Page MenuHomeFreeBSD

tcp: improve tcp_ecn by using switch statements and bit-shifting
ClosedPublic

Authored by rscheff on Jan 23 2024, 2:49 PM.
Tags
None
Referenced Files
F170181884: D43560.id133197.diff
Thu, Sep 3, 6:35 PM
F170180234: D43560.diff
Thu, Sep 3, 6:26 PM
F170178281: D43560.id133197.diff
Thu, Sep 3, 6:12 PM
F170167269: D43560.id.diff
Thu, Sep 3, 5:26 PM
F170157788: D43560.id133284.diff
Thu, Sep 3, 4:47 PM
Unknown Object (File)
Tue, Sep 1, 10:37 PM
Unknown Object (File)
Tue, Sep 1, 6:37 PM
Unknown Object (File)
Tue, Sep 1, 6:32 PM
Subscribers

Details

Summary

In order to improve readability, use switch statements to
differentiate between the different ECN signallings.

Also, access the ACE field by bit-shifting instead checking
each flag individually.

No change in behaviour.

Diff Detail

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

Event Timeline

P.S. There are so many sysctl toggles that ask for SYSCTL_INT_MINMAX() macro, to avoid coding out yet another value checking function but to block user from entering invalid value.

sys/netinet/tcp_ecn.c
103

AFAIK, these should be one liners per style(9).

129

Not sure it is documented, but usual habit is to leave default: as the last case.

  • remove default case, as falling through and returning is the correct action.
sys/netinet/tcp_ecn.c
236

The indentation looks strange here...

rscheff marked an inline comment as done.
  • remove default: when no special action is necessary
  • place statemens after case: in new line
  • add /* FALLTHROUGH */ comments per style(9)
This revision is now accepted and ready to land.Jan 25 2024, 8:28 PM