xref: /linux/net/ieee802154/6lowpan/6lowpan_i.h (revision 8691ee592c9299847b28350692eda1d5d6990581)
1*8691ee59SAlexander Aring #ifndef __IEEE802154_6LOWPAN_I_H__
2*8691ee59SAlexander Aring #define __IEEE802154_6LOWPAN_I_H__
3*8691ee59SAlexander Aring 
4*8691ee59SAlexander Aring #include <net/inet_frag.h>
5*8691ee59SAlexander Aring 
6*8691ee59SAlexander Aring struct lowpan_create_arg {
7*8691ee59SAlexander Aring 	u16 tag;
8*8691ee59SAlexander Aring 	u16 d_size;
9*8691ee59SAlexander Aring 	const struct ieee802154_addr *src;
10*8691ee59SAlexander Aring 	const struct ieee802154_addr *dst;
11*8691ee59SAlexander Aring };
12*8691ee59SAlexander Aring 
13*8691ee59SAlexander Aring /* Equivalent of ipv4 struct ip
14*8691ee59SAlexander Aring  */
15*8691ee59SAlexander Aring struct lowpan_frag_queue {
16*8691ee59SAlexander Aring 	struct inet_frag_queue	q;
17*8691ee59SAlexander Aring 
18*8691ee59SAlexander Aring 	u16			tag;
19*8691ee59SAlexander Aring 	u16			d_size;
20*8691ee59SAlexander Aring 	struct ieee802154_addr	saddr;
21*8691ee59SAlexander Aring 	struct ieee802154_addr	daddr;
22*8691ee59SAlexander Aring };
23*8691ee59SAlexander Aring 
24*8691ee59SAlexander Aring static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a)
25*8691ee59SAlexander Aring {
26*8691ee59SAlexander Aring 	switch (a->mode) {
27*8691ee59SAlexander Aring 	case IEEE802154_ADDR_LONG:
28*8691ee59SAlexander Aring 		return (((__force u64)a->extended_addr) >> 32) ^
29*8691ee59SAlexander Aring 			(((__force u64)a->extended_addr) & 0xffffffff);
30*8691ee59SAlexander Aring 	case IEEE802154_ADDR_SHORT:
31*8691ee59SAlexander Aring 		return (__force u32)(a->short_addr);
32*8691ee59SAlexander Aring 	default:
33*8691ee59SAlexander Aring 		return 0;
34*8691ee59SAlexander Aring 	}
35*8691ee59SAlexander Aring }
36*8691ee59SAlexander Aring 
37*8691ee59SAlexander Aring int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type);
38*8691ee59SAlexander Aring void lowpan_net_frag_exit(void);
39*8691ee59SAlexander Aring int lowpan_net_frag_init(void);
40*8691ee59SAlexander Aring 
41*8691ee59SAlexander Aring #endif /* __IEEE802154_6LOWPAN_I_H__ */
42