linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Lukasz Duda <lukasz.duda@nordicsemi.no>
Cc: linux-wpan@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	Glenn Ruben Bakke <glenn.ruben.bakke@nordicsemi.no>
Subject: Re: [RFC v2 2/4] 6lowpan: Add stateful compression component of 6lowpan module
Date: Thu, 23 Jul 2015 08:59:41 +0200	[thread overview]
Message-ID: <20150723065940.GC1941@omega> (raw)
In-Reply-To: <20150723065209.GB1941@omega>

On Thu, Jul 23, 2015 at 08:52:09AM +0200, Alexander Aring wrote:
> 
> I know why you need such functionality. This is okay for now. But I
> already thought about a nicer handling for that (which is also useful
> for other mechanism). The idea is:
> 
> The netdev structure has some private pointer "netdev->priv". Currently
> bluetooth 6lowpan/802.15.4 6lowpan do their own stuff inside this struct
> which is okay. But we should provide some "upper class" struct for all
> ARPHRD_6LOWPAN, which looks like:
> 
> -----------------------------
> |   6LOWPAN_ARPHRD_STRUCT   | <-- All ARPHRD_6LOWPAN have this struct as first
> -----------------------------
> |        PRIVATE_DATA       | <-- 802.15.4/btle own stuff (private struct of subsystem) simple a
> |                           |     "u8 priv __aligned(sizeof(void *));" inside ARPHRD_6LOWPAN which need to be at last
> -----------------------------
> 
> Then you can put the net_table into the "6LOWPAN_ARPHRD_STRUCT" and cast
> the "netdev->priv" pointer to "6LOWPAN_ARPHRD_STRUCT".
> 
> We really need such thing to avoid the above search&found functionality.
> We should introduce such behaviour at first, then you can rebase your
> stuff on it.
> 
> Also we need some functionality lowpan_alloc_netdev which ensure the
> priv size is "sizeof(6LOWPAN_ARPHRD_STRUCT) + sizeof(PRIVATE_DATA)".
> 
> In upper layers like IPv6 you can do the following then:
> 
> if (dev->type == ARPHRD_6LOWPAN) {
> 	6LOWPAN_ARPHRD_STRUCT foobar = (struct 6LOWPAN_ARPHRD_STRUCT *)dev->priv;
> 
> 	...do great cid handling here...
> }
> 
> I hope this will also help you by implementing 6CO.
> 
> btw: (struct 6LOWPAN_ARPHRD_STRUCT *) should be implemented by a macro.
> 
> 
> So please begin at first to add such functionality, please. Is that okay
> for you?
> 

This is actually the same idea like introducing the lowpan_ptr inside
the netdev structure, just a little different. I am fine also for
introducing the lowpan_ptr when netdev acked such patch. Anyway we need
some core lowpan functionality to allocate/free the memory then. Or we
just point the lowpan_ptr to the right netdev private memory area, then
we don't need to cast every time.

- Alex

  reply	other threads:[~2015-07-23  6:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 11:50 [RFC v2 0/4] Adding stateful compression to IPHC Lukasz Duda
2015-07-13 11:50 ` [RFC v2 1/4] 6lowpan: Introduce debugfs entry for 6lowpan module Lukasz Duda
2015-07-23  6:07   ` Alexander Aring
2015-07-13 11:50 ` [RFC v2 2/4] 6lowpan: Add stateful compression component of " Lukasz Duda
2015-07-23  6:52   ` Alexander Aring
2015-07-23  6:59     ` Alexander Aring [this message]
2015-07-13 11:50 ` [RFC v2 3/4] 6lowpan: Add stateful compression support for iphc.c Lukasz Duda
2015-07-23  7:48   ` Alexander Aring
2015-07-23  8:20     ` Duda, Lukasz
2015-07-13 11:50 ` [RFC v2 4/4] Bluetooth: 6lowpan: Enable stateful compression in bluetooth_6lowpan Lukasz Duda
2015-07-23  7:55   ` Alexander Aring
2015-07-23  8:09     ` Duda, Lukasz
2015-07-13 13:09 ` [RFC v2 0/4] Adding stateful compression to IPHC Jukka Rissanen
2015-07-15 13:42   ` Duda, Lukasz
2015-07-16  7:25     ` Jukka Rissanen
2015-07-13 14:15 ` Michael Richardson
2015-07-15  9:55 ` Duda, Lukasz
2015-07-23  8:22 ` Alexander Aring
2015-10-12 16:15 ` Alexander Aring
2015-10-13  8:36   ` Duda, Lukasz

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=20150723065940.GC1941@omega \
    --to=alex.aring@gmail.com \
    --cc=glenn.ruben.bakke@nordicsemi.no \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=lukasz.duda@nordicsemi.no \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).