In order to allow stricter type checking,
convert KTLS related magic numbers to enum.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 56362 Build 53250: arc lint + arc unit
Event Timeline
sys/sys/ktls.h | ||
---|---|---|
151 | Why do you move the definition from tcp.h to ktls.h? At least the names sound to be TCP specific. |
sys/sys/ktls.h | ||
---|---|---|
151 | To minimize header churn; many drivers don't actually use tcp.h (and use the universally availabe int) prior to enum. But all drivers with tls offload to use ktls.h. with the typedef in tcp.h, ktls.h would also have to come past tcp.h. overall this was more of a test case, if the -Wswitch for clang would properly catch missing default / incomplete enum conditions in switch statements throughout the tree (and it worked, my clang caught the missing default in uipc_ktls.c. I used the phabricator to get this patch from my local machine to the beefy build vm I allocated the other day. But then again, I think using enums more broadly, and thus allowing the compiler to type-check and verify style(9) would have a few benefits... |
Note that the mode is tcp.h because it is a user-facing API (you can use it with setsockopt/getsockopt) and needs to stay in tcp.h
sys/kern/uipc_ktls.c | ||
---|---|---|
1941 | This should be __assert_unreachable(). It is not a reachable case (and a false positive from the compiler warning). | |
sys/netinet/tcp_usrreq.c | ||
2663 | I'm not a super fan of the cast and assuming that the enum aliases to an int. I would rather have a local variable in this function of the right type that is assigned to optval before the call to sooptcopyout. |
Please use mbuf_tstmp2timespec(), somebody might add more precision to it one day.