ieee802154: 6lowpan: rename process_data and lowpan_process_data
As we have decouple decompression from data delivery we can now rename all occurences of process_data in receive path. Signed-off-by: Martin Townsend <mtownsend1973@gmail.com> Acked-by: Alexander Aring <alex.aring@gmail.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
3c400b843d
commit
01141234f2
4 changed files with 29 additions and 23 deletions
|
@ -372,10 +372,12 @@ lowpan_uncompress_size(const struct sk_buff *skb, u16 *dgram_offset)
|
||||||
return skb->len + uncomp_header - ret;
|
return skb->len + uncomp_header - ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
int
|
||||||
const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
|
lowpan_header_decompress(struct sk_buff *skb, struct net_device *dev,
|
||||||
const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
|
const u8 *saddr, const u8 saddr_type,
|
||||||
u8 iphc0, u8 iphc1);
|
const u8 saddr_len, const u8 *daddr,
|
||||||
|
const u8 daddr_type, const u8 daddr_len,
|
||||||
|
u8 iphc0, u8 iphc1);
|
||||||
int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
|
int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
|
||||||
unsigned short type, const void *_daddr,
|
unsigned short type, const void *_daddr,
|
||||||
const void *_saddr, unsigned int len);
|
const void *_saddr, unsigned int len);
|
||||||
|
|
|
@ -301,10 +301,12 @@ err:
|
||||||
/* TTL uncompression values */
|
/* TTL uncompression values */
|
||||||
static const u8 lowpan_ttl_values[] = { 0, 1, 64, 255 };
|
static const u8 lowpan_ttl_values[] = { 0, 1, 64, 255 };
|
||||||
|
|
||||||
int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
int
|
||||||
const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
|
lowpan_header_decompress(struct sk_buff *skb, struct net_device *dev,
|
||||||
const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
|
const u8 *saddr, const u8 saddr_type,
|
||||||
u8 iphc0, u8 iphc1)
|
const u8 saddr_len, const u8 *daddr,
|
||||||
|
const u8 daddr_type, const u8 daddr_len,
|
||||||
|
u8 iphc0, u8 iphc1)
|
||||||
{
|
{
|
||||||
struct ipv6hdr hdr = {};
|
struct ipv6hdr hdr = {};
|
||||||
u8 tmp, num_context = 0;
|
u8 tmp, num_context = 0;
|
||||||
|
@ -480,7 +482,7 @@ drop:
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(lowpan_process_data);
|
EXPORT_SYMBOL_GPL(lowpan_header_decompress);
|
||||||
|
|
||||||
static u8 lowpan_compress_addr_64(u8 **hc_ptr, u8 shift,
|
static u8 lowpan_compress_addr_64(u8 **hc_ptr, u8 shift,
|
||||||
const struct in6_addr *ipaddr,
|
const struct in6_addr *ipaddr,
|
||||||
|
|
|
@ -257,8 +257,8 @@ static int give_skb_to_upper(struct sk_buff *skb, struct net_device *dev)
|
||||||
return netif_rx(skb_cp);
|
return netif_rx(skb_cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_data(struct sk_buff *skb, struct net_device *netdev,
|
static int iphc_decompress(struct sk_buff *skb, struct net_device *netdev,
|
||||||
struct l2cap_chan *chan)
|
struct l2cap_chan *chan)
|
||||||
{
|
{
|
||||||
const u8 *saddr, *daddr;
|
const u8 *saddr, *daddr;
|
||||||
u8 iphc0, iphc1;
|
u8 iphc0, iphc1;
|
||||||
|
@ -287,10 +287,11 @@ static int process_data(struct sk_buff *skb, struct net_device *netdev,
|
||||||
if (lowpan_fetch_skb_u8(skb, &iphc1))
|
if (lowpan_fetch_skb_u8(skb, &iphc1))
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
return lowpan_process_data(skb, netdev,
|
return lowpan_header_decompress(skb, netdev,
|
||||||
saddr, IEEE802154_ADDR_LONG, EUI64_ADDR_LEN,
|
saddr, IEEE802154_ADDR_LONG,
|
||||||
daddr, IEEE802154_ADDR_LONG, EUI64_ADDR_LEN,
|
EUI64_ADDR_LEN, daddr,
|
||||||
iphc0, iphc1);
|
IEEE802154_ADDR_LONG, EUI64_ADDR_LEN,
|
||||||
|
iphc0, iphc1);
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
@ -346,7 +347,7 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
|
||||||
if (!local_skb)
|
if (!local_skb)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
ret = process_data(local_skb, dev, chan);
|
ret = iphc_decompress(local_skb, dev, chan);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,8 @@ static int lowpan_give_skb_to_devices(struct sk_buff *skb,
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_data(struct sk_buff *skb, const struct ieee802154_hdr *hdr)
|
static int
|
||||||
|
iphc_decompress(struct sk_buff *skb, const struct ieee802154_hdr *hdr)
|
||||||
{
|
{
|
||||||
u8 iphc0, iphc1;
|
u8 iphc0, iphc1;
|
||||||
struct ieee802154_addr_sa sa, da;
|
struct ieee802154_addr_sa sa, da;
|
||||||
|
@ -196,9 +197,9 @@ static int process_data(struct sk_buff *skb, const struct ieee802154_hdr *hdr)
|
||||||
else
|
else
|
||||||
dap = &da.hwaddr;
|
dap = &da.hwaddr;
|
||||||
|
|
||||||
return lowpan_process_data(skb, skb->dev, sap, sa.addr_type,
|
return lowpan_header_decompress(skb, skb->dev, sap, sa.addr_type,
|
||||||
IEEE802154_ADDR_LEN, dap, da.addr_type,
|
IEEE802154_ADDR_LEN, dap, da.addr_type,
|
||||||
IEEE802154_ADDR_LEN, iphc0, iphc1);
|
IEEE802154_ADDR_LEN, iphc0, iphc1);
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
@ -541,7 +542,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
} else {
|
} else {
|
||||||
switch (skb->data[0] & 0xe0) {
|
switch (skb->data[0] & 0xe0) {
|
||||||
case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */
|
case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */
|
||||||
ret = process_data(skb, &hdr);
|
ret = iphc_decompress(skb, &hdr);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
|
@ -549,7 +550,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
case LOWPAN_DISPATCH_FRAG1: /* first fragment header */
|
case LOWPAN_DISPATCH_FRAG1: /* first fragment header */
|
||||||
ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAG1);
|
ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAG1);
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
ret = process_data(skb, &hdr);
|
ret = iphc_decompress(skb, &hdr);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
|
@ -562,7 +563,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
case LOWPAN_DISPATCH_FRAGN: /* next fragments headers */
|
case LOWPAN_DISPATCH_FRAGN: /* next fragments headers */
|
||||||
ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAGN);
|
ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAGN);
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
ret = process_data(skb, &hdr);
|
ret = iphc_decompress(skb, &hdr);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue