pkt: add functions to allocate packet data [WIP] #2322
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.
Alternative to #2285. Still WIP (tests need to be adapted).
There were two problems in #2285:
pkt->payload_data
was not thread-safe.The solution for both is more or less to keep
pktbuf
a void pointer oriented buffer and (for (1) specifically) to not putpkt_t
structs into it. This way every thread is responsible for their own instance ofpkt_t
and a movingpayload_data
is not the problem anymore. The header problem get's solved, since the internal organizing structure does not inherit frompkt_header_t
anymore now.Since through this we lost some requirements for
pkt
, I simplified it a little:pkt.h
tosys/net/include
since it haspktbuf
as dependency anyway (technically this is not due to a requirement-loss ;-))packed
attribute frompkt_t
since it is not stored in thepktbuf
anymorepayload_proto
frompkt_t
since I don't see any use-case for it and we save this way a few byte. It was introduced, since I needed a relationship betweenpkt_t
andpkt_hlist_t
to use a modified version of them aspktbuf
's internal organizing structure.