]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
IPoIB: Set pkt_type correctly for multicast packets (fix IGMP breakage)
authorChristoph Lameter <cl@linux.com>
Fri, 27 Aug 2010 13:29:38 +0000 (08:29 -0500)
committerRoland Dreier <rolandd@cisco.com>
Tue, 28 Sep 2010 18:09:23 +0000 (11:09 -0700)
IGMP processing is broken because the IPOIB does not set the
skb->pkt_type the right way for multicast traffic.  All incoming
packets are set to PACKET_HOST which means that igmp_recv() will
ignore the IGMP broadcasts/multicasts.

This in turn means that the IGMP timers are firing and are sending
information about multicast subscriptions unnecessarily.  In a large
private network this can cause traffic spikes.

Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib_ib.c

index ec6b4fbe25e4416fb45ef9e76f5703093c26e86a..dfa71903d6e467c59071e3cc01b04fea98c256b3 100644 (file)
@@ -223,6 +223,7 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
        unsigned int wr_id = wc->wr_id & ~IPOIB_OP_RECV;
        struct sk_buff *skb;
        u64 mapping[IPOIB_UD_RX_SG];
+       union ib_gid *dgid;
 
        ipoib_dbg_data(priv, "recv completion: id %d, status: %d\n",
                       wr_id, wc->status);
@@ -271,6 +272,16 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
        ipoib_ud_dma_unmap_rx(priv, mapping);
        ipoib_ud_skb_put_frags(priv, skb, wc->byte_len);
 
+       /* First byte of dgid signals multicast when 0xff */
+       dgid = &((struct ib_grh *)skb->data)->dgid;
+
+       if (!(wc->wc_flags & IB_WC_GRH) || dgid->raw[0] != 0xff)
+               skb->pkt_type = PACKET_HOST;
+       else if (memcmp(dgid, dev->broadcast + 4, sizeof(union ib_gid)) == 0)
+               skb->pkt_type = PACKET_BROADCAST;
+       else
+               skb->pkt_type = PACKET_MULTICAST;
+
        skb_pull(skb, IB_GRH_BYTES);
 
        skb->protocol = ((struct ipoib_header *) skb->data)->proto;
@@ -281,9 +292,6 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
        dev->stats.rx_bytes += skb->len;
 
        skb->dev = dev;
-       /* XXX get correct PACKET_ type here */
-       skb->pkt_type = PACKET_HOST;
-
        if (test_bit(IPOIB_FLAG_CSUM, &priv->flags) && likely(wc->csum_ok))
                skb->ip_summed = CHECKSUM_UNNECESSARY;