]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Wangxun: vf: Implement some ethtool apis for get_xxx
authorMengyuan Lou <mengyuanlou@net-swift.com>
Wed, 24 Sep 2025 08:21:40 +0000 (16:21 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 27 Sep 2025 00:27:24 +0000 (17:27 -0700)
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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250924082140.41612-1-mengyuanlou@net-swift.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
drivers/net/ethernet/wangxun/libwx/wx_ethtool.h
drivers/net/ethernet/wangxun/ngbevf/ngbevf_main.c
drivers/net/ethernet/wangxun/txgbevf/txgbevf_main.c

index 9572b9f28e599e2f0ecf78811f25dbee14015a9c..1a9b7bfbd1d2499ebed01c52ee80921d1106570d 100644 (file)
@@ -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);
index 9e002e699ecab373e8d6e740485007bc2eeade0b..073f1149a578f0d442f621f0bf5e038663d861a6 100644 (file)
@@ -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_ */
index 5f9ddb5e5403c25c15c749ceb8e4c5b475f53e03..6ef43adcc4256d868f0d9692a6142b3442e7fe7d 100644 (file)
@@ -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;
index 3755bb399f71906e261ebb6ddffb4e29a9f1b58f..72663e3c4205a2896bee21d01babddb71131b920 100644 (file)
@@ -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;