From patchwork Tue May 23 18:17:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 98128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2343884vqo; Tue, 23 May 2023 11:37:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dC7M5y8FRzkjVJbszldLd0TU++2eY6FIGpTk/uWiKfbD40SWjmXpdvbWZMfBM9XGZ5zzi X-Received: by 2002:a17:90b:238f:b0:24d:f77c:71e7 with SMTP id mr15-20020a17090b238f00b0024df77c71e7mr13509612pjb.41.1684867065556; Tue, 23 May 2023 11:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684867065; cv=none; d=google.com; s=arc-20160816; b=R3vz3t9Fsl3KivPZsA3K5hSK8ArDlWoT8l0cQzC61XnNNMOt74JlSU1ljD9QfsEaJS WYkGEtf4Vzo4SJeScWDudLN1eL5yX+OgFCJu+UsN29Xo2TwLoqRJUqHiNcCY6sXi+kRu +J6z4YmQt3W7OEuZap6fulTcFUr20SRM7TuDyH7ASy9pLoWLl61vTr3DgniBf7Ynnml2 fkIEdVChe12+HZYS1oxNHDyU+BKO2ydovOcw1BR0K4Zb/acV4l3vRoZCb7fe4p0j6Nwg IB78/lMfjzia7GHdcQq4e/AzGc6HqaU0FQE0UFrfYIIOVJHDlF3nguxXucj2BzR6dDoV JVgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xOjN030f+KivSx43oy6ENyMrMHsfizHgf8zgnaV+c+4=; b=RWUU6Wh/IU1icWAjbAkyjJqb0/P4MGrSwNZcYlwmetLigXtsex34b+nfm04zD+QQ83 E7wA/BxWuDmHSSroeqAmFCyGXxGuVovr6RjjdFZr8FqAmdEBCBLZ3pRSbl0cXrmJwSHi wwr8rvduvT6mxtCunh7NZRErl/8vdV/rAI6BwEn3Dpjs8N/m3ayVCDWhTMKPOxyuAh/E BOXar/rTttY3cLw/QveaOAS2k1hGdRPlTSoTzyB2JqGZ/AtaAlLyHKYmRpuHPVe9XTD4 h4BGnIFDy8gdjpj3FTwNCMvNU7mgZLfyPvqg/gzfexQSbNbXR5hQtyyo88ibuENureVP MpRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=aDKiYuO8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 24-20020a631258000000b005346d98e741si6865103pgs.50.2023.05.23.11.37.29; Tue, 23 May 2023 11:37:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=aDKiYuO8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229476AbjEWSSG (ORCPT + 99 others); Tue, 23 May 2023 14:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjEWSSF (ORCPT ); Tue, 23 May 2023 14:18:05 -0400 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11EE6119 for ; Tue, 23 May 2023 11:18:03 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 1Wa2qKmmo8aX91Wa2qCkXv; Tue, 23 May 2023 20:17:56 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684865876; bh=xOjN030f+KivSx43oy6ENyMrMHsfizHgf8zgnaV+c+4=; h=From:To:Cc:Subject:Date; b=aDKiYuO8+10YmMH1IU69GSOhnG5Fn+PgSBg6glntAZ+sc3eVkGzE+xPs9s33q7MWd QivsqPba4wkHoVOBLp4UFvElk742rEW64go+mrjnhmycUPgRt6GdDepa7Dkc9PZX8s Ts+ZUH9uls0NF9rMYJfEuf34fDM3e3DnBt8di/dpQ1G9A8G5EaZabUclcdtVlnG8ct dS1jPsbIFTooru+9weUFNViCcdnZCD3hzZePzTv/hHUFWJnWMKLKFSn1/QFzp97jP/ PNlqKmGddvNzsfVGqJJWlJWeZcXJ0p7aNFjYP7xZ4cVqDaiXFJMmuKnaa5vKz/VxlV T4nKQSvRIFCng== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 23 May 2023 20:17:56 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Tariq Toukan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH net-next] net/mlx4: Use bitmap_weight_and() Date: Tue, 23 May 2023 20:17:52 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766711168402198837?= X-GMAIL-MSGID: =?utf-8?q?1766711168402198837?= Use bitmap_weight_and() instead of hand writing it. This saves a few LoC and is slightly faster, should it mater. Signed-off-by: Christophe JAILLET Reviewed-by: Simon Horman --- drivers/net/ethernet/mellanox/mlx4/main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 277738c50c56..28c435ce98d8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -1374,16 +1374,13 @@ static int mlx4_mf_bond(struct mlx4_dev *dev) int nvfs; struct mlx4_slaves_pport slaves_port1; struct mlx4_slaves_pport slaves_port2; - DECLARE_BITMAP(slaves_port_1_2, MLX4_MFUNC_MAX); slaves_port1 = mlx4_phys_to_slaves_pport(dev, 1); slaves_port2 = mlx4_phys_to_slaves_pport(dev, 2); - bitmap_and(slaves_port_1_2, - slaves_port1.slaves, slaves_port2.slaves, - dev->persist->num_vfs + 1); /* only single port vfs are allowed */ - if (bitmap_weight(slaves_port_1_2, dev->persist->num_vfs + 1) > 1) { + if (bitmap_weight_and(slaves_port1.slaves, slaves_port2.slaves, + dev->persist->num_vfs + 1) > 1) { mlx4_warn(dev, "HA mode unsupported for dual ported VFs\n"); return -EINVAL; }