浏览代码

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>
dingtianhong 11 年之前
父节点
当前提交
375f67df28
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/8021q/vlan_core.c

+ 1 - 1
net/8021q/vlan_core.c

@@ -22,7 +22,7 @@ bool vlan_do_receive(struct sk_buff **skbp)
 		return false;
 		return false;
 
 
 	skb->dev = vlan_dev;
 	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.
 		/* Our lower layer thinks this is not local, let's make sure.
 		 * This allows the VLAN to have a different MAC than the
 		 * This allows the VLAN to have a different MAC than the
 		 * underlying device, and still route correctly. */
 		 * underlying device, and still route correctly. */