Skip to content

Commit d5beb7f

Browse files
noaosrleon
authored andcommitted
net/mlx5: Separate query_port_proto_oper for IB and EN
Replaced mlx5_query_port_proto_oper with separate functions per link type. The functions should take different arguments so no point in trying to unite them. Signed-off-by: Noa Osherovich <[email protected]> Signed-off-by: Eran Ben Elisha <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 8cca30a commit d5beb7f

File tree

3 files changed

+28
-14
lines changed
  • drivers
    • infiniband/hw/mlx5
    • net/ethernet/mellanox/mlx5/core
  • include/linux/mlx5

3 files changed

+28
-14
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,7 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port,
748748
&props->active_width);
749749
if (err)
750750
goto out;
751-
err = mlx5_query_port_proto_oper(mdev, &props->active_speed, MLX5_PTYS_IB,
752-
port);
751+
err = mlx5_query_port_ib_proto_oper(mdev, &props->active_speed, port);
753752
if (err)
754753
goto out;
755754

drivers/net/ethernet/mellanox/mlx5/core/port.c

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,25 +175,39 @@ int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev,
175175
}
176176
EXPORT_SYMBOL_GPL(mlx5_query_port_link_width_oper);
177177

178-
int mlx5_query_port_proto_oper(struct mlx5_core_dev *dev,
179-
u8 *proto_oper, int proto_mask,
180-
u8 local_port)
178+
int mlx5_query_port_eth_proto_oper(struct mlx5_core_dev *dev,
179+
u32 *proto_oper, u8 local_port)
181180
{
182181
u32 out[MLX5_ST_SZ_DW(ptys_reg)];
183182
int err;
184183

185-
err = mlx5_query_port_ptys(dev, out, sizeof(out), proto_mask, local_port);
184+
err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN,
185+
local_port);
186186
if (err)
187187
return err;
188188

189-
if (proto_mask == MLX5_PTYS_EN)
190-
*proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper);
191-
else
192-
*proto_oper = MLX5_GET(ptys_reg, out, ib_proto_oper);
189+
*proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper);
190+
191+
return 0;
192+
}
193+
EXPORT_SYMBOL(mlx5_query_port_eth_proto_oper);
194+
195+
int mlx5_query_port_ib_proto_oper(struct mlx5_core_dev *dev,
196+
u8 *proto_oper, u8 local_port)
197+
{
198+
u32 out[MLX5_ST_SZ_DW(ptys_reg)];
199+
int err;
200+
201+
err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_IB,
202+
local_port);
203+
if (err)
204+
return err;
205+
206+
*proto_oper = MLX5_GET(ptys_reg, out, ib_proto_oper);
193207

194208
return 0;
195209
}
196-
EXPORT_SYMBOL_GPL(mlx5_query_port_proto_oper);
210+
EXPORT_SYMBOL(mlx5_query_port_ib_proto_oper);
197211

198212
int mlx5_set_port_ptys(struct mlx5_core_dev *dev, bool an_disable,
199213
u32 proto_admin, int proto_mask)

include/linux/mlx5/port.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ int mlx5_query_port_proto_admin(struct mlx5_core_dev *dev,
103103
u32 *proto_admin, int proto_mask);
104104
int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev,
105105
u8 *link_width_oper, u8 local_port);
106-
int mlx5_query_port_proto_oper(struct mlx5_core_dev *dev,
107-
u8 *proto_oper, int proto_mask,
108-
u8 local_port);
106+
int mlx5_query_port_ib_proto_oper(struct mlx5_core_dev *dev,
107+
u8 *proto_oper, u8 local_port);
108+
int mlx5_query_port_eth_proto_oper(struct mlx5_core_dev *dev,
109+
u32 *proto_oper, u8 local_port);
109110
int mlx5_set_port_ptys(struct mlx5_core_dev *dev, bool an_disable,
110111
u32 proto_admin, int proto_mask);
111112
void mlx5_toggle_port_link(struct mlx5_core_dev *dev);

0 commit comments

Comments
 (0)