Commit cdf29f4a authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

mlxsw: Pass switch ID through devlink_port_attrs_set()

Pass the switch ID down the to devlink through devlink_port_attrs_set()
so it can be used by devlink_compat_switch_id_get().
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7e1146e8
...@@ -1720,7 +1720,9 @@ EXPORT_SYMBOL(mlxsw_core_res_get); ...@@ -1720,7 +1720,9 @@ EXPORT_SYMBOL(mlxsw_core_res_get);
int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port, int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
u32 port_number, bool split, u32 port_number, bool split,
u32 split_port_subnumber) u32 split_port_subnumber,
const unsigned char *switch_id,
unsigned char switch_id_len)
{ {
struct devlink *devlink = priv_to_devlink(mlxsw_core); struct devlink *devlink = priv_to_devlink(mlxsw_core);
struct mlxsw_core_port *mlxsw_core_port = struct mlxsw_core_port *mlxsw_core_port =
...@@ -1731,7 +1733,7 @@ int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port, ...@@ -1731,7 +1733,7 @@ int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
mlxsw_core_port->local_port = local_port; mlxsw_core_port->local_port = local_port;
devlink_port_attrs_set(devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, devlink_port_attrs_set(devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
port_number, split, split_port_subnumber, port_number, split, split_port_subnumber,
NULL, 0); switch_id, switch_id_len);
err = devlink_port_register(devlink, devlink_port, local_port); err = devlink_port_register(devlink, devlink_port, local_port);
if (err) if (err)
memset(mlxsw_core_port, 0, sizeof(*mlxsw_core_port)); memset(mlxsw_core_port, 0, sizeof(*mlxsw_core_port));
......
...@@ -166,7 +166,9 @@ void mlxsw_core_lag_mapping_clear(struct mlxsw_core *mlxsw_core, ...@@ -166,7 +166,9 @@ void mlxsw_core_lag_mapping_clear(struct mlxsw_core *mlxsw_core,
void *mlxsw_core_port_driver_priv(struct mlxsw_core_port *mlxsw_core_port); void *mlxsw_core_port_driver_priv(struct mlxsw_core_port *mlxsw_core_port);
int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port, int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
u32 port_number, bool split, u32 port_number, bool split,
u32 split_port_subnumber); u32 split_port_subnumber,
const unsigned char *switch_id,
unsigned char switch_id_len);
void mlxsw_core_port_fini(struct mlxsw_core *mlxsw_core, u8 local_port); void mlxsw_core_port_fini(struct mlxsw_core *mlxsw_core, u8 local_port);
void mlxsw_core_port_eth_set(struct mlxsw_core *mlxsw_core, u8 local_port, void mlxsw_core_port_eth_set(struct mlxsw_core *mlxsw_core, u8 local_port,
void *port_driver_priv, struct net_device *dev); void *port_driver_priv, struct net_device *dev);
......
...@@ -151,7 +151,9 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module) ...@@ -151,7 +151,9 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module)
int err; int err;
err = mlxsw_core_port_init(mlxsw_m->core, local_port, err = mlxsw_core_port_init(mlxsw_m->core, local_port,
module + 1, false, 0); module + 1, false, 0,
mlxsw_m->base_mac,
sizeof(mlxsw_m->base_mac));
if (err) { if (err) {
dev_err(mlxsw_m->bus_info->dev, "Port %d: Failed to init core port\n", dev_err(mlxsw_m->bus_info->dev, "Port %d: Failed to init core port\n",
local_port); local_port);
......
...@@ -3392,7 +3392,9 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, ...@@ -3392,7 +3392,9 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
int err; int err;
err = mlxsw_core_port_init(mlxsw_sp->core, local_port, err = mlxsw_core_port_init(mlxsw_sp->core, local_port,
module + 1, split, lane / width); module + 1, split, lane / width,
mlxsw_sp->base_mac,
sizeof(mlxsw_sp->base_mac));
if (err) { if (err) {
dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to init core port\n", dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to init core port\n",
local_port); local_port);
......
...@@ -268,7 +268,7 @@ static int mlxsw_sib_port_create(struct mlxsw_sib *mlxsw_sib, u8 local_port, ...@@ -268,7 +268,7 @@ static int mlxsw_sib_port_create(struct mlxsw_sib *mlxsw_sib, u8 local_port,
int err; int err;
err = mlxsw_core_port_init(mlxsw_sib->core, local_port, err = mlxsw_core_port_init(mlxsw_sib->core, local_port,
module + 1, false, 0); module + 1, false, 0, NULL, 0);
if (err) { if (err) {
dev_err(mlxsw_sib->bus_info->dev, "Port %d: Failed to init core port\n", dev_err(mlxsw_sib->bus_info->dev, "Port %d: Failed to init core port\n",
local_port); local_port);
......
...@@ -1128,7 +1128,8 @@ static int mlxsw_sx_port_eth_create(struct mlxsw_sx *mlxsw_sx, u8 local_port, ...@@ -1128,7 +1128,8 @@ static int mlxsw_sx_port_eth_create(struct mlxsw_sx *mlxsw_sx, u8 local_port,
int err; int err;
err = mlxsw_core_port_init(mlxsw_sx->core, local_port, err = mlxsw_core_port_init(mlxsw_sx->core, local_port,
module + 1, false, 0); module + 1, false, 0,
mlxsw_sx->hw_id, sizeof(mlxsw_sx->hw_id));
if (err) { if (err) {
dev_err(mlxsw_sx->bus_info->dev, "Port %d: Failed to init core port\n", dev_err(mlxsw_sx->bus_info->dev, "Port %d: Failed to init core port\n",
local_port); local_port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment