From: Ben Hutchings <bhutchings@solarflare.com>
To: Tom Herbert <therbert@google.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH v5] rps: Receive Packet Steering
Date: Sat, 16 Jan 2010 02:26:31 +0000 [thread overview]
Message-ID: <1263608791.17815.128.camel@localhost> (raw)
In-Reply-To: <alpine.DEB.1.00.1001141353140.19018@pokey.mtv.corp.google.com>
On Thu, 2010-01-14 at 13:56 -0800, Tom Herbert wrote:
[...]
> The CPU masks is set on a per device basis in the sysfs variable
> /sys/class/net/<device>/rps_cpus. This is a set of canonical bit maps for
> each NAPI nstance of the device. For example:
>
> echo "0b 0b0 0b00 0b000" > /sys/class/net/eth0/rps_cpus
>
> would set maps for four NAPI instances on eth0.
[...]
> Caveats:
> - The benefits of this patch are dependent on architecture and cache hierarchy.
> Tuning the masks to get best performance is probably necessary.
It seems to me that it would be helpful to provide some kind of sensible
default behaviour. I'm sure Google has the in-house expertise to do
this at a higher-level, but most end users rely on good defaults rather
than tuning.
[...]
> +/*
> + * Structure that contains the rps maps for various NAPI instances of a device.
> + */
> +struct dev_rps_maps {
> + int num_maps;
> + struct rcu_head rcu;
> + struct rps_map maps[0];
This declaration is a botch. A VLA of structures containing VLAs has an
index operation, but it's broken. It would be better to remove the maps
member and define an inline function for indexing the following array of
maps, instead of writing the magic formula way over...
[...]
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[...]
> +static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb)
> +{
[...]
> + map = (struct rps_map *)
> + ((void *)drmap->maps + (rps_map_size * index));
[...]
...here.
[...]
> @@ -2363,10 +2487,10 @@ void netif_nit_deliver(struct sk_buff *skb)
> }
>
> /**
> - * netif_receive_skb - process receive buffer from network
> + * __netif_receive_skb - process receive buffer from network
> * @skb: buffer to process
> *
> - * netif_receive_skb() is the main receive data processing function.
> + * __netif_receive_skb() is the main receive data processing function.
> * It always succeeds. The buffer may be dropped during processing
> * for congestion control or by the protocol layers.
> *
Surely this kernel-doc should be moved rather than modified, since you
want most callers to continue using netif_receive_skb()?
[...]
> @@ -2475,6 +2599,16 @@ out:
> }
> EXPORT_SYMBOL(netif_receive_skb);
This should be moved underneath the new implementation...
> +int netif_receive_skb(struct sk_buff *skb)
> +{
> + int cpu = get_rps_cpu(skb->dev, skb);
> +
> + if (cpu < 0)
> + return __netif_receive_skb(skb);
> + else
> + return enqueue_to_backlog(skb, cpu);
> +}
[...]
...here.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2010-01-16 2:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 21:56 [PATCH v5] rps: Receive Packet Steering Tom Herbert
2010-01-14 22:56 ` Stephen Hemminger
2010-01-14 23:31 ` Rick Jones
2010-01-16 2:11 ` Ben Hutchings
2010-01-17 17:22 ` Stephen Hemminger
2010-01-15 2:22 ` Changli Gao
2010-01-15 6:19 ` Eric Dumazet
2010-01-15 6:39 ` Changli Gao
2010-01-15 6:57 ` Eric Dumazet
2010-01-15 8:49 ` David Miller
2010-01-15 9:20 ` Changli Gao
2010-01-15 9:26 ` David Miller
2010-01-21 7:04 ` Changli Gao
2010-01-15 9:45 ` David Miller
2010-01-15 8:50 ` David Miller
2010-01-15 9:05 ` Changli Gao
2010-01-15 6:27 ` Eric Dumazet
2010-01-16 2:26 ` Ben Hutchings [this message]
2010-01-21 7:54 ` Changli Gao
2010-01-21 9:16 ` Eric Dumazet
2010-01-28 6:04 ` Stephen Hemminger
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=1263608791.17815.128.camel@localhost \
--to=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).