IEEE 802.15.4 implementation for Linux v1
Subsystems (9)
Hi,
As a part of research activities the Embedded Systems - Open Platform Group from Siemens Corporate Technology we are working on adding support for the IEEE 802.15.4 Wireless Personal Area Networks to the Linux. Our current implementation is neither certified nor even feature complete. However we'd like to present current state of our patchset to the Linux developers community to gain comments, fixes, ideas, etc. This is not yet a pull request, but more like an RFC.
The project page is available at http://apps.sourceforge.net/trac/linux-zigbee
with source code of kernel part available from git at
http://zigbee-linux.git.sourceforge.net, mirrored for convenience atgit://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.git
The source code for userspace utils is available from git at
http://linux-zigbee.git.sourceforge.net/
Changes since previous RFC:
* Split the code into socket family, netlink interface and separate
MAC 802.15.4 implementation.
* Add a sample driver for devices implementing mac level of IEEE 802.15.4 on their own.
* Major cleanup of public interfaces.
* Drop our CRC implementation and use a variant of CRC-ITU-T one
* Add preliminary version of AT86RF231 Atmel chip driver
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-review-v1
Darren Salt (1):
crc-itu-t: add bit-reversed calculation
Dmitry Eremin-Solenikov (9):
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 simple HardMAC driver sample
mac802154: add a software MAC 802.15.4 implementation
ieee802154: add virtual loopback driver
tty_io: export tty_class
ieee802154: add serial dongle driver
ieee802154: add at86rf230/rf231 spi driver
drivers/Makefile | 1 + drivers/char/tty_io.c | 1 + drivers/ieee802154/Kconfig | 42 ++ drivers/ieee802154/Makefile | 6 + drivers/ieee802154/at86rf230.c | 971 +++++++++++++++++++++++++++++++ drivers/ieee802154/fakehard.c | 253 ++++++++ drivers/ieee802154/fakelb.c | 335 +++++++++++ drivers/ieee802154/serial.c | 999 ++++++++++++++++++++++++++++++++ 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/linux/spi/at86rf230.h | 32 + include/linux/tty.h | 3 +- include/net/ieee802154/af_ieee802154.h | 60 ++ include/net/ieee802154/mac802154.h | 79 +++ 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 | 2 + net/Makefile | 2 + 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 ++++++++ net/mac802154/Kconfig | 13 + net/mac802154/Makefile | 5 + net/mac802154/beacon.c | 242 ++++++++ net/mac802154/beacon.h | 48 ++ net/mac802154/beacon_hash.c | 103 ++++ net/mac802154/beacon_hash.h | 40 ++ net/mac802154/dev.c | 843 +++++++++++++++++++++++++++ net/mac802154/mac802154.h | 64 ++ net/mac802154/mac_cmd.c | 325 +++++++++++ net/mac802154/main.c | 96 +++ net/mac802154/mdev.c | 283 +++++++++ net/mac802154/mib.h | 32 + net/mac802154/pib.c | 87 +++ net/mac802154/pib.h | 35 ++ net/mac802154/scan.c | 215 +++++++ 48 files changed, 7187 insertions(+), 4 deletions(-) create mode 100644 drivers/ieee802154/Kconfig create mode 100644 drivers/ieee802154/Makefile create mode 100644 drivers/ieee802154/at86rf230.c create mode 100644 drivers/ieee802154/fakehard.c create mode 100644 drivers/ieee802154/fakelb.c create mode 100644 drivers/ieee802154/serial.c create mode 100644 include/linux/spi/at86rf230.h create mode 100644 include/net/ieee802154/af_ieee802154.h create mode 100644 include/net/ieee802154/mac802154.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 create mode 100644 net/mac802154/Kconfig create mode 100644 net/mac802154/Makefile create mode 100644 net/mac802154/beacon.c create mode 100644 net/mac802154/beacon.h create mode 100644 net/mac802154/beacon_hash.c create mode 100644 net/mac802154/beacon_hash.h create mode 100644 net/mac802154/dev.c create mode 100644 net/mac802154/mac802154.h create mode 100644 net/mac802154/mac_cmd.c create mode 100644 net/mac802154/main.c create mode 100644 net/mac802154/mdev.c create mode 100644 net/mac802154/mib.h create mode 100644 net/mac802154/pib.c create mode 100644 net/mac802154/pib.h create mode 100644 net/mac802154/scan.c
--
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 1/10 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.2.4
PATCH 2/10 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.2.4
PATCH 3/10 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.2.4
PATCH 4/10 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.2.4 -- 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/10 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 | 23 ++++ drivers/ieee802154/Makefile | 3 + drivers/ieee802154/fakehard.c | 253 +++++++++++++++++++++++++++++++++++++++++ drivers/net/Kconfig | 2 + 5 files changed, 282 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 +23 -0
@@ -0,0 +1,23 @@ +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'. + +endif +
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 +253 -0
253 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 · 1 line
1.6.2.4
PATCH 6/10 mac802154: add a software MAC 802.15.4 implementation
Some of available devices are just dump radios implementing IEEE 802.15.4 PHY layer. This commit adds a common library that acts like an intermediate layer between our socket family and drivers for those dumb devices.
--- include/net/ieee802154/mac802154.h | 79 ++++ net/Kconfig | 1 + net/Makefile | 1 + net/mac802154/Kconfig | 13 + net/mac802154/Makefile | 5 + net/mac802154/beacon.c | 242 +++++++++++ net/mac802154/beacon.h | 48 ++ net/mac802154/beacon_hash.c | 103 +++++ net/mac802154/beacon_hash.h | 40 ++ net/mac802154/dev.c | 843 ++++++++++++++++++++++++++++++++++++ net/mac802154/mac802154.h | 64 +++ net/mac802154/mac_cmd.c | 325 ++++++++++++++ net/mac802154/main.c | 96 ++++ net/mac802154/mdev.c | 283 ++++++++++++ net/mac802154/mib.h | 32 ++ net/mac802154/pib.c | 87 ++++ net/mac802154/pib.h | 35 ++ net/mac802154/scan.c | 215 +++++++++ 18 files changed, 2512 insertions(+), 0 deletions(-) create mode 100644 include/net/ieee802154/mac802154.h create mode 100644 net/mac802154/Kconfig create mode 100644 net/mac802154/Makefile create mode 100644 net/mac802154/beacon.c create mode 100644 net/mac802154/beacon.h create mode 100644 net/mac802154/beacon_hash.c create mode 100644 net/mac802154/beacon_hash.h create mode 100644 net/mac802154/dev.c create mode 100644 net/mac802154/mac802154.h create mode 100644 net/mac802154/mac_cmd.c create mode 100644 net/mac802154/main.c create mode 100644 net/mac802154/mdev.c create mode 100644 net/mac802154/mib.h create mode 100644 net/mac802154/pib.c create mode 100644 net/mac802154/pib.h create mode 100644 net/mac802154/scan.c
include/net/ieee802154/mac802154.h new file +79 -0
@@ -0,0 +1,79 @@ +/* +* IEEE802.15.4-2003 specification +* +* 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. +* +* Written by: +*/ +#ifndef IEEE802154_MAC802154_H +#define IEEE802154_MAC802154_H + +/* FIXME: this can be merged with const.h ? */ +typedef enum { +PHY_BUSY =0 ,/* cca */ +PHY_BUSY_RX ,/* state */ +PHY_BUSY_TX ,/* state */ +PHY_FORCE_TRX_OFF , +PHY_IDLE ,/* cca */ +PHY_INVALID_PARAMETER ,/* pib get/set */ +PHY_RX_ON ,/* state */ +PHY_SUCCESS ,/* ed */ +PHY_TRX_OFF ,/* cca, ed, state */ +PHY_TX_ON ,/* cca, ed, state */ +PHY_UNSUPPORTED_ATTRIBUTE ,/* pib get/set */ +PHY_READ_ONLY ,/* pib get/set */ + +PHY_INVAL =-1 ,/* all */ +PHY_ERROR =-2 ,/* all */ +}phy_status_t ; + +struct ieee802154_dev { +const char *name; +int extra_tx_headroom;/* headroom to reserve for tx skb */ +void *priv;/* driver-specific data */ +u32 channel_mask; +u8 current_channel; +u32 flags;/* Flags for device to set */ +struct device *parent; +struct net_device *netdev;/* mwpanX device */ +}; + +/* Checksum is in hardware and is omitted from packet */ +#define IEEE802154_FLAGS_OMIT_CKSUM (1 << 0) + +struct sk_buff ; + +struct ieee802154_ops { +struct module *owner; +phy_status_t (*tx)(struct ieee802154_dev *dev,struct sk_buff *skb); +phy_status_t (*cca)(struct ieee802154_dev *dev); +phy_status_t (*ed)(struct ieee802154_dev *dev,u8 *level); +phy_status_t (*set_trx_state)(struct ieee802154_dev *dev,phy_status_t state); +phy_status_t (*set_channel)(struct ieee802154_dev *dev,int channel); +/* FIXME: PIB get/set ??? */ +}; + +struct ieee802154_dev *ieee802154_alloc_device (void ); +int ieee802154_register_device (struct ieee802154_dev *dev,struct ieee802154_ops *ops); +void ieee802154_unregister_device (struct ieee802154_dev *dev); +void ieee802154_free_device (struct ieee802154_dev *dev); + +int __deprecated ieee802154_add_slave (struct ieee802154_dev *hw,const u8 *addr); + +void ieee802154_rx (struct ieee802154_dev *dev,struct sk_buff *skb,u8 lqi); +void ieee802154_rx_irqsafe (struct ieee802154_dev *dev,struct sk_buff *skb,u8 lqi); +#endif +
net/Kconfig +1 -0
@@ -180,6 +180,7 @@ source "net/econet/Kconfig" source "net/wanrouter/Kconfig" source "net/phonet/Kconfig" source "net/ieee802154/Kconfig" +source "net/mac802154/Kconfig" source "net/sched/Kconfig" source "net/dcb/Kconfig"
net/Makefile +1 -0
@@ -61,6 +61,7 @@ ifneq ($(CONFIG_DCB),) obj-y += dcb/ endif obj-y += ieee802154/ +obj-y += mac802154/ ifeq ($(CONFIG_NET),y) obj-$(CONFIG_SYSCTL) += sysctl_net.o
net/mac802154/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +config MAC802154 + tristate "Generic IEEE 802.15.4 Soft Networking Stack (mac802154)" + depends on IEEE802154 && EXPERIMENTAL + select CRC_ITU_T + ---help--- + This option enables the hardware independent IEEE 802.15.4 + networking stack for SoftMAC devices (the ones implementing + only PHY level of IEEE 802.15.4 standard). + + If you plan to use HardMAC IEEE 802.15.4 devices, you can + say N here. Alternatievly you can say M to compile it as + module. +
net/mac802154/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +obj-$(CONFIG_MAC802154) += mac802154.o +mac802154-objs := main.o mdev.o pib.o dev.o mac_cmd.o scan.o \ + beacon.o beacon_hash.o + +EXTRA_CFLAGS += -Wall -DDEBUG
net/mac802154/beacon.c new file +242 -0
242 lines not on this page · raw message
net/mac802154/beacon.h new file +48 -0
48 lines not on this page · raw message
net/mac802154/beacon_hash.c new file +103 -0
103 lines not on this page · raw message
net/mac802154/beacon_hash.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* MAC beacon hash storage +* +* 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 IEEE802154_BEACON_HASH_H +#define IEEE802154_BEACON_HASH_H + +#define IEEE802154_BEACON_HTABLE_SIZE 256 + +struct beacon_node { +struct hlist_node list; +struct ieee802154_addr coord_addr; +u16 pan_addr; +}; +struct beacon_node *ieee802154_beacon_find_pan (struct ieee802154_addr *coord_addr, +u16 pan_addr); +void ieee802154_beacon_hash_add (struct ieee802154_addr *coord_addr); +void ieee802154_beacon_hash_del (struct ieee802154_addr *coord_addr); +void ieee802154_beacon_hash_dump (void ); +#endif +
net/mac802154/dev.c new file +843 -0
843 lines not on this page · raw message
net/mac802154/mac802154.h new file +64 -0
64 lines not on this page · raw message
net/mac802154/mac_cmd.c new file +325 -0
325 lines not on this page · raw message
net/mac802154/main.c new file +96 -0
96 lines not on this page · raw message
net/mac802154/mdev.c new file +283 -0
283 lines not on this page · raw message
net/mac802154/mib.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright 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 MIB802154_H +#define MIB802154_H + +/* FIXME: should be dropped in favour of generic MIB API */ +u8 ieee802154_dev_get_dsn (struct net_device *dev); +u8 ieee802154_dev_get_bsn (struct net_device *dev); +u16 ieee802154_dev_get_pan_id (struct net_device *dev); +u16 ieee802154_dev_get_short_addr (struct net_device *dev); +void ieee802154_dev_set_pan_id (struct net_device *dev,u16 val); +void ieee802154_dev_set_short_addr (struct net_device *dev,u16 val); +void ieee802154_dev_set_channel (struct net_device *dev,u8 chan); + + +#endif
net/mac802154/pib.c new file +87 -0
87 lines not on this page · raw message
net/mac802154/pib.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 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 PIB802154_H +#define PIB802154_H + +struct ieee802154_pib { +int type; +u32 val; +}; + +#define IEEE802154_PIB_CURCHAN 0/* Current channel, u8 6.1.2 */ +#define IEEE802154_PIB_CHANSUPP 1/* Channel mask, u32 6.1.2 */ +#define IEEE802154_PIB_TRPWR 2/* Transmit power, u8 6.4.2 */ +#define IEEE802154_PIB_CCAMODE 3/* CCA mode, u8 6.7.9 */ + +int ieee802154_pib_set (struct ieee802154_dev *hw,struct ieee802154_pib *pib); +int ieee802154_pib_get (struct ieee802154_dev *hw,struct ieee802154_pib *pib); + +#endif
net/mac802154/scan.c new file +215 -0
215 lines not on this page · raw message
Signature · 1 line
1.6.2.4
PATCH 7/10 ieee802154: add virtual loopback driver
fakelb is a virtual loopback driver implementing one or several interconnected radios. Packets from the radio are either sent back to the node (if no other fake radio are registered) or to all other fake radio.
--- drivers/ieee802154/Kconfig | 11 ++ drivers/ieee802154/Makefile | 1 + drivers/ieee802154/fakelb.c | 335 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 347 insertions(+), 0 deletions(-) create mode 100644 drivers/ieee802154/fakelb.c
drivers/ieee802154/Kconfig +11 -0
@@ -19,5 +19,16 @@ config IEEE802154_FAKEHARD This driver can also be built as a module. To do so say M here. The module will be called 'fakehard'. + +if IEEE802154_DRIVERS && MAC802154 +config IEEE802154_FAKELB + tristate "Fake LR-WPAN driver with several interconnected devices" + ---help--- + Say Y here to enable the fake driver that can emulate a net + of several interconnected radio devices. + + This driver can also be built as a module. To do so say M here. + The module will be called 'fakelb'. + endif
drivers/ieee802154/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o +obj-$(CONFIG_IEEE802154_FAKELB) += fakelb.o EXTRA_CFLAGS += -DDEBUG -DCONFIG_FFD
drivers/ieee802154/fakelb.c new file +335 -0
335 lines not on this page · raw message
Signature · 6 lines
1.6.2.4 -- 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 8/10 tty_io: export tty_class
Currently tty_class in a public variable in the tty_io.c Export it to the modules to allow some usefull tricks.
--- drivers/char/tty_io.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/char/tty_io.c +1 -0
@@ -2809,6 +2809,7 @@ int tty_put_char(struct tty_struct *tty, unsigned char ch)EXPORT_SYMBOL_GPL (tty_put_char);struct class *tty_class; +EXPORT_SYMBOL (tty_class);/** * tty_register_device - register a tty device
Signature · 6 lines
1.6.2.4 -- 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 9/10 ieee802154: add serial dongle driver
Add a tty ldisc supporting IEEE 802.15.4 over serial line. Currently the only protocol implemented/device supported is our firmware for Freescale 13192 evaluation boards.
--- drivers/ieee802154/Kconfig | 3 + drivers/ieee802154/Makefile | 1 + drivers/ieee802154/serial.c | 999 +++++++++++++++++++++++++++++++++++++++++++ include/linux/tty.h | 3 +- 4 files changed, 1005 insertions(+), 1 deletions(-) create mode 100644 drivers/ieee802154/serial.c
drivers/ieee802154/Kconfig +3 -0
@@ -30,5 +30,8 @@ config IEEE802154_FAKELB This driver can also be built as a module. To do so say M here. The module will be called 'fakelb'. +config IEEE802154_SERIAL + tristate "Simple LR-WPAN UART driver" + endif
drivers/ieee802154/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o obj-$(CONFIG_IEEE802154_FAKELB) += fakelb.o +obj-$(CONFIG_IEEE802154_SERIAL) += serial.o EXTRA_CFLAGS += -DDEBUG -DCONFIG_FFD
drivers/ieee802154/serial.c new file +999 -0
999 lines not on this page · raw message
include/linux/tty.h +2 -1
@@ -23,7 +23,7 @@*/ #define NR_UNIX98_PTY_DEFAULT 4096/* Default maximum for Unix98 ptys */ #define NR_UNIX98_PTY_MAX (1 << MINORBITS)/* Absolute limit */ -#define NR_LDISCS 19 +#define NR_LDISCS 20/* line disciplines */ #define N_TTY 0
@@ -46,6 +46,7 @@#define N_GIGASET_M101 16/* Siemens Gigaset M101 serial DECT adapter */ #define N_SLCAN 17/* Serial / USB serial CAN Adaptors */ #define N_PPS 18/* Pulse per Second */ +#define N_IEEE802154 19/* Serial / USB serial IEEE802154.4 devices */ /* * This character is the same as _POSIX_VDISABLE: it cannot be used as
Signature · 6 lines
1.6.2.4 -- 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 10/10 ieee802154: add at86rf230/rf231 spi driver
Add a driver handling AT86RF230/RF231 line of chips. Only basic features are currently implemented (no extended mode operation, etc.) Also the RF230 chip is not really supported yet.
--- drivers/ieee802154/Kconfig | 5 + drivers/ieee802154/Makefile | 1 + drivers/ieee802154/at86rf230.c | 971 ++++++++++++++++++++++++++++++++++++++++ include/linux/spi/at86rf230.h | 32 ++ 4 files changed, 1009 insertions(+), 0 deletions(-) create mode 100644 drivers/ieee802154/at86rf230.c create mode 100644 include/linux/spi/at86rf230.h
drivers/ieee802154/Kconfig +5 -0
@@ -33,5 +33,10 @@ config IEEE802154_FAKELB config IEEE802154_SERIAL tristate "Simple LR-WPAN UART driver" +config IEEE802154_AT86RF230 + tristate "AT86RF230 transceiver driver" + depends on SPI + + endif
drivers/ieee802154/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o obj-$(CONFIG_IEEE802154_FAKELB) += fakelb.o obj-$(CONFIG_IEEE802154_SERIAL) += serial.o +obj-$(CONFIG_IEEE802154_AT86RF230) += at86rf230.o EXTRA_CFLAGS += -DDEBUG -DCONFIG_FFD
drivers/ieee802154/at86rf230.c new file +971 -0
971 lines not on this page · raw message
include/linux/spi/at86rf230.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* AT86RF230/RF231 driver +* +* Copyright (C) 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: +* Dmitry Eremin-Solenikov <[email protected]> +*/ +#ifndef AT86RF230_H +#define AT86RF230_H + +struct at86rf230_platform_data { +int rstn; +int slp_tr; +int dig2; +}; + +#endif +
Signature · 6 lines
1.6.2.4 -- 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 10/10] ieee802154: add at86rf230/rf231 spi driver
Quoted 10 lines · Dmitry Eremin-Solenikov
Add a driver handling AT86RF230/RF231 line of chips. Only basic features are currently implemented (no extended mode operation, etc.) Also the RF230 chip is not really supported yet.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>Signed-off-by Sergey Lapin <[email protected]>---
drivers/ieee802154/Kconfig | 5 +drivers/ieee802154/Makefile| 1 +drivers/ieee802154/at86rf230.c| 971 ++++++++++++++++++++++++++++++++++++++++
Shouldn't this go into drivers/net/ieee802154 instead?
--
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 10/10] ieee802154: add at86rf230/rf231 spi driver
Quoted 6 lines · Gábor Stefanik
Quoted 4 lines · Dmitry Eremin-Solenikov
Add a driver handling AT86RF230/RF231 line of chips. Only basic features are currently implemented (no extended mode operation, etc.) Also the RF230 chip is not really supported yet.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>Signed-off-by Sergey Lapin <[email protected]>---
drivers/ieee802154/Kconfig | 5 +drivers/ieee802154/Makefile| 1 +drivers/ieee802154/at86rf230.c| 971 ++++++++++++++++++++++++++++++++++++++++Shouldn't this go into
drivers/net/ieee802154instead?
I thought about drivers/net as about ip (well, more or less) network drivers. We have drivers/atm or drivers/bluetooth (and bluetooth is 802.15.1...). So we've used just drivers/ieee802154. If you say so, we will move to drivers/net.
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 10/10] ieee802154: add at86rf230/rf231 spi driver
Quoted 3 lines
I thought about
drivers/netas about ip (well, more or less) network drivers. We havedrivers/atmordrivers/bluetooth(and bluetooth is 802.15.1...).
I actually like that this is drivers/bluetooth and not drivers/ieee802151. Would you consider drivers/zigbee instead of drivers/ieee802154 ???
Re: [PATCH 10/10] ieee802154: add at86rf230/rf231 spi driver
Hi Holger,
Quoted 7 lines
Quoted 3 lines
I thought about
drivers/netas about ip (well, more or less) network drivers. We havedrivers/atmordrivers/bluetooth(and bluetooth is 802.15.1...).I actually like that this is
drivers/bluetoothand notdrivers/ieee802151. Would you considerdrivers/zigbeeinstead ofdrivers/ieee802154???
I fully agree here.
Please use "zigbee" instead of "ieee*" names since that can become messy and confusing. I know that in theory the IEEE part of ZigBee is more low-level radio and could be used by non-ZigBee devices, but that is not gonna happen anyway. Especially with Bluetooth Low Energy pushing into the turf of ZigBee. So please use proper names and not confuse people with IEEE numbers ;)
Regards
Marcel
--
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 10/10] ieee802154: add at86rf230/rf231 spi driver
2009/6/2, Marcel Holtmann <[email protected]>:
Quoted 10 lines
Hi Holger,
Quoted 7 lines
Quoted 3 lines
I thought about
drivers/netas about ip (well, more or less) network drivers. We havedrivers/atmordrivers/bluetooth(and bluetooth is 802.15.1...).I actually like that this is
drivers/bluetoothand notdrivers/ieee802151. Would you considerdrivers/zigbeeinstead ofdrivers/ieee802154???
Quoted 8 lines
I fully agree here.
Please use "zigbee" instead of "ieee*" names since that can become messy and confusing. I know that in theory the IEEE part of ZigBee is more low-level radio and could be used by non-ZigBee devices, but that is not gonna happen anyway. Especially with Bluetooth Low Energy pushing into the turf of ZigBee. So please use proper names and not confuse people with IEEE numbers ;)
This gonna happen, as we are most probably going to implement 6lowpan on top of our stack. 6lowpan is a way to encapsulate IPv6 frames into IEEE 802.15.4 and has nothing in common with ZigBee. Moreover ZigBee is a trademark with strict rules upon it's usage. Our lawyers are currently investigating if it's possible to use this name in projects like Linux kernel which are open-source, non-related to any project but OTOH can be encapsulated in any commercial project.
IEEE 802.15.4 is a term like IEEE 802.11. We do have mac80211, we have had (until recently) ieee80211 dir, so why bother?
For Bluetooth naming directories 'bluetooth' is logical, as 802.15.1 standard is a less known name, doesn't incorporate latest changes from Bluetooth, etc.
Signature · 2 lines
With best wishes Dmitry
Re: Ответ: [PATCH 10/10] ieee802154: add at86rf230/rf231 spi driver
Hi Dmitry,
Quoted 25 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
I thought about
drivers/netas about ip (well, more or less) network drivers. We havedrivers/atmordrivers/bluetooth(and bluetooth is 802.15.1...).I actually like that this is
drivers/bluetoothand notdrivers/ieee802151. Would you considerdrivers/zigbeeinstead ofdrivers/ieee802154???Quoted 8 lines
I fully agree here.
Please use "zigbee" instead of "ieee*" names since that can become messy and confusing. I know that in theory the IEEE part of ZigBee is more low-level radio and could be used by non-ZigBee devices, but that is not gonna happen anyway. Especially with Bluetooth Low Energy pushing into the turf of ZigBee. So please use proper names and not confuse people with IEEE numbers ;)
This gonna happen, as we are most probably going to implement 6lowpan on top of our stack. 6lowpan is a way to encapsulate IPv6 frames into IEEE 802.15.4 and has nothing in common with ZigBee. Moreover ZigBee is a trademark with strict rules upon it's usage. Our lawyers are currently investigating if it's possible to use this name in projects like Linux kernel which are open-source, non-related to any project but OTOH can be encapsulated in any commercial project.
Quoted 6 lines
IEEE 802.15.4 is a term like IEEE 802.11. We do have mac80211, we have had (until recently) ieee80211 dir, so why bother?
For Bluetooth naming directories 'bluetooth' is logical, as 802.15.1 standard is a less known name, doesn't incorporate latest changes from Bluetooth, etc.
and so is IEEE 802.15.4 hence we propose using "zigbee" here. Using the mac80211 has historical reasons and 802.11 is a known name and even used on product marketing material. IEEE 802.15.4 is not. We are also using the term "wimax" and not its IEEE numbering.
Regards
Marcel
Re: Ответ: [PATCH 10/10] ieee802154: add at86rf230/rf231 spi driver
Quoted 11 lines · Marcel Holtmann
Quoted 11 lines
This gonna happen, as we are most probably going to implement 6lowpan on top of our stack. 6lowpan is a way to encapsulate IPv6 frames into IEEE 802.15.4 and has nothing in common with ZigBee. Moreover ZigBee is a trademark with strict rules upon it's usage. Our lawyers are currently investigating if it's possible to use this name in projects like Linux kernel which are open-source, non-related to any project but OTOH can be encapsulated in any commercial project.
IEEE 802.15.4 is a term like IEEE 802.11. We do have mac80211, we have had (until recently) ieee80211 dir, so why bother?
Quoted 8 lines
Quoted 3 lines
For Bluetooth naming directories 'bluetooth' is logical, as 802.15.1 standard is a less known name, doesn't incorporate latest changes from Bluetooth, etc.
and so is IEEE 802.15.4 hence we propose using "zigbee" here. Using the mac80211 has historical reasons and 802.11 is a known name and even used on product marketing material. IEEE 802.15.4 is not. We are also using the term "wimax" and not its IEEE numbering.
That WILL add confusion. Because of the following:
1. IEEE 802.15.4 is layer under ZigBee. ZigBee is implemented on top of IEEE 802.15.4, like UDP is implemented on top of IP.
2. There are hardware implementations of the following sorts:
a) Simple radio (IEEE 802.15.4 PHY).
b) IEEE 802.15.4 MAC
c) ZigBee, or other high level protocols (well, actually I don't know of any others than ZigBee at this level, but that doesn't mean they don't exist).
Using this stack we can implement both a) and b). With addition of ZigBee layers, it might be possible to implement c), too. For things like 6lowpan, only a) and b) are useful. If you call this all ZigBee, it will add confusion and artifical limitation. Not to mention, not true. And just for cosmetic measures. That will be a lot of trouble and no practical gain from that.
References:
RFC-4919
RFC-4944
All the best,
S.
--
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 10/10] ieee802154: add at86rf230/rf231 spi driver
In reply to Marcel HoltmannLe Tuesday 02 June 2009 10:36:49 Marcel Holtmann, vous avez écrit :
Quoted 30 lines
Hi Dmitry,
Quoted 28 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
I thought about
drivers/netas about ip (well, more or less) network drivers. We havedrivers/atmordrivers/bluetooth(and bluetooth is 802.15.1...).I actually like that this is
drivers/bluetoothand notdrivers/ieee802151. Would you considerdrivers/zigbeeinstead ofdrivers/ieee802154???Quoted 8 lines
I fully agree here.
Please use "zigbee" instead of "ieee*" names since that can become messy and confusing. I know that in theory the IEEE part of ZigBee is more low-level radio and could be used by non-ZigBee devices, but that is not gonna happen anyway. Especially with Bluetooth Low Energy pushing into the turf of ZigBee. So please use proper names and not confuse people with IEEE numbers ;)
This gonna happen, as we are most probably going to implement 6lowpan on top of our stack. 6lowpan is a way to encapsulate IPv6 frames into IEEE 802.15.4 and has nothing in common with ZigBee. Moreover ZigBee is a trademark with strict rules upon it's usage. Our lawyers are currently investigating if it's possible to use this name in projects like Linux kernel which are open-source, non-related to any project but OTOH can be encapsulated in any commercial project.
IEEE 802.15.4 is a term like IEEE 802.11. We do have mac80211, we have had (until recently) ieee80211 dir, so why bother?
Quoted 8 lines
Quoted 3 lines
For Bluetooth naming directories 'bluetooth' is logical, as 802.15.1 standard is a less known name, doesn't incorporate latest changes from Bluetooth, etc.
and so is IEEE 802.15.4 hence we propose using "zigbee" here. Using the mac80211 has historical reasons and 802.11 is a known name and even used on product marketing material. IEEE 802.15.4 is not. We are also using the term "wimax" and not its IEEE numbering.
Because you have an IEEE 802.15.4 PHY/MAC chip does not mean you want to do ZigBee on top of it and Dmitry explained that well. I would stick with the ieee802154 name here for that reason. If your drivers go in ZigBee, it means that your hardware implements parts of the ZigBee profiles, and that is not the case here.
The current Bluetooth implementation in the kernel deserves its name since drivers are implementing the HCI Bluetooth profile (maybe others as well), that is not plain IEEE 802.15.1.
Signature · 4 lines
Best regards, Florian Fainelli Email : [email protected] http://openwrt.org -------------------------------
Re: Ответ: [PATCH 10/10] ieee802154: add at86rf230/rf231 spi driver
In reply to Marcel HoltmannHi Marcel,
Quoted 8 lines · Marcel Holtmann
Quoted 3 lines
For Bluetooth naming directories 'bluetooth' is logical, as 802.15.1 standard is a less known name, doesn't incorporate latest changes from Bluetooth, etc.
and so is IEEE 802.15.4 hence we propose using "zigbee" here. Using the mac80211 has historical reasons and 802.11 is a known name and even used on product marketing material. IEEE 802.15.4 is not. We are also using the term "wimax" and not its IEEE numbering.
Actually, ieee802154 is better in this case, because as Dmitry mentioned, an entire family of standards is implemented on the top of it, including:
- ZigBee
- 6LoWPAN
- ISA100.11a
- WirelessHART
- and probably something I don't know about
All of them (once implemented) will use ieee802.15.4 drivers. It is better to avoid future confusion and use correct terminology from the very beginning.
Kind regards,
Maxim
Re: Ответ: [PATCH 10/10] ieee802154: add at86rf230/rf231 spi driver
Quoted 5 lines
- ZigBee
- 6LoWPAN
- ISA100.11a
- WirelessHART
- and probably something I don't know about
You now convinced at least me :-)
Re: ?????: [PATCH 10/10] ieee802154: add at86rf230/rf231 spi driver
In reply to Maxim OsipovQuoted 15 lines · Maxim Osipov
Hi Marcel,
Quoted 7 lines · Marcel Holtmann
Quoted 3 lines
For Bluetooth naming directories 'bluetooth' is logical, as 802.15.1 standard is a less known name, doesn't incorporate latest changes from Bluetooth, etc.
and so is IEEE 802.15.4 hence we propose using "zigbee" here. Using the mac80211 has historical reasons and 802.11 is a known name and even used on product marketing material. IEEE 802.15.4 is not. We are also using the term "wimax" and not its IEEE numbering.
Actually, ieee802154 is better in this case, because as Dmitry mentioned, an entire family of standards is implemented on the top of it, including:
Quoted 5 lines
- ZigBee
- 6LoWPAN
- ISA100.11a
- WirelessHART
- and probably something I don't know about
I'll tack on tosmac (the tinyos protocol).
The platforms I support have out of kernel support for a cc2420 (802.15.4) radio using that protocol. In the embedded sensors field it seems to be pretty common to use linux nodes as gateways to systems running various realtime / light weight OSes.
As Maxim stated there are a lot of protocols out there.
Thank you to Dmitry and co for your work on this project, I'll be following your progress with interest (and when I have a sec adding support for the cc2420 if no one else does it first ;)
---
Jonathan Cameron
Re: ?????: [PATCH 10/10] ieee802154: add at86rf230/rf231 spi driver
2009/6/2 Jonathan Cameron <[email protected]>:
Quoted 3 lines
Thank you to Dmitry and co for your work on this project, I'll be following your progress with interest (and when I have a sec adding support for the cc2420 if no one else does it first ;)
We will be waiting with interest for these patches. We don't have the cc2420 hw at hand, so we won't work on support for it in the foreseeble (1-3 moths :)) time.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 09/10] ieee802154: add serial dongle driver
In reply to Dmitry Eremin-Solenikovdrivers/ieee802154/serial.c line 200
Quoted 10 lines
drivers/ieee802154/serial.c new file +10
-0+ zbdev->pending_data =kzalloc (zbdev->pending_size,GFP_KERNEL ); +if (!zbdev->pending_data) { +printk (KERN_ERR "%s(): unable to allocate memory\n" , __func__); + zbdev->pending_id =0 ; + zbdev->pending_size =0 ; +return -ENOMEM ; + } +memcpy (zbdev->pending_data, buf, len); + +return _send_pending_data (zbdev);
Where do you check that the tty has enough space ?
drivers/ieee802154/serial.c line 442
Quoted 7 lines
drivers/ieee802154/serial.c new file +7
-0+case STATE_WAIT_COMMAND : +if (is_command (c)) { + zbdev->id = c; + zbdev->state =STATE_WAIT_PARAM1 ; + }else { +cleanup (zbdev); +printk (KERN_ERR "%s, unexpected command id: %x\n" , __func__, c);
In all these ERR cases what stops a remote device from having fun spewing garbage at you and filling the log ?
drivers/ieee802154/serial.c line 573
Quoted 8 lines
drivers/ieee802154/serial.c new file +7
-0+* channels 0-10 are not valid for us */ +BUG_ON (channel <11 || channel >26 ); +/* ... but our crappy firmware numbers channels from 1 to 16 +* which is a mystery. We suould enforce that using PIB API +* but additional checking here won't kill, and gcc will +* optimize this stuff anyway. */ +BUG_ON ((channel -10 ) <1 && (channel -10 ) >16 );
Shouldn't be driver specific hacks in the ldisc surely - or is the ldisc only applicable to a specific single bit of hardware ?
drivers/ieee802154/serial.c line 811
Quoted 3 lines
+ minor =
tty->index+tty->driver->minor_start;drivers/ieee802154/serial.c new file +2
-0+ zbdev->dev->parent =class_find_device (tty_class,NULL , &minor, dev_minor_match); +
That sort of thing shouldn't be buried in the depths of a driver. I'm not entirely averse to that sort of thing but it belongs in a helper in the tty layer.
drivers/ieee802154/serial.c line 812
Quoted 1 line
drivers/ieee802154/serial.c new file +1
-0+ zbdev->tty = tty;
Refcounting ?
drivers/ieee802154/serial.c line 817
Quoted 5 lines
drivers/ieee802154/serial.c new file +5
-0+cleanup (zbdev); + + tty->disc_data = zbdev; + tty->receive_room =MAX_DATA_SIZE ; + tty->low_latency =1 ;
You can't go around mashing driver internal values - many drivers don't support low_latency mode and this will make them crash.
drivers/ieee802154/serial.c line 821
Quoted 4 lines
drivers/ieee802154/serial.c new file +4
-0+ +/* FIXME: why is this needed. Note don't use ldisc_ref here as the +open path is before the ldisc is referencable */ +
[Because otherwise after a SET_LDISC there may be bits from the old stuff
left over - this one will go away as I finish the ldisc switching rewrite that is in the ttydev tree]
Quoted 10 lines
drivers/ieee802154/serial.c new file +10
-0+/* +* Called when the tty is put into another line discipline or it hangs up. We +* have to wait for any cpu currently executing in any of the other zb_tty_* +* routines to finish before we can call zb_tty_close and free the +* zb_serial_dev struct. This routine must be called from process context, not +* interrupt or softirq context. +*/ +static void +ieee802154_tty_close (struct tty_struct *tty) +{
drivers/ieee802154/serial.c line 868
Quoted 10 lines
drivers/ieee802154/serial.c new file +10
-0+struct zb_device *zbdev; + + zbdev = tty->disc_data; +if (NULL == zbdev) { +printk (KERN_WARNING "%s: match is not found\n" , __func__); +return ; + } + + tty->disc_data =NULL ; + zbdev->tty =NULL ;
Again you want a refcount on these I suspect. You may actually be safe anyway but it would be cleaner to take/drop refs.
Quoted 6 lines
drivers/ieee802154/serial.c new file +6
-0+static int +ieee802154_tty_ioctl (struct tty_struct *tty,struct file *file,unsigned int cmd,unsigned long arg) +{ +struct zb_device *zbdev; +struct ifreq ifr; +int err;
drivers/ieee802154/serial.c line 907
Quoted 10 lines
drivers/ieee802154/serial.c new file +10
-0+void __user *argp = (void __user *) arg; + +pr_debug ("cmd = 0x%x\n" , cmd); +memset (&ifr,0 ,sizeof (ifr)); + + zbdev = tty->disc_data; +if (NULL == zbdev) { +pr_debug ("match is not found\n" ); +return -EINVAL ; + }
If that is NULL it's a serious bug so WARN on it I think
drivers/ieee802154/serial.c line 921
Quoted 3 lines
drivers/ieee802154/serial.c new file +3
-0+default : +pr_debug ("Unknown ioctl cmd: %u\n" , cmd); +return -EINVAL ;
This will break default ioctl processing. You probably want to call into some of the generic handlers at this point depending upon your hardware. Either way -EINVAL is wrong.
Review
Quoted 2 lines
(quoted diff) +2
-0+ } + return 0;
Unreachable
drivers/ieee802154/serial.c line 941
Quoted 11 lines
drivers/ieee802154/serial.c new file +11
-0+static void +ieee802154_tty_receive (struct tty_struct *tty,const unsigned char *buf,char *cflags,int count) +{ +struct zb_device *zbdev; +int i; + +/* Debug info */ +printk (KERN_INFO "%lu %s, received %d bytes:" , jiffies, __func__, count); +for (i =0 ; i < count; ++i) +printk (KERN_CONT " 0x%02X" , buf[i]); +printk (KERN_CONT "\n" );
I don't think the above is meant to be there....
Re: [PATCH 09/10] ieee802154: add serial dongle driver
Thanks for the review, Alan,
Quoted 4 lines · Alan Cox
Quoted 4 lines
drivers/ieee802154/serial.c new file +4
-0+ zbdev->pending_data =kzalloc (zbdev->pending_size,GFP_KERNEL ); +if (!zbdev->pending_data) { +printk (KERN_ERR "%s(): unable to allocate memory\n" , __func__); + zbdev->pending_id =0 ;
Quoted 8 lines
drivers/ieee802154/serial.c line 200
Quoted 6 lines
drivers/ieee802154/serial.c new file +6
-0+ zbdev->pending_size =0 ; +return -ENOMEM ; + } +memcpy (zbdev->pending_data, buf, len); + +return _send_pending_data (zbdev);Where do you check that the tty has enough space ?
Basically that means checking for ->write result, doesn't it?
Quoted 12 lines
drivers/ieee802154/serial.c line 442
Quoted 9 lines
drivers/ieee802154/serial.c new file +7
-0+case STATE_WAIT_COMMAND : +if (is_command (c)) { + zbdev->id = c; + zbdev->state =STATE_WAIT_PARAM1 ; + }else { +cleanup (zbdev); +printk (KERN_ERR "%s, unexpected command id: %x\n" , __func__, c);In all these ERR cases what stops a remote device from having fun spewing garbage at you and filling the log ?
And what stops your precious IDE controller from spewing garbage and filling the log? Nothing I think. I'll lower the priority of the messages though.
Quoted 10 lines
drivers/ieee802154/serial.c line 573
Quoted 7 lines
drivers/ieee802154/serial.c new file +7
-0+* channels 0-10 are not valid for us */ +BUG_ON (channel <11 || channel >26 ); +/* ... but our crappy firmware numbers channels from 1 to 16 +* which is a mystery. We suould enforce that using PIB API +* but additional checking here won't kill, and gcc will +* optimize this stuff anyway. */ +BUG_ON ((channel -10 ) <1 && (channel -10 ) >16 );Shouldn't be driver specific hacks in the ldisc surely - or is the ldisc only applicable to a specific single bit of hardware ?
Currently it's applicable to only one (well, two) type of evkits from FreeScale flashed with pretty much specific firmware. For other evkits one have to write firmware on his own. Unlike bluetooth there is no standard for such communication over serial proto. Also if there will be any RS-232 device which implements IEEE 802.15.4 PHY layer and doesn't follow this protocol, we can extend the ldisc to be more like hci-uart:
a multiplexor of protocols.
Quoted 7 lines
drivers/ieee802154/serial.c line 811
Quoted 3 lines
+ minor =
tty->index+tty->driver->minor_start;drivers/ieee802154/serial.c new file +2
-0+ zbdev->dev->parent =class_find_device (tty_class,NULL , &minor, dev_minor_match); +That sort of thing shouldn't be buried in the depths of a driver. I'm not entirely averse to that sort of thing but it belongs in a helper in the tty layer.
Fine with me. I'll move this into helper in tty layer.
Quoted 3 lines
drivers/ieee802154/serial.c line 812
Quoted 1 line
drivers/ieee802154/serial.c new file +1
-0+ zbdev->tty = tty;Refcounting ?
Sample code? SLIP, hci-uart, ppp don't do it.
Quoted 8 lines
drivers/ieee802154/serial.c line 817
Quoted 5 lines
drivers/ieee802154/serial.c new file +5
-0+cleanup (zbdev); + + tty->disc_data = zbdev; + tty->receive_room =MAX_DATA_SIZE ; + tty->low_latency =1 ;You can't go around mashing driver internal values - many drivers don't support
low_latencymode and this will make them crash.
C&P from drivers/bluetooth/hci-ldisc.c, around line 466. We had problems working with low-latency unset.
Quoted 15 lines
Quoted 15 lines
drivers/ieee802154/serial.c new file +15
-0+/* +* Called when the tty is put into another line discipline or it hangs up. We +* have to wait for any cpu currently executing in any of the other zb_tty_* +* routines to finish before we can call zb_tty_close and free the +* zb_serial_dev struct. This routine must be called from process context, not +* interrupt or softirq context. +*/ +static void +ieee802154_tty_close (struct tty_struct *tty) +{ +struct zb_device *zbdev; + + zbdev = tty->disc_data; +if (NULL == zbdev) { +printk (KERN_WARNING "%s: match is not found\n" , __func__);
Quoted 8 lines
drivers/ieee802154/serial.c line 868
Quoted 5 lines
drivers/ieee802154/serial.c new file +5
-0+return ; + } + + tty->disc_data =NULL ; + zbdev->tty =NULL ;Again you want a refcount on these I suspect. You may actually be safe anyway but it would be cleaner to take/drop refs.
See above. Didn't see refounting in any of ldiscs checked. That's not a 'no, I won't do it', but rather 'wait, all those are also buggy ?!'
Quoted 10 lines
Quoted 10 lines
drivers/ieee802154/serial.c new file +10
-0+static int +ieee802154_tty_ioctl (struct tty_struct *tty,struct file *file,unsigned int cmd,unsigned long arg) +{ +struct zb_device *zbdev; +struct ifreq ifr; +int err; +void __user *argp = (void __user *) arg; + +pr_debug ("cmd = 0x%x\n" , cmd); +memset (&ifr,0 ,sizeof (ifr));
Quoted 8 lines
drivers/ieee802154/serial.c line 907
Quoted 6 lines
drivers/ieee802154/serial.c new file +6
-0+ + zbdev = tty->disc_data; +if (NULL == zbdev) { +pr_debug ("match is not found\n" ); +return -EINVAL ; + }If that is NULL it's a serious bug so WARN on it I think
I tend to agree.
Quoted 7 lines
drivers/ieee802154/serial.c line 921
Quoted 3 lines
drivers/ieee802154/serial.c new file +3
-0+default : +pr_debug ("Unknown ioctl cmd: %u\n" , cmd); +return -EINVAL ;This will break default ioctl processing. You probably want to call into some of the generic handlers at this point depending upon your hardware. Either way
-EINVALis wrong.
n_tty_ioctl_helper ?
Quoted 5 lines
Quoted 5 lines
drivers/ieee802154/serial.c new file +5
-0+static void +ieee802154_tty_receive (struct tty_struct *tty,const unsigned char *buf,char *cflags,int count) +{ +struct zb_device *zbdev; +int i;
Quoted 8 lines
drivers/ieee802154/serial.c line 941
Quoted 6 lines
drivers/ieee802154/serial.c new file +6
-0+ +/* Debug info */ +printk (KERN_INFO "%lu %s, received %d bytes:" , jiffies, __func__, count); +for (i =0 ; i < count; ++i) +printk (KERN_CONT " 0x%02X" , buf[i]); +printk (KERN_CONT "\n" );I don't think the above is meant to be there....
In final version, it will go away.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 09/10] ieee802154: add serial dongle driver
Quoted 5 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ return _send_pending_data(zbdev);Where do you check that the tty has enough space ?
Basically that means checking for ->write result, doesn't it?
You should check write_room before writing if you want some control - you can also then respect internal flow control via the wakeup mechanism.
Something like:
/* Wait for space */
while ((space = tty_write_room(tty)) < len) {
if (file->f_flags & O_NONBLOCK) {
err = -EAGAIN;
break;
}
interruptible_sleep_on(&tty->write_wait);
if (signal_pending(current)) {
err = -EINTR;
break;
}
}
/* Shove the entire frame down */
tty->ops->write(tty, data, len);Quoted 6 lines
Quoted 2 lines
In all these ERR cases what stops a remote device from having fun spewing garbage at you and filling the log ?
And what stops your precious IDE controller from spewing garbage and filling the log? Nothing I think. I'll lower the priority of the messages though.
The fact the drive is entirely under my control and not potentially being spewed at from a hostile network. Also the fact that it takes about 30 seconds to spank a misbehaving drive and reset it. The network laye generally uses time checks (search for ratelimit()).
Quoted 3 lines
any RS-232 device which implements IEEE 802.15.4 PHY layer and doesn't follow this protocol, we can extend the ldisc to be more like hci-uart:
a multiplexor of protocols.
Ok
Quoted 5 lines
Quoted 3 lines
drivers/ieee802154/serial.c line 812
Quoted 1 line
drivers/ieee802154/serial.c new file +1
-0+ zbdev->tty = tty;Refcounting ?
Sample code? SLIP, hci-uart, ppp don't do it.
No I'm still running around clobbering them all - and slip needed a partial rewrite first.
zbdev->tty = tty_kref_get(tty); tty_kref_put(foo);
Quoted 5 lines
Quoted 2 lines
You can't go around mashing driver internal values - many drivers don't support
low_latencymode and this will make them crash.C&P from
drivers/bluetooth/hci-ldisc.c, around line 466. We had problems working with low-latency unset.
The bluetooth one needs killing too. I will do that tomorrow ...
How many releases ago - the entire tty buffering layer has been rewritten over time. tty->low_latency requires driver specific support that most don't have. Also as of 2.6.30rc you'll get debug spew if you misuse it.
If you still need it we need to know why.
Quoted 2 lines
That's not a 'no, I won't do it', but rather 'wait, all those are also buggy ?!'
The tty layer has a lot of "yes, those are also buggy" - which is why I'm currently half way through systematically brutalising it.
Quoted 10 lines
Quoted 7 lines
drivers/ieee802154/serial.c line 921
Quoted 3 lines
drivers/ieee802154/serial.c new file +3
-0+default : +pr_debug ("Unknown ioctl cmd: %u\n" , cmd); +return -EINVAL ;This will break default ioctl processing. You probably want to call into some of the generic handlers at this point depending upon your hardware. Either way
-EINVALis wrong.
n_tty_ioctl_helper?
That depends what you need. tty_mode_ioctl() gives you all the mode stuff, n_tty_ioctl_helper adds things like software flow management which don't actually look relevant to your ldisc ?
Any other queries let me know, and if the tty->low_latency is still needed let me know and we'll figure out why between us, as it should not be.
Alan
Re: [PATCH 09/10] ieee802154: add serial dongle driver
Quoted 10 lines
Quoted 2 lines
C&P from
drivers/bluetooth/hci-ldisc.c, around line 466. We had problems working with low-latency unset.The bluetooth one needs killing too. I will do that tomorrow ...
How many releases ago - the entire tty buffering layer has been rewritten over time.
tty->low_latencyrequires driver specific support that most don't have. Also as of 2.6.30rc you'll get debug spew if you misuse it.If you still need it we need to know why.
As we're tested it here, we don't need tty->low_latency anymore. So that can go away. Thanks!
--
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 08/10] tty_io: export tty_class
In reply to Dmitry Eremin-SolenikovQuoted 2 lines · On Mon, 1 Jun 2009 18:54:49 +0400 Dmitry Eremin-Solenikov…
Currently
tty_classin a public variable in thetty_io.cExport it to the modules to allow some usefull tricks.
Thats exactly why it isn't exported. We don't want "tricks".
Re: [PATCH 08/10] tty_io: export tty_class
2009/6/1 Alan Cox <[email protected]>:
Quoted 7 lines
Quoted 2 lines · On Mon, 1 Jun 2009 18:54:49 +0400 Dmitry Eremin-Solenikov…
Currently
tty_classin a public variable in thetty_io.cExport it to the modules to allow some usefull tricks.Thats exactly why it isn't exported. We don't want "tricks".
I'd like to find a struct device corresponding to the struct tty_struct from the ldisc .open call. What would be the best way for me to do this? I used class_find_device finding the device with matching minor. Will it be acceptable, if I just move this code into tty_* file and export it as to modules?
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 08/10] tty_io: export tty_class
Quoted 3 lines
I used
class_find_devicefinding the device with matching minor. Will it be acceptable, if I just move this code into tty_* file and export it as to modules?
Yes - create a proper tty helper function for doing the job and document what it does. That way if the tty layer is changed it is obvious that this code also needs considering.
Alan
Re: [PATCH 08/10] tty_io: export tty_class
Quoted 7 lines · Alan Cox
Quoted 3 lines
I used
class_find_devicefinding the device with matching minor. Will it be acceptable, if I just move this code into tty_* file and export it as to modules?Yes - create a proper tty helper function for doing the job and document what it does. That way if the tty layer is changed it is obvious that this code also needs considering.
Is this suitable:
Quoted 1 line
From
bea1f7dd279119a1aa60556ff0441e31c92876aaMon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Tue, 2 Jun 2009 06:31:35 +0400
Subject: [PATCH] tty_io: add an API to get device corresponding to tty_struct
--- drivers/char/tty_io.c | 13 +++++++++++++ include/linux/tty.h | 1 + 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/char/tty_io.c +13 -0
@@ -3026,6 +3026,19 @@ dev_t tty_devnum(struct tty_struct *tty) }EXPORT_SYMBOL (tty_devnum); +static int dev_match_devt (struct device *dev,void *data) +{ +dev_t *devt = data; +return dev->devt == *devt; +} + +struct device *tty_get_device (struct tty_struct *tty) +{ +dev_t devt =tty_devnum (tty); +return class_find_device (tty_class,NULL , &devt, dev_match_devt); +} +EXPORT_SYMBOL (tty_get_device); +void proc_clear_tty (struct task_struct *p) {unsigned long flags;
include/linux/tty.h +1 -0
@@ -413,6 +413,7 @@ extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);extern int tty_perform_flush (struct tty_struct *tty,unsigned long arg);extern dev_t tty_devnum (struct tty_struct *tty); +struct device *tty_get_device (struct tty_struct *tty);extern void proc_clear_tty (struct task_struct *p);extern struct tty_struct *get_current_tty (void );extern void tty_default_fops (struct file_operations *fops);
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
Re: [PATCH 08/10] tty_io: export tty_class
Quoted 5 lines
Quoted 3 lines
Yes - create a proper tty helper function for doing the job and document what it does. That way if the tty layer is changed it is obvious that this code also needs considering.
Is this suitable:
Perfect - add the needed documentation to the public function and submit it for merging.
Alan
Re: [PATCH 06/10] mac802154: add a software MAC 802.15.4 implementation
In reply to Dmitry Eremin-SolenikovQuoted 8 lines · Dmitry Eremin-Solenikov
Some of available devices are just dump radios implementing IEEE 802.15.4 PHY layer. This commit adds a common library that acts like an intermediate layer between our socket family and drivers for those dumb devices.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>Signed-off-by Sergey Lapin <[email protected]>--- include/net/ieee802154/mac802154.h | 79 ++++
Could we get some name that is not alphabet soup? Is 'zigbee' trademarked so heavily that it can't be used? Maybe 'wpan'?
Pavel
Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- 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
Andrew Morton
maintainerRe: [PATCH 03/10] net: add IEEE 802.15.4 socket family implementation
In reply to Dmitry Eremin-SolenikovQuoted 6 lines · On Mon, 1 Jun 2009 18:54:44 +0400 Dmitry Eremin-Solenikov…
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_DGRAMto encapsulate data inside normal IEEE 802.15.4 packets.
Quoted 8 lines
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.
Some drive-by nitpicking, and I saw a bug...
Quoted 3 lines
...
+#define
MAC_CB(skb)((structieee802154_mac_cb*)(skb)->cb)
At present this macro can be passed a variable of any type at all.
It would be better to implement this as a (probably inlined) C function, so the compiler can check that it was indeed passed a `struct sk_buff *' (or whatever type it's supposed to be).
And regular C functions are typically in lower case..
I have a feeling that this unnecessary macro pattern is used in other places in networking, and there's an argument that new code should copy the old code. It's not a terribly good argument, IMO - the defeating of type-safety does rather suck.
include/net/ieee802154/netdevice.h line 51
Quoted 10 lines
include/net/ieee802154/netdevice.h new file +10
-0+#define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1) + +#define MAC_CB_FLAG_ACKREQ (1 << 3) +#define MAC_CB_FLAG_SECEN (1 << 4) +#define MAC_CB_FLAG_INTRAPAN (1 << 5) + +#define MAC_CB_IS_ACKREQ (skb) (MAC_CB(skb)->flags & MAC_CB_FLAG_ACKREQ) +#define MAC_CB_IS_SECEN (skb) (MAC_CB(skb)->flags & MAC_CB_FLAG_SECEN) +#define MAC_CB_IS_INTRAPAN (skb) (MAC_CB(skb)->flags & MAC_CB_FLAG_INTRAPAN) +#define MAC_CB_TYPE (skb) (MAC_CB(skb)->flags & MAC_CB_FLAG_TYPEMASK)
These didn't need to be implemented as macros either.
Quoted 18 lines
include/net/ieee802154/netdevice.h new file +18
-0+#define IEEE802154_MAC_SCAN_ED 0 +#define IEEE802154_MAC_SCAN_ACTIVE 1 +#define IEEE802154_MAC_SCAN_PASSIVE 2 +#define IEEE802154_MAC_SCAN_ORPHAN 3 + +/* +* This should be located at net_device->ml_priv +*/ +struct ieee802154_mlme_ops { +int (*assoc_req)(struct net_device *dev,struct ieee802154_addr *addr,u8 channel,u8 cap); +int (*assoc_resp)(struct net_device *dev,struct ieee802154_addr *addr,u16 short_addr,u8 status); +int (*disassoc_req)(struct net_device *dev,struct ieee802154_addr *addr,u8 reason); +int (*start_req)(struct net_device *dev,struct ieee802154_addr *addr,u8 channel, +u8 bcn_ord,u8 sf_ord,u8 pan_coord,u8 blx, +u8 coord_realign); +int (*scan_req)(struct net_device *dev,u8 type,u32 channels,u8 duration); + +/*
include/net/ieee802154/netdevice.h line 80
Quoted 10 lines
include/net/ieee802154/netdevice.h new file +10
-0+* FIXME: these should become the part of PIB/MIB interface. +* However we still don't have IB interface of any kind +*/ +u16 (*get_pan_id)(struct net_device *dev); +u16 (*get_short_addr)(struct net_device *dev); +u8 (*get_dsn)(struct net_device *dev); +u8 (*get_bsn)(struct net_device *dev); +}; + +#define IEEE802154_MLME_OPS (dev) ((struct ieee802154_mlme_ops *) dev->ml_priv)
Nor did this.
net/ieee802154/af_ieee802154.c line 48
Quoted 9 lines
...
net/ieee802154/af_ieee802154.c new file +6
-0+int i; \ +pr_debug ("file %s: function: %s: data: len %d:\n" , __FILE__, __func__, len); \ +for (i =0 ; i < len; i++) {\ +pr_debug ("%02x: %02x\n" , i, (data)[i]); \ + } \ +}
Could perhaps use lib/hexdump.c
Will do weird things if passed a pointer whcih has type other than char*.
Quoted 15 lines
net/ieee802154/af_ieee802154.c new file +15
-0+/* +* Utility function for families +*/ +struct net_device *ieee802154_get_dev (struct net *net,struct ieee802154_addr *addr) +{ +struct net_device *dev =NULL ; + +switch (addr->addr_type) { +case IEEE802154_ADDR_LONG : +rtnl_lock (); + dev =dev_getbyhwaddr (net,ARPHRD_IEEE802154 , addr->hwaddr); +if (dev) +dev_hold (dev); +rtnl_unlock (); +break ;
net/ieee802154/af_ieee802154.c line 74
Quoted 10 lines
net/ieee802154/af_ieee802154.c new file +10
-0+case IEEE802154_ADDR_SHORT : +if (addr->pan_id !=0xffff && addr->short_addr !=IEEE802154_ADDR_UNDEF && addr->short_addr !=0xffff ) { +struct net_device *tmp; + +rtnl_lock (); + +for_each_netdev (net, tmp) { +if (tmp->type ==ARPHRD_IEEE802154 ) { +if (IEEE802154_MLME_OPS (tmp)->get_pan_id (tmp) == addr->pan_id + &&IEEE802154_MLME_OPS (tmp)->get_short_addr (tmp) == addr->short_addr) {
You must use very wide xterms :(
Quoted 21 lines
net/ieee802154/af_ieee802154.c new file +18
-0+ dev = tmp; +dev_hold (dev); +break ; + } + } + } + +rtnl_unlock (); + } +break ; +default : +pr_warning ("Unsupported ieee802154 address type: %d\n" , addr->addr_type); +break ; + } + +return dev; +} +
net/ieee802154/af_ieee802154.c line 237
Quoted 10 lines
net/ieee802154/af_ieee802154.c new file +10
-0+static int ieee802154_create (struct net *net,struct socket *sock,int protocol) +{ +struct sock *sk; +int rc; +struct proto *proto; +const struct proto_ops *ops; + +/* FIXME: init_net */ +if (net != &init_net) +return -EAFNOSUPPORT ;
yeah, I was going to ask about that. What's the problem here?
Quoted 14 lines
net/ieee802154/af_ieee802154.c new file +14
-0+switch (sock->type) { +case SOCK_RAW : + proto = &ieee802154_raw_prot; + ops = &ieee802154_raw_ops; +break ; +case SOCK_DGRAM : + proto = &ieee802154_dgram_prot; + ops = &ieee802154_dgram_ops; +break ; +default : + rc = -ESOCKTNOSUPPORT ; + goto out; + } +
net/ieee802154/af_ieee802154.c line 262
Quoted 10 lines
net/ieee802154/af_ieee802154.c new file +10
-0+ rc = -ENOMEM ; + sk =sk_alloc (net,PF_IEEE802154 ,GFP_KERNEL , proto); +if (!sk) + goto out; + rc =0 ; + + sock->ops = ops; + +sock_init_data (sock, sk); +/* FIXME: sk->sk_destruct */
?
Quoted 11 lines
net/ieee802154/af_ieee802154.c new file +11
-0+ sk->sk_family =PF_IEEE802154 ; + +/* Checksums on by default */ +sock_set_flag (sk,SOCK_ZAPPED ); + +if (sk->sk_prot->hash) + sk->sk_prot->hash (sk); + +if (sk->sk_prot->init) { + rc = sk->sk_prot->init (sk); +if (rc)
net/ieee802154/af_ieee802154.c
Quoted 10 lines
net/ieee802154/af_ieee802154.c new file +7
-0+sk_common_release (sk); + } +out: +return rc; +} + +static void af_ieee802154_remove (void )
Could be __exit, althugh __exit doesn't do much (it used to be implemented on UML and might still be).
Quoted 5 lines
net/ieee802154/af_ieee802154.c new file +5
-0+{ +dev_remove_pack (&ieee802154_packet_type); +sock_unregister (PF_IEEE802154 ); +proto_unregister (&ieee802154_dgram_prot); +proto_unregister (&ieee802154_raw_prot);
net/ieee802154/af_ieee802154.c
Quoted 10 lines
net/ieee802154/af_ieee802154.c new file +7
-0+} + +module_init (af_ieee802154_init); +module_exit (af_ieee802154_remove); +static inline struct dgram_sock *dgram_sk (const struct sock *sk) +{ +return (struct dgram_sock *)sk;
Better to use container_of() - it's clearer and doesn't assume that dgram_sock.sk is the first member.
net/ieee802154/dgram.c line 87
Quoted 7 lines
net/ieee802154/dgram.c new file +4
-0+} +static int dgram_bind (struct sock *sk,struct sockaddr *uaddr,int len) +{ +struct sockaddr_ieee802154 *addr = (struct sockaddr_ieee802154 *)uaddr;
sigh, more casting. Often these things can be done in ways which are nicer to the C type system.
Quoted 82 lines
net/ieee802154/dgram.c new file +79
-0+struct dgram_sock *ro =dgram_sk (sk); +int err =0 ; +struct net_device *dev; + + ro->bound =0 ; + +if (len <sizeof (*addr)) +return -EINVAL ; + +if (addr->family !=AF_IEEE802154 ) +return -EINVAL ; + +lock_sock (sk); + + dev =ieee802154_get_dev (sock_net (sk), &addr->addr); +if (!dev) { + err = -ENODEV ; + goto out; + } + +if (dev->type !=ARPHRD_IEEE802154 ) { + err = -ENODEV ; + goto out_put; + } + +memcpy (&ro->src_addr, &addr->addr,sizeof (struct ieee802154_addr )); + + ro->bound =1 ; +out_put: +dev_put (dev); +out: +release_sock (sk); + +return err; +} + +static int dgram_sendmsg (struct kiocb *iocb,struct sock *sk,struct msghdr *msg, +size_t size) +{ +struct net_device *dev; +unsigned mtu; +struct sk_buff *skb; +struct dgram_sock *ro =dgram_sk (sk); +int err; + +if (msg->msg_flags &MSG_OOB ) { +pr_debug ("msg->msg_flags = 0x%x\n" , msg->msg_flags); +return -EOPNOTSUPP ; + } + +if (!ro->bound) + dev =dev_getfirstbyhwtype (sock_net (sk),ARPHRD_IEEE802154 ); +else + dev =ieee802154_get_dev (sock_net (sk), &ro->src_addr); + +if (!dev) { +pr_debug ("no dev\n" ); +return -ENXIO ; + } + mtu = dev->mtu; +pr_debug ("name = %s, mtu = %u\n" , dev->name, mtu); + + skb =sock_alloc_send_skb (sk,LL_ALLOCATED_SPACE (dev) + size, msg->msg_flags &MSG_DONTWAIT , + &err); +if (!skb) { +dev_put (dev); +return err; + } +skb_reserve (skb,LL_RESERVED_SPACE (dev)); + +skb_reset_network_header (skb); + +MAC_CB (skb)->flags =IEEE802154_FC_TYPE_DATA |MAC_CB_FLAG_ACKREQ ; +MAC_CB (skb)->seq =IEEE802154_MLME_OPS (dev)->get_dsn (dev); + err =dev_hard_header (skb, dev,ETH_P_IEEE802154 , &ro->dst_addr, ro->bound ? &ro->src_addr :NULL , size); +if (err <0 ) { +kfree_skb (skb); +dev_put (dev); +return err;
net/ieee802154/dgram.c line 252
Quoted 10 lines
net/ieee802154/dgram.c new file +10
-0+ } + +skb_reset_mac_header (skb); + + err =memcpy_fromiovec (skb_put (skb, size), msg->msg_iov, size); +if (err <0 ) { +kfree_skb (skb); +dev_put (dev); +return err; + }
It would be better to convert this function (and any similar occurences) to the `goto foo;' unwinding approach. The multiple-return-statements-per-C-function is not a favoured approach. It leads to code duplication and it leads to bugs.
net/ieee802154/dgram.c line 256
Quoted 3 lines
net/ieee802154/dgram.c new file +3
-0+if (size > mtu) { +pr_debug ("size = %u, mtu = %u\n" , size, mtu); +return -EINVAL ;
See, a bug.
Quoted 10 lines
net/ieee802154/dgram.c new file +10
-0+ } + + skb->dev = dev; + skb->sk = sk; + skb->protocol =htons (ETH_P_IEEE802154 ); + + err =dev_queue_xmit (skb); + +dev_put (dev); +
net/ieee802154/dgram.c line 358
Quoted 10 lines
net/ieee802154/dgram.c new file +7
-0+if (err) +return err; + +return size; +} + +struct proto ieee802154_dgram_prot = {
I suspect this could/should be const.
Quoted 9 lines
net/ieee802154/dgram.c new file +9
-0+ .name = "IEEE-802.15.4-MAC", + .owner = THIS_MODULE, + .obj_size = sizeof(struct dgram_sock), + .init = dgram_init, + .close = dgram_close, + .bind = dgram_bind, + .sendmsg = dgram_sendmsg, + .recvmsg = dgram_recvmsg, + .hash = dgram_hash,
net/ieee802154/dgram.c
Quoted 10 lines
net/ieee802154/dgram.c new file +7
-0+ .unhash = dgram_unhash, + .connect = dgram_connect, + .disconnect = dgram_disconnect, + .ioctl = dgram_ioctl, +}; + +struct proto ieee802154_raw_prot = {
const?
Quoted 3 lines
...
--
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 03/10] net: add IEEE 802.15.4 socket family implementation
Quoted 32 lines · Andrew Morton
Quoted 6 lines · On Mon, 1 Jun 2009 18:54:44 +0400 Dmitry Eremin-Solenikov…
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_DGRAMto encapsulate data inside normal IEEE 802.15.4 packets.Quoted 8 lines
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.
Some drive-by nitpicking, and I saw a bug...
Quoted 12 lines
net/ieee802154/af_ieee802154.c new file +12
-0+switch (addr->addr_type) { +case IEEE802154_ADDR_LONG : +rtnl_lock (); + dev =dev_getbyhwaddr (net,ARPHRD_IEEE802154 , addr->hwaddr); +if (dev) +dev_hold (dev); +rtnl_unlock (); +break ; +case IEEE802154_ADDR_SHORT : +if (addr->pan_id !=0xffff && addr->short_addr !=IEEE802154_ADDR_UNDEF && addr->short_addr !=0xffff ) { +struct net_device *tmp; +
Quoted 8 lines
net/ieee802154/af_ieee802154.c line 74
Quoted 6 lines
net/ieee802154/af_ieee802154.c new file +6
-0+rtnl_lock (); + +for_each_netdev (net, tmp) { +if (tmp->type ==ARPHRD_IEEE802154 ) { +if (IEEE802154_MLME_OPS (tmp)->get_pan_id (tmp) == addr->pan_id + &&IEEE802154_MLME_OPS (tmp)->get_short_addr (tmp) == addr->short_addr) {You must use very wide xterms :(
~120 chars in width :) We prefer to have a single code line split between several screen lines, rather than split it manually in some weird places just to justify width of 80 chars.
Quoted 22 lines
Quoted 22 lines
net/ieee802154/af_ieee802154.c new file +18
-0+ dev = tmp; +dev_hold (dev); +break ; + } + } + } + +rtnl_unlock (); + } +break ; +default : +pr_warning ("Unsupported ieee802154 address type: %d\n" , addr->addr_type); +break ; + } + +return dev; +} +
Quoted 12 lines
net/ieee802154/af_ieee802154.c line 237
Quoted 10 lines
net/ieee802154/af_ieee802154.c new file +10
-0+static int ieee802154_create (struct net *net,struct socket *sock,int protocol) +{ +struct sock *sk; +int rc; +struct proto *proto; +const struct proto_ops *ops; + +/* FIXME: init_net */ +if (net != &init_net) +return -EAFNOSUPPORT ;yeah, I was going to ask about that. What's the problem here?
The FIXME was dedicated to the fact that I didn't understand what is this. The code fragment is c&p from lots of examples of similar code (check can, appletalk, etc. for example)
Quoted 18 lines
Quoted 18 lines
net/ieee802154/af_ieee802154.c new file +18
-0+switch (sock->type) { +case SOCK_RAW : + proto = &ieee802154_raw_prot; + ops = &ieee802154_raw_ops; +break ; +case SOCK_DGRAM : + proto = &ieee802154_dgram_prot; + ops = &ieee802154_dgram_ops; +break ; +default : + rc = -ESOCKTNOSUPPORT ; + goto out; + } + + rc = -ENOMEM ; + sk =sk_alloc (net,PF_IEEE802154 ,GFP_KERNEL , proto); +if (!sk) + goto out;
Quoted 8 lines
net/ieee802154/af_ieee802154.c line 262
Quoted 6 lines
net/ieee802154/af_ieee802154.c new file +6
-0+ rc =0 ; + + sock->ops = ops; + +sock_init_data (sock, sk); +/* FIXME: sk->sk_destruct */ ?
Oh... I nearly forgot about this. When writing this code, I examined several existing address families. Usually (but not always) the sk_destruct callback will purge sk_receive_queue and sk_write_queue. However I didn't understand why and in which case should these queues (or others) be purged. Could please one clarify this?
Quoted 6 lines
Quoted 3 lines
...
+static void
af_ieee802154_remove(void)Could be
__exit, althugh__exitdoesn't do much (it used to be implemented on UML and might still be).
Added. BTW: I thought, that __exit functions aren't added to (or are stripped from) the final vmlinux image. Am I wrong?
Quoted 7 lines
net/ieee802154/dgram.c line 50
Quoted 4 lines
net/ieee802154/dgram.c new file +3
-0+static inline struct dgram_sock *dgram_sk (const struct sock *sk) +{ +return (struct dgram_sock *)sk;Better to use
container_of()- it's clearer and doesn't assume that dgram_sock.sk is the first member.
Fixed.
Quoted 10 lines
net/ieee802154/dgram.c line 87
Quoted 7 lines
net/ieee802154/dgram.c new file +4
-0+} +static int dgram_bind (struct sock *sk,struct sockaddr *uaddr,int len) +{ +struct sockaddr_ieee802154 *addr = (struct sockaddr_ieee802154 *)uaddr;sigh, more casting. Often these things can be done in ways which are nicer to the C type system.
Unfortunately sockaddr things can't be done in a more clean way IMO.
Quoted 7 lines
Quoted 6 lines
net/ieee802154/dgram.c new file +6
-0+struct dgram_sock *ro =dgram_sk (sk); +int err =0 ; +struct net_device *dev; + + ro->bound =0 ; +
Quoted 5 lines
Quoted 3 lines
...
+struct proto
ieee802154_dgram_prot= {I suspect this could/should be const.
No. proto_register changes the passed protocol struct during registration.
Quoted 16 lines
Quoted 16 lines
net/ieee802154/dgram.c new file +15
-0+ .name = "IEEE-802.15.4-MAC", + .owner = THIS_MODULE, + .obj_size = sizeof(struct dgram_sock), + .init = dgram_init, + .close = dgram_close, + .bind = dgram_bind, + .sendmsg = dgram_sendmsg, + .recvmsg = dgram_recvmsg, + .hash = dgram_hash, + .unhash = dgram_unhash, + .connect = dgram_connect, + .disconnect = dgram_disconnect, + .ioctl = dgram_ioctl, +}; +
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 03/10] net: add IEEE 802.15.4 socket family implementation
Quoted 25 lines · Dmitry Eremin-Solenikov
Quoted 15 lines · Andrew Morton
Quoted 12 lines · On Mon, 1 Jun 2009 18:54:44 +0400 Dmitry Eremin-Solenikov…
net/ieee802154/af_ieee802154.c new file +12
-0+switch (addr->addr_type) { +case IEEE802154_ADDR_LONG : +rtnl_lock (); + dev =dev_getbyhwaddr (net,ARPHRD_IEEE802154 , addr->hwaddr); +if (dev) +dev_hold (dev); +rtnl_unlock (); +break ; +case IEEE802154_ADDR_SHORT : +if (addr->pan_id !=0xffff && addr->short_addr !=IEEE802154_ADDR_UNDEF && addr->short_addr !=0xffff ) { +struct net_device *tmp; +Quoted 8 lines
net/ieee802154/af_ieee802154.c line 74
Quoted 6 lines
net/ieee802154/af_ieee802154.c new file +6
-0+rtnl_lock (); + +for_each_netdev (net, tmp) { +if (tmp->type ==ARPHRD_IEEE802154 ) { +if (IEEE802154_MLME_OPS (tmp)->get_pan_id (tmp) == addr->pan_id + &&IEEE802154_MLME_OPS (tmp)->get_short_addr (tmp) == addr->short_addr) {You must use very wide xterms :(
Quoted 3 lines
~120 chars in width :) We prefer to have a single code line split between several screen lines, rather than split it manually in some weird places just to justify width of 80 chars.
Hopefully you realize that many find this difficult to read -- I just can't spread my eyes far enough to comprehend the lines.
80 chars is not a hard limit, but it is a good goal. 120 is too wide.
John
Signature · 6 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready. -- 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 03/10] net: add IEEE 802.15.4 socket family implementation
2009/6/4 John W. Linville <[email protected]>:
Quoted 26 lines · Dmitry Eremin-Solenikov
Quoted 25 lines · Andrew Morton
Quoted 23 lines
Quoted 11 lines · On Mon, 1 Jun 2009 18:54:44 +0400 Dmitry Eremin-Solenikov…
+ switch (
addr->addr_type) {
+ caseIEEE802154_ADDR_LONG:
+rtnl_lock();
+ dev =dev_getbyhwaddr(net, ARPHRD_IEEE802154, addr->hwaddr);
+ if (dev)
+dev_hold(dev);
+rtnl_unlock();
+ break;
+ caseIEEE802154_ADDR_SHORT:
+ if (addr->pan_id!=0xffff&&addr->short_addr!=IEEE802154_ADDR_UNDEF&&addr->short_addr!=0xffff) {
+ structnet_device*tmp;net/ieee802154/af_ieee802154.c line 74
Quoted 7 lines
net/ieee802154/af_ieee802154.c new file +7
-0+ + rtnl_lock(); + + for_each_netdev(net, tmp) { + if (tmp->type == ARPHRD_IEEE802154) { + if (IEEE802154_MLME_OPS(tmp)->get_pan_id(tmp) == addr->pan_id + && IEEE802154_MLME_OPS(tmp)->get_short_addr(tmp) == addr->short_addr) {You must use very wide xterms :(
Quoted 8 lines
Quoted 3 lines
~120 chars in width :) We prefer to have a single code line split between several screen lines, rather than split it manually in some weird places just to justify width of 80 chars.
Hopefully you realize that many find this difficult to read -- I just can't spread my eyes far enough to comprehend the lines.
80 chars is not a hard limit, but it is a good goal. 120 is too wide.
We do try to fit the lines into 80 chars, but when that seems logical. I strongly dislike breaking comparations between lines.
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 03/10] net: add IEEE 802.15.4 socket family implementation
Quoted 2 lines · Dmitry Eremin-Solenikov
We do try to fit the lines into 80 chars, but when that seems logical. I strongly dislike breaking comparations between lines.
There are a whole bunch of improvements possible at this particular spot:
switch (X) {
case Y:
if (A) {
...
}
break;...
}
can be written as
switch (X) {
case Y:
if (!A) break; ... break; }
and
for (...) {
if (A) {
...
break;
}
}can be written as
for (...) {
if (!A)
continue;
...
break;
}etc.
Show some creativity!
johannes
Andrew Morton
maintainerRe: [PATCH 01/10] crc-itu-t: add bit-reversed calculation
In reply to Dmitry Eremin-Solenikovinclude/linux/crc-itu-t.h line 35
Quoted 13 lines · On Mon, 1 Jun 2009 18:54:42 +0400 Dmitry Eremin-Solenikov…
From: Darren Salt <[email protected]>
..
static inline u16
crc_itu_t_byte(u16 crc, const u8 data){include/linux/crc-itu-t.h +4
-0return (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 ]; +}
I suspect that inlining these was a mistake, but one which we make often.
lib/crc-itu-t.c u16 crc_itu_t(u16 crc, const u8 *buffer, size_t len) · line 69
Quoted 13 lines
#endif /*
CRC_ITU_T_H*/lib/crc-itu-t.c +3
-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
kerneldoc doesn't support the breaking of this information across multiple lines. It'll need to be done as a single 120-column line.
Quoted 13 lines
lib/crc-itu-t.c +13
-0+* @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);
Quoted 9 lines · Dmitry Eremin-Solenikov
Hi,
As a part of research activities the Embedded Systems - Open Platform Group from Siemens Corporate Technology we are working on adding support for the IEEE 802.15.4 Wireless Personal Area Networks to the Linux. Our current implementation is neither certified nor even feature complete. However we'd like to present current state of our patchset to the Linux developers community to gain comments, fixes, ideas, etc. This is not yet a pull request, but more like an RFC.
Does this stack work with the Atmel USB version of at86rf230? ATAVRRZUSBSTICK, http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4396
It's not so simple to plug in the at86rf230 using SPI. Supporting USB sticks lets you develop on a desktop PC.
freaklabs.org is using ATAVRRZUSBSTICK
Quoted 129 lines
The project page is available at http://apps.sourceforge.net/trac/linux-zigbee
with source code of kernel part available from git at
http://zigbee-linux.git.sourceforge.net, mirrored for convenience atgit://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.gitThe source code for userspace utils is available from git at
http://linux-zigbee.git.sourceforge.net/Changes since previous RFC:
* Split the code into socket family, netlink interface and separate MAC 802.15.4 implementation.
* Add a sample driver for devices implementing mac level of IEEE 802.15.4 on their own.
* Major cleanup of public interfaces.
* Drop our CRC implementation and use a variant of CRC-ITU-T one
* Add preliminary version of AT86RF231 Atmel chip driverThe following changes since commit
59a3759d0fe8d969888c741bb33f4946e4d3750d:
Linus Torvalds (1):
Linux 2.6.30-rc7are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.git for-review-v1
Darren Salt (1):
crc-itu-t: add bit-reversed calculationDmitry Eremin-Solenikov (9):
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 simple HardMAC driver sample
mac802154: add a software MAC 802.15.4 implementation
ieee802154: add virtual loopback driver
tty_io: exporttty_class
ieee802154: add serial dongle driver
ieee802154: add at86rf230/rf231 spi driverdrivers/Makefile | 1 +
drivers/char/tty_io.c| 1 +drivers/ieee802154/Kconfig| 42 ++drivers/ieee802154/Makefile| 6 +drivers/ieee802154/at86rf230.c| 971 +++++++++++++++++++++++++++++++drivers/ieee802154/fakehard.c| 253 ++++++++drivers/ieee802154/fakelb.c| 335 +++++++++++drivers/ieee802154/serial.c| 999 ++++++++++++++++++++++++++++++++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/linux/spi/at86rf230.h| 32 +include/linux/tty.h| 3 +-include/net/ieee802154/af_ieee802154.h| 60 ++include/net/ieee802154/mac802154.h| 79 +++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 | 2 +
net/Makefile | 2 +
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 ++++++++net/mac802154/Kconfig| 13 +net/mac802154/Makefile | 5 + net/mac802154/beacon.c | 242 ++++++++ net/mac802154/beacon.h | 48 ++net/mac802154/beacon_hash.c | 103 ++++
net/mac802154/beacon_hash.h| 40 ++net/mac802154/dev.c| 843 +++++++++++++++++++++++++++net/mac802154/mac802154.h| 64 ++net/mac802154/mac_cmd.c| 325 +++++++++++net/mac802154/main.c| 96 +++net/mac802154/mdev.c| 283 +++++++++net/mac802154/mib.h | 32 + net/mac802154/pib.c | 87 +++ net/mac802154/pib.h | 35 ++ net/mac802154/scan.c | 215 +++++++ 48 files changed, 7187 insertions(+), 4 deletions(-)create mode 100644
drivers/ieee802154/Kconfig
create mode 100644drivers/ieee802154/Makefile
create mode 100644drivers/ieee802154/at86rf230.c
create mode 100644drivers/ieee802154/fakehard.c
create mode 100644drivers/ieee802154/fakelb.c
create mode 100644drivers/ieee802154/serial.c
create mode 100644include/linux/spi/at86rf230.h
create mode 100644include/net/ieee802154/af_ieee802154.hcreate mode 100644include/net/ieee802154/mac802154.h
create mode 100644include/net/ieee802154/mac_def.h
create mode 100644include/net/ieee802154/netdevice.h
create mode 100644include/net/ieee802154/nl802154.h
create mode 100644net/ieee802154/Kconfig
create mode 100644net/ieee802154/Makefile
create mode 100644net/ieee802154/af802154.h
create mode 100644net/ieee802154/af_ieee802154.c
create mode 100644net/ieee802154/dgram.c
create mode 100644net/ieee802154/netlink.c
create mode 100644net/ieee802154/raw.c
create mode 100644net/mac802154/Kconfig
create mode 100644net/mac802154/Makefile
create mode 100644net/mac802154/beacon.c
create mode 100644net/mac802154/beacon.h
create mode 100644net/mac802154/beacon_hash.c
create mode 100644net/mac802154/beacon_hash.h
create mode 100644net/mac802154/dev.c
create mode 100644net/mac802154/mac802154.h
create mode 100644net/mac802154/mac_cmd.c
create mode 100644net/mac802154/main.c
create mode 100644net/mac802154/mdev.c
create mode 100644net/mac802154/mib.h
create mode 100644net/mac802154/pib.c
create mode 100644net/mac802154/pib.h
create mode 100644net/mac802154/scan.c
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Jon Smirl [email protected]
2009/6/5 Jon Smirl <[email protected]>:
Quoted 12 lines
Quoted 9 lines · Dmitry Eremin-Solenikov
Hi,
As a part of research activities the Embedded Systems - Open Platform Group from Siemens Corporate Technology we are working on adding support for the IEEE 802.15.4 Wireless Personal Area Networks to the Linux. Our current implementation is neither certified nor even feature complete. However we'd like to present current state of our patchset to the Linux developers community to gain comments, fixes, ideas, etc. This is not yet a pull request, but more like an RFC.
Quoted 2 lines
Does this stack work with the Atmel USB version of at86rf230? ATAVRRZUSBSTICK, http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4396
No, we do not support Atmel USB sticks, nor we do not have plans for adding support
for it in the foreseable feature. However if the onboard ATmega can be programmed to
provide usb-serial interface, one can use/adapt our serial discipline driver to control it.
One will still have to write firmware for the on-stick ATmega chip.
Or you can add support for any existing interface that is provided by RazorUSB card by yourself.
We tried to make mac802154 drivers easy to implement.
Quoted 2 lines
It's not so simple to plug in the at86rf230 using SPI. Supporting USB sticks lets you develop on a desktop PC.
Hmm. One can solder (e.g.) the FTDI 2232 together with AT86RF230/231 and use that combo
instead of RazorUSB sticks.
Quoted 1 line
freaklabs.org is using ATAVRRZUSBSTICK
I'll look for the interface they are using to control sticks and check how easy will it be to
write a driver for it.
Signature · 2 lines
With best wishes Dmitry
Quoted 28 lines · Dmitry Eremin-Solenikov
2009/6/5 Jon Smirl <[email protected]>:
Quoted 12 lines
Quoted 9 lines · Dmitry Eremin-Solenikov
Hi,
As a part of research activities the Embedded Systems - Open Platform Group from Siemens Corporate Technology we are working on adding support for the IEEE 802.15.4 Wireless Personal Area Networks to the Linux. Our current implementation is neither certified nor even feature complete. However we'd like to present current state of our patchset to the Linux developers community to gain comments, fixes, ideas, etc. This is not yet a pull request, but more like an RFC.
Quoted 2 lines
Does this stack work with the Atmel USB version of at86rf230? ATAVRRZUSBSTICK, http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4396
No, we do not support Atmel USB sticks, nor we do not have plans for adding support
for it in the foreseable feature. However if the onboard ATmega can be programmed to
provide usb-serial interface, one can use/adapt our serial discipline driver to control it.
One will still have to write firmware for the on-stick ATmega chip.Or you can add support for any existing interface that is provided by RazorUSB card by yourself.
We tried to make mac802154 drivers easy to implement.
Quoted 6 lines
Quoted 2 lines
It's not so simple to plug in the at86rf230 using SPI. Supporting USB sticks lets you develop on a desktop PC.
Hmm. One can solder (e.g.) the FTDI 2232 together with AT86RF230/231 and use that combo
instead of RazorUSB sticks.
Everything is there on USB stick. Interface, Zigbee chip, antenna, power, etc.. And they are cheap $40.
Quoted 6 lines
Quoted 2 lines
freaklabs.org is using ATAVRRZUSBSTICK
I'll look for the interface they are using to control sticks and check how easy will it be to
write a driver for it.
For development purposes you don't want to download the stack into the USB stick, you just want to use USB as a transparent pass-through to the Zigbee chip.
I have a Raven kit ordered, it will be here next week.
Quoted 4 lines
--
With best wishes
Dmitry
Signature · 2 lines
Jon Smirl [email protected]
Quoted 10 lines · Dmitry Eremin-Solenikov
Hi,
As a part of research activities the Embedded Systems - Open Platform Group from Siemens Corporate Technology we are working on adding support for the IEEE 802.15.4 Wireless Personal Area Networks to the Linux. Our current implementation is neither certified nor even feature complete. However we'd like to present current state of our patchset to the Linux developers community to gain comments, fixes, ideas, etc. This is not yet a pull request, but more like an RFC.
Quoted 7 lines
The project page is available at http://apps.sourceforge.net/trac/linux-zigbee
with source code of kernel part available from git at
http://zigbee-linux.git.sourceforge.net, mirrored for convenience atgit://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.gitThe source code for userspace utils is available from git at
http://linux-zigbee.git.sourceforge.net/
The Zigbee alliance requires a minimum of $3,500/yr from any company making a product based on the spec. How are you going to reconcile this requirement with the GPL? They exempt non-commercial users but the GPL doesn't allow code to be free for one purpose and pay for another.
"The ZigBee Specification is available to individuals, companies and institutions free of charge for all non-commercial purposes (including university research, technical evaluation, and development of non-commercial software, tools, or documentation). For ease of use, clearly marked errata have been incorporated into this document. These errata may not have been subjected to an Intellectual Property review, and as such, may contain undeclared Necessary Claims. No part of this specification may be used in development of a product for sale without becoming a member of ZigBee Alliance. Copyright © ZigBee Alliance, Inc. (2005). All rights Reserved. This information within this document is the property of the ZigBee Alliance and its use and disclosure are restricted.Elements of ZigBee Alliance specifications may be subject to third party intellectual property rights, including without limitation, patent, copyright or trademark rights (such a third party may or may not be a member of ZigBee). ZigBee is not responsible and shall not be held responsible in any manner for identifying or failing to identify any or all such third party intellectual property rights. This document and the information contained herein are provided on an “AS IS” basis and ZigBee DISCLAIMS ALL WARRANTIES EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING WITH-OUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT OR TRADEMARK RIGHTS) OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT. IN NO EVENT WILL ZIGBEE BE LIABLE FOR ANY LOSS OF PROF-ITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE. All Company, brand and product names may be trademarks that are the sole property of their respective owners. <P>The above notice and this paragraph must be included on all copies of this document that are made. ZigBee Alliance, Inc.2400 Camino Ramon, Suite 375San Ramon, CA 94583"
Signature · 2 lines
Jon Smirl [email protected]
Quoted 13 lines · Jon Smirl
Quoted 10 lines · Dmitry Eremin-Solenikov
Hi,
As a part of research activities the Embedded Systems - Open Platform Group from Siemens Corporate Technology we are working on adding support for the IEEE 802.15.4 Wireless Personal Area Networks to the Linux. Our current implementation is neither certified nor even feature complete. However we'd like to present current state of our patchset to the Linux developers community to gain comments, fixes, ideas, etc. This is not yet a pull request, but more like an RFC.
Quoted 6 lines
The Zigbee alliance requires a minimum of $3,500/yr from any company making a product based on the spec. How are you going to reconcile this requirement with the GPL? They exempt non-commercial users but the GPL doesn't allow code to be free for one purpose and pay for another.
For now, we do not release any ZigBee implementation. BTW - could you refer to particular clause of GPL, which doesn't allow user to pay for code?
Regards,
Maxim
Quoted 21 lines · Maxim Osipov
Quoted 13 lines · Jon Smirl
Quoted 10 lines · Dmitry Eremin-Solenikov
Hi,
As a part of research activities the Embedded Systems - Open Platform Group from Siemens Corporate Technology we are working on adding support for the IEEE 802.15.4 Wireless Personal Area Networks to the Linux. Our current implementation is neither certified nor even feature complete. However we'd like to present current state of our patchset to the Linux developers community to gain comments, fixes, ideas, etc. This is not yet a pull request, but more like an RFC.
Quoted 6 lines
The Zigbee alliance requires a minimum of $3,500/yr from any company making a product based on the spec. How are you going to reconcile this requirement with the GPL? They exempt non-commercial users but the GPL doesn't allow code to be free for one purpose and pay for another.
Quoted 3 lines
For now, we do not release any ZigBee implementation. BTW - could you refer to particular clause of GPL, which doesn't allow user to pay for code?
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
You can charge a duplication fee when you do the copying. It is fine to charge for things like support or the hardware that comes with the software.
Quoted 4 lines
Regards,
Maxim
Signature · 2 lines
Jon Smirl [email protected]
Quoted 26 lines · Jon Smirl
Quoted 10 lines · Dmitry Eremin-Solenikov
Hi,
As a part of research activities the Embedded Systems - Open Platform Group from Siemens Corporate Technology we are working on adding support for the IEEE 802.15.4 Wireless Personal Area Networks to the Linux. Our current implementation is neither certified nor even feature complete. However we'd like to present current state of our patchset to the Linux developers community to gain comments, fixes, ideas, etc. This is not yet a pull request, but more like an RFC.
Quoted 7 lines
The project page is available at http://apps.sourceforge.net/trac/linux-zigbee
with source code of kernel part available from git at
http://zigbee-linux.git.sourceforge.net, mirrored for convenience atgit://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.gitThe source code for userspace utils is available from git at
http://linux-zigbee.git.sourceforge.net/The Zigbee alliance requires a minimum of $3,500/yr from any company making a product based on the spec. How are you going to reconcile this requirement with the GPL? They exempt non-commercial users but the GPL doesn't allow code to be free for one purpose and pay for another.
Quoted 9 lines
"The ZigBee Specification is available to individuals, companies and institutions free of charge for all non-commercial purposes (including university research, technical evaluation, and development of non-commercial software, tools, or documentation). For ease of use, clearly marked errata have been incorporated into this document. These errata may not have been subjected to an Intellectual Property review, and as such, may contain undeclared Necessary Claims. No part of this specification may be used in development of a product for sale without becoming a member of ZigBee Alliance. Copyright ? ZigBee Alliance,
Confusing legaleese, and probably void, too. If you can get hard copy of that book, and make sure your implementation is not derived work of that book, you are safe -- w.r.t. copyright. Someone would have to research the patents, or just move out of US.
Pavel
Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- 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