From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6EFDA0A00; Thu, 31 Dec 2020 08:24:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E61AC140D2D; Thu, 31 Dec 2020 08:23:11 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 16486140CF1 for ; Thu, 31 Dec 2020 08:23:00 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 0BV7LGmS010253 for ; Wed, 30 Dec 2020 23:23:00 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=c+s2b3uqKgOXLYGxlBI3/RO/oWJvuOkSWi0NZmHiozk=; b=SRIMVHi+PJPdZDMv9UpmirqTfrm43DiPY0BMNzFbU/uya6wXm7cosE8HNIEPdHHi4UXB 37R9VrtoQoMoVlghtdg33DhGBr2mXj3J+NWqa6OUNZ/+BZTDNEJvQaPpzbn9iV654afq TA396wmNr43er0y3cmHlL81hSwRO2gglPYgp7f7mFySDyMuaQRkf6j0XFSOLWyyqmU/d dMpRk+asvzn2VaoU8Z6yIFX5ix1l4dfyK9HiJ0xnDwqxLGVPM8ctdQU4F0mTIJvnTAGA LPsXVkhYHSF/rB+QvsiKIoViVjNiRFxHTrhK4uv24w/r/nRT1wEyc3nuARWU11Ge6t0h TA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 35s80806ff-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 30 Dec 2020 23:23:00 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Dec 2020 23:22:59 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Dec 2020 23:22:58 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 30 Dec 2020 23:22:58 -0800 Received: from localhost.localdomain (unknown [10.111.145.157]) by maili.marvell.com (Postfix) with ESMTP id 7EDAF3F703F; Wed, 30 Dec 2020 23:22:58 -0800 (PST) From: "Nalla, Pradeep" To: "Nalla, Pradeep" , Radha Mohan Chintakuntla , Veerasenareddy Burru CC: , , Date: Thu, 31 Dec 2020 07:22:45 +0000 Message-ID: <20201231072247.5719-14-pnalla@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201231072247.5719-1-pnalla@marvell.com> References: <20201231072247.5719-1-pnalla@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2020-12-31_02:2020-12-30, 2020-12-31 signatures=0 Subject: [dpdk-dev] [PATCH 13/15] net/octeontx_ep: stats get/reset and link update 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: "Nalla Pradeep" Added stats get, stats reset and link update operations. Following stats are reported currently 1. ibytes, ipackets and ierrors. 2. obytes, opackets and oerrors. Signed-off-by: Nalla Pradeep --- drivers/net/octeontx_ep/otx_ep_ethdev.c | 84 +++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/drivers/net/octeontx_ep/otx_ep_ethdev.c b/drivers/net/octeontx_ep/otx_ep_ethdev.c index d8da457d86..1739bae765 100644 --- a/drivers/net/octeontx_ep/otx_ep_ethdev.c +++ b/drivers/net/octeontx_ep/otx_ep_ethdev.c @@ -60,6 +60,27 @@ otx_ep_dev_info_get(struct rte_eth_dev *eth_dev, return 0; } +static int +otx_ep_dev_link_update(struct rte_eth_dev *eth_dev, + int wait_to_complete __rte_unused) +{ + struct otx_ep_device *otx_epvf; + struct rte_eth_link link; + + otx_epvf = (struct otx_ep_device *)OTX_EP_DEV(eth_dev); + memset(&link, 0, sizeof(link)); + link.link_status = ETH_LINK_DOWN; + link.link_speed = ETH_SPEED_NUM_NONE; + link.link_duplex = ETH_LINK_HALF_DUPLEX; + link.link_autoneg = ETH_LINK_AUTONEG; + if (otx_epvf->linkup) { + link.link_status = ETH_LINK_UP; + link.link_speed = ETH_SPEED_NUM_10G; + link.link_duplex = ETH_LINK_FULL_DUPLEX; + } + return rte_eth_linkstatus_set(eth_dev, &link); +} + static int otx_ep_dev_start(struct rte_eth_dev *eth_dev) { @@ -348,6 +369,66 @@ otx_ep_tx_queue_release(void *txq) otx_ep_delete_iqs(tq->otx_ep_dev, tq->q_no); } +static int +otx_ep_dev_stats_get(struct rte_eth_dev *eth_dev, + struct rte_eth_stats *stats) +{ + struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev); + struct otx_ep_instr_queue *iq; + struct otx_ep_droq *droq; + int i; + uint64_t bytes = 0; + uint64_t pkts = 0; + uint64_t drop = 0; + + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { + iq = otx_epvf->instr_queue[i]; + pkts += iq->stats.tx_pkts; + bytes += iq->stats.tx_bytes; + drop += iq->stats.instr_dropped; + } + stats->opackets = pkts; + stats->obytes = bytes; + stats->oerrors = drop; + + pkts = 0; + drop = 0; + bytes = 0; + + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { + droq = otx_epvf->droq[i]; + pkts += droq->stats.pkts_received; + bytes += droq->stats.bytes_received; + drop += droq->stats.rx_alloc_failure + droq->stats.rx_err; + } + stats->ibytes = bytes; + stats->ipackets = pkts; + stats->ierrors = drop; + + return 0; +} + +static int +otx_ep_dev_stats_reset(struct rte_eth_dev *eth_dev) +{ + struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev); + struct otx_ep_instr_queue *iq; + struct otx_ep_droq *droq; + int i; + + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { + iq = otx_epvf->instr_queue[i]; + iq->stats.tx_pkts = 0; + iq->stats.tx_bytes = 0; + } + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { + droq = otx_epvf->droq[i]; + droq->stats.pkts_received = 0; + droq->stats.bytes_received = 0; + } + return 0; +} + /* Define our ethernet definitions */ static const struct eth_dev_ops otx_ep_eth_dev_ops = { .dev_configure = otx_ep_dev_configure, @@ -357,6 +438,9 @@ static const struct eth_dev_ops otx_ep_eth_dev_ops = { .rx_queue_release = otx_ep_rx_queue_release, .tx_queue_setup = otx_ep_tx_queue_setup, .tx_queue_release = otx_ep_tx_queue_release, + .link_update = otx_ep_dev_link_update, + .stats_get = otx_ep_dev_stats_get, + .stats_reset = otx_ep_dev_stats_reset, .dev_infos_get = otx_ep_dev_info_get, }; -- 2.17.1