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:
@@ -9,6 +9,13 @@ void stp_off(void) __banked;
|
||||
void stp_parse(void) __banked __reentrant; /* "stp ..." CLI handler (cmd_parser delegates here) */
|
||||
void stp_defaults(void) __banked; /* boot init: 802.1D/w default configuration */
|
||||
|
||||
/* Tick rate of stp_timers(): the main loop idles on the 200 Hz system tick
|
||||
* and rtlplayground.c calls us every (STP_TICK_DIVIDER + 1) = 4th pass.
|
||||
* Measured on hardware: hello 2 s produced BPDUs exactly 2.560 s apart with
|
||||
* the previous value of 64, i.e. 20 ms per tick - every configured timer ran
|
||||
* 28 % long. Shared with the web UI, which ages the same counters. */
|
||||
#define STP_HZ 50
|
||||
|
||||
/* Bridge identifier as carried in a BPDU (priority, extension, MAC). */
|
||||
struct bridge {
|
||||
uint8_t prio;
|
||||
|
||||
Reference in New Issue
Block a user