Skip to content

Commit

Permalink
vlan: slight optimization for vlan_do_receive()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dingtianhong authored and David S. Miller committed Mar 9, 2014
1 parent 2d8d40a commit 375f67d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/8021q/vlan_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bool vlan_do_receive(struct sk_buff **skbp)
return false;

skb->dev = vlan_dev;
if (skb->pkt_type == PACKET_OTHERHOST) {
if (unlikely(skb->pkt_type == PACKET_OTHERHOST)) {
/* Our lower layer thinks this is not local, let's make sure.
* This allows the VLAN to have a different MAC than the
* underlying device, and still route correctly. */
Expand Down

0 comments on commit 375f67d

Please sign in to comment.