From: Eric Dumazet <dada1@cosmosbay•com>
To: Tom Herbert <therbert@google•com>
Cc: netdev@vger•kernel.org, David Miller <davem@davemloft•net>
Subject: Re: [PATCH v2] Receive Packet Steering
Date: Mon, 04 May 2009 08:10:56 +0200 [thread overview]
Message-ID: <49FE86F0.4070206@cosmosbay.com> (raw)
In-Reply-To: <49FE7D63.6050102@cosmosbay.com>
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;
>> +}
>> +
next prev parent reply other threads:[~2009-05-04 6:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-04 4:03 [PATCH v2] Receive Packet Steering Tom Herbert
2009-05-04 5:30 ` Eric Dumazet
2009-05-04 6:10 ` Eric Dumazet [this message]
2009-05-04 7:13 ` Eric Dumazet
2009-05-12 17:28 ` Tom Herbert
2009-05-04 7:08 ` Eric Dumazet
2009-05-04 7:59 ` Andi Kleen
2009-05-04 18:22 ` Jarek Poplawski
2009-05-04 20:43 ` Jarek Poplawski
2009-06-10 8:23 ` David Miller
2009-06-15 5:54 ` Tom Herbert
[not found] ` <65634d660906142252y6f7fc021l844b172995c10044@mail.gmail.com>
2009-06-15 9:02 ` David Miller
2009-06-15 16:39 ` Tom Herbert
2009-06-15 23:18 ` David Miller
2009-07-13 17:49 ` David Miller
2009-07-13 22:04 ` Tom Herbert
2009-07-14 19:33 ` David Miller
2009-07-14 23:28 ` Tom Herbert
2009-07-17 2:48 ` David Miller
2009-07-17 18:05 ` Tom Herbert
2009-07-17 18:08 ` David Miller
2009-07-17 19:59 ` Tom Herbert
2009-07-18 3:54 ` David Miller
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=49FE86F0.4070206@cosmosbay.com \
--to=dada1@cosmosbay$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=therbert@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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