Skip to content

net/netbuf: introduce network buffer abstraction (v2.0)#12691

Closed
jia200x wants to merge 1 commit intoRIOT-OS:masterfrom
jia200x:pr/netbuf_v2
Closed

net/netbuf: introduce network buffer abstraction (v2.0)#12691
jia200x wants to merge 1 commit intoRIOT-OS:masterfrom
jia200x:pr/netbuf_v2

Conversation

@jia200x
Copy link
Copy Markdown
Member

@jia200x jia200x commented Nov 11, 2019

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 buffer
  • netbuf_free: free the resources associated to the network buffer
  • netbuf_get_iolist: get iolist_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 some netif 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:

typedef struct {
    netbuf_t *buf;
    int rssi;
    int lqi;
    uint8_t *l2_address;
    /* ... */
} netif_pkt_t;

So the netif receive function could look like:

void netif_recv(netif_t *netif, netif_pkt_t *pkt)
{
    /* Pass packet to the stack */
}

RFC

  • Does this approach make sense?
  • Are we ok with the name?
  • Does the API make sense?
  • Does it work for all network stacks?

Testing procedure

Check the documentation build ok: make doc.

Issues/PRs references

Replaces #12315
#12688

@jia200x jia200x added the Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR label Nov 11, 2019
@jia200x
Copy link
Copy Markdown
Member Author

jia200x commented Nov 13, 2019

@kaspar030 does this work for your use case?

This was referenced Nov 13, 2019
@jia200x
Copy link
Copy Markdown
Member Author

jia200x commented Mar 31, 2020

With #13771 this becomes outdated. I will close it

@jia200x jia200x closed this Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant