From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE7FC4404F; Wed, 12 Jun 2024 17:13:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A68A42DA1; Wed, 12 Jun 2024 17:05:06 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 531BE42D87 for ; Wed, 12 Jun 2024 17:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204704; x=1749740704; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3d1k603kChEcruhcx6dZRTg2+KVwsauvv5ohATk9FpY=; b=LNoEfuE7Dbcu8CApHgSsi5mVCkTlfd56SZ74FJbDRMZudGFIhVLZf7Ji cYpv35i6UqLBW02Hm+n1uLLAPAUrPSEDfNyNgUPgmfFguYrZXTXnf4mQX BaZ9Sdi0V4nRqjLUx5HMRewda6J4YwkIf98mlBht2uBOmWjmbQgoi07Ep e+F0HMrctIaEPLS1kI8UnXZry+rAM96C7v2ci9S7UWx9SBP01Fsmft3P1 o1TbJNydf62P8Qg4U+cyPweFRl4123yWecQqXATlTh8jjty4vhl4sYdKk BjK6POFbyM+LJnA+xN+SRBanyxTDSmyG0s1Vq9YqkhuS5R5ascqGSi0vS g==; X-CSE-ConnectionGUID: y3XkUOWcQlalLklsnF7FpA== X-CSE-MsgGUID: rhieEq1xQtaI0P0Vdm3HHQ== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32459535" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32459535" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:04:44 -0700 X-CSE-ConnectionGUID: GfZ4QkmZQd6zJCfR2wW8kg== X-CSE-MsgGUID: NmLebS/kQZqk7D2Jpjbflw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39925343" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:04:43 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Ian Stokes , bruce.richardson@intel.com, Chinh Cao Subject: [PATCH v2 054/148] net/ice/base: correct the return type of ice_bitmap_hweight Date: Wed, 12 Jun 2024 16:00:48 +0100 Message-ID: <335a13e1f2ab09f3970b231acfa55aeb78980dd7.1718204528.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Ian Stokes "count" is the returned value, and in this function, value of "count" and "bit" are the same, so there is no reason why these values should be declared as different types, and for returned value data type to be different. Signed-off-by: Chinh Cao Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_bitops.h | 4 ++-- drivers/net/ice/base/ice_switch.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/base/ice_bitops.h b/drivers/net/ice/base/ice_bitops.h index 3b71c1b7f5..5c17bcb674 100644 --- a/drivers/net/ice/base/ice_bitops.h +++ b/drivers/net/ice/base/ice_bitops.h @@ -418,10 +418,10 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits) * Note that this function assumes it is operating on a bitmap declared using * ice_declare_bitmap. */ -static inline int +static inline u16 ice_bitmap_hweight(ice_bitmap_t *bm, u16 size) { - int count = 0; + u16 count = 0; u16 bit = 0; while (size > (bit = ice_find_next_bit(bm, size, bit))) { diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index fc9a690b6f..e49b86e009 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -3919,7 +3919,7 @@ static void ice_subscribable_recp_shared(struct ice_hw *hw, u16 rid) { ice_declare_bitmap(sub_bitmap, ICE_MAX_NUM_RECIPES); struct ice_sw_recipe *recps; - u8 i, cnt; + u16 i, cnt; recps = hw->switch_info->recp_list; ice_cp_bitmap(sub_bitmap, recps[rid].r_bitmap, ICE_MAX_NUM_RECIPES); @@ -3944,8 +3944,9 @@ static enum ice_status ice_release_recipe_res(struct ice_hw *hw, { ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES); struct ice_switch_info *sw = hw->switch_info; - u8 num_recp, rid, num_prof, prof, i, j; enum ice_status status = ICE_SUCCESS; + u16 num_recp, num_prof; + u8 rid, prof, i, j; num_recp = ice_bitmap_hweight(recp->r_bitmap, ICE_MAX_NUM_RECIPES); for (i = 0; i < num_recp; i++) { @@ -7657,7 +7658,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles, ice_xor_bitmap(free_idx, used_idx, possible_idx, ICE_MAX_FV_WORDS); /* return number of free indexes */ - return (u16)ice_bitmap_hweight(free_idx, ICE_MAX_FV_WORDS); + return ice_bitmap_hweight(free_idx, ICE_MAX_FV_WORDS); } static void ice_set_recipe_index(unsigned long idx, u8 *bitmap) @@ -8377,9 +8378,10 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, struct ice_recp_grp_entry *r_tmp; struct ice_sw_fv_list_entry *tmp; struct ice_sw_recipe *rm; - u8 i, cnt, rid_tmp; + u8 i, rid_tmp; bool is_add = true; int status = ICE_SUCCESS; + u16 cnt; if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt) return ICE_ERR_PARAM; -- 2.43.0