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 CB15F454EF; Tue, 25 Jun 2024 13:20:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92E3D42EA6; Tue, 25 Jun 2024 13:17:14 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 9802B42E24 for ; Tue, 25 Jun 2024 13:16:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314169; x=1750850169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TQ9MBLNR54FDeG+WbxvvmTE/aHm1nvajfL8Sz9NxqmI=; b=dfat6L2+U0F8yS5vpK+7Qk9+pHsIGIcQ7OCnRilGnLHeSTbuDEzbOhWM yVMOaFPKdRfU7MXwXEHvhmxB00uGiZJqASuPuqHs/jff3THt7IpkmKQ6x UtmQx9NyTEbpqbQWlmaZYmDdP9CTLSmaaLaOz2XgAVOm2KWfllcbKfkVU sQm80x7euyNYqCcBXL5LlDWAKx2sXbE8i9sOiA+1IabN1VXaEndYmo0GJ +AroQYrkMY/vs4ti4bSnFqw5QRLkgich9TBFhdD0bBP/JnM7TLVKCMNUB U4tnpb10znBY3MU/gu0QBHo3cYr86tFC090tcD8OmCSqkvEHQi59MdSru w==; X-CSE-ConnectionGUID: +eSl/6ucTJ6fNm1ivAEtug== X-CSE-MsgGUID: IdVtB2PLT/60HHmTi2LNAA== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080190" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080190" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 04:16:09 -0700 X-CSE-ConnectionGUID: rEnMOcVCTjmZe/rfzC7X8A== X-CSE-MsgGUID: mOYqigjeRFSuWTZYcIwwog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719171" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:16:08 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Chinh Cao , bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 043/129] net/ice/base: correct the return type of ice_bitmap_hweight Date: Tue, 25 Jun 2024 12:12:48 +0100 Message-ID: <2deb9b48dc166babe34f623165f1a0eeefc0b32b.1719313663.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: 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: Chinh Cao "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 | 3 ++- 2 files changed, 4 insertions(+), 3 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 7e6245bd51..2b4be6d115 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -7464,7 +7464,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) @@ -8175,6 +8175,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, struct ice_sw_recipe *rm; u8 i; int status = ICE_SUCCESS; + u16 cnt; if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt) return ICE_ERR_PARAM; -- 2.43.0