Re: [PATCH v3 10/27] net/i40e: avoid rte malloc in RSS RETA operations

Bruce Richardson
2026-02-16T17:06:46Z

On Wed, Feb 11, 2026 at 01:52:52PM +0000, Anatoly Burakov wrote:
> Currently, when updating or querying RSS redirection table (RETA), 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/i40e/i40e_ethdev.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
> index 06430e6319..654b0e5d16 100644
> --- a/drivers/net/intel/i40e/i40e_ethdev.c
> +++ b/drivers/net/intel/i40e/i40e_ethdev.c
> @@ -4630,7 +4630,7 @@ i40e_dev_rss_reta_update(struct rte_eth_dev *dev,
> return -EINVAL;
> }
>
> - lut = rte_zmalloc("i40e_rss_lut", reta_size, 0);
> + lut = calloc(1, reta_size);
> if (!lut) {
> PMD_DRV_LOG(ERR, "No memory can be allocated");
> return -ENOMEM;
> @@ -4649,7 +4649,7 @@ i40e_dev_rss_reta_update(struct rte_eth_dev *dev,
> pf->adapter->rss_reta_updated = 1;
>
> out:
> - rte_free(lut);
> + free(lut);
>
> return ret;
> }

For i40e do we not have a reasonable max reta size that we could use for a
local array variable, save allocating and freeing entirely?

> @@ -4673,7 +4673,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev *dev,
> return -EINVAL;
> }
>
> - lut = rte_zmalloc("i40e_rss_lut", reta_size, 0);
> + lut = calloc(1, reta_size);
> if (!lut) {
> PMD_DRV_LOG(ERR, "No memory can be allocated");
> return -ENOMEM;
> @@ -4690,7 +4690,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev *dev,
> }
>
> out:
> - rte_free(lut);
> + free(lut);
>
> return ret;
> }
> --
> 2.47.3
>