From: Stefan Schmidt <stefan@osg.samsung.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
Alexander Aring <alex.aring@gmail.com>,
linux-wpan@vger.kernel.org
Cc: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org,
kernel@pengutronix.de, mcr@sandelman.ca,
lukasz.duda@nordicsemi.no, martin.gergeleit@hs-rm.de,
"David S . Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>
Subject: Re: [RFCv2 bluetooth-next 2/3] ipv6: add ipv6_addr_prefix_cpy
Date: Wed, 25 Nov 2015 17:42:43 +0100 [thread overview]
Message-ID: <5655E503.8060107@osg.samsung.com> (raw)
In-Reply-To: <564C8336.7000100@cogentembedded.com>
Hello.
On 18/11/15 14:55, Sergei Shtylyov wrote:
> Hello.
>
> On 11/18/2015 1:33 AM, Alexander Aring wrote:
>
>> This patch adds a static inline function ipv6_addr_prefix_cpy which
>
> I suggest not to reduce "copy".
Agreed. Not worth saving one character here.
>
>> copies a ipv6 address prefix(argument pfx) into the ipv6 address prefix.
>> The prefix len is given by plen as bits. This function mainly based on
>> ipv6_addr_prefix which copies one address prefix from address into a new
>> ipv6 address destination and zero all other address bits.
>>
>> The difference is that ipv6_addr_prefix_cpy don't get a prefix from an
>> ipv6 address, it sets a prefix to an ipv6 address with keeping other
>> address bits. The use case is for context based address compression
>> inside 6LoWPAN IPHC header which keeping ipv6 prefixes inside a context
>> table to lookup address-bits without sending them.
>>
>> Cc: David S. Miller <davem@davemloft.net>
>> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
>> Cc: James Morris <jmorris@namei.org>
>> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
>> Cc: Patrick McHardy <kaber@trash.net>
>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>> ---
>> include/net/ipv6.h | 15 +++++++++++++++
>> 1 file changed, 15 insertions(+)
>>
>> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
>> index e1a10b0..9d38fc2 100644
>> --- a/include/net/ipv6.h
>> +++ b/include/net/ipv6.h
>> @@ -382,6 +382,21 @@ static inline void ipv6_addr_prefix(struct
>> in6_addr *pfx,
>> pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b);
>> }
>>
>> +static inline void ipv6_addr_prefix_cpy(struct in6_addr *addr,
>> + const struct in6_addr *pfx,
>> + int plen)
>> +{
>> + /* caller must guarantee 0 <= plen <= 128 */
>> + int o = plen >> 3,
>> + b = plen & 0x7;
>
> Unusual declaration style, why not just have *int* on both lines?
>
He took that from ipv6_addr_prefix() defined above it. I would also
prefer a second line with int for the second declaration. But as he
followed the coding style already around I think both way are fine.
regards
Stefan Schmidt
next prev parent reply other threads:[~2015-11-25 16:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-17 22:33 [RFCv2 bluetooth-next 0/3] 6lowpan: debugfs and stateful compression support Alexander Aring
2015-11-17 22:33 ` [RFCv2 bluetooth-next 1/3] 6lowpan: add debugfs support Alexander Aring
2015-11-25 16:42 ` Stefan Schmidt
2015-11-25 18:00 ` Alexander Aring
2015-11-26 11:07 ` Stefan Schmidt
2015-11-17 22:33 ` [RFCv2 bluetooth-next 2/3] ipv6: add ipv6_addr_prefix_cpy Alexander Aring
2015-11-17 22:33 ` Alexander Aring
2015-11-18 13:55 ` Sergei Shtylyov
2015-11-18 13:55 ` Sergei Shtylyov
2015-11-25 16:42 ` Stefan Schmidt [this message]
2015-11-25 16:42 ` Stefan Schmidt
2015-11-25 16:42 ` Stefan Schmidt
2015-11-25 18:17 ` Alexander Aring
2015-11-25 18:17 ` Alexander Aring
2015-11-26 11:11 ` Stefan Schmidt
2015-11-26 11:11 ` Stefan Schmidt
2015-11-17 22:33 ` [RFCv2 bluetooth-next 3/3] 6lowpan: iphc: add support for stateful compression Alexander Aring
2015-11-25 17:12 ` Stefan Schmidt
2015-11-25 17:12 ` Stefan Schmidt
2015-11-25 18:07 ` Alexander Aring
2015-11-25 18:07 ` Alexander Aring
2015-11-26 11:19 ` Stefan Schmidt
2015-11-26 11:19 ` Stefan Schmidt
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=5655E503.8060107@osg.samsung.com \
--to=stefan@osg.samsung.com \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kernel@pengutronix.de \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-wpan@vger.kernel.org \
--cc=lukasz.duda@nordicsemi.no \
--cc=martin.gergeleit@hs-rm.de \
--cc=mcr@sandelman.ca \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=yoshfuji@linux-ipv6.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.