[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <412e6f7f1001202354g1022bb64rae267a1b19713b8a@mail.gmail.com>
Date: Thu, 21 Jan 2010 15:54:13 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Tom Herbert <therbert@...gle.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH v5] rps: Receive Packet Steering
On Fri, Jan 15, 2010 at 5:56 AM, Tom Herbert <therbert@...gle.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@...il.com)
--
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