From patchwork Fri Jun 12 03:24:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinan Sun X-Patchwork-Id: 71335 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 754F5A00BE; Fri, 12 Jun 2020 05:47:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D42471BED6; Fri, 12 Jun 2020 05:46:30 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 7FFA11B951 for ; Fri, 12 Jun 2020 05:46:26 +0200 (CEST) IronPort-SDR: fTJ/sOmCsMQn5YfZHpUjFEv9olm3Hgzlz3Q0mrBqP4I3GO+CA+6q/qWKg7Yydw7OBkCzvLG5x+ d8PW3EsW8+EA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 20:46:25 -0700 IronPort-SDR: J2PtLqHzrBB67l2WBgEgYsycExO2wRB4DVCLBKNiQ9Ziad31uGBWTJ2aUbxlNcbhmAD24sC7DS 0fUeXcLmgEfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,501,1583222400"; d="scan'208";a="289759546" Received: from intel.sh.intel.com ([10.239.255.18]) by orsmga002.jf.intel.com with ESMTP; 11 Jun 2020 20:46:24 -0700 From: Guinan Sun To: dev@dpdk.org Cc: Guinan Sun , Jeb Cramer Date: Fri, 12 Jun 2020 03:24:00 +0000 Message-Id: <20200612032410.20864-12-guinanx.sun@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200612032410.20864-1-guinanx.sun@intel.com> References: <20200612032410.20864-1-guinanx.sun@intel.com> Subject: [dpdk-dev] [PATCH 11/21] net/ixgbe/base: modify loop accounting for retries X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The condition for comparing retry against max_retry was flawed in the do-while loops. For the case where retry was initialized to 0 and max_retry was initialized to 1, we'd break out of the loop at the condition when the intent is to retry the code at least once. Otherwise, the loop is unnecessary. The other places have a larger max_retry so code would get run multiple times (if necessary), but not to the intended extent. Signed-off-by: Jeb Cramer Signed-off-by: Guinan Sun --- drivers/net/ixgbe/base/ixgbe_phy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c index 9bb24f1ef..823cf161e 100644 --- a/drivers/net/ixgbe/base/ixgbe_phy.c +++ b/drivers/net/ixgbe/base/ixgbe_phy.c @@ -143,7 +143,7 @@ s32 ixgbe_read_i2c_combined_generic_int(struct ixgbe_hw *hw, u8 addr, u16 reg, else DEBUGOUT("I2C byte read combined error.\n"); retry++; - } while (retry < max_retry); + } while (retry <= max_retry); return IXGBE_ERR_I2C; } @@ -208,7 +208,7 @@ s32 ixgbe_write_i2c_combined_generic_int(struct ixgbe_hw *hw, u8 addr, u16 reg, else DEBUGOUT("I2C byte write combined error.\n"); retry++; - } while (retry < max_retry); + } while (retry <= max_retry); return IXGBE_ERR_I2C; } @@ -2062,7 +2062,7 @@ STATIC s32 ixgbe_read_i2c_byte_generic_int(struct ixgbe_hw *hw, u8 byte_offset, else DEBUGOUT("I2C byte read error.\n"); retry++; - } while (retry < max_retry); + } while (retry <= max_retry); return status; } @@ -2165,7 +2165,7 @@ STATIC s32 ixgbe_write_i2c_byte_generic_int(struct ixgbe_hw *hw, u8 byte_offset, else DEBUGOUT("I2C byte write error.\n"); retry++; - } while (retry < max_retry); + } while (retry <= max_retry); if (lock) hw->mac.ops.release_swfw_sync(hw, swfw_mask);