RE: [PATCH v10 vfio 3/7] vfio/pds: register with the pds_core PF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Brett Creeley <brett.creeley@xxxxxxx>
> Sent: Saturday, June 3, 2023 6:03 AM
> 
> +
> +int pds_vfio_register_client_cmd(struct pds_vfio_pci_device *pds_vfio)
> +{
> +	struct pci_dev *pdev = pds_vfio_to_pci_dev(pds_vfio);
> +	char devname[PDS_DEVNAME_LEN];
> +	int ci;
> +
> +	snprintf(devname, sizeof(devname), "%s.%d-%u",
> PDS_LM_DEV_NAME,
> +		 pci_domain_nr(pdev->bus), pds_vfio->pci_id);
> +
> +	ci = pds_client_register(pci_physfn(pdev), devname);
> +	if (ci <= 0)
> +		return ci;

'ci' cannot be 0 since pds_client_register() already converts 0 into
-EIO.

btw the description of pds_client_register() is wrong. It said return
0 on success. should be positive client_id on success.

> 
> +struct pci_dev *pds_vfio_to_pci_dev(struct pds_vfio_pci_device *pds_vfio)
> +{
> +	return pds_vfio->vfio_coredev.pdev;
> +}

Does this wrapper actually save the length?

> 
> +	dev_dbg(&pdev->dev,
> +		"%s: PF %#04x VF %#04x (%d) vf_id %d domain %d
> pds_vfio %p\n",
> +		__func__, pci_dev_id(pdev->physfn), pds_vfio->pci_id,
> +		pds_vfio->pci_id, pds_vfio->vf_id, pci_domain_nr(pdev->bus),
> +		pds_vfio);

why printing pds_vfio->pci_id twice?

> 
> +#define PDS_LM_DEV_NAME		PDS_CORE_DRV_NAME "."
> PDS_DEV_TYPE_LM_STR
> +

should this name include a 'vfio' string?




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux