Skip to content

Commit 375f67d

Browse files
dingtianhongdavem330
authored andcommitted
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 <[email protected]> Cc: Patrick McHardy <[email protected]> Cc: David S. Miller <[email protected]> Signed-off-by: Ding Tianhong <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2d8d40a commit 375f67d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/8021q/vlan_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bool vlan_do_receive(struct sk_buff **skbp)
2222
return false;
2323

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

0 commit comments

Comments
 (0)