Author: tuexen
Date: Mon May 21 14:53:22 2018
New Revision: 333981
URL: https://svnweb.freebsd.org/changeset/base/333981

Log:
  Only fillin data srucuture when actually stored.

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c Mon May 21 14:52:18 2018        (r333980)
+++ head/sys/netinet/sctputil.c Mon May 21 14:53:22 2018        (r333981)
@@ -72,7 +72,8 @@ extern const struct sctp_ss_functions sctp_ss_function
 void
 sctp_sblog(struct sockbuf *sb, struct sctp_tcb *stcb, int from, int incr)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.sb.stcb = stcb;
        sctp_clog.x.sb.so_sbcc = sb->sb_cc;
@@ -88,12 +89,14 @@ sctp_sblog(struct sockbuf *sb, struct sctp_tcb *stcb, 
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_closing(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int16_t loc)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.close.inp = (void *)inp;
        sctp_clog.x.close.sctp_flags = inp->sctp_flags;
@@ -112,12 +115,14 @@ sctp_log_closing(struct sctp_inpcb *inp, struct sctp_t
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 rto_logging(struct sctp_nets *net, int from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        memset(&sctp_clog, 0, sizeof(sctp_clog));
        sctp_clog.x.rto.net = (void *)net;
@@ -129,12 +134,14 @@ rto_logging(struct sctp_nets *net, int from)
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_strm_del_alt(struct sctp_tcb *stcb, uint32_t tsn, uint16_t sseq, 
uint16_t stream, int from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.strlog.stcb = stcb;
        sctp_clog.x.strlog.n_tsn = tsn;
@@ -149,12 +156,14 @@ sctp_log_strm_del_alt(struct sctp_tcb *stcb, uint32_t 
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_nagle_event(struct sctp_tcb *stcb, int action)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.nagle.stcb = (void *)stcb;
        sctp_clog.x.nagle.total_flight = stcb->asoc.total_flight;
@@ -168,12 +177,14 @@ sctp_log_nagle_event(struct sctp_tcb *stcb, int action
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_sack(uint32_t old_cumack, uint32_t cumack, uint32_t tsn, uint16_t 
gaps, uint16_t dups, int from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.sack.cumack = cumack;
        sctp_clog.x.sack.oldcumack = old_cumack;
@@ -187,12 +198,14 @@ sctp_log_sack(uint32_t old_cumack, uint32_t cumack, ui
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_map(uint32_t map, uint32_t cum, uint32_t high, int from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        memset(&sctp_clog, 0, sizeof(sctp_clog));
        sctp_clog.x.map.base = map;
@@ -205,12 +218,14 @@ sctp_log_map(uint32_t map, uint32_t cum, uint32_t high
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, int 
from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        memset(&sctp_clog, 0, sizeof(sctp_clog));
        sctp_clog.x.fr.largest_tsn = biggest_tsn;
@@ -223,13 +238,15 @@ sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 #ifdef SCTP_MBUF_LOGGING
 void
 sctp_log_mb(struct mbuf *m, int from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.mb.mp = m;
        sctp_clog.x.mb.mbuf_flags = (uint8_t)(SCTP_BUF_GET_FLAGS(m));
@@ -249,6 +266,7 @@ sctp_log_mb(struct mbuf *m, int from)
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
@@ -265,7 +283,8 @@ sctp_log_mbc(struct mbuf *m, int from)
 void
 sctp_log_strm_del(struct sctp_queued_to_read *control, struct 
sctp_queued_to_read *poschk, int from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        if (control == NULL) {
                SCTP_PRINTF("Gak log of NULL?\n");
@@ -289,12 +308,14 @@ sctp_log_strm_del(struct sctp_queued_to_read *control,
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net, int augment, 
uint8_t from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.cwnd.net = net;
        if (stcb->asoc.send_queue_cnt > 255)
@@ -324,12 +345,14 @@ sctp_log_cwnd(struct sctp_tcb *stcb, struct sctp_nets 
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        memset(&sctp_clog, 0, sizeof(sctp_clog));
        if (inp) {
@@ -368,12 +391,14 @@ sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb 
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_nets *net, int error, int 
burst, uint8_t from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        memset(&sctp_clog, 0, sizeof(sctp_clog));
        sctp_clog.x.cwnd.net = net;
@@ -395,12 +420,14 @@ sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_n
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_rwnd(uint8_t from, uint32_t peers_rwnd, uint32_t snd_size, uint32_t 
overhead)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.rwnd.rwnd = peers_rwnd;
        sctp_clog.x.rwnd.send_size = snd_size;
@@ -413,12 +440,14 @@ sctp_log_rwnd(uint8_t from, uint32_t peers_rwnd, uint3
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_rwnd_set(uint8_t from, uint32_t peers_rwnd, uint32_t flight_size, 
uint32_t overhead, uint32_t a_rwndval)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.rwnd.rwnd = peers_rwnd;
        sctp_clog.x.rwnd.send_size = flight_size;
@@ -431,13 +460,15 @@ sctp_log_rwnd_set(uint8_t from, uint32_t peers_rwnd, u
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 #ifdef SCTP_MBCNT_LOGGING
 static void
 sctp_log_mbcnt(uint8_t from, uint32_t total_oq, uint32_t book, uint32_t 
total_mbcnt_q, uint32_t mbcnt)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.mbcnt.total_queue_size = total_oq;
        sctp_clog.x.mbcnt.size_change = book;
@@ -450,22 +481,26 @@ sctp_log_mbcnt(uint8_t from, uint32_t total_oq, uint32
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 #endif
 
 void
 sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d)
 {
+#if defined(SCTP_LOCAL_TRACE_BUF)
        SCTP_CTR6(KTR_SCTP, "SCTP:%d[%d]:%x-%x-%x-%x",
            SCTP_LOG_MISC_EVENT,
            from,
            a, b, c, d);
+#endif
 }
 
 void
 sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_cnt, int from)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.wake.stcb = (void *)stcb;
        sctp_clog.x.wake.wake_cnt = wake_cnt;
@@ -506,12 +541,14 @@ sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_c
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 void
 sctp_log_block(uint8_t from, struct sctp_association *asoc, size_t sendlen)
 {
-       struct sctp_cwnd_log sctp_clog __unused;
+#if defined(SCTP_LOCAL_TRACE_BUF)
+       struct sctp_cwnd_log sctp_clog;
 
        sctp_clog.x.blk.onsb = asoc->total_output_queue_size;
        sctp_clog.x.blk.send_sent_qcnt = (uint16_t)(asoc->send_queue_cnt + 
asoc->sent_queue_cnt);
@@ -527,6 +564,7 @@ sctp_log_block(uint8_t from, struct sctp_association *
            sctp_clog.x.misc.log2,
            sctp_clog.x.misc.log3,
            sctp_clog.x.misc.log4);
+#endif
 }
 
 int
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to