Skip to content

Commit 1b604ef

Browse files
daniellertsdavem330
authored andcommitted
mlxsw: Set port split ability attribute in driver
Currently, port attributes like flavour, port number and whether the port was split are set when initializing a port. Set the split ability of the port as well, based on port_mapping->width field and split attribute of devlink port in spectrum, so that it could be easily passed to devlink in the next patch. Signed-off-by: Danielle Ratson <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a21cf0a commit 1b604ef

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

drivers/net/ethernet/mellanox/mlxsw/core.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ static int __mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
21222122
enum devlink_port_flavour flavour,
21232123
u32 port_number, bool split,
21242124
u32 split_port_subnumber,
2125-
u32 lanes,
2125+
bool splittable, u32 lanes,
21262126
const unsigned char *switch_id,
21272127
unsigned char switch_id_len)
21282128
{
@@ -2161,14 +2161,15 @@ static void __mlxsw_core_port_fini(struct mlxsw_core *mlxsw_core, u8 local_port)
21612161
int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
21622162
u32 port_number, bool split,
21632163
u32 split_port_subnumber,
2164-
u32 lanes,
2164+
bool splittable, u32 lanes,
21652165
const unsigned char *switch_id,
21662166
unsigned char switch_id_len)
21672167
{
21682168
return __mlxsw_core_port_init(mlxsw_core, local_port,
21692169
DEVLINK_PORT_FLAVOUR_PHYSICAL,
21702170
port_number, split, split_port_subnumber,
2171-
lanes, switch_id, switch_id_len);
2171+
splittable, lanes,
2172+
switch_id, switch_id_len);
21722173
}
21732174
EXPORT_SYMBOL(mlxsw_core_port_init);
21742175

@@ -2189,7 +2190,7 @@ int mlxsw_core_cpu_port_init(struct mlxsw_core *mlxsw_core,
21892190

21902191
err = __mlxsw_core_port_init(mlxsw_core, MLXSW_PORT_CPU_PORT,
21912192
DEVLINK_PORT_FLAVOUR_CPU,
2192-
0, false, 0, 0,
2193+
0, false, 0, false, 0,
21932194
switch_id, switch_id_len);
21942195
if (err)
21952196
return err;

drivers/net/ethernet/mellanox/mlxsw/core.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,8 @@ void mlxsw_core_lag_mapping_clear(struct mlxsw_core *mlxsw_core,
191191

192192
void *mlxsw_core_port_driver_priv(struct mlxsw_core_port *mlxsw_core_port);
193193
int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
194-
u32 port_number, bool split,
195-
u32 split_port_subnumber,
196-
u32 lanes,
194+
u32 port_number, bool split, u32 split_port_subnumber,
195+
bool splittable, u32 lanes,
197196
const unsigned char *switch_id,
198197
unsigned char switch_id_len);
199198
void mlxsw_core_port_fini(struct mlxsw_core *mlxsw_core, u8 local_port);

drivers/net/ethernet/mellanox/mlxsw/minimal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module)
164164
int err;
165165

166166
err = mlxsw_core_port_init(mlxsw_m->core, local_port,
167-
module + 1, false, 0, 0,
168-
mlxsw_m->base_mac,
167+
module + 1, false, 0, false,
168+
0, mlxsw_m->base_mac,
169169
sizeof(mlxsw_m->base_mac));
170170
if (err) {
171171
dev_err(mlxsw_m->bus_info->dev, "Port %d: Failed to init core port\n",

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1735,12 +1735,14 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
17351735
struct mlxsw_sp_port *mlxsw_sp_port;
17361736
u32 lanes = port_mapping->width;
17371737
struct net_device *dev;
1738+
bool splittable;
17381739
int err;
17391740

1741+
splittable = lanes > 1 && !split;
17401742
err = mlxsw_core_port_init(mlxsw_sp->core, local_port,
17411743
port_mapping->module + 1, split,
17421744
port_mapping->lane / lanes,
1743-
lanes,
1745+
splittable, lanes,
17441746
mlxsw_sp->base_mac,
17451747
sizeof(mlxsw_sp->base_mac));
17461748
if (err) {

drivers/net/ethernet/mellanox/mlxsw/switchib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int mlxsw_sib_port_create(struct mlxsw_sib *mlxsw_sib, u8 local_port,
281281
int err;
282282

283283
err = mlxsw_core_port_init(mlxsw_sib->core, local_port,
284-
module + 1, false, 0, 0,
284+
module + 1, false, 0, false, 0,
285285
mlxsw_sib->hw_id, sizeof(mlxsw_sib->hw_id));
286286
if (err) {
287287
dev_err(mlxsw_sib->bus_info->dev, "Port %d: Failed to init core port\n",

drivers/net/ethernet/mellanox/mlxsw/switchx2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ static int mlxsw_sx_port_eth_create(struct mlxsw_sx *mlxsw_sx, u8 local_port,
11071107
int err;
11081108

11091109
err = mlxsw_core_port_init(mlxsw_sx->core, local_port,
1110-
module + 1, false, 0, 0,
1110+
module + 1, false, 0, false, 0,
11111111
mlxsw_sx->hw_id, sizeof(mlxsw_sx->hw_id));
11121112
if (err) {
11131113
dev_err(mlxsw_sx->bus_info->dev, "Port %d: Failed to init core port\n",

0 commit comments

Comments
 (0)