This is straight forward: All integer arguments are positive multiples
of `hz', hence it can be safely reduced and the now minimum sleep of one
tick is given already.
One call sleeps a constant amount of
(hz / 50) [ticks] = (hz / 50) / hz [s] = 1 / 50 [s] = 0.02 [s] = 20 [ms]
Runs fine on my APU2's PPPoE link to ISP.
Feedback? OK?
Index: if_pppoe.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppoe.c,v
retrieving revision 1.67
diff -u -p -r1.67 if_pppoe.c
--- if_pppoe.c 19 Feb 2018 08:59:52 -0000 1.67
+++ if_pppoe.c 15 Jun 2019 19:42:37 -0000
@@ -109,8 +109,8 @@ struct pppoetag {
PPPOE_ADD_16(PTR, SESS); \
PPPOE_ADD_16(PTR, LEN)
-#define PPPOE_DISC_TIMEOUT (hz*5) /* base for quick timeout
calculation */
-#define PPPOE_SLOW_RETRY (hz*60) /* persistent retry interval */
+#define PPPOE_DISC_TIMEOUT 5 /* base for quick timeout
calculation (seconds) */
+#define PPPOE_SLOW_RETRY 60 /* persistent retry interval
(seconds) */
#define PPPOE_DISC_MAXPADI 4 /* retry PADI four times
(quickly) */
#define PPPOE_DISC_MAXPADR 2 /* retry PADR twice */
@@ -579,7 +579,7 @@ breakbreak:
PPPOEDEBUG(("%s: failed to send PADR, error=%d\n",
sc->sc_sppp.pp_if.if_xname, err));
}
- timeout_add(&sc->sc_timeout,
+ timeout_add_sec(&sc->sc_timeout,
PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried));
break;
@@ -1086,7 +1086,7 @@ pppoe_timeout(void *arg)
PPPOEDEBUG(("%s: failed to transmit PADI, error=%d\n",
sc->sc_sppp.pp_if.if_xname, err));
}
- timeout_add(&sc->sc_timeout, retry_wait);
+ timeout_add_sec(&sc->sc_timeout, retry_wait);
splx(x);
break;
@@ -1102,7 +1102,7 @@ pppoe_timeout(void *arg)
PPPOEDEBUG(("%s: failed to send PADI,
error=%d\n",
sc->sc_sppp.pp_if.if_xname, err));
}
- timeout_add(&sc->sc_timeout,
+ timeout_add_sec(&sc->sc_timeout,
PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried));
splx(x);
break;
@@ -1112,7 +1112,7 @@ pppoe_timeout(void *arg)
PPPOEDEBUG(("%s: failed to send PADR, error=%d\n",
sc->sc_sppp.pp_if.if_xname, err));
}
- timeout_add(&sc->sc_timeout,
+ timeout_add_sec(&sc->sc_timeout,
PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried));
splx(x);
@@ -1146,7 +1146,7 @@ pppoe_connect(struct pppoe_softc *sc)
PPPOEDEBUG(("%s: failed to send PADI, error=%d\n",
sc->sc_sppp.pp_if.if_xname, err));
- timeout_add(&sc->sc_timeout, PPPOE_DISC_TIMEOUT);
+ timeout_add_sec(&sc->sc_timeout, PPPOE_DISC_TIMEOUT);
splx(x);
return (err);
@@ -1346,7 +1346,7 @@ pppoe_tlf(struct sppp *sp)
* function and defer disconnecting to the timeout handler.
*/
sc->sc_state = PPPOE_STATE_CLOSING;
- timeout_add(&sc->sc_timeout, hz / 50);
+ timeout_add_msec(&sc->sc_timeout, 20);
}
static void