From: Michal Kubiak <michal.kubiak@intel.com>
To: zhengguoyong <zhenggy@chinatelecom.cn>
Cc: <john.fastabend@gmail.com>, <jakub@cloudflare.com>,
<netdev@vger.kernel.org>, <bpf@vger.kernel.org>
Subject: Re: [PATCH] bpf, sockmap: Use sk_rmem_schedule in bpf_tcp_ingress
Date: Thu, 4 Jul 2024 16:38:22 +0200 [thread overview]
Message-ID: <Zoaz3jhyf4VCRjTz@localhost.localdomain> (raw)
In-Reply-To: <ae2569fa-f34a-40d6-9a03-33a455fbb9ea@chinatelecom.cn>
On Thu, Jul 04, 2024 at 12:39:01PM +0800, zhengguoyong wrote:
> 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
>
>
From the commit message I'm not really sure about the intention of this
patch, however it seems the existing kernel implementation is correct.
Changing sk_wmem_schedule -> sk_rmem_schedule breaks the kernel compilation
because those 2 functions even have different input parameters.
Please see the Patchwork results for details:
https://patchwork.kernel.org/project/netdevbpf/patch/ae2569fa-f34a-40d6-9a03-33a455fbb9ea@chinatelecom.cn/
Thanks,
Michal
Nacked-by: Michal Kubiak <michal.kubiak@intel.com>
prev parent reply other threads:[~2024-07-04 14:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 4:39 [PATCH] bpf, sockmap: Use sk_rmem_schedule in bpf_tcp_ingress zhengguoyong
2024-07-04 14:38 ` Michal Kubiak [this message]
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=Zoaz3jhyf4VCRjTz@localhost.localdomain \
--to=michal.kubiak@intel.com \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=zhenggy@chinatelecom.cn \
/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