From: Changli Gao <xiaosuo@gmail.com>
To: Tom Herbert <therbert@google.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH v5] rps: Receive Packet Steering
Date: Thu, 21 Jan 2010 15:54:13 +0800 [thread overview]
Message-ID: <412e6f7f1001202354g1022bb64rae267a1b19713b8a@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.1001141353140.19018@pokey.mtv.corp.google.com>
On Fri, Jan 15, 2010 at 5:56 AM, Tom Herbert <therbert@google.com> wrote:
> +/*
> + * get_rps_cpu is called from netif_receive_skb and returns the target
> + * CPU from the RPS map of the receiving NAPI instance for a given skb.
> + */
> +static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb)
> +{
> + u32 addr1, addr2, ports;
> + struct ipv6hdr *ip6;
> + struct iphdr *ip;
> + u32 ihl;
> + u8 ip_proto;
> + int cpu = -1;
> + struct dev_rps_maps *drmap;
> + struct rps_map *map = NULL;
> + u16 index;
> +
> + rcu_read_lock();
> +
> + drmap = rcu_dereference(dev->dev_rps_maps);
> + if (!drmap)
> + goto done;
> +
> + index = skb_get_rx_queue(skb);
> + if (index >= drmap->num_maps)
> + index = 0;
> +
> + map = (struct rps_map *)
> + ((void *)drmap->maps + (rps_map_size * index));
> + if (!map->len)
> + goto done;
> +
> + if (skb->rxhash)
> + goto got_hash; /* Skip hash computation on packet header */
> +
Sometimes, rxhash will be 0 generated. In order to check whether
rxhash is generated or not, a new bit field in sk_buff is needed. When
rxhash is generated and saved in sk_buff, the bit is set.
And, I think rxhash should be reserved when calling skb_copy and skb_clone.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
next prev parent reply other threads:[~2010-01-21 7:54 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
2010-01-21 7:54 ` Changli Gao [this message]
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=412e6f7f1001202354g1022bb64rae267a1b19713b8a@mail.gmail.com \
--to=xiaosuo@gmail.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).