netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	David Miller <davem@davemloft.net>,
	Realtek linux nic maintainers <nic_swsd@realtek.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 0/2] net: phy: add generic ndo_do_ioctl handler phy_do_ioctl
Date: Sun, 19 Jan 2020 19:19:19 +0100	[thread overview]
Message-ID: <c1f7d8ce-2bc2-5141-9f28-a659d2af4e10@gmail.com> (raw)
In-Reply-To: <20200119175109.GB17720@lunn.ch>

On 19.01.2020 18:51, Andrew Lunn wrote:
> Hi Heiner
> 
>> Almost all drivers have the running check. I found five that don't:
>>
>> *ag71xx, fec_mpc52xx*
>> They don't have the running check but should, because the PHY is
>> attached in ndo_open only.
> 
> So long an ndo_close() sets the phydev pointer to NULL, it should be
> safe. But do the drivers do this?
> 
Setting ndev->phydev to NULL is done by phy_detach(), typically
called from phy_disconnect(). Both drivers do this.
In mpc52xx_fec_close() there might be a small chance for a race
because the chip is stopped before calling phy_diconnect().
Stopping the chip may make the MDIO bus unaccessible.

Actually I was wondering why we need to check at all whether
net_device is running. Typically the PHY is connected / disconnected
in ndo_open / ndo_close, and if both are implemented sanely then
checking for ndev->phydev should be sufficient.

Also it seems we don't consider situations like runtime PM yet.
Then the MDIO bus may not be accessible, but ndev is running
and PHY is attached. Maybe we should add a check for ndev being
present? Because typically netif_device_detach() is called
when (runtime-)suspending.

>> *agere, faraday, rdc*
>> They don't have the running check and attach the PHY in probe.
>>
>> So yes, we could add a second helper w/o the running check, even if
>> it's just for three drivers. There may be more in the future.
>>
>>> Do you plan to convert any more MAC drivers?
>>>
>> Not yet ;) Question would be whether one patch would be sufficient
>> or whether we need one patch per driver that needs to be ACKed by
>> the respective maintainer.
> 
> For this sort of mechanical change, i would do one patch for all
> without running, and another with running. If any driver needs more
> than a mechanical change, then do a patch per driver, and get the
> maintainer involved.
> 
>     Andrew
> 

Heiner

  reply	other threads:[~2020-01-19 18:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-19 13:31 [PATCH net-next 0/2] net: phy: add generic ndo_do_ioctl handler phy_do_ioctl Heiner Kallweit
2020-01-19 13:31 ` [PATCH net-next 1/2] " Heiner Kallweit
2020-01-19 13:32 ` [PATCH net-next 2/2] r8169: use " Heiner Kallweit
2020-01-19 16:12 ` [PATCH net-next 0/2] net: phy: add " Andrew Lunn
2020-01-19 17:18   ` Heiner Kallweit
2020-01-19 17:51     ` Andrew Lunn
2020-01-19 18:19       ` Heiner Kallweit [this message]
2020-01-19 18:50         ` Andrew Lunn
2020-01-19 19:19           ` Heiner Kallweit
2020-01-19 20:50             ` Andrew Lunn
2020-01-19 22:28               ` Heiner Kallweit
2020-01-20 20:35                 ` Heiner Kallweit
2020-01-20  9:42       ` David Miller
2020-01-20  9:43 ` David Miller

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=c1f7d8ce-2bc2-5141-9f28-a659d2af4e10@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    /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;
as well as URLs for NNTP newsgroup(s).