@@ -64,6 +64,7 @@ static bool dump_socket_mem_flag;
static bool enable_fwd;
static bool unique_data;
static bool policy_mtr;
+static bool packet_mode;
static struct rte_mempool *mbuf_mp;
static uint32_t nb_lcores;
@@ -147,6 +148,7 @@ usage(char *progname)
printf(" --policy-mtr: To create meter with policy\n");
printf(" --meter-cir=N: to set committed information rate(CIR)"
" parameter in meter profile, default is %d\n", METER_CIR);
+ printf(" --packet-mode: To enable packet mode for meter profile\n");
printf("To set flow attributes:\n");
printf(" --ingress: set ingress attribute in flows\n");
@@ -588,6 +590,7 @@ args_parse(int argc, char **argv)
{ "cores", 1, 0, 0 },
{ "policy-mtr", 0, 0, 0 },
{ "meter-cir", 1, 0, 0 },
+ { "packet-mode", 0, 0, 0 },
/* Attributes */
{ "ingress", 0, 0, 0 },
{ "egress", 0, 0, 0 },
@@ -823,6 +826,8 @@ args_parse(int argc, char **argv)
n = atoi(optarg);
meter_cir = (uint64_t) n;
}
+ if (strcmp(lgopts[opt_idx].name, "packet-mode") == 0)
+ packet_mode = true;
break;
default:
usage(argv[0]);
@@ -990,7 +995,7 @@ create_meter_rule(int port_id, uint32_t counter)
{
int ret;
struct rte_mtr_params params;
- uint32_t default_prof_id = 100;
+ uint32_t default_prof_id = DEFAULT_METER_PROF_ID;
struct rte_mtr_error error;
memset(¶ms, 0, sizeof(struct rte_mtr_params));
@@ -1141,6 +1146,7 @@ create_meter_profile(void)
mp.srtcm_rfc2697.cir = meter_cir;
mp.srtcm_rfc2697.cbs = meter_cir / 8;
mp.srtcm_rfc2697.ebs = 0;
+ mp.packet_mode = packet_mode;
ret = rte_mtr_meter_profile_add
(port_id, DEFAULT_METER_PROF_ID, &mp, &error);
@@ -108,6 +108,9 @@ The command line options are:
* ``--meter-cir=N``
Set the committed information rate(CIR) parameter, default count is 1250000.
+* ``--packet-mode``
+ Enable packets mode for meter profile.
+
Attributes:
* ``--ingress``