Skip to contentSkip to conversation

virtio-net VLAN filtering bug

Qemu-devel In review Stefan Fritsch 4 participants 11 messages Feb 5, 2014 – Mar 25, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

if the feature VIRTIO_NET_F_CTRL_VLAN is not negotiated, virtio-net should not filter VLANs. That means it should send all packets to the guest instead of dropping all packets that have any VLAN id. The following patch fixes the issue.

Cheers,
Stefan

hw/net/virtio-net.c +9 -1
@@ -312,13 +312,16 @@ static void virtio_net_reset(VirtIODevice *vdev)
     n->mac_table.first_multi = 0;
     n->mac_table.multi_overflow = 0;
     n->mac_table.uni_overflow = 0;
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
     memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
     qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
-    memset(n->vlans, 0, MAX_VLAN >> 3);
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN))
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    else
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
 }
 
 static void peer_test_vnet_hdr(VirtIONet *n)
 {
     NetClientState *nc = qemu_get_queue(n->nic);
     if (!nc->peer) {
@@ -512,12 +515,17 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
         }
         if (!tap_get_vhost_net(nc->peer)) {
             continue;
         }
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
     }
+
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN))
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    else
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
                                      struct iovec *iov, unsigned int iov_cnt)
 {
     uint8_t on;
#1 lore raw

PATCH 1/1 virtio-net: Do not filter VLANs without F_CTRL_VLAN

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all VLAN-tagged packets but send them to the guest.

---

This time CCing the maintainers.

This fixes VLANs with OpenBSD guests (and probably NetBSD, too, because the OpenBSD driver started as a port from NetBSD).

 hw/net/virtio-net.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +11 -1
index 3626608..0ae9a91 100644
@@ -315,7 +315,11 @@ static void virtio_net_reset(VirtIODevice *vdev)
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
     memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
     qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
-    memset(n->vlans, 0, MAX_VLAN >> 3);
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static void peer_test_vnet_hdr(VirtIONet *n)
@@ -515,6 +519,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
         }
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
     }
+
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

Quoted 4 lines · Stefan Fritsch

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all VLAN-tagged packets but send them to the guest.

Thanks for the patch.
I think there are still some issues after this
patch: we need to notify management when
this bit state changes.
And I think libvirt still does not look at the filter info so it's probably not too late, and cleaner to simply tell it:
"all-vlans".
that is, add
'*vlan': 'RxState',
to the schema.

(is it true that it needs to be * because old qemu does not produce it?
maybe not ...)

Taking all this into account - this calls for checking this bit in receive_filter like we do for e.g. unicast addresses.

Amos, you wrote
commit b1be42803b31a913bab65bab563a8760ad2e7f7f

Author: Amos Kong <[email protected]>
Date:   Fri Jun 14 15:45:52 2013 +0800

net: add support of mac-programming over macvtap in QEMU side
which conflicts here - could you take a look please?

Also Cc schema maintainers.

Quoted 18 lines

---

This time CCing the maintainers.

This fixes VLANs with OpenBSD guests (and probably NetBSD, too, because the OpenBSD driver started as a port from NetBSD).

 hw/net/virtio-net.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +0 -0
index 3626608..0ae9a91 100644
@@ -315,7 +315,11 @@ static void virtio_net_reset(VirtIODevice *vdev)
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
     memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));

hw/net/virtio-net.c static void virtio_net_reset(VirtIODevice *vdev) · line 325

Quoted 10 lines
hw/net/virtio-net.c +5 -1
     qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
-    memset(n->vlans, 0, MAX_VLAN >> 3);
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static void peer_test_vnet_hdr(VirtIONet *n)

This chunk doesn't make sense to me.
features are never set at reset, are they?

Quoted 15 lines
hw/net/virtio-net.c +6 -0
@@ -515,6 +519,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
         }
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
     }
+
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.10.4
#3 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

Quoted 17 lines · Michael S. Tsirkin
Quoted 4 lines · Stefan Fritsch

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all VLAN-tagged packets but send them to the guest.

Thanks for the patch.
I think there are still some issues after this
patch: we need to notify management when
this bit state changes.
And I think libvirt still does not look at the filter info so it's probably not too late, and cleaner to simply tell it:
"all-vlans".
that is, add
'*vlan': 'RxState',
to the schema.

