"set flow_ctrl rx (on|off) tx (on|off) (high_water)"
" (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd"
- " (on|off) (port_id)\n"
+ " (on|off) autoneg (on|off) (port_id)\n"
" Set the link flow control parameter on a port.\n\n"
"set pfc_ctrl rx (on|off) tx (on|off) (high_water)"
if(size >= sizeof(s))
return -1;
- rte_snprintf(s, sizeof(s), "%.*s", size, p);
+ snprintf(s, sizeof(s), "%.*s", size, p);
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
return -1;
for (i = 0; i < _NUM_FLD; i++) {
cmdline_parse_token_string_t *token_struct;
modes = list_pkt_forwarding_modes();
- rte_snprintf(help, sizeof help, "set fwd %s - "
+ snprintf(help, sizeof help, "set fwd %s - "
"set packet forwarding mode", modes);
cmd_set_fwd_mode.help_str = help;
cmdline_fixed_string_t tx_lfc_mode;
cmdline_fixed_string_t mac_ctrl_frame_fwd;
cmdline_fixed_string_t mac_ctrl_frame_fwd_mode;
+ cmdline_fixed_string_t autoneg_str;
+ cmdline_fixed_string_t autoneg;
uint32_t high_water;
uint32_t low_water;
uint16_t pause_time;
uint8_t port_id;
};
-static void
-cmd_link_flow_ctrl_set_parsed(void *parsed_result,
- __attribute__((unused)) struct cmdline *cl,
- __attribute__((unused)) void *data)
-{
- struct cmd_link_flow_ctrl_set_result *res = parsed_result;
- struct rte_eth_fc_conf fc_conf;
- int rx_fc_enable, tx_fc_enable, mac_ctrl_frame_fwd;
- int ret;
-
- /*
- * Rx on/off, flow control is enabled/disabled on RX side. This can indicate
- * the RTE_FC_TX_PAUSE, Transmit pause frame at the Rx side.
- * Tx on/off, flow control is enabled/disabled on TX side. This can indicate
- * the RTE_FC_RX_PAUSE, Respond to the pause frame at the Tx side.
- */
- static enum rte_eth_fc_mode rx_tx_onoff_2_lfc_mode[2][2] = {
- {RTE_FC_NONE, RTE_FC_TX_PAUSE}, {RTE_FC_RX_PAUSE, RTE_FC_FULL}
- };
-
- rx_fc_enable = (!strcmp(res->rx_lfc_mode, "on")) ? 1 : 0;
- tx_fc_enable = (!strcmp(res->tx_lfc_mode, "on")) ? 1 : 0;
- mac_ctrl_frame_fwd = (!strcmp(res->mac_ctrl_frame_fwd_mode, "on")) ? 1 : 0;
-
- fc_conf.mode = rx_tx_onoff_2_lfc_mode[rx_fc_enable][tx_fc_enable];
- fc_conf.high_water = res->high_water;
- fc_conf.low_water = res->low_water;
- fc_conf.pause_time = res->pause_time;
- fc_conf.send_xon = res->send_xon;
- fc_conf.mac_ctrl_frame_fwd = (uint8_t)mac_ctrl_frame_fwd;
-
- ret = rte_eth_dev_flow_ctrl_set(res->port_id, &fc_conf);
- if (ret != 0)
- printf("bad flow contrl parameter, return code = %d \n", ret);
-}
-
cmdline_parse_token_string_t cmd_lfc_set_set =
TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
set, "set");
cmdline_parse_token_string_t cmd_lfc_set_mac_ctrl_frame_fwd =
TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
mac_ctrl_frame_fwd_mode, "on#off");
+cmdline_parse_token_string_t cmd_lfc_set_autoneg_str =
+ TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
+ autoneg_str, "autoneg");
+cmdline_parse_token_string_t cmd_lfc_set_autoneg =
+ TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
+ autoneg, "on#off");
cmdline_parse_token_num_t cmd_lfc_set_portid =
TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
port_id, UINT8);
.data = NULL,
.help_str = "Configure the Ethernet flow control: set flow_ctrl rx on|off \
tx on|off high_water low_water pause_time send_xon mac_ctrl_frame_fwd on|off \
-port_id",
+autoneg on|off port_id",
.tokens = {
(void *)&cmd_lfc_set_set,
(void *)&cmd_lfc_set_flow_ctrl,
(void *)&cmd_lfc_set_send_xon,
(void *)&cmd_lfc_set_mac_ctrl_frame_fwd_mode,
(void *)&cmd_lfc_set_mac_ctrl_frame_fwd,
+ (void *)&cmd_lfc_set_autoneg_str,
+ (void *)&cmd_lfc_set_autoneg,
(void *)&cmd_lfc_set_portid,
NULL,
},
};
+static void
+cmd_link_flow_ctrl_set_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_link_flow_ctrl_set_result *res = parsed_result;
+ struct rte_eth_fc_conf fc_conf;
+ int rx_fc_enable, tx_fc_enable, mac_ctrl_frame_fwd;
+ int ret;
+
+ /*
+ * Rx on/off, flow control is enabled/disabled on RX side. This can indicate
+ * the RTE_FC_TX_PAUSE, Transmit pause frame at the Rx side.
+ * Tx on/off, flow control is enabled/disabled on TX side. This can indicate
+ * the RTE_FC_RX_PAUSE, Respond to the pause frame at the Tx side.
+ */
+ static enum rte_eth_fc_mode rx_tx_onoff_2_lfc_mode[2][2] = {
+ {RTE_FC_NONE, RTE_FC_TX_PAUSE}, {RTE_FC_RX_PAUSE, RTE_FC_FULL}
+ };
+
+ rx_fc_enable = (!strcmp(res->rx_lfc_mode, "on")) ? 1 : 0;
+ tx_fc_enable = (!strcmp(res->tx_lfc_mode, "on")) ? 1 : 0;
+ mac_ctrl_frame_fwd = (!strcmp(res->mac_ctrl_frame_fwd_mode, "on")) ? 1 : 0;
+
+ fc_conf.mode = rx_tx_onoff_2_lfc_mode[rx_fc_enable][tx_fc_enable];
+ fc_conf.high_water = res->high_water;
+ fc_conf.low_water = res->low_water;
+ fc_conf.pause_time = res->pause_time;
+ fc_conf.send_xon = res->send_xon;
+ fc_conf.mac_ctrl_frame_fwd = (uint8_t)mac_ctrl_frame_fwd;
+ fc_conf.autoneg = (!strcmp(res->autoneg, "on")) ? 1 : 0;
+
+ ret = rte_eth_dev_flow_ctrl_set(res->port_id, &fc_conf);
+ if (ret != 0)
+ printf("bad flow contrl parameter, return code = %d \n", ret);
+}
+
/* *** SETUP ETHERNET PIRORITY FLOW CONTROL *** */
struct cmd_priority_flow_ctrl_set_result {
cmdline_fixed_string_t set;