From patchwork Tue Feb 21 22:41:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 94286 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp656839qgi; Tue, 21 Feb 2017 14:42:04 -0800 (PST) X-Received: by 10.36.225.13 with SMTP id n13mr11905028ith.114.1487716924064; Tue, 21 Feb 2017 14:42:04 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w126si10282601iow.122.2017.02.21.14.42.03; Tue, 21 Feb 2017 14:42:04 -0800 (PST) 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 sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8E29261063; Tue, 21 Feb 2017 22:42:03 +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 6D55260BDE; Tue, 21 Feb 2017 22:41:36 +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 7D73560BFD; Tue, 21 Feb 2017 22:41:32 +0000 (UTC) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) by lists.linaro.org (Postfix) with ESMTPS id 2752A60BDE for ; Tue, 21 Feb 2017 22:41:31 +0000 (UTC) Received: by mail-lf0-f46.google.com with SMTP id l12so34107672lfe.0 for ; Tue, 21 Feb 2017 14:41:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=v6HGj0PpI0EIcBO7SrQ+EIUrmzJe2qJa/D2D/DpH4Jc=; b=bJuWw3J2FNTBFoKc/Y6Mk/Y6EX3uhNtKHGolXvEcfRRu5w5M8ecYkhn67TDHC/16cT 4Gvcsdbp6mItd5AsiSh1Go+rnQcrUkOt+Lk0FAWSQU8uePQJLH2jpMQ1hnUuCqdOev9R MuCApcCxc4QE1/5t+ZPFhuh7pnygenLJOu4kSew8qxiYgm4rzn0HBN5yFtu5GsXsaucG P4HRrNxq2pI0xCWvH4Qd/S7AGlzRjQogJSSeA98k96gFDh0TJyJZo2dvbDUc8u7dENOK GK/m/Put1ZTFGqjoY2oDtxoofqcYAnQR2lWu6FNhBNOety2G3H2qKJkmxJRpdh3CzQq2 FS3w== X-Gm-Message-State: AMke39nRNjwl+YEkdcr4rYKqCjPn0wIn+51Ik2+ml2Z6vBWgoVKn5X74EyvI/JlUExd1vLKkDFk= X-Received: by 10.46.81.18 with SMTP id f18mr7423628ljb.136.1487716889724; Tue, 21 Feb 2017 14:41:29 -0800 (PST) Received: from forlindon.lumag.auriga.ru ([188.162.65.19]) by smtp.gmail.com with ESMTPSA id s20sm6537043lfe.41.2017.02.21.14.41.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Feb 2017 14:41:29 -0800 (PST) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Wed, 22 Feb 2017 01:41:25 +0300 Message-Id: <20170221224127.31314-2-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170221224127.31314-1-dmitry.ereminsolenikov@linaro.org> References: <20170221182325.14424-1-nikhil.agarwal@linaro.org> <20170221224127.31314-1-dmitry.ereminsolenikov@linaro.org> Subject: [lng-odp] [PATCH 2/4] example: ipsef_offload: port to odpthreads helpers 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Switch from old linux-pthread API to odpthread. Signed-off-by: Dmitry Eremin-Solenikov --- example/ipsec_offload/odp_ipsec_offload.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) -- 2.11.0 diff --git a/example/ipsec_offload/odp_ipsec_offload.c b/example/ipsec_offload/odp_ipsec_offload.c index 4a494d07..001e7038 100644 --- a/example/ipsec_offload/odp_ipsec_offload.c +++ b/example/ipsec_offload/odp_ipsec_offload.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -414,12 +415,12 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t pkt) * - Input interfaces (i.e. new work) * - Per packet ipsec API completion queue * - * @param arg Required by "odph_linux_pthread_create", unused + * @param arg Required by "odph_odpthreads_create", unused * - * @return NULL (should never return) + * @return 0 (should never return) */ static -void *pktio_thread(void *arg EXAMPLE_UNUSED) +int pktio_thread(void *arg EXAMPLE_UNUSED) { int thr; odp_packet_t pkt; @@ -490,7 +491,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) out_port = (odp_out_entry_t *)odp_packet_user_ptr(out_pkt); out_queue = (odp_pktout_queue_t)out_port->pktout; - eth = (odph_ethhdr_t *)((void *)ip - sizeof(odph_ethhdr_t)); + eth = (odph_ethhdr_t *)((uint8_t *)ip - sizeof(odph_ethhdr_t)); eth->dst = out_port->next_hop_addr; eth->src = out_port->addr; eth->type = odp_cpu_to_be_16(0x800); @@ -505,7 +506,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) } /* unreachable */ - return NULL; + return 0; } /** @@ -514,7 +515,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) int main(int argc, char *argv[]) { - odph_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_odpthread_t thread_tbl[MAX_WORKERS]; int i; odp_shm_t shm; odp_cpumask_t cpumask; @@ -522,7 +523,7 @@ main(int argc, char *argv[]) odp_pool_param_t params; odp_queue_param_t qparam; odp_instance_t instance; - odph_linux_thr_params_t thr_params; + odph_odpthread_params_t thr_params; odp_ipsec_config_t config; odp_ipsec_capability_t capa; @@ -642,9 +643,9 @@ main(int argc, char *argv[]) thr_params.instance = instance; /* Create and initialize worker threads */ - odph_linux_pthread_create(thread_tbl, &cpumask, + odph_odpthreads_create(thread_tbl, &cpumask, &thr_params); - odph_linux_pthread_join(thread_tbl, num_workers); + odph_odpthreads_join(thread_tbl); free(args->appl.if_names); free(args->appl.if_str);