diff --git a/html/l2.js b/html/l2.js index 3d41d89a..9df0c75d 100644 --- a/html/l2.js +++ b/html/l2.js @@ -68,7 +68,11 @@ var l2SortCol = 'port'; var l2SortDir = 1; function l2Key(e, col) { - if (col === 'port') return e.port === 'CPU' ? Number.MAX_SAFE_INTEGER : Number(e.port); + if (col === 'port') { + if (e.port === 'CPU') return Number.MAX_SAFE_INTEGER; + if (e.lag) return 100 + e.lag; + return Number(e.port); + } if (col === 'vlan') return Number(e.vlan); return String(e[col]).toLowerCase(); } @@ -114,7 +118,11 @@ function fillL2(s) return; s.sort(l2CMP); s = uniq(s); - l2All = s; + l2All = s.map(function(e) { + if (e.lag) + e.port = 'LAG' + e.lag; + return e; + }); renderL2(); } diff --git a/httpd/page_impl.c b/httpd/page_impl.c index 313a652e..b99f0b9b 100644 --- a/httpd/page_impl.c +++ b/httpd/page_impl.c @@ -359,6 +359,7 @@ void send_l2(uint16_t idx) while (1) { entries_left--; uint8_t port = 0; + uint8_t lag; reg_read_m(RTL837x_TBL_DATA_0); REG_WRITE(RTL837x_TBL_DATA_0, sfr_data[0], sfr_data[1] & 0xfc, sfr_data[2] | (TBL_LUTREAD_NEXT_L2UC << 6), sfr_data[3]); @@ -402,6 +403,9 @@ void send_l2(uint16_t idx) port |= (sfr_data[3] & 0x3) << 2; itoa_html(port); + slen += strtox(outbuf + slen, ",\"lag\":"); + lag = port_lag_of(port); + itoa_html(lag == PORT_LAG_NONE ? 0 : lag + 1); } // Index diff --git a/rtl837x_port.c b/rtl837x_port.c index 1c966728..950766eb 100644 --- a/rtl837x_port.c +++ b/rtl837x_port.c @@ -381,6 +381,7 @@ void port_l2_learned(void) __banked while (1) { uint8_t port = 0; + uint8_t lag; reg_read_m(RTL837x_TBL_DATA_0); REG_WRITE(RTL837x_TBL_DATA_0, sfr_data[0], sfr_data[1],sfr_data[2] | 0xc0, sfr_data[3]); @@ -422,7 +423,13 @@ void port_l2_learned(void) __banked print_string("\tlearned\t"); port |= (sfr_data[3] & 0x3) << 2; - print_phys_port(port); + lag = port_lag_of(port); + if (lag == PORT_LAG_NONE) { + print_phys_port(port); + } else { + print_string("LAG"); + itoa(lag + 1); + } } entry++;