staging: fsl-dpaa2/eth: Change link settings on the fly
authorIoana Radulescu <ruxandra.radulescu@nxp.com>
Fri, 23 Mar 2018 13:44:10 +0000 (08:44 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Mar 2018 15:01:56 +0000 (16:01 +0100)
Newer MC versions allow us to change link settings while the
interface is up. Only check interface status if we are using
an old version.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c

index dfbfa946aa3f150d25c0d2449d183d6b0ccb678f..bfc8b64169ca0b990e7cd3eb4678492e6412e567 100644 (file)
@@ -119,6 +119,8 @@ out:
        return err;
 }
 
+#define DPNI_DYNAMIC_LINK_SET_VER_MAJOR                7
+#define DPNI_DYNAMIC_LINK_SET_VER_MINOR                1
 static int
 dpaa2_eth_set_link_ksettings(struct net_device *net_dev,
                             const struct ethtool_link_ksettings *link_settings)
@@ -127,15 +129,16 @@ dpaa2_eth_set_link_ksettings(struct net_device *net_dev,
        struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
        int err = 0;
 
-       netdev_dbg(net_dev, "Setting link parameters...");
-
-       /* Due to a temporary MC limitation, the DPNI must be down
+       /* If using an older MC version, the DPNI must be down
         * in order to be able to change link settings. Taking steps to let
         * the user know that.
         */
-       if (netif_running(net_dev)) {
-               netdev_info(net_dev, "Sorry, interface must be brought down first.\n");
-               return -EACCES;
+       if (dpaa2_eth_cmp_dpni_ver(priv, DPNI_DYNAMIC_LINK_SET_VER_MAJOR,
+                                  DPNI_DYNAMIC_LINK_SET_VER_MINOR) < 0) {
+               if (netif_running(net_dev)) {
+                       netdev_info(net_dev, "Interface must be brought down first.\n");
+                       return -EACCES;
+               }
        }
 
        cfg.rate = link_settings->base.speed;