From patchwork Wed Feb 24 12:42:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 386841 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp341841jap; Wed, 24 Feb 2021 04:43:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhIMDfmx69bIiZ4/qAelOGWwrkvBYlnBgS3osLGI19d+dxzn8aInVV5jrcK+aFIjJrKxAR X-Received: by 2002:aa7:db16:: with SMTP id t22mr2303767eds.178.1614170631672; Wed, 24 Feb 2021 04:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614170631; cv=none; d=google.com; s=arc-20160816; b=0sIAq7naIU7InRAqhoIP3A5VEVEgThWcF0D0jd7F+rignAMsn+gzBaRhd5omd+Jk7L bA19gMHRRDI4yLPX+DADboqu4+9REw0C80Uvt25muxBaRMFHucS6TP2te9PSQ+1p7Q2H y24NLT1Zd+qKBHsnDvgpIHvZo3urHgkTTk2l3dfL3VPt8N/3MyXz96SFfH5MONXskmW2 9tsBFpRzHKjyyXv8unQQrKnuN0gx4AWpunaaH5uj8ksdGP4T+UHqCfmb3UQs/AM6QTEt dWFOoQbjrAZDkwxI5P7Df1XkjTDich/fYYR5rYcb7qQd08R1DbW+4fqnMFiRESKbnP/I x0qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=RalF8ysaKjyIITW2TRUzkBob8rflHuIhNI+t0LOkO/k=; b=ZckfCNE/dJtkoAI0etwmtKgi9I0L4+zUkLp/XMrFVP5yULFafmBuc95lT2LzR8PM/Y rm0e2B16+bZ0egIwlPE3q5dCtB/PzSordQ8p0ZeN98Uly+56qOuiyWPo+IWXCR4eOx4d gbV+UbT4qmXmz74kz+fVICn8OOI9I/1WSnP20ywcTPzHpeS9MTvcq0X/ThS8CR9PyE3s lDRsatsuN1LwvEXowF7ZExO6tFU0S5Dy6Xi3LyhDCANturV83GEGprnIBOnJFZ8CDInG yZ4CSBP6M7fxuJsByQtEUowz8t1PFGapsMtoDY4snlUSzSGT7HmPPz+G7/a2J1WAIo8g AJwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id a12si1201001edb.110.2021.02.24.04.43.51; Wed, 24 Feb 2021 04:43:51 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDAEE16084D; Wed, 24 Feb 2021 13:43:25 +0100 (CET) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 74FC1160835; Wed, 24 Feb 2021 13:43:22 +0100 (CET) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 41EC12005AE; Wed, 24 Feb 2021 13:43:22 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A91252005AF; Wed, 24 Feb 2021 13:43:19 +0100 (CET) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 0EBBE40327; Wed, 24 Feb 2021 13:43:15 +0100 (CET) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, stable@dpdk.org, Rohit Raj Date: Wed, 24 Feb 2021 18:12:52 +0530 Message-Id: <20210224124311.29799-5-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210224124311.29799-1-hemant.agrawal@nxp.com> References: <20210211141620.12482-1-hemant.agrawal@nxp.com> <20210224124311.29799-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v3 04/23] net/dpaa: fix link get API implementation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" From: Rohit Raj According to DPDK Documentation, rte_eth_link_get API can wait up to 9 seconds for auto-negotiation to finish and then returns link status. In current implementation of rte_eth_link_get API in DPAA drivers, it was not waiting for auto negotiation to finish and was returning link status DOWN It can cause issues with DPDK applications which relies on rte_eth_link_get API for link statusand does not support link status interrupt. This patch fixes this bug by adding wait for up to 9 seconds for auto negotiation to finish. Fixes: 2aa10990a8dd ("bus/dpaa: enable link state interrupt") Cc: stable@dpdk.org Signed-off-by: Rohit Raj Acked-by: Hemant Agrawal --- drivers/net/dpaa/dpaa_ethdev.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index d643514de6..c59873dd8a 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -49,6 +49,9 @@ #include #include +#define CHECK_INTERVAL 100 /* 100ms */ +#define MAX_REPEAT_TIME 90 /* 9s (90 * 100ms) in total */ + /* Supported Rx offloads */ static uint64_t dev_rx_offloads_sup = DEV_RX_OFFLOAD_JUMBO_FRAME | @@ -669,23 +672,30 @@ dpaa_dev_tx_burst_mode_get(struct rte_eth_dev *dev, } static int dpaa_eth_link_update(struct rte_eth_dev *dev, - int wait_to_complete __rte_unused) + int wait_to_complete) { struct dpaa_if *dpaa_intf = dev->data->dev_private; struct rte_eth_link *link = &dev->data->dev_link; struct fman_if *fif = dev->process_private; struct __fman_if *__fif = container_of(fif, struct __fman_if, __if); int ret, ioctl_version; + uint8_t count; PMD_INIT_FUNC_TRACE(); ioctl_version = dpaa_get_ioctl_version_number(); - if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) { - ret = dpaa_get_link_status(__fif->node_name, link); - if (ret) - return ret; + for (count = 0; count <= MAX_REPEAT_TIME; count++) { + ret = dpaa_get_link_status(__fif->node_name, link); + if (ret) + return ret; + if (link->link_status == ETH_LINK_DOWN && + wait_to_complete) + rte_delay_ms(CHECK_INTERVAL); + else + break; + } } else { link->link_status = dpaa_intf->valid; }