[30/35] net/ionic: add alignment and socket info in allocations

Message ID 20221007174336.54354-31-andrew.boyer@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/ionic: updates for 22.11 release |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Boyer, Andrew Oct. 7, 2022, 5:43 p.m. UTC
  This will avoid memory access penalties on NUMA systems.

Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
---
 drivers/net/ionic/ionic_ethdev.c    |  5 +++--
 drivers/net/ionic/ionic_lif.c       | 13 ++++++++-----
 drivers/net/ionic/ionic_rx_filter.c |  3 +--
 3 files changed, 12 insertions(+), 9 deletions(-)
  

Patch

diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 43fa5f8bbf..36fb09b810 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -1005,7 +1005,8 @@  eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	/* Allocate memory for storing MAC addresses */
 	eth_dev->data->mac_addrs = rte_calloc("ionic",
 					adapter->max_mac_addrs,
-					RTE_ETHER_ADDR_LEN, 0);
+					RTE_ETHER_ADDR_LEN,
+					RTE_CACHE_LINE_SIZE);
 	if (eth_dev->data->mac_addrs == NULL) {
 		IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
 			"store MAC addresses",
@@ -1083,7 +1084,7 @@  eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
 		goto err;
 	}
 
-	adapter = rte_zmalloc("ionic", sizeof(*adapter), 0);
+	adapter = rte_zmalloc("ionic", sizeof(*adapter), RTE_CACHE_LINE_SIZE);
 	if (!adapter) {
 		IONIC_PRINT(ERR, "OOM");
 		err = -ENOMEM;
diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index fbeec8ef2e..cf9605c791 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -598,7 +598,8 @@  ionic_qcq_alloc(struct ionic_lif *lif,
 		total_size += rte_mem_page_size();
 	}
 
-	new = rte_zmalloc("ionic", struct_size, 0);
+	new = rte_zmalloc_socket("ionic", struct_size,
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!new) {
 		IONIC_PRINT(ERR, "Cannot allocate queue structure");
 		return -ENOMEM;
@@ -1037,17 +1038,19 @@  ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENOMEM;
 	}
 
-	lif->txqcqs = rte_calloc("ionic",
+	lif->txqcqs = rte_calloc_socket("ionic",
 				adapter->max_ntxqs_per_lif,
-				sizeof(*lif->txqcqs), 0);
+				sizeof(*lif->txqcqs),
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!lif->txqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate tx queues array");
 		return -ENOMEM;
 	}
 
-	lif->rxqcqs = rte_calloc("ionic",
+	lif->rxqcqs = rte_calloc_socket("ionic",
 				adapter->max_nrxqs_per_lif,
-				sizeof(*lif->rxqcqs), 0);
+				sizeof(*lif->rxqcqs),
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!lif->rxqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate rx queues array");
 		return -ENOMEM;
diff --git a/drivers/net/ionic/ionic_rx_filter.c b/drivers/net/ionic/ionic_rx_filter.c
index fdedb9e288..5f9b569f64 100644
--- a/drivers/net/ionic/ionic_rx_filter.c
+++ b/drivers/net/ionic/ionic_rx_filter.c
@@ -55,8 +55,7 @@  ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
 	struct ionic_rx_filter *f;
 	uint32_t key;
 
-	f = rte_zmalloc("ionic", sizeof(*f), 0);
-
+	f = rte_zmalloc("ionic", sizeof(*f), RTE_CACHE_LINE_SIZE);
 	if (!f)
 		return -ENOMEM;