* [PATCH bluetooth-next 00/10] 6lowpan: pending patches
@ 2015-12-09 21:46 Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 03/10] 6lowpan: add nhc module for GHC UDP detection Alexander Aring
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw)
To: linux-wpan; +Cc: linux-bluetooth, netdev, kernel, Alexander Aring
Hi,
these are the current pending patches for 6lowpan based on bluetooth-next.
It contains the following new features:
- per interface debugfs support, useful to add settings to offers a
fast/simple userspace api for debugging.
- register of available NHC compression by IANA, see [0].
- Adding "ipv6_addr_prefix_copy" functionality for upcoming IPHC stateful
compression.
- Alex
[0] https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#lowpan_nhc
Alexander Aring (3):
6lowpan: add lowpan dev register helpers
6lowpan: add debugfs support
ipv6: add ipv6_addr_prefix_copy
Stefan Schmidt (7):
6lowpan: clarify Kconfig entries for upcoming GHC support
6lowpan: add nhc module for GHC hop-by-hopextension header detection
6lowpan: add nhc module for GHC UDP detection
6lowpan: add nhc module for GHC ICMPv6 detection
6lowpan: add nhc module for GHC destination extension header detection
6lowpan: add nhc module for GHC fragmentation extension header
detection
6lowpan: add nhc module for GHC routing extension header detection
include/net/6lowpan.h | 10 ++++++-
include/net/ipv6.h | 15 +++++++++++
net/6lowpan/6lowpan_i.h | 28 +++++++++++++++++++
net/6lowpan/Kconfig | 47 ++++++++++++++++++++++++++++++--
net/6lowpan/Makefile | 9 +++++++
net/6lowpan/core.c | 59 +++++++++++++++++++++++++++++++++++++++--
net/6lowpan/debugfs.c | 53 ++++++++++++++++++++++++++++++++++++
net/6lowpan/nhc_ghc_ext_dest.c | 27 +++++++++++++++++++
net/6lowpan/nhc_ghc_ext_frag.c | 28 +++++++++++++++++++
net/6lowpan/nhc_ghc_ext_hop.c | 27 +++++++++++++++++++
net/6lowpan/nhc_ghc_ext_route.c | 27 +++++++++++++++++++
net/6lowpan/nhc_ghc_icmpv6.c | 27 +++++++++++++++++++
net/6lowpan/nhc_ghc_udp.c | 27 +++++++++++++++++++
net/bluetooth/6lowpan.c | 8 +++---
net/ieee802154/6lowpan/core.c | 6 ++---
15 files changed, 384 insertions(+), 14 deletions(-)
create mode 100644 net/6lowpan/6lowpan_i.h
create mode 100644 net/6lowpan/debugfs.c
create mode 100644 net/6lowpan/nhc_ghc_ext_dest.c
create mode 100644 net/6lowpan/nhc_ghc_ext_frag.c
create mode 100644 net/6lowpan/nhc_ghc_ext_hop.c
create mode 100644 net/6lowpan/nhc_ghc_ext_route.c
create mode 100644 net/6lowpan/nhc_ghc_icmpv6.c
create mode 100644 net/6lowpan/nhc_ghc_udp.c
--
2.6.1
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH bluetooth-next 03/10] 6lowpan: add nhc module for GHC UDP detection 2015-12-09 21:46 [PATCH bluetooth-next 00/10] 6lowpan: pending patches Alexander Aring @ 2015-12-09 21:46 ` Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 04/10] 6lowpan: add nhc module for GHC ICMPv6 detection Alexander Aring ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan Cc: linux-bluetooth, netdev, kernel, Stefan Schmidt, Alexander Aring From: Stefan Schmidt <stefan@osg.samsung.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> --- net/6lowpan/Kconfig | 5 +++++ net/6lowpan/Makefile | 1 + net/6lowpan/nhc_ghc_udp.c | 27 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 net/6lowpan/nhc_ghc_udp.c diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig index 1bd49eb..94d5178 100644 --- a/net/6lowpan/Kconfig +++ b/net/6lowpan/Kconfig @@ -65,4 +65,9 @@ config 6LOWPAN_GHC_EXT_HDR_HOP 6LoWPAN IPv6 Hop-by-Hop option generic header compression according to RFC7400. +config 6LOWPAN_GHC_UDP + tristate "GHC UDP Support" + ---help--- + 6LoWPAN IPv6 UDP generic header compression according to RFC7400. + endif diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile index ba20e01..5e4f2f3 100644 --- a/net/6lowpan/Makefile +++ b/net/6lowpan/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o #rfc7400 ghcs obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_HOP) += nhc_ghc_ext_hop.o +obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o diff --git a/net/6lowpan/nhc_ghc_udp.c b/net/6lowpan/nhc_ghc_udp.c new file mode 100644 index 0000000..17beefa --- /dev/null +++ b/net/6lowpan/nhc_ghc_udp.c @@ -0,0 +1,27 @@ +/* + * 6LoWPAN UDP compression according to RFC7400 + * + * 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_GHC_UDP_IDLEN 1 +#define LOWPAN_GHC_UDP_ID_0 0xd0 +#define LOWPAN_GHC_UDP_MASK_0 0xf8 + +static void udp_ghid_setup(struct lowpan_nhc *nhc) +{ + nhc->id[0] = LOWPAN_GHC_UDP_ID_0; + nhc->idmask[0] = LOWPAN_GHC_UDP_MASK_0; +} + +LOWPAN_NHC(ghc_udp, "RFC7400 UDP", NEXTHDR_UDP, 0, + udp_ghid_setup, LOWPAN_GHC_UDP_IDLEN, NULL, NULL); + +module_lowpan_nhc(ghc_udp); +MODULE_DESCRIPTION("6LoWPAN generic header UDP compression"); +MODULE_LICENSE("GPL"); -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH bluetooth-next 04/10] 6lowpan: add nhc module for GHC ICMPv6 detection 2015-12-09 21:46 [PATCH bluetooth-next 00/10] 6lowpan: pending patches Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 03/10] 6lowpan: add nhc module for GHC UDP detection Alexander Aring @ 2015-12-09 21:46 ` Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 05/10] 6lowpan: add nhc module for GHC destination extension header detection Alexander Aring ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan Cc: linux-bluetooth, netdev, kernel, Stefan Schmidt, Alexander Aring From: Stefan Schmidt <stefan@osg.samsung.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> --- net/6lowpan/Kconfig | 5 +++++ net/6lowpan/Makefile | 1 + net/6lowpan/nhc_ghc_icmpv6.c | 27 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 net/6lowpan/nhc_ghc_icmpv6.c diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig index 94d5178..0a3f5a8 100644 --- a/net/6lowpan/Kconfig +++ b/net/6lowpan/Kconfig @@ -70,4 +70,9 @@ config 6LOWPAN_GHC_UDP ---help--- 6LoWPAN IPv6 UDP generic header compression according to RFC7400. +config 6LOWPAN_GHC_ICMPV6 + tristate "GHC ICMPv6 Support" + ---help--- + 6LoWPAN IPv6 ICMPv6 generic header compression according to RFC7400. + endif diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile index 5e4f2f3..86af3fd 100644 --- a/net/6lowpan/Makefile +++ b/net/6lowpan/Makefile @@ -14,3 +14,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o #rfc7400 ghcs obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_HOP) += nhc_ghc_ext_hop.o obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o +obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o diff --git a/net/6lowpan/nhc_ghc_icmpv6.c b/net/6lowpan/nhc_ghc_icmpv6.c new file mode 100644 index 0000000..32e7c2c --- /dev/null +++ b/net/6lowpan/nhc_ghc_icmpv6.c @@ -0,0 +1,27 @@ +/* + * 6LoWPAN ICMPv6 compression according to RFC7400 + * + * 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_GHC_ICMPV6_IDLEN 1 +#define LOWPAN_GHC_ICMPV6_ID_0 0xdf +#define LOWPAN_GHC_ICMPV6_MASK_0 0xff + +static void icmpv6_ghid_setup(struct lowpan_nhc *nhc) +{ + nhc->id[0] = LOWPAN_GHC_ICMPV6_ID_0; + nhc->idmask[0] = LOWPAN_GHC_ICMPV6_MASK_0; +} + +LOWPAN_NHC(ghc_icmpv6, "RFC7400 ICMPv6", NEXTHDR_ICMP, 0, + icmpv6_ghid_setup, LOWPAN_GHC_ICMPV6_IDLEN, NULL, NULL); + +module_lowpan_nhc(ghc_icmpv6); +MODULE_DESCRIPTION("6LoWPAN generic header ICMPv6 compression"); +MODULE_LICENSE("GPL"); -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH bluetooth-next 05/10] 6lowpan: add nhc module for GHC destination extension header detection 2015-12-09 21:46 [PATCH bluetooth-next 00/10] 6lowpan: pending patches Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 03/10] 6lowpan: add nhc module for GHC UDP detection Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 04/10] 6lowpan: add nhc module for GHC ICMPv6 detection Alexander Aring @ 2015-12-09 21:46 ` Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 06/10] 6lowpan: add nhc module for GHC fragmentation " Alexander Aring ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan Cc: linux-bluetooth, netdev, kernel, Stefan Schmidt, Alexander Aring From: Stefan Schmidt <stefan@osg.samsung.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> --- net/6lowpan/Kconfig | 6 ++++++ net/6lowpan/Makefile | 1 + net/6lowpan/nhc_ghc_ext_dest.c | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 net/6lowpan/nhc_ghc_ext_dest.c diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig index 0a3f5a8..e5184e6 100644 --- a/net/6lowpan/Kconfig +++ b/net/6lowpan/Kconfig @@ -75,4 +75,10 @@ config 6LOWPAN_GHC_ICMPV6 ---help--- 6LoWPAN IPv6 ICMPv6 generic header compression according to RFC7400. +config 6LOWPAN_GHC_EXT_HDR_DEST + tristate "GHC Destination Options Header Support" + ---help--- + 6LoWPAN IPv6 destination option generic header compression according + to RFC7400. + endif diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile index 86af3fd..fc4bac0 100644 --- a/net/6lowpan/Makefile +++ b/net/6lowpan/Makefile @@ -15,3 +15,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_HOP) += nhc_ghc_ext_hop.o obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o +obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_DEST) += nhc_ghc_ext_dest.o diff --git a/net/6lowpan/nhc_ghc_ext_dest.c b/net/6lowpan/nhc_ghc_ext_dest.c new file mode 100644 index 0000000..9887b3a --- /dev/null +++ b/net/6lowpan/nhc_ghc_ext_dest.c @@ -0,0 +1,27 @@ +/* + * 6LoWPAN Extension Header compression according to RFC7400 + * + * 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_GHC_EXT_DEST_IDLEN 1 +#define LOWPAN_GHC_EXT_DEST_ID_0 0xb6 +#define LOWPAN_GHC_EXT_DEST_MASK_0 0xfe + +static void dest_ghid_setup(struct lowpan_nhc *nhc) +{ + nhc->id[0] = LOWPAN_GHC_EXT_DEST_ID_0; + nhc->idmask[0] = LOWPAN_GHC_EXT_DEST_MASK_0; +} + +LOWPAN_NHC(ghc_ext_dest, "RFC7400 Destination Extension Header", NEXTHDR_DEST, + 0, dest_ghid_setup, LOWPAN_GHC_EXT_DEST_IDLEN, NULL, NULL); + +module_lowpan_nhc(ghc_ext_dest); +MODULE_DESCRIPTION("6LoWPAN generic header destination extension compression"); +MODULE_LICENSE("GPL"); -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH bluetooth-next 06/10] 6lowpan: add nhc module for GHC fragmentation extension header detection 2015-12-09 21:46 [PATCH bluetooth-next 00/10] 6lowpan: pending patches Alexander Aring ` (2 preceding siblings ...) 2015-12-09 21:46 ` [PATCH bluetooth-next 05/10] 6lowpan: add nhc module for GHC destination extension header detection Alexander Aring @ 2015-12-09 21:46 ` Alexander Aring [not found] ` <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-12-09 21:46 ` [PATCH bluetooth-next 10/10] ipv6: add ipv6_addr_prefix_copy Alexander Aring 5 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan Cc: linux-bluetooth, netdev, kernel, Stefan Schmidt, Alexander Aring From: Stefan Schmidt <stefan@osg.samsung.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> --- net/6lowpan/Kconfig | 6 ++++++ net/6lowpan/Makefile | 1 + net/6lowpan/nhc_ghc_ext_frag.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 net/6lowpan/nhc_ghc_ext_frag.c diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig index e5184e6..13abcc5 100644 --- a/net/6lowpan/Kconfig +++ b/net/6lowpan/Kconfig @@ -81,4 +81,10 @@ config 6LOWPAN_GHC_EXT_HDR_DEST 6LoWPAN IPv6 destination option generic header compression according to RFC7400. +config 6LOWPAN_GHC_EXT_HDR_FRAG + tristate "GHC Fragmentation Options Header Support" + ---help--- + 6LoWPAN IPv6 fragmentation option generic header compression + according to RFC7400. + endif diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile index fc4bac0..fb3f48d 100644 --- a/net/6lowpan/Makefile +++ b/net/6lowpan/Makefile @@ -16,3 +16,4 @@ obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_HOP) += nhc_ghc_ext_hop.o obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_DEST) += nhc_ghc_ext_dest.o +obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG) += nhc_ghc_ext_frag.o diff --git a/net/6lowpan/nhc_ghc_ext_frag.c b/net/6lowpan/nhc_ghc_ext_frag.c new file mode 100644 index 0000000..1308b79 --- /dev/null +++ b/net/6lowpan/nhc_ghc_ext_frag.c @@ -0,0 +1,28 @@ +/* + * 6LoWPAN Extension Header compression according to RFC7400 + * + * 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_GHC_EXT_FRAG_IDLEN 1 +#define LOWPAN_GHC_EXT_FRAG_ID_0 0xb4 +#define LOWPAN_GHC_EXT_FRAG_MASK_0 0xfe + +static void frag_ghid_setup(struct lowpan_nhc *nhc) +{ + nhc->id[0] = LOWPAN_GHC_EXT_FRAG_ID_0; + nhc->idmask[0] = LOWPAN_GHC_EXT_FRAG_MASK_0; +} + +LOWPAN_NHC(ghc_ext_frag, "RFC7400 Fragmentation Extension Header", + NEXTHDR_FRAGMENT, 0, frag_ghid_setup, + LOWPAN_GHC_EXT_FRAG_IDLEN, NULL, NULL); + +module_lowpan_nhc(ghc_ext_frag); +MODULE_DESCRIPTION("6LoWPAN generic header fragmentation extension compression"); +MODULE_LICENSE("GPL"); -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
[parent not found: <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH bluetooth-next 01/10] 6lowpan: clarify Kconfig entries for upcoming GHC support [not found] ` <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-12-09 21:46 ` Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 02/10] 6lowpan: add nhc module for GHC hop-by-hopextension header detection Alexander Aring ` (3 subsequent siblings) 4 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan-u79uwXL29TY76Z2rM5mHXA Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Stefan Schmidt, Alexander Aring From: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Acked-by: Jukka Rissanen <jukka.rissanen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Signed-off-by: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Signed-off-by: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/6lowpan/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig index 7fa0f38..6af7a46 100644 --- a/net/6lowpan/Kconfig +++ b/net/6lowpan/Kconfig @@ -6,11 +6,12 @@ menuconfig 6LOWPAN "6LoWPAN" which is supported by IEEE 802.15.4 or Bluetooth stacks. menuconfig 6LOWPAN_NHC - tristate "Next Header Compression Support" + tristate "Next Header and Generic Header Compression Support" depends on 6LOWPAN default y ---help--- - Support for next header compression. + Support for next header and generic header compression defined in + RFC6282 and RFC7400. if 6LOWPAN_NHC -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH bluetooth-next 02/10] 6lowpan: add nhc module for GHC hop-by-hopextension header detection [not found] ` <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-12-09 21:46 ` [PATCH bluetooth-next 01/10] 6lowpan: clarify Kconfig entries for upcoming GHC support Alexander Aring @ 2015-12-09 21:46 ` Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 07/10] 6lowpan: add nhc module for GHC routing extension " Alexander Aring ` (2 subsequent siblings) 4 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan-u79uwXL29TY76Z2rM5mHXA Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Stefan Schmidt, Alexander Aring From: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Acked-by: Jukka Rissanen <jukka.rissanen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Signed-off-by: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Signed-off-by: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/6lowpan/Kconfig | 6 ++++++ net/6lowpan/Makefile | 3 +++ net/6lowpan/nhc_ghc_ext_hop.c | 27 +++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 net/6lowpan/nhc_ghc_ext_hop.c diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig index 6af7a46..1bd49eb 100644 --- a/net/6lowpan/Kconfig +++ b/net/6lowpan/Kconfig @@ -59,4 +59,10 @@ config 6LOWPAN_NHC_UDP ---help--- 6LoWPAN IPv6 UDP Header compression according to RFC6282. +config 6LOWPAN_GHC_EXT_HDR_HOP + tristate "GHC Hop-by-Hop Options Header Support" + ---help--- + 6LoWPAN IPv6 Hop-by-Hop option generic header compression according + to RFC7400. + endif diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile index c6ffc55..ba20e01 100644 --- a/net/6lowpan/Makefile +++ b/net/6lowpan/Makefile @@ -10,3 +10,6 @@ obj-$(CONFIG_6LOWPAN_NHC_IPV6) += nhc_ipv6.o obj-$(CONFIG_6LOWPAN_NHC_MOBILITY) += nhc_mobility.o obj-$(CONFIG_6LOWPAN_NHC_ROUTING) += nhc_routing.o obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o + +#rfc7400 ghcs +obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_HOP) += nhc_ghc_ext_hop.o diff --git a/net/6lowpan/nhc_ghc_ext_hop.c b/net/6lowpan/nhc_ghc_ext_hop.c new file mode 100644 index 0000000..baec86f --- /dev/null +++ b/net/6lowpan/nhc_ghc_ext_hop.c @@ -0,0 +1,27 @@ +/* + * 6LoWPAN Extension Header compression according to RFC7400 + * + * 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_GHC_EXT_HOP_IDLEN 1 +#define LOWPAN_GHC_EXT_HOP_ID_0 0xb0 +#define LOWPAN_GHC_EXT_HOP_MASK_0 0xfe + +static void hop_ghid_setup(struct lowpan_nhc *nhc) +{ + nhc->id[0] = LOWPAN_GHC_EXT_HOP_ID_0; + nhc->idmask[0] = LOWPAN_GHC_EXT_HOP_MASK_0; +} + +LOWPAN_NHC(ghc_ext_hop, "RFC7400 Hop-by-Hop Extension Header", NEXTHDR_HOP, 0, + hop_ghid_setup, LOWPAN_GHC_EXT_HOP_IDLEN, NULL, NULL); + +module_lowpan_nhc(ghc_ext_hop); +MODULE_DESCRIPTION("6LoWPAN generic header hop-by-hop extension compression"); +MODULE_LICENSE("GPL"); -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH bluetooth-next 07/10] 6lowpan: add nhc module for GHC routing extension header detection [not found] ` <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-12-09 21:46 ` [PATCH bluetooth-next 01/10] 6lowpan: clarify Kconfig entries for upcoming GHC support Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 02/10] 6lowpan: add nhc module for GHC hop-by-hopextension header detection Alexander Aring @ 2015-12-09 21:46 ` Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 08/10] 6lowpan: add lowpan dev register helpers Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 09/10] 6lowpan: add debugfs support Alexander Aring 4 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan-u79uwXL29TY76Z2rM5mHXA Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Stefan Schmidt, Alexander Aring From: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Acked-by: Jukka Rissanen <jukka.rissanen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Signed-off-by: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Signed-off-by: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/6lowpan/Kconfig | 6 ++++++ net/6lowpan/Makefile | 1 + net/6lowpan/nhc_ghc_ext_route.c | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 net/6lowpan/nhc_ghc_ext_route.c diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig index 13abcc5..bcb9d8a 100644 --- a/net/6lowpan/Kconfig +++ b/net/6lowpan/Kconfig @@ -87,4 +87,10 @@ config 6LOWPAN_GHC_EXT_HDR_FRAG 6LoWPAN IPv6 fragmentation option generic header compression according to RFC7400. +config 6LOWPAN_GHC_EXT_HDR_ROUTE + tristate "GHC Routing Options Header Support" + ---help--- + 6LoWPAN IPv6 routing option generic header compression according + to RFC7400. + endif diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile index fb3f48d..9e35a5d 100644 --- a/net/6lowpan/Makefile +++ b/net/6lowpan/Makefile @@ -17,3 +17,4 @@ obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_DEST) += nhc_ghc_ext_dest.o obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG) += nhc_ghc_ext_frag.o +obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE) += nhc_ghc_ext_route.o diff --git a/net/6lowpan/nhc_ghc_ext_route.c b/net/6lowpan/nhc_ghc_ext_route.c new file mode 100644 index 0000000..d7e5bd7 --- /dev/null +++ b/net/6lowpan/nhc_ghc_ext_route.c @@ -0,0 +1,27 @@ +/* + * 6LoWPAN Extension Header compression according to RFC7400 + * + * 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_GHC_EXT_ROUTE_IDLEN 1 +#define LOWPAN_GHC_EXT_ROUTE_ID_0 0xb2 +#define LOWPAN_GHC_EXT_ROUTE_MASK_0 0xfe + +static void route_ghid_setup(struct lowpan_nhc *nhc) +{ + nhc->id[0] = LOWPAN_GHC_EXT_ROUTE_ID_0; + nhc->idmask[0] = LOWPAN_GHC_EXT_ROUTE_MASK_0; +} + +LOWPAN_NHC(ghc_ext_route, "RFC7400 Routing Extension Header", NEXTHDR_ROUTING, + 0, route_ghid_setup, LOWPAN_GHC_EXT_ROUTE_IDLEN, NULL, NULL); + +module_lowpan_nhc(ghc_ext_route); +MODULE_DESCRIPTION("6LoWPAN generic header routing extension compression"); +MODULE_LICENSE("GPL"); -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH bluetooth-next 08/10] 6lowpan: add lowpan dev register helpers [not found] ` <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (2 preceding siblings ...) 2015-12-09 21:46 ` [PATCH bluetooth-next 07/10] 6lowpan: add nhc module for GHC routing extension " Alexander Aring @ 2015-12-09 21:46 ` Alexander Aring 2015-12-09 21:46 ` [PATCH bluetooth-next 09/10] 6lowpan: add debugfs support Alexander Aring 4 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan-u79uwXL29TY76Z2rM5mHXA Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Alexander Aring This patch introduces register and unregister functionality for lowpan interfaces. While register a lowpan interface there are several things which need to be initialize by the 6lowpan subsystem. Upcoming functionality need to register/unregister per interface components e.g. debugfs entry. Reviewed-by: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Signed-off-by: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- include/net/6lowpan.h | 7 ++++++- net/6lowpan/core.c | 33 +++++++++++++++++++++++++++++++-- net/bluetooth/6lowpan.c | 8 +++----- net/ieee802154/6lowpan/core.c | 6 ++---- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h index cf3bc56..730211f 100644 --- a/include/net/6lowpan.h +++ b/include/net/6lowpan.h @@ -185,7 +185,12 @@ static inline void lowpan_push_hc_data(u8 **hc_ptr, const void *data, *hc_ptr += len; } -void lowpan_netdev_setup(struct net_device *dev, enum lowpan_lltypes lltype); +int lowpan_register_netdevice(struct net_device *dev, + enum lowpan_lltypes lltype); +int lowpan_register_netdev(struct net_device *dev, + enum lowpan_lltypes lltype); +void lowpan_unregister_netdevice(struct net_device *dev); +void lowpan_unregister_netdev(struct net_device *dev); /** * lowpan_header_decompress - replace 6LoWPAN header with IPv6 header diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c index 83b19e0..80fc509 100644 --- a/net/6lowpan/core.c +++ b/net/6lowpan/core.c @@ -15,7 +15,8 @@ #include <net/6lowpan.h> -void lowpan_netdev_setup(struct net_device *dev, enum lowpan_lltypes lltype) +int lowpan_register_netdevice(struct net_device *dev, + enum lowpan_lltypes lltype) { dev->addr_len = EUI64_ADDR_LEN; dev->type = ARPHRD_6LOWPAN; @@ -23,8 +24,36 @@ void lowpan_netdev_setup(struct net_device *dev, enum lowpan_lltypes lltype) dev->priv_flags |= IFF_NO_QUEUE; lowpan_priv(dev)->lltype = lltype; + + return register_netdevice(dev); +} +EXPORT_SYMBOL(lowpan_register_netdevice); + +int lowpan_register_netdev(struct net_device *dev, + enum lowpan_lltypes lltype) +{ + int ret; + + rtnl_lock(); + ret = lowpan_register_netdevice(dev, lltype); + rtnl_unlock(); + return ret; +} +EXPORT_SYMBOL(lowpan_register_netdev); + +void lowpan_unregister_netdevice(struct net_device *dev) +{ + unregister_netdevice(dev); +} +EXPORT_SYMBOL(lowpan_unregister_netdevice); + +void lowpan_unregister_netdev(struct net_device *dev) +{ + rtnl_lock(); + lowpan_unregister_netdevice(dev); + rtnl_unlock(); } -EXPORT_SYMBOL(lowpan_netdev_setup); +EXPORT_SYMBOL(lowpan_unregister_netdev); static int __init lowpan_module_init(void) { diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 9e9cca3..d040365 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -825,9 +825,7 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev) list_add_rcu(&(*dev)->list, &bt_6lowpan_devices); spin_unlock(&devices_lock); - lowpan_netdev_setup(netdev, LOWPAN_LLTYPE_BTLE); - - err = register_netdev(netdev); + err = lowpan_register_netdev(netdev, LOWPAN_LLTYPE_BTLE); if (err < 0) { BT_INFO("register_netdev failed %d", err); spin_lock(&devices_lock); @@ -890,7 +888,7 @@ static void delete_netdev(struct work_struct *work) struct lowpan_dev *entry = container_of(work, struct lowpan_dev, delete_netdev); - unregister_netdev(entry->netdev); + lowpan_unregister_netdev(entry->netdev); /* The entry pointer is deleted by the netdev destructor. */ } @@ -1348,7 +1346,7 @@ static void disconnect_devices(void) ifdown(entry->netdev); BT_DBG("Unregistering netdev %s %p", entry->netdev->name, entry->netdev); - unregister_netdev(entry->netdev); + lowpan_unregister_netdev(entry->netdev); kfree(entry); } } diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c index 20c49c7..737c87a 100644 --- a/net/ieee802154/6lowpan/core.c +++ b/net/ieee802154/6lowpan/core.c @@ -161,9 +161,7 @@ static int lowpan_newlink(struct net *src_net, struct net_device *ldev, wdev->needed_headroom; ldev->needed_tailroom = wdev->needed_tailroom; - lowpan_netdev_setup(ldev, LOWPAN_LLTYPE_IEEE802154); - - ret = register_netdevice(ldev); + ret = lowpan_register_netdevice(ldev, LOWPAN_LLTYPE_IEEE802154); if (ret < 0) { dev_put(wdev); return ret; @@ -180,7 +178,7 @@ static void lowpan_dellink(struct net_device *ldev, struct list_head *head) ASSERT_RTNL(); wdev->ieee802154_ptr->lowpan_dev = NULL; - unregister_netdevice(ldev); + lowpan_unregister_netdevice(ldev); dev_put(wdev); } -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH bluetooth-next 09/10] 6lowpan: add debugfs support [not found] ` <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (3 preceding siblings ...) 2015-12-09 21:46 ` [PATCH bluetooth-next 08/10] 6lowpan: add lowpan dev register helpers Alexander Aring @ 2015-12-09 21:46 ` Alexander Aring 4 siblings, 0 replies; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan-u79uwXL29TY76Z2rM5mHXA Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Alexander Aring This patch will introduce a 6lowpan entry into the debugfs if enabled. Inside this 6lowpan directory we create a subdirectories of all 6lowpan interfaces to offer a per interface debugfs support. Reviewed-by: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Signed-off-by: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- include/net/6lowpan.h | 3 +++ net/6lowpan/6lowpan_i.h | 28 ++++++++++++++++++++++++++ net/6lowpan/Kconfig | 8 ++++++++ net/6lowpan/Makefile | 1 + net/6lowpan/core.c | 28 +++++++++++++++++++++++++- net/6lowpan/debugfs.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 net/6lowpan/6lowpan_i.h create mode 100644 net/6lowpan/debugfs.c diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h index 730211f..2f6a3f2 100644 --- a/include/net/6lowpan.h +++ b/include/net/6lowpan.h @@ -53,6 +53,8 @@ #ifndef __6LOWPAN_H__ #define __6LOWPAN_H__ +#include <linux/debugfs.h> + #include <net/ipv6.h> #include <net/net_namespace.h> @@ -98,6 +100,7 @@ enum lowpan_lltypes { struct lowpan_priv { enum lowpan_lltypes lltype; + struct dentry *iface_debugfs; /* must be last */ u8 priv[0] __aligned(sizeof(void *)); diff --git a/net/6lowpan/6lowpan_i.h b/net/6lowpan/6lowpan_i.h new file mode 100644 index 0000000..d16bb4b --- /dev/null +++ b/net/6lowpan/6lowpan_i.h @@ -0,0 +1,28 @@ +#ifndef __6LOWPAN_I_H +#define __6LOWPAN_I_H + +#include <linux/netdevice.h> + +#ifdef CONFIG_6LOWPAN_DEBUGFS +int lowpan_dev_debugfs_init(struct net_device *dev); +void lowpan_dev_debugfs_exit(struct net_device *dev); + +int __init lowpan_debugfs_init(void); +void lowpan_debugfs_exit(void); +#else +static inline int lowpan_dev_debugfs_init(struct net_device *dev) +{ + return 0; +} + +static inline void lowpan_dev_debugfs_exit(struct net_device *dev) { } + +static inline int __init lowpan_debugfs_init(void) +{ + return 0; +} + +static inline void lowpan_debugfs_exit(void) { } +#endif /* CONFIG_6LOWPAN_DEBUGFS */ + +#endif /* __6LOWPAN_I_H */ diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig index bcb9d8a..9c05151 100644 --- a/net/6lowpan/Kconfig +++ b/net/6lowpan/Kconfig @@ -5,6 +5,14 @@ menuconfig 6LOWPAN This enables IPv6 over Low power Wireless Personal Area Network - "6LoWPAN" which is supported by IEEE 802.15.4 or Bluetooth stacks. +config 6LOWPAN_DEBUGFS + bool "6LoWPAN debugfs support" + depends on 6LOWPAN + depends on DEBUG_FS + ---help--- + This enables 6LoWPAN debugfs support. For example to manipulate + IPHC context information at runtime. + menuconfig 6LOWPAN_NHC tristate "Next Header and Generic Header Compression Support" depends on 6LOWPAN diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile index 9e35a5d..e44f3bf 100644 --- a/net/6lowpan/Makefile +++ b/net/6lowpan/Makefile @@ -1,6 +1,7 @@ obj-$(CONFIG_6LOWPAN) += 6lowpan.o 6lowpan-y := core.o iphc.o nhc.o +6lowpan-$(CONFIG_6LOWPAN_DEBUGFS) += debugfs.o #rfc6282 nhcs obj-$(CONFIG_6LOWPAN_NHC_DEST) += nhc_dest.o diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c index 80fc509..c7f06f5 100644 --- a/net/6lowpan/core.c +++ b/net/6lowpan/core.c @@ -15,9 +15,13 @@ #include <net/6lowpan.h> +#include "6lowpan_i.h" + int lowpan_register_netdevice(struct net_device *dev, enum lowpan_lltypes lltype) { + int ret; + dev->addr_len = EUI64_ADDR_LEN; dev->type = ARPHRD_6LOWPAN; dev->mtu = IPV6_MIN_MTU; @@ -25,7 +29,15 @@ int lowpan_register_netdevice(struct net_device *dev, lowpan_priv(dev)->lltype = lltype; - return register_netdevice(dev); + ret = lowpan_dev_debugfs_init(dev); + if (ret < 0) + return ret; + + ret = register_netdevice(dev); + if (ret < 0) + lowpan_dev_debugfs_exit(dev); + + return ret; } EXPORT_SYMBOL(lowpan_register_netdevice); @@ -44,6 +56,7 @@ EXPORT_SYMBOL(lowpan_register_netdev); void lowpan_unregister_netdevice(struct net_device *dev) { unregister_netdevice(dev); + lowpan_dev_debugfs_exit(dev); } EXPORT_SYMBOL(lowpan_unregister_netdevice); @@ -57,6 +70,12 @@ EXPORT_SYMBOL(lowpan_unregister_netdev); static int __init lowpan_module_init(void) { + int ret; + + ret = lowpan_debugfs_init(); + if (ret < 0) + return ret; + request_module_nowait("ipv6"); request_module_nowait("nhc_dest"); @@ -69,6 +88,13 @@ static int __init lowpan_module_init(void) return 0; } + +static void __exit lowpan_module_exit(void) +{ + lowpan_debugfs_exit(); +} + module_init(lowpan_module_init); +module_exit(lowpan_module_exit); MODULE_LICENSE("GPL"); diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c new file mode 100644 index 0000000..88eef84 --- /dev/null +++ b/net/6lowpan/debugfs.c @@ -0,0 +1,53 @@ +/* This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Authors: + * (C) 2015 Pengutronix, Alexander Aring <aar-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> + * Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. + */ + +#include <net/6lowpan.h> + +#include "6lowpan_i.h" + +static struct dentry *lowpan_debugfs; + +int lowpan_dev_debugfs_init(struct net_device *dev) +{ + struct lowpan_priv *lpriv = lowpan_priv(dev); + + /* creating the root */ + lpriv->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs); + if (!lpriv->iface_debugfs) + goto fail; + + return 0; + +fail: + return -EINVAL; +} + +void lowpan_dev_debugfs_exit(struct net_device *dev) +{ + debugfs_remove_recursive(lowpan_priv(dev)->iface_debugfs); +} + +int __init lowpan_debugfs_init(void) +{ + lowpan_debugfs = debugfs_create_dir("6lowpan", NULL); + if (!lowpan_debugfs) + return -EINVAL; + + return 0; +} + +void lowpan_debugfs_exit(void) +{ + debugfs_remove_recursive(lowpan_debugfs); +} -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH bluetooth-next 10/10] ipv6: add ipv6_addr_prefix_copy 2015-12-09 21:46 [PATCH bluetooth-next 00/10] 6lowpan: pending patches Alexander Aring ` (4 preceding siblings ...) [not found] ` <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-12-09 21:46 ` Alexander Aring [not found] ` <1449697591-15991-11-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 5 siblings, 1 reply; 13+ messages in thread From: Alexander Aring @ 2015-12-09 21:46 UTC (permalink / raw) To: linux-wpan Cc: linux-bluetooth, netdev, kernel, Alexander Aring, David S . Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy This patch adds a static inline function ipv6_addr_prefix_copy which copies a ipv6 address prefix(argument pfx) into the ipv6 address prefix. The prefix len is given by plen as bits. This function mainly based on ipv6_addr_prefix which copies one address prefix from address into a new ipv6 address destination and zero all other address bits. The difference is that ipv6_addr_prefix_copy don't get a prefix from an ipv6 address, it sets a prefix to an ipv6 address with keeping other address bits. The use case is for context based address compression inside 6LoWPAN IPHC header which keeping ipv6 prefixes inside a context table to lookup address-bits without sending them. Cc: David S. Miller <davem@davemloft.net> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> Cc: James Morris <jmorris@namei.org> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> Cc: Patrick McHardy <kaber@trash.net> Acked-by: Łukasz Duda <lukasz.duda@nordicsemi.no> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> --- include/net/ipv6.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 9a5c9f0..6570f37 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -401,6 +401,21 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx, pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b); } +static inline void ipv6_addr_prefix_copy(struct in6_addr *addr, + const struct in6_addr *pfx, + int plen) +{ + /* caller must guarantee 0 <= plen <= 128 */ + int o = plen >> 3, + b = plen & 0x7; + + memcpy(addr->s6_addr, pfx, o); + if (b != 0) { + addr->s6_addr[o] &= ~(0xff00 >> b); + addr->s6_addr[o] |= (pfx->s6_addr[o] & (0xff00 >> b)); + } +} + static inline void __ipv6_addr_set_half(__be32 *addr, __be32 wh, __be32 wl) { -- 2.6.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
[parent not found: <1449697591-15991-11-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH bluetooth-next 10/10] ipv6: add ipv6_addr_prefix_copy [not found] ` <1449697591-15991-11-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-12-10 0:28 ` Marcel Holtmann [not found] ` <64AE99C3-E5EB-47D8-9B0A-FA5B35E93CB2-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org> 0 siblings, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2015-12-10 0:28 UTC (permalink / raw) To: Alexander Aring, David S. Miller Cc: linux-wpan-u79uwXL29TY76Z2rM5mHXA, BlueZ development, Network Development, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy Hi Dave, > This patch adds a static inline function ipv6_addr_prefix_copy which > copies a ipv6 address prefix(argument pfx) into the ipv6 address prefix. > The prefix len is given by plen as bits. This function mainly based on > ipv6_addr_prefix which copies one address prefix from address into a new > ipv6 address destination and zero all other address bits. > > The difference is that ipv6_addr_prefix_copy don't get a prefix from an > ipv6 address, it sets a prefix to an ipv6 address with keeping other > address bits. The use case is for context based address compression > inside 6LoWPAN IPHC header which keeping ipv6 prefixes inside a context > table to lookup address-bits without sending them. > > Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> > Cc: Alexey Kuznetsov <kuznet-v/Mj1YrvjDBInbfyfbPRSQ@public.gmane.org> > Cc: James Morris <jmorris-gx6/JNMH7DfYtjvyW6yDsg@public.gmane.org> > Cc: Hideaki YOSHIFUJI <yoshfuji-VfPWfsRibaP+Ru+s062T9g@public.gmane.org> > Cc: Patrick McHardy <kaber-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org> > Acked-by: Łukasz Duda <lukasz.duda-hR+23Fw+YnFSHonuZl5R5Q@public.gmane.org> > Acked-by: Hannes Frederic Sowa <hannes-tFNcAqjVMyqKXQKiL6tip0B+6BGkLq7r@public.gmane.org> > Acked-by: YOSHIFUJI Hideaki <yoshfuji-VfPWfsRibaP+Ru+s062T9g@public.gmane.org> > Reviewed-by: Stefan Schmidt <stefan-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> > Signed-off-by: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- > include/net/ipv6.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/include/net/ipv6.h b/include/net/ipv6.h > index 9a5c9f0..6570f37 100644 > --- a/include/net/ipv6.h > +++ b/include/net/ipv6.h > @@ -401,6 +401,21 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx, > pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b); > } > > +static inline void ipv6_addr_prefix_copy(struct in6_addr *addr, > + const struct in6_addr *pfx, > + int plen) > +{ > + /* caller must guarantee 0 <= plen <= 128 */ > + int o = plen >> 3, > + b = plen & 0x7; > + > + memcpy(addr->s6_addr, pfx, o); > + if (b != 0) { > + addr->s6_addr[o] &= ~(0xff00 >> b); > + addr->s6_addr[o] |= (pfx->s6_addr[o] & (0xff00 >> b)); > + } > +} > + > static inline void __ipv6_addr_set_half(__be32 *addr, > __be32 wh, __be32 wl) > { if there are no objections, I would like to take this change through the bluetooth-next tree. Regards Marcel ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <64AE99C3-E5EB-47D8-9B0A-FA5B35E93CB2-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>]
* Re: [PATCH bluetooth-next 10/10] ipv6: add ipv6_addr_prefix_copy [not found] ` <64AE99C3-E5EB-47D8-9B0A-FA5B35E93CB2-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org> @ 2015-12-10 3:12 ` David Miller 0 siblings, 0 replies; 13+ messages in thread From: David Miller @ 2015-12-10 3:12 UTC (permalink / raw) To: marcel-kz+m5ild9QBg9hUCZPvPmw Cc: alex.aring-Re5JQEeQqe8AvxtiuMwx3w, linux-wpan-u79uwXL29TY76Z2rM5mHXA, linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, kuznet-v/Mj1YrvjDBInbfyfbPRSQ, jmorris-gx6/JNMH7DfYtjvyW6yDsg, yoshfuji-VfPWfsRibaP+Ru+s062T9g, kaber-dcUjhNyLwpNeoWH0uzbU5w From: Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org> Date: Wed, 9 Dec 2015 14:28:38 -1000 > if there are no objections, I would like to take this change through the bluetooth-next tree. No problem: Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-12-10 3:12 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 21:46 [PATCH bluetooth-next 00/10] 6lowpan: pending patches Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 03/10] 6lowpan: add nhc module for GHC UDP detection Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 04/10] 6lowpan: add nhc module for GHC ICMPv6 detection Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 05/10] 6lowpan: add nhc module for GHC destination extension header detection Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 06/10] 6lowpan: add nhc module for GHC fragmentation " Alexander Aring
[not found] ` <1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-09 21:46 ` [PATCH bluetooth-next 01/10] 6lowpan: clarify Kconfig entries for upcoming GHC support Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 02/10] 6lowpan: add nhc module for GHC hop-by-hopextension header detection Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 07/10] 6lowpan: add nhc module for GHC routing extension " Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 08/10] 6lowpan: add lowpan dev register helpers Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 09/10] 6lowpan: add debugfs support Alexander Aring
2015-12-09 21:46 ` [PATCH bluetooth-next 10/10] ipv6: add ipv6_addr_prefix_copy Alexander Aring
[not found] ` <1449697591-15991-11-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-10 0:28 ` Marcel Holtmann
[not found] ` <64AE99C3-E5EB-47D8-9B0A-FA5B35E93CB2-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2015-12-10 3:12 ` 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).