All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next 0/3] 802.21 and MPLS headers and classification
@ 2014-02-12 10:53 ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-12 10:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-wireless, mathias.kretschmer, Simon Wunderlich

Hi,

this series contains a header file proposal for MPLS labels. These
labels do not seem to be properly defined in the kernel so far. We are
developing a wired/wireless 802.21/MPLS switch and need to check the
MPLS labels to use the traffic control info for transmissions over
802.11 networks.

Please let me know if I should send these patches to somewhere else - I
can certainly resend the 3rd patch to linux-wireless separately but
figured it would be better like this to keep the context.

Thanks,
     Simon

Simon Wunderlich (3):
  if_ether.h: add IEEE 802.21 Ethertype
  UAPI: add MPLS label stack definition
  cfg80211: add MPLS and 802.21 classification

 include/uapi/linux/if_ether.h |    1 +
 include/uapi/linux/mpls.h     |   34 ++++++++++++++++++++++++++++++++++
 net/wireless/util.c           |   24 ++++++++++++++++++++++++
 3 files changed, 59 insertions(+)
 create mode 100644 include/uapi/linux/mpls.h

-- 
1.7.10.4


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

* [net-next 0/3] 802.21 and MPLS headers and classification
@ 2014-02-12 10:53 ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-12 10:53 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	mathias.kretschmer-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh,
	Simon Wunderlich

Hi,

this series contains a header file proposal for MPLS labels. These
labels do not seem to be properly defined in the kernel so far. We are
developing a wired/wireless 802.21/MPLS switch and need to check the
MPLS labels to use the traffic control info for transmissions over
802.11 networks.

Please let me know if I should send these patches to somewhere else - I
can certainly resend the 3rd patch to linux-wireless separately but
figured it would be better like this to keep the context.

Thanks,
     Simon

Simon Wunderlich (3):
  if_ether.h: add IEEE 802.21 Ethertype
  UAPI: add MPLS label stack definition
  cfg80211: add MPLS and 802.21 classification

 include/uapi/linux/if_ether.h |    1 +
 include/uapi/linux/mpls.h     |   34 ++++++++++++++++++++++++++++++++++
 net/wireless/util.c           |   24 ++++++++++++++++++++++++
 3 files changed, 59 insertions(+)
 create mode 100644 include/uapi/linux/mpls.h

-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [net-next 1/3] if_ether.h: add IEEE 802.21 Ethertype
@ 2014-02-12 10:53   ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-12 10:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-wireless, mathias.kretschmer, Simon Wunderlich

Add the Ethertype for IEEE Std 802.21 - Media Independent Handover
Protocol. This Ethertype is used for network control messages.

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 include/uapi/linux/if_ether.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 2ce0f6a..2e27208 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -89,6 +89,7 @@
 #define ETH_P_FCOE	0x8906		/* Fibre Channel over Ethernet  */
 #define ETH_P_TDLS	0x890D          /* TDLS */
 #define ETH_P_FIP	0x8914		/* FCoE Initialization Protocol */
+#define ETH_P_80221	0x8917		/* IEEE 802.21 Media Independent Handover Protocol */
 #define ETH_P_QINQ1	0x9100		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_QINQ2	0x9200		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_QINQ3	0x9300		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
-- 
1.7.10.4


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

* [net-next 1/3] if_ether.h: add IEEE 802.21 Ethertype
@ 2014-02-12 10:53   ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-12 10:53 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	mathias.kretschmer-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh,
	Simon Wunderlich

Add the Ethertype for IEEE Std 802.21 - Media Independent Handover
Protocol. This Ethertype is used for network control messages.

Signed-off-by: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh@public.gmane.org>
---
 include/uapi/linux/if_ether.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 2ce0f6a..2e27208 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -89,6 +89,7 @@
 #define ETH_P_FCOE	0x8906		/* Fibre Channel over Ethernet  */
 #define ETH_P_TDLS	0x890D          /* TDLS */
 #define ETH_P_FIP	0x8914		/* FCoE Initialization Protocol */
+#define ETH_P_80221	0x8917		/* IEEE 802.21 Media Independent Handover Protocol */
 #define ETH_P_QINQ1	0x9100		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_QINQ2	0x9200		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_QINQ3	0x9300		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [net-next 2/3] UAPI: add MPLS label stack definition
