mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
port: pin the management MAC to the CPU port with a static L2 entry
The CPU's own MAC exists in the L2 table only as a learned entry, created whenever the CPU transmits, and it ages out like any other dynamic entry. Unknown unicast is not flooded to the CPU port, so on an idle switch (no web session, no management traffic) the entry expires after the aging time and frames for the management IP no longer reach the CPU: pings die until the next CPU transmission (an ARP reply) re-teaches the entry, then die again. Real management sessions keep the entry alive continuously, which is why this is only visible on idle switches. Install a static entry for the management MAC on the CPU port after the startup config has been replayed, so it lands in the final management VLAN, and move it when the management VLAN is changed at runtime. Entry mechanics, established on hardware: a table write with read-method 0 hashes the key in TBL_DATA_IN and places the entry itself (a search returns index 0 on a miss, there is no software-visible insertion slot). The age field in the third data word must be non-zero for the entry to be visible to lookup at all, and the static flag (bit 0 of byte 1 of that word) stops the aging engine from decrementing it: with the flag a full-age entry survives untouched where an identical unflagged entry ages to invisible within the aging period. With no management VLAN configured the entry lives in VLAN 1.
This commit is contained in:
1 parent
4c8e0ce975
commit
3b8dba6e87
4 files changed
+60
No files matched your search
@@ -48,6 +48,7 @@ __xdata uint16_t vlan_ptr;
|
||||
__xdata char port_names[9][PORT_NAME_SIZE];
|
||||
|
||||
extern __xdata uint16_t management_vlan;
|
||||
extern __xdata struct uip_eth_addr uip_ethaddr;
|
||||
extern __xdata uint8_t sfp_speed[2];
|
||||
extern __xdata uint8_t sfp_pins_last;
|
||||
extern __xdata uint8_t sfp_options[2];
|
||||
@@ -476,7 +477,9 @@ void parse_vlan(void)
|
||||
vlan_settings.vlan = atoi_results_short;
|
||||
|
||||
if (cmd_compare(2, "mgmt")) {
|
||||
port_l2_static_mgmt(uip_ethaddr.addr, management_vlan, true);
|
||||
management_vlan = vlan_settings.vlan;
|
||||
port_l2_static_mgmt(uip_ethaddr.addr, management_vlan, false);
|
||||
if (!vlan_settings.vlan)
|
||||
print_string("Management VLAN disabled\n");
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user