Re: [Linux-zigbee-devel] [PATCH 03/12] 6lowpan: init 6lowpan header and ipv6hdr to zero

2013-07-24 Thread Werner Almesberger
Alexander Aring wrote: > u8 head[100] = {}; What I mean is: I don't see the original code doing a memset on "head", so I'm a bit puzzled why you have to do this now. Was the original code broken by not zeroing "head" ? If yes, that would be a bug fix, not a mere optimization. Or did I overlook s

Re: [Linux-zigbee-devel] [PATCH 03/12] 6lowpan: init 6lowpan header and ipv6hdr to zero

2013-07-24 Thread Alexander Aring
Hi Werner, 2013/7/24 Werner Almesberger > Alexander Aring wrote: > > u8 head[100] = {}; > > What I mean is: I don't see the original code doing a memset on > "head", so I'm a bit puzzled why you have to do this now. > > Was the original code broken by not zeroing "head" ? If yes, > that would b

[Linux-zigbee-devel] [PATCH 13/14] 6lowpan: add comment for unspec address

2013-07-24 Thread Alexander Aring
Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 8454b22..5de520b 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c @@ -565,9 +565,10 @@ st

[Linux-zigbee-devel] [PATCH 06/14] 6lowpan: Fix fragmentation with link-local compressed addresses

2013-07-24 Thread Alexander Aring
From: David Hauweele When a new 6lowpan fragment is received, a skbuff is allocated for the reassembled packet. However when a 6lowpan packet compresses link-local addresses based on link-layer addresses, the processing function relies on the skb mac control block to find the related link-layer a

[Linux-zigbee-devel] [PATCH 08/14] 6lowpan: add function to uncompress multicast addr

2013-07-24 Thread Alexander Aring
Add function to uncompress multicast address. This function split the uncompress function for a multicast address in a seperate function. To uncompress a multicast address is different than a other non-multicasts addresses according to rfc6282. Signed-off-by: Alexander Aring --- net/ieee802154/

[Linux-zigbee-devel] [PATCH 05/14] 6lowpan: remove setting some memory regions to zero

2013-07-24 Thread Alexander Aring
While we can assume that the memory is already be zero, we can drop some memsets while parsing. Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index d231bef..286d7e9 10

[Linux-zigbee-devel] [PATCH 01/14] 6lowpan: fix small comment issue

2013-07-24 Thread Alexander Aring
Fix a little comment issue. Number 2 is 10 in bits and 1 is 01. Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 55e1fd5..1ec14ef 100644 --- a/net/ieee8021

[Linux-zigbee-devel] [PATCH 07/14] 6lowpan: use _saddr and _daddr instead of skb data

2013-07-24 Thread Alexander Aring
Pointers _saddr and _daddr points to source and destination address. Use this for a link-layer compression to get these addresses. Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ieee802154/6lowpan.c b/net/ie

[Linux-zigbee-devel] [PATCHv6 00/14] minor fixes

2013-07-24 Thread Alexander Aring
Next part of this patch series to fix uncompression of some addresses. This patch doesn't fix the payload_length and parsing of traffic class. v6: - Add patch "6lowpan: fix magic number" - Add patch "6lowpan: handle only real local link addresses" - remove useless zero setting to head buffer in

[Linux-zigbee-devel] [PATCH 10/14] 6lowpan: lowpan_uncompress_addr with address_mode

2013-07-24 Thread Alexander Aring
This patch drop the pre and postcount calculation from the lowpan_uncompress_addr function. We use instead a switch case over address_mode value, it's easier to understand what's going on there. Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 151 +-

[Linux-zigbee-devel] [PATCH 14/14] 6lowpan: handle context based source address

2013-07-24 Thread Alexander Aring
Handle context based address when a unspecific address is specified. For other context based address we print a warning and drop the package currently because we don't support it right now. Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 54 +

[Linux-zigbee-devel] [PATCH 02/14] 6lowpan: fix magic number

2013-07-24 Thread Alexander Aring
Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 1ec14ef..90b9b90 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c @@ -589,7 +589,7 @@ stati

[Linux-zigbee-devel] [PATCH 03/14] 6lowpan: fix return value with comment operator

2013-07-24 Thread Alexander Aring
Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 90b9b90..2399c8f 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c @@ -819,7 +819,8 @@ low

[Linux-zigbee-devel] [PATCH 04/14] 6lowpan: init 6lowpan header and ipv6hdr to zero

2013-07-24 Thread Alexander Aring
When we set it to zero, we can assume that the memory is already zero while parsing. Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 2399c8f..d231bef 100644 -

[Linux-zigbee-devel] [PATCH 12/14] 6lowpan: add warning for DAC bit

2013-07-24 Thread Alexander Aring
We don't handle the DAC bit currently, so I add a warning and drop the package. Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index d26

[Linux-zigbee-devel] [PATCH 09/14] 6lowpan: handle only real local link addresses

2013-07-24 Thread Alexander Aring
Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h index 4b8f917..a4a307b 100644 --- a/net/ieee802154/6lowpan.h +++ b/net/ieee802154/6lowpan.h @@ -83,8 +83,11 @@

[Linux-zigbee-devel] [PATCH 11/14] 6lowpan: add warning for CID bit

2013-07-24 Thread Alexander Aring
We don't handle the CID bit currently, so I add a warning and drop the package. Signed-off-by: Alexander Aring --- net/ieee802154/6lowpan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index c711441..d26d22b 100644

Re: [Linux-zigbee-devel] [PATCH 02/14] 6lowpan: fix magic number

2013-07-24 Thread Werner Almesberger
Alexander Aring wrote: > - memcpy(&(sa.hwaddr), saddr, 8); > + memcpy(&(sa.hwaddr), saddr, IEEE802154_ADDR_LEN); Nice. While we're at it, we don't need parentheses around sa.hwaddr. - Werner -- Se

Re: [Linux-zigbee-devel] [PATCH 05/14] 6lowpan: remove setting some memory regions to zero

2013-07-24 Thread Werner Almesberger
Alexander Aring wrote: > hdr.priority = ((tmp >> 2) & 0x0f); > hdr.flow_lbl[0] = ((tmp << 6) & 0xC0) | ((tmp >> 2) & 0x30); Some more opportinities to kill unnecessary parentheses :-) (Just the outermost ones. The rest is fine.) - Werner --

Re: [Linux-zigbee-devel] [PATCH 02/14] 6lowpan: fix magic number

2013-07-24 Thread Alexander Aring
Hi Werner, On Wed, Jul 24, 2013 at 10:17:51AM -0300, Werner Almesberger wrote: > Alexander Aring wrote: > > - memcpy(&(sa.hwaddr), saddr, 8); > > + memcpy(&(sa.hwaddr), saddr, IEEE802154_ADDR_LEN); > > Nice. While we're at it, we don't need parentheses around sa.hwaddr. > Tha

Re: [Linux-zigbee-devel] [PATCH 09/14] 6lowpan: handle only real local link addresses

2013-07-24 Thread Werner Almesberger
Alexander Aring wrote: > +#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80) && > \ > + (((a)->s6_addr16[1]) == 0) && \ > + (((a)->s6_addr16[2]) == 0) && \ > + (((a)->s6_addr16[3]) == 0)) More parenthesis paranoia: the (a) is good and

Re: [Linux-zigbee-devel] [PATCH 05/14] 6lowpan: remove setting some memory regions to zero

2013-07-24 Thread Alexander Aring
Hi Werner, On Wed, Jul 24, 2013 at 10:20:05AM -0300, Werner Almesberger wrote: > Alexander Aring wrote: > > hdr.priority = ((tmp >> 2) & 0x0f); > > hdr.flow_lbl[0] = ((tmp << 6) & 0xC0) | ((tmp >> 2) & 0x30); > > Some more opportinities to kill unnecessary parentheses :-)

Re: [Linux-zigbee-devel] [PATCH 09/14] 6lowpan: handle only real local link addresses

2013-07-24 Thread Alexander Aring
Hi Werner, On Wed, Jul 24, 2013 at 10:25:03AM -0300, Werner Almesberger wrote: > Alexander Aring wrote: > > +#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80) && > > \ > > + (((a)->s6_addr16[1]) == 0) && \ > > + (((a)->s6_addr16[2]) == 0) && \ > > +

Re: [Linux-zigbee-devel] [PATCH 05/14] 6lowpan: remove setting some memory regions to zero

2013-07-24 Thread Werner Almesberger
Alexander Aring wrote: > Ok I will do this, but I know the traffic class has some other issues > inside... should I try to fix this, too? While you're at it ... why not ? :) This is basically the long overdue major rewrite of all the compression stuff, so fixing the traffic class would seem to fi

Re: [Linux-zigbee-devel] [PATCH 09/14] 6lowpan: handle only real local link addresses

2013-07-24 Thread Werner Almesberger
Alexander Aring wrote: > So should I change it only for this or for all macros? Since the pascalism is so widespread I usually point it out when I see it but don't try to strip it from other people's code. I would get rid of the other unnecessary parentheses, though. They just make the code harde

Re: [Linux-zigbee-devel] [PATCH 09/14] 6lowpan: handle only real local link addresses

2013-07-24 Thread Alexander Aring
Hi Werner, On Wed, Jul 24, 2013 at 10:44:26AM -0300, Werner Almesberger wrote: > Alexander Aring wrote: > > So should I change it only for this or for all macros? > > Since the pascalism is so widespread I usually point it out when I > see it but don't try to strip it from other people's code. >