summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-04-04 16:12:28 -0700
committerDavid S. Miller <davem@davemloft.net>2017-04-05 10:49:12 -0700
commit42b1e6aa4672beba79882673c687985b884f7904 (patch)
tree093fe784c0a080e143e9dfafb417f19e3e6cc521 /drivers/net
parent21d529d5eb31f905f8c028956204a0d1bdafbc4b (diff)
downloadlinux-42b1e6aa4672beba79882673c687985b884f7904.tar.gz
linux-42b1e6aa4672beba79882673c687985b884f7904.tar.bz2
linux-42b1e6aa4672beba79882673c687985b884f7904.zip
nfp: report auto-negotiation in ethtool
NSP ABI version 0.17 is exposing the autonegotiation settings. Report whether autoneg is on via ethtool. 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')
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c4
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c2
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.h11
3 files changed, 17 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 0fdc14e7b576..563ced3c99e1 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -203,6 +203,10 @@ nfp_net_get_link_ksettings(struct net_device *netdev,
cmd->base.speed = SPEED_UNKNOWN;
cmd->base.duplex = DUPLEX_UNKNOWN;
+ if (nn->eth_port)
+ cmd->base.autoneg = nn->eth_port->aneg != NFP_ANEG_DISABLED ?
+ AUTONEG_ENABLE : AUTONEG_DISABLE;
+
if (!netif_carrier_ok(netdev))
return 0;
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
index 932772fbd27e..dcb1bc81e554 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
@@ -63,6 +63,7 @@
#define NSP_ETH_STATE_RX_ENABLED BIT_ULL(3)
#define NSP_ETH_STATE_RATE GENMASK_ULL(11, 8)
#define NSP_ETH_STATE_OVRD_CHNG BIT_ULL(22)
+#define NSP_ETH_STATE_ANEG GENMASK_ULL(25, 23)
#define NSP_ETH_CTRL_ENABLED BIT_ULL(1)
#define NSP_ETH_CTRL_TX_ENABLED BIT_ULL(2)
@@ -142,6 +143,7 @@ nfp_eth_port_translate(struct nfp_nsp *nsp, const struct eth_table_entry *src,
return;
dst->override_changed = FIELD_GET(NSP_ETH_STATE_OVRD_CHNG, state);
+ dst->aneg = FIELD_GET(NSP_ETH_STATE_ANEG, state);
}
static void
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.h
index 6838741fadd7..6b3e954e70b3 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.h
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.h
@@ -37,6 +37,14 @@
#include <linux/types.h>
#include <linux/if_ether.h>
+enum nfp_eth_aneg {
+ NFP_ANEG_AUTO = 0,
+ NFP_ANEG_SEARCH,
+ NFP_ANEG_25G_CONSORTIUM,
+ NFP_ANEG_25G_IEEE,
+ NFP_ANEG_DISABLED,
+};
+
/**
* struct nfp_eth_table - ETH table information
* @count: number of table entries
@@ -48,6 +56,7 @@
* @base: first channel index (within NBI)
* @lanes: number of channels
* @speed: interface speed (in Mbps)
+ * @aneg: auto negotiation mode
* @mac_addr: interface MAC address
* @label_port: port id
* @label_subport: id of interface within port (for split ports)
@@ -68,6 +77,8 @@ struct nfp_eth_table {
unsigned int lanes;
unsigned int speed;
+ enum nfp_eth_aneg aneg;
+
u8 mac_addr[ETH_ALEN];
u8 label_port;