All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	linux-wpan@vger.kernel.org, kernel@pengutronix.de,
	Jukka Rissanen <jukka.rissanen@linux.intel.com>,
	Martin Townsend <mtownsend1973@gmail.com>
Subject: Re: [PATCH bluetooth-next 1/2] 6lowpan: add generic nhc layer interface
Date: Sat, 29 Nov 2014 16:03:34 +0100	[thread overview]
Message-ID: <20141129150331.GA9625@omega> (raw)
In-Reply-To: <FB346BA3-CBC9-42DC-8D49-220A6B8A9371@holtmann.org>

Hi Marcel,

On Sat, Nov 29, 2014 at 03:47:57PM +0100, Marcel Holtmann wrote:
> Hi Alex,
> 
> > This patch adds a generic next header compression layer interface. There
> > exists various methods to do a header compression after 6LoWPAN header
> > to save payload. This introduce a generic nhc header which allow a
> > simple adding of a new header compression format instead of a static
> > implementation inside the 6LoWPAN header compression and uncompression
> > function.
> > 
> > Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > Cc: Jukka Rissanen <jukka.rissanen@linux.intel.com>
> > Cc: Martin Townsend <mtownsend1973@gmail.com>
> > ---
> > net/6lowpan/Makefile |   4 +-
> > net/6lowpan/nhc.c    | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > net/6lowpan/nhc.h    | 128 ++++++++++++++++++++++++++++++++++++
> > 3 files changed, 313 insertions(+), 1 deletion(-)
> > create mode 100644 net/6lowpan/nhc.c
> > create mode 100644 net/6lowpan/nhc.h
> > 
> > diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
> > index 415886b..ba6bf47 100644
> > --- a/net/6lowpan/Makefile
> > +++ b/net/6lowpan/Makefile
> > @@ -1,3 +1,5 @@
> > obj-$(CONFIG_6LOWPAN) := 6lowpan.o
> > 

...

> > +
> > +/**
> > + * LOWPAN_NHC - helper macro to generate nh id fields and lowpan_nhc struct
> > + *
> > + * @__nhc: variable name of the lowpan_nhc struct.
> > + * @_name: const char * of common header compression name.
> > + * @_nexthdr: ipv6 nexthdr field for the header compression.
> > + * @_nexthdrlen: ipv6 nexthdr len for the reserved space.
> > + * @_idsetup: callback to setup id and mask values.
> > + * @_idlen: len for the next header id and mask, should be always the same.
> > + * @_uncompress: callback for uncompression call.
> > + * @_compress: callback for compression call.
> > + */
> > +#define LOWPAN_NHC(__nhc, _name, _nexthdr,	\
> > +		   _nexthdrlen, _idsetup,	\
> > +		   _idlen, _uncompress,		\
> > +		   _compress)			\
> > +	static u8 __nhc##_val[_idlen];		\
> > +	static u8 __nhc##_mask[_idlen];		\
> > +	static struct lowpan_nhc __nhc = {	\
> 
> any reason why these are not declared as static const?
> 

no this should also not changeable at runtime, I will change it to
const. Thanks.

> > +		.name		= _name,	\
> > +		.nexthdr	= _nexthdr,	\
> > +		.nexthdrlen	= _nexthdrlen,	\
> > +		.id		= __nhc##_val,	\
> > +		.idmask		= __nhc##_mask,	\
> > +		.idlen		= _idlen,	\
> > +		.idsetup	= _idsetup,	\
> > +		.uncompress	= _uncompress,	\
> > +		.compress	= _compress,	\
> > +	}
> 
> I also wonder if we should mix lowpan_nhc_add and lowpan_nhc_del handling into this macro as well. If the next header compression would be auto-loadable modules, then creating a module_lowpan_nhc() macro similar to module_usb_driver() etc. would help. We could in theory use module aliases to auto-load compression modules once needed. However it might be a bit too much overhead.
> 

yes, I will change it in v2. This is a great idea. Thanks.

- Alex

  reply	other threads:[~2014-11-29 15:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 14:24 [PATCH bluetooth-next 0/2] 6lowpan: introduce nhc framework Alexander Aring
2014-11-29 14:24 ` [PATCH bluetooth-next 1/2] 6lowpan: add generic nhc layer interface Alexander Aring
2014-11-29 14:47   ` Marcel Holtmann
2014-11-29 15:03     ` Alexander Aring [this message]
2014-11-29 14:24 ` [PATCH bluetooth-next 2/2] 6lowpan: add udp compression via nhc layer 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=20141129150331.GA9625@omega \
    --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 \
    --cc=marcel@holtmann.org \
    --cc=mtownsend1973@gmail.com \
    /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.