Skip to contentSkip to conversation

6lowpan: introduce generic 6lowpan private data

RFC In review Alexander Aring 4 participants 10 messages Jul 31, 2015 – Aug 4, 2015

Subsystems (5)
lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

v2 cover 6lowpan: introduce generic 6lowpan private data

Hi,

I already thought many times to introduce something like that. Here is a draft for introducing the generic 6lowpan private data into each lowpan interface. For the beginning I introduced the enum "ll_type" which contains the LL type of a lowpan interface.

Use cases for such feature (LL types):

- If we do in upper layers (6LoWPAN/IPv6) a evaluation of dev->type then the value is on all lowpan interfaces "APRHRD_6LOWPAN". If we checked on "dev->type" and it's ARPHRD_6LOWPAN we can safe use lowpan_priv to get 6LoWPAN generic private data. With this data we can check the LL type which can be currently BTLE or IEEE802154. This could be useful to make different handling in iphc compress/decompress and evaluating LL private data of skb control block "skb->cb".

Example (802.15.4 has different address handling functionality):

switch (lowpan_priv(dev)->ll_type) {
case LOWPAN_LL_TYPE_BTLE:

        /* do EUI64 btle handling */
        break;
   case LOWPAN_LL_TYPE_IEEE802154:
        /* do complicated short/extended address handling */
        /* we can surely call skb->cb to some other private data from LL
           which was set before iphc compress/decompress function call */
        break;

}

The handling is currently for 802.15.4 is in generic 6lowpan code currently not quite. This should be handled by private data. At the moment btle use the same handling like for 802.15.4 extended address. Nevertheless is we can cleanup some handling then in generic iphc functionality.

This also possible in layers like IPv6, just doing a check on APRHRD_6LOWPAN before calling lowpan_priv(dev)->ll_type, then we are sure that the private data of the interface is a 6LoWPAN interface and we can cast it to lowpan_priv. Then we can do 6LoWPAN generic stuff OR 6lowpan specific LL stuff.

- In Lukasz Duda RFC for introducing stateful address compression, I saw some behaviour which such functionality is also useful. Currently we don't have a allocated space for a 6LoWPAN generic space which is assigned to a lowpan interface. When LL layers (BTLE, IEEE802154) calls iphc compress/decompress Lukasz had no change to access some room which is needed for storing the context information into a table. The workaround for this feature was to add allocate a static data room for the table and doing a lookup/match of netdev name. Which a generic 6lowpan private data room per each lowpan interface we can put this table according to the netdev private room, which means in short: no lookup is needed anymore, just dereferencing lowpan_priv.

In upper layer like IPv6 Lukasz could use that to get the stateful context table information as an example for doing 6LoWPAN generic stuff in upper layers.

Note about the implementation for LL 6LoWPAN private pointer:

I stole some mechanism from wireless for that. See [0], the vif struct is part of sdata which is also part of private data of a wireless interface (mac80211). I hope I can just adapt this behaviour.

- Alex

[0] http://lxr.free-electrons.com/source/include/net/mac80211.h#L1366

changes since v2:
- rename L2/l2 to LL/ll. I think the usually word in ietf for L2 is LL which means "link layer". Also ipv6 stack use ll for variables like lladdr -> link layer address.
- rebase to current bluetooth-next/master
- remove some brackets in function lowpan_priv.

Alexander Aring (2):
bluetooth: 6lowpan: change netdev_priv to lowpan_dev 6lowpan: add generic 6lowpan netdev private data

 include/net/6lowpan.h              | 18 ++++++++++++++++++
 net/bluetooth/6lowpan.c            |  9 ++++++---
 net/ieee802154/6lowpan/6lowpan_i.h |  3 ++-
 net/ieee802154/6lowpan/core.c      |  5 ++++-
 4 files changed, 30 insertions(+), 5 deletions(-)
Signature · 1 line
2.5.0
author maintainer
#1 lore raw

RFC v2 1/2 bluetooth: 6lowpan: change netdev_priv to lowpan_dev

The usually way to get the btle lowpan private data is to use the introduced lowpan_dev inline function. This patch will cleanup by using lowpan_dev consequently.

---
 net/bluetooth/6lowpan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/6lowpan.c +1 -1
index 0ffe2e2..24ed5b0 100644
@@ -859,7 +859,7 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev)
 	SET_NETDEV_DEV(netdev, &chan->conn->hcon->hdev->dev);
 	SET_NETDEV_DEVTYPE(netdev, &bt_type);
 
