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