From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9D6BCA04C5; Fri, 4 Sep 2020 09:46:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6677D1C0D9; Fri, 4 Sep 2020 09:46:10 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 224C51C0CC for ; Fri, 4 Sep 2020 09:46:07 +0200 (CEST) IronPort-SDR: SYgpZxHIxSo76BjjBxP9xAtvFONqnFSdC95WnYa1ChD57KNND0nCsNRwfcCvRIaeGVv0PI/Y8S gTmSOSlZQOCg== X-IronPort-AV: E=McAfee;i="6000,8403,9733"; a="145407666" X-IronPort-AV: E=Sophos;i="5.76,388,1592895600"; d="scan'208";a="145407666" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2020 00:46:07 -0700 IronPort-SDR: 8okImplYYhzHRnLXgxfe4/A6VMJnquFNaXsIqV1bX2Ed4Tfq3ORKYBfjdBsLMmRWbyWnlqJ+ni fQtcoNcYUsyQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,388,1592895600"; d="scan'208";a="315769978" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by orsmga002.jf.intel.com with ESMTP; 04 Sep 2020 00:46:05 -0700 From: SteveX Yang To: dev@dpdk.org Cc: qiming.yang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, SteveX Yang Date: Fri, 4 Sep 2020 07:29:03 +0000 Message-Id: <20200904072907.10648-3-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200904072907.10648-1-stevex.yang@intel.com> References: <20200827011410.18401-1-stevex.yang@intel.com> <20200904072907.10648-1-stevex.yang@intel.com> Subject: [dpdk-dev] [PATCH v3 2/6] net/iavf: fix incorrect link status when speed is undefined 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" When PF is put in no-carrier state, iavf VFs will switch to "in carrier" state due to a link up + a link speed set to 0 (default value if no speed detected). To be consistent with linux drivers on which PF and VFs are in same carrier state, updates a link status of VF only if link is up and speed is different from undefined. Fixes: 48de41ca11f0 ("net/avf: enable link status update") Signed-off-by: SteveX Yang --- drivers/net/iavf/iavf_ethdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index f9dd5710c..ae508f2f0 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -620,8 +620,9 @@ iavf_dev_link_update(struct rte_eth_dev *dev, } new_link.link_duplex = ETH_LINK_FULL_DUPLEX; - new_link.link_status = vf->link_up ? ETH_LINK_UP : - ETH_LINK_DOWN; + new_link.link_status = (vf->link_up && + new_link.link_speed != ETH_SPEED_NUM_NONE) + ? ETH_LINK_UP : ETH_LINK_DOWN; new_link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); -- 2.17.1