Skip to content

Commit 622d3e9

Browse files
daniellertsdavem330
authored andcommitted
mlxsw: Set number of port lanes attribute in driver
Currently, port attributes like flavour, port number and whether the port was split are set when initializing a port. Set the number of lanes of the port as well 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 71ad8d5 commit 622d3e9

File tree

6 files changed

+11
-6
lines changed

6 files changed

+11
-6
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,6 +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,
21252126
const unsigned char *switch_id,
21262127
unsigned char switch_id_len)
21272128
{
@@ -2159,13 +2160,14 @@ static void __mlxsw_core_port_fini(struct mlxsw_core *mlxsw_core, u8 local_port)
21592160
int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
21602161
u32 port_number, bool split,
21612162
u32 split_port_subnumber,
2163+
u32 lanes,
21622164
const unsigned char *switch_id,
21632165
unsigned char switch_id_len)
21642166
{
21652167
return __mlxsw_core_port_init(mlxsw_core, local_port,
21662168
DEVLINK_PORT_FLAVOUR_PHYSICAL,
21672169
port_number, split, split_port_subnumber,
2168-
switch_id, switch_id_len);
2170+
lanes, switch_id, switch_id_len);
21692171
}
21702172
EXPORT_SYMBOL(mlxsw_core_port_init);
21712173

@@ -2186,7 +2188,7 @@ int mlxsw_core_cpu_port_init(struct mlxsw_core *mlxsw_core,
21862188

21872189
err = __mlxsw_core_port_init(mlxsw_core, MLXSW_PORT_CPU_PORT,
21882190
DEVLINK_PORT_FLAVOUR_CPU,
2189-
0, false, 0,
2191+
0, false, 0, 0,
21902192
switch_id, switch_id_len);
21912193
if (err)
21922194
return err;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ 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,
194194
u32 port_number, bool split,
195195
u32 split_port_subnumber,
196+
u32 lanes,
196197
const unsigned char *switch_id,
197198
unsigned char switch_id_len);
198199
void mlxsw_core_port_fini(struct mlxsw_core *mlxsw_core, u8 local_port);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ 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,
167+
module + 1, false, 0, 0,
168168
mlxsw_m->base_mac,
169169
sizeof(mlxsw_m->base_mac));
170170
if (err) {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,12 +1733,14 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
17331733
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
17341734
bool split = !!split_base_local_port;
17351735
struct mlxsw_sp_port *mlxsw_sp_port;
1736+
u32 lanes = port_mapping->width;
17361737
struct net_device *dev;
17371738
int err;
17381739

17391740
err = mlxsw_core_port_init(mlxsw_sp->core, local_port,
17401741
port_mapping->module + 1, split,
1741-
port_mapping->lane / port_mapping->width,
1742+
port_mapping->lane / lanes,
1743+
lanes,
17421744
mlxsw_sp->base_mac,
17431745
sizeof(mlxsw_sp->base_mac));
17441746
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,
284+
module + 1, false, 0, 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,
1110+
module + 1, false, 0, 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)