From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0088.outbound.protection.outlook.com [104.47.36.88]) by dpdk.org (Postfix) with ESMTP id 1888F1B23C for ; Sun, 8 Oct 2017 14:46:05 +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=UNd18ObgZRfM/GX0WW//BrBX8wI2vBZkECc++olyuhg=; b=VnZ6lhVDKAuzlBh08BdNeDRHgWVtxWGqFqrdscY9kBIDwLSVUtqoyiHHzHo6uqCmYMMs5JZoX/eZ21G7lhA9yarC5YW+4Ugsbzex7EuemdFGEY7k3WFLPESPy4OY5eMI3A7RIv1jsQVIK66x2qm+G1P2e4gNoKbO3dsfopW7L9k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 8 Oct 2017 12:46:02 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, Santosh Shukla Date: Sun, 8 Oct 2017 18:14:21 +0530 Message-Id: <20171008124430.1866-18-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.56.157) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aba3e5f2-e9e6-4c90-25e9-08d50e4a8995 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:pdFv/Nun4+UHRqdfqPzpss8/t1ZBTNo9hJBD1wFeQe9gB83Pt1AokEM96JF81Vn922vUHgvCbaWSuNM3gsJvcUZhOCHP37zVCu0Ci5r/mvfyHeEvQ3g10kCQjIwk1iNUtCrhZwyHmL6ocaH9ZY3SYrkysDhSDOyl2WphI6nRfQGKIMKDbUb+mse19CxSpGDzJgXwq8z6fc9KTvphsE5/9a4rpYWkCjm2N7qBLKsCX8ozghP5l1xoWDXjP0KHLYSA; 25:yOPrr59riGARapisekIaeFNuLx7J8m1Kc39VXG39T5wvZInhOoHuSHaRL/BX9w0mVTkuS8ryNMdZUuIQyU5lqdi5TagRJh3knz/DGmblICvU92bh0HVbAZHXykXxGNTtVWZ1A1zNuoo8UQ1JcSnERs/QWflw6UCi+Lca3qsocOz9LYZyyQm8+gvdO511+Ezc4hj9pFFdd9mzrJc8mgfdu1UFmnbCRCi3z3bcMfvldOpI3GiZsqboe+QTmpSkn+QDnJSFu3FGRs+xJd5xHpBesYxLzNob9nSSYUqWCUTtuNWCc/oK5yAMyt/1HA63ORG1BQsMEeegsLBo/WyIKSW7qA==; 31:+rI0blD52KcaUi99uAKDbKwwBEG3cyadJ2gc8C8OyxcdMiWGqNA8u74XAbXjP+mUyNZv/Sal+QdxJMERsDvhWeP3Bn2pqxGHamHk4sgRyFqsaV+oCpqYe9qbh9UMpf5p8TLWwC2C//e4+PjS7ktB6aCzkFr34+IQX9sA37rs0dq4Hf7y2t969WiHYVp/rsH4Q3yhZEfJhcv3tSuhL0yT//AKGI5hHzKaY4f05WnOv5E= X-MS-TrafficTypeDiagnostic: BN6PR07MB3089: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 20:IQw8Wz6ONCJlZJ1le//i1B9U4NfhnCD6O0XegfLFx/HezXQn+RXYq7FxmHkiQiyhe9RhJ3UuG/54Oi9ToXGWhARmMQdlWjvv10DPKYYrTsvOeYw+maOeWTURDR2YVdDKNtmN/HUcHwblRfBKIUwsOxCFExjxWIAZuLrdFNqZDRmH6gZqfx74mTZ0xgt019ZRxkgJkBTYpro43qdryIJV98gnXx4hqrt7gTZjEsFcJ87IVe9mBGH+MpzMc00XUd6yIq8ny3dM8tSoTzZTOZH/sbuSVOpd63Y/2HOH5Ns0AKwiFu4btbIcOcMVKmaSgTOcaYX+TBaO+LIIxZsIavuRSL5We6DoVPYB7/NBt6vJAZQP+rdU1VXOg4qYACG0SyfkbEJ6k2vFmd0c69/DvtWhjqfDN0w9s0Ze7GqpYNuOIyTB9HarMFffIT0XhG7bCUzeo244K8Mhc35r9d6BoUCqyFh78Tdtu5ql9VqPBIFXv1CWKxDBtRuB/IsZRS/eC6mNPrOX6KmQyvJPzgzq2Ioj3ZHQWy3tYM0lBkOqg3mZs+Xyv+Z6wyQ4gPQiLS+2mdo54bfrm7fIvBT292DlteMGANAMDGGrXYkas6OAhTyPH6g=; 4:Uo0cScrwyrIdqjo5v43KSoFduezMPiUvqaIwjZC4/rb4CYmQOMY7zr4ikuWgtgBXlo2CXKOBBFNM5Qh3b0/Zrf2XfDd082hqb8hf4H+alXIivn9qVYyfUa1KgMo2Ot07eaI/UydwM7MEZZ8BfN3M1TaeDP79CUQcBqawehqePUlY8KfRa2FOP11DGITqoIYzsPAv9wB3OBAh3jeAbDVdeA4CIu7hx+AzGeciOI83mpNFK5WeRhoFSxVTbD8jtOqj 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)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(100000703101)(100105400095)(6041248)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 0454444834 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(376002)(346002)(199003)(189002)(6916009)(42882006)(81166006)(575784001)(2950100002)(81156014)(8936002)(50226002)(6486002)(16526018)(6666003)(189998001)(16586007)(316002)(6116002)(1076002)(6506006)(3846002)(7736002)(305945005)(8676002)(106356001)(105586002)(5009440100003)(53936002)(4326008)(66066001)(107886003)(47776003)(2906002)(5660300001)(6512007)(76176999)(5003940100001)(50986999)(97736004)(25786009)(101416001)(68736007)(48376002)(50466002)(478600001)(72206003)(2351001)(2361001)(33646002)(36756003)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; H:localhost.localdomain; 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; BN6PR07MB3089; 23:zsRGcpu614RWTcTxk79d0Qu1BagXdCi6e5HxfdUpE?= =?us-ascii?Q?4KA4rYxWuwJtfWL19Tksozp1HgmmenS5XzQ6aGgAm3Me3dQv5wtzpAOsSfp5?= =?us-ascii?Q?0Rkjsnfazhz787OBYF0w3XHU1Dyh36ffd7e4Bp5Q5eES7NGa9gmBePHZqLUP?= =?us-ascii?Q?KaoVmG6Gcstm0zESkGVxleyRZFaKNq4Vh0VgiB2GtbWA4LUsz4Gw+numl1+X?= =?us-ascii?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PTiJpIgC7Wr5+/fmJMAWTTZLIcYcSNqQDjCf0xvibr1WXMWAsQdiybWIY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2017 12:46:02.2637 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v2 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: Sun, 08 Oct 2017 12:46:05 -0000 From: Jerin Jacob Mark Basic stats support in features. Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla Signed-off-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