netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Madalin Bucur (OSS)" <madalin.bucur@oss.nxp.com>
To: Vladimir Oltean <olteanv@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>
Cc: "andrew@lunn.ch" <andrew@lunn.ch>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
	"Madalin Bucur (OSS)" <madalin.bucur@oss.nxp.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [PATCH] dpaa_eth: fix usage as DSA master, try 3
Date: Mon, 25 May 2020 15:20:09 +0000	[thread overview]
Message-ID: <AM6PR04MB39762C1D25DF9A1788C39DC5ECB30@AM6PR04MB3976.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20200524212251.3311546-1-olteanv@gmail.com>

> -----Original Message-----
> From: Vladimir Oltean <olteanv@gmail.com>
> Sent: Monday, May 25, 2020 12:23 AM
> To: davem@davemloft.net
> Cc: andrew@lunn.ch; f.fainelli@gmail.com; vivien.didelot@gmail.com;
> Madalin Bucur (OSS) <madalin.bucur@oss.nxp.com>; netdev@vger.kernel.org
> Subject: [PATCH] dpaa_eth: fix usage as DSA master, try 3
> 
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> The dpaa-eth driver probes on compatible string for the MAC node, and
> the fman/mac.c driver allocates a dpaa-ethernet platform device that
> triggers the probing of the dpaa-eth net device driver.
> 
> All of this is fine, but the problem is that the struct device of the
> dpaa_eth net_device is 2 parents away from the MAC which can be
> referenced via of_node. So of_find_net_device_by_node can't find it, and
> DSA switches won't be able to probe on top of FMan ports.
> 
> It would be a bit silly to modify a core function
> (of_find_net_device_by_node) to look for dev->parent->parent->of_node
> just for one driver. We're just 1 step away from implementing full
> recursion.

Changing a netdevice parent to satisfy this DSA assumption can be regarded as
being just as silly. How about changing the DSA assumption, not the generic
of_find_net_device_by_node API?

ACPI support is in the making for these platforms, is DSA going to work
with that?

> Actually there have already been at least 2 previous attempts to make
> this work:
> - Commit a1a50c8e4c24 ("fsl/man: Inherit parent device and of_node")
> - One or more of the patches in "[v3,0/6] adapt DPAA drivers for DSA":
>   https://patchwork.ozlabs.org/project/netdev/cover/1508178970-28945-1-
> git-send-email-madalin.bucur@nxp.com/
>   (I couldn't really figure out which one was supposed to solve the
>   problem and how).

The prior changes were made without access to a DSA setup. Has this patch been
tested working on such a setup?

> Point being, it looks like this is still pretty much a problem today.
> On T1040, the /sys/class/net/eth0 symlink currently points to
> 
> ../../devices/platform/ffe000000.soc/ffe400000.fman/ffe4e6000.ethernet/dpa
> a-ethernet.0/net/eth0
> 
> which pretty much illustrates the problem. The closest of_node we've got
> is the "fsl,fman-memac" at /soc@ffe000000/fman@400000/ethernet@e6000,
> which is what we'd like to be able to reference from DSA as host port.
> 
> For of_find_net_device_by_node to find the eth0 port, we would need the
> parent of the eth0 net_device to not be the "dpaa-ethernet" platform
> device, but to point 1 level higher, aka the "fsl,fman-memac" node
> directly. The new sysfs path would look like this:
> 
> ../../devices/platform/ffe000000.soc/ffe400000.fman/ffe4e6000.ethernet/net
> /eth0
> 
> And this is exactly what SET_NETDEV_DEV does. It sets the parent of the
> net_device. The new parent has an of_node associated with it, and
> of_dev_node_match already checks for the of_node of the device or of its
> parent.
> 
> Fixes: a1a50c8e4c24 ("fsl/man: Inherit parent device and of_node")
> Fixes: c6e26ea8c893 ("dpaa_eth: change device used")

If this is picked up in stable trees, we may need to make sure some other
changes are there to keep things working, i.e. this one may matter:

commit 060ad66f97954fa93ad495542c8a4f1b6c45aa34
Author: Madalin Bucur <madalin.bucur@nxp.com>
Date:   Wed Oct 23 12:08:44 2019 +0300

    dpaa_eth: change DMA device

    The DPAA Ethernet driver is using the FMan MAC as the device for DMA
    mapping. This is not actually correct, as the real DMA device is the
    FMan port (the FMan Rx port for reception and the FMan Tx port for
    transmission). Changing the device used for DMA mapping to the Fman
    Rx and Tx port devices.

On each target code base one needs to review the impact.
Speaking of impact, does this change keep the existing udev rules functional?

> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> index 2cd1f8efdfa3..6bfa7575af94 100644
> --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> @@ -2914,7 +2914,7 @@ static int dpaa_eth_probe(struct platform_device
> *pdev)
>  	}
> 
>  	/* Do this here, so we can be verbose early */
> -	SET_NETDEV_DEV(net_dev, dev);
> +	SET_NETDEV_DEV(net_dev, dev->parent);
>  	dev_set_drvdata(dev, net_dev);
> 
>  	priv = netdev_priv(net_dev);
> --
> 2.25.1


  reply	other threads:[~2020-05-25 15:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24 21:22 [PATCH] dpaa_eth: fix usage as DSA master, try 3 Vladimir Oltean
2020-05-25 15:20 ` Madalin Bucur (OSS) [this message]
2020-05-25 15:36   ` Andrew Lunn
2020-05-25 16:14   ` Vladimir Oltean
2020-05-25 20:12 ` Florian Fainelli
2020-05-26  0:58 ` David Miller
2020-06-16 13:00   ` Vladimir Oltean

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=AM6PR04MB39762C1D25DF9A1788C39DC5ECB30@AM6PR04MB3976.eurprd04.prod.outlook.com \
    --to=madalin.bucur@oss.nxp.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.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).