diff options
author | Tony Cheneau <tony.cheneau@amnesiak.org> | 2013-03-25 13:59:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-26 12:37:57 -0400 |
commit | d4ac32365dcbfd341a87eae444c26679f889249a (patch) | |
tree | 7457f5ee540426d6e16081209368445af9aeae7d /net/ieee802154/6lowpan.c | |
parent | 9da2924c4ba8da5f41285c98eb1ba9aee99344a4 (diff) |
6lowpan: store fragment tag values per device instead of net stack wide
Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154/6lowpan.c')
-rw-r--r-- | net/ieee802154/6lowpan.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 61eee9d0dd21..f9524513847a 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
@@ -104,6 +104,7 @@ static const u8 lowpan_llprefix[] = {0xfe, 0x80}; | |||
104 | struct lowpan_dev_info { | 104 | struct lowpan_dev_info { |
105 | struct net_device *real_dev; /* real WPAN device ptr */ | 105 | struct net_device *real_dev; /* real WPAN device ptr */ |
106 | struct mutex dev_list_mtx; /* mutex for list ops */ | 106 | struct mutex dev_list_mtx; /* mutex for list ops */ |
107 | unsigned short fragment_tag; | ||
107 | }; | 108 | }; |
108 | 109 | ||
109 | struct lowpan_dev_record { | 110 | struct lowpan_dev_record { |
@@ -120,7 +121,6 @@ struct lowpan_fragment { | |||
120 | struct list_head list; /* fragments list */ | 121 | struct list_head list; /* fragments list */ |
121 | }; | 122 | }; |
122 | 123 | ||
123 | static unsigned short fragment_tag; | ||
124 | static LIST_HEAD(lowpan_fragments); | 124 | static LIST_HEAD(lowpan_fragments); |
125 | static DEFINE_SPINLOCK(flist_lock); | 125 | static DEFINE_SPINLOCK(flist_lock); |
126 | 126 | ||
@@ -1027,14 +1027,14 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head, | |||
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | static int | 1029 | static int |
1030 | lowpan_skb_fragmentation(struct sk_buff *skb) | 1030 | lowpan_skb_fragmentation(struct sk_buff *skb, struct net_device *dev) |
1031 | { | 1031 | { |
1032 | int err, header_length, payload_length, tag, offset = 0; | 1032 | int err, header_length, payload_length, tag, offset = 0; |
1033 | u8 head[5]; | 1033 | u8 head[5]; |
1034 | 1034 | ||
1035 | header_length = lowpan_get_mac_header_length(skb); | 1035 | header_length = lowpan_get_mac_header_length(skb); |
1036 | payload_length = skb->len - header_length; | 1036 | payload_length = skb->len - header_length; |
1037 | tag = fragment_tag++; | 1037 | tag = lowpan_dev_info(dev)->fragment_tag++; |
1038 | 1038 | ||
1039 | /* first fragment header */ | 1039 | /* first fragment header */ |
1040 | head[0] = LOWPAN_DISPATCH_FRAG1 | ((payload_length >> 8) & 0x7); | 1040 | head[0] = LOWPAN_DISPATCH_FRAG1 | ((payload_length >> 8) & 0x7); |
@@ -1099,7 +1099,7 @@ static netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | pr_debug("frame is too big, fragmentation is needed\n"); | 1101 | pr_debug("frame is too big, fragmentation is needed\n"); |
1102 | err = lowpan_skb_fragmentation(skb); | 1102 | err = lowpan_skb_fragmentation(skb, dev); |
1103 | error: | 1103 | error: |
1104 | dev_kfree_skb(skb); | 1104 | dev_kfree_skb(skb); |
1105 | out: | 1105 | out: |
@@ -1243,6 +1243,7 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, | |||
1243 | return -ENODEV; | 1243 | return -ENODEV; |
1244 | 1244 | ||
1245 | lowpan_dev_info(dev)->real_dev = real_dev; | 1245 | lowpan_dev_info(dev)->real_dev = real_dev; |
1246 | lowpan_dev_info(dev)->fragment_tag = 0; | ||
1246 | mutex_init(&lowpan_dev_info(dev)->dev_list_mtx); | 1247 | mutex_init(&lowpan_dev_info(dev)->dev_list_mtx); |
1247 | 1248 | ||
1248 | entry = kzalloc(sizeof(struct lowpan_dev_record), GFP_KERNEL); | 1249 | entry = kzalloc(sizeof(struct lowpan_dev_record), GFP_KERNEL); |