[openib-general] Re: [PATCH] ipoib: count dropped multicast patckets

Michael S. Tsirkin mst at mellanox.co.il
Mon Jan 9 10:07:12 PST 2006


Quoting r. Michael S. Tsirkin <mst at mellanox.co.il>:
> Subject: [PATCH] ipoib: count dropped multicast patckets
> 
> Count dropped multicast packets.
> 
> Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

And here's a patch that actually works :).

Index: openib/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- openib/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	(revision 4839)
+++ openib/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	(working copy)
@@ -122,8 +122,12 @@ static void ipoib_mcast_free(struct ipoi
 	if (mcast->ah)
 		ipoib_put_ah(mcast->ah);
 
-	while (!skb_queue_empty(&mcast->pkt_queue))
+	while (!skb_queue_empty(&mcast->pkt_queue)) {
+		spin_lock_irqsave(&priv->tx_lock, flags);
+		++priv->stats.tx_dropped;
+		spin_unlock_irqrestore(&priv->tx_lock, flags);
 		dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue));
+	}
 
 	kfree(mcast);
 }
@@ -299,6 +303,7 @@ ipoib_mcast_sendonly_join_complete(int s
 {
 	struct ipoib_mcast *mcast = mcast_ptr;
 	struct net_device *dev = mcast->dev;
+	unsigned long flags;
 
 	if (!status)
 		ipoib_mcast_join_finish(mcast, mcmember);
@@ -309,8 +314,12 @@ ipoib_mcast_sendonly_join_complete(int s
 					IPOIB_GID_ARG(mcast->mcmember.mgid), status);
 
 		/* Flush out any queued packets */
-		while (!skb_queue_empty(&mcast->pkt_queue))
+		while (!skb_queue_empty(&mcast->pkt_queue)) {
+			spin_lock_irqsave(&priv->tx_lock, flags);
+			++priv->stats.tx_dropped;
+			spin_unlock_irqrestore(&priv->tx_lock, flags);
 			dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue));
+		}
 
 		/* Clear the busy flag so we try again */
 		clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags);
@@ -686,6 +695,7 @@ void ipoib_mcast_send(struct net_device 
 		if (!mcast) {
 			ipoib_warn(priv, "unable to allocate memory for "
 				   "multicast structure\n");
+			++priv->stats.tx_dropped;
 			dev_kfree_skb_any(skb);
 			goto out;
 		}
@@ -699,8 +709,10 @@ void ipoib_mcast_send(struct net_device 
 	if (!mcast->ah) {
 		if (skb_queue_len(&mcast->pkt_queue) < IPOIB_MAX_MCAST_QUEUE)
 			skb_queue_tail(&mcast->pkt_queue, skb);
-		else
+		else {
+			++priv->stats.tx_dropped;
 			dev_kfree_skb_any(skb);
+		}
 
 		if (mcast->query)
 			ipoib_dbg_mcast(priv, "no address vector, "

-- 
MST



More information about the general mailing list