Re: [PATCH v3 7/7] eni_vdpa: add vDPA driver for Alibaba ENI

Started by Jason Wang on Sep 26, 2021 · 3 messages from 2 authors · Last reply Sep 28, 2021

open the first message on its own page

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.c
diff --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 # VDPA
diff --git a/drivers/vdpa/Makefile b/drivers/vdpa/Makefile
index f02ebed33f19..15665563a7f4 100644
--- a/drivers/vdpa/Makefile
+++ b/drivers/vdpa/Makefile

97 more quoted lines

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
Thanks
quoted
+}
+
+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) {

453 more quoted lines

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Message details and related content
On Sun, Sep 26, 2021 at 12:18:26PM +0800, Jason Wang wrote:
quoted
quoted
I wonder if the following can work with ENI:

-device virtio-net-pci,mrg_rxbuf=off

?
ENI didn't work.
I will remove F_MRG_RXBUF when get_features.
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
Yea. Ugh. Down the road I think we'll add legacy support to vdpa on
strongly ordered systems.  Doing it in userspace is just too messy imho.
But yes, this kind of hack is probably ok for weakly ordered systems.
BTW we need to set VIRTIO_F_ORDER_PLATFORM, right?

-- 
MST

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Message details and related content
On Mon, Sep 27, 2021 at 6:36 PM Michael S. Tsirkin [off-list ref] wrote:
On Sun, Sep 26, 2021 at 12:18:26PM +0800, Jason Wang wrote:
quoted
quoted
quoted
I wonder if the following can work with ENI:

-device virtio-net-pci,mrg_rxbuf=off

?
ENI didn't work.
I will remove F_MRG_RXBUF when get_features.
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
Yea. Ugh. Down the road I think we'll add legacy support to vdpa on
strongly ordered systems.
I don't see the connection, can you explain why?
Doing it in userspace is just too messy imho.
But yes, this kind of hack is probably ok for weakly ordered systems.
BTW we need to set VIRTIO_F_ORDER_PLATFORM, right?
Right.

Thanks
--
MST
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help