From patchwork Mon Mar 2 14:58:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184087 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2193797ile; Mon, 2 Mar 2020 01:29:20 -0800 (PST) X-Google-Smtp-Source: ADFU+vsZxJePu1xYOamsT7xhG9voqcee4m63xu8P7ou90xdFpn1VJBW/tLb5IOODQ64G7DPJzqgs X-Received: by 2002:a17:906:a3c8:: with SMTP id ca8mr1981603ejb.342.1583141360220; Mon, 02 Mar 2020 01:29:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583141360; cv=none; d=google.com; s=arc-20160816; b=z9A147/Tef63SrROUXL0hNAdrbwyg0ImCGUx7Aocz+92RI77uYJjI1z7em8JNBIV3+ LMBEB7TR8uwLStZE20V704KOeeeZvhuL70895HNfMkpoa/UFsoUwmoQxq69htMuDZ93J nSMBtVjobtLEVNozZmXFT1yImjQDmaLmbCmQikr5uK3D5CEy2SXReFz01Ymq+EQpo9Fe cRrvFD243qDP0snewnHNl9CB8IfpgniytI2k3dMPLo+y51P6PkX6jRI2WWH2KAANEzfN jg5O6P5ejFMcVYYEzEfBs2Ps/yor4+Pm+R3Oxhc9JVXEOYgj96QUnuokhe1SKgeKx9XC 05Iw== 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=GpMgUb5gISaZq/zCivcDTb/IxM8HTex+ow0GnVAiwHA=; b=Znc1AgpZl2E8CprFFosAhqs2L0GU1Y8jjIL1VrqU9h+PPr5r/8yDRp4Z2oAl6jhXlF WdetEqQBLBX8HXGp1VJhHYbA88cFwIAkMCgyPQCDfUXRfzijYUczd1zy/KDZUG3IzQ7y 6X5l9X/p2cvTYD4+fxxLAPvmHxidiRIbrYmOA/0NZPYam2XA6dgYGI6akZIZZVjSXE2z KasD6TpYgvh7iKtFDzG9mlfRAkoqXEt/QEJQFVDl/UP7lj8dIZFYFeNgvPuDQCI+0gDV kmmT3Fg8KqvRtcdSrufXzd3uoe/VED6cJ7JP62xa+lMmmeUdARfVwN5mxKKgi9IzvnrP 8XFg== 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 y14si1569646eju.344.2020.03.02.01.29.20; Mon, 02 Mar 2020 01:29:20 -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 D96171C120; Mon, 2 Mar 2020 10:26:56 +0100 (CET) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id DEAD61C0B4 for ; Mon, 2 Mar 2020 10:26:46 +0100 (CET) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A711E200F4C; Mon, 2 Mar 2020 10:26:46 +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 5439A200F58; Mon, 2 Mar 2020 10:26:44 +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 A37BE4029E; Mon, 2 Mar 2020 17:26:41 +0800 (SGT) From: Hemant Agrawal To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Rohit Raj Date: Mon, 2 Mar 2020 20:28:28 +0530 Message-Id: <20200302145829.27808-16-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200302145829.27808-1-hemant.agrawal@nxp.com> References: <20200302145829.27808-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 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 e8fa8f569..3eac85429 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; }