[PATCH v5 19/27] net/iavf: avoid rte malloc in RSS configuration

Anatoly Burakov
2026-02-17T12:16:48Z

Currently, when configuring RSS (redirection table, lookup table, and
hash key), we are using rte_zmalloc followed by an immediate rte_free.
This is not needed as this memory is not being stored anywhere, so
replace it with regular malloc/free.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf_ethdev.c | 4 ++--
drivers/net/intel/iavf/iavf_vchnl.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 70eb7e7ec5..d3fa47fd5e 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -1554,7 +1554,7 @@ iavf_dev_rss_reta_update(struct rte_eth_dev *dev,
return -EINVAL;
}

- lut = rte_zmalloc("rss_lut", reta_size, 0);
+ lut = calloc(1, reta_size);
if (!lut) {
PMD_DRV_LOG(ERR, "No memory can be allocated");
return -ENOMEM;
@@ -1574,7 +1574,7 @@ iavf_dev_rss_reta_update(struct rte_eth_dev *dev,
ret = iavf_configure_rss_lut(adapter);
if (ret) /* revert back */
rte_memcpy(vf->rss_lut, lut, reta_size);
- rte_free(lut);
+ free(lut);

return ret;
}
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index 9ad39300c6..55986ef909 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -1159,7 +1159,7 @@ iavf_configure_rss_lut(struct iavf_adapter *adapter)
int len, err = 0;

len = sizeof(*rss_lut) + vf->vf_res->rss_lut_size - 1;
- rss_lut = rte_zmalloc("rss_lut", len, 0);
+ rss_lut = calloc(1, len);
if (!rss_lut)
return -ENOMEM;

@@ -1178,7 +1178,7 @@ iavf_configure_rss_lut(struct iavf_adapter *adapter)
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_CONFIG_RSS_LUT");

- rte_free(rss_lut);
+ free(rss_lut);
return err;
}

@@ -1191,7 +1191,7 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
int len, err = 0;

len = sizeof(*rss_key) + vf->vf_res->rss_key_size - 1;
- rss_key = rte_zmalloc("rss_key", len, 0);
+ rss_key = calloc(1, len);
if (!rss_key)
return -ENOMEM;

@@ -1210,7 +1210,7 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_CONFIG_RSS_KEY");

- rte_free(rss_key);
+ free(rss_key);
return err;
}

--
2.47.3