Alexander Smirnov | 11 Jul 2012 09:22
Picon

[PATCH net-next v2 0/7] ieee802.15.4 general fixes

Dear David, Eric,

this patch-set is mostly intended to fix sparse and LOCKDEP warnings.
It mostly contains some my previous patches reworked and extended according
to the hints from Eric Dumazet and Fengguang Wu. Many thanks to they!

Changes since v1:
1. A new patch from Tony Cheneau was added. The fragmentation stops working
after some amount of packets sent. This patch fixes this issue.
2. 6lowpan fragment deleting routine: I removed spinlocks from timer_expired
handler and use spin_lock_bh to disable concurrency races with timer interrupt.
3. at86rf230 irq handler was a little bit modified

With best regards,
Alex

Alexander Smirnov (7):
  6lowpan: revert: add missing spin_lock_init()
  drivers/ieee802154/at86rf230: rework irq handler
  mac802154: add get short address method
  6lowpan: get extra headroom in allocated frame
  mac802154: sparse warnings: make symbols static
  6lowpan: fix tag variable size
  6lowpan: rework fragment-deleting routine

 drivers/ieee802154/at86rf230.c |   32 ++++++++++++++-----------
 net/ieee802154/6lowpan.c       |   49 +++++++++++++++++++--------------------
 net/mac802154/mac802154.h      |    1 +
 net/mac802154/mac_cmd.c        |    4 ++-
 net/mac802154/mib.c            |   16 ++++++++++++-
(Continue reading)

Alexander Smirnov | 11 Jul 2012 09:22
Picon

[PATCH net-next v2 1/7] 6lowpan: revert: add missing spin_lock_init()

