[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D5F4A31C7@AcuExch.aculab.com>
Date: Fri, 15 Apr 2016 15:16:18 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jiri Pirko' <jiri@...nulli.us>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"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: 15 April 2016 09:53
..
> >> @@ -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.
>
> See "#define MLXSW_SP_PBS_LEN ARRAY_SIZE(mlxsw_sp_pbs)"
Imagine I'm reading the code quickly.
If the for() loop uses ARRAY_COUNT(mlxsw_sp_pbs) then (provided I grok ARRAY_COUNT())
I know that the array bounds are honoured.
When it uses MLXSW_SP_PBS_LEN I have to search for the definition in order
to check that it is the correct value/constant for that array.
David
Powered by blists - more mailing lists