All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id
@ 2022-04-28  3:05 Alexander Aring
  2022-04-28  3:05 ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Alexander Aring
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Alexander Aring @ 2022-04-28  3:05 UTC (permalink / raw)
  To: jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, stefan, torvalds

Hi,

this patch series removes the rb data structure for looking up a nhc by
nhc id. Instead we using the existing nexthdr lookup array by iterating
over it and find the right nhc by nhc id. It's simply not worth it to
use such complex handling for such small amount of nhc. As we only
support nhc ids which fits into 1 byte and there are not two byte nhc
ids values specified yet, we let the nhc layer only handle 1 byte values.
If there is the need for 2 byte nhc values we can add support for it.

- Alex

Alexander Aring (3):
  net: 6lowpan: remove const from scalars
  net: 6lowpan: use array for find nhc id
  net: 6lowpan: constify lowpan_nhc structures

 net/6lowpan/nhc.c               | 103 ++++++--------------------------
 net/6lowpan/nhc.h               |  38 +++++-------
 net/6lowpan/nhc_dest.c          |   9 +--
 net/6lowpan/nhc_fragment.c      |   9 +--
 net/6lowpan/nhc_ghc_ext_dest.c  |   9 +--
 net/6lowpan/nhc_ghc_ext_frag.c  |  11 +---
 net/6lowpan/nhc_ghc_ext_hop.c   |   9 +--
 net/6lowpan/nhc_ghc_ext_route.c |   9 +--
 net/6lowpan/nhc_ghc_icmpv6.c    |   9 +--
 net/6lowpan/nhc_ghc_udp.c       |   9 +--
 net/6lowpan/nhc_hop.c           |   9 +--
 net/6lowpan/nhc_ipv6.c          |  11 +---
 net/6lowpan/nhc_mobility.c      |   9 +--
 net/6lowpan/nhc_routing.c       |   9 +--
 net/6lowpan/nhc_udp.c           |   9 +--
 15 files changed, 48 insertions(+), 214 deletions(-)

-- 
2.31.1


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

* [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars
  2022-04-28  3:05 [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Alexander Aring
@ 2022-04-28  3:05 ` Alexander Aring
  2022-04-28  3:47   ` net: 6lowpan: simplify lookup by nhc id bluez.test.bot
                     ` (2 more replies)
  2022-04-28  3:05 ` [PATCH bluetooth-next 2/3] net: 6lowpan: use array for find nhc id Alexander Aring
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 18+ messages in thread
From: Alexander Aring @ 2022-04-28  3:05 UTC (permalink / raw)
  To: jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, stefan, torvalds

The keyword const makes no sense for scalar types inside the lowpan_nhc
structure. Most compilers will ignore it so we remove the keyword from
the scalar types.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 net/6lowpan/nhc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/6lowpan/nhc.h b/net/6lowpan/nhc.h
index 67951c40734b..2ac7da388c4d 100644
--- a/net/6lowpan/nhc.h
+++ b/net/6lowpan/nhc.h
@@ -67,11 +67,11 @@ module_exit(__nhc##_exit);
 struct lowpan_nhc {
 	struct rb_node	node;
 	const char	*name;
-	const u8	nexthdr;
-	const size_t	nexthdrlen;
+	u8		nexthdr;
+	size_t		nexthdrlen;
 	u8		*id;
 	u8		*idmask;
-	const size_t	idlen;
+	size_t		idlen;
 
 	void		(*idsetup)(struct lowpan_nhc *nhc);
 	int		(*uncompress)(struct sk_buff *skb, size_t needed);
-- 
2.31.1


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

* [PATCH bluetooth-next 2/3] net: 6lowpan: use array for find nhc id
  2022-04-28  3:05 [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Alexander Aring
  2022-04-28  3:05 ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Alexander Aring
@ 2022-04-28  3:05 ` Alexander Aring
  2022-05-02 19:37   ` Stefan Schmidt
  2022-05-03  7:32   ` Jukka Rissanen
  2022-04-28  3:05 ` [PATCH bluetooth-next 3/3] net: 6lowpan: constify lowpan_nhc structures Alexander Aring
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 18+ messages in thread
From: Alexander Aring @ 2022-04-28  3:05 UTC (permalink / raw)
  To: jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, stefan, torvalds

This patch will remove the complete overengineered and overthinking rb data
structure for looking up the nhc by nhcid. Instead we using the existing
nhc next header array and iterate over it. It works now for 1 byte values
only. However there are only 1 byte nhc id values currently
supported and IANA also does not specify large than 1 byte values yet.
If there are 2 byte values for nhc ids specified we can revisit this
data structure and add support for it.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 net/6lowpan/nhc.c               | 91 +++++----------------------------
 net/6lowpan/nhc.h               | 28 ++++------
 net/6lowpan/nhc_dest.c          |  9 +---
 net/6lowpan/nhc_fragment.c      |  9 +---
 net/6lowpan/nhc_ghc_ext_dest.c  |  9 +---
 net/6lowpan/nhc_ghc_ext_frag.c  | 11 +---
 net/6lowpan/nhc_ghc_ext_hop.c   |  9 +---
 net/6lowpan/nhc_ghc_ext_route.c |  9 +---
 net/6lowpan/nhc_ghc_icmpv6.c    |  9 +---
 net/6lowpan/nhc_ghc_udp.c       |  9 +---
 net/6lowpan/nhc_hop.c           |  9 +---
 net/6lowpan/nhc_ipv6.c          | 11 +---
 net/6lowpan/nhc_mobility.c      |  9 +---
 net/6lowpan/nhc_routing.c       |  9 +---
 net/6lowpan/nhc_udp.c           |  9 +---
 15 files changed, 37 insertions(+), 203 deletions(-)

diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c
index d6bbbd4ab38b..019f121b2449 100644
--- a/net/6lowpan/nhc.c
+++ b/net/6lowpan/nhc.c
@@ -12,77 +12,26 @@
 
 #include "nhc.h"
 
-static struct rb_root rb_root = RB_ROOT;
 static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
 static DEFINE_SPINLOCK(lowpan_nhc_lock);
 
-static int lowpan_nhc_insert(struct lowpan_nhc *nhc)
+static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
 {
-	struct rb_node **new = &rb_root.rb_node, *parent = NULL;
-
-	/* Figure out where to put new node */
-	while (*new) {
-		struct lowpan_nhc *this = rb_entry(*new, struct lowpan_nhc,
-						   node);
-		int result, len_dif, len;
-
-		len_dif = nhc->idlen - this->idlen;
-
-		if (nhc->idlen < this->idlen)
-			len = nhc->idlen;
-		else
-			len = this->idlen;
-
-		result = memcmp(nhc->id, this->id, len);
-		if (!result)
-			result = len_dif;
-
-		parent = *new;
-		if (result < 0)
-			new = &((*new)->rb_left);
-		else if (result > 0)
-			new = &((*new)->rb_right);
-		else
-			return -EEXIST;
-	}
+	struct lowpan_nhc *nhc;
+	int i;
+	u8 id;
 
-	/* Add new node and rebalance tree. */
-	rb_link_node(&nhc->node, parent, new);
-	rb_insert_color(&nhc->node, &rb_root);
+	if (!pskb_may_pull(skb, 1))
+		return NULL;
 
-	return 0;
-}
+	id = *skb->data;
 
-static void lowpan_nhc_remove(struct lowpan_nhc *nhc)
-{
-	rb_erase(&nhc->node, &rb_root);
-}
+	for (i = 0; i < NEXTHDR_MAX + 1; i++) {
+		nhc = lowpan_nexthdr_nhcs[i];
+		if (!nhc)
+			continue;
 
-static struct lowpan_nhc *lowpan_nhc_by_nhcid(const struct sk_buff *skb)
-{
-	struct rb_node *node = rb_root.rb_node;
-	const u8 *nhcid_skb_ptr = skb->data;
-
-	while (node) {
-		struct lowpan_nhc *nhc = rb_entry(node, struct lowpan_nhc,
-						  node);
-		u8 nhcid_skb_ptr_masked[LOWPAN_NHC_MAX_ID_LEN];
-		int result, i;
-
-		if (nhcid_skb_ptr + nhc->idlen > skb->data + skb->len)
-			return NULL;
-
-		/* copy and mask afterwards the nhid value from skb */
-		memcpy(nhcid_skb_ptr_masked, nhcid_skb_ptr, nhc->idlen);
-		for (i = 0; i < nhc->idlen; i++)
-			nhcid_skb_ptr_masked[i] &= nhc->idmask[i];
-
-		result = memcmp(nhcid_skb_ptr_masked, nhc->id, nhc->idlen);
-		if (result < 0)
-			node = node->rb_left;
-		else if (result > 0)
-			node = node->rb_right;
-		else
+		if ((id & nhc->idmask) == nhc->id)
 			return nhc;
 	}
 
@@ -191,16 +140,7 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
 
 int lowpan_nhc_add(struct lowpan_nhc *nhc)
 {
-	int ret;
-
-	if (!nhc->idlen || !nhc->idsetup)
-		return -EINVAL;
-
-	WARN_ONCE(nhc->idlen > LOWPAN_NHC_MAX_ID_LEN,
-		  "LOWPAN_NHC_MAX_ID_LEN should be updated to %zd.\n",
-		  nhc->idlen);
-
-	nhc->idsetup(nhc);
+	int ret = 0;
 
 	spin_lock_bh(&lowpan_nhc_lock);
 
@@ -209,10 +149,6 @@ int lowpan_nhc_add(struct lowpan_nhc *nhc)
 		goto out;
 	}
 
-	ret = lowpan_nhc_insert(nhc);
-	if (ret < 0)
-		goto out;
-
 	lowpan_nexthdr_nhcs[nhc->nexthdr] = nhc;
 out:
 	spin_unlock_bh(&lowpan_nhc_lock);
@@ -224,7 +160,6 @@ void lowpan_nhc_del(struct lowpan_nhc *nhc)
 {
 	spin_lock_bh(&lowpan_nhc_lock);
 
-	lowpan_nhc_remove(nhc);
 	lowpan_nexthdr_nhcs[nhc->nexthdr] = NULL;
 
 	spin_unlock_bh(&lowpan_nhc_lock);
diff --git a/net/6lowpan/nhc.h b/net/6lowpan/nhc.h
index 2ac7da388c4d..9df602a632bd 100644
--- a/net/6lowpan/nhc.h
+++ b/net/6lowpan/nhc.h
@@ -16,24 +16,20 @@
  * @_name: const char * of common header compression name.
  * @_nexthdr: ipv6 nexthdr field for the header compression.
  * @_nexthdrlen: ipv6 nexthdr len for the reserved space.
- * @_idsetup: callback to setup id and mask values.
- * @_idlen: len for the next header id and mask, should be always the same.
+ * @_id: one byte nhc id value.
+ * @_idmask: one byte nhc id mask value.
  * @_uncompress: callback for uncompression call.
  * @_compress: callback for compression call.
  */
 #define LOWPAN_NHC(__nhc, _name, _nexthdr,	\
-		   _hdrlen, _idsetup, _idlen,	\
+		   _hdrlen, _id, _idmask,	\
 		   _uncompress, _compress)	\
-static u8 __nhc##_val[_idlen];			\
-static u8 __nhc##_mask[_idlen];			\
 static struct lowpan_nhc __nhc = {		\
 	.name		= _name,		\
 	.nexthdr	= _nexthdr,		\
 	.nexthdrlen	= _hdrlen,		\
-	.id		= __nhc##_val,		\
-	.idmask		= __nhc##_mask,		\
-	.idlen		= _idlen,		\
-	.idsetup	= _idsetup,		\
+	.id		= _id,			\
+	.idmask		= _idmask,		\
 	.uncompress	= _uncompress,		\
 	.compress	= _compress,		\
 }
@@ -53,27 +49,21 @@ module_exit(__nhc##_exit);
 /**
  * struct lowpan_nhc - hold 6lowpan next hdr compression ifnformation
  *
- * @node: holder for the rbtree.
  * @name: name of the specific next header compression
  * @nexthdr: next header value of the protocol which should be compressed.
  * @nexthdrlen: ipv6 nexthdr len for the reserved space.
- * @id: array for nhc id. Note this need to be in network byteorder.
- * @mask: array for nhc id mask. Note this need to be in network byteorder.
- * @len: the length of the next header id and mask.
- * @setup: callback to setup fill the next header id value and mask.
+ * @id: one byte nhc id value.
+ * @idmask: one byte nhc id mask value.
  * @compress: callback to do the header compression.
  * @uncompress: callback to do the header uncompression.
  */
 struct lowpan_nhc {
-	struct rb_node	node;
 	const char	*name;
 	u8		nexthdr;
 	size_t		nexthdrlen;
-	u8		*id;
-	u8		*idmask;
-	size_t		idlen;
+	u8		id;
+	u8		idmask;
 
-	void		(*idsetup)(struct lowpan_nhc *nhc);
 	int		(*uncompress)(struct sk_buff *skb, size_t needed);
 	int		(*compress)(struct sk_buff *skb, u8 **hc_ptr);
 };
diff --git a/net/6lowpan/nhc_dest.c b/net/6lowpan/nhc_dest.c
index 4768a9459212..0cbcc7806469 100644
--- a/net/6lowpan/nhc_dest.c
+++ b/net/6lowpan/nhc_dest.c
@@ -6,18 +6,11 @@
 
 #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);
+	   LOWPAN_NHC_DEST_ID_0, LOWPAN_NHC_DEST_MASK_0,  NULL, NULL);
 
 module_lowpan_nhc(nhc_dest);
 MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Destination Options compression");
diff --git a/net/6lowpan/nhc_fragment.c b/net/6lowpan/nhc_fragment.c
index be85f07715bd..9414552df0ac 100644
--- a/net/6lowpan/nhc_fragment.c
+++ b/net/6lowpan/nhc_fragment.c
@@ -5,18 +5,11 @@
 
 #include "nhc.h"
 
-#define LOWPAN_NHC_FRAGMENT_IDLEN	1
 #define LOWPAN_NHC_FRAGMENT_ID_0	0xe4
 #define LOWPAN_NHC_FRAGMENT_MASK_0	0xfe
 
-static void fragment_nhid_setup(struct lowpan_nhc *nhc)
-{
-	nhc->id[0] = LOWPAN_NHC_FRAGMENT_ID_0;
-	nhc->idmask[0] = LOWPAN_NHC_FRAGMENT_MASK_0;
-}
-
 LOWPAN_NHC(nhc_fragment, "RFC6282 Fragment", NEXTHDR_FRAGMENT, 0,
-	   fragment_nhid_setup, LOWPAN_NHC_FRAGMENT_IDLEN, NULL, NULL);
+	   LOWPAN_NHC_FRAGMENT_ID_0, LOWPAN_NHC_FRAGMENT_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(nhc_fragment);
 MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Fragment compression");
diff --git a/net/6lowpan/nhc_ghc_ext_dest.c b/net/6lowpan/nhc_ghc_ext_dest.c
index a9137f1733be..e4745ddd10a8 100644
--- a/net/6lowpan/nhc_ghc_ext_dest.c
+++ b/net/6lowpan/nhc_ghc_ext_dest.c
@@ -5,18 +5,11 @@
 
 #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);
+	   0, LOWPAN_GHC_EXT_DEST_ID_0, LOWPAN_GHC_EXT_DEST_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(ghc_ext_dest);
 MODULE_DESCRIPTION("6LoWPAN generic header destination extension compression");
diff --git a/net/6lowpan/nhc_ghc_ext_frag.c b/net/6lowpan/nhc_ghc_ext_frag.c
index d49b745918e0..220e5abfa946 100644
--- a/net/6lowpan/nhc_ghc_ext_frag.c
+++ b/net/6lowpan/nhc_ghc_ext_frag.c
@@ -5,19 +5,12 @@
 
 #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);
+	   NEXTHDR_FRAGMENT, 0, LOWPAN_GHC_EXT_FRAG_ID_0,
+	   LOWPAN_GHC_EXT_FRAG_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(ghc_ext_frag);
 MODULE_DESCRIPTION("6LoWPAN generic header fragmentation extension compression");
diff --git a/net/6lowpan/nhc_ghc_ext_hop.c b/net/6lowpan/nhc_ghc_ext_hop.c
index 3beedf5140a3..9b0de4da7379 100644
--- a/net/6lowpan/nhc_ghc_ext_hop.c
+++ b/net/6lowpan/nhc_ghc_ext_hop.c
@@ -5,18 +5,11 @@
 
 #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);
+	   LOWPAN_GHC_EXT_HOP_ID_0, LOWPAN_GHC_EXT_HOP_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(ghc_ext_hop);
 MODULE_DESCRIPTION("6LoWPAN generic header hop-by-hop extension compression");
diff --git a/net/6lowpan/nhc_ghc_ext_route.c b/net/6lowpan/nhc_ghc_ext_route.c
index 70dc0ea3cf66..3e86faec59c9 100644
--- a/net/6lowpan/nhc_ghc_ext_route.c
+++ b/net/6lowpan/nhc_ghc_ext_route.c
@@ -5,18 +5,11 @@
 
 #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);
+	   0, LOWPAN_GHC_EXT_ROUTE_ID_0, LOWPAN_GHC_EXT_ROUTE_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(ghc_ext_route);
 MODULE_DESCRIPTION("6LoWPAN generic header routing extension compression");
diff --git a/net/6lowpan/nhc_ghc_icmpv6.c b/net/6lowpan/nhc_ghc_icmpv6.c
index 339ceffc25a9..1634f3eb0be8 100644
--- a/net/6lowpan/nhc_ghc_icmpv6.c
+++ b/net/6lowpan/nhc_ghc_icmpv6.c
@@ -5,18 +5,11 @@
 
 #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);
+	   LOWPAN_GHC_ICMPV6_ID_0, LOWPAN_GHC_ICMPV6_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(ghc_icmpv6);
 MODULE_DESCRIPTION("6LoWPAN generic header ICMPv6 compression");
diff --git a/net/6lowpan/nhc_ghc_udp.c b/net/6lowpan/nhc_ghc_udp.c
index f47fec601e73..4ac4813b77ad 100644
--- a/net/6lowpan/nhc_ghc_udp.c
+++ b/net/6lowpan/nhc_ghc_udp.c
@@ -5,18 +5,11 @@
 
 #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);
+	   LOWPAN_GHC_UDP_ID_0, LOWPAN_GHC_UDP_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(ghc_udp);
 MODULE_DESCRIPTION("6LoWPAN generic header UDP compression");
diff --git a/net/6lowpan/nhc_hop.c b/net/6lowpan/nhc_hop.c
index 158fc1906327..182087dfd09d 100644
--- a/net/6lowpan/nhc_hop.c
+++ b/net/6lowpan/nhc_hop.c
@@ -5,18 +5,11 @@
 
 #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);
+	   LOWPAN_NHC_HOP_ID_0, LOWPAN_NHC_HOP_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(nhc_hop);
 MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Hop-by-Hop Options compression");
diff --git a/net/6lowpan/nhc_ipv6.c b/net/6lowpan/nhc_ipv6.c
index 08b7589e5b38..20242360b1d4 100644
--- a/net/6lowpan/nhc_ipv6.c
+++ b/net/6lowpan/nhc_ipv6.c
@@ -5,18 +5,11 @@
 
 #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);
+LOWPAN_NHC(nhc_ipv6, "RFC6282 IPv6", NEXTHDR_IPV6, 0, LOWPAN_NHC_IPV6_ID_0,
+	   LOWPAN_NHC_IPV6_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(nhc_ipv6);
 MODULE_DESCRIPTION("6LoWPAN next header RFC6282 IPv6 compression");
diff --git a/net/6lowpan/nhc_mobility.c b/net/6lowpan/nhc_mobility.c
index ac8fca689828..1c31d872c804 100644
--- a/net/6lowpan/nhc_mobility.c
+++ b/net/6lowpan/nhc_mobility.c
@@ -5,18 +5,11 @@
 
 #include "nhc.h"
 
-#define LOWPAN_NHC_MOBILITY_IDLEN	1
 #define LOWPAN_NHC_MOBILITY_ID_0	0xe8
 #define LOWPAN_NHC_MOBILITY_MASK_0	0xfe
 
-static void mobility_nhid_setup(struct lowpan_nhc *nhc)
-{
-	nhc->id[0] = LOWPAN_NHC_MOBILITY_ID_0;
-	nhc->idmask[0] = LOWPAN_NHC_MOBILITY_MASK_0;
-}
-
 LOWPAN_NHC(nhc_mobility, "RFC6282 Mobility", NEXTHDR_MOBILITY, 0,
-	   mobility_nhid_setup, LOWPAN_NHC_MOBILITY_IDLEN, NULL, NULL);
+	   LOWPAN_NHC_MOBILITY_ID_0, LOWPAN_NHC_MOBILITY_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(nhc_mobility);
 MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Mobility compression");
diff --git a/net/6lowpan/nhc_routing.c b/net/6lowpan/nhc_routing.c
index 1c174023de42..dae03ebf7021 100644
--- a/net/6lowpan/nhc_routing.c
+++ b/net/6lowpan/nhc_routing.c
@@ -5,18 +5,11 @@
 
 #include "nhc.h"
 
-#define LOWPAN_NHC_ROUTING_IDLEN	1
 #define LOWPAN_NHC_ROUTING_ID_0		0xe2
 #define LOWPAN_NHC_ROUTING_MASK_0	0xfe
 
-static void routing_nhid_setup(struct lowpan_nhc *nhc)
-{
-	nhc->id[0] = LOWPAN_NHC_ROUTING_ID_0;
-	nhc->idmask[0] = LOWPAN_NHC_ROUTING_MASK_0;
-}
-
 LOWPAN_NHC(nhc_routing, "RFC6282 Routing", NEXTHDR_ROUTING, 0,
-	   routing_nhid_setup, LOWPAN_NHC_ROUTING_IDLEN, NULL, NULL);
+	   LOWPAN_NHC_ROUTING_ID_0, LOWPAN_NHC_ROUTING_MASK_0, NULL, NULL);
 
 module_lowpan_nhc(nhc_routing);
 MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Routing compression");
diff --git a/net/6lowpan/nhc_udp.c b/net/6lowpan/nhc_udp.c
index 33f17bd8cda7..0a506c77283d 100644
--- a/net/6lowpan/nhc_udp.c
+++ b/net/6lowpan/nhc_udp.c
@@ -14,7 +14,6 @@
 
 #define LOWPAN_NHC_UDP_MASK		0xF8
 #define LOWPAN_NHC_UDP_ID		0xF0
-#define LOWPAN_NHC_UDP_IDLEN		1
 
 #define LOWPAN_NHC_UDP_4BIT_PORT	0xF0B0
 #define LOWPAN_NHC_UDP_4BIT_MASK	0xFFF0
@@ -169,14 +168,8 @@ static int udp_compress(struct sk_buff *skb, u8 **hc_ptr)
 	return 0;
 }
 
-static void udp_nhid_setup(struct lowpan_nhc *nhc)
-{
-	nhc->id[0] = LOWPAN_NHC_UDP_ID;
-	nhc->idmask[0] = LOWPAN_NHC_UDP_MASK;
-}
-
 LOWPAN_NHC(nhc_udp, "RFC6282 UDP", NEXTHDR_UDP, sizeof(struct udphdr),
-	   udp_nhid_setup, LOWPAN_NHC_UDP_IDLEN, udp_uncompress, udp_compress);
+	   LOWPAN_NHC_UDP_ID, LOWPAN_NHC_UDP_MASK, udp_uncompress, udp_compress);
 
 module_lowpan_nhc(nhc_udp);
 MODULE_DESCRIPTION("6LoWPAN next header RFC6282 UDP compression");
-- 
2.31.1


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

* [PATCH bluetooth-next 3/3] net: 6lowpan: constify lowpan_nhc structures
  2022-04-28  3:05 [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Alexander Aring
  2022-04-28  3:05 ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Alexander Aring
  2022-04-28  3:05 ` [PATCH bluetooth-next 2/3] net: 6lowpan: use array for find nhc id Alexander Aring
@ 2022-04-28  3:05 ` Alexander Aring
  2022-05-02 19:37   ` Stefan Schmidt
  2022-05-03  7:32   ` Jukka Rissanen
  2022-06-01 20:28 ` [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Stefan Schmidt
  2022-06-02 17:41 ` Stefan Schmidt
  4 siblings, 2 replies; 18+ messages in thread
From: Alexander Aring @ 2022-04-28  3:05 UTC (permalink / raw)
  To: jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, stefan, torvalds

This patch constify the lowpan_nhc declarations. Since we drop the rb
node datastructure there is no need for runtime manipulation of this
structure.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 net/6lowpan/nhc.c | 16 ++++++++--------
 net/6lowpan/nhc.h |  6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c
index 019f121b2449..7b374595328d 100644
--- a/net/6lowpan/nhc.c
+++ b/net/6lowpan/nhc.c
@@ -12,12 +12,12 @@
 
 #include "nhc.h"
 
-static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
+static const struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
 static DEFINE_SPINLOCK(lowpan_nhc_lock);
 
-static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
+static const struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
 {
-	struct lowpan_nhc *nhc;
+	const struct lowpan_nhc *nhc;
 	int i;
 	u8 id;
 
@@ -41,7 +41,7 @@ static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
 int lowpan_nhc_check_compression(struct sk_buff *skb,
 				 const struct ipv6hdr *hdr, u8 **hc_ptr)
 {
-	struct lowpan_nhc *nhc;
+	const struct lowpan_nhc *nhc;
 	int ret = 0;
 
 	spin_lock_bh(&lowpan_nhc_lock);
@@ -59,7 +59,7 @@ int lowpan_nhc_do_compression(struct sk_buff *skb, const struct ipv6hdr *hdr,
 			      u8 **hc_ptr)
 {
 	int ret;
-	struct lowpan_nhc *nhc;
+	const struct lowpan_nhc *nhc;
 
 	spin_lock_bh(&lowpan_nhc_lock);
 
@@ -102,7 +102,7 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
 				const struct net_device *dev,
 				struct ipv6hdr *hdr)
 {
-	struct lowpan_nhc *nhc;
+	const struct lowpan_nhc *nhc;
 	int ret;
 
 	spin_lock_bh(&lowpan_nhc_lock);
@@ -138,7 +138,7 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
 	return 0;
 }
 
-int lowpan_nhc_add(struct lowpan_nhc *nhc)
+int lowpan_nhc_add(const struct lowpan_nhc *nhc)
 {
 	int ret = 0;
 
@@ -156,7 +156,7 @@ int lowpan_nhc_add(struct lowpan_nhc *nhc)
 }
 EXPORT_SYMBOL(lowpan_nhc_add);
 
-void lowpan_nhc_del(struct lowpan_nhc *nhc)
+void lowpan_nhc_del(const struct lowpan_nhc *nhc)
 {
 	spin_lock_bh(&lowpan_nhc_lock);
 
diff --git a/net/6lowpan/nhc.h b/net/6lowpan/nhc.h
index 9df602a632bd..ab7b4977c32b 100644
--- a/net/6lowpan/nhc.h
+++ b/net/6lowpan/nhc.h
@@ -24,7 +24,7 @@
 #define LOWPAN_NHC(__nhc, _name, _nexthdr,	\
 		   _hdrlen, _id, _idmask,	\
 		   _uncompress, _compress)	\
-static struct lowpan_nhc __nhc = {		\
+static const struct lowpan_nhc __nhc = {	\
 	.name		= _name,		\
 	.nexthdr	= _nexthdr,		\
 	.nexthdrlen	= _hdrlen,		\
@@ -116,14 +116,14 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
  *
  * @nhc: nhc which should be add.
  */
-int lowpan_nhc_add(struct lowpan_nhc *nhc);
+int lowpan_nhc_add(const struct lowpan_nhc *nhc);
 
 /**
  * lowpan_nhc_del - delete a next header compression from framework
  *
  * @nhc: nhc which should be delete.
  */
-void lowpan_nhc_del(struct lowpan_nhc *nhc);
+void lowpan_nhc_del(const struct lowpan_nhc *nhc);
 
 /**
  * lowpan_nhc_init - adding all default nhcs
-- 
2.31.1


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

* RE: net: 6lowpan: simplify lookup by nhc id
  2022-04-28  3:05 ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Alexander Aring
@ 2022-04-28  3:47   ` bluez.test.bot
  2022-05-02 19:36   ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Stefan Schmidt
  2022-05-03  7:31   ` Jukka Rissanen
  2 siblings, 0 replies; 18+ messages in thread
From: bluez.test.bot @ 2022-04-28  3:47 UTC (permalink / raw)
  To: linux-bluetooth, aahringo

[-- Attachment #1: Type: text/plain, Size: 1362 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=636426

---Test result---

Test Summary:
CheckPatch                    PASS      5.77 seconds
GitLint                       PASS      1.40 seconds
SubjectPrefix                 FAIL      0.92 seconds
BuildKernel                   PASS      41.46 seconds
BuildKernel32                 PASS      37.48 seconds
Incremental Build with patchesPASS      63.86 seconds
TestRunner: Setup             PASS      646.14 seconds
TestRunner: l2cap-tester      PASS      20.96 seconds
TestRunner: bnep-tester       PASS      7.82 seconds
TestRunner: mgmt-tester       PASS      130.76 seconds
TestRunner: rfcomm-tester     PASS      12.14 seconds
TestRunner: sco-tester        PASS      11.49 seconds
TestRunner: smp-tester        PASS      11.45 seconds
TestRunner: userchan-tester   PASS      7.68 seconds

Details
##############################
Test: SubjectPrefix - FAIL - 0.92 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject



---
Regards,
Linux Bluetooth


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

* Re: [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars
  2022-04-28  3:05 ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Alexander Aring
  2022-04-28  3:47   ` net: 6lowpan: simplify lookup by nhc id bluez.test.bot
@ 2022-05-02 19:36   ` Stefan Schmidt
  2022-05-03  7:31   ` Jukka Rissanen
  2 siblings, 0 replies; 18+ messages in thread
From: Stefan Schmidt @ 2022-05-02 19:36 UTC (permalink / raw)
  To: Alexander Aring, jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, torvalds


Hello.

On 28.04.22 05:05, Alexander Aring wrote:
> The keyword const makes no sense for scalar types inside the lowpan_nhc
> structure. Most compilers will ignore it so we remove the keyword from
> the scalar types.
> 
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
>   net/6lowpan/nhc.h | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/6lowpan/nhc.h b/net/6lowpan/nhc.h
> index 67951c40734b..2ac7da388c4d 100644
> --- a/net/6lowpan/nhc.h
> +++ b/net/6lowpan/nhc.h
> @@ -67,11 +67,11 @@ module_exit(__nhc##_exit);
>   struct lowpan_nhc {
>   	struct rb_node	node;
>   	const char	*name;
> -	const u8	nexthdr;
> -	const size_t	nexthdrlen;
> +	u8		nexthdr;
> +	size_t		nexthdrlen;
>   	u8		*id;
>   	u8		*idmask;
> -	const size_t	idlen;
> +	size_t		idlen;
>   
>   	void		(*idsetup)(struct lowpan_nhc *nhc);
>   	int		(*uncompress)(struct sk_buff *skb, size_t needed);

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt

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

* Re: [PATCH bluetooth-next 2/3] net: 6lowpan: use array for find nhc id
  2022-04-28  3:05 ` [PATCH bluetooth-next 2/3] net: 6lowpan: use array for find nhc id Alexander Aring
@ 2022-05-02 19:37   ` Stefan Schmidt
  2022-05-03  7:32   ` Jukka Rissanen
  1 sibling, 0 replies; 18+ messages in thread
From: Stefan Schmidt @ 2022-05-02 19:37 UTC (permalink / raw)
  To: Alexander Aring, jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, torvalds

Hello.

On 28.04.22 05:05, Alexander Aring wrote:
> This patch will remove the complete overengineered and overthinking rb data
> structure for looking up the nhc by nhcid. Instead we using the existing
> nhc next header array and iterate over it. It works now for 1 byte values
> only. However there are only 1 byte nhc id values currently
> supported and IANA also does not specify large than 1 byte values yet.
> If there are 2 byte values for nhc ids specified we can revisit this
> data structure and add support for it.
> 
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
>   net/6lowpan/nhc.c               | 91 +++++----------------------------
>   net/6lowpan/nhc.h               | 28 ++++------
>   net/6lowpan/nhc_dest.c          |  9 +---
>   net/6lowpan/nhc_fragment.c      |  9 +---
>   net/6lowpan/nhc_ghc_ext_dest.c  |  9 +---
>   net/6lowpan/nhc_ghc_ext_frag.c  | 11 +---
>   net/6lowpan/nhc_ghc_ext_hop.c   |  9 +---
>   net/6lowpan/nhc_ghc_ext_route.c |  9 +---
>   net/6lowpan/nhc_ghc_icmpv6.c    |  9 +---
>   net/6lowpan/nhc_ghc_udp.c       |  9 +---
>   net/6lowpan/nhc_hop.c           |  9 +---
>   net/6lowpan/nhc_ipv6.c          | 11 +---
>   net/6lowpan/nhc_mobility.c      |  9 +---
>   net/6lowpan/nhc_routing.c       |  9 +---
>   net/6lowpan/nhc_udp.c           |  9 +---
>   15 files changed, 37 insertions(+), 203 deletions(-)
> 
> diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c
> index d6bbbd4ab38b..019f121b2449 100644
> --- a/net/6lowpan/nhc.c
> +++ b/net/6lowpan/nhc.c
> @@ -12,77 +12,26 @@
>   
>   #include "nhc.h"
>   
> -static struct rb_root rb_root = RB_ROOT;
>   static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
>   static DEFINE_SPINLOCK(lowpan_nhc_lock);
>   
> -static int lowpan_nhc_insert(struct lowpan_nhc *nhc)
> +static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
>   {
> -	struct rb_node **new = &rb_root.rb_node, *parent = NULL;
> -
> -	/* Figure out where to put new node */
> -	while (*new) {
> -		struct lowpan_nhc *this = rb_entry(*new, struct lowpan_nhc,
> -						   node);
> -		int result, len_dif, len;
> -
> -		len_dif = nhc->idlen - this->idlen;
> -
> -		if (nhc->idlen < this->idlen)
> -			len = nhc->idlen;
> -		else
> -			len = this->idlen;
> -
> -		result = memcmp(nhc->id, this->id, len);
> -		if (!result)
> -			result = len_dif;
> -
> -		parent = *new;
> -		if (result < 0)
> -			new = &((*new)->rb_left);
> -		else if (result > 0)
> -			new = &((*new)->rb_right);
> -		else
> -			return -EEXIST;
> -	}
> +	struct lowpan_nhc *nhc;
> +	int i;
> +	u8 id;
>   
> -	/* Add new node and rebalance tree. */
> -	rb_link_node(&nhc->node, parent, new);
> -	rb_insert_color(&nhc->node, &rb_root);
> +	if (!pskb_may_pull(skb, 1))
> +		return NULL;
>   
> -	return 0;
> -}
> +	id = *skb->data;
>   
> -static void lowpan_nhc_remove(struct lowpan_nhc *nhc)
> -{
> -	rb_erase(&nhc->node, &rb_root);
> -}
> +	for (i = 0; i < NEXTHDR_MAX + 1; i++) {
> +		nhc = lowpan_nexthdr_nhcs[i];
> +		if (!nhc)
> +			continue;
>   
> -static struct lowpan_nhc *lowpan_nhc_by_nhcid(const struct sk_buff *skb)
> -{
> -	struct rb_node *node = rb_root.rb_node;
> -	const u8 *nhcid_skb_ptr = skb->data;
> -
> -	while (node) {
> -		struct lowpan_nhc *nhc = rb_entry(node, struct lowpan_nhc,
> -						  node);
> -		u8 nhcid_skb_ptr_masked[LOWPAN_NHC_MAX_ID_LEN];
> -		int result, i;
> -
> -		if (nhcid_skb_ptr + nhc->idlen > skb->data + skb->len)
> -			return NULL;
> -
> -		/* copy and mask afterwards the nhid value from skb */
> -		memcpy(nhcid_skb_ptr_masked, nhcid_skb_ptr, nhc->idlen);
> -		for (i = 0; i < nhc->idlen; i++)
> -			nhcid_skb_ptr_masked[i] &= nhc->idmask[i];
> -
> -		result = memcmp(nhcid_skb_ptr_masked, nhc->id, nhc->idlen);
> -		if (result < 0)
> -			node = node->rb_left;
> -		else if (result > 0)
> -			node = node->rb_right;
> -		else
> +		if ((id & nhc->idmask) == nhc->id)
>   			return nhc;
>   	}
>   
> @@ -191,16 +140,7 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
>   
>   int lowpan_nhc_add(struct lowpan_nhc *nhc)
>   {
> -	int ret;
> -
> -	if (!nhc->idlen || !nhc->idsetup)
> -		return -EINVAL;
> -
> -	WARN_ONCE(nhc->idlen > LOWPAN_NHC_MAX_ID_LEN,
> -		  "LOWPAN_NHC_MAX_ID_LEN should be updated to %zd.\n",
> -		  nhc->idlen);
> -
> -	nhc->idsetup(nhc);
> +	int ret = 0;
>   
>   	spin_lock_bh(&lowpan_nhc_lock);
>   
> @@ -209,10 +149,6 @@ int lowpan_nhc_add(struct lowpan_nhc *nhc)
>   		goto out;
>   	}
>   
> -	ret = lowpan_nhc_insert(nhc);
> -	if (ret < 0)
> -		goto out;
> -
>   	lowpan_nexthdr_nhcs[nhc->nexthdr] = nhc;
>   out:
>   	spin_unlock_bh(&lowpan_nhc_lock);
> @@ -224,7 +160,6 @@ void lowpan_nhc_del(struct lowpan_nhc *nhc)
>   {
>   	spin_lock_bh(&lowpan_nhc_lock);
>   
> -	lowpan_nhc_remove(nhc);
>   	lowpan_nexthdr_nhcs[nhc->nexthdr] = NULL;
>   
>   	spin_unlock_bh(&lowpan_nhc_lock);
> diff --git a/net/6lowpan/nhc.h b/net/6lowpan/nhc.h
> index 2ac7da388c4d..9df602a632bd 100644
> --- a/net/6lowpan/nhc.h
> +++ b/net/6lowpan/nhc.h
> @@ -16,24 +16,20 @@
>    * @_name: const char * of common header compression name.
>    * @_nexthdr: ipv6 nexthdr field for the header compression.
>    * @_nexthdrlen: ipv6 nexthdr len for the reserved space.
> - * @_idsetup: callback to setup id and mask values.
> - * @_idlen: len for the next header id and mask, should be always the same.
> + * @_id: one byte nhc id value.
> + * @_idmask: one byte nhc id mask value.
>    * @_uncompress: callback for uncompression call.
>    * @_compress: callback for compression call.
>    */
>   #define LOWPAN_NHC(__nhc, _name, _nexthdr,	\
> -		   _hdrlen, _idsetup, _idlen,	\
> +		   _hdrlen, _id, _idmask,	\
>   		   _uncompress, _compress)	\
> -static u8 __nhc##_val[_idlen];			\
> -static u8 __nhc##_mask[_idlen];			\
>   static struct lowpan_nhc __nhc = {		\
>   	.name		= _name,		\
>   	.nexthdr	= _nexthdr,		\
>   	.nexthdrlen	= _hdrlen,		\
> -	.id		= __nhc##_val,		\
> -	.idmask		= __nhc##_mask,		\
> -	.idlen		= _idlen,		\
> -	.idsetup	= _idsetup,		\
> +	.id		= _id,			\
> +	.idmask		= _idmask,		\
>   	.uncompress	= _uncompress,		\
>   	.compress	= _compress,		\
>   }
> @@ -53,27 +49,21 @@ module_exit(__nhc##_exit);
>   /**
>    * struct lowpan_nhc - hold 6lowpan next hdr compression ifnformation
>    *
> - * @node: holder for the rbtree.
>    * @name: name of the specific next header compression
>    * @nexthdr: next header value of the protocol which should be compressed.
>    * @nexthdrlen: ipv6 nexthdr len for the reserved space.
> - * @id: array for nhc id. Note this need to be in network byteorder.
> - * @mask: array for nhc id mask. Note this need to be in network byteorder.
> - * @len: the length of the next header id and mask.
> - * @setup: callback to setup fill the next header id value and mask.
> + * @id: one byte nhc id value.
> + * @idmask: one byte nhc id mask value.
>    * @compress: callback to do the header compression.
>    * @uncompress: callback to do the header uncompression.
>    */
>   struct lowpan_nhc {
> -	struct rb_node	node;
>   	const char	*name;
>   	u8		nexthdr;
>   	size_t		nexthdrlen;
> -	u8		*id;
> -	u8		*idmask;
> -	size_t		idlen;
> +	u8		id;
> +	u8		idmask;
>   
> -	void		(*idsetup)(struct lowpan_nhc *nhc);
>   	int		(*uncompress)(struct sk_buff *skb, size_t needed);
>   	int		(*compress)(struct sk_buff *skb, u8 **hc_ptr);
>   };
> diff --git a/net/6lowpan/nhc_dest.c b/net/6lowpan/nhc_dest.c
> index 4768a9459212..0cbcc7806469 100644
> --- a/net/6lowpan/nhc_dest.c
> +++ b/net/6lowpan/nhc_dest.c
> @@ -6,18 +6,11 @@
>   
>   #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);
> +	   LOWPAN_NHC_DEST_ID_0, LOWPAN_NHC_DEST_MASK_0,  NULL, NULL);
>   
>   module_lowpan_nhc(nhc_dest);
>   MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Destination Options compression");
> diff --git a/net/6lowpan/nhc_fragment.c b/net/6lowpan/nhc_fragment.c
> index be85f07715bd..9414552df0ac 100644
> --- a/net/6lowpan/nhc_fragment.c
> +++ b/net/6lowpan/nhc_fragment.c
> @@ -5,18 +5,11 @@
>   
>   #include "nhc.h"
>   
> -#define LOWPAN_NHC_FRAGMENT_IDLEN	1
>   #define LOWPAN_NHC_FRAGMENT_ID_0	0xe4
>   #define LOWPAN_NHC_FRAGMENT_MASK_0	0xfe
>   
> -static void fragment_nhid_setup(struct lowpan_nhc *nhc)
> -{
> -	nhc->id[0] = LOWPAN_NHC_FRAGMENT_ID_0;
> -	nhc->idmask[0] = LOWPAN_NHC_FRAGMENT_MASK_0;
> -}
> -
>   LOWPAN_NHC(nhc_fragment, "RFC6282 Fragment", NEXTHDR_FRAGMENT, 0,
> -	   fragment_nhid_setup, LOWPAN_NHC_FRAGMENT_IDLEN, NULL, NULL);
> +	   LOWPAN_NHC_FRAGMENT_ID_0, LOWPAN_NHC_FRAGMENT_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(nhc_fragment);
>   MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Fragment compression");
> diff --git a/net/6lowpan/nhc_ghc_ext_dest.c b/net/6lowpan/nhc_ghc_ext_dest.c
> index a9137f1733be..e4745ddd10a8 100644
> --- a/net/6lowpan/nhc_ghc_ext_dest.c
> +++ b/net/6lowpan/nhc_ghc_ext_dest.c
> @@ -5,18 +5,11 @@
>   
>   #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);
> +	   0, LOWPAN_GHC_EXT_DEST_ID_0, LOWPAN_GHC_EXT_DEST_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(ghc_ext_dest);
>   MODULE_DESCRIPTION("6LoWPAN generic header destination extension compression");
> diff --git a/net/6lowpan/nhc_ghc_ext_frag.c b/net/6lowpan/nhc_ghc_ext_frag.c
> index d49b745918e0..220e5abfa946 100644
> --- a/net/6lowpan/nhc_ghc_ext_frag.c
> +++ b/net/6lowpan/nhc_ghc_ext_frag.c
> @@ -5,19 +5,12 @@
>   
>   #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);
> +	   NEXTHDR_FRAGMENT, 0, LOWPAN_GHC_EXT_FRAG_ID_0,
> +	   LOWPAN_GHC_EXT_FRAG_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(ghc_ext_frag);
>   MODULE_DESCRIPTION("6LoWPAN generic header fragmentation extension compression");
> diff --git a/net/6lowpan/nhc_ghc_ext_hop.c b/net/6lowpan/nhc_ghc_ext_hop.c
> index 3beedf5140a3..9b0de4da7379 100644
> --- a/net/6lowpan/nhc_ghc_ext_hop.c
> +++ b/net/6lowpan/nhc_ghc_ext_hop.c
> @@ -5,18 +5,11 @@
>   
>   #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);
> +	   LOWPAN_GHC_EXT_HOP_ID_0, LOWPAN_GHC_EXT_HOP_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(ghc_ext_hop);
>   MODULE_DESCRIPTION("6LoWPAN generic header hop-by-hop extension compression");
> diff --git a/net/6lowpan/nhc_ghc_ext_route.c b/net/6lowpan/nhc_ghc_ext_route.c
> index 70dc0ea3cf66..3e86faec59c9 100644
> --- a/net/6lowpan/nhc_ghc_ext_route.c
> +++ b/net/6lowpan/nhc_ghc_ext_route.c
> @@ -5,18 +5,11 @@
>   
>   #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);
> +	   0, LOWPAN_GHC_EXT_ROUTE_ID_0, LOWPAN_GHC_EXT_ROUTE_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(ghc_ext_route);
>   MODULE_DESCRIPTION("6LoWPAN generic header routing extension compression");
> diff --git a/net/6lowpan/nhc_ghc_icmpv6.c b/net/6lowpan/nhc_ghc_icmpv6.c
> index 339ceffc25a9..1634f3eb0be8 100644
> --- a/net/6lowpan/nhc_ghc_icmpv6.c
> +++ b/net/6lowpan/nhc_ghc_icmpv6.c
> @@ -5,18 +5,11 @@
>   
>   #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);
> +	   LOWPAN_GHC_ICMPV6_ID_0, LOWPAN_GHC_ICMPV6_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(ghc_icmpv6);
>   MODULE_DESCRIPTION("6LoWPAN generic header ICMPv6 compression");
> diff --git a/net/6lowpan/nhc_ghc_udp.c b/net/6lowpan/nhc_ghc_udp.c
> index f47fec601e73..4ac4813b77ad 100644
> --- a/net/6lowpan/nhc_ghc_udp.c
> +++ b/net/6lowpan/nhc_ghc_udp.c
> @@ -5,18 +5,11 @@
>   
>   #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);
> +	   LOWPAN_GHC_UDP_ID_0, LOWPAN_GHC_UDP_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(ghc_udp);
>   MODULE_DESCRIPTION("6LoWPAN generic header UDP compression");
> diff --git a/net/6lowpan/nhc_hop.c b/net/6lowpan/nhc_hop.c
> index 158fc1906327..182087dfd09d 100644
> --- a/net/6lowpan/nhc_hop.c
> +++ b/net/6lowpan/nhc_hop.c
> @@ -5,18 +5,11 @@
>   
>   #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);
> +	   LOWPAN_NHC_HOP_ID_0, LOWPAN_NHC_HOP_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(nhc_hop);
>   MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Hop-by-Hop Options compression");
> diff --git a/net/6lowpan/nhc_ipv6.c b/net/6lowpan/nhc_ipv6.c
> index 08b7589e5b38..20242360b1d4 100644
> --- a/net/6lowpan/nhc_ipv6.c
> +++ b/net/6lowpan/nhc_ipv6.c
> @@ -5,18 +5,11 @@
>   
>   #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);
> +LOWPAN_NHC(nhc_ipv6, "RFC6282 IPv6", NEXTHDR_IPV6, 0, LOWPAN_NHC_IPV6_ID_0,
> +	   LOWPAN_NHC_IPV6_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(nhc_ipv6);
>   MODULE_DESCRIPTION("6LoWPAN next header RFC6282 IPv6 compression");
> diff --git a/net/6lowpan/nhc_mobility.c b/net/6lowpan/nhc_mobility.c
> index ac8fca689828..1c31d872c804 100644
> --- a/net/6lowpan/nhc_mobility.c
> +++ b/net/6lowpan/nhc_mobility.c
> @@ -5,18 +5,11 @@
>   
>   #include "nhc.h"
>   
> -#define LOWPAN_NHC_MOBILITY_IDLEN	1
>   #define LOWPAN_NHC_MOBILITY_ID_0	0xe8
>   #define LOWPAN_NHC_MOBILITY_MASK_0	0xfe
>   
> -static void mobility_nhid_setup(struct lowpan_nhc *nhc)
> -{
> -	nhc->id[0] = LOWPAN_NHC_MOBILITY_ID_0;
> -	nhc->idmask[0] = LOWPAN_NHC_MOBILITY_MASK_0;
> -}
> -
>   LOWPAN_NHC(nhc_mobility, "RFC6282 Mobility", NEXTHDR_MOBILITY, 0,
> -	   mobility_nhid_setup, LOWPAN_NHC_MOBILITY_IDLEN, NULL, NULL);
> +	   LOWPAN_NHC_MOBILITY_ID_0, LOWPAN_NHC_MOBILITY_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(nhc_mobility);
>   MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Mobility compression");
> diff --git a/net/6lowpan/nhc_routing.c b/net/6lowpan/nhc_routing.c
> index 1c174023de42..dae03ebf7021 100644
> --- a/net/6lowpan/nhc_routing.c
> +++ b/net/6lowpan/nhc_routing.c
> @@ -5,18 +5,11 @@
>   
>   #include "nhc.h"
>   
> -#define LOWPAN_NHC_ROUTING_IDLEN	1
>   #define LOWPAN_NHC_ROUTING_ID_0		0xe2
>   #define LOWPAN_NHC_ROUTING_MASK_0	0xfe
>   
> -static void routing_nhid_setup(struct lowpan_nhc *nhc)
> -{
> -	nhc->id[0] = LOWPAN_NHC_ROUTING_ID_0;
> -	nhc->idmask[0] = LOWPAN_NHC_ROUTING_MASK_0;
> -}
> -
>   LOWPAN_NHC(nhc_routing, "RFC6282 Routing", NEXTHDR_ROUTING, 0,
> -	   routing_nhid_setup, LOWPAN_NHC_ROUTING_IDLEN, NULL, NULL);
> +	   LOWPAN_NHC_ROUTING_ID_0, LOWPAN_NHC_ROUTING_MASK_0, NULL, NULL);
>   
>   module_lowpan_nhc(nhc_routing);
>   MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Routing compression");
> diff --git a/net/6lowpan/nhc_udp.c b/net/6lowpan/nhc_udp.c
> index 33f17bd8cda7..0a506c77283d 100644
> --- a/net/6lowpan/nhc_udp.c
> +++ b/net/6lowpan/nhc_udp.c
> @@ -14,7 +14,6 @@
>   
>   #define LOWPAN_NHC_UDP_MASK		0xF8
>   #define LOWPAN_NHC_UDP_ID		0xF0
> -#define LOWPAN_NHC_UDP_IDLEN		1
>   
>   #define LOWPAN_NHC_UDP_4BIT_PORT	0xF0B0
>   #define LOWPAN_NHC_UDP_4BIT_MASK	0xFFF0
> @@ -169,14 +168,8 @@ static int udp_compress(struct sk_buff *skb, u8 **hc_ptr)
>   	return 0;
>   }
>   
> -static void udp_nhid_setup(struct lowpan_nhc *nhc)
> -{
> -	nhc->id[0] = LOWPAN_NHC_UDP_ID;
> -	nhc->idmask[0] = LOWPAN_NHC_UDP_MASK;
> -}
> -
>   LOWPAN_NHC(nhc_udp, "RFC6282 UDP", NEXTHDR_UDP, sizeof(struct udphdr),
> -	   udp_nhid_setup, LOWPAN_NHC_UDP_IDLEN, udp_uncompress, udp_compress);
> +	   LOWPAN_NHC_UDP_ID, LOWPAN_NHC_UDP_MASK, udp_uncompress, udp_compress);
>   
>   module_lowpan_nhc(nhc_udp);
>   MODULE_DESCRIPTION("6LoWPAN next header RFC6282 UDP compression");

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt

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

* Re: [PATCH bluetooth-next 3/3] net: 6lowpan: constify lowpan_nhc structures
  2022-04-28  3:05 ` [PATCH bluetooth-next 3/3] net: 6lowpan: constify lowpan_nhc structures Alexander Aring
@ 2022-05-02 19:37   ` Stefan Schmidt
  2022-05-03  7:32   ` Jukka Rissanen
  1 sibling, 0 replies; 18+ messages in thread
From: Stefan Schmidt @ 2022-05-02 19:37 UTC (permalink / raw)
  To: Alexander Aring, jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, torvalds


Hello.

On 28.04.22 05:05, Alexander Aring wrote:
> This patch constify the lowpan_nhc declarations. Since we drop the rb
> node datastructure there is no need for runtime manipulation of this
> structure.
> 
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
>   net/6lowpan/nhc.c | 16 ++++++++--------
>   net/6lowpan/nhc.h |  6 +++---
>   2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c
> index 019f121b2449..7b374595328d 100644
> --- a/net/6lowpan/nhc.c
> +++ b/net/6lowpan/nhc.c
> @@ -12,12 +12,12 @@
>   
>   #include "nhc.h"
>   
> -static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
> +static const struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
>   static DEFINE_SPINLOCK(lowpan_nhc_lock);
>   
> -static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
> +static const struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
>   {
> -	struct lowpan_nhc *nhc;
> +	const struct lowpan_nhc *nhc;
>   	int i;
>   	u8 id;
>   
> @@ -41,7 +41,7 @@ static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
>   int lowpan_nhc_check_compression(struct sk_buff *skb,
>   				 const struct ipv6hdr *hdr, u8 **hc_ptr)
>   {
> -	struct lowpan_nhc *nhc;
> +	const struct lowpan_nhc *nhc;
>   	int ret = 0;
>   
>   	spin_lock_bh(&lowpan_nhc_lock);
> @@ -59,7 +59,7 @@ int lowpan_nhc_do_compression(struct sk_buff *skb, const struct ipv6hdr *hdr,
>   			      u8 **hc_ptr)
>   {
>   	int ret;
> -	struct lowpan_nhc *nhc;
> +	const struct lowpan_nhc *nhc;
>   
>   	spin_lock_bh(&lowpan_nhc_lock);
>   
> @@ -102,7 +102,7 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
>   				const struct net_device *dev,
>   				struct ipv6hdr *hdr)
>   {
> -	struct lowpan_nhc *nhc;
> +	const struct lowpan_nhc *nhc;
>   	int ret;
>   
>   	spin_lock_bh(&lowpan_nhc_lock);
> @@ -138,7 +138,7 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
>   	return 0;
>   }
>   
> -int lowpan_nhc_add(struct lowpan_nhc *nhc)
> +int lowpan_nhc_add(const struct lowpan_nhc *nhc)
>   {
>   	int ret = 0;
>   
> @@ -156,7 +156,7 @@ int lowpan_nhc_add(struct lowpan_nhc *nhc)
>   }
>   EXPORT_SYMBOL(lowpan_nhc_add);
>   
> -void lowpan_nhc_del(struct lowpan_nhc *nhc)
> +void lowpan_nhc_del(const struct lowpan_nhc *nhc)
>   {
>   	spin_lock_bh(&lowpan_nhc_lock);
>   
> diff --git a/net/6lowpan/nhc.h b/net/6lowpan/nhc.h
> index 9df602a632bd..ab7b4977c32b 100644
> --- a/net/6lowpan/nhc.h
> +++ b/net/6lowpan/nhc.h
> @@ -24,7 +24,7 @@
>   #define LOWPAN_NHC(__nhc, _name, _nexthdr,	\
>   		   _hdrlen, _id, _idmask,	\
>   		   _uncompress, _compress)	\
> -static struct lowpan_nhc __nhc = {		\
> +static const struct lowpan_nhc __nhc = {	\
>   	.name		= _name,		\
>   	.nexthdr	= _nexthdr,		\
>   	.nexthdrlen	= _hdrlen,		\
> @@ -116,14 +116,14 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
>    *
>    * @nhc: nhc which should be add.
>    */
> -int lowpan_nhc_add(struct lowpan_nhc *nhc);
> +int lowpan_nhc_add(const struct lowpan_nhc *nhc);
>   
>   /**
>    * lowpan_nhc_del - delete a next header compression from framework
>    *
>    * @nhc: nhc which should be delete.
>    */
> -void lowpan_nhc_del(struct lowpan_nhc *nhc);
> +void lowpan_nhc_del(const struct lowpan_nhc *nhc);
>   
>   /**
>    * lowpan_nhc_init - adding all default nhcs

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt

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

* Re: [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars
  2022-04-28  3:05 ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Alexander Aring
  2022-04-28  3:47   ` net: 6lowpan: simplify lookup by nhc id bluez.test.bot
  2022-05-02 19:36   ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Stefan Schmidt
@ 2022-05-03  7:31   ` Jukka Rissanen
  2 siblings, 0 replies; 18+ messages in thread
From: Jukka Rissanen @ 2022-05-03  7:31 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-bluetooth, linux-wpan, stefan, torvalds

On Wed, 2022-04-27 at 23:05 -0400, Alexander Aring wrote:
> The keyword const makes no sense for scalar types inside the
> lowpan_nhc
> structure. Most compilers will ignore it so we remove the keyword
> from
> the scalar types.
> 
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
>  net/6lowpan/nhc.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/6lowpan/nhc.h b/net/6lowpan/nhc.h
> index 67951c40734b..2ac7da388c4d 100644
> --- a/net/6lowpan/nhc.h
> +++ b/net/6lowpan/nhc.h
> @@ -67,11 +67,11 @@ module_exit(__nhc##_exit);
>  struct lowpan_nhc {
>         struct rb_node  node;
>         const char      *name;
> -       const u8        nexthdr;
> -       const size_t    nexthdrlen;
> +       u8              nexthdr;
> +       size_t          nexthdrlen;
>         u8              *id;
>         u8              *idmask;
> -       const size_t    idlen;
> +       size_t          idlen;
>  
>         void            (*idsetup)(struct lowpan_nhc *nhc);
>         int             (*uncompress)(struct sk_buff *skb, size_t
> needed);


Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>


Cheers,
Jukka


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

* Re: [PATCH bluetooth-next 2/3] net: 6lowpan: use array for find nhc id
  2022-04-28  3:05 ` [PATCH bluetooth-next 2/3] net: 6lowpan: use array for find nhc id Alexander Aring
  2022-05-02 19:37   ` Stefan Schmidt
@ 2022-05-03  7:32   ` Jukka Rissanen
  1 sibling, 0 replies; 18+ messages in thread
From: Jukka Rissanen @ 2022-05-03  7:32 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-bluetooth, linux-wpan, stefan, torvalds

On Wed, 2022-04-27 at 23:05 -0400, Alexander Aring wrote:
> This patch will remove the complete overengineered and overthinking
> rb data
> structure for looking up the nhc by nhcid. Instead we using the
> existing
> nhc next header array and iterate over it. It works now for 1 byte
> values
> only. However there are only 1 byte nhc id values currently
> supported and IANA also does not specify large than 1 byte values
> yet.
> If there are 2 byte values for nhc ids specified we can revisit this
> data structure and add support for it.
> 
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
>  net/6lowpan/nhc.c               | 91 +++++--------------------------
> --
>  net/6lowpan/nhc.h               | 28 ++++------
>  net/6lowpan/nhc_dest.c          |  9 +---
>  net/6lowpan/nhc_fragment.c      |  9 +---
>  net/6lowpan/nhc_ghc_ext_dest.c  |  9 +---
>  net/6lowpan/nhc_ghc_ext_frag.c  | 11 +---
>  net/6lowpan/nhc_ghc_ext_hop.c   |  9 +---
>  net/6lowpan/nhc_ghc_ext_route.c |  9 +---
>  net/6lowpan/nhc_ghc_icmpv6.c    |  9 +---
>  net/6lowpan/nhc_ghc_udp.c       |  9 +---
>  net/6lowpan/nhc_hop.c           |  9 +---
>  net/6lowpan/nhc_ipv6.c          | 11 +---
>  net/6lowpan/nhc_mobility.c      |  9 +---
>  net/6lowpan/nhc_routing.c       |  9 +---
>  net/6lowpan/nhc_udp.c           |  9 +---
>  15 files changed, 37 insertions(+), 203 deletions(-)
> 
> diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c
> index d6bbbd4ab38b..019f121b2449 100644
> --- a/net/6lowpan/nhc.c
> +++ b/net/6lowpan/nhc.c
> @@ -12,77 +12,26 @@
>  

Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>


Cheers,
Jukka


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

* Re: [PATCH bluetooth-next 3/3] net: 6lowpan: constify lowpan_nhc structures
  2022-04-28  3:05 ` [PATCH bluetooth-next 3/3] net: 6lowpan: constify lowpan_nhc structures Alexander Aring
  2022-05-02 19:37   ` Stefan Schmidt
@ 2022-05-03  7:32   ` Jukka Rissanen
  1 sibling, 0 replies; 18+ messages in thread
From: Jukka Rissanen @ 2022-05-03  7:32 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-bluetooth, linux-wpan, stefan, torvalds

On Wed, 2022-04-27 at 23:05 -0400, Alexander Aring wrote:
> This patch constify the lowpan_nhc declarations. Since we drop the rb
> node datastructure there is no need for runtime manipulation of this
> structure.
> 
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
>  net/6lowpan/nhc.c | 16 ++++++++--------
>  net/6lowpan/nhc.h |  6 +++---
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c
> index 019f121b2449..7b374595328d 100644
> --- a/net/6lowpan/nhc.c
> +++ b/net/6lowpan/nhc.c
> @@ -12,12 +12,12 @@
> 


Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>


Cheers,
Jukka


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

* Re: [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id
  2022-04-28  3:05 [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Alexander Aring
                   ` (2 preceding siblings ...)
  2022-04-28  3:05 ` [PATCH bluetooth-next 3/3] net: 6lowpan: constify lowpan_nhc structures Alexander Aring
@ 2022-06-01 20:28 ` Stefan Schmidt
  2022-06-01 21:48   ` Luiz Augusto von Dentz
  2022-06-02 17:41 ` Stefan Schmidt
  4 siblings, 1 reply; 18+ messages in thread
From: Stefan Schmidt @ 2022-06-01 20:28 UTC (permalink / raw)
  To: Alexander Aring, jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, torvalds

Hello.

On 28.04.22 05:05, Alexander Aring wrote:
> Hi,
> 
> this patch series removes the rb data structure for looking up a nhc by
> nhc id. Instead we using the existing nexthdr lookup array by iterating
> over it and find the right nhc by nhc id. It's simply not worth it to
> use such complex handling for such small amount of nhc. As we only
> support nhc ids which fits into 1 byte and there are not two byte nhc
> ids values specified yet, we let the nhc layer only handle 1 byte values.
> If there is the need for 2 byte nhc values we can add support for it.
> 
> - Alex
> 
> Alexander Aring (3):
>    net: 6lowpan: remove const from scalars
>    net: 6lowpan: use array for find nhc id
>    net: 6lowpan: constify lowpan_nhc structures

Marcel, Luiz, are you still picking up generic 6lowpan patches or only 
the ones for bluetooth?

These three have been around for over a month and acked by me and Jukka, 
but I can't find them anywhere in bluetooth-next or Linus tree.

If 6lowpan is of less concern for you I can route them through my 
ieee80254 tree as well.

regards
Stefan Schmidt

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

* Re: [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id
  2022-06-01 20:28 ` [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Stefan Schmidt
@ 2022-06-01 21:48   ` Luiz Augusto von Dentz
  2022-06-01 21:56     ` Stefan Schmidt
  0 siblings, 1 reply; 18+ messages in thread
From: Luiz Augusto von Dentz @ 2022-06-01 21:48 UTC (permalink / raw)
  To: Stefan Schmidt
  Cc: Alexander Aring, Jukka Rissanen, linux-bluetooth,
	linux-wpan - ML, Linus Torvalds

Hi Stefan,

On Wed, Jun 1, 2022 at 2:37 PM Stefan Schmidt <stefan@datenfreihafen.org> wrote:
>
> Hello.
>
> On 28.04.22 05:05, Alexander Aring wrote:
> > Hi,
> >
> > this patch series removes the rb data structure for looking up a nhc by
> > nhc id. Instead we using the existing nexthdr lookup array by iterating
> > over it and find the right nhc by nhc id. It's simply not worth it to
> > use such complex handling for such small amount of nhc. As we only
> > support nhc ids which fits into 1 byte and there are not two byte nhc
> > ids values specified yet, we let the nhc layer only handle 1 byte values.
> > If there is the need for 2 byte nhc values we can add support for it.
> >
> > - Alex
> >
> > Alexander Aring (3):
> >    net: 6lowpan: remove const from scalars
> >    net: 6lowpan: use array for find nhc id
> >    net: 6lowpan: constify lowpan_nhc structures
>
> Marcel, Luiz, are you still picking up generic 6lowpan patches or only
> the ones for bluetooth?
>
> These three have been around for over a month and acked by me and Jukka,
> but I can't find them anywhere in bluetooth-next or Linus tree.
>
> If 6lowpan is of less concern for you I can route them through my
> ieee80254 tree as well.

Up to you, I was not aware they normally were merged thru
bluetooth-next but I would be fine merging those as well.

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id
  2022-06-01 21:48   ` Luiz Augusto von Dentz
@ 2022-06-01 21:56     ` Stefan Schmidt
  2022-06-01 21:58       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Schmidt @ 2022-06-01 21:56 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Alexander Aring, Jukka Rissanen, linux-bluetooth,
	linux-wpan - ML, Linus Torvalds

Hello Luiz.

On 01.06.22 23:48, Luiz Augusto von Dentz wrote:
> Hi Stefan,
> 
> On Wed, Jun 1, 2022 at 2:37 PM Stefan Schmidt <stefan@datenfreihafen.org> wrote:
>>
>> Hello.
>>
>> On 28.04.22 05:05, Alexander Aring wrote:
>>> Hi,
>>>
>>> this patch series removes the rb data structure for looking up a nhc by
>>> nhc id. Instead we using the existing nexthdr lookup array by iterating
>>> over it and find the right nhc by nhc id. It's simply not worth it to
>>> use such complex handling for such small amount of nhc. As we only
>>> support nhc ids which fits into 1 byte and there are not two byte nhc
>>> ids values specified yet, we let the nhc layer only handle 1 byte values.
>>> If there is the need for 2 byte nhc values we can add support for it.
>>>
>>> - Alex
>>>
>>> Alexander Aring (3):
>>>     net: 6lowpan: remove const from scalars
>>>     net: 6lowpan: use array for find nhc id
>>>     net: 6lowpan: constify lowpan_nhc structures
>>
>> Marcel, Luiz, are you still picking up generic 6lowpan patches or only
>> the ones for bluetooth?
>>
>> These three have been around for over a month and acked by me and Jukka,
>> but I can't find them anywhere in bluetooth-next or Linus tree.
>>
>> If 6lowpan is of less concern for you I can route them through my
>> ieee80254 tree as well.
> 
> Up to you, I was not aware they normally were merged thru
> bluetooth-next but I would be fine merging those as well.

If you and Marcel don't mind I would like to switch this over to being 
merged through ieee802154. Mostly because 6lowpan is vital for the 15.4 
work we have.

With Jukka stepping down from co-maintaining this part (thanks a lot for 
your work!) this will most likely be reviewed by Alex and me anyway.

We still need to ensure that patches are hitting wpan as well as 
bluetooth mailing list, but the MAINTAINERS file handles this already.

Let me know if you are unhappy with the switch. If not I will start with 
merging these three as well as the MAINTAINERS update from Jukka.

regards
Stefan Schmidt

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

* Re: [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id
  2022-06-01 21:56     ` Stefan Schmidt
@ 2022-06-01 21:58       ` Luiz Augusto von Dentz
  2022-06-02 15:27         ` Marcel Holtmann
  0 siblings, 1 reply; 18+ messages in thread
From: Luiz Augusto von Dentz @ 2022-06-01 21:58 UTC (permalink / raw)
  To: Stefan Schmidt
  Cc: Alexander Aring, Jukka Rissanen, linux-bluetooth,
	linux-wpan - ML, Linus Torvalds

Hi Stefan,

On Wed, Jun 1, 2022 at 2:56 PM Stefan Schmidt <stefan@datenfreihafen.org> wrote:
>
> Hello Luiz.
>
> On 01.06.22 23:48, Luiz Augusto von Dentz wrote:
> > Hi Stefan,
> >
> > On Wed, Jun 1, 2022 at 2:37 PM Stefan Schmidt <stefan@datenfreihafen.org> wrote:
> >>
> >> Hello.
> >>
> >> On 28.04.22 05:05, Alexander Aring wrote:
> >>> Hi,
> >>>
> >>> this patch series removes the rb data structure for looking up a nhc by
> >>> nhc id. Instead we using the existing nexthdr lookup array by iterating
> >>> over it and find the right nhc by nhc id. It's simply not worth it to
> >>> use such complex handling for such small amount of nhc. As we only
> >>> support nhc ids which fits into 1 byte and there are not two byte nhc
> >>> ids values specified yet, we let the nhc layer only handle 1 byte values.
> >>> If there is the need for 2 byte nhc values we can add support for it.
> >>>
> >>> - Alex
> >>>
> >>> Alexander Aring (3):
> >>>     net: 6lowpan: remove const from scalars
> >>>     net: 6lowpan: use array for find nhc id
> >>>     net: 6lowpan: constify lowpan_nhc structures
> >>
> >> Marcel, Luiz, are you still picking up generic 6lowpan patches or only
> >> the ones for bluetooth?
> >>
> >> These three have been around for over a month and acked by me and Jukka,
> >> but I can't find them anywhere in bluetooth-next or Linus tree.
> >>
> >> If 6lowpan is of less concern for you I can route them through my
> >> ieee80254 tree as well.
> >
> > Up to you, I was not aware they normally were merged thru
> > bluetooth-next but I would be fine merging those as well.
>
> If you and Marcel don't mind I would like to switch this over to being
> merged through ieee802154. Mostly because 6lowpan is vital for the 15.4
> work we have.
>
> With Jukka stepping down from co-maintaining this part (thanks a lot for
> your work!) this will most likely be reviewed by Alex and me anyway.
>
> We still need to ensure that patches are hitting wpan as well as
> bluetooth mailing list, but the MAINTAINERS file handles this already.
>
> Let me know if you are unhappy with the switch. If not I will start with
> merging these three as well as the MAINTAINERS update from Jukka.

I have no problem with that.

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id
  2022-06-01 21:58       ` Luiz Augusto von Dentz
@ 2022-06-02 15:27         ` Marcel Holtmann
  2022-06-02 17:38           ` Stefan Schmidt
  0 siblings, 1 reply; 18+ messages in thread
From: Marcel Holtmann @ 2022-06-02 15:27 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Stefan Schmidt, Alexander Aring, Jukka Rissanen, linux-bluetooth,
	linux-wpan - ML, Linus Torvalds

Hi Stefan,

>>>>> this patch series removes the rb data structure for looking up a nhc by
>>>>> nhc id. Instead we using the existing nexthdr lookup array by iterating
>>>>> over it and find the right nhc by nhc id. It's simply not worth it to
>>>>> use such complex handling for such small amount of nhc. As we only
>>>>> support nhc ids which fits into 1 byte and there are not two byte nhc
>>>>> ids values specified yet, we let the nhc layer only handle 1 byte values.
>>>>> If there is the need for 2 byte nhc values we can add support for it.
>>>>> 
>>>>> - Alex
>>>>> 
>>>>> Alexander Aring (3):
>>>>> net: 6lowpan: remove const from scalars
>>>>> net: 6lowpan: use array for find nhc id
>>>>> net: 6lowpan: constify lowpan_nhc structures
>>>> 
>>>> Marcel, Luiz, are you still picking up generic 6lowpan patches or only
>>>> the ones for bluetooth?
>>>> 
>>>> These three have been around for over a month and acked by me and Jukka,
>>>> but I can't find them anywhere in bluetooth-next or Linus tree.
>>>> 
>>>> If 6lowpan is of less concern for you I can route them through my
>>>> ieee80254 tree as well.
>>> 
>>> Up to you, I was not aware they normally were merged thru
>>> bluetooth-next but I would be fine merging those as well.
>> 
>> If you and Marcel don't mind I would like to switch this over to being
>> merged through ieee802154. Mostly because 6lowpan is vital for the 15.4
>> work we have.
>> 
>> With Jukka stepping down from co-maintaining this part (thanks a lot for
>> your work!) this will most likely be reviewed by Alex and me anyway.
>> 
>> We still need to ensure that patches are hitting wpan as well as
>> bluetooth mailing list, but the MAINTAINERS file handles this already.
>> 
>> Let me know if you are unhappy with the switch. If not I will start with
>> merging these three as well as the MAINTAINERS update from Jukka.
> 
> I have no problem with that.

go for it. Lets just keep the mailing list in MAINTAINERS file so we are aware of patches in this area.

Regards

Marcel


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

* Re: [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id
  2022-06-02 15:27         ` Marcel Holtmann
@ 2022-06-02 17:38           ` Stefan Schmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Stefan Schmidt @ 2022-06-02 17:38 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Alexander Aring, Jukka Rissanen, linux-bluetooth,
	linux-wpan - ML, Linus Torvalds

Hello Marcel

On 02.06.22 17:27, Marcel Holtmann wrote:
> Hi Stefan,
> 
>>>>>> this patch series removes the rb data structure for looking up a nhc by
>>>>>> nhc id. Instead we using the existing nexthdr lookup array by iterating
>>>>>> over it and find the right nhc by nhc id. It's simply not worth it to
>>>>>> use such complex handling for such small amount of nhc. As we only
>>>>>> support nhc ids which fits into 1 byte and there are not two byte nhc
>>>>>> ids values specified yet, we let the nhc layer only handle 1 byte values.
>>>>>> If there is the need for 2 byte nhc values we can add support for it.
>>>>>>
>>>>>> - Alex
>>>>>>
>>>>>> Alexander Aring (3):
>>>>>> net: 6lowpan: remove const from scalars
>>>>>> net: 6lowpan: use array for find nhc id
>>>>>> net: 6lowpan: constify lowpan_nhc structures
>>>>>
>>>>> Marcel, Luiz, are you still picking up generic 6lowpan patches or only
>>>>> the ones for bluetooth?
>>>>>
>>>>> These three have been around for over a month and acked by me and Jukka,
>>>>> but I can't find them anywhere in bluetooth-next or Linus tree.
>>>>>
>>>>> If 6lowpan is of less concern for you I can route them through my
>>>>> ieee80254 tree as well.
>>>>
>>>> Up to you, I was not aware they normally were merged thru
>>>> bluetooth-next but I would be fine merging those as well.
>>>
>>> If you and Marcel don't mind I would like to switch this over to being
>>> merged through ieee802154. Mostly because 6lowpan is vital for the 15.4
>>> work we have.
>>>
>>> With Jukka stepping down from co-maintaining this part (thanks a lot for
>>> your work!) this will most likely be reviewed by Alex and me anyway.
>>>
>>> We still need to ensure that patches are hitting wpan as well as
>>> bluetooth mailing list, but the MAINTAINERS file handles this already.
>>>
>>> Let me know if you are unhappy with the switch. If not I will start with
>>> merging these three as well as the MAINTAINERS update from Jukka.
>>
>> I have no problem with that.
> 
> go for it. Lets just keep the mailing list in MAINTAINERS file so we are aware of patches in this area.

Yup, that's the plan. Taking the pending patch in now.

regards
Stefan Schmidt

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

* Re: [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id
  2022-04-28  3:05 [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Alexander Aring
                   ` (3 preceding siblings ...)
  2022-06-01 20:28 ` [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Stefan Schmidt
@ 2022-06-02 17:41 ` Stefan Schmidt
  4 siblings, 0 replies; 18+ messages in thread
From: Stefan Schmidt @ 2022-06-02 17:41 UTC (permalink / raw)
  To: Alexander Aring, jukka.rissanen; +Cc: linux-bluetooth, linux-wpan, torvalds

Hello.

On 28.04.22 05:05, Alexander Aring wrote:
> Hi,
> 
> this patch series removes the rb data structure for looking up a nhc by
> nhc id. Instead we using the existing nexthdr lookup array by iterating
> over it and find the right nhc by nhc id. It's simply not worth it to
> use such complex handling for such small amount of nhc. As we only
> support nhc ids which fits into 1 byte and there are not two byte nhc
> ids values specified yet, we let the nhc layer only handle 1 byte values.
> If there is the need for 2 byte nhc values we can add support for it.
> 
> - Alex
> 
> Alexander Aring (3):
>    net: 6lowpan: remove const from scalars
>    net: 6lowpan: use array for find nhc id
>    net: 6lowpan: constify lowpan_nhc structures
These patches have been applied to the wpan-next tree and will be
part of the next pull request to net-next. Thanks!

regards
Stefan Schmidt

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

end of thread, other threads:[~2022-06-02 17:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28  3:05 [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Alexander Aring
2022-04-28  3:05 ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Alexander Aring
2022-04-28  3:47   ` net: 6lowpan: simplify lookup by nhc id bluez.test.bot
2022-05-02 19:36   ` [PATCH bluetooth-next 1/3] net: 6lowpan: remove const from scalars Stefan Schmidt
2022-05-03  7:31   ` Jukka Rissanen
2022-04-28  3:05 ` [PATCH bluetooth-next 2/3] net: 6lowpan: use array for find nhc id Alexander Aring
2022-05-02 19:37   ` Stefan Schmidt
2022-05-03  7:32   ` Jukka Rissanen
2022-04-28  3:05 ` [PATCH bluetooth-next 3/3] net: 6lowpan: constify lowpan_nhc structures Alexander Aring
2022-05-02 19:37   ` Stefan Schmidt
2022-05-03  7:32   ` Jukka Rissanen
2022-06-01 20:28 ` [PATCH bluetooth-next 0/3] net: 6lowpan: simplify lookup by nhc id Stefan Schmidt
2022-06-01 21:48   ` Luiz Augusto von Dentz
2022-06-01 21:56     ` Stefan Schmidt
2022-06-01 21:58       ` Luiz Augusto von Dentz
2022-06-02 15:27         ` Marcel Holtmann
2022-06-02 17:38           ` Stefan Schmidt
2022-06-02 17:41 ` Stefan Schmidt

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