Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Convert SYN_CACHE_TIMER_ARM macro to static inli...



details:   https://anonhg.NetBSD.org/src/rev/f221b7594ae3
branches:  trunk
changeset: 357565:f221b7594ae3
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Nov 15 09:56:31 2017 +0000

description:
Convert SYN_CACHE_TIMER_ARM macro to static inline function (NFC)

diffstat:

 sys/netinet/tcp_input.c |  28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diffs (70 lines):

diff -r 40a145b4cab4 -r f221b7594ae3 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Wed Nov 15 09:55:22 2017 +0000
+++ b/sys/netinet/tcp_input.c   Wed Nov 15 09:56:31 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.362 2017/11/15 09:55:22 ozaki-r Exp $  */
+/*     $NetBSD: tcp_input.c,v 1.363 2017/11/15 09:56:31 ozaki-r Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.362 2017/11/15 09:55:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.363 2017/11/15 09:56:31 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3652,14 +3652,16 @@
  * We don't estimate RTT with SYNs, so each packet starts with the default
  * RTT and each timer step has a fixed timeout value.
  */
-#define        SYN_CACHE_TIMER_ARM(sc)                                         \
-do {                                                                   \
-       TCPT_RANGESET((sc)->sc_rxtcur,                                  \
-           TCPTV_SRTTDFLT * tcp_backoff[(sc)->sc_rxtshift], TCPTV_MIN, \
-           TCPTV_REXMTMAX);                                            \
-       callout_reset(&(sc)->sc_timer,                                  \
-           (sc)->sc_rxtcur * (hz / PR_SLOWHZ), syn_cache_timer, (sc)); \
-} while (/*CONSTCOND*/0)
+static inline void
+syn_cache_timer_arm(struct syn_cache *sc)
+{
+
+       TCPT_RANGESET(sc->sc_rxtcur,
+           TCPTV_SRTTDFLT * tcp_backoff[sc->sc_rxtshift], TCPTV_MIN,
+           TCPTV_REXMTMAX);
+       callout_reset(&sc->sc_timer,
+           sc->sc_rxtcur * (hz / PR_SLOWHZ), syn_cache_timer, sc);
+}
 
 #define        SYN_CACHE_TIMESTAMP(sc) (tcp_now - (sc)->sc_timebase)
 
@@ -3782,7 +3784,7 @@
         */
        sc->sc_rxttot = 0;
        sc->sc_rxtshift = 0;
-       SYN_CACHE_TIMER_ARM(sc);
+       syn_cache_timer_arm(sc);
 
        /* Link it from tcpcb entry */
        LIST_INSERT_HEAD(&tp->t_sc, sc, sc_tpq);
@@ -3835,7 +3837,7 @@
 
        /* Advance the timer back-off. */
        sc->sc_rxtshift++;
-       SYN_CACHE_TIMER_ARM(sc);
+       syn_cache_timer_arm(sc);
 
        goto out;
 
@@ -4513,7 +4515,7 @@
                 * syn_cache_put() will try to schedule the timer, so
                 * we need to initialize it
                 */
-               SYN_CACHE_TIMER_ARM(sc);
+               syn_cache_timer_arm(sc);
                syn_cache_put(sc);
                splx(s);
                TCP_STATINC(TCP_STAT_SC_DROPPED);



Home | Main Index | Thread Index | Old Index