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 D5581A0568; Mon, 2 Mar 2020 10:29:19 +0100 (CET) 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(-) 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; } -- 2.17.1