From mboxrd@z Thu Jan 1 00:00:00 1970 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 smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A35CDE6FE23 for ; Tue, 23 Dec 2025 19:08:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5040860E62; Tue, 23 Dec 2025 19:08:57 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id vzynYdUafMvK; Tue, 23 Dec 2025 19:08:56 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7F8C460E5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1766516936; bh=f94AB6cb3HG/eWMYQqlXm4FzeTrvvTstknIkIvvEzDE=; h=Date:From:To:Cc:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EMDX8Vr5TFIb+jN3sqOCKRJbP3F7lh0uiMjS0rgbggKR5qdCp1RyBjY/wCZSyFOWa 8oriceFgT0jmulOu6U57MbSMGZEu7+UEukpO1BgK7rrQekEEA2KrSWTOs1R9/wBS7B WcdBGKjlGlhJa/No6lApnsDKAFHX6g+Z2DBf/Vwa7+8TFppt2ZjBRffTZSypeXrUv2 ltgfcrrgpwWhoJqaWLMCLI5MGUt972otmBS7r8fNlXHdnKk6K+2vfavCwQz3ZMSxbY hIL9C+Tj87GbquzN3EvFxx63xtibul/H+Oli+FLGRPE1X9k/WpXf7Z3h7V21/EHU1u RVOz9dMDWThNg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 7F8C460E5F; Tue, 23 Dec 2025 19:08:56 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id B3ECCB9 for ; Tue, 23 Dec 2025 19:08:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9A54F409C0 for ; Tue, 23 Dec 2025 19:08:55 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Uh2--vwA1kGx for ; Tue, 23 Dec 2025 19:08:54 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::329; helo=mail-wm1-x329.google.com; envelope-from=david.laight.linux@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 44A33409BD DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 44A33409BD Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by smtp4.osuosl.org (Postfix) with ESMTPS id 44A33409BD for ; Tue, 23 Dec 2025 19:08:54 +0000 (UTC) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-47bdbc90dcaso35001185e9.1 for ; Tue, 23 Dec 2025 11:08:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766516932; x=1767121732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=f94AB6cb3HG/eW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igJd3Od PggrVSYV/nBZHu6k8yz4cGPYfpHrG132V0WEV5MeQszHOPLT6hG0o= X-Google-Smtp-Source: AGHT+IH3Q0hPHKJKChpo35Wgcum55tE85eoWpfZOgkdjlvObESRWfsHXpeJunSU5cP6/XSJwW1Ja9A== X-Received: by 2002:a05:600c:45cf:b0:477:75eb:a643 with SMTP id 5b1f17b1804b1-47d19533403mr139222325e9.4.1766516931787; Tue, 23 Dec 2025 11:08:51 -0800 (PST) Received: from pumpkin (host-2-103-239-165.as13285.net. [2.103.239.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324ea227casm29610174f8f.15.2025.12.23.11.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 11:08:51 -0800 (PST) Date: Tue, 23 Dec 2025 19:08:46 +0000 From: David Laight To: "Yury Norov (NVIDIA)" Cc: Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rasmus Villemoes , Andrew Morton , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20251223190846.76ff4dc0@pumpkin> In-Reply-To: <20251223162303.434659-3-yury.norov@gmail.com> References: <20251223162303.434659-1-yury.norov@gmail.com> <20251223162303.434659-3-yury.norov@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766516932; x=1767121732; darn=lists.osuosl.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=f94AB6cb3HG/eWMYQqlXm4FzeTrvvTstknIkIvvEzDE=; b=FwcrNbusBNpiOopXKHVKt+sCy1ni0WGMHkNEBtwd9DGY1ZatBM8C5VJEj7i+Td4d93 DnO61Az93rU3U8EOmfbAG0C2B3GHSMB69WnHdaHIGLDW1VkH40s7LLUe+VV9J1KszBj6 kdLsKD3KfDyDVDFChYZg+XVZvi5cfWt31PdMcisLkwWnC0Sv2xzMT9fAIdcVjU96zqvx zeTYVQcVwEuBGHF4jDDOzKwV28C/l8j4nEOvsGbHWrL9iTl4bDrr9Uh8G6jlYivKBFn3 zSZ+RnkOfTXOHbmPndoi2J6gnzv7E6Cr2QFWtnGWctthGG0ooFu/Ok2+hWi1lDws8vZY r0Aw== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=FwcrNbus Subject: Re: [Intel-wired-lan] [PATCH 2/3] ice: use bitmap_weighted_xor() in ice_find_free_recp_res_idx() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Tue, 23 Dec 2025 11:23:01 -0500 "Yury Norov (NVIDIA)" wrote: > Use the right helper and save one bitmaps traverse. It makes no difference here. The bitmap has 48 entries and is just a single 'long' on 64bit. It is also already in a very slow path that has iterated all the 'set' bit of two bitmaps. The code is also pretty convoluted and confusing already. One of the other bitmaps has 64 entries, recoding using u64 would make it a bit more readable. Doing the 'weight' here is also just optimising for failure. Oh, and using u8 and u16 for function parameters, return values and maths requires extra instructions and is usually a bad idea. Dvaid > > Signed-off-by: Yury Norov (NVIDIA) > --- > drivers/net/ethernet/intel/ice/ice_switch.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c > index 84848f0123e7..903417477929 100644 > --- a/drivers/net/ethernet/intel/ice/ice_switch.c > +++ b/drivers/net/ethernet/intel/ice/ice_switch.c > @@ -4984,10 +4984,8 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const unsigned long *profiles, > hw->switch_info->recp_list[bit].res_idxs, > ICE_MAX_FV_WORDS); > > - bitmap_xor(free_idx, used_idx, possible_idx, ICE_MAX_FV_WORDS); > - > /* return number of free indexes */ > - return (u16)bitmap_weight(free_idx, ICE_MAX_FV_WORDS); > + return (u16)bitmap_weighted_xor(free_idx, used_idx, possible_idx, ICE_MAX_FV_WORDS); > } > > /**