[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160415085259.GB1911@nanopsycho.orion>
Date: Fri, 15 Apr 2016 10:52:59 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: David Laight <David.Laight@...LAB.COM>
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
Fri, Apr 15, 2016 at 10:33:27AM CEST, David.Laight@...LAB.COM wrote:
>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.
Okay
>
>>
>> #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.
See "#define MLXSW_SP_PBS_LEN ARRAY_SIZE(mlxsw_sp_pbs)"
>
>> - 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.
Okay. Will send follow-up to make this a bit nicer. Thanks.
>
>> + mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl, i, mlxsw_sp_pbs[i]);
>
> David
>
Powered by blists - more mailing lists