From patchwork Fri Mar 6 09:57:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184251 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp7233821ile; Fri, 6 Mar 2020 02:02:15 -0800 (PST) X-Google-Smtp-Source: ADFU+vtITzvCAodAYXrODvOQUceyqj5PxbhH88wTWPy0ZNeTaTzJbluXMBjW9eW5515e8qfunBCM X-Received: by 2002:a17:906:f258:: with SMTP id gy24mr2245867ejb.120.1583488934689; Fri, 06 Mar 2020 02:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583488934; cv=none; d=google.com; s=arc-20160816; b=FHefyX9jDyZjmi2MunBrDU0hSB2yM9bgSYsvhrdHMubPw6LsucAz9VfnOE1gb7KHGm ufeDfZayq1bLKXy1rEkbz5cs2aKZCKHHfCD158tvNGQNMOvpf9HnQVsXGYIsGZW1cqr0 RFC/liQP7hBXWE3hosRe71fJHMgya/9G8MhGHP8rViNa3Jw8nLvJUyKpSAnFRMrYECVA QLMnBDr/R+R5K2fJos/c/hXtSi648JOyF26L9V/ThCU3ugBloCSneqB1E6/ech+kvSjg 3tF8rB/n/H3M6B3I4wvB0tFRAD4tJOAA7rZ1JBwLG5zKEvAwIaKjUG5B5+d6plt6B3ig JQjw== 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=24AcGpA/42VRh2lY4d8MdSQJxmdZMP/SgBAzzYC61Hw=; b=yieC0zzgtDgbP9UngVrAHWvGKVAaZOhb2FCGyqFi1peGHk+KFpg7Ye/zqIBlmSfSZv hHHonphY3aSn4zYjSZ/HG0kXz3X/JmeJr/sPF8CW4KfYMjoCcYGIDDNUmUJrg6mxvNSK cluCSSq599EK0xtMCfYhNI8vxDfg8ATaECytOeQXPBu5demfBQFSAUj7KDQtbp9diyvl kYHp83HKyb1algxrCK9KCMMVxYQDdsGlJx9dRxmimnN/jYRHEjPzpfQkjtmKfFjewvpl IuA8BelkoxmLu5tqkeAZNPhGPmTuYQX7EiJhDY2oFoglDEu2VKmZCaZHuGoGaU4uIKpv gqdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.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 dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id o18si1457087edz.215.2020.03.06.02.02.14; Fri, 06 Mar 2020 02:02:14 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D9B761C0C3; Fri, 6 Mar 2020 11:00:09 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 1300D1C038 for ; Fri, 6 Mar 2020 10:59:57 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C09B71A0A80; Fri, 6 Mar 2020 10:59:56 +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 6BE931A0AA5; Fri, 6 Mar 2020 10:59:54 +0100 (CET) Received: from bf-netperf1.ap.com (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B7BE54029B; Fri, 6 Mar 2020 17:59:51 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Rohit Raj Date: Fri, 6 Mar 2020 15:27:41 +0530 Message-Id: <20200306095742.18080-16-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200306095742.18080-1-hemant.agrawal@nxp.com> References: <20200302145829.27808-1-hemant.agrawal@nxp.com> <20200306095742.18080-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 15/16] bus/dpaa: enable set link status 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" From: Rohit Raj Enabled set link status API to start/stop phy device from application. Signed-off-by: Rohit Raj --- drivers/bus/dpaa/base/qbman/process.c | 35 ++++++++++++++++++++--- drivers/bus/dpaa/include/process.h | 3 ++ drivers/bus/dpaa/rte_bus_dpaa_version.map | 1 + drivers/net/dpaa/dpaa_ethdev.c | 14 +++++++-- 4 files changed, 47 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c index 598b10661..8ab57f105 100644 --- a/drivers/bus/dpaa/base/qbman/process.c +++ b/drivers/bus/dpaa/base/qbman/process.c @@ -317,7 +317,7 @@ int rte_dpaa_intr_enable(char *if_name, int efd) ret = ioctl(fd, DPAA_IOCTL_ENABLE_LINK_STATUS_INTERRUPT, &args); if (ret) { - perror("Failed to enable interrupt\n"); + printf("Failed to enable interrupt: Not Supported\n"); return ret; } @@ -333,7 +333,7 @@ int rte_dpaa_intr_disable(char *if_name) ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT, &if_name); if (ret) { - perror("Failed to disable interrupt\n"); + printf("Failed to disable interrupt: Not Supported\n"); return ret; } @@ -356,9 +356,36 @@ int rte_dpaa_get_link_status(char *if_name) ret = ioctl(fd, DPAA_IOCTL_GET_LINK_STATUS, &args); if (ret) { - perror("Failed to get link status\n"); - return ret; + printf("Failed to get link status: Not Supported\n"); + return -errno; } return args.link_status; } + +#define DPAA_IOCTL_UPDATE_LINK_STATUS \ + _IOW(DPAA_IOCTL_MAGIC, 0x11, struct usdpaa_ioctl_link_status_args) + +int rte_dpaa_update_link_status(char *if_name, int link_status) +{ + struct usdpaa_ioctl_link_status_args args; + int ret; + + ret = check_fd(); + if (ret) + return ret; + + strcpy(args.if_name, if_name); + args.link_status = link_status; + + ret = ioctl(fd, DPAA_IOCTL_UPDATE_LINK_STATUS, &args); + if (ret) { + if (errno == EINVAL) + printf("Failed to set link status: Not Supported\n"); + else + perror("Failed to set link status"); + return ret; + } + + return 0; +} diff --git a/drivers/bus/dpaa/include/process.h b/drivers/bus/dpaa/include/process.h index 312da1245..9f8c85895 100644 --- a/drivers/bus/dpaa/include/process.h +++ b/drivers/bus/dpaa/include/process.h @@ -94,4 +94,7 @@ struct usdpaa_ioctl_link_status_args { __rte_experimental int rte_dpaa_get_link_status(char *if_name); +__rte_experimental +int rte_dpaa_update_link_status(char *if_name, int link_status); + #endif /* __PROCESS_H */ diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map index bf70e6656..146f29556 100644 --- a/drivers/bus/dpaa/rte_bus_dpaa_version.map +++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map @@ -103,4 +103,5 @@ EXPERIMENTAL { rte_dpaa_get_link_status; rte_dpaa_intr_disable; rte_dpaa_intr_enable; + rte_dpaa_update_link_status; }; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 28c6b1c17..c0a96dd47 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -972,17 +972,27 @@ dpaa_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) static int dpaa_link_down(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + struct __fman_if *__fif; + PMD_INIT_FUNC_TRACE(); - dpaa_eth_dev_stop(dev); + __fif = container_of(fif, struct __fman_if, __if); + + rte_dpaa_update_link_status(__fif->node_name, ETH_LINK_DOWN); return 0; } static int dpaa_link_up(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + struct __fman_if *__fif; + PMD_INIT_FUNC_TRACE(); - dpaa_eth_dev_start(dev); + __fif = container_of(fif, struct __fman_if, __if); + + rte_dpaa_update_link_status(__fif->node_name, ETH_LINK_UP); return 0; }