From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0070.outbound.protection.outlook.com [104.47.38.70]) by dpdk.org (Postfix) with ESMTP id 157F2AAD2 for ; Wed, 14 Mar 2018 14:53:29 +0100 (CET) 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=39fJeuNyGSfJv6z+SR5n/OdPPkwxlnZYvWy66y/9Tys=; b=fdWx7EszSvHRIEOgZbIVwKGZTG5K+DOPzX6DGZrZv22SQhj+fpL8EeLgV6+L4woh/4ZNCbPUoz2QyfRtFiSpIQpAhSgTBeHnFLf3hvXPMRSntIFnfD90Zf2YbAx0aOjkdCg+bHYeQHCFPX6L/fguaAkMK28ginnmOW1u2hDBrHE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (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.567.14; Wed, 14 Mar 2018 13:53:25 +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: Wed, 14 Mar 2018 19:22:29 +0530 Message-Id: <20180314135233.31282-8-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180314135233.31282-1-pbhagavatula@caviumnetworks.com> References: <20180216213700.3415-1-pbhagavatula@caviumnetworks.com> <20180314135233.31282-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: DM5PR20CA0005.namprd20.prod.outlook.com (2603:10b6:3:93::15) To MWHPR07MB3470.namprd07.prod.outlook.com (2603:10b6:301:63::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1c8a90f7-9114-4fc6-2104-08d589b2f667 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:BhjFVX3E7KCD4z1rkUAwsBRQfE/EUDpIsEPhwru91M/hWWS5+F9eakVA2bX4g037DcDh8tKZmNXqIxxT3F23JqPIE7l4Y9Hpdwk2KBi+8hG6vMnG5jSlkAmwT5g5c7NAvZMguqi05IPlktsYYC+6VwNCIDv/9Jz1inF1ouMTXDCakNbpFN9+Mtu+5rdVehT0UL+cTGqLNvFMv8H4sc0WH08zmswpFddcaLsvTRU+8Gc5NBJ6jqsFdoTitzh/iL0J; 25:UU8V9GDlZ8nAss61U9XVjJMF9qf11ak9OZ+42zs7ct/UNBwF2mIdB3QCSbiWG2av3/BWnONmxJ+Dar66zDMxAqWPZqku+hmXZtg+8KbJrq73BJP/K/TehrNxQ2ZsdTUV7p+TQKj20tra1ABpvBa0MktZTKt92WYi6rbw3WPWPYRCeFQ03psgGoLT4E3saNyo+kLjBdVLsSk7/CYWVAQtkEhEsSRoNJTT6vsF5vgnOG/mxB8vvfdijbgx1xw3mLC9OIy8P7bwmqU+LYYw0hLhCmJuLBpApV3dYqKwwp0EjLQ608O50ek2PaFQCPukKAtQ/j1EFe+YW0VfBIEjQ/0GCg==; 31:kGt2jfAV0o7iEMqDqML50kmG5sXNAIVRnOL8TzAt0TKQv9jjS1f+iTYIILeT6nQMY7fwMEecUKs0OtQLx6U8c2g/wv7/bFTH59ANCoZAdwJOgFaBz19RdnfRPX3MTo5XU756h+mCFeRGKoPueUFCBpV9P7SEJmnjyab8V4+chK3IPz9qcZ2bnaDRsrNrLZ2SdwoNv5C+hDFmodCCihDoDMAzQjrv176o0zB4GidBles= X-MS-TrafficTypeDiagnostic: MWHPR07MB3470: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3470; 20:7ND+tzClOefDOBnPAJXG1WT+p64s1gmnc233Y6DGT4U2xCZrzevjRR8Ttwo1+OdulRdKxn1atflXQF4Q4fQffxrMVFwmkkgQmmraKcDAax+H469nn0jPPYc6wwc19XXczAt6rQMKBJBtpOo0IChmUjl+wlokmkmy7m4ld13GgfR/RqB59755SZ27aBA/DQ5RikRFggX2kZAogiFz+lfNQkS4aVK5jj75tX9FVy10GANUY5HwLNJIf84Pgow87key7KlgfkMZc22nKkS/H42vw9k8XcBQ9KiNosU9sgJiSJ2mCdkm0e10gPtze6V0fNNflKXqeMBQdhPsK1fv3pJSriDyloihkYntK9QbaWD4BX20bw8Eh6lFhrVcoomrEwDjIQjFxDHKCI6Pf76fWZtNvryV5k+45oaGVmjpD2WmdvI/lmBvbcuWwXwDuVKz8v442CLRm9v7p7ry9mUXddsEsjF2aqN9ukKas7pho8L/n6SEq8aPUXNrEUin1sYFuPdIFHmPbFZ9dKP51FBszvZvqNG5NTwtMvCtpOIvWACMD756o6QQXNN9evqdauhhlMqlu2p4ZL1J8mEOaVGnw4F5NCF/f3nc6hYTVYu2Yb8ZhEw=; 4:DuqREJScVr6w7Cf8ATd0O6hlmfU8M5O+LwYlxuAJLbjazGekCshQdklk3LJn7FK6CUGviGBFDNVU0N6EPz/EBsfDdg8Hc78+v1NnW9ma5AjOY2IXMs7N8fuepRsC/6HfSLVN3QrcMT0g3qLWT8xieomdqbjZnBLDn+EhYcVx1GgniNRUM/k5Pw/3jvzsbN9zrLO51AUKOnwu4R/YDH/aErlFXCDdsyIMeh7jxgglgWPTtwj0MbUjp2bDi8KiTmX9jpEgweHo11w0kT5zjLopvQ== 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)(944501244)(52105095)(3002001)(93006095)(10201501046)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:MWHPR07MB3470; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3470; X-Forefront-PRVS: 0611A21987 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(39380400002)(366004)(346002)(396003)(189003)(199004)(53936002)(6512007)(3846002)(4326008)(6506007)(48376002)(26005)(105586002)(68736007)(97736004)(47776003)(2950100002)(386003)(1076002)(6486002)(106356001)(52116002)(305945005)(107886003)(7736002)(69596002)(76176011)(66066001)(5660300001)(59450400001)(51416003)(25786009)(36756003)(50466002)(316002)(16586007)(72206003)(53416004)(1857600001)(6116002)(478600001)(575784001)(8676002)(81156014)(81166006)(42882007)(2906002)(5009440100003)(50226002)(16526019)(8936002)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3470; H:ltp-pvn.caveonetworks.com; 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; MWHPR07MB3470; 23:ggOYSrLZEwq1fqFYaC9tElpXIklVjYG1l3KzGQA3+?= =?us-ascii?Q?2xEG6XRtpDFqc2KlFQZggyPlrQiWwa/SYgQXyE/5qLD2JouSZcDvhI+s5VbL?= =?us-ascii?Q?wtBY4SF6c9ocrAsNW5EJwmXU1JftyESqViYox2ZsZ2F50L+AO2dkMp4aJWLJ?= =?us-ascii?Q?AnmqNv6Py1/TvLWCYENNAbgh9s9N0BNwu9oQJ1kdbeSKQbs3yxf27PP65YaU?= =?us-ascii?Q?GjQkun3l13oEA8b5S3ADEgyTtczvZOvd3TVL7vyh6Krxu9JdO+38CDmroYjO?= =?us-ascii?Q?l9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BC6V4wmktxbskyzbSAPuHFKmbI+FyAjWBg7M/yEkBTnfmTHBZ+oxoS4F9azq+2sN7WtA4IutItKeibZrU1nyc2Phqfu/qZMpNX2LQ7vsrwyNmXGuaZXEn7D1i5UR/qRE6XRyKNyz6ZgCEpUI8NU7r9yaAQ0P7M597TQQAkPU28pr15cUdZyF6jlL4k0dKX51f02ZtIC6AbFAwlDcvHWqQHZVfP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2018 13:53:25.4086 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c8a90f7-9114-4fc6-2104-08d589b2f667 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 v2 07/11] event/octeontx: add burst mode for timer arm 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: Wed, 14 Mar 2018 13:53:30 -0000 Signed-off-by: Pavan Nikhilesh --- drivers/event/octeontx/timvf_evdev.c | 1 + drivers/event/octeontx/timvf_evdev.h | 3 ++ drivers/event/octeontx/timvf_worker.c | 36 +++++++++++++ drivers/event/octeontx/timvf_worker.h | 95 +++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+) diff --git a/drivers/event/octeontx/timvf_evdev.c b/drivers/event/octeontx/timvf_evdev.c index 3d0e43229..fe4e8cd05 100644 --- a/drivers/event/octeontx/timvf_evdev.c +++ b/drivers/event/octeontx/timvf_evdev.c @@ -307,6 +307,7 @@ timvf_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t flags, else timvf_ops.arm_burst = timvf_timer_reg_burst_mp; + timvf_ops.arm_tmo_tick_burst = timvf_timer_reg_brst; timvf_ops.cancel_burst = timvf_timer_unreg_burst; *caps = RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT; diff --git a/drivers/event/octeontx/timvf_evdev.h b/drivers/event/octeontx/timvf_evdev.h index 232657776..a263ccc68 100644 --- a/drivers/event/octeontx/timvf_evdev.h +++ b/drivers/event/octeontx/timvf_evdev.h @@ -199,6 +199,9 @@ int timvf_timer_reg_burst_sp(const struct rte_event_timer_adapter *adptr, struct rte_event_timer **tim, const uint16_t nb_timers); int timvf_timer_reg_burst_mp(const struct rte_event_timer_adapter *adptr, struct rte_event_timer **tim, const uint16_t nb_timers); +int timvf_timer_reg_brst(const struct rte_event_timer_adapter *adptr, + struct rte_event_timer **tim, const uint64_t timeout_tick, + const uint16_t nb_timers); void timvf_set_chunk_refill(struct timvf_ring * const timr); #endif /* __TIMVF_EVDEV_H__ */ diff --git a/drivers/event/octeontx/timvf_worker.c b/drivers/event/octeontx/timvf_worker.c index 93fd050c0..8c1da246c 100644 --- a/drivers/event/octeontx/timvf_worker.c +++ b/drivers/event/octeontx/timvf_worker.c @@ -81,6 +81,42 @@ timvf_timer_reg_burst_mp(const struct rte_event_timer_adapter *adptr, return index; } +int +timvf_timer_reg_brst(const struct rte_event_timer_adapter *adptr, + struct rte_event_timer **tim, const uint64_t timeout_tick, + const uint16_t nb_timers) +{ + int ret; + uint16_t set_timers = 0; + uint16_t idx; + uint16_t arr_idx = 0; + struct timvf_ring *timr = adptr->data->adapter_priv; + struct tim_mem_entry entry[TIMVF_MAX_BURST] __rte_cache_aligned; + + if (unlikely(timeout_tick > timr->meta.nb_bkts)) { + for (idx = 0; idx < nb_timers; idx++) + tim[idx]->state = RTE_EVENT_TIMER_ERROR_TOOLATE; + rte_errno = EINVAL; + return 0; + } + + while (arr_idx < nb_timers) { + for (idx = 0; idx < TIMVF_MAX_BURST && (arr_idx < nb_timers); + idx++, arr_idx++) { + entry[idx].w0 = + (tim[arr_idx]->ev.event & 0xFFC000000000) >> 6 | + (tim[arr_idx]->ev.event & 0xFFFFFFFF); + entry[idx].wqe = tim[arr_idx]->ev.u64; + } + ret = timvf_add_entry_brst(timr, timeout_tick, &tim[set_timers], + entry, idx); + set_timers += ret; + if (ret != idx) + break; + } + return set_timers; +} + void timvf_set_chunk_refill(struct timvf_ring * const timr) { diff --git a/drivers/event/octeontx/timvf_worker.h b/drivers/event/octeontx/timvf_worker.h index 7e197f5cd..9dad5c769 100644 --- a/drivers/event/octeontx/timvf_worker.h +++ b/drivers/event/octeontx/timvf_worker.h @@ -325,3 +325,98 @@ timvf_add_entry_mp(struct timvf_ring * const timr, const uint32_t rel_bkt, tim->state = RTE_EVENT_TIMER_ARMED; return 0; } + +static inline uint16_t +timvf_cpy_wrk(uint16_t index, uint16_t cpy_lmt, + struct tim_mem_entry *chunk, + struct rte_event_timer ** const tim, + const struct tim_mem_entry * const ents, + const struct tim_mem_bucket * const bkt) +{ + for (; index < cpy_lmt; index++) { + *chunk = *(ents + index); + tim[index]->impl_opaque[0] = (uint64_t)chunk++; + tim[index]->impl_opaque[1] = (uint64_t)bkt; + tim[index]->state = RTE_EVENT_TIMER_ARMED; + } + + return index; +} + +/* Burst mode functions */ +static inline int +timvf_add_entry_brst(struct timvf_ring * const timr, const uint16_t rel_bkt, + struct rte_event_timer ** const tim, + const struct tim_mem_entry *ents, + const uint16_t nb_timers) +{ + int16_t rem; + int16_t crem = 0; + uint8_t lock_cnt; + uint16_t index = 0; + uint16_t chunk_remainder = 0; + uint64_t lock_sema; + struct tim_mem_bucket *bkt; + struct tim_mem_entry *chunk; + +__retry: + bkt = timvf_get_target_bucket(timr, rel_bkt); + + /* Only one thread beyond this. */ + lock_sema = timr_bkt_inc_lock(bkt); + lock_cnt = (uint8_t) + ((lock_sema >> TIM_BUCKET_W1_S_LOCK) & TIM_BUCKET_W1_M_LOCK); + + if (lock_cnt) { + timr_bkt_dec_lock(bkt); + goto __retry; + } + + /* Bucket related checks. */ + if (unlikely(timr_bkt_get_hbt(lock_sema))) { + timr_bkt_dec_lock(bkt); + goto __retry; + } + + chunk_remainder = timr_bkt_fetch_rem(lock_sema); + rem = chunk_remainder - nb_timers; + if (rem < 0) { + crem = nb_chunk_slots - chunk_remainder; + if (chunk_remainder && crem) { + chunk = ((struct tim_mem_entry *)bkt->current_chunk) + + crem; + + index = timvf_cpy_wrk(index, chunk_remainder, + chunk, tim, ents, bkt); + timr_bkt_sub_rem(bkt, chunk_remainder); + timr_bkt_add_nent(bkt, chunk_remainder); + } + rem = nb_timers - chunk_remainder; + ents = ents + chunk_remainder; + + chunk = timr->meta.refill_chunk(bkt, timr); + if (unlikely(chunk == NULL)) { + timr_bkt_dec_lock(bkt); + rte_errno = ENOMEM; + tim[index]->state = RTE_EVENT_TIMER_ERROR; + return crem; + } + *(uint64_t *)(chunk + nb_chunk_slots) = 0; + bkt->current_chunk = (uint64_t) chunk; + + index = timvf_cpy_wrk(index, nb_timers, chunk, tim, ents, bkt); + timr_bkt_set_rem(bkt, nb_chunk_slots - rem); + timr_bkt_add_nent(bkt, rem); + } else { + chunk = (struct tim_mem_entry *)bkt->current_chunk; + chunk += (nb_chunk_slots - chunk_remainder); + + index = timvf_cpy_wrk(index, nb_timers, + chunk, tim, ents, bkt); + timr_bkt_sub_rem(bkt, nb_timers); + timr_bkt_add_nent(bkt, nb_timers); + } + + timr_bkt_dec_lock(bkt); + return nb_timers; +} -- 2.16.2