-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: wangxun: Add the basic ethtool interfaces
Add the basic ethtool ops get_drvinfo and get_link for ngbe and txgbe. Ngbe implements get_link_ksettings, nway_reset and set_link_ksettings for free using phylib code. The code related to the physical interface is not yet fully implemented in txgbe using phylink code. So do not implement get_link_ksettings, nway_reset and set_link_ksettings in txgbe. Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/20230214091527.69943-1-mengyuanlou@net-swift.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
- Loading branch information
Mengyuan Lou
authored and
Jakub Kicinski
committed
Feb 16, 2023
1 parent
14ade6b
commit 1b8d1c5
Showing
12 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
|
||
obj-$(CONFIG_LIBWX) += libwx.o | ||
|
||
libwx-objs := wx_hw.o wx_lib.o | ||
libwx-objs := wx_hw.o wx_lib.o wx_ethtool.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2015 - 2023 Beijing WangXun Technology Co., Ltd. */ | ||
|
||
#include <linux/pci.h> | ||
#include <linux/phy.h> | ||
|
||
#include "wx_type.h" | ||
#include "wx_ethtool.h" | ||
|
||
void wx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info) | ||
{ | ||
struct wx *wx = netdev_priv(netdev); | ||
|
||
strscpy(info->driver, wx->driver_name, sizeof(info->driver)); | ||
strscpy(info->fw_version, wx->eeprom_id, sizeof(info->fw_version)); | ||
strscpy(info->bus_info, pci_name(wx->pdev), sizeof(info->bus_info)); | ||
} | ||
EXPORT_SYMBOL(wx_get_drvinfo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright (c) 2015 - 2023 Beijing WangXun Technology Co., Ltd. */ | ||
|
||
#ifndef _WX_ETHTOOL_H_ | ||
#define _WX_ETHTOOL_H_ | ||
|
||
void wx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info); | ||
#endif /* _WX_ETHTOOL_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2015 - 2023 Beijing WangXun Technology Co., Ltd. */ | ||
|
||
#include <linux/pci.h> | ||
#include <linux/phy.h> | ||
#include <linux/netdevice.h> | ||
|
||
#include "../libwx/wx_ethtool.h" | ||
#include "ngbe_ethtool.h" | ||
|
||
static const struct ethtool_ops ngbe_ethtool_ops = { | ||
.get_drvinfo = wx_get_drvinfo, | ||
.get_link = ethtool_op_get_link, | ||
.get_link_ksettings = phy_ethtool_get_link_ksettings, | ||
.set_link_ksettings = phy_ethtool_set_link_ksettings, | ||
.nway_reset = phy_ethtool_nway_reset, | ||
}; | ||
|
||
void ngbe_set_ethtool_ops(struct net_device *netdev) | ||
{ | ||
netdev->ethtool_ops = &ngbe_ethtool_ops; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright (c) 2015 - 2023 Beijing WangXun Technology Co., Ltd. */ | ||
|
||
#ifndef _NGBE_ETHTOOL_H_ | ||
#define _NGBE_ETHTOOL_H_ | ||
|
||
void ngbe_set_ethtool_ops(struct net_device *netdev); | ||
|
||
#endif /* _NGBE_ETHTOOL_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
obj-$(CONFIG_TXGBE) += txgbe.o | ||
|
||
txgbe-objs := txgbe_main.o \ | ||
txgbe_hw.o | ||
txgbe_hw.o \ | ||
txgbe_ethtool.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2015 - 2023 Beijing WangXun Technology Co., Ltd. */ | ||
|
||
#include <linux/pci.h> | ||
#include <linux/phylink.h> | ||
#include <linux/netdevice.h> | ||
|
||
#include "../libwx/wx_ethtool.h" | ||
#include "txgbe_ethtool.h" | ||
|
||
static const struct ethtool_ops txgbe_ethtool_ops = { | ||
.get_drvinfo = wx_get_drvinfo, | ||
.get_link = ethtool_op_get_link, | ||
}; | ||
|
||
void txgbe_set_ethtool_ops(struct net_device *netdev) | ||
{ | ||
netdev->ethtool_ops = &txgbe_ethtool_ops; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright (c) 2015 - 2023 Beijing WangXun Technology Co., Ltd. */ | ||
|
||
#ifndef _TXGBE_ETHTOOL_H_ | ||
#define _TXGBE_ETHTOOL_H_ | ||
|
||
void txgbe_set_ethtool_ops(struct net_device *netdev); | ||
|
||
#endif /* _TXGBE_ETHTOOL_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters