[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fdfc759b-2bdd-427a-878f-e4294524841d@engleder-embedded.com>
Date: Tue, 14 Jan 2025 21:17:32 +0100
From: Gerhard Engleder <gerhard@...leder-embedded.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 4/5] tsnep: Select speed for loopback
On 13.01.25 22:59, Andrew Lunn wrote:
> On Fri, Jan 10, 2025 at 03:48:27PM +0100, Gerhard Engleder wrote:
>> Use 100 Mbps only if the PHY is configured to this speed. Otherwise use
>> always the maximum speed of 1000 Mbps.
>>
>> Signed-off-by: Gerhard Engleder <gerhard@...leder-embedded.com>
>> ---
>> drivers/net/ethernet/engleder/tsnep_main.c | 13 ++++++++++++-
>> 1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
>> index 5c501e4f9e3e..45b9f5780902 100644
>> --- a/drivers/net/ethernet/engleder/tsnep_main.c
>> +++ b/drivers/net/ethernet/engleder/tsnep_main.c
>> @@ -229,8 +229,19 @@ static void tsnep_phy_link_status_change(struct net_device *netdev)
>> static int tsnep_phy_loopback(struct tsnep_adapter *adapter, bool enable)
>> {
>> int retval;
>> + int speed;
>>
>> - retval = phy_loopback(adapter->phydev, enable, 0);
>> + if (enable) {
>> + if (adapter->phydev->autoneg == AUTONEG_DISABLE &&
>> + adapter->phydev->speed == SPEED_100)
>> + speed = SPEED_100;
>> + else
>> + speed = SPEED_1000;
>> + } else {
>> + speed = 0;
>> + }
>> +
>> + retval = phy_loopback(adapter->phydev, enable, speed);
>
> If phy_loopback() returns -EOPNOTSUPP, don't you want to retry without
> a speed? There is no guarantee the PHY paired with this MAC does
> support setting the loopback speed.
Some tests require 100 Mbps and other tests require 1000 Mbps for
loopback. So a defined loopback speed is required. For my tests it
is ok if they work only with PHYs which support setting the loopback
speed.
Gerhard
Powered by blists - more mailing lists