From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0058.outbound.protection.outlook.com [104.47.36.58]) by dpdk.org (Postfix) with ESMTP id 0119E7D87 for ; Thu, 31 Aug 2017 16:56:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EI2Thj43x2tXQpC4z+L4iuPVf8u7GKd7q6nHzoL3+os=; b=Ln9znjfj+0Rnwyn/SznSXpAxnzy3hU4Tw/u7Y37adf6EWWPEFlvgKHPnzQIyyH1jg/lmUSe2AZtZlP2WVFicb4zElwfqKxiU6R51q5THlQnehde1Srx+u7YGaVbQx0tl+KVH06TCme0H8qjrvk6Glr4cPrMz9aVaJQU3BDARsaM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin.domain.name (171.76.126.71) by SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Thu, 31 Aug 2017 14:56:01 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: ferruh.yigit@intel.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Thu, 31 Aug 2017 20:24:27 +0530 Message-Id: <20170831145436.5397-18-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.76.126.71] X-ClientProxiedBy: MA1PR01CA0109.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::25) To SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 600cf227-b6ef-4eef-f201-08d4f0806614 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN2PR07MB2526; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 3:ty7UbRQ82j8IoObBDgcZk2UMli9FaIl3+ERJhX+YyCN21MpppwFAMSNrBbjzl5bUqD5DCyFW4cpfqQpJrhDLn+9j6EVKUhO8E3ZNt/ea6Xkaog6TDQ+SGMYxnxs8bHDmg5FkQIVRyvm7N5psdFbfTLF5FKp8S406W29bpbN35YFg/nmSPZ71Pz1vnzP00684jqSFZOXE7qJeEIagcLXK55XmH01oG1yBe7L5/jLd3a5T3FaOd2cW5ic8ITogi0nv; 25:Aj1ps6eK8UcisE6AFjvGhFK4KaYanskZ0CdmdH1ilEOFI0IgmJYeMl5rqUUJIIkaeKxU//peTVO3JkT7AZN5fs8ja7vphVQQSr84LWgliGFUqMzzO/E+GajWL/aKLsdcMeUQnXcZ8UcP8QT+t/1MhYNSpUsplY6d1Om6kOQkZ8BmhB+4p5QdgnYqeeWeKlsHDyNMSwNt9c1QT83JkqUaaMNf/SGfKcVRPO4PUkx+HxvS34D3z3NiwzMZxVEYUv/kHherGcJAR66QKa2KFJKtEEcZIrH3qV51qqkpvoPvSP3/XPeaZ2A8HYkzT7nlIPkUuRMhJxFpiBnFM00Vjxflxg==; 31:/YFZ1gMqkixaqZJFbZPxKE+WgEn2pu7YXiKng21laWKpGPO/pboPDuI3zPHHIDvr50NGE5z08I3pvtevcFanqUIwKRhyJojY0YNQj5hLUWXIl1AsVo9f7AuSVtXPNAviUZiAe2LW51U89m9zBHJ27K9//Hh5MjNhVj6KE2/aNOVPDARUuoIpYQxtu8K0JBHzXt0nqE8m5Cf/fcNyhtv/OzWu6Y1M1ApWZFVxt0xQN9Y= X-MS-TrafficTypeDiagnostic: SN2PR07MB2526: X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 20:AT02XGrPy7aNoPf8vNuPrIRb9b69fbyGn7R2vGALbNmtVz90kYFLxxaDz+jH5mkDsYPXXrFnQqs97NUEqSmMJz65STmXMkXc/EKKitt/bSBZJ9lu6sQtdyDLVj0XoF9ueYTBesbDzn9zs/+AcrlZDDtdYNW1AYlkG/4WYam+pu9dIpYlk1z4McSl+by70zxWmE3DZVRtKCyep4JhOiIHMaddnMbt5KMOvqxaEqwJ49UiMvDUwmWFzWlcXZfzNs78RRsVlkkLAviJJC16uvj/s7wCmvVcoCkV/jaZYJ6lkhBmwwp9DeClpHhODx0kbvC7GGvH+JHzccdbJE77hoG9MtSTkf8M3kklggGhO/f+aYxvXPddsbSzK8Or8n+mYnsxMoAjsOXzZaREI9as9gY0dg0sUZLmdG5bOcvCU2XHjfauzHVeQQ1NwpIsGHi7hOpp/PGZibdAjkPTlDXZyH3w/GncwUQGc6gsG3sUaFKXuS8S6thu6UHDJSur2sGLrvxfKhjCfmyV4+9DEREnzdTqoQzsSpebw2VKreQYnjndluJF+lKvK4YYrqyWvN8NeAHXSk6xDcd1yFWo6hCMcLzMcbwgmavbBF3Qy0JSujudR0k=; 4:l8GieIrv7dywhBYOaWRyxfYosWlUKpVNHfnYvivYPfSfgVm3+AFl5hXdMIMaYaGeagray4QYftnH9PwgFEqUVyaDL+DkUQH3uPUTAUTxkAzAP3LaiEPRXD4KC7nL4peReIULEwlhfTXnX3UVxGg/xX3NcdK+qkMGzVu4MPMrPFpa7h4eU/1PBtPN1u2IgiaqDb9wt85FNKNzK3Zg06kfokcH/gJ1oaA18/UbrZD5d7KlSiQn4HJJWvYuV+Rsk8bB X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR07MB2526; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR07MB2526; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(25786009)(1076002)(53936002)(3846002)(6116002)(575784001)(478600001)(110136004)(72206003)(7736002)(6666003)(107886003)(6512007)(305945005)(6506006)(36756003)(6486002)(68736007)(5003940100001)(189998001)(50986999)(42882006)(106356001)(101416001)(76176999)(2950100002)(6916009)(5660300001)(2361001)(33646002)(2351001)(2906002)(4326008)(97736004)(105586002)(48376002)(50466002)(81166006)(66066001)(69596002)(8936002)(47776003)(53416004)(8676002)(50226002)(81156014)(42186005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2526; H:jerin.domain.name; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2526; 23:+TUUR7FjQulYxcR9D9j8FUdiDQUqRWfFFuZftAoTx?= =?us-ascii?Q?Foljb0dxiOisySN+oU5x/oKwRWwaR9h+H/+2+nE74Vuwr1k+Kk0Ce2hSfXQI?= =?us-ascii?Q?RUJTguNHPsAPLnxOssbEbV/RQjqVrx7tITxNTS4sB1HmAVYC8j88Bk9Gp9rT?= =?us-ascii?Q?aU41PeJWQZeX6vefJEFPA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SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 14:56:01.1148 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2526 Subject: [dpdk-dev] [PATCH 17/26] net/octeontx: add basic stats support 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: , X-List-Received-Date: Thu, 31 Aug 2017 14:56:04 -0000 Mark Basic stats support in features. Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla --- doc/guides/nics/features/octeontx.ini | 1 + drivers/net/octeontx/octeontx_ethdev.c | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/doc/guides/nics/features/octeontx.ini b/doc/guides/nics/features/octeontx.ini index ed5de9a74..a7eabc42a 100644 --- a/doc/guides/nics/features/octeontx.ini +++ b/doc/guides/nics/features/octeontx.ini @@ -10,6 +10,7 @@ Lock-free Tx queue = Y Jumbo frame = Y Promiscuous mode = Y CRC offload = Y +Basic stats = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 1e572b174..95045ab0c 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -182,6 +182,38 @@ octeontx_port_promisc_set(struct octeontx_nic *nic, int en) nic->port_id, en ? "set" : "unset"); } +static void +octeontx_port_stats(struct octeontx_nic *nic, struct rte_eth_stats *stats) +{ + octeontx_mbox_bgx_port_stats_t bgx_stats; + int res; + + PMD_INIT_FUNC_TRACE(); + + res = octeontx_bgx_port_stats(nic->port_id, &bgx_stats); + if (res < 0) + octeontx_log_err("failed to get port stats %d", nic->port_id); + + stats->ipackets = bgx_stats.rx_packets; + stats->ibytes = bgx_stats.rx_bytes; + stats->imissed = bgx_stats.rx_dropped; + stats->ierrors = bgx_stats.rx_errors; + stats->opackets = bgx_stats.tx_packets; + stats->obytes = bgx_stats.tx_bytes; + stats->oerrors = bgx_stats.tx_errors; + + octeontx_log_dbg("port %d get stats done inpkts=%ld outpkts=%ld", + nic->port_id, stats->ipackets, stats->opackets); +} + +static void +octeontx_port_stats_clr(struct octeontx_nic *nic) +{ + PMD_INIT_FUNC_TRACE(); + + octeontx_bgx_port_stats_clr(nic->port_id); +} + static inline void devconf_set_default_sane_values(struct rte_event_dev_config *dev_conf, struct rte_event_dev_info *info) @@ -401,6 +433,24 @@ octeontx_dev_link_update(struct rte_eth_dev *dev, return octeontx_atomic_write_link_status(dev, &link); } +static void +octeontx_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + + PMD_INIT_FUNC_TRACE(); + octeontx_port_stats(nic, stats); +} + +static void +octeontx_dev_stats_reset(struct rte_eth_dev *dev) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + + PMD_INIT_FUNC_TRACE(); + octeontx_port_stats_clr(nic); +} + static void octeontx_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) @@ -444,6 +494,8 @@ static const struct eth_dev_ops octeontx_dev_ops = { .promiscuous_enable = octeontx_dev_promisc_enable, .promiscuous_disable = octeontx_dev_promisc_disable, .link_update = octeontx_dev_link_update, + .stats_get = octeontx_dev_stats_get, + .stats_reset = octeontx_dev_stats_reset, }; /* Create Ethdev interface per BGX LMAC ports */ -- 2.14.1