mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
6lowpan: Moving generic compression code into 6lowpan_iphc.c
Because the IEEE 802154 and Bluetooth share the IP header compression and uncompression code, the common code is moved to 6lowpan_iphc.c file. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Acked-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
committed by
Marcel Holtmann
parent
71fb419724
commit
8df8c56a5a
File diff suppressed because it is too large
Load Diff
@@ -232,6 +232,28 @@
|
||||
dest = 16 bit inline */
|
||||
#define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */
|
||||
|
||||
static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val)
|
||||
{
|
||||
if (unlikely(!pskb_may_pull(skb, 1)))
|
||||
return -EINVAL;
|
||||
|
||||
*val = skb->data[0];
|
||||
skb_pull(skb, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int lowpan_fetch_skb_u16(struct sk_buff *skb, u16 *val)
|
||||
{
|
||||
if (unlikely(!pskb_may_pull(skb, 2)))
|
||||
return -EINVAL;
|
||||
|
||||
*val = (skb->data[0] << 8) | skb->data[1];
|
||||
skb_pull(skb, 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool lowpan_fetch_skb(struct sk_buff *skb,
|
||||
void *data, const unsigned int len)
|
||||
{
|
||||
@@ -244,4 +266,14 @@ static inline bool lowpan_fetch_skb(struct sk_buff *skb,
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef int (*skb_delivery_cb)(struct sk_buff *skb, struct net_device *dev);
|
||||
|
||||
int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
||||
const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
|
||||
const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
|
||||
u8 iphc0, u8 iphc1, skb_delivery_cb skb_deliver);
|
||||
int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, const void *_daddr,
|
||||
const void *_saddr, unsigned int len);
|
||||
|
||||
#endif /* __6LOWPAN_H__ */
|
||||
|
||||
807
net/ieee802154/6lowpan_iphc.c
Normal file
807
net/ieee802154/6lowpan_iphc.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
obj-$(CONFIG_IEEE802154) += ieee802154.o af_802154.o
|
||||
obj-$(CONFIG_IEEE802154_6LOWPAN) += 6lowpan.o
|
||||
obj-$(CONFIG_IEEE802154_6LOWPAN) += 6lowpan.o 6lowpan_iphc.o
|
||||
|
||||
ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o wpan-class.o
|
||||
af_802154-y := af_ieee802154.o raw.o dgram.o
|
||||
|
||||
Reference in New Issue
Block a user