Commit 1876749d authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: refresh port state before reporting autonegotiation

State of autonegotiation may have changed but is not yet refreshed.
Make sure ethtool respects the NFP_PORT_CHANGED flag when looking
at autoneg.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46b25031
...@@ -209,7 +209,7 @@ nfp_net_get_link_ksettings(struct net_device *netdev, ...@@ -209,7 +209,7 @@ nfp_net_get_link_ksettings(struct net_device *netdev,
cmd->base.duplex = DUPLEX_UNKNOWN; cmd->base.duplex = DUPLEX_UNKNOWN;
port = nfp_port_from_netdev(netdev); port = nfp_port_from_netdev(netdev);
eth_port = __nfp_port_get_eth_port(port); eth_port = nfp_port_get_eth_port(port);
if (eth_port) if (eth_port)
cmd->base.autoneg = eth_port->aneg != NFP_ANEG_DISABLED ? cmd->base.autoneg = eth_port->aneg != NFP_ANEG_DISABLED ?
AUTONEG_ENABLE : AUTONEG_DISABLE; AUTONEG_ENABLE : AUTONEG_DISABLE;
...@@ -219,14 +219,6 @@ nfp_net_get_link_ksettings(struct net_device *netdev, ...@@ -219,14 +219,6 @@ nfp_net_get_link_ksettings(struct net_device *netdev,
/* Use link speed from ETH table if available, otherwise try the BAR */ /* Use link speed from ETH table if available, otherwise try the BAR */
if (eth_port) { if (eth_port) {
int err;
if (test_bit(NFP_PORT_CHANGED, &port->flags)) {
err = nfp_net_refresh_eth_port(port);
if (err)
return err;
}
cmd->base.port = eth_port->port_type; cmd->base.port = eth_port->port_type;
cmd->base.speed = eth_port->speed; cmd->base.speed = eth_port->speed;
cmd->base.duplex = DUPLEX_FULL; cmd->base.duplex = DUPLEX_FULL;
......
...@@ -58,6 +58,18 @@ struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port) ...@@ -58,6 +58,18 @@ struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port)
return port->eth_port; return port->eth_port;
} }
struct nfp_eth_table_port *nfp_port_get_eth_port(struct nfp_port *port)
{
if (!__nfp_port_get_eth_port(port))
return NULL;
if (test_bit(NFP_PORT_CHANGED, &port->flags))
if (nfp_net_refresh_eth_port(port))
return NULL;
return __nfp_port_get_eth_port(port);
}
int int
nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len) nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
{ {
......
...@@ -86,6 +86,7 @@ struct nfp_port { ...@@ -86,6 +86,7 @@ struct nfp_port {
struct nfp_port *nfp_port_from_netdev(struct net_device *netdev); struct nfp_port *nfp_port_from_netdev(struct net_device *netdev);
struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port); struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port);
struct nfp_eth_table_port *nfp_port_get_eth_port(struct nfp_port *port);
int int
nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len); nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len);
......
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