Add mtu support in http server

This commit is contained in:
logicog
2025-12-22 23:28:50 +01:00
parent 67fbad38ce
commit 51345a07e6
4 changed files with 115 additions and 15 deletions
+2
View File
@@ -570,6 +570,8 @@ void httpd_appcall(void)
send_eee();
} else if (is_word(q, "/mirror.json")) {
send_mirror();
} else if (is_word(q, "/mtu.json")) {
send_mtu();
} else if (is_word(q, "/lag.json")) {
send_lag();
} else if (is_word(q, "/config")) {
+22
View File
@@ -380,6 +380,28 @@ void send_eee(void)
}
}
void send_mtu(void)
{
print_string("send_mtu called\n");
slen = strtox(outbuf, HTTP_RESPONCE_JSON);
char_to_html('[');
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) {
slen += strtox(outbuf + slen, "{\"portNum\":");
itoa_html(machine.log_to_phys_port[i]);
slen += strtox(outbuf + slen, ",\"mtu\":\"0x");
reg_read_m(RTL8373_REG_MAC_L2_PORT_MAX_LEN + ((uint16_t) i << 8));
uint16_t mtu = SFR_DATA_U16 & 0x3fff;
byte_to_html(mtu >> 8);
byte_to_html(mtu & 0xff);
char_to_html('"');
char_to_html('}');
if (i < machine.max_port)
char_to_html(',');
else
char_to_html(']');
}
}
void send_status(void)
{
+1
View File
@@ -7,6 +7,7 @@ void send_vlan(uint16_t vlan);
void send_basic_info(void);
void send_eee(void);
void send_mirror(void);
void send_mtu(void);
void send_config(void);
void send_cmd_log(void);
void send_lag(void);