From patchwork Tue Oct 10 15:00:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 115412 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3857270qgn; Tue, 10 Oct 2017 08:03:12 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDWHYaYDL4kXF+JBU9kPViY60faumQ+5heM5kbB/n+0AH61Cx5BOs6I+Eoyz5BK86qJAsGx X-Received: by 10.36.160.136 with SMTP id o130mr6157143ite.36.1507647792420; Tue, 10 Oct 2017 08:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507647792; cv=none; d=google.com; s=arc-20160816; b=nCE8FdhB1iFEABG23LC7JF7dnFd/fxiNl8Elef14i2JmfoqeMx3BMHlNUkvUy6ItlG uAbEtWVI3sDanRQRtalUSM+N9sBHSl458qASqQDEohTrTOzuyCCW4ylhQFmp9Ln5Jr+i 2DTUbPzGQF8mDruYcBmMdmSKgjxRslhojOx2OAG/X6hiniD5z3Mg8hPV7mf0czDj8baK PoJDW4SoFkLBOhLXBR9iiLCqQtDH2BAobBjNKrV715jhaNL9ebWiPRcYYkQFUcHJJSS/ 62IKnkqmGf3ROqqjsI5n11W5hx6fwZscTcb6M/5HK+kFwmMDHkAJFufVf1VNsJPuN+3N S3Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=uMvFpb44XYgj6ZZhMlQ/nTpgEZeLocCCXrfsrbp7gMU=; b=AQl3foDDI7BRMB8FiSqFaSZOMCYJETGlihQqqWL7Caaus0+zCJV5enBGMydnl0TU6J N7lNzJHqMzxBysQZmXk7znZu5MsZuVuwnI8xRgtzLC3G9jgnocOCb0o8+03dp0Ma9e4+ EqoFkE4+DN3MBFldnqbH4Sdwy8qncZsGD0IPCqaYjBf7JwMwEhyLLZQpCOq9umvDPT94 tP/e3zVczY0LhLMSPsnLHl068JKJli9SxkIm2CuWPqAZTjmR8zbCanj/l4cxZCzJSSIN kZCqh2W2DdAlcR8HpZ4h30ClGcNLWcjWj/8cAwCZMgu/M2ZVBWLqZ5KzePaAznL07zr/ HNfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id p127si8993046itd.109.2017.10.10.08.03.10; Tue, 10 Oct 2017 08:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id C81C960D87; Tue, 10 Oct 2017 15:03:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 30DC060C79; Tue, 10 Oct 2017 15:01:14 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id ADC0460805; Tue, 10 Oct 2017 15:00:51 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id 8FE7260805 for ; Tue, 10 Oct 2017 15:00:48 +0000 (UTC) Received: from mxback5j.mail.yandex.net (mxback5j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10e]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 192691802C58 for ; Tue, 10 Oct 2017 18:00:47 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback5j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iYF0Fw68wp-0lga95Wg; Tue, 10 Oct 2017 18:00:47 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id jk0YtVglYD-0kxusgUY; Tue, 10 Oct 2017 18:00:46 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 10 Oct 2017 18:00:10 +0300 Message-Id: <1507647610-23573-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507647610-23573-1-git-send-email-odpbot@yandex.ru> References: <1507647610-23573-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 205 Subject: [lng-odp] [PATCH v2 4/4] linux-gen: timer: drop odp prefix from odp_timer_s X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Maxim Uvarov Signed-off-by: Maxim Uvarov --- /** Email created from pull request 205 (muvarov:master_timer_cleanup) ** https://github.com/Linaro/odp/pull/205 ** Patch: https://github.com/Linaro/odp/pull/205.patch ** Base sha: 3bacbfd55edf76b897a4b2e5c62b59ca6fa95331 ** Merge commit sha: 818bddefdf4c5afa6d1608da3de280ebcf585d75 **/ platform/linux-generic/odp_timer.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index 8b8166784..70a9c97b7 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -116,15 +116,15 @@ ODP_ALIGNED(16) /* 16-byte atomic operations need properly aligned addresses */ ODP_STATIC_ASSERT(sizeof(tick_buf_t) == 16, "sizeof(tick_buf_t) == 16"); #endif -typedef struct odp_timer_s { +typedef struct { void *user_ptr; odp_queue_t queue;/* Used for free list when timer is free */ -} odp_timer; +} _odp_timer_t; -static void timer_init(odp_timer *tim, - tick_buf_t *tb, - odp_queue_t _q, - void *_up) +static void timer_init(_odp_timer_t *tim, + tick_buf_t *tb, + odp_queue_t _q, + void *_up) { tim->queue = _q; tim->user_ptr = _up; @@ -140,7 +140,7 @@ static void timer_init(odp_timer *tim, } /* Teardown when timer is freed */ -static void timer_fini(odp_timer *tim, tick_buf_t *tb) +static void timer_fini(_odp_timer_t *tim, tick_buf_t *tb) { ODP_ASSERT(tb->exp_tck.v == TMO_UNUSED); ODP_ASSERT(tb->tmo_buf == ODP_BUFFER_INVALID); @@ -148,13 +148,13 @@ static void timer_fini(odp_timer *tim, tick_buf_t *tb) tim->user_ptr = NULL; } -static inline uint32_t get_next_free(odp_timer *tim) +static inline uint32_t get_next_free(_odp_timer_t *tim) { /* Reusing 'queue' for next free index */ return _odp_typeval(tim->queue); } -static inline void set_next_free(odp_timer *tim, uint32_t nf) +static inline void set_next_free(_odp_timer_t *tim, uint32_t nf) { ODP_ASSERT(tim->queue == ODP_QUEUE_INVALID); /* Reusing 'queue' for next free index */ @@ -172,7 +172,7 @@ typedef struct timer_pool_s { uint64_t min_rel_tck; uint64_t max_rel_tck; tick_buf_t *tick_buf; /* Expiration tick and timeout buffer */ - odp_timer *timers; /* User pointer and queue handle (and lock) */ + _odp_timer_t *timers; /* User pointer and queue handle (and lock) */ odp_atomic_u32_t high_wm;/* High watermark of allocated timers */ odp_spinlock_t lock; uint32_t num_alloc;/* Current number of allocated timers */ @@ -237,7 +237,8 @@ static odp_timer_pool_t timer_pool_new(const char *name, } size_t sz0 = ROUNDUP_CACHE_LINE(sizeof(timer_pool_t)); size_t sz1 = ROUNDUP_CACHE_LINE(sizeof(tick_buf_t) * param->num_timers); - size_t sz2 = ROUNDUP_CACHE_LINE(sizeof(odp_timer) * param->num_timers); + size_t sz2 = ROUNDUP_CACHE_LINE(sizeof(_odp_timer_t) * + param->num_timers); odp_shm_t shm = odp_shm_reserve(name, sz0 + sz1 + sz2, ODP_CACHE_LINE_SIZE, ODP_SHM_SW_ONLY); if (odp_unlikely(shm == ODP_SHM_INVALID)) @@ -337,7 +338,7 @@ static inline odp_timer_t timer_alloc(timer_pool_t *tp, /* Remove first unused timer from free list */ ODP_ASSERT(tp->first_free != tp->param.num_timers); uint32_t idx = tp->first_free; - odp_timer *tim = &tp->timers[idx]; + _odp_timer_t *tim = &tp->timers[idx]; tp->first_free = get_next_free(tim); /* Initialize timer */ timer_init(tim, &tp->tick_buf[idx], queue, user_ptr); @@ -363,7 +364,7 @@ static odp_buffer_t timer_cancel(timer_pool_t *tp, static inline odp_buffer_t timer_free(timer_pool_t *tp, uint32_t idx) { - odp_timer *tim = &tp->timers[idx]; + _odp_timer_t *tim = &tp->timers[idx]; /* Free the timer by setting timer state to unused and * grab any timeout buffer */ @@ -563,7 +564,7 @@ static odp_buffer_t timer_cancel(timer_pool_t *tp, static unsigned timer_expire(timer_pool_t *tp, uint32_t idx, uint64_t tick) { - odp_timer *tim = &tp->timers[idx]; + _odp_timer_t *tim = &tp->timers[idx]; tick_buf_t *tb = &tp->tick_buf[idx]; odp_buffer_t tmo_buf = ODP_BUFFER_INVALID; uint64_t exp_tck; @@ -691,7 +692,7 @@ static void timer_notify(timer_pool_t *tp) } } - odp_timer *array = &tp->timers[0]; + _odp_timer_t *array = &tp->timers[0]; uint32_t i; /* Prefetch initial cache lines (match 32 above) */ for (i = 0; i < 32; i += ODP_CACHE_LINE_SIZE / sizeof(array[0]))