test/stack: check stack performance
[dpdk.git] / app / test-pmd / cmdline_flow.c
index 91e2e35..36659a6 100644 (file)
@@ -3248,15 +3248,26 @@ parse_vc_action_rss(struct context *ctx, const struct token *token,
                        .func = RTE_ETH_HASH_FUNCTION_DEFAULT,
                        .level = 0,
                        .types = rss_hf,
-                       .key_len = 0,
+                       .key_len = sizeof(action_rss_data->key),
                        .queue_num = RTE_MIN(nb_rxq, ACTION_RSS_QUEUE_NUM),
-                       .key = NULL,
+                       .key = action_rss_data->key,
                        .queue = action_rss_data->queue,
                },
+               .key = "testpmd's default RSS hash key, "
+                       "override it for better balancing",
                .queue = { 0 },
        };
        for (i = 0; i < action_rss_data->conf.queue_num; ++i)
                action_rss_data->queue[i] = i;
+       if (!port_id_is_invalid(ctx->port, DISABLED_WARN) &&
+           ctx->port != (portid_t)RTE_PORT_ALL) {
+               struct rte_eth_dev_info info;
+
+               rte_eth_dev_info_get(ctx->port, &info);
+               action_rss_data->conf.key_len =
+                       RTE_MIN(sizeof(action_rss_data->key),
+                               info.hash_key_size);
+       }
        action->conf = &action_rss_data->conf;
        return ret;
 }
@@ -3490,6 +3501,38 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token,
        if (!vxlan_encap_conf.select_vlan)
                action_vxlan_encap_data->items[1].type =
                        RTE_FLOW_ITEM_TYPE_VOID;
+       if (vxlan_encap_conf.select_tos_ttl) {
+               if (vxlan_encap_conf.select_ipv4) {
+                       static struct rte_flow_item_ipv4 ipv4_mask_tos;
+
+                       memcpy(&ipv4_mask_tos, &rte_flow_item_ipv4_mask,
+                              sizeof(ipv4_mask_tos));
+                       ipv4_mask_tos.hdr.type_of_service = 0xff;
+                       ipv4_mask_tos.hdr.time_to_live = 0xff;
+                       action_vxlan_encap_data->item_ipv4.hdr.type_of_service =
+                                       vxlan_encap_conf.ip_tos;
+                       action_vxlan_encap_data->item_ipv4.hdr.time_to_live =
+                                       vxlan_encap_conf.ip_ttl;
+                       action_vxlan_encap_data->items[2].mask =
+                                                       &ipv4_mask_tos;
+               } else {
+                       static struct rte_flow_item_ipv6 ipv6_mask_tos;
+
+                       memcpy(&ipv6_mask_tos, &rte_flow_item_ipv6_mask,
+                              sizeof(ipv6_mask_tos));
+                       ipv6_mask_tos.hdr.vtc_flow |=
+                               RTE_BE32(0xfful << IPV6_HDR_TC_SHIFT);
+                       ipv6_mask_tos.hdr.hop_limits = 0xff;
+                       action_vxlan_encap_data->item_ipv6.hdr.vtc_flow |=
+                               rte_cpu_to_be_32
+                                       ((uint32_t)vxlan_encap_conf.ip_tos <<
+                                        IPV6_HDR_TC_SHIFT);
+                       action_vxlan_encap_data->item_ipv6.hdr.hop_limits =
+                                       vxlan_encap_conf.ip_ttl;
+                       action_vxlan_encap_data->items[2].mask =
+                                                       &ipv6_mask_tos;
+               }
+       }
        memcpy(action_vxlan_encap_data->item_vxlan.vni, vxlan_encap_conf.vni,
               RTE_DIM(vxlan_encap_conf.vni));
        action->conf = &action_vxlan_encap_data->conf;
@@ -3797,6 +3840,7 @@ parse_vc_action_mplsogre_encap(struct context *ctx, const struct token *token,
        header += sizeof(gre);
        memcpy(mpls.label_tc_s, mplsogre_encap_conf.label,
               RTE_DIM(mplsogre_encap_conf.label));
+       mpls.label_tc_s[2] |= 0x1;
        memcpy(header, &mpls, sizeof(mpls));
        header += sizeof(mpls);
        action_encap_data->conf.size = header -
@@ -3987,6 +4031,7 @@ parse_vc_action_mplsoudp_encap(struct context *ctx, const struct token *token,
        header += sizeof(udp);
        memcpy(mpls.label_tc_s, mplsoudp_encap_conf.label,
               RTE_DIM(mplsoudp_encap_conf.label));
+       mpls.label_tc_s[2] |= 0x1;
        memcpy(header, &mpls, sizeof(mpls));
        header += sizeof(mpls);
        action_encap_data->conf.size = header -
@@ -4314,6 +4359,8 @@ parse_int(struct context *ctx, const struct token *token,
        }
        buf = (uint8_t *)ctx->object + arg->offset;
        size = arg->size;
+       if (u > RTE_LEN2MASK(size * CHAR_BIT, uint64_t))
+               return -1;
 objmask:
        switch (size) {
        case sizeof(uint8_t):