From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C28388D8F for ; Sun, 25 Sep 2016 11:01:28 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 25 Sep 2016 02:01:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,392,1470726000"; d="scan'208";a="765710685" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 25 Sep 2016 02:01:27 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u8P91Pq2014910; Sun, 25 Sep 2016 17:01:25 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u8P91M9d006100; Sun, 25 Sep 2016 17:01:24 +0800 Received: (from xiaowan1@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u8P91MbK006096; Sun, 25 Sep 2016 17:01:22 +0800 From: Xiao Wang To: wenzhuo.lu@intel.com Cc: dev@dpdk.org, ferruh.yigit@intel.com, Xiao Wang Date: Sun, 25 Sep 2016 17:00:01 +0800 Message-Id: <1474794017-5896-25-git-send-email-xiao.w.wang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1474794017-5896-1-git-send-email-xiao.w.wang@intel.com> References: <1472312902-16963-2-git-send-email-xiao.w.wang@intel.com> <1474794017-5896-1-git-send-email-xiao.w.wang@intel.com> Subject: [dpdk-dev] [PATCH v2 24/40] net/ixgbe/base: use default check link function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2016 09:01:29 -0000 This patch removes X550em_a specific check link function and use default ixgbe_check_mac_link_generic for it. It is not necessary to check both the MAC link register and external PHY registers when checking link. Signed-off-by: Xiao Wang --- drivers/net/ixgbe/base/ixgbe_common.c | 7 ++++ drivers/net/ixgbe/base/ixgbe_type.h | 1 + drivers/net/ixgbe/base/ixgbe_x550.c | 78 ++++------------------------------- 3 files changed, 16 insertions(+), 70 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c index c01f919..985fece 100644 --- a/drivers/net/ixgbe/base/ixgbe_common.c +++ b/drivers/net/ixgbe/base/ixgbe_common.c @@ -4173,6 +4173,13 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed, *speed = IXGBE_LINK_SPEED_5GB_FULL; } break; + case IXGBE_LINKS_SPEED_10_X550EM_A: + *speed = IXGBE_LINK_SPEED_UNKNOWN; + if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T || + hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) { + *speed = IXGBE_LINK_SPEED_10_FULL; + } + break; default: *speed = IXGBE_LINK_SPEED_UNKNOWN; } diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h index 70f684c..f1e4274 100644 --- a/drivers/net/ixgbe/base/ixgbe_type.h +++ b/drivers/net/ixgbe/base/ixgbe_type.h @@ -2213,6 +2213,7 @@ enum { #define IXGBE_LINKS_SPEED_10G_82599 0x30000000 #define IXGBE_LINKS_SPEED_1G_82599 0x20000000 #define IXGBE_LINKS_SPEED_100_82599 0x10000000 +#define IXGBE_LINKS_SPEED_10_X550EM_A 0x00000000 #define IXGBE_LINK_UP_TIME 90 /* 9.0 Seconds */ #define IXGBE_AUTO_NEG_TIME 45 /* 4.5 Seconds */ diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c index a9f4d2a..3c19326 100644 --- a/drivers/net/ixgbe/base/ixgbe_x550.c +++ b/drivers/net/ixgbe/base/ixgbe_x550.c @@ -1716,72 +1716,6 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed, } /** - * ixgbe_check_link_m88 - Poll PHY for link - * @hw: pointer to hardware structure - * @speed: pointer to link speed - * @link_up: true when link is up - * @link_up_wait: bool indicating whether to wait for link - * - * Check that both the MAC and PHY have link. - */ -static s32 -ixgbe_check_link_m88(struct ixgbe_hw *hw, ixgbe_link_speed *speed, - bool *link_up, bool link_up_wait) -{ - u16 reg; - s32 rc; - u32 i; - - rc = ixgbe_check_mac_link_generic(hw, speed, link_up, link_up_wait); - if (rc || !*link_up) - return rc; - - rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_PHY_SPEC_STATUS, 0, ®); - - /* MAC link is up, so check external PHY link */ - *link_up = !!(reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK); - - if (link_up_wait) { - for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) { - if (!rc && - (reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK)) { - *link_up = true; - break; - } - *link_up = false; - msec_delay(100); - rc = hw->phy.ops.read_reg(hw, - IXGBE_M88E1500_PHY_SPEC_STATUS, - 0, ®); - } - } - -#define M88_SPEED(x) (IXGBE_M88E1500_PHY_SPEC_STATUS_RESOLVED | \ - IXGBE_M88E1500_PHY_SPEC_STATUS_DUPLEX | \ - ((IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_##x) <<\ - IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_SHIFT)) - - reg &= M88_SPEED(MASK); - switch (reg) { - case M88_SPEED(10): - *speed = IXGBE_LINK_SPEED_10_FULL; - break; - case M88_SPEED(100): - *speed = IXGBE_LINK_SPEED_100_FULL; - break; - case M88_SPEED(1000): - *speed = IXGBE_LINK_SPEED_1GB_FULL; - break; - default: - *speed = IXGBE_LINK_SPEED_UNKNOWN; - break; - } -#undef M88_SPEED - - return rc; -} - -/** * ixgbe_init_mac_link_ops_X550em - init mac link function pointers * @hw: pointer to hardware structure */ @@ -1811,10 +1745,14 @@ void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw) ixgbe_setup_mac_link_sfp_x550em; break; case ixgbe_media_type_copper: - if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T || - hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) { - mac->ops.setup_link = ixgbe_setup_sgmii_m88; - mac->ops.check_link = ixgbe_check_link_m88; + if (hw->mac.type == ixgbe_mac_X550EM_a) { + if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T || + hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) { + mac->ops.setup_link = ixgbe_setup_sgmii_m88; + } else { + mac->ops.setup_link = + ixgbe_setup_mac_link_t_X550em; + } } else { mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em; mac->ops.check_link = ixgbe_check_link_t_X550em; -- 1.9.3