-	*dev = netdev_priv(netdev);
+	*dev = lowpan_dev(netdev);
 	(*dev)->netdev = netdev;
 	(*dev)->hdev = chan->conn->hcon->hdev;
 	INIT_LIST_HEAD(&(*dev)->peers);
Signature · 1 line
2.5.0
author maintainer
#3 lore raw

RFC v2 2/2 6lowpan: add generic 6lowpan netdev private data

In reply to Alexander Aring

This patch introduced the 6lowpan netdev private data struct. We name it lowpan_priv and it's placed at the beginning of netdev private data. All lowpan interfaces should allocate this room at first of netdev private data. 6LoWPAN LL private data can be allocate by additional netdev private data, e.g. dev->priv_size should be "sizeof(struct lowpan_priv) + sizeof(LL_LOWPAN_PRIVATE_DATA)".

---
 include/net/6lowpan.h              | 18 ++++++++++++++++++
 net/bluetooth/6lowpan.c            |  7 +++++--
 net/ieee802154/6lowpan/6lowpan_i.h |  3 ++-
 net/ieee802154/6lowpan/core.c      |  5 ++++-
 4 files changed, 29 insertions(+), 4 deletions(-)
include/net/6lowpan.h +18 -0
index dc03d77..a955be2 100644
@@ -197,6 +197,24 @@
 #define LOWPAN_NHC_UDP_CS_P_11	0xF3 /* source & dest = 0xF0B + 4bit inline */
 #define LOWPAN_NHC_UDP_CS_C	0x04 /* checksum elided */
 
