[dpdk-dev] [PATCH v5 3/4] net/ifcvf: add ifcvf vdpa driver

Ferruh Yigit ferruh.yigit at intel.com
Wed Apr 11 20:58:29 CEST 2018


On 4/5/2018 7:07 PM, Xiao Wang wrote:
> The IFCVF vDPA (vhost data path acceleration) driver provides support for
> the Intel FPGA 100G VF (IFCVF). IFCVF's datapath is virtio ring compatible,
> it works as a HW vhost backend which can send/receive packets to/from
> virtio directly by DMA.
> 
> Different VF devices serve different virtio frontends which are in
> different VMs, so each VF needs to have its own DMA address translation
> service. During the driver probe a new container is created, with this
> container vDPA driver can program DMA remapping table with the VM's memory
> region information.
> 
> Key vDPA driver ops implemented:
> 
> - ifcvf_dev_config:
>   Enable VF data path with virtio information provided by vhost lib,
>   including IOMMU programming to enable VF DMA to VM's memory, VFIO
>   interrupt setup to route HW interrupt to virtio driver, create notify
>   relay thread to translate virtio driver's kick to a MMIO write onto HW,
>   HW queues configuration.
> 
> - ifcvf_dev_close:
>   Revoke all the setup in ifcvf_dev_config.
> 
> Live migration feature is supported by IFCVF and this driver enables
> it. For the dirty page logging, VF helps to log for packet buffer write,
> driver helps to make the used ring as dirty when device stops.
> 
> Because vDPA driver needs to set up MSI-X vector to interrupt the
> guest, only vfio-pci is supported currently.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang at intel.com>
> Signed-off-by: Rosen Xu <rosen.xu at intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
> ---
>  config/common_base                    |   7 +
>  config/common_linuxapp                |   1 +
>  drivers/net/Makefile                  |   3 +
>  drivers/net/ifc/Makefile              |  36 ++
>  drivers/net/ifc/base/ifcvf.c          | 329 +++++++++++++
>  drivers/net/ifc/base/ifcvf.h          | 160 +++++++
>  drivers/net/ifc/base/ifcvf_osdep.h    |  52 +++
>  drivers/net/ifc/ifcvf_vdpa.c          | 840 ++++++++++++++++++++++++++++++++++
>  drivers/net/ifc/rte_ifcvf_version.map |   4 +
>  mk/rte.app.mk                         |   3 +
>  10 files changed, 1435 insertions(+)
>  create mode 100644 drivers/net/ifc/Makefile
>  create mode 100644 drivers/net/ifc/base/ifcvf.c
>  create mode 100644 drivers/net/ifc/base/ifcvf.h
>  create mode 100644 drivers/net/ifc/base/ifcvf_osdep.h
>  create mode 100644 drivers/net/ifc/ifcvf_vdpa.c
>  create mode 100644 drivers/net/ifc/rte_ifcvf_version.map
> 
> diff --git a/config/common_base b/config/common_base
> index 2c40b2603..5d4f9e75c 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -796,6 +796,13 @@ CONFIG_RTE_LIBRTE_VHOST_DEBUG=n
>  #
>  CONFIG_RTE_LIBRTE_PMD_VHOST=n
>  
> +#
> +# Compile IFCVF driver
> +# To compile, CONFIG_RTE_LIBRTE_VHOST and CONFIG_RTE_EAL_VFIO
> +# should be enabled.
> +#
> +CONFIG_RTE_LIBRTE_IFCVF_VDPA=n

I believe better to keep "PMD" in config option for consistency:
CONFIG_RTE_LIBRTE_IFCVF_VDPA_PMD
And add this into PMD section of the doc.

<...>

> +/*
> + * The set of PCI devices this driver supports.
> + */
> +static const struct rte_pci_id pci_id_ifcvf_map[] = {
> +	{ .class_id = RTE_CLASS_ANY_ID,
> +	  .vendor_id = IFCVF_VENDOR_ID,
> +	  .device_id = IFCVF_DEVICE_ID,
> +	  .subsystem_vendor_id = IFCVF_SUBSYS_VENDOR_ID,
> +	  .subsystem_device_id = IFCVF_SUBSYS_DEVICE_ID,

Can be good to add comment that these can be same with virtio device id to
clarify this is known/expected.

> +	},
> +
> +	{ .vendor_id = 0, /* sentinel */
> +	},
> +};
> +
> +static struct rte_pci_driver rte_ifcvf_vdpa = {
> +	.driver = {
> +		.name = "net_ifcvf",
> +	},

No need to set name, already done by RTE_PMD_REGISTER_PCI

<...>

> +RTE_INIT(ifcvf_vdpa_init_log);
> +static void
> +ifcvf_vdpa_init_log(void)
> +{
> +	ifcvf_vdpa_logtype = rte_log_register("net.ifcvf_vdpa");

latest format is "pmd.net.ifcvf_vdpa"


More information about the dev mailing list