Skip to content

Commit e6d99b8

Browse files
committed
feat(tool - eth): allow user to set RxMAC error mask with parameter -m
1 parent 6b66e6b commit e6d99b8

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

tools/eth/eth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum commands {
5858
CMD_USAGE,
5959
CMD_ENABLE,
6060
CMD_RESET,
61-
CMD_SET_MASK,
61+
CMD_SET_ERROR_MASK,
6262
CMD_SET_PMA_TYPE,
6363
CMD_SET_PMA_FEATURE,
6464
CMD_SET_MAX_LENGTH,

tools/eth/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void usage(const char *progname, int verbose)
4545
printf("-S Show etherStats counters\n");
4646
printf("-l length Minimal allowed frame length\n");
4747
printf("-L length Maximal allowed frame length\n");
48-
/* printf("-m mask Set error mask 0-31\n"); */
48+
printf("-m mask Set RXMAC error bitmask value (integer; use -v to view current configuration)\n");
4949
printf("-c type Set PMA type/mode by name or enable/disable feature (+feat/-feat)\n");
5050
printf("-p repeater_cfg Set transmit data source%s\n", verbose ? "" : " (-hv for more info)");
5151
if (verbose) {
@@ -212,10 +212,9 @@ int main(int argc, char *argv[])
212212
p.param < 0 || p.param > 31) {
213213
errx(EXIT_FAILURE, "Wrong error mask.");
214214
}
215-
p.command = CMD_SET_MASK;
215+
p.command = CMD_SET_ERROR_MASK;
216216
cmds++;
217217
break;
218-
219218
case 'M':
220219
switch (tolower(optarg[0])) {
221220
case 's': p.command = CMD_SHOW_MACS; break;

tools/eth/rxmac.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ void rxmac_print_status(struct nc_rxmac *rxmac, struct eth_params *p)
5555
return;
5656

5757
printf("------------------------------ RXMAC Configuration ----\n");
58-
printf("Frame error from MII [1] : %s", (s.error_mask & 0x00000001) ? "enabled\n" : "disabled\n");
59-
printf("CRC check [2] : %s", (s.error_mask & 0x00000002) ? "enabled\n" : "disabled\n");
60-
printf("Minimum frame length [4] : %s\n"
61-
"* length : %d B\n",
58+
printf("Error mask register : 0x%02x\n", s.error_mask);
59+
printf(" * Frame error from MII [0]: %s\n", (s.error_mask & 0x00000001) ? "enabled" : "disabled");
60+
printf(" * CRC check [1]: %s\n", (s.error_mask & 0x00000002) ? "enabled" : "disabled");
61+
printf(" * Minimum frame length [2]: %s\n"
62+
" * length : %d B\n",
6263
(s.error_mask & 0x00000004) ? "enabled" : "disabled",
6364
s.frame_length_min);
64-
printf("MTU frame length [8] : %s\n"
65-
"* length : %d B",
65+
printf(" * MTU frame length [3]: %s\n"
66+
" * length : %d B",
6667
(s.error_mask & 0x00000008) ? "enabled" : "disabled",
6768
s.frame_length_max);
6869

@@ -78,8 +79,8 @@ void rxmac_print_status(struct nc_rxmac *rxmac, struct eth_params *p)
7879
case RXMAC_MAC_FILTER_TABLE_BCAST: text = "Filter by MAC address table, allow broadcast"; break;
7980
case RXMAC_MAC_FILTER_TABLE_BCAST_MCAST:text = "Filter by MAC address table, allow broadcast + multicast"; break;
8081
}
81-
printf("MAC address check [16] : %s\n"
82-
"* mode : %s\n",
82+
printf(" * MAC address check [4]: %s\n"
83+
" * mode : %s\n",
8384
(s.error_mask & 0x00000010) ? "enabled" : "disabled", text);
8485
printf("MAC address table size : %d\n", s.mac_addr_count);
8586
}
@@ -237,6 +238,9 @@ int rxmac_execute_operation(struct nc_rxmac *rxmac, struct eth_params *p)
237238
nc_rxmac_set_frame_length(rxmac, p->param,
238239
p->command == CMD_SET_MAX_LENGTH ? RXMAC_FRAME_LENGTH_MAX : RXMAC_FRAME_LENGTH_MIN);
239240
break;
241+
case CMD_SET_ERROR_MASK:
242+
nc_rxmac_set_error_mask(rxmac, p->param);
243+
break;
240244
case CMD_SHOW_MACS:
241245
ret = show_mac_addresses(rxmac);
242246
break;

0 commit comments

Comments
 (0)