mlxsw: spectrum: Fix handling of resource_size_param
authorJiri Pirko <jiri@mellanox.com>
Wed, 28 Feb 2018 12:12:09 +0000 (13:12 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Feb 2018 17:32:36 +0000 (12:32 -0500)
commit77d270967c5f723e5910dd073962b6372d7ef466
treecf9ff25bb8ba0eeb1d783da2baeb0f96843ed566
parent2ddc94c76cc4ccaf51b478315912b38dfdde1afc
mlxsw: spectrum: Fix handling of resource_size_param

Current code uses global variables, adjusts them and passes pointer down
to devlink. With every other mlxsw_core instance, the previously passed
pointer values are rewritten. Fix this by de-globalize the variables and
also memcpy size_params during devlink resource registration.
Also, introduce a convenient size_param_init helper.

Fixes: ef3116e5403e ("mlxsw: spectrum: Register KVD resources with devlink")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
include/net/devlink.h
net/core/devlink.c