From: zhengguoyong <zhenggy@chinatelecom.cn>
To: john.fastabend@gmail.com, jakub@cloudflare.com
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH] bpf, sockmap: Use sk_rmem_schedule in bpf_tcp_ingress
Date: Thu, 4 Jul 2024 12:39:01 +0800 [thread overview]
Message-ID: <ae2569fa-f34a-40d6-9a03-33a455fbb9ea@chinatelecom.cn> (raw)
In sockmap redirect mode, when msg send to redir sk,
we use sk_wrmem_schedule to check memory is enough,
tcp_bpf_sendmsg
tcp_bpf_send_verdict
bpf_tcp_ingress
sk_wmem_schedule
but in bpf_tcp_ingress, the parameter sk means receiver,
so use sk_rmem_schedule here is more suitability.
Signed-off-by: GuoYong Zheng <zhenggy@chinatelecom.cn>
---
net/ipv4/tcp_bpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
index 53b0d62..88c58b5 100644
--- a/net/ipv4/tcp_bpf.c
+++ b/net/ipv4/tcp_bpf.c
@@ -49,7 +49,7 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock,
sge = sk_msg_elem(msg, i);
size = (apply && apply_bytes < sge->length) ?
apply_bytes : sge->length;
- if (!sk_wmem_schedule(sk, size)) {
+ if (!sk_rmem_schedule(sk, size)) {
if (!copied)
ret = -ENOMEM;
break;
--
1.8.3.1
next reply other threads:[~2024-07-04 4:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 4:39 zhengguoyong [this message]
2024-07-04 14:38 ` [PATCH] bpf, sockmap: Use sk_rmem_schedule in bpf_tcp_ingress Michal Kubiak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ae2569fa-f34a-40d6-9a03-33a455fbb9ea@chinatelecom.cn \
--to=zhenggy@chinatelecom.cn \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox