[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070918111817.1769.1042.sendpatchset@localhost.localdomain>
Date: Tue, 18 Sep 2007 16:48:17 +0530
From: Krishna Kumar <krkumar2@...ibm.com>
To: rdreier@...co.com
Cc: netdev@...r.kernel.org, Krishna Kumar <krkumar2@...ibm.com>,
davem@...emloft.net, general@...ts.openfabrics.org
Subject: [PATCH 2/2] IPoIB: Code cleanup
Follow-up cleanup and "while loop" optimization in the poll handler.
net_rx_action guarantees that 'budget' is atleast 1.
Note: This could also be done for poll handlers of other drivers.
Signed-off-by: Krishna Kumar <krkumar2@...ibm.com>
---
ipoib_ib.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
diff -ruNp new1/drivers/infiniband/ulp/ipoib/ipoib_ib.c new2/drivers/infiniband/ulp/ipoib/ipoib_ib.c
--- new1/drivers/infiniband/ulp/ipoib/ipoib_ib.c 2007-09-18 16:14:20.000000000 +0530
+++ new2/drivers/infiniband/ulp/ipoib/ipoib_ib.c 2007-09-18 16:31:42.000000000 +0530
@@ -285,19 +285,16 @@ 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;
+ int num_wc, max_wc;
+ int done = 0;
- done = 0;
-
- 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++) {
+ for (i = 0; i < num_wc; i++) {
struct ib_wc *wc = priv->ibwc + i;
if (wc->wr_id & IPOIB_CM_OP_SRQ) {
@@ -309,10 +306,7 @@ int ipoib_poll(struct napi_struct *napi,
} else
ipoib_ib_handle_tx_wc(dev, wc);
}
-
- if (n != t)
- break;
- }
+ } while (num_wc == max_wc && done < budget);
if (done < budget) {
if (likely(!ib_req_notify_cq(priv->cq,
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists