httpd: leave the L2 listing as it is on main

Listing by next-address also returned the reserved-multicast entries STP
writes, shown as port 1 with a delete button, while l2_delete() still
looks up by next-unicast and so removed the unicast entry after that
index instead. The change was there to show the LACP steering entries;
delivery by trap writes none, so it goes.
This commit is contained in:
d00f committed 2026-10-12 16:27:21 +02:00
1 parent 25040070e5
commit 0df48fbb1c
1 file changed
+4 -22
+4 -22
View File
@@ -409,19 +409,14 @@ void send_l2(uint16_t idx)
*/
__xdata uint16_t entry = idx & 0xfff;
__xdata uint16_t first_entry = 0xffff; // An illegal entry index
__xdata uint16_t mbr;
__bit first = true;
char_to_html('[');
while (1) {
entries_left--;
uint8_t port = 0;
uint8_t lag;
uint8_t mc = 0;
reg_read_m(RTL837x_TBL_DATA_0);
// Iterate with "next address" (method 2) so static multicast entries -
// an IGMP group entry, say - are listed too, not only learned or
// static unicast ones.
REG_WRITE(RTL837x_TBL_DATA_0, sfr_data[0], sfr_data[1] & 0xfc, sfr_data[2] | (TBL_LUTREAD_NEXT_ADDRESS << 6), sfr_data[3]);
REG_WRITE(RTL837x_TBL_DATA_0, sfr_data[0], sfr_data[1] & 0xfc, sfr_data[2] | (TBL_LUTREAD_NEXT_L2UC << 6), sfr_data[3]);
REG_WRITE(RTL837X_TBL_CTRL, entry >> 8, entry, TBL_L2_UNICAST, TBL_EXECUTE);
do {
@@ -429,7 +424,7 @@ void send_l2(uint16_t idx)
} while (sfr_data[3] & TBL_EXECUTE);
reg_read_m(RTL837x_L2_DATA_OUT_B);
__bit valid = (sfr_data[0] & 0x20) && !(sfr_data[0] & 0x10);
__bit valid = (sfr_data[0] & 0x20) != 0;
if (valid) {
/* separator + 74-byte worst-case entry + closing "]" */
if (slen + 76 > TCP_OUTBUF_SIZE)
@@ -438,8 +433,6 @@ void send_l2(uint16_t idx)
char_to_html(',');
first = false;
mc = sfr_data[2] & 0x01; // multicast MAC: member mask, no SPA/age
// VLAN, taken from the read above instead of reading the register twice
slen += strtox(outbuf + slen, "{\"vlan\":\"");
charhex_to_html(sfr_data[0] & 0x0f);
@@ -458,23 +451,12 @@ void send_l2(uint16_t idx)
// type
reg_read_m(RTL837x_L2_DATA_OUT_C);
if (mc || (sfr_data[1] & 0x1))
if (sfr_data[1] & 0x1)
slen += strtox(outbuf + slen, "\",\"type\":\"s\",\"port\":");
else
slen += strtox(outbuf + slen, "\",\"type\":\"l\",\"port\":");
if (mc) {
// Report the lowest member of the mask (an entry holding only
// the CPU port is rendered as "CPU" by the UI)
mbr = port | ((uint16_t)sfr_data[3] << 2);
port = 0;
while (mbr && !(mbr & 1)) {
mbr >>= 1;
port++;
}
} else {
port |= (sfr_data[3] & 0x3) << 2;
}
port |= (sfr_data[3] & 0x3) << 2;
itoa_html(port);
slen += strtox(outbuf + slen, ",\"lag\":");
lag = port_lag_of(port);