Allowing commands like port 1 lldp block and port 2 lldp permit

so we are able to enable/disable lldp transmission on a specific
port.
This commit is contained in:
Rob Emery committed 2026-10-10 09:50:01 +01:00
1 parent cedc795b82
commit 4f1a2f04d8
3 files changed
+13

No files matched your search

+9
View File
@@ -881,6 +881,7 @@ void parse_port(void)
cmd_error("\nUsage:" \
"\nport <port> [show|on|off]" \
"\nport <port> [10m|100m|1g|2g5|duplex] [half|full]" \
"\nport <port> lldp [block|permit]" \
"\nport <port> name [custom port name]\n");
return;
}
@@ -966,6 +967,14 @@ void parse_port(void)
else
phy_settings.duplex = PHY_DUPLEX_HALF;
phy_set_duplex();
} else if (cmd_compare(2, "lldp")) {
if (cmd_compare(3, "block")){
lldp_port_status &= ~(1 << phy_settings.port);
} else if (cmd_compare(3, "permit")) {
lldp_port_status |= 1 << phy_settings.port;
} else {
print_string ("Unknown port <port> lldp [block|permit] command\n");
}
} else {
cmd_error("Unknown port command\n");
}
+1
View File
@@ -131,6 +131,7 @@ struct flash_region_t {
};
extern __xdata char port_names[9][PORT_NAME_SIZE];
extern __xdata uint16_t lldp_port_status;
extern __xdata bool stp_enabled;
+3
View File
@@ -14,6 +14,7 @@ extern __xdata bool lldp_enabled;
extern __code const struct machine machine;
__xdata uint8_t lldp_seconds;
__xdata uint16_t lldp_port_status = 0xffff;
void lldp_init(void) __banked
{
@@ -109,11 +110,13 @@ void lldp_send(void) __banked __reentrant
for (uint8_t port = machine.min_port; port <= machine.max_port; port++) {
if ((1 << machine.log_to_phys_port[port]) & lldp_port_status) {
LLDP_O->payload[port_position] = '0' + machine.log_to_phys_port[port];
LLDP_O->rtl_tag.pmask = HTONS((uint16_t)1 << port);
tcpip_output();
}
}
}
void lldp_set_addresses(void) __banked {