Skip to content
Browse files

net/pkt: Redefine the necessary fifo attribute

commit 79672d1 was missing the fact socket layer is putting net_pkt
into a k_fifo. However, it's on receiving side only: at this point the
k_fifo_put is using the k_work area which is then useless at this
point Thus why it did not break anything, as k_fifo only needs 4 bytes
while the k_work attribute takes 12 bytes.

Thus adding a union on the k_work attribute with another new attribute
that describes the behavior.

Signed-off-by: Tomasz Bursztyka <>
  • Loading branch information...
tbursztyka authored and jukkar committed May 24, 2019
1 parent 2d48f43 commit 79a25a6fff328d5a36db085b2c6ace0445f2d0f5
Showing with 12 additions and 2 deletions.
  1. +12 −2 include/net/net_pkt.h
@@ -58,8 +58,18 @@ struct net_pkt_cursor {
* net_pkt_clone() function.
struct net_pkt {
/** Internal variable that is used when packet is sent */
struct k_work work;
union {
/** Internal variable that is used when packet is sent
* or received.
struct k_work work;
/** Socket layer will queue received net_pkt into a k_fifo.
* Since this happens after consuming net_pkt's k_work on
* RX path, it is then fine to have both attributes sharing
* the same memory area.
int sock_recv_fifo;

/** Slab pointer from where it belongs to */
struct k_mem_slab *slab;

0 comments on commit 79a25a6

Please sign in to comment.
You can’t perform that action at this time.