Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
* [PATCHv2 bluetooth-next 1/6] ieee802154 socket: Return EMSGSIZE from raw_sendmsg() if packet too big.
       [not found] <cover.1432535597.git.buytenh@wantstofly.org>
@ 2015-05-25 12:38 ` Lennert Buytenhek
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 2/6] Documentation/networking/ieee802154.txt: fix various inaccuracies Lennert Buytenhek
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Lennert Buytenhek @ 2015-05-25 12:38 UTC (permalink / raw)
  To: linux-wpan

The proper return code for trying to send a packet that exceeds the
outgoing interface's MTU is EMSGSIZE, not EINVAL, so patch ieee802154's
raw_sendmsg() to do the right thing.  (Its dgram_sendmsg() was already
returning EMSGSIZE for this case.)

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Alexander Aring <alex.aring@gmail.com>
---
 net/ieee802154/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
index e5cc253..d9fc5cc 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -284,7 +284,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 
 	if (size > mtu) {
 		pr_debug("size = %Zu, mtu = %u\n", size, mtu);
-		err = -EINVAL;
+		err = -EMSGSIZE;
 		goto out_dev;
 	}
 
-- 
2.1.0


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

* [PATCHv2 bluetooth-next 2/6] Documentation/networking/ieee802154.txt: fix various inaccuracies.
       [not found] <cover.1432535597.git.buytenh@wantstofly.org>
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 1/6] ieee802154 socket: Return EMSGSIZE from raw_sendmsg() if packet too big Lennert Buytenhek
@ 2015-05-25 12:38 ` Lennert Buytenhek
  2015-05-26 18:17   ` Alexander Aring
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 3/6] ieee802154: Remove ieee802154_reduced_mlme_ops references Lennert Buytenhek
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Lennert Buytenhek @ 2015-05-25 12:38 UTC (permalink / raw)
  To: linux-wpan

* Update the linux-zigbee git:// repository URL.

* Remove the MLME section as the current kernel does not provide a
  full 802.15.4 MLME implementation.

* The hardmac example driver 'fakehard' was removed some time ago.

* The IEEE 802.15.4 device drivers live in drivers/net/ieee802154/,
  not in drivers/ieee802154/.

* The IEEE 802.15.4 MTU is 127 bytes, not 128 bytes.

* Some of the 6LoWPAN code lives in net/6lowpan/.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
---
 Documentation/networking/ieee802154.txt | 32 +++++++++++---------------------
 1 file changed, 11 insertions(+), 21 deletions(-)

diff --git a/Documentation/networking/ieee802154.txt b/Documentation/networking/ieee802154.txt
index 22bbc72..1700756 100644
--- a/Documentation/networking/ieee802154.txt
+++ b/Documentation/networking/ieee802154.txt
@@ -30,8 +30,8 @@ int sd = socket(PF_IEEE802154, SOCK_DGRAM, 0);
 
 The address family, socket addresses etc. are defined in the
 include/net/af_ieee802154.h header or in the special header
-in our userspace package (see either linux-zigbee sourceforge download page
-or git tree at git://linux-zigbee.git.sourceforge.net/gitroot/linux-zigbee).
+in the userspace package (see either http://wpan.cakelab.org/ or the
+git tree at https://github.com/linux-wpan/wpan-tools).
 
 One can use SOCK_RAW for passing raw data towards device xmit function. YMMV.
 
@@ -49,15 +49,6 @@ Like with WiFi, there are several types of devices implementing IEEE 802.15.4.
 Those types of devices require different approach to be hooked into Linux kernel.
 
 
-MLME - MAC Level Management
-============================
-
-Most of IEEE 802.15.4 MLME interfaces are directly mapped on netlink commands.
-See the include/net/nl802154.h header. Our userspace tools package
-(see above) provides CLI configuration utility for radio interfaces and simple
-coordinator for IEEE 802.15.4 networks as an example users of MLME protocol.
-
-
 HardMAC
 =======
 
@@ -75,8 +66,6 @@ net_device with a pointer to struct ieee802154_mlme_ops instance. The fields
 assoc_req, assoc_resp, disassoc_req, start_req, and scan_req are optional.
 All other fields are required.
 
-We provide an example of simple HardMAC driver at drivers/ieee802154/fakehard.c
-
 
 SoftMAC
 =======
@@ -89,7 +78,8 @@ stack interface for network sniffers (e.g. WireShark).
 
 This layer is going to be extended soon.
 
-See header include/net/mac802154.h and several drivers in drivers/ieee802154/.
+See header include/net/mac802154.h and several drivers in
+drivers/net/ieee802154/.
 
 
 Device drivers API
@@ -114,18 +104,17 @@ Moreover IEEE 802.15.4 device operations structure should be filled.
 Fake drivers
 ============
 
-In addition there are two drivers available which simulate real devices with
-HardMAC (fakehard) and SoftMAC (fakelb - IEEE 802.15.4 loopback driver)
-interfaces. This option provides possibility to test and debug stack without
-usage of real hardware.
+In addition there is a driver available which simulates a real device with
+SoftMAC (fakelb - IEEE 802.15.4 loopback driver) interface. This option
+provides possibility to test and debug stack without usage of real hardware.
 
-See sources in drivers/ieee802154 folder for more details.
+See sources in drivers/net/ieee802154 folder for more details.
 
 
 6LoWPAN Linux implementation
 ============================
 
-The IEEE 802.15.4 standard specifies an MTU of 128 bytes, yielding about 80
+The IEEE 802.15.4 standard specifies an MTU of 127 bytes, yielding about 80
 octets of actual MAC payload once security is turned on, on a wireless link
 with a link throughput of 250 kbps or less.  The 6LoWPAN adaptation format
 [RFC4944] was specified to carry IPv6 datagrams over such constrained links,
@@ -140,7 +129,8 @@ In Semptember 2011 the standard update was published - [RFC6282].
 It deprecates HC1 and HC2 compression and defines IPHC encoding format which is
 used in this Linux implementation.
 
-All the code related to 6lowpan you may find in files: net/ieee802154/6lowpan.*
+All the code related to 6lowpan you may find in files: net/6lowpan/*
+and net/ieee802154/6lowpan/*
 
 To setup 6lowpan interface you need (busybox release > 1.17.0):
 1. Add IEEE802.15.4 interface and initialize PANid;
-- 
2.1.0


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

* [PATCHv2 bluetooth-next 3/6] ieee802154: Remove ieee802154_reduced_mlme_ops references.
       [not found] <cover.1432535597.git.buytenh@wantstofly.org>
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 1/6] ieee802154 socket: Return EMSGSIZE from raw_sendmsg() if packet too big Lennert Buytenhek
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 2/6] Documentation/networking/ieee802154.txt: fix various inaccuracies Lennert Buytenhek
@ 2015-05-25 12:38 ` Lennert Buytenhek
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 4/6] ieee802154: Remove 802.15.4/6LoWPAN checks for interface MTU Lennert Buytenhek
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Lennert Buytenhek @ 2015-05-25 12:38 UTC (permalink / raw)
  To: linux-wpan

