802.21 and MPLS headers and classification
Subsystems (3)
v3 cover 802.21 and MPLS headers and classification
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.
The first patches are resent without changes. The third patch was changed to use skb->protocol instead of checking the ethernet type to determine if MPLS was used, as suggested by David Miller.
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/linux/mpls.h | 6 ++++++ include/uapi/linux/if_ether.h | 1 + include/uapi/linux/mpls.h | 34 ++++++++++++++++++++++++++++++++++ net/wireless/util.c | 16 ++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 include/linux/mpls.h create mode 100644 include/uapi/linux/mpls.h
Signature · 1 line
1.7.10.4
A message that is not in the archive (sent off-list or not yet received): 1393244920-15903-1-git-send-email-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org
PATCH v3 3/3 cfg80211: add MPLS and 802.21 classification
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.
---
Changes to second version:
* rely on skb->protocol instead of checking ethertype
Changes to first version:
* include linux/mpls.h, not the UAPI one
* change __constant_htons to htons
--- net/wireless/util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/wireless/util.c +16 -0
@@ -11,6 +11,7 @@#include <net/ip.h> #include <net/dsfield.h> #include <linux/if_vlan.h> +#include <linux/mpls.h> #include "core.h" #include "rdev-ops.h"
@@ -717,6 +718,21 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb,case htons (ETH_P_IPV6 ): dscp =ipv6_get_dsfield (ipv6_hdr (skb)) &0xfc ;break ; +case htons (ETH_P_MPLS_UC ): +case htons (ETH_P_MPLS_MC ): { +struct mpls_label_stack mpls_tmp, *mpls; + + mpls =skb_header_pointer (skb,sizeof (struct ethhdr ), +sizeof (*mpls), &mpls_tmp); +if (!mpls) +return 0 ; + +return (ntohl (mpls->entry) &MPLS_LS_TC_MASK ) + >>MPLS_LS_TC_SHIFT ; + } +case htons (ETH_P_80221 ): +/* 802.21 is always network control traffic */ +return 7 ;default :return 0 ; }
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [net-next v3 3/3] cfg80211: add MPLS and 802.21 classification
Quoted 4 lines · 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.
Fine with me. I guess this should go through net-next due to the dependencies on patches 1 and 2.
Quoted 2 lines
Signed-off-by Simon Wunderlich <[email protected]>Signed-off-by Mathias Kretschmer <[email protected]>
johannes
Re: [net-next v3 3/3] cfg80211: add MPLS and 802.21 classification
In reply to Simon WunderlichHello.
Quoted 24 lines · 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 <[email protected]>Signed-off-by Mathias Kretschmer <[email protected]>---
Changes to second version:* rely on
skb->protocolinstead of checking ethertypeChanges to first version:
* include
linux/mpls.h, not the UAPI one
* change__constant_htonsto htons--- net/wireless/util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)net/wireless/util.c +0
-0
[...]
Quoted 6 lines
net/wireless/util.c +2
-0@@ -717,6 +718,21 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb,case htons (ETH_P_IPV6 ): dscp =ipv6_get_dsfield (ipv6_hdr (skb)) &0xfc ;break ; +case htons (ETH_P_MPLS_UC ): +case htons (ETH_P_MPLS_MC ): {
net/wireless/util.c unsigned int cfg80211_classify8021d(struct sk_buff *skb, · line 732
Quoted 10 lines
net/wireless/util.c +10
-0+struct mpls_label_stack mpls_tmp, *mpls; + + mpls =skb_header_pointer (skb,sizeof (struct ethhdr ), +sizeof (*mpls), &mpls_tmp); +if (!mpls) +return 0 ; + +return (ntohl (mpls->entry) &MPLS_LS_TC_MASK ) + >>MPLS_LS_TC_SHIFT ; + }
Brace is over-indented here, it can't be at the same level as the
statements it embraces.
WBR, Sergei
PATCH v3 1/3 if_ether.h: add IEEE 802.21 Ethertype
In reply to Simon WunderlichAdd the Ethertype for IEEE Std 802.21 - Media Independent Handover Protocol. This Ethertype is used for network control messages.
--- include/uapi/linux/if_ether.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/if_ether.h +1 -0
@@ -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 ] */
Signature · 1 line
1.7.10.4
PATCH v3 2/3 UAPI: add MPLS label stack definition
In reply to Simon WunderlichLabels for the Multiprotocol Label Switching are defined in RFC 3032 which was superseded by RFC 5462. Add the definition to UAPI and a stub header for include/linux.
---
Changes to first version:
* add stub mpls header in include/linux/mpls.h for users inside the kernel
--- include/linux/mpls.h | 6 ++++++ include/uapi/linux/mpls.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 include/linux/mpls.h create mode 100644 include/uapi/linux/mpls.h
include/linux/mpls.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _LINUX_MPLS_H +#define _LINUX_MPLS_H + +#include <uapi/linux/mpls.h> + +#endif /* _LINUX_MPLS_H */
include/uapi/linux/mpls.h new file +34 -0
@@ -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 */
Signature · 1 line
1.7.10.4
RE: [net-next v3 2/3] UAPI: add MPLS label stack definition
Quoted 1 line
Subject: [net-next v3 2/3] UAPI: add MPLS label stack definition
[...]
Quoted 7 lines
include/uapi/linux/mpls.h new file +7
-0+/* 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 | +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
include/uapi/linux/mpls.h line 23
Quoted 10 lines
include/uapi/linux/mpls.h new file +10
-0+* +* 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; +};
The "label stack" name isn't quite right as this struct describes just one entry in an MPLS label stack. Perhaps one of the following instead?
- mpls_label
- mpls_label_entry
- mpls_label_stack_entry
- mpls_lse.
I suppose mpls_label_stack_entry is the most pedantically correct (and is what RFC 3032 says); but for conciseness and general readability I favour mpls_label.
Regards,
Neil