to_flags is currently a 64-bit integer; however, we only use 7 bits.
Furthermore, there is no reason this needs to be a 64-bit integer for the forseeable future. Also, there is an inconsistency between to_flags and the mask in tcp_addoptions(). Before r195654, to_flags was a u_long and the mask in tcp_addoptions() was a u_int. r195654 changed to_flags to be a u_int64_t but left the mask in tcp_addoptions() as a u_int, meaning that these variables will only be the same width on platforms with 64-bit integers. Convert both to_flags and the mask in tcp_addoptions() to be explicitly 32-bit variables. This may save a few cycles on 32-bit platforms, and avoids unnecessarily mixing types. Differential Revision: https://reviews.freebsd.org/D5584 Reviewed by: hiren MFC after: 2 weeks Sponsored by: Juniper Networks
This commit is contained in:
parent
9901091eba
commit
5d20f97461
@ -1652,7 +1652,7 @@ tcp_setpersist(struct tcpcb *tp)
|
||||
int
|
||||
tcp_addoptions(struct tcpopt *to, u_char *optp)
|
||||
{
|
||||
u_int mask, optlen = 0;
|
||||
u_int32_t mask, optlen = 0;
|
||||
|
||||
for (mask = 1; mask < TOF_MAXOPT; mask <<= 1) {
|
||||
if ((to->to_flags & mask) != mask)
|
||||
|
@ -364,7 +364,7 @@ struct tcpcb {
|
||||
* options in tcp_addoptions.
|
||||
*/
|
||||
struct tcpopt {
|
||||
u_int64_t to_flags; /* which options are present */
|
||||
u_int32_t to_flags; /* which options are present */
|
||||
#define TOF_MSS 0x0001 /* maximum segment size */
|
||||
#define TOF_SCALE 0x0002 /* window scaling */
|
||||
#define TOF_SACKPERM 0x0004 /* SACK permitted */
|
||||
|
Loading…
Reference in New Issue
Block a user