As there doesn't seem to be a definition of it or any users of it.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Alexander Aring <alex.aring@gmail.com>
---
 include/net/ieee802154_netdev.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 84a72a1..0a87975 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -430,10 +430,4 @@ ieee802154_mlme_ops(const struct net_device *dev)
 	return dev->ml_priv;
 }
 
-static inline struct ieee802154_reduced_mlme_ops *
-ieee802154_reduced_mlme_ops(const struct net_device *dev)
-{
-	return dev->ml_priv;
-}
-
 #endif
-- 
2.1.0


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

* [PATCHv2 bluetooth-next 4/6] ieee802154: Remove 802.15.4/6LoWPAN checks for interface MTU.
       [not found] <cover.1432535597.git.buytenh@wantstofly.org>
                   ` (2 preceding siblings ...)
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 3/6] ieee802154: Remove ieee802154_reduced_mlme_ops references Lennert Buytenhek
@ 2015-05-25 12:38 ` Lennert Buytenhek
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 5/6] ieee802154 socket: No need to check for ARPHRD_IEEE802154 in raw_bind() Lennert Buytenhek
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 6/6] mac802154: mac802154_mlme_start_req() optimisation Lennert Buytenhek
  5 siblings, 0 replies; 8+ messages in thread
From: Lennert Buytenhek @ 2015-05-25 12:38 UTC (permalink / raw)
  To: linux-wpan

In the past, 802.15.4 interfaces and 6LoWPAN interfaces used the
same dev->type (ARPHRD_IEEE802154), and 802.15.4 interfaces were
distinguished from 6LoWPAN interfaces by their differing dev->mtu.

6LoWPAN interfaces have their own ARPHRD type now, so there is no
longer any need to check dev->mtu to distinguish 802.15.4 devices
from 6LoWPAN devices.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Alexander Aring <alex.aring@gmail.com>
---
 net/ieee802154/nl-mac.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index ada58a8..3503c38 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -168,10 +168,7 @@ static struct net_device *ieee802154_nl_get_dev(struct genl_info *info)
 	if (!dev)
 		return NULL;
 
