net/ice/base: add function to deallocate flow entry

Decouple ice_dealloc_flow_entry from ice_flow_rem_entry_sync.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
Leyi Rong 2019-06-19 23:18:20 +08:00 committed by Ferruh Yigit
parent 5c8af36253
commit 16c14a0cd6

View File

@ -931,6 +931,29 @@ ice_flow_find_prof_id(struct ice_hw *hw, enum ice_block blk, u64 prof_id)
return NULL;
}
/**
* ice_dealloc_flow_entry - Deallocate flow entry memory
* @hw: pointer to the HW struct
* @entry: flow entry to be removed
*/
static void
ice_dealloc_flow_entry(struct ice_hw *hw, struct ice_flow_entry *entry)
{
if (!entry)
return;
if (entry->entry)
ice_free(hw, entry->entry);
if (entry->acts) {
ice_free(hw, entry->acts);
entry->acts = NULL;
entry->acts_cnt = 0;
}
ice_free(hw, entry);
}
/**
* ice_flow_rem_entry_sync - Remove a flow entry
* @hw: pointer to the HW struct
@ -944,16 +967,7 @@ ice_flow_rem_entry_sync(struct ice_hw *hw, struct ice_flow_entry *entry)
LIST_DEL(&entry->l_entry);
if (entry->entry)
ice_free(hw, entry->entry);
if (entry->acts) {
ice_free(hw, entry->acts);
entry->acts = NULL;
entry->acts_cnt = 0;
}
ice_free(hw, entry);
ice_dealloc_flow_entry(hw, entry);
return ICE_SUCCESS;
}