[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49FE86F0.4070206@cosmosbay.com>
Date: Mon, 04 May 2009 08:10:56 +0200
From: Eric Dumazet <dada1@...mosbay.com>
To: Tom Herbert <therbert@...gle.com>
CC: netdev@...r.kernel.org, David Miller <davem@...emloft.net>
Subject: Re: [PATCH v2] Receive Packet Steering
Eric Dumazet a écrit :
> Tom Herbert a écrit :
>> This is an update of the receive packet steering patch (RPS) based on received
>> comments (thanks for all the comments). Improvements are:
>>
>> 1) Removed config option for the feature.
>> 2) Made scheduling of backlog NAPI devices between CPUs lockless and much
>> simpler.
>> 3) Added new softirq to do defer sending IPIs for coalescing.
>> 4) Imported hash from simple_rx_hash. Eliminates modulo operation to convert
>> hash to index.
>> 5) If no cpu is found for packet steering, then netif_receive_skb processes
>> packet inline as before without queueing. In paritcular if RPS is not
>> configured on a device the receive path is unchanged from current for
>> NAPI devices (one additional conditional).
>>
>> Tom
>
another error :
>> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
>> index 2da59a0..073a407 100644
>> --- a/net/core/net-sysfs.c
>> +++ b/net/core/net-sysfs.c
>> @@ -211,6 +211,63 @@ static ssize_t store_tx_queue_len(struct device *dev,
>> return netdev_store(dev, attr, buf, len, change_tx_queue_len);
>> }
>>
>> +static ssize_t store_rps_cpus(struct device *dev,
>> + struct device_attribute *attr,
>> + const char *buf, size_t len)
>> +{
>> + struct net_device *net = to_net_dev(dev);
>> + cpumask_t mask;
>> + int err, cpu;
>> + int i = 0;
>> +
>> + if (!capable(CAP_NET_ADMIN))
>> + return -EPERM;
>> +
>> + err = bitmap_parse(buf, len, cpumask_bits(&mask), nr_cpumask_bits);
>> + if (err)
>> + return err;
>> +
>> + rtnl_lock();
>> + if (dev_isalive(net)) {
>> + if (!net->rps_map) {
>> + net->rps_map = kzalloc(sizeof(u16) *
>> + num_possible_cpus(), GFP_KERNEL);
>
> num_possible_cpus() is not the max index of a cpu, but the number of possible cpus.
> it can be for example 2, but cpu0 being index 0, and second cpu at index 511
>
> So I believe you want nr_cpu_ids here
>
> (num_possible_cpus() <= nr_cpu_ids), not necessarly equal.
>
>
>> + if (!net->rps_map)
lacks a rtnl_unlock() here, before return
>> + return -ENOMEM;
>> + }
>> + cpus_and(mask, mask, cpu_online_map);
>> + for_each_cpu_mask(cpu, mask)
>> + net->rps_map[i++] = cpu;
>> + net->rps_map_len = i;
>> + }
>> + rtnl_unlock();
>> +
>> + return len;
>> +}
>> +
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists