提交 bbe2f399 编写于 作者: A Alex Williamson 提交者: Mark McLoughlin

virtio-net: reorganize receive_filter()

Reorganize receive_filter to better handle the split between
unicast and multicast filtering.  This allows us to skip the
broadcast check on unicast packets and leads to more opportunities
for optimization.
Signed-off-by: NAlex Williamson <alex.williamson@hp.com>
Signed-off-by: NMark McLoughlin <markmc@redhat.com>
上级 f10c592e
...@@ -347,14 +347,17 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size) ...@@ -347,14 +347,17 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)
return 0; return 0;
} }
if ((ptr[0] & 1) && n->allmulti) if (ptr[0] & 1) { // multicast
return 1; if (!memcmp(ptr, bcast, sizeof(bcast))) {
return 1;
if (!memcmp(ptr, bcast, sizeof(bcast))) } else if (n->allmulti) {
return 1; return 1;
}
if (!memcmp(ptr, n->mac, ETH_ALEN)) } else { // unicast
return 1; if (!memcmp(ptr, n->mac, ETH_ALEN)) {
return 1;
}
}
for (i = 0; i < n->mac_table.in_use; i++) { for (i = 0; i < n->mac_table.in_use; i++) {
if (!memcmp(ptr, &n->mac_table.macs[i * ETH_ALEN], ETH_ALEN)) if (!memcmp(ptr, &n->mac_table.macs[i * ETH_ALEN], ETH_ALEN))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册