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 7DB01A0599; Fri, 10 Apr 2020 03:04:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C80121D449; Fri, 10 Apr 2020 03:03:47 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 014EF1D440 for ; Fri, 10 Apr 2020 03:03:45 +0200 (CEST) IronPort-SDR: 1Q/rOiAPkCi85fftJRB1352n/bQMMx1FjxT8bzFHhPg2Zf/j1kFNkkebr8sIrEdMFFB5i7lOPt HqttfXOW/s7w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 18:03:45 -0700 IronPort-SDR: Ze3WkkMllHl4FOWLRm9FhOqt6nRsGHEvJVUoBKzBrf356wE1CRFQ7b0S9bUb4obbDlPKLmpFFO FzswnSEx9IOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,364,1580803200"; d="scan'208";a="259525752" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by orsmga008.jf.intel.com with ESMTP; 09 Apr 2020 18:03:43 -0700 From: Wei Zhao To: dev@dpdk.org Cc: qi.z.zhang@intel.com, nannan.lu@intel.com, yuan.peng@intel.com, Wei Zhao Date: Fri, 10 Apr 2020 08:41:57 +0800 Message-Id: <20200410004157.3032-4-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200410004157.3032-1-wei.zhao1@intel.com> References: <20200410004157.3032-1-wei.zhao1@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 3/3] net/ice/base: force switch to use different recipe for 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" When we use profile rule as swicth rule to download, if we download 2 different rules one by one, there will be rejection from function ice_aq_sw_rules(), for example: "flow create 0 priority 0 ingress pattern eth / ipv6 / ah / end actions queue index 3 / end" "flow create 0 priority 0 ingress pattern eth / ipv6 / esp / end actions queue index 2 / end" That is because the 2 rules has the same s_rule input set except action queue index, so it will be rejected by hardware. So we have to use different recipes for them. Also, we need to add recipe_id to keep record of recipe index, which will be used in rule remove, if not, there will be error when search recipe in function ice_rem_adv_rule() if we create 2 or more profile rule. For example: "flow create 0 priority 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 1 / end actions queue index 4 / end" "flow create 0 priority 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions queue index 5 / end" then, "flow flush 0" you will find only the first rule will be delete, because ice_find_recp() will always return recipe id of the first rule. Signed-off-by: Wei Zhao --- drivers/net/ice/base/ice_switch.c | 15 ++++++++++----- drivers/net/ice/base/ice_switch.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index bc0c368d7..d8eec7f51 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -4983,7 +4983,8 @@ static const struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = { * * Returns index of matching recipe, or ICE_MAX_NUM_RECIPES if not found. */ -static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts) +static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts, + enum ice_sw_tunnel_type tun_type) { bool refresh_required = true; struct ice_sw_recipe *recp; @@ -5042,7 +5043,10 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts) /* If for "i"th recipe the found was never set to false * then it means we found our match */ - if (found) + if (ice_is_prof_rule(tun_type) && + tun_type == recp[i].tun_type && found) + return i; /* Return the recipe ID */ + else if (!ice_is_prof_rule(tun_type) && found) return i; /* Return the recipe ID */ } } @@ -5798,7 +5802,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo, * if the rule type is a profile rule, that means that there no field value * match required, in this case just a profile hit is required. */ -static bool ice_is_prof_rule(enum ice_sw_tunnel_type type) +bool ice_is_prof_rule(enum ice_sw_tunnel_type type) { switch (type) { case ICE_SW_TUN_PROFID_IPV6_ESP: @@ -5952,11 +5956,12 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, goto err_free_lkup_exts; /* Look for a recipe which matches our requested fv / mask list */ - *rid = ice_find_recp(hw, lkup_exts); + *rid = ice_find_recp(hw, lkup_exts, rinfo->tun_type); if (*rid < ICE_MAX_NUM_RECIPES) /* Success if found a recipe that match the existing criteria */ goto err_unroll; + rm->tun_type = rinfo->tun_type; /* Recipe we need does not exist, add a recipe */ status = ice_add_sw_recipe(hw, rm, match_tun, profiles); if (status) @@ -6873,7 +6878,7 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, if (status) return status; - rid = ice_find_recp(hw, &lkup_exts); + rid = ice_find_recp(hw, &lkup_exts, rinfo->tun_type); /* If did not find a recipe that match the existing criteria */ if (rid == ICE_MAX_NUM_RECIPES) return ICE_ERR_PARAM; diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index f7ae5c741..9666422f7 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -483,5 +483,6 @@ bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle); void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw); +bool ice_is_prof_rule(enum ice_sw_tunnel_type type); #endif /* _ICE_SWITCH_H_ */ -- 2.19.1