lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <abe284e0-7f0a-2cca-04ad-ef69fa1cc1d7@redhat.com>
Date:   Fri, 9 Jul 2021 10:29:38 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Zhu Lingshan <lingshan.zhu@...el.com>, mst@...hat.com
Cc:     virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
        kvm@...r.kernel.org
Subject: Re: [PATCH V3 1/2] vDPA/ifcvf: introduce get_dev_type() which returns
 virtio dev id


在 2021/7/6 上午10:36, Zhu Lingshan 写道:
> This commit introduces a new function get_dev_type() which returns
> the virtio device id of a device, to avoid duplicated code.
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@...el.com>


Acked-by: Jason Wang <jasowang@...hat.com>


> ---
>   drivers/vdpa/ifcvf/ifcvf_main.c | 34 ++++++++++++++++++++-------------
>   1 file changed, 21 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index bc1d59f316d1..5f70ab1283a0 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -442,6 +442,26 @@ static const struct vdpa_config_ops ifc_vdpa_ops = {
>   	.set_config_cb  = ifcvf_vdpa_set_config_cb,
>   };
>   
> +static u32 get_dev_type(struct pci_dev *pdev)
> +{
> +	u32 dev_type;
> +
> +	/* This drirver drives both modern virtio devices and transitional
> +	 * devices in modern mode.
> +	 * vDPA requires feature bit VIRTIO_F_ACCESS_PLATFORM,
> +	 * so legacy devices and transitional devices in legacy
> +	 * mode will not work for vDPA, this driver will not
> +	 * drive devices with legacy interface.
> +	 */
> +
> +	if (pdev->device < 0x1040)
> +		dev_type =  pdev->subsystem_device;
> +	else
> +		dev_type =  pdev->device - 0x1040;
> +
> +	return dev_type;
> +}
> +
>   static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   {
>   	struct device *dev = &pdev->dev;
> @@ -486,19 +506,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   	pci_set_drvdata(pdev, adapter);
>   
>   	vf = &adapter->vf;
> -
> -	/* This drirver drives both modern virtio devices and transitional
> -	 * devices in modern mode.
> -	 * vDPA requires feature bit VIRTIO_F_ACCESS_PLATFORM,
> -	 * so legacy devices and transitional devices in legacy
> -	 * mode will not work for vDPA, this driver will not
> -	 * drive devices with legacy interface.
> -	 */
> -	if (pdev->device < 0x1040)
> -		vf->dev_type =  pdev->subsystem_device;
> -	else
> -		vf->dev_type =  pdev->device - 0x1040;
> -
> +	vf->dev_type = get_dev_type(pdev);
>   	vf->base = pcim_iomap_table(pdev);
>   
>   	adapter->pdev = pdev;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