diff options
| author | Daniel Borkmann <daniel@iogearbox.net> | 2018-10-17 02:30:32 +0200 |
|---|---|---|
| committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-10-17 02:30:33 +0200 |
| commit | 44d520eb17cd5fd7a3ac28b9d872e655c3920021 (patch) | |
| tree | 91c572d5fd4344b131082e7a1e5e033245dc21b8 /include/linux | |
| parent | 3f4c3127d332000530349db4843deece27fe5e0c (diff) | |
| parent | 753fb2ee09345e0730e610b2ee3a01964fe22a63 (diff) | |
Merge branch 'bpf-sk-msg-peek'
John Fastabend says:
====================
This adds support for the MSG_PEEK flag when redirecting into
an ingress psock sk_msg queue.
The first patch adds some base support to the helpers, then the
feature, and finally we add an option for the test suite to do
a duplicate MSG_PEEK call on every recv to test the feature.
With duplicate MSG_PEEK call all tests continue to PASS.
====================
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/skmsg.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h index 31df0d9fa536..22347b08e1f8 100644 --- a/include/linux/skmsg.h +++ b/include/linux/skmsg.h @@ -187,18 +187,21 @@ static inline void sk_msg_xfer_full(struct sk_msg *dst, struct sk_msg *src) sk_msg_init(src); } +static inline bool sk_msg_full(const struct sk_msg *msg) +{ + return (msg->sg.end == msg->sg.start) && msg->sg.size; +} + static inline u32 sk_msg_elem_used(const struct sk_msg *msg) { + if (sk_msg_full(msg)) + return MAX_MSG_FRAGS; + return msg->sg.end >= msg->sg.start ? msg->sg.end - msg->sg.start : msg->sg.end + (MAX_MSG_FRAGS - msg->sg.start); } -static inline bool sk_msg_full(const struct sk_msg *msg) -{ - return (msg->sg.end == msg->sg.start) && msg->sg.size; -} - static inline struct scatterlist *sk_msg_elem(struct sk_msg *msg, int which) { return &msg->sg.data[which]; |
