blob: 836b16fa001f19852fec7f2890b8ef303d2c0773 [file] [log] [blame]
Alexander Aring7240cde2014-02-28 07:32:50 +01001#ifndef __IEEE802154_6LOWPAN_REASSEMBLY_H__
2#define __IEEE802154_6LOWPAN_REASSEMBLY_H__
3
4#include <net/inet_frag.h>
5
6struct lowpan_create_arg {
Alexander Aringf870b8c2014-10-06 11:00:51 +02007 u16 tag;
Alexander Aring7240cde2014-02-28 07:32:50 +01008 u16 d_size;
Phoebe Buckheisterae531b92014-03-14 21:24:02 +01009 const struct ieee802154_addr *src;
10 const struct ieee802154_addr *dst;
Alexander Aring7240cde2014-02-28 07:32:50 +010011};
12
13/* Equivalent of ipv4 struct ip
14 */
15struct lowpan_frag_queue {
16 struct inet_frag_queue q;
17
Alexander Aringf870b8c2014-10-06 11:00:51 +020018 u16 tag;
Alexander Aring7240cde2014-02-28 07:32:50 +010019 u16 d_size;
Phoebe Buckheisterae531b92014-03-14 21:24:02 +010020 struct ieee802154_addr saddr;
21 struct ieee802154_addr daddr;
Alexander Aring7240cde2014-02-28 07:32:50 +010022};
23
Phoebe Buckheisterae531b92014-03-14 21:24:02 +010024static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a)
Alexander Aring7240cde2014-02-28 07:32:50 +010025{
Phoebe Buckheisterae531b92014-03-14 21:24:02 +010026 switch (a->mode) {
Alexander Aring7240cde2014-02-28 07:32:50 +010027 case IEEE802154_ADDR_LONG:
Phoebe Buckheisterae531b92014-03-14 21:24:02 +010028 return (((__force u64)a->extended_addr) >> 32) ^
29 (((__force u64)a->extended_addr) & 0xffffffff);
Alexander Aring7240cde2014-02-28 07:32:50 +010030 case IEEE802154_ADDR_SHORT:
31 return (__force u32)(a->short_addr);
32 default:
33 return 0;
34 }
35}
36
Alexander Aring7240cde2014-02-28 07:32:50 +010037int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type);
38void lowpan_net_frag_exit(void);
39int lowpan_net_frag_init(void);
40
41#endif /* __IEEE802154_6LOWPAN_REASSEMBLY_H__ */