提交 d4ac3236 编写于 作者: T Tony Cheneau 提交者: David S. Miller

6lowpan: store fragment tag values per device instead of net stack wide

Signed-off-by: NTony Cheneau <tony.cheneau@amnesiak.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9da2924c
...@@ -104,6 +104,7 @@ static const u8 lowpan_llprefix[] = {0xfe, 0x80}; ...@@ -104,6 +104,7 @@ static const u8 lowpan_llprefix[] = {0xfe, 0x80};
struct lowpan_dev_info { struct lowpan_dev_info {
struct net_device *real_dev; /* real WPAN device ptr */ struct net_device *real_dev; /* real WPAN device ptr */
struct mutex dev_list_mtx; /* mutex for list ops */ struct mutex dev_list_mtx; /* mutex for list ops */
unsigned short fragment_tag;
}; };
struct lowpan_dev_record { struct lowpan_dev_record {
...@@ -120,7 +121,6 @@ struct lowpan_fragment { ...@@ -120,7 +121,6 @@ struct lowpan_fragment {
struct list_head list; /* fragments list */ struct list_head list; /* fragments list */
}; };
static unsigned short fragment_tag;
static LIST_HEAD(lowpan_fragments); static LIST_HEAD(lowpan_fragments);
static DEFINE_SPINLOCK(flist_lock); static DEFINE_SPINLOCK(flist_lock);
...@@ -1027,14 +1027,14 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head, ...@@ -1027,14 +1027,14 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
} }
static int static int
lowpan_skb_fragmentation(struct sk_buff *skb) 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 = lowpan_get_mac_header_length(skb);
payload_length = skb->len - header_length; payload_length = skb->len - header_length;
tag = fragment_tag++; tag = lowpan_dev_info(dev)->fragment_tag++;
/* first fragment header */ /* first fragment header */
head[0] = LOWPAN_DISPATCH_FRAG1 | ((payload_length >> 8) & 0x7); 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,7 +1099,7 @@ static netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev)
} }
pr_debug("frame is too big, fragmentation is needed\n"); pr_debug("frame is too big, fragmentation is needed\n");
err = lowpan_skb_fragmentation(skb); err = lowpan_skb_fragmentation(skb, dev);
error: error:
dev_kfree_skb(skb); dev_kfree_skb(skb);
out: out:
...@@ -1243,6 +1243,7 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, ...@@ -1243,6 +1243,7 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
return -ENODEV; return -ENODEV;
lowpan_dev_info(dev)->real_dev = real_dev; lowpan_dev_info(dev)->real_dev = real_dev;
lowpan_dev_info(dev)->fragment_tag = 0;
mutex_init(&lowpan_dev_info(dev)->dev_list_mtx); mutex_init(&lowpan_dev_info(dev)->dev_list_mtx);
entry = kzalloc(sizeof(struct lowpan_dev_record), GFP_KERNEL); entry = kzalloc(sizeof(struct lowpan_dev_record), GFP_KERNEL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册