Skip to content

Commit c0f2e51

Browse files
Jiawen WuPaolo Abeni
authored andcommitted
net: txgbe: Correct the currect link settings
For AML 25G/10G devices, some of the information returned from phylink_ethtool_ksettings_get() is not correct, since there is a fixed-link mode. So add additional corrections. Signed-off-by: Jiawen Wu <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 3439297 commit c0f2e51

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

drivers/net/ethernet/wangxun/libwx/wx_ethtool.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,6 @@ int wx_get_link_ksettings(struct net_device *netdev,
231231
{
232232
struct wx *wx = netdev_priv(netdev);
233233

234-
if (wx->mac.type == wx_mac_aml40)
235-
return -EOPNOTSUPP;
236-
237234
return phylink_ethtool_ksettings_get(wx->phylink, cmd);
238235
}
239236
EXPORT_SYMBOL(wx_get_link_ksettings);

drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,31 @@
1212
#include "txgbe_fdir.h"
1313
#include "txgbe_ethtool.h"
1414

15+
int txgbe_get_link_ksettings(struct net_device *netdev,
16+
struct ethtool_link_ksettings *cmd)
17+
{
18+
struct wx *wx = netdev_priv(netdev);
19+
struct txgbe *txgbe = wx->priv;
20+
int err;
21+
22+
if (wx->mac.type == wx_mac_aml40)
23+
return -EOPNOTSUPP;
24+
25+
err = wx_get_link_ksettings(netdev, cmd);
26+
if (err)
27+
return err;
28+
29+
if (wx->mac.type == wx_mac_sp)
30+
return 0;
31+
32+
cmd->base.port = txgbe->link_port;
33+
cmd->base.autoneg = AUTONEG_DISABLE;
34+
linkmode_copy(cmd->link_modes.supported, txgbe->sfp_support);
35+
linkmode_copy(cmd->link_modes.advertising, txgbe->advertising);
36+
37+
return 0;
38+
}
39+
1540
static int txgbe_set_ringparam(struct net_device *netdev,
1641
struct ethtool_ringparam *ring,
1742
struct kernel_ethtool_ringparam *kernel_ring,
@@ -510,7 +535,7 @@ static const struct ethtool_ops txgbe_ethtool_ops = {
510535
.get_drvinfo = wx_get_drvinfo,
511536
.nway_reset = wx_nway_reset,
512537
.get_link = ethtool_op_get_link,
513-
.get_link_ksettings = wx_get_link_ksettings,
538+
.get_link_ksettings = txgbe_get_link_ksettings,
514539
.set_link_ksettings = wx_set_link_ksettings,
515540
.get_sset_count = wx_get_sset_count,
516541
.get_strings = wx_get_strings,

drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#ifndef _TXGBE_ETHTOOL_H_
55
#define _TXGBE_ETHTOOL_H_
66

7+
int txgbe_get_link_ksettings(struct net_device *netdev,
8+
struct ethtool_link_ksettings *cmd);
79
void txgbe_set_ethtool_ops(struct net_device *netdev);
810

911
#endif /* _TXGBE_ETHTOOL_H_ */

0 commit comments

Comments
 (0)