Fri, Apr 15, 2016 at 10:33:27AM CEST, david.lai...@aculab.com wrote:
>From: Jiri Pirko
>> Sent: 14 April 2016 17:19
>> From: Jiri Pirko <j...@mellanox.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
>

Reply via email to