All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2
@ 2014-08-13 13:46 Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 01/12] mac802154: rx: warn if ieee80211_rx call from irq Alexander Aring
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

Hi,

this is the next series to make the 802.15.4 implementation like wireless.
I fixed also some issues from my previous series.

This was:

- a typo in commit ("mac802154: remove not functional monitor device")
- missing tasklet_kill(&local->tasklet) in ieee802154_unregister_hw
  ("mac802154: rx: use tasklet instead workqueue")

I created a branch for this at github, you can see this at [0].

At the end I will resubmit all patches on this mailinglist and then I will
merge this branch to master.

In this series I cleanup a little bit the rx.c file. It contains now all
parsing function from wpan.c file until netif_rx call.

Also I rework the open and close callback for the netdev interface. This
adds also a driver-ops header file like the mac80211 one. This file contains
wrapper function for calling device_ops. We should do this for all device_ops
which we call, instead doing local->ops->foobar(local->hw, ...) etc...

We are now a little bit closer to the wireless implementation style, but
it need some work to have a similar parsing function call.

Another thing is to have a similar interface/phy registration like wireless,
this need a new userspace software. I will try to create one, but this need
some time.

Also I will try to implement the perm_address, the perm_address is for an
extended address which is set by the driver. This can be a random generated
one or contains information from an eeprom. This address would be default
mac address of the registered wpan interface. At the moment our mac address
is default 00..00.


Sorry, I think we should not accept more patches for next. If you like you
can help me with the wireless transformation implementation. Simply ask
or send patches which I should apply on the "wpan_rework_rfc" branch.

- Alex

[0] https://github.com/linux-wpan/linux-wpan-next/commits/wpan_rework_rfc

Alexander Aring (12):
  mac802154: rx: warn if ieee80211_rx call from irq
  mac802154: move header parse functions to rx.c
  mac802154: rename sdata slaves and slaves_mtx
  mac802154: introduce IEEE802154_DEV_TO_SUB_IF
  mac802154: move slave open/close functions to wpan
  mac802154: rename wpan.c to iface.c
  mac802154: rx: use netif_receive_skb
  mac802154: introduce internal driver-ops header
  mac802154: remove useless -EBUSY if sdata running
  mac802154: rework open count
  mac802154: remove ieee802154_addr from driver_ops
  mac802154: rework sdata state change to running

 include/net/mac802154.h      |   1 -
 net/mac802154/Makefile       |   2 +-
 net/mac802154/driver-ops.h   |  29 +++
 net/mac802154/ieee802154_i.h |  20 +-
 net/mac802154/iface.c        | 457 +++++++++++++++++++++++++++++++++
 net/mac802154/mac_cmd.c      |   2 +-
 net/mac802154/main.c         | 114 ++-------
 net/mac802154/mib.c          |  49 ++--
 net/mac802154/rx.c           | 190 ++++++++++++++
 net/mac802154/tx.c           |   4 +-
 net/mac802154/wpan.c         | 596 -------------------------------------------
 11 files changed, 739 insertions(+), 725 deletions(-)
 create mode 100644 net/mac802154/driver-ops.h
 create mode 100644 net/mac802154/iface.c
 delete mode 100644 net/mac802154/wpan.c

-- 
2.0.3


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 01/12] mac802154: rx: warn if ieee80211_rx call from irq
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 02/12] mac802154: move header parse functions to rx.c Alexander Aring
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

This patch adds a warning if the ieee80211_rx function is called from an
irq context which should never happen.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/rx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index fe16754..7d62170 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -65,6 +65,8 @@ fail:
 
 void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb)
 {
+	WARN_ON_ONCE(softirq_count() == 0);
+
 	mac802154_subif_rx(hw, skb);
 }
 EXPORT_SYMBOL(ieee802154_rx);
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 02/12] mac802154: move header parse functions to rx.c
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 01/12] mac802154: rx: warn if ieee80211_rx call from irq Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 03/12] mac802154: rename sdata slaves and slaves_mtx Alexander Aring
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

This patch moves the frame parsing part inside the rx function. It's
part of receive handling until netif_rx_ni is called.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/ieee802154_i.h |   1 -
 net/mac802154/rx.c           | 188 +++++++++++++++++++++++++++++++++++++++++++
 net/mac802154/wpan.c         | 182 -----------------------------------------
 3 files changed, 188 insertions(+), 183 deletions(-)

diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 6bad21f..65b26f9 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -122,7 +122,6 @@ extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
 int mac802154_slave_open(struct net_device *dev);
 int mac802154_slave_close(struct net_device *dev);
 
-void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb);
 void mac802154_wpan_setup(struct net_device *dev);
 
 netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index 7d62170..cc3aa33 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -26,12 +26,200 @@
 #include <linux/workqueue.h>
 #include <linux/netdevice.h>
 #include <linux/crc-ccitt.h>
+#include <net/rtnetlink.h>
+#include <linux/nl802154.h>
 
 #include <net/mac802154.h>
 #include <net/ieee802154_netdev.h>
 
 #include "ieee802154_i.h"
 
+static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
+{
+	return netif_rx_ni(skb);
+}
+
+static int
+mac802154_subif_frame(struct ieee802154_sub_if_data *sdata, struct sk_buff *skb,
+		      const struct ieee802154_hdr *hdr)
+{
+	__le16 span, sshort;
+	int rc;
+
+	pr_debug("getting packet via slave interface %s\n", sdata->dev->name);
+
+	spin_lock_bh(&sdata->mib_lock);
+
+	span = sdata->pan_id;
+	sshort = sdata->short_addr;
+
+	switch (mac_cb(skb)->dest.mode) {
+	case IEEE802154_ADDR_NONE:
+		if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
+			/* FIXME: check if we are PAN coordinator */
+			skb->pkt_type = PACKET_OTHERHOST;
+		else
+			/* ACK comes with both addresses empty */
+			skb->pkt_type = PACKET_HOST;
+		break;
+	case IEEE802154_ADDR_LONG:
+		if (mac_cb(skb)->dest.pan_id != span &&
+		    mac_cb(skb)->dest.pan_id !=
+		    cpu_to_le16(IEEE802154_PANID_BROADCAST))
+			skb->pkt_type = PACKET_OTHERHOST;
+		else if (mac_cb(skb)->dest.extended_addr ==
+			 sdata->extended_addr)
+			skb->pkt_type = PACKET_HOST;
+		else
+			skb->pkt_type = PACKET_OTHERHOST;
+		break;
+	case IEEE802154_ADDR_SHORT:
+		if (mac_cb(skb)->dest.pan_id != span &&
+		    mac_cb(skb)->dest.pan_id !=
+		    cpu_to_le16(IEEE802154_PANID_BROADCAST))
+			skb->pkt_type = PACKET_OTHERHOST;
+		else if (mac_cb(skb)->dest.short_addr == sshort)
+			skb->pkt_type = PACKET_HOST;
+		else if (mac_cb(skb)->dest.short_addr ==
+			  cpu_to_le16(IEEE802154_ADDR_BROADCAST))
+			skb->pkt_type = PACKET_BROADCAST;
+		else
+			skb->pkt_type = PACKET_OTHERHOST;
+		break;
+	default:
+		break;
+	}
+
+	spin_unlock_bh(&sdata->mib_lock);
+
+	skb->dev = sdata->dev;
+
+	rc = mac802154_llsec_decrypt(&sdata->sec, skb);
+	if (rc) {
+		pr_debug("decryption failed: %i\n", rc);
+		goto fail;
+	}
+
+	sdata->dev->stats.rx_packets++;
+	sdata->dev->stats.rx_bytes += skb->len;
+
+	switch (mac_cb(skb)->type) {
+	case IEEE802154_FC_TYPE_DATA:
+		return mac802154_process_data(sdata->dev, skb);
+	default:
+		pr_warn("ieee802154: bad frame received (type = %d)\n",
+			mac_cb(skb)->type);
+		goto fail;
+	}
+
+fail:
+	kfree_skb(skb);
+	return NET_RX_DROP;
+}
+
+static void mac802154_print_addr(const char *name,
+				 const struct ieee802154_addr *addr)
+{
+	if (addr->mode == IEEE802154_ADDR_NONE)
+		pr_debug("%s not present\n", name);
+
+	pr_debug("%s PAN ID: %04x\n", name, le16_to_cpu(addr->pan_id));
+	if (addr->mode == IEEE802154_ADDR_SHORT) {
+		pr_debug("%s is short: %04x\n", name,
+			 le16_to_cpu(addr->short_addr));
+	} else {
+		u64 hw = swab64((__force u64)addr->extended_addr);
+
+		pr_debug("%s is hardware: %8phC\n", name, &hw);
+	}
+}
+
+static int mac802154_parse_frame_start(struct sk_buff *skb,
+				       struct ieee802154_hdr *hdr)
+{
+	int hlen;
+	struct ieee802154_mac_cb *cb = mac_cb_init(skb);
+
+	hlen = ieee802154_hdr_pull(skb, hdr);
+	if (hlen < 0)
+		return -EINVAL;
+
+	skb->mac_len = hlen;
+
+	pr_debug("fc: %04x dsn: %02x\n", le16_to_cpup((__le16 *)&hdr->fc),
+		 hdr->seq);
+
+	cb->type = hdr->fc.type;
+	cb->ackreq = hdr->fc.ack_request;
+	cb->secen = hdr->fc.security_enabled;
+
+	mac802154_print_addr("destination", &hdr->dest);
+	mac802154_print_addr("source", &hdr->source);
+
+	cb->source = hdr->source;
+	cb->dest = hdr->dest;
+
+	if (hdr->fc.security_enabled) {
+		u64 key;
+
+		pr_debug("seclevel %i\n", hdr->sec.level);
+
+		switch (hdr->sec.key_id_mode) {
+		case IEEE802154_SCF_KEY_IMPLICIT:
+			pr_debug("implicit key\n");
+			break;
+
+		case IEEE802154_SCF_KEY_INDEX:
+			pr_debug("key %02x\n", hdr->sec.key_id);
+			break;
+
+		case IEEE802154_SCF_KEY_SHORT_INDEX:
+			pr_debug("key %04x:%04x %02x\n",
+				 le32_to_cpu(hdr->sec.short_src) >> 16,
+				 le32_to_cpu(hdr->sec.short_src) & 0xffff,
+				 hdr->sec.key_id);
+			break;
+
+		case IEEE802154_SCF_KEY_HW_INDEX:
+			key = swab64((__force u64)hdr->sec.extended_src);
+			pr_debug("key source %8phC %02x\n", &key,
+				 hdr->sec.key_id);
+			break;
+		}
+	}
+
+	return 0;
+}
+
+static void
+mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
+{
+	int ret;
+	struct ieee802154_sub_if_data *sdata;
+	struct ieee802154_hdr hdr;
+
+	ret = mac802154_parse_frame_start(skb, &hdr);
+	if (ret) {
+		pr_debug("got invalid frame\n");
+		return;
+	}
+
+	rcu_read_lock();
+	list_for_each_entry_rcu(sdata, &local->slaves, list) {
+		if (sdata->type != NL802154_IFTYPE_NODE ||
+		    !netif_running(sdata->dev))
+			continue;
+
+		mac802154_subif_frame(sdata, skb, &hdr);
+		skb = NULL;
+		break;
+	}
+	rcu_read_unlock();
+
+	if (skb)
+		kfree_skb(skb);
+}
+
 static void
 mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb)
 {
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index f350218..865e1a5 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -412,185 +412,3 @@ void mac802154_wpan_setup(struct net_device *dev)
 
 	mac802154_llsec_init(&sdata->sec);
 }
