diff options
author | Philippe Reynes <tremyfr@gmail.com> | 2017-01-31 01:04:42 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-31 21:10:45 +0300 |
commit | f8244ab55200dbe074380c3388804adff03a8a19 (patch) | |
tree | afcd30800e83aba917466b3ef4e350f33aa1caf3 /drivers/net/ethernet/aquantia/atlantic/aq_nic.c | |
parent | e9904990e8e70a51574e6ec6b872f3c705ec75f0 (diff) | |
download | linux-f8244ab55200dbe074380c3388804adff03a8a19.tar.xz |
net: aquantia: atlantic: 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.
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>
Tested-by: Pavel Belous <pavel.s.belous@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/aquantia/atlantic/aq_nic.c')
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index 84bb44186750..bed25abd2889 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -734,50 +734,65 @@ err_exit:; (void)err; } -void aq_nic_get_link_settings(struct aq_nic_s *self, struct ethtool_cmd *cmd) +void aq_nic_get_link_ksettings(struct aq_nic_s *self, + struct ethtool_link_ksettings *cmd) { - cmd->port = PORT_TP; - cmd->transceiver = XCVR_EXTERNAL; + u32 supported, advertising; + + cmd->base.port = PORT_TP; /* This driver supports only 10G capable adapters, so DUPLEX_FULL */ - cmd->duplex = DUPLEX_FULL; - cmd->autoneg = self->aq_nic_cfg.is_autoneg; + cmd->base.duplex = DUPLEX_FULL; + cmd->base.autoneg = self->aq_nic_cfg.is_autoneg; + + ethtool_convert_link_mode_to_legacy_u32(&supported, + cmd->link_modes.supported); + ethtool_convert_link_mode_to_legacy_u32(&advertising, + cmd->link_modes.advertising); - cmd->supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_10G) ? + supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_10G) ? ADVERTISED_10000baseT_Full : 0U; - cmd->supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_1G) ? + supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_1G) ? ADVERTISED_1000baseT_Full : 0U; - cmd->supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_100M) ? + supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_100M) ? ADVERTISED_100baseT_Full : 0U; - cmd->supported |= self->aq_hw_caps.flow_control ? SUPPORTED_Pause : 0; - cmd->supported |= SUPPORTED_Autoneg; + supported |= self->aq_hw_caps.flow_control ? SUPPORTED_Pause : 0; + supported |= SUPPORTED_Autoneg; + supported |= SUPPORTED_TP; - cmd->advertising = (self->aq_nic_cfg.is_autoneg) ? + advertising = (self->aq_nic_cfg.is_autoneg) ? ADVERTISED_Autoneg : 0U; - cmd->advertising |= + advertising |= (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_10G) ? ADVERTISED_10000baseT_Full : 0U; - cmd->advertising |= + advertising |= (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_1G) ? ADVERTISED_1000baseT_Full : 0U; - cmd->advertising |= + advertising |= (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_100M) ? ADVERTISED_100baseT_Full : 0U; - cmd->advertising |= (self->aq_nic_cfg.flow_control) ? + advertising |= (self->aq_nic_cfg.flow_control) ? ADVERTISED_Pause : 0U; + advertising |= ADVERTISED_TP; + + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, + supported); + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, + advertising); } -int aq_nic_set_link_settings(struct aq_nic_s *self, struct ethtool_cmd *cmd) +int aq_nic_set_link_ksettings(struct aq_nic_s *self, + const struct ethtool_link_ksettings *cmd) { u32 speed = 0U; u32 rate = 0U; int err = 0; - if (cmd->autoneg == AUTONEG_ENABLE) { + if (cmd->base.autoneg == AUTONEG_ENABLE) { rate = self->aq_hw_caps.link_speed_msk; self->aq_nic_cfg.is_autoneg = true; } else { - speed = ethtool_cmd_speed(cmd); + speed = cmd->base.speed; switch (speed) { case SPEED_100: |