Skip to contentSkip to conversation

tc: add meta match on receive hash

PATCH Applied Stephen Hemminger 3 participants 5 messages Aug 23, 2010 – Aug 24, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc: add meta match on receive hash

Trivial extension to existing meta data match rules to allow matching on skb receive hash value.

include/linux/tc_ematch/tc_em_meta.h +1 -0
@@ -79,6 +79,7 @@ enum {
  	TCF_META_ID_SK_SENDMSG_OFF,
  	TCF_META_ID_SK_WRITE_PENDING,
 	TCF_META_ID_VLAN_TAG,
+	TCF_META_ID_RXHASH,
 	__TCF_META_ID_MAX
 };
 #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)
net/sched/em_meta.c +6 -0
@@ -223,6 +223,11 @@ META_COLLECTOR(int_maclen)
 	dst->value = skb->mac_len;
 }
 
+META_COLLECTOR(int_rxhash)
+{
+	dst->value = skb->rxhash;
+}
+
 /**************************************************************************
  * Netfilter
  **************************************************************************/
@@ -541,6 +546,7 @@ static struct meta_ops __meta_ops[TCF_ME
 		[META_ID(SK_SENDMSG_OFF)]	= META_FUNC(int_sk_sendmsg_off),
 		[META_ID(SK_WRITE_PENDING)]	= META_FUNC(int_sk_write_pend),
 		[META_ID(VLAN_TAG)]		= META_FUNC(int_vlan_tag),
+		[META_ID(RXHASH)]		= META_FUNC(int_rxhash),
 	}
 };
 
#1 lore raw
Quoted 18 lines · Stephen Hemminger

Trivial extension to existing meta data match rules to allow matching on skb receive hash value.

include/linux/tc_ematch/tc_em_meta.h      2010-08-22 11:28:20.560321846 -0700 renamed from include/linux/tc_ematch/tc_em_meta.h      2010-08-22 11:28:09.208550912 -0700 +1 -0
@@ -79,6 +79,7 @@ enum {
        TCF_META_ID_SK_SENDMSG_OFF,
        TCF_META_ID_SK_WRITE_PENDING,
        TCF_META_ID_VLAN_TAG,
+       TCF_META_ID_RXHASH,

       __TCF_META_ID_MAX
 };
 #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)

net/sched/em_meta.c       2010-08-22 11:25:16.088029057 -0700 META_COLLECTOR(int_maclen) · line 229

Quoted 7 lines
net/sched/em_meta.c       2010-08-22 11:25:16.088029057 -0700 renamed from net/sched/em_meta.c       2010-08-22 11:23:29.394155391 -0700 +4 -0
@@ -223,6 +223,11 @@ META_COLLECTOR(int_maclen)
        dst->value = skb->mac_len;
  }
 
+META_COLLECTOR(int_rxhash)
+{
+       dst->value = skb->rxhash;
+}

How about using skb_get_rxhash instead. It returns the rxhash anyway.

Quoted 17 lines
net/sched/em_meta.c       2010-08-22 11:25:16.088029057 -0700 renamed from net/sched/em_meta.c       2010-08-22 11:23:29.394155391 -0700 +2 -1
+
  /**************************************************************************
  * Netfilter
  **************************************************************************/
@@ -541,6 +546,7 @@ static struct meta_ops __meta_ops[TCF_ME
                [META_ID(SK_SENDMSG_OFF)]       = META_FUNC(int_sk_sendmsg_off),
                [META_ID(SK_WRITE_PENDING)]     = META_FUNC(int_sk_write_pend),
                [META_ID(VLAN_TAG)]             = META_FUNC(int_vlan_tag),
+               [META_ID(RXHASH)]               = META_FUNC(int_rxhash),
        }
  };
 
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Regards,
Changli Gao([email protected])
maintainer
#2 lore raw

From: Changli Gao <[email protected]>
Date: Tue, 24 Aug 2010 07:25:19 +0800

Quoted 11 lines

On Tue, Aug 24, 2010 at 4:08 AM, Stephen Hemminger

net/sched/em_meta.c META_COLLECTOR(int_maclen) · line 229

Quoted 8 lines
net/sched/em_meta.c +4 -0
@@ -223,6 +223,11 @@ META_COLLECTOR(int_maclen)
        dst->value = skb->mac_len;
  }
 
+META_COLLECTOR(int_rxhash)
+{
+       dst->value = skb->rxhash;
+}

How about using skb_get_rxhash instead. It returns the rxhash anyway.

Agreed.

#3 lore raw

Trivial extension to existing meta data match rules to allow matching on skb receive hash value.

---
This versions uses skb_get_rxhash()

include/linux/tc_ematch/tc_em_meta.h +1 -0
@@ -79,6 +79,7 @@ enum {
  	TCF_META_ID_SK_SENDMSG_OFF,
  	TCF_META_ID_SK_WRITE_PENDING,
 	TCF_META_ID_VLAN_TAG,
+	TCF_META_ID_RXHASH,
 	__TCF_META_ID_MAX
 };
 #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)
net/sched/em_meta.c +6 -0
@@ -223,6 +223,11 @@ META_COLLECTOR(int_maclen)
 	dst->value = skb->mac_len;
 }
 
+META_COLLECTOR(int_rxhash)
+{
+	dst->value = skb_get_rxhash(skb);
+}
+
 /**************************************************************************
  * Netfilter
  **************************************************************************/
@@ -541,6 +546,7 @@ static struct meta_ops __meta_ops[TCF_ME
 		[META_ID(SK_SENDMSG_OFF)]	= META_FUNC(int_sk_sendmsg_off),
 		[META_ID(SK_WRITE_PENDING)]	= META_FUNC(int_sk_write_pend),
 		[META_ID(VLAN_TAG)]		= META_FUNC(int_vlan_tag),
+		[META_ID(RXHASH)]		= META_FUNC(int_rxhash),
 	}
 };