/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2020 Intel Corporation
+ * Copyright(c) 2001-2021 Intel Corporation
*/
#include "ice_common.h"
if (acts[i].type == ICE_FLOW_ACT_CNTR_PKT ||
acts[i].type == ICE_FLOW_ACT_CNTR_BYTES ||
acts[i].type == ICE_FLOW_ACT_CNTR_PKT_BYTES) {
- struct ice_acl_cntrs cntrs;
+ struct ice_acl_cntrs cntrs = { 0 };
enum ice_status status;
+ /* amount is unused in the dealloc path but the common
+ * parameter check routine wants a value set, as zero
+ * is invalid for the check. Just set it.
+ */
+ cntrs.amount = 1;
cntrs.bank = 0; /* Only bank0 for the moment */
cntrs.first_cntr =
LE16_TO_CPU(acts[i].data.acl_act.value);
if (acts[i].type == ICE_FLOW_ACT_CNTR_PKT ||
acts[i].type == ICE_FLOW_ACT_CNTR_BYTES ||
acts[i].type == ICE_FLOW_ACT_CNTR_PKT_BYTES) {
- struct ice_acl_cntrs cntrs;
+ struct ice_acl_cntrs cntrs = { 0 };
enum ice_status status;
cntrs.amount = 1;
if (entry_h == ICE_FLOW_ENTRY_HANDLE_INVAL)
return ICE_ERR_PARAM;
- entry = ICE_FLOW_ENTRY_PTR((unsigned long)entry_h);
+ entry = ICE_FLOW_ENTRY_PTR((intptr_t)entry_h);
/* Retain the pointer to the flow profile as the entry will be freed */
prof = entry->prof;
seg->raws_cnt++;
}
+/**
+ * ice_flow_rem_vsi_prof - remove vsi from flow profile
+ * @hw: pointer to the hardware structure
+ * @blk: classification stage
+ * @vsi_handle: software VSI handle
+ * @prof_id: unique ID to identify this flow profile
+ *
+ * This function removes the flow entries associated to the input
+ * vsi handle and disassociates the vsi from the flow profile.
+ */
+enum ice_status ice_flow_rem_vsi_prof(struct ice_hw *hw, enum ice_block blk, u16 vsi_handle,
+ u64 prof_id)
+{
+ struct ice_flow_prof *prof = NULL;
+ enum ice_status status = ICE_SUCCESS;
+
+ if (blk >= ICE_BLK_COUNT || !ice_is_vsi_valid(hw, vsi_handle))
+ return ICE_ERR_PARAM;
+
+ /* find flow profile pointer with input package block and profile id */
+ prof = ice_flow_find_prof_id(hw, ICE_BLK_FD, prof_id);
+ if (!prof) {
+ ice_debug(hw, ICE_DBG_PKG,
+ "Cannot find flow profile id=%" PRIu64 "\n", prof_id);
+ return ICE_ERR_DOES_NOT_EXIST;
+ }
+
+ /* Remove all remaining flow entries before removing the flow profile */
+ if (!LIST_EMPTY(&prof->entries)) {
+ struct ice_flow_entry *e, *t;
+
+ ice_acquire_lock(&prof->entries_lock);
+ LIST_FOR_EACH_ENTRY_SAFE(e, t, &prof->entries, ice_flow_entry,
+ l_entry) {
+ if (e->vsi_handle != vsi_handle)
+ continue;
+
+ status = ice_flow_rem_entry_sync(hw, blk, e);
+ if (status)
+ break;
+ }
+ ice_release_lock(&prof->entries_lock);
+ }
+ if (status)
+ return status;
+
+ /* disassociate the flow profile from sw vsi handle */
+ status = ice_flow_disassoc_prof(hw, blk, prof, vsi_handle);
+ if (status)
+ ice_debug(hw, ICE_DBG_PKG,
+ "ice_flow_disassoc_prof() failed with status=%d\n",
+ status);
+ return status;
+}
+
#define ICE_FLOW_RSS_SEG_HDR_L2_MASKS \
(ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN)
* 3 for tunneled with outer ipv6
*/
#define ICE_FLOW_GEN_PROFID(hash, hdr, encap) \
- (u64)(((u64)(hash) & ICE_FLOW_PROF_HASH_M) | \
- (((u64)(hdr) << ICE_FLOW_PROF_HDR_S) & ICE_FLOW_PROF_HDR_M) | \
- (((u64)(encap) << ICE_FLOW_PROF_ENCAP_S) & ICE_FLOW_PROF_ENCAP_M))
+ ((u64)(((u64)(hash) & ICE_FLOW_PROF_HASH_M) | \
+ (((u64)(hdr) << ICE_FLOW_PROF_HDR_S) & ICE_FLOW_PROF_HDR_M) | \
+ (((u64)(encap) << ICE_FLOW_PROF_ENCAP_S) & ICE_FLOW_PROF_ENCAP_M)))
static void
ice_rss_config_xor_word(struct ice_hw *hw, u8 prof_id, u8 src, u8 dst)
if (status)
goto exit;
- /* Don't do RSS for GTPU Outer */
- if (segs_cnt == ICE_FLOW_SEG_SINGLE &&
- segs[segs_cnt - 1].hdrs & ICE_FLOW_SEG_HDR_GTPU) {
- status = ICE_SUCCESS;
- goto exit;
- }
-
/* Search for a flow profile that has matching headers, hash fields
* and has the input VSI associated to it. If found, no further
* operations required and exit.
if (status)
goto out;
- /* Don't do RSS for GTPU Outer */
- if (segs_cnt == ICE_FLOW_SEG_SINGLE &&
- segs[segs_cnt - 1].hdrs & ICE_FLOW_SEG_HDR_GTPU) {
- status = ICE_SUCCESS;
- goto out;
- }
-
prof = ice_flow_find_prof_conds(hw, blk, ICE_FLOW_RX, segs, segs_cnt,
vsi_handle,
ICE_FLOW_FIND_PROF_CHK_FLDS);