From patchwork Wed May 20 09:31:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 48790 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8C2D2121F for ; Wed, 20 May 2015 09:31:52 +0000 (UTC) Received: by wivs14 with SMTP id s14sf17814490wiv.1 for ; Wed, 20 May 2015 02:31:52 -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: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=4BQwWsL+wAEti+L57HpWDqQMaPo55PLLzB2fPf2tw3A=; b=MKhK4yDIeb741w9g/Vnhx97v4apVaEkIz8iMtptLnXlRmUPvX6EG19vPQvWNi0Ze4s UXCVBMVBsfeg4zYxYSRV++UPYgMxqRp6luGwnEELu9oid1hr4Jikjwpvxyjw30IEiBmm DzXwF1pkBXvtv2j0iI4kfhma6d4LmBV8uT2b5UuTMVP6hO8pr5j9r29KnE62DDoal4rC rYHTBuTAFOUYXSc+Osf8iWm3EhiVuMdw2A9qtN/r4edQTYGaNqpjD9FqqQ1/zQlxLNJo lcyXvaWgC2YmemAko6jy/CHTqPqgg5lSX9M6GR2GIGBK8NloZT7JDn6Fwbf1f/y7y7DP sZrw== X-Gm-Message-State: ALoCoQkHbck3+pwc6zTynKqkJ6w+gyjLgfixr7JZhiJEWNDHUrcG1cIvIG/ZUN8asnp5fuVoV10Q X-Received: by 10.152.43.116 with SMTP id v20mr25711421lal.3.1432114312027; Wed, 20 May 2015 02:31:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.39 with SMTP id dd7ls172363lac.60.gmail; Wed, 20 May 2015 02:31:51 -0700 (PDT) X-Received: by 10.152.246.34 with SMTP id xt2mr21881600lac.110.1432114311802; Wed, 20 May 2015 02:31:51 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id az14si10807091lab.154.2015.05.20.02.31.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 02:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagr1 with SMTP id r1so64404467lag.0 for ; Wed, 20 May 2015 02:31:51 -0700 (PDT) X-Received: by 10.152.4.72 with SMTP id i8mr25823991lai.32.1432114311473; Wed, 20 May 2015 02:31:51 -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.108.230 with SMTP id hn6csp1396009lbb; Wed, 20 May 2015 02:31:50 -0700 (PDT) X-Received: by 10.55.40.132 with SMTP id o4mr69197758qko.61.1432114309932; Wed, 20 May 2015 02:31:49 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id r9si115358qca.13.2015.05.20.02.31.48; Wed, 20 May 2015 02:31:49 -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 CD2AB61EBA; Wed, 20 May 2015 09:31:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 04B7561E83; Wed, 20 May 2015 09:31:44 +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 EE05161E90; Wed, 20 May 2015 09:31:41 +0000 (UTC) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53]) by lists.linaro.org (Postfix) with ESMTPS id F1B9961EE2 for ; Wed, 20 May 2015 09:31:26 +0000 (UTC) Received: by lagr1 with SMTP id r1so64388819lag.0 for ; Wed, 20 May 2015 02:31:25 -0700 (PDT) X-Received: by 10.112.13.6 with SMTP id d6mr24698150lbc.117.1432114285370; Wed, 20 May 2015 02:31:25 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-163-142.pppoe.mtu-net.ru. [91.76.163.142]) by mx.google.com with ESMTPSA id tp10sm4458538lbb.4.2015.05.20.02.31.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 May 2015 02:31:24 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 20 May 2015 12:31:22 +0300 Message-Id: <1432114282-3568-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH] validation: pktio: do not destroy pool 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.43 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 Some platforms like DPDK and Cavium bare metal can not dynamically destroy and create pool with the same name. Keep pool destroy only in test suite termination to make all other pktio tests passed. Signed-off-by: Maxim Uvarov Reviewed-by: Stuart Haslam --- test/validation/odp_pktio.c | 66 ++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index d4bf7bf..7c1a666 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -56,6 +56,8 @@ odp_pool_t default_pkt_pool = ODP_POOL_INVALID; /** sequence number of IP packets */ odp_atomic_u32_t ip_seq; +odp_pool_t pool[MAX_NUM_IFACES] = {ODP_POOL_INVALID, ODP_POOL_INVALID}; + static void pktio_pkt_set_macs(odp_packet_t pkt, pktio_info_t *src, pktio_info_t *dst) { @@ -219,29 +221,11 @@ static int default_pool_create(void) return 0; } -static odp_pktio_t create_pktio(const char *iface) +static odp_pktio_t create_pktio(const char *iface, int num) { - odp_pool_t pool; odp_pktio_t pktio; - char pool_name[ODP_POOL_NAME_LEN]; - odp_pool_param_t params; - memset(¶ms, 0, sizeof(params)); - params.pkt.seg_len = PKT_BUF_SIZE; - params.pkt.len = PKT_BUF_SIZE; - params.pkt.num = PKT_BUF_NUM; - params.type = ODP_POOL_PACKET; - - snprintf(pool_name, sizeof(pool_name), "pkt_pool_%s", iface); - - pool = odp_pool_lookup(pool_name); - if (pool != ODP_POOL_INVALID) - CU_ASSERT(odp_pool_destroy(pool) == 0); - - pool = odp_pool_create(pool_name, ODP_SHM_NULL, ¶ms); - CU_ASSERT(pool != ODP_POOL_INVALID); - - pktio = odp_pktio_open(iface, pool); + pktio = odp_pktio_open(iface, pool[num]); if (pktio == ODP_PKTIO_INVALID) pktio = odp_pktio_lookup(iface); CU_ASSERT(pktio != ODP_PKTIO_INVALID); @@ -431,7 +415,7 @@ static void pktio_test_txrx(odp_queue_type_t q_type, int num_pkts) io = &pktios[i]; io->name = iface_name[i]; - io->id = create_pktio(iface_name[i]); + io->id = create_pktio(iface_name[i], i); if (io->id == ODP_PKTIO_INVALID) { CU_FAIL("failed to open iface"); return; @@ -487,7 +471,7 @@ static void test_odp_pktio_mtu(void) { int ret; int mtu; - odp_pktio_t pktio = create_pktio(iface_name[0]); + odp_pktio_t pktio = create_pktio(iface_name[0], 0); mtu = odp_pktio_mtu(pktio); CU_ASSERT(mtu > 0); @@ -503,7 +487,7 @@ static void test_odp_pktio_mtu(void) static void test_odp_pktio_promisc(void) { int ret; - odp_pktio_t pktio = create_pktio(iface_name[0]); + odp_pktio_t pktio = create_pktio(iface_name[0], 0); ret = odp_pktio_promisc_mode_set(pktio, 1); CU_ASSERT(0 == ret); @@ -530,7 +514,7 @@ static void test_odp_pktio_mac(void) unsigned char mac_addr[ODPH_ETHADDR_LEN]; int mac_len; int ret; - odp_pktio_t pktio = create_pktio(iface_name[0]); + odp_pktio_t pktio = create_pktio(iface_name[0], 0); printf("testing mac for %s\n", iface_name[0]); @@ -553,7 +537,7 @@ static void test_odp_pktio_mac(void) static void test_odp_pktio_inq_remdef(void) { - odp_pktio_t pktio = create_pktio(iface_name[0]); + odp_pktio_t pktio = create_pktio(iface_name[0], 0); odp_queue_t inq; odp_event_t ev; int i; @@ -582,7 +566,7 @@ static void test_odp_pktio_open(void) /* test the sequence open->close->open->close() */ for (i = 0; i < 2; ++i) { - pktio = create_pktio(iface_name[0]); + pktio = create_pktio(iface_name[0], 0); CU_ASSERT(pktio != ODP_PKTIO_INVALID); CU_ASSERT(odp_pktio_close(pktio) == 0); } @@ -613,7 +597,7 @@ static void test_odp_pktio_inq(void) { odp_pktio_t pktio; - pktio = create_pktio(iface_name[0]); + pktio = create_pktio(iface_name[0], 0); CU_ASSERT(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0); @@ -621,12 +605,35 @@ static void test_odp_pktio_inq(void) CU_ASSERT(odp_pktio_close(pktio) == 0); } +static int create_pool(const char *iface, int num) +{ + char pool_name[ODP_POOL_NAME_LEN]; + odp_pool_param_t params; + + memset(¶ms, 0, sizeof(params)); + params.pkt.seg_len = PKT_BUF_SIZE; + params.pkt.len = PKT_BUF_SIZE; + params.pkt.num = PKT_BUF_NUM; + params.type = ODP_POOL_PACKET; + + snprintf(pool_name, sizeof(pool_name), "pkt_pool_%s", iface); + + pool[num] = odp_pool_create(pool_name, ODP_SHM_NULL, ¶ms); + if (ODP_POOL_INVALID == pool[num]) { + CU_FAIL("unable to create pool"); + return -1; + } + + return 0; +} + static int init_pktio_suite(void) { odp_atomic_init_u32(&ip_seq, 0); iface_name[0] = getenv("ODP_PKTIO_IF0"); iface_name[1] = getenv("ODP_PKTIO_IF1"); num_ifaces = 1; + int i; if (!iface_name[0]) { printf("No interfaces specified, using default \"loop\".\n"); @@ -639,6 +646,11 @@ static int init_pktio_suite(void) iface_name[0], iface_name[1]); } + for (i = 0; i < num_ifaces; i++) { + if (create_pool(iface_name[i], i) != 0) + return -1; + } + if (default_pool_create() != 0) { fprintf(stderr, "error: failed to create default pool\n"); return -1;