From patchwork Fri May 20 16:30:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 68273 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3858274qge; Fri, 20 May 2016 08:53:16 -0700 (PDT) X-Received: by 10.140.249.5 with SMTP id u5mr4284483qhc.24.1463759595645; Fri, 20 May 2016 08:53:15 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v19si18699003qkb.111.2016.05.20.08.53.15; Fri, 20 May 2016 08:53:15 -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 38D12616DD; Fri, 20 May 2016 15:53:15 +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 6A8766180E; Fri, 20 May 2016 15:35:42 +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 8664661893; Fri, 20 May 2016 15:35:36 +0000 (UTC) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by lists.linaro.org (Postfix) with ESMTPS id A7ACA61588 for ; Fri, 20 May 2016 15:32:25 +0000 (UTC) Received: by mail-lb0-f178.google.com with SMTP id n11so36622518lbh.1 for ; Fri, 20 May 2016 08:32:25 -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=du8bgpaZAjA+x+NbvzZBjnd5DASfvY3FbghXxc+YlnFaZZtaUIeWzt0VesWl9iMwFY htaULyLQhFe5T/yKjwa5JvBIsshTz590NMYQltno4HgXFDNiFVVhRXab83r2rZC6osBF h/eXAgWtLut73Jd7w/gqQwa+V3S9kHVB9hWCjJ0g+MGpPVWAnBK68t8UsK8IkWcVEIuZ faQoUjO8cT8sy1iFnwu5O9HRN9zYrXAXWfhCRQvbgSTrktYYKbumX1UCelit3lM/QMTB UoDAcvwofCa+H5dZg54Lepauy/mEjXCgQ3f1RiTZ8tnBfjydAhQCgfVmml5xssbyJjD5 99jQ== X-Gm-Message-State: AOPr4FWekAFNLJDPzOpcUpt3ZHGifo7zKcItTzoYumyLeZ3KN/8ExpMfCVvH1gKlWSeqp7GyQro= X-Received: by 10.112.43.225 with SMTP id z1mr1358159lbl.14.1463758344563; Fri, 20 May 2016 08:32:24 -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 tg1sm3348847lbb.7.2016.05.20.08.32.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 May 2016 08:32:23 -0700 (PDT) From: Christophe Milard To: maxim.uvarov@linaro.com, lng-odp@lists.linaro.org Date: Fri, 20 May 2016 18:30:39 +0200 Message-Id: <1463761851-37121-24-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463761851-37121-1-git-send-email-christophe.milard@linaro.org> References: <1463761851-37121-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv9 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; }