Skip to contentSkip to conversation

vdpa: Allow vDPA to work on big-endian machine

PATCH Superseded Konstantin Shkolnyy 5 participants 12 messages Feb 11, 2025 – Feb 21, 2025 Networking

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vdpa: Allow vDPA to work on big-endian machine

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

---
 net/vhost-vdpa.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/vhost-vdpa.c +6 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
 
 }
 
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
 static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                        Error **errp)
 {
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
         .cleanup = vhost_vdpa_cleanup,
         .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
         .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,
         .check_peer_type = vhost_vdpa_check_peer_type,
         .set_steering_ebpf = vhost_vdpa_set_steering_ebpf,
 };
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

I guess this patch should be merged after
https://lists.nongnu.org/archive/html/qemu-devel/2025-02/msg02290.html
? Actually, it is better to make it a series of patches, isn't it?

Quoted 31 lines
---
 net/vhost-vdpa.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/vhost-vdpa.c +6 -1
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
 
 }
 
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
 static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                        Error **errp)
 {
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
         .cleanup = vhost_vdpa_cleanup,
         .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
         .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,
         .check_peer_type = vhost_vdpa_check_peer_type,
         .set_steering_ebpf = vhost_vdpa_set_steering_ebpf,
 };
--

2.34.1

#2 lore raw
Quoted 7 lines · Eugenio Perez Martin
Quoted 6 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

Quoted 5 lines
Quoted 1 line

I guess this patch should be merged after
https://lists.nongnu.org/archive/html/qemu-devel/2025-02/msg02290.html
? Actually, it is better to make it a series of patches, isn't it?

It doesn't matter if it's before or after. The only (coincidental) connection between these 2 patches is that both are needed for QEMU to enable vDPA on a big-endian machine.

#3 lore raw
In reply to Konstantin Shkolnyy
Quoted 27 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

---
  net/vhost-vdpa.c | 6 ++++++
  1 file changed, 6 insertions(+)
net/vhost-vdpa.c +5 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
 
  }
 
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
  static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                         Error **errp)
  {

net/vhost-vdpa.c static NetClientInfo net_vhost_vdpa_info = { · line 445

Quoted 4 lines
net/vhost-vdpa.c +1 -0
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
          .cleanup = vhost_vdpa_cleanup,
          .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
          .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,

Dubious mismatch with set_vnet_be handler.

Quoted 3 lines
net/vhost-vdpa.c +0 -0
          .check_peer_type = vhost_vdpa_check_peer_type,
          .set_steering_ebpf = vhost_vdpa_set_steering_ebpf,
  };
#4 lore raw
Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 23 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

---
  net/vhost-vdpa.c | 6 ++++++

  1 file changed, 6 insertions(+)
net/vhost-vdpa.c +5 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
   }
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
   static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                          Error **errp)
Quoted 8 lines

net/vhost-vdpa.c static NetClientInfo net_vhost_vdpa_info = { · line 445

Quoted 6 lines
net/vhost-vdpa.c +1 -0
   {
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
           .cleanup = vhost_vdpa_cleanup,
           .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
           .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,

Dubious mismatch with set_vnet_be handler.

I'm not sure what you are suggesting...

#5 lore raw
Quoted 34 lines · Konstantin Shkolnyy
Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 23 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

---
  net/vhost-vdpa.c | 6 ++++++

  1 file changed, 6 insertions(+)
net/vhost-vdpa.c +5 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
   }
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
   static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                          Error **errp)
Quoted 8 lines

net/vhost-vdpa.c static NetClientInfo net_vhost_vdpa_info = { · line 445

Quoted 6 lines
net/vhost-vdpa.c +1 -0
   {
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
           .cleanup = vhost_vdpa_cleanup,
           .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
           .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,

Dubious mismatch with set_vnet_be handler.

Quoted 1 line

I'm not sure what you are suggesting...

Implement set_vnet_le for parity?

#6 lore raw
Quoted 35 lines · Philippe Mathieu-Daudé
Quoted 34 lines · Konstantin Shkolnyy
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

---
  net/vhost-vdpa.c | 6 ++++++

  1 file changed, 6 insertions(+)
net/vhost-vdpa.c +5 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
   }
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
   static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                          Error **errp)
   {

net/vhost-vdpa.c static NetClientInfo net_vhost_vdpa_info = { · line 445

Quoted 4 lines
net/vhost-vdpa.c +1 -0
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
           .cleanup = vhost_vdpa_cleanup,
           .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
           .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,

Dubious mismatch with set_vnet_be handler.

Quoted 3 lines
Quoted 1 line

I'm not sure what you are suggesting...

Implement set_vnet_le for parity?

To my (very limited) knowledge, kernel's vhost_vdpa that QEMU talks to doesn't have an API to "change h/w endianness". If so, vDPA's .set_vnet_le/be(), as well as qemu_set_vnet_le/be() have very limited choices. qemu_set_vnet_le/be() behavior with vDPA was to simply assume that h/w endianness by default matches host's. This assumption is valid for other types of "NetClients" which are implemented in s/w. However, I suspect, vDPA h/w might all be going to be LE, to match virtio 1.0. Such is the NIC I'm dealing with.

My patch is only fixing a specific use case. Perhaps, for a complete fix, qemu_set_vnet_be() also shouldn't unconditionally return success on big endian machines, but always call .set_vnet_be() so that vDPA could fail it? But then it would start calling .set_vnet_be() on other "NetClients" where it didn't before.

That's why I don't want to just add a .set_vnet_be(), before someone here even confirms that vDPA h/w is indeed assumed LE, and, hence, what the right path is to a complete solution...

int qemu_set_vnet_be(NetClientState *nc, bool is_be) {

#if HOST_BIG_ENDIAN
    return 0;
#else
    if (!nc || !nc->info->set_vnet_be)
        return -ENOSYS;

    return nc->info->set_vnet_be(nc, is_be);

#endif
}

#7 lore raw
Quoted 55 lines · Konstantin Shkolnyy
Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 35 lines · Konstantin Shkolnyy
Quoted 33 lines · Philippe Mathieu-Daudé
Quoted 26 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

---
  net/vhost-vdpa.c | 6 ++++++

  1 file changed, 6 insertions(+)
net/vhost-vdpa.c +5 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState 
 *nc)
   }
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
   static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                          Error **errp)
   {

net/vhost-vdpa.c static NetClientInfo net_vhost_vdpa_info = { · line 445

Quoted 4 lines
net/vhost-vdpa.c +1 -0
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
           .cleanup = vhost_vdpa_cleanup,
           .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
           .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,

Dubious mismatch with set_vnet_be handler.

Quoted 3 lines
Quoted 1 line

I'm not sure what you are suggesting...

Implement set_vnet_le for parity?

To my (very limited) knowledge, kernel's vhost_vdpa that QEMU talks to doesn't have an API to "change h/w endianness". If so, vDPA's .set_vnet_le/be(), as well as qemu_set_vnet_le/be() have very limited choices. qemu_set_vnet_le/be() behavior with vDPA was to simply assume that h/w endianness by default matches host's. This assumption is valid for other types of "NetClients" which are implemented in s/w. However, I suspect, vDPA h/w might all be going to be LE, to match virtio 1.0. Such is the NIC I'm dealing with.

My patch is only fixing a specific use case. Perhaps, for a complete fix, qemu_set_vnet_be() also shouldn't unconditionally return success on big endian machines, but always call .set_vnet_be() so that vDPA could fail it? But then it would start calling .set_vnet_be() on other "NetClients" where it didn't before.

That's why I don't want to just add a .set_vnet_be(), before someone here even confirms that vDPA h/w is indeed assumed LE, and, hence, what the right path is to a complete solution...

int qemu_set_vnet_be(NetClientState *nc, bool is_be) {
#if HOST_BIG_ENDIAN
    return 0;
#else
    if (!nc || !nc->info->set_vnet_be) return -ENOSYS;

Quoted 4 lines

    return nc->info->set_vnet_be(nc, is_be);
#endif
}

Does anyone have any answers/suggestions?

#8 lore raw

Hi Konstantin,

(Cc'ing more developers)

Quoted 56 lines · Konstantin Shkolnyy
Quoted 55 lines · Konstantin Shkolnyy
Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 35 lines · Konstantin Shkolnyy
Quoted 33 lines · Philippe Mathieu-Daudé
Quoted 26 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

---
  net/vhost-vdpa.c | 6 ++++++

  1 file changed, 6 insertions(+)
net/vhost-vdpa.c +5 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState 
 *nc)
   }
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
   static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                          Error **errp)
   {

net/vhost-vdpa.c static NetClientInfo net_vhost_vdpa_info = { · line 445

Quoted 4 lines
net/vhost-vdpa.c +1 -0
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
           .cleanup = vhost_vdpa_cleanup,
           .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
           .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,

Dubious mismatch with set_vnet_be handler.

Quoted 3 lines
Quoted 1 line

I'm not sure what you are suggesting...

Implement set_vnet_le for parity?

To my (very limited) knowledge, kernel's vhost_vdpa that QEMU talks to doesn't have an API to "change h/w endianness". If so, vDPA's .set_vnet_le/be(), as well as qemu_set_vnet_le/be() have very limited choices. qemu_set_vnet_le/be() behavior with vDPA was to simply assume that h/w endianness by default matches host's. This assumption is valid for other types of "NetClients" which are implemented in s/w. However, I suspect, vDPA h/w might all be going to be LE, to match virtio 1.0. Such is the NIC I'm dealing with.

My patch is only fixing a specific use case. Perhaps, for a complete fix, qemu_set_vnet_be() also shouldn't unconditionally return success on big endian machines, but always call .set_vnet_be() so that vDPA could fail it? But then it would start calling .set_vnet_be() on other "NetClients" where it didn't before.

That's why I don't want to just add a .set_vnet_be(), before someone here even confirms that vDPA h/w is indeed assumed LE, and, hence, what the right path is to a complete solution...

int qemu_set_vnet_be(NetClientState *nc, bool is_be) {
#if HOST_BIG_ENDIAN
     return 0;
#else
     if (!nc || !nc->info->set_vnet_be) return -ENOSYS;

Quoted 7 lines
Quoted 4 lines

     return nc->info->set_vnet_be(nc, is_be);
#endif
}

Does anyone have any answers/suggestions?

Since you mentioned "vDPA h/w always implements LE data format", I'd expect virtio_is_big_endian(vdev) always return FALSE, and thus this to be safe:

static int vhost_vdpa_set_vnet_be(NetClientState *nc, bool is_le)

 {
     g_assert_not_reached();

}

But I don't know much about vDPA, so I won't object to your patch.

Regards,

Phil.

#9 lore raw
Quoted 70 lines · Philippe Mathieu-Daudé

Hi Konstantin,

(Cc'ing more developers)

Quoted 64 lines · Konstantin Shkolnyy
Quoted 63 lines · Konstantin Shkolnyy
Quoted 40 lines · Philippe Mathieu-Daudé
Quoted 39 lines · Konstantin Shkolnyy
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that
vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and
outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

---
  net/vhost-vdpa.c | 6 ++++++
  1 file changed, 6 insertions(+)
net/vhost-vdpa.c +5 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState
 *nc)
  }
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;
+}
+
  static bool vhost_vdpa_check_peer_type(NetClientState *nc,
 ObjectClass *oc,
                                         Error **errp)
  {

net/vhost-vdpa.c static NetClientInfo net_vhost_vdpa_info = { · line 445

Quoted 4 lines
net/vhost-vdpa.c +1 -0
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
          .cleanup = vhost_vdpa_cleanup,
          .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
          .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,

Dubious mismatch with set_vnet_be handler.

Quoted 3 lines
Quoted 1 line

I'm not sure what you are suggesting...

Implement set_vnet_le for parity?

To my (very limited) knowledge, kernel's vhost_vdpa that QEMU talks to doesn't have an API to "change h/w endianness". If so, vDPA's .set_vnet_le/be(), as well as qemu_set_vnet_le/be() have very limited choices. qemu_set_vnet_le/be() behavior with vDPA was to simply assume that h/w endianness by default matches host's. This assumption is valid for other types of "NetClients" which are implemented in s/w. However, I suspect, vDPA h/w might all be going to be LE, to match virtio 1.0. Such is the NIC I'm dealing with.

My patch is only fixing a specific use case. Perhaps, for a complete fix, qemu_set_vnet_be() also shouldn't unconditionally return success on big endian machines, but always call .set_vnet_be() so that vDPA could fail it? But then it would start calling .set_vnet_be() on other "NetClients" where it didn't before.

That's why I don't want to just add a .set_vnet_be(), before someone here even confirms that vDPA h/w is indeed assumed LE, and, hence, what the right path is to a complete solution...

Note that modern (VERION_1) virtio/vDPA device assumes LE. Transitional devices need to support "native endian" which requires the interface like what you suggest here when guest and host endian are different.

But we need to confirm with the vDPA vendors to know if their device is modern only or transitional.

E.g by looking at mlx5_vdpa drivers, it seems to support big endian:

/* TODO: cross-endian support */
static inline bool mlx5_vdpa_is_little_endian(struct mlx5_vdpa_dev *mvdev)

{
        return virtio_legacy_is_little_endian() ||
                (mvdev->actual_features & BIT_ULL(VIRTIO_F_VERSION_1));
}

But it needs to judge the endian according to what userspace tells us (as the "TODO"), we probably need to invent new vDPA ioctls for that besides the Qemu modifications.

Adding Dragos for more thought here.

Thanks

Quoted 32 lines
Quoted 9 lines
Quoted 9 lines

int qemu_set_vnet_be(NetClientState *nc, bool is_be) {

#if HOST_BIG_ENDIAN
     return 0;
#else
     if (!nc || !nc->info->set_vnet_be)
         return -ENOSYS;
Quoted 7 lines
Quoted 4 lines
     return nc->info->set_vnet_be(nc, is_be);

#endif
}

Does anyone have any answers/suggestions?

Since you mentioned "vDPA h/w always implements LE data format", I'd expect virtio_is_big_endian(vdev) always return FALSE, and thus this to be safe:

  static int vhost_vdpa_set_vnet_be(NetClientState *nc, bool is_le)
  {
      g_assert_not_reached();
  }

But I don't know much about vDPA, so I won't object to your patch.

Regards,

Phil.

#10 lore raw
In reply to Konstantin Shkolnyy
Quoted 6 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

Thanks for the patch! Yet something to improve:

Quoted 9 lines
---
 net/vhost-vdpa.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/vhost-vdpa.c +0 -0
index 231b45246c..7219aa2eee 100644

net/vhost-vdpa.c static bool vhost_vdpa_has_ufo(NetClientState *nc) · line 275

Quoted 6 lines
net/vhost-vdpa.c +3 -0
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
 
 }
 
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;

How about checking is_le is true then?
And add a code comment with an explanation, please.

Quoted 15 lines
net/vhost-vdpa.c +3 -0
+}
+
 static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
                                        Error **errp)
 {
@@ -437,6 +442,7 @@ static NetClientInfo net_vhost_vdpa_info = {
         .cleanup = vhost_vdpa_cleanup,
         .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
         .has_ufo = vhost_vdpa_has_ufo,
+        .set_vnet_le = vhost_vdpa_set_vnet_le,
         .check_peer_type = vhost_vdpa_check_peer_type,
         .set_steering_ebpf = vhost_vdpa_set_steering_ebpf,
 };
Signature · 1 line
2.34.1
#11 lore raw
Quoted 21 lines · Michael S. Tsirkin
Quoted 6 lines · Konstantin Shkolnyy

Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

Thanks for the patch! Yet something to improve:

Quoted 10 lines
---
  net/vhost-vdpa.c | 6 ++++++
  1 file changed, 6 insertions(+)
net/vhost-vdpa.c +0 -0
index 231b45246c..7219aa2eee 100644
@@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
 
Quoted 7 lines

net/vhost-vdpa.c static bool vhost_vdpa_has_ufo(NetClientState *nc) · line 275

Quoted 5 lines
net/vhost-vdpa.c +3 -0
  }
 
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
+{
+    return 0;

How about checking is_le is true then?

As I understand, the control comes here from virtio_net_set_vnet_endian(...., bool enable). That "enable" is copied into the "is_le" here. Thus, it doesn't look like "is_le = false" means BE. Rather, it looks like it means "default endianness of the NetClient". If so, the function should probably just return 0 in both cases.

I think, that is also why we have .set_vnet_le() and .set_vnet_be() instead of just one function.

If the above is correct, maybe I should rename "is_le" into "enable"? (I simply copied the name from another function...)

Quoted 1 line

And add a code comment with an explanation, please.

Sure.