1 #ifndef __IEEE802154_6LOWPAN_I_H__
2 #define __IEEE802154_6LOWPAN_I_H__
3 
4 #include <linux/list.h>
5 
6 #include <net/ieee802154_netdev.h>
7 #include <net/inet_frag.h>
8 #include <net/6lowpan.h>
9 
10 struct lowpan_create_arg {
11 	u16 tag;
12 	u16 d_size;
13 	const struct ieee802154_addr *src;
14 	const struct ieee802154_addr *dst;
15 };
16 
17 /* Equivalent of ipv4 struct ip
18  */
19 struct lowpan_frag_queue {
20 	struct inet_frag_queue	q;
21 
22 	u16			tag;
23 	u16			d_size;
24 	struct ieee802154_addr	saddr;
25 	struct ieee802154_addr	daddr;
26 };
27 
28 static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a)
29 {
30 	switch (a->mode) {
31 	case IEEE802154_ADDR_LONG:
32 		return (((__force u64)a->extended_addr) >> 32) ^
33 			(((__force u64)a->extended_addr) & 0xffffffff);
34 	case IEEE802154_ADDR_SHORT:
35 		return (__force u32)(a->short_addr);
36 	default:
37 		return 0;
38 	}
39 }
40 
41 /* private device info */
42 struct lowpan_dev_info {
43 	struct net_device	*real_dev; /* real WPAN device ptr */
44 	u16			fragment_tag;
45 };
46 
47 static inline struct
48 lowpan_dev_info *lowpan_dev_info(const struct net_device *dev)
49 {
50 	return (struct lowpan_dev_info *)lowpan_priv(dev)->priv;
51 }
52 
53 int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type);
54 void lowpan_net_frag_exit(void);
55 int lowpan_net_frag_init(void);
56 
57 void lowpan_rx_init(void);
58 void lowpan_rx_exit(void);
59 
60 int lowpan_header_create(struct sk_buff *skb, struct net_device *dev,
61 			 unsigned short type, const void *_daddr,
62 			 const void *_saddr, unsigned int len);
63 netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev);
64 
65 #endif /* __IEEE802154_6LOWPAN_I_H__ */
66