From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Cc: Alexander Aring <alex.aring@gmail.com>,
dbaryshkov@gmail.com, davem@davemloft.net,
linux-zigbee-devel@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 3/6] 6lowpan: introduce lowpan_fetch_skb function
Date: Wed, 14 Aug 2013 14:06:34 +0200 [thread overview]
Message-ID: <20130814120634.GD2010@order.stressinduktion.org> (raw)
In-Reply-To: <520B7029.3070903@gmail.com>
On Wed, Aug 14, 2013 at 03:55:21PM +0400, Alexander Smirnov wrote:
> On 08/14/2013 03:49 PM, Hannes Frederic Sowa wrote:
> >On Wed, Aug 14, 2013 at 01:01:45PM +0200, Alexander Aring wrote:
> >>This patch adds a helper function to parse the ipv6 header to a
> >>6lowpan header in stream.
> >>
> >>This function checks first if we can pull data with a specific
> >>length from a skb. If this seems to be okay, we copy skb data to
> >>a destination pointer and run skb_pull.
> >>
> >>Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> >>Reviewed-by: Werner Almesberger <werner@almesberger.net>
> >>---
> >> net/ieee802154/6lowpan.h | 12 ++++++++++++
> >> 1 file changed, 12 insertions(+)
> >>
> >>diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h
> >>index 61f0ce9..e3348ec 100644
> >>--- a/net/ieee802154/6lowpan.h
> >>+++ b/net/ieee802154/6lowpan.h
> >>@@ -233,4 +233,16 @@
> >> dest = 16 bit inline */
> >> #define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit
> >> inline */
> >>
> >>+static inline bool lowpan_fetch_skb(struct sk_buff *skb,
> >>+ void *data, const unsigned int len)
> >>+{
> >>+ if (unlikely(!pskb_may_pull(skb, len)))
> >>+ return true;
> >>+
> >>+ skb_copy_from_linear_data(skb, data, len);
> >>+ skb_pull(skb, len);
> >>+
> >>+ return false;
> >>+}
> >
> >Isn't the return value inverted here?
>
> Nope, everything is right here, but I spent several minutes to get it...
> Probably using of standard intergers will be better here: return -EINVAL
> and return 0;
Ah, yes, I saw it in your next patch. You could also use false for failure and
true for success. Either way, this seemd a bit unnatural for me.
Thanks,
Hannes
next prev parent reply other threads:[~2013-08-14 12:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 11:01 [PATCHv2 net-next 0/6] 6lowpan: uncompress of addresses fix Alexander Aring
[not found] ` <1376478108-3539-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-14 11:01 ` [PATCH 1/6] 6lowpan: init ipv6hdr buffer to zero Alexander Aring
[not found] ` <1376478108-3539-2-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-14 11:06 ` Alexander Aring
2013-08-14 11:01 ` [PATCH net-next 2/6] 6lowpan: Fix fragmentation with link-local compressed addresses Alexander Aring
2013-08-14 11:01 ` [PATCH net-next 3/6] 6lowpan: introduce lowpan_fetch_skb function Alexander Aring
2013-08-14 11:49 ` Hannes Frederic Sowa
2013-08-14 11:55 ` Alexander Smirnov
2013-08-14 12:06 ` Hannes Frederic Sowa [this message]
2013-08-14 12:45 ` Alexander Aring
2013-08-14 12:47 ` Hannes Frederic Sowa
2013-08-14 12:54 ` Alexander Aring
2013-08-14 11:01 ` [PATCH net-next 4/6] 6lowpan: add function to uncompress multicast addr Alexander Aring
2013-08-14 11:01 ` [PATCH net-next 5/6] 6lowpan: lowpan_uncompress_addr with address_mode Alexander Aring
2013-08-14 11:01 ` [PATCH net-next 6/6] 6lowpan: handle context based source address Alexander Aring
2013-08-14 11:23 ` [PATCHv2 net-next 0/6] 6lowpan: uncompress of addresses fix Alexander Smirnov
2013-08-14 12:41 ` Alexander Aring
-- strict thread matches above, loose matches on Subject: below --
2013-08-16 19:59 [PATCHv3 net-next 0/6] 6lowpan: address uncompression fixes Alexander Aring
[not found] ` <1376683199-10370-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-16 19:59 ` [PATCH net-next 3/6] 6lowpan: introduce lowpan_fetch_skb function Alexander Aring
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=20130814120634.GD2010@order.stressinduktion.org \
--to=hannes@stressinduktion.org \
--cc=alex.aring@gmail.com \
--cc=alex.bluesman.smirnov@gmail.com \
--cc=davem@davemloft.net \
--cc=dbaryshkov@gmail.com \
--cc=linux-zigbee-devel@lists.sourceforge.net \
--cc=netdev@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.