From patchwork Tue May 10 15:47:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12845197 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C397EC433FE for ; Tue, 10 May 2022 15:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346351AbiEJPww (ORCPT ); Tue, 10 May 2022 11:52:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347238AbiEJPwI (ORCPT ); Tue, 10 May 2022 11:52:08 -0400 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE8501A81A; Tue, 10 May 2022 08:47:59 -0700 (PDT) Received: by mail-qt1-x82e.google.com with SMTP id hf18so13860148qtb.0; Tue, 10 May 2022 08:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8XwVIoqaEjrb3iMSCaJMjNScsN/uhpRfrQ8NarzetBA=; b=TRtRj0OV5KH470cMHDPWUxl3cSGx95ngPsN0DC93pj0q8lGKr6CIDI7KqIjvYte1Hq DqQZeHliFkhzx++RKygoPz5nE4Aqk2UIQzgMw/6D7YlBFtqCr1XJQeY0aXrD7Z3I7zL8 vdYXHH5j0T9lwr4UaICLcWXUHX0ik0X+sJnHHfGa8ofweq10xOcV5vZi7VReLlWYtqqn nHzBpLgUII9FKyjiNIqU9JJdGkKXpJ8qxoycCK70hC8aBK07eSXmnxo2CnbJXB+wPmRf eG+ftCF5WaKR0/SbaXZWXn93wkpkW1VusQ4Xh9LxdA3A1hrUIpyXsC+T7vM12H0qF72o ZkGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8XwVIoqaEjrb3iMSCaJMjNScsN/uhpRfrQ8NarzetBA=; b=YttMwB8O6ncQnx11oCNG/1q2sfqdNlXA9Dr7W8V5gnSwyoVwYv/UTG1qi5m1p2Jzry urcXOzFtut1WnmVPNCU+elgC2WlEFqSTaOcaiMjHxv6v/DVfTrOi8Mhkm4zUy4llY9T/ oGPg8zSoy2NsvpDmM3SbmjiyceAW9RIB43TdbmtbRR6hpdRp2LZ0Y/ZpACTgqGPZzDcX 1aVmCNyrigv2AvgpacenE/Vb9Xyp/6mui3BvUU5RuYDq6e+4AdtD41FqoEU8v/jo6VCb /ckD70zNhU0NUnhF/w9qgiuNf4ZHN+LDGrfxy+A9CIvSeTcrXfmv3ygmhs/8dGddmt05 CnAQ== X-Gm-Message-State: AOAM533FC8mRzanlHpvbT+ujwA1IDP90Oa6GMAnXlCPWUAq2Hp8Zqo+t Q3t+1X/EE57ZDQz0+44dqmA= X-Google-Smtp-Source: ABdhPJx1lvQ2cAFBLJUoEVeXgxIKrxcn5z7aIGeJaHLVOgtu8J7l1okT1ZHyyT7jgo7gM8c1D/jlvA== X-Received: by 2002:ac8:58ca:0:b0:2f3:da32:ab1 with SMTP id u10-20020ac858ca000000b002f3da320ab1mr10163209qta.308.1652197678887; Tue, 10 May 2022 08:47:58 -0700 (PDT) Received: from localhost ([98.242.65.84]) by smtp.gmail.com with ESMTPSA id a123-20020ae9e881000000b0069fc13ce227sm8659793qkg.88.2022.05.10.08.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:47:58 -0700 (PDT) From: Yury Norov To: Andy Shevchenko , David Laight , Greg Kroah-Hartman , Joe Perches , Julia Lawall , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Nicholas Piggin , Nicolas Palix , Peter Zijlstra , Rasmus Villemoes , Matti Vaittinen , linux-kernel@vger.kernel.org Cc: Yury Norov , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Jesse Brandeburg , Paolo Abeni , Tony Nguyen , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH 04/22] ice: use bitmap_empty() in ice_vf_has_no_qs_ena() Date: Tue, 10 May 2022 08:47:32 -0700 Message-Id: <20220510154750.212913-5-yury.norov@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220510154750.212913-1-yury.norov@gmail.com> References: <20220510154750.212913-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org bitmap_empty() is better than bitmap_weight() because it may return earlier, and improves on readability. CC: David S. Miller CC: Eric Dumazet CC: Jakub Kicinski CC: Jesse Brandeburg CC: Paolo Abeni CC: Tony Nguyen CC: intel-wired-lan@lists.osuosl.org CC: netdev@vger.kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Yury Norov --- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c index 6578059d9479..de67ac4075f0 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -740,8 +740,8 @@ bool ice_is_vf_trusted(struct ice_vf *vf) */ bool ice_vf_has_no_qs_ena(struct ice_vf *vf) { - return (!bitmap_weight(vf->rxq_ena, ICE_MAX_RSS_QS_PER_VF) && - !bitmap_weight(vf->txq_ena, ICE_MAX_RSS_QS_PER_VF)); + return bitmap_empty(vf->rxq_ena, ICE_MAX_RSS_QS_PER_VF) && + bitmap_empty(vf->txq_ena, ICE_MAX_RSS_QS_PER_VF); } /** From patchwork Tue May 10 15:47:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12845195 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89F45C4332F for ; Tue, 10 May 2022 15:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346626AbiEJPwr (ORCPT ); Tue, 10 May 2022 11:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347244AbiEJPwI (ORCPT ); Tue, 10 May 2022 11:52:08 -0400 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58F8F1C924; Tue, 10 May 2022 08:48:02 -0700 (PDT) Received: by mail-qt1-x82a.google.com with SMTP id x22so13822868qto.2; Tue, 10 May 2022 08:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4h/3sgiwZZAh9sVqTF8TpILnTbNrmnSNrow0mo4Rdcc=; b=nJkTTrZSgx/CxVZqlMx3R99vSMQL//nFGa0hZ07IqiBvDSeqXSh9woBb7OJS56Cgai 0Eczz7GiCbLotCzZ0RoAwk+04UmWVPqefXwHcWCtVHfsoYKir1gUkz5PcvJDzZPWYQ75 URMLPjFUroRtaY2wPU9e49KSkKK2clyA5OTfTPRmfC3LA7D5bBVwUwv6tWChLYpP5q4b YliYKg8zx9K6d2Adk173DWMSF7K6ESmJdunxWxXgdW2HhDVTAcgzgFAfINNDUzoIKXXd lGkUlRAVou6efYVNj35qLHlyuwca4XCM01AFtngv6grLtyX/iW52ydqcsC8bm+QKi7Sq 0urg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4h/3sgiwZZAh9sVqTF8TpILnTbNrmnSNrow0mo4Rdcc=; b=l83P71Whvn/JgaMEcnYfNYMxDEL50qE+Ys7rvvh6UwpxG2Y15Kb7h/avTwFhJCgK1F 9G1Ca7F9hx1UxAWw6h7donXrCuSDMkJVY4oTVWXMuS06jTQRTSiy9NDQ4KBS9Wpx+feU YouAqp2KnjF7UF4MUExJrkpHTPFI/Wc/RDuBBJmSj8STIfzvDfFtPjxv4ysPB3+F/dVZ Z1JfGC4eTTqtAqwZNfJUl9TL5y52LQ8Wyo/3ob8fQ/39r+mh7CIM1xgnPhD9kC6vi+lK 5WIyvzMLPavR1/Jz+qYbv+wsn3TnHSHw6BSuJLXZmtmK2WfxU/S+zgzA7z3/jkQX7a/Y ySPQ== X-Gm-Message-State: AOAM533UUWEg41uKTc9TDCnzHCEHzi4+u1tNgpa7cpEv8nx+OPsxHqj2 dmlZ+rsUCEupG206X8vIjvg= X-Google-Smtp-Source: ABdhPJyRxWRJRs5edGWoSur4H0QL70ANK42gtong6CQMuKkJqvRPmtDL3Ea8w/9GEy/oZ2btzNbyrw== X-Received: by 2002:ac8:5ad4:0:b0:2f3:e0fb:df1c with SMTP id d20-20020ac85ad4000000b002f3e0fbdf1cmr6254624qtd.267.1652197681464; Tue, 10 May 2022 08:48:01 -0700 (PDT) Received: from localhost ([98.242.65.84]) by smtp.gmail.com with ESMTPSA id o2-20020ac841c2000000b002f39b99f691sm9288209qtm.43.2022.05.10.08.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:48:01 -0700 (PDT) From: Yury Norov To: Andy Shevchenko , David Laight , Greg Kroah-Hartman , Joe Perches , Julia Lawall , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Nicholas Piggin , Nicolas Palix , Peter Zijlstra , Rasmus Villemoes , Matti Vaittinen , linux-kernel@vger.kernel.org Cc: Yury Norov , "David S . Miller" , Eric Dumazet , Geetha sowjanya , Jakub Kicinski , Jerin Jacob , Linu Cherian , Paolo Abeni , Subbaraya Sundeep , Sunil Goutham , hariprasad , netdev@vger.kernel.org Subject: [PATCH 06/22] octeontx2: use bitmap_empty() instead of bitmap_weight() Date: Tue, 10 May 2022 08:47:34 -0700 Message-Id: <20220510154750.212913-7-yury.norov@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220510154750.212913-1-yury.norov@gmail.com> References: <20220510154750.212913-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org bitmap_empty() is better than bitmap_weight() because it may return earlier, and improves on readability. CC: David S. Miller CC: Eric Dumazet CC: Geetha sowjanya CC: Jakub Kicinski CC: Jerin Jacob CC: Linu Cherian CC: Paolo Abeni CC: Subbaraya Sundeep CC: Sunil Goutham CC: hariprasad CC: netdev@vger.kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Yury Norov --- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 6 +++--- drivers/net/ethernet/marvell/octeontx2/af/rpm.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c index 25491edc35ce..921bf9cb707b 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c @@ -615,7 +615,7 @@ void cgx_lmac_enadis_rx_pause_fwding(void *cgxd, int lmac_id, bool enable) return; /* Pause frames are not enabled just return */ - if (!bitmap_weight(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) + if (bitmap_empty(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) return; cgx_lmac_get_pause_frm_status(cgx, lmac_id, &rx_pause, &tx_pause); @@ -870,13 +870,13 @@ int verify_lmac_fc_cfg(void *cgxd, int lmac_id, u8 tx_pause, u8 rx_pause, set_bit(pfvf_idx, lmac->tx_fc_pfvf_bmap.bmap); /* check if other pfvfs are using flow control */ - if (!rx_pause && bitmap_weight(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) { + if (!rx_pause && !bitmap_empty(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) { dev_warn(&cgx->pdev->dev, "Receive Flow control disable not permitted as its used by other PFVFs\n"); return -EPERM; } - if (!tx_pause && bitmap_weight(lmac->tx_fc_pfvf_bmap.bmap, lmac->tx_fc_pfvf_bmap.max)) { + if (!tx_pause && !bitmap_empty(lmac->tx_fc_pfvf_bmap.bmap, lmac->tx_fc_pfvf_bmap.max)) { dev_warn(&cgx->pdev->dev, "Transmit Flow control disable not permitted as its used by other PFVFs\n"); return -EPERM; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c index 47e83d7a5804..f2c866825c81 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c @@ -109,7 +109,7 @@ void rpm_lmac_enadis_rx_pause_fwding(void *rpmd, int lmac_id, bool enable) return; /* Pause frames are not enabled just return */ - if (!bitmap_weight(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) + if (bitmap_empty(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) return; if (enable) { From patchwork Tue May 10 15:47:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12845196 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83396C433EF for ; Tue, 10 May 2022 15:48:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346640AbiEJPwu (ORCPT ); Tue, 10 May 2022 11:52:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347246AbiEJPwI (ORCPT ); Tue, 10 May 2022 11:52:08 -0400 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9826023BC2; Tue, 10 May 2022 08:48:07 -0700 (PDT) Received: by mail-qt1-x82a.google.com with SMTP id t16so13810793qtr.9; Tue, 10 May 2022 08:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YUVX9pehnKFP2HbXOeJRXPON1pdMSinpND4hyUbpd7Y=; b=H7DHmga0YfNQOKRmyc5R1n9BtsfW36I+EeUo8Gn6tKIkX1sawCN5POYUm1ggf0QLIg y/zdQlOHPeAwSHVXraw2VC92qXm5io24/bWkUg1a+EOWnAFbhyWGy2MQNYq+voI38Af5 qZJGZMvd3wnnjh0CIvbujrGVLSjzEHi3dj/FKGGyEv7SNcwK08++bVPBiKSAfTxpILXC 10JenjZtFA2cuFkeXEq6/NVYLvBCGiFr8H5wwG5j8N/vk8f+kI2EV3ewRffC9eLq8o0I GfiUAU89D1PkvS/jYqGf1K163yTaUsGnqaXBK9LMC0TVultHBleCIej+qbQMbyD9ZLTL 8dXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YUVX9pehnKFP2HbXOeJRXPON1pdMSinpND4hyUbpd7Y=; b=Zn9ZO58XyJSLgt5sYc+kG8EU98WgEthfog6UBymmWTpVU2faebwW3aqZlNaW7MqQMr 6pcA0rMcAbjj5rcYGuI9KN+gHl5qJIPIG+m8gdx6D3Mn+p2RxTOA7bGCm8ZGXh3pBd1b VIwO3V0tSY140eeBt1mfk6aqYzxDvJGoQTXP+JKlGEYGINweLKmlUnHYTWGsyFwmhO8b Q1/XvmosCG2+5aDYPmSVR4VUUewxR7562AA9pqG00SGqo+1uC6tjUe5UI269HfP5CfxF GoFCuCjJ0hGnTAUZC2hDpXJGB5skLU33mQnZghBM9Rth7OLmx1d4Rz6nAJLCj5E8MXeR kr6g== X-Gm-Message-State: AOAM531FLpIT6bkKpy4xul547kLOB5vg5oG431ZKMKbHqApPCvet5q10 eCqcJ2Cq244Rt/9PX6Fu/RE= X-Google-Smtp-Source: ABdhPJxaFgINLYqbZDb9FJmk7RM9HPgCJquH2MWeHN9oyrPrIpTHIjpThvrKU8Y1hJ9jOgwtocfAUQ== X-Received: by 2002:a05:622a:141:b0:2f3:c7be:3f53 with SMTP id v1-20020a05622a014100b002f3c7be3f53mr19486120qtw.539.1652197685469; Tue, 10 May 2022 08:48:05 -0700 (PDT) Received: from localhost ([98.242.65.84]) by smtp.gmail.com with ESMTPSA id w2-20020a379402000000b0069fc13ce250sm9044681qkd.129.2022.05.10.08.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:48:05 -0700 (PDT) From: Yury Norov To: Andy Shevchenko , David Laight , Greg Kroah-Hartman , Joe Perches , Julia Lawall , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Nicholas Piggin , Nicolas Palix , Peter Zijlstra , Rasmus Villemoes , Matti Vaittinen , linux-kernel@vger.kernel.org Cc: Yury Norov , Ariel Elior , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Manish Chopra , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH 09/22] qed: replace bitmap_weight() with MANY_BITS() Date: Tue, 10 May 2022 08:47:37 -0700 Message-Id: <20220510154750.212913-10-yury.norov@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220510154750.212913-1-yury.norov@gmail.com> References: <20220510154750.212913-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org qed_init_qm_get_idx_from_flags() uses bitmap_weight() to check if number of bits in pq_flags is greater than 1. It's a bad practice to use bitmap API for things like flags, because flags are not bitmaps (and it's bloating and potentially not safe - for example if flags are not declared as unsigned long). In this case, MANY_BITS() fits better than bitmap_weight(), and switching to MANY_BITS() silences scripts/coccinelle/api/bitmap.cocci. CC: Ariel Elior CC: David S. Miller CC: Eric Dumazet CC: Jakub Kicinski CC: Manish Chopra CC: Paolo Abeni CC: netdev@vger.kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Yury Norov --- drivers/net/ethernet/qlogic/qed/qed_dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c index 672480c9d195..fbe69e538f53 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c @@ -1702,8 +1702,7 @@ static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, struct qed_qm_info *qm_info = &p_hwfn->qm_info; /* Can't have multiple flags set here */ - if (bitmap_weight(&pq_flags, - sizeof(pq_flags) * BITS_PER_BYTE) > 1) { + if (MANY_BITS(pq_flags)) { DP_ERR(p_hwfn, "requested multiple pq flags 0x%lx\n", pq_flags); goto err; } From patchwork Tue May 10 15:47:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12845194 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3C36C433EF for ; Tue, 10 May 2022 15:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346619AbiEJPwo (ORCPT ); Tue, 10 May 2022 11:52:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347250AbiEJPwI (ORCPT ); Tue, 10 May 2022 11:52:08 -0400 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D6FE24595; Tue, 10 May 2022 08:48:09 -0700 (PDT) Received: by mail-qt1-x830.google.com with SMTP id y3so13831177qtn.8; Tue, 10 May 2022 08:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YR9pn4jX9oEu9ZPj21v5YqSNSABltP6KazwK0dihI+g=; b=b+d37BcnOOtc833JitSGOc7x3f2L3AE7Nf10xKLmhD4GjDgpUtUBGSvKNjCXlWoFqv 6YzrP02ahLFBG32O0Ws+15xbHp+dOeXdYG4mz3m054dW6mc4c722EwbQ9AzX+mLaIQv4 ESgLOi0yiR8EipW8HUqp/tAQoath61KrpL7EIRFe5NTmTAK+1Wzc8MkJakAmihyXNKk5 JQYymdcaGhZgnIVlvXS6OESpD7BDWVMQKKwcNHxjWTXNIQ5ryfnwS9lOEAZIo6T+A9Gz ivAvlL2bGWw2ECqmb0qWK6tD/Dbpw/VQMsOwfpB+0Bvitw4WH0kczgxf39JrhdgbNJbK YL4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YR9pn4jX9oEu9ZPj21v5YqSNSABltP6KazwK0dihI+g=; b=tzOHQMEfD0xji+InY5WoyEFQgqewNXy9B4MV+MjS8OeAgnry3O8zqzmSJHDWHReZx4 CUmsMWv8mlRc35E6zytTWh1LfizfgHSoJcUdFBVNQOx4t/YC0fqfZxVgmQwgrFOhlJ/F StD/ie14Rog2kDuvEMUzWuAZuRTu8O77VyDyGTeLxw/3mKyGjN81o4UXUTj/9RM2YECD iXejwkQNgy1O9q+1hKi9iV9w10OBbRgrfgh8mlKY1d2jHkrO+5QRVFN61h7O4bXEq0ef s6D3uHatuHHQAK5Rdn1z11GJF/1/GBpeDOXlnnMk2TLzjaA3mzELPjdxks1u3MxX1VHS 9jRg== X-Gm-Message-State: AOAM532CYAcfP/bkUWh99K6ZBcyGYSNM7PDr58Jf6ZizJhrRil6S6Ijl ZrESImBNpoNWybekJbpgw1s= X-Google-Smtp-Source: ABdhPJxFRmHP4o+KUAcl9Gzd3ONFTDwlKHVokPABxu3iBRg8vfeqO1O6Qd5Jeytf8QvM2mlUZTuU5Q== X-Received: by 2002:a05:622a:1213:b0:2f3:a79a:2ccc with SMTP id y19-20020a05622a121300b002f3a79a2cccmr20009701qtx.376.1652197688440; Tue, 10 May 2022 08:48:08 -0700 (PDT) Received: from localhost ([98.242.65.84]) by smtp.gmail.com with ESMTPSA id h191-20020a379ec8000000b0069fc347ef5dsm8578128qke.74.2022.05.10.08.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:48:08 -0700 (PDT) From: Yury Norov To: Andy Shevchenko , David Laight , Greg Kroah-Hartman , Joe Perches , Julia Lawall , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Nicholas Piggin , Nicolas Palix , Peter Zijlstra , Rasmus Villemoes , Matti Vaittinen , linux-kernel@vger.kernel.org Cc: Yury Norov , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Leon Romanovsky , Paolo Abeni , Saeed Mahameed , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH 10/22] net/mlx5e: simplify mlx5e_set_fecparam() Date: Tue, 10 May 2022 08:47:38 -0700 Message-Id: <20220510154750.212913-11-yury.norov@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220510154750.212913-1-yury.norov@gmail.com> References: <20220510154750.212913-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org mlx5e_set_fecparam() used bitmap API to handle fecparam->fec. This is a bad practice because ->fec is not a bitmap - it's an u32 mask. The code wants to prevent user from passing ->fec with many modes enables. For this purpose it's better to use MANY_BITS() macro, which allows to avoid converting u32 to bitmap. CC: David S. Miller CC: Eric Dumazet CC: Jakub Kicinski CC: Leon Romanovsky CC: Paolo Abeni CC: Saeed Mahameed CC: netdev@vger.kernel.org CC: linux-rdma@vger.kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Yury Norov --- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 6e80585d731f..316cb72c4cc8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -1664,13 +1664,11 @@ static int mlx5e_set_fecparam(struct net_device *netdev, { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5_core_dev *mdev = priv->mdev; - unsigned long fec_bitmap; u16 fec_policy = 0; int mode; int err; - bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE); - if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1) + if (MANY_BITS(fecparam->fec)) return -EOPNOTSUPP; for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) { From patchwork Tue May 10 15:47:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12845198 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE6F9C433FE for ; Tue, 10 May 2022 15:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346680AbiEJPxG (ORCPT ); Tue, 10 May 2022 11:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347267AbiEJPwN (ORCPT ); Tue, 10 May 2022 11:52:13 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D8B27FE4; Tue, 10 May 2022 08:48:15 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id fu47so13827619qtb.5; Tue, 10 May 2022 08:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yb/F6YFHx8jMmT8NzFo+iYOEgGU08YViXeElbI3tjgc=; b=MMnXS3xA1tmydR2qCDMamehnHI5FTZPQnT0YdSBT4isID4m9dejiQqAVaASciKXh2t uNvjLP9M1SpNR4L9suFWs2GB3zj0kW6tIw+HGOGD0qgwx94I6AWsORwzqjwEJ0Yw8Lon SHAjLcmqVRiNW8qsl5AfmJNSQJxIMdeX/5OhcZCWobvLe1G4TOlSiS1f4gQUkC3AyewE s/5zKTm6e85HXpPxzZGWWHF7kuC8kNjOOFMOLzuI6valozkPvbjyLJR/echRLonbSXes Vef44tpvYg2wXOOhFuE8RU0X4TxNWG/udFq3Emz7Cl/FRJe4tXgux0zhuZj3kBgh3jZD 9N3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yb/F6YFHx8jMmT8NzFo+iYOEgGU08YViXeElbI3tjgc=; b=76KRrIAfArRUp4oHOH+q8Q1eCGeF4C0taImlIGbukwMIGyjKwxuWpkklPgrT/kuhc5 yJPlwBiUUp3BfXD23HIutJPzok2gMTbXuAj4TuMCfatte54JKnaTs071rCvslAIwfiXs GjRWKXwZFo9LmnbeHU8EjetkITZw7XCvp42ZLbB3JLqyzZzL1+DB9cnrgumfFfx3XEFu 81YqUvKwGGgrNZyCzo6JE1EVaALx3h+bAiMXJl4CHM1eEt9COp5aKE8QD4F5RSCIpWXf x+OskF7rVUhA5bp/XIPd8YDkylrloaraa3kfMW70URozjbjLZN88Y0WDdn4hP1GoV2s2 ZjHQ== X-Gm-Message-State: AOAM530b7Dwz3XLIq9adoT9BAqCT1884OEYOjet/Y45Lk+w3lWs23hnH poNcC8IgoVBlCZE81XbzsAg= X-Google-Smtp-Source: ABdhPJwV70hoAcYnRzaFrPNRGD//htdKIyrvhMG9B5O5rgnhDgAUf7COuLmQzmUbet3XQOUvrJCg2A== X-Received: by 2002:a05:622a:93:b0:2f3:c4ef:6c71 with SMTP id o19-20020a05622a009300b002f3c4ef6c71mr19568082qtw.505.1652197694757; Tue, 10 May 2022 08:48:14 -0700 (PDT) Received: from localhost ([98.242.65.84]) by smtp.gmail.com with ESMTPSA id c2-20020ac80542000000b002f39b99f67bsm9312717qth.21.2022.05.10.08.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:48:14 -0700 (PDT) From: Yury Norov To: Andy Shevchenko , David Laight , Greg Kroah-Hartman , Joe Perches , Julia Lawall , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Nicholas Piggin , Nicolas Palix , Peter Zijlstra , Rasmus Villemoes , Matti Vaittinen , linux-kernel@vger.kernel.org Cc: Yury Norov , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Leon Romanovsky , Paolo Abeni , Saeed Mahameed , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH 15/22] net/mlx5: use cpumask_weight_gt() in irq_pool_request_irq() Date: Tue, 10 May 2022 08:47:43 -0700 Message-Id: <20220510154750.212913-16-yury.norov@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220510154750.212913-1-yury.norov@gmail.com> References: <20220510154750.212913-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org cpumask_weight_gt() is more efficient because it may stop traversing cpumask depending on condition. CC: David S. Miller CC: Eric Dumazet CC: Jakub Kicinski CC: Leon Romanovsky CC: Paolo Abeni CC: Saeed Mahameed CC: netdev@vger.kernel.org CC: linux-rdma@vger.kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Yury Norov --- drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c index 380a208ab137..d57f804ee934 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c @@ -58,7 +58,7 @@ irq_pool_request_irq(struct mlx5_irq_pool *pool, const struct cpumask *req_mask) if (err) return ERR_PTR(err); if (pool->irqs_per_cpu) { - if (cpumask_weight(req_mask) > 1) + if (cpumask_weight_gt(req_mask, 1)) /* if req_mask contain more then one CPU, set the least loadad CPU * of req_mask */