zephyr/subsys/net/l2/ethernet
Daniel Glöckner 5ef825fdf6 net: pkt: fix race condition in packet reference counting
It has been observed that some network drivers, f.ex. the SAM E70 GMAC,
call net_pkt_unref from inside the interrupt that signals the successful
transmission of a packet. This conflicts with the net_pkt_unref call
made by ethernet_send after the packet has been given to the driver.

We fix this by using an atomic_t to hold the reference count as there
might be other, difficult to find cases of net_pkt_(un)ref being used
across threads and interrupts.

The name of the element has been changed from "ref" to "atomic_ref" to
cause a compile error when code still has not been converted to use the
atomic_* functions.

Fixes #12708

Signed-off-by: Daniel Glöckner <dg@emlix.com>
2019-01-29 09:22:14 +02:00
..
gptp net: gptp: Track memory allocations better 2019-01-08 13:29:18 +02:00
lldp net/pkt: Remove parameters to "reserve" some headroom 2018-12-14 14:16:37 +01:00
CMakeLists.txt net: l2: Add support for Link Layer Discovery Protocol (LLDP) 2018-08-08 09:53:24 +03:00
Kconfig net: arp: Add support for receiving gratuitous ARP request 2018-10-10 16:12:35 +03:00
arp.c net: pkt: fix race condition in packet reference counting 2019-01-29 09:22:14 +02:00
arp.h net/ethernet: Remove usage of net_pkt_ll() function 2018-12-14 14:16:37 +01:00
eth_stats.h net: ethernet: Add helper functions to update error stats. 2018-12-04 09:36:51 -06:00
ethernet.c net: ethernet: Clean an obscure ref/unref logic in ethernet_send() 2019-01-08 13:39:40 +02:00
ethernet_mgmt.c net: Clarify logging in networking code 2018-12-07 12:00:04 +02:00
ethernet_stats.c net: Clarify logging in networking code 2018-12-07 12:00:04 +02:00