nuttx/drivers/usrsock
Zhe Weng e4721cef5c usrsock_rpmsg_server: Add net_lock to combine get_tx_payload and recvfrom in recvfrom_handler
A dead lock may happen before this patch:
rptun thread (usrsock_rpmsg_recvfrom_handler):
 Gets all tx payload but waiting net_lock in psock_recvfrom
net driver thread (higher priority):
 Receives a packet, holding net_lock, calling usrsock_rpmsg_send_event
 But no tx buffer left, so rpmsg_send blocks, and won't release net_lock

In short:
Rptun: Hold all `tx_payload_buffer` -> want `net_lock`
Driver: Hold `net_lock` -> want `tx_payload_buffer`

This patch use net_lock to combine get_tx_payload and recvfrom together,
then:
- If it's waiting net_lock, tx payload will not be held, other threads
  may get tx buffer and do their work.
- If net_lock is got, it won't be disturbed before finish receiving,
  then tx payload won't have chance to be blocked before releasing.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-09-14 14:32:40 +08:00
..
CMakeLists.txt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
Kconfig move usrsock to kernel space 2023-01-11 15:14:03 +08:00
Make.defs move usrsock to kernel space 2023-01-11 15:14:03 +08:00
usrsock_dev.c fs/inode: remove all unnecessary check for filep/inode 2023-08-29 09:47:11 +08:00
usrsock_rpmsg_server.c usrsock_rpmsg_server: Add net_lock to combine get_tx_payload and recvfrom in recvfrom_handler 2023-09-14 14:32:40 +08:00
usrsock_rpmsg.c net: consistent the net sem wait naming conversion 2023-01-15 12:31:30 -03:00