net/netbuf: introduce network buffer abstraction (v2.0) #12691
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
Towards an network stack independent
netif
(#12688), this proposes an API for stack independent packet allocation, release and access to content.This approach replaces #12315 since it's cleaner and a smaller step.
Each network stack needs to define these 3 functions:
netbuf_alloc
: allocate a network buffernetbuf_free
: free the resources associated to the network buffernetbuf_get_iolist
: getiolist_t
representation of the network buffer.With these functions, it's possible e.g to remove all GNRC pktbuf specific functions in
gnrc_netif_ieee802154
, so this layer can be reused by other network stacks (it still requires somenetif
abstract functions but that would come soon :).I'm also naming it "netbuf" and not "netif_pkt_t" because this is intended to represent the data of the pkt and not the metadata. As discussed with @miri64 offline, there might be something like:
So the
netif
receive function could look like:RFC
Testing procedure
Check the documentation build ok:
make doc
.Issues/PRs references
Replaces #12315
#12688