From patchwork Thu May 19 16:27:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 68154 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3278398qge; Thu, 19 May 2016 08:49:29 -0700 (PDT) X-Received: by 10.36.14.71 with SMTP id 68mr3513294ite.98.1463672967899; Thu, 19 May 2016 08:49:27 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e13si13985316igz.25.2016.05.19.08.49.27; Thu, 19 May 2016 08:49:27 -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 E488A616D2; Thu, 19 May 2016 15:49:26 +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 427AC61815; Thu, 19 May 2016 15:32:25 +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 24C97618D1; Thu, 19 May 2016 15:32:20 +0000 (UTC) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by lists.linaro.org (Postfix) with ESMTPS id 16B1E61812 for ; Thu, 19 May 2016 15:28:53 +0000 (UTC) Received: by mail-lf0-f48.google.com with SMTP id e130so3872238lfe.3 for ; Thu, 19 May 2016 08:28:53 -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=JUWJqnjVJFYmMiEDM3Hs1Drw4+LzcLzGedquTFVwVe8=; b=kONHEwCOFh4iZz4qgV+89PPQYaJ1ZcaGXuzlbRDhtZwCllSilHDZ34u5sOWVnmIBry qnGZoi2XYVzYuU+7uyoqMlNyeLVRi9uAeGM5dpGezvD8hvms/SPl37NQoUG0a47XCLJh /cVh1bJcBmecItnI3lHE0DxY2o+Y/XeweeB46swGtjy7y0ZPdaEvuU+/dL1loQdV23LD tGdOqC9khoTKE8ZDltFzpU5IlLtNTpnORIcoIJvZ7y+zJLADs+ieB5TvnB4guonY9pnq tW9EUa62S5L8Vg7U6NPqO2ai7vZGvuNkUBW/4mjGhv/wZpAXEd67O1ykIUVJNjjVrl/o U5iw== X-Gm-Message-State: AOPr4FXJB/X0t8IRxgaSi7TznfQymhfQ5M7Bhb9XAKn5Dw0c3pwoQCrHY25aUcv5+yywvpXx+Ok= X-Received: by 10.25.18.26 with SMTP id h26mr426665lfi.110.1463671732017; Thu, 19 May 2016 08:28:52 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 08:28:51 -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:02 +0200 Message-Id: <1463675234-6739-24-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 23/35] example: l2fwd_simple: 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" l2fwd_simple is changed to use the implementation agnostic ODP thread create and join functions, from helpers. l2fwd_simple is hence no longer aware on how the odpthread is implemented. Signed-off-by: Christophe Milard --- example/l2fwd_simple/odp_l2fwd_simple.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c index fb096ab..c075744 100644 --- a/example/l2fwd_simple/odp_l2fwd_simple.c +++ b/example/l2fwd_simple/odp_l2fwd_simple.c @@ -68,7 +68,7 @@ static odp_pktio_t create_pktio(const char *name, odp_pool_t pool, return pktio; } -static void *run_worker(void *arg ODP_UNUSED) +static int run_worker(void *arg ODP_UNUSED) { odp_packet_t pkt_tbl[MAX_PKT_BURST]; int pkts, sent, tx_drops, i; @@ -97,7 +97,7 @@ static void *run_worker(void *arg ODP_UNUSED) if (odp_unlikely(!odp_packet_has_eth(pkt))) { printf("warning: packet has no eth header\n"); - return NULL; + return 0; } eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); eth->src = global.src; @@ -110,7 +110,7 @@ static void *run_worker(void *arg ODP_UNUSED) if (odp_unlikely(tx_drops)) odp_packet_free_multi(&pkt_tbl[sent], tx_drops); } - return NULL; + return 0; } int main(int argc, char **argv) @@ -118,9 +118,9 @@ int main(int argc, char **argv) odp_pool_t pool; odp_pool_param_t params; odp_cpumask_t cpumask; - odph_linux_pthread_t thd; + odph_odpthread_t thd; odp_instance_t instance; - odph_linux_thr_params_t thr_params; + odph_odpthread_params_t thr_params; if (argc != 5 || odph_eth_addr_parse(&global.dst, argv[3]) != 0 || @@ -169,7 +169,8 @@ int main(int argc, char **argv) thr_params.thr_type = ODP_THREAD_WORKER; thr_params.instance = instance; - odph_linux_pthread_create(&thd, &cpumask, &thr_params); - odph_linux_pthread_join(&thd, 1); + odph_odpthreads_create(&thd, &cpumask, &thr_params); + odph_odpthreads_join(&thd); + return 0; }