netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* NAPI question
@ 2002-11-09  1:33 Ben Greear
  2002-11-09  1:50 ` jamal
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Greear @ 2002-11-09  1:33 UTC (permalink / raw)
  To: 'netdev@oss.sgi.com'

In dev.c, there is this code.  Please see my question by the ### marks.

static void net_rx_action(struct softirq_action *h)
{
	int this_cpu = smp_processor_id();
	struct softnet_data *queue = &softnet_data[this_cpu];
	unsigned long start_time = jiffies;
	int budget = netdev_max_backlog;

	br_read_lock(BR_NETPROTO_LOCK);
	local_irq_disable();

	while (!list_empty(&queue->poll_list)) {
		struct net_device *dev;

		if (budget <= 0 || jiffies - start_time > 1)
			goto softnet_break;

		local_irq_enable();

		dev = list_entry(queue->poll_list.next, struct net_device, poll_list);

		if (dev->quota <= 0 || dev->poll(dev, &budget)) {
			local_irq_disable();
			list_del(&dev->poll_list);
			list_add_tail(&dev->poll_list, &queue->poll_list);

###  How can quota ever get negative?  In other words, why not just set it to dev->weight
###  always?  Or, if the dev didn't use up all it's quota from the last round, why not
###  increase it up to a max of 2 x weight or something like that?

			if (dev->quota < 0)
                                dev->quota += dev->weight;
                         else
                                dev->quota = dev->weight;
		} else {
			dev_put(dev);
			local_irq_disable();
		}
	}


-- 
Ben Greear <greearb@candelatech.com>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-09  1:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-09  1:33 NAPI question Ben Greear
2002-11-09  1:50 ` jamal

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).