ieee802154 socket: Return EMSGSIZE from raw_sendmsg() if packet too big.
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/6 ieee802154 socket: Return EMSGSIZE from raw_sendmsg() if packet too big.
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.)
--- net/ieee802154/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ieee802154/socket.c +1 -1
@@ -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; }
Signature · 1 line
2.1.0
PATCH v2 2/6 Documentation/networking/ieee802154.txt: fix various inaccuracies.
In reply to a message not in the archive* 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/.
--- Documentation/networking/ieee802154.txt | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-)
Documentation/networking/ieee802154.txt +11 -21
@@ -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;
Signature · 1 line
2.1.0
Re: [PATCHv2 bluetooth-next 2/6] Documentation/networking/ieee802154.txt: fix various inaccuracies.
Quoted 10 lines · Lennert Buytenhek
* 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 indrivers/ieee802154/.
Quoted 6 lines
* 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 <[email protected]>Reviewed-by Stefan Schmidt <[email protected]>
PATCH v2 3/6 ieee802154: Remove ieee802154_reduced_mlme_ops references.
In reply to a message not in the archiveAs there doesn't seem to be a definition of it or any users of it.
--- include/net/ieee802154_netdev.h | 6 ------ 1 file changed, 6 deletions(-)
include/net/ieee802154_netdev.h +0 -6
@@ -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
Signature · 1 line
2.1.0
PATCH v2 4/6 ieee802154: Remove 802.15.4/6LoWPAN checks for interface MTU.
In reply to a message not in the archiveIn 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.
--- net/ieee802154/nl-mac.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
net/ieee802154/nl-mac.c +3 -14
@@ -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);
Signature · 1 line
2.1.0
PATCH v2 5/6 ieee802154 socket: No need to check for ARPHRD_IEEE802154 in raw_bind().
In reply to a message not in the archiveieee802154_get_dev() only returns devices that have dev->type == ARPHRD_IEEE802154, therefore, there is no need to check this again in raw_bind().
--- net/ieee802154/socket.c | 6 ------ 1 file changed, 6 deletions(-)
net/ieee802154/socket.c +0 -6
@@ -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);
Signature · 1 line
2.1.0
PATCH v2 6/6 mac802154: mac802154_mlme_start_req() optimisation.
In reply to a message not in the archivemac802154_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.
--- net/mac802154/mac_cmd.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
net/mac802154/mac_cmd.c +11 -18
@@ -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, ¶ms, changed); - } - -return rc; +return mac802154_set_params (dev, ¶ms, changed); } static int mac802154_set_mac_params(struct net_device *dev,
Signature · 1 line
2.1.0
Re: [PATCHv2 bluetooth-next 6/6] mac802154: mac802154_mlme_start_req() optimisation.
Quoted 6 lines · Lennert Buytenhek
mac802154_mlme_start_req()calls ieee802154_mlme_ops(dev)->llsec->set_params() on thenet_devicepassed into it, however, thisnet_devicewill always be a mac802154net_device, so just callmac802154_set_params()directly instead.Signed-off-by Lennert Buytenhek <[email protected]>