@@ -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
@@ -493,6 +494,8 @@ usage(char *progname)
printf(" --mbuf-size=N: to set the size of mbuf\n");
printf(" --mbuf-cache-size=N: to set the size of mbuf cache\n");
printf(" --total-mbuf-count=N: to set the count of total mbuf count\n");
+ printf(" --meter-profile=cir,cbs,ebs: set CIR CBS EBS parameters in meter"
+ " profile, default is %d,%d,%d\n", METER_CIR, METER_CIR / 8, 0);
printf("To set flow attributes:\n");
printf(" --ingress: set ingress attribute in flows\n");
@@ -624,9 +627,10 @@ args_parse(int argc, char **argv)
uint32_t prio;
char *token;
char *end;
+ char *arg;
int n, opt;
int opt_idx;
- size_t i;
+ size_t i, j;
static const struct option lgopts[] = {
/* Control */
@@ -705,6 +709,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)
@@ -922,6 +927,18 @@ args_parse(int argc, char **argv)
RTE_MAX_LCORE);
}
}
+ if (strcmp(lgopts[opt_idx].name,
+ "meter-profile") == 0) {
+ arg = optarg;
+ j = 0;
+ token = strsep(&arg, ",\0");
+ while (token != NULL && j < sizeof(
+ meter_profile_values) /
+ sizeof(uint64_t)) {
+ meter_profile_values[j++] = atol(token);
+ token = strsep(&arg, ",\0");
+ }
+ }
if (strcmp(lgopts[opt_idx].name, "policy-mtr") == 0)
handle_meter_policy(argv[0], optarg);
break;
@@ -1251,9 +1268,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) {
@@ -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 parameter, default value is 1250000, 156250 and 0.
+
Attributes:
* ``--ingress``