@ 2014-02-12 10:53   ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-12 10:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-wireless, mathias.kretschmer, Simon Wunderlich

Labels for the Multiprotocol Label Switching are defined in RFC 3032
which was superseded by RFC 5462. Add the definition to UAPI.

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 include/uapi/linux/mpls.h |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 include/uapi/linux/mpls.h

diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h
new file mode 100644
index 0000000..15c8260
--- /dev/null
+++ b/include/uapi/linux/mpls.h
@@ -0,0 +1,34 @@
+#ifndef _UAPI_MPLS_H
+#define _UAPI_MPLS_H
+
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+/* Reference: RFC 5462, RFC 3032
+ *
+ *  0                   1                   2                   3
+ *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |                Label                  | TC  |S|       TTL     |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ *	Label:  Label Value, 20 bits
+ *	TC:     Traffic Class field, 3 bits
+ *	S:      Bottom of Stack, 1 bit
+ *	TTL:    Time to Live, 8 bits
+ */
+
+struct mpls_label_stack {
+	__be32 entry;
+};
+
+#define MPLS_LS_LABEL_MASK      0xFFFFF000
+#define MPLS_LS_LABEL_SHIFT     12
+#define MPLS_LS_TC_MASK         0x00000E00
+#define MPLS_LS_TC_SHIFT        9
+#define MPLS_LS_S_MASK          0x00000100
+#define MPLS_LS_S_SHIFT         8
+#define MPLS_LS_TTL_MASK        0x000000FF
+#define MPLS_LS_TTL_SHIFT       0
+
+#endif /* _UAPI_MPLS_H */
-- 
1.7.10.4


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

* [net-next 2/3] UAPI: add MPLS label stack definition
@ 2014-02-12 10:53   ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-12 10:53 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	mathias.kretschmer-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh,
	Simon Wunderlich

Labels for the Multiprotocol Label Switching are defined in RFC 3032
which was superseded by RFC 5462. Add the definition to UAPI.

Signed-off-by: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh@public.gmane.org>
---
 include/uapi/linux/mpls.h |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 include/uapi/linux/mpls.h

diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h
new file mode 100644
index 0000000..15c8260
--- /dev/null
+++ b/include/uapi/linux/mpls.h
@@ -0,0 +1,34 @@
+#ifndef _UAPI_MPLS_H
+#define _UAPI_MPLS_H
+
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+/* Reference: RFC 5462, RFC 3032
+ *
+ *  0                   1                   2                   3
+ *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |                Label                  | TC  |S|       TTL     |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ *	Label:  Label Value, 20 bits
+ *	TC:     Traffic Class field, 3 bits
+ *	S:      Bottom of Stack, 1 bit
+ *	TTL:    Time to Live, 8 bits
+ */
+
+struct mpls_label_stack {
+	__be32 entry;
+};
+
+#define MPLS_LS_LABEL_MASK      0xFFFFF000
+#define MPLS_LS_LABEL_SHIFT     12
+#define MPLS_LS_TC_MASK         0x00000E00
+#define MPLS_LS_TC_SHIFT        9
+#define MPLS_LS_S_MASK          0x00000100
+#define MPLS_LS_S_SHIFT         8
+#define MPLS_LS_TTL_MASK        0x000000FF
+#define MPLS_LS_TTL_SHIFT       0
+
+#endif /* _UAPI_MPLS_H */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [net-next 3/3] cfg80211: add MPLS and 802.21 classification
@ 2014-02-12 10:53   ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-12 10:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-wireless, mathias.kretschmer, Simon Wunderlich

MPLS labels may contain traffic control information, which should be
evaluated and used by the wireless subsystem if present.

Also check for IEEE 802.21 which is always network control traffic.

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 net/wireless/util.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index d39c371..98e3b11 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -11,6 +11,7 @@
 #include <net/ip.h>
 #include <net/dsfield.h>
 #include <linux/if_vlan.h>
+#include <uapi/linux/mpls.h>
 #include "core.h"
 #include "rdev-ops.h"
 
@@ -710,6 +711,29 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb,
 			return vlan_priority;
 	}
 
