IB/nes: 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: Philippe Reynes <tremyfr@gmail.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:

committed by
Doug Ledford

parent
def4a6ffc9
commit
24dc08c3c9
@@ -1465,7 +1465,8 @@ static int nes_netdev_set_pauseparam(struct net_device *netdev,
|
|||||||
/**
|
/**
|
||||||
* nes_netdev_get_settings
|
* nes_netdev_get_settings
|
||||||
*/
|
*/
|
||||||
static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd *et_cmd)
|
static int nes_netdev_get_link_ksettings(struct net_device *netdev,
|
||||||
|
struct ethtool_link_ksettings *cmd)
|
||||||
{
|
{
|
||||||
struct nes_vnic *nesvnic = netdev_priv(netdev);
|
struct nes_vnic *nesvnic = netdev_priv(netdev);
|
||||||
struct nes_device *nesdev = nesvnic->nesdev;
|
struct nes_device *nesdev = nesvnic->nesdev;
|
||||||
@@ -1474,54 +1475,59 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
|
|||||||
u8 phy_type = nesadapter->phy_type[mac_index];
|
u8 phy_type = nesadapter->phy_type[mac_index];
|
||||||
u8 phy_index = nesadapter->phy_index[mac_index];
|
u8 phy_index = nesadapter->phy_index[mac_index];
|
||||||
u16 phy_data;
|
u16 phy_data;
|
||||||
|
u32 supported, advertising;
|
||||||
|
|
||||||
et_cmd->duplex = DUPLEX_FULL;
|
cmd->base.duplex = DUPLEX_FULL;
|
||||||
et_cmd->port = PORT_MII;
|
cmd->base.port = PORT_MII;
|
||||||
et_cmd->maxtxpkt = 511;
|
|
||||||
et_cmd->maxrxpkt = 511;
|
|
||||||
|
|
||||||
if (nesadapter->OneG_Mode) {
|
if (nesadapter->OneG_Mode) {
|
||||||
ethtool_cmd_speed_set(et_cmd, SPEED_1000);
|
cmd->base.speed = SPEED_1000;
|
||||||
if (phy_type == NES_PHY_TYPE_PUMA_1G) {
|
if (phy_type == NES_PHY_TYPE_PUMA_1G) {
|
||||||
et_cmd->supported = SUPPORTED_1000baseT_Full;
|
supported = SUPPORTED_1000baseT_Full;
|
||||||
et_cmd->advertising = ADVERTISED_1000baseT_Full;
|
advertising = ADVERTISED_1000baseT_Full;
|
||||||
et_cmd->autoneg = AUTONEG_DISABLE;
|
cmd->base.autoneg = AUTONEG_DISABLE;
|
||||||
et_cmd->transceiver = XCVR_INTERNAL;
|
cmd->base.phy_address = mac_index;
|
||||||
et_cmd->phy_address = mac_index;
|
|
||||||
} else {
|
} else {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
et_cmd->supported = SUPPORTED_1000baseT_Full
|
|
||||||
|
supported = SUPPORTED_1000baseT_Full
|
||||||
| SUPPORTED_Autoneg;
|
| SUPPORTED_Autoneg;
|
||||||
et_cmd->advertising = ADVERTISED_1000baseT_Full
|
advertising = ADVERTISED_1000baseT_Full
|
||||||
| ADVERTISED_Autoneg;
|
| ADVERTISED_Autoneg;
|
||||||
spin_lock_irqsave(&nesadapter->phy_lock, flags);
|
spin_lock_irqsave(&nesadapter->phy_lock, flags);
|
||||||
nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data);
|
nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data);
|
||||||
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
|
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
|
||||||
if (phy_data & 0x1000)
|
if (phy_data & 0x1000)
|
||||||
et_cmd->autoneg = AUTONEG_ENABLE;
|
cmd->base.autoneg = AUTONEG_ENABLE;
|
||||||
else
|
else
|
||||||
et_cmd->autoneg = AUTONEG_DISABLE;
|
cmd->base.autoneg = AUTONEG_DISABLE;
|
||||||
et_cmd->transceiver = XCVR_EXTERNAL;
|
cmd->base.phy_address = phy_index;
|
||||||
et_cmd->phy_address = phy_index;
|
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
if ((phy_type == NES_PHY_TYPE_ARGUS) ||
|
if ((phy_type == NES_PHY_TYPE_ARGUS) ||
|
||||||
(phy_type == NES_PHY_TYPE_SFP_D) ||
|
(phy_type == NES_PHY_TYPE_SFP_D) ||
|
||||||
(phy_type == NES_PHY_TYPE_KR)) {
|
(phy_type == NES_PHY_TYPE_KR)) {
|
||||||
et_cmd->transceiver = XCVR_EXTERNAL;
|
cmd->base.port = PORT_FIBRE;
|
||||||
et_cmd->port = PORT_FIBRE;
|
supported = SUPPORTED_FIBRE;
|
||||||
et_cmd->supported = SUPPORTED_FIBRE;
|
advertising = ADVERTISED_FIBRE;
|
||||||
et_cmd->advertising = ADVERTISED_FIBRE;
|
cmd->base.phy_address = phy_index;
|
||||||
et_cmd->phy_address = phy_index;
|
|
||||||
} else {
|
} else {
|
||||||
et_cmd->transceiver = XCVR_INTERNAL;
|
supported = SUPPORTED_10000baseT_Full;
|
||||||
et_cmd->supported = SUPPORTED_10000baseT_Full;
|
advertising = ADVERTISED_10000baseT_Full;
|
||||||
et_cmd->advertising = ADVERTISED_10000baseT_Full;
|
cmd->base.phy_address = mac_index;
|
||||||
et_cmd->phy_address = mac_index;
|
|
||||||
}
|
}
|
||||||
ethtool_cmd_speed_set(et_cmd, SPEED_10000);
|
cmd->base.speed = SPEED_10000;
|
||||||
et_cmd->autoneg = AUTONEG_DISABLE;
|
cmd->base.autoneg = AUTONEG_DISABLE;
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1529,7 +1535,9 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
|
|||||||
/**
|
/**
|
||||||
* nes_netdev_set_settings
|
* nes_netdev_set_settings
|
||||||
*/
|
*/
|
||||||
static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd *et_cmd)
|
static int
|
||||||
|
nes_netdev_set_link_ksettings(struct net_device *netdev,
|
||||||
|
const struct ethtool_link_ksettings *cmd)
|
||||||
{
|
{
|
||||||
struct nes_vnic *nesvnic = netdev_priv(netdev);
|
struct nes_vnic *nesvnic = netdev_priv(netdev);
|
||||||
struct nes_device *nesdev = nesvnic->nesdev;
|
struct nes_device *nesdev = nesvnic->nesdev;
|
||||||
@@ -1543,7 +1551,7 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd
|
|||||||
|
|
||||||
spin_lock_irqsave(&nesadapter->phy_lock, flags);
|
spin_lock_irqsave(&nesadapter->phy_lock, flags);
|
||||||
nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data);
|
nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data);
|
||||||
if (et_cmd->autoneg) {
|
if (cmd->base.autoneg) {
|
||||||
/* Turn on Full duplex, Autoneg, and restart autonegotiation */
|
/* Turn on Full duplex, Autoneg, and restart autonegotiation */
|
||||||
phy_data |= 0x1300;
|
phy_data |= 0x1300;
|
||||||
} else {
|
} else {
|
||||||
@@ -1560,8 +1568,6 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd
|
|||||||
|
|
||||||
static const struct ethtool_ops nes_ethtool_ops = {
|
static const struct ethtool_ops nes_ethtool_ops = {
|
||||||
.get_link = ethtool_op_get_link,
|
.get_link = ethtool_op_get_link,
|
||||||
.get_settings = nes_netdev_get_settings,
|
|
||||||
.set_settings = nes_netdev_set_settings,
|
|
||||||
.get_strings = nes_netdev_get_strings,
|
.get_strings = nes_netdev_get_strings,
|
||||||
.get_sset_count = nes_netdev_get_sset_count,
|
.get_sset_count = nes_netdev_get_sset_count,
|
||||||
.get_ethtool_stats = nes_netdev_get_ethtool_stats,
|
.get_ethtool_stats = nes_netdev_get_ethtool_stats,
|
||||||
@@ -1570,6 +1576,8 @@ static const struct ethtool_ops nes_ethtool_ops = {
|
|||||||
.set_coalesce = nes_netdev_set_coalesce,
|
.set_coalesce = nes_netdev_set_coalesce,
|
||||||
.get_pauseparam = nes_netdev_get_pauseparam,
|
.get_pauseparam = nes_netdev_get_pauseparam,
|
||||||
.set_pauseparam = nes_netdev_set_pauseparam,
|
.set_pauseparam = nes_netdev_set_pauseparam,
|
||||||
|
.get_link_ksettings = nes_netdev_get_link_ksettings,
|
||||||
|
.set_link_ksettings = nes_netdev_set_link_ksettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, netdev_features_t features)
|
static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, netdev_features_t features)
|
||||||
|
Reference in New Issue
Block a user