"clear vf stats (port_id) (vf_id)\n"
" Reset a VF's statistics.\n\n"
+
+ "show port (port_id) pctype mapping\n"
+ " Get flow ptype to pctype mapping on a port\n\n"
+
);
}
"tso show (portid)"
" Display the status of TCP Segmentation Offload.\n\n"
- "gro (on|off) (port_id)"
- " Enable or disable Generic Receive Offload in io"
- " forward engine.\n\n"
+ "set port (port_id) gro on|off\n"
+ " Enable or disable Generic Receive Offload in"
+ " csum forwarding engine.\n\n"
+
+ "show port (port_id) gro\n"
+ " Display GRO configuration.\n\n"
+
+ "set gro flush (cycles)\n"
+ " Set the cycle to flush GROed packets from"
+ " reassembly tables.\n\n"
+
+ "set port (port_id) gso (on|off)"
+ " Enable or disable Generic Segmentation Offload in"
+ " csum forwarding engine.\n\n"
+
+ "set gso segsz (length)\n"
+ " Set max packet length for output GSO segments,"
+ " including packet header and payload.\n\n"
- "gro set (max_flow_num) (max_item_num_per_flow) (port_id)\n"
- " Set max flow number and max packet number per-flow"
- " for GRO.\n\n"
+ "show port (port_id) gso\n"
+ " Show GSO configuration.\n\n"
"set fwd (%s)\n"
" Set packet forwarding mode.\n\n"
"E-tag set filter del e-tag-id (value) port (port_id)\n"
" Delete an E-tag forwarding filter on a port\n\n"
+#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
+ "set port tm hierarchy default (port_id)\n"
+ " Set default traffic Management hierarchy on a port\n\n"
+
+#endif
"ddp add (port_id) (profile_path[,output_path])\n"
" Load a profile package on a port\n\n"
"port config all max-pkt-len (value)\n"
" Set the max packet length.\n\n"
- "port config all (crc-strip|scatter|rx-cksum|hw-vlan|hw-vlan-filter|"
+ "port config all (crc-strip|scatter|rx-cksum|rx-timestamp|hw-vlan|hw-vlan-filter|"
"hw-vlan-strip|hw-vlan-extend|drop-en)"
" (on|off)\n"
" Set crc-strip/scatter/rx-checksum/hardware-vlan/drop_en"
" for ports.\n\n"
- "port config all rss (all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none)\n"
+ "port config all rss (all|ip|tcp|udp|sctp|ether|port|vxlan|"
+ "geneve|nvgre|none|<flowtype_id>)\n"
" Set the RSS mode.\n\n"
"port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
"port config (port_id|all) l2-tunnel E-tag"
" (enable|disable)\n"
" Enable/disable the E-tag support.\n\n"
+
+ "port config (port_id) pctype mapping reset\n"
+ " Reset flow type to pctype mapping on a port\n\n"
+
+ "port config (port_id) pctype mapping update"
+ " (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n"
+ " Update a flow type to pctype mapping item on a port\n\n"
);
}
"set_hash_input_set (port_id) (ipv4|ipv4-frag|"
"ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|"
"ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|"
- "l2_payload) (ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|"
- "dst-ipv6|ipv4-tos|ipv4-proto|ipv6-tc|"
+ "l2_payload|<flowtype_id>) (ovlan|ivlan|src-ipv4|dst-ipv4|"
+ "src-ipv6|dst-ipv6|ipv4-tos|ipv4-proto|ipv6-tc|"
"ipv6-next-header|udp-src-port|udp-dst-port|"
"tcp-src-port|tcp-dst-port|sctp-src-port|"
"sctp-dst-port|sctp-veri-tag|udp-key|gre-key|fld-1st|"
stop_port(RTE_PORT_ALL);
else if (!strcmp(res->name, "close"))
close_port(RTE_PORT_ALL);
+ else if (!strcmp(res->name, "reset"))
+ reset_port(RTE_PORT_ALL);
else
printf("Unknown parameter\n");
}
"port");
cmdline_parse_token_string_t cmd_operate_port_all_port =
TOKEN_STRING_INITIALIZER(struct cmd_operate_port_result, name,
- "start#stop#close");
+ "start#stop#close#reset");
cmdline_parse_token_string_t cmd_operate_port_all_all =
TOKEN_STRING_INITIALIZER(struct cmd_operate_port_result, value, "all");
cmdline_parse_inst_t cmd_operate_port = {
.f = cmd_operate_port_parsed,
.data = NULL,
- .help_str = "port start|stop|close all: Start/Stop/Close all ports",
+ .help_str = "port start|stop|close all: Start/Stop/Close/Reset all ports",
.tokens = {
(void *)&cmd_operate_port_all_cmd,
(void *)&cmd_operate_port_all_port,
stop_port(res->value);
else if (!strcmp(res->name, "close"))
close_port(res->value);
+ else if (!strcmp(res->name, "reset"))
+ reset_port(res->value);
else
printf("Unknown parameter\n");
}
keyword, "port");
cmdline_parse_token_string_t cmd_operate_specific_port_port =
TOKEN_STRING_INITIALIZER(struct cmd_operate_specific_port_result,
- name, "start#stop#close");
+ name, "start#stop#close#reset");
cmdline_parse_token_num_t cmd_operate_specific_port_id =
TOKEN_NUM_INITIALIZER(struct cmd_operate_specific_port_result,
value, UINT8);
cmdline_parse_inst_t cmd_operate_specific_port = {
.f = cmd_operate_specific_port_parsed,
.data = NULL,
- .help_str = "port start|stop|close <port_id>: Start/Stop/Close port_id",
+ .help_str = "port start|stop|close <port_id>: Start/Stop/Close/Reset port_id",
.tokens = {
(void *)&cmd_operate_specific_port_cmd,
(void *)&cmd_operate_specific_port_port,
printf("Unknown parameter\n");
return;
}
+ } else if (!strcmp(res->name, "rx-timestamp")) {
+ if (!strcmp(res->value, "on"))
+ rx_mode.hw_timestamp = 1;
+ else if (!strcmp(res->value, "off"))
+ rx_mode.hw_timestamp = 0;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
} else if (!strcmp(res->name, "hw-vlan")) {
if (!strcmp(res->value, "on")) {
rx_mode.hw_vlan_filter = 1;
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, all, "all");
cmdline_parse_token_string_t cmd_config_rx_mode_flag_name =
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, name,
- "crc-strip#scatter#rx-cksum#hw-vlan#"
+ "crc-strip#scatter#rx-cksum#rx-timestamp#hw-vlan#"
"hw-vlan-filter#hw-vlan-strip#hw-vlan-extend");
cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value,
cmdline_parse_inst_t cmd_config_rx_mode_flag = {
.f = cmd_config_rx_mode_flag_parsed,
.data = NULL,
- .help_str = "port config all crc-strip|scatter|rx-cksum|hw-vlan|"
+ .help_str = "port config all crc-strip|scatter|rx-cksum|rx-timestamp|hw-vlan|"
"hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
.tokens = {
(void *)&cmd_config_rx_mode_flag_port,
rss_conf.rss_hf = ETH_RSS_NVGRE;
else if (!strcmp(res->value, "none"))
rss_conf.rss_hf = 0;
+ else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
+ atoi(res->value) < 64)
+ rss_conf.rss_hf = 1ULL << atoi(res->value);
else {
printf("Unknown parameter\n");
return;
cmdline_parse_token_string_t cmd_config_rss_name =
TOKEN_STRING_INITIALIZER(struct cmd_config_rss, name, "rss");
cmdline_parse_token_string_t cmd_config_rss_value =
- TOKEN_STRING_INITIALIZER(struct cmd_config_rss, value,
- "all#ip#tcp#udp#sctp#ether#port#vxlan#geneve#nvgre#none");
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss, value, NULL);
cmdline_parse_inst_t cmd_config_rss = {
.f = cmd_config_rss_parsed,
.data = NULL,
.help_str = "port config all rss "
- "all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none",
+ "all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none|<flowtype_id>",
.tokens = {
(void *)&cmd_config_rss_port,
(void *)&cmd_config_rss_keyword,
struct cmd_showport_reta *res = parsed_result;
struct rte_eth_rss_reta_entry64 reta_conf[8];
struct rte_eth_dev_info dev_info;
+ uint16_t max_reta_size;
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(res->port_id, &dev_info);
- if (dev_info.reta_size == 0 || res->size != dev_info.reta_size ||
- res->size > ETH_RSS_RETA_SIZE_512) {
- printf("Invalid redirection table size: %u\n", res->size);
+ max_reta_size = RTE_MIN(dev_info.reta_size, ETH_RSS_RETA_SIZE_512);
+ if (res->size == 0 || res->size > max_reta_size) {
+ printf("Invalid redirection table size: %u (1-%u)\n",
+ res->size, max_reta_size);
return;
}
};
/* *** SET GRO FOR A PORT *** */
-struct cmd_gro_result {
+struct cmd_gro_enable_result {
+ cmdline_fixed_string_t cmd_set;
+ cmdline_fixed_string_t cmd_port;
cmdline_fixed_string_t cmd_keyword;
- cmdline_fixed_string_t mode;
- uint8_t port_id;
+ cmdline_fixed_string_t cmd_onoff;
+ portid_t cmd_pid;
};
static void
-cmd_enable_gro_parsed(void *parsed_result,
+cmd_gro_enable_parsed(void *parsed_result,
__attribute__((unused)) struct cmdline *cl,
__attribute__((unused)) void *data)
{
- struct cmd_gro_result *res;
+ struct cmd_gro_enable_result *res;
res = parsed_result;
- setup_gro(res->mode, res->port_id);
+ if (!strcmp(res->cmd_keyword, "gro"))
+ setup_gro(res->cmd_onoff, res->cmd_pid);
+}
+
+cmdline_parse_token_string_t cmd_gro_enable_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_set, "set");
+cmdline_parse_token_string_t cmd_gro_enable_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_keyword, "port");
+cmdline_parse_token_num_t cmd_gro_enable_pid =
+ TOKEN_NUM_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_pid, UINT16);
+cmdline_parse_token_string_t cmd_gro_enable_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_keyword, "gro");
+cmdline_parse_token_string_t cmd_gro_enable_onoff =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_onoff, "on#off");
+
+cmdline_parse_inst_t cmd_gro_enable = {
+ .f = cmd_gro_enable_parsed,
+ .data = NULL,
+ .help_str = "set port <port_id> gro on|off",
+ .tokens = {
+ (void *)&cmd_gro_enable_set,
+ (void *)&cmd_gro_enable_port,
+ (void *)&cmd_gro_enable_pid,
+ (void *)&cmd_gro_enable_keyword,
+ (void *)&cmd_gro_enable_onoff,
+ NULL,
+ },
+};
+
+/* *** DISPLAY GRO CONFIGURATION *** */
+struct cmd_gro_show_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_gro_show_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_gro_show_result *res;
+
+ res = parsed_result;
+ if (!strcmp(res->cmd_keyword, "gro"))
+ show_gro(res->cmd_pid);
+}
+
+cmdline_parse_token_string_t cmd_gro_show_show =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result,
+ cmd_show, "show");
+cmdline_parse_token_string_t cmd_gro_show_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result,
+ cmd_port, "port");
+cmdline_parse_token_num_t cmd_gro_show_pid =
+ TOKEN_NUM_INITIALIZER(struct cmd_gro_show_result,
+ cmd_pid, UINT16);
+cmdline_parse_token_string_t cmd_gro_show_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result,
+ cmd_keyword, "gro");
+
+cmdline_parse_inst_t cmd_gro_show = {
+ .f = cmd_gro_show_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> gro",
+ .tokens = {
+ (void *)&cmd_gro_show_show,
+ (void *)&cmd_gro_show_port,
+ (void *)&cmd_gro_show_pid,
+ (void *)&cmd_gro_show_keyword,
+ NULL,
+ },
+};
+
+/* *** SET FLUSH CYCLES FOR GRO *** */
+struct cmd_gro_flush_result {
+ cmdline_fixed_string_t cmd_set;
+ cmdline_fixed_string_t cmd_keyword;
+ cmdline_fixed_string_t cmd_flush;
+ uint8_t cmd_cycles;
+};
+
+static void
+cmd_gro_flush_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_gro_flush_result *res;
+
+ res = parsed_result;
+ if ((!strcmp(res->cmd_keyword, "gro")) &&
+ (!strcmp(res->cmd_flush, "flush")))
+ setup_gro_flush_cycles(res->cmd_cycles);
}
-cmdline_parse_token_string_t cmd_gro_keyword =
- TOKEN_STRING_INITIALIZER(struct cmd_gro_result,
+cmdline_parse_token_string_t cmd_gro_flush_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result,
+ cmd_set, "set");
+cmdline_parse_token_string_t cmd_gro_flush_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result,
cmd_keyword, "gro");
-cmdline_parse_token_string_t cmd_gro_mode =
- TOKEN_STRING_INITIALIZER(struct cmd_gro_result,
- mode, "on#off");
-cmdline_parse_token_num_t cmd_gro_pid =
- TOKEN_NUM_INITIALIZER(struct cmd_gro_result,
- port_id, UINT8);
+cmdline_parse_token_string_t cmd_gro_flush_flush =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result,
+ cmd_flush, "flush");
+cmdline_parse_token_num_t cmd_gro_flush_cycles =
+ TOKEN_NUM_INITIALIZER(struct cmd_gro_flush_result,
+ cmd_cycles, UINT8);
-cmdline_parse_inst_t cmd_enable_gro = {
- .f = cmd_enable_gro_parsed,
+cmdline_parse_inst_t cmd_gro_flush = {
+ .f = cmd_gro_flush_parsed,
.data = NULL,
- .help_str = "gro (on|off) (port_id)",
+ .help_str = "set gro flush <cycles>",
.tokens = {
- (void *)&cmd_gro_keyword,
- (void *)&cmd_gro_mode,
- (void *)&cmd_gro_pid,
+ (void *)&cmd_gro_flush_set,
+ (void *)&cmd_gro_flush_keyword,
+ (void *)&cmd_gro_flush_flush,
+ (void *)&cmd_gro_flush_cycles,
NULL,
},
};
-/* *** SET MAX FLOW NUMBER AND ITEM NUM PER FLOW FOR GRO *** */
-struct cmd_gro_set_result {
- cmdline_fixed_string_t gro;
- cmdline_fixed_string_t mode;
- uint16_t flow_num;
- uint16_t item_num_per_flow;
- uint8_t port_id;
+/* *** ENABLE/DISABLE GSO *** */
+struct cmd_gso_enable_result {
+ cmdline_fixed_string_t cmd_set;
+ cmdline_fixed_string_t cmd_port;
+ cmdline_fixed_string_t cmd_keyword;
+ cmdline_fixed_string_t cmd_mode;
+ portid_t cmd_pid;
+};
+
+static void
+cmd_gso_enable_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_gso_enable_result *res;
+
+ res = parsed_result;
+ if (!strcmp(res->cmd_keyword, "gso"))
+ setup_gso(res->cmd_mode, res->cmd_pid);
+}
+
+cmdline_parse_token_string_t cmd_gso_enable_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result,
+ cmd_set, "set");
+cmdline_parse_token_string_t cmd_gso_enable_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result,
+ cmd_port, "port");
+cmdline_parse_token_string_t cmd_gso_enable_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result,
+ cmd_keyword, "gso");
+cmdline_parse_token_string_t cmd_gso_enable_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result,
+ cmd_mode, "on#off");
+cmdline_parse_token_num_t cmd_gso_enable_pid =
+ TOKEN_NUM_INITIALIZER(struct cmd_gso_enable_result,
+ cmd_pid, UINT16);
+
+cmdline_parse_inst_t cmd_gso_enable = {
+ .f = cmd_gso_enable_parsed,
+ .data = NULL,
+ .help_str = "set port <port_id> gso on|off",
+ .tokens = {
+ (void *)&cmd_gso_enable_set,
+ (void *)&cmd_gso_enable_port,
+ (void *)&cmd_gso_enable_pid,
+ (void *)&cmd_gso_enable_keyword,
+ (void *)&cmd_gso_enable_mode,
+ NULL,
+ },
+};
+
+/* *** SET MAX PACKET LENGTH FOR GSO SEGMENTS *** */
+struct cmd_gso_size_result {
+ cmdline_fixed_string_t cmd_set;
+ cmdline_fixed_string_t cmd_keyword;
+ cmdline_fixed_string_t cmd_segsz;
+ uint16_t cmd_size;
};
static void
-cmd_gro_set_parsed(void *parsed_result,
+cmd_gso_size_parsed(void *parsed_result,
__attribute__((unused)) struct cmdline *cl,
__attribute__((unused)) void *data)
{
- struct cmd_gro_set_result *res = parsed_result;
+ struct cmd_gso_size_result *res = parsed_result;
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
if (test_done == 0) {
- printf("Before set GRO flow_num and item_num_per_flow,"
- " please stop forwarding first\n");
+ printf("Before setting GSO segsz, please first"
+ " stop fowarding\n");
return;
}
- if (!strcmp(res->mode, "set")) {
- if (res->flow_num == 0)
- printf("Invalid flow number. Revert to default value:"
- " %u.\n", GRO_DEFAULT_FLOW_NUM);
+ if (!strcmp(res->cmd_keyword, "gso") &&
+ !strcmp(res->cmd_segsz, "segsz")) {
+ if (res->cmd_size < RTE_GSO_SEG_SIZE_MIN)
+ printf("gso_size should be larger than %zu."
+ " Please input a legal value\n",
+ RTE_GSO_SEG_SIZE_MIN);
else
- gro_ports[res->port_id].param.max_flow_num =
- res->flow_num;
+ gso_max_segment_size = res->cmd_size;
+ }
+}
- if (res->item_num_per_flow == 0)
- printf("Invalid item number per-flow. Revert"
- " to default value:%u.\n",
- GRO_DEFAULT_ITEM_NUM_PER_FLOW);
- else
- gro_ports[res->port_id].param.max_item_per_flow =
- res->item_num_per_flow;
+cmdline_parse_token_string_t cmd_gso_size_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_gso_size_result,
+ cmd_set, "set");
+cmdline_parse_token_string_t cmd_gso_size_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gso_size_result,
+ cmd_keyword, "gso");
+cmdline_parse_token_string_t cmd_gso_size_segsz =
+ TOKEN_STRING_INITIALIZER(struct cmd_gso_size_result,
+ cmd_segsz, "segsz");
+cmdline_parse_token_num_t cmd_gso_size_size =
+ TOKEN_NUM_INITIALIZER(struct cmd_gso_size_result,
+ cmd_size, UINT16);
+
+cmdline_parse_inst_t cmd_gso_size = {
+ .f = cmd_gso_size_parsed,
+ .data = NULL,
+ .help_str = "set gso segsz <length>",
+ .tokens = {
+ (void *)&cmd_gso_size_set,
+ (void *)&cmd_gso_size_keyword,
+ (void *)&cmd_gso_size_segsz,
+ (void *)&cmd_gso_size_size,
+ NULL,
+ },
+};
+
+/* *** SHOW GSO CONFIGURATION *** */
+struct cmd_gso_show_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_gso_show_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_gso_show_result *res = parsed_result;
+
+ if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
+ printf("invalid port id %u\n", res->cmd_pid);
+ return;
+ }
+ if (!strcmp(res->cmd_keyword, "gso")) {
+ if (gso_ports[res->cmd_pid].enable) {
+ printf("Max GSO'd packet size: %uB\n"
+ "Supported GSO types: TCP/IPv4, "
+ "VxLAN with inner TCP/IPv4 packet, "
+ "GRE with inner TCP/IPv4 packet\n",
+ gso_max_segment_size);
+ } else
+ printf("GSO is not enabled on Port %u\n", res->cmd_pid);
}
}
-cmdline_parse_token_string_t cmd_gro_set_gro =
- TOKEN_STRING_INITIALIZER(struct cmd_gro_set_result,
- gro, "gro");
-cmdline_parse_token_string_t cmd_gro_set_mode =
- TOKEN_STRING_INITIALIZER(struct cmd_gro_set_result,
- mode, "set");
-cmdline_parse_token_num_t cmd_gro_set_flow_num =
- TOKEN_NUM_INITIALIZER(struct cmd_gro_set_result,
- flow_num, UINT16);
-cmdline_parse_token_num_t cmd_gro_set_item_num_per_flow =
- TOKEN_NUM_INITIALIZER(struct cmd_gro_set_result,
- item_num_per_flow, UINT16);
-cmdline_parse_token_num_t cmd_gro_set_portid =
- TOKEN_NUM_INITIALIZER(struct cmd_gro_set_result,
- port_id, UINT8);
+cmdline_parse_token_string_t cmd_gso_show_show =
+TOKEN_STRING_INITIALIZER(struct cmd_gso_show_result,
+ cmd_show, "show");
+cmdline_parse_token_string_t cmd_gso_show_port =
+TOKEN_STRING_INITIALIZER(struct cmd_gso_show_result,
+ cmd_port, "port");
+cmdline_parse_token_string_t cmd_gso_show_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gso_show_result,
+ cmd_keyword, "gso");
+cmdline_parse_token_num_t cmd_gso_show_pid =
+ TOKEN_NUM_INITIALIZER(struct cmd_gso_show_result,
+ cmd_pid, UINT16);
-cmdline_parse_inst_t cmd_gro_set = {
- .f = cmd_gro_set_parsed,
+cmdline_parse_inst_t cmd_gso_show = {
+ .f = cmd_gso_show_parsed,
.data = NULL,
- .help_str = "gro set <max_flow_num> <max_item_num_per_flow> "
- "<port_id>: set max flow number and max packet number per-flow "
- "for GRO",
+ .help_str = "show port <port_id> gso",
.tokens = {
- (void *)&cmd_gro_set_gro,
- (void *)&cmd_gro_set_mode,
- (void *)&cmd_gro_set_flow_num,
- (void *)&cmd_gro_set_item_num_per_flow,
- (void *)&cmd_gro_set_portid,
+ (void *)&cmd_gso_show_show,
+ (void *)&cmd_gso_show_port,
+ (void *)&cmd_gso_show_pid,
+ (void *)&cmd_gso_show_keyword,
NULL,
},
};
cmdline_fixed_string_t show;
cmdline_fixed_string_t bonding;
cmdline_fixed_string_t config;
- uint8_t port_id;
+ portid_t port_id;
};
static void cmd_show_bonding_config_parsed(void *parsed_result,
{
struct cmd_show_bonding_config_result *res = parsed_result;
int bonding_mode, agg_mode;
- uint8_t slaves[RTE_MAX_ETHPORTS];
+ portid_t slaves[RTE_MAX_ETHPORTS];
int num_slaves, num_active_slaves;
int primary_id;
int i;
memset(&filter, 0, sizeof(struct rte_eth_mac_filter));
- (void)rte_memcpy(&filter.mac_addr, &res->address, ETHER_ADDR_LEN);
+ rte_memcpy(&filter.mac_addr, &res->address, ETHER_ADDR_LEN);
/* set VF MAC filter */
filter.is_vf = 1;
__attribute__((unused)) void *data)
{
struct cmd_vf_mac_addr_result *res = parsed_result;
- int ret = 0;
+ int ret = -ENOTSUP;
+
+ if (strcmp(res->what, "add") != 0)
+ return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_i40e_add_vf_mac_addr(res->port_num, res->vf_num,
+ &res->address);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_bnxt_mac_addr_add(res->port_num, &res->address,
+ res->vf_num);
+#endif
- if (strcmp(res->what, "add") == 0)
- ret = rte_eth_dev_mac_addr_add(res->port_num,
- &res->address, res->vf_num);
if(ret < 0)
printf("vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
memset(&filter, 0, sizeof(filter));
if (!strcmp(res->mac, "mac_addr")) {
filter.flags |= RTE_ETHTYPE_FLAGS_MAC;
- (void)rte_memcpy(&filter.mac_addr, &res->mac_addr,
+ rte_memcpy(&filter.mac_addr, &res->mac_addr,
sizeof(struct ether_addr));
}
if (!strcmp(res->drop, "drop"))
if (!strcmp(flowtype_str[i].str, string))
return flowtype_str[i].type;
}
+
+ if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
+ return (uint16_t)atoi(string);
+
return RTE_ETH_FLOW_UNKNOWN;
}
#define IPV6_ADDR_TO_ARRAY(ip_addr, ip) \
do { \
if ((ip_addr).family == AF_INET6) \
- (void)rte_memcpy(&(ip), \
+ rte_memcpy(&(ip), \
&((ip_addr).addr.ipv6), \
sizeof(struct in6_addr)); \
else { \
}
if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
- (void)rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr,
+ rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr,
&res->mac_addr,
sizeof(struct ether_addr));
if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
- (void)rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr,
+ rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr,
&res->mac_addr,
sizeof(struct ether_addr));
entry.input.flow.tunnel_flow.tunnel_type =
rte_cpu_to_be_32(res->tunnel_id_value);
}
- (void)rte_memcpy(entry.input.flow_ext.flexbytes,
+ rte_memcpy(entry.input.flow_ext.flexbytes,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
memset(&port->dev_conf.fdir_conf.flex_conf.flex_mask[i],
0, sizeof(struct rte_eth_fdir_flex_mask));
port->dev_conf.fdir_conf.flex_conf.nb_flexmasks = 1;
- (void)rte_memcpy(&port->dev_conf.fdir_conf.flex_conf.flex_mask[0],
+ rte_memcpy(&port->dev_conf.fdir_conf.flex_conf.flex_mask[0],
&flex_mask,
sizeof(struct rte_eth_fdir_flex_mask));
cmd_reconfig_device_queue(res->port_id, 1, 1);
port_id, UINT8);
cmdline_parse_token_string_t cmd_set_hash_input_set_flow_type =
TOKEN_STRING_INITIALIZER(struct cmd_set_hash_input_set_result,
- flow_type,
- "ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#ipv4-other#"
- "ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#ipv6-other#l2_payload");
+ flow_type, NULL);
cmdline_parse_token_string_t cmd_set_hash_input_set_field =
TOKEN_STRING_INITIALIZER(struct cmd_set_hash_input_set_result,
inset_field,
.data = NULL,
.help_str = "set_hash_input_set <port_id> "
"ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
- "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload "
+ "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload|<flowtype_id> "
"ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|ipv4-tos|ipv4-proto|"
"ipv6-tc|ipv6-next-header|udp-src-port|udp-dst-port|tcp-src-port|"
"tcp-dst-port|sctp-src-port|sctp-dst-port|sctp-veri-tag|udp-key|"
cmdline_fixed_string_t vf;
cmdline_fixed_string_t vlan;
cmdline_fixed_string_t stripq;
- uint8_t port_id;
+ portid_t port_id;
uint16_t vf_id;
cmdline_fixed_string_t on_off;
};
},
};
+
+#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
+
+/* *** Set Port default Traffic Management Hierarchy *** */
+struct cmd_set_port_tm_hierarchy_default_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t tm;
+ cmdline_fixed_string_t hierarchy;
+ cmdline_fixed_string_t def;
+ uint16_t port_id;
+};
+
+cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_set =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_tm_hierarchy_default_result, set, "set");
+cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_tm_hierarchy_default_result, port, "port");
+cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_tm =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_tm_hierarchy_default_result, tm, "tm");
+cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_hierarchy =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_tm_hierarchy_default_result,
+ hierarchy, "hierarchy");
+cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_default =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_tm_hierarchy_default_result,
+ def, "default");
+cmdline_parse_token_num_t cmd_set_port_tm_hierarchy_default_port_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_set_port_tm_hierarchy_default_result,
+ port_id, UINT8);
+
+static void cmd_set_port_tm_hierarchy_default_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_set_port_tm_hierarchy_default_result *res = parsed_result;
+ struct rte_port *p;
+ uint16_t port_id = res->port_id;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
+ p = &ports[port_id];
+
+ /* Port tm flag */
+ if (p->softport.tm_flag == 0) {
+ printf(" tm not enabled on port %u (error)\n", port_id);
+ return;
+ }
+
+ /* Forward mode: tm */
+ if (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, "tm")) {
+ printf(" tm mode not enabled(error)\n");
+ return;
+ }
+
+ /* Set the default tm hierarchy */
+ p->softport.tm.default_hierarchy_enable = 1;
+}
+
+cmdline_parse_inst_t cmd_set_port_tm_hierarchy_default = {
+ .f = cmd_set_port_tm_hierarchy_default_parsed,
+ .data = NULL,
+ .help_str = "set port tm hierarchy default <port_id>",
+ .tokens = {
+ (void *)&cmd_set_port_tm_hierarchy_default_set,
+ (void *)&cmd_set_port_tm_hierarchy_default_port,
+ (void *)&cmd_set_port_tm_hierarchy_default_tm,
+ (void *)&cmd_set_port_tm_hierarchy_default_hierarchy,
+ (void *)&cmd_set_port_tm_hierarchy_default_default,
+ (void *)&cmd_set_port_tm_hierarchy_default_port_id,
+ NULL,
+ },
+};
+#endif
+
/* Strict link priority scheduling mode setting */
static void
cmd_strict_link_prio_parsed(
uint32_t pkg_size;
int ret = -ENOTSUP;
#ifdef RTE_LIBRTE_I40E_PMD
- uint32_t i;
+ uint32_t i, j, n;
uint8_t *buff;
- uint32_t buff_size;
+ uint32_t buff_size = 0;
struct rte_pmd_i40e_profile_info info;
- uint32_t dev_num;
+ uint32_t dev_num = 0;
struct rte_pmd_i40e_ddp_device_id *devs;
+ uint32_t proto_num = 0;
+ struct rte_pmd_i40e_proto_info *proto;
+ uint32_t pctype_num = 0;
+ struct rte_pmd_i40e_ptype_info *pctype;
+ uint32_t ptype_num = 0;
+ struct rte_pmd_i40e_ptype_info *ptype;
+ uint8_t proto_id;
+
#endif
pkg = open_ddp_package_file(res->filepath, &pkg_size);
(uint8_t *)&dev_num, sizeof(dev_num),
RTE_PMD_I40E_PKG_INFO_DEVID_NUM);
if (!ret && dev_num) {
- devs = (struct rte_pmd_i40e_ddp_device_id *)malloc(dev_num *
- sizeof(struct rte_pmd_i40e_ddp_device_id));
+ buff_size = dev_num * sizeof(struct rte_pmd_i40e_ddp_device_id);
+ devs = (struct rte_pmd_i40e_ddp_device_id *)malloc(buff_size);
if (devs) {
ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- (uint8_t *)devs, dev_num *
- sizeof(struct rte_pmd_i40e_ddp_device_id),
+ (uint8_t *)devs, buff_size,
RTE_PMD_I40E_PKG_INFO_DEVID_LIST);
if (!ret) {
printf("List of supported devices:\n");
free(devs);
}
}
+
+ /* get information about protocols and packet types */
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)&proto_num, sizeof(proto_num),
+ RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM);
+ if (ret || !proto_num)
+ goto no_print_return;
+
+ buff_size = proto_num * sizeof(struct rte_pmd_i40e_proto_info);
+ proto = (struct rte_pmd_i40e_proto_info *)malloc(buff_size);
+ if (!proto)
+ goto no_print_return;
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)proto,
+ buff_size,
+ RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST);
+ if (!ret) {
+ printf("List of used protocols:\n");
+ for (i = 0; i < proto_num; i++)
+ printf(" %2u: %s\n", proto[i].proto_id,
+ proto[i].name);
+ printf("\n");
+ }
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)&pctype_num, sizeof(pctype_num),
+ RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM);
+ if (ret || !pctype_num)
+ goto no_print_pctypes;
+
+ buff_size = pctype_num * sizeof(struct rte_pmd_i40e_ptype_info);
+ pctype = (struct rte_pmd_i40e_ptype_info *)malloc(buff_size);
+ if (!pctype)
+ goto no_print_pctypes;
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)pctype,
+ buff_size,
+ RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST);
+ if (ret) {
+ free(pctype);
+ goto no_print_pctypes;
+ }
+
+ printf("List of defined packet classification types:\n");
+ for (i = 0; i < pctype_num; i++) {
+ printf(" %2u:", pctype[i].ptype_id);
+ for (j = 0; j < RTE_PMD_I40E_PROTO_NUM; j++) {
+ proto_id = pctype[i].protocols[j];
+ if (proto_id != RTE_PMD_I40E_PROTO_UNUSED) {
+ for (n = 0; n < proto_num; n++) {
+ if (proto[n].proto_id == proto_id) {
+ printf(" %s", proto[n].name);
+ break;
+ }
+ }
+ }
+ }
+ printf("\n");
+ }
+ printf("\n");
+ free(pctype);
+
+no_print_pctypes:
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)&ptype_num,
+ sizeof(ptype_num),
+ RTE_PMD_I40E_PKG_INFO_PTYPE_NUM);
+ if (ret || !ptype_num)
+ goto no_print_return;
+
+ buff_size = ptype_num * sizeof(struct rte_pmd_i40e_ptype_info);
+ ptype = (struct rte_pmd_i40e_ptype_info *)malloc(buff_size);
+ if (!ptype)
+ goto no_print_return;
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)ptype,
+ buff_size,
+ RTE_PMD_I40E_PKG_INFO_PTYPE_LIST);
+ if (ret) {
+ free(ptype);
+ goto no_print_return;
+ }
+ printf("List of defined packet types:\n");
+ for (i = 0; i < ptype_num; i++) {
+ printf(" %2u:", ptype[i].ptype_id);
+ for (j = 0; j < RTE_PMD_I40E_PROTO_NUM; j++) {
+ proto_id = ptype[i].protocols[j];
+ if (proto_id != RTE_PMD_I40E_PROTO_UNUSED) {
+ for (n = 0; n < proto_num; n++) {
+ if (proto[n].proto_id == proto_id) {
+ printf(" %s", proto[n].name);
+ break;
+ }
+ }
+ }
+ }
+ printf("\n");
+ }
+ free(ptype);
+ printf("\n");
+
+ free(proto);
ret = 0;
+no_print_return:
#endif
if (ret == -ENOTSUP)
printf("Function not supported in PMD driver\n");
},
};
+/* port config pctype mapping reset */
+
+/* Common result structure for port config pctype mapping reset */
+struct cmd_pctype_mapping_reset_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t config;
+ uint8_t port_id;
+ cmdline_fixed_string_t pctype;
+ cmdline_fixed_string_t mapping;
+ cmdline_fixed_string_t reset;
+};
+
+/* Common CLI fields for port config pctype mapping reset*/
+cmdline_parse_token_string_t cmd_pctype_mapping_reset_port =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_reset_result,
+ port, "port");
+cmdline_parse_token_string_t cmd_pctype_mapping_reset_config =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_reset_result,
+ config, "config");
+cmdline_parse_token_num_t cmd_pctype_mapping_reset_port_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_pctype_mapping_reset_result,
+ port_id, UINT8);
+cmdline_parse_token_string_t cmd_pctype_mapping_reset_pctype =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_reset_result,
+ pctype, "pctype");
+cmdline_parse_token_string_t cmd_pctype_mapping_reset_mapping =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_reset_result,
+ mapping, "mapping");
+cmdline_parse_token_string_t cmd_pctype_mapping_reset_reset =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_reset_result,
+ reset, "reset");
+
+static void
+cmd_pctype_mapping_reset_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_pctype_mapping_reset_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ ret = rte_pmd_i40e_flow_type_mapping_reset(res->port_id);
+#endif
+
+ switch (ret) {
+ case 0:
+ break;
+ case -ENODEV:
+ printf("invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ printf("function not implemented\n");
+ break;
+ default:
+ printf("programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+cmdline_parse_inst_t cmd_pctype_mapping_reset = {
+ .f = cmd_pctype_mapping_reset_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype mapping reset",
+ .tokens = {
+ (void *)&cmd_pctype_mapping_reset_port,
+ (void *)&cmd_pctype_mapping_reset_config,
+ (void *)&cmd_pctype_mapping_reset_port_id,
+ (void *)&cmd_pctype_mapping_reset_pctype,
+ (void *)&cmd_pctype_mapping_reset_mapping,
+ (void *)&cmd_pctype_mapping_reset_reset,
+ NULL,
+ },
+};
+
+/* show port pctype mapping */
+
+/* Common result structure for show port pctype mapping */
+struct cmd_pctype_mapping_get_result {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t port;
+ uint8_t port_id;
+ cmdline_fixed_string_t pctype;
+ cmdline_fixed_string_t mapping;
+};
+
+/* Common CLI fields for pctype mapping get */
+cmdline_parse_token_string_t cmd_pctype_mapping_get_show =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_get_result,
+ show, "show");
+cmdline_parse_token_string_t cmd_pctype_mapping_get_port =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_get_result,
+ port, "port");
+cmdline_parse_token_num_t cmd_pctype_mapping_get_port_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_pctype_mapping_get_result,
+ port_id, UINT8);
+cmdline_parse_token_string_t cmd_pctype_mapping_get_pctype =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_get_result,
+ pctype, "pctype");
+cmdline_parse_token_string_t cmd_pctype_mapping_get_mapping =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_get_result,
+ mapping, "mapping");
+
+static void
+cmd_pctype_mapping_get_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_pctype_mapping_get_result *res = parsed_result;
+ int ret = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+ struct rte_pmd_i40e_flow_type_mapping
+ mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
+ int i, j, first_pctype;
+#endif
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ ret = rte_pmd_i40e_flow_type_mapping_get(res->port_id, mapping);
+#endif
+
+ switch (ret) {
+ case 0:
+ break;
+ case -ENODEV:
+ printf("invalid port_id %d\n", res->port_id);
+ return;
+ case -ENOTSUP:
+ printf("function not implemented\n");
+ return;
+ default:
+ printf("programming error: (%s)\n", strerror(-ret));
+ return;
+ }
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ for (i = 0; i < RTE_PMD_I40E_FLOW_TYPE_MAX; i++) {
+ if (mapping[i].pctype != 0ULL) {
+ first_pctype = 1;
+
+ printf("pctype: ");
+ for (j = 0; j < RTE_PMD_I40E_PCTYPE_MAX; j++) {
+ if (mapping[i].pctype & (1ULL << j)) {
+ printf(first_pctype ?
+ "%02d" : ",%02d", j);
+ first_pctype = 0;
+ }
+ }
+ printf(" -> flowtype: %02d\n", mapping[i].flow_type);
+ }
+ }
+#endif
+}
+
+cmdline_parse_inst_t cmd_pctype_mapping_get = {
+ .f = cmd_pctype_mapping_get_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> pctype mapping",
+ .tokens = {
+ (void *)&cmd_pctype_mapping_get_show,
+ (void *)&cmd_pctype_mapping_get_port,
+ (void *)&cmd_pctype_mapping_get_port_id,
+ (void *)&cmd_pctype_mapping_get_pctype,
+ (void *)&cmd_pctype_mapping_get_mapping,
+ NULL,
+ },
+};
+
+/* port config pctype mapping update */
+
+/* Common result structure for port config pctype mapping update */
+struct cmd_pctype_mapping_update_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t config;
+ uint8_t port_id;
+ cmdline_fixed_string_t pctype;
+ cmdline_fixed_string_t mapping;
+ cmdline_fixed_string_t update;
+ cmdline_fixed_string_t pctype_list;
+ uint16_t flow_type;
+};
+
+/* Common CLI fields for pctype mapping update*/
+cmdline_parse_token_string_t cmd_pctype_mapping_update_port =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_update_result,
+ port, "port");
+cmdline_parse_token_string_t cmd_pctype_mapping_update_config =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_update_result,
+ config, "config");
+cmdline_parse_token_num_t cmd_pctype_mapping_update_port_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_pctype_mapping_update_result,
+ port_id, UINT8);
+cmdline_parse_token_string_t cmd_pctype_mapping_update_pctype =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_update_result,
+ pctype, "pctype");
+cmdline_parse_token_string_t cmd_pctype_mapping_update_mapping =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_update_result,
+ mapping, "mapping");
+cmdline_parse_token_string_t cmd_pctype_mapping_update_update =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_update_result,
+ update, "update");
+cmdline_parse_token_string_t cmd_pctype_mapping_update_pc_type =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_pctype_mapping_update_result,
+ pctype_list, NULL);
+cmdline_parse_token_num_t cmd_pctype_mapping_update_flow_type =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_pctype_mapping_update_result,
+ flow_type, UINT16);
+
+static void
+cmd_pctype_mapping_update_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_pctype_mapping_update_result *res = parsed_result;
+ int ret = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+ struct rte_pmd_i40e_flow_type_mapping mapping;
+ unsigned int i;
+ unsigned int nb_item;
+ unsigned int pctype_list[RTE_PMD_I40E_PCTYPE_MAX];
+#endif
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ nb_item = parse_item_list(res->pctype_list, "pctypes",
+ RTE_PMD_I40E_PCTYPE_MAX, pctype_list, 1);
+ mapping.flow_type = res->flow_type;
+ for (i = 0, mapping.pctype = 0ULL; i < nb_item; i++)
+ mapping.pctype |= (1ULL << pctype_list[i]);
+ ret = rte_pmd_i40e_flow_type_mapping_update(res->port_id,
+ &mapping,
+ 1,
+ 0);
+#endif
+
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ printf("invalid pctype or flow type\n");
+ break;
+ case -ENODEV:
+ printf("invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ printf("function not implemented\n");
+ break;
+ default:
+ printf("programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+cmdline_parse_inst_t cmd_pctype_mapping_update = {
+ .f = cmd_pctype_mapping_update_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype mapping update"
+ " <pctype_id_0,[pctype_id_1]*> <flowtype_id>",
+ .tokens = {
+ (void *)&cmd_pctype_mapping_update_port,
+ (void *)&cmd_pctype_mapping_update_config,
+ (void *)&cmd_pctype_mapping_update_port_id,
+ (void *)&cmd_pctype_mapping_update_pctype,
+ (void *)&cmd_pctype_mapping_update_mapping,
+ (void *)&cmd_pctype_mapping_update_update,
+ (void *)&cmd_pctype_mapping_update_pc_type,
+ (void *)&cmd_pctype_mapping_update_flow_type,
+ NULL,
+ },
+};
+
/* ptype mapping get */
/* Common result structure for ptype mapping get */
(cmdline_parse_inst_t *)&cmd_tso_show,
(cmdline_parse_inst_t *)&cmd_tunnel_tso_set,
(cmdline_parse_inst_t *)&cmd_tunnel_tso_show,
- (cmdline_parse_inst_t *)&cmd_enable_gro,
- (cmdline_parse_inst_t *)&cmd_gro_set,
+ (cmdline_parse_inst_t *)&cmd_gro_enable,
+ (cmdline_parse_inst_t *)&cmd_gro_flush,
+ (cmdline_parse_inst_t *)&cmd_gro_show,
+ (cmdline_parse_inst_t *)&cmd_gso_enable,
+ (cmdline_parse_inst_t *)&cmd_gso_size,
+ (cmdline_parse_inst_t *)&cmd_gso_show,
(cmdline_parse_inst_t *)&cmd_link_flow_control_set,
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_rx,
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_tx,
(cmdline_parse_inst_t *)&cmd_vf_tc_max_bw,
(cmdline_parse_inst_t *)&cmd_strict_link_prio,
(cmdline_parse_inst_t *)&cmd_tc_min_bw,
+#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
+ (cmdline_parse_inst_t *)&cmd_set_port_tm_hierarchy_default,
+#endif
(cmdline_parse_inst_t *)&cmd_ddp_add,
(cmdline_parse_inst_t *)&cmd_ddp_del,
(cmdline_parse_inst_t *)&cmd_ddp_get_list,
(cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
(cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
(cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
+
+ (cmdline_parse_inst_t *)&cmd_pctype_mapping_get,
+ (cmdline_parse_inst_t *)&cmd_pctype_mapping_reset,
+ (cmdline_parse_inst_t *)&cmd_pctype_mapping_update,
NULL,
};