From patchwork Thu Feb 11 14:16:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 380998 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp2121681jah; Thu, 11 Feb 2021 06:28:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZ5663NuR0MZ/08WXO6xhKqIP+XpJLihZkJqIFrKVv/uAolOJvTRb0JOsSRGpEecDAHe0r X-Received: by 2002:a17:907:210e:: with SMTP id qn14mr9049656ejb.237.1613053714236; Thu, 11 Feb 2021 06:28:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613053714; cv=none; d=google.com; s=arc-20160816; b=cM3/qk+R7SGYzH03oiJuV5Sotq7iUr8zo+UmrODBxmS49K8rBoBgmsLL7MVjOYERDP HICBNEKn50lhg6/ZWDfXO4qD3oIXcRDS81E3JBBukIxsMdsNoP65Bomp4IwqfE9s0/rJ Lx/s6DvDAcv37wRuXrJ3EB9LdBub3fnCjIQv8aNR5cpTjjxQARPyzsfzXQCKmc6cStKh pLC0WKF4763ziuVOq5tplbO/mnFduRmfiA5IolYnZSH3BNc+8/U86//H9qI5/uoTYf1k 67jixsSzYInDTkfnpLMRyp7YDJwAewqdvFOcerHSnjUhjFgTVE/4eMaju3g7SObMXsLN wmZw== 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:to:from; bh=gt9JEdfucpxNZhgP8NVHy8IGvzPaPLdIGQJsp+egGFU=; b=Kk+okASDE/nxrfn5mMAYsb03epJhTYg6CZrVHjT4dFFTV2Mt1zsQ6LfqOFGevz6n0G GTwR6WS660NWDwQ9pZxNWupvGN35Xf/eC7FS3BpVm+Gd6FgvzhSleJqwurby495xm1B8 BgnQy9qvwwO58Pt0yTK+7nHFvDXNL+DloJRfN4d+qQs5ucubXWWlUlIlYcxJWFeFL3xl jD2o+6Kg14nCqDW7/L0JgoXGMmCJ8yth6IF3LOhrMtudMX4yE8eFitQ+M31YUdwn62qg HEP3H30FdWA68bCYAhu3ZrQEoDNP9nsXzwf8evFdDEW6wcigYYFqD3m4/bFdmGB0i4Mi 680g== 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 lu13si3766978ejb.351.2021.02.11.06.28.34; Thu, 11 Feb 2021 06:28:34 -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 8DEF51CC562; Thu, 11 Feb 2021 15:28:05 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 6C80F1CC3B1 for ; Thu, 11 Feb 2021 15:28:00 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 508161A061E; Thu, 11 Feb 2021 15:28:00 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 123191A05C7; Thu, 11 Feb 2021 15:27:59 +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 10A66402E5; Thu, 11 Feb 2021 15:27:56 +0100 (CET) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Date: Thu, 11 Feb 2021 19:46:04 +0530 Message-Id: <20210211141620.12482-5-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210211141620.12482-1-hemant.agrawal@nxp.com> References: <20210120142723.14090-1-hemant.agrawal@nxp.com> <20210211141620.12482-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 04/20] 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 upto 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 wasn't 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 doesn't 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; }