From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 80CC91B380 for ; Fri, 13 Oct 2017 10:58:25 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2017 01:58:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,370,1503385200"; d="scan'208";a="1230354468" Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by fmsmga002.fm.intel.com with ESMTP; 13 Oct 2017 01:58:20 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by IRSMSX108.ger.corp.intel.com (163.33.3.3) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 13 Oct 2017 09:58:19 +0100 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.49]) by irsmsx112.ger.corp.intel.com ([169.254.1.12]) with mapi id 14.03.0319.002; Fri, 13 Oct 2017 09:58:19 +0100 From: "Singh, Jasvinder" To: "Wu, Jingjing" , "dev@dpdk.org" CC: "Dumitrescu, Cristian" , "De Lara Guarch, Pablo" , "Pei, Yulong" Thread-Topic: [PATCH v7 2/3] app/test-pmd: add CLI for shaper and wred profiles Thread-Index: AQHTQ8udWaNSR9Q9TkmuOSw5H6QWxaLhebbA Date: Fri, 13 Oct 2017 08:58:18 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D3326D62E@IRSMSX103.ger.corp.intel.com> References: <20171009190750.6697-1-jasvinder.singh@intel.com> <20171011092612.13369-1-jasvinder.singh@intel.com> <20171011092612.13369-2-jasvinder.singh@intel.com> <9BB6961774997848B5B42BEC655768F810E94668@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <9BB6961774997848B5B42BEC655768F810E94668@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzk3M2U4ODUtNzE4Ny00ZmRlLWFiNDgtYTc4NDI3MGFiYzlkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImM1dHQxMjgwUmtSMHJNcXB2ZVc0M05tQzFxWUcxRlFyR1lnSFdkdXZIbVU9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v7 2/3] app/test-pmd: add CLI for shaper and wred profiles X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2017 08:58:28 -0000 =20 > > +/* *** Add Port TM Node WRED Profile *** */ struct > > +cmd_add_port_tm_node_wred_profile_result { > > + cmdline_fixed_string_t add; > > + cmdline_fixed_string_t port; > > + cmdline_fixed_string_t tm; > > + cmdline_fixed_string_t node; > > + cmdline_fixed_string_t wred; > > + cmdline_fixed_string_t profile; > > + uint16_t port_id; > > + uint32_t wred_profile_id; > > + cmdline_fixed_string_t color_g; > > + uint16_t min_th_g; > > + uint16_t max_th_g; > > + uint16_t maxp_inv_g; > > + uint16_t wq_log2_g; > > + cmdline_fixed_string_t color_y; > > + uint16_t min_th_y; > > + uint16_t max_th_y; > > + uint16_t maxp_inv_y; > > + uint16_t wq_log2_y; > > + cmdline_fixed_string_t color_r; > > + uint16_t min_th_r; > > + uint16_t max_th_r; > > + uint16_t maxp_inv_r; > > + uint16_t wq_log2_r; > > +}; > > + > > +cmdline_parse_token_string_t > cmd_add_port_tm_node_wred_profile_add =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, add, > > "add"); > > +cmdline_parse_token_string_t > cmd_add_port_tm_node_wred_profile_port =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, port, > > "port"); > > +cmdline_parse_token_string_t > cmd_add_port_tm_node_wred_profile_tm =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, tm, > "tm"); > > +cmdline_parse_token_string_t > cmd_add_port_tm_node_wred_profile_node =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, node, > > "node"); > > +cmdline_parse_token_string_t > cmd_add_port_tm_node_wred_profile_wred =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, wred, > > "wred"); > > +cmdline_parse_token_string_t > > +cmd_add_port_tm_node_wred_profile_profile > > =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + profile, "profile"); > > +cmdline_parse_token_num_t > cmd_add_port_tm_node_wred_profile_port_id > > =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + port_id, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_wred_profile_id =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + wred_profile_id, UINT32); > > +cmdline_parse_token_string_t > > cmd_add_port_tm_node_wred_profile_color_g =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + color_g, "G#g"); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_min_th_g =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + min_th_g, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_max_th_g =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + max_th_g, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_maxp_inv_g =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + maxp_inv_g, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_wq_log2_g =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + wq_log2_g, UINT16); > > +cmdline_parse_token_string_t > > +cmd_add_port_tm_node_wred_profile_color_y > > =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + color_y, "Y#y"); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_min_th_y =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + min_th_y, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_max_th_y =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + max_th_y, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_maxp_inv_y =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + maxp_inv_y, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_wq_log2_y =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + wq_log2_y, UINT16); > > +cmdline_parse_token_string_t > > +cmd_add_port_tm_node_wred_profile_color_r > > =3D > > + TOKEN_STRING_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + color_r, "R#r"); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_min_th_r =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + min_th_r, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_max_th_r =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + max_th_r, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_maxp_inv_r =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + maxp_inv_r, UINT16); > > +cmdline_parse_token_num_t > > cmd_add_port_tm_node_wred_profile_wq_log2_r =3D > > + TOKEN_NUM_INITIALIZER( > > + struct cmd_add_port_tm_node_wred_profile_result, > > + wq_log2_r, UINT16); > > + > > + > > +static void cmd_add_port_tm_node_wred_profile_parsed(void > *parsed_result, > > + __attribute__((unused)) struct cmdline *cl, > > + __attribute__((unused)) void *data) > > +{ > > + struct cmd_add_port_tm_node_wred_profile_result *res =3D > > parsed_result; > > + struct rte_tm_wred_params wp; > > + enum rte_tm_color color; > > + struct rte_tm_error error; > > + uint32_t wred_profile_id =3D res->wred_profile_id; > > + portid_t port_id =3D res->port_id; > > + int ret; > > + > > + if (port_id_is_invalid(port_id, ENABLED_WARN)) > > + return; > > + > > + memset(&wp, 0, sizeof(struct rte_tm_wred_params)); > > + > > + /* WRED Params (Green Color)*/ > > + if ((strcmp(res->color_g, "G") =3D=3D 0) || > > + (strcmp(res->color_g, "g") =3D=3D 0)) { > > + color =3D RTE_TM_GREEN; > > + wp.red_params[color].min_th =3D res->min_th_g; > > + wp.red_params[color].max_th =3D res->max_th_g; > > + wp.red_params[color].maxp_inv =3D res->maxp_inv_g; > > + wp.red_params[color].wq_log2 =3D res->wq_log2_g; > > + } else { > > + printf("WRED profile error(G or g for green color)!\n"); > > + return; > > + } > > + > No need to check the res->color_g, because it already be checked by > cmdline. > Because you defined it like > cmd_add_port_tm_node_wred_profile_color_g =3D > TOKEN_STRING_INITIALIZER( > struct cmd_add_port_tm_node_wred_profile_result, > color_g, "G#g"); > You can just assign wp.red_params[RTE_TM_GREEN] directly. > The similar as color_y, color_r. > And is that possible for you to set WERD with less than 3 colors? If so, = you > may need to change your command definition. Ok, I will remove the extra check which seems unnecessary. Also, will try t= o simplify the command to single color instead of three color at a time. Thanks.