git: 59884aea8b98 - main - tcp: clean up macro useage in tcp_fixed_maxseg()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 07 May 2024 20:14:07 UTC
The branch main has been updated by rscheff:
URL: https://cgit.FreeBSD.org/src/commit/?id=59884aea8b98781ecc7ad2d490a9210aab750de3
commit 59884aea8b98781ecc7ad2d490a9210aab750de3
Author: Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2024-05-04 08:42:42 +0000
Commit: Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2024-05-04 11:04:25 +0000
tcp: clean up macro useage in tcp_fixed_maxseg()
Replace local PAD macro with PADTCPOLEN macro
No functional change.
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D45076
---
sys/netinet/tcp_subr.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 306053ae8289..b17231a243f1 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -3530,7 +3530,6 @@ tcp_maxseg(const struct tcpcb *tp)
if (tp->t_flags & TF_SACK_PERMIT)
optlen += PADTCPOLEN(TCPOLEN_SACK_PERMITTED);
}
-#undef PAD
optlen = min(optlen, TCP_MAXOLEN);
return (tp->t_maxseg - optlen);
}
@@ -3552,7 +3551,6 @@ tcp_fixed_maxseg(const struct tcpcb *tp)
* for cc modules to figure out what the modulo of the
* cwnd should be.
*/
-#define PAD(len) ((((len) / 4) + !!((len) % 4)) * 4)
if (TCPS_HAVEESTABLISHED(tp->t_state)) {
if (tp->t_flags & TF_RCVD_TSTMP)
optlen = TCPOLEN_TSTAMP_APPA;
@@ -3560,23 +3558,22 @@ tcp_fixed_maxseg(const struct tcpcb *tp)
optlen = 0;
#if defined(IPSEC_SUPPORT) || defined(TCP_SIGNATURE)
if (tp->t_flags & TF_SIGNATURE)
- optlen += PAD(TCPOLEN_SIGNATURE);
+ optlen += PADTCPOLEN(TCPOLEN_SIGNATURE);
#endif
} else {
if (tp->t_flags & TF_REQ_TSTMP)
optlen = TCPOLEN_TSTAMP_APPA;
else
- optlen = PAD(TCPOLEN_MAXSEG);
+ optlen = PADTCPOLEN(TCPOLEN_MAXSEG);
if (tp->t_flags & TF_REQ_SCALE)
- optlen += PAD(TCPOLEN_WINDOW);
+ optlen += PADTCPOLEN(TCPOLEN_WINDOW);
#if defined(IPSEC_SUPPORT) || defined(TCP_SIGNATURE)
if (tp->t_flags & TF_SIGNATURE)
- optlen += PAD(TCPOLEN_SIGNATURE);
+ optlen += PADTCPOLEN(TCPOLEN_SIGNATURE);
#endif
if (tp->t_flags & TF_SACK_PERMIT)
- optlen += PAD(TCPOLEN_SACK_PERMITTED);
+ optlen += PADTCPOLEN(TCPOLEN_SACK_PERMITTED);
}
-#undef PAD
optlen = min(optlen, TCP_MAXOLEN);
return (tp->t_maxseg - optlen);
}