net: myricom: myri10ge: use new api ethtool_{get|set}_link_ksettings
authorPhilippe Reynes <tremyfr@gmail.com>
Thu, 9 Feb 2017 22:17:23 +0000 (23:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Feb 2017 03:32:17 +0000 (22:32 -0500)
The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Acked-by: Hyong-Youb Kim <hykim@myri.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/myricom/myri10ge/myri10ge.c

index 1139d1803e7e483a72e4cc225207e68a5d61924a..b171ed2015fe479b6d7d099f14e188a3dd8cda00 100644 (file)
@@ -1610,15 +1610,16 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
 }
 
 static int
-myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
+myri10ge_get_link_ksettings(struct net_device *netdev,
+                           struct ethtool_link_ksettings *cmd)
 {
        struct myri10ge_priv *mgp = netdev_priv(netdev);
        char *ptr;
        int i;
 
-       cmd->autoneg = AUTONEG_DISABLE;
-       ethtool_cmd_speed_set(cmd, SPEED_10000);
-       cmd->duplex = DUPLEX_FULL;
+       cmd->base.autoneg = AUTONEG_DISABLE;
+       cmd->base.speed = SPEED_10000;
+       cmd->base.duplex = DUPLEX_FULL;
 
        /*
         * parse the product code to deterimine the interface type
@@ -1643,16 +1644,12 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
                ptr++;
        if (*ptr == 'R' || *ptr == 'Q' || *ptr == 'S') {
                /* We've found either an XFP, quad ribbon fiber, or SFP+ */
-               cmd->port = PORT_FIBRE;
-               cmd->supported |= SUPPORTED_FIBRE;
-               cmd->advertising |= ADVERTISED_FIBRE;
+               cmd->base.port = PORT_FIBRE;
+               ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);
+               ethtool_link_ksettings_add_link_mode(cmd, advertising, FIBRE);
        } else {
-               cmd->port = PORT_OTHER;
+               cmd->base.port = PORT_OTHER;
        }
-       if (*ptr == 'R' || *ptr == 'S')
-               cmd->transceiver = XCVR_EXTERNAL;
-       else
-               cmd->transceiver = XCVR_INTERNAL;
 
        return 0;
 }
@@ -1925,7 +1922,6 @@ myri10ge_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)
 }
 
 static const struct ethtool_ops myri10ge_ethtool_ops = {
-       .get_settings = myri10ge_get_settings,
        .get_drvinfo = myri10ge_get_drvinfo,
        .get_coalesce = myri10ge_get_coalesce,
        .set_coalesce = myri10ge_set_coalesce,
@@ -1939,6 +1935,7 @@ static const struct ethtool_ops myri10ge_ethtool_ops = {
        .set_msglevel = myri10ge_set_msglevel,
        .get_msglevel = myri10ge_get_msglevel,
        .set_phys_id = myri10ge_phys_id,
+       .get_link_ksettings = myri10ge_get_link_ksettings,
 };
 
 static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss)