Commit 36a19b29 authored by Philippe Reynes's avatar Philippe Reynes Committed by David S. Miller

net: ethernet: apm: xgene: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 971d3a44
...@@ -54,46 +54,59 @@ static void xgene_get_drvinfo(struct net_device *ndev, ...@@ -54,46 +54,59 @@ static void xgene_get_drvinfo(struct net_device *ndev,
sprintf(info->bus_info, "%s", pdev->name); sprintf(info->bus_info, "%s", pdev->name);
} }
static int xgene_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd) static int xgene_get_link_ksettings(struct net_device *ndev,
struct ethtool_link_ksettings *cmd)
{ {
struct xgene_enet_pdata *pdata = netdev_priv(ndev); struct xgene_enet_pdata *pdata = netdev_priv(ndev);
struct phy_device *phydev = ndev->phydev; struct phy_device *phydev = ndev->phydev;
u32 supported;
if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) { if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
if (phydev == NULL) if (phydev == NULL)
return -ENODEV; return -ENODEV;
return phy_ethtool_gset(phydev, cmd); return phy_ethtool_ksettings_get(phydev, cmd);
} else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { } else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) {
if (pdata->mdio_driver) { if (pdata->mdio_driver) {
if (!phydev) if (!phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_gset(phydev, cmd); return phy_ethtool_ksettings_get(phydev, cmd);
} }
cmd->supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg | supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg |
SUPPORTED_MII; SUPPORTED_MII;
cmd->advertising = cmd->supported; ethtool_convert_legacy_u32_to_link_mode(
ethtool_cmd_speed_set(cmd, SPEED_1000); cmd->link_modes.supported,
cmd->duplex = DUPLEX_FULL; supported);
cmd->port = PORT_MII; ethtool_convert_legacy_u32_to_link_mode(
cmd->transceiver = XCVR_INTERNAL; cmd->link_modes.advertising,
cmd->autoneg = AUTONEG_ENABLE; supported);
cmd->base.speed = SPEED_1000;
cmd->base.duplex = DUPLEX_FULL;
cmd->base.port = PORT_MII;
cmd->base.autoneg = AUTONEG_ENABLE;
} else { } else {
cmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE; supported = SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE;
cmd->advertising = cmd->supported; ethtool_convert_legacy_u32_to_link_mode(
ethtool_cmd_speed_set(cmd, SPEED_10000); cmd->link_modes.supported,
cmd->duplex = DUPLEX_FULL; supported);
cmd->port = PORT_FIBRE; ethtool_convert_legacy_u32_to_link_mode(
cmd->transceiver = XCVR_INTERNAL; cmd->link_modes.advertising,
cmd->autoneg = AUTONEG_DISABLE; supported);
cmd->base.speed = SPEED_10000;
cmd->base.duplex = DUPLEX_FULL;
cmd->base.port = PORT_FIBRE;
cmd->base.autoneg = AUTONEG_DISABLE;
} }
return 0; return 0;
} }
static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd) static int xgene_set_link_ksettings(struct net_device *ndev,
const struct ethtool_link_ksettings *cmd)
{ {
struct xgene_enet_pdata *pdata = netdev_priv(ndev); struct xgene_enet_pdata *pdata = netdev_priv(ndev);
struct phy_device *phydev = ndev->phydev; struct phy_device *phydev = ndev->phydev;
...@@ -102,7 +115,7 @@ static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd) ...@@ -102,7 +115,7 @@ static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
if (!phydev) if (!phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_sset(phydev, cmd); return phy_ethtool_ksettings_set(phydev, cmd);
} }
if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) {
...@@ -110,7 +123,7 @@ static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd) ...@@ -110,7 +123,7 @@ static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
if (!phydev) if (!phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_sset(phydev, cmd); return phy_ethtool_ksettings_set(phydev, cmd);
} }
} }
...@@ -152,12 +165,12 @@ static void xgene_get_ethtool_stats(struct net_device *ndev, ...@@ -152,12 +165,12 @@ static void xgene_get_ethtool_stats(struct net_device *ndev,
static const struct ethtool_ops xgene_ethtool_ops = { static const struct ethtool_ops xgene_ethtool_ops = {
.get_drvinfo = xgene_get_drvinfo, .get_drvinfo = xgene_get_drvinfo,
.get_settings = xgene_get_settings,
.set_settings = xgene_set_settings,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
.get_strings = xgene_get_strings, .get_strings = xgene_get_strings,
.get_sset_count = xgene_get_sset_count, .get_sset_count = xgene_get_sset_count,
.get_ethtool_stats = xgene_get_ethtool_stats .get_ethtool_stats = xgene_get_ethtool_stats,
.get_link_ksettings = xgene_get_link_ksettings,
.set_link_ksettings = xgene_set_link_ksettings,
}; };
void xgene_enet_set_ethtool_ops(struct net_device *ndev) void xgene_enet_set_ethtool_ops(struct net_device *ndev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment