[PATCH v6 26/27] net/ice: avoid rte malloc in raw pattern parsing

Anatoly Burakov
2026-02-19T16:26:27Z

Currently, when parsing raw flow patterns, we are using rte_zmalloc
followed by an immediate rte_free. This memory does not need to be stored
in hugepage memory, so replace it with regular malloc/free.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/intel/ice/ice_fdir_filter.c | 14 +++++++-------
drivers/net/intel/ice/ice_hash.c | 10 +++++-----
2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index da22b65a77..5f44b5c818 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1879,13 +1879,13 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
pkt_len)
return -rte_errno;

- tmp_spec = rte_zmalloc(NULL, pkt_len / 2, 0);
+ tmp_spec = calloc(1, pkt_len / 2);
if (!tmp_spec)
return -rte_errno;

- tmp_mask = rte_zmalloc(NULL, pkt_len / 2, 0);
+ tmp_mask = calloc(1, pkt_len / 2);
if (!tmp_mask) {
- rte_free(tmp_spec);
+ free(tmp_spec);
return -rte_errno;
}

@@ -1950,13 +1950,13 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,

filter->parser_ena = true;

- rte_free(tmp_spec);
- rte_free(tmp_mask);
+ free(tmp_spec);
+ free(tmp_mask);
break;

raw_error:
- rte_free(tmp_spec);
- rte_free(tmp_mask);
+ free(tmp_spec);
+ free(tmp_mask);
return ret_val;
}

diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c
index afdc8f220a..854c6e8dca 100644
--- a/drivers/net/intel/ice/ice_hash.c
+++ b/drivers/net/intel/ice/ice_hash.c
@@ -676,13 +676,13 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad,

pkt_len = spec_len / 2;

- pkt_buf = rte_zmalloc(NULL, pkt_len, 0);
+ pkt_buf = calloc(1, pkt_len);
if (!pkt_buf)
return -ENOMEM;

- msk_buf = rte_zmalloc(NULL, pkt_len, 0);
+ msk_buf = calloc(1, pkt_len);
if (!msk_buf) {
- rte_free(pkt_buf);
+ free(pkt_buf);
return -ENOMEM;
}

@@ -733,8 +733,8 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad,
rte_memcpy(&meta->raw.prof, &prof, sizeof(prof));

free_mem:
- rte_free(pkt_buf);
- rte_free(msk_buf);
+ free(pkt_buf);
+ free(msk_buf);

return ret;
}
--
2.47.3