Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1b844afe9e67d6cd441ae6df71051b4004f31dd2
Commit:     1b844afe9e67d6cd441ae6df71051b4004f31dd2
Parent:     8909c571fa1e62e254c4045394e6eaccfadec6f4
Author:     Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 10 13:43:53 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 13:43:53 2007 -0700

    IPoIB: Recycle loopback skbs instead of freeing and reallocating
    
    InfiniBand HCAs replicate multicast packets back to the QP that sent
    them if that QP is attached to the destination multicast group.  This
    means that IPoIB multicasts are often replicated back to the receive
    queue of the interface that generated them.  To avoid confusing the
    network stack, we drop these duplicates within the IPoIB driver.
    
    However, there's no reason to free the skb that received the duplicate
    and then immediately allocate a new skb to post to the receive queue.
    We can be more efficient and just repost the same skb.
    
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/ulp/ipoib/ipoib_ib.c |   33 ++++++++++++++++---------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c 
b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 8404f05..1094488 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -197,6 +197,13 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, 
struct ib_wc *wc)
        }
 
        /*
+        * Drop packets that this interface sent, ie multicast packets
+        * that the HCA has replicated.
+        */
+       if (wc->slid == priv->local_lid && wc->src_qp == priv->qp->qp_num)
+               goto repost;
+
+       /*
         * If we can't allocate a new RX buffer, dump
         * this packet and reuse the old buffer.
         */
@@ -213,24 +220,18 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, 
struct ib_wc *wc)
        skb_put(skb, wc->byte_len);
        skb_pull(skb, IB_GRH_BYTES);
 
-       if (wc->slid != priv->local_lid ||
-           wc->src_qp != priv->qp->qp_num) {
-               skb->protocol = ((struct ipoib_header *) skb->data)->proto;
-               skb_reset_mac_header(skb);
-               skb_pull(skb, IPOIB_ENCAP_LEN);
+       skb->protocol = ((struct ipoib_header *) skb->data)->proto;
+       skb_reset_mac_header(skb);
+       skb_pull(skb, IPOIB_ENCAP_LEN);
 
-               dev->last_rx = jiffies;
-               ++priv->stats.rx_packets;
-               priv->stats.rx_bytes += skb->len;
+       dev->last_rx = jiffies;
+       ++priv->stats.rx_packets;
+       priv->stats.rx_bytes += skb->len;
 
-               skb->dev = dev;
-               /* XXX get correct PACKET_ type here */
-               skb->pkt_type = PACKET_HOST;
-               netif_receive_skb(skb);
-       } else {
-               ipoib_dbg_data(priv, "dropping loopback packet\n");
-               dev_kfree_skb_any(skb);
-       }
+       skb->dev = dev;
+       /* XXX get correct PACKET_ type here */
+       skb->pkt_type = PACKET_HOST;
+       netif_receive_skb(skb);
 
 repost:
        if (unlikely(ipoib_ib_post_receive(dev, wr_id)))
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to