]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nfp: ethtool: fix the display error of `ethtool -m DEVNAME`
authorYu Xiao <yu.xiao@corigine.com>
Tue, 2 Aug 2022 09:33:55 +0000 (10:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:26 +0000 (11:18 +0200)
commit 57b063516ab74fa69ded32af9d83b6a74532aef6 upstream.

The port flag isn't set to `NFP_PORT_CHANGED` when using
`ethtool -m DEVNAME` before, so the port state (e.g. interface)
cannot be updated. Therefore, it caused that `ethtool -m DEVNAME`
sometimes cannot read the correct information.

E.g. `ethtool -m DEVNAME` cannot work when load driver before plug
in optical module, as the port interface is still NONE without port
update.

Now update the port state before sending info to NIC to ensure that
port interface is correct (latest state).

Fixes: c35c5cc1c0fe ("nfp: implement ethtool get module EEPROM")
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Yu Xiao <yu.xiao@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20220802093355.69065-1-simon.horman@corigine.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c

index 10857914c552b3070547dd656426a5ec8ab5db14..46d6988829ff1c094ecdcf2dc9efd233ef437210 100644 (file)
@@ -1127,6 +1127,8 @@ nfp_port_get_module_info(struct net_device *netdev,
        u8 data;
 
        port = nfp_port_from_netdev(netdev);
+       /* update port state to get latest interface */
+       set_bit(NFP_PORT_CHANGED, &port->flags);
        eth_port = nfp_port_get_eth_port(port);
        if (!eth_port)
                return -EOPNOTSUPP;