Commit 478208e3 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

6lowpan: remove lowpan_fetch_skb_u8

This patch removes the lowpan_fetch_skb_u8 function for getting the iphc
bytes. Instead we using the generic which has a len parameter to tell
the amount of bytes to fetch.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Acked-by: default avatarJukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 8911d774
...@@ -287,19 +287,20 @@ static inline void raw_dump_inline(const char *caller, char *msg, ...@@ -287,19 +287,20 @@ static inline void raw_dump_inline(const char *caller, char *msg,
const unsigned char *buf, int len) { } const unsigned char *buf, int len) { }
#endif #endif
static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val) /**
{ * lowpan_fetch_skb - getting inline data from 6LoWPAN header
if (unlikely(!pskb_may_pull(skb, 1))) *
return -EINVAL; * This function will pull data from sk buffer and put it into data to
* remove the 6LoWPAN inline data. This function returns true if the
*val = skb->data[0]; * sk buffer is too small to pull the amount of data which is specified
skb_pull(skb, 1); * by len.
*
return 0; * @skb: the buffer where the inline data should be pulled from.
} * @data: destination buffer for the inline data.
* @len: amount of data which should be pulled in bytes.
static inline bool lowpan_fetch_skb(struct sk_buff *skb, */
void *data, const unsigned int len) static inline bool lowpan_fetch_skb(struct sk_buff *skb, void *data,
unsigned int len)
{ {
if (unlikely(!pskb_may_pull(skb, len))) if (unlikely(!pskb_may_pull(skb, len)))
return true; return true;
......
...@@ -265,8 +265,8 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev, ...@@ -265,8 +265,8 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
raw_dump_table(__func__, "raw skb data dump uncompressed", raw_dump_table(__func__, "raw skb data dump uncompressed",
skb->data, skb->len); skb->data, skb->len);
if (lowpan_fetch_skb_u8(skb, &iphc0) || if (lowpan_fetch_skb(skb, &iphc0, sizeof(iphc0)) ||
lowpan_fetch_skb_u8(skb, &iphc1)) lowpan_fetch_skb(skb, &iphc1, sizeof(iphc1)))
return -EINVAL; return -EINVAL;
/* another if the CID flag is set */ /* another if the CID flag is set */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment