From: Alexander Aring <alex.aring@gmail.com>
To: linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de, linux-bluetooth@vger.kernel.org,
jukka.rissanen@linux.intel.com,
Alexander Aring <alex.aring@gmail.com>
Subject: [PATCH bluetooth-next 6/6] 6lowpan: remove lowpan_fetch_skb_u8
Date: Tue, 13 Oct 2015 13:42:59 +0200 [thread overview]
Message-ID: <1444736579-27826-6-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1444736579-27826-1-git-send-email-alex.aring@gmail.com>
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: Alexander Aring <alex.aring@gmail.com>
---
include/net/6lowpan.h | 27 ++++++++++++++-------------
net/6lowpan/iphc.c | 4 ++--
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index ac30ad3..4afdbb3 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -287,19 +287,20 @@ static inline void raw_dump_inline(const char *caller, char *msg,
const unsigned char *buf, int len) { }
#endif
-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 bool lowpan_fetch_skb(struct sk_buff *skb,
- void *data, const unsigned int len)
+/**
+ * lowpan_fetch_skb - getting inline data from 6LoWPAN header
+ *
+ * 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
+ * sk buffer is too small to pull the amount of data which is specified
+ * by len.
+ *
+ * @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,
+ unsigned int len)
{
if (unlikely(!pskb_may_pull(skb, len)))
return true;
diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
index 8f967d3..87d8f1f 100644
--- a/net/6lowpan/iphc.c
+++ b/net/6lowpan/iphc.c
@@ -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",
skb->data, skb->len);
- if (lowpan_fetch_skb_u8(skb, &iphc0) ||
- lowpan_fetch_skb_u8(skb, &iphc1))
+ if (lowpan_fetch_skb(skb, &iphc0, sizeof(iphc0)) ||
+ lowpan_fetch_skb(skb, &iphc1, sizeof(iphc1)))
return -EINVAL;
/* another if the CID flag is set */
--
2.6.1
next prev parent reply other threads:[~2015-10-13 11:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 11:42 [PATCH bluetooth-next 1/6] mac802154: llsec: use kzfree Alexander Aring
2015-10-13 11:42 ` [PATCH bluetooth-next 2/6] bluetooth: 6lowpan: use lowpan dispatch helpers Alexander Aring
2015-10-13 13:02 ` Jukka Rissanen
2015-10-16 12:38 ` Jukka Rissanen
2015-10-13 11:42 ` [PATCH bluetooth-next 3/6] 6lowpan: introduce LOWPAN_IPHC_MAX_HC_BUF_LEN Alexander Aring
2015-10-16 12:40 ` Jukka Rissanen
2015-10-13 11:42 ` [PATCH bluetooth-next 4/6] 6lowpan: cleanup lowpan_header_compress Alexander Aring
2015-10-16 12:41 ` Jukka Rissanen
2015-10-13 11:42 ` [PATCH bluetooth-next 5/6] 6lowpan: cleanup lowpan_header_decompress Alexander Aring
2015-10-16 12:43 ` Jukka Rissanen
2015-10-13 11:42 ` Alexander Aring [this message]
2015-10-16 12:44 ` [PATCH bluetooth-next 6/6] 6lowpan: remove lowpan_fetch_skb_u8 Jukka Rissanen
2015-10-20 8:04 ` [PATCH bluetooth-next 1/6] mac802154: llsec: use kzfree Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444736579-27826-6-git-send-email-alex.aring@gmail.com \
--to=alex.aring@gmail.com \
--cc=jukka.rissanen@linux.intel.com \
--cc=kernel@pengutronix.de \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-wpan@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).