"show port (port_id) rxq|txq (queue_id) desc (desc_id) status"
" Show status of rx|tx descriptor.\n\n"
+
+ "show port (port_id) macs|mcast_macs"
+ " Display list of mac addresses added to port.\n\n"
);
}
},
};
+/* *** display mac addresses added to a port *** */
+struct cmd_showport_macs_result {
+ cmdline_fixed_string_t cmd_show;
+ cmdline_fixed_string_t cmd_port;
+ cmdline_fixed_string_t cmd_keyword;
+ portid_t cmd_pid;
+};
+
+static void
+cmd_showport_macs_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_showport_macs_result *res = parsed_result;
+
+ if (port_id_is_invalid(res->cmd_pid, ENABLED_WARN))
+ return;
+
+ if (!strcmp(res->cmd_keyword, "macs"))
+ show_macs(res->cmd_pid);
+ else if (!strcmp(res->cmd_keyword, "mcast_macs"))
+ show_mcast_macs(res->cmd_pid);
+}
+
+cmdline_parse_token_string_t cmd_showport_macs_show =
+ TOKEN_STRING_INITIALIZER(struct cmd_showport_macs_result,
+ cmd_show, "show");
+cmdline_parse_token_string_t cmd_showport_macs_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_showport_macs_result,
+ cmd_port, "port");
+cmdline_parse_token_num_t cmd_showport_macs_pid =
+ TOKEN_NUM_INITIALIZER(struct cmd_showport_macs_result,
+ cmd_pid, UINT16);
+cmdline_parse_token_string_t cmd_showport_macs_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_showport_macs_result,
+ cmd_keyword, "macs#mcast_macs");
+
+cmdline_parse_inst_t cmd_showport_macs = {
+ .f = cmd_showport_macs_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> macs|mcast_macs",
+ .tokens = {
+ (void *)&cmd_showport_macs_show,
+ (void *)&cmd_showport_macs_port,
+ (void *)&cmd_showport_macs_pid,
+ (void *)&cmd_showport_macs_keyword,
+ NULL,
+ },
+};
+
/* ******************************************************************************** */
/* list of instructions */
(cmdline_parse_inst_t *)&cmd_setup_rxtx_queue,
(cmdline_parse_inst_t *)&cmd_config_rss_reta,
(cmdline_parse_inst_t *)&cmd_showport_reta,
+ (cmdline_parse_inst_t *)&cmd_showport_macs,
(cmdline_parse_inst_t *)&cmd_config_burst,
(cmdline_parse_inst_t *)&cmd_config_thresh,
(cmdline_parse_inst_t *)&cmd_config_threshold,
printf("\n\n");
}
+
+void
+show_macs(portid_t port_id)
+{
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
+ struct rte_eth_dev_info dev_info;
+ struct rte_ether_addr *addr;
+ uint32_t i, num_macs = 0;
+ struct rte_eth_dev *dev;
+
+ dev = &rte_eth_devices[port_id];
+
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+ for (i = 0; i < dev_info.max_mac_addrs; i++) {
+ addr = &dev->data->mac_addrs[i];
+
+ /* skip zero address */
+ if (rte_is_zero_ether_addr(addr))
+ continue;
+
+ num_macs++;
+ }
+
+ printf("Number of MAC address added: %d\n", num_macs);
+
+ for (i = 0; i < dev_info.max_mac_addrs; i++) {
+ addr = &dev->data->mac_addrs[i];
+
+ /* skip zero address */
+ if (rte_is_zero_ether_addr(addr))
+ continue;
+
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, addr);
+ printf(" %s\n", buf);
+ }
+}
+
+void
+show_mcast_macs(portid_t port_id)
+{
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
+ struct rte_ether_addr *addr;
+ struct rte_port *port;
+ uint32_t i;
+
+ port = &ports[port_id];
+
+ printf("Number of Multicast MAC address added: %d\n", port->mc_addr_nb);
+
+ for (i = 0; i < port->mc_addr_nb; i++) {
+ addr = &port->mc_addr_pool[i];
+
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, addr);
+ printf(" %s\n", buf);
+ }
+}