aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>2014-03-14 16:24:03 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-14 22:15:26 -0400
commita13061ec04e9168625427a591235b167d5499bc6 (patch)
tree153f6ffdc04fcc15746c69e7155de73c0de78b0f /net/ieee802154
parentae531b9475f62c5e1863508604cd6b3faf362d56 (diff)
6lowpan: move lowpan frag_info out of 802.15.4 headers
Fragmentation and reassembly information for 6lowpan is independent from the 802.15.4 stack and used only by the 6lowpan reassembly process. Move the ieee802154_frag_info struct to a private are, it needn't be in the 802.15.4 skb control block. Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/reassembly.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/net/ieee802154/reassembly.c b/net/ieee802154/reassembly.c
index a2b9e4e533f8..ef2d54372b13 100644
--- a/net/ieee802154/reassembly.c
+++ b/net/ieee802154/reassembly.c
@@ -30,6 +30,17 @@
30 30
31#include "reassembly.h" 31#include "reassembly.h"
32 32
33struct lowpan_frag_info {
34 __be16 d_tag;
35 u16 d_size;
36 u8 d_offset;
37};
38
39struct lowpan_frag_info *lowpan_cb(struct sk_buff *skb)
40{
41 return (struct lowpan_frag_info *)skb->cb;
42}
43
33static struct inet_frags lowpan_frags; 44static struct inet_frags lowpan_frags;
34 45
35static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, 46static int lowpan_frag_reasm(struct lowpan_frag_queue *fq,
@@ -102,7 +113,7 @@ out:
102} 113}
103 114
104static inline struct lowpan_frag_queue * 115static inline struct lowpan_frag_queue *
105fq_find(struct net *net, const struct ieee802154_frag_info *frag_info, 116fq_find(struct net *net, const struct lowpan_frag_info *frag_info,
106 const struct ieee802154_addr *src, 117 const struct ieee802154_addr *src,
107 const struct ieee802154_addr *dst) 118 const struct ieee802154_addr *dst)
108{ 119{
@@ -137,8 +148,8 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq,
137 if (fq->q.last_in & INET_FRAG_COMPLETE) 148 if (fq->q.last_in & INET_FRAG_COMPLETE)
138 goto err; 149 goto err;
139 150
140 offset = mac_cb(skb)->frag_info.d_offset << 3; 151 offset = lowpan_cb(skb)->d_offset << 3;
141 end = mac_cb(skb)->frag_info.d_size; 152 end = lowpan_cb(skb)->d_size;
142 153
143 /* Is this the final fragment? */ 154 /* Is this the final fragment? */
144 if (offset + skb->len == end) { 155 if (offset + skb->len == end) {
@@ -164,15 +175,13 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq,
164 * this fragment, right? 175 * this fragment, right?
165 */ 176 */
166 prev = fq->q.fragments_tail; 177 prev = fq->q.fragments_tail;
167 if (!prev || mac_cb(prev)->frag_info.d_offset < 178 if (!prev || lowpan_cb(prev)->d_offset < lowpan_cb(skb)->d_offset) {
168 mac_cb(skb)->frag_info.d_offset) {
169 next = NULL; 179 next = NULL;
170 goto found; 180 goto found;
171 } 181 }
172 prev = NULL; 182 prev = NULL;
173 for (next = fq->q.fragments; next != NULL; next = next->next) { 183 for (next = fq->q.fragments; next != NULL; next = next->next) {
174 if (mac_cb(next)->frag_info.d_offset >= 184 if (lowpan_cb(next)->d_offset >= lowpan_cb(skb)->d_offset)
175 mac_cb(skb)->frag_info.d_offset)
176 break; /* bingo! */ 185 break; /* bingo! */
177 prev = next; 186 prev = next;
178 } 187 }
@@ -319,7 +328,7 @@ out_oom:
319} 328}
320 329
321static int lowpan_get_frag_info(struct sk_buff *skb, const u8 frag_type, 330static int lowpan_get_frag_info(struct sk_buff *skb, const u8 frag_type,
322 struct ieee802154_frag_info *frag_info) 331 struct lowpan_frag_info *frag_info)
323{ 332{
324 bool fail; 333 bool fail;
325 u8 pattern = 0, low = 0; 334 u8 pattern = 0, low = 0;
@@ -346,7 +355,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type)
346{ 355{
347 struct lowpan_frag_queue *fq; 356 struct lowpan_frag_queue *fq;
348 struct net *net = dev_net(skb->dev); 357 struct net *net = dev_net(skb->dev);
349 struct ieee802154_frag_info *frag_info = &mac_cb(skb)->frag_info; 358 struct lowpan_frag_info *frag_info = lowpan_cb(skb);
350 struct ieee802154_addr source, dest; 359 struct ieee802154_addr source, dest;
351 int err; 360 int err;
352 361