netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] nfp: ethtool: fix the display error of `ethtool -m DEVNAME`
@ 2022-08-02  8:59 Simon Horman
  2022-08-02  9:33 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Horman @ 2022-08-02  8:59 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni; +Cc: netdev, oss-drivers

From: Yu Xiao <yu.xiao@corigine.com>

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: 61f7c6f4 ("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>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
index df0afd271a21..e6ee45afd80c 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -1230,6 +1230,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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] nfp: ethtool: fix the display error of `ethtool -m DEVNAME`
  2022-08-02  8:59 [PATCH net] nfp: ethtool: fix the display error of `ethtool -m DEVNAME` Simon Horman
@ 2022-08-02  9:33 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2022-08-02  9:33 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni; +Cc: netdev, oss-drivers

On Tue, Aug 02, 2022 at 09:59:16AM +0100, Simon Horman wrote:
> From: Yu Xiao <yu.xiao@corigine.com>
> 
> 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: 61f7c6f4 ("nfp: implement ethtool get module EEPROM")

Sorry about this. I see that the fixes tag above has 8 rather than 12
characters of the commit hash. I'll post v2 to address this problem.

> 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>
> ---
>  drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
> index df0afd271a21..e6ee45afd80c 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
> @@ -1230,6 +1230,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;
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-02  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-02  8:59 [PATCH net] nfp: ethtool: fix the display error of `ethtool -m DEVNAME` Simon Horman
2022-08-02  9:33 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).