* Re: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
2026-06-01 9:18 [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size Eric Dumazet
@ 2026-06-01 10:17 ` Matthieu Baerts
2026-06-01 17:52 ` kernel test robot
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Matthieu Baerts @ 2026-06-01 10:17 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, Mat Martineau,
Geliang Tang, netdev, eric.dumazet
Hi Eric,
On 01/06/2026 19:18, Eric Dumazet wrote:
> Instead of passing opt_size address to mptcp_established_options(),
> change this function to return it by value.
>
> This removes the need for an expensive stack canary in
> tcp_established_options() when CONFIG_STACKPROTECTOR_STRONG=y.
>
> $ scripts/bloat-o-meter -t vmlinux.old vmlinux.new
> add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-92 (-92)
> Function old new delta
> tcp_options_write.isra 1423 1407 -16
> mptcp_established_options 2746 2720 -26
> tcp_established_options 553 503 -50
> Total: Before=22110750, After=22110658, chg -0.00%
Thank you for looking at that!
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index f7263fe2a2e40b507257c3720cc2d78d37357d6d..cd4639beceaa53c573135ddaeb7528a80b4ca824 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -149,9 +149,9 @@ bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
> unsigned int *size, struct mptcp_out_options *opts);
> bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
> struct mptcp_out_options *opts);
> -bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
> - unsigned int *size, unsigned int remaining,
> - struct mptcp_out_options *opts);
> +int mptcp_established_options(struct sock *sk, struct sk_buff *skb,
> + unsigned int remaining,
> + struct mptcp_out_options *opts);
> bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb);
>
> void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp,
> @@ -266,13 +266,13 @@ static inline bool mptcp_synack_options(const struct request_sock *req,
> return false;
> }
>
> -static inline bool mptcp_established_options(struct sock *sk,
> - struct sk_buff *skb,
> - unsigned int *size,
> - unsigned int remaining,
> - struct mptcp_out_options *opts)
> +static inline int mptcp_established_options(struct sock *sk,
> + struct sk_buff *skb,
> + unsigned int *size,
I guess this line should be removed: that's the version when MPTCP is
not enabled.
Apart from that, the rest looks good to me!
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
2026-06-01 9:18 [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size Eric Dumazet
2026-06-01 10:17 ` Matthieu Baerts
@ 2026-06-01 17:52 ` kernel test robot
2026-06-02 2:09 ` kernel test robot
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-06-01 17:52 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: llvm, oe-kbuild-all, Simon Horman, Neal Cardwell,
Kuniyuki Iwashima, Matthieu Baerts, Mat Martineau, Geliang Tang,
netdev, eric.dumazet, Eric Dumazet
Hi Eric,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/mptcp-change-mptcp_established_options-to-return-opt_size/20260601-174435
base: net-next/main
patch link: https://lore.kernel.org/r/20260601091816.444738-1-edumazet%40google.com
patch subject: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260601/202606011921.XxnF0IB7-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260601/202606011921.XxnF0IB7-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606011921.XxnF0IB7-lkp@intel.com/
All errors (new ones prefixed by >>):
>> net/ipv4/tcp_output.c:1187:24: error: too few arguments to function call, expected 5, have 4
1186 | opt_size = mptcp_established_options(sk, skb, remaining,
| ~~~~~~~~~~~~~~~~~~~~~~~~~
1187 | &opts->mptcp);
| ^
include/net/mptcp.h:269:19: note: 'mptcp_established_options' declared here
269 | static inline int mptcp_established_options(struct sock *sk,
| ^ ~~~~~~~~~~~~~~~~
270 | struct sk_buff *skb,
| ~~~~~~~~~~~~~~~~~~~~
271 | unsigned int *size,
| ~~~~~~~~~~~~~~~~~~~
272 | unsigned int remaining,
| ~~~~~~~~~~~~~~~~~~~~~~~
273 | struct mptcp_out_options *opts)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
vim +1187 net/ipv4/tcp_output.c
1145
1146 /* Compute TCP options for ESTABLISHED sockets. This is not the
1147 * final wire format yet.
1148 */
1149 static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb,
1150 struct tcp_out_options *opts,
1151 struct tcp_key *key)
1152 {
1153 struct tcp_sock *tp = tcp_sk(sk);
1154 unsigned int size = 0;
1155 unsigned int eff_sacks;
1156
1157 opts->options = 0;
1158
1159 /* Better than switch (key.type) as it has static branches */
1160 if (tcp_key_is_md5(key)) {
1161 opts->options |= OPTION_MD5;
1162 size += TCPOLEN_MD5SIG_ALIGNED;
1163 } else if (tcp_key_is_ao(key)) {
1164 opts->options |= OPTION_AO;
1165 size += tcp_ao_len_aligned(key->ao_key);
1166 }
1167
1168 if (likely(tp->rx_opt.tstamp_ok)) {
1169 opts->options |= OPTION_TS;
1170 opts->tsval = skb ? tcp_skb_timestamp_ts(tp->tcp_usec_ts, skb) +
1171 tp->tsoffset : 0;
1172 opts->tsecr = tp->rx_opt.ts_recent;
1173 size += TCPOLEN_TSTAMP_ALIGNED;
1174 }
1175
1176 /* MPTCP options have precedence over SACK for the limited TCP
1177 * option space because a MPTCP connection would be forced to
1178 * fall back to regular TCP if a required multipath option is
1179 * missing. SACK still gets a chance to use whatever space is
1180 * left.
1181 */
1182 if (sk_is_mptcp(sk)) {
1183 unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1184 int opt_size;
1185
1186 opt_size = mptcp_established_options(sk, skb, remaining,
> 1187 &opts->mptcp);
1188 if (opt_size >= 0) {
1189 opts->options |= OPTION_MPTCP;
1190 size += opt_size;
1191 }
1192 }
1193
1194 eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;
1195 if (unlikely(eff_sacks)) {
1196 const unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1197 if (likely(remaining >= TCPOLEN_SACK_BASE_ALIGNED +
1198 TCPOLEN_SACK_PERBLOCK)) {
1199 opts->num_sack_blocks =
1200 min_t(unsigned int, eff_sacks,
1201 (remaining - TCPOLEN_SACK_BASE_ALIGNED) /
1202 TCPOLEN_SACK_PERBLOCK);
1203
1204 size += TCPOLEN_SACK_BASE_ALIGNED +
1205 opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK;
1206 } else {
1207 opts->num_sack_blocks = 0;
1208 }
1209 } else {
1210 opts->num_sack_blocks = 0;
1211 }
1212
1213 if (tcp_ecn_mode_accecn(tp)) {
1214 int ecn_opt = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn_option);
1215
1216 if (ecn_opt && tp->saw_accecn_opt &&
1217 (ecn_opt >= TCP_ACCECN_OPTION_PERSIST ||
1218 !tcp_accecn_opt_fail_send(tp)) &&
1219 (ecn_opt >= TCP_ACCECN_OPTION_FULL || tp->accecn_opt_demand ||
1220 tcp_accecn_option_beacon_check(sk))) {
1221 opts->use_synack_ecn_bytes = 0;
1222 size += tcp_options_fit_accecn(opts, tp->accecn_minlen,
1223 MAX_TCP_OPTION_SPACE - size);
1224 }
1225 }
1226
1227 if (unlikely(BPF_SOCK_OPS_TEST_FLAG(tp,
1228 BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG))) {
1229 unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1230
1231 bpf_skops_hdr_opt_len(sk, skb, NULL, NULL, 0, opts, &remaining);
1232
1233 size = MAX_TCP_OPTION_SPACE - remaining;
1234 }
1235
1236 return size;
1237 }
1238
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
2026-06-01 9:18 [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size Eric Dumazet
2026-06-01 10:17 ` Matthieu Baerts
2026-06-01 17:52 ` kernel test robot
@ 2026-06-02 2:09 ` kernel test robot
2026-06-02 2:19 ` kernel test robot
2026-06-02 3:52 ` kernel test robot
4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-06-02 2:09 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: oe-kbuild-all, Simon Horman, Neal Cardwell, Kuniyuki Iwashima,
Matthieu Baerts, Mat Martineau, Geliang Tang, netdev,
eric.dumazet, Eric Dumazet
Hi Eric,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/mptcp-change-mptcp_established_options-to-return-opt_size/20260601-174435
base: net-next/main
patch link: https://lore.kernel.org/r/20260601091816.444738-1-edumazet%40google.com
patch subject: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
config: i386-randconfig-007-20260602 (https://download.01.org/0day-ci/archive/20260602/202606021033.Gt2vODEq-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260602/202606021033.Gt2vODEq-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606021033.Gt2vODEq-lkp@intel.com/
All errors (new ones prefixed by >>):
net/ipv4/tcp_output.c: In function 'tcp_established_options':
>> net/ipv4/tcp_output.c:1186:63: error: passing argument 3 of 'mptcp_established_options' makes pointer from integer without a cast [-Wint-conversion]
1186 | opt_size = mptcp_established_options(sk, skb, remaining,
| ^~~~~~~~~
| |
| unsigned int
In file included from include/net/tcp.h:44,
from net/ipv4/tcp_output.c:40:
include/net/mptcp.h:271:59: note: expected 'unsigned int *' but argument is of type 'unsigned int'
271 | unsigned int *size,
| ~~~~~~~~~~~~~~^~~~
>> net/ipv4/tcp_output.c:1187:54: error: passing argument 4 of 'mptcp_established_options' makes integer from pointer without a cast [-Wint-conversion]
1187 | &opts->mptcp);
| ^~~~~~~~~~~~
| |
| struct mptcp_out_options *
include/net/mptcp.h:272:58: note: expected 'unsigned int' but argument is of type 'struct mptcp_out_options *'
272 | unsigned int remaining,
| ~~~~~~~~~~~~~^~~~~~~~~
>> net/ipv4/tcp_output.c:1186:28: error: too few arguments to function 'mptcp_established_options'
1186 | opt_size = mptcp_established_options(sk, skb, remaining,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/net/mptcp.h:269:19: note: declared here
269 | static inline int mptcp_established_options(struct sock *sk,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
vim +/mptcp_established_options +1186 net/ipv4/tcp_output.c
1145
1146 /* Compute TCP options for ESTABLISHED sockets. This is not the
1147 * final wire format yet.
1148 */
1149 static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb,
1150 struct tcp_out_options *opts,
1151 struct tcp_key *key)
1152 {
1153 struct tcp_sock *tp = tcp_sk(sk);
1154 unsigned int size = 0;
1155 unsigned int eff_sacks;
1156
1157 opts->options = 0;
1158
1159 /* Better than switch (key.type) as it has static branches */
1160 if (tcp_key_is_md5(key)) {
1161 opts->options |= OPTION_MD5;
1162 size += TCPOLEN_MD5SIG_ALIGNED;
1163 } else if (tcp_key_is_ao(key)) {
1164 opts->options |= OPTION_AO;
1165 size += tcp_ao_len_aligned(key->ao_key);
1166 }
1167
1168 if (likely(tp->rx_opt.tstamp_ok)) {
1169 opts->options |= OPTION_TS;
1170 opts->tsval = skb ? tcp_skb_timestamp_ts(tp->tcp_usec_ts, skb) +
1171 tp->tsoffset : 0;
1172 opts->tsecr = tp->rx_opt.ts_recent;
1173 size += TCPOLEN_TSTAMP_ALIGNED;
1174 }
1175
1176 /* MPTCP options have precedence over SACK for the limited TCP
1177 * option space because a MPTCP connection would be forced to
1178 * fall back to regular TCP if a required multipath option is
1179 * missing. SACK still gets a chance to use whatever space is
1180 * left.
1181 */
1182 if (sk_is_mptcp(sk)) {
1183 unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1184 int opt_size;
1185
> 1186 opt_size = mptcp_established_options(sk, skb, remaining,
> 1187 &opts->mptcp);
1188 if (opt_size >= 0) {
1189 opts->options |= OPTION_MPTCP;
1190 size += opt_size;
1191 }
1192 }
1193
1194 eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;
1195 if (unlikely(eff_sacks)) {
1196 const unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1197 if (likely(remaining >= TCPOLEN_SACK_BASE_ALIGNED +
1198 TCPOLEN_SACK_PERBLOCK)) {
1199 opts->num_sack_blocks =
1200 min_t(unsigned int, eff_sacks,
1201 (remaining - TCPOLEN_SACK_BASE_ALIGNED) /
1202 TCPOLEN_SACK_PERBLOCK);
1203
1204 size += TCPOLEN_SACK_BASE_ALIGNED +
1205 opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK;
1206 } else {
1207 opts->num_sack_blocks = 0;
1208 }
1209 } else {
1210 opts->num_sack_blocks = 0;
1211 }
1212
1213 if (tcp_ecn_mode_accecn(tp)) {
1214 int ecn_opt = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn_option);
1215
1216 if (ecn_opt && tp->saw_accecn_opt &&
1217 (ecn_opt >= TCP_ACCECN_OPTION_PERSIST ||
1218 !tcp_accecn_opt_fail_send(tp)) &&
1219 (ecn_opt >= TCP_ACCECN_OPTION_FULL || tp->accecn_opt_demand ||
1220 tcp_accecn_option_beacon_check(sk))) {
1221 opts->use_synack_ecn_bytes = 0;
1222 size += tcp_options_fit_accecn(opts, tp->accecn_minlen,
1223 MAX_TCP_OPTION_SPACE - size);
1224 }
1225 }
1226
1227 if (unlikely(BPF_SOCK_OPS_TEST_FLAG(tp,
1228 BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG))) {
1229 unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1230
1231 bpf_skops_hdr_opt_len(sk, skb, NULL, NULL, 0, opts, &remaining);
1232
1233 size = MAX_TCP_OPTION_SPACE - remaining;
1234 }
1235
1236 return size;
1237 }
1238
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
2026-06-01 9:18 [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size Eric Dumazet
` (2 preceding siblings ...)
2026-06-02 2:09 ` kernel test robot
@ 2026-06-02 2:19 ` kernel test robot
2026-06-02 3:52 ` kernel test robot
4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-06-02 2:19 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: oe-kbuild-all, Simon Horman, Neal Cardwell, Kuniyuki Iwashima,
Matthieu Baerts, Mat Martineau, Geliang Tang, netdev,
eric.dumazet, Eric Dumazet
Hi Eric,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/mptcp-change-mptcp_established_options-to-return-opt_size/20260601-174435
base: net-next/main
patch link: https://lore.kernel.org/r/20260601091816.444738-1-edumazet%40google.com
patch subject: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
config: powerpc-arches_defconfig (https://download.01.org/0day-ci/archive/20260602/202606021023.2uNktNr0-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260602/202606021023.2uNktNr0-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606021023.2uNktNr0-lkp@intel.com/
All errors (new ones prefixed by >>):
net/ipv4/tcp_output.c: In function 'tcp_established_options':
net/ipv4/tcp_output.c:1186:63: error: passing argument 3 of 'mptcp_established_options' makes pointer from integer without a cast [-Wint-conversion]
1186 | opt_size = mptcp_established_options(sk, skb, remaining,
| ^~~~~~~~~
| |
| unsigned int
net/ipv4/tcp_output.c:1186:63: note: possible fix: take the address with '&'
1186 | opt_size = mptcp_established_options(sk, skb, remaining,
| ^~~~~~~~~
| &
In file included from include/net/tcp.h:44,
from net/ipv4/tcp_output.c:40:
include/net/mptcp.h:271:59: note: expected 'unsigned int *' but argument is of type 'unsigned int'
271 | unsigned int *size,
| ~~~~~~~~~~~~~~^~~~
net/ipv4/tcp_output.c:1187:54: error: passing argument 4 of 'mptcp_established_options' makes integer from pointer without a cast [-Wint-conversion]
1187 | &opts->mptcp);
| ^~~~~~~~~~~~
| |
| struct mptcp_out_options *
include/net/mptcp.h:272:58: note: expected 'unsigned int' but argument is of type 'struct mptcp_out_options *'
272 | unsigned int remaining,
| ~~~~~~~~~~~~~^~~~~~~~~
>> net/ipv4/tcp_output.c:1186:28: error: too few arguments to function 'mptcp_established_options'; expected 5, have 4
1186 | opt_size = mptcp_established_options(sk, skb, remaining,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/net/mptcp.h:269:19: note: declared here
269 | static inline int mptcp_established_options(struct sock *sk,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
vim +/mptcp_established_options +1186 net/ipv4/tcp_output.c
1145
1146 /* Compute TCP options for ESTABLISHED sockets. This is not the
1147 * final wire format yet.
1148 */
1149 static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb,
1150 struct tcp_out_options *opts,
1151 struct tcp_key *key)
1152 {
1153 struct tcp_sock *tp = tcp_sk(sk);
1154 unsigned int size = 0;
1155 unsigned int eff_sacks;
1156
1157 opts->options = 0;
1158
1159 /* Better than switch (key.type) as it has static branches */
1160 if (tcp_key_is_md5(key)) {
1161 opts->options |= OPTION_MD5;
1162 size += TCPOLEN_MD5SIG_ALIGNED;
1163 } else if (tcp_key_is_ao(key)) {
1164 opts->options |= OPTION_AO;
1165 size += tcp_ao_len_aligned(key->ao_key);
1166 }
1167
1168 if (likely(tp->rx_opt.tstamp_ok)) {
1169 opts->options |= OPTION_TS;
1170 opts->tsval = skb ? tcp_skb_timestamp_ts(tp->tcp_usec_ts, skb) +
1171 tp->tsoffset : 0;
1172 opts->tsecr = tp->rx_opt.ts_recent;
1173 size += TCPOLEN_TSTAMP_ALIGNED;
1174 }
1175
1176 /* MPTCP options have precedence over SACK for the limited TCP
1177 * option space because a MPTCP connection would be forced to
1178 * fall back to regular TCP if a required multipath option is
1179 * missing. SACK still gets a chance to use whatever space is
1180 * left.
1181 */
1182 if (sk_is_mptcp(sk)) {
1183 unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1184 int opt_size;
1185
> 1186 opt_size = mptcp_established_options(sk, skb, remaining,
1187 &opts->mptcp);
1188 if (opt_size >= 0) {
1189 opts->options |= OPTION_MPTCP;
1190 size += opt_size;
1191 }
1192 }
1193
1194 eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;
1195 if (unlikely(eff_sacks)) {
1196 const unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1197 if (likely(remaining >= TCPOLEN_SACK_BASE_ALIGNED +
1198 TCPOLEN_SACK_PERBLOCK)) {
1199 opts->num_sack_blocks =
1200 min_t(unsigned int, eff_sacks,
1201 (remaining - TCPOLEN_SACK_BASE_ALIGNED) /
1202 TCPOLEN_SACK_PERBLOCK);
1203
1204 size += TCPOLEN_SACK_BASE_ALIGNED +
1205 opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK;
1206 } else {
1207 opts->num_sack_blocks = 0;
1208 }
1209 } else {
1210 opts->num_sack_blocks = 0;
1211 }
1212
1213 if (tcp_ecn_mode_accecn(tp)) {
1214 int ecn_opt = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn_option);
1215
1216 if (ecn_opt && tp->saw_accecn_opt &&
1217 (ecn_opt >= TCP_ACCECN_OPTION_PERSIST ||
1218 !tcp_accecn_opt_fail_send(tp)) &&
1219 (ecn_opt >= TCP_ACCECN_OPTION_FULL || tp->accecn_opt_demand ||
1220 tcp_accecn_option_beacon_check(sk))) {
1221 opts->use_synack_ecn_bytes = 0;
1222 size += tcp_options_fit_accecn(opts, tp->accecn_minlen,
1223 MAX_TCP_OPTION_SPACE - size);
1224 }
1225 }
1226
1227 if (unlikely(BPF_SOCK_OPS_TEST_FLAG(tp,
1228 BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG))) {
1229 unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1230
1231 bpf_skops_hdr_opt_len(sk, skb, NULL, NULL, 0, opts, &remaining);
1232
1233 size = MAX_TCP_OPTION_SPACE - remaining;
1234 }
1235
1236 return size;
1237 }
1238
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
2026-06-01 9:18 [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size Eric Dumazet
` (3 preceding siblings ...)
2026-06-02 2:19 ` kernel test robot
@ 2026-06-02 3:52 ` kernel test robot
4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-06-02 3:52 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: oe-kbuild-all, Simon Horman, Neal Cardwell, Kuniyuki Iwashima,
Matthieu Baerts, Mat Martineau, Geliang Tang, netdev,
eric.dumazet, Eric Dumazet
Hi Eric,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/mptcp-change-mptcp_established_options-to-return-opt_size/20260601-174435
base: net-next/main
patch link: https://lore.kernel.org/r/20260601091816.444738-1-edumazet%40google.com
patch subject: [PATCH net-next] mptcp: change mptcp_established_options() to return opt_size
config: nios2-defconfig (https://download.01.org/0day-ci/archive/20260602/202606021113.tfn0OswA-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260602/202606021113.tfn0OswA-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606021113.tfn0OswA-lkp@intel.com/
All warnings (new ones prefixed by >>):
net/ipv4/tcp_output.c: In function 'tcp_established_options':
>> net/ipv4/tcp_output.c:1186:63: warning: passing argument 3 of 'mptcp_established_options' makes pointer from integer without a cast [-Wint-conversion]
1186 | opt_size = mptcp_established_options(sk, skb, remaining,
| ^~~~~~~~~
| |
| unsigned int
In file included from include/net/tcp.h:44,
from net/ipv4/tcp_output.c:40:
include/net/mptcp.h:271:59: note: expected 'unsigned int *' but argument is of type 'unsigned int'
271 | unsigned int *size,
| ~~~~~~~~~~~~~~^~~~
>> net/ipv4/tcp_output.c:1187:54: warning: passing argument 4 of 'mptcp_established_options' makes integer from pointer without a cast [-Wint-conversion]
1187 | &opts->mptcp);
| ^~~~~~~~~~~~
| |
| struct mptcp_out_options *
In file included from include/net/tcp.h:44,
from net/ipv4/tcp_output.c:40:
include/net/mptcp.h:272:58: note: expected 'unsigned int' but argument is of type 'struct mptcp_out_options *'
272 | unsigned int remaining,
| ~~~~~~~~~~~~~^~~~~~~~~
net/ipv4/tcp_output.c:1186:28: error: too few arguments to function 'mptcp_established_options'
1186 | opt_size = mptcp_established_options(sk, skb, remaining,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/net/tcp.h:44,
from net/ipv4/tcp_output.c:40:
include/net/mptcp.h:269:19: note: declared here
269 | static inline int mptcp_established_options(struct sock *sk,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
vim +/mptcp_established_options +1186 net/ipv4/tcp_output.c
1145
1146 /* Compute TCP options for ESTABLISHED sockets. This is not the
1147 * final wire format yet.
1148 */
1149 static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb,
1150 struct tcp_out_options *opts,
1151 struct tcp_key *key)
1152 {
1153 struct tcp_sock *tp = tcp_sk(sk);
1154 unsigned int size = 0;
1155 unsigned int eff_sacks;
1156
1157 opts->options = 0;
1158
1159 /* Better than switch (key.type) as it has static branches */
1160 if (tcp_key_is_md5(key)) {
1161 opts->options |= OPTION_MD5;
1162 size += TCPOLEN_MD5SIG_ALIGNED;
1163 } else if (tcp_key_is_ao(key)) {
1164 opts->options |= OPTION_AO;
1165 size += tcp_ao_len_aligned(key->ao_key);
1166 }
1167
1168 if (likely(tp->rx_opt.tstamp_ok)) {
1169 opts->options |= OPTION_TS;
1170 opts->tsval = skb ? tcp_skb_timestamp_ts(tp->tcp_usec_ts, skb) +
1171 tp->tsoffset : 0;
1172 opts->tsecr = tp->rx_opt.ts_recent;
1173 size += TCPOLEN_TSTAMP_ALIGNED;
1174 }
1175
1176 /* MPTCP options have precedence over SACK for the limited TCP
1177 * option space because a MPTCP connection would be forced to
1178 * fall back to regular TCP if a required multipath option is
1179 * missing. SACK still gets a chance to use whatever space is
1180 * left.
1181 */
1182 if (sk_is_mptcp(sk)) {
1183 unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1184 int opt_size;
1185
> 1186 opt_size = mptcp_established_options(sk, skb, remaining,
> 1187 &opts->mptcp);
1188 if (opt_size >= 0) {
1189 opts->options |= OPTION_MPTCP;
1190 size += opt_size;
1191 }
1192 }
1193
1194 eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;
1195 if (unlikely(eff_sacks)) {
1196 const unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1197 if (likely(remaining >= TCPOLEN_SACK_BASE_ALIGNED +
1198 TCPOLEN_SACK_PERBLOCK)) {
1199 opts->num_sack_blocks =
1200 min_t(unsigned int, eff_sacks,
1201 (remaining - TCPOLEN_SACK_BASE_ALIGNED) /
1202 TCPOLEN_SACK_PERBLOCK);
1203
1204 size += TCPOLEN_SACK_BASE_ALIGNED +
1205 opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK;
1206 } else {
1207 opts->num_sack_blocks = 0;
1208 }
1209 } else {
1210 opts->num_sack_blocks = 0;
1211 }
1212
1213 if (tcp_ecn_mode_accecn(tp)) {
1214 int ecn_opt = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn_option);
1215
1216 if (ecn_opt && tp->saw_accecn_opt &&
1217 (ecn_opt >= TCP_ACCECN_OPTION_PERSIST ||
1218 !tcp_accecn_opt_fail_send(tp)) &&
1219 (ecn_opt >= TCP_ACCECN_OPTION_FULL || tp->accecn_opt_demand ||
1220 tcp_accecn_option_beacon_check(sk))) {
1221 opts->use_synack_ecn_bytes = 0;
1222 size += tcp_options_fit_accecn(opts, tp->accecn_minlen,
1223 MAX_TCP_OPTION_SPACE - size);
1224 }
1225 }
1226
1227 if (unlikely(BPF_SOCK_OPS_TEST_FLAG(tp,
1228 BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG))) {
1229 unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
1230
1231 bpf_skops_hdr_opt_len(sk, skb, NULL, NULL, 0, opts, &remaining);
1232
1233 size = MAX_TCP_OPTION_SPACE - remaining;
1234 }
1235
1236 return size;
1237 }
1238
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread