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 09:13:07 +0200 [thread overview]
Message-ID: <49FE9583.8040009@cosmosbay.com> (raw)
In-Reply-To: <49FE7D63.6050102@cosmosbay.com>
Eric Dumazet a écrit :
> Tom Herbert a écrit :
>> +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)
>> + 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;
I misread patch and my previous remark was wrong, as you put in rps_map
all possible cpu indexes, there is no hole in the array, so its size
is num_possible_cpus() indeed, sorry for the false alarm.
Now I wonder how this can handle cpu hotplug, I see nothing in your patch to transfert
packets ownership or rps_map[] rebuilding in case a cpu is offlined...
next prev parent reply other threads:[~2009-05-04 7:16 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
2009-05-04 7:13 ` Eric Dumazet [this message]
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=49FE9583.8040009@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