-
-static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
-{
-	return netif_rx_ni(skb);
-}
-
-static int
-mac802154_subif_frame(struct ieee802154_sub_if_data *sdata, struct sk_buff *skb,
-		      const struct ieee802154_hdr *hdr)
-{
-	__le16 span, sshort;
-	int rc;
-
-	pr_debug("getting packet via slave interface %s\n", sdata->dev->name);
-
-	spin_lock_bh(&sdata->mib_lock);
-
-	span = sdata->pan_id;
-	sshort = sdata->short_addr;
-
-	switch (mac_cb(skb)->dest.mode) {
-	case IEEE802154_ADDR_NONE:
-		if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
-			/* FIXME: check if we are PAN coordinator */
-			skb->pkt_type = PACKET_OTHERHOST;
-		else
-			/* ACK comes with both addresses empty */
-			skb->pkt_type = PACKET_HOST;
-		break;
-	case IEEE802154_ADDR_LONG:
-		if (mac_cb(skb)->dest.pan_id != span &&
-		    mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST))
-			skb->pkt_type = PACKET_OTHERHOST;
-		else if (mac_cb(skb)->dest.extended_addr == sdata->extended_addr)
-			skb->pkt_type = PACKET_HOST;
-		else
-			skb->pkt_type = PACKET_OTHERHOST;
-		break;
-	case IEEE802154_ADDR_SHORT:
-		if (mac_cb(skb)->dest.pan_id != span &&
-		    mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST))
-			skb->pkt_type = PACKET_OTHERHOST;
-		else if (mac_cb(skb)->dest.short_addr == sshort)
-			skb->pkt_type = PACKET_HOST;
-		else if (mac_cb(skb)->dest.short_addr ==
-			  cpu_to_le16(IEEE802154_ADDR_BROADCAST))
-			skb->pkt_type = PACKET_BROADCAST;
-		else
-			skb->pkt_type = PACKET_OTHERHOST;
-		break;
-	default:
-		break;
-	}
-
-	spin_unlock_bh(&sdata->mib_lock);
-
-	skb->dev = sdata->dev;
-
-	rc = mac802154_llsec_decrypt(&sdata->sec, skb);
-	if (rc) {
-		pr_debug("decryption failed: %i\n", rc);
-		goto fail;
-	}
-
-	sdata->dev->stats.rx_packets++;
-	sdata->dev->stats.rx_bytes += skb->len;
-
-	switch (mac_cb(skb)->type) {
-	case IEEE802154_FC_TYPE_DATA:
-		return mac802154_process_data(sdata->dev, skb);
-	default:
-		pr_warn("ieee802154: bad frame received (type = %d)\n",
-			mac_cb(skb)->type);
-		goto fail;
-	}
-
-fail:
-	kfree_skb(skb);
-	return NET_RX_DROP;
-}
-
-static void mac802154_print_addr(const char *name,
-				 const struct ieee802154_addr *addr)
-{
-	if (addr->mode == IEEE802154_ADDR_NONE)
-		pr_debug("%s not present\n", name);
-
-	pr_debug("%s PAN ID: %04x\n", name, le16_to_cpu(addr->pan_id));
-	if (addr->mode == IEEE802154_ADDR_SHORT) {
-		pr_debug("%s is short: %04x\n", name,
-			 le16_to_cpu(addr->short_addr));
-	} else {
-		u64 hw = swab64((__force u64) addr->extended_addr);
-
-		pr_debug("%s is hardware: %8phC\n", name, &hw);
-	}
-}
-
-static int mac802154_parse_frame_start(struct sk_buff *skb,
-				       struct ieee802154_hdr *hdr)
-{
-	int hlen;
-	struct ieee802154_mac_cb *cb = mac_cb_init(skb);
-
-	hlen = ieee802154_hdr_pull(skb, hdr);
-	if (hlen < 0)
-		return -EINVAL;
-
-	skb->mac_len = hlen;
-
-	pr_debug("fc: %04x dsn: %02x\n", le16_to_cpup((__le16 *)&hdr->fc),
-		 hdr->seq);
-
-	cb->type = hdr->fc.type;
-	cb->ackreq = hdr->fc.ack_request;
-	cb->secen = hdr->fc.security_enabled;
-
-	mac802154_print_addr("destination", &hdr->dest);
-	mac802154_print_addr("source", &hdr->source);
-
-	cb->source = hdr->source;
-	cb->dest = hdr->dest;
-
-	if (hdr->fc.security_enabled) {
-		u64 key;
-
-		pr_debug("seclevel %i\n", hdr->sec.level);
-
-		switch (hdr->sec.key_id_mode) {
-		case IEEE802154_SCF_KEY_IMPLICIT:
-			pr_debug("implicit key\n");
-			break;
-
-		case IEEE802154_SCF_KEY_INDEX:
-			pr_debug("key %02x\n", hdr->sec.key_id);
-			break;
-
-		case IEEE802154_SCF_KEY_SHORT_INDEX:
-			pr_debug("key %04x:%04x %02x\n",
-				 le32_to_cpu(hdr->sec.short_src) >> 16,
-				 le32_to_cpu(hdr->sec.short_src) & 0xffff,
-				 hdr->sec.key_id);
-			break;
-
-		case IEEE802154_SCF_KEY_HW_INDEX:
-			key = swab64((__force u64) hdr->sec.extended_src);
-			pr_debug("key source %8phC %02x\n", &key,
-				 hdr->sec.key_id);
-			break;
-		}
-	}
-
-	return 0;
-}
-
-void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
-{
-	int ret;
-	struct ieee802154_sub_if_data *sdata;
-	struct ieee802154_hdr hdr;
-
-	ret = mac802154_parse_frame_start(skb, &hdr);
-	if (ret) {
-		pr_debug("got invalid frame\n");
-		return;
-	}
-
-	rcu_read_lock();
-	list_for_each_entry_rcu(sdata, &local->slaves, list) {
-		if (sdata->type != NL802154_IFTYPE_NODE ||
-		    !netif_running(sdata->dev))
-			continue;
-
-		mac802154_subif_frame(sdata, skb, &hdr);
-		skb = NULL;
-		break;
-	}
-	rcu_read_unlock();
-
-	if (skb)
-		kfree_skb(skb);
-}
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 03/12] mac802154: rename sdata slaves and slaves_mtx
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 01/12] mac802154: rx: warn if ieee80211_rx call from irq Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 02/12] mac802154: move header parse functions to rx.c Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 04/12] mac802154: introduce IEEE802154_DEV_TO_SUB_IF Alexander Aring
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

