Skip to content

Commit 054bb88

Browse files
dingtianhongdavem330
authored andcommitted
bonding: slight optimization for bond xmit path
Add unlikely() micro to the unlikely conditions in the bond xmit path for slight optimization. Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7aceb47 commit 054bb88

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,7 +2957,7 @@ static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
29572957
fk->ports = 0;
29582958
noff = skb_network_offset(skb);
29592959
if (skb->protocol == htons(ETH_P_IP)) {
2960-
if (!pskb_may_pull(skb, noff + sizeof(*iph)))
2960+
if (unlikely(!pskb_may_pull(skb, noff + sizeof(*iph))))
29612961
return false;
29622962
iph = ip_hdr(skb);
29632963
fk->src = iph->saddr;
@@ -2966,7 +2966,7 @@ static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
29662966
if (!ip_is_fragment(iph))
29672967
proto = iph->protocol;
29682968
} else if (skb->protocol == htons(ETH_P_IPV6)) {
2969-
if (!pskb_may_pull(skb, noff + sizeof(*iph6)))
2969+
if (unlikely(!pskb_may_pull(skb, noff + sizeof(*iph6))))
29702970
return false;
29712971
iph6 = ipv6_hdr(skb);
29722972
fk->src = (__force __be32)ipv6_addr_hash(&iph6->saddr);
@@ -3768,7 +3768,7 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
37683768
* If we risk deadlock from transmitting this in the
37693769
* netpoll path, tell netpoll to queue the frame for later tx
37703770
*/
3771-
if (is_netpoll_tx_blocked(dev))
3771+
if (unlikely(is_netpoll_tx_blocked(dev)))
37723772
return NETDEV_TX_BUSY;
37733773

37743774
rcu_read_lock();

0 commit comments

Comments
 (0)