From patchwork Tue May 17 13:04:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 67970 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2080765qge; Tue, 17 May 2016 06:37:14 -0700 (PDT) X-Received: by 10.55.143.129 with SMTP id r123mr1504358qkd.170.1463492234003; Tue, 17 May 2016 06:37:14 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b100si2266968qkb.62.2016.05.17.06.37.00; Tue, 17 May 2016 06:37:13 -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 A793261790; Tue, 17 May 2016 13:37: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 3285D6183C; Tue, 17 May 2016 13:16:19 +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 DDEE46179F; Tue, 17 May 2016 13:15:35 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by lists.linaro.org (Postfix) with ESMTPS id 244AC617A4 for ; Tue, 17 May 2016 13:05:31 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id u64so6524929lff.3 for ; Tue, 17 May 2016 06:05:31 -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=Bo8zGyafmc10LGJDUibS0WRzqD4uoUvlVQkgQ87b7jfPjjLY5xO0tPs09Nm3J791/d +BPySvlm92PGzgoE8qRRYeHqvr9qPmpNzCv90iPSgWs4YBfoz1GPg+tSTy5jUvldozWc Gq+DgDrMiuV9TloEmpmNqnMsM8wWse5syH97vpMerhVWnKzHULhNvpGQoTNNckb/iie5 l+tTaLmh1SS/oEVCX0hiaefAVoTqHtkJzkysg3+xd1U9X3M5piDtrbb2yY7Kj20WEoQr YGck/hE89T+yXpdfpg5AtxCuHRvfQFSfT9BwQK+GIG5nA0FYA0jEUp4++NbRWTM7HGOe zv6g== X-Gm-Message-State: AOPr4FWUt4eLPebh4s6NqD1/6HQ5Qn6/Gli8/QDOAJnuwXb5R6t+PZXdq2Uou8LWf6Il1dTyU/0= X-Received: by 10.25.21.68 with SMTP id l65mr451306lfi.44.1463490330099; Tue, 17 May 2016 06:05:30 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 May 2016 06:05:29 -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:30 +0200 Message-Id: <1463490282-23277-24-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 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; }