mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-09-02 15:02:51 +08:00
stp: correct the timer tick rate (50 Hz, measured)
The timers assumed stp_timers() runs at 64 Hz. It does not: the main loop idles on the 200 Hz system tick and calls us every fourth pass, i.e. 50 Hz. Measured on hardware - with hello configured to 2 s the BPDUs left the port 2.560 s apart, exactly the 28 % overshoot the wrong constant implies, and every other timer (forward delay, max age, tx-hold refill) was stretched the same way. Move the constant to the header with the arithmetic spelled out, and use it in the status page too, which had the 64 hardcoded and therefore aged the same counters differently than the engine.
This commit is contained in:
+1
-1
@@ -643,7 +643,7 @@ void send_stp(void)
|
||||
itoa_html(stp_pp2p[pi_i]);
|
||||
/* designated info: a freshly heard BPDU wins, else we are the
|
||||
* segment's designated bridge and report our own values */
|
||||
stp_we_root = stp_dbridge[pi_i].mac[5] && stp_bpdu_age[pi_i] < (uint16_t)stp_maxage_s * 64;
|
||||
stp_we_root = stp_dbridge[pi_i].mac[5] && stp_bpdu_age[pi_i] < (uint16_t)stp_maxage_s * STP_HZ;
|
||||
slen += strtox(outbuf + slen, ",\"db\":\"");
|
||||
if (stp_we_root) {
|
||||
pi_prio = stp_dbridge[pi_i].prio; pi_ext = stp_dbridge[pi_i].ext;
|
||||
|
||||
Reference in New Issue
Block a user