Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <noaos@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Noa Osherovich and committed by
Leon Romanovsky
d5beb7f2 8cca30a7

+28 -14
+1 -2
drivers/infiniband/hw/mlx5/main.c
··· 748 748 &props->active_width); 749 749 if (err) 750 750 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); 753 752 if (err) 754 753 goto out; 755 754
+23 -9
drivers/net/ethernet/mellanox/mlx5/core/port.c
··· 175 175 } 176 176 EXPORT_SYMBOL_GPL(mlx5_query_port_link_width_oper); 177 177 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) 181 180 { 182 181 u32 out[MLX5_ST_SZ_DW(ptys_reg)]; 183 182 int err; 184 183 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); 186 186 if (err) 187 187 return err; 188 188 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); 193 190 194 191 return 0; 195 192 } 196 - EXPORT_SYMBOL_GPL(mlx5_query_port_proto_oper); 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); 207 + 208 + return 0; 209 + } 210 + EXPORT_SYMBOL(mlx5_query_port_ib_proto_oper); 197 211 198 212 int mlx5_set_port_ptys(struct mlx5_core_dev *dev, bool an_disable, 199 213 u32 proto_admin, int proto_mask)
+4 -3
include/linux/mlx5/port.h
··· 103 103 u32 *proto_admin, int proto_mask); 104 104 int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev, 105 105 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); 109 110 int mlx5_set_port_ptys(struct mlx5_core_dev *dev, bool an_disable, 110 111 u32 proto_admin, int proto_mask); 111 112 void mlx5_toggle_port_link(struct mlx5_core_dev *dev);