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 10B6DC322 for ; Tue, 16 Jun 2015 16:39:54 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 16 Jun 2015 07:38:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,626,1427785200"; d="scan'208";a="509199733" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 16 Jun 2015 07:38:50 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t5GEcmti008489 for ; Tue, 16 Jun 2015 15:38:48 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t5GEcmX3012945 for ; Tue, 16 Jun 2015 15:38:48 +0100 Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id t5GEcmck012941 for dev@dpdk.org; Tue, 16 Jun 2015 15:38:48 +0100 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Tue, 16 Jun 2015 15:38:48 +0100 Message-Id: <1434465528-12907-1-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 Subject: [dpdk-dev] [PATCH] ixgbevf: fix link status for PF up/down events 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: Tue, 16 Jun 2015 14:39:55 -0000 Current ixgbe VF base driver only really read the status register when: - get_link_status is true - link reset - mailbox timeout. We only set get_link_status to true when we start the PF/VF, so following calls to ixgbe_dev_link_update will just keep the old link status unless the link has been reset. Because of this behaviour, when the link status of the PF changes after the VF has been initialized, we do not read the current status register from the nic and instead we just keep the old link status. Fix the problem by setting this field to true before calling ixgbe_check_link function from base driver. We don't need to check after this call for get_link_status anymore, so remove it. Signed-off-by: Sergio Gonzalez Monroy --- drivers/net/ixgbe/ixgbe_ethdev.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7414a2e..4affb01 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2128,11 +2128,14 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) memset(&old, 0, sizeof(old)); rte_ixgbe_dev_atomic_read_link_status(dev, &old); + hw->mac.get_link_status = true; + /* check if it needs to wait to complete, if lsc interrupt is enabled */ if (wait_to_complete == 0 || dev->data->dev_conf.intr_conf.lsc != 0) diag = ixgbe_check_link(hw, &link_speed, &link_up, 0); else diag = ixgbe_check_link(hw, &link_speed, &link_up, 1); + if (diag != 0) { link.link_speed = ETH_LINK_SPEED_100; link.link_duplex = ETH_LINK_HALF_DUPLEX; @@ -2142,12 +2145,6 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) return 0; } - if (link_speed == IXGBE_LINK_SPEED_UNKNOWN && - !hw->mac.get_link_status) { - memcpy(&link, &old, sizeof(link)); - return -1; - } - if (link_up == 0) { rte_ixgbe_dev_atomic_write_link_status(dev, &link); if (link.link_status == old.link_status) -- 1.9.3