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 8A5EBA0563; Mon, 23 Mar 2020 08:20:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8D2BD1C1C4; Mon, 23 Mar 2020 08:16:07 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0A26C1C0D9 for ; Mon, 23 Mar 2020 08:15:45 +0100 (CET) IronPort-SDR: GHud6fpJOM6f7yDnAIJgRj8rgCG5ZaIyxBanek8Ol/ZufiPuFfKu6AT17w/lUk3cTKsRytAL1E okiwMf5ejCKQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 00:15:45 -0700 IronPort-SDR: TZM2BID9wzfbOWUknKeGsisCnpRCsBdJV+RkuNFCa8zDnV5AD4iTofVVJYPgyQiTy2B2QUJ6lH Dua257Ookv3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,295,1580803200"; d="scan'208";a="246111838" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2020 00:15:43 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Tony Nguyen , Paul M Stillwell Jr Date: Mon, 23 Mar 2020 15:17:56 +0800 Message-Id: <20200323071759.13075-34-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200323071759.13075-1-qi.z.zhang@intel.com> References: <20200309114357.31800-1-qi.z.zhang@intel.com> <20200323071759.13075-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 33/36] net/ice/base: misc cleanups for Flow Director 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" Cleanup some things found while doing code review: - Remove unnececcary initializations, parenthesis, and braces - Fix a couple of function headers Signed-off-by: Tony Nguyen Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_fdir.c | 42 ++++++++++++++++++------------------ drivers/net/ice/base/ice_flex_pipe.c | 2 +- drivers/net/ice/base/ice_flow.c | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c index ae82c4d99..6dc8d54da 100644 --- a/drivers/net/ice/base/ice_fdir.c +++ b/drivers/net/ice/base/ice_fdir.c @@ -916,7 +916,7 @@ bool ice_fdir_has_frag(enum ice_fltr_ptype flow) struct ice_fdir_fltr * ice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx) { - struct ice_fdir_fltr *rule = NULL; + struct ice_fdir_fltr *rule; LIST_FOR_EACH_ENTRY(rule, &hw->fdir_list_head, ice_fdir_fltr, fltr_node) { @@ -965,7 +965,7 @@ ice_fdir_update_cntrs(struct ice_hw *hw, enum ice_fltr_ptype flow, { int incr; - incr = (add) ? 1 : -1; + incr = add ? 1 : -1; hw->fdir_active_fltr += incr; if (flow == ICE_FLTR_PTYPE_NONF_NONE || flow >= ICE_FLTR_PTYPE_MAX) { ice_debug(hw, ICE_DBG_SW, "Unknown filter type %d\n", flow); @@ -990,7 +990,7 @@ static int ice_cmp_ipv6_addr(__be32 *a, __be32 *b) } /** - * ice_fdir_comp_ipv6_rules - compare 2 filters + * ice_fdir_comp_rules - compare 2 filters * @a: a Flow Director filter data structure * @b: a Flow Director filter data structure * @v6: bool true if v6 filter @@ -1053,30 +1053,30 @@ ice_fdir_comp_rules(struct ice_fdir_fltr *a, struct ice_fdir_fltr *b, bool v6) */ bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input) { - enum ice_fltr_ptype flow_type; struct ice_fdir_fltr *rule; bool ret = false; - rule = NULL; - LIST_FOR_EACH_ENTRY(rule, &hw->fdir_list_head, ice_fdir_fltr, fltr_node) { - if (rule->flow_type == input->flow_type) { - flow_type = input->flow_type; - if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_TCP || - flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP || - flow_type == ICE_FLTR_PTYPE_NONF_IPV4_SCTP || - flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER) - ret = ice_fdir_comp_rules(rule, input, false); + enum ice_fltr_ptype flow_type; + + if (rule->flow_type != input->flow_type) + continue; + + flow_type = input->flow_type; + if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_TCP || + flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP || + flow_type == ICE_FLTR_PTYPE_NONF_IPV4_SCTP || + flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER) + ret = ice_fdir_comp_rules(rule, input, false); + else + ret = ice_fdir_comp_rules(rule, input, true); + if (ret) { + if (rule->fltr_id == input->fltr_id && + rule->q_index != input->q_index) + ret = false; else - ret = ice_fdir_comp_rules(rule, input, true); - if (ret) { - if (rule->fltr_id == input->fltr_id && - rule->q_index != input->q_index) - ret = false; - else - break; - } + break; } } diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index 851f0273b..213aceef5 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -1953,7 +1953,7 @@ ice_find_free_tunnel_entry(struct ice_hw *hw, enum ice_tunnel_type type, } /** - * ice_get_tunnel_port - retrieve an open tunnel port + * ice_get_open_tunnel_port - retrieve an open tunnel port * @hw: pointer to the HW structure * @type: tunnel type (TNL_ALL will return any open port) * @port: returns open port diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index cdb4b004f..e523b8f45 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -2656,8 +2656,8 @@ ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id, void *data, struct ice_flow_action *acts, u8 acts_cnt, u64 *entry_h) { - struct ice_flow_prof *prof = NULL; struct ice_flow_entry *e = NULL; + struct ice_flow_prof *prof; enum ice_status status = ICE_SUCCESS; /* ACL entries must indicate an action */ -- 2.13.6