IPoIB: Add some likely/unlikely annotations in hot path
authorEli Cohen <eli@dev.mellanox.co.il>
Fri, 22 Sep 2006 22:22:58 +0000 (15:22 -0700)
committerRoland Dreier <rolandd@cisco.com>
Fri, 22 Sep 2006 22:22:58 +0000 (15:22 -0700)
Signed-off-by: Eli Cohen <eli@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib_ib.c
drivers/infiniband/ulp/ipoib/ipoib_main.c

index 240befdf90dc96e5d84519aa8902fc848e04d7ab..f426a69d9a436cce55addba00be1d1d2cdd7ff30 100644 (file)
@@ -332,7 +332,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
        struct ipoib_tx_buf *tx_req;
        dma_addr_t addr;
 
-       if (skb->len > dev->mtu + INFINIBAND_ALEN) {
+       if (unlikely(skb->len > dev->mtu + INFINIBAND_ALEN)) {
                ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n",
                           skb->len, dev->mtu + INFINIBAND_ALEN);
                ++priv->stats.tx_dropped;
index 867d62742054fa42c318eccfbf19650966231357..1eaf00e9862c5a4a0381d0570b5ac7ee0723f93c 100644 (file)
@@ -620,7 +620,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
        struct ipoib_neigh *neigh;
        unsigned long flags;
 
-       if (!spin_trylock_irqsave(&priv->tx_lock, flags))
+       if (unlikely(!spin_trylock_irqsave(&priv->tx_lock, flags)))
                return NETDEV_TX_LOCKED;
 
        /*
@@ -633,7 +633,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
                return NETDEV_TX_BUSY;
        }
 
-       if (skb->dst && skb->dst->neighbour) {
+       if (likely(skb->dst && skb->dst->neighbour)) {
                if (unlikely(!*to_ipoib_neigh(skb->dst->neighbour))) {
                        ipoib_path_lookup(skb, dev);
                        goto out;