Re: [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up

From: Christian Hesse
Date: Fri Dec 08 2017 - 05:52:54 EST


Benjamin Poirier <bpoirier@xxxxxxxx> on Fri, 2017/12/08 17:34:
> On 2017/12/07 20:02, Ben Hutchings wrote:
> > On Tue, 2017-11-28 at 11:23 +0100, Greg Kroah-Hartman wrote:
> > > 4.4-stable review patch.ÂÂIf anyone has any objections, please let me
> > > know.
> > >
> > > ------------------
> > >
> > > From: Benjamin Poirier <bpoirier@xxxxxxxx>
> > >
> > > commit 19110cfbb34d4af0cdfe14cd243f3b09dc95b013 upstream.
> > [...]
> > > --- a/drivers/net/ethernet/intel/e1000e/mac.c
> > > +++ b/drivers/net/ethernet/intel/e1000e/mac.c
> > > @@ -410,6 +410,9 @@ void e1000e_clear_hw_cntrs_base(struct e
> > > Â *ÂÂChecks to see of the link status of the hardware has changed.ÂÂIf a
> > > Â *ÂÂchange in link status has been detected, then we read the PHY
> > > registers
> > > Â *ÂÂto get the current speed/duplex if link exists.
> > > + *
> > > + *ÂÂReturns a negative error code (-E1000_ERR_*) or 0 (link down) or 1
> > > (link
> > > + *ÂÂup).
> > > Â **/
> > > Âs32 e1000e_check_for_copper_link(struct e1000_hw *hw)
> > > Â{
> > [...]
> > > --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> > > +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> > > @@ -5017,7 +5017,7 @@ static bool e1000e_has_link(struct e1000
> > > > Â case e1000_media_type_copper:
> > > > Â if (hw->mac.get_link_status) {
> > > > Â ret_val = hw->mac.ops.check_for_link(hw);
> > > > - link_active = !hw->mac.get_link_status;
> > > > + link_active = ret_val > 0;
> > > > Â } else {
> > > > Â link_active = true;
> > > > Â }
> >
> > As this change in e1000e_has_link() is conditional only on the media
> > type, doesn't e1000_check_for_copper_link_ich8lan() also need to be
> > changed to return 1 for link up?
>
> You're right. I looked at it again, in the commit log I wrote that
> "hw->mac.ops.check_for_link(hw) === e1000e_check_for_copper_link" which
> is true for the race condition reported (because that's the function in
> use on adapters that have msix vectors mac.type == e1000_82574) but not
> generally true. The other check_for_link callback needs to be adjusted
> likewise.
>
> However, I happen to have a I218-LM (e1000_pch_lpt) so I tested 4.14.3
> and this error only delays link up, it doesn't prevent it.
> e1000_check_for_copper_link_ich8lan() sets mac->get_link_status = false;
> and on the next watchdog execution, we fall in the second branch of the
> following e1000e_has_link code:
>
> case e1000_media_type_copper:
> if (hw->mac.get_link_status) {
> ret_val = hw->mac.ops.check_for_link(hw);
> link_active = ret_val > 0;
> } else {
> link_active = true;
>
> OTOH, there are multiple reports in
> https://bugzilla.kernel.org/show_bug.cgi?id=198047
> that reverting 830466993daf ("e1000e: Separate signaling for link
> check/link up") fixes the issue so there's something I'm missing.
>
> Gabriel and Christian, can you test the following patch?

With this patch applied my connection is up and running again. Thanks!
--
main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];)
putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}

Attachment: pgpuR1vq94Yv3.pgp
Description: OpenPGP digital signature