IEEE 802.15.4 MAC layer basic implementation
Subsystems (4)
PATCH 1/1 IEEE 802.15.4 MAC layer basic implementation
Hi all,
the following patch series add basic support for IEEE 802.15.4 Medium Access Control layer.
The IEEE 802.15.4 Working Group focuses on the standardization of the bottom two layers of ISO/OSI protocol stack: Physical (PHY) and MAC. The MAC layer provides access control to a shared channel and reliable data delivery.
This series provide only basic features:
- interface for drivers registration
- RX/TX datapaths
- reduced mlme operations
- monitor device type support (used by network sniffers, e.g. Wireshark)
- IEEE 802.15.4 loopback driver
- documentation update
--
Since last post, series has been reworked to provide support for monitor device and loopback driver only.
--
The following changes since commit d1d182e00d72300e05b18e28372fab003d8d4a58:
wimax/i2400m: remove an unused variable (2011-12-16 15:57:03 -0500)
are available in the git repository at:
git://linux-zigbee.git.sourceforge.net/gitroot/linux-zigbee/kernel to_upstream
Alexander Smirnov (14):
mac802154: basic ieee802.15.4 device structures
mac802154: allocation of ieee802154 device
mac802154: RX data path
mac802154: TX data path
mac802154: define reduced mlme operations
mac802154: slave interfaces definition
mac802154: reduced mlme operations
mac802154: basic mib support
ieee802154: remove ieee802154 policy from globals
ieee802154: interface type to be added
mac802154: slaves manipulation routine
mac802154: monitor device support drivers/ieee802154: IEEE 802.15.4 loopback driver Documentation/networking/ieee802154: update MAC chapter
Documentation/networking/ieee802154.txt | 57 ++++++- drivers/ieee802154/Kconfig | 8 + drivers/ieee802154/Makefile | 1 + drivers/ieee802154/fakelb.c | 287 +++++++++++++++++++++++++++++++ include/linux/if_arp.h | 1 + include/linux/nl802154.h | 8 +- include/net/ieee802154_netdev.h | 22 ++- include/net/mac802154.h | 153 ++++++++++++++++ include/net/wpan-phy.h | 4 +- net/Kconfig | 1 + net/Makefile | 1 + net/ieee802154/ieee802154.h | 2 + net/ieee802154/nl-phy.c | 10 +- net/ieee802154/wpan-class.c | 1 + net/mac802154/Kconfig | 16 ++ net/mac802154/Makefile | 2 + net/mac802154/ieee802154_dev.c | 265 ++++++++++++++++++++++++++++ net/mac802154/mac802154.h | 102 +++++++++++ net/mac802154/mac_cmd.c | 43 +++++ net/mac802154/mib.c | 96 ++++++++++ net/mac802154/monitor.c | 115 ++++++++++++ net/mac802154/rx.c | 107 ++++++++++++ net/mac802154/tx.c | 113 ++++++++++++ 23 files changed, 1402 insertions(+), 13 deletions(-) create mode 100644 drivers/ieee802154/fakelb.c create mode 100644 include/net/mac802154.h create mode 100644 net/mac802154/Kconfig create mode 100644 net/mac802154/Makefile create mode 100644 net/mac802154/ieee802154_dev.c create mode 100644 net/mac802154/mac802154.h create mode 100644 net/mac802154/mac_cmd.c create mode 100644 net/mac802154/mib.c create mode 100644 net/mac802154/monitor.c create mode 100644 net/mac802154/rx.c create mode 100644 net/mac802154/tx.c
With best regards,
Alexander Smirnov
PATCH 1/14 mac802154: basic ieee802.15.4 device structures
The IEEE 802.15.4 Working Group focuses on the standardization of the bottom two layers of ISO/OSI protocol stack: Physical (PHY) and MAC. The MAC layer provides access control to a shared channel and reliable data delivery. The main functions performed by the MAC sublayer are:
association and disassociation, security control, optional star network topology functions, such as beacon generation and Guaranteed Time Slots (GTSs) management, generation of ACK frames (if used), and, finally, application support for the two possible network topologies described in the standard.
This is an initial commit which describes main data structures needed for ieee802.15.4 compatible devices representation in MAC layer and callbacks that the driver may, or in some cases, must handle, for example to transmit a frame
--- include/net/mac802154.h | 145 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 145 insertions(+), 0 deletions(-) create mode 100644 include/net/mac802154.h
include/net/mac802154.h new file +145 -0
@@ -0,0 +1,145 @@ +/* +* IEEE802.15.4-2003 specification +* +* Copyright (C) 2007-2011 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 NET_MAC802154_H +#define NET_MAC802154_H + +#include <net/af_ieee802154.h> + +/** +* enum ieee802154_hw_addr_filt_flags - hardware flags +* +* These flags are used to indicate changed address settings from +* the stack to the hardware. +* +* @IEEE802515_SADDR_CHANGED: +* Indicates that the Short Address changed +* +* @IEEE802515_IEEEADDR_CHANGED: +* Indicates that the IEEE Address changed +* +* @IEEE802515_PANID_CHANGED: +* Indicates that the PAN ID changed +* +* @IEEE802515_PANC_CHANGED: +* Indicates that PAN Coordinator status changed +*/ +enum ieee802154_hw_addr_filt_flags { +IEEE802515_SADDR_CHANGED =1 <<0 , +IEEE802515_IEEEADDR_CHANGED =1 <<1 , +IEEE802515_PANID_CHANGED =1 <<2 , +IEEE802515_PANC_CHANGED =1 <<3 , +}; + +struct ieee802154_hw_addr_filt { +u16 pan_id; +u16 short_addr; +u8 ieee_addr[IEEE802154_ADDR_LEN ]; +u8 pan_coord; +}; + +struct ieee802154_dev { +/* filled by the driver */ +int extra_tx_headroom;/* headroom to reserve for tx skb */ +u32 flags;/* Flags for device to set */ +struct device *parent; + +/* filled by mac802154 core */ +struct ieee802154_hw_addr_filt hw_filt; +void *priv;/* driver-specific data */ +struct wpan_phy *phy; +}; + +/* Checksum is in hardware and is omitted from packet */ +/** +* enum ieee802154_hw_flags - hardware flags +* +* These flags are used to indicate hardware capabilities to +* the stack. Generally, flags here should have their meaning +* done in a way that the simplest hardware doesn't need setting +* any particular flags. There are some exceptions to this rule, +* however, so you are advised to review these flags carefully. +* +* @IEEE802154_HW_OMIT_CKSUM: +* Indicates that receiver omits FCS and transmitter will add +* FCS on it's own. +* +* @IEEE802154_HW_AACK: +* Indicates that receiver will autorespond with ACK frames. +*/ +enum ieee802154_hw_flags { +IEEE802154_HW_OMIT_CKSUM =1 <<0 , +IEEE802154_HW_AACK =1 <<1 , +}; + +/** +* struct ieee802154_ops - callbacks from mac802154 to the driver +* +* This structure contains various callbacks that the driver may +* handle or, in some cases, must handle, for example to transmit +* a frame. +* +* @start: Handler that 802.15.4 module calls for device initialisation. +* This function is called before the first interface is attached. +* +* @stop: Handler that 802.15.4 module calls for device cleanup +* This function is called after the last interface is removed. +* +* @xmit: Handler that 802.15.4 module calls for each transmitted frame. +* skb cntains the buffer starting from the IEEE 802.15.4 header. +* The low-level driver should send the frame based on available +* configuration. +* This function should return zero or negative errno. +* Called with pib_lock held. +* +* @ed: Handler that 802.15.4 module calls for Energy Detection. +* This function should place the value for detected energy +* (usually device-dependant) in the level pointer and return +* either zero or negative errno. +* Called with pib_lock held. +* +* @set_channel: Set radio for listening on specific channel. +* Set the device for listening on specified channel. +* Returns either zero, or negative errno. +* Called with pib_lock held. +* +* @set_hw_addr_filt: Set radio for listening on specific address. +* Set the device for listening on specified address. +* Returns either zero, or negative errno. +*/ +struct ieee802154_ops { +struct module *owner; +int (*start)(struct ieee802154_dev *dev); +void (*stop)(struct ieee802154_dev *dev); +int (*xmit)(struct ieee802154_dev *dev, +struct sk_buff *skb); +int (*ed)(struct ieee802154_dev *dev,u8 *level); +int (*set_channel)(struct ieee802154_dev *dev, +int page, +int channel); +int (*set_hw_addr_filt)(struct ieee802154_dev *dev, +struct ieee802154_hw_addr_filt *filt, +unsigned long changed); +int (*ieee_addr)(struct ieee802154_dev *dev, +u8 addr[IEEE802154_ADDR_LEN ]); +}; + +int ieee802154_register_device (struct ieee802154_dev *dev); +void ieee802154_unregister_device (struct ieee802154_dev *dev); + +#endif /* NET_MAC802154_H */
Signature · 1 line
1.7.2.3
David Miller
maintainerRe: [PATCH 01/14] mac802154: basic ieee802.15.4 device structures
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:41 +0300
include/net/mac802154.h line 54
Quoted 6 lines
include/net/mac802154.h new file +6
-0+struct ieee802154_hw_addr_filt { +u16 pan_id; +u16 short_addr; +u8 ieee_addr[IEEE802154_ADDR_LEN ]; +u8 pan_coord; +};
What is the endianness of pan_id and short_addr objects? You should use the appropriate endianness types "__be16, __le16" and accessors to represent this.
If you're storing them in cpu byte order, why?
PATCH 2/14 mac802154: allocation of ieee802154 device
In reply to Alexander SmirnovInterface for device drivers to allocate and register ieee802154 compatible devices.
--- net/Kconfig | 1 + net/Makefile | 1 + net/mac802154/Kconfig | 16 +++++ net/mac802154/Makefile | 2 + net/mac802154/ieee802154_dev.c | 124 ++++++++++++++++++++++++++++++++++++++++ net/mac802154/mac802154.h | 61 ++++++++++++++++++++ 6 files changed, 205 insertions(+), 0 deletions(-) create mode 100644 net/mac802154/Kconfig create mode 100644 net/mac802154/Makefile create mode 100644 net/mac802154/ieee802154_dev.c create mode 100644 net/mac802154/mac802154.h
net/Kconfig +1 -0
@@ -211,6 +211,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" source "net/dns_resolver/Kconfig"
net/Makefile +1 -0
@@ -60,6 +60,7 @@ ifneq ($(CONFIG_DCB),) obj-y += dcb/ endif obj-$(CONFIG_IEEE802154) += ieee802154/ +obj-$(CONFIG_MAC802154) += mac802154/ ifeq ($(CONFIG_NET),y) obj-$(CONFIG_SYSCTL) += sysctl_net.o
net/mac802154/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +config MAC802154 + tristate "Generic IEEE 802.15.4 Soft Networking Stack (mac802154)" + depends on IEEE802154 && EXPERIMENTAL + select CRC_CCITT + ---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! Compatibility with other implementations hasn't + been tested yet! + + 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 +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_MAC802154) += mac802154.o +mac802154-objs := ieee802154_dev.o
net/mac802154/ieee802154_dev.c new file +124 -0
124 lines not on this page · raw message
net/mac802154/mac802154.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
1.7.2.3
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-2-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 02/14] mac802154: allocation of ieee802154 device
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:42 +0300
net/mac802154/ieee802154_dev.c line 41
Quoted 1 line
net/mac802154/ieee802154_dev.c new file +1
-0+ phy =wpan_phy_alloc (ALIGN (sizeof (*priv),NETDEV_ALIGN ) + priv_size);
WHy make the call sites have to be cognizant of all of these crazy alignment calculations?
Make wpan_phy_alloc() take care of it, and just pass the minimum amount of information necessary for it to calculate the right size.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 3/14 mac802154: RX data path
In reply to Alexander SmirnovMain RX data path implementation between physical and mac layers. Both contexts are supported: interrupt (data processed via worker) and non-interrupt (data processed directly).
--- include/net/ieee802154_netdev.h | 2 + include/net/mac802154.h | 4 ++ net/mac802154/Makefile | 2 +- net/mac802154/rx.c | 106 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 1 deletions(-) create mode 100644 net/mac802154/rx.c
include/net/ieee802154_netdev.h +2 -0
@@ -26,6 +26,8 @@#ifndef IEEE802154_NETDEVICE_H #define IEEE802154_NETDEVICE_H +#include <net/af_ieee802154.h> +/* * A control block of skb passed between the ARPHRD_IEEE802154 device * and other stack parts.
include/net/mac802154.h +4 -0
@@ -142,4 +142,8 @@ struct ieee802154_ops {int ieee802154_register_device (struct ieee802154_dev *dev);void ieee802154_unregister_device (struct ieee802154_dev *dev); +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_MAC802154_H */
net/mac802154/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_MAC802154) += mac802154.o -mac802154-objs := ieee802154_dev.o +mac802154-objs := ieee802154_dev.o rx.o
net/mac802154/rx.c new file +106 -0
106 lines not on this page · raw message
Signature · 1 line
1.7.2.3
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-3-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 03/14] mac802154: RX data path
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:43 +0300
include/net/mac802154.h struct ieee802154_ops { · line 147
Quoted 3 lines
include/net/mac802154.h +3
-0+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);
Line up the "u8 lqi" argument with the openning parenthesis on the previous line.
net/mac802154/rx.c line 40
Quoted 6 lines
net/mac802154/rx.c new file +6
-0+static void +mac802154_subif_rx (struct ieee802154_dev *hw,struct sk_buff *skb,u8 lqi) +{ +struct mac802154_priv *priv =mac802154_to_priv (hw); + +BUG_ON (!skb);
This assertion is excessive.
You are adding all of the call sites, therefore you can see if the SKB argument is NULL or not.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 4/14 mac802154: TX data path
In reply to Alexander SmirnovMain TX data path implementation between upper and physical layers.
--- net/mac802154/Makefile | 2 +- net/mac802154/mac802154.h | 5 ++ net/mac802154/tx.c | 113 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletions(-) create mode 100644 net/mac802154/tx.c
net/mac802154/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_MAC802154) += mac802154.o -mac802154-objs := ieee802154_dev.o rx.o +mac802154-objs := ieee802154_dev.o rx.o tx.o
net/mac802154/mac802154.h +5 -0
@@ -58,4 +58,9 @@ enum {#define mac802154_to_priv (_hw) container_of(_hw, struct mac802154_priv, hw) +#define MAC802154_MAX_XMIT_ATTEMPTS 3 + +netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb, +u8 page,u8 chan); +#endif /* MAC802154_H */
net/mac802154/tx.c new file +113 -0
113 lines not on this page · raw message
Signature · 1 line
1.7.2.3
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-4-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 04/14] mac802154: TX data path
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:44 +0300
net/mac802154/mac802154.h enum { · line 64
Quoted 2 lines
net/mac802154/mac802154.h +2
-0+netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb, +u8 page,u8 chan);
Line up these arguments on the second line correctly!
If you can't do it properly by hand, use something like emacs's "C mode" to do it for you automatically.
net/mac802154/tx.c line 52
Quoted 3 lines
net/mac802154/tx.c new file +3
-0+ res = xw->priv->ops->set_channel (&xw->priv->hw, + xw->page, + xw->chan);
Line up the arguments properly.
net/mac802154/tx.c line 54
Quoted 1 line
net/mac802154/tx.c new file +1
-0+pr_debug ("(%s): set_channel failed\n" , __func__);
Putting __func__ into the debugging printk's is excessive, take these out.
net/mac802154/tx.c line 84
Quoted 2 lines
net/mac802154/tx.c new file +2
-0+if (WARN_ON (!(priv->phy->channels_supported[page] & + (1 << chan))))
More poor formatting.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 14/14 Documentation/networking/ieee802154: update MAC chapter
In reply to Alexander SmirnovUpdate the documentation according to latest changes.
--- Documentation/networking/ieee802154.txt | 57 +++++++++++++++++++++++++++---- 1 files changed, 50 insertions(+), 7 deletions(-)
Documentation/networking/ieee802154.txt +50 -7
@@ -4,15 +4,22 @@ Introduction ============ +The IEEE 802.15.4 working group focuses on standartization of bottom +two layers: Medium Accsess Control (MAC) and Physical (PHY). And there +are mainly two options available for upper layers: + - ZigBee - proprietary protocol from ZigBee Alliance + - 6LowPAN - IPv6 networking over low rate personal area networks The Linux-ZigBee project goal is to provide complete implementation -of IEEE 802.15.4 / ZigBee / 6LoWPAN protocols. IEEE 802.15.4 is a stack +of IEEE 802.15.4 and 6LoWPAN protocols. IEEE 802.15.4 is a stack of protocols for organizing Low-Rate Wireless Personal Area Networks. -Currently only IEEE 802.15.4 layer is implemented. We have chosen -to use plain Berkeley socket API, the generic Linux networking stack -to transfer IEEE 802.15.4 messages and a special protocol over genetlink -for configuration/management +The stack is composed of three main parts: + - IEEE 802.15.4 layer; We have chosen to use plain Berkeley socket API, + the generic Linux networking stack to transfer IEEE 802.15.4 messages + and a special protocol over genetlink for configuration/management + - MAC - provides access to shared channel and reliable data delivery + - PHY - represents device drivers Socket API
@@ -73,11 +80,47 @@ We provide an example of simple HardMAC driver at drivers/ieee802154/fakehard.c SoftMAC ======= -We are going to provide intermediate layer implementing IEEE 802.15.4 MAC -in software. This is currently WIP. +The MAC is the middle layer in the IEEE 802.15.4 Linux stack. This moment it +provides interface for drivers registration and management of slave interfaces. + +NOTE: Currently the only monitor device type is supported - it's IEEE 802.15.4 +stack interface for network sniffers (e.g. WireShark). + +This layer is going to be extended soon. See header include/net/mac802154.h and several drivers in drivers/ieee802154/. + +Device drivers API +================== + +The include/net/mac802154.h defines following functions: + - struct ieee802154_dev *ieee802154_alloc_device + (size_t priv_size, struct ieee802154_ops *ops): + allocation of IEEE 802.15.4 compatible device + + - void ieee802154_free_device(struct ieee802154_dev *dev): + freeing allocated device + + - int ieee802154_register_device(struct ieee802154_dev *dev): + register PHY in the system + + - void ieee802154_unregister_device(struct ieee802154_dev *dev): + freeing registered PHY + +Moreover IEEE 802.15.4 device operations structure should be filled. + +Fake drivers +============ + +In addition there are two drivers available which simulate real devices with +HardMAC (fakehard) and SoftMAC (fakelb - IEEE 802.15.4 loopback driver) +interfaces. This option provides possibility to test and debug stack without +usage of real hardware. + +See sources in drivers/ieee802154 folder for more details. + + 6LoWPAN Linux implementation ============================
Signature · 1 line
1.7.2.3
A message that is not in the archive (sent off-list or not yet received): 20111219163117.GA13123-AUGNqIMGY+bGcXpsla5Oef8+0UxHXcjY@public.gmane.org
PATCH 5/14 mac802154: define reduced mlme operations
According IEEE 802.15.4 standard each node can be either full functionality device (FFD) or reduce functionality device (RFD). So 2 sets of operations are needed. This patch define RFD operations structure.
--- include/net/ieee802154_netdev.h | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-)
include/net/ieee802154_netdev.h +18 -2
@@ -83,6 +83,14 @@ struct wpan_phy;* get_phy should increment the reference counting on returned phy. * Use wpan_wpy_put to put that reference. */ + +/* +* The IEEE 802.15.4 standard defines 2 type of devices: +* - FFD - full functionality device +* - RFD - reduce functionality device +* +* So 2 sets of mlme operations are needed +*/ struct ieee802154_mlme_ops { int (*assoc_req)(struct net_device *dev, struct ieee802154_addr *addr,
@@ -112,12 +120,20 @@ struct ieee802154_mlme_ops { u8 (*get_bsn)(const struct net_device *dev); }; +struct ieee802154_reduced_mlme_ops { +struct wpan_phy *(*get_phy)(const struct net_device *dev); +}; +static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops (const struct net_device *dev) {return dev->ml_priv; } -#endif - +static inline struct ieee802154_reduced_mlme_ops *ieee802154_reduced_mlme_ops ( +const struct net_device *dev) +{ +return dev->ml_priv; +} +#endif
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 6/14 mac802154: slave interfaces definition
In reply to a message not in the archiveSlaves represent typical network interfaces available from userspace. Each ieee802154 device/transceiver may have several slaves and able to be associated with several networks at the same time.
--- net/mac802154/mac802154.h | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
net/mac802154/mac802154.h +25 -0
@@ -56,6 +56,31 @@ enum { MAC802154_DEVICE_RUN, }; +/* +* Slave interface definition +*/ +struct mac802154_sub_if_data { +struct list_head list;/* the ieee802154_priv->slaves list */ + +struct mac802154_priv *hw; +struct net_device *dev; + +int type; + +spinlock_t mib_lock; + +u16 pan_id; +u16 short_addr; + +u8 chan; +u8 page; + +/* MAC BSN field */ +u8 bsn; +/* MAC DSN field */ +u8 dsn; +}; +#define mac802154_to_priv (_hw) container_of(_hw, struct mac802154_priv, hw)#define MAC802154_MAX_XMIT_ATTEMPTS 3
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-6-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 06/14] mac802154: slave interfaces definition
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:46 +0300
net/mac802154/mac802154.h enum { · line 73
Quoted 2 lines
net/mac802154/mac802154.h +2
-0+u16 pan_id; +u16 short_addr;
Again, endianness of these values, use the proper types and accessors etc.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 7/14 mac802154: reduced mlme operations
In reply to a message not in the archiveInitialize set of reduced operations.
--- net/mac802154/Makefile | 2 +- net/mac802154/mac802154.h | 2 ++ net/mac802154/mac_cmd.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletions(-) create mode 100644 net/mac802154/mac_cmd.c
net/mac802154/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_MAC802154) += mac802154.o -mac802154-objs := ieee802154_dev.o rx.o tx.o +mac802154-objs := ieee802154_dev.o rx.o tx.o mac_cmd.o
net/mac802154/mac802154.h +2 -0
@@ -85,6 +85,8 @@ struct mac802154_sub_if_data {#define MAC802154_MAX_XMIT_ATTEMPTS 3 +extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced; +netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb,u8 page,u8 chan);
net/mac802154/mac_cmd.c new file +43 -0
43 lines not on this page · raw message
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 8/14 mac802154: basic mib support
In reply to a message not in the archiveBasic support for IEEE 802.15.4 management information base. Currently setting of HW address is implemented only.
--- net/mac802154/Makefile | 2 +- net/mac802154/mac802154.h | 3 + net/mac802154/mib.c | 96 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 1 deletions(-) create mode 100644 net/mac802154/mib.c
net/mac802154/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_MAC802154) += mac802154.o -mac802154-objs := ieee802154_dev.o rx.o tx.o mac_cmd.o +mac802154-objs := ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o
net/mac802154/mac802154.h +3 -0
@@ -90,4 +90,7 @@ extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb,u8 page,u8 chan); +/* MIB callbacks */ +void mac802154_dev_set_ieee_addr (struct net_device *dev); +#endif /* MAC802154_H */
net/mac802154/mib.c new file +96 -0
96 lines not on this page · raw message
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-8-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 08/14] mac802154: basic mib support
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:48 +0300
net/mac802154/mib.c line 58
Quoted 2 lines
net/mac802154/mib.c new file +2
-0+ res = hw->ops->set_hw_addr_filt (&hw->hw, + &hw->hw.hw_filt, nw->changed);
Line up the arguments.
net/mac802154/mib.c line 61
Quoted 2 lines
net/mac802154/mib.c new file +2
-0+pr_debug ("%s: failed changed mask %lx\n" , + __func__, nw->changed);
Get rid of __func__.
net/mac802154/mib.c line 91
Quoted 3 lines
net/mac802154/mib.c new file +3
-0+if (priv->hw->ops->set_hw_addr_filt && +memcmp (priv->hw->hw.hw_filt.ieee_addr, + dev->dev_addr,IEEE802154_ADDR_LEN )) {
More bad formatting.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 9/14 ieee802154: remove ieee802154 policy from globals
In reply to a message not in the archiveMove ieee802154 netlink policy array definition inside ieee802154 layer.
--- include/linux/nl802154.h | 2 -- net/ieee802154/ieee802154.h | 2 ++ net/ieee802154/wpan-class.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
include/linux/nl802154.h +0 -2
@@ -74,8 +74,6 @@ enum {#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) -extern const struct nla_policy ieee802154_policy[]; -/* commands */ /* REQ should be responded with CONF * and INDIC with RESP
net/ieee802154/ieee802154.h +2 -0
@@ -21,6 +21,8 @@int __init ieee802154_nl_init (void ); void __exit ieee802154_nl_exit(void); +extern const struct nla_policy ieee802154_policy[]; +#define IEEE802154_OP (_cmd, _func) \ { \ .cmd = _cmd, \
net/ieee802154/wpan-class.c +1 -0
@@ -21,6 +21,7 @@#include <linux/module.h> #include <linux/device.h> +#include <net/netlink.h> #include <net/wpan-phy.h> #include "ieee802154.h"
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-9-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 09/14] ieee802154: remove ieee802154 policy from globals
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:49 +0300
Quoted 3 lines
Move ieee802154 netlink policy array definition inside ieee802154 layer.
Signed-off-by Alexander Smirnov <[email protected]>
Then mark the thing static at it's definition, don't just remove all the externs like this.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 10/14 ieee802154: interface type to be added
In reply to a message not in the archiveFrom: Alexander Smirnov <alexander@Lenovo.(none)>
This stack supports several types of slaves interfaces. Another parameter to 'add_iface_ function added.
--- include/linux/nl802154.h | 5 +++++ include/net/wpan-phy.h | 2 +- net/ieee802154/nl-phy.c | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-)
include/linux/nl802154.h +5 -0
@@ -68,6 +68,7 @@ enum {IEEE802154_ATTR_CHANNEL_PAGE_LIST ,IEEE802154_ATTR_PHY_NAME , +IEEE802154_ATTR_DEV_TYPE , __IEEE802154_ATTR_MAX, };
@@ -124,4 +125,8 @@ enum {#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) +enum { + __IEEE802154_DEV_MAX, +}; +#endif
include/net/wpan-phy.h +1 -1
@@ -42,7 +42,7 @@ struct wpan_phy {int idx;struct net_device *(*add_iface)(struct wpan_phy *phy, -const char *name); +const char *name,int type);void (*del_iface)(struct wpan_phy *phy,struct net_device *dev); char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
net/ieee802154/nl-phy.c +9 -1
@@ -179,6 +179,7 @@ static int ieee802154_add_iface(struct sk_buff *skb,const char *devname;int rc = -ENOBUFS ;struct net_device *dev; +int type = -EINVAL ;pr_debug ("%s\n" , __func__);
@@ -221,7 +222,14 @@ static int ieee802154_add_iface(struct sk_buff *skb, goto nla_put_failure; } - dev = phy->add_iface (phy, devname); +if (info->attrs[IEEE802154_ATTR_DEV_TYPE ]) { + type =nla_get_u8 (info->attrs[IEEE802154_ATTR_DEV_TYPE ]); +if (type > __IEEE802154_DEV_MAX) { +return -EINVAL ; + } + } + + dev = phy->add_iface (phy, devname, type);if (IS_ERR (dev)) { rc =PTR_ERR (dev); goto nla_put_failure;
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-10-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 10/14] ieee802154: interface type to be added
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:50 +0300
net/ieee802154/nl-phy.c static int ieee802154_add_iface(struct sk_buff *skb, · line 182
Quoted 3 lines
net/ieee802154/nl-phy.c +1
-0int rc = -ENOBUFS ;struct net_device *dev; +int type = -EINVAL ;
Bad indentation.
Or do you mean to tell me this doesn't look like total garbage and stand out like a sore thumb on your computer screen?
net/ieee802154/nl-phy.c static int ieee802154_add_iface(struct sk_buff *skb, · line 229
Quoted 3 lines
net/ieee802154/nl-phy.c +3
-0+if (type > __IEEE802154_DEV_MAX) { +return -EINVAL ; + }
No need for openning and closing braces here, there is simply one statement in the basic block.
If you'll need them later, add them later, not now.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
PATCH 11/14 mac802154: slaves manipulation routine
In reply to a message not in the archiveFrom: Alexander Smirnov <alexander@Lenovo.(none)>
This patch adds interface for registration and removing slaves in the system.
--- include/net/mac802154.h | 4 + net/mac802154/ieee802154_dev.c | 140 +++++++++++++++++++++++++++++++++++++++- net/mac802154/mac802154.h | 3 + 3 files changed, 146 insertions(+), 1 deletions(-)
include/net/mac802154.h +4 -0
@@ -139,6 +139,10 @@ struct ieee802154_ops { u8 addr[IEEE802154_ADDR_LEN]); }; +struct ieee802154_dev *ieee802154_alloc_device (size_t priv_size, +struct ieee802154_ops *ops); +void ieee802154_free_device (struct ieee802154_dev *dev); +int ieee802154_register_device (struct ieee802154_dev *dev);void ieee802154_unregister_device (struct ieee802154_dev *dev);
net/mac802154/ieee802154_dev.c +139 -1
176 lines not on this page · raw message
net/mac802154/mac802154.h +3 -0
@@ -87,6 +87,9 @@ struct mac802154_sub_if_data {extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced; +int mac802154_slave_open (struct net_device *dev); +int mac802154_slave_close (struct net_device *dev); +netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb,u8 page,u8 chan);
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-11-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 11/14] mac802154: slaves manipulation routine
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:51 +0300
include/net/mac802154.h struct ieee802154_ops { · line 143
Quoted 2 lines
include/net/mac802154.h +2
-0+struct ieee802154_dev *ieee802154_alloc_device (size_t priv_size, +struct ieee802154_ops *ops);
Line up the arguments properly.
net/mac802154/ieee802154_dev.c line 34
Quoted 2 lines
net/mac802154/ieee802154_dev.c +2
-0+if (priv->hw->open_count++ ==0 ) { + res = priv->hw->ops->start (&priv->hw->hw);
That's terrible, fix up the indentation.
net/mac802154/ieee802154_dev.c line 62
Quoted 1 line
net/mac802154/ieee802154_dev.c +1
-0+if ((--priv->hw->open_count) ==0 )
This is more canonical as "if (!--priv->hw->open_count)".
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
Re: [PATCH 11/14] mac802154: slaves manipulation routine
Quoted 3 lines · David Miller
From: Alexander Smirnov <[email protected]>
net/mac802154/ieee802154_dev.c line 62
Quoted 1 line
net/mac802154/ieee802154_dev.c +1
-0+if ((--priv->hw->open_count) ==0 )This is more canonical as "if (!--priv->hw->open_count)".
Shrug. I think this is more readable and
intelligible with the == 0.
A test of a non-bool or non-ptr to a specific value seems reasonable to me.
PATCH 12/14 mac802154: monitor device support
In reply to a message not in the archiveFrom: Alexander Smirnov <alexander@Lenovo.(none)>
Support for monitor device intended to capture all the network activity. This interface could be used by networks sniffers.
--- include/linux/if_arp.h | 1 + include/linux/nl802154.h | 1 + include/net/wpan-phy.h | 2 + net/mac802154/Makefile | 2 +- net/mac802154/ieee802154_dev.c | 5 ++- net/mac802154/mac802154.h | 3 + net/mac802154/monitor.c | 115 ++++++++++++++++++++++++++++++++++++++++ net/mac802154/rx.c | 1 + 8 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 net/mac802154/monitor.c
include/linux/if_arp.h +1 -0
@@ -87,6 +87,7 @@#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_MONITOR 805/* IEEE 802.15.4 network monitor */ #define ARPHRD_PHONET 820/* PhoNet media type */ #define ARPHRD_PHONET_PIPE 821/* PhoNet pipe header */
include/linux/nl802154.h +1 -0
@@ -126,6 +126,7 @@ enum {#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)enum { +IEEE802154_DEV_MONITOR =1 ,/* for compatibility with WireShark */ __IEEE802154_DEV_MAX, };
include/net/wpan-phy.h +2 -0
@@ -24,6 +24,8 @@#include <linux/netdevice.h> #include <linux/mutex.h> +#define WPAN_NUM_PAGES 32 +struct wpan_phy {struct mutex pib_lock;
net/mac802154/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_MAC802154) += mac802154.o -mac802154-objs := ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o +mac802154-objs := ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o monitor.o
net/mac802154/ieee802154_dev.c +4 -1
@@ -126,8 +126,11 @@ static struct net_device *mac802154_add_iface(struct wpan_phy *phy,struct net_device *dev;int err = -ENOMEM ; -/* No devices is currently supported */ switch (type) { +case IEEE802154_DEV_MONITOR : + dev =alloc_netdev (sizeof (struct mac802154_sub_if_data ), + name, mac802154_monitor_setup); +break ;default : dev =NULL ; err = -EINVAL ;
net/mac802154/mac802154.h +3 -0
@@ -90,6 +90,9 @@ extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;int mac802154_slave_open (struct net_device *dev);int mac802154_slave_close (struct net_device *dev); +void mac802154_monitors_rx (struct mac802154_priv *priv,struct sk_buff *skb); +void mac802154_monitor_setup (struct net_device *dev); +netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb,u8 page,u8 chan);
net/mac802154/monitor.c new file +115 -0
115 lines not on this page · raw message
net/mac802154/rx.c +1 -0
@@ -60,6 +60,7 @@ mac802154_subif_rx(struct ieee802154_dev *hw, struct sk_buff *skb, u8 lqi)skb_trim (skb, skb->len -2 );/* CRC */ } +mac802154_monitors_rx (priv, skb); out:dev_kfree_skb (skb);return ;
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
David Miller
maintainerRe: [PATCH 12/14] mac802154: monitor device support
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:52 +0300
include/linux/nl802154.h enum { · line 129
Quoted 1 line
include/linux/nl802154.h +1
-0+ IEEE802154_DEV_MONITOR = 1, /* for compatibility with WireShark */
What's this "compatability" all about? Explain it.
net/mac802154/ieee802154_dev.c static struct net_device *mac802154_add_iface(struct wpan_phy *phy, · line 132
Quoted 2 lines
net/mac802154/ieee802154_dev.c +2
-0+ dev =alloc_netdev (sizeof (struct mac802154_sub_if_data ), + name, mac802154_monitor_setup);
Line up the arguments properly.
Quoted 69 lines
net/mac802154/ieee802154_dev.c +1
-0+break ;default : dev =NULL ; err = -EINVAL ;net/mac802154/mac802154.h +3
-0@@ -90,6 +90,9 @@ extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;int mac802154_slave_open (struct net_device *dev);int mac802154_slave_close (struct net_device *dev); +void mac802154_monitors_rx (struct mac802154_priv *priv,struct sk_buff *skb); +void mac802154_monitor_setup (struct net_device *dev); +netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb,u8 page,u8 chan);net/mac802154/monitor.c new file +45
-0@@ -0,0 +1,115 @@ +/* +* 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: +* Dmitry Eremin-Solenikov <[email protected]> +* Sergey Lapin <[email protected]> +* Maxim Gorbachyov <[email protected]> +*/ + +#include <linux/netdevice.h> +#include <linux/skbuff.h> +#include <linux/if_arp.h> +#include <linux/crc-ccitt.h> +#include <linux/nl802154.h> +#include <net/ieee802154.h> +#include <net/mac802154.h> +#include <net/wpan-phy.h> + +#include "mac802154.h" + +static netdev_tx_t mac802154_monitor_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct mac802154_sub_if_data *priv; +u8 chan, page; + + priv =netdev_priv (dev); + +/* FIXME: locking */ + chan = priv->hw->phy->current_channel; + page = priv->hw->phy->current_page; + +if (chan == (u8)-1 )/* not init */
...
net/mac802154/monitor.c line 112
Quoted 1 line
net/mac802154/monitor.c new file +1
-0+ priv->chan =-1 ;/* not initialized */
This mixing of the integer "-1" value with a "u8" type is asking for trouble. Define something like:
#define MAC802154_CHAN_NONE 0xff
or
#define MAC802154_CHAN_NONE (~(u8)0)
and use it consistently.
PATCH 13/14 drivers/ieee802154: IEEE 802.15.4 loopback driver
In reply to a message not in the archiveFrom: Alexander Smirnov <alexander@Lenovo.(none)>
Add support for loopback driver. It's very useful tool for testing and development upper IEEE 802.15.4 layer.
--- drivers/ieee802154/Kconfig | 8 ++ drivers/ieee802154/Makefile | 1 + drivers/ieee802154/fakelb.c | 287 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+), 0 deletions(-) create mode 100644 drivers/ieee802154/fakelb.c
drivers/ieee802154/Kconfig +8 -0
@@ -19,4 +19,12 @@ config IEEE802154_FAKEHARD This driver can also be built as a module. To do so say M here. The module will be called 'fakehard'. +config IEEE802154_FAKELB + depends on IEEE802154_DRIVERS && MAC802154 + tristate "IEEE 802.15.4 loopback driver" + ---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'.
drivers/ieee802154/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o +obj-$(CONFIG_IEEE802154_FAKELB) += fakelb.o
drivers/ieee802154/fakelb.c new file +287 -0
287 lines not on this page · raw message
Signature · 9 lines
1.7.2.3 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure
A message that is not in the archive (sent off-list or not yet received): 1324312434-13151-13-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 13/14] drivers/ieee802154: IEEE 802.15.4 loopback driver
From: Alexander Smirnov <[email protected]>
Date: Mon, 19 Dec 2011 19:33:53 +0300
drivers/ieee802154/fakelb.c line 40
Quoted 1 line
drivers/ieee802154/fakelb.c new file +1
-0+ unsigned int working:1;
Integer bit fields are troublesome, use a set of flags here, or if this is likely to be the only set of state use a "bool" type.
drivers/ieee802154/fakelb.c line 103
Quoted 5 lines
drivers/ieee802154/fakelb.c new file +5
-0+list_for_each_entry (dp, &priv->fake->list, list) +if (dp != priv && + dp->dev->phy->current_channel == + priv->dev->phy->current_channel) +fakelb_hw_deliver (dp, skb);
Format the if() statement properly:
if (dp != priv && (dp->dev->phy->current_channel == priv->dev->phy->current_channel))
And use braces around the top-level list traversal since the basic block is taking up multiple lines.
drivers/ieee802154/fakelb.c line 120
Quoted 11 lines
drivers/ieee802154/fakelb.c new file +11
-0+static int +fakelb_hw_start (struct ieee802154_dev *dev) { +struct fakelb_dev_priv *priv = dev->priv; + +if (priv->working) +return -EBUSY ; + + priv->working =1 ; + +return 0 ; +}
What prevents this "test and set" sequence from running in parallel with whatever clears the ->working value and thus we end up losing the event?
drivers/ieee802154/fakelb.c line 187
Quoted 4 lines
drivers/ieee802154/fakelb.c new file +4
-0+ ieee->phy->channels_supported[6 ] |=0x3ffc00 ; + + +INIT_LIST_HEAD (&priv->list);
Excess empty line, there is no need for two of them, get rid of the extra one.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure