From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 3B5C21B4AA for ; Thu, 29 Nov 2018 14:22:47 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F417C05FF87; Thu, 29 Nov 2018 13:22:46 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-230.ams2.redhat.com [10.36.117.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BBA1105706A; Thu, 29 Nov 2018 13:22:44 +0000 (UTC) From: Kevin Traynor To: Jasvinder Singh Cc: Ferruh Yigit , dpdk stable Date: Thu, 29 Nov 2018 13:20:31 +0000 Message-Id: <20181129132128.7609-31-ktraynor@redhat.com> In-Reply-To: <20181129132128.7609-1-ktraynor@redhat.com> References: <20181129132128.7609-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 29 Nov 2018 13:22:46 +0000 (UTC) Subject: [dpdk-stable] patch 'app/testpmd: fix memory allocation for DSCP table' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2018 13:22:47 -0000 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 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 Reviewed-by: Ferruh Yigit --- 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 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@dpdk.org Signed-off-by: Jasvinder Singh Reviewed-by: Ferruh Yigit