"show port (port_id) fec_mode"
" Show fec mode of a port.\n\n"
+
+ "show port (port_id) flow_ctrl"
+ " Show flow control info of a port.\n\n"
);
}
"del port meter profile (port_id) (profile_id)\n"
" meter profile delete\n\n"
- "create port meter (port_id) (mtr_id) (profile_id) (meter_enable)\n"
- "(g_action) (y_action) (r_action) (stats_mask) (shared)\n"
- "(use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\n"
+ "create port meter (port_id) (mtr_id) (profile_id) (policy_id) (meter_enable)\n"
+ "(stats_mask) (shared) (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\n"
"(dscp_tbl_entry63)]\n"
" meter create\n\n"
"del port meter (port_id) (mtr_id)\n"
" meter delete\n\n"
+ "add port meter policy (port_id) (policy_id) g_actions (actions)\n"
+ "y_actions (actions) r_actions (actions)\n"
+ " meter policy add\n\n"
+
+ "del port meter policy (port_id) (policy_id)\n"
+ " meter policy delete\n\n"
+
"set port meter profile (port_id) (mtr_id) (profile_id)\n"
" meter update meter profile\n\n"
" Register a dynf and Set/clear this flag on Tx. "
"Testpmd will set this value to any Tx packet "
"sent from this port\n\n"
+
+ "port cleanup (port_id) txq (queue_id) (free_cnt)\n"
+ " Cleanup txq mbufs for a specific Tx queue\n\n"
);
}
},
};
+/* *** cleanup txq mbufs *** */
+struct cmd_cleanup_txq_mbufs_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t keyword;
+ cmdline_fixed_string_t name;
+ uint16_t port_id;
+ uint16_t queue_id;
+ uint32_t free_cnt;
+};
+
+static void
+cmd_cleanup_txq_mbufs_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_cleanup_txq_mbufs_result *res = parsed_result;
+ uint16_t port_id = res->port_id;
+ uint16_t queue_id = res->queue_id;
+ uint32_t free_cnt = res->free_cnt;
+ struct rte_eth_txq_info qinfo;
+ int ret;
+
+ if (test_done == 0) {
+ printf("Please stop forwarding first\n");
+ return;
+ }
+
+ if (rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo)) {
+ printf("Failed to get port %u Tx queue %u info\n",
+ port_id, queue_id);
+ return;
+ }
+
+ if (qinfo.queue_state != RTE_ETH_QUEUE_STATE_STARTED) {
+ printf("Tx queue %u not started\n", queue_id);
+ return;
+ }
+
+ ret = rte_eth_tx_done_cleanup(port_id, queue_id, free_cnt);
+ if (ret < 0) {
+ printf("Failed to cleanup mbuf for port %u Tx queue %u "
+ "error desc: %s(%d)\n",
+ port_id, queue_id, strerror(-ret), ret);
+ return;
+ }
+
+ printf("Cleanup port %u Tx queue %u mbuf nums: %u\n",
+ port_id, queue_id, ret);
+}
+
+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, port,
+ "port");
+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_cleanup =
+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, keyword,
+ "cleanup");
+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, port_id,
+ RTE_UINT16);
+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_txq =
+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, name,
+ "txq");
+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_queue_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, queue_id,
+ RTE_UINT16);
+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_free_cnt =
+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, free_cnt,
+ RTE_UINT32);
+
+cmdline_parse_inst_t cmd_cleanup_txq_mbufs = {
+ .f = cmd_cleanup_txq_mbufs_parsed,
+ .data = NULL,
+ .help_str = "port cleanup <port_id> txq <queue_id> <free_cnt>",
+ .tokens = {
+ (void *)&cmd_cleanup_txq_mbufs_port,
+ (void *)&cmd_cleanup_txq_mbufs_cleanup,
+ (void *)&cmd_cleanup_txq_mbufs_port_id,
+ (void *)&cmd_cleanup_txq_mbufs_txq,
+ (void *)&cmd_cleanup_txq_mbufs_queue_id,
+ (void *)&cmd_cleanup_txq_mbufs_free_cnt,
+ NULL,
+ },
+};
+
/* *** configure port rxq/txq ring size *** */
struct cmd_config_rxtx_ring_size {
cmdline_fixed_string_t port;
if (!numa_support || socket_id == NUMA_NO_CONFIG)
socket_id = port->socket_id;
+ if (port->nb_tx_desc[res->qid] < tx_pkt_nb_segs) {
+ printf("Failed to setup TX queue: not enough descriptors\n");
+ return;
+ }
ret = rte_eth_tx_queue_setup(res->portid,
res->qid,
port->nb_tx_desc[res->qid],
__rte_unused void *data)
{
struct cmd_config_dcb *res = parsed_result;
+ struct rte_eth_dcb_info dcb_info;
portid_t port_id = res->port_id;
struct rte_port *port;
uint8_t pfc_en;
printf("nb_cores shouldn't be less than number of TCs.\n");
return;
}
+
+ /* Check whether the port supports the report of DCB info. */
+ ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info);
+ if (ret == -ENOTSUP) {
+ printf("rte_eth_dev_get_dcb_info not supported.\n");
+ return;
+ }
+
if (!strncmp(res->pfc_en, "on", 2))
pfc_en = 1;
else
ret = init_port_dcb_config(port_id, DCB_ENABLED,
(enum rte_eth_nb_tcs)res->num_tcs,
pfc_en);
-
-
if (ret != 0) {
printf("Cannot initialize network ports.\n");
return;
}
+ fwd_config_setup();
+
cmd_reconfig_device_queue(port_id, 1, 1);
}
int k;
/* Apply queue tx offloads configuration */
- for (k = 0; k < port->dev_info.max_rx_queues; k++)
+ for (k = 0; k < port->dev_info.max_tx_queues; k++)
port->tx_conf[k].offloads =
port->dev_conf.txmode.offloads;
}
},
};
+/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */
+struct cmd_link_flow_ctrl_show {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t port;
+ portid_t port_id;
+ cmdline_fixed_string_t flow_ctrl;
+};
+
+cmdline_parse_token_string_t cmd_lfc_show_show =
+ TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show,
+ show, "show");
+cmdline_parse_token_string_t cmd_lfc_show_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show,
+ port, "port");
+cmdline_parse_token_num_t cmd_lfc_show_portid =
+ TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show,
+ port_id, RTE_UINT16);
+cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl =
+ TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show,
+ flow_ctrl, "flow_ctrl");
+
+static void
+cmd_link_flow_ctrl_show_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_link_flow_ctrl_show *res = parsed_result;
+ static const char *info_border = "*********************";
+ struct rte_eth_fc_conf fc_conf;
+ bool rx_fc_en = false;
+ bool tx_fc_en = false;
+ int ret;
+
+ ret = rte_eth_dev_flow_ctrl_get(res->port_id, &fc_conf);
+ if (ret != 0) {
+ printf("Failed to get current flow ctrl information: err = %d\n",
+ ret);
+ return;
+ }
+
+ if (fc_conf.mode == RTE_FC_RX_PAUSE || fc_conf.mode == RTE_FC_FULL)
+ rx_fc_en = true;
+ if (fc_conf.mode == RTE_FC_TX_PAUSE || fc_conf.mode == RTE_FC_FULL)
+ tx_fc_en = true;
+
+ printf("\n%s Flow control infos for port %-2d %s\n",
+ info_border, res->port_id, info_border);
+ printf("FC mode:\n");
+ printf(" Rx pause: %s\n", rx_fc_en ? "on" : "off");
+ printf(" Tx pause: %s\n", tx_fc_en ? "on" : "off");
+ printf("Autoneg: %s\n", fc_conf.autoneg ? "on" : "off");
+ printf("Pause time: 0x%x\n", fc_conf.pause_time);
+ printf("High waterline: 0x%x\n", fc_conf.high_water);
+ printf("Low waterline: 0x%x\n", fc_conf.low_water);
+ printf("Send XON: %s\n", fc_conf.send_xon ? "on" : "off");
+ printf("Forward MAC control frames: %s\n",
+ fc_conf.mac_ctrl_frame_fwd ? "on" : "off");
+ printf("\n%s************** End ***********%s\n",
+ info_border, info_border);
+}
+
+cmdline_parse_inst_t cmd_link_flow_control_show = {
+ .f = cmd_link_flow_ctrl_show_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> flow_ctrl",
+ .tokens = {
+ (void *)&cmd_lfc_show_show,
+ (void *)&cmd_lfc_show_port,
+ (void *)&cmd_lfc_show_portid,
+ (void *)&cmd_lfc_show_flow_ctrl,
+ NULL,
+ },
+};
+
/* *** SETUP ETHERNET LINK FLOW CONTROL *** */
struct cmd_link_flow_ctrl_set_result {
cmdline_fixed_string_t set;
fprintf(f,
"Total : size(M) total: %.6lf alloc: %.6lf(%.3lf%%) free: %.6lf \tcount alloc: %-4u free: %u\n",
(double)total / (1024 * 1024), (double)alloc / (1024 * 1024),
- (double)alloc * 100 / (double)total,
+ total ? ((double)alloc * 100 / (double)total) : 0,
(double)free / (1024 * 1024),
n_alloc, n_free);
if (last_allocs)
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon,
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd,
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg,
+ (cmdline_parse_inst_t *)&cmd_link_flow_control_show,
(cmdline_parse_inst_t *)&cmd_priority_flow_control_set,
(cmdline_parse_inst_t *)&cmd_config_dcb,
(cmdline_parse_inst_t *)&cmd_read_reg,
(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,
+ (cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs,
(cmdline_parse_inst_t *)&cmd_dump,
(cmdline_parse_inst_t *)&cmd_dump_one,
#ifdef RTE_NET_I40E
(cmdline_parse_inst_t *)&cmd_enable_port_meter,
(cmdline_parse_inst_t *)&cmd_disable_port_meter,
(cmdline_parse_inst_t *)&cmd_del_port_meter,
+ (cmdline_parse_inst_t *)&cmd_del_port_meter_policy,
(cmdline_parse_inst_t *)&cmd_set_port_meter_profile,
(cmdline_parse_inst_t *)&cmd_set_port_meter_dscp_table,
- (cmdline_parse_inst_t *)&cmd_set_port_meter_policer_action,
(cmdline_parse_inst_t *)&cmd_set_port_meter_stats_mask,
(cmdline_parse_inst_t *)&cmd_show_port_meter_stats,
(cmdline_parse_inst_t *)&cmd_mcast_addr,