aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChangli Gao <xiaosuo@gmail.com>2010-08-21 02:23:15 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-22 02:40:14 -0400
commit739a91ef0625e0e4a40b835f4f891313c47915df (patch)
treebfcb025c8b446a81e82f0b57ad76168996ce49bc
parent81ce790bd75d49a0d119f5d7b27405e1d9b1bd57 (diff)
net_sched: cls_flow: add key rxhash
We can use rxhash to classify the traffic into flows. As rxhash maybe supplied by NIC or RPS, it is cheaper. Signed-off-by: Changli Gao <xiaosuo@gmail.com> Acked-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/pkt_cls.h1
-rw-r--r--net/sched/cls_flow.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 7f6ba8658abe..defbde203d07 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -332,6 +332,7 @@ enum {
332 FLOW_KEY_SKUID, 332 FLOW_KEY_SKUID,
333 FLOW_KEY_SKGID, 333 FLOW_KEY_SKGID,
334 FLOW_KEY_VLAN_TAG, 334 FLOW_KEY_VLAN_TAG,
335 FLOW_KEY_RXHASH,
335 __FLOW_KEY_MAX, 336 __FLOW_KEY_MAX,
336}; 337};
337 338
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index cd709f1294df..5b271a18bc3a 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -306,6 +306,11 @@ static u32 flow_get_vlan_tag(const struct sk_buff *skb)
306 return tag & VLAN_VID_MASK; 306 return tag & VLAN_VID_MASK;
307} 307}
308 308
309static u32 flow_get_rxhash(struct sk_buff *skb)
310{
311 return skb_get_rxhash(skb);
312}
313
309static u32 flow_key_get(struct sk_buff *skb, int key) 314static u32 flow_key_get(struct sk_buff *skb, int key)
310{ 315{
311 switch (key) { 316 switch (key) {
@@ -343,6 +348,8 @@ static u32 flow_key_get(struct sk_buff *skb, int key)
343 return flow_get_skgid(skb); 348 return flow_get_skgid(skb);
344 case FLOW_KEY_VLAN_TAG: 349 case FLOW_KEY_VLAN_TAG:
345 return flow_get_vlan_tag(skb); 350 return flow_get_vlan_tag(skb);
351 case FLOW_KEY_RXHASH:
352 return flow_get_rxhash(skb);
346 default: 353 default:
347 WARN_ON(1); 354 WARN_ON(1);
348 return 0; 355 return 0;