Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tcp: clarify tcp_congestion_ops functions comments

The optional and required hints in the tcp_congestion_ops are information
for the user of this interface to signalize its importance when
implementing these functions.

However, cong_avoid comment incorrectly tells that it is required,
in reality congestion control must provide one of either cong_avoid or
cong_control.

In addition, min_tso_segs has not had any comment optional/required
hints. So mark it as optional since it is used only in BBR.

Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Daniel Sedlak <daniel.sedlak@cdn77.com>
Link: https://patch.msgid.link/20260105115533.1151442-1-daniel.sedlak@cdn77.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Daniel Sedlak and committed by
Jakub Kicinski
55ffb0b1 f6608679

+19 -10
+19 -10
include/net/tcp.h
··· 1243 1243 struct tcp_congestion_ops { 1244 1244 /* fast path fields are put first to fill one cache line */ 1245 1245 1246 + /* A congestion control (CC) must provide one of either: 1247 + * 1248 + * (a) a cong_avoid function, if the CC wants to use the core TCP 1249 + * stack's default functionality to implement a "classic" 1250 + * (Reno/CUBIC-style) response to packet loss, RFC3168 ECN, 1251 + * idle periods, pacing rate computations, etc. 1252 + * 1253 + * (b) a cong_control function, if the CC wants custom behavior and 1254 + * complete control of all congestion control behaviors. 1255 + */ 1256 + /* (a) "classic" response: calculate new cwnd. 1257 + */ 1258 + void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked); 1259 + /* (b) "custom" response: call when packets are delivered to update 1260 + * cwnd and pacing rate, after all the ca_state processing. 1261 + */ 1262 + void (*cong_control)(struct sock *sk, u32 ack, int flag, const struct rate_sample *rs); 1263 + 1246 1264 /* return slow start threshold (required) */ 1247 1265 u32 (*ssthresh)(struct sock *sk); 1248 - 1249 - /* do new cwnd calculation (required) */ 1250 - void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked); 1251 1266 1252 1267 /* call before changing ca_state (optional) */ 1253 1268 void (*set_state)(struct sock *sk, u8 new_state); ··· 1276 1261 /* hook for packet ack accounting (optional) */ 1277 1262 void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample); 1278 1263 1279 - /* override sysctl_tcp_min_tso_segs */ 1264 + /* override sysctl_tcp_min_tso_segs (optional) */ 1280 1265 u32 (*min_tso_segs)(struct sock *sk); 1281 - 1282 - /* call when packets are delivered to update cwnd and pacing rate, 1283 - * after all the ca_state processing. (optional) 1284 - */ 1285 - void (*cong_control)(struct sock *sk, u32 ack, int flag, const struct rate_sample *rs); 1286 - 1287 1266 1288 1267 /* new value of cwnd after loss (required) */ 1289 1268 u32 (*undo_cwnd)(struct sock *sk);