Commit Graph
10 Commits
Author SHA1 Message Date
Rob Emery 30ffbf0b47 Merge pull request #588 from DrDoof/feat/lldp-tx
lldp: complete the transmitted TLVs and announce shutdown
2026-10-29 12:28:16 +00:00
d00f bf77a7f1c5 lldp: time the transmit interval from the system tick
lldp_tick counted main-loop passes, so the 6000 meant for 30 s at
SYS_TICK_HZ ran at whatever rate the loop happened to have, and the
interval moved with httpd and SFP load. Step once per second from the
tick counter like the STP timers do, count seconds to the interval and
derive the TTL from it with the 802.1AB hold multiplier of 4.
2026-10-14 13:06:02 +02:00
d00f 2481810906 lacp: tidy up after review
Move port_bit() to rtl837x_common.h as PORT_BIT(), a uint16_t shift,
and MAC_ADDR_LEN from rtl837x_lldp.h next to it, and use MAC_ADDR_LEN
for every address in the LACP code instead of a literal 6. Define
lacp_mux_update() before its first caller and drop the forward
declaration, declare variables at the top of their blocks, put the
operator at the end of a continued line, drop the field value comments
of the LACPDU struct, and leave lacp_port_lag to lacp_init() instead of
initialising it in the test environment.
2026-10-14 00:55:11 +02:00
d00f 12b85025e3 lldp: announce shutdown with a TTL of 0
lldp off and port <n> lldp block went silent and left the neighbour
holding our entry until its TTL ran out, 120 s later. Send one LLDPDU
with a TTL of 0 on the ports that stop, the shutdown form 802.1AB
defines for this, before the transmit mask changes.
2026-10-13 04:00:32 +02:00
d00f 0e2d940765 lldp: advertise system capabilities and the management address
Neighbours could not tell a bridge from a host and had no address to
reach us on. Add the System Capabilities TLV (bridge, enabled) and a
Management Address TLV with the IPv4 address, left out while the
address is still 0.0.0.0. Size the payload buffer for the frame it can
now hold: 64 bytes did not cover a 23 character hostname next to the
longer model names.
2026-10-13 04:00:17 +02:00
d00f 677536dd74 lldp: send the port id as an interface name
The Port ID TLV carried a single digit with the locally assigned
subtype, so a neighbour listed us as port "3". Send "Port 3" with the
interface name subtype instead, the form the port keeps in the CLI and
the web UI.
2026-10-13 04:00:17 +02:00
Rob Emery 9b2bd7f1b8 The tick rate has been changed now so we'll have to approximate
timing with ticks

Fixing up the log_to_phys_port assignment

2000 is about every 10 seconds, so scaling up to once every 30ish

Removing the attempt to block lldp frames,
This does not work however the hard work has been done for us in
the #514 so we can borrow that work later on
2026-10-10 09:50:38 +01:00
Rob Emery ccf541a06b Refactor and golfing from https://github.com/logicog/RTLPlayground/pull/398#issuecomment-5654087271
I've tweaked it a little to keep the port_position in as I think
that is clearer than a random "12" in the loop later on
2026-10-10 09:50:01 +01:00
Rob Emery 3eacc9c8a5 LLPD_MAC_ADDR_LEN -> MAC_ADDR_LEN and memcopy instead of manually setting bytes 2026-10-10 09:50:01 +01:00
Rob Emery 1ebee4d6e9 Implementing basic LLDP server, should send port_id message
to each port once every 30 seconds.
* Additionally fixes the on-ward passing of LLDP frames through
the switch

The ports on the case are marked 1-8 so this should reflect that
rather than being 0-based

We can send the hostname as well, this can be dynamically allocated

Let's send the model as the system description as well
2026-10-10 09:49:24 +01:00