"show port (info|stats|summary|xstats|fdir|dcb_tc) (port_id|all)\n"
" Display information for port_id, or all.\n\n"
+ "show port info (port_id) representor\n"
+ " Show supported representors for a specific port\n\n"
+
"show port port_id (module_eeprom|eeprom)\n"
" Display the module EEPROM or EEPROM information for port_id.\n\n"
"queue_mask (queue_mask_value)\n"
" Set rate limit for queues in VF of a port\n\n"
- "set port (port_id) mirror-rule (rule_id)"
- " (pool-mirror-up|pool-mirror-down|vlan-mirror)"
- " (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off)\n"
- " Set pool or vlan type mirror rule on a port.\n"
- " e.g., 'set port 0 mirror-rule 0 vlan-mirror 0,1"
- " dst-pool 0 on' enable mirror traffic with vlan 0,1"
- " to pool 0.\n\n"
-
- "set port (port_id) mirror-rule (rule_id)"
- " (uplink-mirror|downlink-mirror) dst-pool"
- " (pool_id) (on|off)\n"
- " Set uplink or downlink type mirror rule on a port.\n"
- " e.g., 'set port 0 mirror-rule 0 uplink-mirror dst-pool"
- " 0 on' enable mirror income traffic to pool 0.\n\n"
-
- "reset port (port_id) mirror-rule (rule_id)\n"
- " Reset a mirror rule.\n\n"
-
"set flush_rx (on|off)\n"
" Flush (default) or don't flush RX streams before"
" forwarding. Mainly used with PCAP drivers.\n\n"
"show bonding config (port_id)\n"
" Show the bonding config for port_id.\n\n"
+ "show bonding lacp info (port_id)\n"
+ " Show the bonding lacp information for port_id.\n\n"
+
"set bonding mac_addr (port_id) (address)\n"
" Set the MAC address of a bonded device.\n\n"
__rte_unused void *data)
{
struct cmd_config_max_pkt_len_result *res = parsed_result;
- uint32_t max_rx_pkt_len_backup = 0;
- portid_t pid;
+ portid_t port_id;
int ret;
+ if (strcmp(res->name, "max-pkt-len") != 0) {
+ printf("Unknown parameter\n");
+ return;
+ }
+
if (!all_ports_stopped()) {
fprintf(stderr, "Please stop all ports first\n");
return;
}
- RTE_ETH_FOREACH_DEV(pid) {
- struct rte_port *port = &ports[pid];
-
- if (!strcmp(res->name, "max-pkt-len")) {
- if (res->value < RTE_ETHER_MIN_LEN) {
- fprintf(stderr,
- "max-pkt-len can not be less than %d\n",
- RTE_ETHER_MIN_LEN);
- return;
- }
- if (res->value == port->dev_conf.rxmode.max_rx_pkt_len)
- return;
-
- ret = eth_dev_info_get_print_err(pid, &port->dev_info);
- if (ret != 0) {
- fprintf(stderr,
- "rte_eth_dev_info_get() failed for port %u\n",
- pid);
- return;
- }
+ RTE_ETH_FOREACH_DEV(port_id) {
+ struct rte_port *port = &ports[port_id];
- max_rx_pkt_len_backup = port->dev_conf.rxmode.max_rx_pkt_len;
+ if (res->value < RTE_ETHER_MIN_LEN) {
+ fprintf(stderr,
+ "max-pkt-len can not be less than %d\n",
+ RTE_ETHER_MIN_LEN);
+ return;
+ }
- port->dev_conf.rxmode.max_rx_pkt_len = res->value;
- if (update_jumbo_frame_offload(pid) != 0)
- port->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len_backup;
- } else {
- fprintf(stderr, "Unknown parameter\n");
+ ret = eth_dev_info_get_print_err(port_id, &port->dev_info);
+ if (ret != 0) {
+ fprintf(stderr,
+ "rte_eth_dev_info_get() failed for port %u\n",
+ port_id);
return;
}
+
+ update_jumbo_frame_offload(port_id, res->value);
}
init_port_config();
rss_conf.rss_hf = ETH_RSS_ECPRI;
else if (!strcmp(res->value, "mpls"))
rss_conf.rss_hf = ETH_RSS_MPLS;
+ else if (!strcmp(res->value, "ipv4-chksum"))
+ rss_conf.rss_hf = ETH_RSS_IPV4_CHKSUM;
else if (!strcmp(res->value, "none"))
rss_conf.rss_hf = 0;
else if (!strcmp(res->value, "level-default")) {
.help_str = "port config all rss "
"all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
"nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none|level-default|"
- "level-outer|level-inner|<flowtype_id>",
+ "level-outer|level-inner|ipv4-chksum|<flowtype_id>",
.tokens = {
(void *)&cmd_config_rss_port,
(void *)&cmd_config_rss_keyword,
}
};
+/* *** SHOW IEEE802.3 BONDING INFORMATION *** */
+struct cmd_show_bonding_lacp_info_result {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t bonding;
+ cmdline_fixed_string_t lacp;
+ cmdline_fixed_string_t info;
+ portid_t port_id;
+};
+
+static void port_param_show(struct port_params *params)
+{
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
+
+ printf("\t\tsystem priority: %u\n", params->system_priority);
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, ¶ms->system);
+ printf("\t\tsystem mac address: %s\n", buf);
+ printf("\t\tport key: %u\n", params->key);
+ printf("\t\tport priority: %u\n", params->port_priority);
+ printf("\t\tport number: %u\n", params->port_number);
+}
+
+static void lacp_slave_info_show(struct rte_eth_bond_8023ad_slave_info *info)
+{
+ char a_state[256] = { 0 };
+ char p_state[256] = { 0 };
+ int a_len = 0;
+ int p_len = 0;
+ uint32_t i;
+
+ static const char * const state[] = {
+ "ACTIVE",
+ "TIMEOUT",
+ "AGGREGATION",
+ "SYNCHRONIZATION",
+ "COLLECTING",
+ "DISTRIBUTING",
+ "DEFAULTED",
+ "EXPIRED"
+ };
+ static const char * const selection[] = {
+ "UNSELECTED",
+ "STANDBY",
+ "SELECTED"
+ };
+
+ for (i = 0; i < RTE_DIM(state); i++) {
+ if ((info->actor_state >> i) & 1)
+ a_len += snprintf(&a_state[a_len],
+ RTE_DIM(a_state) - a_len, "%s ",
+ state[i]);
+
+ if ((info->partner_state >> i) & 1)
+ p_len += snprintf(&p_state[p_len],
+ RTE_DIM(p_state) - p_len, "%s ",
+ state[i]);
+ }
+ printf("\tAggregator port id: %u\n", info->agg_port_id);
+ printf("\tselection: %s\n", selection[info->selected]);
+ printf("\tActor detail info:\n");
+ port_param_show(&info->actor);
+ printf("\t\tport state: %s\n", a_state);
+ printf("\tPartner detail info:\n");
+ port_param_show(&info->partner);
+ printf("\t\tport state: %s\n", p_state);
+ printf("\n");
+}
+
+static void lacp_conf_show(struct rte_eth_bond_8023ad_conf *conf)
+{
+ printf("\tfast period: %u ms\n", conf->fast_periodic_ms);
+ printf("\tslow period: %u ms\n", conf->slow_periodic_ms);
+ printf("\tshort timeout: %u ms\n", conf->short_timeout_ms);
+ printf("\tlong timeout: %u ms\n", conf->long_timeout_ms);
+ printf("\taggregate wait timeout: %u ms\n",
+ conf->aggregate_wait_timeout_ms);
+ printf("\ttx period: %u ms\n", conf->tx_period_ms);
+ printf("\trx marker period: %u ms\n", conf->rx_marker_period_ms);
+ printf("\tupdate timeout: %u ms\n", conf->update_timeout_ms);
+ switch (conf->agg_selection) {
+ case AGG_BANDWIDTH:
+ printf("\taggregation mode: bandwidth\n");
+ break;
+ case AGG_STABLE:
+ printf("\taggregation mode: stable\n");
+ break;
+ case AGG_COUNT:
+ printf("\taggregation mode: count\n");
+ break;
+ default:
+ printf("\taggregation mode: invalid\n");
+ break;
+ }
+
+ printf("\n");
+}
+
+static void cmd_show_bonding_lacp_info_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_show_bonding_lacp_info_result *res = parsed_result;
+ struct rte_eth_bond_8023ad_slave_info slave_info;
+ struct rte_eth_bond_8023ad_conf port_conf;
+ portid_t slaves[RTE_MAX_ETHPORTS];
+ portid_t port_id = res->port_id;
+ int num_active_slaves;
+ int bonding_mode;
+ int i;
+ int ret;
+
+ bonding_mode = rte_eth_bond_mode_get(port_id);
+ if (bonding_mode != BONDING_MODE_8023AD) {
+ fprintf(stderr, "\tBonding mode is not mode 4\n");
+ return;
+ }
+
+ num_active_slaves = rte_eth_bond_active_slaves_get(port_id, slaves,
+ RTE_MAX_ETHPORTS);
+ if (num_active_slaves < 0) {
+ fprintf(stderr, "\tFailed to get active slave list for port = %u\n",
+ port_id);
+ return;
+ }
+ if (num_active_slaves == 0)
+ fprintf(stderr, "\tIEEE802.3 port %u has no active slave\n",
+ port_id);
+
+ printf("\tIEEE802.3 port: %u\n", port_id);
+ ret = rte_eth_bond_8023ad_conf_get(port_id, &port_conf);
+ if (ret) {
+ fprintf(stderr, "\tGet bonded device %u info failed\n",
+ port_id);
+ return;
+ }
+ lacp_conf_show(&port_conf);
+
+ for (i = 0; i < num_active_slaves; i++) {
+ ret = rte_eth_bond_8023ad_slave_info(port_id, slaves[i],
+ &slave_info);
+ if (ret) {
+ fprintf(stderr, "\tGet slave device %u info failed\n",
+ slaves[i]);
+ return;
+ }
+ printf("\tSlave Port: %u\n", slaves[i]);
+ lacp_slave_info_show(&slave_info);
+ }
+}
+
+cmdline_parse_token_string_t cmd_show_bonding_lacp_info_show =
+TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
+ show, "show");
+cmdline_parse_token_string_t cmd_show_bonding_lacp_info_bonding =
+TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
+ bonding, "bonding");
+cmdline_parse_token_string_t cmd_show_bonding_lacp_info_lacp =
+TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
+ bonding, "lacp");
+cmdline_parse_token_string_t cmd_show_bonding_lacp_info_info =
+TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
+ info, "info");
+cmdline_parse_token_num_t cmd_show_bonding_lacp_info_port_id =
+TOKEN_NUM_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
+ port_id, RTE_UINT16);
+
+cmdline_parse_inst_t cmd_show_bonding_lacp_info = {
+ .f = cmd_show_bonding_lacp_info_parsed,
+ .help_str = "show bonding lacp info <port_id> : "
+ "Show bonding IEEE802.3 information for port_id",
+ .data = NULL,
+ .tokens = {
+ (void *)&cmd_show_bonding_lacp_info_show,
+ (void *)&cmd_show_bonding_lacp_info_bonding,
+ (void *)&cmd_show_bonding_lacp_info_lacp,
+ (void *)&cmd_show_bonding_lacp_info_info,
+ (void *)&cmd_show_bonding_lacp_info_port_id,
+ NULL
+ }
+};
+
/* *** SHOW NIC BONDING CONFIGURATION *** */
struct cmd_show_bonding_config_result {
cmdline_fixed_string_t show;
},
};
+/* *** show port representors information *** */
+struct cmd_representor_info_result {
+ cmdline_fixed_string_t cmd_show;
+ cmdline_fixed_string_t cmd_port;
+ cmdline_fixed_string_t cmd_info;
+ cmdline_fixed_string_t cmd_keyword;
+ portid_t cmd_pid;
+};
+
+static void
+cmd_representor_info_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_representor_info_result *res = parsed_result;
+ struct rte_eth_representor_info *info;
+ struct rte_eth_representor_range *range;
+ uint32_t range_diff;
+ uint32_t i;
+ int ret;
+ int num;
+
+ if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
+ fprintf(stderr, "Invalid port id %u\n", res->cmd_pid);
+ return;
+ }
+
+ ret = rte_eth_representor_info_get(res->cmd_pid, NULL);
+ if (ret < 0) {
+ fprintf(stderr,
+ "Failed to get the number of representor info ranges for port %hu: %s\n",
+ res->cmd_pid, rte_strerror(-ret));
+ return;
+ }
+ num = ret;
+
+ info = calloc(1, sizeof(*info) + num * sizeof(info->ranges[0]));
+ if (info == NULL) {
+ fprintf(stderr,
+ "Failed to allocate memory for representor info for port %hu\n",
+ res->cmd_pid);
+ return;
+ }
+ info->nb_ranges_alloc = num;
+
+ ret = rte_eth_representor_info_get(res->cmd_pid, info);
+ if (ret < 0) {
+ fprintf(stderr,
+ "Failed to get the representor info for port %hu: %s\n",
+ res->cmd_pid, rte_strerror(-ret));
+ free(info);
+ return;
+ }
+
+ printf("Port controller: %hu\n", info->controller);
+ printf("Port PF: %hu\n", info->pf);
+
+ printf("Ranges: %u\n", info->nb_ranges);
+ for (i = 0; i < info->nb_ranges; i++) {
+ range = &info->ranges[i];
+ range_diff = range->id_end - range->id_base;
+
+ printf("%u. ", i + 1);
+ printf("'%s' ", range->name);
+ if (range_diff > 0)
+ printf("[%u-%u]: ", range->id_base, range->id_end);
+ else
+ printf("[%u]: ", range->id_base);
+
+ printf("Controller %d, PF %d", range->controller, range->pf);
+
+ switch (range->type) {
+ case RTE_ETH_REPRESENTOR_NONE:
+ printf(", NONE\n");
+ break;
+ case RTE_ETH_REPRESENTOR_VF:
+ if (range_diff > 0)
+ printf(", VF %d..%d\n", range->vf,
+ range->vf + range_diff);
+ else
+ printf(", VF %d\n", range->vf);
+ break;
+ case RTE_ETH_REPRESENTOR_SF:
+ printf(", SF %d\n", range->sf);
+ break;
+ case RTE_ETH_REPRESENTOR_PF:
+ if (range_diff > 0)
+ printf("..%d\n", range->pf + range_diff);
+ else
+ printf("\n");
+ break;
+ default:
+ printf(", UNKNOWN TYPE %d\n", range->type);
+ break;
+ }
+ }
+
+ free(info);
+}
+
+cmdline_parse_token_string_t cmd_representor_info_show =
+ TOKEN_STRING_INITIALIZER(struct cmd_representor_info_result,
+ cmd_show, "show");
+cmdline_parse_token_string_t cmd_representor_info_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_representor_info_result,
+ cmd_port, "port");
+cmdline_parse_token_string_t cmd_representor_info_info =
+ TOKEN_STRING_INITIALIZER(struct cmd_representor_info_result,
+ cmd_info, "info");
+cmdline_parse_token_num_t cmd_representor_info_pid =
+ TOKEN_NUM_INITIALIZER(struct cmd_representor_info_result,
+ cmd_pid, RTE_UINT16);
+cmdline_parse_token_string_t cmd_representor_info_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_representor_info_result,
+ cmd_keyword, "representor");
+
+cmdline_parse_inst_t cmd_representor_info = {
+ .f = cmd_representor_info_parsed,
+ .data = NULL,
+ .help_str = "show port info <port_id> representor",
+ .tokens = {
+ (void *)&cmd_representor_info_show,
+ (void *)&cmd_representor_info_port,
+ (void *)&cmd_representor_info_info,
+ (void *)&cmd_representor_info_pid,
+ (void *)&cmd_representor_info_keyword,
+ NULL,
+ },
+};
+
+
/* *** SHOW DEVICE INFO *** */
struct cmd_showdevice_result {
cmdline_fixed_string_t show;
},
};
-/* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */
-struct cmd_set_mirror_mask_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t mirror;
- uint8_t rule_id;
- cmdline_fixed_string_t what;
- cmdline_fixed_string_t value;
- cmdline_fixed_string_t dstpool;
- uint8_t dstpool_id;
- cmdline_fixed_string_t on;
-};
-
-cmdline_parse_token_string_t cmd_mirror_mask_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result,
- set, "set");
-cmdline_parse_token_string_t cmd_mirror_mask_port =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result,
- port, "port");
-cmdline_parse_token_num_t cmd_mirror_mask_portid =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_mask_result,
- port_id, RTE_UINT16);
-cmdline_parse_token_string_t cmd_mirror_mask_mirror =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result,
- mirror, "mirror-rule");
-cmdline_parse_token_num_t cmd_mirror_mask_ruleid =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_mask_result,
- rule_id, RTE_UINT8);
-cmdline_parse_token_string_t cmd_mirror_mask_what =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result,
- what, "pool-mirror-up#pool-mirror-down"
- "#vlan-mirror");
-cmdline_parse_token_string_t cmd_mirror_mask_value =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result,
- value, NULL);
-cmdline_parse_token_string_t cmd_mirror_mask_dstpool =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result,
- dstpool, "dst-pool");
-cmdline_parse_token_num_t cmd_mirror_mask_poolid =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_mask_result,
- dstpool_id, RTE_UINT8);
-cmdline_parse_token_string_t cmd_mirror_mask_on =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result,
- on, "on#off");
-
-static void
-cmd_set_mirror_mask_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- int ret,nb_item,i;
- struct cmd_set_mirror_mask_result *res = parsed_result;
- struct rte_eth_mirror_conf mr_conf;
-
- memset(&mr_conf, 0, sizeof(struct rte_eth_mirror_conf));
-
- unsigned int vlan_list[ETH_MIRROR_MAX_VLANS];
-
- mr_conf.dst_pool = res->dstpool_id;
-
- if (!strcmp(res->what, "pool-mirror-up")) {
- mr_conf.pool_mask = strtoull(res->value, NULL, 16);
- mr_conf.rule_type = ETH_MIRROR_VIRTUAL_POOL_UP;
- } else if (!strcmp(res->what, "pool-mirror-down")) {
- mr_conf.pool_mask = strtoull(res->value, NULL, 16);
- mr_conf.rule_type = ETH_MIRROR_VIRTUAL_POOL_DOWN;
- } else if (!strcmp(res->what, "vlan-mirror")) {
- mr_conf.rule_type = ETH_MIRROR_VLAN;
- nb_item = parse_item_list(res->value, "vlan",
- ETH_MIRROR_MAX_VLANS, vlan_list, 1);
- if (nb_item <= 0)
- return;
-
- for (i = 0; i < nb_item; i++) {
- if (vlan_list[i] > RTE_ETHER_MAX_VLAN_ID) {
- fprintf(stderr,
- "Invalid vlan_id: must be < 4096\n");
- return;
- }
-
- mr_conf.vlan.vlan_id[i] = (uint16_t)vlan_list[i];
- mr_conf.vlan.vlan_mask |= 1ULL << i;
- }
- }
-
- if (!strcmp(res->on, "on"))
- ret = rte_eth_mirror_rule_set(res->port_id, &mr_conf,
- res->rule_id, 1);
- else
- ret = rte_eth_mirror_rule_set(res->port_id, &mr_conf,
- res->rule_id, 0);
- if (ret < 0)
- fprintf(stderr, "mirror rule add error: (%s)\n",
- strerror(-ret));
-}
-
-cmdline_parse_inst_t cmd_set_mirror_mask = {
- .f = cmd_set_mirror_mask_parsed,
- .data = NULL,
- .help_str = "set port <port_id> mirror-rule <rule_id> "
- "pool-mirror-up|pool-mirror-down|vlan-mirror "
- "<pool_mask|vlan_id[,vlan_id]*> dst-pool <pool_id> on|off",
- .tokens = {
- (void *)&cmd_mirror_mask_set,
- (void *)&cmd_mirror_mask_port,
- (void *)&cmd_mirror_mask_portid,
- (void *)&cmd_mirror_mask_mirror,
- (void *)&cmd_mirror_mask_ruleid,
- (void *)&cmd_mirror_mask_what,
- (void *)&cmd_mirror_mask_value,
- (void *)&cmd_mirror_mask_dstpool,
- (void *)&cmd_mirror_mask_poolid,
- (void *)&cmd_mirror_mask_on,
- NULL,
- },
-};
-
-/* *** CONFIGURE VM MIRROR UPLINK/DOWNLINK RULE *** */
-struct cmd_set_mirror_link_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t mirror;
- uint8_t rule_id;
- cmdline_fixed_string_t what;
- cmdline_fixed_string_t dstpool;
- uint8_t dstpool_id;
- cmdline_fixed_string_t on;
-};
-
-cmdline_parse_token_string_t cmd_mirror_link_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result,
- set, "set");
-cmdline_parse_token_string_t cmd_mirror_link_port =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result,
- port, "port");
-cmdline_parse_token_num_t cmd_mirror_link_portid =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_link_result,
- port_id, RTE_UINT16);
-cmdline_parse_token_string_t cmd_mirror_link_mirror =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result,
- mirror, "mirror-rule");
-cmdline_parse_token_num_t cmd_mirror_link_ruleid =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_link_result,
- rule_id, RTE_UINT8);
-cmdline_parse_token_string_t cmd_mirror_link_what =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result,
- what, "uplink-mirror#downlink-mirror");
-cmdline_parse_token_string_t cmd_mirror_link_dstpool =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result,
- dstpool, "dst-pool");
-cmdline_parse_token_num_t cmd_mirror_link_poolid =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_link_result,
- dstpool_id, RTE_UINT8);
-cmdline_parse_token_string_t cmd_mirror_link_on =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result,
- on, "on#off");
-
-static void
-cmd_set_mirror_link_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- int ret;
- struct cmd_set_mirror_link_result *res = parsed_result;
- struct rte_eth_mirror_conf mr_conf;
-
- memset(&mr_conf, 0, sizeof(struct rte_eth_mirror_conf));
- if (!strcmp(res->what, "uplink-mirror"))
- mr_conf.rule_type = ETH_MIRROR_UPLINK_PORT;
- else
- mr_conf.rule_type = ETH_MIRROR_DOWNLINK_PORT;
-
- mr_conf.dst_pool = res->dstpool_id;
-
- if (!strcmp(res->on, "on"))
- ret = rte_eth_mirror_rule_set(res->port_id, &mr_conf,
- res->rule_id, 1);
- else
- ret = rte_eth_mirror_rule_set(res->port_id, &mr_conf,
- res->rule_id, 0);
-
- /* check the return value and print it if is < 0 */
- if (ret < 0)
- fprintf(stderr, "mirror rule add error: (%s)\n",
- strerror(-ret));
-
-}
-
-cmdline_parse_inst_t cmd_set_mirror_link = {
- .f = cmd_set_mirror_link_parsed,
- .data = NULL,
- .help_str = "set port <port_id> mirror-rule <rule_id> "
- "uplink-mirror|downlink-mirror dst-pool <pool_id> on|off",
- .tokens = {
- (void *)&cmd_mirror_link_set,
- (void *)&cmd_mirror_link_port,
- (void *)&cmd_mirror_link_portid,
- (void *)&cmd_mirror_link_mirror,
- (void *)&cmd_mirror_link_ruleid,
- (void *)&cmd_mirror_link_what,
- (void *)&cmd_mirror_link_dstpool,
- (void *)&cmd_mirror_link_poolid,
- (void *)&cmd_mirror_link_on,
- NULL,
- },
-};
-
-/* *** RESET VM MIRROR RULE *** */
-struct cmd_rm_mirror_rule_result {
- cmdline_fixed_string_t reset;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t mirror;
- uint8_t rule_id;
-};
-
-cmdline_parse_token_string_t cmd_rm_mirror_rule_reset =
- TOKEN_STRING_INITIALIZER(struct cmd_rm_mirror_rule_result,
- reset, "reset");
-cmdline_parse_token_string_t cmd_rm_mirror_rule_port =
- TOKEN_STRING_INITIALIZER(struct cmd_rm_mirror_rule_result,
- port, "port");
-cmdline_parse_token_num_t cmd_rm_mirror_rule_portid =
- TOKEN_NUM_INITIALIZER(struct cmd_rm_mirror_rule_result,
- port_id, RTE_UINT16);
-cmdline_parse_token_string_t cmd_rm_mirror_rule_mirror =
- TOKEN_STRING_INITIALIZER(struct cmd_rm_mirror_rule_result,
- mirror, "mirror-rule");
-cmdline_parse_token_num_t cmd_rm_mirror_rule_ruleid =
- TOKEN_NUM_INITIALIZER(struct cmd_rm_mirror_rule_result,
- rule_id, RTE_UINT8);
-
-static void
-cmd_reset_mirror_rule_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- int ret;
- struct cmd_set_mirror_link_result *res = parsed_result;
- /* check rule_id */
- ret = rte_eth_mirror_rule_reset(res->port_id,res->rule_id);
- if(ret < 0)
- fprintf(stderr, "mirror rule remove error: (%s)\n",
- strerror(-ret));
-}
-
-cmdline_parse_inst_t cmd_reset_mirror_rule = {
- .f = cmd_reset_mirror_rule_parsed,
- .data = NULL,
- .help_str = "reset port <port_id> mirror-rule <rule_id>",
- .tokens = {
- (void *)&cmd_rm_mirror_rule_reset,
- (void *)&cmd_rm_mirror_rule_port,
- (void *)&cmd_rm_mirror_rule_portid,
- (void *)&cmd_rm_mirror_rule_mirror,
- (void *)&cmd_rm_mirror_rule_ruleid,
- NULL,
- },
-};
-
/* ******************************************************************************** */
struct cmd_dump_result {
if (!rte_is_multicast_ether_addr(&res->mc_addr)) {
fprintf(stderr,
- "Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n",
- res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1],
- res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3],
- res->mc_addr.addr_bytes[4], res->mc_addr.addr_bytes[5]);
+ "Invalid multicast addr " RTE_ETHER_ADDR_PRT_FMT "\n",
+ RTE_ETHER_ADDR_BYTES(&res->mc_addr));
return;
}
if (strcmp(res->what, "add") == 0)
struct rte_eth_dev_info dev_info;
portid_t port_id = res->port_id;
struct rte_port *port = &ports[port_id];
+ struct rte_eth_conf dev_conf;
uint64_t port_offloads;
uint64_t queue_offloads;
uint16_t nb_rx_queues;
printf("Rx Offloading Configuration of port %d :\n", port_id);
- port_offloads = port->dev_conf.rxmode.offloads;
+ ret = eth_dev_conf_get_print_err(port_id, &dev_conf);
+ if (ret != 0)
+ return;
+
+ port_offloads = dev_conf.rxmode.offloads;
printf(" Port :");
print_rx_offloads(port_offloads);
printf("\n");
struct rte_eth_dev_info dev_info;
portid_t port_id = res->port_id;
struct rte_port *port = &ports[port_id];
+ struct rte_eth_conf dev_conf;
uint64_t port_offloads;
uint64_t queue_offloads;
uint16_t nb_tx_queues;
printf("Tx Offloading Configuration of port %d :\n", port_id);
- port_offloads = port->dev_conf.txmode.offloads;
+ ret = eth_dev_conf_get_print_err(port_id, &dev_conf);
+ if (ret != 0)
+ return;
+
+ port_offloads = dev_conf.txmode.offloads;
printf(" Port :");
print_tx_offloads(port_offloads);
printf("\n");
(cmdline_parse_inst_t *)&cmd_showqueue,
(cmdline_parse_inst_t *)&cmd_showeeprom,
(cmdline_parse_inst_t *)&cmd_showportall,
+ (cmdline_parse_inst_t *)&cmd_representor_info,
(cmdline_parse_inst_t *)&cmd_showdevice,
(cmdline_parse_inst_t *)&cmd_showcfg,
(cmdline_parse_inst_t *)&cmd_showfwdall,
#ifdef RTE_NET_BOND
(cmdline_parse_inst_t *) &cmd_set_bonding_mode,
(cmdline_parse_inst_t *) &cmd_show_bonding_config,
+ (cmdline_parse_inst_t *) &cmd_show_bonding_lacp_info,
(cmdline_parse_inst_t *) &cmd_set_bonding_primary,
(cmdline_parse_inst_t *) &cmd_add_bonding_slave,
(cmdline_parse_inst_t *) &cmd_remove_bonding_slave,
(cmdline_parse_inst_t *)&cmd_vf_mac_addr_filter,
(cmdline_parse_inst_t *)&cmd_queue_rate_limit,
(cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
- (cmdline_parse_inst_t *)&cmd_set_mirror_mask,
- (cmdline_parse_inst_t *)&cmd_set_mirror_link,
- (cmdline_parse_inst_t *)&cmd_reset_mirror_rule,
(cmdline_parse_inst_t *)&cmd_showport_rss_hash,
(cmdline_parse_inst_t *)&cmd_showport_rss_hash_key,
(cmdline_parse_inst_t *)&cmd_config_rss_hash_key,