[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e944c21-e37b-4ea9-dfa2-d087d3984192@mellanox.com>
Date: Wed, 15 Nov 2017 12:01:33 +0200
From: Arkadi Sharshevsky <arkadis@...lanox.com>
To: David Ahern <dsa@...ulusnetworks.com>,
Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org
Cc: davem@...emloft.net, mlxsw@...lanox.com, andrew@...n.ch,
vivien.didelot@...oirfairelinux.com, f.fainelli@...il.com,
michael.chan@...adcom.com, ganeshgr@...lsio.com,
saeedm@...lanox.com, matanb@...lanox.com, leonro@...lanox.com,
idosch@...lanox.com, jakub.kicinski@...ronome.com, ast@...nel.org,
daniel@...earbox.net, simon.horman@...ronome.com,
pieter.jansenvanvuuren@...ronome.com, john.hurley@...ronome.com,
alexander.h.duyck@...el.com, linville@...driver.com,
gospo@...adcom.com, steven.lin1@...adcom.com, yuvalm@...lanox.com,
ogerlitz@...lanox.com, roopa@...ulusnetworks.com
Subject: Re: [patch net-next RFC v2 07/11] mlxsw: spectrum: Register KVD
resources with devlink
On 11/15/2017 02:15 AM, David Ahern wrote:
> On 11/14/17 9:18 AM, Jiri Pirko wrote:
>> +static int
>> +mlxsw_sp_resource_kvd_size_validate(struct devlink *devlink, u64 size,
>> + struct list_head *resource_list,
>> + struct netlink_ext_ack *extack)
>> +{
>> + struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
>> + u32 kvd_size, single_size, double_size, linear_size;
>> + struct devlink_resource *resource;
>> +
>> + kvd_size = MLXSW_CORE_RES_GET(mlxsw_core, KVD_SIZE);
>> + if (kvd_size != size) {
>> + NL_SET_ERR_MSG(extack, MLXSW_SP_PREFIX "kvd size cannot be chagned");
>> + return -EINVAL;
>> + }
>> +
>> + list_for_each_entry(resource, resource_list, list) {
>> + switch (resource->id) {
>> + case MLXSW_SP_RESOURCE_KVD_LINEAR:
>> + linear_size = resource->size_new;
>> + break;
>> + case MLXSW_SP_RESOURCE_KVD_HASH_SINGLE:
>> + single_size = resource->size_new;
>> + break;
>> + case MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE:
>> + double_size = resource->size_new;
>> + break;
>> + }
>> + }
>> +
>> + /* Overlap is not supported */
>> + if (linear_size + single_size + double_size > kvd_size) {
>> + NL_SET_ERR_MSG(extack, MLXSW_SP_PREFIX "Overlap is not supported");
>> + return -EINVAL;
>> + }
>> +
>> + return 0;
>> +}
>> +
>
> gcc warnings due to the above:
>
> /home/dsa/kernel-3.git/drivers/net/ethernet/mellanox/mlxsw/spectrum.c:
> In function ‘mlxsw_sp_resource_kvd_size_validate’:
> /home/dsa/kernel-3.git/drivers/net/ethernet/mellanox/mlxsw/spectrum.c:3974:32:
> warning: ‘linear_size’ may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> if (linear_size + single_size + double_size > kvd_size) {
> ^
> /home/dsa/kernel-3.git/drivers/net/ethernet/mellanox/mlxsw/spectrum.c:3950:29:
> warning: ‘double_size’ may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> u32 kvd_size, single_size, double_size, linear_size;
> ^
> /home/dsa/kernel-3.git/drivers/net/ethernet/mellanox/mlxsw/spectrum.c:3950:16:
> warning: ‘single_size’ may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> u32 kvd_size, single_size, double_size, linear_size;
> ^
>
Thanks, will fix
Powered by blists - more mailing lists