+	if (skb_headlen(skb) >= sizeof(struct ethhdr)) {
+		struct ethhdr *eh = (struct ethhdr *) skb->data;
+		struct mpls_label_stack mpls_tmp, *mpls;
+
+		switch (eh->h_proto) {
+		case __constant_htons(ETH_P_MPLS_UC):
+		case __constant_htons(ETH_P_MPLS_MC):
+			/* MPLS */
+			mpls = skb_header_pointer(skb, sizeof(*eh),
+						  sizeof(*mpls), &mpls_tmp);
+			if (!mpls)
+				break;
+
+			return (ntohl(mpls->entry) & MPLS_LS_TC_MASK)
+				>> MPLS_LS_TC_SHIFT;
+		case __constant_htons(ETH_P_80221):
+			/* 802.21 is always network control traffic */
+			return 7;
+		default:
+			break;
+		}
+	}
+
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):
 		dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc;
-- 
1.7.10.4


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

* [net-next 3/3] cfg80211: add MPLS and 802.21 classification
@ 2014-02-12 10:53   ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-12 10:53 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	mathias.kretschmer-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh,
	Simon Wunderlich

MPLS labels may contain traffic control information, which should be
evaluated and used by the wireless subsystem if present.

Also check for IEEE 802.21 which is always network control traffic.

Signed-off-by: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh@public.gmane.org>
---
 net/wireless/util.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index d39c371..98e3b11 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -11,6 +11,7 @@
 #include <net/ip.h>
 #include <net/dsfield.h>
 #include <linux/if_vlan.h>
+#include <uapi/linux/mpls.h>
 #include "core.h"
 #include "rdev-ops.h"
 
@@ -710,6 +711,29 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb,
 			return vlan_priority;
 	}
 
+	if (skb_headlen(skb) >= sizeof(struct ethhdr)) {
+		struct ethhdr *eh = (struct ethhdr *) skb->data;
+		struct mpls_label_stack mpls_tmp, *mpls;
+
+		switch (eh->h_proto) {
+		case __constant_htons(ETH_P_MPLS_UC):
+		case __constant_htons(ETH_P_MPLS_MC):
+			/* MPLS */
+			mpls = skb_header_pointer(skb, sizeof(*eh),
+						  sizeof(*mpls), &mpls_tmp);
+			if (!mpls)
+				break;
+
+			return (ntohl(mpls->entry) & MPLS_LS_TC_MASK)
+				>> MPLS_LS_TC_SHIFT;
+		case __constant_htons(ETH_P_80221):
+			/* 802.21 is always network control traffic */
+			return 7;
+		default:
+			break;
+		}
+	}
+
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):
 		dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [net-next 3/3] cfg80211: add MPLS and 802.21 classification
  2014-02-12 10:53   ` Simon Wunderlich
  (?)
@ 2014-02-12 11:49   ` Joe Perches
  2014-02-12 12:46     ` [PATCH] checkpatch: Warn on uses of __constant_<foo> functions Joe Perches
  2014-02-13 10:46       ` Simon Wunderlich
  -1 siblings, 2 replies; 13+ messages in thread
From: Joe Perches @ 2014-02-12 11:49 UTC (permalink / raw)
  To: Simon Wunderlich; +Cc: netdev, davem, linux-wireless, mathias.kretschmer

On Wed, 2014-02-12 at 11:53 +0100, Simon Wunderlich wrote:
> MPLS labels may contain traffic control information, which should be
> evaluated and used by the wireless subsystem if present.

trivial notes:

> diff --git a/net/wireless/util.c b/net/wireless/util.c
[]
> @@ -11,6 +11,7 @@
>  #include <net/ip.h>
>  #include <net/dsfield.h>
>  #include <linux/if_vlan.h>
> +#include <uapi/linux/mpls.h>

Please try not to #include uapi files.

