]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - net/ieee802154/6lowpan/6lowpan_i.h
Linux 4.14-rc6
[mirror_ubuntu-bionic-kernel.git] / net / ieee802154 / 6lowpan / 6lowpan_i.h
CommitLineData
8691ee59
AA
1#ifndef __IEEE802154_6LOWPAN_I_H__
2#define __IEEE802154_6LOWPAN_I_H__
7240cdec 3
4662a0da
AA
4#include <linux/list.h>
5
4dc315e2 6#include <net/ieee802154_netdev.h>
7240cdec 7#include <net/inet_frag.h>
b72f6f51 8#include <net/6lowpan.h>
7240cdec 9
9efeccac 10typedef unsigned __bitwise lowpan_rx_result;
72a5e6bb
AA
11#define RX_CONTINUE ((__force lowpan_rx_result) 0u)
12#define RX_DROP_UNUSABLE ((__force lowpan_rx_result) 1u)
13#define RX_DROP ((__force lowpan_rx_result) 2u)
14#define RX_QUEUED ((__force lowpan_rx_result) 3u)
15
16#define LOWPAN_DISPATCH_FRAG1 0xc0
17#define LOWPAN_DISPATCH_FRAGN 0xe0
18
7240cdec 19struct lowpan_create_arg {
f870b8c6 20 u16 tag;
7240cdec 21 u16 d_size;
ae531b94
PB
22 const struct ieee802154_addr *src;
23 const struct ieee802154_addr *dst;
7240cdec
AA
24};
25
26/* Equivalent of ipv4 struct ip
27 */
28struct lowpan_frag_queue {
29 struct inet_frag_queue q;
30
f870b8c6 31 u16 tag;
7240cdec 32 u16 d_size;
ae531b94
PB
33 struct ieee802154_addr saddr;
34 struct ieee802154_addr daddr;
7240cdec
AA
35};
36
ae531b94 37static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a)
7240cdec 38{
ae531b94 39 switch (a->mode) {
7240cdec 40 case IEEE802154_ADDR_LONG:
ae531b94
PB
41 return (((__force u64)a->extended_addr) >> 32) ^
42 (((__force u64)a->extended_addr) & 0xffffffff);
7240cdec 43 case IEEE802154_ADDR_SHORT:
5a7f97e5 44 return (__force u32)(a->short_addr + (a->pan_id << 16));
7240cdec
AA
45 default:
46 return 0;
47 }
48}
49
7240cdec
AA
50int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type);
51void lowpan_net_frag_exit(void);
52int lowpan_net_frag_init(void);
53
4662a0da
AA
54void lowpan_rx_init(void);
55void lowpan_rx_exit(void);
56
4dc315e2
AA
57int lowpan_header_create(struct sk_buff *skb, struct net_device *dev,
58 unsigned short type, const void *_daddr,
59 const void *_saddr, unsigned int len);
60netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev);
61
72a5e6bb
AA
62int lowpan_iphc_decompress(struct sk_buff *skb);
63lowpan_rx_result lowpan_rx_h_ipv6(struct sk_buff *skb);
64
8691ee59 65#endif /* __IEEE802154_6LOWPAN_I_H__ */