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

Michael S. Tsirkin mst at mellanox.co.il
Tue Jan 10 00:24:32 PST 2006


Quoting r. Michael S. Tsirkin <mst at mellanox.co.il>:
> Subject: Re: [PATCH] ipoib: count dropped multicast patckets
> 
> 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 :).

And here's a verson that really actually works :).

Count dropped multicast packets.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: openib/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- openib.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2006-01-08 22:42:58.000000000 +0200
+++ openib/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2006-01-10 10:17:41.000000000 +0200
@@ -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,8 @@ ipoib_mcast_sendonly_join_complete(int s
 {
 	struct ipoib_mcast *mcast = mcast_ptr;
 	struct net_device *dev = mcast->dev;
+	struct ipoib_dev_priv *priv = netdev_priv(dev);
+	unsigned long flags;
 
 	if (!status)
 		ipoib_mcast_join_finish(mcast, mcmember);
@@ -309,8 +315,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 +696,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 +710,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