diff mbox

[net-next,05/15] i40e: Tell OS link is going down when calling set_phy_config

Message ID 1409304620-23251-6-git-send-email-jeffrey.t.kirsher@intel.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Kirsher, Jeffrey T Aug. 29, 2014, 9:30 a.m. UTC
From: Catherine Sullivan <catherine.sullivan@intel.com>

Since we don't seem to be getting an LSE telling us link is going down
during set_phy_config (but we do get an LSE telling us we are coming
back up), fake one for the OS and tell them link is going down. Also
do an atomic restart no matter what because there are times the user
may want to end with link up even if they started with link down (like
if they accidentally set it to a speed that can't link and are trying to
fix it).

Change-ID: I0a642af9c1d0feb67bce741aba1a9c33bd349ed6
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

Comments

Sergei Shtylyov Aug. 29, 2014, 5:37 p.m. UTC | #1
On 08/29/2014 01:30 PM, Jeff Kirsher wrote:

> From: Catherine Sullivan <catherine.sullivan@intel.com>

> Since we don't seem to be getting an LSE telling us link is going down
> during set_phy_config (but we do get an LSE telling us we are coming
> back up), fake one for the OS and tell them link is going down. Also
> do an atomic restart no matter what because there are times the user
> may want to end with link up even if they started with link down (like
> if they accidentally set it to a speed that can't link and are trying to
> fix it).

> Change-ID: I0a642af9c1d0feb67bce741aba1a9c33bd349ed6
> Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
> Tested-by: Jim Young <jamesx.m.young@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 21 ++++++++++++++++++---
>   1 file changed, 18 insertions(+), 3 deletions(-)

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index de4ce0e..101be2f 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -559,9 +559,17 @@ static int i40e_set_settings(struct net_device *netdev,
>   		config.eeer = abilities.eeer_val;
>   		config.low_power_ctrl = abilities.d3_lpan;
>
> -		/* If link is up set link and an so changes take effect */
> -		if (hw->phy.link_info.link_info & I40E_AQ_LINK_UP)
> -			config.abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
> +		/* set link and an so changes take effect */

    Can't parse this comment, probably a word is missing?

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rose, Gregory V Sept. 3, 2014, 5:27 p.m. UTC | #2
On Fri, 29 Aug 2014 21:37:39 +0400
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:

> On 08/29/2014 01:30 PM, Jeff Kirsher wrote:
> 
> > From: Catherine Sullivan <catherine.sullivan@intel.com>
> 
> > Since we don't seem to be getting an LSE telling us link is going
> > down during set_phy_config (but we do get an LSE telling us we are
> > coming back up), fake one for the OS and tell them link is going
> > down. Also do an atomic restart no matter what because there are
> > times the user may want to end with link up even if they started
> > with link down (like if they accidentally set it to a speed that
> > can't link and are trying to fix it).
> 
> > Change-ID: I0a642af9c1d0feb67bce741aba1a9c33bd349ed6
> > Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
> > Tested-by: Jim Young <jamesx.m.young@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> > ---
> >   drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 21
> > ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3
> > deletions(-)
> 
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index
> > de4ce0e..101be2f 100644 ---
> > a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++
> > b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -559,9 +559,17
> > @@ static int i40e_set_settings(struct net_device *netdev,
> > config.eeer = abilities.eeer_val; config.low_power_ctrl =
> > abilities.d3_lpan;
> >
> > -		/* If link is up set link and an so changes take
> > effect */
> > -		if (hw->phy.link_info.link_info & I40E_AQ_LINK_UP)
> > -			config.abilities |=
> > I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
> > +		/* set link and an so changes take effect */
> 
>     Can't parse this comment, probably a word is missing?
> 
> WBR, Sergei

"and an" should be "and AN" I think - AN standing in for
auto negotiation.

Agreed the comment needs fixing up.  Should probably just say
"auto negotiation"

- Greg

> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index de4ce0e..101be2f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -559,9 +559,17 @@  static int i40e_set_settings(struct net_device *netdev,
 		config.eeer = abilities.eeer_val;
 		config.low_power_ctrl = abilities.d3_lpan;
 
-		/* If link is up set link and an so changes take effect */
-		if (hw->phy.link_info.link_info & I40E_AQ_LINK_UP)
-			config.abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
+		/* set link and an so changes take effect */
+		config.abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
+		/* If link is up put link down */
+		if (hw->phy.link_info.link_info & I40E_AQ_LINK_UP) {
+			/* Tell the OS link is going down, the link will go
+			 * back up when fw says it is ready asynchronously
+			 */
+			netdev_info(netdev, "PHY settings change requested, NIC Link is going down.\n");
+			netif_carrier_off(netdev);
+			netif_tx_stop_all_queues(netdev);
+		}
 
 		/* make the aq call */
 		status = i40e_aq_set_phy_config(hw, &config, NULL);
@@ -678,6 +686,13 @@  static int i40e_set_pauseparam(struct net_device *netdev,
 	else
 		 return -EINVAL;
 
+	/* Tell the OS link is going down, the link will go back up when fw
+	 * says it is ready asynchronously
+	 */
+	netdev_info(netdev, "Flow control settings change requested, NIC Link is going down.\n");
+	netif_carrier_off(netdev);
+	netif_tx_stop_all_queues(netdev);
+
 	/* Set the fc mode and only restart an if link is up*/
 	status = i40e_set_fc(hw, &aq_failures, link_up);