netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] Wangxun: vf: Implement some ethtool apis for get_xxx
@ 2025-09-24  8:21 Mengyuan Lou
  2025-09-25  9:22 ` Simon Horman
  2025-09-27  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Mengyuan Lou @ 2025-09-24  8:21 UTC (permalink / raw)
  To: netdev; +Cc: jiawenwu, duanqiangwen, linglingzhang, Mengyuan Lou

Implement some ethtool interfaces for obtaining the status of
Wangxun Virtual Function Ethernet.
Just like connection status, version information, queue depth and so on.

Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
---
 .../net/ethernet/wangxun/libwx/wx_ethtool.c   | 33 +++++++++++++++++++
 .../net/ethernet/wangxun/libwx/wx_ethtool.h   |  1 +
 .../net/ethernet/wangxun/ngbevf/ngbevf_main.c |  4 +++
 .../ethernet/wangxun/txgbevf/txgbevf_main.c   |  4 +++
 4 files changed, 42 insertions(+)

diff --git a/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c b/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
index 9572b9f28e59..1a9b7bfbd1d2 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
+++ b/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
@@ -546,3 +546,36 @@ void wx_get_ptp_stats(struct net_device *dev,
 	}
 }
 EXPORT_SYMBOL(wx_get_ptp_stats);
+
+static int wx_get_link_ksettings_vf(struct net_device *netdev,
+				    struct ethtool_link_ksettings *cmd)
+{
+	struct wx *wx = netdev_priv(netdev);
+
+	ethtool_link_ksettings_zero_link_mode(cmd, supported);
+	cmd->base.autoneg = AUTONEG_DISABLE;
+	cmd->base.port = PORT_NONE;
+	cmd->base.duplex = DUPLEX_FULL;
+	cmd->base.speed = wx->speed;
+
+	return 0;
+}
+
+static const struct ethtool_ops wx_ethtool_ops_vf = {
+	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
+				     ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ |
+				     ETHTOOL_COALESCE_USE_ADAPTIVE,
+	.get_drvinfo		= wx_get_drvinfo,
+	.get_link		= ethtool_op_get_link,
+	.get_ringparam		= wx_get_ringparam,
+	.get_msglevel		= wx_get_msglevel,
+	.get_coalesce		= wx_get_coalesce,
+	.get_ts_info		= ethtool_op_get_ts_info,
+	.get_link_ksettings	= wx_get_link_ksettings_vf,
+};
+
+void wx_set_ethtool_ops_vf(struct net_device *netdev)
+{
+	netdev->ethtool_ops = &wx_ethtool_ops_vf;
+}
+EXPORT_SYMBOL(wx_set_ethtool_ops_vf);
diff --git a/drivers/net/ethernet/wangxun/libwx/wx_ethtool.h b/drivers/net/ethernet/wangxun/libwx/wx_ethtool.h
index 9e002e699eca..073f1149a578 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_ethtool.h
+++ b/drivers/net/ethernet/wangxun/libwx/wx_ethtool.h
@@ -44,4 +44,5 @@ int wx_get_ts_info(struct net_device *dev,
 		   struct kernel_ethtool_ts_info *info);
 void wx_get_ptp_stats(struct net_device *dev,
 		      struct ethtool_ts_stats *ts_stats);
+void wx_set_ethtool_ops_vf(struct net_device *netdev);
 #endif /* _WX_ETHTOOL_H_ */
diff --git a/drivers/net/ethernet/wangxun/ngbevf/ngbevf_main.c b/drivers/net/ethernet/wangxun/ngbevf/ngbevf_main.c
index 5f9ddb5e5403..6ef43adcc425 100644
--- a/drivers/net/ethernet/wangxun/ngbevf/ngbevf_main.c
+++ b/drivers/net/ethernet/wangxun/ngbevf/ngbevf_main.c
@@ -14,6 +14,7 @@
 #include "../libwx/wx_mbx.h"
 #include "../libwx/wx_vf.h"
 #include "../libwx/wx_vf_common.h"
+#include "../libwx/wx_ethtool.h"
 #include "ngbevf_type.h"
 
 /* ngbevf_pci_tbl - PCI Device ID Table
@@ -186,6 +187,8 @@ static int ngbevf_probe(struct pci_dev *pdev,
 		goto err_pci_release_regions;
 	}
 
+	wx->driver_name = KBUILD_MODNAME;
+	wx_set_ethtool_ops_vf(netdev);
 	netdev->netdev_ops = &ngbevf_netdev_ops;
 
 	/* setup the private structure */
@@ -203,6 +206,7 @@ static int ngbevf_probe(struct pci_dev *pdev,
 	if (err)
 		goto err_free_sw_init;
 
+	wx_get_fw_version_vf(wx);
 	err = register_netdev(netdev);
 	if (err)
 		goto err_register;
diff --git a/drivers/net/ethernet/wangxun/txgbevf/txgbevf_main.c b/drivers/net/ethernet/wangxun/txgbevf/txgbevf_main.c
index 3755bb399f71..72663e3c4205 100644
--- a/drivers/net/ethernet/wangxun/txgbevf/txgbevf_main.c
+++ b/drivers/net/ethernet/wangxun/txgbevf/txgbevf_main.c
@@ -14,6 +14,7 @@
 #include "../libwx/wx_mbx.h"
 #include "../libwx/wx_vf.h"
 #include "../libwx/wx_vf_common.h"
+#include "../libwx/wx_ethtool.h"
 #include "txgbevf_type.h"
 
 /* txgbevf_pci_tbl - PCI Device ID Table
@@ -239,6 +240,8 @@ static int txgbevf_probe(struct pci_dev *pdev,
 		goto err_pci_release_regions;
 	}
 
+	wx->driver_name = KBUILD_MODNAME;
+	wx_set_ethtool_ops_vf(netdev);
 	netdev->netdev_ops = &txgbevf_netdev_ops;
 
 	/* setup the private structure */
@@ -256,6 +259,7 @@ static int txgbevf_probe(struct pci_dev *pdev,
 	if (err)
 		goto err_free_sw_init;
 
+	wx_get_fw_version_vf(wx);
 	err = register_netdev(netdev);
 	if (err)
 		goto err_register;
-- 
2.30.1


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

* Re: [PATCH net-next] Wangxun: vf: Implement some ethtool apis for get_xxx
  2025-09-24  8:21 [PATCH net-next] Wangxun: vf: Implement some ethtool apis for get_xxx Mengyuan Lou
@ 2025-09-25  9:22 ` Simon Horman
  2025-09-27  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-09-25  9:22 UTC (permalink / raw)
  To: Mengyuan Lou; +Cc: netdev, jiawenwu, duanqiangwen, linglingzhang

