The process private data allocation was indented incorrectly
in the source code, and had unnecessary cast. It is better
that the data be allocated on same numa node as the device
structure.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 drivers/net/pcap/pcap_ethdev.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index 728ef85d53..aefa74c7be 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -1208,10 +1208,8 @@ pmd_init_internals(struct rte_vdev_device *vdev,
        PMD_LOG(INFO, "Creating pcap-backed ethdev on numa socket %d",
                numa_node);
 
-       pp = (struct pmd_process_private *)
-               rte_zmalloc(NULL, sizeof(struct pmd_process_private),
-                               RTE_CACHE_LINE_SIZE);
-
+       pp = rte_zmalloc_socket(NULL, sizeof(struct pmd_process_private),
+                               RTE_CACHE_LINE_SIZE, numa_node);
        if (pp == NULL) {
                PMD_LOG(ERR,
                        "Failed to allocate memory for process private");
@@ -1578,11 +1576,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_socket(NULL, sizeof(struct 
pmd_process_private),
+                                       RTE_CACHE_LINE_SIZE, 
dev->device.numa_node);
                if (pp == NULL) {
                        PMD_LOG(ERR,
                                "Failed to allocate memory for process 
private");
-- 
2.47.2

Reply via email to