summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-11-04 18:47:25 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-11-04 18:47:58 +0000
commit475a0cfd02f14d764023e926ac01fc7597134229 (patch)
tree3f791fce4d2b55e4f2fbfdfdb29dfc9db8aba58d /include/linux
parent05441d697f7f9a927264f4058cbbc6a03dfcac9d (diff)
parent0048086bd3616b2b3b1b0f122f6268360769a756 (diff)
Merge branch 'bpf-sockmap-fixes-for-verdicts-redirects-corks-and-recvmsg'
Alexei Starovoitov says: ==================== bpf, sockmap: Fixes for verdicts, redirects, corks and recvmsg() From: Alexei Starovoitov <ast@kernel.org> These patches fix bugs in sockmap: patches area ------- ---------------------------------------------------------------- 01 recvmsg() after a fault 02-04 the verdict of an sk_msg prog and the return value of sendmsg() 05 the backlog of a stopped psock 06 TCP listeners 07-08 the target of an egress redirect 09 the TCP state in recvmsg() 10-14 corks and the redirect target 15 bpf_msg_push_data() and bpf_msg_pop_data() 8 of the patches are from Chris Mason and Josef Bacik. Patch 08 changes net/core/stream.c. Patch 09 moves tcp_can_send_ack() from net/mptcp/protocol.c to include/net/tcp.h. Patches 10 and 15 change the sk_msg helpers in net/core/filter.c. v1 -> v2: - Patch 03: end the verdict after a failed push too if apply_bytes is 0. Another sender can use up apply_bytes during the push (CI bot) - Patch 04: correct the Fixes tag (CI bot) - Rebase on the bpf tree v1: https://lore.kernel.org/bpf/20261101192057.2296489-1-alexei.starovoitov@gmail.com/ ==================== Reviewed-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: John Fastabend <john.fastabend@gmail.com> Link: https://patch.msgid.link/20261102072112.4160195-1-alexei.starovoitov@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/skmsg.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index d5e35f24738d..f0e27b4b929f 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -196,6 +196,25 @@ static inline void sk_msg_init(struct sk_msg *msg)
sg_init_marker(msg->sg.data, NR_MSG_FRAG_IDS);
}
+/*
+ * sk_msg_memcopy_from_iter() writes to byte sg.copybreak of element sg.curr,
+ * counted from the offset of that element. Point both past the last byte of
+ * the message, after something other than a copy has changed its elements.
+ */
+static inline void sk_msg_reset_curr(struct sk_msg *msg)
+{
+ if (!msg->sg.size) {
+ msg->sg.curr = msg->sg.start;
+ msg->sg.copybreak = 0;
+ } else {
+ u32 i = msg->sg.end;
+
+ sk_msg_iter_var_prev(i);
+ msg->sg.curr = i;
+ msg->sg.copybreak = msg->sg.data[i].length;
+ }
+}
+
static inline void sk_msg_xfer(struct sk_msg *dst, struct sk_msg *src,
int which, u32 size)
{