From: Leyi Rong Date: Wed, 19 Jun 2019 15:18:26 +0000 (+0800) Subject: net/ice/base: cleanup unused code X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=42fde0faf94e690b2163df080d525dd2ed30c633;p=dpdk.git net/ice/base: cleanup unused code Cleanup the useless code. Signed-off-by: Paul M Stillwell Jr Signed-off-by: Leyi Rong Acked-by: Qi Zhang --- diff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c index 4cb6df1133..3ef07e0943 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 2ecb147f12..8490fac614 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 c1cd68c53b..14d7bbc7e6 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -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); @@ -4479,6 +4479,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 a72e72982b..fa3158a7b1 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 5994846c0f..58a4829c85 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 05b1170c98..b788aa7ec2 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 8f7a2c1f9f..ea587a0f0d 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -22,13 +22,9 @@ #define ICE_BYTES_PER_DWORD 4 #define ICE_MAX_TRAFFIC_CLASS 8 -#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" @@ -45,9 +41,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) { @@ -192,9 +186,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, }; @@ -914,9 +905,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 {