Quoted 2 lines

(is it true that it needs to be * because old qemu does not produce it?
maybe not ...)

The following conversions are back-compat safe:

changing an input parameter from mandatory to optional adding an optional input parameter
changing an output parameter from optional to mandatory adding an output parameter (optional or always-present)

Regarding whether a parameter must be marked as optional: on input, optional means the user can omit it. On output, marking it as optional means the current version of qemu will sometimes generate it, and sometimes avoid it. If qemu always generates it in the current version, even if it was not generated in an previous version, then an output parameter does not have to be marked optional (that is, behavior of previous qemu versions should not impact the choice of whether the current qemu marks an output as optional - only whether the current qemu sometimes omits the parameter). However, once an output parameter is marked mandatory, you must never remove it in future qemu versions.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#4 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

In reply to Michael S. Tsirkin
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines · Stefan Fritsch

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all VLAN-tagged packets but send them to the guest.

Quoted 10 lines

Thanks for the patch.
I think there are still some issues after this
patch: we need to notify management when
this bit state changes.
And I think libvirt still does not look at the filter info so it's probably not too late, and cleaner to simply tell it:
"all-vlans".
that is, add
'*vlan': 'RxState',
to the schema.

I am not familiar with these interfaces and can't comment on that.

Quoted 16 lines
Quoted 16 lines
hw/net/virtio-net.c +5 -1
index 3626608..0ae9a91 100644
@@ -315,7 +315,11 @@ static void virtio_net_reset(VirtIODevice *vdev)
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
     memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
     qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
-    memset(n->vlans, 0, MAX_VLAN >> 3);
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
Quoted 4 lines

hw/net/virtio-net.c static void virtio_net_reset(VirtIODevice *vdev) · line 325

Quoted 1 line
hw/net/virtio-net.c +0 -0
 static void peer_test_vnet_hdr(VirtIONet *n)

This chunk doesn't make sense to me. features are never set at reset, are they?

You are right. This chunk is not necessary. I have checked that the second chunk alone fixes the issue.

Quoted 12 lines
Quoted 12 lines
hw/net/virtio-net.c +6 -0
@@ -515,6 +519,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
         }
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
     }
+
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
Quoted 4 lines
Quoted 3 lines
hw/net/virtio-net.c +0 -0
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.10.4

Cheers,
Stefan

#5 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

In reply to Stefan Fritsch
Quoted 2 lines · Stefan Fritsch

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all VLAN-tagged packets but send them to the guest.

Can we just update receive_filter() to filter out VLAN-tagged packets only when VIRTIO_NET_F_CTRL_VLAN is negotiated?

@@ -913,7 +940,8 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)

     if (!memcmp(&ptr[12], vlan, sizeof(vlan))) {
         int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff;
-        if (!(n->vlans[vid >> 5] & (1U << (vid & 0x1f))))
+        if ((vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) &&
+            !(n->vlans[vid >> 5] & (1U << (vid & 0x1f))))
             return 0;
     }
Quoted 44 lines

---

This time CCing the maintainers.

This fixes VLANs with OpenBSD guests (and probably NetBSD, too, because the OpenBSD driver started as a port from NetBSD).

 hw/net/virtio-net.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +11 -1
index 3626608..0ae9a91 100644
@@ -315,7 +315,11 @@ static void virtio_net_reset(VirtIODevice *vdev)
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
     memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
     qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
-    memset(n->vlans, 0, MAX_VLAN >> 3);
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static void peer_test_vnet_hdr(VirtIONet *n)
@@ -515,6 +519,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
         }
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
     }
+
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.10.4
Signature · 1 line
			Amos.
#6 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

Quoted 6 lines · Amos Kong
Quoted 2 lines · Stefan Fritsch

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all VLAN-tagged packets but send them to the guest.

Can we just update receive_filter() to filter out VLAN-tagged packets only when VIRTIO_NET_F_CTRL_VLAN is negotiated?

We could. But this adds a (very small) per-packet overhead while my patch only adds overhead during reset. Therefore I didn't take that approach. But if changing receive_filter() makes management much easier, that could be acceptable.

