[dpdk-stable] patch 'app/testpmd: fix memory allocation for DSCP table' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Thu Nov 29 14:20:31 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From 9ea49e5abf874e263b42c73c25177c4be32be213 Mon Sep 17 00:00:00 2001
From: Jasvinder Singh <jasvinder.singh at intel.com>
Date: Tue, 6 Nov 2018 10:26:40 +0000
Subject: [PATCH] app/testpmd: fix memory allocation for DSCP table

[ upstream commit 459463ae6c2602de54c72330f31c206ac59387ea ]

The patch fixes the memory allocation for the meter DSCP table.

Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")

Signed-off-by: Jasvinder Singh <jasvinder.singh at intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 app/test-pmd/cmdline_mtr.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index 63f32828f..846de88db 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -75,5 +75,5 @@ parse_uint(uint64_t *value, const char *str)
 
 static int
-parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table)
+parse_dscp_table_entries(char *str, enum rte_mtr_color **dscp_table)
 {
 	char *token;
@@ -85,7 +85,7 @@ parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table)
 
 	/* Allocate memory for dscp table */
-	dscp_table = (enum rte_mtr_color *)malloc(MAX_DSCP_TABLE_ENTRIES *
+	*dscp_table = (enum rte_mtr_color *)malloc(MAX_DSCP_TABLE_ENTRIES *
 		sizeof(enum rte_mtr_color));
-	if (dscp_table == NULL)
+	if (*dscp_table == NULL)
 		return -1;
 
@@ -93,13 +93,13 @@ parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table)
 		if (strcmp(token, "G") == 0 ||
 			strcmp(token, "g") == 0)
-			dscp_table[i++] = RTE_MTR_GREEN;
+			*dscp_table[i++] = RTE_MTR_GREEN;
 		else if (strcmp(token, "Y") == 0 ||
 			strcmp(token, "y") == 0)
-			dscp_table[i++] = RTE_MTR_YELLOW;
+			*dscp_table[i++] = RTE_MTR_YELLOW;
 		else if (strcmp(token, "R") == 0 ||
 			strcmp(token, "r") == 0)
-			dscp_table[i++] = RTE_MTR_RED;
+			*dscp_table[i++] = RTE_MTR_RED;
 		else {
-			free(dscp_table);
+			free(*dscp_table);
 			return -1;
 		}
@@ -109,5 +109,5 @@ parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table)
 		token = strtok_r(str, PARSE_DELIMITER, &str);
 		if (token == NULL) {
-			free(dscp_table);
+			free(*dscp_table);
 			return -1;
 		}
@@ -118,5 +118,5 @@ parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table)
 static int
 parse_meter_color_str(char *c_str, uint32_t *use_prev_meter_color,
-	enum rte_mtr_color *dscp_table)
+	enum rte_mtr_color **dscp_table)
 {
 	char *token;
@@ -196,5 +196,5 @@ parse_policer_action_string(char *p_str, uint32_t action_mask,
 static int
 parse_multi_token_string(char *t_str, uint16_t *port_id,
-	uint32_t *mtr_id, enum rte_mtr_color *dscp_table)
+	uint32_t *mtr_id, enum rte_mtr_color **dscp_table)
 {
 	char *token;
@@ -795,5 +795,5 @@ static void cmd_create_port_meter_parsed(void *parsed_result,
 
 	/* Parse meter input color string params */
-	ret = parse_meter_color_str(c_str, &use_prev_meter_color, dscp_table);
+	ret = parse_meter_color_str(c_str, &use_prev_meter_color, &dscp_table);
 	if (ret) {
 		printf(" Meter input color params string parse error\n");
@@ -1142,5 +1142,5 @@ static void cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
 
 	/* Parse string */
-	ret = parse_multi_token_string(t_str, &port_id, &mtr_id, dscp_table);
+	ret = parse_multi_token_string(t_str, &port_id, &mtr_id, &dscp_table);
 	if (ret) {
 		printf(" Multi token string parse error\n");
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-29 13:11:35.818359100 +0000
+++ 0030-app-testpmd-fix-memory-allocation-for-DSCP-table.patch	2018-11-29 13:11:34.000000000 +0000
@@ -1,12 +1,13 @@
-From 459463ae6c2602de54c72330f31c206ac59387ea Mon Sep 17 00:00:00 2001
+From 9ea49e5abf874e263b42c73c25177c4be32be213 Mon Sep 17 00:00:00 2001
 From: Jasvinder Singh <jasvinder.singh at intel.com>
 Date: Tue, 6 Nov 2018 10:26:40 +0000
 Subject: [PATCH] app/testpmd: fix memory allocation for DSCP table
 
+[ upstream commit 459463ae6c2602de54c72330f31c206ac59387ea ]
+
 The patch fixes the memory allocation for the meter DSCP table.
 
 Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
-Cc: stable at dpdk.org
 
 Signed-off-by: Jasvinder Singh <jasvinder.singh at intel.com>
 Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>


More information about the stable mailing list