Re: [Intel-wired-lan] [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
On Wed, Dec 17, 2025 at 11:37:32AM +, Loktionov, Aleksandr wrote: > > > > -Original Message- > > From: Intel-wired-lan On Behalf > > Of Yury Norov (NVIDIA) > > Sent: Tuesday, December 16, 2025 1:29 AM > > To: Nguyen, Anthony L ; Kitszel, > > Przemyslaw ; Andrew Lunn > > ; David S. Miller ; Eric > > Dumazet ; Jakub Kicinski ; Paolo > > Abeni ; [email protected]; > > [email protected]; [email protected] > > Cc: Yury Norov (NVIDIA) > > 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) > > --- > > .../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
Re: [Intel-wired-lan] [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
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/[email protected]/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/[email protected]/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 | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ 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 Laba2022-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 3620struct i40e_netdev_priv *np = netdev_priv(netdev); 5a28983710b739 Jakub Kicinski 2025-06-14 3621struct i40e_vsi *vsi = np->vsi; 5a28983710b739 Jakub Kicinski 2025-06-14 3622struct i40e_pf *pf = vsi->back; c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3623struct i40e_hw *hw = &pf->hw; 272cdaf2472ab7 Shannon Nelson 2016-02-17 3624u64 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 Laba2022-10-24 3626 DECLARE_BITMAP(flow_pctypes, FLOW_PCTYPES_SIZE); eb0dd6e4a3b3df Carolyn Wyborny 2016-07-27 3627u64 i_set, i_setc; c7d05ca89f8e40 Jesse Brandeburg 2013-09-11 3628 3b32c9
Re: [Intel-wired-lan] [PATCH] i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
> -Original Message- > From: Intel-wired-lan On Behalf > Of Yury Norov (NVIDIA) > Sent: Tuesday, December 16, 2025 1:29 AM > To: Nguyen, Anthony L ; Kitszel, > Przemyslaw ; Andrew Lunn > ; David S. Miller ; Eric > Dumazet ; Jakub Kicinski ; Paolo > Abeni ; [email protected]; > [email protected]; [email protected] > Cc: Yury Norov (NVIDIA) > 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) > --- > .../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
