18691ee59SAlexander Aring #ifndef __IEEE802154_6LOWPAN_I_H__ 28691ee59SAlexander Aring #define __IEEE802154_6LOWPAN_I_H__ 38691ee59SAlexander Aring 44662a0daSAlexander Aring #include <linux/list.h> 54662a0daSAlexander Aring 64dc315e2SAlexander Aring #include <net/ieee802154_netdev.h> 78691ee59SAlexander Aring #include <net/inet_frag.h> 8b72f6f51SAlexander Aring #include <net/6lowpan.h> 98691ee59SAlexander Aring 10*72a5e6bbSAlexander Aring typedef unsigned __bitwise__ lowpan_rx_result; 11*72a5e6bbSAlexander Aring #define RX_CONTINUE ((__force lowpan_rx_result) 0u) 12*72a5e6bbSAlexander Aring #define RX_DROP_UNUSABLE ((__force lowpan_rx_result) 1u) 13*72a5e6bbSAlexander Aring #define RX_DROP ((__force lowpan_rx_result) 2u) 14*72a5e6bbSAlexander Aring #define RX_QUEUED ((__force lowpan_rx_result) 3u) 15*72a5e6bbSAlexander Aring 16*72a5e6bbSAlexander Aring #define LOWPAN_DISPATCH_FRAG1 0xc0 17*72a5e6bbSAlexander Aring #define LOWPAN_DISPATCH_FRAGN 0xe0 18*72a5e6bbSAlexander Aring 198691ee59SAlexander Aring struct lowpan_create_arg { 208691ee59SAlexander Aring u16 tag; 218691ee59SAlexander Aring u16 d_size; 228691ee59SAlexander Aring const struct ieee802154_addr *src; 238691ee59SAlexander Aring const struct ieee802154_addr *dst; 248691ee59SAlexander Aring }; 258691ee59SAlexander Aring 268691ee59SAlexander Aring /* Equivalent of ipv4 struct ip 278691ee59SAlexander Aring */ 288691ee59SAlexander Aring struct lowpan_frag_queue { 298691ee59SAlexander Aring struct inet_frag_queue q; 308691ee59SAlexander Aring 318691ee59SAlexander Aring u16 tag; 328691ee59SAlexander Aring u16 d_size; 338691ee59SAlexander Aring struct ieee802154_addr saddr; 348691ee59SAlexander Aring struct ieee802154_addr daddr; 358691ee59SAlexander Aring }; 368691ee59SAlexander Aring 378691ee59SAlexander Aring static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a) 388691ee59SAlexander Aring { 398691ee59SAlexander Aring switch (a->mode) { 408691ee59SAlexander Aring case IEEE802154_ADDR_LONG: 418691ee59SAlexander Aring return (((__force u64)a->extended_addr) >> 32) ^ 428691ee59SAlexander Aring (((__force u64)a->extended_addr) & 0xffffffff); 438691ee59SAlexander Aring case IEEE802154_ADDR_SHORT: 448691ee59SAlexander Aring return (__force u32)(a->short_addr); 458691ee59SAlexander Aring default: 468691ee59SAlexander Aring return 0; 478691ee59SAlexander Aring } 488691ee59SAlexander Aring } 498691ee59SAlexander Aring 504662a0daSAlexander Aring /* private device info */ 514662a0daSAlexander Aring struct lowpan_dev_info { 52f4606583SAlexander Aring struct net_device *wdev; /* wpan device ptr */ 534662a0daSAlexander Aring u16 fragment_tag; 544662a0daSAlexander Aring }; 554662a0daSAlexander Aring 564662a0daSAlexander Aring static inline struct 574662a0daSAlexander Aring lowpan_dev_info *lowpan_dev_info(const struct net_device *dev) 584662a0daSAlexander Aring { 59b72f6f51SAlexander Aring return (struct lowpan_dev_info *)lowpan_priv(dev)->priv; 604662a0daSAlexander Aring } 614662a0daSAlexander Aring 628691ee59SAlexander Aring int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type); 638691ee59SAlexander Aring void lowpan_net_frag_exit(void); 648691ee59SAlexander Aring int lowpan_net_frag_init(void); 658691ee59SAlexander Aring 664662a0daSAlexander Aring void lowpan_rx_init(void); 674662a0daSAlexander Aring void lowpan_rx_exit(void); 684662a0daSAlexander Aring 694dc315e2SAlexander Aring int lowpan_header_create(struct sk_buff *skb, struct net_device *dev, 704dc315e2SAlexander Aring unsigned short type, const void *_daddr, 714dc315e2SAlexander Aring const void *_saddr, unsigned int len); 724dc315e2SAlexander Aring netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev); 734dc315e2SAlexander Aring 74*72a5e6bbSAlexander Aring int lowpan_iphc_decompress(struct sk_buff *skb); 75*72a5e6bbSAlexander Aring lowpan_rx_result lowpan_rx_h_ipv6(struct sk_buff *skb); 76*72a5e6bbSAlexander Aring 778691ee59SAlexander Aring #endif /* __IEEE802154_6LOWPAN_I_H__ */ 78