[PATCH 22/27] backports: 6lowpan domain specific backport of inet_frag_lru_move()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We can't generalize a backport of inet_frag_lru_move() as
it requires modifying an internal struct netns_frags struct.
We work around this by extending the parent struct used within
6lowpan. We have two changes, one data structure change
and then a domain specific defines. Other subsystems which
require similar work can backport usage through similar
techniques.

The respective change upstream that put the lock on
struct netns_frags is commit 3ef0eb0db4 added by
through v3.9.

mcgrof@ergon ~/linux-next (git::master)$ git describe --contains 3ef0eb0db4
v3.9-rc1~139^2~232^2

commit 3ef0eb0db4bf92c6d2510fe5c4dc51852746f206
Author: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
Date:   Mon Jan 28 23:45:51 2013 +0000

    net: frag, move LRU list maintenance outside of rwlock

    Updating the fragmentation queues LRU (Least-Recently-Used) list,
    required taking the hash writer lock.  However, the LRU list isn't
    tied to the hash at all, so we can use a separate lock for it.

    Original-idea-by: Florian Westphal <fw@xxxxxxxxx>
    Signed-off-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>

Cc: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
Cc: Alexander Smirnov <alex.bluesman.smirnov@xxxxxxxxx>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@xxxxxxxxx>
Cc: linux-zigbee-devel@xxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxxxxx>
---
 .../network/0013-lowpan-inet_frag_lru_move.patch   | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/0013-lowpan-inet_frag_lru_move.patch

diff --git a/patches/collateral-evolutions/network/0013-lowpan-inet_frag_lru_move.patch b/patches/collateral-evolutions/network/0013-lowpan-inet_frag_lru_move.patch
new file mode 100644
index 0000000..9f1f0c1
--- /dev/null
+++ b/patches/collateral-evolutions/network/0013-lowpan-inet_frag_lru_move.patch
@@ -0,0 +1,59 @@
+Domain specific backport for inet_frag_lru_move()
+This requires two parts, the data structure changes
+and then domain specific inet_frag_lru_move() define.
+
+--- a/net/ieee802154/reassembly.c
++++ b/net/ieee802154/reassembly.c
+@@ -81,6 +81,9 @@ void lowpan_frag_init(struct inet_frag_q
+ 	fq->d_size = arg->d_size;
+ 	fq->saddr = *arg->src;
+ 	fq->daddr = *arg->dst;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
++	spin_lock_init(&fq->lru_lock);
++#endif
+ }
+ EXPORT_SYMBOL(lowpan_frag_init);
+ 
+--- a/net/ieee802154/reassembly.h
++++ b/net/ieee802154/reassembly.h
+@@ -2,6 +2,7 @@
+ #define __IEEE802154_6LOWPAN_REASSEMBLY_H__
+ 
+ #include <net/inet_frag.h>
++#include <linux/spinlock.h>
+ 
+ struct lowpan_create_arg {
+ 	__be16 tag;
+@@ -19,8 +20,32 @@ struct lowpan_frag_queue {
+ 	u16			d_size;
+ 	struct ieee802154_addr	saddr;
+ 	struct ieee802154_addr	daddr;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
++	spinlock_t		lru_lock;
++#endif
+ };
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
++/*
++ * XXX: this is a *domain* specific inet_frag_lru_move backport,
++ * note the added lowpan_ prefix, this requires a respective patch
++ * which extends struct lowpan_frag_queue with an lru_lock and
++ * initializes it. We add this helper here to reduce the backport.
++ * There is no way to generalize the other changes in the patch.
++ */
++#define inet_frag_lru_move LINUX_BACKPORT(lowpan_inet_frag_lru_move)
++static inline void inet_frag_lru_move(struct inet_frag_queue *q)
++{
++	struct lowpan_frag_queue *fq;
++
++	fq = container_of(q, struct lowpan_frag_queue, q);
++
++	spin_lock(&fq->lru_lock);
++	list_move_tail(&q->lru_list, &q->net->lru_list);
++	spin_unlock(&fq->lru_lock);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */
++
+ static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a)
+ {
+ 	switch (a->addr_type) {
-- 
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux