From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 76942A0516; Tue, 9 Jun 2020 14:01:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8AA891BF8E; Tue, 9 Jun 2020 13:57:14 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id BDD8A1BF31 for ; Tue, 9 Jun 2020 13:57:04 +0200 (CEST) IronPort-SDR: cQ0LBTrw1fMbN8Wp/1QlDGG94W+kqaDzHv/T51VwHvpb8yx+nZ5bL0eVMXG+NqEZ5cYXZ/51IH bt2372wReP9g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2020 04:57:04 -0700 IronPort-SDR: amBFK4FYykVXtzC4tq8ongi9pezqPV0spN1IBH4VmHBC/O8jr9hgjKp9xo13RGf0W1tVQTGVVN 59S4Agu5kSWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,492,1583222400"; d="scan'208";a="473044191" Received: from dpdk51.sh.intel.com ([10.67.111.82]) by fmsmga005.fm.intel.com with ESMTP; 09 Jun 2020 04:57:02 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: xiaolong.ye@intel.com, dev@dpdk.org, Qi Zhang , Kiran Patil , "Paul M . Stillwell Jr" Date: Tue, 9 Jun 2020 19:59:40 +0800 Message-Id: <20200609120001.35110-32-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200609120001.35110-1-qi.z.zhang@intel.com> References: <20200603024016.30636-1-qi.z.zhang@intel.com> <20200609120001.35110-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 31/52] net/ice/base: reset flags when all rules are deleted X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" To avoid having stale information about "adv_rule" per recipe, when all rules associated to a given recipe are deleted, reset the "adv_rule" flag otherwise it causes problem later on when decisions about filter rules being present or not are made based on "adv_rule" flag. Removed setting "adv_rule = 1" when recipe is created. It is set correctly when advanced switch rule is added referring to the recipe which was created as a result of adding advanced switch rule. Signed-off-by: Kiran Patil Signed-off-by: Paul M. Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_switch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 94268d560..f379a5f5d 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -4122,6 +4122,9 @@ void ice_rem_all_sw_rules_info(struct ice_hw *hw) ice_rem_sw_rule_info(hw, rule_head); else ice_rem_adv_rule_info(hw, rule_head); + if (sw->recp_list[i].adv_rule && + LIST_EMPTY(&sw->recp_list[i].filt_rules)) + sw->recp_list[i].adv_rule = false; } } @@ -6130,7 +6133,6 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm, recp->n_grp_count = rm->n_grp_count; recp->tun_type = rm->tun_type; recp->recp_created = true; - recp->adv_rule = 1; } rm->root_buf = buf; ice_free(hw, tmp); @@ -7611,11 +7613,15 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, rule_buf_sz, 1, ice_aqc_opc_remove_sw_rules, NULL); if (status == ICE_SUCCESS || status == ICE_ERR_DOES_NOT_EXIST) { + struct ice_switch_info *sw = hw->switch_info; + ice_acquire_lock(rule_lock); LIST_DEL(&list_elem->list_entry); ice_free(hw, list_elem->lkups); ice_free(hw, list_elem); ice_release_lock(rule_lock); + if (LIST_EMPTY(&sw->recp_list[rid].filt_rules)) + sw->recp_list[rid].adv_rule = false; } ice_free(hw, s_rule); } -- 2.13.6