On Fri, 6 Apr 2018, Jonathan Gray wrote: > On Thu, Apr 05, 2018 at 09:57:23PM +0200, Stefan Fritsch wrote: > > Add another magic 1ms delay that seems to help with some remaining > > issues on an HP elitebook 820 G3 with i219LM. A printf() at the same > > place helps, too. > > Could you explain what the problem here was and why this place was > chosen to add the delay?
The problems fixed by patches 1-6 were that there were these kinds of errors em0: Hardware Initialization Failed em0: Unable to initialize the hardware either during em_attach (in this case em0 would simply not be available in ifconfig) or during ifconfig up. The problems only appeared if there was no link (or no cable plugged in) during boot or during resume. The fixes 1 to 5 made the problem appear much less often, but it still appeared sometimes. I had some printfs added and I have never seen the problem with the printf present. In the end I traced the "fix" to the single printf at this exact location and I replaced it with a delay. We added Patch 6 (the E1000_TARC0_CB_MULTIQ_2_REQ erratum) later, to fix different problems with watchdog timeouts that were only recoverable by a reboot, when pulling the cable or when the link was flaky. > > > --- > > sys/dev/pci/if_em_hw.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git sys/dev/pci/if_em_hw.c sys/dev/pci/if_em_hw.c > > index 7709a4c5805..d122e727875 100644 > > --- sys/dev/pci/if_em_hw.c > > +++ sys/dev/pci/if_em_hw.c > > @@ -1493,6 +1493,8 @@ em_init_hw(struct em_hw *hw) > > /* Set the media type and TBI compatibility */ > > em_set_media_type(hw); > > > > + /* Magic delay that improves problems with i219LM on HP Elitebook */ > > + msec_delay(1); > > /* Must be called after em_set_media_type because media_type is used */ > > em_initialize_hardware_bits(hw); > > > > -- > > 2.13.0 > > >