netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: netdev@vger.kernel.org
Subject: NAPI: netif_rx_reschedule() ??
Date: Wed, 30 Aug 2006 15:07:31 -0700	[thread overview]
Message-ID: <adau03tlvx8.fsf@cisco.com> (raw)

I'm looking at updating IP-over-InfiniBand to use NAPI, and due to the
way IB works, the driver is going to be susceptible to the rotting
packet problem.  It seems I'm going to have to call netif_rx_reschedule().

However I'm confused about a couple of things, and there are only two
uses of netif_rx_reschedule() in the kernel, so I'm a little stuck.

1. What is the intent of the second, 'undo' parameter?  For example,
   ibmveth.c does

	if(ibmveth_rxq_pending_buffer(adapter) && netif_rx_reschedule(netdev, frames_processed))
	{
		lpar_rc = h_vio_signal(adapter->vdev->unit_address, VIO_IRQ_DISABLE);
		ibmveth_assert(lpar_rc == H_SUCCESS);
		more_work = 1;
		goto restart_poll;
	}

   but it only does

	netdev->quota -= frames_processed;

   _after_ that block (and the jump back to restart_poll).  So the
   whole things seems fishy: netdev->quota goes up by the number of
   frames processed??

2. What is the return value supposed to be used for?  ibmveth.c
   returns from the poll method if netif_rx_reschedule() returns 0 (ie
   the poll was already scheduled); ibm_emac_mal.c jumps back to
   repoll regardless of the return value, and NAPI_HOWTO.txt has

	if (ring_has_new_packet() && netif_rx_reschedule(dev, received)) {
		disable_rx_and_rxnobufs()
		goto restart_poll
	} while (rx_status_is_set);

   which is not particularly enlightening to say the least...
   if (...) {...} while (...) ?!

   It's not clear to me why the driver would want to do something
   different depending on whether the NAPI poll was already scheduled
   or not.

Thanks,
  Roland

             reply	other threads:[~2006-08-30 22:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-30 22:07 Roland Dreier [this message]
2006-08-30 23:12 ` NAPI: netif_rx_reschedule() ?? Stephen Hemminger
2006-08-30 23:31   ` Roland Dreier
2006-08-30 23:38     ` Stephen Hemminger
2006-08-30 23:39     ` Roland Dreier
2006-08-31 21:29       ` Stephen Hemminger
2006-08-31 21:50         ` jamal
2006-08-31 23:54 ` Alexey Kuznetsov

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=adau03tlvx8.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=netdev@vger.kernel.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).