From: Krishna Kumar <krkumar2@in.ibm.com>
To: rdreier@cisco.com
Cc: netdev@vger.kernel.org, davem@davemloft.net,
general@lists.openfabrics.org
Subject: [ofa-general] [PATCH] IPoIB: Optimizations in poll handler.
Date: Tue, 18 Sep 2007 17:09:16 +0530 [thread overview]
Message-ID: <20070918113916.2065.14065.sendpatchset@localhost.localdomain> (raw)
Final follow-up optimizations: If the poll loop executes more than
once (and it happens on my system with two flood pings):
- no need to calculate "budget - done" on every iteration (but
will require to do this once, when returning from fn)
- check for one variable being non-zero instead of comparing two
vars for every iteration.
Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
ipoib_ib.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff -ruNp new2/drivers/infiniband/ulp/ipoib/ipoib_ib.c new3/drivers/infiniband/ulp/ipoib/ipoib_ib.c
--- new2/drivers/infiniband/ulp/ipoib/ipoib_ib.c 2007-09-18 16:31:42.000000000 +0530
+++ new3/drivers/infiniband/ulp/ipoib/ipoib_ib.c 2007-09-18 17:01:44.000000000 +0530
@@ -286,36 +286,37 @@ 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 num_wc, max_wc;
- int done = 0;
+ int remaining = budget;
do {
int i;
- max_wc = min(IPOIB_NUM_WC, budget - done);
+ max_wc = min(IPOIB_NUM_WC, remaining);
num_wc = ib_poll_cq(priv->cq, max_wc, priv->ibwc);
for (i = 0; i < num_wc; i++) {
struct ib_wc *wc = priv->ibwc + i;
if (wc->wr_id & IPOIB_CM_OP_SRQ) {
- ++done;
+ --remaining;
ipoib_cm_handle_rx_wc(dev, wc);
} else if (wc->wr_id & IPOIB_OP_RECV) {
- ++done;
+ --remaining;
ipoib_ib_handle_rx_wc(dev, wc);
} else
ipoib_ib_handle_tx_wc(dev, wc);
}
- } while (num_wc == max_wc && done < budget);
+ } while (num_wc == max_wc && remaining);
- if (done < budget) {
+ if (remaining) {
if (likely(!ib_req_notify_cq(priv->cq,
IB_CQ_NEXT_COMP |
IB_CQ_REPORT_MISSED_EVENTS)))
netif_rx_complete(dev, napi);
}
- return done;
+ /* return number of receives processed */
+ return budget - remaining;
}
void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr)
reply other threads:[~2007-09-18 11:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070918113916.2065.14065.sendpatchset@localhost.localdomain \
--to=krkumar2@in.ibm.com \
--cc=davem@davemloft.net \
--cc=general@lists.openfabrics.org \
--cc=netdev@vger.kernel.org \
--cc=rdreier@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox