Skip to contentSkip to conversation

bpf: support setting max RTO for bpf_setsockopt

PATCH Applied Jason Xing 6 participants 11 messages Feb 19, 2025 – Feb 22, 2025 2 messages not in the archive

Subsystems (6)
lore
Share & tools
lore

Jason Xing

author
#0 lore raw

v3 cover bpf: support setting max RTO for bpf_setsockopt

Support max RTO set by BPF program calling bpf_setsockopt(). Add corresponding selftests.

Jason Xing (2):
bpf: support TCP_RTO_MAX_MS for bpf_setsockopt selftests/bpf: add rto max for bpf_setsockopt test

 net/core/filter.c                                   | 1 +
 tools/testing/selftests/bpf/progs/bpf_tracing_net.h | 1 +
 tools/testing/selftests/bpf/progs/setget_sockopt.c  | 1 +
 3 files changed, 3 insertions(+)
Signature · 1 line
2.43.5
author
#1 lore raw

PATCH v3 1/2 bpf: support TCP_RTO_MAX_MS for bpf_setsockopt

Some applications don't want to wait for too long because the time of retransmission increases exponentially and can reach more than 10 seconds, for example. Eric implements the core logic on supporting rto max feature in the stack previously. Based on that, we can support it for BPF use.

This patch reuses the same logic of TCP_RTO_MAX_MS in do_tcp_setsockopt() and do_tcp_getsockopt(). BPF program can call bpf_{set/get}sockopt() to set/get the maximum value of RTO.

---
 net/core/filter.c | 1 +
 1 file changed, 1 insertion(+)
net/core/filter.c +1 -0
index 2ec162dd83c4..ffec7b4357f9 100644
@@ -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_MS:
 		if (*optlen != sizeof(int))
 			return -EINVAL;
 		break;
Signature · 1 line
2.43.5
author
#6 lore raw

PATCH v3 2/2 selftests/bpf: add rto max for bpf_setsockopt test

In reply to Jason Xing

Test the TCP_RTO_MAX_MS optname in the existing setget_sockopt test.

---
 tools/testing/selftests/bpf/progs/bpf_tracing_net.h | 1 +
 tools/testing/selftests/bpf/progs/setget_sockopt.c  | 1 +
 2 files changed, 2 insertions(+)
tools/testing/selftests/bpf/progs/bpf_tracing_net.h +1 -0
index 59843b430f76..eb6ed1b7b2ef 100644
@@ -49,6 +49,7 @@
 #define TCP_SAVED_SYN		28
 #define TCP_CA_NAME_MAX		16
 #define TCP_NAGLE_OFF		1
+#define TCP_RTO_MAX_MS		44
 
 #define TCP_ECN_OK              1
 #define TCP_ECN_QUEUE_CWR       2
tools/testing/selftests/bpf/progs/setget_sockopt.c +1 -0
index 6dd4318debbf..106fe430f41b 100644
@@ -61,6 +61,7 @@ static const struct sockopt_test sol_tcp_tests[] = {
 	{ .opt = TCP_NOTSENT_LOWAT, .new = 1314, .expected = 1314, },
 	{ .opt = TCP_BPF_SOCK_OPS_CB_FLAGS, .new = BPF_SOCK_OPS_ALL_CB_FLAGS,
 	  .expected = BPF_SOCK_OPS_ALL_CB_FLAGS, },
+	{ .opt = TCP_RTO_MAX_MS, .new = 2000, .expected = 2000, },
 	{ .opt = 0, },
 };
 
Signature · 1 line
2.43.5
#9 lore raw
In reply to a message not in the archive

Hi Jason,

Quoted 37 lines · Jason Xing
Quoted 18 lines · On Wed, Feb 19, 2025 at 4:27 PM <[email protected]> wrote:

Dear patch submitter,

CI has tested the following submission:

Status:     FAILURE
Name:       [bpf-next,v3,0/2] bpf: support setting max RTO for bpf_setsockopt
Patchwork:  https://patchwork.kernel.org/project/netdevbpf/list/?series=935463&state=*
Matrix:     https://github.com/kernel-patches/bpf/actions/runs/13408235954

Failed jobs:
build-aarch64-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452248960
build-s390x-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452248633
build-x86_64-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452249287
build-x86_64-llvm-17: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452250339
build-x86_64-llvm-17-O2: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452250688
build-x86_64-llvm-18: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452251018
build-x86_64-llvm-18-O2: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452251311

Quoted 3 lines

Please note: this email is coming from an unmonitored mailbox. If you have questions or feedback, please reach out to the Meta Kernel CI team at [email protected].

I think the only diff I made is that I removed the change in tools/include/uapi/linux/bpf.h from V2.

tools/include/uapi/linux/tcp.h +1 -0
index 13ceeb395eb8..7989e3f34a58 100644
@@ -128,6 +128,7 @@ enum {
  #define TCP_CM_INQ             TCP_INQ
 
  #define TCP_TX_DELAY           37      /* delay outgoing packets by XX usec */
+#define TCP_RTO_MAX_MS         44      /* max rto time in ms */
 

Last time everything was fine. I doubt it has something to do with the failure :S

Quoted 2 lines

But I tested it locally and could not reproduce it. Could it be caused because of applying to a wrong branch? I'm afraid not, right?

It looks like TCP_RTO_MAX_MS is defined in include/uapi/linux/tcp.h. But

I don't see a uapi include in net/core/filter.c where you're using the definition.

Given the transitive dependency, perhaps some other file shifted? Seems better

to directly include the uapi header if you're going to use it.

Thanks,

Daniel

#12 lore raw
In reply to Jason Xing
This series was applied to bpf/bpf-next.git (net) by Martin KaFai Lau <[email protected]>:

Hello:

This series was applied to bpf/bpf-next.git (net)
by Martin KaFai Lau <[email protected]>:

Quoted 8 lines · On Wed, 19 Feb 2025 16:13:30 +0800 you wrote:

Support max RTO set by BPF program calling bpf_setsockopt(). Add corresponding selftests.

Jason Xing (2):
bpf: support TCP_RTO_MAX_MS for bpf_setsockopt selftests/bpf: add rto max for bpf_setsockopt test

[...]

Here is the summary with links:
- [bpf-next,v3,1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt

    https://git.kernel.org/bpf/bpf-next/c/6810c771d316
  - [bpf-next,v3,2/2] selftests/bpf: add rto max for bpf_setsockopt test
    https://git.kernel.org/bpf/bpf-next/c/7a93ba804847

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#10 lore raw
In reply to Daniel Xu
Quoted 34 lines · Daniel Xu

Hi Jason,

Quoted 31 lines · Jason Xing
Quoted 18 lines · On Wed, Feb 19, 2025 at 4:27 PM <[email protected]> wrote:

Dear patch submitter,

CI has tested the following submission:

Status:     FAILURE
Name:       [bpf-next,v3,0/2] bpf: support setting max RTO for bpf_setsockopt
Patchwork:  https://patchwork.kernel.org/project/netdevbpf/list/?series=935463&state=*
Matrix:     https://github.com/kernel-patches/bpf/actions/runs/13408235954

Failed jobs:
build-aarch64-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452248960
build-s390x-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452248633
build-x86_64-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452249287
build-x86_64-llvm-17: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452250339
build-x86_64-llvm-17-O2: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452250688
build-x86_64-llvm-18: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452251018
build-x86_64-llvm-18-O2: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452251311

Quoted 3 lines

Please note: this email is coming from an unmonitored mailbox. If you have questions or feedback, please reach out to the Meta Kernel CI team at [email protected].

I think the only diff I made is that I removed the change in tools/include/uapi/linux/bpf.h from V2.

tools/include/uapi/linux/tcp.h +0 -0
index 13ceeb395eb8..7989e3f34a58 100644
@@ -128,6 +128,7 @@ enum {
   #define TCP_CM_INQ             TCP_INQ
 
Quoted 5 lines
Quoted 5 lines
tools/include/uapi/linux/tcp.h +1 -0
   #define TCP_TX_DELAY           37      /* delay outgoing packets by XX usec */
+#define TCP_RTO_MAX_MS         44      /* max rto time in ms */
 

Last time everything was fine. I doubt it has something to do with the failure :S

kernel should not need tools/include, so no.

Quoted 3 lines
Quoted 3 lines

But I tested it locally and could not reproduce it. Could it be caused because of applying to a wrong branch? I'm afraid not, right?

Right, in v2, the patch 1 cannot be applied to bpf-next/master, so the bpf CI retried with bpf-next/net. It is the current bpf CI setup.

That v2's patch 1 is removed in v3, so the v3 applied cleanly to bpf-next/master and the bpf CI moved forward to test it.

I tested locally and I have applied v3 to bpf-next/net. Thanks.

May be the bpf CI can retry with bpf-next/net also there is kernel compilation error.

author
#11 lore raw
Quoted 51 lines · Martin KaFai Lau
Quoted 34 lines · Daniel Xu

Hi Jason,

Quoted 31 lines · Jason Xing
Quoted 18 lines · On Wed, Feb 19, 2025 at 4:27 PM <[email protected]> wrote:

Dear patch submitter,

CI has tested the following submission:

Status:     FAILURE
Name:       [bpf-next,v3,0/2] bpf: support setting max RTO for bpf_setsockopt
Patchwork:  https://patchwork.kernel.org/project/netdevbpf/list/?series=935463&state=*
Matrix:     https://github.com/kernel-patches/bpf/actions/runs/13408235954

Failed jobs:
build-aarch64-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452248960
build-s390x-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452248633
build-x86_64-gcc: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452249287
build-x86_64-llvm-17: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452250339
build-x86_64-llvm-17-O2: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452250688
build-x86_64-llvm-18: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452251018
build-x86_64-llvm-18-O2: https://github.com/kernel-patches/bpf/actions/runs/13408235954/job/37452251311

Quoted 3 lines

Please note: this email is coming from an unmonitored mailbox. If you have questions or feedback, please reach out to the Meta Kernel CI team at [email protected].

I think the only diff I made is that I removed the change in tools/include/uapi/linux/bpf.h from V2.

tools/include/uapi/linux/tcp.h +0 -0
index 13ceeb395eb8..7989e3f34a58 100644
@@ -128,6 +128,7 @@ enum {
   #define TCP_CM_INQ             TCP_INQ
 
Quoted 5 lines
Quoted 5 lines
tools/include/uapi/linux/tcp.h +1 -0
   #define TCP_TX_DELAY           37      /* delay outgoing packets by XX usec */
+#define TCP_RTO_MAX_MS         44      /* max rto time in ms */
 

Last time everything was fine. I doubt it has something to do with the failure :S

kernel should not need tools/include, so no.

Quoted 3 lines
Quoted 3 lines

But I tested it locally and could not reproduce it. Could it be caused because of applying to a wrong branch? I'm afraid not, right?

Right, in v2, the patch 1 cannot be applied to bpf-next/master, so the bpf CI retried with bpf-next/net. It is the current bpf CI setup.

Quoted 7 lines

That v2's patch 1 is removed in v3, so the v3 applied cleanly to bpf-next/master and the bpf CI moved forward to test it.

I tested locally and I have applied v3 to bpf-next/net. Thanks.

May be the bpf CI can retry with bpf-next/net also there is kernel compilation error.

Oh, I got it, thanks!

#2 lore raw

Re: [PATCH bpf-next v3 1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt

In reply to Jason Xing
kernel test robot noticed the following build errors:

Hi Jason,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Jason-Xing/bpf-support-TCP_RTO_MAX_MS-for-bpf_setsockopt/20250219-161637
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20250219081333.56378-2-kerneljasonxing%40gmail.com
patch subject: [PATCH bpf-next v3 1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt
config: x86_64-buildonly-randconfig-002-20250220 (https://download.01.org/0day-ci/archive/20250220/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250220/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

net/core/filter.c: In function 'sol_tcp_sockopt':

>> net/core/filter.c:5385:14: error: 'TCP_RTO_MAX_MS' undeclared (first use in this function); did you mean 'TCP_RTO_MAX'?
    5385 |         case TCP_RTO_MAX_MS:
         |              ^~~~~~~~~~~~~~
         |              TCP_RTO_MAX

net/core/filter.c:5385:14: note: each undeclared identifier is reported only once for each function it appears in

vim +5385 net/core/filter.c

5365
5366 static int sol_tcp_sockopt(struct sock *sk, int optname,
5367 char *optval, int *optlen,
5368 bool getopt)
5369 {
5370 if (sk->sk_protocol != IPPROTO_TCP)
5371 return -EINVAL;
5372
5373 switch (optname) {
5374 case TCP_NODELAY:
5375 case TCP_MAXSEG:
5376 case TCP_KEEPIDLE:
5377 case TCP_KEEPINTVL:
5378 case TCP_KEEPCNT:
5379 case TCP_SYNCNT:
5380 case TCP_WINDOW_CLAMP:
5381 case TCP_THIN_LINEAR_TIMEOUTS:
5382 case TCP_USER_TIMEOUT:
5383 case TCP_NOTSENT_LOWAT:
5384 case TCP_SAVE_SYN:

> 5385		case TCP_RTO_MAX_MS:

5386 if (*optlen != sizeof(int))
5387 return -EINVAL;
5388 break;
5389 case TCP_CONGESTION:
5390 return sol_tcp_sockopt_congestion(sk, optval, optlen, getopt);
5391 case TCP_SAVED_SYN:
5392 if (*optlen < 1)
5393 return -EINVAL;
5394 break;
5395 case TCP_BPF_SOCK_OPS_CB_FLAGS:
5396 if (*optlen != sizeof(int))
5397 return -EINVAL;
5398 if (getopt) {
5399 struct tcp_sock *tp = tcp_sk(sk);
5400 int cb_flags = tp->bpf_sock_ops_cb_flags;
5401
5402 memcpy(optval, &cb_flags, *optlen);
5403 return 0;
5404 }
5405 return bpf_sol_tcp_setsockopt(sk, optname, optval, *optlen);
5406 default:
5407 if (getopt)
5408 return -EINVAL;
5409 return bpf_sol_tcp_setsockopt(sk, optname, optval, *optlen);
5410 }
5411
5412 if (getopt) {
5413 if (optname == TCP_SAVED_SYN) {
5414 struct tcp_sock *tp = tcp_sk(sk);
5415
5416 if (!tp->saved_syn ||
5417 *optlen > tcp_saved_syn_len(tp->saved_syn))
5418 return -EINVAL;
5419 memcpy(optval, tp->saved_syn->data, *optlen);
5420 /* It cannot free tp->saved_syn here because it
5421 * does not know if the user space still needs it.
5422 */
5423 return 0;
5424 }
5425
5426 return do_tcp_getsockopt(sk, SOL_TCP, optname,
5427 KERNEL_SOCKPTR(optval),
5428 KERNEL_SOCKPTR(optlen));
5429 }
5430
5431 return do_tcp_setsockopt(sk, SOL_TCP, optname,
5432 KERNEL_SOCKPTR(optval), *optlen);
5433 }
5434

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author
#3 lore raw

Re: [PATCH bpf-next v3 1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt

Quoted 20 lines · kernel test robot

Hi Jason,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Jason-Xing/bpf-support-TCP_RTO_MAX_MS-for-bpf_setsockopt/20250219-161637
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20250219081333.56378-2-kerneljasonxing%40gmail.com
patch subject: [PATCH bpf-next v3 1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt
config: x86_64-buildonly-randconfig-002-20250220 (https://download.01.org/0day-ci/archive/20250220/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250220/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 8 lines

All errors (new ones prefixed by >>):

net/core/filter.c: In function 'sol_tcp_sockopt':

Quoted 1 line
Quoted 1 line

net/core/filter.c:5385:14: error: 'TCP_RTO_MAX_MS' undeclared (first use in this function); did you mean 'TCP_RTO_MAX'?

    5385 |         case TCP_RTO_MAX_MS:
         |              ^~~~~~~~~~~~~~
         |              TCP_RTO_MAX

net/core/filter.c:5385:14: note: each undeclared identifier is reported only once for each function it appears in

We've discussed this a few hours ago. It turned out to be the wrong branch which this series applied to. Please try bpf-next net branch instead :)

Thanks,
Jason

#4 lore raw

Re: [PATCH bpf-next v3 1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt

Quoted 25 lines · Jason Xing
Quoted 24 lines · kernel test robot

Hi Jason,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Jason-Xing/bpf-support-TCP_RTO_MAX_MS-for-bpf_setsockopt/20250219-161637
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20250219081333.56378-2-kerneljasonxing%40gmail.com
patch subject: [PATCH bpf-next v3 1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt
config: x86_64-buildonly-randconfig-002-20250220 (https://download.01.org/0day-ci/archive/20250220/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250220/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

net/core/filter.c: In function 'sol_tcp_sockopt':

Quoted 1 line
Quoted 1 line

net/core/filter.c:5385:14: error: 'TCP_RTO_MAX_MS' undeclared (first use in this function); did you mean 'TCP_RTO_MAX'?

Quoted 8 lines
Quoted 4 lines
    5385 |         case TCP_RTO_MAX_MS:
         |              ^~~~~~~~~~~~~~
         |              TCP_RTO_MAX

net/core/filter.c:5385:14: note: each undeclared identifier is reported only once for each function it appears in

We've discussed this a few hours ago. It turned out to be the wrong branch which this series applied to. Please try bpf-next net branch instead :)

Thanks for the info, we will configure this branch in the bot side. Sorry for the false positive.

Quoted 4 lines

Thanks,
Jason

#5 lore raw

Re: [PATCH bpf-next v3 1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt

In reply to Jason Xing
kernel test robot noticed the following build errors:

Hi Jason,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Jason-Xing/bpf-support-TCP_RTO_MAX_MS-for-bpf_setsockopt/20250219-161637
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20250219081333.56378-2-kerneljasonxing%40gmail.com
patch subject: [PATCH bpf-next v3 1/2] bpf: support TCP_RTO_MAX_MS for bpf_setsockopt
config: i386-buildonly-randconfig-004-20250220 (https://download.01.org/0day-ci/archive/20250223/[email protected]/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250223/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

net/core/filter.c:1726:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
1726 | .arg3_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:2041:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
2041 | .arg1_type = ARG_PTR_TO_MEM | PTR_MAYBE_NULL | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
net/core/filter.c:2043:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
2043 | .arg3_type = ARG_PTR_TO_MEM | PTR_MAYBE_NULL | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
net/core/filter.c:2580:35: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
2580 | .arg2_type = ARG_PTR_TO_MEM | PTR_MAYBE_NULL | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
net/core/filter.c:4649:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
4649 | .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:4663:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
4663 | .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:4863:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
4863 | .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:4891:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
4891 | .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:5063:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
5063 | .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:5077:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
5077 | .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:5126:45: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
5126 | .arg1_type = ARG_PTR_TO_BTF_ID_SOCK_COMMON | PTR_MAYBE_NULL,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~

>> net/core/filter.c:5385:7: error: use of undeclared identifier 'TCP_RTO_MAX_MS'; did you mean 'TCA_RED_MAX_P'?
    5385 |         case TCP_RTO_MAX_MS:
         |              ^~~~~~~~~~~~~~
         |              TCA_RED_MAX_P
   include/uapi/linux/pkt_sched.h:258:2: note: 'TCA_RED_MAX_P' declared here
     258 |         TCA_RED_MAX_P,
         |         ^

net/core/filter.c:5562:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
5562 | .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:5596:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
5596 | .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:5630:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
5630 | .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:5664:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
5664 | .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:5839:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
5839 | .arg2_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:6376:46: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
6376 | .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_WRITE | MEM_ALIGNED,
| ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~
net/core/filter.c:6388:46: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
6388 | .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_WRITE | MEM_ALIGNED,
| ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~
net/core/filter.c:6474:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
6474 | .arg3_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
net/core/filter.c:6484:30: warning: bitwise operation between different enumeration types ('enum bpf_arg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
6484 | .arg3_type = ARG_PTR_TO_MEM | MEM_RDONLY,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
20 warnings and 1 error generated.

vim +5385 net/core/filter.c

5365
5366 static int sol_tcp_sockopt(struct sock *sk, int optname,
5367 char *optval, int *optlen,
5368 bool getopt)
5369 {
5370 if (sk->sk_protocol != IPPROTO_TCP)
5371 return -EINVAL;
5372
5373 switch (optname) {
5374 case TCP_NODELAY:
5375 case TCP_MAXSEG:
5376 case TCP_KEEPIDLE:
5377 case TCP_KEEPINTVL:
5378 case TCP_KEEPCNT:
5379 case TCP_SYNCNT:
5380 case TCP_WINDOW_CLAMP:
5381 case TCP_THIN_LINEAR_TIMEOUTS:
5382 case TCP_USER_TIMEOUT:
5383 case TCP_NOTSENT_LOWAT:
5384 case TCP_SAVE_SYN:

> 5385		case TCP_RTO_MAX_MS:

5386 if (*optlen != sizeof(int))
5387 return -EINVAL;
5388 break;
5389 case TCP_CONGESTION:
5390 return sol_tcp_sockopt_congestion(sk, optval, optlen, getopt);
5391 case TCP_SAVED_SYN:
5392 if (*optlen < 1)
5393 return -EINVAL;
5394 break;
5395 case TCP_BPF_SOCK_OPS_CB_FLAGS:
5396 if (*optlen != sizeof(int))
5397 return -EINVAL;
5398 if (getopt) {
5399 struct tcp_sock *tp = tcp_sk(sk);
5400 int cb_flags = tp->bpf_sock_ops_cb_flags;
5401
5402 memcpy(optval, &cb_flags, *optlen);
5403 return 0;
5404 }
5405 return bpf_sol_tcp_setsockopt(sk, optname, optval, *optlen);
5406 default:
5407 if (getopt)
5408 return -EINVAL;
5409 return bpf_sol_tcp_setsockopt(sk, optname, optval, *optlen);
5410 }
5411
5412 if (getopt) {
5413 if (optname == TCP_SAVED_SYN) {
5414 struct tcp_sock *tp = tcp_sk(sk);
5415
5416 if (!tp->saved_syn ||
5417 *optlen > tcp_saved_syn_len(tp->saved_syn))
5418 return -EINVAL;
5419 memcpy(optval, tp->saved_syn->data, *optlen);
5420 /* It cannot free tp->saved_syn here because it
5421 * does not know if the user space still needs it.
5422 */
5423 return 0;
5424 }
5425
5426 return do_tcp_getsockopt(sk, SOL_TCP, optname,
5427 KERNEL_SOCKPTR(optval),
5428 KERNEL_SOCKPTR(optlen));
5429 }
5430
5431 return do_tcp_setsockopt(sk, SOL_TCP, optname,
5432 KERNEL_SOCKPTR(optval), *optlen);
5433 }
5434

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki