vdpa: Allow VDPA to work on big-endian machine
PATCH v2 1/1 vdpa: Allow VDPA to work on big-endian machine
After commit 0caed25cd171 vhost_vdpa_net_load_vlan() started seeing VIRTIO_NET_F_CTRL_VLAN flag and making 4096 calls to the kernel with VIRTIO_NET_CTRL_VLAN_ADD command. However, it forgot to convert the 16-bit VLAN IDs to LE format. On BE machine, the kernel calls failed when they saw "VLAN IDs" greater than 4095, and QEMU then said:
"unable to start vhost net: 5: falling back on userspace virtio", and VDPA became disabled.
Convert the VLAN ID to LE before putting it into virtio queue.
---
Changes in v2:
- Replace __le16 with uint16_t.
- Add "Fixes:" tag.
net/vhost-vdpa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/vhost-vdpa.c +3 -2
@@ -1173,9 +1173,10 @@ static int vhost_vdpa_net_load_single_vlan(VhostVDPAState *s,struct iovec *in_cursor, uint16_t vid) { + uint16_t vid_le = cpu_to_le16(vid);const struct iovec data = { - .iov_base = &vid, - .iov_len =sizeof (vid), + .iov_base = &vid_le, + .iov_len =sizeof (vid_le), }; ssize_t r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, VIRTIO_NET_CTRL_VLAN,
Signature · 1 line
2.34.1
Quoted 8 lines · Konstantin Shkolnyy
After commit
0caed25cd171vhost_vdpa_net_load_vlan()started seeingVIRTIO_NET_F_CTRL_VLANflag and making 4096 calls to the kernel withVIRTIO_NET_CTRL_VLAN_ADDcommand. However, it forgot to convert the 16-bit VLAN IDs to LE format. On BE machine, the kernel calls failed when they saw "VLAN IDs" greater than 4095, and QEMU then said:
"unable to start vhost net: 5: falling back on userspace virtio", and VDPA became disabled.
Quoted 6 lines
Convert the VLAN ID to LE before putting it into virtio queue.
Fixes 8f7e9967484d ("vdpa: Restore vlan filtering state")Signed-off-by Konstantin Shkolnyy <[email protected]>Acked-by Jason Wang <[email protected]>Acked-by Eugenio Pérez <[email protected]>
Quoted 9 lines · Akihiko Odaki
Quoted 8 lines · Konstantin Shkolnyy
After commit
0caed25cd171vhost_vdpa_net_load_vlan()started seeingVIRTIO_NET_F_CTRL_VLANflag and making 4096 calls to the kernel withVIRTIO_NET_CTRL_VLAN_ADDcommand. However, it forgot to convert the 16-bit VLAN IDs to LE format. On BE machine, the kernel calls failed when they saw "VLAN IDs" greater than 4095, and QEMU then said:
"unable to start vhost net: 5: falling back on userspace virtio", and VDPA became disabled.
Quoted 8 lines
Quoted 6 lines
Convert the VLAN ID to LE before putting it into virtio queue.
Fixes 8f7e9967484d ("vdpa: Restore vlan filtering state")Signed-off-by Konstantin Shkolnyy <[email protected]>Acked-by Jason Wang <[email protected]>Acked-by Eugenio Pérez <[email protected]>Reviewed-by Akihiko Odaki <[email protected]>
Was this patch missed or there was another reason it wasn't applied?
Quoted 13 lines · Konstantin Shkolnyy
Quoted 11 lines · Akihiko Odaki
Quoted 10 lines · Konstantin Shkolnyy
After commit
0caed25cd171vhost_vdpa_net_load_vlan()started seeingVIRTIO_NET_F_CTRL_VLANflag and making 4096 calls to the kernel withVIRTIO_NET_CTRL_VLAN_ADDcommand. However, it forgot to convert the 16-bit VLAN IDs to LE format. On BE machine, the kernel calls failed when they saw "VLAN IDs" greater than 4095, and QEMU then said:
"unable to start vhost net: 5: falling back on userspace virtio", and VDPA became disabled.Convert the VLAN ID to LE before putting it into virtio queue.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Fixes 8f7e9967484d ("vdpa: Restore vlan filtering state")Signed-off-by Konstantin Shkolnyy <[email protected]>Acked-by Jason Wang <[email protected]>Acked-by Eugenio Pérez <[email protected]>Reviewed-by Akihiko Odaki <[email protected]>Was this patch missed or there was another reason it wasn't applied?
Adding Michael.
Thanks