Skip to content

gnrc_sixlowpan: Refactoring #8511

@miri64

Description

@miri64

Motivation

GNRC's 6LoWPAN has some quality defects in its design, that need to be addressed before @cgundogan can start porting ICNLoWPAN to RIOT. Also I have some issues with certain points in the code that in hindsight I would have done differently.

A model for the 6LoWPAN adaption layer

In a try to solve both problems in my motivation in one go I came up with a model for the 6LoWPAN adaption layer that drafts the different components of 6LoWPAN (fragmentation, IPHC, etc.) as layered sub-modules (in the following referred to as 6Lo modules) with a common API. In reviewing all the RFCs currently available on the adaption layer (RFC4944, RFC6282, RFC7400, RFC8025, RFC8138 (and also some drafts)) I identified 8 6Lo modules (which in turn of course can have their own sub-module). In the following the cursive ones are already implemented in RIOT and need to be refactored to this module:

I omitted HC1 since I believe there is no benefit in ever porting it, but if someone would plan to it would also be its own 6Lo layer.

Every 6Lo modules will provide two functions with the following prototype:

void send(gnrc_pktsnip_t *pkt, void *ctx, uint8_t page);
void recv(gnrc_pktsnip_t *pkt, void *ctx, uint8_t page);

For the more visual inclined, here is a UML diagram I threw together:

6lo-remodel-class

The context is there so e.g. the compression models can be handed the reassembly buffer so they can de-compress the packet directly in it instead of awkwardly returning some values by having 3 (!) return values to the compression decode function as it is currently the case (i.e. so we don't have to back-trace into a previous 6Lo layer, once the task of the next layer layer did its job).

How to proceed

I think moving over to this module shouldn't be too intrusive as it is pretty simple and most components are already in a shape that is quite similar. I think @cgundogan can divide most of the refactoring tasks among ourselves.

I'm going to open a project to track our process on that more dynamically.

Metadata

Metadata

Labels

Area: networkArea: NetworkingProcess: API changeIntegration Process: PR contains or issue proposes an API change. Should be handled with care.Type: trackingThe issue tracks and organizes the sub-tasks of a larger effort

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions