Re: [RFC v2 2/4] 6lowpan: Add stateful compression component of 6lowpan module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux