Page MenuHomeFreeBSD

tcp: use enum for all congestion control signals
ClosedPublic

Authored by rscheff on Feb 11 2024, 6:09 PM.
Tags
None
Referenced Files
F102075338: D43838.id134930.diff
Thu, Nov 7, 7:48 AM
Unknown Object (File)
Sun, Oct 27, 6:29 PM
Unknown Object (File)
Thu, Oct 24, 2:03 AM
Unknown Object (File)
Wed, Oct 23, 11:25 PM
Unknown Object (File)
Sat, Oct 19, 2:52 PM
Unknown Object (File)
Fri, Oct 11, 12:22 AM
Unknown Object (File)
Sep 30 2024, 8:48 AM
Unknown Object (File)
Sep 27 2024, 1:32 PM

Details

Summary

Facilitate easier troubleshooting by enumerating
all congestion control signals. Typecast the
enum to int, when a cc module uses private signals.
While there, ensure that the currently used
private signals are unique too. While not strictly
necessary to use individual bits, retain the
possibility of combined signals for the future.

No external change.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 56078
Build 52967: arc lint + arc unit

Event Timeline

glebius added inline comments.
sys/netinet/cc/cc_cdg.c
457

Did compiler ask you to add the cast? enums are ints by standard, so if compiler did, that means something is off here. If it did not, there is no reason for this cast.

rscheff added inline comments.
sys/netinet/cc/cc_cdg.c
457

Yes. The "private" signals are not part of the enum, and if a cc module wants to refer to them in a switch{}, the cast is necessary to silence that warning; cc_cdg, cc_chd and cc_vegas make use of these private signals. The alternative would be to add CC_CDG_DELAY, CC_CHD_DELAY, and CC_VEGAS_DELAY into cc.h as global enums.

I thought to leave these only in the scope of the respective cc module, and do the cast to int instead.

sys/netinet/cc/cc_cdg.c
457

I see. Unfortunately enums are not expandable. One hack that can be done is this:

#define CC_GENERIC_ENUM  CC_ACK = 1, CC_DUPACK = .......................

enum cdgsignal_t {CC_GENERIC_ENUM, CC_CDG_DELAY = ...};

Probably using int cast is simpler.

rscheff added inline comments.
sys/netinet/cc/cc_cdg.c
457

Presumably, if you create a new type, for gdb to consistenly decode these private signals, you would have to use that type in the function definition - which would collide with the cc module function block definition; so to compile, you'd typecast within the switch, and loose gdb visibility again. So probably not much gain after all...

rscheff marked an inline comment as done.
  • rebase main
This revision is now accepted and ready to land.Feb 22 2024, 3:54 PM