J Jason Wang #
Message details and related content
On Sun, Sep 26, 2021 at 11:24 AM Wu Zongyong [off-list ref] wrote:
On Sun, Sep 26, 2021 at 10:24:21AM +0800, Jason Wang wrote:quoted
On Wed, Sep 22, 2021 at 8:47 PM Wu Zongyong [off-list ref] wrote:quoted
This patch adds a new vDPA driver for Alibaba ENI(Elastic Network Interface) which is build upon virtio 0.9.5 specification. And this driver doesn't support to run on BE host. Signed-off-by: Wu Zongyong <redacted> --- drivers/vdpa/Kconfig | 8 + drivers/vdpa/Makefile | 1 + drivers/vdpa/alibaba/Makefile | 3 + drivers/vdpa/alibaba/eni_vdpa.c | 554 ++++++++++++++++++++++++++++++++ 4 files changed, 566 insertions(+) create mode 100644 drivers/vdpa/alibaba/Makefile create mode 100644 drivers/vdpa/alibaba/eni_vdpa.cdiff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig index 3d91982d8371..9587b9177b05 100644 --- a/drivers/vdpa/Kconfig +++ b/drivers/vdpa/Kconfig@@ -78,4 +78,12 @@ config VP_VDPA help This kernel module bridges virtio PCI device to vDPA bus. +config ALIBABA_ENI_VDPA + tristate "vDPA driver for Alibaba ENI" + select VIRTIO_PCI_LEGACY_LIB + depends on PCI_MSI + help + VDPA driver for Alibaba ENI(Elastic Network Interface) which is build upon + virtio 0.9.5 specification. + endif # VDPAdiff --git a/drivers/vdpa/Makefile b/drivers/vdpa/Makefile index f02ebed33f19..15665563a7f4 100644 --- a/drivers/vdpa/Makefile +++ b/drivers/vdpa/Makefile
I think we need to fail FEATURE_OK if F_MRG_RXBUF is not negotiated. Since VERSION_1 requires a fixed header length even if F_MRG_RXBUF is not negotiated. But this trick doesn't come for free. If some driver doesn't support mrg_rxbuf, it won't work. Thanks
quoted
Thanksquoted
+} + +static int eni_vdpa_set_features(struct vdpa_device *vdpa, u64 features) +{ + struct virtio_pci_legacy_device *ldev = vdpa_to_ldev(vdpa); + + vp_legacy_set_features(ldev, (u32)features); + + return 0; +} + +static u8 eni_vdpa_get_status(struct vdpa_device *vdpa) +{ + struct virtio_pci_legacy_device *ldev = vdpa_to_ldev(vdpa); + + return vp_legacy_get_status(ldev); +} + +static int eni_vdpa_get_vq_irq(struct vdpa_device *vdpa, u16 idx) +{ + struct eni_vdpa *eni_vdpa = vdpa_to_eni(vdpa); + int irq = eni_vdpa->vring[idx].irq; + + if (irq == VIRTIO_MSI_NO_VECTOR) + return -EINVAL; + + return irq; +} + +static void eni_vdpa_free_irq(struct eni_vdpa *eni_vdpa) +{ + struct virtio_pci_legacy_device *ldev = &eni_vdpa->ldev; + struct pci_dev *pdev = ldev->pci_dev; + int i; + + for (i = 0; i < eni_vdpa->queues; i++) { + if (eni_vdpa->vring[i].irq != VIRTIO_MSI_NO_VECTOR) {
_______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization