mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
tools: httpd_sim serves the MAC count per port
The simulator answered /status.json without the "macs" field the Ports page now reads. It counts the dynamic entries of its own L2 table for the port, so the column and /l2.json agree and the two static entries show the difference.
This commit is contained in:
1 parent
b94d2aeabc
commit
8a7c847ad9
1 file changed
+7
@@ -56,6 +56,7 @@ time_t last_session_use;
|
||||
|
||||
uint64_t txG[PORTS], txB[PORTS], rxG[PORTS], rxB[PORTS];
|
||||
char txG_buff[20], txB_buff[20], rxG_buff[20], rxB_buff[20], counter_buf[20], counter_name[20];
|
||||
char macs_buff[8];
|
||||
char sfp_temp[8], sfp_vcc[8], sfp_txbias[8], sfp_txpower[8], sfp_rxpower[8], sfp_laser[8], sfp_options[6];
|
||||
char num_buff[20];
|
||||
char l2_idx_buff[20];
|
||||
@@ -180,6 +181,12 @@ void send_status(int s)
|
||||
json_object_object_add(v, "txB", json_object_new_string(txB_buff));
|
||||
json_object_object_add(v, "rxG", json_object_new_string(rxG_buff));
|
||||
json_object_object_add(v, "rxB", json_object_new_string(rxB_buff));
|
||||
uint16_t macs = 0;
|
||||
for (int e = 0; e < L2_ENTRY_NUM; e++)
|
||||
if (l2_entries[e].port == physToLogPort[i-1] && l2_entries[e].type != 's')
|
||||
macs++;
|
||||
sprintf(macs_buff, "0x%04x", macs);
|
||||
json_object_object_add(v, "macs", json_object_new_string(macs_buff));
|
||||
if (i >= PORTS - NSFP) {
|
||||
uint16_t temp = 0x28fb + rand() / (RAND_MAX / 100);
|
||||
uint16_t vcc = 0x7eda + rand() / (RAND_MAX / 100);
|
||||
|
||||
Reference in new issue
Block a user