Alexander Aring | 8691ee5 | 2015-01-04 17:10:54 +0100 | [diff] [blame] | 1 | #ifndef __IEEE802154_6LOWPAN_I_H__ |
| 2 | #define __IEEE802154_6LOWPAN_I_H__ |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 3 | |
Alexander Aring | 4662a0d | 2015-01-04 17:10:55 +0100 | [diff] [blame^] | 4 | #include <linux/list.h> |
| 5 | |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 6 | #include <net/inet_frag.h> |
| 7 | |
| 8 | struct lowpan_create_arg { |
Alexander Aring | f870b8c | 2014-10-06 11:00:51 +0200 | [diff] [blame] | 9 | u16 tag; |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 10 | u16 d_size; |
Phoebe Buckheister | ae531b9 | 2014-03-14 21:24:02 +0100 | [diff] [blame] | 11 | const struct ieee802154_addr *src; |
| 12 | const struct ieee802154_addr *dst; |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 13 | }; |
| 14 | |
| 15 | /* Equivalent of ipv4 struct ip |
| 16 | */ |
| 17 | struct lowpan_frag_queue { |
| 18 | struct inet_frag_queue q; |
| 19 | |
Alexander Aring | f870b8c | 2014-10-06 11:00:51 +0200 | [diff] [blame] | 20 | u16 tag; |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 21 | u16 d_size; |
Phoebe Buckheister | ae531b9 | 2014-03-14 21:24:02 +0100 | [diff] [blame] | 22 | struct ieee802154_addr saddr; |
| 23 | struct ieee802154_addr daddr; |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 24 | }; |
| 25 | |
Phoebe Buckheister | ae531b9 | 2014-03-14 21:24:02 +0100 | [diff] [blame] | 26 | static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a) |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 27 | { |
Phoebe Buckheister | ae531b9 | 2014-03-14 21:24:02 +0100 | [diff] [blame] | 28 | switch (a->mode) { |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 29 | case IEEE802154_ADDR_LONG: |
Phoebe Buckheister | ae531b9 | 2014-03-14 21:24:02 +0100 | [diff] [blame] | 30 | return (((__force u64)a->extended_addr) >> 32) ^ |
| 31 | (((__force u64)a->extended_addr) & 0xffffffff); |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 32 | case IEEE802154_ADDR_SHORT: |
| 33 | return (__force u32)(a->short_addr); |
| 34 | default: |
| 35 | return 0; |
| 36 | } |
| 37 | } |
| 38 | |
Alexander Aring | 4662a0d | 2015-01-04 17:10:55 +0100 | [diff] [blame^] | 39 | struct lowpan_dev_record { |
| 40 | struct net_device *ldev; |
| 41 | struct list_head list; |
| 42 | }; |
| 43 | |
| 44 | /* private device info */ |
| 45 | struct lowpan_dev_info { |
| 46 | struct net_device *real_dev; /* real WPAN device ptr */ |
| 47 | struct mutex dev_list_mtx; /* mutex for list ops */ |
| 48 | u16 fragment_tag; |
| 49 | }; |
| 50 | |
| 51 | static inline struct |
| 52 | lowpan_dev_info *lowpan_dev_info(const struct net_device *dev) |
| 53 | { |
| 54 | return netdev_priv(dev); |
| 55 | } |
| 56 | |
| 57 | extern struct list_head lowpan_devices; |
| 58 | |
Alexander Aring | 7240cde | 2014-02-28 07:32:50 +0100 | [diff] [blame] | 59 | int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type); |
| 60 | void lowpan_net_frag_exit(void); |
| 61 | int lowpan_net_frag_init(void); |
| 62 | |
Alexander Aring | 4662a0d | 2015-01-04 17:10:55 +0100 | [diff] [blame^] | 63 | void lowpan_rx_init(void); |
| 64 | void lowpan_rx_exit(void); |
| 65 | |
Alexander Aring | 8691ee5 | 2015-01-04 17:10:54 +0100 | [diff] [blame] | 66 | #endif /* __IEEE802154_6LOWPAN_I_H__ */ |