diff mbox

[dpdk-dev,v5,13/29] i40e/base: fix for PHY NVM interaction problem

Message ID 1457424877-26234-14-git-send-email-helin.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers show

Commit Message

Helin Zhang March 8, 2016, 8:14 a.m. UTC
This patch fixes a problem where the NVMUpdate Tool, when
using the PHY NVM feature, gets bad data from the PHY because
of contention on the MDIO interface from get phy capability
calls from the driver during regular operations. The problem
is fixed by adding a check if media is available before calling
get phy capability function because that bit is not set when
device is in PHY interaction mode.

Fixes: 842ea1996335 ("i40e/base: save link module type")

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

v4:
 - Reworded the commit logs.
diff mbox

Patch

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 8d2f2c7..cc8a63e 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2607,17 +2607,19 @@  enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw)
 	if (status)
 		return status;
 
-	status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
-					      NULL);
-	if (status)
-		return status;
-
-	memcpy(hw->phy.link_info.module_type, &abilities.module_type,
-		sizeof(hw->phy.link_info.module_type));
+	if (hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) {
+		status = i40e_aq_get_phy_capabilities(hw, false, false,
+						      &abilities, NULL);
+		if (status)
+			return status;
 
+		memcpy(hw->phy.link_info.module_type, &abilities.module_type,
+			sizeof(hw->phy.link_info.module_type));
+	}
 	return status;
 }
 
+
 /**
  * i40e_get_link_speed
  * @hw: pointer to the hw struct