netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, shemminger@linux-foundation.org,
	jgarzik@pobox.com, hadi@cyberus.ca, rusty@rustcorp.com.au
Subject: Re: [PATCH RFC]: napi_struct V5
Date: Tue, 07 Aug 2007 15:37:30 -0700	[thread overview]
Message-ID: <adasl6vq8d1.fsf@cisco.com> (raw)
In-Reply-To: <20070805.232423.21363072.davem@davemloft.net> (David Miller's message of "Sun, 05 Aug 2007 23:24:23 -0700 (PDT)")

Thanks for looking at ipoib... overall looks fine, just a few comments.

 > --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
 > +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
 > @@ -281,63 +281,58 @@ static void ipoib_ib_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
 >  			   wc->status, wr_id, wc->vendor_err);
 >  }
 >  
 > -int ipoib_poll(struct net_device *dev, int *budget)
 > +int ipoib_poll(struct napi_struct *napi, int budget)

 > +poll_more:
 > +	while (done < budget) {
 > +		int max = (budget - done);
 > +
 >  		t = min(IPOIB_NUM_WC, max);

I think this is the only place where max is used now.  Might as well
kill it and put budget-done in directly.  That would get rid of the
strange-looking parens in the "max =" line too.

 >  		n = ib_poll_cq(priv->cq, t, priv->ibwc);
 >  
 > -		for (i = 0; i < n; ++i) {
 > +		for (i = 0; i < n; i++) {

it might be nicer to avoid noise like this in the patch.

 > +	if (done < budget) {
 > +		netif_rx_complete(dev, napi);
 >  		if (unlikely(ib_req_notify_cq(priv->cq,
 >  					      IB_CQ_NEXT_COMP |
 >  					      IB_CQ_REPORT_MISSED_EVENTS)) &&
 > -		    netif_rx_reschedule(dev, 0))
 > -			return 1;
 > -
 > -		return 0;
 > +		    netif_rx_reschedule(napi))
 > +			goto poll_more;

this goto back to the polling loop is a change in behavior.  When we
were tuning NAPI, we found that returning in the missed event case and
letting the NAPI core call the poll routine later actually performed
better, because it allowed more work to pile up.

So could the code just look like:

		netif_rx_complete(dev, napi);
 		if (unlikely(ib_req_notify_cq(priv->cq,
 					      IB_CQ_NEXT_COMP |
 					      IB_CQ_REPORT_MISSED_EVENTS)))
			netif_rx_reschedule(napi);

and then just return done in all cases?

It doesn't seem like the return value of netif_rx_reschedule() matters
in what we would want to do.  The only thing it's used for in the old
code is to decide what the poll routine should return.

 - R.

  parent reply	other threads:[~2007-08-07 22:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-06  6:24 [PATCH RFC]: napi_struct V5 David Miller
2007-08-06 18:00 ` Michael Chan
2007-08-06 20:50   ` David Miller
2007-08-07 12:52 ` jamal
2007-08-08  0:59   ` David Miller
2007-08-08 12:10     ` jamal
2007-08-09  4:35       ` David Miller
2007-08-07 22:37 ` Roland Dreier [this message]
2007-08-07 23:06   ` David Miller
2007-08-08  3:56     ` Roland Dreier
2007-08-08  4:08       ` David Miller
     [not found]     ` <OFA2F18805.38AA0BD0-ON87257331.005367FB-88257331.0027BEED@us.ibm.com>
2007-08-08 15:32       ` jamal
2007-08-09  4:23         ` David Miller
2007-08-09  5:32           ` Jeff Garzik
2007-08-09 16:58         ` Roland Dreier
2007-08-10 13:55           ` jamal
2007-08-10 21:39             ` David Miller
2007-08-13 21:47             ` Roland Dreier
2007-08-08 22:20       ` David Miller
2007-08-08 23:23         ` Shirley Ma
2007-08-09 17:49         ` Roland Dreier
2007-08-09 18:16           ` Shirley Ma

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=adasl6vq8d1.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=shemminger@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).