This patch namens the slaves attribute in sdata to interfaces and
slaves_mtx to iflist_mtx. This patch is part to get the wireless feeling
into the 802.15.4 implementation.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/ieee802154_i.h |  4 ++--
 net/mac802154/main.c         | 54 ++++++++++++++++++++++----------------------
 net/mac802154/rx.c           |  2 +-
 net/mac802154/tx.c           |  4 ++--
 net/mac802154/wpan.c         |  8 +++----
 5 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 65b26f9..f4d102a 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -87,8 +87,8 @@ struct ieee802154_local {
 	 *
 	 * So atomic readers can use any of this protection methods.
 	 */
-	struct list_head	slaves;
-	struct mutex		slaves_mtx;
+	struct list_head	interfaces;
+	struct mutex		iflist_mtx;
 
 	/* This one is used for scanning and other jobs not to be interfered
 	 * with serial driver.
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index d9c5cbe..2f070e9 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -39,20 +39,20 @@ int mac802154_slave_open(struct net_device *dev)
 	ASSERT_RTNL();
 
 	if (sdata->type == NL802154_IFTYPE_NODE) {
-		mutex_lock(&sdata->local->slaves_mtx);
-		list_for_each_entry(subif, &sdata->local->slaves, list) {
+		mutex_lock(&sdata->local->iflist_mtx);
+		list_for_each_entry(subif, &sdata->local->interfaces, list) {
 			if (subif != sdata && subif->type == sdata->type &&
 			    subif->running) {
-				mutex_unlock(&sdata->local->slaves_mtx);
+				mutex_unlock(&sdata->local->iflist_mtx);
 				return -EBUSY;
 			}
 		}
-		mutex_unlock(&sdata->local->slaves_mtx);
+		mutex_unlock(&sdata->local->iflist_mtx);
 	}
 
-	mutex_lock(&sdata->local->slaves_mtx);
+	mutex_lock(&sdata->local->iflist_mtx);
 	sdata->running = true;
-	mutex_unlock(&sdata->local->slaves_mtx);
+	mutex_unlock(&sdata->local->iflist_mtx);
 
 	if (local->open_count++ == 0) {
 		res = local->ops->start(&local->hw);
@@ -88,9 +88,9 @@ int mac802154_slave_close(struct net_device *dev)
 
 	netif_stop_queue(dev);
 
-	mutex_lock(&sdata->local->slaves_mtx);
+	mutex_lock(&sdata->local->iflist_mtx);
 	sdata->running = false;
-	mutex_unlock(&sdata->local->slaves_mtx);
+	mutex_unlock(&sdata->local->iflist_mtx);
 
 	if (!--local->open_count)
 		local->ops->stop(&local->hw);
@@ -115,21 +115,21 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
 
 	SET_NETDEV_DEV(dev, &local->phy->dev);
 
-	mutex_lock(&local->slaves_mtx);
+	mutex_lock(&local->iflist_mtx);
 	if (!local->running) {
-		mutex_unlock(&local->slaves_mtx);
+		mutex_unlock(&local->iflist_mtx);
 		return -ENODEV;
 	}
-	mutex_unlock(&local->slaves_mtx);
+	mutex_unlock(&local->iflist_mtx);
 
 	err = register_netdev(dev);
 	if (err < 0)
 		return err;
 
 	rtnl_lock();
-	mutex_lock(&local->slaves_mtx);
-	list_add_tail_rcu(&sdata->list, &local->slaves);
-	mutex_unlock(&local->slaves_mtx);
+	mutex_lock(&local->iflist_mtx);
+	list_add_tail_rcu(&sdata->list, &local->interfaces);
+	mutex_unlock(&local->iflist_mtx);
 	rtnl_unlock();
 
 	return 0;
@@ -146,9 +146,9 @@ mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
 
 	BUG_ON(sdata->local->phy != phy);
 
-	mutex_lock(&sdata->local->slaves_mtx);
+	mutex_lock(&sdata->local->iflist_mtx);
 	list_del_rcu(&sdata->list);
-	mutex_unlock(&sdata->local->slaves_mtx);
+	mutex_unlock(&sdata->local->iflist_mtx);
 
 	synchronize_rcu();
 	unregister_netdevice(sdata->dev);
@@ -298,8 +298,8 @@ ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
 	local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
 	local->ops = ops;
 
-	INIT_LIST_HEAD(&local->slaves);
-	mutex_init(&local->slaves_mtx);
+	INIT_LIST_HEAD(&local->interfaces);
+	mutex_init(&local->iflist_mtx);
 
 	tasklet_init(&local->tasklet,
 		     ieee802154_tasklet_handler,
@@ -315,9 +315,9 @@ void ieee802154_free_hw(struct ieee802154_hw *hw)
 {
 	struct ieee802154_local *local = hw_to_local(hw);
 
-	BUG_ON(!list_empty(&local->slaves));
+	BUG_ON(!list_empty(&local->interfaces));
 
-	mutex_destroy(&local->slaves_mtx);
+	mutex_destroy(&local->iflist_mtx);
 
 	wpan_phy_free(local->phy);
 }
@@ -388,9 +388,9 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
 
 	rtnl_lock();
 
-	mutex_lock(&local->slaves_mtx);
+	mutex_lock(&local->iflist_mtx);
 	local->running = MAC802154_DEVICE_RUN;
-	mutex_unlock(&local->slaves_mtx);
+	mutex_unlock(&local->iflist_mtx);
 
 	rtnl_unlock();
 
@@ -414,14 +414,14 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
 
 	rtnl_lock();
 
-	mutex_lock(&local->slaves_mtx);
+	mutex_lock(&local->iflist_mtx);
 	local->running = MAC802154_DEVICE_STOPPED;
-	mutex_unlock(&local->slaves_mtx);
+	mutex_unlock(&local->iflist_mtx);
 
-	list_for_each_entry_safe(sdata, next, &local->slaves, list) {
-		mutex_lock(&sdata->local->slaves_mtx);
+	list_for_each_entry_safe(sdata, next, &local->interfaces, list) {
+		mutex_lock(&sdata->local->iflist_mtx);
 		list_del(&sdata->list);
-		mutex_unlock(&sdata->local->slaves_mtx);
+		mutex_unlock(&sdata->local->iflist_mtx);
 
 		unregister_netdevice(sdata->dev);
 	}
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index cc3aa33..394601a 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -205,7 +205,7 @@ mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
 	}
 
 	rcu_read_lock();
-	list_for_each_entry_rcu(sdata, &local->slaves, list) {
+	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
 		if (sdata->type != NL802154_IFTYPE_NODE ||
 		    !netif_running(sdata->dev))
 			continue;
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 23735dd..277ccd1 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -72,7 +72,7 @@ out:
 
 	/* Restart the netif queue on each sub_if_data object. */
 	rcu_read_lock();
-	list_for_each_entry_rcu(sdata, &xw->local->slaves, list)
+	list_for_each_entry_rcu(sdata, &xw->local->interfaces, list)
 		netif_wake_queue(sdata->dev);
 	rcu_read_unlock();
 
@@ -111,7 +111,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
 
 	/* Stop the netif queue on each sub_if_data object. */
 	rcu_read_lock();
-	list_for_each_entry_rcu(sdata, &local->slaves, list)
+	list_for_each_entry_rcu(sdata, &local->interfaces, list)
 		netif_stop_queue(sdata->dev);
 	rcu_read_unlock();
 
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 865e1a5..c480501 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -129,9 +129,9 @@ int mac802154_set_mac_params(struct net_device *dev,
 {
 	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
 
-	mutex_lock(&sdata->local->slaves_mtx);
+	mutex_lock(&sdata->local->iflist_mtx);
 	sdata->mac_params = *params;
-	mutex_unlock(&sdata->local->slaves_mtx);
+	mutex_unlock(&sdata->local->iflist_mtx);
 
 	return 0;
 }
@@ -141,9 +141,9 @@ void mac802154_get_mac_params(struct net_device *dev,
 {
 	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
 
-	mutex_lock(&sdata->local->slaves_mtx);
+	mutex_lock(&sdata->local->iflist_mtx);
 	*params = sdata->mac_params;
-	mutex_unlock(&sdata->local->slaves_mtx);
+	mutex_unlock(&sdata->local->iflist_mtx);
 }
 
 static int mac802154_wpan_open(struct net_device *dev)
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 04/12] mac802154: introduce IEEE802154_DEV_TO_SUB_IF
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (2 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 03/12] mac802154: rename sdata slaves and slaves_mtx Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 05/12] mac802154: move slave open/close functions to wpan Alexander Aring
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

This function adds a wrapper to call netdev_priv to getting the sdata
attribute. There exists a similar function in the wirless stack.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/ieee802154_i.h |  6 ++++++
 net/mac802154/mac_cmd.c      |  2 +-
 net/mac802154/main.c         | 11 ++++------
 net/mac802154/mib.c          | 49 ++++++++++++++++++++++----------------------
 net/mac802154/wpan.c         | 20 ++++++++----------
 5 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index f4d102a..f4d3816 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -116,6 +116,12 @@ hw_to_local(struct ieee802154_hw *hw)
 	return container_of(hw, struct ieee802154_local, hw);
 }
 