Revert the commit 768f7c7c121e80f458a9d013b2e8b169e5dfb1e5 to initialize
spinlock in the more preferable way and make it static to avoid sparse
warning.

Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov <at> gmail.com>
---
 net/ieee802154/6lowpan.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index f4070e5..b872515 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
 <at>  <at>  -123,7 +123,7  <at>  <at>  struct lowpan_fragment {

 static unsigned short fragment_tag;
 static LIST_HEAD(lowpan_fragments);
-spinlock_t flist_lock;
+static DEFINE_SPINLOCK(flist_lock);

 static inline struct
 lowpan_dev_info *lowpan_dev_info(const struct net_device *dev)
 <at>  <at>  -1186,8 +1186,6  <at>  <at>  static int lowpan_newlink(struct net *src_net, struct net_device *dev,
 	list_add_tail(&entry->list, &lowpan_devices);
 	mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx);

-	spin_lock_init(&flist_lock);
-
 	register_netdevice(dev);

(Continue reading)

Alexander Smirnov | 11 Jul 2012 09:22
Picon

[PATCH net-next v2 3/7] mac802154: add get short address method

Add method to get the device short 802.15.4 address. This call
needed by ieee802154 layer to satisfy 'iz list' request from
the user space.

Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov <at> gmail.com>
---
 net/mac802154/mac802154.h |    1 +
 net/mac802154/mac_cmd.c   |    2 ++
 net/mac802154/mib.c       |   14 ++++++++++++++
 3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/net/mac802154/mac802154.h b/net/mac802154/mac802154.h
index 6967864..a4dcaf1 100644
--- a/net/mac802154/mac802154.h
+++ b/net/mac802154/mac802154.h
 <at>  <at>  -109,6 +109,7  <at>  <at>  netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,

 /* MIB callbacks */
 void mac802154_dev_set_short_addr(struct net_device *dev, u16 val);
+u16 mac802154_dev_get_short_addr(const struct net_device *dev);
 void mac802154_dev_set_ieee_addr(struct net_device *dev);
 u16 mac802154_dev_get_pan_id(const struct net_device *dev);
 void mac802154_dev_set_pan_id(struct net_device *dev, u16 val);
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index 7f5403e..5d9a47b 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
 <at>  <at>  -71,4 +71,6  <at>  <at>  struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced = {
 struct ieee802154_mlme_ops mac802154_mlme_wpan = {
 	.get_phy = mac802154_get_phy,
(Continue reading)

Alexander Smirnov | 11 Jul 2012 09:22
Picon

[PATCH net-next v2 2/7] drivers/ieee802154/at86rf230: rework irq handler

Fix LOCKDEP bug message for the irq handler spinlock.
Make the irq processing code more explicit and stable.

Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov <at> gmail.com>
---
 drivers/ieee802154/at86rf230.c |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/ieee802154/at86rf230.c b/drivers/ieee802154/at86rf230.c
index 902e38b..5d30940 100644
--- a/drivers/ieee802154/at86rf230.c
+++ b/drivers/ieee802154/at86rf230.c
 <at>  <at>  -543,6 +543,13  <at>  <at>  at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
 	int rc;
 	unsigned long flags;

+	spin_lock(&lp->lock);
+	if  (lp->irq_disabled) {
+		spin_unlock(&lp->lock);
+		return -EBUSY;
+	}
+	spin_unlock(&lp->lock);
+
 	might_sleep();

 	rc = at86rf230_state(dev, STATE_FORCE_TX_ON);
 <at>  <at>  -592,12 +599,8  <at>  <at>  static int at86rf230_rx(struct at86rf230_local *lp)
 	if (!skb)
 		return -ENOMEM;

(Continue reading)

Alexander Smirnov | 11 Jul 2012 09:22
Picon

[PATCH net-next v2 4/7] 6lowpan: get extra headroom in allocated frame

Use netdev_alloc_skb_ip_align() instead of alloc_skb() to get some
extra headroom in case we need to forward this frame in a tunnel or
something else.

Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov <at> gmail.com>
---
 net/ieee802154/6lowpan.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index b872515..ae3f4eb 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
 <at>  <at>  -661,8 +661,8  <at>  <at>  lowpan_alloc_new_frame(struct sk_buff *skb, u8 iphc0, u8 len, u8 tag)
 	frame->tag = tag;

 	/* allocate buffer for frame assembling */
-	frame->skb = alloc_skb(frame->length +
-			       sizeof(struct ipv6hdr), GFP_ATOMIC);
+	frame->skb = netdev_alloc_skb_ip_align(skb->dev, frame->length +
+					       sizeof(struct ipv6hdr));

 	if (!frame->skb)
 		goto skb_err;
--

-- 
1.7.2.3

Alexander Smirnov | 11 Jul 2012 09:22
Picon

[PATCH net-next v2 5/7] mac802154: sparse warnings: make symbols static

Make symbols static to avoid the following warning shown up
by sparse:

    warning: symbol ... was not declared. Should it be static?

Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov <at> gmail.com>
---
 net/mac802154/mac_cmd.c |    2 +-
 net/mac802154/mib.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index 5d9a47b..d8d2770 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
 <at>  <at>  -55,7 +55,7  <at>  <at>  static int mac802154_mlme_start_req(struct net_device *dev,
 	return 0;
 }

-struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
+static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
 {
 	struct mac802154_sub_if_data *priv = netdev_priv(dev);

diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 5c66b8f..f47781a 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
 <at>  <at>  -39,7 +39,7  <at>  <at>  struct hw_addr_filt_notify_work {
 	unsigned long changed;
(Continue reading)

Alexander Smirnov | 11 Jul 2012 09:22
Picon

[PATCH net-next v2 6/7] 6lowpan: fix tag variable size

Function lowpan_alloc_new_frame() takes u8 tag as an argument. However,
its only caller, lowpan_process_data() passes down a u16. Hence,
the tag value can get corrupted. This prevent 6lowpan fragment reassembly of a
message when the fragment tag value is over 256.

Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov <at> gmail.com>
Cc: Tony Cheneau <tony.cheneau <at> amnesiak.org>
---
 net/ieee802154/6lowpan.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index ae3f4eb..2e790fb 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
 <at>  <at>  -646,7 +646,7  <at>  <at>  static void lowpan_fragment_timer_expired(unsigned long entry_addr)
 }

 static struct lowpan_fragment *
-lowpan_alloc_new_frame(struct sk_buff *skb, u8 iphc0, u8 len, u8 tag)
+lowpan_alloc_new_frame(struct sk_buff *skb, u8 iphc0, u8 len, u16 tag)
 {
 	struct lowpan_fragment *frame;

--

-- 
1.7.2.3

Alexander Smirnov | 11 Jul 2012 09:22
Picon

[PATCH net-next v2 7/7] 6lowpan: rework fragment-deleting routine

6lowpan module starts collecting incomming frames and fragments
right after lowpan_module_init() therefor it will be better to
clean unfinished fragments in lowpan_cleanup_module() function
instead of doing it when link goes down.

Changed spinlocks type to prevent deadlock with expired timer event
and removed unused one.

Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov <at> gmail.com>
---
 net/ieee802154/6lowpan.c |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 2e790fb..6871ec1 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
 <at>  <at>  -113,7 +113,6  <at>  <at>  struct lowpan_dev_record {

 struct lowpan_fragment {
 	struct sk_buff		*skb;		/* skb to be assembled */
-	spinlock_t		lock;		/* concurency lock */
 	u16			length;		/* length to be assemled */
 	u32			bytes_rcv;	/* bytes received */
 	u16			tag;		/* current fragment tag */
 <at>  <at>  -637,10 +636,7  <at>  <at>  static void lowpan_fragment_timer_expired(unsigned long entry_addr)

 	pr_debug("timer expired for frame with tag %d\n", entry->tag);

-	spin_lock(&flist_lock);
(Continue reading)

David Miller | 12 Jul 2012 16:56
Favicon

Re: [PATCH net-next v2 0/7] ieee802.15.4 general fixes

From: Alexander Smirnov <alex.bluesman.smirnov <at> gmail.com>
Date: Wed, 11 Jul 2012 11:22:41 +0400

> Dear David, Eric,
> 
> this patch-set is mostly intended to fix sparse and LOCKDEP warnings.
> It mostly contains some my previous patches reworked and extended according
> to the hints from Eric Dumazet and Fengguang Wu. Many thanks to they!
> 
> Changes since v1:
> 1. A new patch from Tony Cheneau was added. The fragmentation stops working
> after some amount of packets sent. This patch fixes this issue.
> 2. 6lowpan fragment deleting routine: I removed spinlocks from timer_expired
> handler and use spin_lock_bh to disable concurrency races with timer interrupt.
> 3. at86rf230 irq handler was a little bit modified

Series applied, but you don't need to grab a spinlock to only
load one interger from some datastructure.  I mean:

	lock();
	ret = p->foo;
	unlock();

is completely pointless.

Gmane