summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/netronome
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-04-04 16:12:27 -0700
committerDavid S. Miller <davem@davemloft.net>2017-04-05 10:49:12 -0700
commit21d529d5eb31f905f8c028956204a0d1bdafbc4b (patch)
tree9a4e7e857a99b72bb0221e26d07a44c3dfe8d29f /drivers/net/ethernet/netronome
parent172f638c93dd0b90b231d07662e64025b1e53e38 (diff)
downloadlinux-21d529d5eb31f905f8c028956204a0d1bdafbc4b.tar.bz2
nfp: report link speed from NSP
On the PF prefer the link speed value provided by the NSP. Refresh port table if needed. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome')
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
index d3cec0d4a978..0fdc14e7b576 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -49,6 +49,7 @@
#include <linux/ethtool.h>
#include "nfpcore/nfp.h"
+#include "nfpcore/nfp_nsp_eth.h"
#include "nfp_net_ctrl.h"
#include "nfp_net.h"
@@ -205,6 +206,16 @@ nfp_net_get_link_ksettings(struct net_device *netdev,
if (!netif_carrier_ok(netdev))
return 0;
+ /* Use link speed from ETH table if available, otherwise try the BAR */
+ if (nn->eth_port && nfp_net_link_changed_read_clear(nn))
+ nfp_net_refresh_port_config(nn);
+ /* Separate if - on FW error the port could've disappeared from table */
+ if (nn->eth_port) {
+ cmd->base.speed = nn->eth_port->speed;
+ cmd->base.duplex = DUPLEX_FULL;
+ return 0;
+ }
+
sts = nn_readl(nn, NFP_NET_CFG_STS);
ls = FIELD_GET(NFP_NET_CFG_STS_LINK_RATE, sts);