From patchwork Thu May 19 16:27:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 68160 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3279683qge; Thu, 19 May 2016 08:52:11 -0700 (PDT) X-Received: by 10.140.107.70 with SMTP id g64mr14467001qgf.43.1463673131450; Thu, 19 May 2016 08:52:11 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m125si13091540qhc.127.2016.05.19.08.52.11; Thu, 19 May 2016 08:52:11 -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 1C692617F7; Thu, 19 May 2016 15:52:11 +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 E0F2261831; Thu, 19 May 2016 15:32:48 +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 A18D061822; Thu, 19 May 2016 15:32:39 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id 4E8F06181E for ; Thu, 19 May 2016 15:29:01 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id y84so38874708lfc.0 for ; Thu, 19 May 2016 08:29:01 -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=421qjEZ6bZE8c3sAlSSaYwHwRC3rq5eQ6g/0h2YBFGs=; b=YnBJnBnUTvpGH8DFEqGHCIgMZG0xzn7rvygtnXy7ed6vNzmWmMs3fwSyeghiw588Dv 4xUVnQ7PZFp+8Q5El2m61o1CkEePt/lMT81MAF+wx27u3bXc9cQaQ4Ve+haKh2AaS5nw Jmx8UcxlT3f5ZY/UFK+QMxGRP0OHchX6xM/R/hLHF7auIkz7auZuc4nEBk4J3Py3vPDn nOVuiTwiV3sQIhpU6YllxA6b01mke5ATyzoG2JPKb7suOwbjOmgE0U0PDWGtpWgIr8vp UwbAsRTjabU/kAH3AF6vREVzmWdOHmEM9YnkOKzIeaHSIzJNGCg8ox27JHUoQQOWfXcZ PbKw== X-Gm-Message-State: AOPr4FVbvbvOJJ8BRK9/RIG3wgPCq/HMvmbH/jMhpV7YFp15hXTcwZVlhPaGCYbISls3tTElf/4= X-Received: by 10.25.88.12 with SMTP id m12mr5144173lfb.42.1463671740280; Thu, 19 May 2016 08:29:00 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id cv11sm2366290lbb.49.2016.05.19.08.28.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 08:28:59 -0700 (PDT) From: Christophe Milard To: brian.brooks@linaro.org, maxim.uvarov@linaro.com, lng-odp@lists.linaro.org Date: Thu, 19 May 2016 18:27:10 +0200 Message-Id: <1463675234-6739-32-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463675234-6739-1-git-send-email-christophe.milard@linaro.org> References: <1463675234-6739-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv8 31/35] example: switch: 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_switch is changed to use the implementation agnostic ODP thread create and join functions, from helpers. odp_switch is hence no longer aware on how the odpthread is implemented. Signed-off-by: Christophe Milard --- example/switch/odp_switch.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index 96229ff..9358c2c 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -574,7 +574,7 @@ static void bind_workers(void) * * @param arg Thread arguments of type 'thread_args_t *' */ -static void *run_worker(void *arg) +static int run_worker(void *arg) { thread_args_t *thr_args = arg; odp_packet_t pkt_tbl[MAX_PKT_BURST]; @@ -652,7 +652,7 @@ static void *run_worker(void *arg) /* Make sure that latest stat writes are visible to other threads */ odp_mb_full(); - return NULL; + return 0; } /* @@ -878,7 +878,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]; int i, j; int cpu; int num_workers; @@ -890,7 +890,7 @@ int main(int argc, char **argv) stats_t (*stats)[MAX_PKTIOS]; int if_count; odp_instance_t instance; - odph_linux_thr_params_t thr_params; + odph_odpthread_params_t thr_params; /* Init ODP before calling anything else */ if (odp_init_global(&instance, NULL, NULL)) { @@ -1003,8 +1003,7 @@ 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); } @@ -1026,7 +1025,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);