lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+h21hoz_LJgvCiVeuPTUVHN2Nu9wWAVnzz9GS2bo=y+Y1hLJA@mail.gmail.com>
Date:   Tue, 16 Jun 2020 17:56:17 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Joakim Tjernlund <Joakim.Tjernlund@...inera.com>
Cc:     "davem@...emloft.net" <davem@...emloft.net>,
        "vivien.didelot@...il.com" <vivien.didelot@...il.com>,
        "madalin.bucur@....nxp.com" <madalin.bucur@....nxp.com>,
        "fido_max@...ox.ru" <fido_max@...ox.ru>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "f.fainelli@...il.com" <f.fainelli@...il.com>,
        "andrew@...n.ch" <andrew@...n.ch>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net 2/2] dpaa_eth: fix usage as DSA master, try 4

Hi Joakim,

On Tue, 16 Jun 2020 at 17:51, Joakim Tjernlund
<Joakim.Tjernlund@...inera.com> wrote:
>
> On Tue, 2020-06-16 at 17:41 +0300, Vladimir Oltean wrote:
> > From: Vladimir Oltean <vladimir.oltean@....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.
> >
> > On T1040, the /sys/class/net/eth0 symlink currently points to:
> >
> > ../../devices/platform/ffe000000.soc/ffe400000.fman/ffe4e6000.ethernet/net/eth0
>
> Just want to point out that on 4.19.x, the above patch still exists:
> cd /sys
> find -name eth0
> ./devices/platform/ffe000000.soc/ffe400000.fman/ffe4e6000.ethernet/net/eth0
> ./class/net/eth
>

By 'current' I mean 'the net tree just before this patch is applied',
i.e. a v5.7 tree with "dpaa_eth: fix usage as DSA master, try 3"
reverted.

> >
> > which pretty much illustrates the problem. The closest of_node we've got
> > is the "fsl,fman-memac" at /soc@...000000/fman@...000/ethernet@...00,
> > 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/dpaa-ethernet.0/net/eth0
> >
> > Actually this has worked before, through the SET_NETDEV_DEV mechanism,
> > which sets the parent of the net_device as the parent of the platform
> > device. But the device which was set as sysfs parent was inadvertently
> > changed through commit 060ad66f9795 ("dpaa_eth: change DMA device"),
> > which did not take into consideration the effect it would have upon
> > of_find_net_device_by_node. So restore the old sysfs parent to make that
> > work correctly.
> >
> > Fixes: 060ad66f9795 ("dpaa_eth: change DMA device")
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@....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 c4416a5f8816..2972244e6eb0 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
> >
>

Thanks,
-Vladimir

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