* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * version: DPDK.L.1.2.3-3
*/
#include <stdarg.h>
cmdline_printf(cl,
"Display informations:\n"
"---------------------\n"
- "- show port info|stats|fdir X|all\n"
- " Diplays information or stats on port X, or all\n"
+ "- show port info|stats|fdir|stat_qmap X|all\n"
+ " Diplays information or stats or stats queue mapping on port X, or all\n"
"- clear port stats X|all\n"
" Clear stats for port X, or all\n"
"- show config rxtx|cores|fwd\n"
"- set corelist|portlist x[,y]*\n"
" Set the list of forwarding cores / forwarding "
"ports\n"
+ "- vlan set strip|filter|qinq on/off port_id\n"
+ " Set the VLAN strip, filter, QinQ(extended) on a port"
"- rx_vlan add/rm vlan_id|all port_id\n"
- " Add/remove vlan_id, or all identifiers, to/from "
- "the set of VLAN Identifiers\n filtered by port_id\n"
+ " Set the VLAN filter table, add/remove vlan_id, or all "
+ "identifiers, to/from the set of VLAN Identifiers\n"
+ "filtered by port_id\n"
+ "- rx_vlan set tpid value port_id\n"
+ " Set Outer VLAN TPID for Packet Filtering on a port \n"
"- tx_vlan set vlan_id port_id\n"
- " Enable hardware insertion of a VLAN header with "
- "the Tag Identifier vlan_id\n in packets sent on"
- "port_id\n"
+ " Set hardware insertion of VLAN ID in packets sent on a port\n"
"- tx_vlan reset port_id\n"
" Disable hardware insertion of a VLAN header in "
"packets sent on port_id\n"
" Set bit field value of a port register\n"
"- write regbit port_id reg_off bit_x value\n"
" Set bit value of a port register\n"
+ "- set stat_qmap tx|rx port_id queue_id qmapping\n"
+ " Set statistics mapping (qmapping 0..15) for tx|rx queue_id on port_id\n"
+ " e.g., 'set stat_qmap rx 0 2 5' sets rx queue 2 on port 0 to mapping 5\n"
"\n");
cmdline_printf(cl,
"Control forwarding:\n"
" ip_src_address port_src dst ip_dst_address port_dst\n"
" flexbytes flexbytes_values vlan vlan_id soft soft_id\n"
"- set_masks_filter port_id only_ip_flow 0|1 src_mask\n"
- " ip_src_mask port_src_mask dst_mask ip_dst_mask\n"
+ " ip_src_mask port_src_mask dst_mask ip_dst_mask\n"
" port_dst_mask flexbytes 0|1 vlan_id 0|1 vlan_prio 0|1\n"
+ "- set_ipv6_masks_filter port_id only_ip_flow 0|1 src_mask\n"
+ " ip_src_mask port_src_mask dst_mask ip_dst_mask\n"
+ " port_dst_mask flexbytes 0|1 vlan_id 0|1\n"
+ " vlan_prio 0|1 compare_dst 0|1\n"
"\n");
cmdline_printf(cl,
"Misc:\n"
},
};
+/* *** VLAN OFFLOAD SET ON A PORT *** */
+struct cmd_vlan_offload_result {
+ cmdline_fixed_string_t vlan;
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t what;
+ cmdline_fixed_string_t on;
+ cmdline_fixed_string_t port_id;
+};
+
+static void
+cmd_vlan_offload_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ int on;
+ struct cmd_vlan_offload_result *res = parsed_result;
+ char *str;
+ int i, len = 0;
+ portid_t port_id = 0;
+ unsigned int tmp;
+
+ str = res->port_id;
+ len = strnlen(str, STR_TOKEN_SIZE);
+ i = 0;
+ /* Get port_id first */
+ while(i < len){
+ if(str[i] == ',')
+ break;
+
+ i++;
+ }
+ str[i]='\0';
+ tmp = strtoul(str, NULL, 0);
+ /* If port_id greater that what portid_t can represent, return */
+ if(tmp > 255)
+ return;
+ port_id = (portid_t)tmp;
+
+ if (!strcmp(res->on, "on"))
+ on = 1;
+ else
+ on = 0;
+
+ if (!strcmp(res->what, "strip"))
+ rx_vlan_strip_set(port_id, on);
+ else if(!strcmp(res->what, "stripq")){
+ uint16_t queue_id = 0;
+
+ /* No queue_id, return */
+ if(i + 1 >= len)
+ return;
+ tmp = strtoul(str + i + 1, NULL, 0);
+ /* If queue_id greater that what 16-bits can represent, return */
+ if(tmp > 0xffff)
+ return;
+
+ queue_id = (uint16_t)tmp;
+ rx_vlan_strip_set_on_queue(port_id, queue_id, on);
+ }
+ else if (!strcmp(res->what, "filter"))
+ rx_vlan_filter_set(port_id, on);
+ else
+ vlan_extend_set(port_id, on);
+
+ return;
+}
+
+cmdline_parse_token_string_t cmd_vlan_offload_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
+ vlan, "vlan");
+cmdline_parse_token_string_t cmd_vlan_offload_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
+ set, "set");
+cmdline_parse_token_string_t cmd_vlan_offload_what =
+ TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
+ what, "strip#filter#qinq#stripq");
+cmdline_parse_token_string_t cmd_vlan_offload_on =
+ TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
+ on, "on#off");
+cmdline_parse_token_string_t cmd_vlan_offload_portid =
+ TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
+ port_id, NULL);
+
+cmdline_parse_inst_t cmd_vlan_offload = {
+ .f = cmd_vlan_offload_parsed,
+ .data = NULL,
+ .help_str = "set strip|filter|qinq|stripq on|off port_id[,queue_id], filter/strip for rx side"
+ " qinq(extended) for both rx/tx sides ",
+ .tokens = {
+ (void *)&cmd_vlan_offload_vlan,
+ (void *)&cmd_vlan_offload_set,
+ (void *)&cmd_vlan_offload_what,
+ (void *)&cmd_vlan_offload_on,
+ (void *)&cmd_vlan_offload_portid,
+ NULL,
+ },
+};
+
+/* *** VLAN TPID SET ON A PORT *** */
+struct cmd_vlan_tpid_result {
+ cmdline_fixed_string_t vlan;
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t what;
+ uint16_t tp_id;
+ uint8_t port_id;
+};
+
+static void
+cmd_vlan_tpid_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_vlan_tpid_result *res = parsed_result;
+ vlan_tpid_set(res->port_id, res->tp_id);
+ return;
+}
+
+cmdline_parse_token_string_t cmd_vlan_tpid_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result,
+ vlan, "vlan");
+cmdline_parse_token_string_t cmd_vlan_tpid_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result,
+ set, "set");
+cmdline_parse_token_string_t cmd_vlan_tpid_what =
+ TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result,
+ what, "tpid");
+cmdline_parse_token_num_t cmd_vlan_tpid_tpid =
+ TOKEN_NUM_INITIALIZER(struct cmd_vlan_tpid_result,
+ tp_id, UINT16);
+cmdline_parse_token_num_t cmd_vlan_tpid_portid =
+ TOKEN_NUM_INITIALIZER(struct cmd_vlan_tpid_result,
+ port_id, UINT8);
+
+cmdline_parse_inst_t cmd_vlan_tpid = {
+ .f = cmd_vlan_tpid_parsed,
+ .data = NULL,
+ .help_str = "set tpid tp_id port_id, set the Outer VLAN Ether type",
+ .tokens = {
+ (void *)&cmd_vlan_tpid_vlan,
+ (void *)&cmd_vlan_tpid_set,
+ (void *)&cmd_vlan_tpid_what,
+ (void *)&cmd_vlan_tpid_tpid,
+ (void *)&cmd_vlan_tpid_portid,
+ NULL,
+ },
+};
+
/* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */
struct cmd_rx_vlan_filter_result {
cmdline_fixed_string_t rx_vlan;
struct cmd_rx_vlan_filter_result *res = parsed_result;
if (!strcmp(res->what, "add"))
- rx_vlan_filter_set(res->port_id, res->vlan_id, 1);
+ rx_vft_set(res->port_id, res->vlan_id, 1);
else
- rx_vlan_filter_set(res->port_id, res->vlan_id, 0);
+ rx_vft_set(res->port_id, res->vlan_id, 0);
}
cmdline_parse_token_string_t cmd_rx_vlan_filter_rx_vlan =
__attribute__((unused)) void *data)
{
struct cmd_tx_vlan_set_result *res = parsed_result;
-
tx_vlan_set(res->port_id, res->vlan_id);
}
uint8_t port_id;
cmdline_fixed_string_t src_mask;
uint32_t ip_src_mask;
+ uint16_t ipv6_src_mask;
uint16_t port_src_mask;
cmdline_fixed_string_t dst_mask;
uint32_t ip_dst_mask;
+ uint16_t ipv6_dst_mask;
uint16_t port_dst_mask;
cmdline_fixed_string_t flexbytes;
uint8_t flexbytes_value;
uint8_t vlan_prio_value;
cmdline_fixed_string_t only_ip_flow;
uint8_t only_ip_flow_value;
+ cmdline_fixed_string_t comp_ipv6_dst;
+ uint8_t comp_ipv6_dst_value;
};
static void
port_src_mask, UINT16);
cmdline_parse_token_string_t cmd_pkt_filter_masks_dst_mask =
TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
- src_mask, "dst_mask");
+ dst_mask, "dst_mask");
cmdline_parse_token_num_t cmd_pkt_filter_masks_ip_dst_mask =
TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
ip_dst_mask, UINT32);
},
};
+static void
+cmd_pkt_filter_masks_ipv6_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct rte_fdir_masks fdir_masks;
+ struct cmd_pkt_filter_masks_result *res = parsed_result;
+
+ memset(&fdir_masks, 0, sizeof(struct rte_fdir_masks));
+
+ fdir_masks.set_ipv6_mask = 1;
+ fdir_masks.only_ip_flow = res->only_ip_flow_value;
+ fdir_masks.vlan_id = res->vlan_id_value;
+ fdir_masks.vlan_prio = res->vlan_prio_value;
+ fdir_masks.dst_ipv6_mask = res->ipv6_dst_mask;
+ fdir_masks.src_ipv6_mask = res->ipv6_src_mask;
+ fdir_masks.src_port_mask = res->port_src_mask;
+ fdir_masks.dst_port_mask = res->port_dst_mask;
+ fdir_masks.flexbytes = res->flexbytes_value;
+ fdir_masks.comp_ipv6_dst = res->comp_ipv6_dst_value;
+
+ fdir_set_masks(res->port_id, &fdir_masks);
+}
+
+cmdline_parse_token_string_t cmd_pkt_filter_masks_filter_mask_ipv6 =
+ TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
+ filter_mask, "set_ipv6_masks_filter");
+cmdline_parse_token_num_t cmd_pkt_filter_masks_src_mask_ipv6_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
+ ipv6_src_mask, UINT16);
+cmdline_parse_token_num_t cmd_pkt_filter_masks_dst_mask_ipv6_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
+ ipv6_dst_mask, UINT16);
+
+cmdline_parse_token_string_t cmd_pkt_filter_masks_comp_ipv6_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
+ comp_ipv6_dst, "compare_dst");
+cmdline_parse_token_num_t cmd_pkt_filter_masks_comp_ipv6_dst_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
+ comp_ipv6_dst_value, UINT8);
+
+cmdline_parse_inst_t cmd_set_ipv6_masks_filter = {
+ .f = cmd_pkt_filter_masks_ipv6_parsed,
+ .data = NULL,
+ .help_str = "setup ipv6 masks filter",
+ .tokens = {
+ (void *)&cmd_pkt_filter_masks_filter_mask_ipv6,
+ (void *)&cmd_pkt_filter_masks_port_id,
+ (void *)&cmd_pkt_filter_masks_only_ip_flow,
+ (void *)&cmd_pkt_filter_masks_only_ip_flow_value,
+ (void *)&cmd_pkt_filter_masks_src_mask,
+ (void *)&cmd_pkt_filter_masks_src_mask_ipv6_value,
+ (void *)&cmd_pkt_filter_masks_port_src_mask,
+ (void *)&cmd_pkt_filter_masks_dst_mask,
+ (void *)&cmd_pkt_filter_masks_dst_mask_ipv6_value,
+ (void *)&cmd_pkt_filter_masks_port_dst_mask,
+ (void *)&cmd_pkt_filter_masks_flexbytes,
+ (void *)&cmd_pkt_filter_masks_flexbytes_value,
+ (void *)&cmd_pkt_filter_masks_vlan_id,
+ (void *)&cmd_pkt_filter_masks_vlan_id_value,
+ (void *)&cmd_pkt_filter_masks_vlan_prio,
+ (void *)&cmd_pkt_filter_masks_vlan_prio_value,
+ (void *)&cmd_pkt_filter_masks_comp_ipv6_dst,
+ (void *)&cmd_pkt_filter_masks_comp_ipv6_dst_value,
+ NULL,
+ },
+};
+
/* *** SETUP ETHERNET LINK FLOW CONTROL *** */
struct cmd_link_flow_ctrl_set_result {
cmdline_fixed_string_t set;
else if (!strcmp(res->what, "fdir"))
for (i = 0; i < nb_ports; i++)
fdir_get_infos(i);
+ else if (!strcmp(res->what, "stat_qmap"))
+ for (i = 0; i < nb_ports; i++)
+ nic_stats_mapping_display(i);
}
cmdline_parse_token_string_t cmd_showportall_show =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port");
cmdline_parse_token_string_t cmd_showportall_what =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what,
- "info#stats#fdir");
+ "info#stats#fdir#stat_qmap");
cmdline_parse_token_string_t cmd_showportall_all =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all");
cmdline_parse_inst_t cmd_showportall = {
.f = cmd_showportall_parsed,
.data = NULL,
- .help_str = "show|clear port info|stats|fdir all",
+ .help_str = "show|clear port info|stats|fdir|stat_qmap all",
.tokens = {
(void *)&cmd_showportall_show,
(void *)&cmd_showportall_port,
nic_stats_display(res->portnum);
else if (!strcmp(res->what, "fdir"))
fdir_get_infos(res->portnum);
+ else if (!strcmp(res->what, "stat_qmap"))
+ nic_stats_mapping_display(res->portnum);
}
cmdline_parse_token_string_t cmd_showport_show =
TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port");
cmdline_parse_token_string_t cmd_showport_what =
TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,
- "info#stats#fdir");
+ "info#stats#fdir#stat_qmap");
cmdline_parse_token_num_t cmd_showport_portnum =
TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, INT32);
cmdline_parse_inst_t cmd_showport = {
.f = cmd_showport_parsed,
.data = NULL,
- .help_str = "show|clear port info|stats|fdir X (X = port number)",
+ .help_str = "show|clear port info|stats|fdir|stat_qmap X (X = port number)",
.tokens = {
(void *)&cmd_showport_show,
(void *)&cmd_showport_port,
"add#remove");
cmdline_parse_token_num_t cmd_mac_addr_portnum =
TOKEN_NUM_INITIALIZER(struct cmd_mac_addr_result, port_num, UINT8);
-cmdline_parse_token_string_t cmd_mac_addr_addr =
+cmdline_parse_token_etheraddr_t cmd_mac_addr_addr =
TOKEN_ETHERADDR_INITIALIZER(struct cmd_mac_addr_result, address);
cmdline_parse_inst_t cmd_mac_addr = {
};
+/* *** CONFIGURE QUEUE STATS COUNTER MAPPINGS *** */
+struct cmd_set_qmap_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t qmap;
+ cmdline_fixed_string_t what;
+ uint8_t port_id;
+ uint16_t queue_id;
+ uint8_t map_value;
+};
+
+static void
+cmd_set_qmap_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_set_qmap_result *res = parsed_result;
+ int is_rx = (strcmp(res->what, "tx") == 0) ? 0 : 1;
+
+ set_qmap(res->port_id, (uint8_t)is_rx, res->queue_id, res->map_value);
+}
+
+cmdline_parse_token_string_t cmd_setqmap_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result,
+ set, "set");
+cmdline_parse_token_string_t cmd_setqmap_qmap =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result,
+ qmap, "stat_qmap");
+cmdline_parse_token_string_t cmd_setqmap_what =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result,
+ what, "tx#rx");
+cmdline_parse_token_num_t cmd_setqmap_portid =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
+ port_id, UINT8);
+cmdline_parse_token_num_t cmd_setqmap_queueid =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
+ queue_id, UINT16);
+cmdline_parse_token_num_t cmd_setqmap_mapvalue =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
+ map_value, UINT8);
+
+cmdline_parse_inst_t cmd_set_qmap = {
+ .f = cmd_set_qmap_parsed,
+ .data = NULL,
+ .help_str = "Set statistics mapping value on tx|rx queue_id of port_id",
+ .tokens = {
+ (void *)&cmd_setqmap_set,
+ (void *)&cmd_setqmap_qmap,
+ (void *)&cmd_setqmap_what,
+ (void *)&cmd_setqmap_portid,
+ (void *)&cmd_setqmap_queueid,
+ (void *)&cmd_setqmap_mapvalue,
+ NULL,
+ },
+};
+
+/* ******************************************************************************** */
+
/* list of instructions */
cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_help,
(cmdline_parse_inst_t *)&cmd_set_promisc_mode_all,
(cmdline_parse_inst_t *)&cmd_set_allmulti_mode_one,
(cmdline_parse_inst_t *)&cmd_set_allmulti_mode_all,
+ (cmdline_parse_inst_t *)&cmd_vlan_offload,
+ (cmdline_parse_inst_t *)&cmd_vlan_tpid,
(cmdline_parse_inst_t *)&cmd_rx_vlan_filter_all,
(cmdline_parse_inst_t *)&cmd_rx_vlan_filter,
(cmdline_parse_inst_t *)&cmd_tx_vlan_set,
(cmdline_parse_inst_t *)&cmd_upd_perfect_filter,
(cmdline_parse_inst_t *)&cmd_rm_perfect_filter,
(cmdline_parse_inst_t *)&cmd_set_masks_filter,
+ (cmdline_parse_inst_t *)&cmd_set_ipv6_masks_filter,
(cmdline_parse_inst_t *)&cmd_stop,
(cmdline_parse_inst_t *)&cmd_mac_addr,
+ (cmdline_parse_inst_t *)&cmd_set_qmap,
NULL,
};