mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port enable/disable
Date: Fri, 22 Sep 2017 11:23:57 -0700	[thread overview]
Message-ID: <6d7799bb-2b33-0696-1805-63cea5e52667@gmail.com> (raw)
In-Reply-To: <87377eob5t.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>

On 09/22/2017 11:12 AM, Vivien Didelot wrote:
> Hi Florian,
> 
> Florian Fainelli <f.fainelli@gmail.com> writes:
> 
>> On 09/22/2017 09:17 AM, Vivien Didelot wrote:
>>> The .port_enable and .port_disable functions are meant to deal with the
>>> switch ports only, and no driver is using the phy argument anyway.
>>> Remove it.
>>
>> I don't think this makes sense, there are perfectly legit reasons why a
>> switch driver may have something to do with the PHY device attached to
>> its per-port network interface, we should definitively keep that around,
>> unless you think we should be accessing the PHY within the switch
>> drivers by doing:
>>
>> struct phy_device *phydev = ds->ports[port].netdev->phydev?
> 
> bcm_sf2 is the only user for this phy argument right now. The reason I'm
> doing this is because I prefer to discourage switch drivers to dig into
> the phy device themselves while as you said there must be a cleaner
> solution. This must be handled somehow elsewhere in the stack.

The current approach of passing the phy_device reference as an argument
is certainly a cleaner way then. The port_enable caller can provide the
correct phy_device and that lifts the switch driver from having to dig
it itself from its per-port netdev.

> 
> In the meantime, moving the PHY device up to the dsa_port structure is a
> good solution, in order not to expose it in switch ops, but still make
> it available to more complex drivers.
> 
> Do you know if netdev->phydev is usable? Why do DSA has its own copy in
> dsa_slave_priv then?

Historical reasons mostly. Considering the complexity of
dsa_slave_phy_setup(), I would certainly be extremely careful in
changing any of this, the potential for breakage is pretty big. At first
glance, I would say that this is a safe conversion to do, and I can test
this on the HW I have here anyway.
-- 
Florian

  reply	other threads:[~2017-09-22 18:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 16:17 [PATCH net-next 0/4] net: dsa: simplify port enabling Vivien Didelot
2017-09-22 16:17 ` [PATCH net-next 1/4] net: dsa: move up phy enabling in core Vivien Didelot
2017-09-22 16:32   ` Andrew Lunn
2017-09-22 16:58     ` Florian Fainelli
2017-09-22 16:52   ` Florian Fainelli
2017-09-22 16:17 ` [PATCH net-next 2/4] net: dsa: remove phy arg from port enable/disable Vivien Didelot
2017-09-22 17:14   ` Florian Fainelli
2017-09-22 18:12     ` Vivien Didelot
2017-09-22 18:23       ` Florian Fainelli [this message]
2017-09-22 19:11         ` Andrew Lunn
2017-09-22 16:17 ` [PATCH net-next 3/4] net: dsa: make slave close symmetrical to open Vivien Didelot
2017-09-22 16:34   ` Andrew Lunn
2017-09-22 17:15   ` Florian Fainelli
2017-09-22 16:17 ` [PATCH net-next 4/4] net: dsa: add port enable and disable helpers Vivien Didelot
2017-09-22 16:35   ` Andrew Lunn
2017-09-22 17:16   ` Florian Fainelli

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=6d7799bb-2b33-0696-1805-63cea5e52667@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.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

Powered by JetHome