6lowpan: introduce nhc framework
Alexander Aring
maintainerv4 cover 6lowpan: introduce nhc framework
This patch series introduce the next header compression framework. Currently we support udp compression/uncompression only. This framework allow to add new next header compression formats easily.
If somebody wants to add a new header compression format and some information are missing while calling compression and uncompression callbacks. Please feel free to make framework changes according these callbacks.
changes since v2:
- make udp nhc as module as suggested by Marcel Holtmann
- fix comment header in nhc_udp.c
I didn't make the lowpan_nhc declaration "const" because this will occur issues with rb_node, id and idmask array. Which will manipulated during runtime.
changes since v3:
- add patch 3/3 for other known rfc6282 ipv6 extension headers compression formats
- add request_modules for loading nhc default compression format modules. Which was suggested by Jukka Rissanen. Thanks, this is really working.
- Add rtnl_lock for lowpan_nhc_add and del since we have no synced request_modules call this could make trouble.
- Move some handling out of nhc_do_compression and uncompression function. The complete handling is now inside of iphc.c and nhc_do_compression and uncompression functions is only a wrapper call for the callback.
- rework some menuentries for Kconfig and compression format, they are grouped by rfc now.
- move some generic handling like "skb_pull(skb, nhc->nexthdrlen);" into iphc.c. It would be great if we have something also for uncompression for the skb_cow. But this isn't possible right now.
- change warning if nhc was not found to "was not found" instead isn't implemented. It isn't implemented if callbacks are NULL now.
- small cleanups.
changes since v4:
- add spinlock for to prevent nhc from deletion while using. This can occur if nhc module is unloading while compression/uncompression.
- move nhc handling for nhc compression/uncompression completely into nhc_do_compression/nhc_do_uncompression.
Note about locking:
We have now a spinlock nhc_lowpan_lock which prevents manipulating the nhc datastructures while using it. On receiving side it's easy to handle, at the end we check if 6lowpan nh compressed flag is set and run uncompression. On the other hand the transmit side is complicated, we check if next_hdr field is registrated and run some other compression routines, at least we do the finally nhc compression which depends on the first check if next_hdr was registrated. The kernel will crash if we remove the using module between "next_hdr check" and "do nhc compression", the lock will prevent that now.
Now in the transmit path exist a little window to remove a lowpan_nhc while compression. This is exactly the part between "check if we support" and "doing compression". This is a very unlikely case, if this occurs we drop the packet while compression. Don't know how to better deal with that right now. I will try to search a better solution later.
Alexander Aring (3):
6lowpan: add generic nhc layer interface 6lowpan: add udp compression via nhc layer 6lowpan: nhc: add other known rfc6282 compressions
net/6lowpan/Kconfig | 60 +++++++++- net/6lowpan/Makefile | 13 ++- net/6lowpan/iphc.c | 200 ++++++--------------------------- net/6lowpan/nhc.c | 241 ++++++++++++++++++++++++++++++++++++++++ net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++ 12 files changed, 802 insertions(+), 171 deletions(-) create mode 100644 net/6lowpan/nhc.c create mode 100644 net/6lowpan/nhc.h create mode 100644 net/6lowpan/nhc_rfc6282_dest.c create mode 100644 net/6lowpan/nhc_rfc6282_frag.c create mode 100644 net/6lowpan/nhc_rfc6282_hop.c create mode 100644 net/6lowpan/nhc_rfc6282_ipv6.c create mode 100644 net/6lowpan/nhc_rfc6282_mobil.c create mode 100644 net/6lowpan/nhc_rfc6282_route.c create mode 100644 net/6lowpan/nhc_rfc6282_udp.c
Signature · 1 line
2.2.1
Alexander Aring
maintainerPATCH v4 1/3 6lowpan: add generic nhc layer interface
This patch adds a generic next header compression layer interface. There exists various methods to do a header compression after 6LoWPAN header to save payload. This introduce a generic nhc header which allow a simple adding of a new header compression format instead of a static implementation inside the 6LoWPAN header compression and uncompression function.
--- net/6lowpan/Makefile | 2 +- net/6lowpan/nhc.c | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++ net/6lowpan/nhc.h | 146 +++++++++++++++++++++++++++++++ 3 files changed, 388 insertions(+), 1 deletion(-) create mode 100644 net/6lowpan/nhc.c create mode 100644 net/6lowpan/nhc.h
net/6lowpan/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-$(CONFIG_6LOWPAN) := 6lowpan.o -6lowpan-y := iphc.o +6lowpan-y := iphc.o nhc.o
net/6lowpan/nhc.c new file +241 -0
241 lines not on this page · raw message
net/6lowpan/nhc.h new file +146 -0
146 lines not on this page · raw message
Signature · 1 line
2.2.1
Alexander Aring
maintainerPATCH v4 2/3 6lowpan: add udp compression via nhc layer
In reply to Alexander AringThis patch move UDP header compression and uncompression into the generic 6LoWPAN nhc header compression layer. Moreover this patch activates the nhc layer compression in iphc compression and uncompression functions.
--- net/6lowpan/Kconfig | 16 +++- net/6lowpan/Makefile | 5 +- net/6lowpan/iphc.c | 194 ++++++------------------------------------ net/6lowpan/nhc_rfc6282_udp.c | 156 +++++++++++++++++++++++++++++++++ 4 files changed, 201 insertions(+), 170 deletions(-) create mode 100644 net/6lowpan/nhc_rfc6282_udp.c
net/6lowpan/Kconfig +15 -1
@@ -1,6 +1,20 @@ -config 6LOWPAN +menuconfig 6LOWPAN tristate "6LoWPAN Support" depends on IPV6 ---help--- This enables IPv6 over Low power Wireless Personal Area Network - "6LoWPAN" which is supported by IEEE 802.15.4 or Bluetooth stacks. + +menuconfig 6LOWPAN_NHC_RFC6282 + tristate "NHC RFC6282" + depends on 6LOWPAN + default y + ---help--- + Support for next header compression accroding to RFC6282. + +config 6LOWPAN_NHC_RFC6282_UDP + tristate "UDP Header Support" + depends on 6LOWPAN_NHC_RFC6282 + default y + ---help--- + 6LoWPAN IPv6 UDP Header compression according to RFC6282.
net/6lowpan/Makefile +4 -1
@@ -1,3 +1,6 @@ -obj-$(CONFIG_6LOWPAN) := 6lowpan.o +obj-$(CONFIG_6LOWPAN) += 6lowpan.o 6lowpan-y := iphc.o nhc.o + +#rfc6282 nhc +obj-$(CONFIG_6LOWPAN_NHC_RFC6282_UDP) += nhc_rfc6282_udp.o
net/6lowpan/iphc.c +26 -168
242 lines not on this page · raw message
net/6lowpan/nhc_rfc6282_udp.c new file +156 -0
156 lines not on this page · raw message
Signature · 1 line
2.2.1
Alexander Aring
maintainerPATCH v4 3/3 6lowpan: nhc: add other known rfc6282 compressions
In reply to Alexander AringThis patch adds other known rfc6282 compression formats to the nhc framework. These compression formats are known but not implemented yet. For now this is useful to printout a warning which compression format isn't supported.
--- net/6lowpan/Kconfig | 44 +++++++++++++++++++++++++++++++++++++++++ net/6lowpan/Makefile | 6 ++++++ net/6lowpan/iphc.c | 6 ++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_frag.c | 26 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_hop.c | 26 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_route.c | 26 ++++++++++++++++++++++++ 9 files changed, 213 insertions(+) create mode 100644 net/6lowpan/nhc_rfc6282_dest.c create mode 100644 net/6lowpan/nhc_rfc6282_frag.c create mode 100644 net/6lowpan/nhc_rfc6282_hop.c create mode 100644 net/6lowpan/nhc_rfc6282_ipv6.c create mode 100644 net/6lowpan/nhc_rfc6282_mobil.c create mode 100644 net/6lowpan/nhc_rfc6282_route.c
net/6lowpan/Kconfig +44 -0
@@ -18,3 +18,47 @@ config 6LOWPAN_NHC_RFC6282_UDP default y ---help--- 6LoWPAN IPv6 UDP Header compression according to RFC6282. + +config 6LOWPAN_NHC_RFC6282_DEST + tristate "Destination Options Header Support" + depends on 6LOWPAN_NHC_RFC6282 + default y + ---help--- + 6LoWPAN IPv6 Destination Options Header compression according to + RFC6282. + +config 6LOWPAN_NHC_RFC6282_FRAG + tristate "Fragment Header Support" + depends on 6LOWPAN_NHC_RFC6282 + default y + ---help--- + 6LoWPAN IPv6 Fragment Header compression according to RFC6282. + +config 6LOWPAN_NHC_RFC6282_HOP + tristate "Hop-by-Hop Options Header Support" + depends on 6LOWPAN_NHC_RFC6282 + default y + ---help--- + 6LoWPAN IPv6 Hop-by-Hop Options Header compression according to + RFC6282. + +config 6LOWPAN_NHC_RFC6282_IPV6 + tristate "IPv6 Header Support" + depends on 6LOWPAN_NHC_RFC6282 + default y + ---help--- + 6LoWPAN IPv6 Header compression according to RFC6282. + +config 6LOWPAN_NHC_RFC6282_MOBIL + tristate "Mobility Header Support" + depends on 6LOWPAN_NHC_RFC6282 + default y + ---help--- + 6LoWPAN IPv6 Mobility Header compression according to RFC6282. + +config 6LOWPAN_NHC_RFC6282_ROUTE + tristate "Routing Header Support" + depends on 6LOWPAN_NHC_RFC6282 + default y + ---help--- + 6LoWPAN IPv6 Routing Header compression according to RFC6282.
net/6lowpan/Makefile +6 -0
@@ -4,3 +4,9 @@ obj-$(CONFIG_6LOWPAN) += 6lowpan.o #rfc6282 nhc obj-$(CONFIG_6LOWPAN_NHC_RFC6282_UDP) += nhc_rfc6282_udp.o +obj-$(CONFIG_6LOWPAN_NHC_RFC6282_DEST) += nhc_rfc6282_dest.o +obj-$(CONFIG_6LOWPAN_NHC_RFC6282_FRAG) += nhc_rfc6282_frag.o +obj-$(CONFIG_6LOWPAN_NHC_RFC6282_HOP) += nhc_rfc6282_hop.o +obj-$(CONFIG_6LOWPAN_NHC_RFC6282_IPV6) += nhc_rfc6282_ipv6.o +obj-$(CONFIG_6LOWPAN_NHC_RFC6282_MOBIL) += nhc_rfc6282_mobil.o +obj-$(CONFIG_6LOWPAN_NHC_RFC6282_ROUTE) += nhc_rfc6282_route.o
net/6lowpan/iphc.c +6 -0
@@ -613,6 +613,12 @@ EXPORT_SYMBOL_GPL(lowpan_header_compress);static int __init lowpan_module_init (void ) { +request_module_nowait ("nhc_rfc6282_dest" ); +request_module_nowait ("nhc_rfc6282_frag" ); +request_module_nowait ("nhc_rfc6282_hop" ); +request_module_nowait ("nhc_rfc6282_ipv6" ); +request_module_nowait ("nhc_rfc6282_mobil" ); +request_module_nowait ("nhc_rfc6282_route" );request_module_nowait ("nhc_rfc6282_udp" );return 0 ;
net/6lowpan/nhc_rfc6282_dest.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* 6LoWPAN IPv6 Destination Options Header compression according to +* RFC6282 +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include "nhc.h" + +#define LOWPAN_NHC_DEST_IDLEN 1 +#define LOWPAN_NHC_DEST_ID_0 0xe6 +#define LOWPAN_NHC_DEST_MASK_0 0xfe + +static void dest_nhid_setup (struct lowpan_nhc *nhc) +{ + nhc->id[0 ] =LOWPAN_NHC_DEST_ID_0 ; + nhc->idmask[0 ] =LOWPAN_NHC_DEST_MASK_0 ; +} + +LOWPAN_NHC (nhc_dest,"RFC6282 Destination Options" ,NEXTHDR_DEST ,0 , + dest_nhid_setup,LOWPAN_NHC_DEST_IDLEN ,NULL ,NULL ); + +module_lowpan_nhc (nhc_dest); +MODULE_LICENSE ("GPL" );
net/6lowpan/nhc_rfc6282_frag.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* 6LoWPAN IPv6 Fragment Header compression according to RFC6282 +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include "nhc.h" + +#define LOWPAN_NHC_FRAG_IDLEN 1 +#define LOWPAN_NHC_FRAG_ID_0 0xe4 +#define LOWPAN_NHC_FRAG_MASK_0 0xfe + +static void frag_nhid_setup (struct lowpan_nhc *nhc) +{ + nhc->id[0 ] =LOWPAN_NHC_FRAG_ID_0 ; + nhc->idmask[0 ] =LOWPAN_NHC_FRAG_MASK_0 ; +} + +LOWPAN_NHC (nhc_frag,"RFC6282 Fragment" ,NEXTHDR_FRAGMENT ,0 , + frag_nhid_setup,LOWPAN_NHC_FRAG_IDLEN ,NULL ,NULL ); + +module_lowpan_nhc (nhc_frag); +MODULE_LICENSE ("GPL" );
net/6lowpan/nhc_rfc6282_hop.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* 6LoWPAN IPv6 Hop-by-Hop Options Header compression according to RFC6282 +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include "nhc.h" + +#define LOWPAN_NHC_HOP_IDLEN 1 +#define LOWPAN_NHC_HOP_ID_0 0xe0 +#define LOWPAN_NHC_HOP_MASK_0 0xfe + +static void hop_nhid_setup (struct lowpan_nhc *nhc) +{ + nhc->id[0 ] =LOWPAN_NHC_HOP_ID_0 ; + nhc->idmask[0 ] =LOWPAN_NHC_HOP_MASK_0 ; +} + +LOWPAN_NHC (nhc_hop,"RFC6282 Hop-by-Hop Options" ,NEXTHDR_HOP ,0 , + hop_nhid_setup,LOWPAN_NHC_HOP_IDLEN ,NULL ,NULL ); + +module_lowpan_nhc (nhc_hop); +MODULE_LICENSE ("GPL" );
net/6lowpan/nhc_rfc6282_ipv6.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* 6LoWPAN IPv6 Header compression according to RFC6282 +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include "nhc.h" + +#define LOWPAN_NHC_IPV6_IDLEN 1 +#define LOWPAN_NHC_IPV6_ID_0 0xee +#define LOWPAN_NHC_IPV6_MASK_0 0xfe + +static void ipv6_nhid_setup (struct lowpan_nhc *nhc) +{ + nhc->id[0 ] =LOWPAN_NHC_IPV6_ID_0 ; + nhc->idmask[0 ] =LOWPAN_NHC_IPV6_MASK_0 ; +} + +LOWPAN_NHC (nhc_ipv6,"RFC6282 IPv6" ,NEXTHDR_IPV6 ,0 , ipv6_nhid_setup, +LOWPAN_NHC_IPV6_IDLEN ,NULL ,NULL ); + +module_lowpan_nhc (nhc_ipv6); +MODULE_LICENSE ("GPL" );
net/6lowpan/nhc_rfc6282_mobil.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* 6LoWPAN IPv6 Mobility Header compression according to RFC6282 +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include "nhc.h" + +#define LOWPAN_NHC_MOBIL_IDLEN 1 +#define LOWPAN_NHC_MOBIL_ID_0 0xe8 +#define LOWPAN_NHC_MOBIL_MASK_0 0xfe + +static void mobil_nhid_setup (struct lowpan_nhc *nhc) +{ + nhc->id[0 ] =LOWPAN_NHC_MOBIL_ID_0 ; + nhc->idmask[0 ] =LOWPAN_NHC_MOBIL_MASK_0 ; +} + +LOWPAN_NHC (nhc_mobil,"RFC6282 Mobility" ,NEXTHDR_MOBILITY ,0 , + mobil_nhid_setup,LOWPAN_NHC_MOBIL_IDLEN ,NULL ,NULL ); + +module_lowpan_nhc (nhc_mobil); +MODULE_LICENSE ("GPL" );
net/6lowpan/nhc_rfc6282_route.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* 6LoWPAN IPv6 Routing Header compression according to RFC6282 +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include "nhc.h" + +#define LOWPAN_NHC_ROUTE_IDLEN 1 +#define LOWPAN_NHC_ROUTE_ID_0 0xe2 +#define LOWPAN_NHC_ROUTE_MASK_0 0xfe + +static void route_nhid_setup (struct lowpan_nhc *nhc) +{ + nhc->id[0 ] =LOWPAN_NHC_ROUTE_ID_0 ; + nhc->idmask[0 ] =LOWPAN_NHC_ROUTE_MASK_0 ; +} + +LOWPAN_NHC (nhc_route,"RFC6282 Routing" ,NEXTHDR_ROUTING ,0 , route_nhid_setup, +LOWPAN_NHC_ROUTE_IDLEN ,NULL ,NULL ); + +module_lowpan_nhc (nhc_route); +MODULE_LICENSE ("GPL" );
Signature · 1 line
2.2.1
Marcel Holtmann
maintainerHi Alex,
Quoted 67 lines
This patch series introduce the next header compression framework. Currently we support udp compression/uncompression only. This framework allow to add new next header compression formats easily.
If somebody wants to add a new header compression format and some information are missing while calling compression and uncompression callbacks. Please feel free to make framework changes according these callbacks.
changes since v2:
- make udp nhc as module as suggested by Marcel Holtmann
- fix comment header innhc_udp.cI didn't make the
lowpan_nhcdeclaration "const" because this will occur issues withrb_node, id and idmask array. Which will manipulated during runtime.changes since v3:
- add patch 3/3 for other known rfc6282 ipv6 extension headers compression formats
- addrequest_modulesfor loading nhc default compression format modules. Which was suggested by Jukka Rissanen. Thanks, this is really working.
- Addrtnl_lockforlowpan_nhc_addand del since we have no syncedrequest_modulescall this could make trouble.
- Move some handling out ofnhc_do_compressionand uncompression function. The complete handling is now inside ofiphc.candnhc_do_compressionand uncompression functions is only a wrapper call for the callback.
- rework some menuentries forKconfigand compression format, they are grouped by rfc now.
- move some generic handling like "skb_pull(skb, nhc->nexthdrlen);" intoiphc.c. It would be great if we have something also for uncompression for theskb_cow. But this isn't possible right now.
- change warning if nhc was not found to "was not found" instead isn't implemented. It isn't implemented if callbacks are NULL now.
- small cleanups.changes since v4:
- add spinlock for to prevent nhc from deletion while using. This can occur if nhc module is unloading while compression/uncompression.
- move nhc handling for nhc compression/uncompression completely into nhc_do_compression/nhc_do_uncompression.Note about locking:
We have now a spinlock
nhc_lowpan_lockwhich prevents manipulating the nhc datastructures while using it. On receiving side it's easy to handle, at the end we check if 6lowpan nh compressed flag is set and run uncompression. On the other hand the transmit side is complicated, we check ifnext_hdrfield is registrated and run some other compression routines, at least we do the finally nhc compression which depends on the first check ifnext_hdrwas registrated. The kernel will crash if we remove the using module between "next_hdrcheck" and "do nhc compression", the lock will prevent that now.Now in the transmit path exist a little window to remove a
lowpan_nhcwhile compression. This is exactly the part between "check if we support" and "doing compression". This is a very unlikely case, if this occurs we drop the packet while compression. Don't know how to better deal with that right now. I will try to search a better solution later.Cc Jukka Rissanen <[email protected]>Cc Martin Townsend <[email protected]>Cc Marcel Holtmann <[email protected]>Alexander Aring (3):
6lowpan: add generic nhc layer interface 6lowpan: add udp compression via nhc layer 6lowpan: nhc: add other known rfc6282 compressions
Quoted 12 lines
net/6lowpan/Kconfig | 60 +++++++++- net/6lowpan/Makefile | 13 ++- net/6lowpan/iphc.c | 200 ++++++--------------------------- net/6lowpan/nhc.c | 241 ++++++++++++++++++++++++++++++++++++++++ net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++
can we please remove the _rfc6282 from the filenames. RFCs get update and thus change numbers. I do not want to carry RFC numbers in filenames around. There is also almost no precedence in the kernel source code that would justify doing this.
Regards
Marcel
Hello.
Quoted 100 lines · Marcel Holtmann
Hi Alex,
Quoted 1 line
This patch series introduce the next header compression framework.
Currently
Quoted 1 line
we support udp compression/uncompression only. This framework allow to
add new
Quoted 3 lines
next header compression formats easily.
If somebody wants to add a new header compression format and some
information
Quoted 1 line
are missing while calling compression and uncompression callbacks.
Please
Quoted 6 lines
feel free to make framework changes according these callbacks.
changes since v2:
- make udp nhc as module as suggested by Marcel Holtmann
- fix comment header innhc_udp.cQuoted 6 lines
I didn't make the
lowpan_nhcdeclaration "const" because this will occur issues withrb_node, id and idmask array. Which will manipulated during runtime.changes since v3:
- add patch 3/3 for other known rfc6282 ipv6 extension headerscompression
Quoted 2 lines
formats
- addrequest_modulesfor loading nhc default compression formatmodules.
Quoted 4 lines
Which was suggested by Jukka Rissanen. Thanks, this is really working.
- Addrtnl_lockforlowpan_nhc_addand del since we have no syncedrequest_modulescall this could make trouble.
- Move some handling out ofnhc_do_compressionand uncompressionfunction.
Quoted 1 line
The complete handling is now inside of
iphc.candnhc_do_compressionand
Quoted 10 lines
uncompression functions is only a wrapper call for the callback.
- rework some menuentries forKconfigand compression format, they are grouped by rfc now.
- move some generic handling like "skb_pull(skb, nhc->nexthdrlen);" intoiphc.c. It would be great if we have something also for uncompression for theskb_cow. But this isn't possible right now.
- change warning if nhc was not found to "was not found" instead isn't implemented. It isn't implemented if callbacks are NULL now.
- small cleanups.Quoted 2 lines
changes since v4:
- add spinlock for to prevent nhc from deletion while using. This canoccur
Quoted 7 lines
if nhc module is unloading while compression/uncompression.
- move nhc handling for nhc compression/uncompression completely into nhc_do_compression/nhc_do_uncompression.Note about locking:
We have now a spinlock
nhc_lowpan_lockwhich prevents manipulating thenhc
Quoted 1 line
datastructures while using it. On receiving side it's easy to handle, at
the
Quoted 2 lines
end we check if 6lowpan nh compressed flag is set and run uncompression. On the other hand the transmit side is complicated, we check if
next_hdrfield
Quoted 1 line
is registrated and run some other compression routines, at least we do
the
Quoted 3 lines
finally nhc compression which depends on the first check if
next_hdrwas registrated. The kernel will crash if we remove the using module between "next_hdrcheck" and "do nhc compression", the lock will prevent thatnow.
Quoted 2 lines
Now in the transmit path exist a little window to remove a
lowpan_nhcwhile
Quoted 2 lines
compression. This is exactly the part between "check if we support" and "doing compression". This is a very unlikely case, if this occurs we
drop
Quoted 1 line
the packet while compression. Don't know how to better deal with that
right
Quoted 11 lines
now. I will try to search a better solution later.
Cc Jukka Rissanen <[email protected]>Cc Martin Townsend <[email protected]>Cc Marcel Holtmann <[email protected]>Alexander Aring (3):
6lowpan: add generic nhc layer interface 6lowpan: add udp compression via nhc layer 6lowpan: nhc: add other known rfc6282 compressionsQuoted 4 lines
net/6lowpan/Kconfig | 60 +++++++++- net/6lowpan/Makefile | 13 ++- net/6lowpan/iphc.c | 200 ++++++--------------------------- net/6lowpan/nhc.c | 241++++++++++++++++++++++++++++++++++++++++
Quoted 8 lines
net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++
Quoted 4 lines
can we please remove the
_rfc6282from the filenames. RFCs get update and thus change numbers. I do not want to carry RFC numbers in filenames around. There is also almost no precedence in the kernel source code that would justify doing this.
They look indeed quite ugly in the filename. :)
Moving them as a comment and starting point into the file should be enough. Maybe we can also rename nhc_mobil to nhc_mobility. The other abbreviations are clear in my opinion but for mobil I actually opened the rfc to look what you mean here.
regards
Stefan Schmidt
Alexander Aring
maintainerHi,
On Thu, Jan 08, 2015 at 07:18:57PM +0000, Stefan Schmidt wrote:
...
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++Quoted 4 lines
can we please remove the
_rfc6282from the filenames. RFCs get update and thus change numbers. I do not want to carry RFC numbers in filenames around. There is also almost no precedence in the kernel source code that would justify doing this.
Quoted 7 lines
They look indeed quite ugly in the filename. :)
Moving them as a comment and starting point into the file should be enough. Maybe we can also rename
nhc_mobiltonhc_mobility. The other abbreviations are clear in my opinion but for mobil I actually opened the rfc to look what you mean here.
For the rfc6282 thing:
Currently there exists two RFCs which describes an UDP compression. It's rfc6282 (the well known 6LoWPAN IPHC compression RFC) and RFC7400 which was pointed out by Martin Townsend [0].
We need to clarify how we should deal with multiple definitions for a compression format. On receiving side we should always support what we can which is decided by the variable nhcid length. While on transmit... we need still some configuration interface (my dreams are to decide the compression methods per socket, don't know how possible that is).
For the handling I thought that we have then two UDP nhc modules, both can be loaded (at the moment _only_ one UDP nhc compressression should implement the compress methods, both should implement uncompression methods).
I can rename it to nhc_udp.c for the standard compression methods according to rfc6282, I am fine with that. But later there exists then an another compression module with the naming "nhc_ghc_udp.c" or something else. So we have "nhc_udp.ko" and "nhc_ghc_udp.ko". Is that okay for everybody?
Maybe I should also add some modinfo information, which containing the nhc->name.
For the nexthdr names:
I will try to change it according to the NEXTHDR IPv6 defines [1], so also the linux IPv6 guys knows what it is.
- Alex
[0] https://tools.ietf.org/html/rfc7400
[1] http://lxr.free-electrons.com/source/include/net/ipv6.h#L33
Alexander Aring
maintainerQuoted 43 lines · Alexander Aring
Hi,
On Thu, Jan 08, 2015 at 07:18:57PM +0000, Stefan Schmidt wrote:
...Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++Quoted 4 lines
can we please remove the
_rfc6282from the filenames. RFCs get update and thus change numbers. I do not want to carry RFC numbers in filenames around. There is also almost no precedence in the kernel source code that would justify doing this.Quoted 7 lines
They look indeed quite ugly in the filename. :)
Moving them as a comment and starting point into the file should be enough. Maybe we can also rename
nhc_mobiltonhc_mobility. The other abbreviations are clear in my opinion but for mobil I actually opened the rfc to look what you mean here.For the rfc6282 thing:
Currently there exists two RFCs which describes an UDP compression. It's rfc6282 (the well known 6LoWPAN IPHC compression RFC) and RFC7400 which was pointed out by Martin Townsend [0].
We need to clarify how we should deal with multiple definitions for a compression format. On receiving side we should always support what we can which is decided by the variable nhcid length. While on transmit... we need still some configuration interface (my dreams are to decide the compression methods per socket, don't know how possible that is).
For the handling I thought that we have then two UDP nhc modules, both can be loaded (at the moment _only_ one UDP nhc compressression should implement the compress methods, both should implement uncompression methods).
Quoted 6 lines
I can rename it to
nhc_udp.cfor the standard compression methods according to rfc6282, I am fine with that. But later there exists then an another compression module with the naming "nhc_ghc_udp.c" or something else. So we have "nhc_udp.ko" and "nhc_ghc_udp.ko". Is that okay for everybody?
We can also put all udp compression formats into the nhc_udp.c file. But then all udp compressions are handled by one module then. We should not do that, because we can handle it per module.
- Alex
Hello.
Quoted 56 lines · Alexander Aring
Quoted 48 lines · Alexander Aring
Hi,
On Thu, Jan 08, 2015 at 07:18:57PM +0000, Stefan Schmidt wrote:
...Quoted 18 lines
Quoted 9 lines
Quoted 8 lines
net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++Quoted 6 lines
can we please remove the
_rfc6282from the filenames. RFCs get update and
thus change numbers. I do not want to carry RFC numbers in filenames around. There is also almost no precedence in the kernel source code that
would justify doing this.They look indeed quite ugly in the filename. :)
Quoted 8 lines
Moving them as a comment and starting point into the file should be enough.
Maybe we can also renamenhc_mobiltonhc_mobility. The other abbreviations
are clear in my opinion but for mobil I actually opened the rfc to look what
you mean here.For the rfc6282 thing:
Currently there exists two RFCs which describes an UDP compression. It's rfc6282 (the well known 6LoWPAN IPHC compression RFC) and RFC7400 which was pointed out by Martin Townsend [0].
We need to clarify how we should deal with multiple definitions for a compression format. On receiving side we should always support what we can which is decided by the variable nhcid length. While on transmit... we need still some configuration interface (my dreams are to decide the compression methods per socket, don't know how possible that is).
For the handling I thought that we have then two UDP nhc modules, both can be loaded (at the moment _only_ one UDP nhc compressression should implement the compress methods, both should implement uncompression methods).
Quoted 6 lines
I can rename it to
nhc_udp.cfor the standard compression methods according to rfc6282, I am fine with that. But later there exists then an another compression module with the naming "nhc_ghc_udp.c" or something else. So we have "nhc_udp.ko" and "nhc_ghc_udp.ko". Is that okay for everybody?
Quoted 3 lines
We can also put all udp compression formats into the
nhc_udp.cfile. But then all udp compressions are handled by one module then. We should not do that, because we can handle it per module.
I would keep them all in different modules for now.
regards
Stefan Schmidt
Alexander Aring
maintainerQuoted 43 lines · Alexander Aring
Hi,
On Thu, Jan 08, 2015 at 07:18:57PM +0000, Stefan Schmidt wrote:
...Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++Quoted 4 lines
can we please remove the
_rfc6282from the filenames. RFCs get update and thus change numbers. I do not want to carry RFC numbers in filenames around. There is also almost no precedence in the kernel source code that would justify doing this.Quoted 7 lines
They look indeed quite ugly in the filename. :)
Moving them as a comment and starting point into the file should be enough. Maybe we can also rename
nhc_mobiltonhc_mobility. The other abbreviations are clear in my opinion but for mobil I actually opened the rfc to look what you mean here.For the rfc6282 thing:
Currently there exists two RFCs which describes an UDP compression. It's rfc6282 (the well known 6LoWPAN IPHC compression RFC) and RFC7400 which was pointed out by Martin Townsend [0].
We need to clarify how we should deal with multiple definitions for a compression format. On receiving side we should always support what we can which is decided by the variable nhcid length. While on transmit... we need still some configuration interface (my dreams are to decide the compression methods per socket, don't know how possible that is).
For the handling I thought that we have then two UDP nhc modules, both can be loaded (at the moment _only_ one UDP nhc compressression should implement the compress methods, both should implement uncompression methods).
Quoted 6 lines
I can rename it to
nhc_udp.cfor the standard compression methods according to rfc6282, I am fine with that. But later there exists then an another compression module with the naming "nhc_ghc_udp.c" or something else. So we have "nhc_udp.ko" and "nhc_ghc_udp.ko". Is that okay for everybody?
Another idea, we drop the rfc6282 and replace it with "iphc", so we should have then some little word which describes from which RFC the compression comes from like "nhc_iphc_udp.ko" or "nhc_ghc_udp.ko".
- Alex
Hello.
Quoted 29 lines · Alexander Aring
Hi,
On Thu, Jan 08, 2015 at 07:18:57PM +0000, Stefan Schmidt wrote:
...Quoted 16 lines
Quoted 9 lines
Quoted 8 lines
net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++Quoted 4 lines
can we please remove the
_rfc6282from the filenames. RFCs get update and thus change numbers. I do not want to carry RFC numbers in filenames around. There is also almost no precedence in the kernel source code that would justify doing this.They look indeed quite ugly in the filename. :)
Quoted 8 lines
Moving them as a comment and starting point into the file should be enough.
Maybe we can also renamenhc_mobiltonhc_mobility. The other abbreviations
are clear in my opinion but for mobil I actually opened the rfc to look what
you mean here.
Quoted 5 lines
For the rfc6282 thing:
Currently there exists two RFCs which describes an UDP compression. It's rfc6282 (the well known 6LoWPAN IPHC compression RFC) and RFC7400 which was pointed out by Martin Townsend [0].
November 2014, thats really new.
Quoted 5 lines
We need to clarify how we should deal with multiple definitions for a compression format. On receiving side we should always support what we can which is decided by the variable nhcid length. While on transmit... we need still some configuration interface (my dreams are to decide the compression methods per socket, don't know how possible that is).
As a general rule we should try to accept, identify and uncompress as many formats for the incoming side. For the sending side this decision is very unlikely to be made by the application but instead it is made by the system configurator / platform. Thus in my eyes it makes more sense to have the configure options either via netlink or sysfs but not over the socket interface.
Quoted 10 lines
For the handling I thought that we have then two UDP nhc modules, both can be loaded (at the moment _only_ one UDP nhc compressression should implement the compress methods, both should implement uncompression methods).
I can rename it to
nhc_udp.cfor the standard compression methods according to rfc6282, I am fine with that. But later there exists then an another compression module with the naming "nhc_ghc_udp.c" or something else. So we have "nhc_udp.ko" and "nhc_ghc_udp.ko". Is that okay for everybody?
It would be ok for me. nhc_udp is the earlier spec and thus has a shorter name while we need to distinguish for later specs and add the ghc for it. In a later mail you mentioned using _iphc_ and _ghc_ I would avoid that because GHC is just plugged into NHC and thus is also a under the IPHC umbrella of compressions. :)
Quoted 2 lines
Maybe I should also add some modinfo information, which containing the
nhc->name.
Maybe. For what would it be used? Having a human readable description would make sense for the configure interface in some cases I would say.
Quoted 4 lines
For the nexthdr names:
I will try to change it according to the NEXTHDR IPv6 defines [1], so also the linux IPv6 guys knows what it is.
That looks good to me.
regards
Stefan Schmidt
Alexander Aring
maintainerHi,
Quoted 46 lines · Stefan Schmidt
Hello.
Quoted 29 lines · Alexander Aring
Hi,
On Thu, Jan 08, 2015 at 07:18:57PM +0000, Stefan Schmidt wrote:
...Quoted 16 lines
Quoted 9 lines
Quoted 8 lines
net/6lowpan/nhc.h | 146 ++++++++++++++++++++++++ net/6lowpan/nhc_rfc6282_dest.c | 27 +++++ net/6lowpan/nhc_rfc6282_frag.c | 26 +++++ net/6lowpan/nhc_rfc6282_hop.c | 26 +++++ net/6lowpan/nhc_rfc6282_ipv6.c | 26 +++++ net/6lowpan/nhc_rfc6282_mobil.c | 26 +++++ net/6lowpan/nhc_rfc6282_route.c | 26 +++++ net/6lowpan/nhc_rfc6282_udp.c | 156 ++++++++++++++++++++++++++Quoted 4 lines
can we please remove the
_rfc6282from the filenames. RFCs get update and thus change numbers. I do not want to carry RFC numbers in filenames around. There is also almost no precedence in the kernel source code that would justify doing this.They look indeed quite ugly in the filename. :)
Quoted 8 lines
Moving them as a comment and starting point into the file should be enough.
Maybe we can also renamenhc_mobiltonhc_mobility. The other abbreviations
are clear in my opinion but for mobil I actually opened the rfc to look what
you mean here.Quoted 5 lines
For the rfc6282 thing:
Currently there exists two RFCs which describes an UDP compression. It's rfc6282 (the well known 6LoWPAN IPHC compression RFC) and RFC7400 which was pointed out by Martin Townsend [0].
November 2014, thats really new.
Quoted 5 lines
We need to clarify how we should deal with multiple definitions for a compression format. On receiving side we should always support what we can which is decided by the variable nhcid length. While on transmit... we need still some configuration interface (my dreams are to decide the compression methods per socket, don't know how possible that is).
Quoted 7 lines
As a general rule we should try to accept, identify and uncompress as many formats for the incoming side. For the sending side this decision is very unlikely to be made by the application but instead it is made by the system configurator / platform. Thus in my eyes it makes more sense to have the configure options either via netlink or sysfs but not over the socket interface.
yes, this is the next part which is also more easier than the per socket interface. To make this just per socket is more granularity than have a "global setting" for this. Maybe we can handle this in one net namespace configuration, but this also seems after the a step to introduce a netlink configuration framework. I already talked with Jukka and he also agree For a netlink interface (this was in some previous series).
Quoted 11 lines
Quoted 10 lines
For the handling I thought that we have then two UDP nhc modules, both can be loaded (at the moment _only_ one UDP nhc compressression should implement the compress methods, both should implement uncompression methods).
I can rename it to
nhc_udp.cfor the standard compression methods according to rfc6282, I am fine with that. But later there exists then an another compression module with the naming "nhc_ghc_udp.c" or something else. So we have "nhc_udp.ko" and "nhc_ghc_udp.ko". Is that okay for everybody?
Quoted 6 lines
It would be ok for me.
nhc_udpis the earlier spec and thus has a shorter name while we need to distinguish for later specs and add the ghc for it. In a later mail you mentioned using _iphc_ and _ghc_ I would avoid that because GHC is just plugged into NHC and thus is also a under the IPHC umbrella of compressions. :)
ok.
Quoted 6 lines
Quoted 2 lines
Maybe I should also add some modinfo information, which containing the
nhc->name.Maybe. For what would it be used? Having a human readable description would make sense for the configure interface in some cases I would say.
For modinfo $NHC_MODULE.
Quoted 7 lines
Quoted 4 lines
For the nexthdr names:
I will try to change it according to the NEXTHDR IPv6 defines [1], so also the linux IPv6 guys knows what it is.
That looks good to me.
ok.
- Alex
Hi Alex,
Quoted 52 lines · Alexander Aring
This patch series introduce the next header compression framework. Currently we support udp compression/uncompression only. This framework allow to add new next header compression formats easily.
If somebody wants to add a new header compression format and some information are missing while calling compression and uncompression callbacks. Please feel free to make framework changes according these callbacks.
changes since v2:
- make udp nhc as module as suggested by Marcel Holtmann
- fix comment header innhc_udp.cI didn't make the
lowpan_nhcdeclaration "const" because this will occur issues withrb_node, id and idmask array. Which will manipulated during runtime.changes since v3:
- add patch 3/3 for other known rfc6282 ipv6 extension headers compression formats
- addrequest_modulesfor loading nhc default compression format modules. Which was suggested by Jukka Rissanen. Thanks, this is really working.
- Addrtnl_lockforlowpan_nhc_addand del since we have no syncedrequest_modulescall this could make trouble.
- Move some handling out ofnhc_do_compressionand uncompression function. The complete handling is now inside ofiphc.candnhc_do_compressionand uncompression functions is only a wrapper call for the callback.
- rework some menuentries forKconfigand compression format, they are grouped by rfc now.
- move some generic handling like "skb_pull(skb, nhc->nexthdrlen);" intoiphc.c. It would be great if we have something also for uncompression for theskb_cow. But this isn't possible right now.
- change warning if nhc was not found to "was not found" instead isn't implemented. It isn't implemented if callbacks are NULL now.
- small cleanups.changes since v4:
- add spinlock for to prevent nhc from deletion while using. This can occur if nhc module is unloading while compression/uncompression.
- move nhc handling for nhc compression/uncompression completely into nhc_do_compression/nhc_do_uncompression.Note about locking:
We have now a spinlock
nhc_lowpan_lockwhich prevents manipulating the nhc datastructures while using it. On receiving side it's easy to handle, at the end we check if 6lowpan nh compressed flag is set and run uncompression. On the other hand the transmit side is complicated, we check ifnext_hdrfield is registrated and run some other compression routines, at least we do the finally nhc compression which depends on the first check ifnext_hdrwas registrated. The kernel will crash if we remove the using module between "next_hdrcheck" and "do nhc compression", the lock will prevent that now.
Quoted 6 lines
Now in the transmit path exist a little window to remove a
lowpan_nhcwhile compression. This is exactly the part between "check if we support" and "doing compression". This is a very unlikely case, if this occurs we drop the packet while compression. Don't know how to better deal with that right now. I will try to search a better solution later.
tried v4 shortly with Bluetooth and see no issues. Waiting next version before giving final ack.
Cheers,
Jukka