netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [NET_SCHED 00/04]: Two fixes + cls_flow VLAN tag based classification
@ 2008-02-05 14:29 Patrick McHardy
  2008-02-05 14:29 ` [NET_SCHED 01/04]: em_meta: fix compile warning Patrick McHardy
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Patrick McHardy @ 2008-02-05 14:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, Patrick McHardy

These patches fix a compile warning in em_meta, an invalid check in
the flow classifier and add VLAN tag based classification to cls_flow.
Please apply, thanks.


 include/linux/if_vlan.h |    7 ++++---
 include/linux/pkt_cls.h |    1 +
 net/sched/cls_flow.c    |   17 +++++++++++++++--
 net/sched/em_meta.c     |    2 +-
 4 files changed, 21 insertions(+), 6 deletions(-)

Patrick McHardy (4):
      [NET_SCHED]: em_meta: fix compile warning
      [NET_SCHED]: cls_flow: fix key mask validity check
      [VLAN]: Constify skb argument to vlan_get_tag()
      [NET_SCHED]: cls_flow: support classification based on VLAN tag

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NET_SCHED 01/04]: em_meta: fix compile warning
  2008-02-05 14:29 [NET_SCHED 00/04]: Two fixes + cls_flow VLAN tag based classification Patrick McHardy
@ 2008-02-05 14:29 ` Patrick McHardy
  2008-02-06  0:19   ` David Miller
  2008-02-05 14:29 ` [NET_SCHED 02/04]: cls_flow: fix key mask validity check Patrick McHardy
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Patrick McHardy @ 2008-02-05 14:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, Patrick McHardy

[NET_SCHED]: em_meta: fix compile warning

