All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Xing <kerneljasonxing@gmail.com>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
	 daniel@iogearbox.net, davem@davemloft.net, dsahern@kernel.org,
	 eddyz87@gmail.com, edumazet@google.com, haoluo@google.com,
	horms@kernel.org,  john.fastabend@gmail.com, jolsa@kernel.org,
	kpsingh@kernel.org,  kuba@kernel.org, martin.lau@linux.dev,
	ncardwell@google.com,  netdev@vger.kernel.org, pabeni@redhat.com,
	sdf@fomichev.me, song@kernel.org,  yonghong.song@linux.dev
Subject: Re: [PATCH net-next 2/3] bpf: add TCP_BPF_RTO_MAX for bpf_setsockopt
Date: Thu, 13 Feb 2025 11:14:45 +0800	[thread overview]
Message-ID: <CAL+tcoDKxNbhLTtL7i4WNGzEJxB1h1rAvYvmSvapnZjmdO=QuQ@mail.gmail.com> (raw)
In-Reply-To: <20250213023214.76562-1-kuniyu@amazon.com>

On Thu, Feb 13, 2025 at 10:32 AM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> From: Kuniyuki Iwashima <kuniyu@amazon.com>
> Date: Thu, 13 Feb 2025 11:25:01 +0900
> > > diff --git a/net/core/filter.c b/net/core/filter.c
> > > index 2ec162dd83c4..a21a147e0a86 100644
> > > --- a/net/core/filter.c
> > > +++ b/net/core/filter.c
> > > @@ -5303,6 +5303,12 @@ static int bpf_sol_tcp_setsockopt(struct sock *sk, int optname,
> > >                     return -EINVAL;
> > >             tp->bpf_sock_ops_cb_flags = val;
> > >             break;
> > > +   case TCP_BPF_RTO_MAX:
> > > +           if (val > TCP_RTO_MAX_SEC * MSEC_PER_SEC ||
> > > +               val < TCP_RTO_MAX_MIN_SEC * MSEC_PER_SEC)
> > > +                   return -EINVAL;
> > > +           inet_csk(sk)->icsk_rto_max = msecs_to_jiffies(val);
> > > +           break;
> > >     default:
> > >             return -EINVAL;
> > >     }
> >
> > You need not define TCP_BPF_RTO_MAX because TCP_RTO_MAX is not a
> > BPF specific option, and you can just reuse do_tcp_setsockopt(),
> > then bpf_getsockopt() also works.
> >
> > ---8<---
> > diff --git a/net/core/filter.c b/net/core/filter.c
> > index 2ec162dd83c4..77732f10097c 100644
> > --- a/net/core/filter.c
> > +++ b/net/core/filter.c
> > @@ -5382,6 +5382,7 @@ static int sol_tcp_sockopt(struct sock *sk, int optname,
> >       case TCP_USER_TIMEOUT:
> >       case TCP_NOTSENT_LOWAT:
> >       case TCP_SAVE_SYN:
> > +     case TCP_RTO_MAX:
>
> s/TCP_RTO_MAX/TCP_RTO_MAX_MS/ :)

Thanks for spotting this simpler approach. It works.

Thanks,
Jason

>
>
> >               if (*optlen != sizeof(int))
> >                       return -EINVAL;
> >               break;
> > ---8<---

  reply	other threads:[~2025-02-13  3:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13  0:43 [PATCH net-next 0/3] bpf: support setting max RTO for bpf_setsockopt Jason Xing
2025-02-13  0:43 ` [PATCH net-next 1/3] tcp: add TCP_RTO_MAX_MIN_SEC definition Jason Xing
2025-02-13  2:19   ` Kuniyuki Iwashima
2025-02-13  0:43 ` [PATCH net-next 2/3] bpf: add TCP_BPF_RTO_MAX for bpf_setsockopt Jason Xing
2025-02-13  2:25   ` Kuniyuki Iwashima
2025-02-13  2:32     ` Kuniyuki Iwashima
2025-02-13  3:14       ` Jason Xing [this message]
2025-02-13 23:41   ` Stanislav Fomichev
2025-02-13 23:57     ` Jason Xing
2025-02-14  2:14       ` Martin KaFai Lau
2025-02-14  3:09         ` Jason Xing
2025-02-14  5:41           ` Martin KaFai Lau
2025-02-14  6:12             ` Jason Xing
2025-02-14  6:40               ` Martin KaFai Lau
2025-02-14  6:56                 ` Jason Xing
2025-02-14 23:44                   ` Martin KaFai Lau
2025-02-14 23:53                     ` Jason Xing
2025-02-15  2:39                       ` Martin KaFai Lau
2025-02-15  2:52                         ` Jason Xing
2025-02-14 15:48       ` Stanislav Fomichev
2025-02-14 23:21         ` Jason Xing
2025-02-13  0:43 ` [PATCH net-next 3/3] selftests/bpf: add rto max for bpf_setsockopt test Jason Xing
2025-02-13  2:30   ` Kuniyuki Iwashima
2025-02-13  3:13     ` Jason Xing

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='CAL+tcoDKxNbhLTtL7i4WNGzEJxB1h1rAvYvmSvapnZjmdO=QuQ@mail.gmail.com' \
    --to=kerneljasonxing@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=martin.lau@linux.dev \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.