From patchwork Tue May 17 13:04:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 67960 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2076475qge; Tue, 17 May 2016 06:30:00 -0700 (PDT) X-Received: by 10.140.16.133 with SMTP id 5mr1374403qgb.50.1463491800795; Tue, 17 May 2016 06:30:00 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v5si2196756qkv.204.2016.05.17.06.30.00; Tue, 17 May 2016 06:30:00 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6DD3C6177E; Tue, 17 May 2016 13:30:00 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 A54386180F; Tue, 17 May 2016 13:15:32 +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 03B9B61779; Tue, 17 May 2016 13:15:01 +0000 (UTC) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by lists.linaro.org (Postfix) with ESMTPS id AC50B6178E for ; Tue, 17 May 2016 13:05:22 +0000 (UTC) Received: by mail-lf0-f50.google.com with SMTP id u64so6522984lff.3 for ; Tue, 17 May 2016 06:05:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=h0LCIAISiuC1atOoOHALbK2dyIicx7tddSi+8UWwerw=; b=NkSlFnoD6euCeNcrXX6gLjn6kDX0qU7DPnUjYwcC/MmSMfs0QwaW41DkZq84TdI7mZ OYcEmcyhM9ylxdlUKRJVbadmiXUkjeH81CGZCtjLcQpmVHqK9hEwZNnRZS7G67UcgG4C nX+Gqc9wxU5RbYwGLNe4bXsYFbHyvFO6x4AT3AsIX44DOMNn+WmlfX72+Oo/j5cjOyj8 EbDnhA7nhGYrd5pAd/g3o+4nx4JmP6Sfthh5Cy46yJnoJSGIWdbOrgiE0RozrlG4vdEn VNOFJFXIGNEGOKfh7QArwxl0Nk7euHBv451nqODliFlqX2V0Ng6eO4WCs5BYvdnXSbR5 aw5w== X-Gm-Message-State: AOPr4FXBPqWMz6AlwwJpjlyWsp8TADnJXDqEvpbeZ1Vb5S0d1jnGrQ825/Uu+gxDXYvZ4TmOX1k= X-Received: by 10.25.43.85 with SMTP id r82mr431693lfr.63.1463490321594; Tue, 17 May 2016 06:05:21 -0700 (PDT) Received: from localhost.localdomain (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id q1sm506536lbo.4.2016.05.17.06.05.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 May 2016 06:05:21 -0700 (PDT) From: Christophe Milard To: lng-odp@lists.linaro.org, brian.brooks@linaro.org, mike.holmes@linaro.org Date: Tue, 17 May 2016 15:04:20 +0200 Message-Id: <1463490282-23277-14-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463490282-23277-1-git-send-email-christophe.milard@linaro.org> References: <1463490282-23277-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv7 13/35] performance: odp_l2fwd: using agnostic function for ODP threads 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" odp_l2fwd is changed to use the implementation agnostic ODP thread create and join functions, from helpers. odp_l2fwd is hence no longer aware on how the odpthread is implemented. Signed-off-by: Christophe Milard --- test/performance/odp_l2fwd.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 8b83475..9a8d578 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -296,7 +296,7 @@ static inline int event_queue_send(odp_queue_t queue, odp_packet_t *pkt_tbl, * * @param arg thread arguments of type 'thread_args_t *' */ -static void *run_worker_sched_mode(void *arg) +static int run_worker_sched_mode(void *arg) { odp_event_t ev_tbl[MAX_PKT_BURST]; odp_packet_t pkt_tbl[MAX_PKT_BURST]; @@ -398,7 +398,7 @@ static void *run_worker_sched_mode(void *arg) /* Make sure that latest stat writes are visible to other threads */ odp_mb_full(); - return NULL; + return 0; } /** @@ -406,7 +406,7 @@ static void *run_worker_sched_mode(void *arg) * * @param arg thread arguments of type 'thread_args_t *' */ -static void *run_worker_plain_queue_mode(void *arg) +static int run_worker_plain_queue_mode(void *arg) { int thr; int pkts; @@ -497,7 +497,7 @@ static void *run_worker_plain_queue_mode(void *arg) /* Make sure that latest stat writes are visible to other threads */ odp_mb_full(); - return NULL; + return 0; } /** @@ -505,7 +505,7 @@ static void *run_worker_plain_queue_mode(void *arg) * * @param arg thread arguments of type 'thread_args_t *' */ -static void *run_worker_direct_mode(void *arg) +static int run_worker_direct_mode(void *arg) { int thr; int pkts; @@ -591,7 +591,7 @@ static void *run_worker_direct_mode(void *arg) /* Make sure that latest stat writes are visible to other threads */ odp_mb_full(); - return NULL; + return 0; } /** @@ -1287,7 +1287,7 @@ static void gbl_args_init(args_t *args) */ int main(int argc, char *argv[]) { - odph_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int i; int cpu; @@ -1300,7 +1300,7 @@ int main(int argc, char *argv[]) int ret; stats_t *stats; int if_count; - void *(*thr_run_func)(void *); + int (*thr_run_func)(void *); odp_instance_t instance; /* Init ODP before calling anything else */ @@ -1435,7 +1435,7 @@ int main(int argc, char *argv[]) cpu = odp_cpumask_first(&cpumask); for (i = 0; i < num_workers; ++i) { odp_cpumask_t thd_mask; - odph_linux_thr_params_t thr_params; + odph_odpthread_params_t thr_params; memset(&thr_params, 0, sizeof(thr_params)); thr_params.start = thr_run_func; @@ -1447,8 +1447,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&thd_mask); odp_cpumask_set(&thd_mask, cpu); - odph_linux_pthread_create(&thread_tbl[i], &thd_mask, - &thr_params); + odph_odpthreads_create(&thread_tbl[i], &thd_mask, + &thr_params); cpu = odp_cpumask_next(&cpumask, cpu); } @@ -1470,7 +1470,8 @@ int main(int argc, char *argv[]) exit_threads = 1; /* Master thread waits for other threads to exit */ - odph_linux_pthread_join(thread_tbl, num_workers); + for (i = 0; i < num_workers; ++i) + odph_odpthreads_join(&thread_tbl[i]); free(gbl_args->appl.if_names); free(gbl_args->appl.if_str);