aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoa Osherovich <noaos@mellanox.com>2016-06-02 03:47:53 -0400
committerLeon Romanovsky <leon@kernel.org>2016-08-18 11:49:52 -0400
commitd5beb7f2aff4a60237fd97a98d49a78c9045b8f2 (patch)
tree7b321d490a99f7829c6327ad08f48fd3969e8a5b
parent8cca30a7f914fe363fa9700715619ca5c8cb38cc (diff)
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>
-rw-r--r--drivers/infiniband/hw/mlx5/main.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/port.c32
-rw-r--r--include/linux/mlx5/port.h7
3 files changed, 28 insertions, 14 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 6fb77d791045..f02a975320bd 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -748,8 +748,7 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port,
748 &props->active_width); 748 &props->active_width);
749 if (err) 749 if (err)
750 goto out; 750 goto out;
751 err = mlx5_query_port_proto_oper(mdev, &props->active_speed, MLX5_PTYS_IB, 751 err = mlx5_query_port_ib_proto_oper(mdev, &props->active_speed, port);
752 port);
753 if (err) 752 if (err)
754 goto out; 753 goto out;
755 754
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
index 2ee28ad8f918..34e7184e23c9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
@@ -175,25 +175,39 @@ int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev,
175} 175}
176EXPORT_SYMBOL_GPL(mlx5_query_port_link_width_oper); 176EXPORT_SYMBOL_GPL(mlx5_query_port_link_width_oper);
177 177
178int mlx5_query_port_proto_oper(struct mlx5_core_dev *dev, 178int mlx5_query_port_eth_proto_oper(struct mlx5_core_dev *dev,
179 u8 *proto_oper, int proto_mask, 179 u32 *proto_oper, u8 local_port)
180 u8 local_port)
181{ 180{
182 u32 out[MLX5_ST_SZ_DW(ptys_reg)]; 181 u32 out[MLX5_ST_SZ_DW(ptys_reg)];
183 int err; 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 if (err) 186 if (err)
187 return err; 187 return err;
188 188
189 if (proto_mask == MLX5_PTYS_EN) 189 *proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper);
190 *proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper); 190
191 else 191 return 0;
192 *proto_oper = MLX5_GET(ptys_reg, out, ib_proto_oper); 192}
193EXPORT_SYMBOL(mlx5_query_port_eth_proto_oper);
194
195int 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);
193 207
194 return 0; 208 return 0;
195} 209}
196EXPORT_SYMBOL_GPL(mlx5_query_port_proto_oper); 210EXPORT_SYMBOL(mlx5_query_port_ib_proto_oper);
197 211
198int mlx5_set_port_ptys(struct mlx5_core_dev *dev, bool an_disable, 212int mlx5_set_port_ptys(struct mlx5_core_dev *dev, bool an_disable,
199 u32 proto_admin, int proto_mask) 213 u32 proto_admin, int proto_mask)
diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h
index 6f876a4770f6..b3065acd20b4 100644
--- a/include/linux/mlx5/port.h
+++ b/include/linux/mlx5/port.h
@@ -103,9 +103,10 @@ int mlx5_query_port_proto_admin(struct mlx5_core_dev *dev,
103 u32 *proto_admin, int proto_mask); 103 u32 *proto_admin, int proto_mask);
104int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev, 104int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev,
105 u8 *link_width_oper, u8 local_port); 105 u8 *link_width_oper, u8 local_port);
106int mlx5_query_port_proto_oper(struct mlx5_core_dev *dev, 106int mlx5_query_port_ib_proto_oper(struct mlx5_core_dev *dev,
107 u8 *proto_oper, int proto_mask, 107 u8 *proto_oper, u8 local_port);
108 u8 local_port); 108int mlx5_query_port_eth_proto_oper(struct mlx5_core_dev *dev,
109 u32 *proto_oper, u8 local_port);
109int mlx5_set_port_ptys(struct mlx5_core_dev *dev, bool an_disable, 110int mlx5_set_port_ptys(struct mlx5_core_dev *dev, bool an_disable,
110 u32 proto_admin, int proto_mask); 111 u32 proto_admin, int proto_mask);
111void mlx5_toggle_port_link(struct mlx5_core_dev *dev); 112void mlx5_toggle_port_link(struct mlx5_core_dev *dev);