Subject: Re: [PATCH RFC net-next] net: dsa: b53: convert to phylink_pcs

From: "Russell King (Oracle)" <[email-masked]>
Date: Fri, 8 Apr 2022 09:30:02 +0100

On Thu, Apr 07, 2022 at 03:55:35PM -0700, Florian Fainelli wrote:
> On 4/6/22 08:06, Russell King (Oracle) wrote:
> > Convert B53 to use phylink_pcs for the serdes rather than hooking it
> > into the MAC-layer callbacks.
> > 
> > Signed-off-by: Russell King (Oracle) <[email-masked]>
> > ---
> > Hi Florian,
> > 
> > Please can you test this patch? Thanks.
> 
> Did not spend much time debugging this as I had to do something else but
> here is what I got:
> 
> [    1.909223] b53-srab-switch 18036000.ethernet-switch: SerDes lane 0,
> model: 1, rev B0 (OUI: 0x0143bff0)
> [    1.918956] 8<--- cut here ---
> [    1.922119] Unable to handle kernel NULL pointer dereference at virtual
> address 0000012c

Thanks - it looks like the problem is dev->port has not been allocated
at the point where b53_serdes_init is called, causing this null pointer
deref. It's allocated in b53_switch_register(), which is also where the
driver works out how many ports there are.

I don't see an easy way to allocate this array earlier... so, where can
we save a pointer to the PCS. I guess as this is specific to srab, we
could put it in struct b53_srab_port_priv - but then we'll need
b53_phylink_mac_select_pcs() to call into the e.g. the srab layer.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!