]> git.droids-corp.org - dpdk.git/commitdiff
app/flow-perf: support dynamic values for meter profile
authorRongwei Liu <rongweil@nvidia.com>
Thu, 11 Nov 2021 14:23:38 +0000 (16:23 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 16 Nov 2021 11:34:06 +0000 (12:34 +0100)
Change meter-cir option to meter-profile to cover user input for CIR,
CBS & EBS values.

The usage is as below:
--meter-profile=N1,N2,N3 default value is 1250000 156250 0.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
app/test-flow-perf/main.c
doc/guides/tools/flow-perf.rst

index 89596eb3f651a0a4cc4b164bd9729cc4bed2ffd6..01bfa20db7c68663d35de86cedd05d24f94c42c4 100644 (file)
@@ -85,6 +85,7 @@ static uint32_t hairpin_queues_num; /* total hairpin q number - default: 0 */
 static uint32_t nb_lcores;
 static uint8_t max_priority;
 static uint32_t rand_seed;
+static uint64_t meter_profile_values[3]; /* CIR CBS EBS values. */
 
 #define MAX_PKT_BURST    32
 #define LCORE_MODE_PKT    1
@@ -484,6 +485,9 @@ usage(char *progname)
                "and S as seed for pseudo-random number generator\n");
        printf("  --unique-data: flag to set using unique data for all"
                " actions that support data, such as header modify and encap actions\n");
+       printf("  --meter-profile=cir,cbs,ebs: set CIR CBS EBS parameters in meter"
+               " profile, default values are %d,%d,%d\n", METER_CIR,
+               METER_CIR / 8, 0);
 
        printf("To set flow attributes:\n");
        printf("  --ingress: set ingress attribute in flows\n");
@@ -707,6 +711,7 @@ args_parse(int argc, char **argv)
                { "vxlan-encap",                0, 0, 0 },
                { "vxlan-decap",                0, 0, 0 },
                { "policy-mtr",                 1, 0, 0 },
+               { "meter-profile",              1, 0, 0 },
        };
 
        RTE_ETH_FOREACH_DEV(i)
@@ -926,6 +931,17 @@ args_parse(int argc, char **argv)
                        }
                        if (strcmp(lgopts[opt_idx].name, "policy-mtr") == 0)
                                read_meter_policy(argv[0], optarg);
+                       if (strcmp(lgopts[opt_idx].name,
+                                               "meter-profile") == 0) {
+                               i = 0;
+                               token = strsep(&optarg, ",\0");
+                               while (token != NULL && i < sizeof(
+                                               meter_profile_values) /
+                                               sizeof(uint64_t)) {
+                                       meter_profile_values[i++] = atol(token);
+                                       token = strsep(&optarg, ",\0");
+                               }
+                       }
                        break;
                default:
                        usage(argv[0]);
@@ -1251,9 +1267,11 @@ create_meter_profile(void)
                if (!((ports_mask >> port_id) & 0x1))
                        continue;
                mp.alg = RTE_MTR_SRTCM_RFC2697;
-               mp.srtcm_rfc2697.cir = METER_CIR;
-               mp.srtcm_rfc2697.cbs = METER_CIR / 8;
-               mp.srtcm_rfc2697.ebs = 0;
+               mp.srtcm_rfc2697.cir = meter_profile_values[0] ?
+                       meter_profile_values[0] : METER_CIR;
+               mp.srtcm_rfc2697.cbs = meter_profile_values[1] ?
+                       meter_profile_values[1] : METER_CIR / 8;
+               mp.srtcm_rfc2697.ebs = meter_profile_values[2];
                ret = rte_mtr_meter_profile_add
                        (port_id, DEFAULT_METER_PROF_ID, &mp, &error);
                if (ret != 0) {
index e4083f053e772b3e047bd78cc4c2a36b777f5f06..24f0fefcd8d068b9306f354d8f2983a08b2f2a66 100644 (file)
@@ -134,6 +134,9 @@ The command line options are:
 *      ``--total-mbuf-count=N``
        Set the count of total mbuf number, default count is 32000.
 
+*      ``--meter-profile=N1,N2,N3``
+       Set the CIR, CBS and EBS parameters, default values are 1250000, 156250 and 0.
+
 Attributes:
 
 *      ``--ingress``