+static inline struct ieee802154_sub_if_data *
+IEEE802154_DEV_TO_SUB_IF(const struct net_device *dev)
+{
+	return netdev_priv(dev);
+}
+
 extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
 extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
 
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index 2abbc39..df73ce7 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -79,7 +79,7 @@ static int mac802154_mlme_start_req(struct net_device *dev,
 
 static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
 
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 2f070e9..df197f4 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -31,7 +31,7 @@
 
 int mac802154_slave_open(struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct ieee802154_sub_if_data *subif;
 	struct ieee802154_local *local = sdata->local;
 	int res = 0;
@@ -81,7 +81,7 @@ err:
 
 int mac802154_slave_close(struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct ieee802154_local *local = sdata->local;
 
 	ASSERT_RTNL();
@@ -101,13 +101,12 @@ int mac802154_slave_close(struct net_device *dev)
 static int
 mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata;
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct ieee802154_local *local;
 	int err;
 
 	local = wpan_phy_priv(phy);
 
-	sdata = netdev_priv(dev);
 	sdata->dev = dev;
 	sdata->local = local;
 
@@ -138,12 +137,10 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
 static void
 mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata;
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	ASSERT_RTNL();
 
-	sdata = netdev_priv(dev);
-
 	BUG_ON(sdata->local->phy != phy);
 
 	mutex_lock(&sdata->local->iflist_mtx);
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 62dc94c..683e9e8 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -42,7 +42,7 @@ struct hw_addr_filt_notify_work {
 
 static struct ieee802154_local *mac802154_slave_get_priv(struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
 
@@ -66,7 +66,7 @@ static void hw_addr_notify(struct work_struct *work)
 
 static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct hw_addr_filt_notify_work *work;
 
 	work = kzalloc(sizeof(*work), GFP_ATOMIC);
@@ -81,7 +81,7 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
 
 void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
 
@@ -98,7 +98,7 @@ void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
 
 __le16 mac802154_dev_get_short_addr(const struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	__le16 ret;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -112,7 +112,7 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev)
 
 void mac802154_dev_set_ieee_addr(struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct ieee802154_local *local = sdata->local;
 
 	sdata->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
@@ -126,7 +126,7 @@ void mac802154_dev_set_ieee_addr(struct net_device *dev)
 
 __le16 mac802154_dev_get_pan_id(const struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	__le16 ret;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -140,7 +140,7 @@ __le16 mac802154_dev_get_pan_id(const struct net_device *dev)
 
 void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
 
@@ -157,7 +157,7 @@ void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val)
 
 u8 mac802154_dev_get_dsn(const struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
 
@@ -168,8 +168,9 @@ static void phy_chan_notify(struct work_struct *work)
 {
 	struct phy_chan_notify_work *nw = container_of(work,
 					  struct phy_chan_notify_work, work);
-	struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
-	struct ieee802154_sub_if_data *sdata = netdev_priv(nw->dev);
+	struct net_device *dev = nw->dev;
+	struct ieee802154_local *local = mac802154_slave_get_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	mutex_lock(&sdata->local->phy->pib_lock);
@@ -187,7 +188,7 @@ static void phy_chan_notify(struct work_struct *work)
 
 void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct phy_chan_notify_work *work;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -218,7 +219,7 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
 int mac802154_get_params(struct net_device *dev,
 			 struct ieee802154_llsec_params *params)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -234,7 +235,7 @@ int mac802154_set_params(struct net_device *dev,
 			 const struct ieee802154_llsec_params *params,
 			 int changed)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -251,7 +252,7 @@ int mac802154_add_key(struct net_device *dev,
 		      const struct ieee802154_llsec_key_id *id,
 		      const struct ieee802154_llsec_key *key)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -266,7 +267,7 @@ int mac802154_add_key(struct net_device *dev,
 int mac802154_del_key(struct net_device *dev,
 		      const struct ieee802154_llsec_key_id *id)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -282,7 +283,7 @@ int mac802154_del_key(struct net_device *dev,
 int mac802154_add_dev(struct net_device *dev,
 		      const struct ieee802154_llsec_device *llsec_dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -296,7 +297,7 @@ int mac802154_add_dev(struct net_device *dev,
 
 int mac802154_del_dev(struct net_device *dev, __le64 dev_addr)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -313,7 +314,7 @@ int mac802154_add_devkey(struct net_device *dev,
 			 __le64 device_addr,
 			 const struct ieee802154_llsec_device_key *key)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -329,7 +330,7 @@ int mac802154_del_devkey(struct net_device *dev,
 			 __le64 device_addr,
 			 const struct ieee802154_llsec_device_key *key)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -345,7 +346,7 @@ int mac802154_del_devkey(struct net_device *dev,
 int mac802154_add_seclevel(struct net_device *dev,
 			   const struct ieee802154_llsec_seclevel *sl)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -360,7 +361,7 @@ int mac802154_add_seclevel(struct net_device *dev,
 int mac802154_del_seclevel(struct net_device *dev,
 			   const struct ieee802154_llsec_seclevel *sl)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	int res;
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -375,7 +376,7 @@ int mac802154_del_seclevel(struct net_device *dev,
 
 void mac802154_lock_table(struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
 
@@ -385,7 +386,7 @@ void mac802154_lock_table(struct net_device *dev)
 void mac802154_get_table(struct net_device *dev,
 			 struct ieee802154_llsec_table **t)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
 
@@ -394,7 +395,7 @@ void mac802154_get_table(struct net_device *dev,
 
 void mac802154_unlock_table(struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	BUG_ON(dev->type != ARPHRD_IEEE802154);
 
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index c480501..ec20d66 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -37,7 +37,7 @@
 
 static int mac802154_wpan_update_llsec(struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
 	int rc = 0;
 
@@ -60,7 +60,7 @@ static int mac802154_wpan_update_llsec(struct net_device *dev)
 static int
 mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct sockaddr_ieee802154 *sa =
 		(struct sockaddr_ieee802154 *)&ifr->ifr_addr;
 	int err = -ENOIOCTLCMD;
@@ -127,7 +127,7 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
 int mac802154_set_mac_params(struct net_device *dev,
 			     const struct ieee802154_mac_params *params)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	mutex_lock(&sdata->local->iflist_mtx);
 	sdata->mac_params = *params;
@@ -139,7 +139,7 @@ int mac802154_set_mac_params(struct net_device *dev,
 void mac802154_get_mac_params(struct net_device *dev,
 			      struct ieee802154_mac_params *params)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	mutex_lock(&sdata->local->iflist_mtx);
 	*params = sdata->mac_params;
@@ -149,7 +149,7 @@ void mac802154_get_mac_params(struct net_device *dev,
 static int mac802154_wpan_open(struct net_device *dev)
 {
 	int rc;
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct wpan_phy *phy = sdata->local->phy;
 
 	rc = mac802154_slave_open(dev);
@@ -245,7 +245,7 @@ static int mac802154_header_create(struct sk_buff *skb,
 				   unsigned len)
 {
 	struct ieee802154_hdr hdr;
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	struct ieee802154_mac_cb *cb = mac_cb(skb);
 	int hlen;
 
@@ -314,12 +314,10 @@ mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
 static netdev_tx_t
 mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata;
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	u8 chan, page;
 	int rc;
 
-	sdata = netdev_priv(dev);
-
 	spin_lock_bh(&sdata->mib_lock);
 	chan = sdata->chan;
 	page = sdata->page;
@@ -361,7 +359,7 @@ static const struct net_device_ops mac802154_wpan_ops = {
 
 static void mac802154_wpan_free(struct net_device *dev)
 {
-	struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	mac802154_llsec_destroy(&sdata->sec);
 
@@ -388,7 +386,7 @@ void mac802154_wpan_setup(struct net_device *dev)
 	dev->netdev_ops		= &mac802154_wpan_ops;
 	dev->ml_priv		= &mac802154_mlme_wpan;
 
-	sdata = netdev_priv(dev);
+	sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 	sdata->type = NL802154_IFTYPE_NODE;
 
 	sdata->chan = MAC802154_CHAN_NONE;
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 05/12] mac802154: move slave open/close functions to wpan
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (3 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 04/12] mac802154: introduce IEEE802154_DEV_TO_SUB_IF Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 06/12] mac802154: rename wpan.c to iface.c Alexander Aring
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

This function is never used outside of wpan.c and can be static there.
This patch moves these functions into the wpan.c file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/ieee802154_i.h |  3 --
 net/mac802154/main.c         | 69 --------------------------------------------
 net/mac802154/wpan.c         | 69 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 72 deletions(-)

diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index f4d3816..c20fbc9 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -125,9 +125,6 @@ IEEE802154_DEV_TO_SUB_IF(const struct net_device *dev)
 extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
 extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
 
-int mac802154_slave_open(struct net_device *dev);
-int mac802154_slave_close(struct net_device *dev);
-
 void mac802154_wpan_setup(struct net_device *dev);
 
 netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index df197f4..3740c76 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -29,75 +29,6 @@
 
 #include "ieee802154_i.h"
 
-int mac802154_slave_open(struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct ieee802154_sub_if_data *subif;
-	struct ieee802154_local *local = sdata->local;
-	int res = 0;
-
-	ASSERT_RTNL();
-
-	if (sdata->type == NL802154_IFTYPE_NODE) {
-		mutex_lock(&sdata->local->iflist_mtx);
-		list_for_each_entry(subif, &sdata->local->interfaces, list) {
-			if (subif != sdata && subif->type == sdata->type &&
-			    subif->running) {
-				mutex_unlock(&sdata->local->iflist_mtx);
-				return -EBUSY;
-			}
-		}
-		mutex_unlock(&sdata->local->iflist_mtx);
-	}
-
-	mutex_lock(&sdata->local->iflist_mtx);
-	sdata->running = true;
-	mutex_unlock(&sdata->local->iflist_mtx);
-
-	if (local->open_count++ == 0) {
-		res = local->ops->start(&local->hw);
-		WARN_ON(res);
-		if (res)
-			goto err;
-	}
-
-	if (local->ops->ieee_addr) {
-		__le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
-
-		res = local->ops->ieee_addr(&local->hw, addr);
-		WARN_ON(res);
-		if (res)
-			goto err;
-		mac802154_dev_set_ieee_addr(dev);
-	}
-
-	netif_start_queue(dev);
-	return 0;
-err:
-	sdata->local->open_count--;
-
-	return res;
-}
-
-int mac802154_slave_close(struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct ieee802154_local *local = sdata->local;
-
-	ASSERT_RTNL();
-
-	netif_stop_queue(dev);
-
-	mutex_lock(&sdata->local->iflist_mtx);
-	sdata->running = false;
-	mutex_unlock(&sdata->local->iflist_mtx);
-
-	if (!--local->open_count)
-		local->ops->stop(&local->hw);
-
-	return 0;
-}
-
 static int
 mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
 {
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index ec20d66..8fe0072 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -35,6 +35,75 @@
 
 #include "ieee802154_i.h"
 
+static int mac802154_slave_open(struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	struct ieee802154_sub_if_data *subif;
+	struct ieee802154_local *local = sdata->local;
+	int res = 0;
+
+	ASSERT_RTNL();
+
+	if (sdata->type == NL802154_IFTYPE_NODE) {
+		mutex_lock(&sdata->local->iflist_mtx);
+		list_for_each_entry(subif, &sdata->local->interfaces, list) {
+			if (subif != sdata && subif->type == sdata->type &&
+			    subif->running) {
+				mutex_unlock(&sdata->local->iflist_mtx);
+				return -EBUSY;
+			}
+		}
+		mutex_unlock(&sdata->local->iflist_mtx);
+	}
+
+	mutex_lock(&sdata->local->iflist_mtx);
+	sdata->running = true;
+	mutex_unlock(&sdata->local->iflist_mtx);
+
+	if (local->open_count++ == 0) {
+		res = local->ops->start(&local->hw);
+		WARN_ON(res);
+		if (res)
+			goto err;
+	}
+
+	if (local->ops->ieee_addr) {
+		__le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
+
+		res = local->ops->ieee_addr(&local->hw, addr);
+		WARN_ON(res);
+		if (res)
+			goto err;
+		mac802154_dev_set_ieee_addr(dev);
+	}
+
+	netif_start_queue(dev);
+	return 0;
+err:
+	sdata->local->open_count--;
+
+	return res;
+}
+
+static int mac802154_slave_close(struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	struct ieee802154_local *local = sdata->local;
+
+	ASSERT_RTNL();
+
+	netif_stop_queue(dev);
+
+	mutex_lock(&sdata->local->iflist_mtx);
+	sdata->running = false;
+	mutex_unlock(&sdata->local->iflist_mtx);
+
+	if (!--local->open_count)
+		local->ops->stop(&local->hw);
+
+	return 0;
+}
+
 static int mac802154_wpan_update_llsec(struct net_device *dev)
 {
 	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 06/12] mac802154: rename wpan.c to iface.c
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (4 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 05/12] mac802154: move slave open/close functions to wpan Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 07/12] mac802154: rx: use netif_receive_skb Alexander Aring
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

The wpan.c file contains interface handling functions now. This file is
similar like the mac80211 iface.c. We rename this file to iface.c to get
the wireless feeling into the 802.15.4 implementation.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/Makefile |   2 +-
 net/mac802154/iface.c  | 478 ++++++++++++++++++++++++++++++++++++++++++++++++
 net/mac802154/wpan.c   | 481 -------------------------------------------------
 3 files changed, 479 insertions(+), 482 deletions(-)
 create mode 100644 net/mac802154/iface.c
 delete mode 100644 net/mac802154/wpan.c

diff --git a/net/mac802154/Makefile b/net/mac802154/Makefile
index 5f54676..d7030d4 100644
--- a/net/mac802154/Makefile
+++ b/net/mac802154/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_MAC802154)	+= mac802154.o
 mac802154-objs		:= main.o rx.o tx.o mac_cmd.o mib.o \
-			   wpan.o llsec.o
+			   iface.o llsec.o
 
 ccflags-y += -D__CHECK_ENDIAN__
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
new file mode 100644
index 0000000..9ddbf88
--- /dev/null
+++ b/net/mac802154/iface.c
@@ -0,0 +1,478 @@
+/*
+ * Copyright 2007-2012 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.
+ *
+ * Written by:
+ * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
+ * Sergey Lapin <slapin@ossfans.org>
+ * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
+ * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
+ */
+
+#include <linux/netdevice.h>
+#include <linux/module.h>
+#include <linux/if_arp.h>
+
+#include <net/rtnetlink.h>
+#include <linux/nl802154.h>
+#include <net/af_ieee802154.h>
+#include <net/mac802154.h>
+#include <net/ieee802154_netdev.h>
+#include <net/ieee802154.h>
+#include <net/wpan-phy.h>
+
+#include "ieee802154_i.h"
+
+static int mac802154_slave_open(struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	struct ieee802154_sub_if_data *subif;
+	struct ieee802154_local *local = sdata->local;
+	int res = 0;
+
+	ASSERT_RTNL();
+
+	if (sdata->type == NL802154_IFTYPE_NODE) {
+		mutex_lock(&sdata->local->iflist_mtx);
+		list_for_each_entry(subif, &sdata->local->interfaces, list) {
+			if (subif != sdata && subif->type == sdata->type &&
+			    subif->running) {
+				mutex_unlock(&sdata->local->iflist_mtx);
+				return -EBUSY;
+			}
+		}
+		mutex_unlock(&sdata->local->iflist_mtx);
+	}
+
+	mutex_lock(&sdata->local->iflist_mtx);
+	sdata->running = true;
+	mutex_unlock(&sdata->local->iflist_mtx);
+
+	if (local->open_count++ == 0) {
+		res = local->ops->start(&local->hw);
+		WARN_ON(res);
+		if (res)
+			goto err;
+	}
+
+	if (local->ops->ieee_addr) {
+		__le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
+
+		res = local->ops->ieee_addr(&local->hw, addr);
+		WARN_ON(res);
+		if (res)
+			goto err;
+		mac802154_dev_set_ieee_addr(dev);
+	}
+
+	netif_start_queue(dev);
+	return 0;
+err:
+	sdata->local->open_count--;
+
+	return res;
+}
+
+static int mac802154_slave_close(struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	struct ieee802154_local *local = sdata->local;
+
+	ASSERT_RTNL();
+
+	netif_stop_queue(dev);
+
+	mutex_lock(&sdata->local->iflist_mtx);
+	sdata->running = false;
+	mutex_unlock(&sdata->local->iflist_mtx);
+
+	if (!--local->open_count)
+		local->ops->stop(&local->hw);
+
+	return 0;
+}
+
+static int mac802154_wpan_update_llsec(struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
+	int rc = 0;
+
+	if (ops->llsec) {
+		struct ieee802154_llsec_params params;
+		int changed = 0;
+
+		params.pan_id = sdata->pan_id;
+		changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
+
+		params.hwaddr = sdata->extended_addr;
+		changed |= IEEE802154_LLSEC_PARAM_HWADDR;
+
+		rc = ops->llsec->set_params(dev, &params, changed);
+	}
+
+	return rc;
+}
+
+static int
+mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	struct sockaddr_ieee802154 *sa =
+		(struct sockaddr_ieee802154 *)&ifr->ifr_addr;
+	int err = -ENOIOCTLCMD;
+
+	spin_lock_bh(&sdata->mib_lock);
+
+	switch (cmd) {
+	case SIOCGIFADDR:
+	{
+		u16 pan_id, short_addr;
+
+		pan_id = le16_to_cpu(sdata->pan_id);
+		short_addr = le16_to_cpu(sdata->short_addr);
+		if (pan_id == IEEE802154_PANID_BROADCAST ||
+		    short_addr == IEEE802154_ADDR_BROADCAST) {
+			err = -EADDRNOTAVAIL;
+			break;
+		}
+
+		sa->family = AF_IEEE802154;
+		sa->addr.addr_type = IEEE802154_ADDR_SHORT;
+		sa->addr.pan_id = pan_id;
+		sa->addr.short_addr = short_addr;
+
+		err = 0;
+		break;
+	}
+	case SIOCSIFADDR:
+		dev_warn(&dev->dev,
+			 "Using DEBUGing ioctl SIOCSIFADDR isn't recommened!\n");
+		if (sa->family != AF_IEEE802154 ||
+		    sa->addr.addr_type != IEEE802154_ADDR_SHORT ||
+		    sa->addr.pan_id == IEEE802154_PANID_BROADCAST ||
+		    sa->addr.short_addr == IEEE802154_ADDR_BROADCAST ||
+		    sa->addr.short_addr == IEEE802154_ADDR_UNDEF) {
+			err = -EINVAL;
+			break;
+		}
+
+		sdata->pan_id = cpu_to_le16(sa->addr.pan_id);
+		sdata->short_addr = cpu_to_le16(sa->addr.short_addr);
+
+		err = mac802154_wpan_update_llsec(dev);
+		break;
+	}
+
+	spin_unlock_bh(&sdata->mib_lock);
+	return err;
+}
+
+static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
+{
+	struct sockaddr *addr = p;
+
+	if (netif_running(dev))
+		return -EBUSY;
+
+	/* FIXME: validate addr */
+	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+	mac802154_dev_set_ieee_addr(dev);
+	return mac802154_wpan_update_llsec(dev);
+}
+
+int mac802154_set_mac_params(struct net_device *dev,
+			     const struct ieee802154_mac_params *params)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+
+	mutex_lock(&sdata->local->iflist_mtx);
+	sdata->mac_params = *params;
+	mutex_unlock(&sdata->local->iflist_mtx);
+
+	return 0;
+}
+
+void mac802154_get_mac_params(struct net_device *dev,
+			      struct ieee802154_mac_params *params)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+
+	mutex_lock(&sdata->local->iflist_mtx);
+	*params = sdata->mac_params;
+	mutex_unlock(&sdata->local->iflist_mtx);
+}
+
+static int mac802154_wpan_open(struct net_device *dev)
+{
+	int rc;
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	struct wpan_phy *phy = sdata->local->phy;
+
+	rc = mac802154_slave_open(dev);
+	if (rc < 0)
+		return rc;
+
+	mutex_lock(&phy->pib_lock);
+
+	if (phy->set_txpower) {
+		rc = phy->set_txpower(phy, sdata->mac_params.transmit_power);
+		if (rc < 0)
+			goto out;
+	}
+
+	if (phy->set_lbt) {
+		rc = phy->set_lbt(phy, sdata->mac_params.lbt);
+		if (rc < 0)
+			goto out;
+	}
+
+	if (phy->set_cca_mode) {
+		rc = phy->set_cca_mode(phy, sdata->mac_params.cca_mode);
+		if (rc < 0)
+			goto out;
+	}
+
+	if (phy->set_cca_ed_level) {
+		rc = phy->set_cca_ed_level(phy, sdata->mac_params.cca_ed_level);
+		if (rc < 0)
+			goto out;
+	}
+
+	if (phy->set_csma_params) {
+		rc = phy->set_csma_params(phy, sdata->mac_params.min_be,
+					  sdata->mac_params.max_be,
+					  sdata->mac_params.csma_retries);
+		if (rc < 0)
+			goto out;
+	}
+
+	if (phy->set_frame_retries) {
+		rc = phy->set_frame_retries(phy,
+					    sdata->mac_params.frame_retries);
+		if (rc < 0)
+			goto out;
+	}
+
+	mutex_unlock(&phy->pib_lock);
+	return 0;
+
+out:
+	mutex_unlock(&phy->pib_lock);
+	return rc;
+}
+
+static int mac802154_set_header_security(struct ieee802154_sub_if_data *sdata,
+					 struct ieee802154_hdr *hdr,
+					 const struct ieee802154_mac_cb *cb)
+{
+	struct ieee802154_llsec_params params;
+	u8 level;
+
+	mac802154_llsec_get_params(&sdata->sec, &params);
+
+	if (!params.enabled && cb->secen_override && cb->secen)
+		return -EINVAL;
+	if (!params.enabled ||
+	    (cb->secen_override && !cb->secen) ||
+	    !params.out_level)
+		return 0;
+	if (cb->seclevel_override && !cb->seclevel)
+		return -EINVAL;
+
+	level = cb->seclevel_override ? cb->seclevel : params.out_level;
+
+	hdr->fc.security_enabled = 1;
+	hdr->sec.level = level;
+	hdr->sec.key_id_mode = params.out_key.mode;
+	if (params.out_key.mode == IEEE802154_SCF_KEY_SHORT_INDEX)
+		hdr->sec.short_src = params.out_key.short_source;
+	else if (params.out_key.mode == IEEE802154_SCF_KEY_HW_INDEX)
+		hdr->sec.extended_src = params.out_key.extended_source;
+	hdr->sec.key_id = params.out_key.id;
+
+	return 0;
+}
+
+static int mac802154_header_create(struct sk_buff *skb,
+				   struct net_device *dev,
+				   unsigned short type,
+				   const void *daddr,
+				   const void *saddr,
+				   unsigned len)
+{
+	struct ieee802154_hdr hdr;
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	struct ieee802154_mac_cb *cb = mac_cb(skb);
+	int hlen;
+
+	if (!daddr)
+		return -EINVAL;
+
+	memset(&hdr.fc, 0, sizeof(hdr.fc));
+	hdr.fc.type = cb->type;
+	hdr.fc.security_enabled = cb->secen;
+	hdr.fc.ack_request = cb->ackreq;
+	hdr.seq = ieee802154_mlme_ops(dev)->get_dsn(dev);
+
+	if (mac802154_set_header_security(sdata, &hdr, cb) < 0)
+		return -EINVAL;
+
+	if (!saddr) {
+		spin_lock_bh(&sdata->mib_lock);
+
+		if (sdata->short_addr ==
+		    cpu_to_le16(IEEE802154_ADDR_BROADCAST) ||
+		    sdata->short_addr == cpu_to_le16(IEEE802154_ADDR_UNDEF) ||
+		    sdata->pan_id == cpu_to_le16(IEEE802154_PANID_BROADCAST)) {
+			hdr.source.mode = IEEE802154_ADDR_LONG;
+			hdr.source.extended_addr = sdata->extended_addr;
+		} else {
+			hdr.source.mode = IEEE802154_ADDR_SHORT;
+			hdr.source.short_addr = sdata->short_addr;
+		}
+
+		hdr.source.pan_id = sdata->pan_id;
+
+		spin_unlock_bh(&sdata->mib_lock);
+	} else {
+		hdr.source = *(const struct ieee802154_addr *)saddr;
+	}
+
+	hdr.dest = *(const struct ieee802154_addr *)daddr;
+
+	hlen = ieee802154_hdr_push(skb, &hdr);
+	if (hlen < 0)
+		return -EINVAL;
+
+	skb_reset_mac_header(skb);
+	skb->mac_len = hlen;
+
+	if (len > ieee802154_max_payload(&hdr))
+		return -EMSGSIZE;
+
+	return hlen;
+}
+
+static int
+mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
+{
+	struct ieee802154_hdr hdr;
+	struct ieee802154_addr *addr = (struct ieee802154_addr *)haddr;
+
+	if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0) {
+		pr_debug("malformed packet\n");
+		return 0;
+	}
+
+	*addr = hdr.source;
+	return sizeof(*addr);
+}
+
+static netdev_tx_t
+mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	u8 chan, page;
+	int rc;
+
+	spin_lock_bh(&sdata->mib_lock);
+	chan = sdata->chan;
+	page = sdata->page;
+	spin_unlock_bh(&sdata->mib_lock);
+
+	if (chan == MAC802154_CHAN_NONE ||
+	    page >= WPAN_NUM_PAGES ||
+	    chan >= WPAN_NUM_CHANNELS) {
+		kfree_skb(skb);
+		return NETDEV_TX_OK;
+	}
+
+	rc = mac802154_llsec_encrypt(&sdata->sec, skb);
+	if (rc) {
+		pr_warn("encryption failed: %i\n", rc);
+		kfree_skb(skb);
+		return NETDEV_TX_OK;
+	}
+
+	skb->skb_iif = dev->ifindex;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += skb->len;
+
+	return mac802154_tx(sdata->local, skb, page, chan);
+}
+
+static struct header_ops mac802154_header_ops = {
+	.create		= mac802154_header_create,
+	.parse		= mac802154_header_parse,
+};
+
+static const struct net_device_ops mac802154_wpan_ops = {
+	.ndo_open		= mac802154_wpan_open,
+	.ndo_stop		= mac802154_slave_close,
+	.ndo_start_xmit		= mac802154_wpan_xmit,
+	.ndo_do_ioctl		= mac802154_wpan_ioctl,
+	.ndo_set_mac_address	= mac802154_wpan_mac_addr,
+};
+
+static void mac802154_wpan_free(struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+
+	mac802154_llsec_destroy(&sdata->sec);
+
+	free_netdev(dev);
+}
+
+void mac802154_wpan_setup(struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata;
+
+	dev->addr_len		= IEEE802154_ADDR_LEN;
+	memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
+
+	dev->hard_header_len	= MAC802154_FRAME_HARD_HEADER_LEN;
+	dev->header_ops		= &mac802154_header_ops;
+	dev->needed_tailroom	= 2 + 16; /* FCS + MIC */
+	dev->mtu		= IEEE802154_MTU;
+	dev->tx_queue_len	= 300;
+	dev->type		= ARPHRD_IEEE802154;
+	dev->flags		= IFF_NOARP | IFF_BROADCAST;
+	dev->watchdog_timeo	= 0;
+
+	dev->destructor		= mac802154_wpan_free;
+	dev->netdev_ops		= &mac802154_wpan_ops;
+	dev->ml_priv		= &mac802154_mlme_wpan;
+
+	sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	sdata->type = NL802154_IFTYPE_NODE;
+
+	sdata->chan = MAC802154_CHAN_NONE;
+	sdata->page = 0;
+
+	spin_lock_init(&sdata->mib_lock);
+	mutex_init(&sdata->sec_mtx);
+
+	get_random_bytes(&sdata->bsn, 1);
+	get_random_bytes(&sdata->dsn, 1);
+
+	/* defaults per 802.15.4-2011 */
+	sdata->mac_params.min_be = 3;
+	sdata->mac_params.max_be = 5;
+	sdata->mac_params.csma_retries = 4;
+	/* for compatibility, actual default is 3 */
+	sdata->mac_params.frame_retries = -1;
+
+	sdata->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST);
+	sdata->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);
+
+	mac802154_llsec_init(&sdata->sec);
+}
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
deleted file mode 100644
index 8fe0072..0000000
--- a/net/mac802154/wpan.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * Copyright 2007-2012 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 <dbaryshkov@gmail.com>
- * Sergey Lapin <slapin@ossfans.org>
- * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
- * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
- */
-
-#include <linux/netdevice.h>
-#include <linux/module.h>
-#include <linux/if_arp.h>
-
-#include <net/rtnetlink.h>
-#include <linux/nl802154.h>
-#include <net/af_ieee802154.h>
-#include <net/mac802154.h>
-#include <net/ieee802154_netdev.h>
-#include <net/ieee802154.h>
-#include <net/wpan-phy.h>
-
-#include "ieee802154_i.h"
-
-static int mac802154_slave_open(struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct ieee802154_sub_if_data *subif;
-	struct ieee802154_local *local = sdata->local;
-	int res = 0;
-
-	ASSERT_RTNL();
-
-	if (sdata->type == NL802154_IFTYPE_NODE) {
-		mutex_lock(&sdata->local->iflist_mtx);
-		list_for_each_entry(subif, &sdata->local->interfaces, list) {
-			if (subif != sdata && subif->type == sdata->type &&
-			    subif->running) {
-				mutex_unlock(&sdata->local->iflist_mtx);
-				return -EBUSY;
-			}
-		}
-		mutex_unlock(&sdata->local->iflist_mtx);
-	}
-
-	mutex_lock(&sdata->local->iflist_mtx);
-	sdata->running = true;
-	mutex_unlock(&sdata->local->iflist_mtx);
-
-	if (local->open_count++ == 0) {
-		res = local->ops->start(&local->hw);
-		WARN_ON(res);
-		if (res)
-			goto err;
-	}
-
-	if (local->ops->ieee_addr) {
-		__le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
-
-		res = local->ops->ieee_addr(&local->hw, addr);
-		WARN_ON(res);
-		if (res)
-			goto err;
-		mac802154_dev_set_ieee_addr(dev);
-	}
-
-	netif_start_queue(dev);
-	return 0;
-err:
-	sdata->local->open_count--;
-
-	return res;
-}
-
-static int mac802154_slave_close(struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct ieee802154_local *local = sdata->local;
-
-	ASSERT_RTNL();
-
-	netif_stop_queue(dev);
-
-	mutex_lock(&sdata->local->iflist_mtx);
-	sdata->running = false;
-	mutex_unlock(&sdata->local->iflist_mtx);
-
-	if (!--local->open_count)
-		local->ops->stop(&local->hw);
-
-	return 0;
-}
-
-static int mac802154_wpan_update_llsec(struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
-	int rc = 0;
-
-	if (ops->llsec) {
-		struct ieee802154_llsec_params params;
-		int changed = 0;
-
-		params.pan_id = sdata->pan_id;
-		changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
-
-		params.hwaddr = sdata->extended_addr;
-		changed |= IEEE802154_LLSEC_PARAM_HWADDR;
-
-		rc = ops->llsec->set_params(dev, &params, changed);
-	}
-
-	return rc;
-}
-
-static int
-mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct sockaddr_ieee802154 *sa =
-		(struct sockaddr_ieee802154 *)&ifr->ifr_addr;
-	int err = -ENOIOCTLCMD;
-
-	spin_lock_bh(&sdata->mib_lock);
-
-	switch (cmd) {
-	case SIOCGIFADDR:
-	{
-		u16 pan_id, short_addr;
-
-		pan_id = le16_to_cpu(sdata->pan_id);
-		short_addr = le16_to_cpu(sdata->short_addr);
-		if (pan_id == IEEE802154_PANID_BROADCAST ||
-		    short_addr == IEEE802154_ADDR_BROADCAST) {
-			err = -EADDRNOTAVAIL;
-			break;
-		}
-
-		sa->family = AF_IEEE802154;
-		sa->addr.addr_type = IEEE802154_ADDR_SHORT;
-		sa->addr.pan_id = pan_id;
-		sa->addr.short_addr = short_addr;
-
-		err = 0;
-		break;
-	}
-	case SIOCSIFADDR:
-		dev_warn(&dev->dev,
-			 "Using DEBUGing ioctl SIOCSIFADDR isn't recommened!\n");
-		if (sa->family != AF_IEEE802154 ||
-		    sa->addr.addr_type != IEEE802154_ADDR_SHORT ||
-		    sa->addr.pan_id == IEEE802154_PANID_BROADCAST ||
-		    sa->addr.short_addr == IEEE802154_ADDR_BROADCAST ||
-		    sa->addr.short_addr == IEEE802154_ADDR_UNDEF) {
-			err = -EINVAL;
-			break;
-		}
-
-		sdata->pan_id = cpu_to_le16(sa->addr.pan_id);
-		sdata->short_addr = cpu_to_le16(sa->addr.short_addr);
-
-		err = mac802154_wpan_update_llsec(dev);
-		break;
-	}
-
-	spin_unlock_bh(&sdata->mib_lock);
-	return err;
-}
-
-static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
-{
-	struct sockaddr *addr = p;
-
-	if (netif_running(dev))
-		return -EBUSY;
-
-	/* FIXME: validate addr */
-	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-	mac802154_dev_set_ieee_addr(dev);
-	return mac802154_wpan_update_llsec(dev);
-}
-
-int mac802154_set_mac_params(struct net_device *dev,
-			     const struct ieee802154_mac_params *params)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-
-	mutex_lock(&sdata->local->iflist_mtx);
-	sdata->mac_params = *params;
-	mutex_unlock(&sdata->local->iflist_mtx);
-
-	return 0;
-}
-
-void mac802154_get_mac_params(struct net_device *dev,
-			      struct ieee802154_mac_params *params)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-
-	mutex_lock(&sdata->local->iflist_mtx);
-	*params = sdata->mac_params;
-	mutex_unlock(&sdata->local->iflist_mtx);
-}
-
-static int mac802154_wpan_open(struct net_device *dev)
-{
-	int rc;
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct wpan_phy *phy = sdata->local->phy;
-
-	rc = mac802154_slave_open(dev);
-	if (rc < 0)
-		return rc;
-
-	mutex_lock(&phy->pib_lock);
-
-	if (phy->set_txpower) {
-		rc = phy->set_txpower(phy, sdata->mac_params.transmit_power);
-		if (rc < 0)
-			goto out;
-	}
-
-	if (phy->set_lbt) {
-		rc = phy->set_lbt(phy, sdata->mac_params.lbt);
-		if (rc < 0)
-			goto out;
-	}
-
-	if (phy->set_cca_mode) {
-		rc = phy->set_cca_mode(phy, sdata->mac_params.cca_mode);
-		if (rc < 0)
-			goto out;
-	}
-
-	if (phy->set_cca_ed_level) {
-		rc = phy->set_cca_ed_level(phy, sdata->mac_params.cca_ed_level);
-		if (rc < 0)
-			goto out;
-	}
-
-	if (phy->set_csma_params) {
-		rc = phy->set_csma_params(phy, sdata->mac_params.min_be,
-					  sdata->mac_params.max_be,
-					  sdata->mac_params.csma_retries);
-		if (rc < 0)
-			goto out;
-	}
-
-	if (phy->set_frame_retries) {
-		rc = phy->set_frame_retries(phy,
-					    sdata->mac_params.frame_retries);
-		if (rc < 0)
-			goto out;
-	}
-
-	mutex_unlock(&phy->pib_lock);
-	return 0;
-
-out:
-	mutex_unlock(&phy->pib_lock);
-	return rc;
-}
-
-static int mac802154_set_header_security(struct ieee802154_sub_if_data *sdata,
-					 struct ieee802154_hdr *hdr,
-					 const struct ieee802154_mac_cb *cb)
-{
-	struct ieee802154_llsec_params params;
-	u8 level;
-
-	mac802154_llsec_get_params(&sdata->sec, &params);
-
-	if (!params.enabled && cb->secen_override && cb->secen)
-		return -EINVAL;
-	if (!params.enabled ||
-	    (cb->secen_override && !cb->secen) ||
-	    !params.out_level)
-		return 0;
-	if (cb->seclevel_override && !cb->seclevel)
-		return -EINVAL;
-
-	level = cb->seclevel_override ? cb->seclevel : params.out_level;
-
-	hdr->fc.security_enabled = 1;
-	hdr->sec.level = level;
-	hdr->sec.key_id_mode = params.out_key.mode;
-	if (params.out_key.mode == IEEE802154_SCF_KEY_SHORT_INDEX)
-		hdr->sec.short_src = params.out_key.short_source;
-	else if (params.out_key.mode == IEEE802154_SCF_KEY_HW_INDEX)
-		hdr->sec.extended_src = params.out_key.extended_source;
-	hdr->sec.key_id = params.out_key.id;
-
-	return 0;
-}
-
-static int mac802154_header_create(struct sk_buff *skb,
-				   struct net_device *dev,
-				   unsigned short type,
-				   const void *daddr,
-				   const void *saddr,
-				   unsigned len)
-{
-	struct ieee802154_hdr hdr;
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct ieee802154_mac_cb *cb = mac_cb(skb);
-	int hlen;
-
-	if (!daddr)
-		return -EINVAL;
-
-	memset(&hdr.fc, 0, sizeof(hdr.fc));
-	hdr.fc.type = cb->type;
-	hdr.fc.security_enabled = cb->secen;
-	hdr.fc.ack_request = cb->ackreq;
-	hdr.seq = ieee802154_mlme_ops(dev)->get_dsn(dev);
-
-	if (mac802154_set_header_security(sdata, &hdr, cb) < 0)
-		return -EINVAL;
-
-	if (!saddr) {
-		spin_lock_bh(&sdata->mib_lock);
-
-		if (sdata->short_addr == cpu_to_le16(IEEE802154_ADDR_BROADCAST) ||
-		    sdata->short_addr == cpu_to_le16(IEEE802154_ADDR_UNDEF) ||
-		    sdata->pan_id == cpu_to_le16(IEEE802154_PANID_BROADCAST)) {
-			hdr.source.mode = IEEE802154_ADDR_LONG;
-			hdr.source.extended_addr = sdata->extended_addr;
-		} else {
-			hdr.source.mode = IEEE802154_ADDR_SHORT;
-			hdr.source.short_addr = sdata->short_addr;
-		}
-
-		hdr.source.pan_id = sdata->pan_id;
-
-		spin_unlock_bh(&sdata->mib_lock);
-	} else {
-		hdr.source = *(const struct ieee802154_addr *)saddr;
-	}
-
-	hdr.dest = *(const struct ieee802154_addr *)daddr;
-
-	hlen = ieee802154_hdr_push(skb, &hdr);
-	if (hlen < 0)
-		return -EINVAL;
-
-	skb_reset_mac_header(skb);
-	skb->mac_len = hlen;
-
-	if (len > ieee802154_max_payload(&hdr))
-		return -EMSGSIZE;
-
-	return hlen;
-}
-
-static int
-mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
-{
-	struct ieee802154_hdr hdr;
-	struct ieee802154_addr *addr = (struct ieee802154_addr *)haddr;
-
-	if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0) {
-		pr_debug("malformed packet\n");
-		return 0;
-	}
-
-	*addr = hdr.source;
-	return sizeof(*addr);
-}
-
-static netdev_tx_t
-mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	u8 chan, page;
-	int rc;
-
-	spin_lock_bh(&sdata->mib_lock);
-	chan = sdata->chan;
-	page = sdata->page;
-	spin_unlock_bh(&sdata->mib_lock);
-
-	if (chan == MAC802154_CHAN_NONE ||
-	    page >= WPAN_NUM_PAGES ||
-	    chan >= WPAN_NUM_CHANNELS) {
-		kfree_skb(skb);
-		return NETDEV_TX_OK;
-	}
-
-	rc = mac802154_llsec_encrypt(&sdata->sec, skb);
-	if (rc) {
-		pr_warn("encryption failed: %i\n", rc);
-		kfree_skb(skb);
-		return NETDEV_TX_OK;
-	}
-
-	skb->skb_iif = dev->ifindex;
-	dev->stats.tx_packets++;
-	dev->stats.tx_bytes += skb->len;
-
-	return mac802154_tx(sdata->local, skb, page, chan);
-}
-
-static struct header_ops mac802154_header_ops = {
-	.create		= mac802154_header_create,
-	.parse		= mac802154_header_parse,
-};
-
-static const struct net_device_ops mac802154_wpan_ops = {
-	.ndo_open		= mac802154_wpan_open,
-	.ndo_stop		= mac802154_slave_close,
-	.ndo_start_xmit		= mac802154_wpan_xmit,
-	.ndo_do_ioctl		= mac802154_wpan_ioctl,
-	.ndo_set_mac_address	= mac802154_wpan_mac_addr,
-};
-
-static void mac802154_wpan_free(struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-
-	mac802154_llsec_destroy(&sdata->sec);
-
-	free_netdev(dev);
-}
-
-void mac802154_wpan_setup(struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata;
-
-	dev->addr_len		= IEEE802154_ADDR_LEN;
-	memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
-
-	dev->hard_header_len	= MAC802154_FRAME_HARD_HEADER_LEN;
-	dev->header_ops		= &mac802154_header_ops;
-	dev->needed_tailroom	= 2 + 16; /* FCS + MIC */
-	dev->mtu		= IEEE802154_MTU;
-	dev->tx_queue_len	= 300;
-	dev->type		= ARPHRD_IEEE802154;
-	dev->flags		= IFF_NOARP | IFF_BROADCAST;
-	dev->watchdog_timeo	= 0;
-
-	dev->destructor		= mac802154_wpan_free;
-	dev->netdev_ops		= &mac802154_wpan_ops;
-	dev->ml_priv		= &mac802154_mlme_wpan;
-
-	sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	sdata->type = NL802154_IFTYPE_NODE;
-
-	sdata->chan = MAC802154_CHAN_NONE;
-	sdata->page = 0;
-
-	spin_lock_init(&sdata->mib_lock);
-	mutex_init(&sdata->sec_mtx);
-
-	get_random_bytes(&sdata->bsn, 1);
-	get_random_bytes(&sdata->dsn, 1);
-
-	/* defaults per 802.15.4-2011 */
-	sdata->mac_params.min_be = 3;
-	sdata->mac_params.max_be = 5;
-	sdata->mac_params.csma_retries = 4;
-	/* for compatibility, actual default is 3 */
-	sdata->mac_params.frame_retries = -1;
-
-	sdata->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST);
-	sdata->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);
-
-	mac802154_llsec_init(&sdata->sec);
-}
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 07/12] mac802154: rx: use netif_receive_skb
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (5 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 06/12] mac802154: rename wpan.c to iface.c Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 08/12] mac802154: introduce internal driver-ops header Alexander Aring
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

To use netif_receive_skb or netif_rx_ni depends on context. We have a
tasklet which is the same like mac80211 and we should use the same
net rx delivery function netif_receive_skb.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index 394601a..7c3af47 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -36,7 +36,7 @@
 
 static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
 {
-	return netif_rx_ni(skb);
+	return netif_receive_skb(skb);
 }
 
 static int
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 08/12] mac802154: introduce internal driver-ops header
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (6 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 07/12] mac802154: rx: use netif_receive_skb Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 09/12] mac802154: remove useless -EBUSY if sdata running Alexander Aring
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

We should not call the driver ops callbacks directly. This patch
introduce a driver-ops header file to calling these wrappers. It's like
the mac80211 driver-ops header.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/driver-ops.h | 29 +++++++++++++++++++++++++++++
 net/mac802154/iface.c      |  5 +++--
 2 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 net/mac802154/driver-ops.h

diff --git a/net/mac802154/driver-ops.h b/net/mac802154/driver-ops.h
new file mode 100644
index 0000000..edaf75f
--- /dev/null
+++ b/net/mac802154/driver-ops.h
@@ -0,0 +1,29 @@
+#ifndef __MAC802154_DRVIER_OPS
+#define __MAC802154_DRIVER_OPS
+
+#include <net/mac802154.h>
+
+#include "ieee802154_i.h"
+
+static inline int drv_start(struct ieee802154_local *local)
+{
+	might_sleep();
+
+	smp_mb();
+	return local->ops->start(&local->hw);
+}
+
+static inline void drv_stop(struct ieee802154_local *local)
+{
+	might_sleep();
+
+	local->ops->stop(&local->hw);
+
+	/* sync away all work on the tasklet before clearing started */
+	tasklet_disable(&local->tasklet);
+	tasklet_enable(&local->tasklet);
+
+	barrier();
+}
+
+#endif /* __MAC802154_DRVIER_OPS */
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 9ddbf88..ae774d3 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -29,6 +29,7 @@
 #include <net/ieee802154.h>
 #include <net/wpan-phy.h>
 
+#include "driver-ops.h"
 #include "ieee802154_i.h"
 
 static int mac802154_slave_open(struct net_device *dev)
@@ -57,7 +58,7 @@ static int mac802154_slave_open(struct net_device *dev)
 	mutex_unlock(&sdata->local->iflist_mtx);
 
 	if (local->open_count++ == 0) {
-		res = local->ops->start(&local->hw);
+		res = drv_start(local);
 		WARN_ON(res);
 		if (res)
 			goto err;
@@ -95,7 +96,7 @@ static int mac802154_slave_close(struct net_device *dev)
 	mutex_unlock(&sdata->local->iflist_mtx);
 
 	if (!--local->open_count)
-		local->ops->stop(&local->hw);
+		drv_stop(local);
 
 	return 0;
 }
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 09/12] mac802154: remove useless -EBUSY if sdata running
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (7 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 08/12] mac802154: introduce internal driver-ops header Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 15:07   ` Alexander Aring
  2014-08-24  6:59   ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 10/12] mac802154: rework open count Alexander Aring
                   ` (2 subsequent siblings)
  11 siblings, 2 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

The slave_open function is only called by ndo_open callback. This
callback is already protected to do a ip link set wpan0 up twice.
This patch removing also a unnecessary for each loop to find the right
entry which is already known.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/iface.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index ae774d3..ab23246 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -35,24 +35,11 @@
 static int mac802154_slave_open(struct net_device *dev)
 {
 	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-	struct ieee802154_sub_if_data *subif;
 	struct ieee802154_local *local = sdata->local;
 	int res = 0;
 
 	ASSERT_RTNL();
 
-	if (sdata->type == NL802154_IFTYPE_NODE) {
-		mutex_lock(&sdata->local->iflist_mtx);
-		list_for_each_entry(subif, &sdata->local->interfaces, list) {
-			if (subif != sdata && subif->type == sdata->type &&
-			    subif->running) {
-				mutex_unlock(&sdata->local->iflist_mtx);
-				return -EBUSY;
-			}
-		}
-		mutex_unlock(&sdata->local->iflist_mtx);
-	}
-
 	mutex_lock(&sdata->local->iflist_mtx);
 	sdata->running = true;
 	mutex_unlock(&sdata->local->iflist_mtx);
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 10/12] mac802154: rework open count
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (8 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 09/12] mac802154: remove useless -EBUSY if sdata running Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 11/12] mac802154: remove ieee802154_addr from driver_ops Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 12/12] mac802154: rework sdata state change to running Alexander Aring
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

Some cleanup to avoid pre- and post-calculation with the open_count
variable.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/iface.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index ab23246..c1e5096 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -40,17 +40,17 @@ static int mac802154_slave_open(struct net_device *dev)
 
 	ASSERT_RTNL();
 
-	mutex_lock(&sdata->local->iflist_mtx);
-	sdata->running = true;
-	mutex_unlock(&sdata->local->iflist_mtx);
-
-	if (local->open_count++ == 0) {
+	if (!local->open_count) {
 		res = drv_start(local);
 		WARN_ON(res);
 		if (res)
 			goto err;
 	}
 
+	mutex_lock(&sdata->local->iflist_mtx);
+	sdata->running = true;
+	mutex_unlock(&sdata->local->iflist_mtx);
+
 	if (local->ops->ieee_addr) {
 		__le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
 
@@ -61,11 +61,12 @@ static int mac802154_slave_open(struct net_device *dev)
 		mac802154_dev_set_ieee_addr(dev);
 	}
 
+	local->open_count++;
+
 	netif_start_queue(dev);
+
 	return 0;
 err:
-	sdata->local->open_count--;
-
 	return res;
 }
 
@@ -78,11 +79,13 @@ static int mac802154_slave_close(struct net_device *dev)
 
 	netif_stop_queue(dev);
 
+	local->open_count--;
+
 	mutex_lock(&sdata->local->iflist_mtx);
 	sdata->running = false;
 	mutex_unlock(&sdata->local->iflist_mtx);
 
-	if (!--local->open_count)
+	if (!local->open_count)
 		drv_stop(local);
 
 	return 0;
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 11/12] mac802154: remove ieee802154_addr from driver_ops
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (9 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 10/12] mac802154: rework open count Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-13 13:46 ` [PATCH wpan-next 12/12] mac802154: rework sdata state change to running Alexander Aring
  11 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

This function is never used by any driver. There exist also no comment
for this. In my opinion it was a try to implement hardware address
filter but we have already such driver ops for this functionallity.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 include/net/mac802154.h |  1 -
 net/mac802154/iface.c   | 10 ----------
 2 files changed, 11 deletions(-)

diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 9e9d8fa..4666b98 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -173,7 +173,6 @@ struct ieee802154_ops {
 	int		(*set_hw_addr_filt)(struct ieee802154_hw *hw,
 					    struct ieee802154_hw_addr_filt *filt,
 					    unsigned long changed);
-	int		(*ieee_addr)(struct ieee802154_hw *hw, __le64 addr);
 	int		(*set_txpower)(struct ieee802154_hw *hw, int db);
 	int		(*set_lbt)(struct ieee802154_hw *hw, bool on);
 	int		(*set_cca_mode)(struct ieee802154_hw *hw, u8 mode);
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index c1e5096..4655be5 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -51,16 +51,6 @@ static int mac802154_slave_open(struct net_device *dev)
 	sdata->running = true;
 	mutex_unlock(&sdata->local->iflist_mtx);
 
-	if (local->ops->ieee_addr) {
-		__le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
-
-		res = local->ops->ieee_addr(&local->hw, addr);
-		WARN_ON(res);
-		if (res)
-			goto err;
-		mac802154_dev_set_ieee_addr(dev);
-	}
-
 	local->open_count++;
 
 	netif_start_queue(dev);
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH wpan-next 12/12] mac802154: rework sdata state change to running
  2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
                   ` (10 preceding siblings ...)
  2014-08-13 13:46 ` [PATCH wpan-next 11/12] mac802154: remove ieee802154_addr from driver_ops Alexander Aring
@ 2014-08-13 13:46 ` Alexander Aring
  2014-08-14  8:05   ` Martin Townsend
  11 siblings, 1 reply; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 13:46 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring

This patch reworks the handling for setting the state like mac80211. We
use bit's instead a bool variable. The mutex is not needed because it's
locked by rtnl lock.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/ieee802154_i.h |  6 +++++-
 net/mac802154/iface.c        | 10 ++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index c20fbc9..5bfdec0 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -31,6 +31,10 @@ enum {
 	IEEE802154_RX_MSG        = 1,
 };
 
+enum ieee802154_sdata_state_bits {
+	SDATA_STATE_RUNNING,
+};
+
 /* Slave interface definition.
  *
  * Slaves represent typical network interfaces available from userspace.
@@ -44,7 +48,7 @@ struct ieee802154_sub_if_data {
 	struct net_device *dev;
 
 	int type;
-	bool running;
+	unsigned long state;
 
 	spinlock_t mib_lock;
 
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 4655be5..d221562 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -47,9 +47,7 @@ static int mac802154_slave_open(struct net_device *dev)
 			goto err;
 	}
 
-	mutex_lock(&sdata->local->iflist_mtx);
-	sdata->running = true;
-	mutex_unlock(&sdata->local->iflist_mtx);
+	set_bit(SDATA_STATE_RUNNING, &sdata->state);
 
 	local->open_count++;
 
@@ -57,6 +55,8 @@ static int mac802154_slave_open(struct net_device *dev)
 
 	return 0;
 err:
+	/* might already be clear but that doesn't matter */
+	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
 	return res;
 }
 
@@ -71,9 +71,7 @@ static int mac802154_slave_close(struct net_device *dev)
 
 	local->open_count--;
 
-	mutex_lock(&sdata->local->iflist_mtx);
-	sdata->running = false;
-	mutex_unlock(&sdata->local->iflist_mtx);
+	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
 
 	if (!local->open_count)
 		drv_stop(local);
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH wpan-next 09/12] mac802154: remove useless -EBUSY if sdata running
  2014-08-13 13:46 ` [PATCH wpan-next 09/12] mac802154: remove useless -EBUSY if sdata running Alexander Aring
