aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-10-13 07:42:58 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-10-20 18:49:24 -0400
commit8911d7748ca360ef96cb207cc5165eb9c08669e5 (patch)
treeed912fd4c9021f1f937eece443d0be1173b9c5c1 /net/ieee802154
parenta6f773891a836abfa16fcbb8af14c29c3e109336 (diff)
6lowpan: cleanup lowpan_header_decompress
This patch changes the lowpan_header_decompress function by removing inklayer related information from parameters. This is currently for supporting short and extended address for iphc handling in 802154. We don't support short address handling anyway right now, but there exists already code for handling short addresses in lowpan_header_decompress. The address parameters are also changed to a void pointer, so 6LoWPAN linklayer specific code can put complex structures as these parameters and cast it again inside the generic code by evaluating linklayer type before. The order is also changed by destination address at first and then source address, which is the same like all others functions where destination is always the first, memcpy, dev_hard_header, lowpan_header_compress, etc. This patch also moves the fetching of iphc values from 6LoWPAN linklayer specific code into the generic branch. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/6lowpan/rx.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/net/ieee802154/6lowpan/rx.c b/net/ieee802154/6lowpan/rx.c
index 65d55e05516c..403f17126433 100644
--- a/net/ieee802154/6lowpan/rx.c
+++ b/net/ieee802154/6lowpan/rx.c
@@ -90,36 +90,12 @@ static lowpan_rx_result lowpan_rx_h_frag(struct sk_buff *skb)
90 90
91int lowpan_iphc_decompress(struct sk_buff *skb) 91int lowpan_iphc_decompress(struct sk_buff *skb)
92{ 92{
93 struct ieee802154_addr_sa sa, da;
94 struct ieee802154_hdr hdr; 93 struct ieee802154_hdr hdr;
95 u8 iphc0, iphc1;
96 void *sap, *dap;
97 94
98 if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0) 95 if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
99 return -EINVAL; 96 return -EINVAL;
100 97
101 raw_dump_table(__func__, "raw skb data dump", skb->data, skb->len); 98 return lowpan_header_decompress(skb, skb->dev, &hdr.dest, &hdr.source);
102
103 if (lowpan_fetch_skb_u8(skb, &iphc0) ||
104 lowpan_fetch_skb_u8(skb, &iphc1))
105 return -EINVAL;
106
107 ieee802154_addr_to_sa(&sa, &hdr.source);
108 ieee802154_addr_to_sa(&da, &hdr.dest);
109
110 if (sa.addr_type == IEEE802154_ADDR_SHORT)
111 sap = &sa.short_addr;
112 else
113 sap = &sa.hwaddr;
114
115 if (da.addr_type == IEEE802154_ADDR_SHORT)
116 dap = &da.short_addr;
117 else
118 dap = &da.hwaddr;
119
120 return lowpan_header_decompress(skb, skb->dev, sap, sa.addr_type,
121 IEEE802154_ADDR_LEN, dap, da.addr_type,
122 IEEE802154_ADDR_LEN, iphc0, iphc1);
123} 99}
124 100
125static lowpan_rx_result lowpan_rx_h_iphc(struct sk_buff *skb) 101static lowpan_rx_result lowpan_rx_h_iphc(struct sk_buff *skb)