stp: rename stpEnabled and take the comments out of the header

The variable lives in rtlplayground.c, so it is declared in rtl837x_common.h
with the others there, and it follows the naming of the rest.

The header carried comments on the externs that the definitions in
rtl837x_stp.c repeat, sometimes differently, which is one place too many to
keep in step. What only the header had, the value ranges and what the
designated arrays hold, moved to the definitions; the rest is gone. Function
declarations lost their comments too.

The status printer only prints, so its running commentary went. A define
replaces the bare 33 in stp_in(), and the note on the loop check is down to
what applies at that line.
This commit is contained in:
d00f
2026-08-18 23:32:25 +02:00
parent 81d11c246c
commit ec069a5bcc
6 changed files with 43 additions and 78 deletions
+14 -19
View File
@@ -6,8 +6,8 @@ void stp_in(void) __banked;
void stp_setup(void) __banked;
void stp_timers(void) __banked;
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 */
void stp_parse(void) __banked __reentrant;
void stp_defaults(void) __banked;
/* Tick rate of stp_timers(), also used by the web UI. */
#define STP_HZ 50
@@ -19,14 +19,12 @@ struct bridge {
uint8_t mac[6];
};
/* ---- Configuration (defaults per 802.1D-2004/802.1w, set in stp_defaults) --- */
extern __xdata uint8_t stpEnabled;
extern __xdata uint8_t stp_prio; /* bridge priority, high byte: 0x80 = 32768; CLI takes 0-15 (steps of 4096) */
extern __xdata uint8_t stp_hello_s; /* hello time, 1-10 s (default 2) */
extern __xdata uint8_t stp_maxage_s; /* max age, 6-40 s (default 20) */
extern __xdata uint8_t stp_fwddelay_s; /* forward delay, 4-30 s (default 15); our listen period */
extern __xdata uint8_t stp_rstp; /* 1 = RSTP BPDUs (v2), 0 = STP-compatible Config BPDUs (v0) */
extern __xdata uint8_t stp_txhold; /* max BPDUs per port per second (default 6) */
extern __xdata uint8_t stp_prio;
extern __xdata uint8_t stp_hello_s;
extern __xdata uint8_t stp_maxage_s;
extern __xdata uint8_t stp_fwddelay_s;
extern __xdata uint8_t stp_rstp;
extern __xdata uint8_t stp_txhold;
/* Per-port config/status flags (stp_pflags[]) */
#define STP_PF_ENABLED 0x01 /* port participates in STP (default on) */
@@ -39,21 +37,18 @@ extern __xdata uint8_t stp_txhold; /* max BPDUs per port per second (default 6)
#define STP_PF_TRIPPED 0x80 /* runtime: disabled by BPDU guard */
extern __xdata uint8_t stp_pflags[10];
extern __xdata uint32_t stp_pcost[10]; /* path cost; 0 = auto (20000) */
extern __xdata uint32_t stp_pcost[10];
extern __xdata uint8_t stp_pprio[10];
extern __xdata uint8_t stp_pp2p[10]; /* admin point-to-point: 0 auto, 1 on, 2 off */
extern __xdata uint8_t stp_pp2p[10];
/* Last-heard designated info per port (from received BPDUs); consult
* stp_bpdu_age to decide whether it is still current. */
extern __xdata struct bridge stp_dbridge[10];
extern __xdata uint16_t stp_dpid[10];
extern __xdata uint32_t stp_dcost[10];
extern __xdata uint16_t stp_bpdu_age[10]; /* ticks since a BPDU was heard */ /* port priority (default 0x80) */
extern __xdata uint16_t stp_bpdu_age[10];
/* ---- Status, exposed read-only for the web UI (send_stp) ---- */
extern __xdata struct bridge root_bridge;
extern __xdata uint32_t root_bridge_cost; /* our path cost to the root (0 if we are root) */
extern __xdata uint8_t stp_root_port; /* logical port towards the root; 0xff = we are root */
extern __xdata uint16_t stp_tc_count; /* topology change counter (diagnostics) */
extern __xdata uint32_t root_bridge_cost;
extern __xdata uint8_t stp_root_port;
extern __xdata uint16_t stp_tc_count;
#endif