-	/* Check on mtu is currently a hacked solution because lowpan
-	 * and wpan have the same ARPHRD type.
-	 */
-	if (dev->type != ARPHRD_IEEE802154 || dev->mtu != IEEE802154_MTU) {
+	if (dev->type != ARPHRD_IEEE802154) {
 		dev_put(dev);
 		return NULL;
 	}
@@ -455,11 +452,7 @@ int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb)
 
 	idx = 0;
 	for_each_netdev(net, dev) {
-		/* Check on mtu is currently a hacked solution because lowpan
-		 * and wpan have the same ARPHRD type.
-		 */
-		if (idx < s_idx || dev->type != ARPHRD_IEEE802154 ||
-		    dev->mtu != IEEE802154_MTU)
+		if (idx < s_idx || dev->type != ARPHRD_IEEE802154)
 			goto cont;
 
 		if (ieee802154_nl_fill_iface(skb, NETLINK_CB(cb->skb).portid,
@@ -789,11 +782,7 @@ ieee802154_llsec_dump_table(struct sk_buff *skb, struct netlink_callback *cb,
 	int rc;
 
 	for_each_netdev(net, dev) {
-		/* Check on mtu is currently a hacked solution because lowpan
-		 * and wpan have the same ARPHRD type.
-		 */
-		if (idx < first_dev || dev->type != ARPHRD_IEEE802154 ||
-		    dev->mtu != IEEE802154_MTU)
+		if (idx < first_dev || dev->type != ARPHRD_IEEE802154)
 			goto skip;
 
 		data.ops = ieee802154_mlme_ops(dev);
-- 
2.1.0


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

* [PATCHv2 bluetooth-next 5/6] ieee802154 socket: No need to check for ARPHRD_IEEE802154 in raw_bind().
       [not found] <cover.1432535597.git.buytenh@wantstofly.org>
                   ` (3 preceding siblings ...)
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 4/6] ieee802154: Remove 802.15.4/6LoWPAN checks for interface MTU Lennert Buytenhek
@ 2015-05-25 12:38 ` Lennert Buytenhek
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 6/6] mac802154: mac802154_mlme_start_req() optimisation Lennert Buytenhek
  5 siblings, 0 replies; 8+ messages in thread
From: Lennert Buytenhek @ 2015-05-25 12:38 UTC (permalink / raw)
  To: linux-wpan

ieee802154_get_dev() only returns devices that have dev->type ==
ARPHRD_IEEE802154, therefore, there is no need to check this again
in raw_bind().

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Alexander Aring <alex.aring@gmail.com>
---
 net/ieee802154/socket.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
index d9fc5cc..02abef2 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -226,15 +226,9 @@ static int raw_bind(struct sock *sk, struct sockaddr *_uaddr, int len)
 		goto out;
 	}
 
-	if (dev->type != ARPHRD_IEEE802154) {
-		err = -ENODEV;
-		goto out_put;
-	}
-
 	sk->sk_bound_dev_if = dev->ifindex;
 	sk_dst_reset(sk);
 
-out_put:
 	dev_put(dev);
 out:
 	release_sock(sk);
-- 
2.1.0


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

* [PATCHv2 bluetooth-next 6/6] mac802154: mac802154_mlme_start_req() optimisation.
       [not found] <cover.1432535597.git.buytenh@wantstofly.org>
                   ` (4 preceding siblings ...)
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 5/6] ieee802154 socket: No need to check for ARPHRD_IEEE802154 in raw_bind() Lennert Buytenhek
@ 2015-05-25 12:38 ` Lennert Buytenhek
  2015-05-26 18:17   ` Alexander Aring
  5 siblings, 1 reply; 8+ messages in thread
From: Lennert Buytenhek @ 2015-05-25 12:38 UTC (permalink / raw)
  To: linux-wpan

mac802154_mlme_start_req() calls
ieee802154_mlme_ops(dev)->llsec->set_params() on the net_device
passed into it, however, this net_device will always be a mac802154
net_device, so just call mac802154_set_params() directly instead.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
---
 net/mac802154/mac_cmd.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index 5220c2b2..8606da4 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -36,8 +36,8 @@ static int mac802154_mlme_start_req(struct net_device *dev,
 				    u8 pan_coord, u8 blx,
 				    u8 coord_realign)
 {
-	struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
-	int rc = 0;
+	struct ieee802154_llsec_params params;
+	int changed = 0;
 
 	ASSERT_RTNL();
 
@@ -47,26 +47,19 @@ static int mac802154_mlme_start_req(struct net_device *dev,
 	dev->ieee802154_ptr->short_addr = addr->short_addr;
 	mac802154_dev_set_page_channel(dev, page, channel);
 
-	if (ops->llsec) {
-		struct ieee802154_llsec_params params;
-		int changed = 0;
+	params.pan_id = addr->pan_id;
+	changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
 
-		params.coord_shortaddr = addr->short_addr;
-		changed |= IEEE802154_LLSEC_PARAM_COORD_SHORTADDR;
+	params.hwaddr = ieee802154_devaddr_from_raw(dev->dev_addr);
+	changed |= IEEE802154_LLSEC_PARAM_HWADDR;
 
-		params.pan_id = addr->pan_id;
-		changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
+	params.coord_hwaddr = params.hwaddr;
+	changed |= IEEE802154_LLSEC_PARAM_COORD_HWADDR;
 
-		params.hwaddr = ieee802154_devaddr_from_raw(dev->dev_addr);
-		changed |= IEEE802154_LLSEC_PARAM_HWADDR;
+	params.coord_shortaddr = addr->short_addr;
+	changed |= IEEE802154_LLSEC_PARAM_COORD_SHORTADDR;
 
-		params.coord_hwaddr = params.hwaddr;
-		changed |= IEEE802154_LLSEC_PARAM_COORD_HWADDR;
-
-		rc = ops->llsec->set_params(dev, &params, changed);
-	}
-
-	return rc;
+	return mac802154_set_params(dev, &params, changed);
 }
 
 static int mac802154_set_mac_params(struct net_device *dev,
-- 
2.1.0


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

* Re: [PATCHv2 bluetooth-next 6/6] mac802154: mac802154_mlme_start_req() optimisation.
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 6/6] mac802154: mac802154_mlme_start_req() optimisation Lennert Buytenhek
@ 2015-05-26 18:17   ` Alexander Aring
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Aring @ 2015-05-26 18:17 UTC (permalink / raw)
  To: Lennert Buytenhek; +Cc: linux-wpan

On Mon, May 25, 2015 at 03:38:51PM +0300, Lennert Buytenhek wrote:
> mac802154_mlme_start_req() calls
> ieee802154_mlme_ops(dev)->llsec->set_params() on the net_device
> passed into it, however, this net_device will always be a mac802154
> net_device, so just call mac802154_set_params() directly instead.
> 
> Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>

Acked-by: Alexander Aring <alex.aring@gmail.com>


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

* Re: [PATCHv2 bluetooth-next 2/6] Documentation/networking/ieee802154.txt: fix various inaccuracies.
  2015-05-25 12:38 ` [PATCHv2 bluetooth-next 2/6] Documentation/networking/ieee802154.txt: fix various inaccuracies Lennert Buytenhek
@ 2015-05-26 18:17   ` Alexander Aring
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Aring @ 2015-05-26 18:17 UTC (permalink / raw)
  To: Lennert Buytenhek; +Cc: linux-wpan

On Mon, May 25, 2015 at 03:38:29PM +0300, Lennert Buytenhek wrote:
> * Update the linux-zigbee git:// repository URL.
> 
> * Remove the MLME section as the current kernel does not provide a
>   full 802.15.4 MLME implementation.
> 
> * The hardmac example driver 'fakehard' was removed some time ago.
> 
> * The IEEE 802.15.4 device drivers live in drivers/net/ieee802154/,
>   not in drivers/ieee802154/.
> 
> * The IEEE 802.15.4 MTU is 127 bytes, not 128 bytes.
> 
> * Some of the 6LoWPAN code lives in net/6lowpan/.
> 
> Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
> Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>

Acked-by: Alexander Aring <alex.aring@gmail.com>


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

end of thread, other threads:[~2015-05-26 18:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1432535597.git.buytenh@wantstofly.org>
2015-05-25 12:38 ` [PATCHv2 bluetooth-next 1/6] ieee802154 socket: Return EMSGSIZE from raw_sendmsg() if packet too big Lennert Buytenhek
2015-05-25 12:38 ` [PATCHv2 bluetooth-next 2/6] Documentation/networking/ieee802154.txt: fix various inaccuracies Lennert Buytenhek
2015-05-26 18:17   ` Alexander Aring
2015-05-25 12:38 ` [PATCHv2 bluetooth-next 3/6] ieee802154: Remove ieee802154_reduced_mlme_ops references Lennert Buytenhek
2015-05-25 12:38 ` [PATCHv2 bluetooth-next 4/6] ieee802154: Remove 802.15.4/6LoWPAN checks for interface MTU Lennert Buytenhek
2015-05-25 12:38 ` [PATCHv2 bluetooth-next 5/6] ieee802154 socket: No need to check for ARPHRD_IEEE802154 in raw_bind() Lennert Buytenhek
2015-05-25 12:38 ` [PATCHv2 bluetooth-next 6/6] mac802154: mac802154_mlme_start_req() optimisation Lennert Buytenhek
2015-05-26 18:17   ` Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox