IEEE 802.15.4 stack: generic parts
Subsystems (7)
Hello,
As generic parts of our IEEE 802.15.4 stack are now more or less stable, we'd like to merge them into mainline Linux kernel. I've prepared a branch on the git.kernel.org that contains changes we'd like to get in at first step. What should we do? Should this be included into linux-next? Should this be submitted directly to Dave Miller?
The following changes since commit 59a3759d0fe8d969888c741bb33f4946e4d3750d:
Linus Torvalds (1):
Linux 2.6.30-rc7
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.git for-next
Darren Salt (1):
crc-itu-t: add bit-reversed calculation
Dmitry Eremin-Solenikov (5):
Add constants for the ieee 802.15.4/ZigBee stack
net: add IEEE 802.15.4 socket family implementation
net: add NL802154 interface for configuration of 802.15.4 devices
ieee802154: add documentation about our stack
ieee802154: add simple HardMAC driver sample
Documentation/networking/ieee802154.txt | 76 +++++ MAINTAINERS | 12 + drivers/Makefile | 1 + drivers/ieee802154/Kconfig | 21 ++ drivers/ieee802154/Makefile | 3 + drivers/ieee802154/fakehard.c | 258 ++++++++++++++++ drivers/net/Kconfig | 2 + include/linux/crc-itu-t.h | 10 + include/linux/if.h | 2 + include/linux/if_arp.h | 2 + include/linux/if_ether.h | 2 + include/linux/socket.h | 6 +- include/net/ieee802154/af_ieee802154.h | 60 ++++ include/net/ieee802154/mac_def.h | 158 ++++++++++ include/net/ieee802154/netdevice.h | 84 ++++++ include/net/ieee802154/nl802154.h | 165 +++++++++++ lib/crc-itu-t.c | 18 ++ net/Kconfig | 1 + net/Makefile | 1 + net/core/dev.c | 6 +- net/core/sock.c | 3 + net/ieee802154/Kconfig | 12 + net/ieee802154/Makefile | 5 + net/ieee802154/af802154.h | 35 +++ net/ieee802154/af_ieee802154.c | 356 +++++++++++++++++++++++ net/ieee802154/dgram.c | 373 ++++++++++++++++++++++++ net/ieee802154/netlink.c | 485 +++++++++++++++++++++++++++++++ net/ieee802154/raw.c | 250 ++++++++++++++++ 28 files changed, 2404 insertions(+), 3 deletions(-) create mode 100644 Documentation/networking/ieee802154.txt create mode 100644 drivers/ieee802154/Kconfig create mode 100644 drivers/ieee802154/Makefile create mode 100644 drivers/ieee802154/fakehard.c create mode 100644 include/net/ieee802154/af_ieee802154.h create mode 100644 include/net/ieee802154/mac_def.h create mode 100644 include/net/ieee802154/netdevice.h create mode 100644 include/net/ieee802154/nl802154.h create mode 100644 net/ieee802154/Kconfig create mode 100644 net/ieee802154/Makefile create mode 100644 net/ieee802154/af802154.h create mode 100644 net/ieee802154/af_ieee802154.c create mode 100644 net/ieee802154/dgram.c create mode 100644 net/ieee802154/netlink.c create mode 100644 net/ieee802154/raw.c
PATCH 1/6 crc-itu-t: add bit-reversed calculation
From: Darren Salt <[email protected]>
--- include/linux/crc-itu-t.h | 10 ++++++++++ lib/crc-itu-t.c | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 0 deletions(-)
include/linux/crc-itu-t.h +10 -0
@@ -6,6 +6,9 @@* Poly 0x0x1021 (x^16 + x^12 + x^15 + 1) * Init 0 * +* The bit-reversed buffer variants may be non-standard, but some firmware +* loaders require them. +* * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */
@@ -14,15 +17,22 @@#define CRC_ITU_T_H #include <linux/types.h> +#include <linux/bitrev.h> extern u16 const crc_itu_t_table[256 ];extern u16 crc_itu_t (u16 crc,const u8 *buffer,size_t len); +extern u16 crc_itu_t_bitreversed (u16 crc,const u8 *buffer,size_t len);static inline u16 crc_itu_t_byte (u16 crc,const u8 data) {return (crc <<8 ) ^ crc_itu_t_table[((crc >>8 ) ^ data) &0xff ]; } +static inline u16 crc_itu_t_bitreversed_byte (u16 crc,const u8 data) +{ +return (crc <<8 ) ^ crc_itu_t_table[((crc >>8 ) ^bitrev8 (data)) &0xff ]; +} +#endif /* CRC_ITU_T_H */
lib/crc-itu-t.c +18 -0
@@ -64,6 +64,24 @@ u16 crc_itu_t(u16 crc, const u8 *buffer, size_t len) }EXPORT_SYMBOL (crc_itu_t); +/** +* crc_itu_t_bitreversed - Compute the CRC-ITU-T for the data buffer; +* the buffer content is assumed to be bit-reversed +* +* @crc: previous CRC value +* @buffer: data pointer +* @len: number of bytes in the buffer +* +* Returns the updated CRC value +*/ +u16 crc_itu_t_bitreversed (u16 crc,const u8 *buffer,size_t len) +{ +while (len--) + crc =crc_itu_t_bitreversed_byte (crc, *buffer++); +return crc; +} +EXPORT_SYMBOL (crc_itu_t_bitreversed); +MODULE_DESCRIPTION ("CRC ITU-T V.41 calculations" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.6.3.1
PATCH 2/6 Add constants for the ieee 802.15.4/ZigBee stack
IEEE 802.15.4/ZigBee stack requires several constants to be defined/adjusted.
--- include/linux/if.h | 2 ++ include/linux/if_arp.h | 2 ++ include/linux/if_ether.h | 2 ++ include/linux/socket.h | 6 +++++- net/core/dev.c | 6 ++++-- net/core/sock.c | 3 +++ 6 files changed, 18 insertions(+), 3 deletions(-)
include/linux/if.h +2 -0
@@ -68,6 +68,8 @@#define IFF_MASTER_ARPMON 0x100/* bonding master, ARP mon in use */ #define IFF_WAN_HDLC 0x200/* WAN HDLC device */ +#define IFF_IEEE802154_COORD 0x100/* IEEE802.15.4 PAN coordinator */ +#define IF_GET_IFACE 0x0001/* for querying only */ #define IF_GET_PROTO 0x0002
include/linux/if_arp.h +2 -0
@@ -86,6 +86,8 @@#define ARPHRD_IEEE80211 801/* IEEE 802.11 */ #define ARPHRD_IEEE80211_PRISM 802/* IEEE 802.11 + Prism2 header */ #define ARPHRD_IEEE80211_RADIOTAP 803/* IEEE 802.11 + radiotap header */ +#define ARPHRD_IEEE802154 804 +#define ARPHRD_IEEE802154_PHY 805#define ARPHRD_PHONET 820/* PhoNet media type */ #define ARPHRD_PHONET_PIPE 821/* PhoNet pipe header */
include/linux/if_ether.h +2 -0
@@ -106,6 +106,8 @@#define ETH_P_DSA 0x001B/* Distributed Switch Arch. */ #define ETH_P_TRAILER 0x001C/* Trailer switch tagging */ #define ETH_P_PHONET 0x00F5/* Nokia Phonet frames */ +#define ETH_P_IEEE802154 0x00F6/* IEEE802.15.4 frame */ +#define ETH_P_IEEE802154_MAC 0x00F7/* IEEE802.15.4 MAC frame */ /* * This is an Ethernet frame header.
include/linux/socket.h +5 -1
@@ -194,7 +194,9 @@ struct ucred {#define AF_RXRPC 33/* RxRPC sockets */ #define AF_ISDN 34/* mISDN sockets */ #define AF_PHONET 35/* Phonet sockets */ -#define AF_MAX 36/* For now.. */ +#define AF_IEEE802154 36/* IEEE802154 sockets */ +#define AF_ZIGBEE 37/* ZIGBEE sockets */ +#define AF_MAX 38/* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC
@@ -233,6 +235,8 @@ struct ucred {#define PF_RXRPC AF_RXRPC#define PF_ISDN AF_ISDN#define PF_PHONET AF_PHONET +#define PF_IEEE802154 AF_IEEE802154 +#define PF_ZIGBEE AF_ZIGBEE#define PF_MAX AF_MAX/* Maximum queue length specifiable by listen. */
net/core/dev.c +4 -2
@@ -268,7 +268,8 @@ static const unsigned short netdev_lock_type[] =ARPHRD_IRDA ,ARPHRD_FCPP ,ARPHRD_FCAL ,ARPHRD_FCPL ,ARPHRD_FCFABRIC ,ARPHRD_IEEE802_TR ,ARPHRD_IEEE80211 ,ARPHRD_IEEE80211_PRISM ,ARPHRD_IEEE80211_RADIOTAP ,ARPHRD_PHONET , - ARPHRD_PHONET_PIPE, ARPHRD_VOID, ARPHRD_NONE}; +ARPHRD_PHONET_PIPE ,ARPHRD_IEEE802154 ,ARPHRD_IEEE802154_PHY , + ARPHRD_VOID, ARPHRD_NONE};static const char *netdev_lock_name[] = {"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25",
@@ -285,7 +286,8 @@ static const char *netdev_lock_name[] ="_xmit_IRDA" ,"_xmit_FCPP" ,"_xmit_FCAL" ,"_xmit_FCPL" ,"_xmit_FCFABRIC" ,"_xmit_IEEE802_TR" ,"_xmit_IEEE80211" ,"_xmit_IEEE80211_PRISM" ,"_xmit_IEEE80211_RADIOTAP" ,"_xmit_PHONET" , - "_xmit_PHONET_PIPE", "_xmit_VOID", "_xmit_NONE"}; +"_xmit_PHONET_PIPE" ,"_xmit_IEEE802154" ,"_xmit_IEEE802154_PHY" , + "_xmit_VOID", "_xmit_NONE"};static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE (netdev_lock_type)];static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE (netdev_lock_type)];
net/core/sock.c +3 -0
@@ -155,6 +155,7 @@ static const char *af_family_key_strings[AF_MAX+1] = {"sk_lock-27" ,"sk_lock-28" ,"sk_lock-AF_CAN" ,"sk_lock-AF_TIPC" ,"sk_lock-AF_BLUETOOTH" ,"sk_lock-IUCV" ,"sk_lock-AF_RXRPC" ,"sk_lock-AF_ISDN" ,"sk_lock-AF_PHONET" , +"sk_lock-AF_IEEE802154" ,"sk_lock-AF_ZIGBEE" ,"sk_lock-AF_MAX" }; static const char *af_family_slock_key_strings[AF_MAX+1] = {
@@ -170,6 +171,7 @@ static const char *af_family_slock_key_strings[AF_MAX+1] = {"slock-27" ,"slock-28" ,"slock-AF_CAN" ,"slock-AF_TIPC" ,"slock-AF_BLUETOOTH" ,"slock-AF_IUCV" ,"slock-AF_RXRPC" ,"slock-AF_ISDN" ,"slock-AF_PHONET" , +"slock-AF_IEEE802154" ,"slock-AF_ZIGBEE" ,"slock-AF_MAX" }; static const char *af_family_clock_key_strings[AF_MAX+1] = {
@@ -185,6 +187,7 @@ static const char *af_family_clock_key_strings[AF_MAX+1] = {"clock-27" ,"clock-28" ,"clock-AF_CAN" ,"clock-AF_TIPC" ,"clock-AF_BLUETOOTH" ,"clock-AF_IUCV" ,"clock-AF_RXRPC" ,"clock-AF_ISDN" ,"clock-AF_PHONET" , +"clock-AF_IEEE802154" ,"clock-AF_ZIGBEE" ,"clock-AF_MAX" };
Signature · 1 line
1.6.3.1
PATCH 3/6 net: add IEEE 802.15.4 socket family implementation
Add support for communication over IEEE 802.15.4 networks. This implementation is neither certified nor complete, but aims to that goal. This commit contains only the socket interface for communication over IEEE 802.15.4 networks. One can either send RAW datagrams or use SOCK_DGRAM to encapsulate data inside normal IEEE 802.15.4 packets.
Configuration interface, drivers and software MAC 802.15.4 implementation will follow.
Initial implementation was done by Maxim Gorbachyov, Maxim Osipov and Pavel Smolensky as a research project at Siemens AG. Later the stack was heavily reworked to better suit the linux networking model, and is now maitained as an open project partially sponsored by Siemens.
--- include/net/ieee802154/af_ieee802154.h | 60 +++++ include/net/ieee802154/mac_def.h | 158 ++++++++++++++ include/net/ieee802154/netdevice.h | 84 +++++++ net/Kconfig | 1 + net/Makefile | 1 + net/ieee802154/Kconfig | 12 + net/ieee802154/Makefile | 4 + net/ieee802154/af802154.h | 35 +++ net/ieee802154/af_ieee802154.c | 356 ++++++++++++++++++++++++++++++ net/ieee802154/dgram.c | 373 ++++++++++++++++++++++++++++++++ net/ieee802154/raw.c | 250 +++++++++++++++++++++ 11 files changed, 1334 insertions(+), 0 deletions(-) create mode 100644 include/net/ieee802154/af_ieee802154.h create mode 100644 include/net/ieee802154/mac_def.h create mode 100644 include/net/ieee802154/netdevice.h create mode 100644 net/ieee802154/Kconfig create mode 100644 net/ieee802154/Makefile create mode 100644 net/ieee802154/af802154.h create mode 100644 net/ieee802154/af_ieee802154.c create mode 100644 net/ieee802154/dgram.c create mode 100644 net/ieee802154/raw.c
include/net/ieee802154/af_ieee802154.h new file +60 -0
@@ -0,0 +1,60 @@ +/* +* IEEE 802.15.4 inteface for userspace +* +* Copyright 2007, 2008 Siemens AG +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Written by: +* Sergey Lapin <[email protected]> +* Dmitry Eremin-Solenikov <[email protected]> +*/ + +#ifndef _AF_IEEE802154_H +#define _AF_IEEE802154_H + +#include <linux/socket.h> /* for sa_family_t */ + +enum { +IEEE802154_ADDR_NONE =0x0 , +/* RESERVED = 0x01, */ +IEEE802154_ADDR_SHORT =0x2 ,/* 16-bit address + PANid */ +IEEE802154_ADDR_LONG =0x3 ,/* 64-bit address + PANid */ +}; + +/* address length, octets */ +#define IEEE802154_ADDR_LEN 8 + +struct ieee802154_addr { +int addr_type; +u16 pan_id; +union { +u8 hwaddr[IEEE802154_ADDR_LEN ]; +u16 short_addr; + }; +}; + +#define IEEE802154_PANID_BROADCAST 0xffff +#define IEEE802154_ADDR_BROADCAST 0xffff +#define IEEE802154_ADDR_UNDEF 0xfffe + +struct sockaddr_ieee802154 { +sa_family_t family;/* AF_IEEE802154 */ +struct ieee802154_addr addr; +}; + +/* master device */ +#define IEEE802154_SIOC_ADD_SLAVE (SIOCDEVPRIVATE + 0) + +#endif
include/net/ieee802154/mac_def.h new file +158 -0
158 lines not on this page · raw message
include/net/ieee802154/netdevice.h new file +84 -0
84 lines not on this page · raw message
net/Kconfig +1 -0
@@ -179,6 +179,7 @@ source "net/lapb/Kconfig" source "net/econet/Kconfig" source "net/wanrouter/Kconfig" source "net/phonet/Kconfig" +source "net/ieee802154/Kconfig" source "net/sched/Kconfig" source "net/dcb/Kconfig"
net/Makefile +1 -0
@@ -60,6 +60,7 @@ obj-$(CONFIG_NET_9P) += 9p/ ifneq ($(CONFIG_DCB),) obj-y += dcb/ endif +obj-y += ieee802154/ ifeq ($(CONFIG_NET),y) obj-$(CONFIG_SYSCTL) += sysctl_net.o
net/ieee802154/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +config IEEE802154 + tristate "IEEE Std 802.15.4 Low-Rate Wireless Personal Area Networks support (EXPERIMENTAL)" + depends on EXPERIMENTAL + ---help--- + IEEE Std 802.15.4 defines a low data rate, low power and low complexity + short range wireless personal area networks. It was designed to + organise networks of sensors, switches, etc automation devices. Maximum + allowed data rate is 250 kb/s and typical personal operating space + around 10m. + + Say Y here to compile LR-WPAN support into the kernel or say M to + compile it as modules.
net/ieee802154/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +obj-$(CONFIG_IEEE802154) += af_802154.o +af_802154-objs := af_ieee802154.o raw.o dgram.o + +EXTRA_CFLAGS += -Wall -DDEBUG
net/ieee802154/af802154.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Internal interfaces for ieee 802.15.4 address family. +* +* Copyright 2007, 2008, 2009 Siemens AG +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Written by: +* Sergey Lapin <[email protected]> +* Dmitry Eremin-Solenikov <[email protected]> +*/ + +#ifndef AF802154_H +#define AF802154_H + +struct sk_buff ; +struct net_devce ; +extern struct proto ieee802154_raw_prot; +extern struct proto ieee802154_dgram_prot; +void ieee802154_raw_deliver (struct net_device *dev,struct sk_buff *skb); +int ieee802154_dgram_deliver (struct net_device *dev,struct sk_buff *skb); +struct net_device *ieee802154_get_dev (struct net *net,struct ieee802154_addr *addr); + +#endif
net/ieee802154/af_ieee802154.c new file +356 -0
356 lines not on this page · raw message
net/ieee802154/dgram.c new file +373 -0
373 lines not on this page · raw message
net/ieee802154/raw.c new file +250 -0
250 lines not on this page · raw message
Signature · 1 line
1.6.3.1
PATCH 4/6 net: add NL802154 interface for configuration of 802.15.4 devices
Add a netlink interface for configuration of IEEE 802.15.4 device. Also this interface specifies events notification sent by devices towards higher layers.
--- include/net/ieee802154/nl802154.h | 165 +++++++++++++ net/ieee802154/Makefile | 3 +- net/ieee802154/netlink.c | 485 +++++++++++++++++++++++++++++++++++++ 3 files changed, 652 insertions(+), 1 deletions(-) create mode 100644 include/net/ieee802154/nl802154.h create mode 100644 net/ieee802154/netlink.c
include/net/ieee802154/nl802154.h new file +165 -0
@@ -0,0 +1,165 @@ +/* +* ieee802154_nl.h +* +* Copyright (C) 2007, 2008 Siemens AG +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +*/ + +#ifndef IEEE802154_NL_H +#define IEEE802154_NL_H + +#define IEEE802154_NL_NAME "802.15.4 MAC" +#define IEEE802154_MCAST_COORD_NAME "coordinator" +#define IEEE802154_MCAST_BEACON_NAME "beacon" + +enum { + __IEEE802154_ATTR_INVALID, + +IEEE802154_ATTR_DEV_NAME , +IEEE802154_ATTR_DEV_INDEX , + +IEEE802154_ATTR_STATUS , + +IEEE802154_ATTR_SHORT_ADDR , +IEEE802154_ATTR_HW_ADDR , +IEEE802154_ATTR_PAN_ID , + +IEEE802154_ATTR_CHANNEL , + +IEEE802154_ATTR_COORD_SHORT_ADDR , +IEEE802154_ATTR_COORD_HW_ADDR , +IEEE802154_ATTR_COORD_PAN_ID , + +IEEE802154_ATTR_SRC_SHORT_ADDR , +IEEE802154_ATTR_SRC_HW_ADDR , +IEEE802154_ATTR_SRC_PAN_ID , + +IEEE802154_ATTR_DEST_SHORT_ADDR , +IEEE802154_ATTR_DEST_HW_ADDR , +IEEE802154_ATTR_DEST_PAN_ID , + +IEEE802154_ATTR_CAPABILITY ,/* FIXME: this is association */ +IEEE802154_ATTR_REASON , +IEEE802154_ATTR_SCAN_TYPE , +IEEE802154_ATTR_CHANNELS , +IEEE802154_ATTR_DURATION , +IEEE802154_ATTR_ED_LIST , +IEEE802154_ATTR_BCN_ORD , +IEEE802154_ATTR_SF_ORD , +IEEE802154_ATTR_PAN_COORD , +IEEE802154_ATTR_BAT_EXT , +IEEE802154_ATTR_COORD_REALIGN , +IEEE802154_ATTR_SEC , + + __IEEE802154_ATTR_MAX, +}; + +#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) +#define NLA_HW_ADDR NLA_U64 +#define NLA_GET_HW_ADDR (attr, addr) do { u64 _temp = nla_get_u64(attr); memcpy(addr, &_temp, 8); } while (0) +#define NLA_PUT_HW_ADDR (msg, attr, addr) do { u64 _temp; memcpy(&_temp, addr, 8); NLA_PUT_U64(msg, attr, _temp); } while (0) + +#ifdef IEEE802154_NL_WANT_POLICY +static struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX +1 ] = { + [IEEE802154_ATTR_DEV_NAME ] = { .type =NLA_STRING , }, + [IEEE802154_ATTR_DEV_INDEX ] = { .type =NLA_U32 , }, + + [IEEE802154_ATTR_STATUS ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_SHORT_ADDR ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_HW_ADDR ] = { .type =NLA_HW_ADDR , }, + [IEEE802154_ATTR_PAN_ID ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_CHANNEL ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_COORD_SHORT_ADDR ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_COORD_HW_ADDR ] = { .type =NLA_HW_ADDR , }, + [IEEE802154_ATTR_COORD_PAN_ID ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_SRC_SHORT_ADDR ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_SRC_HW_ADDR ] = { .type =NLA_HW_ADDR , }, + [IEEE802154_ATTR_SRC_PAN_ID ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_DEST_SHORT_ADDR ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_DEST_HW_ADDR ] = { .type =NLA_HW_ADDR , }, + [IEEE802154_ATTR_DEST_PAN_ID ] = { .type =NLA_U16 , }, + + [IEEE802154_ATTR_CAPABILITY ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_REASON ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_SCAN_TYPE ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_CHANNELS ] = { .type =NLA_U32 , }, + [IEEE802154_ATTR_DURATION ] = { .type =NLA_U8 , }, +#ifdef __KERNEL__ + [IEEE802154_ATTR_ED_LIST] = { .len = 27 }, +#else + [IEEE802154_ATTR_ED_LIST ] = { .minlen =27 , .maxlen =27 }, +#endif +}; +#endif + +/* commands */ +/* REQ should be responded with CONF +* and INDIC with RESP +*/ +enum { + __IEEE802154_COMMAND_INVALID, + +IEEE802154_ASSOCIATE_REQ , +IEEE802154_ASSOCIATE_CONF , +IEEE802154_DISASSOCIATE_REQ , +IEEE802154_DISASSOCIATE_CONF , +IEEE802154_GET_REQ , +IEEE802154_GET_CONF , +/* IEEE802154_GTS_REQ, */ +/* IEEE802154_GTS_CONF, */ +IEEE802154_RESET_REQ , +IEEE802154_RESET_CONF , +/* IEEE802154_RX_ENABLE_REQ, */ +/* IEEE802154_RX_ENABLE_CONF, */ +IEEE802154_SCAN_REQ , +IEEE802154_SCAN_CONF , +IEEE802154_SET_REQ , +IEEE802154_SET_CONF , +IEEE802154_START_REQ , +IEEE802154_START_CONF , +IEEE802154_SYNC_REQ , +IEEE802154_POLL_REQ , +IEEE802154_POLL_CONF , + +IEEE802154_ASSOCIATE_INDIC , +IEEE802154_ASSOCIATE_RESP , +IEEE802154_DISASSOCIATE_INDIC , +IEEE802154_BEACON_NOTIFY_INDIC , +/* IEEE802154_GTS_INDIC, */ +IEEE802154_ORPHAN_INDIC , +IEEE802154_ORPHAN_RESP , +IEEE802154_COMM_STATUS_INDIC , +IEEE802154_SYNC_LOSS_INDIC , + + __IEEE802154_CMD_MAX, +}; + +#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) + + +#ifdef __KERNEL__ +struct net_device ; + +int ieee802154_nl_assoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 cap); +int ieee802154_nl_assoc_confirm (struct net_device *dev,u16 short_addr,u8 status); +int ieee802154_nl_disassoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 reason); +int ieee802154_nl_disassoc_confirm (struct net_device *dev,u8 status); +int ieee802154_nl_scan_confirm (struct net_device *dev,u8 status,u8 scan_type,u32 unscanned, +u8 *edl/*, struct list_head *pan_desc_list */ ); +int ieee802154_nl_beacon_indic (struct net_device *dev,u16 panid,u16 coord_addr);/* TODO */ +#endif + +#endif
net/ieee802154/Makefile +2 -1
@@ -1,4 +1,5 @@ -obj-$(CONFIG_IEEE802154) += af_802154.o +obj-$(CONFIG_IEEE802154) += nl802154.o af_802154.o +nl802154-objs := netlink.o af_802154-objs := af_ieee802154.o raw.o dgram.o EXTRA_CFLAGS += -Wall -DDEBUG
net/ieee802154/netlink.c new file +485 -0
485 lines not on this page · raw message
Signature · 6 lines
1.6.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/6 ieee802154: add documentation about our stack
Add MAINTAINERS entry and a small text describing our stack interfaces, how to hook the drivers, etc.
--- Documentation/networking/ieee802154.txt | 76 +++++++++++++++++++++++++++++++ MAINTAINERS | 12 +++++ 2 files changed, 88 insertions(+), 0 deletions(-) create mode 100644 Documentation/networking/ieee802154.txt
Documentation/networking/ieee802154.txt new file +76 -0
@@ -0,0 +1,76 @@ + + Linux IEEE 802.15.4 implementation + + +Introduction +============ + +The Linux-ZigBee project goal is to provide complete implementation +of IEEE 802.15.4 / ZigBee / 6LoWPAN protocols. IEEE 802.15.4 is a stack +of protocols for organizing Low-Rate Wireless Personal Area Networks. + +Currently only IEEE 802.15.4 layer is implemented. We have choosen +to use plain Berkeley socket API, the generic Linux networking stack +to transfer IEEE 802.15.4 messages and a special protocol over genetlink +for configuration/management + + +Socket API +========== + +int sd = socket(PF_IEEE802154, SOCK_DGRAM, 0); +..... + +The address family, socket addresses etc. are defined in the +include/net/ieee802154/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). + +One can use SOCK_RAW for passing raw data towards device xmit function. YMMV. + + +MLME - MAC Level Management +============================ + +Most of IEEE 802.15.4 MLME interfaces are directly mapped on netlink commands. +See the include/net/ieee802154/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. + + +Kernel side +============= + +Like with WiFi, there are several types of devices implementing IEEE 802.15.4. +1) 'HardMAC'. The MAC layer is implemented in the device itself, the device + exports MLME and data API. +2) 'SoftMAC' or just radio. These types of devices are just radio transceivers + possibly with some kinds of acceleration like automatic CRC computation and + comparation, automagic ACK handling, address matching, etc. + +Those types of devices require different approach to be hooked into Linux kernel. + + +HardMAC +======= + +See the header include/net/ieee802154/netdevice.h. You have to implement Linux +net_device, with .type = ARPHRD_IEEE802154. Data is exchanged with socket family +code via plain sk_buffs. The control block of sk_buffs will contain additional +info as described in the struct ieee802154_mac_cb. + +To hook the MLME interface you have to populate the ml_priv field of your +net_device with a pointer to struct ieee802154_mlme_ops instance. All fields are +required. + +We provide an example of simple HardMAC driver at drivers/ieee802154/fakehard.c + + +SoftMAC +======= + +We are going to provide intermediate layer impelementing IEEE 802.15.4 MAC +in software. This is currently WIP. + +See header include/net/ieee802154/mac802154.h and several drivers in +drivers/ieee802154/
MAINTAINERS +12 -0
@@ -2807,6 +2807,18 @@ L: linux1394-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org S: Maintained F: drivers/ieee1394/raw1394* +IEEE 802.15.4 SUBSYSTEM +P: Dmitry Eremin-Solenikov +M: [email protected] +P: Sergey Lapin +M: [email protected] +L: linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org +W: http://apps.sourceforge.net/trac/linux-zigbee +T: git git://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.git +S: Maintained +F: net/ieee802154/ +F: drivers/ieee801254/ + INTEGRITY MEASUREMENT ARCHITECTURE (IMA) P: Mimi Zohar M: zohar-r/[email protected]
Signature · 6 lines
1.6.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/6 ieee802154: add simple HardMAC driver sample
fakehard is a really simple driver implementing only necessary callbacks and serves the role of an example of driver for HardMAC IEEE 802.15.4 device.
--- drivers/Makefile | 1 + drivers/ieee802154/Kconfig | 21 ++++ drivers/ieee802154/Makefile | 3 + drivers/ieee802154/fakehard.c | 258 +++++++++++++++++++++++++++++++++++++++++ drivers/net/Kconfig | 2 + 5 files changed, 285 insertions(+), 0 deletions(-) create mode 100644 drivers/ieee802154/Kconfig create mode 100644 drivers/ieee802154/Makefile create mode 100644 drivers/ieee802154/fakehard.c
drivers/Makefile +1 -0
@@ -107,3 +107,4 @@ obj-$(CONFIG_SSB) += ssb/ obj-$(CONFIG_VIRTIO) += virtio/ obj-$(CONFIG_STAGING) += staging/ obj-y += platform/ +obj-y += ieee802154/
drivers/ieee802154/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +menuconfig IEEE802154_DRIVERS + bool "IEEE 802.15.4 drivers" + depends on NETDEVICES && IEEE802154 + default y + ---help--- + Say Y here to get to see options for IEEE 802.15.4 Low-Rate + Wireless Personal Area Network device drivers. This option alone + does not add any kernel code. + + If you say N, all options in this submenu will be skipped and disabled. + +config IEEE802154_FAKEHARD + tristate "Fake LR-WPAN driver with several interconnected devices" + depends on IEEE802154_DRIVERS + ---help--- + Say Y here to enable the fake driver that serves as an example + of HardMAC device driver. + + This driver can also be built as a module. To do so say M here. + The module will be called 'fakehard'. +
drivers/ieee802154/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o + +EXTRA_CFLAGS += -DDEBUG -DCONFIG_FFD
drivers/ieee802154/fakehard.c new file +258 -0
258 lines not on this page · raw message
drivers/net/Kconfig +2 -0
@@ -2704,6 +2704,8 @@ source "drivers/net/wan/Kconfig" source "drivers/atm/Kconfig" +source "drivers/ieee802154/Kconfig" + source "drivers/s390/net/Kconfig" config XEN_NETDEV_FRONTEND
Signature · 6 lines
1.6.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
In reply to Dmitry Eremin-SolenikovQuoted 5 lines · Dmitry Eremin-Solenikov
include/net/ieee802154/nl802154.h new file +5
-0+enum { + __IEEE802154_COMMAND_INVALID, + +IEEE802154_ASSOCIATE_REQ , +IEEE802154_ASSOCIATE_CONF ,
include/net/ieee802154/nl802154.h line 126
Quoted 10 lines
include/net/ieee802154/nl802154.h new file +10
-0+IEEE802154_DISASSOCIATE_REQ , +IEEE802154_DISASSOCIATE_CONF , +IEEE802154_GET_REQ , +IEEE802154_GET_CONF , +/* IEEE802154_GTS_REQ, */ +/* IEEE802154_GTS_CONF, */ +IEEE802154_RESET_REQ , + IEEE802154_RESET_CONF, +/* IEEE802154_RX_ENABLE_REQ, */ +/* IEEE802154_RX_ENABLE_CONF, */
This is a recipe for disaster. Somebody will come along and uncomment things. Why this is bad, I leave as an exercise for the reader.
johannes
David Miller
maintainerRe: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
From: Johannes Berg <[email protected]>
Date: Wed, 03 Jun 2009 11:39:24 +0200
Quoted 12 lines · Dmitry Eremin-Solenikov
Quoted 11 lines
include/net/ieee802154/nl802154.h new file +10
-0+enum { + __IEEE802154_COMMAND_INVALID, + +IEEE802154_ASSOCIATE_REQ , +IEEE802154_ASSOCIATE_CONF , +IEEE802154_DISASSOCIATE_REQ , +IEEE802154_DISASSOCIATE_CONF , +IEEE802154_GET_REQ , +IEEE802154_GET_CONF , +/* IEEE802154_GTS_REQ, */
Quoted 8 lines
include/net/ieee802154/nl802154.h line 126
Quoted 5 lines
include/net/ieee802154/nl802154.h new file +5
-0+/* IEEE802154_GTS_CONF, */ +IEEE802154_RESET_REQ , + IEEE802154_RESET_CONF, +/* IEEE802154_RX_ENABLE_REQ, */ +/* IEEE802154_RX_ENABLE_CONF, */ This is a recipe for disaster. Somebody will come along and uncomment things. Why this is bad, I leave as an exercise for the reader.
Right, it changes the other request numbers and breaks userspace.
Dmitry you have to pick these numbers as fixed numbers now and do so in such a way that they will remain unchanged forever because they are part of the user visible interface.
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
Quoted 24 lines · David Miller
From: Johannes Berg <[email protected]>
Date: Wed, 03 Jun 2009 11:39:24 +0200Quoted 12 lines · Dmitry Eremin-Solenikov
Quoted 11 lines
(quoted diff) +10
-0+enum { + __IEEE802154_COMMAND_INVALID, + + IEEE802154_ASSOCIATE_REQ, + IEEE802154_ASSOCIATE_CONF, + IEEE802154_DISASSOCIATE_REQ, + IEEE802154_DISASSOCIATE_CONF, + IEEE802154_GET_REQ, + IEEE802154_GET_CONF, +/* IEEE802154_GTS_REQ, */Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+/* IEEE802154_GTS_CONF, */ + IEEE802154_RESET_REQ, + IEEE802154_RESET_CONF, +/* IEEE802154_RX_ENABLE_REQ, */ +/* IEEE802154_RX_ENABLE_CONF, */This is a recipe for disaster. Somebody will come along and uncomment things. Why this is bad, I leave as an exercise for the reader.
Quoted 8 lines
Right, it changes the other request numbers and breaks userspace.
Dmitry you have to pick these numbers as fixed numbers now and do so in such a way that they will remain unchanged forever because they are part of the user visible interface.
From
733dcc791aef46e029e696c9c986e74916ff596bMon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Wed, 3 Jun 2009 14:43:41 +0400
Subject: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
Add a netlink interface for configuration of IEEE 802.15.4 device. Also this interface specifies events notification sent by devices towards higher layers.
--- include/net/ieee802154/nl802154.h | 166 +++++++++++++ net/ieee802154/Makefile | 3 +- net/ieee802154/netlink.c | 485 +++++++++++++++++++++++++++++++++++++ 3 files changed, 653 insertions(+), 1 deletions(-) create mode 100644 include/net/ieee802154/nl802154.h create mode 100644 net/ieee802154/netlink.c
include/net/ieee802154/nl802154.h new file +166 -0
@@ -0,0 +1,166 @@ +/* +* ieee802154_nl.h +* +* Copyright (C) 2007, 2008 Siemens AG +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +*/ + +#ifndef IEEE802154_NL_H +#define IEEE802154_NL_H + +#define IEEE802154_NL_NAME "802.15.4 MAC" +#define IEEE802154_MCAST_COORD_NAME "coordinator" +#define IEEE802154_MCAST_BEACON_NAME "beacon" + +enum { + __IEEE802154_ATTR_INVALID, + +IEEE802154_ATTR_DEV_NAME , +IEEE802154_ATTR_DEV_INDEX , + +IEEE802154_ATTR_STATUS , + +IEEE802154_ATTR_SHORT_ADDR , +IEEE802154_ATTR_HW_ADDR , +IEEE802154_ATTR_PAN_ID , + +IEEE802154_ATTR_CHANNEL , + +IEEE802154_ATTR_COORD_SHORT_ADDR , +IEEE802154_ATTR_COORD_HW_ADDR , +IEEE802154_ATTR_COORD_PAN_ID , + +IEEE802154_ATTR_SRC_SHORT_ADDR , +IEEE802154_ATTR_SRC_HW_ADDR , +IEEE802154_ATTR_SRC_PAN_ID , + +IEEE802154_ATTR_DEST_SHORT_ADDR , +IEEE802154_ATTR_DEST_HW_ADDR , +IEEE802154_ATTR_DEST_PAN_ID , + +IEEE802154_ATTR_CAPABILITY ,/* FIXME: this is association */ +IEEE802154_ATTR_REASON , +IEEE802154_ATTR_SCAN_TYPE , +IEEE802154_ATTR_CHANNELS , +IEEE802154_ATTR_DURATION , +IEEE802154_ATTR_ED_LIST , +IEEE802154_ATTR_BCN_ORD , +IEEE802154_ATTR_SF_ORD , +IEEE802154_ATTR_PAN_COORD , +IEEE802154_ATTR_BAT_EXT , +IEEE802154_ATTR_COORD_REALIGN , +IEEE802154_ATTR_SEC , + + __IEEE802154_ATTR_MAX, +}; + +#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) +#define NLA_HW_ADDR NLA_U64 +#define NLA_GET_HW_ADDR (attr, addr) do { u64 _temp = nla_get_u64(attr); memcpy(addr, &_temp, 8); } while (0) +#define NLA_PUT_HW_ADDR (msg, attr, addr) do { u64 _temp; memcpy(&_temp, addr, 8); NLA_PUT_U64(msg, attr, _temp); } while (0) + +#ifdef IEEE802154_NL_WANT_POLICY +static struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX +1 ] = { + [IEEE802154_ATTR_DEV_NAME ] = { .type =NLA_STRING , }, + [IEEE802154_ATTR_DEV_INDEX ] = { .type =NLA_U32 , }, + + [IEEE802154_ATTR_STATUS ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_SHORT_ADDR ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_HW_ADDR ] = { .type =NLA_HW_ADDR , }, + [IEEE802154_ATTR_PAN_ID ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_CHANNEL ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_COORD_SHORT_ADDR ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_COORD_HW_ADDR ] = { .type =NLA_HW_ADDR , }, + [IEEE802154_ATTR_COORD_PAN_ID ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_SRC_SHORT_ADDR ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_SRC_HW_ADDR ] = { .type =NLA_HW_ADDR , }, + [IEEE802154_ATTR_SRC_PAN_ID ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_DEST_SHORT_ADDR ] = { .type =NLA_U16 , }, + [IEEE802154_ATTR_DEST_HW_ADDR ] = { .type =NLA_HW_ADDR , }, + [IEEE802154_ATTR_DEST_PAN_ID ] = { .type =NLA_U16 , }, + + [IEEE802154_ATTR_CAPABILITY ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_REASON ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_SCAN_TYPE ] = { .type =NLA_U8 , }, + [IEEE802154_ATTR_CHANNELS ] = { .type =NLA_U32 , }, + [IEEE802154_ATTR_DURATION ] = { .type =NLA_U8 , }, +#ifdef __KERNEL__ + [IEEE802154_ATTR_ED_LIST] = { .len = 27 }, +#else + [IEEE802154_ATTR_ED_LIST ] = { .minlen =27 , .maxlen =27 }, +#endif +}; +#endif + +/* commands */ +/* REQ should be responded with CONF +* and INDIC with RESP +*/ +enum { + __IEEE802154_COMMAND_INVALID, + +IEEE802154_ASSOCIATE_REQ , +IEEE802154_ASSOCIATE_CONF , +IEEE802154_DISASSOCIATE_REQ , +IEEE802154_DISASSOCIATE_CONF , +IEEE802154_GET_REQ , +IEEE802154_GET_CONF , +IEEE802154_RESET_REQ , +IEEE802154_RESET_CONF , +IEEE802154_SCAN_REQ , +IEEE802154_SCAN_CONF , +IEEE802154_SET_REQ , +IEEE802154_SET_CONF , +IEEE802154_START_REQ , +IEEE802154_START_CONF , +IEEE802154_SYNC_REQ , +IEEE802154_POLL_REQ , +IEEE802154_POLL_CONF , + +IEEE802154_ASSOCIATE_INDIC , +IEEE802154_ASSOCIATE_RESP , +IEEE802154_DISASSOCIATE_INDIC , +IEEE802154_BEACON_NOTIFY_INDIC , +IEEE802154_ORPHAN_INDIC , +IEEE802154_ORPHAN_RESP , +IEEE802154_COMM_STATUS_INDIC , +IEEE802154_SYNC_LOSS_INDIC , + +IEEE802154_GTS_REQ ,/* Not supported yet */ +IEEE802154_GTS_INDIC ,/* Not supported yet */ +IEEE802154_GTS_CONF ,/* Not supported yet */ +IEEE802154_RX_ENABLE_REQ ,/* Not supported yet */ +IEEE802154_RX_ENABLE_CONF ,/* Not supported yet */ + + __IEEE802154_CMD_MAX, +}; + +#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) + + +#ifdef __KERNEL__ +struct net_device ; + +int ieee802154_nl_assoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 cap); +int ieee802154_nl_assoc_confirm (struct net_device *dev,u16 short_addr,u8 status); +int ieee802154_nl_disassoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 reason); +int ieee802154_nl_disassoc_confirm (struct net_device *dev,u8 status); +int ieee802154_nl_scan_confirm (struct net_device *dev,u8 status,u8 scan_type,u32 unscanned, +u8 *edl/*, struct list_head *pan_desc_list */ ); +int ieee802154_nl_beacon_indic (struct net_device *dev,u16 panid,u16 coord_addr);/* TODO */ +#endif + +#endif
net/ieee802154/Makefile +2 -1
@@ -1,4 +1,5 @@ -obj-$(CONFIG_IEEE802154) += af_802154.o +obj-$(CONFIG_IEEE802154) += nl802154.o af_802154.o +nl802154-objs := netlink.o af_802154-objs := af_ieee802154.o raw.o dgram.o EXTRA_CFLAGS += -Wall -DDEBUG
net/ieee802154/netlink.c new file +485 -0
485 lines not on this page · raw message
Signature · 6 lines
1.6.3.1 -- With best wishes Dmitry
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
include/net/ieee802154/nl802154.h line 54
Quoted 1 line · Dmitry Eremin-Solenikov
include/net/ieee802154/nl802154.h new file +1
-0+ IEEE802154_ATTR_CAPABILITY, /* FIXME: this is association */
Fix what?
include/net/ieee802154/nl802154.h line 73
Quoted 4 lines
include/net/ieee802154/nl802154.h new file +4
-0+#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) +#define NLA_HW_ADDR NLA_U64 +#define NLA_GET_HW_ADDR (attr, addr) do { u64 _temp = nla_get_u64(attr); memcpy(addr, &_temp, 8); } while (0) +#define NLA_PUT_HW_ADDR (msg, attr, addr) do { u64 _temp; memcpy(&_temp, addr, 8); NLA_PUT_U64(msg, attr, _temp); } while (0)
I really don't like this namespace pollution.
include/net/ieee802154/nl802154.h line 76
Quoted 2 lines
include/net/ieee802154/nl802154.h new file +2
-0+#ifdef IEEE802154_NL_WANT_POLICY +static struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = {
Ho humm. This shouldn't be in a header file. Not even with an #ifdef that exactly one C file then sets.
include/net/ieee802154/nl802154.h line 102
Quoted 4 lines
include/net/ieee802154/nl802154.h new file +4
-0+ [IEEE802154_ATTR_DURATION ] = { .type =NLA_U8 , }, +#ifdef __KERNEL__ + [IEEE802154_ATTR_ED_LIST] = { .len = 27 }, +#else
Ick.
include/net/ieee802154/nl802154.h line 112
Quoted 5 lines
include/net/ieee802154/nl802154.h new file +5
-0+/* commands */ +/* REQ should be responded with CONF +* and INDIC with RESP +*/ +enum {
kernel-doc explaining the commands would be immensely helpful.
include/net/ieee802154/nl802154.h line 146
Quoted 5 lines
include/net/ieee802154/nl802154.h new file +5
-0+IEEE802154_GTS_REQ ,/* Not supported yet */ +IEEE802154_GTS_INDIC ,/* Not supported yet */ +IEEE802154_GTS_CONF ,/* Not supported yet */ +IEEE802154_RX_ENABLE_REQ ,/* Not supported yet */ + IEEE802154_RX_ENABLE_CONF, /* Not supported yet */
Just leave it out then. You're fixing ABI here.
include/net/ieee802154/nl802154.h line 164
Quoted 11 lines
include/net/ieee802154/nl802154.h new file +11
-0+#ifdef __KERNEL__ +struct net_device ; + +int ieee802154_nl_assoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 cap); +int ieee802154_nl_assoc_confirm (struct net_device *dev,u16 short_addr,u8 status); +int ieee802154_nl_disassoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 reason); +int ieee802154_nl_disassoc_confirm (struct net_device *dev,u8 status); +int ieee802154_nl_scan_confirm (struct net_device *dev,u8 status,u8 scan_type,u32 unscanned, +u8 *edl/*, struct list_head *pan_desc_list */ ); +int ieee802154_nl_beacon_indic (struct net_device *dev,u16 panid,u16 coord_addr);/* TODO */ +#endif
Why not just use two header files, one in net/ and one in linux/?
net/ieee802154/Makefile line 2
Quoted 3 lines
net/ieee802154/Makefile +2
-1-obj-$(CONFIG_IEEE802154) += af_802154.o +obj-$(CONFIG_IEEE802154) += nl802154.o af_802154.o +nl802154-objs := netlink.o
That doesn't make any sense. Why the indirection?
net/ieee802154/netlink.c line 31
Quoted 3 lines
net/ieee802154/netlink.c new file +3
-0+#include <net/ieee802154/af_ieee802154.h> +#define IEEE802154_NL_WANT_POLICY +#include <net/ieee802154/nl802154.h>
Like I thought. That's ugly.
net/ieee802154/netlink.c line 89
Quoted 7 lines
net/ieee802154/netlink.c new file +7
-0+static int ieee802154_nl_put_failure (struct sk_buff *msg) +{ +void *hdr =genlmsg_data (NLMSG_DATA (msg->data));/* XXX: nlh is right at the start of msg */ +genlmsg_cancel (msg, hdr); +nlmsg_free (msg); +return -ENOBUFS ; +}
This seems weird.
Quoted 6 lines
net/ieee802154/netlink.c new file +6
-0+int ieee802154_nl_assoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 cap) +{ +struct sk_buff *msg; + +pr_debug ("%s\n" , __func__); +
net/ieee802154/netlink.c line 106
Quoted 10 lines
net/ieee802154/netlink.c new file +10
-0+ msg =ieee802154_nl_create (/* flags*/ 0 ,IEEE802154_ASSOCIATE_INDIC ); +if (!msg) +return -ENOBUFS ; + +NLA_PUT_STRING (msg,IEEE802154_ATTR_DEV_NAME , dev->name); +NLA_PUT_U32 (msg,IEEE802154_ATTR_DEV_INDEX , dev->ifindex); +NLA_PUT_HW_ADDR (msg,IEEE802154_ATTR_HW_ADDR , dev->dev_addr); + +/* FIXME: check that we really received hw address */ +NLA_PUT_HW_ADDR (msg,IEEE802154_ATTR_SRC_HW_ADDR , addr->hwaddr);
?
net/ieee802154/netlink.c line 276
Quoted 11 lines
net/ieee802154/netlink.c new file +11
-0+static int ieee802154_associate_req (struct sk_buff *skb,struct genl_info *info) +{ +struct net_device *dev; +struct ieee802154_addr addr; +int ret = -EINVAL ; + +if (!info->attrs[IEEE802154_ATTR_CHANNEL ] + || !info->attrs[IEEE802154_ATTR_COORD_PAN_ID ] + || (!info->attrs[IEEE802154_ATTR_COORD_HW_ADDR ] && !info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR ]) + || !info->attrs[IEEE802154_ATTR_CAPABILITY ]) +return -EINVAL ;
That's some odd coding style.
johannes
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
Quoted 14 lines · Johannes Berg
include/net/ieee802154/nl802154.h line 73
Quoted 4 lines · Dmitry Eremin-Solenikov
include/net/ieee802154/nl802154.h new file +4
-0+#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) +#define NLA_HW_ADDR NLA_U64 +#define NLA_GET_HW_ADDR (attr, addr) do { u64 _temp = nla_get_u64(attr); memcpy(addr, &_temp, 8); } while (0) +#define NLA_PUT_HW_ADDR (msg, attr, addr) do { u64 _temp; memcpy(&_temp, addr, 8); NLA_PUT_U64(msg, attr, _temp); } while (0)I really don't like this namespace pollution.
include/net/ieee802154/nl802154.h line 76
Quoted 2 lines
include/net/ieee802154/nl802154.h new file +2
-0+#ifdef IEEE802154_NL_WANT_POLICY +static struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = {Ho humm. This shouldn't be in a header file. Not even with an #ifdef that exactly one C file then sets.
Quoted 6 lines
include/net/ieee802154/nl802154.h line 102
Quoted 4 lines
include/net/ieee802154/nl802154.h new file +4
-0+ [IEEE802154_ATTR_DURATION ] = { .type =NLA_U8 , }, +#ifdef __KERNEL__ + [IEEE802154_ATTR_ED_LIST] = { .len = 27 }, +#elseIck.
We'd like to share the policy declaration between kernel and user space as a single file. I'll move this from header to the source file though.
Quoted 8 lines
include/net/ieee802154/nl802154.h line 112
Quoted 6 lines
include/net/ieee802154/nl802154.h new file +5
-0+/* commands */ +/* REQ should be responded with CONF +* and INDIC with RESP +*/ +enum {kernel-doc explaining the commands would be immensely helpful.
What explanations whould you like to see? These commands are described in the IEEE 802.15.4 standard.
Quoted 9 lines
include/net/ieee802154/nl802154.h line 146
Quoted 7 lines
include/net/ieee802154/nl802154.h new file +5
-0+IEEE802154_GTS_REQ ,/* Not supported yet */ +IEEE802154_GTS_INDIC ,/* Not supported yet */ +IEEE802154_GTS_CONF ,/* Not supported yet */ +IEEE802154_RX_ENABLE_REQ ,/* Not supported yet */ + IEEE802154_RX_ENABLE_CONF, /* Not supported yet */Just leave it out then. You're fixing ABI here.
Thas is the desired thing: the ABI is modelled after the subroutines in IEEE 802.15.4 standard. So we'd like to fix the numbers for the commands from the start.
Quoted 5 lines
Quoted 5 lines
include/net/ieee802154/nl802154.h new file +5
-0+#ifdef __KERNEL__ +struct net_device ; + +int ieee802154_nl_assoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 cap); +int ieee802154_nl_assoc_confirm (struct net_device *dev,u16 short_addr,u8 status);
Quoted 8 lines
include/net/ieee802154/nl802154.h line 164
Quoted 6 lines
include/net/ieee802154/nl802154.h new file +6
-0+int ieee802154_nl_disassoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 reason); +int ieee802154_nl_disassoc_confirm (struct net_device *dev,u8 status); +int ieee802154_nl_scan_confirm (struct net_device *dev,u8 status,u8 scan_type,u32 unscanned, +u8 *edl/*, struct list_head *pan_desc_list */ ); +int ieee802154_nl_beacon_indic (struct net_device *dev,u16 panid,u16 coord_addr);/* TODO */ +#endif Why not just use two header files, one in
net/and one in linux/?
What would you suggest to put into the linux/ header and what in the net/ one?
Quoted 9 lines
net/ieee802154/netlink.c line 89
Quoted 7 lines
net/ieee802154/netlink.c new file +7
-0+static int ieee802154_nl_put_failure (struct sk_buff *msg) +{ +void *hdr =genlmsg_data (NLMSG_DATA (msg->data));/* XXX: nlh is right at the start of msg */ +genlmsg_cancel (msg, hdr); +nlmsg_free (msg); +return -ENOBUFS ; +}This seems weird.
Why?
Quoted 5 lines
Quoted 5 lines
net/ieee802154/netlink.c new file +5
-0+static int ieee802154_associate_req (struct sk_buff *skb,struct genl_info *info) +{ +struct net_device *dev; +struct ieee802154_addr addr; +int ret = -EINVAL ;
Quoted 8 lines
net/ieee802154/netlink.c line 276
Quoted 6 lines
net/ieee802154/netlink.c new file +6
-0+ +if (!info->attrs[IEEE802154_ATTR_CHANNEL ] + || !info->attrs[IEEE802154_ATTR_COORD_PAN_ID ] + || (!info->attrs[IEEE802154_ATTR_COORD_HW_ADDR ] && !info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR ]) + || !info->attrs[IEEE802154_ATTR_CAPABILITY ]) +return -EINVAL ;That's some odd coding style.
Could you please elaborate this? What seems odd to you?
Signature · 7 lines
With best wishes Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
Quoted 10 lines · Dmitry Eremin-Solenikov
Quoted 7 lines
include/net/ieee802154/nl802154.h line 112
Quoted 5 lines
include/net/ieee802154/nl802154.h new file +5
-0+/* commands */ +/* REQ should be responded with CONF +* and INDIC with RESP +*/ +enum {kernel-doc explaining the commands would be immensely helpful.
What explanations whould you like to see? These commands are described in the IEEE 802.15.4 standard.
Well, for example which arguments they require...
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
include/net/ieee802154/nl802154.h new file +5
-0+#ifdef __KERNEL__ +struct net_device ; + +int ieee802154_nl_assoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 cap); +int ieee802154_nl_assoc_confirm (struct net_device *dev,u16 short_addr,u8 status);Quoted 8 lines
include/net/ieee802154/nl802154.h line 164
Quoted 6 lines
include/net/ieee802154/nl802154.h new file +6
-0+int ieee802154_nl_disassoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 reason); +int ieee802154_nl_disassoc_confirm (struct net_device *dev,u8 status); +int ieee802154_nl_scan_confirm (struct net_device *dev,u8 status,u8 scan_type,u32 unscanned, +u8 *edl/*, struct list_head *pan_desc_list */ ); +int ieee802154_nl_beacon_indic (struct net_device *dev,u16 panid,u16 coord_addr);/* TODO */ +#endif Why not just use two header files, one in
net/and one in linux/?
Quoted 2 lines
What would you suggest to put into the linux/ header and what in the
net/one?
userspace vs. in-kernel separation
Quoted 11 lines
Quoted 9 lines
net/ieee802154/netlink.c line 89
Quoted 7 lines
net/ieee802154/netlink.c new file +7
-0+static int ieee802154_nl_put_failure (struct sk_buff *msg) +{ +void *hdr =genlmsg_data (NLMSG_DATA (msg->data));/* XXX: nlh is right at the start of msg */ +genlmsg_cancel (msg, hdr); +nlmsg_free (msg); +return -ENOBUFS ; +}This seems weird.
Why?
Because it's strange to cancel then free?
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
net/ieee802154/netlink.c new file +5
-0+static int ieee802154_associate_req (struct sk_buff *skb,struct genl_info *info) +{ +struct net_device *dev; +struct ieee802154_addr addr; +int ret = -EINVAL ;Quoted 8 lines
net/ieee802154/netlink.c line 276
Quoted 6 lines
net/ieee802154/netlink.c new file +6
-0+ +if (!info->attrs[IEEE802154_ATTR_CHANNEL ] + || !info->attrs[IEEE802154_ATTR_COORD_PAN_ID ] + || (!info->attrs[IEEE802154_ATTR_COORD_HW_ADDR ] && !info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR ]) + || !info->attrs[IEEE802154_ATTR_CAPABILITY ]) +return -EINVAL ;That's some odd coding style.
Quoted 1 line
Could you please elaborate this? What seems odd to you?
if (X
&& Y)
vs
if (X &&
Y)
where the latter is used for all other sources files in the kernel. Try applying that to _all_ your patches while you rework the sources to fit into 80 columns.
johannes
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
2009/6/4 Johannes Berg <[email protected]>:
Quoted 12 lines · Dmitry Eremin-Solenikov
Quoted 11 lines
Quoted 10 lines
net/ieee802154/netlink.c line 89
Quoted 8 lines
net/ieee802154/netlink.c new file +7
-0+static int ieee802154_nl_put_failure (struct sk_buff *msg) +{ +void *hdr =genlmsg_data (NLMSG_DATA (msg->data));/* XXX: nlh is right at the start of msg */ +genlmsg_cancel (msg, hdr); +nlmsg_free (msg); +return -ENOBUFS ; +}This seems weird.
Quoted 3 lines
Quoted 1 line
Why?
Because it's strange to cancel then free?
From looking at the other code, the usual pattern for netlink is (please, correct me if I'm wrong):
int fill (....)
{
genlmsg_put();
NLA_PUT(...)
NLA_PUT(...)
return genlmsg_end();
nla_put_failure:
genlmsg_cancel();
return -EMSGSIZE;
}
int cmd(...)
{
int rc;
nlmsg_new();
rc = fill();
if (rc < 0)
goto out;
genlmsg_unicast();out:
nlmsg_free();
return -ENOBUFS;
}This is equivalent to our code:
sk_buff *new()
{
msg = nlmsg_new();
genlmsg_put();
return msg;
}
int finish()
{
genlmsg_end();
return genlmsg_unicast(); /*multicast in our case, but doesn't matter */
}int cancel()
{
genlmsg_cancel();
nlmsg_free();
return -ENOBUFS;
}
int cmd()
{
msg = new();
NLA_PUT()
NLA_PUT();
return finish();nla_put_failure:
return cancel();
}
Quoted 19 lines
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
net/ieee802154/netlink.c new file +5
-0+static int ieee802154_associate_req (struct sk_buff *skb,struct genl_info *info) +{ +struct net_device *dev; +struct ieee802154_addr addr; +int ret = -EINVAL ;Quoted 8 lines
Quoted 6 lines
+
+ if (!info->attrs[IEEE802154_ATTR_CHANNEL]+ || !info->attrs[IEEE802154_ATTR_COORD_PAN_ID] + || (!info->attrs[IEEE802154_ATTR_COORD_HW_ADDR] && !info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR]) + || !info->attrs[IEEE802154_ATTR_CAPABILITY])+ return
-EINVAL;That's some odd coding style.
Quoted 1 line
Could you please elaborate this? What seems odd to you?
if (X
&& Y)
Quoted 8 lines
vs
if (X &&
Y)where the latter is used for all other sources files in the kernel. Try applying that to _all_ your patches while you rework the sources to fit into 80 columns.
Fine, I'll apply the latter pattern and try to reformat code to fit to 80 columns.
Signature · 6 lines
With best wishes Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
Quoted 45 lines · Dmitry Eremin-Solenikov
2009/6/4 Johannes Berg <[email protected]>:
Quoted 10 lines · Dmitry Eremin-Solenikov
Quoted 9 lines
Quoted 9 lines
net/ieee802154/netlink.c line 89
Quoted 8 lines
net/ieee802154/netlink.c new file +7
-0+static int ieee802154_nl_put_failure (struct sk_buff *msg) +{ +void *hdr =genlmsg_data (NLMSG_DATA (msg->data));/* XXX: nlh is right at the start of msg */ +genlmsg_cancel (msg, hdr); +nlmsg_free (msg); +return -ENOBUFS ; +}This seems weird.
Quoted 4 lines
Quoted 1 line
Why?
Because it's strange to cancel then free?
From looking at the other code, the usual pattern for netlink is
(please, correct me if I'm wrong):
int fill (....)
{ genlmsg_put(); NLA_PUT(...) NLA_PUT(...) return genlmsg_end();
nla_put_failure:genlmsg_cancel(); return -EMSGSIZE; }int cmd(...)
{ int rc; nlmsg_new(); rc = fill(); if (rc < 0) goto out; genlmsg_unicast();out:
nlmsg_free(); return -ENOBUFS; }
Quoted 8 lines
This is equivalent to our code:
sk_buff*new(){ msg = nlmsg_new(); genlmsg_put(); return msg; }
canceling messages is only necessary in fill functions that are also used for dumps, where as many elements are stuffed in the skb as possible. When the last element doesn't completely fit, its removed again (canceled) and put into the next skb.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
2009/6/4 Patrick McHardy <[email protected]>:
Quoted 62 lines
Quoted 52 lines · Dmitry Eremin-Solenikov
2009/6/4 Johannes Berg <[email protected]>:
Quoted 14 lines · Dmitry Eremin-Solenikov
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
net/ieee802154/netlink.c new file +3
-0+static int ieee802154_nl_put_failure (struct sk_buff *msg) +{ +void *hdr =genlmsg_data (NLMSG_DATA (msg->data));/* XXX: nlh is right at the start of msg */
+genlmsg_cancel(msg, hdr);
+nlmsg_free(msg);
+ return-ENOBUFS;
+}This seems weird.
Quoted 5 lines
Quoted 1 line
Why?
Because it's strange to cancel then free?
From looking at the other code, the usual pattern for netlink is
(please, correct me if I'm wrong):
int fill (....)
{
genlmsg_put();
NLA_PUT(...)
NLA_PUT(...)
returngenlmsg_end();
nla_put_failure:
genlmsg_cancel();
return-EMSGSIZE;
}int cmd(...)
{
int rc;
nlmsg_new();rc =
fill();
if (rc < 0)
goto out;genlmsg_unicast();
out:
nlmsg_free();
return-ENOBUFS;
}Quoted 8 lines
This is equivalent to our code:
sk_buff*new()
{
msg =nlmsg_new();
genlmsg_put();
return msg;
}
Quoted 4 lines
canceling messages is only necessary in fill functions that are also used for dumps, where as many elements are stuffed in the skb as possible. When the last element doesn't completely fit, its removed again (canceled) and put into the next skb.
Understood. So you'd suggest just to drop the genlmsg_cancel() from the failure call chain?
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
Quoted 8 lines · Dmitry Eremin-Solenikov
2009/6/4 Patrick McHardy <[email protected]>:
Quoted 4 lines
canceling messages is only necessary in fill functions that are also used for dumps, where as many elements are stuffed in the skb as possible. When the last element doesn't completely fit, its removed again (canceled) and put into the next skb.
Understood. So you'd suggest just to drop the
genlmsg_cancel()from the failure call chain?
Yes.
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
In reply to Johannes BergQuoted 4 lines
include/net/ieee802154/nl802154.h line 73
Quoted 4 lines
include/net/ieee802154/nl802154.h new file +4
-0+#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) +#define NLA_HW_ADDR NLA_U64 +#define NLA_GET_HW_ADDR (attr, addr) do { u64 _temp = nla_get_u64(attr); memcpy(addr, &_temp, 8); } while (0) +#define NLA_PUT_HW_ADDR (msg, attr, addr) do { u64 _temp; memcpy(&_temp, addr, 8); NLA_PUT_U64(msg, attr, _temp); } while (0)
What would you propose here? adding prefix will add length to macro, IEEE802154_NL_PUT_HW_ADDR is damn long name. Using repeated code sequence is not better (it is error-prone and unreadable).
Any ideas?
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
Quoted 10 lines · Sergey Lapin
Quoted 4 lines
include/net/ieee802154/nl802154.h line 73
Quoted 4 lines
include/net/ieee802154/nl802154.h new file +4
-0+#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) +#define NLA_HW_ADDR NLA_U64 +#define NLA_GET_HW_ADDR (attr, addr) do { u64 _temp = nla_get_u64(attr); memcpy(addr, &_temp, 8); } while (0) +#define NLA_PUT_HW_ADDR (msg, attr, addr) do { u64 _temp; memcpy(&_temp, addr, 8); NLA_PUT_U64(msg, attr, _temp); } while (0)What would you propose here? adding prefix will add length to macro,
IEEE802154_NL_PUT_HW_ADDRis damn long name. Using repeated code sequence is not better (it is error-prone and unreadable).Any ideas?
Kill it and use nla_put(skb, attr, addr, 8);
Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
In reply to Johannes BergHi,
This doesn't address all the comments all comments by Johannes (as I didn't understood the two last one), but I'd like to post this heavily updated version.
Quoted 1 line
From
1aae1d7a60b104d271082c7612d1b9b9314c5949Mon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Thu, 4 Jun 2009 03:09:42 +0400
Subject: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices
Add a netlink interface for configuration of IEEE 802.15.4 device. Also this interface specifies events notification sent by devices towards higher layers.
--- include/net/ieee802154/nl802154.h | 137 +++++++++++ net/ieee802154/Makefile | 3 +- net/ieee802154/netlink.c | 489 +++++++++++++++++++++++++++++++++++++ net/ieee802154/nl_policy.c | 65 +++++ 4 files changed, 693 insertions(+), 1 deletions(-) create mode 100644 include/net/ieee802154/nl802154.h create mode 100644 net/ieee802154/netlink.c create mode 100644 net/ieee802154/nl_policy.c
include/net/ieee802154/nl802154.h new file +137 -0
@@ -0,0 +1,137 @@ +/* +* nl802154.h +* +* Copyright (C) 2007, 2008 Siemens AG +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +*/ + +#ifndef IEEE802154_NL_H +#define IEEE802154_NL_H + +#ifdef __KERNEL__ +#include <net/netlink.h> +#endif + +#define IEEE802154_NL_NAME "802.15.4 MAC" +#define IEEE802154_MCAST_COORD_NAME "coordinator" +#define IEEE802154_MCAST_BEACON_NAME "beacon" + +enum { + __IEEE802154_ATTR_INVALID, + +IEEE802154_ATTR_DEV_NAME , +IEEE802154_ATTR_DEV_INDEX , + +IEEE802154_ATTR_STATUS , + +IEEE802154_ATTR_SHORT_ADDR , +IEEE802154_ATTR_HW_ADDR , +IEEE802154_ATTR_PAN_ID , + +IEEE802154_ATTR_CHANNEL , + +IEEE802154_ATTR_COORD_SHORT_ADDR , +IEEE802154_ATTR_COORD_HW_ADDR , +IEEE802154_ATTR_COORD_PAN_ID , + +IEEE802154_ATTR_SRC_SHORT_ADDR , +IEEE802154_ATTR_SRC_HW_ADDR , +IEEE802154_ATTR_SRC_PAN_ID , + +IEEE802154_ATTR_DEST_SHORT_ADDR , +IEEE802154_ATTR_DEST_HW_ADDR , +IEEE802154_ATTR_DEST_PAN_ID , + +IEEE802154_ATTR_CAPABILITY , +IEEE802154_ATTR_REASON , +IEEE802154_ATTR_SCAN_TYPE , +IEEE802154_ATTR_CHANNELS , +IEEE802154_ATTR_DURATION , +IEEE802154_ATTR_ED_LIST , +IEEE802154_ATTR_BCN_ORD , +IEEE802154_ATTR_SF_ORD , +IEEE802154_ATTR_PAN_COORD , +IEEE802154_ATTR_BAT_EXT , +IEEE802154_ATTR_COORD_REALIGN , +IEEE802154_ATTR_SEC , + + __IEEE802154_ATTR_MAX, +}; + +#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) + +extern struct nla_policy ieee802154_policy[]; + +/* commands */ +/* REQ should be responded with CONF +* and INDIC with RESP +*/ +enum { + __IEEE802154_COMMAND_INVALID, + +IEEE802154_ASSOCIATE_REQ , +IEEE802154_ASSOCIATE_CONF , +IEEE802154_DISASSOCIATE_REQ , +IEEE802154_DISASSOCIATE_CONF , +IEEE802154_GET_REQ , +IEEE802154_GET_CONF , +IEEE802154_RESET_REQ , +IEEE802154_RESET_CONF , +IEEE802154_SCAN_REQ , +IEEE802154_SCAN_CONF , +IEEE802154_SET_REQ , +IEEE802154_SET_CONF , +IEEE802154_START_REQ , +IEEE802154_START_CONF , +IEEE802154_SYNC_REQ , +IEEE802154_POLL_REQ , +IEEE802154_POLL_CONF , + +IEEE802154_ASSOCIATE_INDIC , +IEEE802154_ASSOCIATE_RESP , +IEEE802154_DISASSOCIATE_INDIC , +IEEE802154_BEACON_NOTIFY_INDIC , +IEEE802154_ORPHAN_INDIC , +IEEE802154_ORPHAN_RESP , +IEEE802154_COMM_STATUS_INDIC , +IEEE802154_SYNC_LOSS_INDIC , + +IEEE802154_GTS_REQ ,/* Not supported yet */ +IEEE802154_GTS_INDIC ,/* Not supported yet */ +IEEE802154_GTS_CONF ,/* Not supported yet */ +IEEE802154_RX_ENABLE_REQ ,/* Not supported yet */ +IEEE802154_RX_ENABLE_CONF ,/* Not supported yet */ + + __IEEE802154_CMD_MAX, +}; + +#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) + + +#ifdef __KERNEL__ +struct net_device ; +struct ieee802154_addr ; + +int ieee802154_nl_assoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 cap); +int ieee802154_nl_assoc_confirm (struct net_device *dev,u16 short_addr,u8 status); +int ieee802154_nl_disassoc_indic (struct net_device *dev,struct ieee802154_addr *addr,u8 reason); +int ieee802154_nl_disassoc_confirm (struct net_device *dev,u8 status); +int ieee802154_nl_scan_confirm (struct net_device *dev,u8 status,u8 scan_type,u32 unscanned, +u8 *edl/*, struct list_head *pan_desc_list */ ); +int ieee802154_nl_beacon_indic (struct net_device *dev,u16 panid,u16 coord_addr);/* TODO */ +#endif + +#endif
net/ieee802154/Makefile +2 -1
@@ -1,4 +1,5 @@ -obj-$(CONFIG_IEEE802154) += af_802154.o +obj-$(CONFIG_IEEE802154) += nl802154.o af_802154.o +nl802154-objs := netlink.o nl_policy.o af_802154-objs := af_ieee802154.o raw.o dgram.o EXTRA_CFLAGS += -Wall -DDEBUG
net/ieee802154/netlink.c new file +489 -0
489 lines not on this page · raw message
net/ieee802154/nl_policy.c new file +65 -0
65 lines not on this page · raw message
Signature · 5 lines
1.6.3.1 -- With best wishes Dmitry
David Miller
maintainerRe: [PATCH 2/6] Add constants for the ieee 802.15.4/ZigBee stack
In reply to Dmitry Eremin-SolenikovFrom: Dmitry Eremin-Solenikov <[email protected]>
Date: Wed, 3 Jun 2009 13:33:45 +0400
Quoted 18 lines
IEEE 802.15.4/ZigBee stack requires several constants to be defined/adjusted.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>Signed-off-by Sergey Lapin <[email protected]>--- include/linux/if.h | 2 ++ include/linux/if_arp.h | 2 ++ include/linux/if_ether.h | 2 ++ include/linux/socket.h | 6 +++++- net/core/dev.c | 6 ++++-- net/core/sock.c | 3 +++ 6 files changed, 18 insertions(+), 3 deletions(-)include/linux/if.h +0
-0
include/linux/if.h line 75
Quoted 8 lines
include/linux/if.h +2
-0@@ -68,6 +68,8 @@#define IFF_MASTER_ARPMON 0x100/* bonding master, ARP mon in use */ #define IFF_WAN_HDLC 0x200/* WAN HDLC device */ +#define IFF_IEEE802154_COORD 0x100/* IEEE802.15.4 PAN coordinator */ +#define IF_GET_IFACE 0x0001/* for querying only */ #define IF_GET_PROTO 0x0002
This constant isn't used by any of these patches, and it's value overlaps that of IFF_MASTER_ARPMON so would need to be changed anyways.
I didn't check if other things in this patch turn out to be unused as well, please audit that.
Re: [PATCH 2/6] Add constants for the ieee 802.15.4/ZigBee stack
Quoted 34 lines · David Miller
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Wed, 3 Jun 2009 13:33:45 +0400Quoted 18 lines
IEEE 802.15.4/ZigBee stack requires several constants to be defined/adjusted.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>Signed-off-by Sergey Lapin <[email protected]>--- include/linux/if.h | 2 ++ include/linux/if_arp.h | 2 ++ include/linux/if_ether.h | 2 ++ include/linux/socket.h | 6 +++++- net/core/dev.c | 6 ++++-- net/core/sock.c | 3 +++ 6 files changed, 18 insertions(+), 3 deletions(-)include/linux/if.h +0
-0include/linux/if.h line 75
Quoted 8 lines
include/linux/if.h +2
-0@@ -68,6 +68,8 @@#define IFF_MASTER_ARPMON 0x100/* bonding master, ARP mon in use */ #define IFF_WAN_HDLC 0x200/* WAN HDLC device */ +#define IFF_IEEE802154_COORD 0x100/* IEEE802.15.4 PAN coordinator */ +#define IF_GET_IFACE 0x0001/* for querying only */ #define IF_GET_PROTO 0x0002This constant isn't used by any of these patches, and it's value overlaps that of
IFF_MASTER_ARPMONso would need to be changed anyways.
Quoted 2 lines
I didn't check if other things in this patch turn out to be unused as well, please audit that.
Please check the updated patch. We do request several unused in this serie value (like AF_ZIGBEE), but we'd like for them to be merged ASAP as their are a part of ABI.
Quoted 1 line
From
cda453105a17d8e97c57a25dacbdc0fc82a90f71Mon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Wed, 3 Jun 2009 14:43:38 +0400
Subject: [PATCH 2/6] Add constants for the ieee 802.15.4/ZigBee stack
IEEE 802.15.4/ZigBee stack requires several constants to be defined/adjusted.
--- include/linux/if_arp.h | 2 ++ include/linux/if_ether.h | 2 ++ include/linux/socket.h | 6 +++++- net/core/dev.c | 6 ++++-- net/core/sock.c | 3 +++ 5 files changed, 16 insertions(+), 3 deletions(-)
include/linux/if_arp.h +2 -0
@@ -86,6 +86,8 @@#define ARPHRD_IEEE80211 801/* IEEE 802.11 */ #define ARPHRD_IEEE80211_PRISM 802/* IEEE 802.11 + Prism2 header */ #define ARPHRD_IEEE80211_RADIOTAP 803/* IEEE 802.11 + radiotap header */ +#define ARPHRD_IEEE802154 804 +#define ARPHRD_IEEE802154_PHY 805#define ARPHRD_PHONET 820/* PhoNet media type */ #define ARPHRD_PHONET_PIPE 821/* PhoNet pipe header */
include/linux/if_ether.h +2 -0
@@ -106,6 +106,8 @@#define ETH_P_DSA 0x001B/* Distributed Switch Arch. */ #define ETH_P_TRAILER 0x001C/* Trailer switch tagging */ #define ETH_P_PHONET 0x00F5/* Nokia Phonet frames */ +#define ETH_P_IEEE802154 0x00F6/* IEEE802.15.4 frame */ +#define ETH_P_IEEE802154_MAC 0x00F7/* IEEE802.15.4 MAC frame */ /* * This is an Ethernet frame header.
include/linux/socket.h +5 -1
@@ -194,7 +194,9 @@ struct ucred {#define AF_RXRPC 33/* RxRPC sockets */ #define AF_ISDN 34/* mISDN sockets */ #define AF_PHONET 35/* Phonet sockets */ -#define AF_MAX 36/* For now.. */ +#define AF_IEEE802154 36/* IEEE802154 sockets */ +#define AF_ZIGBEE 37/* ZIGBEE sockets */ +#define AF_MAX 38/* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC
@@ -233,6 +235,8 @@ struct ucred {#define PF_RXRPC AF_RXRPC#define PF_ISDN AF_ISDN#define PF_PHONET AF_PHONET +#define PF_IEEE802154 AF_IEEE802154 +#define PF_ZIGBEE AF_ZIGBEE#define PF_MAX AF_MAX/* Maximum queue length specifiable by listen. */
net/core/dev.c +4 -2
@@ -268,7 +268,8 @@ static const unsigned short netdev_lock_type[] =ARPHRD_IRDA ,ARPHRD_FCPP ,ARPHRD_FCAL ,ARPHRD_FCPL ,ARPHRD_FCFABRIC ,ARPHRD_IEEE802_TR ,ARPHRD_IEEE80211 ,ARPHRD_IEEE80211_PRISM ,ARPHRD_IEEE80211_RADIOTAP ,ARPHRD_PHONET , - ARPHRD_PHONET_PIPE, ARPHRD_VOID, ARPHRD_NONE}; +ARPHRD_PHONET_PIPE ,ARPHRD_IEEE802154 ,ARPHRD_IEEE802154_PHY , + ARPHRD_VOID, ARPHRD_NONE};static const char *netdev_lock_name[] = {"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25",
@@ -285,7 +286,8 @@ static const char *netdev_lock_name[] ="_xmit_IRDA" ,"_xmit_FCPP" ,"_xmit_FCAL" ,"_xmit_FCPL" ,"_xmit_FCFABRIC" ,"_xmit_IEEE802_TR" ,"_xmit_IEEE80211" ,"_xmit_IEEE80211_PRISM" ,"_xmit_IEEE80211_RADIOTAP" ,"_xmit_PHONET" , - "_xmit_PHONET_PIPE", "_xmit_VOID", "_xmit_NONE"}; +"_xmit_PHONET_PIPE" ,"_xmit_IEEE802154" ,"_xmit_IEEE802154_PHY" , + "_xmit_VOID", "_xmit_NONE"};static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE (netdev_lock_type)];static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE (netdev_lock_type)];
net/core/sock.c +3 -0
@@ -155,6 +155,7 @@ static const char *af_family_key_strings[AF_MAX+1] = {"sk_lock-27" ,"sk_lock-28" ,"sk_lock-AF_CAN" ,"sk_lock-AF_TIPC" ,"sk_lock-AF_BLUETOOTH" ,"sk_lock-IUCV" ,"sk_lock-AF_RXRPC" ,"sk_lock-AF_ISDN" ,"sk_lock-AF_PHONET" , +"sk_lock-AF_IEEE802154" ,"sk_lock-AF_ZIGBEE" ,"sk_lock-AF_MAX" }; static const char *af_family_slock_key_strings[AF_MAX+1] = {
@@ -170,6 +171,7 @@ static const char *af_family_slock_key_strings[AF_MAX+1] = {"slock-27" ,"slock-28" ,"slock-AF_CAN" ,"slock-AF_TIPC" ,"slock-AF_BLUETOOTH" ,"slock-AF_IUCV" ,"slock-AF_RXRPC" ,"slock-AF_ISDN" ,"slock-AF_PHONET" , +"slock-AF_IEEE802154" ,"slock-AF_ZIGBEE" ,"slock-AF_MAX" }; static const char *af_family_clock_key_strings[AF_MAX+1] = {
@@ -185,6 +187,7 @@ static const char *af_family_clock_key_strings[AF_MAX+1] = {"clock-27" ,"clock-28" ,"clock-AF_CAN" ,"clock-AF_TIPC" ,"clock-AF_BLUETOOTH" ,"clock-AF_IUCV" ,"clock-AF_RXRPC" ,"clock-AF_ISDN" ,"clock-AF_PHONET" , +"clock-AF_IEEE802154" ,"clock-AF_ZIGBEE" ,"clock-AF_MAX" };
Signature · 10 lines
1.6.3.1 -- With best wishes Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerRe: [PATCH 2/6] Add constants for the ieee 802.15.4/ZigBee stack
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Wed, 3 Jun 2009 14:51:51 +0400
Quoted 3 lines
Please check the updated patch. We do request several unused in this serie value (like
AF_ZIGBEE), but we'd like for them to be merged ASAP as their are a part of ABI.
I don't allow anyone else to do this, and neither will I allow it for you either.
Merge it when the patches that use them are submitted.
And if it happens, you just might to change AF_ZIGBEE if that number is taken by another series of patches, that's just how it is. We don't reserve AF_* for people while they're getting their stuff ready.
This decision is final.
Re: [PATCH 2/6] Add constants for the ieee 802.15.4/ZigBee stack
Quoted 9 lines · David Miller
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Wed, 3 Jun 2009 14:51:51 +0400Quoted 3 lines
Please check the updated patch. We do request several unused in this serie value (like
AF_ZIGBEE), but we'd like for them to be merged ASAP as their are a part of ABI.I don't allow anyone else to do this, and neither will I allow it for you either.
Sorry, we didn't know about this policy. No need to be that harsh! Here is the cleaned up version.
Quoted 1 line
From
d1e359b7f66a4acc8b41bbeaeeeee4c81501e4bcMon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Thu, 4 Jun 2009 03:09:40 +0400
Subject: [PATCH 2/6] Add constants for the ieee 802.15.4/ZigBee stack
IEEE 802.15.4/ZigBee stack requires several constants to be defined/adjusted.
--- include/linux/if_arp.h | 2 ++ include/linux/if_ether.h | 1 + include/linux/socket.h | 4 +++- net/core/dev.c | 6 ++++-- net/core/sock.c | 3 +++ 5 files changed, 13 insertions(+), 3 deletions(-)
include/linux/if_arp.h +2 -0
@@ -86,6 +86,8 @@#define ARPHRD_IEEE80211 801/* IEEE 802.11 */ #define ARPHRD_IEEE80211_PRISM 802/* IEEE 802.11 + Prism2 header */ #define ARPHRD_IEEE80211_RADIOTAP 803/* IEEE 802.11 + radiotap header */ +#define ARPHRD_IEEE802154 804 +#define ARPHRD_IEEE802154_PHY 805#define ARPHRD_PHONET 820/* PhoNet media type */ #define ARPHRD_PHONET_PIPE 821/* PhoNet pipe header */
include/linux/if_ether.h +1 -0
@@ -106,6 +106,7 @@#define ETH_P_DSA 0x001B/* Distributed Switch Arch. */ #define ETH_P_TRAILER 0x001C/* Trailer switch tagging */ #define ETH_P_PHONET 0x00F5/* Nokia Phonet frames */ +#define ETH_P_IEEE802154 0x00F6/* IEEE802.15.4 frame */ /* * This is an Ethernet frame header.
include/linux/socket.h +3 -1
@@ -194,7 +194,8 @@ struct ucred {#define AF_RXRPC 33/* RxRPC sockets */ #define AF_ISDN 34/* mISDN sockets */ #define AF_PHONET 35/* Phonet sockets */ -#define AF_MAX 36/* For now.. */ +#define AF_IEEE802154 36/* IEEE802154 sockets */ +#define AF_MAX 37/* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC
@@ -233,6 +234,7 @@ struct ucred {#define PF_RXRPC AF_RXRPC#define PF_ISDN AF_ISDN#define PF_PHONET AF_PHONET +#define PF_IEEE802154 AF_IEEE802154#define PF_MAX AF_MAX/* Maximum queue length specifiable by listen. */
net/core/dev.c +4 -2
@@ -268,7 +268,8 @@ static const unsigned short netdev_lock_type[] =ARPHRD_IRDA ,ARPHRD_FCPP ,ARPHRD_FCAL ,ARPHRD_FCPL ,ARPHRD_FCFABRIC ,ARPHRD_IEEE802_TR ,ARPHRD_IEEE80211 ,ARPHRD_IEEE80211_PRISM ,ARPHRD_IEEE80211_RADIOTAP ,ARPHRD_PHONET , - ARPHRD_PHONET_PIPE, ARPHRD_VOID, ARPHRD_NONE}; +ARPHRD_PHONET_PIPE ,ARPHRD_IEEE802154 ,ARPHRD_IEEE802154_PHY , + ARPHRD_VOID, ARPHRD_NONE};static const char *netdev_lock_name[] = {"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25",
@@ -285,7 +286,8 @@ static const char *netdev_lock_name[] ="_xmit_IRDA" ,"_xmit_FCPP" ,"_xmit_FCAL" ,"_xmit_FCPL" ,"_xmit_FCFABRIC" ,"_xmit_IEEE802_TR" ,"_xmit_IEEE80211" ,"_xmit_IEEE80211_PRISM" ,"_xmit_IEEE80211_RADIOTAP" ,"_xmit_PHONET" , - "_xmit_PHONET_PIPE", "_xmit_VOID", "_xmit_NONE"}; +"_xmit_PHONET_PIPE" ,"_xmit_IEEE802154" ,"_xmit_IEEE802154_PHY" , + "_xmit_VOID", "_xmit_NONE"};static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE (netdev_lock_type)];static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE (netdev_lock_type)];
net/core/sock.c +3 -0
@@ -155,6 +155,7 @@ static const char *af_family_key_strings[AF_MAX+1] = {"sk_lock-27" ,"sk_lock-28" ,"sk_lock-AF_CAN" ,"sk_lock-AF_TIPC" ,"sk_lock-AF_BLUETOOTH" ,"sk_lock-IUCV" ,"sk_lock-AF_RXRPC" ,"sk_lock-AF_ISDN" ,"sk_lock-AF_PHONET" , +"sk_lock-AF_IEEE802154" ,"sk_lock-AF_MAX" }; static const char *af_family_slock_key_strings[AF_MAX+1] = {
@@ -170,6 +171,7 @@ static const char *af_family_slock_key_strings[AF_MAX+1] = {"slock-27" ,"slock-28" ,"slock-AF_CAN" ,"slock-AF_TIPC" ,"slock-AF_BLUETOOTH" ,"slock-AF_IUCV" ,"slock-AF_RXRPC" ,"slock-AF_ISDN" ,"slock-AF_PHONET" , +"slock-AF_IEEE802154" ,"slock-AF_MAX" }; static const char *af_family_clock_key_strings[AF_MAX+1] = {
@@ -185,6 +187,7 @@ static const char *af_family_clock_key_strings[AF_MAX+1] = {"clock-27" ,"clock-28" ,"clock-AF_CAN" ,"clock-AF_TIPC" ,"clock-AF_BLUETOOTH" ,"clock-AF_IUCV" ,"clock-AF_RXRPC" ,"clock-AF_ISDN" ,"clock-AF_PHONET" , +"clock-AF_IEEE802154" ,"clock-AF_MAX" };
Signature · 10 lines
1.6.3.1 -- With best wishes Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerRe: [PATCH 2/6] Add constants for the ieee 802.15.4/ZigBee stack
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Thu, 4 Jun 2009 03:15:37 +0400
Quoted 8 lines
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Thu, 4 Jun 2009 03:09:40 +0400
Subject: [PATCH 2/6] Add constants for the ieee 802.15.4/ZigBee stackIEEE 802.15.4/ZigBee stack requires several constants to be defined/adjusted.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>Signed-off-by Sergey Lapin <[email protected]>
Looks a lot better, except that there is no reason to mention ZigBee anymore in the commit message I guess :-)
Once all the feedback is sorted out, please make a formal resubmission of the entire series.
Thank you.
Re: [PATCH 1/6] crc-itu-t: add bit-reversed calculation
In reply to Dmitry Eremin-SolenikovOn Wed, 2009-06-03 at 13:33 +0400, Dmitry Eremin-Solenikov wrote:
[...]
Quoted 3 lines
+/**
+ *crc_itu_t_bitreversed- Compute the CRC-ITU-T for the data buffer;
+ * the buffer content is assumed to be bit-reversed
[...]
This short description spills onto two lines which is invalid and breaks the generation of docs. Sorry to point this out after recommending the patch to you.
I've changed the description to "crc_itu_t_bitreversed - Compute the CRC-ITU-T for a bit-reversed data buffer" all on one line.
Ben.
Signature · 2 lines
Ben Hutchings Logic doesn't apply to the real world. - Marvin Minsky
Re: [PATCH 1/6] crc-itu-t: add bit-reversed calculation
2009/6/3 Ben Hutchings <ben-/[email protected]>:
Quoted 5 lines · Dmitry Eremin-Solenikov
[...]
Quoted 3 lines
+/**
+ *crc_itu_t_bitreversed- Compute the CRC-ITU-T for the data buffer;
+ * the buffer content is assumed to be bit-reversed
Quoted 8 lines
[...]
This short description spills onto two lines which is invalid and breaks the generation of docs. Sorry to point this out after recommending the patch to you.
I've changed the description to "
crc_itu_t_bitreversed- Compute the CRC-ITU-T for a bit-reversed data buffer" all on one line.
Changing patch here in accordance with your suggestion.
Signature · 6 lines
With best wishes Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/6] crc-itu-t: add bit-reversed calculation
In reply to Ben HutchingsQuoted 5 lines · Ben Hutchings
On Wed, 2009-06-03 at 13:33 +0400, Dmitry Eremin-Solenikov wrote:
[...]Quoted 3 lines
+/**
+ *crc_itu_t_bitreversed- Compute the CRC-ITU-T for the data buffer;
+ * the buffer content is assumed to be bit-reversed
Quoted 8 lines
[...]
This short description spills onto two lines which is invalid and breaks the generation of docs. Sorry to point this out after recommending the patch to you.
I've changed the description to "
crc_itu_t_bitreversed- Compute the CRC-ITU-T for a bit-reversed data buffer" all on one line.
Anyway, this patch isn't necessary for the first round of patches, we are submitting now (got in by a mistake).
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 1/6] crc-itu-t: add bit-reversed calculation
In reply to Ben HutchingsHi,
Quoted 5 lines · Ben Hutchings
On Wed, 2009-06-03 at 13:33 +0400, Dmitry Eremin-Solenikov wrote:
[...]Quoted 3 lines
+/**
+ *crc_itu_t_bitreversed- Compute the CRC-ITU-T for the data buffer;
+ * the buffer content is assumed to be bit-reversed
Quoted 8 lines
[...]
This short description spills onto two lines which is invalid and breaks the generation of docs. Sorry to point this out after recommending the patch to you.
I've changed the description to "
crc_itu_t_bitreversed- Compute the CRC-ITU-T for a bit-reversed data buffer" all on one line.
Just another not w.r.t. this patch: one should add 'select BITREVERSE' to this Kconfig entry, as it depends on bitreversing stuff.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 1/6] crc-itu-t: add bit-reversed calculation
[non-HTML reply, sorry about that]
Quoted 15 lines · Dmitry Eremin-Solenikov
Hi,
Quoted 11 lines · Ben Hutchings
On Wed, 2009-06-03 at 13:33 +0400, Dmitry Eremin-Solenikov wrote:
[...]Quoted 3 lines
+/**
+ *crc_itu_t_bitreversed- Compute the CRC-ITU-T for the data buffer;
+ * the buffer content is assumed to be bit-reversed[...]
This short description spills onto two lines which is invalid and breaks the generation of docs. Sorry to point this out after recommending the patch to you.
Quoted 5 lines
Quoted 2 lines
I've changed the description to "
crc_itu_t_bitreversed- Compute the CRC-ITU-T for a bit-reversed data buffer" all on one line.Just another not w.r.t. this patch: one should add 'select BITREVERSE' to this
Kconfigentry, as it depends on bitreversing stuff.
What also might be interesting, have you checked the crc-ccitt algorithm? I had come across a crc_itu_t with bitreverse implementation in the past as well, and I could simplify the implementation by using crc-ccit and only call bitreverse on the last output. So something like:
u16 crc = crc_ccitt(~0, data, len);
u16 crc_itu_t = swab16(crc);
Instead of bitreverse for every step, only a single byteswap was needed. You need to check if this indeed works for your driver, but this would reduce the number of times bitrev is called, and also prevents the BITREV dependency for the crc implementation.
Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html