From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0084.outbound.protection.outlook.com [104.47.33.84]) by dpdk.org (Postfix) with ESMTP id 352D67CFC for ; Fri, 25 Aug 2017 12:25:54 +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=QsSy11WgnacjJ6zDcMPeBqEWznoYjqvH1fhciwOBVxM=; b=bj0MKmtTaGTUlxESmQcAUSGVZhnyRUasWxhGkS/tARnYFiUXnMt6rQug+aUw/iX3aTbmNfWf3IdI2c3eTQWyIeKNCI4CKPNwcw5pKMyzszWkTmMI2PcyiZ667299EiNx3tJyVu/a6oLKmf3jJ6cuMWIgFww4C8RwQTmiyrOvqes= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (213.186.78.165) by SN2PR07MB2528.namprd07.prod.outlook.com (2603:10b6:804:7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1385.9; Fri, 25 Aug 2017 10:25:48 +0000 Date: Fri, 25 Aug 2017 15:55:38 +0530 From: Jerin Jacob To: "Carrillo, Erik G" Cc: "dev@dpdk.org" , "thomas@monjalon.net" , "Richardson, Bruce" , "Van Haaren, Harry" , "hemant.agrawal@nxp.com" , "Eads, Gage" , "nipun.gupta@nxp.com" , "Vangati, Narender" , "Rao, Nikhil" , "pbhagavatula@caviumnetworks.com" , "jianbo.liu@linaro.org" , "rsanford@akamai.com" Message-ID: <20170825102537.GC9774@jerin> References: <20170817161104.24293-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-Originating-IP: [213.186.78.165] X-ClientProxiedBy: AM4PR05CA0014.eurprd05.prod.outlook.com (2603:10a6:205::27) To SN2PR07MB2528.namprd07.prod.outlook.com (2603:10b6:804:7::6) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f74540d1-e24d-40e9-52f6-08d4eba3a905 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN2PR07MB2528; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2528; 3:HIroenHyF+re+s2f5fc1OygrFjaGixdy8rpacKcoBbfkvm6tM+9dgJ4ROCyfJfx3wZXIvx8p8OcBhHuaLYCw/c5MQD+Hfvz3JG7e4042WLqSj1xQPI4OqulNQ4/rdbHsPlSWPc1W3HHpOecO6xKhS0hydQB8/3WCPC4ycEQQTu3oArjhpDV6aNYKZM2o4IrZ6tBTSzxz6sO6ANM7YsuXRi/H+RBEDWPfUqwNsAOJotbyjC3Jhug8C7QEFoFyz2QU; 25:L1FB3qj3TU3XmacSfJ5t/4iqqYAG1Nl+H2A4sQufTWLQ+nBOhvi4fYlUC7v71PbP4KKfHqXYeIRDRiVNTy2sq1V8Jlc7/wt9fFtmcJk/oFnPPQk9NvSvQmOm2F12EokUlHAEPkfmwkb7Ojc6MjmcTLns1MWywNn0L7PBpBOR2NE2ey0whA4SGHdN7vpxZ/yiU/7OVZuf6me4O66GxZ8iTteSfr/OwKfj7REypDH4pLzASRXQuZ7m3OurA9DKxUtWaU1Acmpdx+eaUy+GPDmkJjz5IEltEn7vAndQTXwTuopehMnrQeRkt/ffVbpshUeRllIRzbvCOuOAL/BnZ4/Y6Q==; 31:uRZDJFaGJztCY0CAd6FofnJC55V+YfCI4VMr1l6xQ1exNBveG/8LNjCn/7UlVQuJI38Pi33Psl3tjcTjxhmnAAA1yyfY8uuhVCbI3x1+ZugzPdPbVJgzUakm/4KepepQlQF3lG15w5+qi8aOQJwNk0Chn41BChQockAzceLSteBAB98xNlFQT8HEjEOfObjS9iMj+5T0g+S3BnXkCw2/qIZj34/7hejXxX/A6+4kmoA= X-MS-TrafficTypeDiagnostic: SN2PR07MB2528: X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2528; 20:wiosk9/VcIAEYDG8JtfrFVm7I/s7RNzS1Q9gtzSXN7SynFfBGEfQdQndhgMvytZaIllME+bBbwKlSvtr2Ljj0oPoOe0J5FgzdOPMnW76TJ2Ossuxn10m28CKrp62Slb5aezdYhVRDU0C9eWopZJwy7IhGDdTPsCK27Hk2oJGwIRIshMd4pGzwIKVXukDPRdxeJewBkxwc5pIKTl8xmrY2f1cBE/T7d+Da2JDWs0zMcowa8qOjCbhSGViojms/RpxD2KuxR54fW/z5fdMMdfYhHCM2cBg3kxZ3QsnfOwZcyeLugUpmh7rZVgCZ/UjjvMDa1H3Xbc6ZQo61X9OIuOZ5ZCLF5RFnj9pFq/VXpUSu+twuJ+KZ1R3vg/e9c3DQurp7rqUN3IcR5O4nvD7nbKEYHi3QtA7Vy5NemCUapmHiRnbok4Z4m0JpUzcYrRtoV6QLp3cvBDsfJR+SVaRrjdsOVNz7Gk+WjxzVe8XU+dY17NP7O/bt1ur5luYJAe7sW5eS2H9ehHGerRNwn2b/VDH4jtYHQAFIYqyLBZhOYC0yaZpv/EulL+VSjjtsKOakgyhA/wSoCJ4RoydTBB4Ja7Y+DzeM0j1eQ2B/nVHDeOYjXE= X-Exchange-Antispam-Report-Test: UriScan:(278428928389397)(185117386973197)(228905959029699)(17755550239193); 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)(3002001)(93006095)(100000703101)(100105400095)(10201501046)(6041248)(20161123562025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR07MB2528; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR07MB2528; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2528; 4:LwHzEZ9b46KeKiP0Dpsayq0vBI7viwmS6WsdOIaP+E+RGlsQV9XQ7sLNJeXeWZ75dz+SeqlOZa07jHLF8Uj8uXvaacwgPDEYdpIQkCKw86s8w+nrD9v9hBF093N9QTyLE3F/hye8xpk7WQbzeCnpgIpUxKUs9kdLFHCo526UmAplp8SsSGc3csivT7ePC/u83q1sNWR0q6wWxZRr5BFOpiisweoYe/RgA0DRB/dX0VJzLOw345LCjZqH2FS+cfFmViJ3YskkoIj8p9CfIeaQnITR7utq5DR2nAdZxXOzzqgBrYZEoZqe1YaC0jaghOytbDiDfwH1+tGPoDV32+2qFBYEOmdLfSt5BuOiFhFWbZtdA4PUniZ2Xs0XWuk64wHKQhy3CObHnlcQt6gy4cQLtw== X-Forefront-PRVS: 041032FF37 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(189002)(377454003)(13464003)(199003)(229853002)(189998001)(33716001)(101416001)(7350300001)(55016002)(47776003)(68736007)(5660300001)(97736004)(6306002)(4326008)(54906002)(561944003)(42186005)(305945005)(966005)(7736002)(53546010)(83506001)(54356999)(3846002)(76176999)(50986999)(23726003)(72206003)(2906002)(106356001)(66066001)(53936002)(105586002)(7416002)(1076002)(6116002)(6246003)(9686003)(25786009)(53376002)(2950100002)(42882006)(81156014)(6666003)(50466002)(33656002)(4001350100001)(8676002)(110136004)(6916009)(81166006)(6496005)(478600001)(8656003)(18370500001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2528; H:jerin; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; SN2PR07MB2528; 23:A8JCcOALAostRJHtosotZOUq8sbeltYUwy4byimPy?= =?us-ascii?Q?oZk3bVyAQaILXot/9GjxsEblm9TJOpX+S7QgOyRPu5niE43J59AlQyJf11/L?= =?us-ascii?Q?V6jDjOgUTUFTam30tWL4qoQ7enl0WbJSPfX+zU1O+modQvkXzpn30n4i1we6?= =?us-ascii?Q?LgU/MaMekAaV7zQIje4L/CZjIUg3gaJsuSi5Uc73HqVqK/eaTwoenwbT2gqY?= =?us-ascii?Q?v+HVyXuVF4d2em04Y54kbBm/MG6UcTBuPICfxscOFNLT9C8aZRiOoosWIoe+?= =?us-ascii?Q?WnNG2a4Oub87zXm79xxHt+8UHeTR8oBeBqRNWecU928tdt9ElTjvhqIQGlyU?= =?us-ascii?Q?7GzIj9BQIZtnwcHdzyJFumvVXrsg6Qa5o2S+HKB4ZBmgqMEMtyX+sWMoZ5qI?= =?us-ascii?Q?MT38Xb+i/TsZ/v4qMqBv7NYJQ6yt7Br0oLjzBQAnidUxh2xedGIqH73T2Q8g?= =?us-ascii?Q?v1/YvUEd0M7YG22fwpjezHi3HwAe2b+aSEcVxlV6zQkbrs8KSpDoliCObtTy?= =?us-ascii?Q?8NTMlkZKWzx/tNppcvFQ5iRcVVkjO/rIJal+wyh9qLV9jDAdqXbZ6YkZ7zal?= =?us-ascii?Q?i3TM4hYRc8yT29C28bkQ7RSxU6YgIydpzxMHc87/Jjjow4hoPUROVVWrSA6w?= =?us-ascii?Q?UK7I2u4o59svOlaRp3pKBNypeOk029iQAUWDUCR0ipTQJzYfN2mBP8Xd4iuO?= =?us-ascii?Q?Es5wpbDAz+5wEFMKO+RELIZH71gVrB0O9gjehfAQ5U5pB0+LZpneFMymQaCf?= =?us-ascii?Q?//P9qCo+MLsGfiykF2ox21RiY08WvWVnOuKFj8Ic7GrnnwqnSIGT+DYkcEDj?= =?us-ascii?Q?HVpHbKR2YraeG+9xL6XoH8oAZeAsRm7mzKkt9aTjnS+OuVd+71VOmUx2Fxqa?= =?us-ascii?Q?DbukGYNWJbOdMWv4BbLXSt6LEtAp8ae/ocfq7to3bUQBJv6wT+9grg+PrP2K?= =?us-ascii?Q?lF30gE/sSwe2mhllveJkhCMiIrTTbnrP5WrE1oNKG7M5+KDgd/LEFt4CA6Lb?= =?us-ascii?Q?kbLRvxLfk//uacvKqubYiW/H56CGG565GAi3gHuhKMoRI9F6SCt0dZzab7a7?= =?us-ascii?Q?nXBvm+i7kDMw6Y9NbVFvXfA0yMWgD7Yf466doktLMMFJT7Ce0gqgGP+xALXI?= =?us-ascii?Q?OhNaBfPGoDBo80pKBouSPesE9a9r7mnBlN1wuGTg7nu+qi51ETt+a+dUsmiH?= =?us-ascii?Q?/7RD73eZvJcBKulrM0tJ8pnWB2LAjWOsItktNHgRp4jArdOdKywW6mG9naJP?= =?us-ascii?Q?gDtyFDUFtxHU2/NjhjMqHgBX1obps5LloV3gluBi9B23x9AJL58fk6ptVNPD?= =?us-ascii?Q?jAW2oQFaHQFZdEkU2Gs/VYpRoT5gxeOv0kUyUX2wqF6fc8vVsOGk64URNc99?= =?us-ascii?Q?qEQI46fbt1s4qNwy20tbyoy1KZW6iZ5K4q7/BU9ZQ21RGQCbyUmMBzwbkhdK?= =?us-ascii?Q?U704K41JOBkYCUIRLDzI+ugOaRsIf8=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2528; 6:6Fyy6wlLm0eBZvbqjKmlLwft99r4wfEiD07iPYSumWpcBme9TTLICjLwt/2rb0NfBwI0z0ysXZdeZvwKKlWIRekdIJbM06TWHRvDQrOhiSrq56sjhUTy/xfngUaaYVKJLVlaEriZct96bDkax9sKHIlKLHI/bWqZFnNAa2uxnYqUuUtrRvho0ILRdDJin4Pybb4CW3UUY9x1+uYktqM962Hhh9zkRZj42939/4P7X/BFbrrkOKhiGy1/LKf5GdvxcubbRf+XB/KgLoqZiaSpMztdyd5+dprKfai07xJZ6a6/Wb+OJjWe6GfrI+VtPfHAxqSHTlD5RLUHfXZa3x1FOQ==; 5:0Qu6t5bGjYhKziCF9gxhxw2TqMA6biLpHe9nlMsRNaH+CM9+6UUXkA/o+b14gOHmfDgS2nPZRN4Rhtm1C2F4zYuN3lBHMq/Qkugwjlr1FL3SDGabKbZxA9VPjoR9GiwuMaaOWPwx08n4xcGnj6lQ/Q==; 24:up/wjWRQznGG+7FmjaGJbU/82d08XsLVsh4kdWIyjKC09k3VVVfDFZ1B6MP7CAcvBdNOUp1EYRKhF3Oxni1SXuDxTNRUqD7q0glmRl6mLhE=; 7:o8AMl+GqVhSW2d/pu6GITejK59npn3nevr79iOrXUPeG8LytnJTX+qjj3dZM1SFSD5/e3J+C6265hBQUuTXZVPppM3obKsalrNn8WC9Y9Ky9Os9BGnyea+eruYItY/jNWPivGbJXvDNZk5LXReScDs2ZzHsyrTm4P6+1Cyvg6nXS9GKpGK8mRiIVwGdGyinPZARFwLfX5DQOybDwQtsbifZUVQvx64PJ5u9wdRyWOws= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2017 10:25:48.7727 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2528 Subject: Re: [dpdk-dev] [RFC PATCH 0/1] eventtimer: introduce event timer wheel 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: Fri, 25 Aug 2017 10:25:54 -0000 -----Original Message----- > Date: Wed, 23 Aug 2017 22:57:08 +0000 > From: "Carrillo, Erik G" > To: Jerin Jacob , "dev@dpdk.org" > > CC: "thomas@monjalon.net" , "Richardson, Bruce" > , "Van Haaren, Harry" > , "hemant.agrawal@nxp.com" > , "Eads, Gage" , > "nipun.gupta@nxp.com" , "Vangati, Narender" > , "Rao, Nikhil" , > "pbhagavatula@caviumnetworks.com" , > "jianbo.liu@linaro.org" , "rsanford@akamai.com" > > Subject: RE: [dpdk-dev] [RFC PATCH 0/1] eventtimer: introduce event timer > wheel > > Hi Jerin, Hi Carrillo, > > Thanks for sharing your proposal. > > We have implemented something quite similar locally. In applications that utilize the eventdev framework, entities we call "bridge drivers" are configured, and they are analogous to service cores. OK. > > One such bridge driver, the Timer Bridge Driver, runs on an lcore specified during application startup and, once it is started, will manage set of event timers, and enqueue timer events into an event device upon their expiry. To use event timers, the application will allocate them and set a payload pointer and queue id in pretty much the same way you've shown. Then we call rte_event_timer_reset() to arm the timer, which will install it in one of the rte_timer library's skiplists. Concurrently, the Timer Bridge Driver will be executing a run() function in a loop, which will repeatedly execute rte_timer_manage(). For any timers that have expired, a callback defined in the bridge driver will execute, and this callback will enqueue a new event of type TIMER. As workers are dequeuing events, they will encounter the timer event and can use the "payload pointer" to get back to some specified object. OK > > Some differences include: > - our API doesn't currently support burst-style arming > - our API supports periodic timers (since they are free from the rte_timer lib) > > Regarding the implementation you describe in the "Implementation thoughts" section of your email, our timer bridge driver doesn't have a ring in which it enqueues timer events. Instead the rte_event_timer_reset() is mostly a wrapper for rte_timer_reset(). Because various worker lcores could be modifying timers concurrently, and they were all headed for the same skiplist, we encountered performance issues with lock contention for that skiplist. I modified the timer library itself in various ways, including adding a multiple-producer single-consumer ring for requests to modify the skiplists. I had the best results however, when I created per-installer skiplists for each target lcore. I submitted the patch to the ML today[1]. I personally saw contention on the CAS operation to update the head pointer of ring when multiple lcores installed timers repeatedly and simultaneously, but perhaps burst-enqueuing can avoid that. OK > > On a separate note, it also looks like attributes of the timer wheel pertaining to resolution or max number of timers will have no effect in the software implementation. Instead, timer resolution would be a function of the frequency with which a service core can invoke rte_timer_manage. Also, it would seem that no limit on the number of timers would be necessary. Does that sound right? Yes. The SW implementation can ignore the resolution and max number of timers. This is just hint from application to partition the HW resource effectively. > > In summary, it looks like our solutions align fairly well, and I propose that we take on the software implementation if there are no objections. Sure, no objection. Could you please comment on the API changes required in the header file. Once it is finalized. We need to have a) common code for ops b) SW driver c) HW driver and we would like contribute on (a) and (c) /Jerin > > [1] http://dpdk.org/ml/archives/dev/2017-August/073317.html > > Thanks, > Gabriel > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob > > Sent: Thursday, August 17, 2017 11:11 AM > > To: dev@dpdk.org > > Cc: thomas@monjalon.net; Richardson, Bruce > > ; Van Haaren, Harry > > ; hemant.agrawal@nxp.com; Eads, Gage > > ; nipun.gupta@nxp.com; Vangati, Narender > > ; Rao, Nikhil ; > > pbhagavatula@caviumnetworks.com; jianbo.liu@linaro.org; > > rsanford@akamai.com; Jerin Jacob > > Subject: [dpdk-dev] [RFC PATCH 0/1] eventtimer: introduce event timer > > wheel > > > > Some of the NPU class of networking hardwares has timer hardware where > > the user can arm and cancel the event timer. On the expiry of the timeout > > time, the hardware will post the notification as an event to eventdev HW, > > Instead of calling a callback like CPU based timer scheme. It enables, > > highresolution (1us or so) timer management using internal or external clock > > domains, and offloading the timer housing keeping work from the worker > > lcores. > > > > This RFC attempts to abstract such NPU class of timer Hardware and > > introduce event timer wheel subsystem inside the eventdev as they are > > tightly coupled. > > > > This RFC introduces the functionality to create an event timer wheel. This > > allows an application to arm event timers, which shall enqueue an event to a > > specified event queue on expiry of a given interval. > > > > The event timer wheel uses an ops table to which the various event devices > > (e.g Cavium Octeontx, NXP dpaa2 and SW) register timer subsystem > > implementation specific ops to use. > > > > The RFC extends DPDK event based programming model where event can be > > of type timer, and expiry event will be notified through CPU over eventdev > > ports. > > > > Some of the use cases of event timer wheel are Beacon Timers, Generic SW > > Timeout, Wireless MAC Scheduling, 3G Frame Protocols, Packet Scheduling, > > Protocol Retransmission Timers, Supervision Timers. > > All these use cases require high resolution and low time drift. > > > > The abstract working model of an event timer wheel is as follows: > > ========================================================== > > ======= > > timer_tick_ns > > + > > +-------+ | > > | | | > > +-------+ bkt 0 +----v---+ > > | | | | > > | +-------+ | > > +---+---+ +---+---+ +---+---+---+---+ > > | | | | | | | | | > > | bkt n | | bkt 1 |<-> t0| t1| t2| tn| > > | | | | | | | | | > > +---+---+ +---+---+ +---+---+---+---+ > > | Timer wheel | > > +---+---+ +---+---+ > > | | | | > > | bkt 4 | | bkt 2 |<--- Current bucket > > | | | | > > +---+---+ +---+---+ > > | +-------+ | > > | | | | > > +------+ bkt 3 +-------+ > > | | > > +-------+ > > > > - It has a virtual monotonically increasing 64-bit timer wheel clock based on > > *enum rte_event_timer_wheel_clk_src* clock source. The clock source > > could > > be a CPU clock, or a platform depended external clock. > > > > - Application creates a timer wheel instance with given clock source, > > the total number of event timers, resolution(expressed in ns) to traverse > > between the buckets. > > > > - Each timer wheel may have 0 to n buckets based on the configured > > max timeout(max_tmo_ns) and resolution(timer_tick_ns). On timer wheel > > start, the timer starts ticking at *timer_tick_ns* resolution. > > > > - Application arms an event timer to be expired at the number of > > *timer_tick_ns* from now. > > > > - Application can cancel the existing armed timer if required. > > > > - If not canceled by the application and the timer expires then the library > > injects the timer expiry event to the designated event queue. > > > > - The timer expiry event will be received through > > *rte_event_dequeue_burst* > > > > - Application frees the created timer wheel instance. > > > > A more detailed description of the event timer wheel is contained in the > > header's comments. > > > > Implementation thoughts > > ======================= > > The event devices have to provide a driver level function that is used to get > > event timer subsystem capability and the respective event timer wheel ops. > > if the event device is not capable a software implementation of the event > > timer wheel ops will be selected. > > > > The software implementation of timer wheel will make use of existing > > rte_timer[1], rte_ring library and EAL service cores[2] to achieve event > > generation. The worker cores call event timer arm function which enqueues > > event timer to a rte_ring. The registered service core would then dequeue > > event timer from rte_ring and use the rte_timer library to register a timer. > > The service core then invokes rte_timer_manage() function to retrieve > > expired timers and generates the associated event. > > > > The implementation of event timer wheel subsystem for both hardware > > (Cavium > > OCTEONTX) and software(if there are no volunteers) will be undertaken by > > Cavium. > > > > [1] http://dpdk.org/doc/guides/prog_guide/timer_lib.html > > [2] http://dpdk.org/ml/archives/dev/2017-May/065207.html > > > > An example code snippet to show the proposed API usage > > ====================================================== > > example: TCP Retransmission in abstract form. > > > > uint8_t > > configure_event_dev(...) > > { > > /* Create the event device. */ > > const struct rte_event_dev_config config = { > > .nb_event_queues = 1, > > /* Event device related configuration. */ > > ... > > }; > > > > rte_event_dev_configure(event_dev_id, &config); > > /* Event queue and port configuration. */ > > ... > > /* Start the event device.*/ > > rte_event_dev_start(event_dev_id); > > } > > > > #define NSECPERSEC 1E9 // No of ns for 1 sec > > uint8_t > > configure_event_timer_wheel(...) > > { > > /* Create an event timer wheel for reliable connections. */ > > const struct rte_event_timer_wheel_config wheel_config = { > > .event_dev_id = event_dev_id, > > .timer_wheel_id = 0, > > .clk_src = RTE_EVENT_TIMER_WHEEL_CPU_CLK, > > .timer_tick_ns = NSECPERSEC / 10, // 100 milliseconds > > .max_tmo_nsec = 180 * NSECPERSEC // 2 minutes > > .nb_timers = 40000, // Number of timers that the wheel can > > hold. > > .timer_wheel_flags = 0, > > }; > > struct rte_event_timer_wheel *wheel = NULL; > > wheel = rte_event_timer_wheel_create(&wheel_config); > > if (wheel == NULL) > > { > > /* Failed to create event timer wheel. */ > > ... > > return false; > > > > } > > /* Start the event timer wheel. */ > > rte_event_timer_wheel_start(wheel); > > > > /* Create a mempool of event timers. */ > > struct rte_mempool *event_timer_pool = NULL; > > > > event_timer_pool = > > rte_mempool_create("event_timer_mempool", SIZE, > > sizeof(struct rte_event_timer), ...); > > if (event_timer_pool == NULL) > > { > > /* Failed to create event timer mempool. */ > > ... > > return false; > > } > > } > > > > > > uint8_t > > process_tcp_data_packet(...) > > { > > /*Classify based on type*/ > > switch (...) { > > case ...: > > /* Setting up a new connection (Protocol dependent.) */ > > ... > > /* Setting up a new event timer. */ > > conn->timer = NULL > > rte_mempool_get(event_timer_pool, (void **)&conn- > > >timer); > > if (timer == NULL) { > > /* Failed to get event timer instance. */ > > /* Tear down the connection */ > > return false; > > } > > > > /* Set up the timer event. */ > > conn->timer->ev.u64 = conn; > > conn->timer->ev.queue_id = event_queue_id; > > ... > > /* All necessary resources successfully allocated */ > > /* Compute the timer timeout ticks */ > > conn->timer->timeout_ticks = 30; //3 sec Per RFC1122(TCP > > returns) > > /* Arm the timer with our timeout */ > > ret = rte_event_timer_arm_burst(wheel, &conn->timer, 1); > > if (ret != 1) { > > /* Check return value for too early or too late > > expiration > > * tick */ > > ... > > return false; > > } > > return true; > > case ...: > > /* Ack for the previous tcp data packet has been received.*/ > > /* cancel the retransmission timer*/ > > rte_event_timer_cancel_burst(wheel, &conn->timer, 1); > > break; > > } > > } > > > > uint8_t > > process_timer_event(...) > > { > > /* A retransmission timeout for the connection has been received. > > */ > > conn = ev.event_ptr; > > /* Retransmit last packet (e.g. TCP segment). */ > > ... > > /* Re-arm timer using original values. */ > > rte_event_timer_arm_burst(wheel_id, &conn->timer, 1); } > > > > void > > events_processing_loop(...) > > { > > while (...) { > > /* Receive events from the configured event port. */ > > rte_event_dequeue_burst(event_dev_id, event_port, &ev, > > 1, 0); > > ... > > /* Classify events based on event_type. */ > > switch(ev.event_type) { > > case RTE_EVENT_TYPE_ETHDEV: > > ... > > process_packets(...); > > break; > > case RTE_EVENT_TYPE_TIMER: > > process_timer_event(ev); > > ... > > break; > > } > > } > > } > > > > int main() > > { > > > > configure_event_dev(); > > configure_event_timer_wheel(); > > on_each_worker_lcores(events_processing_loop()) > > } > > > > Jerin Jacob (1): > > eventtimer: introduce event timer wheel > > > > doc/api/doxy-api-index.md | 3 +- > > lib/librte_eventdev/Makefile | 1 + > > lib/librte_eventdev/rte_event_timer_wheel.h | 493 > > ++++++++++++++++++++++++++++ > > lib/librte_eventdev/rte_eventdev.h | 4 +- > > 4 files changed, 498 insertions(+), 3 deletions(-) create mode 100644 > > lib/librte_eventdev/rte_event_timer_wheel.h > > > > -- > > 2.14.1 >