From: David Howells <dhowells@xxxxxxxxxx> [ Upstream commit f8dd95b29d7ef08c19ec9720564acf72243ddcf6] As MSG_SENDPAGE_NOTLAST is being phased out along with sendpage(), don't use it further in than the sendpage methods, but rather translate it to MSG_MORE and use that instead. Fixes: 04919bed948dc ("tcp: Introduce tcp_read_skb()") Signed-off-by: David Howells <dhowells@xxxxxxxxxx> cc: Willem de Bruijn <willemdebruijn.kernel@xxxxxxxxx> cc: Bernard Metzler <bmt@xxxxxxxxxxxxxx> cc: Jason Gunthorpe <jgg@xxxxxxxx> cc: Leon Romanovsky <leon@xxxxxxxxxx> cc: John Fastabend <john.fastabend@xxxxxxxxx> cc: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx> cc: David Ahern <dsahern@xxxxxxxxxx> cc: Karsten Graul <kgraul@xxxxxxxxxxxxx> cc: Wenjia Zhang <wenjia@xxxxxxxxxxxxx> cc: Jan Karcher <jaka@xxxxxxxxxxxxx> cc: "D. Wythe" <alibuda@xxxxxxxxxxxxxxxxx> cc: Tony Lu <tonylu@xxxxxxxxxxxxxxxxx> cc: Wen Gu <guwen@xxxxxxxxxxxxxxxxx> cc: Boris Pismenny <borisp@xxxxxxxxxx> cc: Steffen Klassert <steffen.klassert@xxxxxxxxxxx> cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20230623225513.2732256-2-dhowells@xxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> --- net/ipv4/tcp_bpf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index f3def363b971..cd6648aaf570 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -88,9 +88,9 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock, static int tcp_bpf_push(struct sock *sk, struct sk_msg *msg, u32 apply_bytes, int flags, bool uncharge) { + struct msghdr msghdr = {}; bool apply = apply_bytes; struct scatterlist *sge; - struct msghdr msghdr = { .msg_flags = flags | MSG_SPLICE_PAGES, }; struct page *page; int size, ret = 0; u32 off; @@ -107,11 +107,12 @@ static int tcp_bpf_push(struct sock *sk, struct sk_msg *msg, u32 apply_bytes, tcp_rate_check_app_limited(sk); retry: + msghdr.msg_flags = flags | MSG_SPLICE_PAGES; has_tx_ulp = tls_sw_has_ctx_tx(sk); if (has_tx_ulp) msghdr.msg_flags |= MSG_SENDPAGE_NOPOLICY; - if (flags & MSG_SENDPAGE_NOTLAST) + if (size < sge->length && msg->sg.start != msg->sg.end) msghdr.msg_flags |= MSG_MORE; bvec_set_page(&bvec, page, size, off); -- 2.33.0