patch 'app/procinfo: remove unnecessary rte_malloc' has been queued to stable release 22.11.4

Xueming Li xuemingl at nvidia.com
Sun Oct 22 16:22:50 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/15/23. 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. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=f42884a20c25f4ce9e4daaee0e26c25e9962df91

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From f42884a20c25f4ce9e4daaee0e26c25e9962df91 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Mon, 7 Aug 2023 13:43:10 -0700
Subject: [PATCH] app/procinfo: remove unnecessary rte_malloc
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit cfe29906c69bedb5f87dadcc02703ce46e80f37e ]

Better to use malloc() which is faster than rte_malloc()
and has more error checking, as is done already for statistics.

Fixes: 077c546704da ("app/proc_info: add metrics displaying")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Chengwen Feng <fengchengwen at huawei.com>
---
 app/proc-info/main.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 53e852a07c..50871c92a0 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -19,7 +19,6 @@
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_ethdev.h>
-#include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_launch.h>
@@ -719,24 +718,23 @@ metrics_display(int port_id)
 		return;
 	}

-	metrics = rte_malloc("proc_info_metrics",
-		sizeof(struct rte_metric_value) * len, 0);
+	metrics = malloc(sizeof(struct rte_metric_value) * len);
 	if (metrics == NULL) {
 		printf("Cannot allocate memory for metrics\n");
 		return;
 	}

-	names =  rte_malloc(NULL, sizeof(struct rte_metric_name) * len, 0);
+	names = malloc(sizeof(struct rte_metric_name) * len);
 	if (names == NULL) {
 		printf("Cannot allocate memory for metrics names\n");
-		rte_free(metrics);
+		free(metrics);
 		return;
 	}

 	if (len != rte_metrics_get_names(names, len)) {
 		printf("Cannot get metrics names\n");
-		rte_free(metrics);
-		rte_free(names);
+		free(metrics);
+		free(names);
 		return;
 	}

@@ -748,8 +746,8 @@ metrics_display(int port_id)
 	ret = rte_metrics_get_values(port_id, metrics, len);
 	if (ret < 0 || ret > len) {
 		printf("Cannot get metrics values\n");
-		rte_free(metrics);
-		rte_free(names);
+		free(metrics);
+		free(names);
 		return;
 	}

@@ -758,8 +756,8 @@ metrics_display(int port_id)
 		printf("%s: %"PRIu64"\n", names[i].name, metrics[i].value);

 	printf("%s############################\n", nic_stats_border);
-	rte_free(metrics);
-	rte_free(names);
+	free(metrics);
+	free(names);
 }
 #endif

--
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-10-22 22:17:39.382566600 +0800
+++ 0141-app-procinfo-remove-unnecessary-rte_malloc.patch	2023-10-22 22:17:34.436723700 +0800
@@ -1 +1 @@
-From cfe29906c69bedb5f87dadcc02703ce46e80f37e Mon Sep 17 00:00:00 2001
+From f42884a20c25f4ce9e4daaee0e26c25e9962df91 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit cfe29906c69bedb5f87dadcc02703ce46e80f37e ]
@@ -10 +12,0 @@
-Cc: stable at dpdk.org
@@ -19 +21 @@
-index af4c1d8bcb..ce53bc30df 100644
+index 53e852a07c..50871c92a0 100644
@@ -30 +32 @@
-@@ -909,24 +908,23 @@ metrics_display(int port_id)
+@@ -719,24 +718,23 @@ metrics_display(int port_id)
@@ -60 +62 @@
-@@ -938,8 +936,8 @@ metrics_display(int port_id)
+@@ -748,8 +746,8 @@ metrics_display(int port_id)
@@ -71 +73 @@
-@@ -948,8 +946,8 @@ metrics_display(int port_id)
+@@ -758,8 +756,8 @@ metrics_display(int port_id)


More information about the stable mailing list