From: "Neftin, Sasha" <sasha.neftin@intel.com>
To: Benjamin Poirier <bpoirier@suse.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-kernel@vger.kernel.org,
Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Subject: Re: [Intel-wired-lan] [PATCH 4/5] e1000e: Separate signaling for link check/link up
Date: Wed, 2 Aug 2017 14:28:07 +0300 [thread overview]
Message-ID: <14acedf3-e5d9-31e8-9ff6-fabc2127c021@intel.com> (raw)
In-Reply-To: <20170721183627.13373-4-bpoirier@suse.com>
On 7/21/2017 21:36, Benjamin Poirier wrote:
> 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>
> ---
> drivers/net/ethernet/intel/e1000e/mac.c | 11 ++++++++---
> drivers/net/ethernet/intel/e1000e/netdev.c | 2 +-
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c
> index b322011ec282..f457c5703d0c 100644
> --- 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 e1000_hw *hw)
> * 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 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
> @@ -461,10 +464,12 @@ s32 e1000e_check_for_copper_link(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;
> }
>
> /**
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index fc6a1d9999b2..5a8ab1136566 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -5081,7 +5081,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter)
> 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;
> }
Hello Benjamin,
Will this patch fix any serious problem with link indication? Is it
necessary? Can we consider your patch series without 4/5 part?
next prev parent reply other threads:[~2017-08-02 11:28 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 14:21 commit 16ecba59 breaks 82574L under heavy load Lennart Sorensen
2017-07-18 23:14 ` Benjamin Poirier
2017-07-19 14:19 ` Lennart Sorensen
2017-07-20 0:07 ` Benjamin Poirier
2017-07-20 14:00 ` Lennart Sorensen
2017-07-20 23:44 ` Benjamin Poirier
2017-07-21 15:27 ` Lennart Sorensen
2017-07-21 16:09 ` Lennart Sorensen
2017-07-21 18:36 ` [PATCH 1/5] e1000e: Fix error path in link detection Benjamin Poirier
2017-07-21 18:36 ` [PATCH 2/5] e1000e: Fix wrong comment related to " Benjamin Poirier
2017-09-19 0:13 ` [Intel-wired-lan] " Brown, Aaron F
2017-07-21 18:36 ` [PATCH 3/5] e1000e: Fix return value test Benjamin Poirier
2017-09-15 0:20 ` [Intel-wired-lan] " Brown, Aaron F
2017-07-21 18:36 ` [PATCH 4/5] e1000e: Separate signaling for link check/link up Benjamin Poirier
2017-07-21 18:50 ` Lennart Sorensen
2017-08-02 11:28 ` Neftin, Sasha [this message]
2017-08-02 14:34 ` [Intel-wired-lan] " Lennart Sorensen
2017-08-02 14:49 ` Benjamin Poirier
2017-09-15 0:27 ` Brown, Aaron F
2017-07-21 18:36 ` [PATCH 5/5] e1000e: Avoid receiver overrun interrupt bursts Benjamin Poirier
2017-07-21 18:48 ` Lennart Sorensen
2017-08-12 2:13 ` Philip Prindeville
2017-08-12 2:47 ` Philip Prindeville
2017-08-21 17:17 ` Benjamin Poirier
2017-09-15 0:38 ` [Intel-wired-lan] " Brown, Aaron F
2017-09-19 18:38 ` [5/5] " Philip Prindeville
2017-09-19 19:41 ` Benjamin Poirier
2017-10-24 17:20 ` Lennart Sorensen
2017-10-24 17:39 ` Philip Prindeville
2017-09-15 0:18 ` [Intel-wired-lan] [PATCH 1/5] e1000e: Fix error path in link detection Brown, Aaron F
2017-07-21 19:02 ` commit 16ecba59 breaks 82574L under heavy load Lennart Sorensen
2017-07-24 21:56 ` Philip Prindeville
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14acedf3-e5d9-31e8-9ff6-fabc2127c021@intel.com \
--to=sasha.neftin@intel.com \
--cc=bpoirier@suse.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lsorense@csclub.uwaterloo.ca \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®