From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0087.outbound.protection.outlook.com [104.47.36.87]) by dpdk.org (Postfix) with ESMTP id 005A61B6A8 for ; Sun, 8 Apr 2018 09:39:48 +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=WvU5xPFrdUsuWP53DrD4XGRIMnTwSXmEUwHHSpKDK4c=; b=npThbaaV7cUeKejH3KE+276eIxf9LrBbfkDOPE/FWz5rrPKkshywa9pAyqiVpC7ikvIXeMxFtnijfgSr2TmwYuo/7vpJMOOOZecPgU2tZlcvr1iWXtTkyIr+Ry5oRBgBcacUDB56Pl174Wv13ib2T52aoRUenlPuBNN4xoIdquI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (122.178.210.9) 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.653.12; Sun, 8 Apr 2018 07:39:45 +0000 Date: Sun, 8 Apr 2018 13:09:30 +0530 From: Jerin Jacob To: Pavan Nikhilesh Cc: santosh.shukla@caviumnetworks.com, erik.g.carrillo@intel.com, dev@dpdk.org Message-ID: <20180408073928.GA6880@jerin> References: <20180216213700.3415-1-pbhagavatula@caviumnetworks.com> <20180403150514.24201-1-pbhagavatula@caviumnetworks.com> <20180403150514.24201-4-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180403150514.24201-4-pbhagavatula@caviumnetworks.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [122.178.210.9] X-ClientProxiedBy: MAXPR0101CA0061.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::23) To SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05c83624-32c8-4d43-2722-08d59d23e740 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2526; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 3:1eM2napRJOYDLdTry3SJ0aiO4vrvCnbIRqm0+zVgsm2vFI6HCKwcC5QpkXDFuhTGvglGnXm33adVA2WbKNB8OcDwAkqGbKO+OvkyQIdgm68uCxpnxZqSoxPS82brEdFeUg0koz3Hkay+wEI5lMChYOxF9VuvZMKzqDolMfUGkTrm4h38wOZtao/i6cBvny4N271m/BorFljoLZ+8kYvVJz3dA2pg6EDwuEKcRBEmFl26hxRrFYZARtcjA/oTc8lt; 25:SWK2JHA9kJU9tn7ISFHbmQWYDCawzBc0xUUVN4aUNh/L4X1vWZDs2JR/61lv+vC/mVUVTKbr9kfHJaPo9qY7dvQGU0Dx16cO3Q6GlS3BEhSTLeZq16cnLo+3BqMuYwK4D/lv8I/xRkl7d5+vvGMFY2dTUl8MfPKVRiy5OB1Wtiyy5HWR+jfrzLs08SL6zYZ3R4R96HEhj2nCjjEe1E1UPM5nA6RDDnNQwSJhkvWWj3syV/8HUnqVvPuPZKtZVVAVMXcmYIym2ZqXBYKn5v4fzvaVqQ7/os3splS4pv0d9xF8Xc321UQYlxQ+PJ3vY+2sGNZBx9eIiYfLxbGUFqt1rw==; 31:9OsGysgI7k96PAqoPsoSJj59OiwxeB0ODc287OWJ1GW6cnfjKVjUwS3M1mcRxQGYXhtO76sS5K5uLYIb1cd8s27npgK5qIx9jj7vNFiklOVPs1jY8EwO4viWQWEvnQa38ceOl1ia8FZxPQiMMznez9W0OJwURm7QM1bQqBWEBlnEmOE6aTConHk5HgcpxJNct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Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(3231221)(944501327)(52105095)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN2PR07MB2526; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2526; X-Forefront-PRVS: 0636271852 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(346002)(376002)(366004)(396003)(39850400004)(13464003)(189003)(199004)(53936002)(446003)(26005)(229853002)(47776003)(6636002)(42882007)(55016002)(97736004)(33656002)(66066001)(6666003)(2906002)(16526019)(105586002)(478600001)(50466002)(9686003)(72206003)(33716001)(8936002)(4326008)(7736002)(23726003)(25786009)(33896004)(6496006)(1076002)(386003)(3846002)(5660300001)(59450400001)(6116002)(6246003)(956004)(476003)(52116002)(8676002)(11346002)(81166006)(106356001)(6862004)(316002)(305945005)(81156014)(68736007)(76176011)(486006)(16586007)(58126008)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2526; H:jerin; 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; SN2PR07MB2526; 23:tqXFr5+W+DiI8YRZgGXnLu5ptc3CUoN5ok1thsZxS?= =?us-ascii?Q?qBztq1euMe6+knh1wlviSEmaM5MuRJuV6oFr1xr6QcfXvsRNGCoAPE4UnNdQ?= =?us-ascii?Q?iM6XQCEYt5jZP702+WGdcyFEdA3n5dQsMWYYs+/cFFOkjWbLpsriLO2hNxHr?= =?us-ascii?Q?qYoiUm4YvVOIk1rTMdRWOoXzRdPn2b8qk2enb46Q8gbUX8xfVpbM3cbYD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rkN/Ecw3MsO6Czm4yOujr5aZXm?= =?us-ascii?Q?FYQ0HsCrEyAL1wtJwJmIRIcMJuzXoceieK0946g7TpX0vCAkep1AmoxBuTpW?= =?us-ascii?Q?hNUFSMk0TLks8vwQe05YVG5om4VJfxU4cRuuw94mE88cvHBLjXTCNe0cs02b?= =?us-ascii?Q?ewgb5avFEtvfxDRQzAJ4v77uzNt9WDT0DixEj89L+k8/nLqCMOoSHwmU5Spw?= =?us-ascii?Q?oMlAoiiwTxUOwG9bek6J2jQN+e6h+yJWv1QWI5ubgR3?= X-Microsoft-Antispam-Message-Info: Gnw9Bk1tvoGOFHLMR5ttM3N/lFz8eTsdW4fwaNWf70srhe3ByaZlNdmkpmBu8mnuFAsgAKD9jJFU7S7NmCgqw/gOOCNIa32J1NK1ux9j/oATmw7IWGVg6CftfQdOY+ftQBReXdjaKN5PoxEBhCFluLFZoWwDhfc2oF27ueOHcP0mLx/fUpziGNf5Rma8BHKD X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 6:MJB4nh/tUgXcGi3Pa/9s04XhHEtrpMFvgwcPNgBzVwFz20fKrO1K65V/NFg331Bb1LgqJkuNdmSTCeao26xcUK24nZu38Bp5bb8MtPt9kCn2kbVUkqX1lxbGbYpcdub0ICItWdQWy3XRrVLm82YxCxl0XV2IBqPK+kE65ZOKcHXNFjRk3M57KhIImnS3cumcHmALcXQCj0tn5TPFK9vawujaSP0BAVto60UORQgb6XNmWRF9ZTJRoCNvxHKp8001uhBGls94+1/GGtOgbikM+VuVowlAlX243rSugDYuecgCmF7bBDPArUtYnhgQTalLX1vlo9r2BdMqhiax+HzHtGRjzHvi+DvfEfgm1/RuN4zJ3WeRhexABS3mp+e3HHblUCvYcXk/BuGrwdKLeOP0jNOnHPTGV6b1xfQelm2v75cNLco0Q/X8VhurqXPNB3X0IjwXood0OeHjAyJEdOqZSQ==; 5:l8jyXVMB/FsCR+axboy3fAeZWci0YFl/aoUVyLywfOsRPsN85eWRgjFk7Q3v4TcjTsmaFKXY/kU1pHIXEponrkG/wphWoV0O3chxcp/r1HLlJsqBDWyDqY5JIApyDfVW4qvvBlsOU/ma6y3670dZLOGSViCGdm50JS+YWNmv4b8=; 24:TdE3us8kUo/RrgqOOvV9hYGeAkyL8V55WyIXf+vwWc2MJVqZYJJGj5PmPOlA7cLJPeS35u6uispGjwxU/vsGikzO+4nyZ10MqdJcTHvgZWM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 7:kX+6We1lkq8bnLDdp8+FC+B4aLLObMt4Njn9jF14Y4zH2zob1wcNiTePrimqT3OrfvEBctN/f97NNe7roB05sA0f8AFq7owq2oeen+Von5xy1PgRPXwZyZEn2bHlwmms5wq2CeRtgonXwThFDFFM/M0Ljx/Fz5Ux3MC188bhVhtC+l9y8Vn2v1ljYuwyDGeaDBQZBABKfm0e8KqJh6sBkziWokCx7QTcnPhHd+DZ4xRjIckqe0K/7Zrtu6o8tGIT X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2018 07:39:45.3200 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05c83624-32c8-4d43-2722-08d59d23e740 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2526 Subject: Re: [dpdk-dev] [PATCH v3 03/12] event/octeontx: add support to create and free timer adapter 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 Apr 2018 07:39:49 -0000 -----Original Message----- > Date: Tue, 3 Apr 2018 20:35:05 +0530 > From: Pavan Nikhilesh > To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, > erik.g.carrillo@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh > Subject: [dpdk-dev] [PATCH v3 03/12] event/octeontx: add support to create > and free timer adapter > X-Mailer: git-send-email 2.16.3 > > When the application requests to create a timer device, Octeontx TIM > create does the following: > - Get the requested TIMvf ring based on adapter_id. > - Verify the config parameters supplied. > - Allocate memory required for > * Buckets based on min and max timeout supplied. > * Allocate the chunk pool based on the number of timers. > - Clear the interrupts. > > On Free: > - Free the allocated bucket and chunk memory. > - Free private data used by TIMvf. > > Signed-off-by: Pavan Nikhilesh > --- > +static int > +timvf_ring_create(struct rte_event_timer_adapter *adptr) > +{ > + > + switch (rcfg->clk_src) { > + case RTE_EVENT_TIMER_ADAPTER_CPU_CLK: while defining the enum, equate TIM_CLK_SRC_SCLK, TIM_CLK_SRC_GPIO.. values to RTE_EVENT_TIMER_ADAPTER_CPU_CLK, RTE_EVENT_TIMER_ADAPTER_EXT_CLK0 .. etc to avoid switch case. > + timr->clk_src = TIM_CLK_SRC_SCLK; > + break; > + case RTE_EVENT_TIMER_ADAPTER_EXT_CLK0: > + timr->clk_src = TIM_CLK_SRC_GPIO; > + break; > + case RTE_EVENT_TIMER_ADAPTER_EXT_CLK1: > + timr->clk_src = TIM_CLK_SRC_GTI; > + break; > + case RTE_EVENT_TIMER_ADAPTER_EXT_CLK2: > + timr->clk_src = TIM_CLK_SRC_PTP; > + break; > + default: > + timvf_log_err("Invalid clk source specified."); > + goto cfg_err; > + } > + > + timvf_write64(0, (uint8_t *)timr->vbar0 + TIM_VRING_BASE); > + timvf_write64(0, (uint8_t *)timr->vbar0 + TIM_VF_NRSPERR_INT); > + timvf_write64(0, (uint8_t *)timr->vbar0 + TIM_VF_NRSPERR_INT_W1S); > + timvf_write64(0x7, (uint8_t *)timr->vbar0 + TIM_VF_NRSPERR_ENA_W1C); > + timvf_write64(0x7, (uint8_t *)timr->vbar0 + TIM_VF_NRSPERR_ENA_W1S); > + > + return 0; > +mem_err: > + rte_free(timr); > + return -ENOMEM; > +cfg_err: > + rte_free(timr); > + return -EINVAL; > +} > + > +static int > +timvf_ring_free(struct rte_event_timer_adapter *adptr) > +{ > + struct timvf_ring *timr = adptr->data->adapter_priv; > + rte_mempool_free(timr->meta.chunk_pool); > + rte_free(timr->meta.bkt); > + rte_free(adptr->data->adapter_priv); > + return 0; > +} > + > +static struct rte_event_timer_adapter_ops timvf_ops = { use const > + .init = timvf_ring_create, Found additional tab > + .uninit = timvf_ring_free, > + .get_info = timvf_ring_info_get, > +}; > + > +int > +timvf_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t flags, > + uint32_t *caps, const struct rte_event_timer_adapter_ops **ops) > +{ > + RTE_SET_USED(dev); > + RTE_SET_USED(flags); > + *caps = RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT; > + *ops = &timvf_ops; > + return -EINVAL; > +} > +enum timvf_clk_src { > + TIM_CLK_SRC_SCLK, See above comment. > + TIM_CLK_SRC_GPIO, > + TIM_CLK_SRC_GTI, > + TIM_CLK_SRC_PTP, > +}; > + > +struct timvf_meta { > + bkt_id get_target_bkt; > + refill_chunk refill_chunk; > + struct rte_reciprocal_u64 fast_div; > + uint64_t ring_start_cyc; > + uint32_t nb_bkts; > + struct tim_mem_bucket *bkt; > + void *chunk_pool; > + uint64_t tck_int; > +}; > + > +struct timvf_ring { > + struct timvf_meta meta; IMO, Additional 'meta' indirection can be avoid to reduce the code clutter. > + uint64_t tck_nsec; > + void *vbar0; > + void *bkt_pos; > + uint64_t max_tout; > + uint64_t nb_chunks; > + enum timvf_clk_src clk_src; > + uint16_t tim_ring_id; > +} __rte_cache_aligned; > +