]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlx4_core: Avoid setting ports for auto when only one port type is supported
authorMoshe Lazer <moshel@mellanox.com>
Sun, 28 Apr 2013 14:19:17 +0000 (17:19 +0300)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:11 +0000 (14:45 -0700)
When only one port type is supported driver should reject requests
to change mode to auto sense.

Signed-off-by: Moshe Lazer <moshel@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/net/ethernet/mellanox/mlx4/main.c

index cd70f679facc517d9bb296c86d8161da1042a871..49f154375cbc6875a170395f8f78c5a17fc260da 100644 (file)
@@ -1134,6 +1134,13 @@ static ssize_t set_port_type(struct device *dev,
                goto err_out;
        }
 
+       if ((info->tmp_type & mdev->caps.supported_type[info->port]) !=
+           info->tmp_type) {
+               mlx4_err(mdev, "Requested port type for port %d is not supported on this HCA\n",
+                        info->port);
+               return -EINVAL;
+       }
+
        mlx4_stop_sense(mdev);
        mutex_lock(&priv->port_mutex);
        /* Possible type is always the one that was delivered */