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

Burakov, Anatoly
2026-02-17T12:32:18Z

On 2/16/2026 6:06 PM, Bruce Richardson wrote:
> 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?
>

It's on the order of kilobytes I think so I decided against stack
allocation for this scenario.

--
Thanks,
Anatoly