linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up
@ 2017-12-09 21:00 rwarsow
  0 siblings, 0 replies; 5+ messages in thread
From: rwarsow @ 2017-12-09 21:00 UTC (permalink / raw)
  To: linux-kernel

Hallo

with this patch from here:

https://marc.info/?l=linux-kernel&m=151272209903675&w=2


e1000e is great again !

:)


tested 4.14.5-rc1

-- 

Greeting

Ronald

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up
  2017-12-08  8:34     ` Benjamin Poirier
@ 2017-12-08 10:45       ` Christian Hesse
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Hesse @ 2017-12-08 10:45 UTC (permalink / raw)
  To: Benjamin Poirier
  Cc: Ben Hutchings, Gabriel C, Jeff Kirsher, stable, Lennart Sorensen,
	Aaron Brown, Amit Pundir, Greg Kroah-Hartman, LKML

[-- Attachment #1: Type: text/plain, Size: 3293 bytes --]

Benjamin Poirier <bpoirier@suse.com> 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@suse.com>
> > > 
> > > 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up
  2017-12-07 20:02   ` Ben Hutchings
@ 2017-12-08  8:34     ` Benjamin Poirier
  2017-12-08 10:45       ` Christian Hesse
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Poirier @ 2017-12-08  8:34 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Gabriel C, Christian Hesse, Jeff Kirsher, stable,
	Lennart Sorensen, Aaron Brown, Amit Pundir, Greg Kroah-Hartman,
	LKML

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@suse.com>
> > 
> > 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?

diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index d6d4ed7acf03..31277d3bb7dc 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -1367,6 +1367,9 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)
  *  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).
  **/
 static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
 {
@@ -1382,7 +1385,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
 	 * Change or Rx Sequence Error interrupt.
 	 */
 	if (!mac->get_link_status)
-		return 0;
+		return 1;
 
 	/* First we want to see if the MII Status Register reports
 	 * link.  If so, then we want to get the current speed/duplex
@@ -1613,10 +1616,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
 	 * different link partner.
 	 */
 	ret_val = e1000e_config_fc_after_link_up(hw);
-	if (ret_val)
+	if (ret_val) {
 		e_dbg("Error configuring flow control\n");
+		return ret_val;
+	}
 
-	return ret_val;
+	return 1;
 }
 
 static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up
  2017-11-28 10:23 ` [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up Greg Kroah-Hartman
@ 2017-12-07 20:02   ` Ben Hutchings
  2017-12-08  8:34     ` Benjamin Poirier
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2017-12-07 20:02 UTC (permalink / raw)
  To: Benjamin Poirier, Jeff Kirsher
  Cc: stable, Lennart Sorensen, Aaron Brown, Amit Pundir,
	Greg Kroah-Hartman, LKML

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@suse.com>
> 
> 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?

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up
  2017-11-28 10:22 [PATCH 4.4 00/96] 4.4.103-stable review Greg Kroah-Hartman
@ 2017-11-28 10:23 ` Greg Kroah-Hartman
  2017-12-07 20:02   ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2017-11-28 10:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lennart Sorensen, Benjamin Poirier,
	Aaron Brown, Jeff Kirsher, Amit Pundir

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Benjamin Poirier <bpoirier@suse.com>

commit 19110cfbb34d4af0cdfe14cd243f3b09dc95b013 upstream.

Lennart reported the following race condition:

\ e1000_watchdog_task
    \ e1000e_has_link
        \ hw->mac.ops.check_for_link() === e1000e_check_for_copper_link
            /* link is up */
            mac->get_link_status = false;

                            /* interrupt */
                            \ e1000_msix_other
                                hw->mac.get_link_status = true;

        link_active = !hw->mac.get_link_status
        /* link_active is false, wrongly */

This problem arises because the single flag get_link_status is used to
signal two different states: link status needs checking and link status is
down.

Avoid the problem by using the return value of .check_for_link to signal
the link status to e1000e_has_link().

Reported-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/intel/e1000e/mac.c    |   11 ++++++++---
 drivers/net/ethernet/intel/e1000e/netdev.c |    2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

--- 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)
 {
@@ -423,7 +426,7 @@ s32 e1000e_check_for_copper_link(struct
 	 * Change or Rx Sequence Error interrupt.
 	 */
 	if (!mac->get_link_status)
-		return 0;
+		return 1;
 
 	/* First we want to see if the MII Status Register reports
 	 * link.  If so, then we want to get the current speed/duplex
@@ -461,10 +464,12 @@ s32 e1000e_check_for_copper_link(struct
 	 * different link partner.
 	 */
 	ret_val = e1000e_config_fc_after_link_up(hw);
-	if (ret_val)
+	if (ret_val) {
 		e_dbg("Error configuring flow control\n");
+		return ret_val;
+	}
 
-	return ret_val;
+	return 1;
 }
 
 /**
--- 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;
 		}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-09 21:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-09 21:00 [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up rwarsow
  -- strict thread matches above, loose matches on Subject: below --
2017-11-28 10:22 [PATCH 4.4 00/96] 4.4.103-stable review Greg Kroah-Hartman
2017-11-28 10:23 ` [PATCH 4.4 71/96] e1000e: Separate signaling for link check/link up Greg Kroah-Hartman
2017-12-07 20:02   ` Ben Hutchings
2017-12-08  8:34     ` Benjamin Poirier
2017-12-08 10:45       ` Christian Hesse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).