public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "huangguangbin (A)" <huangguangbin2@huawei.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
	davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, lipeng321@huawei.com,
	chenhao288@hisilicon.com
Subject: Re: [PATCH] net: phy: genphy_loopback: fix loopback failed when speed is unknown
Date: Thu, 7 Apr 2022 16:45:03 +0200	[thread overview]
Message-ID: <Yk7475EJ622D1Ty/@lunn.ch> (raw)
In-Reply-To: <d42ae21a-6136-5340-6851-e3108759937a@huawei.com>

> Hi Andrew,
> The PHY we test is RTL8211F, it supports 10 half. This problem actually is,
> our board has MAC connected with PHY, when loopback test, packet flow is
> MAC->PHY->MAC, it needs speed of MAC and PHY should be same when they work.
> 
> If PHY speed is unknown when PHY goes down, we will not set MAC speed in
> adjust_link interface. In this case, we hope that PHY speed should not be
> changed, as the old code of function genphy_loopback() before patch
> "net: phy: genphy_loopback: add link speed configuration".
> 
> If PHY has never link, MAC speed has never be set in adjust_link interface,
> yeah, in this case, MAC and PHY may has different speed, and they can not work.
> I think we can accept this situation.
> 
> I think it is general problem if there is MAC connected with PHY.

Thanks for investigating. Looks like we are getting close the real
solution. And it is a generic problem, that the MAC and PHY might not
be using the same configuration.

So it looks like if the link is down, or speed is UNKNOWN, we need to
set phydev->link true, speed 10, duplex half, the PHY into 10/Half and
call the adjust_link callback. That should get the MAC and PHY to talk
to each other.

The open question is what to do when we disable loopback. Maybe we
need to always set link false, speed unknown and call phy_start_aneg()
to restart the link?

   Andrew

  reply	other threads:[~2022-04-07 14:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 11:48 [PATCH] net: phy: genphy_loopback: fix loopback failed when speed is unknown Guangbin Huang
2022-03-31 12:23 ` Andrew Lunn
2022-03-31 13:57   ` huangguangbin (A)
2022-03-31 14:26     ` Andrew Lunn
2022-04-01  6:40       ` Oleksij Rempel
2022-04-01 12:14         ` Andrew Lunn
2022-04-07 13:54           ` huangguangbin (A)
2022-04-07 14:45             ` Andrew Lunn [this message]
2022-04-08  8:18               ` Oleksij Rempel
2022-04-08 13:04                 ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yk7475EJ622D1Ty/@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=chenhao288@hisilicon.com \
    --cc=davem@davemloft.net \
    --cc=huangguangbin2@huawei.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lipeng321@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox