From patchwork Tue Jun 11 15:52:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leyi Rong X-Patchwork-Id: 54708 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE4181C5D4; Tue, 11 Jun 2019 17:55:26 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id DFA311C231 for ; Tue, 11 Jun 2019 17:54:38 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2019 08:54:38 -0700 X-ExtLoop1: 1 Received: from lrong-srv-03.sh.intel.com ([10.67.119.177]) by orsmga001.jf.intel.com with ESMTP; 11 Jun 2019 08:54:37 -0700 From: Leyi Rong To: qi.z.zhang@intel.com Cc: dev@dpdk.org, Leyi Rong , Paul M Stillwell Jr Date: Tue, 11 Jun 2019 23:52:04 +0800 Message-Id: <20190611155221.2703-50-leyi.rong@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190611155221.2703-1-leyi.rong@intel.com> References: <20190604054248.68510-1-leyi.rong@intel.com> <20190611155221.2703-1-leyi.rong@intel.com> Subject: [dpdk-dev] [PATCH v2 49/66] net/ice/base: code clean up 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 the useless code. Signed-off-by: Paul M Stillwell Jr Signed-off-by: Leyi Rong --- drivers/net/ice/base/ice_controlq.c | 62 +--------------------------- drivers/net/ice/base/ice_fdir.h | 4 -- drivers/net/ice/base/ice_flex_pipe.c | 7 ++-- drivers/net/ice/base/ice_sched.c | 4 +- drivers/net/ice/base/ice_switch.c | 8 ---- drivers/net/ice/base/ice_switch.h | 2 - drivers/net/ice/base/ice_type.h | 22 ++-------- 7 files changed, 11 insertions(+), 98 deletions(-) diff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c index 4cb6df113..3ef07e094 100644 --- a/drivers/net/ice/base/ice_controlq.c +++ b/drivers/net/ice/base/ice_controlq.c @@ -262,7 +262,7 @@ ice_cfg_sq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq) * @hw: pointer to the hardware structure * @cq: pointer to the specific Control queue * - * Configure base address and length registers for the receive (event q) + * Configure base address and length registers for the receive (event queue) */ static enum ice_status ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq) @@ -772,9 +772,6 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) struct ice_ctl_q_ring *sq = &cq->sq; u16 ntc = sq->next_to_clean; struct ice_sq_cd *details; -#if 0 - struct ice_aq_desc desc_cb; -#endif struct ice_aq_desc *desc; desc = ICE_CTL_Q_DESC(*sq, ntc); @@ -783,15 +780,6 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) while (rd32(hw, cq->sq.head) != ntc) { ice_debug(hw, ICE_DBG_AQ_MSG, "ntc %d head %d.\n", ntc, rd32(hw, cq->sq.head)); -#if 0 - if (details->callback) { - ICE_CTL_Q_CALLBACK cb_func = - (ICE_CTL_Q_CALLBACK)details->callback; - ice_memcpy(&desc_cb, desc, sizeof(desc_cb), - ICE_DMA_TO_DMA); - cb_func(hw, &desc_cb); - } -#endif ice_memset(desc, 0, sizeof(*desc), ICE_DMA_MEM); ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM); ntc++; @@ -941,38 +929,8 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq, details = ICE_CTL_Q_DETAILS(cq->sq, cq->sq.next_to_use); if (cd) *details = *cd; -#if 0 - /* FIXME: if/when this block gets enabled (when the #if 0 - * is removed), add braces to both branches of the surrounding - * conditional expression. The braces have been removed to - * prevent checkpatch complaining. - */ - - /* If the command details are defined copy the cookie. The - * CPU_TO_LE32 is not needed here because the data is ignored - * by the FW, only used by the driver - */ - if (details->cookie) { - desc->cookie_high = - CPU_TO_LE32(ICE_HI_DWORD(details->cookie)); - desc->cookie_low = - CPU_TO_LE32(ICE_LO_DWORD(details->cookie)); - } -#endif else ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM); -#if 0 - /* clear requested flags and then set additional flags if defined */ - desc->flags &= ~CPU_TO_LE16(details->flags_dis); - desc->flags |= CPU_TO_LE16(details->flags_ena); - - if (details->postpone && !details->async) { - ice_debug(hw, ICE_DBG_AQ_MSG, - "Async flag not set along with postpone flag\n"); - status = ICE_ERR_PARAM; - goto sq_send_command_error; - } -#endif /* Call clean and check queue available function to reclaim the * descriptors that were processed by FW/MBX; the function returns the @@ -1019,20 +977,8 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq, (cq->sq.next_to_use)++; if (cq->sq.next_to_use == cq->sq.count) cq->sq.next_to_use = 0; -#if 0 - /* FIXME - handle this case? */ - if (!details->postpone) -#endif wr32(hw, cq->sq.tail, cq->sq.next_to_use); -#if 0 - /* if command details are not defined or async flag is not set, - * we need to wait for desc write back - */ - if (!details->async && !details->postpone) { - /* FIXME - handle this case? */ - } -#endif do { if (ice_sq_done(hw, cq)) break; @@ -1087,9 +1033,6 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq, /* update the error if time out occurred */ if (!cmd_completed) { -#if 0 - (!details->async && !details->postpone)) { -#endif ice_debug(hw, ICE_DBG_AQ_MSG, "Control Send Queue Writeback timeout.\n"); status = ICE_ERR_AQ_TIMEOUT; @@ -1208,9 +1151,6 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq, cq->rq.next_to_clean = ntc; cq->rq.next_to_use = ntu; -#if 0 - ice_nvmupd_check_wait_event(hw, LE16_TO_CPU(e->desc.opcode)); -#endif clean_rq_elem_out: /* Set pending if needed, unlock and return */ if (pending) { diff --git a/drivers/net/ice/base/ice_fdir.h b/drivers/net/ice/base/ice_fdir.h index 2ecb147f1..8490fac61 100644 --- a/drivers/net/ice/base/ice_fdir.h +++ b/drivers/net/ice/base/ice_fdir.h @@ -163,9 +163,6 @@ struct ice_fdir_fltr { /* filter control */ u16 q_index; -#ifdef ADQ_SUPPORT - u16 orig_q_index; -#endif /* ADQ_SUPPORT */ u16 dest_vsi; u8 dest_ctl; u8 fltr_status; @@ -173,7 +170,6 @@ struct ice_fdir_fltr { u32 fltr_id; }; - /* Dummy packet filter definition structure. */ struct ice_fdir_base_pkt { enum ice_fltr_ptype flow; diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index fdc9eb6eb..8f19b9fef 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -398,7 +398,7 @@ ice_find_boost_entry(struct ice_seg *ice_seg, u16 addr, * Handles enumeration of individual label entries. */ static void * -ice_label_enum_handler(u32 __always_unused sect_type, void *section, u32 index, +ice_label_enum_handler(u32 __ALWAYS_UNUSED sect_type, void *section, u32 index, u32 *offset) { struct ice_label_section *labels; @@ -640,7 +640,7 @@ static bool ice_bits_max_set(const u8 *mask, u16 size, u16 max) * @size: the size of the complete key in bytes (must be even) * @val: array of 8-bit values that makes up the value portion of the key * @upd: array of 8-bit masks that determine what key portion to update - * @dc: array of 8-bit masks that make up the dont' care mask + * @dc: array of 8-bit masks that make up the don't care mask * @nm: array of 8-bit masks that make up the never match mask * @off: the offset of the first byte in the key to update * @len: the number of bytes in the key update @@ -897,7 +897,7 @@ ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type, u32 i; ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); - ice_debug(hw, ICE_DBG_PKG, "Package version: %d.%d.%d.%d\n", + ice_debug(hw, ICE_DBG_PKG, "Package format version: %d.%d.%d.%d\n", pkg_hdr->format_ver.major, pkg_hdr->format_ver.minor, pkg_hdr->format_ver.update, pkg_hdr->format_ver.draft); @@ -4544,6 +4544,7 @@ ice_move_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig, status = ice_vsig_find_vsi(hw, blk, vsi, &orig_vsig); if (!status) status = ice_vsig_add_mv_vsi(hw, blk, vsi, vsig); + if (status) { ice_free(hw, p); return status; diff --git a/drivers/net/ice/base/ice_sched.c b/drivers/net/ice/base/ice_sched.c index a72e72982..fa3158a7b 100644 --- a/drivers/net/ice/base/ice_sched.c +++ b/drivers/net/ice/base/ice_sched.c @@ -1233,7 +1233,7 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi) goto err_init_port; } - /* If the last node is a leaf node then the index of the Q group + /* If the last node is a leaf node then the index of the queue group * layer is two less than the number of elements. */ if (num_elems > 2 && buf[0].generic[num_elems - 1].data.elem_type == @@ -3529,9 +3529,11 @@ ice_cfg_agg_vsi_priority_per_tc(struct ice_port_info *pi, u32 agg_id, LIST_FOR_EACH_ENTRY(agg_vsi_info, &agg_info->agg_vsi_list, ice_sched_agg_vsi_info, list_entry) if (agg_vsi_info->vsi_handle == vsi_handle) { + /* cppcheck-suppress unreadVariable */ vsi_handle_valid = true; break; } + if (!vsi_handle_valid) goto exit_agg_priority_per_tc; diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 373acb7a6..c7fcd71a7 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -2934,7 +2934,6 @@ ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) return ICE_SUCCESS; } -#ifndef NO_MACVLAN_SUPPORT /** * ice_add_mac_vlan - Add MAC and VLAN pair based filter rule * @hw: pointer to the hardware structure @@ -2969,7 +2968,6 @@ ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list) } return ICE_SUCCESS; } -#endif /** * ice_add_eth_mac - Add ethertype and MAC based filter rule @@ -3307,7 +3305,6 @@ ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) return ICE_SUCCESS; } -#ifndef NO_MACVLAN_SUPPORT /** * ice_remove_mac_vlan - Remove MAC VLAN based filter rule * @hw: pointer to the hardware structure @@ -3335,7 +3332,6 @@ ice_remove_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) } return ICE_SUCCESS; } -#endif /* !NO_MACVLAN_SUPPORT */ /** * ice_vsi_uses_fltr - Determine if given VSI uses specified filter @@ -3850,11 +3846,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, ice_remove_promisc(hw, lkup, &remove_list_head); break; case ICE_SW_LKUP_MAC_VLAN: -#ifndef NO_MACVLAN_SUPPORT ice_remove_mac_vlan(hw, &remove_list_head); -#else - ice_debug(hw, ICE_DBG_SW, "MAC VLAN look up is not supported yet\n"); -#endif /* !NO_MACVLAN_SUPPORT */ break; case ICE_SW_LKUP_ETHERTYPE: case ICE_SW_LKUP_ETHERTYPE_MAC: diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index 05b1170c9..b788aa7ec 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -373,12 +373,10 @@ enum ice_status ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list); enum ice_status ice_remove_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list); -#ifndef NO_MACVLAN_SUPPORT enum ice_status ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list); enum ice_status ice_remove_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list); -#endif /* !NO_MACVLAN_SUPPORT */ enum ice_status ice_add_mac_with_sw_marker(struct ice_hw *hw, struct ice_fltr_info *f_info, diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index f4e151c55..8de5cc097 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -22,7 +22,6 @@ #define ICE_BYTES_PER_DWORD 4 #define ICE_MAX_TRAFFIC_CLASS 8 -#ifndef ROUND_UP /** * ROUND_UP - round up to next arbitrary multiple (not a power of 2) * @a: value to round up @@ -32,15 +31,10 @@ * Note, when b is a power of 2 use ICE_ALIGN() instead. */ #define ROUND_UP(a, b) ((b) * DIVIDE_AND_ROUND_UP((a), (b))) -#endif -#ifndef MIN_T #define MIN_T(_t, _a, _b) min((_t)(_a), (_t)(_b)) -#endif -#ifndef IS_ASCII #define IS_ASCII(_ch) ((_ch) < 0x80) -#endif #include "ice_status.h" #include "ice_hw_autogen.h" @@ -57,9 +51,7 @@ static inline bool ice_is_tc_ena(ice_bitmap_t bitmap, u8 tc) return ice_is_bit_set(&bitmap, tc); } -#ifndef DIV_64BIT #define DIV_64BIT(n, d) ((n) / (d)) -#endif /* DIV_64BIT */ static inline u64 round_up_64bit(u64 a, u32 b) { @@ -114,6 +106,9 @@ static inline u32 ice_round_to_num(u32 N, u32 R) #define ICE_DBG_USER BIT_ULL(31) #define ICE_DBG_ALL 0xFFFFFFFFFFFFFFFFULL +#ifndef __ALWAYS_UNUSED +#define __ALWAYS_UNUSED +#endif @@ -201,9 +196,6 @@ enum ice_media_type { enum ice_vsi_type { ICE_VSI_PF = 0, ICE_VSI_CTRL = 3, /* equates to ICE_VSI_PF with 1 queue pair */ -#ifdef ADQ_SUPPORT - ICE_VSI_CHNL = 4, -#endif /* ADQ_SUPPORT */ ICE_VSI_LB = 6, }; @@ -279,13 +271,8 @@ enum ice_fltr_ptype { ICE_FLTR_PTYPE_MAX, }; -#ifndef ADQ_SUPPORT /* 2 VSI = 1 ICE_VSI_PF + 1 ICE_VSI_CTRL */ #define ICE_MAX_FDIR_VSI_PER_FILTER 2 -#else -/* 1 ICE_VSI_PF + 1 ICE_VSI_CTRL + ICE_MAX_TRAFFIC_CLASS */ -#define ICE_MAX_FDIR_VSI_PER_FILTER (2 + ICE_MAX_TRAFFIC_CLASS) -#endif /* !ADQ_SUPPORT */ struct ice_fd_hw_prof { struct ice_flow_seg_info *fdir_seg; @@ -930,9 +917,6 @@ struct ice_hw_port_stats { /* flow director stats */ u32 fd_sb_status; u64 fd_sb_match; -#ifdef ADQ_SUPPORT - u64 ch_atr_match; -#endif /* ADQ_SUPPORT */ }; enum ice_sw_fwd_act_type {