mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Add backend support for bandwidth control
This commit is contained in:
@@ -586,6 +586,8 @@ void httpd_appcall(void)
|
|||||||
send_counters(q[20]-'0');
|
send_counters(q[20]-'0');
|
||||||
} else if (is_word(q, "/eee.json")) {
|
} else if (is_word(q, "/eee.json")) {
|
||||||
send_eee();
|
send_eee();
|
||||||
|
} else if (is_word(q, "/bandwidth.json")) {
|
||||||
|
send_bandwidth();
|
||||||
} else if (is_word(q, "/l2.json")) {
|
} else if (is_word(q, "/l2.json")) {
|
||||||
parse_short(q + 13); // e.g.: /l2.json?idx=10
|
parse_short(q + 13); // e.g.: /l2.json?idx=10
|
||||||
send_l2(short_parsed);
|
send_l2(short_parsed);
|
||||||
|
|||||||
@@ -546,6 +546,50 @@ void send_eee(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void send_bandwidth(void)
|
||||||
|
{
|
||||||
|
dbg_string("send_bandwidth 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, ",\"iLimited\":");
|
||||||
|
reg_read_m(RTL837X_IGBW_PORT_CTRL + i * 4);
|
||||||
|
if (sfr_data[1] & 0x10)
|
||||||
|
char_to_html('1');
|
||||||
|
else
|
||||||
|
char_to_html('0');
|
||||||
|
slen += strtox(outbuf + slen, ",\"iBW\":\"");
|
||||||
|
byte_to_html(sfr_data[1] & 0x0f);
|
||||||
|
byte_to_html(sfr_data[2]);
|
||||||
|
byte_to_html(sfr_data[3]);
|
||||||
|
slen += strtox(outbuf + slen, "\",\"iFC\":");
|
||||||
|
if (reg_bit_test(RTL837X_IGBW_PORT_FC_CTRL, i))
|
||||||
|
char_to_html('1');
|
||||||
|
else
|
||||||
|
char_to_html('0');
|
||||||
|
reg_read_m(RTL837X_EGBW_PORT_CTRL + i * 1024);
|
||||||
|
slen += strtox(outbuf + slen, ",\"eLimited\":");
|
||||||
|
if (sfr_data[1] & 0x10)
|
||||||
|
char_to_html('1');
|
||||||
|
else
|
||||||
|
char_to_html('0');
|
||||||
|
slen += strtox(outbuf + slen, ",\"eBW\":\"");
|
||||||
|
byte_to_html(sfr_data[1] & 0x0f);
|
||||||
|
byte_to_html(sfr_data[2]);
|
||||||
|
byte_to_html(sfr_data[3]);
|
||||||
|
char_to_html('"');
|
||||||
|
char_to_html('}');
|
||||||
|
if (i < machine.max_port)
|
||||||
|
char_to_html(',');
|
||||||
|
else
|
||||||
|
char_to_html(']');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void send_mtu(void)
|
void send_mtu(void)
|
||||||
{
|
{
|
||||||
dbg_string("send_mtu called\n");
|
dbg_string("send_mtu called\n");
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ void send_counters(char port);
|
|||||||
void send_status(void);
|
void send_status(void);
|
||||||
void send_vlan(uint16_t vlan);
|
void send_vlan(uint16_t vlan);
|
||||||
void send_basic_info(void);
|
void send_basic_info(void);
|
||||||
|
void send_bandwidth(void);
|
||||||
void send_eee(void);
|
void send_eee(void);
|
||||||
void send_l2(uint16_t idx);
|
void send_l2(uint16_t idx);
|
||||||
void l2_delete(uint16_t idx);
|
void l2_delete(uint16_t idx);
|
||||||
|
|||||||
Reference in New Issue
Block a user