svn commit: r334880 - head/sys/dev/vnic

Warner Losh imp at bsdimp.com
Sun Jul 8 16:23:54 UTC 2018


On Sun, Jul 8, 2018 at 10:14 AM, Mark Johnston <markj at freebsd.org> wrote:

> On Sun, Jul 08, 2018 at 09:58:35AM -0600, Warner Losh wrote:
> > On Sun, Jul 8, 2018 at 9:55 AM, Sean Bruno <sbruno at freebsd.org> wrote:
> >
> > >
> > >
> > > On 07/08/18 09:26, Mark Johnston wrote:
> > > > On Sun, Jul 08, 2018 at 09:10:27AM -0600, Sean Bruno wrote:
> > > >>
> > > >>
> > > >> On 07/07/18 11:43, Mark Johnston wrote:
> > > >>> On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner wrote:
> > > >>>> Author: andrew
> > > >>>> Date: Sat Jun  9 14:47:49 2018
> > > >>>> New Revision: 334880
> > > >>>> URL: https://svnweb.freebsd.org/changeset/base/334880
> > > >>>>
> > > >>>> Log:
> > > >>>>   In the ThunderX BGX network driver we were skipping the NULL
> > > terminator
> > > >>>>   when parsing the phy type, however this is included in the
> length
> > > returned
> > > >>>>   by OF_getprop. To fix this stop ignoring the terminator.
> > > >>>>
> > > >>>>   PR:              228828
> > > >>>>   Reported by:     sbruno
> > > >>>>   Sponsored by:    DARPA, AFRL
> > > >>>
> > > >>> This seems to break vnic on packet.net ThunderXs.  In particular,
> VF
> > > >>> creation fails.  It seems the problem in my case is that there are
> > > >>> multiple PHY devices in the device tree, e.g., xfi at 0, xfi at 1.  With
> > > this
> > > >>> change, bgx_fdt_phy_name_match() fails to match against any device
> > > >>> containing a unit address in the node name.
> > > >>>
> > > >>
> > > >>
> > > >> Huh ... this was *required* to get the ThunderXs we have in the
> FreeBSD
> > > >> cluster to work at all.  o.0
> > > >>
> > > >> I guess "someone" needs to contact "someone" to figure out which is
> > > >> correct or we need to replace our FreeBSD cluster machines with ones
> > > >> that work like the packet.net machines?
> > > >
> > > > I think the current code works fine if there's only one PHY device,
> so
> > > > my problem is probably just the result of having a different hardware
> > > > setup.  We can probably fix the code to handle both cases.  Could you
> > > > mail me the output of "ofwdump -ap" from the cluster machine?
> > > >
> > > >
> > >
> > >
> > > I dropped the output here:
> > > https://people.freebsd.org/~sbruno/ofwdump.txt
> >
> >
> > Ian's method is better. But Ian's question is better: are there not
> > phandles to find this stuff? Names in FDT are kinda meaningless most of
> the
> > time (I say kinda here to gloss over a laundry list of exceptions that
> PHY
> > finding typically does not fall into).
>
> Sean's output shows why the current code works for him.  In my case the
> bgx subnodes don't contain a qlm-mode property, so we're falling back to
> name matching:
>
> Node 0x891c: bgx0
>   #address-cells:
>     00 00 00 01
>   #size-cells:
>     00 00 00 00
>   reg:
>     00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>   Node 0x8ad8: xfi at 0
>     reg:
>       00 00 00 00
>     local-mac-address:
>       fc 15 b4 97 48 b7
>     phy-handle:
>       00 00 00 75
>   Node 0x8b34: xfi at 1
>     reg:
>       00 00 00 01
>     local-mac-address:
>       fc 15 b4 97 48 b8
>     phy-handle:
>       00 00 00 76
>
> Being unfamiliar with FDT, could I ask you to explain how the code could
> be using phandles to find the PHYs?
>

Allwinner provides a good example, and says it in code better than I could
quickly summarize:

static phandle_t
awg_get_phy_node(device_t dev)
{
        phandle_t node;
pcell_t phy_handle;

        node = ofw_bus_get_node(dev);
        if (OF_getencprop(node, "phy-handle", (void *)&phy_handle,
            sizeof(phy_handle)) <= 0)
                return (0);

        return (OF_node_from_xref(phy_handle));
}

Warner


More information about the svn-src-all mailing list