app/testpmd: initialize WRED profile packet mode from cli

Message ID 1547124645-90122-1-git-send-email-nikhil.rao@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Cristian Dumitrescu
Headers
Series app/testpmd: initialize WRED profile packet mode from cli |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Rao, Nikhil Jan. 10, 2019, 12:50 p.m. UTC
  Add struct rte_tm_wred_params::packet_mode to the
"add port tm node wred profile" cli command.

Fixes: 2fcf2f104fa2 ("ethdev: support WRED thresholds in bytes")
Cc: stable@dpdk.org

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
 app/test-pmd/cmdline_tm.c                   | 8 ++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)
  

Comments

Jingjing Wu Feb. 14, 2019, 2:03 a.m. UTC | #1
> -----Original Message-----
> From: Rao, Nikhil
> Sent: Thursday, January 10, 2019 8:51 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh,
> Jasvinder <jasvinder.singh@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] app/testpmd: initialize WRED profile packet mode from cli
> 
> Add struct rte_tm_wred_params::packet_mode to the
> "add port tm node wred profile" cli command.
> 
> Fixes: 2fcf2f104fa2 ("ethdev: support WRED thresholds in bytes")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>

Acked-by: Jingjing Wu <jingjing.wu@intel.com>
  

Patch

diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 1012084..70203f3 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -1154,6 +1154,7 @@  struct cmd_add_port_tm_node_wred_profile_result {
 	cmdline_fixed_string_t wred;
 	cmdline_fixed_string_t profile;
 	uint16_t port_id;
+	int packet_mode;
 	uint32_t wred_profile_id;
 	cmdline_fixed_string_t color_g;
 	uint64_t min_th_g;
@@ -1199,6 +1200,10 @@  struct cmd_add_port_tm_node_wred_profile_result {
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_tm_node_wred_profile_result,
 			wred_profile_id, UINT32);
+cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_tm_node_wred_profile_result,
+			packet_mode, INT32);
 cmdline_parse_token_string_t cmd_add_port_tm_node_wred_profile_color_g =
 	TOKEN_STRING_INITIALIZER(
 		struct cmd_add_port_tm_node_wred_profile_result,
@@ -1279,6 +1284,8 @@  static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result,
 	memset(&wp, 0, sizeof(struct rte_tm_wred_params));
 	memset(&error, 0, sizeof(struct rte_tm_error));
 
+	wp.packet_mode = res->packet_mode;
+
 	/* WRED Params  (Green Color)*/
 	color = RTE_TM_GREEN;
 	wp.red_params[color].min_th = res->min_th_g;
@@ -1321,6 +1328,7 @@  static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result,
 		(void *)&cmd_add_port_tm_node_wred_profile_profile,
 		(void *)&cmd_add_port_tm_node_wred_profile_port_id,
 		(void *)&cmd_add_port_tm_node_wred_profile_wred_profile_id,
+		(void *)&cmd_add_port_tm_node_wred_profile_packet_mode,
 		(void *)&cmd_add_port_tm_node_wred_profile_color_g,
 		(void *)&cmd_add_port_tm_node_wred_profile_min_th_g,
 		(void *)&cmd_add_port_tm_node_wred_profile_max_th_g,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index cbf23e9..e10487c 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2666,7 +2666,7 @@  Add port traffic management WRED profile
 
 Create a new WRED profile::
 
-   testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
+   testpmd> add port tm node wred profile (port_id) (wred_profile_id) (packet_mode) \
    (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
    (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
    (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
@@ -2674,6 +2674,8 @@  Create a new WRED profile::
 where:
 
 * ``wred_profile id``: Identifier for the newly create WRED profile
+* ``packet_mode``: WRED profile mode. If non-zero, min_th/max_th are specified
+  in packets, else, min_th/max_th are specified in bytes
 * ``color_g``: Packet color (green)
 * ``min_th_g``: Minimum queue threshold for packet with green color
 * ``max_th_g``: Minimum queue threshold for packet with green color