diff options
author | Sixiang Chen <sixiang.chen@corigine.com> | 2022-06-22 10:39:38 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2022-06-23 13:40:25 +0200 |
commit | ccb9bc1dfa444e3541622ccfff135e83d2a569d1 (patch) | |
tree | ee569f7d592bf12b3acb9dd604addeabb792e67c /drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | |
parent | 85763435d5b5ed91ce670d87862012a632b54014 (diff) | |
download | lwn-ccb9bc1dfa444e3541622ccfff135e83d2a569d1.tar.gz lwn-ccb9bc1dfa444e3541622ccfff135e83d2a569d1.zip |
nfp: add 'ethtool --identify' support
Add support for ethtool -p|--identify
by enabling blinking of the panel LED if supported by the NIC firmware.
Signed-off-by: Sixiang Chen <sixiang.chen@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20220622083938.291548-1-simon.horman@corigine.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 34 |
1 files changed, 34 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 15e9cf71a8e2..7475b209353f 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c @@ -1477,6 +1477,38 @@ static void nfp_port_get_pauseparam(struct net_device *netdev, pause->tx_pause = 1; } +static int nfp_net_set_phys_id(struct net_device *netdev, + enum ethtool_phys_id_state state) +{ + struct nfp_eth_table_port *eth_port; + struct nfp_port *port; + int err; + + port = nfp_port_from_netdev(netdev); + eth_port = __nfp_port_get_eth_port(port); + if (!eth_port) + return -EOPNOTSUPP; + + switch (state) { + case ETHTOOL_ID_ACTIVE: + /* Control LED to blink */ + err = nfp_eth_set_idmode(port->app->cpp, eth_port->index, 1); + break; + + case ETHTOOL_ID_INACTIVE: + /* Control LED to normal mode */ + err = nfp_eth_set_idmode(port->app->cpp, eth_port->index, 0); + break; + + case ETHTOOL_ID_ON: + case ETHTOOL_ID_OFF: + default: + return -EOPNOTSUPP; + } + + return err; +} + static const struct ethtool_ops nfp_net_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES | @@ -1510,6 +1542,7 @@ static const struct ethtool_ops nfp_net_ethtool_ops = { .get_fecparam = nfp_port_get_fecparam, .set_fecparam = nfp_port_set_fecparam, .get_pauseparam = nfp_port_get_pauseparam, + .set_phys_id = nfp_net_set_phys_id, }; const struct ethtool_ops nfp_port_ethtool_ops = { @@ -1528,6 +1561,7 @@ const struct ethtool_ops nfp_port_ethtool_ops = { .get_fecparam = nfp_port_get_fecparam, .set_fecparam = nfp_port_set_fecparam, .get_pauseparam = nfp_port_get_pauseparam, + .set_phys_id = nfp_net_set_phys_id, }; void nfp_net_set_ethtool_ops(struct net_device *netdev) |