aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGal Pressman <galp@mellanox.com>2016-04-24 15:51:53 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-26 15:58:02 -0400
commitda54d24ec3ef736de04c61a01653776a9750334f (patch)
treed016f1fa4ac3c6049bcb0b682f0f8ab6979e156a
parent94cb1ebbafd509210887eea6ced55c40da7b4baa (diff)
net/mlx5e: Add ethtool support for interface identify (LED blinking)
Add the needed hardware command and mlx5_ifc structs for managing LED control. Add set_phys_id ethtool callback to support ethtool -p flag. Signed-off-by: Gal Pressman <galp@mellanox.com> Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c25
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/port.c13
-rw-r--r--include/linux/mlx5/driver.h1
-rw-r--r--include/linux/mlx5/port.h6
4 files changed, 45 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 522d584bc05f..a2c444ec191b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1135,6 +1135,30 @@ static int mlx5e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1135 return mlx5_set_port_wol(mdev, mlx5_wol_mode); 1135 return mlx5_set_port_wol(mdev, mlx5_wol_mode);
1136} 1136}
1137 1137
1138static int mlx5e_set_phys_id(struct net_device *dev,
1139 enum ethtool_phys_id_state state)
1140{
1141 struct mlx5e_priv *priv = netdev_priv(dev);
1142 struct mlx5_core_dev *mdev = priv->mdev;
1143 u16 beacon_duration;
1144
1145 if (!MLX5_CAP_GEN(mdev, beacon_led))
1146 return -EOPNOTSUPP;
1147
1148 switch (state) {
1149 case ETHTOOL_ID_ACTIVE:
1150 beacon_duration = MLX5_BEACON_DURATION_INF;
1151 break;
1152 case ETHTOOL_ID_INACTIVE:
1153 beacon_duration = MLX5_BEACON_DURATION_OFF;
1154 break;
1155 default:
1156 return -EOPNOTSUPP;
1157 }
1158
1159 return mlx5_set_port_beacon(mdev, beacon_duration);
1160}
1161
1138const struct ethtool_ops mlx5e_ethtool_ops = { 1162const struct ethtool_ops mlx5e_ethtool_ops = {
1139 .get_drvinfo = mlx5e_get_drvinfo, 1163 .get_drvinfo = mlx5e_get_drvinfo,
1140 .get_link = ethtool_op_get_link, 1164 .get_link = ethtool_op_get_link,
@@ -1159,6 +1183,7 @@ const struct ethtool_ops mlx5e_ethtool_ops = {
1159 .get_pauseparam = mlx5e_get_pauseparam, 1183 .get_pauseparam = mlx5e_get_pauseparam,
1160 .set_pauseparam = mlx5e_set_pauseparam, 1184 .set_pauseparam = mlx5e_set_pauseparam,
1161 .get_ts_info = mlx5e_get_ts_info, 1185 .get_ts_info = mlx5e_get_ts_info,
1186 .set_phys_id = mlx5e_set_phys_id,
1162 .get_wol = mlx5e_get_wol, 1187 .get_wol = mlx5e_get_wol,
1163 .set_wol = mlx5e_set_wol, 1188 .set_wol = mlx5e_set_wol,
1164}; 1189};
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
index c37740f30fbe..446549f63b5c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
@@ -115,6 +115,19 @@ int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
115} 115}
116EXPORT_SYMBOL_GPL(mlx5_query_port_ptys); 116EXPORT_SYMBOL_GPL(mlx5_query_port_ptys);
117 117
118int mlx5_set_port_beacon(struct mlx5_core_dev *dev, u16 beacon_duration)
119{
120 u32 out[MLX5_ST_SZ_DW(mlcr_reg)];
121 u32 in[MLX5_ST_SZ_DW(mlcr_reg)];
122
123 memset(in, 0, sizeof(in));
124 MLX5_SET(mlcr_reg, in, local_port, 1);
125 MLX5_SET(mlcr_reg, in, beacon_duration, beacon_duration);
126
127 return mlx5_core_access_reg(dev, in, sizeof(in), out,
128 sizeof(out), MLX5_REG_MLCR, 0, 1);
129}
130
118int mlx5_query_port_proto_cap(struct mlx5_core_dev *dev, 131int mlx5_query_port_proto_cap(struct mlx5_core_dev *dev,
119 u32 *proto_cap, int proto_mask) 132 u32 *proto_cap, int proto_mask)
120{ 133{
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 497a4dbd91b0..2e8758d1b19e 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -116,6 +116,7 @@ enum {
116 MLX5_REG_PMLP = 0, /* TBD */ 116 MLX5_REG_PMLP = 0, /* TBD */
117 MLX5_REG_NODE_DESC = 0x6001, 117 MLX5_REG_NODE_DESC = 0x6001,
118 MLX5_REG_HOST_ENDIANNESS = 0x7004, 118 MLX5_REG_HOST_ENDIANNESS = 0x7004,
119 MLX5_REG_MLCR = 0x902b,
119}; 120};
120 121
121enum { 122enum {
diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h
index 577e953d0aa7..a364ab1737a0 100644
--- a/include/linux/mlx5/port.h
+++ b/include/linux/mlx5/port.h
@@ -35,6 +35,11 @@
35 35
36#include <linux/mlx5/driver.h> 36#include <linux/mlx5/driver.h>
37 37
38enum mlx5_beacon_duration {
39 MLX5_BEACON_DURATION_OFF = 0x0,
40 MLX5_BEACON_DURATION_INF = 0xffff,
41};
42
38int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps); 43int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
39int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys, 44int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
40 int ptys_size, int proto_mask, u8 local_port); 45 int ptys_size, int proto_mask, u8 local_port);
@@ -53,6 +58,7 @@ int mlx5_set_port_admin_status(struct mlx5_core_dev *dev,
53 enum mlx5_port_status status); 58 enum mlx5_port_status status);
54int mlx5_query_port_admin_status(struct mlx5_core_dev *dev, 59int mlx5_query_port_admin_status(struct mlx5_core_dev *dev,
55 enum mlx5_port_status *status); 60 enum mlx5_port_status *status);
61int mlx5_set_port_beacon(struct mlx5_core_dev *dev, u16 beacon_duration);
56 62
57int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port); 63int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port);
58void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, u8 port); 64void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, u8 port);