git: db2ce6914b6a - main - sctp: plug set-but-not-used vars

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Tue, 19 Apr 2022 12:46:08 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=db2ce6914b6a5f5f40f12d5daf1cc81767fc8610

commit db2ce6914b6a5f5f40f12d5daf1cc81767fc8610
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-04-19 12:32:24 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-04-19 12:45:57 +0000

    sctp: plug set-but-not-used vars
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netinet/sctp_cc_functions.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c
index c5b031199a01..342b4126698b 100644
--- a/sys/netinet/sctp_cc_functions.c
+++ b/sys/netinet/sctp_cc_functions.c
@@ -54,6 +54,12 @@ __FBSDID("$FreeBSD$");
 #define SHIFT_MPTCP_MULTI_Z 16
 #define SHIFT_MPTCP_MULTI 8
 
+#ifdef KDTRACE_HOOOKS
+#define __dtrace
+#else
+#define	__dtrace	__unused
+#endif
+
 static void
 sctp_enforce_cwnd_limit(struct sctp_association *assoc, struct sctp_nets *net)
 {
@@ -252,7 +258,7 @@ static int
 cc_bw_same(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw,
     uint64_t rtt_offset, uint64_t vtag, uint8_t inst_ind)
 {
-	uint64_t oth, probepoint;
+	uint64_t oth __dtrace, probepoint __dtrace;
 
 	probepoint = (((uint64_t)net->cwnd) << 32);
 	if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) {
@@ -387,7 +393,7 @@ static int
 cc_bw_decrease(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t rtt_offset,
     uint64_t vtag, uint8_t inst_ind)
 {
-	uint64_t oth, probepoint;
+	uint64_t oth __dtrace, probepoint __dtrace;
 
 	/* Bandwidth decreased. */
 	probepoint = (((uint64_t)net->cwnd) << 32);
@@ -527,7 +533,7 @@ out_decision:
 static int
 cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t vtag)
 {
-	uint64_t oth, probepoint;
+	uint64_t oth __dtrace, probepoint __dtrace;
 
 	/*
 	 * BW increased, so update and return 0, since all actions in our
@@ -571,7 +577,7 @@ static int
 cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw)
 {
 	uint64_t bw_offset, rtt_offset;
-	uint64_t probepoint, rtt, vtag;
+	uint64_t probepoint __dtrace, rtt, vtag;
 	uint64_t bytes_for_this_rtt, inst_bw;
 	uint64_t div, inst_off;
 	int bw_shift;
@@ -684,7 +690,7 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
     int accum_moved, int reneged_all SCTP_UNUSED, int will_exit, int use_rtcc)
 {
 	struct sctp_nets *net;
-	int old_cwnd;
+	int old_cwnd __dtrace;
 	uint32_t t_ssthresh, incr;
 	uint64_t t_ucwnd_sbw;
 	uint64_t t_path_mptcp;
@@ -797,7 +803,7 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
 					continue;
 				}
 			} else {
-				uint64_t vtag, probepoint;
+				uint64_t vtag __dtrace, probepoint __dtrace;
 
 				probepoint = (((uint64_t)net->cwnd) << 32);
 				probepoint |= ((0xa << 16) | 0);
@@ -995,7 +1001,7 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
 static void
 sctp_cwnd_update_exit_pf_common(struct sctp_tcb *stcb, struct sctp_nets *net)
 {
-	int old_cwnd;
+	int old_cwnd __dtrace;
 
 	old_cwnd = net->cwnd;
 	net->cwnd = net->mtu;
@@ -1336,7 +1342,7 @@ static void
 sctp_cwnd_new_rtcc_transmission_begins(struct sctp_tcb *stcb,
     struct sctp_nets *net)
 {
-	uint64_t vtag, probepoint;
+	uint64_t vtag __dtrace, probepoint __dtrace;
 
 	if (net->cc_mod.rtcc.lbw) {
 		/* Clear the old bw.. we went to 0 in-flight */
@@ -1399,7 +1405,11 @@ static void
 sctp_set_rtcc_initial_cc_param(struct sctp_tcb *stcb,
     struct sctp_nets *net)
 {
+#ifdef KDTRACE_HOOOKS
 	uint64_t vtag, probepoint;
+#else
+	uint64_t vtag __unused, probepoint __unused;
+#endif
 
 	sctp_set_initial_cc_param(stcb, net);
 	stcb->asoc.use_precise_time = 1;