Wangxun: vf: Implement some ethtool apis for get_xxx

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>
This commit is contained in:
Mengyuan Lou 2025-09-24 16:21:40 +08:00 committed by Jakub Kicinski
parent 55f5a5a7c1
commit e556f011e2
4 changed files with 42 additions and 0 deletions

View 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);

View 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_ */

View 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;

View 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;