Small IEEE 802.15.4 updates
Subsystems (3)
Hi, Dave,
Could you please pull small updates for IEEE 802.15.4 targeted into 2.6.32-rcX. Thank you.
The following changes since commit 4142e0d1def2c0176c27fd2e810243045a62eb6d:
Linus Torvalds (1):
Merge branch 'osync_cleanup' of git://git.kernel.org/.../jack/linux-fs-2.6
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git for-next
Dmitry Eremin-Solenikov (7):
af_ieee802154: setsockopt optlen arg isn't __user
ieee802154: add locking for seq numbers
ieee802154: add a helper to put the wpan_phy device
ieee802154: add wpan-phy iteration functions
ieee802154: merge nl802154 and wpan-class in single module
nl802154: split away MAC commands implementation
ieee802154: add LIST_PHY command support
include/linux/nl802154.h | 1 + include/net/wpan-phy.h | 8 + net/ieee802154/Makefile | 4 +- net/ieee802154/dgram.c | 2 +- net/ieee802154/ieee802154.h | 48 ++++ net/ieee802154/netlink.c | 616 ++----------------------------------------- net/ieee802154/nl-mac.c | 609 ++++++++++++++++++++++++++++++++++++++++++ net/ieee802154/nl-phy.c | 175 ++++++++++++ net/ieee802154/raw.c | 2 +- net/ieee802154/wpan-class.c | 48 ++++- 10 files changed, 908 insertions(+), 605 deletions(-) create mode 100644 net/ieee802154/ieee802154.h create mode 100644 net/ieee802154/nl-mac.c create mode 100644 net/ieee802154/nl-phy.c
Signature · 2 lines
With best wishes Dmitry
PATCH 1/7 af_ieee802154: setsockopt optlen arg isn't __user
Remove __user annotation from optlen arg as it's bogus.
--- net/ieee802154/dgram.c | 2 +- net/ieee802154/raw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ieee802154/dgram.c +1 -1
@@ -414,7 +414,7 @@ static int dgram_getsockopt(struct sock *sk, int level, int optname, }static int dgram_setsockopt (struct sock *sk,int level,int optname, -char __user *optval,int __user optlen) +char __user *optval,int optlen) {struct dgram_sock *ro =dgram_sk (sk);int val;
net/ieee802154/raw.c +1 -1
@@ -244,7 +244,7 @@ static int raw_getsockopt(struct sock *sk, int level, int optname, }static int raw_setsockopt (struct sock *sk,int level,int optname, -char __user *optval,int __user optlen) +char __user *optval,int optlen) {return -EOPNOTSUPP ; }
Signature · 1 line
1.6.3.3
PATCH 2/7 ieee802154: add locking for seq numbers
--- net/ieee802154/netlink.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
net/ieee802154/netlink.c +4 -0
@@ -35,6 +35,7 @@#include <net/ieee802154_netdev.h> static unsigned int ieee802154_seq_num; +static DEFINE_SPINLOCK (ieee802154_seq_lock);static struct genl_family ieee802154_coordinator_family = { .id =GENL_ID_GENERATE ,
@@ -57,12 +58,15 @@ static struct sk_buff *ieee802154_nl_create(int flags, u8 req) {void *hdr;struct sk_buff *msg =nlmsg_new (NLMSG_GOODSIZE ,GFP_ATOMIC ); +unsigned long f;if (!msg)return NULL ; +spin_lock_irqsave (&ieee802154_seq_lock, f); hdr =genlmsg_put (msg,0 , ieee802154_seq_num++, &ieee802154_coordinator_family, flags, req); +spin_unlock_irqrestore (&ieee802154_seq_lock, f);if (!hdr) {nlmsg_free (msg);return NULL ;
Signature · 1 line
1.6.3.3
PATCH 3/7 ieee802154: add a helper to put the wpan_phy device
--- include/net/wpan-phy.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
include/net/wpan-phy.h +6 -0
@@ -56,6 +56,12 @@ static inline void *wpan_phy_priv(struct wpan_phy *phy) }struct wpan_phy *wpan_phy_find (const char *str); + +static inline void wpan_phy_put (struct wpan_phy *phy) +{ +put_device (&phy->dev); +} +static inline const char *wpan_phy_name (struct wpan_phy *phy) {return dev_name (&phy->dev);
Signature · 1 line
1.6.3.3
PATCH 4/7 ieee802154: add wpan-phy iteration functions
Add API to iterate over the wpan-phy instances.
--- include/net/wpan-phy.h | 2 ++ net/ieee802154/wpan-class.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 0 deletions(-)
include/net/wpan-phy.h +2 -0
@@ -48,6 +48,8 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size);int wpan_phy_register (struct device *parent,struct wpan_phy *phy);void wpan_phy_unregister (struct wpan_phy *phy);void wpan_phy_free (struct wpan_phy *phy); +/* Same semantics as for class_for_each_device */ +int wpan_phy_for_each (int (*fn)(struct wpan_phy *phy,void *data),void *data);static inline void *wpan_phy_priv (struct wpan_phy *phy) {
net/ieee802154/wpan-class.c +25 -0
@@ -91,6 +91,31 @@ struct wpan_phy *wpan_phy_find(const char *str) }EXPORT_SYMBOL (wpan_phy_find); +struct wpan_phy_iter_data { +int (*fn)(struct wpan_phy *phy,void *data); +void *data; +}; + +static int wpan_phy_iter (struct device *dev,void *_data) +{ +struct wpan_phy_iter_data *wpid = _data; + struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); +return wpid->fn (phy, wpid->data); +} + +int wpan_phy_for_each (int (*fn)(struct wpan_phy *phy,void *data), +void *data) +{ +struct wpan_phy_iter_data wpid = { + .fn = fn, + .data = data, + }; + +return class_for_each_device (&wpan_phy_class,NULL , + &wpid, wpan_phy_iter); +} +EXPORT_SYMBOL (wpan_phy_for_each); +static int wpan_phy_idx_valid (int idx) {return idx >=0 ;
Signature · 1 line
1.6.3.3
PATCH 5/7 ieee802154: merge nl802154 and wpan-class in single module
There is no real need to have ieee802154 interfaces separate into several small modules, as neither of them has it's own use.
--- net/ieee802154/Makefile | 4 ++-- net/ieee802154/netlink.c | 9 ++------- net/ieee802154/wpan-class.c | 23 ++++++++++++++++++++--- 3 files changed, 24 insertions(+), 12 deletions(-)
net/ieee802154/Makefile +2 -2
@@ -1,5 +1,5 @@ -obj-$(CONFIG_IEEE802154) += nl802154.o af_802154.o wpan-class.o -nl802154-y := netlink.o nl_policy.o +obj-$(CONFIG_IEEE802154) += ieee802154.o af_802154.o +ieee802154-y := netlink.o nl_policy.o wpan-class.o af_802154-y := af_ieee802154.o raw.o dgram.o ccflags-y += -Wall -DDEBUG
net/ieee802154/netlink.c +2 -7
@@ -643,7 +643,7 @@ static struct genl_ops ieee802154_coordinator_ops[] = { ieee802154_dump_iface), }; -static int __init ieee802154_nl_init (void ) +int __init ieee802154_nl_init (void ) {int rc;int i;
@@ -676,14 +676,9 @@ fail:genl_unregister_family (&ieee802154_coordinator_family);return rc; } -module_init (ieee802154_nl_init); -static void __exit ieee802154_nl_exit(void) +void __exit ieee802154_nl_exit(void) {genl_unregister_family (&ieee802154_coordinator_family); } -module_exit (ieee802154_nl_exit); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("ieee 802.15.4 configuration interface" );
net/ieee802154/wpan-class.c +20 -3
@@ -22,6 +22,8 @@#include <net/wpan-phy.h> +#include "ieee802154.h" + #define MASTER_SHOW_COMPLEX(name, format_string, args...) \ static ssize_t name ## _show(struct device *dev, \ struct device_attribute *attr, char *buf) \
@@ -169,16 +171,31 @@ EXPORT_SYMBOL(wpan_phy_free);static int __init wpan_phy_class_init (void ) { -return class_register (&wpan_phy_class); +int rc; + rc =class_register (&wpan_phy_class); +if (rc) + goto err; + + rc =ieee802154_nl_init (); +if (rc) + goto err_nl; + +return 0 ; +err_nl: +class_unregister (&wpan_phy_class); +err: +return rc; } -subsys_initcall (wpan_phy_class_init); +module_init (wpan_phy_class_init); static void __exit wpan_phy_class_exit(void) { +ieee802154_nl_exit ();class_unregister (&wpan_phy_class); }module_exit (wpan_phy_class_exit); -MODULE_DESCRIPTION ("IEEE 802.15.4 device class" );MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("IEEE 802.15.4 configuration interface" ); +MODULE_AUTHOR ("Dmitry Eremin-Solenikov" );
Signature · 1 line
1.6.3.3
PATCH 6/7 nl802154: split away MAC commands implementation
Move all mac-related stuff to separate file so that ieee802154/netlink.c contains only generic code.
---
net/ieee802154/Makefile | 2 +-
net/ieee802154/ieee802154.h | 48 +++
net/ieee802154/netlink.c | 605 +-------------------------------
net/ieee802154/{netlink.c => nl-mac.c} | 117 ++-----
4 files changed, 81 insertions(+), 691 deletions(-)
create mode 100644 net/ieee802154/ieee802154.h
copy net/ieee802154/{netlink.c => nl-mac.c} (86%)net/ieee802154/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-$(CONFIG_IEEE802154) += ieee802154.o af_802154.o -ieee802154-y := netlink.o nl_policy.o wpan-class.o +ieee802154-y := netlink.o nl-mac.o nl_policy.o wpan-class.o af_802154-y := af_ieee802154.o raw.o dgram.o ccflags-y += -Wall -DDEBUG
net/ieee802154/ieee802154.h new file +48 -0
48 lines not on this page · raw message
net/ieee802154/netlink.c +11 -594
664 lines not on this page · raw message
net/ieee802154/nl-mac.c renamed from net/ieee802154/netlink.c +21 -96
208 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 7/7 ieee802154: add LIST_PHY command support
Add nl802154 command to get information about PHY's present in the system.
--- include/linux/nl802154.h | 1 + net/ieee802154/Makefile | 2 +- net/ieee802154/netlink.c | 4 + net/ieee802154/nl-phy.c | 175 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 181 insertions(+), 1 deletions(-) create mode 100644 net/ieee802154/nl-phy.c
include/linux/nl802154.h +1 -0
@@ -114,6 +114,7 @@ enum {IEEE802154_RX_ENABLE_CONF ,/* Not supported yet */ IEEE802154_LIST_IFACE , +IEEE802154_LIST_PHY , __IEEE802154_CMD_MAX, };
net/ieee802154/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-$(CONFIG_IEEE802154) += ieee802154.o af_802154.o -ieee802154-y := netlink.o nl-mac.o nl_policy.o wpan-class.o +ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o wpan-class.o af_802154-y := af_ieee802154.o raw.o dgram.o ccflags-y += -Wall -DDEBUG
net/ieee802154/netlink.c +4 -0
@@ -87,6 +87,10 @@ int __init ieee802154_nl_init(void)if (rc) goto fail; + rc =nl802154_phy_register (); +if (rc) + goto fail; +return 0 ; fail:
net/ieee802154/nl-phy.c new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
1.6.3.3
David Miller
maintainerFrom: Dmitry Eremin-Solenikov <[email protected]>
Date: Wed, 16 Sep 2009 02:12:58 +0400
Quoted 2 lines
Could you please pull small updates for IEEE 802.15.4 targeted into 2.6.32-rcX. Thank you.
I'm only taking bug fixes at this time, some of these changes are feature patches. You had months before the merge window to get this kind of stuff to me.
Please resend only the bug fixes, thank you.