+enum lowpan_ll_types {
+	LOWPAN_LL_TYPE_BTLE,
+	LOWPAN_LL_TYPE_IEEE802154,
+};
+
+struct lowpan_priv {
+	enum lowpan_ll_types ll_type;
+
+	/* must be last */
+	u8 priv[0] __aligned(sizeof(void *));
+};
+
+static inline
+struct lowpan_priv *lowpan_priv(const struct net_device *dev)
+{
+	return netdev_priv(dev);
+}
+
 #ifdef DEBUG
 /* print data in line */
 static inline void raw_dump_inline(const char *caller, char *msg,
net/bluetooth/6lowpan.c +5 -2
index 24ed5b0..eb61121 100644
@@ -85,7 +85,7 @@ struct lowpan_dev {
 
 static inline struct lowpan_dev *lowpan_dev(const struct net_device *netdev)
 {
-	return netdev_priv(netdev);
+	return (struct lowpan_dev *)lowpan_priv(netdev)->priv;
 }
 
 static inline void peer_add(struct lowpan_dev *dev, struct lowpan_peer *peer)
@@ -848,7 +848,8 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev)
 	struct net_device *netdev;
 	int err = 0;
 
-	netdev = alloc_netdev(sizeof(struct lowpan_dev), IFACE_NAME_TEMPLATE,
+	netdev = alloc_netdev(sizeof(struct lowpan_priv) +
+			      sizeof(struct lowpan_dev), IFACE_NAME_TEMPLATE,
 			      NET_NAME_UNKNOWN, netdev_setup);
 	if (!netdev)
 		return -ENOMEM;
@@ -869,6 +870,8 @@ 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_priv(netdev)->ll_type = LOWPAN_LL_TYPE_BTLE;
+
 	err = register_netdev(netdev);
 	if (err < 0) {
 		BT_INFO("register_netdev failed %d", err);
net/ieee802154/6lowpan/6lowpan_i.h +2 -1
index e50f69d..0dd4e46 100644
@@ -5,6 +5,7 @@
 
 #include <net/ieee802154_netdev.h>
 #include <net/inet_frag.h>
+#include <net/6lowpan.h>
 
 struct lowpan_create_arg {
 	u16 tag;
@@ -52,7 +53,7 @@ struct lowpan_dev_info {
 static inline struct
 lowpan_dev_info *lowpan_dev_info(const struct net_device *dev)
 {
-	return netdev_priv(dev);
+	return (struct lowpan_dev_info *)lowpan_priv(dev)->priv;
 }
 
 extern struct list_head lowpan_devices;
net/ieee802154/6lowpan/core.c +4 -1
index f20a387..ede602c 100644
@@ -153,6 +153,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
 	list_add_tail(&entry->list, &lowpan_devices);
 	mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx);
 
+	lowpan_priv(dev)->ll_type = LOWPAN_LL_TYPE_IEEE802154;
+
 	ret = register_netdevice(dev);
 	if (ret >= 0) {
 		if (!lowpan_open_count)
@@ -193,7 +195,8 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head)
 
 static struct rtnl_link_ops lowpan_link_ops __read_mostly = {
 	.kind		= "lowpan",
-	.priv_size	= sizeof(struct lowpan_dev_info),
+	.priv_size	= sizeof(struct lowpan_priv) +
+			  sizeof(struct lowpan_dev_info),
 	.setup		= lowpan_setup,
 	.newlink	= lowpan_newlink,
 	.dellink	= lowpan_dellink,
Signature · 1 line
2.5.0
#5 lore raw

iphc, rfc6553/6554 and 6lo ESC discussion

In reply to Alexander Aring

{trimmed CC list}

Quoted 3 lines · Alexander Aring

check the LL type which can be currently BTLE or IEEE802154. This could be useful to make different handling in iphc compress/decompress and evaluating LL private data of skb control block "skb->cb".

Speaking of iphc compression, the IETF 6lo WG is currently looking at ways to expand the available HC and NHC space. This is mostly so that the ROLL WG (which I co-chair) can then define a way to compress the RH3 and RPI headers (and the IPIP header required to insert those).

It would be great to have more people writing code in this discussion. If you need more pointers to the discussion, or even if you want to have a G+/Jitsi/etc. meeting to understand the *why* of the discussion, let me know.

Quoted 5 lines

The handling is currently for 802.15.4 is in generic 6lowpan code
currently not quite. This should be handled by private data. At the moment btle use the same handling like for 802.15.4 extended address. Nevertheless is we can cleanup some handling then in generic iphc functionality.

Something to think about is there are networks which are not 15.4... Including NFC, DECT/ULE, BACnet, and G.9959 (which uses 8-bit short-addresses).

My gut is that DECT/ULE is going to take over :-)

Quoted 11 lines

- In Lukasz Duda RFC for introducing stateful address compression, I
saw some behaviour which such functionality is also useful. Currently we don't have a allocated space for a 6LoWPAN generic space which is assigned to a lowpan interface. When LL layers (BTLE, IEEE802154) calls iphc compress/decompress Lukasz had no change to access some room which is needed for storing the context information into a table. The workaround for this feature was to add allocate a static data room for the table and doing a lookup/match of netdev name. Which a generic 6lowpan private data room per each lowpan interface we can put this table according to the netdev private room, which means in short: no lookup is needed anymore, just dereferencing lowpan_priv.

yeah!

Acked-by on the v2 series
#7 lore raw
In reply to Alexander Aring

Hi Alex,

Quoted 6 lines · Alexander Aring

Hi,

I already thought many times to introduce something like that. Here is a draft for introducing the generic 6lowpan private data into each lowpan interface. For the beginning I introduced the enum "ll_type" which contains the LL type of a lowpan interface.

BTW, did you document the description below somewhere, it looks very useful.

Quoted 70 lines

Use cases for such feature (LL types):

- If we do in upper layers (6LoWPAN/IPv6) a evaluation of dev->type then the value is on all lowpan interfaces "APRHRD_6LOWPAN". If we checked on "dev->type" and it's ARPHRD_6LOWPAN we can safe use lowpan_priv to get 6LoWPAN generic private data. With this data we can check the LL type which can be currently BTLE or IEEE802154. This could be useful to make different handling in iphc compress/decompress and evaluating LL private data of skb control block "skb->cb".

Example (802.15.4 has different address handling functionality):

switch (lowpan_priv(dev)->ll_type) {
case LOWPAN_LL_TYPE_BTLE:

        /* do EUI64 btle handling */
        break;
   case LOWPAN_LL_TYPE_IEEE802154:
        /* do complicated short/extended address handling */
        /* we can surely call skb->cb to some other private data from LL
           which was set before iphc compress/decompress function call */
        break;

}

The handling is currently for 802.15.4 is in generic 6lowpan code currently not quite. This should be handled by private data. At the moment btle use the same handling like for 802.15.4 extended address. Nevertheless is we can cleanup some handling then in generic iphc functionality.

This also possible in layers like IPv6, just doing a check on APRHRD_6LOWPAN before calling lowpan_priv(dev)->ll_type, then we are sure that the private data of the interface is a 6LoWPAN interface and we can cast it to lowpan_priv. Then we can do 6LoWPAN generic stuff OR 6lowpan specific LL stuff.

- In Lukasz Duda RFC for introducing stateful address compression, I saw some behaviour which such functionality is also useful. Currently we don't have a allocated space for a 6LoWPAN generic space which is assigned to a lowpan interface. When LL layers (BTLE, IEEE802154) calls iphc compress/decompress Lukasz had no change to access some room which is needed for storing the context information into a table. The workaround for this feature was to add allocate a static data room for the table and doing a lookup/match of netdev name. Which a generic 6lowpan private data room per each lowpan interface we can put this table according to the netdev private room, which means in short: no lookup is needed anymore, just dereferencing lowpan_priv.

In upper layer like IPv6 Lukasz could use that to get the stateful context table information as an example for doing 6LoWPAN generic stuff in upper layers.

Note about the implementation for LL 6LoWPAN private pointer:

I stole some mechanism from wireless for that. See [0], the vif struct is part of sdata which is also part of private data of a wireless interface (mac80211). I hope I can just adapt this behaviour.

- Alex

[0] http://lxr.free-electrons.com/source/include/net/mac80211.h#L1366

changes since v2:
- rename L2/l2 to LL/ll. I think the usually word in ietf for L2 is LL which means "link layer". Also ipv6 stack use ll for variables like lladdr -> link layer address.
- rebase to current bluetooth-next/master
- remove some brackets in function lowpan_priv.

Alexander Aring (2):
bluetooth: 6lowpan: change netdev_priv to lowpan_dev 6lowpan: add generic 6lowpan netdev private data

Quoted 6 lines
 include/net/6lowpan.h              | 18 ++++++++++++++++++
 net/bluetooth/6lowpan.c            |  9 ++++++---
 net/ieee802154/6lowpan/6lowpan_i.h |  3 ++-
 net/ieee802154/6lowpan/core.c      |  5 ++++-
 4 files changed, 30 insertions(+), 5 deletions(-)

Cheers,
Jukka

author maintainer
#6 lore raw

Re: iphc, rfc6553/6554 and 6lo ESC discussion

In reply to Michael Richardson

Hi,

sorry, I saw this mail right now.

Quoted 8 lines · Michael Richardson

{trimmed CC list}

Quoted 3 lines · Alexander Aring

check the LL type which can be currently BTLE or IEEE802154. This could be useful to make different handling in iphc compress/decompress and evaluating LL private data of skb control block "skb->cb".

Quoted 9 lines

Speaking of iphc compression, the IETF 6lo WG is currently looking at ways to expand the available HC and NHC space. This is mostly so that the ROLL WG (which I co-chair) can then define a way to compress the RH3 and RPI headers (and the IPIP header required to insert those).

It would be great to have more people writing code in this discussion. If you need more pointers to the discussion, or even if you want to have a G+/Jitsi/etc. meeting to understand the *why* of the discussion, let me know.

I never did some discussion with the IETF people. Mainly I work at most with rfc6282 and rfc4944 and I have no idea how people at IETF working. For me, I would like to understand the "*why*", also there is some acronyms here which I don't know. I know what you mean with "HC" and "NHC" only.

For adding new compression methods in 6LoWPAN, if they will be used in more than one 6LoWPAN linklayer which is supported then it's some candidate for "net/6lowpan" branch. Read below.

Quoted 10 lines
Quoted 5 lines

The handling is currently for 802.15.4 is in generic 6lowpan code
currently not quite. This should be handled by private data. At the moment btle use the same handling like for 802.15.4 extended address. Nevertheless is we can cleanup some handling then in generic iphc functionality.

Something to think about is there are networks which are not 15.4... Including NFC, DECT/ULE, BACnet, and G.9959 (which uses 8-bit short-addresses).

That's fine, my intention with this patch is to make the 6lowpan generic branch not specify to any linklayer. Currently that is not true because we have some addr_type parameters at iphc compress/decompress functions. These values comming from the 802.15.4 subsystem.

With a lltype we can introduce some switch case mechanism while iphc function calling and evaluate _linklayer_ private data and in this switch-case (like address compress/decompression) we can do different things for each linklayer.

Also it is possible to access private data per (skb - the skb is the network buffer which goes to each layer, this has some control block array, which linklayer 6lowpan code can put data into it before calling iphc functionality.)

looks like (don't to this real, I did not add some array size checks):

memcpy(my_link_layer_data, skb->cb, sizeof(*my_link_layer_data));

iphc_decompress(skb, skb->dev, .....);

inside of iphc_decompress we can do now:

switch (lowpan_priv(dev)->lltype)
case LOWPAN_LLTYPE_IEEE802154:

	my_link_layer_data_802154 = skb->cb;
	/* do complicated 802.15.4 short/extended handling */
	break;
case LOWPAN_LLTYPE_BTLE:
	my_link_layer_data_btle = skb->cb;
	/* do BTLE address handling */
	break;
case LOWPAN_LLTYPE_DECT:
	my_link_layer_data_dect = skb->cb;
	/* do BTLE address handling */
	break;
case LOWPAN_LLTYPE_FOOBAR:
	my_link_layer_data_foobar = skb->cb;
	/* do BTLE address handling */
	break;

....
}

so the goal is to get rid out the linklayer specific code out of net/6lowpan.

The goal of "net/6lowpan" was to implement compression methods which are described in two or more 6LoWPAN rfc's. This is actually iphc compression which is described in BTLE/802.15.4.

When there comming more compression methods we need to figure out, if it's only belong to one 6LoWPAN rfc, then it's not for "net/6lowpan".

With the lltype in 6lowpan we can do at some places different handling in the compression methods of "net/6lowpan" at some places.

Additional we can in "IPv6" casting to lowpan_priv, which contains some data from the "net/6lowpan" branch like IPHC CID table. But also possible is to make some 6lowpan linklayer different handling inside of IPv6.

Quoted 2 lines

My gut is that DECT/ULE is going to take over :-)

mhhh, ok. Good to know. :-/

I already know many people which hopes/thinks that 802.15.4 will die in the next years. Is some good motivation for me. :-)

- Alex

author maintainer
#8 lore raw
In reply to Jukka Rissanen
Quoted 10 lines · Jukka Rissanen

Hi Alex,

Quoted 6 lines · Alexander Aring

Hi,

I already thought many times to introduce something like that. Here is a draft for introducing the generic 6lowpan private data into each lowpan interface. For the beginning I introduced the enum "ll_type" which contains the LL type of a lowpan interface.

Quoted 6 lines

BTW, did you document the description below somewhere, it looks very useful.

no, maybe we can create a "Documentation/networking/6lowpan.txt" for this?

- Alex

#9 lore raw
Quoted 14 lines · Alexander Aring
Quoted 13 lines · Jukka Rissanen

Hi Alex,

Quoted 6 lines · Alexander Aring

Hi,

I already thought many times to introduce something like that. Here is a draft for introducing the generic 6lowpan private data into each lowpan interface. For the beginning I introduced the enum "ll_type" which contains the LL type of a lowpan interface.

Quoted 6 lines
Quoted 3 lines

BTW, did you document the description below somewhere, it looks very useful.

no, maybe we can create a "Documentation/networking/6lowpan.txt" for this?

You read my mind, I was thinking exactly that :)

Cheers,
Jukka

Reviewed-by on v2 1/2
#2 lore raw

Re: [RFCv2 bluetooth-next 1/2] bluetooth: 6lowpan: change netdev_priv to lowpan_dev

In reply to Alexander Aring

Hello.

Quoted 14 lines · Alexander Aring

The usually way to get the btle lowpan private data is to use the introduced lowpan_dev inline function. This patch will cleanup by using lowpan_dev consequently.

---
  net/bluetooth/6lowpan.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/6lowpan.c +0 -0
index 0ffe2e2..24ed5b0 100644

net/bluetooth/6lowpan.c static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev) · line 865

Quoted 8 lines
net/bluetooth/6lowpan.c +1 -1
@@ -859,7 +859,7 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev)
  	SET_NETDEV_DEV(netdev, &chan->conn->hcon->hdev->dev);
  	SET_NETDEV_DEVTYPE(netdev, &bt_type);
 
-	*dev = netdev_priv(netdev);
+	*dev = lowpan_dev(netdev);
  	(*dev)->netdev = netdev;
  	(*dev)->hdev = chan->conn->hcon->hdev;
  	INIT_LIST_HEAD(&(*dev)->peers);

regards
Stefan Schmidt

Reviewed-by on v2 2/2
#4 lore raw

Re: [RFCv2 bluetooth-next 2/2] 6lowpan: add generic 6lowpan netdev private data

In reply to Alexander Aring

Hello.

Quoted 111 lines · Alexander Aring

This patch introduced the 6lowpan netdev private data struct. We name it lowpan_priv and it's placed at the beginning of netdev private data. All lowpan interfaces should allocate this room at first of netdev private data. 6LoWPAN LL private data can be allocate by additional netdev private data, e.g. dev->priv_size should be "sizeof(struct lowpan_priv) + sizeof(LL_LOWPAN_PRIVATE_DATA)".

---
  include/net/6lowpan.h              | 18 ++++++++++++++++++
  net/bluetooth/6lowpan.c            |  7 +++++--
  net/ieee802154/6lowpan/6lowpan_i.h |  3 ++-
  net/ieee802154/6lowpan/core.c      |  5 ++++-
  4 files changed, 29 insertions(+), 4 deletions(-)
