aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c20
-rw-r--r--include/linux/mlx4/device.h3
2 files changed, 20 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index ee637a200915..7dbc6a230779 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -106,8 +106,17 @@ static void mlx4_en_get_wol(struct net_device *netdev,
106 struct mlx4_en_priv *priv = netdev_priv(netdev); 106 struct mlx4_en_priv *priv = netdev_priv(netdev);
107 int err = 0; 107 int err = 0;
108 u64 config = 0; 108 u64 config = 0;
109 u64 mask;
109 110
110 if (!(priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_WOL)) { 111 if ((priv->port < 1) || (priv->port > 2)) {
112 en_err(priv, "Failed to get WoL information\n");
113 return;
114 }
115
116 mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 :
117 MLX4_DEV_CAP_FLAG_WOL_PORT2;
118
119 if (!(priv->mdev->dev->caps.flags & mask)) {
111 wol->supported = 0; 120 wol->supported = 0;
112 wol->wolopts = 0; 121 wol->wolopts = 0;
113 return; 122 return;
@@ -136,8 +145,15 @@ static int mlx4_en_set_wol(struct net_device *netdev,
136 struct mlx4_en_priv *priv = netdev_priv(netdev); 145 struct mlx4_en_priv *priv = netdev_priv(netdev);
137 u64 config = 0; 146 u64 config = 0;
138 int err = 0; 147 int err = 0;
148 u64 mask;
149
150 if ((priv->port < 1) || (priv->port > 2))
151 return -EOPNOTSUPP;
152
153 mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 :
154 MLX4_DEV_CAP_FLAG_WOL_PORT2;
139 155
140 if (!(priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_WOL)) 156 if (!(priv->mdev->dev->caps.flags & mask))
141 return -EOPNOTSUPP; 157 return -EOPNOTSUPP;
142 158
143 if (wol->supported & ~WAKE_MAGIC) 159 if (wol->supported & ~WAKE_MAGIC)
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 84b0b1848f17..ca2c39771c38 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -77,7 +77,8 @@ enum {
77 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30, 77 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30,
78 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32, 78 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32,
79 MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34, 79 MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34,
80 MLX4_DEV_CAP_FLAG_WOL = 1LL << 38, 80 MLX4_DEV_CAP_FLAG_WOL_PORT1 = 1LL << 37,
81 MLX4_DEV_CAP_FLAG_WOL_PORT2 = 1LL << 38,
81 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40, 82 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40,
82 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 83 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
83 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 84 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,