net/sched/em_meta.c: In function 'meta_int_vlan_tag':
net/sched/em_meta.c:179: warning: 'tag' may be used uninitialized in this function

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit adfab462c5e0a32ffff274927bba4eec3afc6e35
tree bfac456798152d7ea6bedcca4a03b4f045605d3d
parent fb1c15ba9ebcab6478a409051ad26d7d180fe286
author Patrick McHardy <kaber@trash.net> Tue, 05 Feb 2008 15:22:21 +0100
committer Patrick McHardy <kaber@trash.net> Tue, 05 Feb 2008 15:22:21 +0100

 net/sched/em_meta.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index 9c2ec19..2a7e648 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -176,7 +176,7 @@ META_COLLECTOR(var_dev)
 
 META_COLLECTOR(int_vlan_tag)
 {
-	unsigned short tag;
+	unsigned short uninitialized_var(tag);
 	if (vlan_get_tag(skb, &tag) < 0)
 		*err = -1;
 	else

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [NET_SCHED 02/04]: cls_flow: fix key mask validity check
  2008-02-05 14:29 [NET_SCHED 00/04]: Two fixes + cls_flow VLAN tag based classification Patrick McHardy
  2008-02-05 14:29 ` [NET_SCHED 01/04]: em_meta: fix compile warning Patrick McHardy
@ 2008-02-05 14:29 ` Patrick McHardy
  2008-02-06  0:20   ` David Miller
  2008-02-05 14:29 ` [VLAN 03/04]: Constify skb argument to vlan_get_tag() Patrick McHardy
  2008-02-05 14:29 ` [NET_SCHED 04/04]: cls_flow: support classification based on VLAN tag Patrick McHardy
  3 siblings, 1 reply; 9+ messages in thread
From: Patrick McHardy @ 2008-02-05 14:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, Patrick McHardy

[NET_SCHED]: cls_flow: fix key mask validity check

Since we're using fls(), we need to check whether the value is non-zero first.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 2e5915ef51e55135522e59e041bb176432857d82
tree 9a42fac3d1646a378acdc91b55642b68c9d97dde
parent adfab462c5e0a32ffff274927bba4eec3afc6e35
author Patrick McHardy <kaber@trash.net> Tue, 05 Feb 2008 15:22:23 +0100
committer Patrick McHardy <kaber@trash.net> Tue, 05 Feb 2008 15:22:23 +0100

 net/sched/cls_flow.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index 8d76986..eeb223c 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -402,12 +402,13 @@ static int flow_change(struct tcf_proto *tp, unsigned long base,
 
 	if (tb[TCA_FLOW_KEYS]) {
 		keymask = nla_get_u32(tb[TCA_FLOW_KEYS]);
-		if (fls(keymask) - 1 > FLOW_KEY_MAX)
-			return -EOPNOTSUPP;
 
 		nkeys = hweight32(keymask);
 		if (nkeys == 0)
 			return -EINVAL;
+
+		if (fls(keymask) - 1 > FLOW_KEY_MAX)
+			return -EOPNOTSUPP;
 	}
 
 	err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &flow_ext_map);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [VLAN 03/04]: Constify skb argument to vlan_get_tag()
  2008-02-05 14:29 [NET_SCHED 00/04]: Two fixes + cls_flow VLAN tag based classification Patrick McHardy
  2008-02-05 14:29 ` [NET_SCHED 01/04]: em_meta: fix compile warning Patrick McHardy
  2008-02-05 14:29 ` [NET_SCHED 02/04]: cls_flow: fix key mask validity check Patrick McHardy
@ 2008-02-05 14:29 ` Patrick McHardy
  2008-02-06  0:20   ` David Miller
  2008-02-05 14:29 ` [NET_SCHED 04/04]: cls_flow: support classification based on VLAN tag Patrick McHardy
  3 siblings, 1 reply; 9+ messages in thread
From: Patrick McHardy @ 2008-02-05 14:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, Patrick McHardy

[VLAN]: Constify skb argument to vlan_get_tag()

Required by next patch to use it from the flow classifier.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 03faf81b8195be455c3c7592d76d712ea9d80b13
tree 9da377d2bd44421494a4c4d7cf6c705d199c26ce
parent 2e5915ef51e55135522e59e041bb176432857d82
author Patrick McHardy <kaber@trash.net> Tue, 05 Feb 2008 15:22:23 +0100
committer Patrick McHardy <kaber@trash.net> Tue, 05 Feb 2008 15:22:23 +0100

 include/linux/if_vlan.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 34f40ef..79504b2 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -327,7 +327,7 @@ static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, unsigned short t
  * 
  * Returns error if the skb is not of VLAN type
  */
-static inline int __vlan_get_tag(struct sk_buff *skb, unsigned short *tag)
+static inline int __vlan_get_tag(const struct sk_buff *skb, unsigned short *tag)
 {
 	struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
 
@@ -347,7 +347,8 @@ static inline int __vlan_get_tag(struct sk_buff *skb, unsigned short *tag)
  * 
  * Returns error if @skb->cb[] is not set correctly
  */
-static inline int __vlan_hwaccel_get_tag(struct sk_buff *skb, unsigned short *tag)
+static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
+					 unsigned short *tag)
 {
 	struct vlan_skb_tx_cookie *cookie;
 
@@ -370,7 +371,7 @@ static inline int __vlan_hwaccel_get_tag(struct sk_buff *skb, unsigned short *ta
  * 
  * Returns error if the skb is not VLAN tagged
  */
-static inline int vlan_get_tag(struct sk_buff *skb, unsigned short *tag)
+static inline int vlan_get_tag(const struct sk_buff *skb, unsigned short *tag)
 {
 	if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
 		return __vlan_hwaccel_get_tag(skb, tag);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [NET_SCHED 04/04]: cls_flow: support classification based on VLAN tag
  2008-02-05 14:29 [NET_SCHED 00/04]: Two fixes + cls_flow VLAN tag based classification Patrick McHardy
                   ` (2 preceding siblings ...)
  2008-02-05 14:29 ` [VLAN 03/04]: Constify skb argument to vlan_get_tag() Patrick McHardy
@ 2008-02-05 14:29 ` Patrick McHardy
  2008-02-06  0:21   ` David Miller
  3 siblings, 1 reply; 9+ messages in thread
From: Patrick McHardy @ 2008-02-05 14:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, Patrick McHardy

[NET_SCHED]: cls_flow: support classification based on VLAN tag

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 104092e6d90cba5fa00902a3154155872d693f42
tree 0e3fd5871a861fa022bbc2f34d314bb8672b556a
parent 03faf81b8195be455c3c7592d76d712ea9d80b13
author Patrick McHardy <kaber@trash.net> Tue, 05 Feb 2008 15:22:23 +0100
committer Patrick McHardy <kaber@trash.net> Tue, 05 Feb 2008 15:22:23 +0100

 include/linux/pkt_cls.h |    1 +
 net/sched/cls_flow.c    |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 40fac8c..28dfc61 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -348,6 +348,7 @@ enum
 	FLOW_KEY_RTCLASSID,
 	FLOW_KEY_SKUID,
 	FLOW_KEY_SKGID,
+	FLOW_KEY_VLAN_TAG,
 	__FLOW_KEY_MAX,
 };
 
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index eeb223c..971b867 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -19,6 +19,7 @@
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
+#include <linux/if_vlan.h>
 
 #include <net/pkt_cls.h>
 #include <net/ip.h>
@@ -270,6 +271,15 @@ static u32 flow_get_skgid(const struct sk_buff *skb)
 	return 0;
 }
 
+static u32 flow_get_vlan_tag(const struct sk_buff *skb)
+{
+	u16 uninitialized_var(tag);
+
+	if (vlan_get_tag(skb, &tag) < 0)
+		return 0;
+	return tag & VLAN_VID_MASK;
+}
+
 static u32 flow_key_get(const struct sk_buff *skb, int key)
 {
 	switch (key) {
@@ -305,6 +315,8 @@ static u32 flow_key_get(const struct sk_buff *skb, int key)
 		return flow_get_skuid(skb);
 	case FLOW_KEY_SKGID:
 		return flow_get_skgid(skb);
+	case FLOW_KEY_VLAN_TAG:
+		return flow_get_vlan_tag(skb);
 	default:
 		WARN_ON(1);
 		return 0;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [NET_SCHED 01/04]: em_meta: fix compile warning
  2008-02-05 14:29 ` [NET_SCHED 01/04]: em_meta: fix compile warning Patrick McHardy
@ 2008-02-06  0:19   ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2008-02-06  0:19 UTC (permalink / raw)
  To: kaber; +Cc: netdev

From: Patrick McHardy <kaber@trash.net>
Date: Tue,  5 Feb 2008 15:29:40 +0100 (MET)

> [NET_SCHED]: em_meta: fix compile warning
> 
> net/sched/em_meta.c: In function 'meta_int_vlan_tag':
> net/sched/em_meta.c:179: warning: 'tag' may be used uninitialized in this function
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [NET_SCHED 02/04]: cls_flow: fix key mask validity check
  2008-02-05 14:29 ` [NET_SCHED 02/04]: cls_flow: fix key mask validity check Patrick McHardy
@ 2008-02-06  0:20   ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2008-02-06  0:20 UTC (permalink / raw)
  To: kaber; +Cc: netdev

From: Patrick McHardy <kaber@trash.net>
Date: Tue,  5 Feb 2008 15:29:41 +0100 (MET)

> [NET_SCHED]: cls_flow: fix key mask validity check
> 
> Since we're using fls(), we need to check whether the value is non-zero first.
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [VLAN 03/04]: Constify skb argument to vlan_get_tag()
  2008-02-05 14:29 ` [VLAN 03/04]: Constify skb argument to vlan_get_tag() Patrick McHardy
@ 2008-02-06  0:20   ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2008-02-06  0:20 UTC (permalink / raw)
  To: kaber; +Cc: netdev

From: Patrick McHardy <kaber@trash.net>
Date: Tue,  5 Feb 2008 15:29:43 +0100 (MET)

> [VLAN]: Constify skb argument to vlan_get_tag()
> 
> Required by next patch to use it from the flow classifier.
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [NET_SCHED 04/04]: cls_flow: support classification based on VLAN tag
  2008-02-05 14:29 ` [NET_SCHED 04/04]: cls_flow: support classification based on VLAN tag Patrick McHardy
@ 2008-02-06  0:21   ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2008-02-06  0:21 UTC (permalink / raw)
  To: kaber; +Cc: netdev

From: Patrick McHardy <kaber@trash.net>
Date: Tue,  5 Feb 2008 15:29:44 +0100 (MET)

> [NET_SCHED]: cls_flow: support classification based on VLAN tag
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Also applied, thanks a lot.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-02-06  0:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-05 14:29 [NET_SCHED 00/04]: Two fixes + cls_flow VLAN tag based classification Patrick McHardy
2008-02-05 14:29 ` [NET_SCHED 01/04]: em_meta: fix compile warning Patrick McHardy
2008-02-06  0:19   ` David Miller
2008-02-05 14:29 ` [NET_SCHED 02/04]: cls_flow: fix key mask validity check Patrick McHardy
2008-02-06  0:20   ` David Miller
2008-02-05 14:29 ` [VLAN 03/04]: Constify skb argument to vlan_get_tag() Patrick McHardy
2008-02-06  0:20   ` David Miller
2008-02-05 14:29 ` [NET_SCHED 04/04]: cls_flow: support classification based on VLAN tag Patrick McHardy
2008-02-06  0:21   ` David Miller

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).