Commit c0f2e511 authored by Jiawen Wu's avatar Jiawen Wu Committed by Paolo Abeni
Browse files

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: default avatarJiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/C94BF867617C544D+20250521064402.22348-7-jiawenwu@trustnetic.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 34392979
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -231,9 +231,6 @@ int wx_get_link_ksettings(struct net_device *netdev,
{
	struct wx *wx = netdev_priv(netdev);

	if (wx->mac.type == wx_mac_aml40)
		return -EOPNOTSUPP;

	return phylink_ethtool_ksettings_get(wx->phylink, cmd);
}
EXPORT_SYMBOL(wx_get_link_ksettings);
+26 −1
Original line number Diff line number Diff line
@@ -12,6 +12,31 @@
#include "txgbe_fdir.h"
#include "txgbe_ethtool.h"

int txgbe_get_link_ksettings(struct net_device *netdev,
			     struct ethtool_link_ksettings *cmd)
{
	struct wx *wx = netdev_priv(netdev);
	struct txgbe *txgbe = wx->priv;
	int err;

	if (wx->mac.type == wx_mac_aml40)
		return -EOPNOTSUPP;

	err = wx_get_link_ksettings(netdev, cmd);
	if (err)
		return err;

	if (wx->mac.type == wx_mac_sp)
		return 0;

	cmd->base.port = txgbe->link_port;
	cmd->base.autoneg = AUTONEG_DISABLE;
	linkmode_copy(cmd->link_modes.supported, txgbe->sfp_support);
	linkmode_copy(cmd->link_modes.advertising, txgbe->advertising);

	return 0;
}

static int txgbe_set_ringparam(struct net_device *netdev,
			       struct ethtool_ringparam *ring,
			       struct kernel_ethtool_ringparam *kernel_ring,
@@ -510,7 +535,7 @@ static const struct ethtool_ops txgbe_ethtool_ops = {
	.get_drvinfo		= wx_get_drvinfo,
	.nway_reset		= wx_nway_reset,
	.get_link		= ethtool_op_get_link,
	.get_link_ksettings	= wx_get_link_ksettings,
	.get_link_ksettings	= txgbe_get_link_ksettings,
	.set_link_ksettings	= wx_set_link_ksettings,
	.get_sset_count		= wx_get_sset_count,
	.get_strings		= wx_get_strings,
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@
#ifndef _TXGBE_ETHTOOL_H_
#define _TXGBE_ETHTOOL_H_

int txgbe_get_link_ksettings(struct net_device *netdev,
			     struct ethtool_link_ksettings *cmd);
void txgbe_set_ethtool_ops(struct net_device *netdev);

#endif /* _TXGBE_ETHTOOL_H_ */