Commit 3e69162e authored by Alexander Aring's avatar Alexander Aring Committed by David S. Miller

6lowpan: set and use mac_len for mac header length

Set the mac header length while creating the 802.15.4 mac header.

Drop the function for recalculate mac header length in upper layers
which was static and works for intra pan communication only.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Reviewed-by: default avatarWerner Almesberger <werner@almesberger.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3961532f
...@@ -1100,17 +1100,6 @@ static int lowpan_set_address(struct net_device *dev, void *p) ...@@ -1100,17 +1100,6 @@ static int lowpan_set_address(struct net_device *dev, void *p)
return 0; return 0;
} }
static int lowpan_get_mac_header_length(struct sk_buff *skb)
{
/*
* Currently long addressing mode is supported only, so the overall
* header size is 21:
* FC SeqNum DPAN DA SA Sec
* 2 + 1 + 2 + 8 + 8 + 0 = 21
*/
return 21;
}
static int static int
lowpan_fragment_xmit(struct sk_buff *skb, u8 *head, lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
int mlen, int plen, int offset, int type) int mlen, int plen, int offset, int type)
...@@ -1150,7 +1139,7 @@ lowpan_skb_fragmentation(struct sk_buff *skb, struct net_device *dev) ...@@ -1150,7 +1139,7 @@ lowpan_skb_fragmentation(struct sk_buff *skb, struct net_device *dev)
int err, header_length, payload_length, tag, offset = 0; int err, header_length, payload_length, tag, offset = 0;
u8 head[5]; u8 head[5];
header_length = lowpan_get_mac_header_length(skb); header_length = skb->mac_len;
payload_length = skb->len - header_length; payload_length = skb->len - header_length;
tag = lowpan_dev_info(dev)->fragment_tag++; tag = lowpan_dev_info(dev)->fragment_tag++;
......
...@@ -208,6 +208,8 @@ static int mac802154_header_create(struct sk_buff *skb, ...@@ -208,6 +208,8 @@ static int mac802154_header_create(struct sk_buff *skb,
head[1] = fc >> 8; head[1] = fc >> 8;
memcpy(skb_push(skb, pos), head, pos); memcpy(skb_push(skb, pos), head, pos);
skb_reset_mac_header(skb);
skb->mac_len = pos;
return pos; return pos;
} }
......
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