[PATCH v21 05/25] net/pcap: remove unnecessary casts
Stephen Hemminger
stephen at networkplumber.org
Wed Mar 25 03:37:36 CET 2026
The function rte_zmalloc returns void * so cast is unnecessary.
Use numa aware allocation and add tag for tracing.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/pcap/pcap_ethdev.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index 4513d46d61..d6fe062b92 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -1217,13 +1217,11 @@ pmd_init_internals(struct rte_vdev_device *vdev,
struct pmd_process_private *pp;
unsigned int numa_node = vdev->device.numa_node;
- PMD_LOG(INFO, "Creating pcap-backed ethdev on numa socket %d",
+ PMD_LOG(INFO, "Creating pcap-backed ethdev on numa socket %u",
numa_node);
- pp = (struct pmd_process_private *)
- rte_zmalloc(NULL, sizeof(struct pmd_process_private),
- RTE_CACHE_LINE_SIZE);
-
+ pp = rte_zmalloc_socket("pcap_private", sizeof(struct pmd_process_private),
+ RTE_CACHE_LINE_SIZE, numa_node);
if (pp == NULL) {
PMD_LOG(ERR,
"Failed to allocate memory for process private");
@@ -1284,7 +1282,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev,
if (osdep_iface_mac_get(if_name, &mac) < 0)
return -1;
- mac_addrs = rte_zmalloc_socket(NULL, RTE_ETHER_ADDR_LEN, 0, numa_node);
+ mac_addrs = rte_zmalloc_socket("pcap_mac", RTE_ETHER_ADDR_LEN, 0, numa_node);
if (mac_addrs == NULL)
return -1;
@@ -1590,11 +1588,8 @@ pmd_pcap_probe(struct rte_vdev_device *dev)
unsigned int i;
internal = eth_dev->data->dev_private;
- pp = (struct pmd_process_private *)
- rte_zmalloc(NULL,
- sizeof(struct pmd_process_private),
- RTE_CACHE_LINE_SIZE);
-
+ pp = rte_zmalloc("pcap_private", sizeof(struct pmd_process_private),
+ RTE_CACHE_LINE_SIZE);
if (pp == NULL) {
PMD_LOG(ERR,
"Failed to allocate memory for process private");
--
2.53.0
More information about the dev
mailing list