Quoted 60 lines
(quoted diff) +2 -1
@@ -913,7 +940,8 @@ static int receive_filter(VirtIONet
 *n, const uint8_t *buf, int size)
 
     if (!memcmp(&ptr[12], vlan, sizeof(vlan))) {
         int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff;
-        if (!(n->vlans[vid >> 5] & (1U << (vid & 0x1f))))
+        if ((vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) &&
+            !(n->vlans[vid >> 5] & (1U << (vid & 0x1f))))
             return 0;
     }
Quoted 45 lines

---

This time CCing the maintainers.

This fixes VLANs with OpenBSD guests (and probably NetBSD, too, because the OpenBSD driver started as a port from NetBSD).

 hw/net/virtio-net.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +11 -1
index 3626608..0ae9a91 100644
@@ -315,7 +315,11 @@ static void virtio_net_reset(VirtIODevice *vdev)
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
     memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
     qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
-    memset(n->vlans, 0, MAX_VLAN >> 3);
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static void peer_test_vnet_hdr(VirtIONet *n)
@@ -515,6 +519,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
         }
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
     }
+
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.10.4
Signature · 1 line
			Amos.
#7 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

Quoted 8 lines · Stefan Fritsch
Quoted 6 lines · Amos Kong
Quoted 2 lines · Stefan Fritsch

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all VLAN-tagged packets but send them to the guest.

Can we just update receive_filter() to filter out VLAN-tagged packets only when VIRTIO_NET_F_CTRL_VLAN is negotiated?

If we change receive_filter(), we also need a flag to indicate management this feature isn't negotiated, management will do some additional operation to host device to get same effect.

Quoted 4 lines

We could. But this adds a (very small) per-packet overhead while my patch only adds overhead during reset. Therefore I didn't take that approach. But if changing receive_filter() makes management much easier, that could be acceptable.

Actually your solution is better, QEMU will return a long list [0,1,2,...4095] to management, host device will filter all the vlan packets and send to QEMU.

So the problem raised by mst doesn't exist.

Thanks, Amos

Quoted 59 lines
Quoted 59 lines
(quoted diff) +2 -1
@@ -913,7 +940,8 @@ static int receive_filter(VirtIONet
 *n, const uint8_t *buf, int size)
 
     if (!memcmp(&ptr[12], vlan, sizeof(vlan))) {
         int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff;
-        if (!(n->vlans[vid >> 5] & (1U << (vid & 0x1f))))
+        if ((vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) &&
+            !(n->vlans[vid >> 5] & (1U << (vid & 0x1f))))
             return 0;
     }
Quoted 45 lines

---

This time CCing the maintainers.

This fixes VLANs with OpenBSD guests (and probably NetBSD, too, because the OpenBSD driver started as a port from NetBSD).

 hw/net/virtio-net.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +11 -1
index 3626608..0ae9a91 100644
@@ -315,7 +315,11 @@ static void virtio_net_reset(VirtIODevice *vdev)
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
     memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
     qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
-    memset(n->vlans, 0, MAX_VLAN >> 3);
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static void peer_test_vnet_hdr(VirtIONet *n)
@@ -515,6 +519,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
         }
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
     }
+
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN)) {
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    } else {
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
+    }
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.10.4
Signature · 1 line
			Amos.
Signature · 1 line
			Amos.
#8 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

Hi,

Am Dienstag, 25. Februar 2014, 11:06:33 schrieb Amos Kong:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines · Stefan Fritsch
Quoted 3 lines

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all
VLAN-tagged packets but send them to the guest.

AFAICS, no fix has been committed, yet. Is there anything I need to do to get this fixed?

Quoted 13 lines
Quoted 2 lines
Quoted 2 lines

Can we just update receive_filter() to filter out VLAN-tagged packets only when VIRTIO_NET_F_CTRL_VLAN is negotiated?

If we change receive_filter(), we also need a flag to indicate management this feature isn't negotiated, management will do some additional operation to host device to get same effect.

Quoted 4 lines

We could. But this adds a (very small) per-packet overhead while my patch only adds overhead during reset. Therefore I didn't take that approach. But if changing receive_filter() makes management much easier, that could be acceptable.

Quoted 5 lines

Actually your solution is better, QEMU will return a long list [0,1,2,...4095] to management, host device will filter all the vlan packets and send to QEMU.

