[41/69] net/i40e/base: changeed code wrapping for CARLSVILLE_HW
diff mbox series

Message ID 20191202074935.97629-42-xiaolong.ye@intel.com
State New
Delegated to: xiaolong ye
Headers show
Series
  • update for i40e base code
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Ye Xiaolong Dec. 2, 2019, 7:49 a.m. UTC
As pointed out by Arkadiusz, the code is not wrapped properly and if
CARLSVILLE_HW is not defined the code will not compile.  In addition,
noticed that the we were taking the if condition majority of the time so
flip the condition to only test for the device that requires the
workaround when updating stats.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Reviewed-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Michael Alice <alice.michael@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index 337d62b5f..cedec4dce 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7173,27 +7173,30 @@  enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw,
 enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 					    u32 *tx_counter, u32 *rx_counter)
 {
-	enum i40e_status_code retval;
-	u32 cmd_status;
-
+#ifdef CARLSVILLE_HW
 	/* only X710-T*L requires special handling of counters
 	 * for other devices we just read the MAC registers
 	 */
-	if (hw->device_id != I40E_DEV_ID_10G_BASE_T_BC) {
-		*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
-		*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
-		return I40E_SUCCESS;
-	}
+	if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC) {
+		enum i40e_status_code retval;
+		u32 cmd_status;
 
-	retval = i40e_aq_run_phy_activity(hw,
+		retval = i40e_aq_run_phy_activity(hw,
 			I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED,
 			I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS,
 			&cmd_status, tx_counter, rx_counter, NULL);
 
-	if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS)
-		retval = I40E_ERR_ADMIN_QUEUE_ERROR;
+		if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS)
+			retval = I40E_ERR_ADMIN_QUEUE_ERROR;
 
-	return retval;
+		return retval;
+	}
+
+#endif /* CARLSVILLE_HW */
+	*tx_counter = rd32(hw, I40E_PRTPM_TLPIC);
+	*rx_counter = rd32(hw, I40E_PRTPM_RLPIC);
+
+	return I40E_SUCCESS;
 }
 
 /**