:p
atchew
Login
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. Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com> --- net/vhost-vdpa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index XXXXXXX..XXXXXXX 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -XXX,XX +XXX,XX @@ static int vhost_vdpa_net_load_single_vlan(VhostVDPAState *s, struct iovec *in_cursor, uint16_t vid) { + __le16 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, -- 2.34.1
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. Fixes: 8f7e9967484d ("vdpa: Restore vlan filtering state") Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com> Acked-by: Jason Wang <jasowang@redhat.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> --- This patch was reviewed several months ago but was never applied. Resending... Changes in v3: - Add Reviewed-by: Akihiko Odaki. --- net/vhost-vdpa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index XXXXXXX..XXXXXXX 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -XXX,XX +XXX,XX @@ 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, -- 2.34.1