On 10/21/2026 11:25 AM, Bruce Richardson wrote:
On Tue, Oct 20, 2026 at 01:11:08PM +0100, Anatoly Burakov wrote:
Pattern lookup allocates a match item just to copy an entry from the
engine's supported-pattern table. Each engine must then free this
temporary object after parsing.

Make `ice_search_pattern_match_item()` fill caller-provided storage
and return a status code. Use stack-local match items in all four
engines, removing the allocation and corresponding cleanup paths.

Signed-off-by: Anatoly Burakov <[email protected]>
Acked-by: Bruce Richardson <[email protected]>

I'm sure there are still plenty more cleanups that can be done converting
dynamic to stack storage. Even a quick review of this change shows that the
"rss_meta_ptr" value in ice_hash_parse_pattern_action can be just put on
stack to simplify the code.

If you mean allocate the meta on the stack, that particular fix wouldn't pan out because of the way engines manage memory (basically, rss_meta_ptr is the one that has to persist, so it has to be allocated on the heap). If you mean allocate the meta on the stack *in the caller*, that would work but require some re-plumbing because we'd need a union of all possible metadatas to pass into the parse function. So, doable, but a bit more work than just putting things on the stack.

This suggestion is also nullified by patch 6, because it makes it so that the final flow object is allocated by the parse function, so there's no more "metadata" passing between pattern matcher and the engine - the heap-allocated object is the one we store in the flow list.

However, you're right that there's plenty of things we could've done differently when it comes to memory management, and future work porting ice to flow_engine framework will fix all of these issues in flow our API (and will get rid of the nested allocations that are still kept in patch 6).

---
  drivers/net/intel/ice/ice_acl_filter.c    | 22 ++++++++------------
  drivers/net/intel/ice/ice_fdir_filter.c   | 18 ++++++++--------
  drivers/net/intel/ice/ice_generic_flow.c  | 25 +++++------------------
  drivers/net/intel/ice/ice_generic_flow.h  |  3 ++-
  drivers/net/intel/ice/ice_hash.c          | 13 +++++-------
  drivers/net/intel/ice/ice_switch_filter.c | 14 +++++--------
  6 files changed, 34 insertions(+), 61 deletions(-)



--
Thanks,
Anatoly

Reply via email to