[ofa-general] [PATCH] Cleanup ipoib_poll() to use meaningful variable names

Krishna Kumar krkumar2 at in.ibm.com
Fri Sep 21 01:16:55 PDT 2007


1. Cleanup variable names in ibpob_poll
2. "while loop" optimization in the poll handler since net_rx_action
   guarantees 'budget' is atleast 1.

Signed-off-by: Krishna Kumar <krkumar2 at in.ibm.com>
---
 ipoib_ib.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff -ruNp a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2007-09-21 13:16:41.000000000 +0530
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2007-09-21 13:20:42.000000000 +0530
@@ -285,18 +285,15 @@ int ipoib_poll(struct napi_struct *napi,
 {
 	struct ipoib_dev_priv *priv = container_of(napi, struct ipoib_dev_priv, napi);
 	struct net_device *dev = priv->dev;
-	int done;
-	int t;
-	int n, i;
-
-	done  = 0;
+	int num_wc, max_wc;
+	int done = 0;
 
 poll_more:
-	while (done < budget) {
-		int max = (budget - done);
+	do {
+		int i;
 
-		t = min(IPOIB_NUM_WC, max);
-		n = ib_poll_cq(priv->cq, t, priv->ibwc);
+		max_wc = min(IPOIB_NUM_WC, budget - done);
+		num_wc = ib_poll_cq(priv->cq, max_wc, priv->ibwc);
 
 		for (i = 0; i < n; i++) {
 			struct ib_wc *wc = priv->ibwc + i;
@@ -310,10 +307,7 @@ poll_more:
 			} else
 				ipoib_ib_handle_tx_wc(dev, wc);
 		}
-
-		if (n != t)
-			break;
-	}
+	} while (num_wc == max_wc && done < budget);
 
 	if (done < budget) {
 		netif_rx_complete(dev, napi);



More information about the general mailing list