From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0062.outbound.protection.outlook.com [104.47.33.62]) by dpdk.org (Postfix) with ESMTP id DA0BD1BA25 for ; Mon, 9 Apr 2018 23:01:32 +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=hLYMf/jKJQRDQM/YvUa9ldnJbfpR1tEgPSF/RAVF8jE=; b=nxe3oie6r5e+dkPzQjqPcFwAffOeX3O93ZTgBFaRyTNYqRRQXIgjJuCSI0d80qQ42jqwIx+uRSIjKgdi8+sC5Yqs+yh2b/KohEBFMfwnYGohD+tE6lDDDXzd0hOaGyf0YY0Edmzs2h+rVYnjBlbKjx7znc/fECGao20GNvVc3yQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by MWHPR07MB3470.namprd07.prod.outlook.com (2603:10b6:301:63::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Mon, 9 Apr 2018 21:01:29 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, erik.g.carrillo@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Tue, 10 Apr 2018 02:30:29 +0530 Message-Id: <20180409210035.23278-6-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180409210035.23278-1-pbhagavatula@caviumnetworks.com> References: <20180216213700.3415-1-pbhagavatula@caviumnetworks.com> <20180409210035.23278-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0088.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1::28) To MWHPR07MB3470.namprd07.prod.outlook.com (2603:10b6:301:63::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2f595a53-c7d1-48d3-d6b4-08d59e5d123f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:MWHPR07MB3470; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3470; 3:Yj4YD4Im8cgDARaao3N4O9aSQpXczDxE5Ye77TS3dZcjT4dX2745r+mjXQefTxE5pehR/8OuVaaosWj2CrPkR/EhUNfbE3asUWYa8zT9gxCgG+6yhKJz8mpxf29bd2lXapxj1+qtPCrxdndtj6+RHDU70xmkjwxx+oMhZTdAIwUakx2Bh6AWnkh82c6aIgyM3uMnAk5eSQe4Z6WOi38Ckvby1nQJ6x4jKtBzKD2qGM1n2mSV1IyZZmBUY3ghbVsJ; 25:pKRN6zgXE7DS01wS0CGIgvecxcL6StsRUzZniHZ4vgQgDnc7ad6mZMRaymeqlAqjadzZ5c7B7eoi2bqMTfDUmKX55AZgTNKgQ3aMPf/5z+3NDQGq74g87JuPVDPcUJI7t/NaTboxhSR312bh5KDJ2Ce3WGEUfLZNZZD77tdPqNLIsWh0tLp0deeUwSDvSruENJhnukm4D5W/mWjMEffLj/0G1Y/zomUrdnuGzkW+XDh9RNSdocZ0gnhit8ECMrVh7mFkOzaSYOWq+0eUbkIkmRNTCsM/aP2Fwn6+hayd0ZHGVxDTUn8r9lu6ZPEydOMHH70jyFdUFlrRxeXoAjusgQ==; 31:xZbNcilrzu2QGTrCtS52LtL223XiWt/inuF6IQNiVg45Q/Hy860gNmyPchNdukSBQPM7HPQ8TntNkASGtJTV1xLTm2R40Nt1nUY6N30A8sNwBC/K1WQBSvH3Sq7RP7TiCxx344upIMhZ1e6fP3rEKYDBZNX93Vbm41pWICDneCviwFccs4jRxo3HiRdd+spwy1sPqk6f8r+sCC4T1mQllsnsJSigYc8G4p3nAOOEWqQ= X-MS-TrafficTypeDiagnostic: MWHPR07MB3470: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3470; 20:XOSopTQTNTcKV+VOoDlXXKlTN6xGrz6blpanRky8tz2jMHVaZmD/onWbtHsVDypr3UJw+YslwvaUo75BcoMHr50avsTJEkuyPzzyMM2qpHqtyrk+nCrnWNkSsAOR/NeAC3KiMeq2r0czo1r/L0ZAEnc12ToEx4h7zv2mUlWEy6waUz4Kk8bMS3syQvi6EO3NZnQ2a/NCOcIimjzzP8UXzXoDwLEp1SikxAZRiGFij/is0LYDIKWMATniEPuBPtcRliRb7QrL2zY3+Vo4NrNoqZy+zttLXRIB63xk3EIPBSr8+LjQDYKVXUfDCcOTfDsxBV4t2CvYdoRZeLGp4EfvmHT3airWJ/nzB0TZtAdK05ad07B10nahSeWu/9t7KE9RMpBiFL//jgRSfU7z9E8LOGFLOdKxYT2QspExIanZJpLqukyjlDPZJGsoacE8dC+4u+nvbgFOXcc34QaOvBKnNcKkniKbTyEBvRTNu4z9WW2ocYQJAuo9irrC2nazaBfVxsPUXPAk18zDyTxf8f7o1BZvgBRt1Qg5yMYEHZYxgk6lYZyP+5gFFdnCJplAPaGcgbUdQWqeYdTtDz7VELwOJmR6W0rGwYzjVbxlLKMkm4A=; 4:Fci2kAeJ8+4MbKESgQpTxW8QOFzFMu0QGZBB3WGqZoVsaEZzCbRM1MD9BDdIJX9mUYxgbQtoZY1br4ryyvgkfQU8tGa0XKYPgm8KC30v5mJec+CrCf7qczDbeZuaFOtMbSeBlyniEAb8iL83hoA+ezJsPpf/rGJO0xhiTN368X5KWoIsTrzoNyKvA4w7yyxouurByKSSlV2rSPIBGCgCThNQCziRYd5yyKGlGSBoSBXUUMz6H3sJLGly1tpInOoeRRTxpxtzb0hE1Se/Xdc6jA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(3002001)(10201501046)(93006095)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:MWHPR07MB3470; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3470; X-Forefront-PRVS: 0637FCE711 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(366004)(376002)(346002)(39860400002)(396003)(39380400002)(189003)(199004)(107886003)(48376002)(446003)(1857600001)(50466002)(97736004)(66066001)(2906002)(53936002)(6512007)(42882007)(81166006)(956004)(81156014)(25786009)(16526019)(6116002)(2616005)(476003)(5660300001)(6486002)(3846002)(11346002)(8936002)(26005)(50226002)(8676002)(486006)(47776003)(1076002)(478600001)(105586002)(76176011)(68736007)(72206003)(7736002)(106356001)(5009440100003)(305945005)(4326008)(6506007)(316002)(16586007)(386003)(51416003)(52116002)(36756003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3470; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3470; 23:gXFs8/41IAqDG0CK4XYoW0Qzt9uMZM5tvFUxeiPHO?= =?us-ascii?Q?tyUQk4Aay1MWWSWgrylz/+2//VdGOb0e1h1KFU78gj5oA6qyRdyt1gpJXHR5?= =?us-ascii?Q?Fdavb/AM90QhrPhEs52vDR3GjwxIR3q6c93yjz4HvzMxcHqzpyPTKGH3d78i?= =?us-ascii?Q?U/9J3abTIzJ20cBMboReaUg4+sbgWQsr57YOnkc79f+EWiTwJB56gC2OqrP2?= =?us-ascii?Q?5et3dhv7Zdsx2fGXzmyn+lVGwTONgz+H/DAZsZtGAHSN66vgG/AtWS2EZWVO?= =?us-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vrC2p4VujfrJjuE=; 24:AU59IUgKXzAPjgSiKR+5zB3K0pyBcUTi61lMYHOPUWG5247bVI0UPLjKL7DIHxThToHjC8zBjiXGz4GtU8bKGEoC6Lmg+ux3Q6DKjIVVxq4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3470; 7:ZOYlF6+LtArmB73Zs5unn2tHJx07V9NS7k/hiKmQLULWaoogNLKA6lYEl+F9gHZMyUPzUh6Nr+LMQdq4e7u1hT1B8Y1HrG1YRi03315gBocbPtbTU/CU8qjZ3BCqkUQM+xuPd8+dbDIAEvT7gqcBXqfVz4kBZePYmJLw4mWR/JCin8+Byqow5wjIK6Lx7zK2mArqooaboHY3CYWRAt30+EYXWf7lHj5bVapwtGOLJMNNGZDV4KWCCqKdoEsmCI2+ X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2018 21:01:29.7958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f595a53-c7d1-48d3-d6b4-08d59e5d123f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3470 Subject: [dpdk-dev] [PATCH v4 05/11] event/octeontx: add event timer stats get and reset 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: Mon, 09 Apr 2018 21:01:33 -0000 Add functions to get and reset event timer adapter stats. Signed-off-by: Pavan Nikhilesh --- drivers/event/octeontx/ssovf_evdev.c | 14 ++++++++++++- drivers/event/octeontx/timvf_evdev.c | 30 +++++++++++++++++++++++++++- drivers/event/octeontx/timvf_evdev.h | 3 +++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 34496f114..2df70b52a 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -21,6 +21,7 @@ #include "timvf_evdev.h" int otx_logtype_ssovf; +static uint8_t timvf_enable_stats; RTE_INIT(otx_ssovf_init_log); static void @@ -606,7 +607,8 @@ static int ssovf_timvf_caps_get(const struct rte_eventdev *dev, uint64_t flags, uint32_t *caps, const struct rte_event_timer_adapter_ops **ops) { - return timvf_timer_adapter_caps_get(dev, flags, caps, ops, 0); + return timvf_timer_adapter_caps_get(dev, flags, caps, ops, + timvf_enable_stats); } /* Initialize and register event driver with DPDK Application */ @@ -654,6 +656,7 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) static const char *const args[] = { SSOVF_SELFTEST_ARG, + TIMVF_ENABLE_STATS_ARG, NULL }; @@ -681,6 +684,15 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) rte_kvargs_free(kvlist); return ret; } + + ret = rte_kvargs_process(kvlist, + TIMVF_ENABLE_STATS_ARG, + ssovf_selftest, &timvf_enable_stats); + if (ret != 0) { + ssovf_log_err("%s: Error in timvf stats", name); + rte_kvargs_free(kvlist); + return ret; + } } rte_kvargs_free(kvlist); diff --git a/drivers/event/octeontx/timvf_evdev.c b/drivers/event/octeontx/timvf_evdev.c index 84c6a511e..c66db437e 100644 --- a/drivers/event/octeontx/timvf_evdev.c +++ b/drivers/event/octeontx/timvf_evdev.c @@ -268,6 +268,29 @@ timvf_ring_free(struct rte_event_timer_adapter *adptr) return 0; } +static int +timvf_stats_get(const struct rte_event_timer_adapter *adapter, + struct rte_event_timer_adapter_stats *stats) +{ + struct timvf_ring *timr = adapter->data->adapter_priv; + uint64_t bkt_cyc = rte_rdtsc() - timr->ring_start_cyc; + + stats->evtim_exp_count = timr->tim_arm_cnt; + stats->ev_enq_count = timr->tim_arm_cnt; + stats->adapter_tick_count = rte_reciprocal_divide_u64(bkt_cyc, + &timr->fast_div); + return 0; +} + +static int +timvf_stats_reset(const struct rte_event_timer_adapter *adapter) +{ + struct timvf_ring *timr = adapter->data->adapter_priv; + + timr->tim_arm_cnt = 0; + return 0; +} + static struct rte_event_timer_adapter_ops timvf_ops = { .init = timvf_ring_create, .uninit = timvf_ring_free, @@ -283,7 +306,12 @@ timvf_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t flags, { RTE_SET_USED(dev); RTE_SET_USED(flags); - RTE_SET_USED(enable_stats); + + if (enable_stats) { + timvf_ops.stats_get = timvf_stats_get; + timvf_ops.stats_reset = timvf_stats_reset; + } + *caps = RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT; *ops = &timvf_ops; return -EINVAL; diff --git a/drivers/event/octeontx/timvf_evdev.h b/drivers/event/octeontx/timvf_evdev.h index 7663dc375..e89a43531 100644 --- a/drivers/event/octeontx/timvf_evdev.h +++ b/drivers/event/octeontx/timvf_evdev.h @@ -83,6 +83,8 @@ #define timvf_read64 rte_read64_relaxed #define timvf_write64 rte_write64_relaxed +#define TIMVF_ENABLE_STATS_ARG ("timvf_stats") + extern int otx_logtype_timvf; static const uint16_t nb_chunk_slots = (TIM_CHUNK_SIZE / 16) - 1; @@ -145,6 +147,7 @@ struct timvf_ring { struct tim_mem_bucket *bkt; void *chunk_pool; uint64_t tck_int; + volatile uint64_t tim_arm_cnt; uint64_t tck_nsec; void *vbar0; void *bkt_pos; -- 2.17.0