* [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
@ 2025-12-16 0:28 Yury Norov (NVIDIA)
2025-12-17 11:37 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-12-17 22:46 ` kernel test robot
0 siblings, 2 replies; 4+ messages in thread
From: Yury Norov (NVIDIA) @ 2025-12-16 0:28 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, intel-wired-lan,
netdev, linux-kernel
Cc: Yury Norov (NVIDIA)
bitmap_weight() is O(N) and useless here, because the following
for_each_set_bit() returns immediately in case of empty flow_pctypes.
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
---
.../net/ethernet/intel/i40e/i40e_ethtool.c | 24 ++++++++-----------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index f2c2646ea298..54b0348fdee3 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -3720,20 +3720,16 @@ static int i40e_set_rxfh_fields(struct net_device *netdev,
return -EINVAL;
}
- if (bitmap_weight(flow_pctypes, FLOW_PCTYPES_SIZE)) {
- u8 flow_id;
-
- for_each_set_bit(flow_id, flow_pctypes, FLOW_PCTYPES_SIZE) {
- i_setc = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id)) |
- ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id)) << 32);
- i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
-
- i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id),
- (u32)i_set);
- i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id),
- (u32)(i_set >> 32));
- hena |= BIT_ULL(flow_id);
- }
+ for_each_set_bit(flow_id, flow_pctypes, FLOW_PCTYPES_SIZE) {
+ i_setc = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id)) |
+ ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id)) << 32);
+ i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
+
+ i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id),
+ (u32)i_set);
+ i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id),
+ (u32)(i_set >> 32));
+ hena |= BIT_ULL(flow_id);
}
i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (u32)hena);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [Intel-wired-lan] [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
2025-12-16 0:28 [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields() Yury Norov (NVIDIA)
@ 2025-12-17 11:37 ` Loktionov, Aleksandr
2025-12-18 0:29 ` Yury Norov
2025-12-17 22:46 ` kernel test robot
1 sibling, 1 reply; 4+ messages in thread
From: Loktionov, Aleksandr @ 2025-12-17 11:37 UTC (permalink / raw)
To: Yury Norov (NVIDIA), Nguyen, Anthony L, Kitszel, Przemyslaw,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, intel-wired-lan@lists.osuosl.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Yury Norov (NVIDIA)
> Sent: Tuesday, December 16, 2025 1:29 AM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>; intel-wired-lan@lists.osuosl.org;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> Subject: [Intel-wired-lan] [PATCH] i40e: drop useless bitmap_weight()
> call in i40e_set_rxfh_fields()
>
> bitmap_weight() is O(N) and useless here, because the following
> for_each_set_bit() returns immediately in case of empty flow_pctypes.
>
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> ---
> .../net/ethernet/intel/i40e/i40e_ethtool.c | 24 ++++++++----------
> -
> 1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index f2c2646ea298..54b0348fdee3 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -3720,20 +3720,16 @@ static int i40e_set_rxfh_fields(struct
> net_device *netdev,
> return -EINVAL;
> }
>
> - if (bitmap_weight(flow_pctypes, FLOW_PCTYPES_SIZE)) {
> - u8 flow_id;
> -
> - for_each_set_bit(flow_id, flow_pctypes,
> FLOW_PCTYPES_SIZE) {
> - i_setc = (u64)i40e_read_rx_ctl(hw,
> I40E_GLQF_HASH_INSET(0, flow_id)) |
> - ((u64)i40e_read_rx_ctl(hw,
> I40E_GLQF_HASH_INSET(1, flow_id)) << 32);
> - i_set = i40e_get_rss_hash_bits(&pf->hw, nfc,
> i_setc);
> -
> - i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0,
> flow_id),
> - (u32)i_set);
> - i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1,
> flow_id),
> - (u32)(i_set >> 32));
> - hena |= BIT_ULL(flow_id);
> - }
> + for_each_set_bit(flow_id, flow_pctypes, FLOW_PCTYPES_SIZE) {
You removed the flow_id declaration, but use it in the code below.
Are you sure it compiles?
> + i_setc = (u64)i40e_read_rx_ctl(hw,
> I40E_GLQF_HASH_INSET(0, flow_id)) |
> + ((u64)i40e_read_rx_ctl(hw,
> I40E_GLQF_HASH_INSET(1, flow_id)) << 32);
> + i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
> +
> + i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id),
> + (u32)i_set);
> + i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id),
> + (u32)(i_set >> 32));
> + hena |= BIT_ULL(flow_id);
> }
>
> i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (u32)hena);
> --
> 2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
2025-12-16 0:28 [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields() Yury Norov (NVIDIA)
2025-12-17 11:37 ` [Intel-wired-lan] " Loktionov, Aleksandr
@ 2025-12-17 22:46 ` kernel test robot
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-12-17 22:46 UTC (permalink / raw)
To: Yury Norov (NVIDIA), Tony Nguyen, Przemek Kitszel, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
intel-wired-lan, linux-kernel
Cc: llvm, oe-kbuild-all, netdev, Yury Norov (NVIDIA)
Hi Yury,
kernel test robot noticed the following build errors:
[auto build test ERROR on tnguy-next-queue/dev-queue]
[also build test ERROR on tnguy-net-queue/dev-queue linus/master v6.19-rc1 next-20251217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yury-Norov-NVIDIA/i40e-drop-useless-bitmap_weight-call-in-i40e_set_rxfh_fields/20251216-083033
base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
patch link: https://lore.kernel.org/r/20251216002852.334561-1-yury.norov%40gmail.com
patch subject: [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20251218/202512180618.zgXQvXlK-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251218/202512180618.zgXQvXlK-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512180618.zgXQvXlK-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3711:19: error: use of undeclared identifier 'flow_id'
3711 | for_each_set_bit(flow_id, flow_pctypes, FLOW_PCTYPES_SIZE) {
| ^
>> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3711:19: error: use of undeclared identifier 'flow_id'
>> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3711:19: error: use of undeclared identifier 'flow_id'
>> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3711:19: error: use of undeclared identifier 'flow_id'
>> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3711:19: error: use of undeclared identifier 'flow_id'
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3712:62: error: use of undeclared identifier 'flow_id'
3712 | i_setc = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id)) |
| ^
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3713:56: error: use of undeclared identifier 'flow_id'
3713 | ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id)) << 32);
| ^
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3716:49: error: use of undeclared identifier 'flow_id'
3716 | i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id),
| ^
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3718:49: error: use of undeclared identifier 'flow_id'
3718 | i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id),
| ^
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:3720:19: error: use of undeclared identifier 'flow_id'
3720 | hena |= BIT_ULL(flow_id);
| ^
10 errors generated.
vim +/flow_id +3711 drivers/net/ethernet/intel/i40e/i40e_ethtool.c
eb0dd6e4a3b3df Carolyn Wyborny 2016-07-27 3614
3b32c9932853e1 Slawomir Laba 2022-10-24 3615 #define FLOW_PCTYPES_SIZE 64
5a28983710b739 Jakub Kicinski 2025-06-14 3616 static int i40e_set_rxfh_fields(struct net_device *netdev,
5a28983710b739 Jakub Kicinski 2025-06-14 3617 const struct ethtool_rxfh_fields *nfc,
5a28983710b739 Jakub Kicinski 2025-06-14 3618 struct netlink_ext_ack *extack)
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3619 {
5a28983710b739 Jakub Kicinski 2025-06-14 3620 struct i40e_netdev_priv *np = netdev_priv(netdev);
5a28983710b739 Jakub Kicinski 2025-06-14 3621 struct i40e_vsi *vsi = np->vsi;
5a28983710b739 Jakub Kicinski 2025-06-14 3622 struct i40e_pf *pf = vsi->back;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3623 struct i40e_hw *hw = &pf->hw;
272cdaf2472ab7 Shannon Nelson 2016-02-17 3624 u64 hena = (u64)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0)) |
272cdaf2472ab7 Shannon Nelson 2016-02-17 3625 ((u64)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1)) << 32);
3b32c9932853e1 Slawomir Laba 2022-10-24 3626 DECLARE_BITMAP(flow_pctypes, FLOW_PCTYPES_SIZE);
eb0dd6e4a3b3df Carolyn Wyborny 2016-07-27 3627 u64 i_set, i_setc;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3628
3b32c9932853e1 Slawomir Laba 2022-10-24 3629 bitmap_zero(flow_pctypes, FLOW_PCTYPES_SIZE);
3b32c9932853e1 Slawomir Laba 2022-10-24 3630
70756d0a4727fe Ivan Vecera 2023-11-13 3631 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) {
83d14c595e011f Carolyn Wyborny 2017-06-07 3632 dev_err(&pf->pdev->dev,
83d14c595e011f Carolyn Wyborny 2017-06-07 3633 "Change of RSS hash input set is not supported when MFP mode is enabled\n");
83d14c595e011f Carolyn Wyborny 2017-06-07 3634 return -EOPNOTSUPP;
83d14c595e011f Carolyn Wyborny 2017-06-07 3635 }
83d14c595e011f Carolyn Wyborny 2017-06-07 3636
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3637 /* RSS does not support anything other than hashing
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3638 * to queues on src and dst IPs and ports
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3639 */
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3640 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST |
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3641 RXH_L4_B_0_1 | RXH_L4_B_2_3))
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3642 return -EINVAL;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3643
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3644 switch (nfc->flow_type) {
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3645 case TCP_V4_FLOW:
141d0c9037ca57 Jacob Keller 2025-05-05 3646 set_bit(LIBIE_FILTER_PCTYPE_NONF_IPV4_TCP, flow_pctypes);
0e8b9fdd40fe65 Ivan Vecera 2023-11-13 3647 if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE,
0e8b9fdd40fe65 Ivan Vecera 2023-11-13 3648 pf->hw.caps))
141d0c9037ca57 Jacob Keller 2025-05-05 3649 set_bit(LIBIE_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK,
3b32c9932853e1 Slawomir Laba 2022-10-24 3650 flow_pctypes);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3651 break;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3652 case TCP_V6_FLOW:
141d0c9037ca57 Jacob Keller 2025-05-05 3653 set_bit(LIBIE_FILTER_PCTYPE_NONF_IPV6_TCP, flow_pctypes);
0e8b9fdd40fe65 Ivan Vecera 2023-11-13 3654 if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE,
0e8b9fdd40fe65 Ivan Vecera 2023-11-13 3655 pf->hw.caps))
141d0c9037ca57 Jacob Keller 2025-05-05 3656 set_bit(LIBIE_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK,
3b32c9932853e1 Slawomir Laba 2022-10-24 3657 flow_pctypes);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3658 break;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3659 case UDP_V4_FLOW:
141d0c9037ca57 Jacob Keller 2025-05-05 3660 set_bit(LIBIE_FILTER_PCTYPE_NONF_IPV4_UDP, flow_pctypes);
0e8b9fdd40fe65 Ivan Vecera 2023-11-13 3661 if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE,
0e8b9fdd40fe65 Ivan Vecera 2023-11-13 3662 pf->hw.caps)) {
141d0c9037ca57 Jacob Keller 2025-05-05 3663 set_bit(LIBIE_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP,
3b32c9932853e1 Slawomir Laba 2022-10-24 3664 flow_pctypes);
141d0c9037ca57 Jacob Keller 2025-05-05 3665 set_bit(LIBIE_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP,
3b32c9932853e1 Slawomir Laba 2022-10-24 3666 flow_pctypes);
3b32c9932853e1 Slawomir Laba 2022-10-24 3667 }
141d0c9037ca57 Jacob Keller 2025-05-05 3668 hena |= BIT_ULL(LIBIE_FILTER_PCTYPE_FRAG_IPV4);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3669 break;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3670 case UDP_V6_FLOW:
141d0c9037ca57 Jacob Keller 2025-05-05 3671 set_bit(LIBIE_FILTER_PCTYPE_NONF_IPV6_UDP, flow_pctypes);
0e8b9fdd40fe65 Ivan Vecera 2023-11-13 3672 if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE,
0e8b9fdd40fe65 Ivan Vecera 2023-11-13 3673 pf->hw.caps)) {
141d0c9037ca57 Jacob Keller 2025-05-05 3674 set_bit(LIBIE_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP,
3b32c9932853e1 Slawomir Laba 2022-10-24 3675 flow_pctypes);
141d0c9037ca57 Jacob Keller 2025-05-05 3676 set_bit(LIBIE_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP,
3b32c9932853e1 Slawomir Laba 2022-10-24 3677 flow_pctypes);
3b32c9932853e1 Slawomir Laba 2022-10-24 3678 }
141d0c9037ca57 Jacob Keller 2025-05-05 3679 hena |= BIT_ULL(LIBIE_FILTER_PCTYPE_FRAG_IPV6);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3680 break;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3681 case AH_ESP_V4_FLOW:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3682 case AH_V4_FLOW:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3683 case ESP_V4_FLOW:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3684 case SCTP_V4_FLOW:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3685 if ((nfc->data & RXH_L4_B_0_1) ||
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3686 (nfc->data & RXH_L4_B_2_3))
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3687 return -EINVAL;
141d0c9037ca57 Jacob Keller 2025-05-05 3688 hena |= BIT_ULL(LIBIE_FILTER_PCTYPE_NONF_IPV4_OTHER);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3689 break;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3690 case AH_ESP_V6_FLOW:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3691 case AH_V6_FLOW:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3692 case ESP_V6_FLOW:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3693 case SCTP_V6_FLOW:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3694 if ((nfc->data & RXH_L4_B_0_1) ||
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3695 (nfc->data & RXH_L4_B_2_3))
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3696 return -EINVAL;
141d0c9037ca57 Jacob Keller 2025-05-05 3697 hena |= BIT_ULL(LIBIE_FILTER_PCTYPE_NONF_IPV6_OTHER);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3698 break;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3699 case IPV4_FLOW:
141d0c9037ca57 Jacob Keller 2025-05-05 3700 hena |= BIT_ULL(LIBIE_FILTER_PCTYPE_NONF_IPV4_OTHER) |
141d0c9037ca57 Jacob Keller 2025-05-05 3701 BIT_ULL(LIBIE_FILTER_PCTYPE_FRAG_IPV4);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3702 break;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3703 case IPV6_FLOW:
141d0c9037ca57 Jacob Keller 2025-05-05 3704 hena |= BIT_ULL(LIBIE_FILTER_PCTYPE_NONF_IPV6_OTHER) |
141d0c9037ca57 Jacob Keller 2025-05-05 3705 BIT_ULL(LIBIE_FILTER_PCTYPE_FRAG_IPV6);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3706 break;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3707 default:
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3708 return -EINVAL;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3709 }
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3710
3b32c9932853e1 Slawomir Laba 2022-10-24 @3711 for_each_set_bit(flow_id, flow_pctypes, FLOW_PCTYPES_SIZE) {
3b32c9932853e1 Slawomir Laba 2022-10-24 3712 i_setc = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id)) |
3b32c9932853e1 Slawomir Laba 2022-10-24 3713 ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id)) << 32);
54b5af5a438076 Slawomir Laba 2022-10-24 3714 i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
3b32c9932853e1 Slawomir Laba 2022-10-24 3715
3b32c9932853e1 Slawomir Laba 2022-10-24 3716 i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id),
eb0dd6e4a3b3df Carolyn Wyborny 2016-07-27 3717 (u32)i_set);
3b32c9932853e1 Slawomir Laba 2022-10-24 3718 i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id),
eb0dd6e4a3b3df Carolyn Wyborny 2016-07-27 3719 (u32)(i_set >> 32));
3b32c9932853e1 Slawomir Laba 2022-10-24 3720 hena |= BIT_ULL(flow_id);
3b32c9932853e1 Slawomir Laba 2022-10-24 3721 }
eb0dd6e4a3b3df Carolyn Wyborny 2016-07-27 3722
272cdaf2472ab7 Shannon Nelson 2016-02-17 3723 i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (u32)hena);
272cdaf2472ab7 Shannon Nelson 2016-02-17 3724 i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), (u32)(hena >> 32));
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3725 i40e_flush(hw);
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3726
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3727 return 0;
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3728 }
c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3729
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-wired-lan] [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
2025-12-17 11:37 ` [Intel-wired-lan] " Loktionov, Aleksandr
@ 2025-12-18 0:29 ` Yury Norov
0 siblings, 0 replies; 4+ messages in thread
From: Yury Norov @ 2025-12-18 0:29 UTC (permalink / raw)
To: Loktionov, Aleksandr
Cc: Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
On Wed, Dec 17, 2025 at 11:37:32AM +0000, Loktionov, Aleksandr wrote:
>
>
> > -----Original Message-----
> > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> > Of Yury Norov (NVIDIA)
> > Sent: Tuesday, December 16, 2025 1:29 AM
> > To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
> > Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn
> > <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> > Abeni <pabeni@redhat.com>; intel-wired-lan@lists.osuosl.org;
> > netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> > Cc: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> > Subject: [Intel-wired-lan] [PATCH] i40e: drop useless bitmap_weight()
> > call in i40e_set_rxfh_fields()
> >
> > bitmap_weight() is O(N) and useless here, because the following
> > for_each_set_bit() returns immediately in case of empty flow_pctypes.
> >
> > Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> > ---
> > .../net/ethernet/intel/i40e/i40e_ethtool.c | 24 ++++++++----------
> > -
> > 1 file changed, 10 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > index f2c2646ea298..54b0348fdee3 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > @@ -3720,20 +3720,16 @@ static int i40e_set_rxfh_fields(struct
> > net_device *netdev,
> > return -EINVAL;
> > }
> >
> > - if (bitmap_weight(flow_pctypes, FLOW_PCTYPES_SIZE)) {
> > - u8 flow_id;
> > -
> > - for_each_set_bit(flow_id, flow_pctypes,
> > FLOW_PCTYPES_SIZE) {
> > - i_setc = (u64)i40e_read_rx_ctl(hw,
> > I40E_GLQF_HASH_INSET(0, flow_id)) |
> > - ((u64)i40e_read_rx_ctl(hw,
> > I40E_GLQF_HASH_INSET(1, flow_id)) << 32);
> > - i_set = i40e_get_rss_hash_bits(&pf->hw, nfc,
> > i_setc);
> > -
> > - i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0,
> > flow_id),
> > - (u32)i_set);
> > - i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1,
> > flow_id),
> > - (u32)(i_set >> 32));
> > - hena |= BIT_ULL(flow_id);
> > - }
> > + for_each_set_bit(flow_id, flow_pctypes, FLOW_PCTYPES_SIZE) {
> You removed the flow_id declaration, but use it in the code below.
> Are you sure it compiles?
No it doesn't. I'll send the right version shortly. Sorry for this
noise.
Thanks,
Yury
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-18 0:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16 0:28 [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields() Yury Norov (NVIDIA)
2025-12-17 11:37 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-12-18 0:29 ` Yury Norov
2025-12-17 22:46 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).