From patchwork Wed Aug 26 15:49:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 52738 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 9A0AC22E9E for ; Wed, 26 Aug 2015 15:54:01 +0000 (UTC) Received: by labd1 with SMTP id d1sf66958946lab.0 for ; Wed, 26 Aug 2015 08:54:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to: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=4esSHGoyXfQSSNOOEClz6Fh/rzew5L1GpLpEU+1fmgg=; b=aM7vV48JCEwmfV/Cx0mM58vYVApzV2aZPJ9zulbQwmOp+dNV5UuRaW8VCf/uZCWtvt dO6OttT0b9+4P68jSHKAYf36XCe4Lsdij2lF9oACKX7w7vGDeOw69BCDAUxxCDJll5WU y35iSt1yziWN5zXxwt3tjKUKkZ+tv5Z2vjSUcMsmT8z9k2/RrdRIfKZqxGg+t7Bd2Nx4 PJtCuzJOXis/K1UsCxcoY4JJo1MJQ9qRqHxL65cUp9OS5zms4oq1jd19jtkzebmpwXig MPM4YWo5Va5tk9BfbkNhxtS3OTymuKay6H94PKL8IRNb5HUHRtYUO4bNgUCZiNnlc3WU jUmg== X-Gm-Message-State: ALoCoQneN6/J3RKKf2sSlp20wE6uUE/5jeXo9iU1VzAo/S5JvQJyBkeTpot/IjLS+DL5gPh7MoxY X-Received: by 10.180.79.66 with SMTP id h2mr1095257wix.3.1440604440557; Wed, 26 Aug 2015 08:54:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.101 with SMTP id z5ls808301laz.65.gmail; Wed, 26 Aug 2015 08:54:00 -0700 (PDT) X-Received: by 10.112.201.36 with SMTP id jx4mr32120272lbc.9.1440604440371; Wed, 26 Aug 2015 08:54:00 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id wh4si19060070lbb.91.2015.08.26.08.54.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 08:54:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labia3 with SMTP id ia3so57907804lab.3 for ; Wed, 26 Aug 2015 08:54:00 -0700 (PDT) X-Received: by 10.112.146.135 with SMTP id tc7mr13376270lbb.35.1440604440073; Wed, 26 Aug 2015 08:54:00 -0700 (PDT) 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.162.200 with SMTP id yc8csp4011873lbb; Wed, 26 Aug 2015 08:53:58 -0700 (PDT) X-Received: by 10.50.111.133 with SMTP id ii5mr2173791igb.6.1440604438260; Wed, 26 Aug 2015 08:53:58 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a21si12419865ioa.153.2015.08.26.08.53.57; Wed, 26 Aug 2015 08:53:58 -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; Received: by lists.linaro.org (Postfix, from userid 109) id 3BE7F6207D; Wed, 26 Aug 2015 15:53:57 +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 44B4B6181B; Wed, 26 Aug 2015 15:50:21 +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 8E80B6208E; Wed, 26 Aug 2015 15:50:13 +0000 (UTC) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com [209.85.215.52]) by lists.linaro.org (Postfix) with ESMTPS id B83F262078 for ; Wed, 26 Aug 2015 15:49:20 +0000 (UTC) Received: by labia3 with SMTP id ia3so57810499lab.3 for ; Wed, 26 Aug 2015 08:49:19 -0700 (PDT) X-Received: by 10.152.36.7 with SMTP id m7mr30606943laj.87.1440604159672; Wed, 26 Aug 2015 08:49:19 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id w3sm6870916lag.13.2015.08.26.08.49.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Aug 2015 08:49:19 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 26 Aug 2015 18:49:07 +0300 Message-Id: <1440604147-24703-8-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440604147-24703-1-git-send-email-maxim.uvarov@linaro.org> References: <1440604147-24703-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv5 7/7] linux-generic: default state for pktio is STOP X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@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.52 as permitted sender) smtp.mailfrom=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 After open pktio remains stopped. Inside worker thread (after all configuration done it should be started.) In that patch I just start it everywhere to keep original logic and be easy for review. Putting it inside worker threads will require thread arguments change and understanding logic of current app. It's better to do further changes in separate patches per app. Signed-off-by: Maxim Uvarov --- example/classifier/odp_classifier.c | 5 +++++ example/generator/odp_generator.c | 4 ++++ example/ipsec/odp_ipsec.c | 6 ++++++ example/packet/odp_pktio.c | 4 ++++ platform/linux-generic/pktio/loop.c | 2 +- platform/linux-generic/pktio/socket.c | 2 +- platform/linux-generic/pktio/socket_mmap.c | 2 +- test/performance/odp_l2fwd.c | 6 ++++++ test/performance/odp_pktio_perf.c | 6 ++++++ test/validation/classification/odp_classification_tests.c | 7 +++++++ test/validation/pktio/pktio.c | 3 +++ 11 files changed, 44 insertions(+), 3 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index ac204af..685f335 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -463,6 +463,11 @@ int main(int argc, char *argv[]) /* configure default Cos and default queue */ configure_default_queue(pktio, args); + if (odp_pktio_start(pktio)) { + EXAMPLE_ERR("Error: unable to start pktio.\n"); + exit(EXIT_FAILURE); + } + /* Create and init worker threads */ memset(thread_tbl, 0, sizeof(thread_tbl)); diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index c1974dc..4710411 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -357,6 +357,10 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool) if (ret != 0) EXAMPLE_ABORT("Error: default input-Q setup for %s\n", dev); + ret = odp_pktio_start(pktio); + if (ret) + EXAMPLE_ABORT("Error: unable to start %s\n", dev); + printf(" created pktio:%02" PRIu64 ", dev:%s, queue mode (ATOMIC queues)\n" " default pktio%02" PRIu64 diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 85dbc00..96effe2 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -556,6 +556,12 @@ void initialize_intf(char *intf) exit(EXIT_FAILURE); } + ret = odp_pktio_start(pktio); + if (ret) { + EXAMPLE_ERR("Error: unable to start %s\n", intf); + exit(EXIT_FAILURE); + } + /* Read the source MAC address for this interface */ ret = odp_pktio_mac_addr(pktio, src_mac, sizeof(src_mac)); if (ret <= 0) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 835fb96..df53ea2 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -171,6 +171,10 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool, int mode) if (ret != 0) EXAMPLE_ABORT("Error: default input-Q setup for %s\n", dev); + ret = odp_pktio_start(pktio); + if (ret != 0) + EXAMPLE_ABORT("Error: unable to start %s\n", dev); + printf(" created pktio:%02" PRIu64 ", dev:%s, queue mode (ATOMIC queues)\n" " \tdefault pktio%02" PRIu64 "-INPUT queue:%" PRIu64 "\n", diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index f61ccd5..ef77e34 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -41,7 +41,7 @@ static int loopback_open(odp_pktio_t id, pktio_entry_t *pktio_entry, if (pktio_entry->s.pkt_loop.loopq == ODP_QUEUE_INVALID) return -1; - pktio_entry->s.state = STATE_START; + pktio_entry->s.state = STATE_STOP; return 0; } diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 43c5f67..6fcdb46 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -234,7 +234,7 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev, goto error; } - pktio_entry->s.state = STATE_START; + pktio_entry->s.state = STATE_STOP; return 0; error: diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 2e55672..3fd2b0f 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -486,7 +486,7 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, goto error; } - pktio_entry->s.state = STATE_START; + pktio_entry->s.state = STATE_STOP; return 0; error: diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index db26a58..ce4efa8 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -317,6 +317,12 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool, return ODP_PKTIO_INVALID; } + ret = odp_pktio_start(pktio); + if (ret != 0) { + LOG_ERR("Error: unable to start %s\n", dev); + return ODP_PKTIO_INVALID; + } + return pktio; } diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 1552579..709becf 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -777,6 +777,12 @@ static int test_init(void) if (odp_pktio_inq_setdef(gbl_args->pktio_rx, inq_def) != 0) return -1; + if (odp_pktio_start(gbl_args->pktio_tx) != 0) + return -1; + if (gbl_args->args.num_ifaces > 1 && + odp_pktio_start(gbl_args->pktio_rx)) + return -1; + return 0; } diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index c44ceb9..127683a 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -325,6 +325,13 @@ int classification_suite_init(void) queue_list[i] = ODP_QUEUE_INVALID; odp_atomic_init_u32(&seq, 0); + + ret = odp_pktio_start(pktio_loop); + if (ret) { + fprintf(stderr, "unable to start loop\n"); + return -1; + } + return 0; } diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index 874e28e..d7ddd16 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -470,6 +470,9 @@ static void test_txrx(odp_queue_type_t q_type, int num_pkts) io->inq = odp_pktio_inq_getdef(io->id); else io->inq = ODP_QUEUE_INVALID; + + ret = odp_pktio_start(io->id); + CU_ASSERT(ret == 0); } /* if we have two interfaces then send through one and receive on