[PATCH v4 27/27] net/ice: avoid rte malloc in flow pattern match
Burakov, Anatoly
anatoly.burakov at intel.com
Thu Feb 19 14:07:20 CET 2026
On 2/16/2026 6:37 PM, Bruce Richardson wrote:
> On Fri, Feb 13, 2026 at 10:26:38AM +0000, Anatoly Burakov wrote:
>> Currently, when allocating buffers for pattern match items and flow item
>> storage, we are using rte_zmalloc followed by immediate rte_free. This is
>> not needed as these buffers are only used temporarily within the function
>> scope, so replace it with regular calloc/free.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
>> ---
>> drivers/net/intel/ice/ice_acl_filter.c | 3 ++-
>> drivers/net/intel/ice/ice_fdir_filter.c | 5 +++--
>> drivers/net/intel/ice/ice_generic_flow.c | 15 +++++++--------
>> drivers/net/intel/ice/ice_hash.c | 3 ++-
>> drivers/net/intel/ice/ice_switch_filter.c | 5 +++--
>> 5 files changed, 17 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/net/intel/ice/ice_acl_filter.c b/drivers/net/intel/ice/ice_acl_filter.c
>> index 38e30a4f62..6754a40044 100644
>> --- a/drivers/net/intel/ice/ice_acl_filter.c
>> +++ b/drivers/net/intel/ice/ice_acl_filter.c
>> @@ -9,6 +9,7 @@
>> #include <string.h>
>> #include <unistd.h>
>> #include <stdarg.h>
>> +#include <stdlib.h>
>> #include <rte_debug.h>
>> #include <rte_ether.h>
>> #include <ethdev_driver.h>
>> @@ -1009,7 +1010,7 @@ ice_acl_parse(struct ice_adapter *ad,
>> *meta = filter;
>>
>> error:
>> - rte_free(item);
>> + free(item);
>> return ret;
>> }
>
> Should this code be reworked so that the error is propagated back to caller
> and the item freed there so as allocation and freeing occur together in the
> one function - or even in the same file?
>
It should, and in fact further rework is also about fixing quirks like
these. With this patch though, I tried to minimize the changes and not
touch logic, because untangling these allocations is not trivial.
--
Thanks,
Anatoly
More information about the dev
mailing list