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: <063D6719AE5E284EB5DD2968C1650D6D5F4A2E99@AcuExch.aculab.com>
Date:	Fri, 15 Apr 2016 08:33:27 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Jiri Pirko' <jiri@...nulli.us>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:	"davem@...emloft.net" <davem@...emloft.net>,
	"idosch@...lanox.com" <idosch@...lanox.com>,
	"eladr@...lanox.com" <eladr@...lanox.com>,
	"yotamg@...lanox.com" <yotamg@...lanox.com>,
	"ogerlitz@...lanox.com" <ogerlitz@...lanox.com>,
	"roopa@...ulusnetworks.com" <roopa@...ulusnetworks.com>,
	"nikolay@...ulusnetworks.com" <nikolay@...ulusnetworks.com>,
	"jhs@...atatu.com" <jhs@...atatu.com>,
	"john.fastabend@...il.com" <john.fastabend@...il.com>,
	"rami.rosen@...el.com" <rami.rosen@...el.com>,
	"gospo@...ulusnetworks.com" <gospo@...ulusnetworks.com>,
	"stephen@...workplumber.org" <stephen@...workplumber.org>,
	"sfeldma@...il.com" <sfeldma@...il.com>
Subject: RE: [patch net-next 05/18] mlxsw: spectrum_buffers: Push out
 indexes and direction out of SB structs

From: Jiri Pirko
> Sent: 14 April 2016 17:19
> From: Jiri Pirko <jiri@...lanox.com>
> 
> Structs are in arrays so use array index as pool/tc/prio index. With
> that, there is need to maintain separate arrays for ingress and egress.
...
> +static const u16 mlxsw_sp_pbs[] = {
> +	2 * MLXSW_SP_BYTES_TO_CELLS(ETH_FRAME_LEN),
> +	0,
> +	0,
> +	0,
> +	0,
> +	0,
> +	0,
> +	0,
> +	0, /* Unused */
> +	2 * MLXSW_SP_BYTES_TO_CELLS(MLXSW_PORT_MAX_MTU),
>  };

Use designated initialisers.

> 
>  #define MLXSW_SP_PBS_LEN ARRAY_SIZE(mlxsw_sp_pbs)
> @@ -106,10 +96,9 @@ static int mlxsw_sp_port_pb_init(struct mlxsw_sp_port *mlxsw_sp_port)
>  	mlxsw_reg_pbmc_pack(pbmc_pl, mlxsw_sp_port->local_port,
>  			    0xffff, 0xffff / 2);
>  	for (i = 0; i < MLXSW_SP_PBS_LEN; i++) {

I'd rather see an explicit ARRAY_COUNT(mlxsw_sp_pbs) than some 'randon' constant.

> -		const struct mlxsw_sp_pb *pb;
> -
> -		pb = &mlxsw_sp_pbs[i];
> -		mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl, pb->index, pb->size);
> +		if (i == 8)
> +			continue;

I'm guessing that is the same '8' as the commented 'unused' slot when mlxsw_sp_pbs[]
is initialised.
Would be better if a named constant.
If this in initialisation code an illegal value (maybe 0xffff) to mark the
unused slot.

> +		mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl, i, mlxsw_sp_pbs[i]);

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