]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: skmsg, improve sk_msg_used_element to work in cork context
authorJohn Fastabend <john.fastabend@gmail.com>
Tue, 16 Oct 2018 18:07:59 +0000 (11:07 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 17 Oct 2018 00:30:31 +0000 (02:30 +0200)
commit6ba18d5ddc8e4324a9192c0f1463c0839be7a421
treec2315a4509373faded8a283081efce95a7b6ad7e
parent3b8cc56f3c0163855180f355acdfefb14846f4c6
bpf: skmsg, improve sk_msg_used_element to work in cork context

Currently sk_msg_used_element is only called in zerocopy context where
cork is not possible and if this case happens we fallback to copy
mode. However the helper is more useful if it works in all contexts.

This patch resolved the case where if end == head indicating a full
or empty ring the helper always reports an empty ring. To fix this
add a test for the full ring case to avoid reporting a full ring
has 0 elements. This additional functionality will be used in the
next patches from recvmsg context where end = head with a full ring
is a valid case.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
include/linux/skmsg.h