lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1395328121.4968.19.camel@jekeller-desk1.amr.corp.intel.com>
Date:	Thu, 20 Mar 2014 15:08:41 +0000
From:	"Keller, Jacob E" <jacob.e.keller@...el.com>
To:	David Laight <David.Laight@...LAB.COM>
CC:	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"gospo@...hat.com" <gospo@...hat.com>,
	"sassmann@...hat.com" <sassmann@...hat.com>,
	Arun Sharma <asharma@...com>
Subject: Re: [net-next 13/15] ixgbe: clean up
 ixgbe_atr_compute_perfect_hash_82599

On Thu, 2014-03-20 at 09:44 +0000, David Laight wrote:
> From: Jeff Kirsher
> > From: Jacob Keller <jacob.e.keller@...el.com>
> > 
> > Rather than assign several parameters in a row, we should use a for
> > loop, which reduces code size.
> 
> And probably increases execution time.
> Especially for the first two blocks.

Probably, but I don't believe this is in the hot path.

> 
> ...
> > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
> > b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
> > index bdac7bd..34ab2fc 100644
> > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
> > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
> > @@ -1597,35 +1597,20 @@ void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
> >  {
> > 
> >  	u32 hi_hash_dword, lo_hash_dword, flow_vm_vlan;
> > -	u32 bucket_hash = 0;
> > +	u32 bucket_hash = 0, hi_dword = 0;
> > +	int i;
> > 
> >  	/* Apply masks to input data */
> > -	input->dword_stream[0]  &= input_mask->dword_stream[0];
> > -	input->dword_stream[1]  &= input_mask->dword_stream[1];
> > -	input->dword_stream[2]  &= input_mask->dword_stream[2];
> > -	input->dword_stream[3]  &= input_mask->dword_stream[3];
> > -	input->dword_stream[4]  &= input_mask->dword_stream[4];
> > -	input->dword_stream[5]  &= input_mask->dword_stream[5];
> > -	input->dword_stream[6]  &= input_mask->dword_stream[6];
> > -	input->dword_stream[7]  &= input_mask->dword_stream[7];
> > -	input->dword_stream[8]  &= input_mask->dword_stream[8];
> > -	input->dword_stream[9]  &= input_mask->dword_stream[9];
> > -	input->dword_stream[10] &= input_mask->dword_stream[10];
> > +	for (i = 0; i <= 10; i++)
> > +		input->dword_stream[i] &= input_mask->dword_stream[i];
> > 
> >  	/* record the flow_vm_vlan bits as they are a key part to the hash */
> >  	flow_vm_vlan = ntohl(input->dword_stream[0]);
> > 
> >  	/* generate common hash dword */
> > -	hi_hash_dword = ntohl(input->dword_stream[1] ^
> > -				    input->dword_stream[2] ^
> > -				    input->dword_stream[3] ^
> > -				    input->dword_stream[4] ^
> > -				    input->dword_stream[5] ^
> > -				    input->dword_stream[6] ^
> > -				    input->dword_stream[7] ^
> > -				    input->dword_stream[8] ^
> > -				    input->dword_stream[9] ^
> > -				    input->dword_stream[10]);
> > +	for (i = 1; i <= 10; i++)
> > +		hi_dword ^= input->dword_stream[i];
> > +	hi_hash_dword = ntohl(hi_dword);
> 
> If has to be worth doing these ^= at the same time as the & with the mask.
> Especially if the compiler can't assume that 'input' and 'input_mask'
> don't overlap - which forces some strong sequencing on the instructions.

I'm guessing you mean something like:

hi_dword ^= (input->dword_stream[i] & input_mask->dword_stream[i])?

Thanks,
Jake

> 
> >  	/* low dword is word swapped version of common */
> >  	lo_hash_dword = (hi_hash_dword >> 16) | (hi_hash_dword << 16);
> > @@ -1644,21 +1629,8 @@ void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
> >  	lo_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan << 16);
> > 
> >  	/* Process remaining 30 bit of the key */
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(1);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(2);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(3);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(4);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(5);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(6);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(7);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(8);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(9);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(10);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(11);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(12);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(13);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(14);
> > -	IXGBE_COMPUTE_BKT_HASH_ITERATION(15);
> > +	for (i = 1; i <= 15; i++)
> > +		IXGBE_COMPUTE_BKT_HASH_ITERATION(i);
> > 
> >  	/*
> >  	 * Limit hash to 13 bits since max bucket count is 8K.
> > --
> 
> 	David
> 
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