From patchwork Mon Nov 24 22:38:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 41440 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 876C125E18 for ; Mon, 24 Nov 2014 22:39:42 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf6222039eek.11 for ; Mon, 24 Nov 2014 14:39:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=IDGkZq7nWQeAx6Q0VgL9YOX6MZz0gm71MCg9eLkDhGs=; b=aJqVO+hTzqnxFNQzWM0gWphId2w6ABbnb07s034Ubiitbshuo/bDsaNCfFJj+wZCdT AyZq5hr4qlaJ08ESOpnkf+m2MPKj7XXyznsG4CZK/2SOKAYXaWpflpuE01rxoho0NnpL 1kV+k/JTQRExpZ+v5re0fz953hx08S/01wLakZTdy++78bkF/EURR5Xz2uIm2Z2baAa2 ZgKn5ZrHGAWlCKQX/hZZ5tQ3mv+HQ7Z7txrU8lTe3I3e80982eUXOBTI7oKqNdGsHrJe 8qs5GbfGQgsLWLFKGw3Bwu4PEhJSmjt8+xmVdDjXRD++ECExm0RbcATCwei+wvai/W/n M1EA== X-Gm-Message-State: ALoCoQmYWanUxVQKhUOU0W63seWQXjM4l1r1+/AcQTNtxw31xrTvW9knRzZ/TJVk/HrdIiiNqQxx X-Received: by 10.152.6.4 with SMTP id w4mr35468law.7.1416868781814; Mon, 24 Nov 2014 14:39:41 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.99 with SMTP id bf3ls497170lab.13.gmail; Mon, 24 Nov 2014 14:39:41 -0800 (PST) X-Received: by 10.112.130.10 with SMTP id oa10mr22899798lbb.12.1416868781676; Mon, 24 Nov 2014 14:39:41 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id v7si6096651lal.125.2014.11.24.14.39.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Nov 2014 14:39:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id gf13so8520685lab.27 for ; Mon, 24 Nov 2014 14:39:41 -0800 (PST) X-Received: by 10.152.8.170 with SMTP id s10mr22875300laa.56.1416868781591; Mon, 24 Nov 2014 14:39:41 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp348193lbc; Mon, 24 Nov 2014 14:39:40 -0800 (PST) X-Received: by 10.52.22.9 with SMTP id z9mr11377630vde.87.1416868780397; Mon, 24 Nov 2014 14:39:40 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id cq10si6960623vdc.7.2014.11.24.14.39.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Nov 2014 14:39:40 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xt2IE-0007qs-2J; Mon, 24 Nov 2014 22:39:38 +0000 Received: from mail-lb0-f176.google.com ([209.85.217.176]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xt2Hk-0007m2-FP for lng-odp@lists.linaro.org; Mon, 24 Nov 2014 22:39:08 +0000 Received: by mail-lb0-f176.google.com with SMTP id p9so7390000lbv.35 for ; Mon, 24 Nov 2014 14:39:03 -0800 (PST) X-Received: by 10.152.88.69 with SMTP id be5mr23106494lab.36.1416868742833; Mon, 24 Nov 2014 14:39:02 -0800 (PST) Received: from macmini.lan (84-217-193-77.tn.glocalnet.net. [84.217.193.77]) by mx.google.com with ESMTPSA id pr9sm2952957lbc.12.2014.11.24.14.39.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Nov 2014 14:39:02 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Mon, 24 Nov 2014 23:38:46 +0100 Message-Id: <1416868730-26140-6-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416868730-26140-1-git-send-email-ola.liljedahl@linaro.org> References: <1416868730-26140-1-git-send-email-ola.liljedahl@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v3 5/9] linux-generic: odp_generator.c use odp_atomic.h X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ola.liljedahl@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Ola Liljedahl --- Updated to use odp_atomic.h functions with atomic types. example/generator/odp_generator.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index e2e0ba4..7d1c237 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -338,11 +338,14 @@ static void *gen_send_thread(void *arg) if (args->appl.interval != 0) { printf(" [%02i] send pkt no:%ju seq %ju\n", - thr, counters.seq, counters.seq%0xffff); + thr, + odp_atomic_load_u64(&counters.seq), + odp_atomic_load_u64(&counters.seq)%0xffff); /* TODO use odp timer */ usleep(args->appl.interval * 1000); } - if (args->appl.number != -1 && counters.seq + if (args->appl.number != -1 && + odp_atomic_load_u64(&counters.seq) >= (unsigned int)args->appl.number) { break; } @@ -351,7 +354,8 @@ static void *gen_send_thread(void *arg) /* receive number of reply pks until timeout */ if (args->appl.mode == APPL_MODE_PING && args->appl.number > 0) { while (args->appl.timeout >= 0) { - if (counters.icmp >= (unsigned int)args->appl.number) + if (odp_atomic_load_u64(&counters.icmp) >= + (unsigned int)args->appl.number) break; /* TODO use odp timer */ sleep(1); @@ -361,10 +365,12 @@ static void *gen_send_thread(void *arg) /* print info */ if (args->appl.mode == APPL_MODE_UDP) { - printf(" [%02i] total send: %ju\n", thr, counters.seq); + printf(" [%02i] total send: %ju\n", + thr, odp_atomic_load_u64(&counters.seq)); } else if (args->appl.mode == APPL_MODE_PING) { printf(" [%02i] total send: %ju total receive: %ju\n", - thr, counters.seq, counters.icmp); + thr, odp_atomic_load_u64(&counters.seq), + odp_atomic_load_u64(&counters.icmp)); } return arg; }