> @@ -710,6 +711,29 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb,
>  			return vlan_priority;
>  	}
>  
> +	if (skb_headlen(skb) >= sizeof(struct ethhdr)) {
> +		struct ethhdr *eh = (struct ethhdr *) skb->data;
> +		struct mpls_label_stack mpls_tmp, *mpls;
> +
> +		switch (eh->h_proto) {
> +		case __constant_htons(ETH_P_MPLS_UC):
> +		case __constant_htons(ETH_P_MPLS_MC):

__constant_ isn't necessary for these labels.

>  	switch (skb->protocol) {
>  	case htons(ETH_P_IP):
>  		dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc;

like this, just case htons(ETH_<FOO>) is enough.



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

* [PATCH] checkpatch: Warn on uses of __constant_<foo> functions
  2014-02-12 11:49   ` Joe Perches
@ 2014-02-12 12:46     ` Joe Perches
  2014-02-13 10:46       ` Simon Wunderlich
  1 sibling, 0 replies; 13+ messages in thread
From: Joe Perches @ 2014-02-12 12:46 UTC (permalink / raw)
  To: Andrew Morton, Andy Whitcroft; +Cc: Simon Wunderlich, LKML

Emit a warning when using any of these __constant_<foo> forms:

	__constant_cpu_to_be[x]
	__constant_cpu_to_le[x]
	__constant_be[x]_to_cpu
	__constant_le[x]_to_cpu
	__constant_htons
	__constant_ntohs

Using any of these outside of include/uapi/ isn't preferred
as using the function without __constant_ is identical when
the argument is a constant.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 464dcef..8a5c49b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3910,6 +3910,19 @@ sub process {
 			}
 		}
 
+# don't use __constant_<foo> functions outside of include/uapi/
+		if ($realfile !~ m@^include/uapi/@ &&
+		    $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) {
+			my $constant_func = $1;
+			my $func = $constant_func;
+			$func =~ s/^__constant_//;
+			if (WARN("CONSTANT_CONVERSION",
+				 "$constant_func should be $func\n" . $herecurr) &&
+			    $fix) {
+				$fixed[$linenr - 1] =~ s/\b$constant_func\b/$func/g;
+			}
+		}
+
 # prefer usleep_range over udelay
 		if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
 			# ignore udelay's < 10, however



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

* Re: [net-next 3/3] cfg80211: add MPLS and 802.21 classification
  2014-02-12 11:49   ` Joe Perches
@ 2014-02-13 10:46       ` Simon Wunderlich
  2014-02-13 10:46       ` Simon Wunderlich
  1 sibling, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-13 10:46 UTC (permalink / raw)
  To: Joe Perches; +Cc: netdev, davem, linux-wireless, mathias.kretschmer

Hey Joe,

thanks for the comments!

> On Wed, 2014-02-12 at 11:53 +0100, Simon Wunderlich wrote:
> > MPLS labels may contain traffic control information, which should be
> > evaluated and used by the wireless subsystem if present.
> 
> trivial notes:
> > diff --git a/net/wireless/util.c b/net/wireless/util.c
> 
> []
> 
> > @@ -11,6 +11,7 @@
> > 
> >  #include <net/ip.h>
> >  #include <net/dsfield.h>
> >  #include <linux/if_vlan.h>
> > 
> > +#include <uapi/linux/mpls.h>
> 
> Please try not to #include uapi files.
> 

why not? The packet definition header has been put in UAPI, so I need that 
there ... or should we move that to some place else? Other protocol definition 
headers like IP, udp, tcp have been defined in uapi too the same way, so I 
figured that would be the right position.

> > @@ -710,6 +711,29 @@ unsigned int cfg80211_classify8021d(struct sk_buff
> > *skb,
> > 
> >  			return vlan_priority;
> >  	
> >  	}
> > 
> > +	if (skb_headlen(skb) >= sizeof(struct ethhdr)) {
> > +		struct ethhdr *eh = (struct ethhdr *) skb->data;
> > +		struct mpls_label_stack mpls_tmp, *mpls;
> > +
> > +		switch (eh->h_proto) {
> > +		case __constant_htons(ETH_P_MPLS_UC):
> 
> > +		case __constant_htons(ETH_P_MPLS_MC):
> __constant_ isn't necessary for these labels.
> 

OK, I will change that.

> >  	switch (skb->protocol) {
> >  	
> >  	case htons(ETH_P_IP):
> >  		dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc;
> 
> like this, just case htons(ETH_<FOO>) is enough.

OK.

I can rework and resend this particular patch - probably to linux wireless. If 
the other patches are ok, would you guys merge the first two patches to net-
next then?

Thanks,
    Simon

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

* Re: [net-next 3/3] cfg80211: add MPLS and 802.21 classification
@ 2014-02-13 10:46       ` Simon Wunderlich
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wunderlich @ 2014-02-13 10:46 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	mathias.kretschmer-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh

Hey Joe,

thanks for the comments!

> On Wed, 2014-02-12 at 11:53 +0100, Simon Wunderlich wrote:
> > MPLS labels may contain traffic control information, which should be
> > evaluated and used by the wireless subsystem if present.
> 
> trivial notes:
> > diff --git a/net/wireless/util.c b/net/wireless/util.c
> 
> []
> 
> > @@ -11,6 +11,7 @@
> > 
> >  #include <net/ip.h>
> >  #include <net/dsfield.h>
> >  #include <linux/if_vlan.h>
> > 
> > +#include <uapi/linux/mpls.h>
> 
> Please try not to #include uapi files.
> 

why not? The packet definition header has been put in UAPI, so I need that 
there ... or should we move that to some place else? Other protocol definition 
headers like IP, udp, tcp have been defined in uapi too the same way, so I 
figured that would be the right position.

> > @@ -710,6 +711,29 @@ unsigned int cfg80211_classify8021d(struct sk_buff
> > *skb,
> > 
> >  			return vlan_priority;
> >  	
> >  	}
> > 
> > +	if (skb_headlen(skb) >= sizeof(struct ethhdr)) {
> > +		struct ethhdr *eh = (struct ethhdr *) skb->data;
> > +		struct mpls_label_stack mpls_tmp, *mpls;
> > +
> > +		switch (eh->h_proto) {
> > +		case __constant_htons(ETH_P_MPLS_UC):
> 
> > +		case __constant_htons(ETH_P_MPLS_MC):
> __constant_ isn't necessary for these labels.
> 

OK, I will change that.

> >  	switch (skb->protocol) {
> >  	
> >  	case htons(ETH_P_IP):
> >  		dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc;
> 
> like this, just case htons(ETH_<FOO>) is enough.

OK.

I can rework and resend this particular patch - probably to linux wireless. If 
the other patches are ok, would you guys merge the first two patches to net-
next then?

Thanks,
    Simon
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [net-next 3/3] cfg80211: add MPLS and 802.21 classification
  2014-02-13 10:46       ` Simon Wunderlich
  (?)
@ 2014-02-13 11:14       ` Joe Perches
  -1 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2014-02-13 11:14 UTC (permalink / raw)
  To: Simon Wunderlich; +Cc: netdev, davem, linux-wireless, mathias.kretschmer

On Thu, 2014-02-13 at 11:46 +0100, Simon Wunderlich wrote:

Hi Simon

> > On Wed, 2014-02-12 at 11:53 +0100, Simon Wunderlich wrote:
> > > MPLS labels may contain traffic control information, which should be
> > > evaluated and used by the wireless subsystem if present.
[]
> > > diff --git a/net/wireless/util.c b/net/wireless/util.c
[]
> > > +#include <uapi/linux/mpls.h>
> > 
> > Please try not to #include uapi files.
> why not? The packet definition header has been put in UAPI, so I need that 
> there ... or should we move that to some place else? Other protocol definition 
> headers like IP, udp, tcp have been defined in uapi to the same way, so I 
> figured that would be the right position.

It seems the practice is to have another include/<net|linux>/mpls.h
file that #includes the <uapi/linux/mpls.h>

For instance, look at:

include/linux/udp.h

It does #include <uapi/linux/udp.h>

All the other kernel sources use

#include <linux/udp.h>




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

end of thread, other threads:[~2014-02-13 11:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12 10:53 [net-next 0/3] 802.21 and MPLS headers and classification Simon Wunderlich
2014-02-12 10:53 ` Simon Wunderlich
2014-02-12 10:53 ` [net-next 1/3] if_ether.h: add IEEE 802.21 Ethertype Simon Wunderlich
2014-02-12 10:53   ` Simon Wunderlich
2014-02-12 10:53 ` [net-next 2/3] UAPI: add MPLS label stack definition Simon Wunderlich
2014-02-12 10:53   ` Simon Wunderlich
2014-02-12 10:53 ` [net-next 3/3] cfg80211: add MPLS and 802.21 classification Simon Wunderlich
2014-02-12 10:53   ` Simon Wunderlich
2014-02-12 11:49   ` Joe Perches
2014-02-12 12:46     ` [PATCH] checkpatch: Warn on uses of __constant_<foo> functions Joe Perches
2014-02-13 10:46     ` [net-next 3/3] cfg80211: add MPLS and 802.21 classification Simon Wunderlich
2014-02-13 10:46       ` Simon Wunderlich
2014-02-13 11:14       ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.