Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vlan: slight optimization for vlan_do_receive()

According Joe's suggestion, maybe it'd be faster to add an unlikely to
the test for PCKET_OTHERHOST, so I add it and see whether the performance
could be better, although the differences is so small and negligible, but
it is hard to catch that any lower device would set the skb type to
PACKET_OTHERHOST, so most of time, I think it make sense to add unlikely
for the test.

Cc: Joe Perches <joe@perches.com>
Cc: Patrick McHardy <kaber@trash.net>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

dingtianhong and committed by
David S. Miller
375f67df 2d8d40af

+1 -1
+1 -1
net/8021q/vlan_core.c
··· 22 22 return false; 23 23 24 24 skb->dev = vlan_dev; 25 - if (skb->pkt_type == PACKET_OTHERHOST) { 25 + if (unlikely(skb->pkt_type == PACKET_OTHERHOST)) { 26 26 /* Our lower layer thinks this is not local, let's make sure. 27 27 * This allows the VLAN to have a different MAC than the 28 28 * underlying device, and still route correctly. */