* [PATCH net 1/3] 6lowpan: fix segmentation fault caused by mlme request
2012-04-26 9:24 [PATCH net 0/3][6lowpan] fixes for 6lowpan Alexander Smirnov
@ 2012-04-26 9:24 ` Alexander Smirnov
2012-04-26 9:24 ` [PATCH net 2/3] 6lowpan: clean up fragments list if module unloaded Alexander Smirnov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Smirnov @ 2012-04-26 9:24 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-zigbee-devel, Alexander Smirnov
Add nescesary mlme callbacks to satisfy "iz list" request from user space.
Due to 6lowpan device doesn't have its own phy, mlme implemented as a pipe
to a real phy to which 6lowpan is attached.
Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
---
net/ieee802154/6lowpan.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 58c8895..7ce508f 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -1044,6 +1044,24 @@ static void lowpan_dev_free(struct net_device *dev)
free_netdev(dev);
}
+static struct wpan_phy *lowpan_get_phy(const struct net_device *dev)
+{
+ struct net_device *real_dev = lowpan_dev_info(dev)->real_dev;
+ return ieee802154_mlme_ops(real_dev)->get_phy(real_dev);
+}
+
+static u16 lowpan_get_pan_id(const struct net_device *dev)
+{
+ struct net_device *real_dev = lowpan_dev_info(dev)->real_dev;
+ return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev);
+}
+
+static u16 lowpan_get_short_addr(const struct net_device *dev)
+{
+ struct net_device *real_dev = lowpan_dev_info(dev)->real_dev;
+ return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev);
+}
+
static struct header_ops lowpan_header_ops = {
.create = lowpan_header_create,
};
@@ -1053,6 +1071,12 @@ static const struct net_device_ops lowpan_netdev_ops = {
.ndo_set_mac_address = eth_mac_addr,
};
+static struct ieee802154_mlme_ops lowpan_mlme = {
+ .get_pan_id = lowpan_get_pan_id,
+ .get_phy = lowpan_get_phy,
+ .get_short_addr = lowpan_get_short_addr,
+};
+
static void lowpan_setup(struct net_device *dev)
{
pr_debug("(%s)\n", __func__);
@@ -1070,6 +1094,7 @@ static void lowpan_setup(struct net_device *dev)
dev->netdev_ops = &lowpan_netdev_ops;
dev->header_ops = &lowpan_header_ops;
+ dev->ml_priv = &lowpan_mlme;
dev->destructor = lowpan_dev_free;
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH net 2/3] 6lowpan: clean up fragments list if module unloaded
2012-04-26 9:24 [PATCH net 0/3][6lowpan] fixes for 6lowpan Alexander Smirnov
2012-04-26 9:24 ` [PATCH net 1/3] 6lowpan: fix segmentation fault caused by mlme request Alexander Smirnov
@ 2012-04-26 9:24 ` Alexander Smirnov
2012-04-26 9:24 ` [PATCH net 3/3] 6lowpan: add missing spin_lock_init() Alexander Smirnov
[not found] ` <1335432298-17161-1-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Smirnov @ 2012-04-26 9:24 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-zigbee-devel, Alexander Smirnov
Clean all the pending fragments and relative timers if 6lowpan link
is going to be deleted.
Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
---
net/ieee802154/6lowpan.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 7ce508f..a21ca6e 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -1177,11 +1177,20 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head)
{
struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev);
struct net_device *real_dev = lowpan_dev->real_dev;
- struct lowpan_dev_record *entry;
- struct lowpan_dev_record *tmp;
+ struct lowpan_dev_record *entry, *tmp;
+ struct lowpan_fragment *frame, *tframe;
ASSERT_RTNL();
+ spin_lock(&flist_lock);
+ list_for_each_entry_safe(frame, tframe, &lowpan_fragments, list) {
+ del_timer(&frame->timer);
+ list_del(&frame->list);
+ dev_kfree_skb(frame->skb);
+ kfree(frame);
+ }
+ spin_unlock(&flist_lock);
+
mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx);
list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) {
if (entry->ldev == dev) {
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH net 3/3] 6lowpan: add missing spin_lock_init()
2012-04-26 9:24 [PATCH net 0/3][6lowpan] fixes for 6lowpan Alexander Smirnov
2012-04-26 9:24 ` [PATCH net 1/3] 6lowpan: fix segmentation fault caused by mlme request Alexander Smirnov
2012-04-26 9:24 ` [PATCH net 2/3] 6lowpan: clean up fragments list if module unloaded Alexander Smirnov
@ 2012-04-26 9:24 ` Alexander Smirnov
[not found] ` <1335432298-17161-1-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Smirnov @ 2012-04-26 9:24 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-zigbee-devel, Alexander Smirnov
Add missing spin_lock_init() for frames list lock.
Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
---
net/ieee802154/6lowpan.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index a21ca6e..b570dbf 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -1168,6 +1168,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
list_add_tail(&entry->list, &lowpan_devices);
mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx);
+ spin_lock_init(&flist_lock);
+
register_netdevice(dev);
return 0;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread[parent not found: <1335432298-17161-1-git-send-email-alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]