mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #565 from DrDoof/feat/mac-count
port: show how many MAC addresses each port has learned
This commit is contained in:
7 files changed
+51
-37
No files matched your search
@@ -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