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

net: emulex: benet: 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 88c513d4
...@@ -606,7 +606,8 @@ bool be_pause_supported(struct be_adapter *adapter) ...@@ -606,7 +606,8 @@ bool be_pause_supported(struct be_adapter *adapter)
false : true; false : true;
} }
static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) static int be_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
u8 link_status; u8 link_status;
...@@ -614,13 +615,14 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -614,13 +615,14 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
int status; int status;
u32 auto_speeds; u32 auto_speeds;
u32 fixed_speeds; u32 fixed_speeds;
u32 supported = 0, advertising = 0;
if (adapter->phy.link_speed < 0) { if (adapter->phy.link_speed < 0) {
status = be_cmd_link_status_query(adapter, &link_speed, status = be_cmd_link_status_query(adapter, &link_speed,
&link_status, 0); &link_status, 0);
if (!status) if (!status)
be_link_status_update(adapter, link_status); be_link_status_update(adapter, link_status);
ethtool_cmd_speed_set(ecmd, link_speed); cmd->base.speed = link_speed;
status = be_cmd_get_phy_info(adapter); status = be_cmd_get_phy_info(adapter);
if (!status) { if (!status) {
...@@ -629,58 +631,51 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -629,58 +631,51 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
be_cmd_query_cable_type(adapter); be_cmd_query_cable_type(adapter);
ecmd->supported = supported =
convert_to_et_setting(adapter, convert_to_et_setting(adapter,
auto_speeds | auto_speeds |
fixed_speeds); fixed_speeds);
ecmd->advertising = advertising =
convert_to_et_setting(adapter, auto_speeds); convert_to_et_setting(adapter, auto_speeds);
ecmd->port = be_get_port_type(adapter); cmd->base.port = be_get_port_type(adapter);
if (adapter->phy.auto_speeds_supported) { if (adapter->phy.auto_speeds_supported) {
ecmd->supported |= SUPPORTED_Autoneg; supported |= SUPPORTED_Autoneg;
ecmd->autoneg = AUTONEG_ENABLE; cmd->base.autoneg = AUTONEG_ENABLE;
ecmd->advertising |= ADVERTISED_Autoneg; advertising |= ADVERTISED_Autoneg;
} }
ecmd->supported |= SUPPORTED_Pause; supported |= SUPPORTED_Pause;
if (be_pause_supported(adapter)) if (be_pause_supported(adapter))
ecmd->advertising |= ADVERTISED_Pause; advertising |= ADVERTISED_Pause;
switch (adapter->phy.interface_type) {
case PHY_TYPE_KR_10GB:
case PHY_TYPE_KX4_10GB:
ecmd->transceiver = XCVR_INTERNAL;
break;
default:
ecmd->transceiver = XCVR_EXTERNAL;
break;
}
} else { } else {
ecmd->port = PORT_OTHER; cmd->base.port = PORT_OTHER;
ecmd->autoneg = AUTONEG_DISABLE; cmd->base.autoneg = AUTONEG_DISABLE;
ecmd->transceiver = XCVR_DUMMY1;
} }
/* Save for future use */ /* Save for future use */
adapter->phy.link_speed = ethtool_cmd_speed(ecmd); adapter->phy.link_speed = cmd->base.speed;
adapter->phy.port_type = ecmd->port; adapter->phy.port_type = cmd->base.port;
adapter->phy.transceiver = ecmd->transceiver; adapter->phy.autoneg = cmd->base.autoneg;
adapter->phy.autoneg = ecmd->autoneg; adapter->phy.advertising = advertising;
adapter->phy.advertising = ecmd->advertising; adapter->phy.supported = supported;
adapter->phy.supported = ecmd->supported;
} else { } else {
ethtool_cmd_speed_set(ecmd, adapter->phy.link_speed); cmd->base.speed = adapter->phy.link_speed;
ecmd->port = adapter->phy.port_type; cmd->base.port = adapter->phy.port_type;
ecmd->transceiver = adapter->phy.transceiver; cmd->base.autoneg = adapter->phy.autoneg;
ecmd->autoneg = adapter->phy.autoneg; advertising = adapter->phy.advertising;
ecmd->advertising = adapter->phy.advertising; supported = adapter->phy.supported;
ecmd->supported = adapter->phy.supported;
} }
ecmd->duplex = netif_carrier_ok(netdev) ? DUPLEX_FULL : DUPLEX_UNKNOWN; cmd->base.duplex = netif_carrier_ok(netdev) ?
ecmd->phy_address = adapter->port_num; DUPLEX_FULL : DUPLEX_UNKNOWN;
cmd->base.phy_address = adapter->port_num;
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
supported);
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
advertising);
return 0; return 0;
} }
...@@ -1399,7 +1394,6 @@ static int be_set_priv_flags(struct net_device *netdev, u32 flags) ...@@ -1399,7 +1394,6 @@ static int be_set_priv_flags(struct net_device *netdev, u32 flags)
} }
const struct ethtool_ops be_ethtool_ops = { const struct ethtool_ops be_ethtool_ops = {
.get_settings = be_get_settings,
.get_drvinfo = be_get_drvinfo, .get_drvinfo = be_get_drvinfo,
.get_wol = be_get_wol, .get_wol = be_get_wol,
.set_wol = be_set_wol, .set_wol = be_set_wol,
...@@ -1433,5 +1427,6 @@ const struct ethtool_ops be_ethtool_ops = { ...@@ -1433,5 +1427,6 @@ const struct ethtool_ops be_ethtool_ops = {
.get_channels = be_get_channels, .get_channels = be_get_channels,
.set_channels = be_set_channels, .set_channels = be_set_channels,
.get_module_info = be_get_module_info, .get_module_info = be_get_module_info,
.get_module_eeprom = be_get_module_eeprom .get_module_eeprom = be_get_module_eeprom,
.get_link_ksettings = be_get_link_ksettings,
}; };
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