]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
i40e: Add ablitity to enable/disable link from set_link_restart_an
authorCatherine Sullivan <catherine.sullivan@intel.com>
Wed, 4 Jun 2014 01:23:20 +0000 (01:23 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 25 Jun 2014 01:19:04 +0000 (18:19 -0700)
The ability is already there in the fw and this will make it easy
to toggle link without calling set_phy_config when no other link
settings need to change.

Change-ID: I185567ae81776382ac145247e4eb1ee95f22382c
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_common.c
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_prototype.h

index a51bba6347182639d890288286ede561a83dcb50..bbace40bd114caa38ba369367df2692bb97f6c0a 100644 (file)
@@ -971,12 +971,14 @@ i40e_status i40e_aq_clear_pxe_mode(struct i40e_hw *hw,
 /**
  * i40e_aq_set_link_restart_an
  * @hw: pointer to the hw struct
+ * @enable_link: if true: enable link, if false: disable link
  * @cmd_details: pointer to command details structure or NULL
  *
  * Sets up the link and restarts the Auto-Negotiation over the link.
  **/
 i40e_status i40e_aq_set_link_restart_an(struct i40e_hw *hw,
-                               struct i40e_asq_cmd_details *cmd_details)
+                                       bool enable_link,
+                                       struct i40e_asq_cmd_details *cmd_details)
 {
        struct i40e_aq_desc desc;
        struct i40e_aqc_set_link_restart_an *cmd =
@@ -987,6 +989,10 @@ i40e_status i40e_aq_set_link_restart_an(struct i40e_hw *hw,
                                          i40e_aqc_opc_set_link_restart_an);
 
        cmd->command = I40E_AQ_PHY_RESTART_AN;
+       if (enable_link)
+               cmd->command |= I40E_AQ_PHY_LINK_ENABLE;
+       else
+               cmd->command &= ~I40E_AQ_PHY_LINK_ENABLE;
 
        status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
index 7da37581bc02184d11e16695873f2f97051fa47e..df89b6c3db41336f04fa5434635c7cd64ea34321 100644 (file)
@@ -1027,9 +1027,10 @@ static int i40e_nway_reset(struct net_device *netdev)
        struct i40e_netdev_priv *np = netdev_priv(netdev);
        struct i40e_pf *pf = np->vsi->back;
        struct i40e_hw *hw = &pf->hw;
+       bool link_up = hw->phy.link_info.link_info & I40E_AQ_LINK_UP;
        i40e_status ret = 0;
 
-       ret = i40e_aq_set_link_restart_an(hw, NULL);
+       ret = i40e_aq_set_link_restart_an(hw, link_up, NULL);
        if (ret) {
                netdev_info(netdev, "link restart failed, aq_err=%d\n",
                            pf->hw.aq.asq_last_status);
index a430699c41d5e2be548db369bca02efdcaad40bf..3300b996a467e902f637b412610befe8047b92b0 100644 (file)
@@ -77,7 +77,8 @@ i40e_status i40e_aq_set_default_vsi(struct i40e_hw *hw, u16 vsi_id,
 i40e_status i40e_aq_clear_pxe_mode(struct i40e_hw *hw,
                                struct i40e_asq_cmd_details *cmd_details);
 i40e_status i40e_aq_set_link_restart_an(struct i40e_hw *hw,
-                               struct i40e_asq_cmd_details *cmd_details);
+                                       bool enable_link,
+                                       struct i40e_asq_cmd_details *cmd_details);
 i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,
                                bool enable_lse, struct i40e_link_status *link,
                                struct i40e_asq_cmd_details *cmd_details);