Skip to content

Commit 2008d49

Browse files
committed
Add support for mirror status and mirror deletion via CLI
1 parent 5622f1c commit 2008d49

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

cmd_parser.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,37 @@ void parse_mirror(void)
273273
__xdata uint16_t rx_pmask = 0;
274274
__xdata uint16_t tx_pmask = 0;
275275

276+
if (cmd_words_b[1] > 0 && cmd_compare(1, "status")) {
277+
reg_read_m(RTL837x_MIRROR_CTRL);
278+
uint8_t mPort = sfr_data[3];
279+
if (mPort & 1) {
280+
print_string("Enabled: ");
281+
} else {
282+
print_string("NOT Enabled: ");
283+
}
284+
print_string("Mirroring port: ");
285+
if (!isRTL8373)
286+
write_char('0' + log_to_phys_port[mPort >> 1]);
287+
else
288+
write_char('0' + (mPort >> 1) + 1);
289+
reg_read_m(RTL837x_MIRROR_CONF);
290+
uint16_t m = sfr_data[0];
291+
m = (m << 8) | sfr_data[1];
292+
print_string(", Port mask RX: ");
293+
print_short(m);
294+
m = sfr_data[2];
295+
m = (m << 8) | sfr_data[3];
296+
print_string(", Port mask TX: ");
297+
print_short(m);
298+
write_char('\n');
299+
return;
300+
} else if (cmd_words_b[1] > 0 && cmd_compare(1, "off")) {
301+
port_mirror_del();
302+
return;
303+
}
304+
276305
if (!isnumber(cmd_buffer[cmd_words_b[1]])) {
277-
print_string("Port missing: port <mirroring port> [port][t/r]...");
306+
print_string("Port missing: mirror <mirroring port> [port][t/r]...");
278307
return;
279308
}
280309

0 commit comments

Comments
 (0)