]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlx4_en: fix WOL handlers were always looking at port2 capability bit
authorJoe Jin <joe.jin@oracle.com>
Thu, 15 Dec 2011 01:37:32 +0000 (09:37 +0800)
committerJoe Jin <joe.jin@oracle.com>
Thu, 15 Dec 2011 01:37:32 +0000 (09:37 +0800)
commit 559a9f1d354b577af28f84181751820ff7d29feb
Author: Oren Duer <oren@mellanox.co.il>
Date:   Sat Nov 26 19:55:15 2011 +0000

    net/mlx4_en: fix WOL handlers were always looking at port2 capability bit

    There are 2 capability bits for WOL, one for each port.
    WOL handlers were looking only on the second bit, regardless of the port.

Signed-off-by: Oren Duer <oren@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/mlx4/en_ethtool.c
include/linux/mlx4/device.h

index 74e2a2a8a02bb2e5b9af9d5bbaee623ac1b2e139..25440e91daa1b80b05e2fdc2138592c51d394e83 100644 (file)
@@ -103,8 +103,17 @@ static void mlx4_en_get_wol(struct net_device *netdev,
        struct mlx4_en_priv *priv = netdev_priv(netdev);
        int err = 0;
        u64 config = 0;
+       u64 mask;
 
-       if (!(priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_WOL)) {
+       if ((priv->port < 1) || (priv->port > 2)) {
+               en_err(priv, "Failed to get WoL information\n");
+               return;
+       }
+
+       mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 :
+               MLX4_DEV_CAP_FLAG_WOL_PORT2;
+
+       if (!(priv->mdev->dev->caps.flags & mask)) {
                wol->supported = 0;
                wol->wolopts = 0;
                return;
@@ -133,8 +142,15 @@ static int mlx4_en_set_wol(struct net_device *netdev,
        struct mlx4_en_priv *priv = netdev_priv(netdev);
        u64 config = 0;
        int err = 0;
+       u64 mask;
+
+       if ((priv->port < 1) || (priv->port > 2))
+               return -EOPNOTSUPP;
+
+       mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 :
+               MLX4_DEV_CAP_FLAG_WOL_PORT2;
 
-       if (!(priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_WOL))
+       if (!(priv->mdev->dev->caps.flags & mask))
                return -EOPNOTSUPP;
 
        if (wol->supported & ~WAKE_MAGIC)
index f898e1bddd088f70cc43c8124b064996a11e8fe3..1aae95fd92d17a5a40d15335cc652138a5b0ae4f 100644 (file)
@@ -76,7 +76,8 @@ enum {
        MLX4_DEV_CAP_FLAG_IBOE          = 1LL << 30,
        MLX4_DEV_CAP_FLAG_UC_LOOPBACK   = 1LL << 32,
        MLX4_DEV_CAP_FLAG_FCS_KEEP      = 1LL << 34,
-       MLX4_DEV_CAP_FLAG_WOL           = 1LL << 38,
+       MLX4_DEV_CAP_FLAG_WOL_PORT1     = 1LL << 37,
+       MLX4_DEV_CAP_FLAG_WOL_PORT2     = 1LL << 38,
        MLX4_DEV_CAP_FLAG_UDP_RSS       = 1LL << 40,
        MLX4_DEV_CAP_FLAG_VEP_UC_STEER  = 1LL << 41,
        MLX4_DEV_CAP_FLAG_VEP_MC_STEER  = 1LL << 42