> -----Original Message----- > From: Wu, Jingjing > Sent: Sunday, January 7, 2018 2:25 PM > To: Singh, Jasvinder <jasvinder.si...@intel.com>; dev@dpdk.org > Cc: Dumitrescu, Cristian <cristian.dumitre...@intel.com>; Mcnamara, John > <john.mcnam...@intel.com> > Subject: RE: [PATCH 1/3] app/testpmd: metering and policing CLI clean up > > > > > -----Original Message----- > > From: Singh, Jasvinder > > Sent: Tuesday, November 21, 2017 12:39 AM > > To: dev@dpdk.org > > Cc: Dumitrescu, Cristian <cristian.dumitre...@intel.com>; Wu, Jingjing > > <jingjing...@intel.com>; Mcnamara, John <john.mcnam...@intel.com> > > Subject: [PATCH 1/3] app/testpmd: metering and policing CLI clean up > > > > This patch updates the metering and policing CLIs as follows: > > - change name of set port meter CLI to create port meter and add meter > > enable option, dscp table entries arguments, action mask, policer actions > > and previous meter color option as an input color > > - set the right metering algorithm in add meter profile CLIs related to > > srtcm(rfc2697) and trtcm(rfc2698,rfc4115) > > - change clear flag type from uint32_t to string in show meter stats > > CLI > > > > Signed-off-by: Jasvinder Singh <jasvinder.si...@intel.com> > Acked-by: Jingjing Wu <jingjing...@intel.com> > > With minor comment: > > > +static int > > +parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table) { > > + char *token; > > + int i = 0; > > + > > + token = strtok_r(str, PARSE_DELIMITER, &str); > > + if (token == NULL) > > + return 0; > > + > > + /* Allocate memory for dscp table */ > > + dscp_table = (enum rte_mtr_color > *)malloc(MAX_DSCP_TABLE_ENTRIES * > > + sizeof(enum rte_mtr_color)); > > + > > + while (1) { > > + if (strcmp(token, "G") == 0 || > > + strcmp(token, "g") == 0) > > + dscp_table[i++] = RTE_MTR_GREEN; > > + else if (strcmp(token, "Y") == 0 || > > + strcmp(token, "y") == 0) > > + dscp_table[i++] = RTE_MTR_YELLOW; > > + else if (strcmp(token, "R") == 0 || > > + strcmp(token, "r") == 0) > > + dscp_table[i++] = RTE_MTR_RED; > > + else { > > + free(dscp_table); > > + return -1; > > + } > > + if (i == MAX_DSCP_TABLE_ENTRIES) > > + break; > Is that meaning the size dscp table must be 64, can it be less than 64?
The DSCP field is represented by 6 bits in the byte long TOS field of the IP header. Therefore, DSCP table should be have 64 entries for the packets classification. > Thanks > Jingjing