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