So the problem raised by mst doesn't exist.

Cheers,
Stefan

#9 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

Quoted 11 lines · Stefan Fritsch

Hi,

Am Dienstag, 25. Februar 2014, 11:06:33 schrieb Amos Kong:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines · Stefan Fritsch
Quoted 3 lines

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all
VLAN-tagged packets but send them to the guest.

AFAICS, no fix has been committed, yet. Is there anything I need to do to get this fixed?

Michael asked in IRC to continually add a RxState for vlan in RxFilter notification through QMP events.

(sorry I didn't talk too much becaused I'm in meeting)

I mentioned in [1] [2], we don't need to add this new state if we apply patch Stefan's patch[3]

Michael said Stefan's fix is wrong, but the problem exists. The problem is the bug fixed by [3], not the problem that was mentioned in [4]

Michael, what's wrong with Stefan's patch?

Thanks, Amos

[1] http://lists.gnu.org/archive/html/qemu-devel/2014-02/msg03835.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg04434.html
[3] virtio-net: Do not filter VLANs without F_CTRL_VLAN
[4] https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02604.html

Quoted 22 lines
Quoted 13 lines
Quoted 2 lines
Quoted 2 lines

Can we just update receive_filter() to filter out VLAN-tagged packets only when VIRTIO_NET_F_CTRL_VLAN is negotiated?

If we change receive_filter(), we also need a flag to indicate management this feature isn't negotiated, management will do some additional operation to host device to get same effect.

Quoted 4 lines

We could. But this adds a (very small) per-packet overhead while my patch only adds overhead during reset. Therefore I didn't take that approach. But if changing receive_filter() makes management much easier, that could be acceptable.

Quoted 5 lines

Actually your solution is better, QEMU will return a long list [0,1,2,...4095] to management, host device will filter all the vlan packets and send to QEMU.

So the problem raised by mst doesn't exist.

Cheers,
Stefan

Signature · 1 line
			Amos.
#10 lore raw

Re: [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN

Quoted 29 lines · Amos Kong
Quoted 11 lines · Stefan Fritsch

Hi,

Am Dienstag, 25. Februar 2014, 11:06:33 schrieb Amos Kong:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines · Stefan Fritsch
Quoted 3 lines

If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all
VLAN-tagged packets but send them to the guest.

AFAICS, no fix has been committed, yet. Is there anything I need to do to get this fixed?

Michael asked in IRC to continually add a RxState for vlan in RxFilter notification through QMP events.

(sorry I didn't talk too much becaused I'm in meeting)

I mentioned in [1] [2], we don't need to add this new state if we apply patch Stefan's patch[3]

Michael said Stefan's fix is wrong, but the problem exists. The problem is the bug fixed by [3], not the problem that was mentioned in [4]

Michael, what's wrong with Stefan's patch?

Quoted 7 lines

Thanks, Amos

[1] http://lists.gnu.org/archive/html/qemu-devel/2014-02/msg03835.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg04434.html
[3] virtio-net: Do not filter VLANs without F_CTRL_VLAN
[4] https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02604.html

Mainly what's wrong is the effect this has on the output of query-rx-filter. the patch is incomplete: management should be able to see that vlan filtering is disabled.

Besides, looking at guest features at reset time is also not a good idea, it works by luck.
A better place would be virtio_net_set_features.

Quoted 25 lines
Quoted 22 lines
Quoted 13 lines
Quoted 2 lines
Quoted 2 lines

Can we just update receive_filter() to filter out VLAN-tagged packets only when VIRTIO_NET_F_CTRL_VLAN is negotiated?

If we change receive_filter(), we also need a flag to indicate management this feature isn't negotiated, management will do some additional operation to host device to get same effect.

Quoted 4 lines

We could. But this adds a (very small) per-packet overhead while my patch only adds overhead during reset. Therefore I didn't take that approach. But if changing receive_filter() makes management much easier, that could be acceptable.

Quoted 5 lines

Actually your solution is better, QEMU will return a long list [0,1,2,...4095] to management, host device will filter all the vlan packets and send to QEMU.

So the problem raised by mst doesn't exist.

Cheers,
Stefan

Signature · 1 line
			Amos.