Commit a13061ec authored by Phoebe Buckheister's avatar Phoebe Buckheister Committed by David S. Miller

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: default avatarPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae531b94
...@@ -187,13 +187,6 @@ static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa, ...@@ -187,13 +187,6 @@ static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa,
} }
} }
struct ieee802154_frag_info {
__be16 d_tag;
u16 d_size;
u8 d_offset;
};
/* /*
* A control block of skb passed between the ARPHRD_IEEE802154 device * A control block of skb passed between the ARPHRD_IEEE802154 device
* and other stack parts. * and other stack parts.
...@@ -202,7 +195,6 @@ struct ieee802154_mac_cb { ...@@ -202,7 +195,6 @@ struct ieee802154_mac_cb {
u8 lqi; u8 lqi;
u8 flags; u8 flags;
u8 seq; u8 seq;
struct ieee802154_frag_info frag_info;
struct ieee802154_addr source; struct ieee802154_addr source;
struct ieee802154_addr dest; struct ieee802154_addr dest;
}; };
......
...@@ -30,6 +30,17 @@ ...@@ -30,6 +30,17 @@
#include "reassembly.h" #include "reassembly.h"
struct lowpan_frag_info {
__be16 d_tag;
u16 d_size;
u8 d_offset;
};
struct lowpan_frag_info *lowpan_cb(struct sk_buff *skb)
{
return (struct lowpan_frag_info *)skb->cb;
}
static struct inet_frags lowpan_frags; static struct inet_frags lowpan_frags;
static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, static int lowpan_frag_reasm(struct lowpan_frag_queue *fq,
...@@ -102,7 +113,7 @@ static void lowpan_frag_expire(unsigned long data) ...@@ -102,7 +113,7 @@ static void lowpan_frag_expire(unsigned long data)
} }
static inline struct lowpan_frag_queue * static inline struct lowpan_frag_queue *
fq_find(struct net *net, const struct ieee802154_frag_info *frag_info, fq_find(struct net *net, const struct lowpan_frag_info *frag_info,
const struct ieee802154_addr *src, const struct ieee802154_addr *src,
const struct ieee802154_addr *dst) const struct ieee802154_addr *dst)
{ {
...@@ -137,8 +148,8 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq, ...@@ -137,8 +148,8 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq,
if (fq->q.last_in & INET_FRAG_COMPLETE) if (fq->q.last_in & INET_FRAG_COMPLETE)
goto err; goto err;
offset = mac_cb(skb)->frag_info.d_offset << 3; offset = lowpan_cb(skb)->d_offset << 3;
end = mac_cb(skb)->frag_info.d_size; end = lowpan_cb(skb)->d_size;
/* Is this the final fragment? */ /* Is this the final fragment? */
if (offset + skb->len == end) { if (offset + skb->len == end) {
...@@ -164,15 +175,13 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq, ...@@ -164,15 +175,13 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq,
* this fragment, right? * this fragment, right?
*/ */
prev = fq->q.fragments_tail; prev = fq->q.fragments_tail;
if (!prev || mac_cb(prev)->frag_info.d_offset < if (!prev || lowpan_cb(prev)->d_offset < lowpan_cb(skb)->d_offset) {
mac_cb(skb)->frag_info.d_offset) {
next = NULL; next = NULL;
goto found; goto found;
} }
prev = NULL; prev = NULL;
for (next = fq->q.fragments; next != NULL; next = next->next) { for (next = fq->q.fragments; next != NULL; next = next->next) {
if (mac_cb(next)->frag_info.d_offset >= if (lowpan_cb(next)->d_offset >= lowpan_cb(skb)->d_offset)
mac_cb(skb)->frag_info.d_offset)
break; /* bingo! */ break; /* bingo! */
prev = next; prev = next;
} }
...@@ -319,7 +328,7 @@ static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, struct sk_buff *prev, ...@@ -319,7 +328,7 @@ static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, struct sk_buff *prev,
} }
static int lowpan_get_frag_info(struct sk_buff *skb, const u8 frag_type, static int lowpan_get_frag_info(struct sk_buff *skb, const u8 frag_type,
struct ieee802154_frag_info *frag_info) struct lowpan_frag_info *frag_info)
{ {
bool fail; bool fail;
u8 pattern = 0, low = 0; u8 pattern = 0, low = 0;
...@@ -346,7 +355,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type) ...@@ -346,7 +355,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type)
{ {
struct lowpan_frag_queue *fq; struct lowpan_frag_queue *fq;
struct net *net = dev_net(skb->dev); struct net *net = dev_net(skb->dev);
struct ieee802154_frag_info *frag_info = &mac_cb(skb)->frag_info; struct lowpan_frag_info *frag_info = lowpan_cb(skb);
struct ieee802154_addr source, dest; struct ieee802154_addr source, dest;
int err; int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment