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