On Sat, Jul 06, 2024 at 11:11:43AM +0200, Landry Breuil wrote:
> Le Tue, Jul 02, 2024 at 07:50:56PM +0000, Miod Vallat a écrit :
> > > hi,
> > > 
> > > playing with 7.5 on an edgerouter poe, it panics at boot:
> > 
> > Congratulations, you've reached a divide by zero in the kernel.
> > 
> > This is caused by cn30xxgmx_rgmii_speed() setting the local variable
> > `baudrate' to zero (with an XXX comment) prior to dividing by it.
> > 
> > The following diff sweeps the issue under the rug by following the
> > "consider unknown value as 1Gbps" logic used all over the file. It might
> > help your setup.
> 
> i've commited the other diff, but should this one go in too for
> correctness ? in that case, any oks, or someone to commit it with my ok ?

The cnmac2 link is connected to a discrete Ethernet switch chip
on the PoE, and this link does not carry RGMII in-band PHY status.
If the code were to support such hardware designs in the future,
something like this patch would be needed.

OK visa@

> Landry
> 
> > Index: dev/cn30xxgmx.c
> > ===================================================================
> > RCS file: /OpenBSD/src/sys/arch/octeon/dev/cn30xxgmx.c,v
> > retrieving revision 1.54
> > diff -u -p -r1.54 cn30xxgmx.c
> > --- dev/cn30xxgmx.c 20 May 2024 23:13:33 -0000      1.54
> > +++ dev/cn30xxgmx.c 2 Jul 2024 19:49:45 -0000
> > @@ -991,7 +991,8 @@ cn30xxgmx_rgmii_speed(struct cn30xxgmx_p
> >             baudrate = IF_Gbps(1);
> >             break;
> >     default:
> > -           baudrate = 0/* XXX */;
> > +           /* Assume 1Gbps for now*/
> > +           baudrate = IF_Gbps(1);  /* XXX */
> >             break;
> >     }
> >     ifp->if_baudrate = baudrate;
> > @@ -1202,7 +1203,7 @@ cn30xxgmx_rgmii_speed_speed(struct cn30x
> >             SET(prt_cfg, PRTN_CFG_SPEED);
> >             break;
> >     default:
> > -           /* NOT REACHED! */
> > +           /* THEORETICALLY NOT REACHED! */
> >             /* Following configuration is default value of system.
> >             */
> >             tx_clk = 1;
> > 
> 

Reply via email to