netdev
[Top] [All Lists]

NAPI question

To: "'netdev@xxxxxxxxxxx'" <netdev@xxxxxxxxxxx>
Subject: NAPI question
From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Date: Fri, 08 Nov 2002 17:33:01 -0800
Organization: Candela Technologies
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2a) Gecko/20020910
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@xxxxxxxxxxxxxxx>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear



<Prev in Thread] Current Thread [Next in Thread>