OSDN Git Service

xsk: Check need wakeup flag in sendmsg()
authorBjörn Töpel <bjorn.topel@intel.com>
Mon, 30 Nov 2020 18:51:59 +0000 (19:51 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 30 Nov 2020 23:09:25 +0000 (00:09 +0100)
commite392081837283fbe5df1837fd85012ae5bfae098
treef0c1d7ea91db4dfc7f03b59818246ac15d9ca2a7
parent45a86681844e375bef6f6add272ccc309bb6a08d
xsk: Check need wakeup flag in sendmsg()

Add a check for need wake up in sendmsg(), so that if a user calls
sendmsg() when no wakeup is needed, do not trigger a wakeup.

To simplify the need wakeup check in the syscall, unconditionally
enable the need wakeup flag for Tx. This has a side-effect for poll();
If poll() is called for a socket without enabled need wakeup, a Tx
wakeup is unconditionally performed.

The wakeup matrix for AF_XDP now looks like:

need wakeup | poll()       | sendmsg()   | recvmsg()
------------+--------------+-------------+------------
disabled    | wake Tx      | wake Tx     | nop
enabled     | check flag;  | check flag; | check flag;
            |   wake Tx/Rx |   wake Tx   |   wake Rx

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/20201130185205.196029-5-bjorn.topel@gmail.com
net/xdp/xsk.c
net/xdp/xsk_buff_pool.c