On Wed, Sep 24, 2025 at 04:21:40PM +0800, Mengyuan Lou wrote:
> Implement some ethtool interfaces for obtaining the status of
> Wangxun Virtual Function Ethernet.
> Just like connection status, version information, queue depth and so on.
> 
> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>

Hi Mengyuan Lou,

To my mind this patch, although small is doing quite a few things.

1. Adding ethtool code to libwx
2. Using 1 in two drivers
3. Adding a wx_get_fw_version_vf() call to two drivers

To be honest I would probably have split this up a bit.
Especially 3. But perhaps that is just me.

Also, I think that, as things stand, "net: wangxun: " would be a more
appropriate prefix for the title of the patch.

So if you do decide to re-spin, please consider the above.

But regardless, the code looks fine to me.

Reviewed-by: Simon Horman <horms@kernel.org>

...

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

* Re: [PATCH net-next] Wangxun: vf: Implement some ethtool apis for get_xxx
  2025-09-24  8:21 [PATCH net-next] Wangxun: vf: Implement some ethtool apis for get_xxx Mengyuan Lou
  2025-09-25  9:22 ` Simon Horman
@ 2025-09-27  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-27  1:10 UTC (permalink / raw)
  To: Mengyuan Lou; +Cc: netdev, jiawenwu, duanqiangwen, linglingzhang

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 24 Sep 2025 16:21:40 +0800 you wrote:
> Implement some ethtool interfaces for obtaining the status of
> Wangxun Virtual Function Ethernet.
> Just like connection status, version information, queue depth and so on.
> 
> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
> ---
>  .../net/ethernet/wangxun/libwx/wx_ethtool.c   | 33 +++++++++++++++++++
>  .../net/ethernet/wangxun/libwx/wx_ethtool.h   |  1 +
>  .../net/ethernet/wangxun/ngbevf/ngbevf_main.c |  4 +++
>  .../ethernet/wangxun/txgbevf/txgbevf_main.c   |  4 +++
>  4 files changed, 42 insertions(+)

Here is the summary with links:
  - [net-next] Wangxun: vf: Implement some ethtool apis for get_xxx
    https://git.kernel.org/netdev/net-next/c/e556f011e2df

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-09-27  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-24  8:21 [PATCH net-next] Wangxun: vf: Implement some ethtool apis for get_xxx Mengyuan Lou
2025-09-25  9:22 ` Simon Horman
2025-09-27  1:10 ` patchwork-bot+netdevbpf

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).