@ 2014-08-13 15:07   ` Alexander Aring
  2014-08-24  6:59   ` Alexander Aring
  1 sibling, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-13 15:07 UTC (permalink / raw)
  To: linux-wpan

Hi,

On Wed, Aug 13, 2014 at 03:46:32PM +0200, Alexander Aring wrote:
> The slave_open function is only called by ndo_open callback. This
> callback is already protected to do a ip link set wpan0 up twice.
> This patch removing also a unnecessary for each loop to find the right
> entry which is already known.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
>  net/mac802154/iface.c | 13 -------------
>  1 file changed, 13 deletions(-)
> 
> diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
> index ae774d3..ab23246 100644
> --- a/net/mac802154/iface.c
> +++ b/net/mac802154/iface.c
> @@ -35,24 +35,11 @@
>  static int mac802154_slave_open(struct net_device *dev)
>  {
>  	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
> -	struct ieee802154_sub_if_data *subif;
>  	struct ieee802154_local *local = sdata->local;
>  	int res = 0;
>  
>  	ASSERT_RTNL();
>  
> -	if (sdata->type == NL802154_IFTYPE_NODE) {
> -		mutex_lock(&sdata->local->iflist_mtx);
> -		list_for_each_entry(subif, &sdata->local->interfaces, list) {
> -			if (subif != sdata && subif->type == sdata->type &&

I will keep this patch, I thought this is subif == sdata... then it
would not make sense. But this make sense now. It checks that we don't
have an another running interface for a phy.

Sorry.

- Alex

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH wpan-next 12/12] mac802154: rework sdata state change to running
  2014-08-13 13:46 ` [PATCH wpan-next 12/12] mac802154: rework sdata state change to running Alexander Aring
@ 2014-08-14  8:05   ` Martin Townsend
  2014-08-14  8:18     ` Alexander Aring
  0 siblings, 1 reply; 17+ messages in thread
From: Martin Townsend @ 2014-08-14  8:05 UTC (permalink / raw)
  To: Alexander Aring, linux-wpan

Looks good, I would think that the mutex is not needed as set_bit and clear_bit are atomic operations??

- Martin.

On 13/08/14 14:46, Alexander Aring wrote:
> This patch reworks the handling for setting the state like mac80211. We
> use bit's instead a bool variable. The mutex is not needed because it's
> locked by rtnl lock.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
>  net/mac802154/ieee802154_i.h |  6 +++++-
>  net/mac802154/iface.c        | 10 ++++------
>  2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
> index c20fbc9..5bfdec0 100644
> --- a/net/mac802154/ieee802154_i.h
> +++ b/net/mac802154/ieee802154_i.h
> @@ -31,6 +31,10 @@ enum {
>  	IEEE802154_RX_MSG        = 1,
>  };
>  
> +enum ieee802154_sdata_state_bits {
> +	SDATA_STATE_RUNNING,
> +};
> +
>  /* Slave interface definition.
>   *
>   * Slaves represent typical network interfaces available from userspace.
> @@ -44,7 +48,7 @@ struct ieee802154_sub_if_data {
>  	struct net_device *dev;
>  
>  	int type;
> -	bool running;
> +	unsigned long state;
>  
>  	spinlock_t mib_lock;
>  
> diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
> index 4655be5..d221562 100644
> --- a/net/mac802154/iface.c
> +++ b/net/mac802154/iface.c
> @@ -47,9 +47,7 @@ static int mac802154_slave_open(struct net_device *dev)
>  			goto err;
>  	}
>  
> -	mutex_lock(&sdata->local->iflist_mtx);
> -	sdata->running = true;
> -	mutex_unlock(&sdata->local->iflist_mtx);
> +	set_bit(SDATA_STATE_RUNNING, &sdata->state);
>  
>  	local->open_count++;
>  
> @@ -57,6 +55,8 @@ static int mac802154_slave_open(struct net_device *dev)
>  
>  	return 0;
>  err:
> +	/* might already be clear but that doesn't matter */
> +	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
>  	return res;
>  }
>  
> @@ -71,9 +71,7 @@ static int mac802154_slave_close(struct net_device *dev)
>  
>  	local->open_count--;
>  
> -	mutex_lock(&sdata->local->iflist_mtx);
> -	sdata->running = false;
> -	mutex_unlock(&sdata->local->iflist_mtx);
> +	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
>  
>  	if (!local->open_count)
>  		drv_stop(local);


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH wpan-next 12/12] mac802154: rework sdata state change to running
  2014-08-14  8:05   ` Martin Townsend
@ 2014-08-14  8:18     ` Alexander Aring
  0 siblings, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-14  8:18 UTC (permalink / raw)
  To: Martin Townsend; +Cc: linux-wpan

On Thu, Aug 14, 2014 at 09:05:37AM +0100, Martin Townsend wrote:
> Looks good, I would think that the mutex is not needed as set_bit and clear_bit are atomic operations??
>

you are right, it's atomic. I will change the commit msg according to
this. I thought it would be locked because it's only read/write when
rtnl lock is hold. This is the current behaviour, but it's not
necessary.

- Alex

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH wpan-next 09/12] mac802154: remove useless -EBUSY if sdata running
  2014-08-13 13:46 ` [PATCH wpan-next 09/12] mac802154: remove useless -EBUSY if sdata running Alexander Aring
  2014-08-13 15:07   ` Alexander Aring
@ 2014-08-24  6:59   ` Alexander Aring
  1 sibling, 0 replies; 17+ messages in thread
From: Alexander Aring @ 2014-08-24  6:59 UTC (permalink / raw)
  To: linux-wpan

Hi,

On Wed, Aug 13, 2014 at 03:46:32PM +0200, Alexander Aring wrote:
> The slave_open function is only called by ndo_open callback. This
> callback is already protected to do a ip link set wpan0 up twice.
> This patch removing also a unnecessary for each loop to find the right
> entry which is already known.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
>  net/mac802154/iface.c | 13 -------------
>  1 file changed, 13 deletions(-)
> 
> diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
> index ae774d3..ab23246 100644
> --- a/net/mac802154/iface.c
> +++ b/net/mac802154/iface.c
> @@ -35,24 +35,11 @@
>  static int mac802154_slave_open(struct net_device *dev)
>  {
>  	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
> -	struct ieee802154_sub_if_data *subif;
>  	struct ieee802154_local *local = sdata->local;
>  	int res = 0;
>  
>  	ASSERT_RTNL();
>  
> -	if (sdata->type == NL802154_IFTYPE_NODE) {
> -		mutex_lock(&sdata->local->iflist_mtx);
> -		list_for_each_entry(subif, &sdata->local->interfaces, list) {
> -			if (subif != sdata && subif->type == sdata->type &&
> -			    subif->running) {
> -				mutex_unlock(&sdata->local->iflist_mtx);
> -				return -EBUSY;
> -			}
> -		}
> -		mutex_unlock(&sdata->local->iflist_mtx);
> -	}

I finally found where it was copy&pasted from wireless code and
obfuscated afterwards. [0]

It's like a good puzzle. :-)

I adapt the current 80211 behaviour.


I will write a status update about the rework process today.

- Alex

[0] http://lxr.free-electrons.com/source/net/mac80211/iface.c?v=3.16#L257

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-08-24  6:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-13 13:46 [PATCH wpan-next 00/12] ieee802154: mac802154: wireless transformation part 2 Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 01/12] mac802154: rx: warn if ieee80211_rx call from irq Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 02/12] mac802154: move header parse functions to rx.c Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 03/12] mac802154: rename sdata slaves and slaves_mtx Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 04/12] mac802154: introduce IEEE802154_DEV_TO_SUB_IF Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 05/12] mac802154: move slave open/close functions to wpan Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 06/12] mac802154: rename wpan.c to iface.c Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 07/12] mac802154: rx: use netif_receive_skb Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 08/12] mac802154: introduce internal driver-ops header Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 09/12] mac802154: remove useless -EBUSY if sdata running Alexander Aring
2014-08-13 15:07   ` Alexander Aring
2014-08-24  6:59   ` Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 10/12] mac802154: rework open count Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 11/12] mac802154: remove ieee802154_addr from driver_ops Alexander Aring
2014-08-13 13:46 ` [PATCH wpan-next 12/12] mac802154: rework sdata state change to running Alexander Aring
2014-08-14  8:05   ` Martin Townsend
2014-08-14  8:18     ` Alexander Aring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.