include/net/6lowpan.h +18 -0
index dc03d77..a955be2 100644
@@ -197,6 +197,24 @@
  #define LOWPAN_NHC_UDP_CS_P_11	0xF3 /* source & dest = 0xF0B + 4bit inline */
  #define LOWPAN_NHC_UDP_CS_C	0x04 /* checksum elided */
 
+enum lowpan_ll_types {
+	LOWPAN_LL_TYPE_BTLE,
+	LOWPAN_LL_TYPE_IEEE802154,
+};
+
+struct lowpan_priv {
+	enum lowpan_ll_types ll_type;
+
+	/* must be last */
+	u8 priv[0] __aligned(sizeof(void *));
+};
+
+static inline
+struct lowpan_priv *lowpan_priv(const struct net_device *dev)
+{
+	return netdev_priv(dev);
+}
+
  #ifdef DEBUG
  /* print data in line */
  static inline void raw_dump_inline(const char *caller, char *msg,
net/bluetooth/6lowpan.c +5 -2
index 24ed5b0..eb61121 100644
@@ -85,7 +85,7 @@ struct lowpan_dev {
 
  static inline struct lowpan_dev *lowpan_dev(const struct net_device *netdev)
  {
-	return netdev_priv(netdev);
+	return (struct lowpan_dev *)lowpan_priv(netdev)->priv;
  }
 
  static inline void peer_add(struct lowpan_dev *dev, struct lowpan_peer *peer)
@@ -848,7 +848,8 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev)
  	struct net_device *netdev;
  	int err = 0;
 
-	netdev = alloc_netdev(sizeof(struct lowpan_dev), IFACE_NAME_TEMPLATE,
+	netdev = alloc_netdev(sizeof(struct lowpan_priv) +
+			      sizeof(struct lowpan_dev), IFACE_NAME_TEMPLATE,
  			      NET_NAME_UNKNOWN, netdev_setup);
  	if (!netdev)
  		return -ENOMEM;
@@ -869,6 +870,8 @@ 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_priv(netdev)->ll_type = LOWPAN_LL_TYPE_BTLE;
+
  	err = register_netdev(netdev);
  	if (err < 0) {
  		BT_INFO("register_netdev failed %d", err);
net/ieee802154/6lowpan/6lowpan_i.h +2 -1
index e50f69d..0dd4e46 100644
@@ -5,6 +5,7 @@
 
  #include <net/ieee802154_netdev.h>
  #include <net/inet_frag.h>
+#include <net/6lowpan.h>
 
  struct lowpan_create_arg {
  	u16 tag;
@@ -52,7 +53,7 @@ struct lowpan_dev_info {
  static inline struct
  lowpan_dev_info *lowpan_dev_info(const struct net_device *dev)
  {
-	return netdev_priv(dev);
+	return (struct lowpan_dev_info *)lowpan_priv(dev)->priv;
  }
 
  extern struct list_head lowpan_devices;
net/ieee802154/6lowpan/core.c +2 -0
index f20a387..ede602c 100644
@@ -153,6 +153,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
  	list_add_tail(&entry->list, &lowpan_devices);
  	mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx);
 
+	lowpan_priv(dev)->ll_type = LOWPAN_LL_TYPE_IEEE802154;
+
  	ret = register_netdevice(dev);
  	if (ret >= 0) {
  		if (!lowpan_open_count)

net/ieee802154/6lowpan/core.c static void lowpan_dellink(struct net_device *dev, struct list_head *head) · line 202

Quoted 9 lines
net/ieee802154/6lowpan/core.c +2 -1
@@ -193,7 +195,8 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head)
 
  static struct rtnl_link_ops lowpan_link_ops __read_mostly = {
  	.kind		= "lowpan",
-	.priv_size	= sizeof(struct lowpan_dev_info),
+	.priv_size	= sizeof(struct lowpan_priv) +
+			  sizeof(struct lowpan_dev_info),
  	.setup		= lowpan_setup,
  	.newlink	= lowpan_newlink,
  	.dellink	= lowpan_dellink,

regards
Stefan Schmidt