Subsystems (5)
Quoted 1 line
From Dmitry Eremin-Solenikov <[email protected]> # This line is ignored.
GIT:
From: Dmitry Eremin-Solenikov <[email protected]>
Subject: [RFC][PATCH 0/5] Please review the data-only IEEE 802.15.4 MAC implementation In-Reply-To:
Hello,
I'd like to submit several our next patches for linux-next inclusion (most probably not yet for 2.6.31 though). Could you please review them?
The following changes since commit 81e2a3d5b75cbf0b42428b9d5a7cc7c85be9e7a7:
Eric Dumazet (1):
atm: sk_wmem_alloc initial value is one
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git for-next
Darren Salt (1):
crc-itu-t: add bit-reversed calculation
Dmitry Eremin-Solenikov (5):
ieee802154: use standard routine for printing dumps
mac802154: add a software MAC 802.15.4 implementation
ieee802154: add virtual loopback driver
MAINTAINERS: fix IEEE 802.15.4 entry
Merge branch 'for-linus' into for-next
MAINTAINERS | 5 +- drivers/ieee802154/Kconfig | 13 + drivers/ieee802154/Makefile | 1 + drivers/ieee802154/fakelb.c | 345 +++++++++++++++ include/linux/crc-itu-t.h | 10 + include/linux/if.h | 2 + include/net/ieee802154/mac802154.h | 83 ++++ lib/Kconfig | 1 + lib/crc-itu-t.c | 17 + net/Kconfig | 1 + net/Makefile | 1 + net/ieee802154/af_ieee802154.c | 12 +- net/mac802154/Kconfig | 17 + net/mac802154/Makefile | 4 + net/mac802154/dev.c | 845 ++++++++++++++++++++++++++++++++++++ net/mac802154/mac802154.h | 62 +++ net/mac802154/mac_cmd.c | 94 ++++ net/mac802154/mdev.c | 298 +++++++++++++ net/mac802154/mib.h | 32 ++ net/mac802154/rx.c | 98 +++++ 20 files changed, 1930 insertions(+), 11 deletions(-) create mode 100644 drivers/ieee802154/fakelb.c 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/dev.c create mode 100644 net/mac802154/mac802154.h create mode 100644 net/mac802154/mac_cmd.c create mode 100644 net/mac802154/mdev.c create mode 100644 net/mac802154/mib.h create mode 100644 net/mac802154/rx.c
PATCH 1/5 ieee802154: use standard routine for printing dumps
Use print_hex_dump_bytes instead of self-written dumping function for outputting packet dumps.
--- net/ieee802154/af_ieee802154.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-)
net/ieee802154/af_ieee802154.c +3 -9
@@ -39,14 +39,6 @@#include "af802154.h" -#define DBG_DUMP (data, len) { \ - int i; \ - pr_debug("function: %s: data: len %d:\n", __func__, len); \ - for (i = 0; i < len; i++) {\ - pr_debug("%02x: %02x\n", i, (data)[i]); \ - } \ -} -/* * Utility function for families */
@@ -302,10 +294,12 @@ static struct net_proto_family ieee802154_family_ops = {static int ieee802154_rcv (struct sk_buff *skb,struct net_device *dev,struct packet_type *pt,struct net_device *orig_dev) { -DBG_DUMP (skb->data, skb->len);if (!netif_running (dev))return -ENODEV ;pr_debug ("got frame, type %d, dev %p\n" , dev->type, dev); +#ifdef DEBUG +print_hex_dump_bytes ("ieee802154_rcv " ,DUMP_PREFIX_NONE , skb->data, skb->len); +#endif if (!net_eq (dev_net (dev), &init_net)) goto drop;
Signature · 1 line
1.6.3.1
PATCH 2/5 crc-itu-t: add bit-reversed calculation
From: Darren Salt <[email protected]>
Changes since original patch by Darren:
* add 'select BITREVERSE'
* fix kerneldoc
--- include/linux/crc-itu-t.h | 10 ++++++++++ lib/Kconfig | 1 + lib/crc-itu-t.c | 17 +++++++++++++++++ 3 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/Kconfig +1 -0
@@ -45,6 +45,7 @@ config CRC_T10DIF config CRC_ITU_T tristate "CRC ITU-T V.41 functions" + select BITREVERSE help This option is provided for the case where no in-kernel-tree modules require CRC ITU-T V.41 functions, but a module built outside
lib/crc-itu-t.c +17 -0
@@ -64,6 +64,23 @@ 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 bit-reversed data buffer; +* +* @crc: previous CRC value +* @buffer: data pointer +* @len: number of bytes in the buffer +* +* Returns the updated CRC value +*/ +u16 crc_itu_t_bitreversed (u16 crc,const u8 *buffer,size_t len) +{ +while (len--) + crc =crc_itu_t_bitreversed_byte (crc, *buffer++); +return crc; +} +EXPORT_SYMBOL (crc_itu_t_bitreversed); +MODULE_DESCRIPTION ("CRC ITU-T V.41 calculations" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.6.3.1
PATCH 3/5 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.
Currently this is data-only part (no commands, no beacons). Control interfaces will follow up shortly.
Note this implementaion is neither certified, nor feature complete!
--- MAINTAINERS | 1 + include/linux/if.h | 2 + include/net/ieee802154/mac802154.h | 83 ++++ net/Kconfig | 1 + net/Makefile | 1 + net/mac802154/Kconfig | 17 + net/mac802154/Makefile | 4 + net/mac802154/dev.c | 845 ++++++++++++++++++++++++++++++++++++ net/mac802154/mac802154.h | 62 +++ net/mac802154/mac_cmd.c | 94 ++++ net/mac802154/mdev.c | 298 +++++++++++++ net/mac802154/mib.h | 32 ++ net/mac802154/rx.c | 98 +++++ 13 files changed, 1538 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/dev.c create mode 100644 net/mac802154/mac802154.h create mode 100644 net/mac802154/mac_cmd.c create mode 100644 net/mac802154/mdev.c create mode 100644 net/mac802154/mib.h create mode 100644 net/mac802154/rx.c
MAINTAINERS +1 -0
@@ -2829,6 +2829,7 @@ W: http://apps.sourceforge.net/trac/linux-zigbee T: git git://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.git S: Maintained F: net/ieee802154/ +F: net/mac802154/ F: drivers/ieee801254/ INTEGRITY MEASUREMENT ARCHITECTURE (IMA)
include/linux/if.h +2 -0
@@ -71,6 +71,8 @@* release skb->dst */ +#define IFF_IEEE802154_COORD 0x400/* IEEE802.15.4 PAN coordinator */ +#define IF_GET_IFACE 0x0001/* for querying only */ #define IF_GET_PROTO 0x0002
include/net/ieee802154/mac802154.h new file +83 -0
83 lines not on this page · raw message
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 +17 -0
@@ -0,0 +1,17 @@ +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). + + Note: this implementation is neither certified, nor feature + complete! We do not garantee that it is compatible w/ other + implementations, etc. + + 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 +4 -0
@@ -0,0 +1,4 @@ +obj-$(CONFIG_MAC802154) += mac802154.o +mac802154-objs := rx.o mdev.o dev.o mac_cmd.o + +EXTRA_CFLAGS += -Wall -DDEBUG
net/mac802154/dev.c new file +845 -0
845 lines not on this page · raw message
net/mac802154/mac802154.h new file +62 -0
62 lines not on this page · raw message
net/mac802154/mac_cmd.c new file +94 -0
94 lines not on this page · raw message
net/mac802154/mdev.c new file +298 -0
298 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/rx.c new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
1.6.3.1
PATCH 4/5 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 | 13 ++ drivers/ieee802154/Makefile | 1 + drivers/ieee802154/fakelb.c | 345 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 359 insertions(+), 0 deletions(-) create mode 100644 drivers/ieee802154/fakelb.c
drivers/ieee802154/Kconfig +13 -0
@@ -20,3 +20,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 +345 -0
345 lines not on this page · raw message
Signature · 1 line
1.6.3.1
PATCH 5/5 MAINTAINERS: fix IEEE 802.15.4 entry
IEEE 802.15.4 git tree was moved from my private area to shared one. Fix address accordingly.
Also note that our mailing list is moderated for non-subscribers.
--- MAINTAINERS | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
@@ -2824,9 +2824,9 @@ P: Dmitry Eremin-Solenikov M: [email protected] P: Sergey Lapin M: [email protected] -L: [email protected] +L: [email protected] (moderated for non-subscribers) W: http://apps.sourceforge.net/trac/linux-zigbee -T: git git://git.kernel.org/pub/scm/linux/kernel/git/lumag/lowpan.git +T: git git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git S: Maintained F: net/ieee802154/ F: drivers/ieee801254/
Signature · 1 line
1.6.3.1
Re: [PATCH 4/5] ieee802154: add virtual loopback driver
In reply to Dmitry Eremin-SolenikovQuoted 42 lines · Dmitry Eremin-Solenikov
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/fakelb.c new file +37
-0+static ssize_t +adddev_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t n) +{ +struct platform_device *pdev =to_platform_device (dev); +struct fake_priv *priv =platform_get_drvdata (pdev); +char hw[8 ] = {}; +int i, j, ch, err; + +for (i =0 , j =0 ; i <16 && j < n; j++) { + ch = buf[j]; +switch (buf[j]) { +default : +return -EINVAL ; + case '0'...'9': + ch -='0' ; +break ; + case 'A'...'F': + ch -='A' -10 ; +break ; + case 'a'...'f': + ch -='a' -10 ; +break ; +case ':' : +case '.' : +continue ; + } +if (i %2 ) + hw[i/2 ] = (hw[i/2 ] &0xf0 ) | ch; +else + hw[i/2 ] = ch <<4 ; + i++; + } +if (i !=16 ) +return -EINVAL ; + err =ieee802154fake_add_priv (dev, priv, hw); +if (err)
drivers/ieee802154/fakelb.c line 257
Quoted 10 lines
drivers/ieee802154/fakelb.c new file +10
-0+return err; +return n; +} + +static DEVICE_ATTR(adddev, 0200, NULL, adddev_store); + +static struct attribute *fake_attrs[] = { + &dev_attr_adddev.attr, +NULL , +};
No new sysfs interfaces for network device creation please. Please use the rtnl_link API.