Commit 739a91ef0625e0e4a40b835f4f891313c47915df

Authored by Changli Gao
Committed by David S. Miller
1 parent 81ce790bd7

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>

Showing 2 changed files with 8 additions and 0 deletions Side-by-side Diff

include/linux/pkt_cls.h
... ... @@ -332,6 +332,7 @@
332 332 FLOW_KEY_SKUID,
333 333 FLOW_KEY_SKGID,
334 334 FLOW_KEY_VLAN_TAG,
  335 + FLOW_KEY_RXHASH,
335 336 __FLOW_KEY_MAX,
336 337 };
337 338  
net/sched/cls_flow.c
... ... @@ -306,6 +306,11 @@
306 306 return tag & VLAN_VID_MASK;
307 307 }
308 308  
  309 +static u32 flow_get_rxhash(struct sk_buff *skb)
  310 +{
  311 + return skb_get_rxhash(skb);
  312 +}
  313 +
309 314 static u32 flow_key_get(struct sk_buff *skb, int key)
310 315 {
311 316 switch (key) {
... ... @@ -343,6 +348,8 @@
343 348 return flow_get_skgid(skb);
344 349 case FLOW_KEY_VLAN_TAG:
345 350 return flow_get_vlan_tag(skb);
  351 + case FLOW_KEY_RXHASH:
  352 + return flow_get_rxhash(skb);
346 353 default:
347 354 WARN_ON(1);
348 355 return 0;