All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jukka Rissanen <jukka.rissanen@linux.intel.com>
To: Alexander Aring <alex.aring@gmail.com>
Cc: linux-wpan@vger.kernel.org, kernel@pengutronix.de,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH bluetooth-next 6/6] 6lowpan: remove lowpan_fetch_skb_u8
Date: Fri, 16 Oct 2015 15:44:11 +0300	[thread overview]
Message-ID: <1444999451.3652.14.camel@linux.intel.com> (raw)
In-Reply-To: <1444736579-27826-6-git-send-email-alex.aring@gmail.com>

Hi Alex,


Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>


On ti, 2015-10-13 at 13:42 +0200, Alexander Aring wrote:
> 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 */


Cheers,
Jukka



  reply	other threads:[~2015-10-16 12:44 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 ` [PATCH bluetooth-next 6/6] 6lowpan: remove lowpan_fetch_skb_u8 Alexander Aring
2015-10-16 12:44   ` Jukka Rissanen [this message]
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=1444999451.3652.14.camel@linux.intel.com \
    --to=jukka.rissanen@linux.intel.com \
    --cc=alex.aring@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.