From patchwork Fri Jan 27 14:29:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 92664 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp232373obz; Fri, 27 Jan 2017 06:38:56 -0800 (PST) X-Received: by 10.55.209.203 with SMTP id o72mr8284514qkl.281.1485527936896; Fri, 27 Jan 2017 06:38:56 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f9si3647640qki.259.2017.01.27.06.38.56; Fri, 27 Jan 2017 06:38:56 -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 817C9609D2; Fri, 27 Jan 2017 14:38:56 +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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 D9C7C60DC1; Fri, 27 Jan 2017 14:31:48 +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 9A3D9609AD; Fri, 27 Jan 2017 14:31:37 +0000 (UTC) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by lists.linaro.org (Postfix) with ESMTPS id BE455609AD for ; Fri, 27 Jan 2017 14:30:00 +0000 (UTC) Received: by mail-lf0-f51.google.com with SMTP id n124so162428582lfd.2 for ; Fri, 27 Jan 2017 06:30:00 -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:cc:subject:date:message-id:in-reply-to :references; bh=ZOS0k9BL0yaSGthu54ZkbL/KcaQdaiTOm39ed19atz8=; b=IN8Odjn6Ah2lcD5EDm2cshNYnIrf3GpxEGqtE37ZISzO0boc6Fw1zftDg7biN9sk0X YPGAQQj8b7j+PpnxN55y3PeQtaQmsXZdGm6H0ntnab0CAdySkAl0BfoEUOVfFMjNdkad SOOK/SrOTmYgXAhrFD4f0VE6Yjlks33SIhfe/ckLgWKuzlBTUqZxymxnxYazBtdYVnT5 F8BGf1415F6boPYnoy5n6mfxIzW1NNyd76gRYNuaYonsDujnVU9qrysoKSoKex5TQBS+ c4cHHJ9ENufk0ViUPSemeyD+CEOQEEtxr9JkPWXqLifvv+RzUPmCd+Be7Uj6APLJoLxh wkTg== X-Gm-Message-State: AIkVDXKmk0Qd4f0erg+FHdPHF0lwhb/kMe3ZyVh+vtx9+8K9EPRMk6+1C6+AL60x9T+JsT7/HsE= X-Received: by 10.25.27.147 with SMTP id b141mr2962107lfb.183.1485527399187; Fri, 27 Jan 2017 06:29:59 -0800 (PST) Received: from localhost.localdomain (ppp109-252-7-40.pppoe.spdop.ru. [109.252.7.40]) by smtp.gmail.com with ESMTPSA id t9sm1325479lja.48.2017.01.27.06.29.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Jan 2017 06:29:58 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 27 Jan 2017 17:29:20 +0300 Message-Id: <20170127142921.29029-15-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.11.0.295.gd7dffce In-Reply-To: <20170127142921.29029-1-maxim.uvarov@linaro.org> References: <20170127142921.29029-1-maxim.uvarov@linaro.org> Subject: [lng-odp] [API-NEXT PATCH 14/15] merge fix: test/common_plat/validation/api/packet/packet.c 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" Signed-off-by: Maxim Uvarov --- test/common_plat/validation/api/packet/packet.c | 483 ------------------------ 1 file changed, 483 deletions(-) -- 2.11.0.295.gd7dffce diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c index f62227ab..41a4c878 100644 --- a/test/common_plat/validation/api/packet/packet.c +++ b/test/common_plat/validation/api/packet/packet.c @@ -1342,7 +1342,6 @@ void packet_test_concatsplit(void) CU_ASSERT(odp_packet_len(pkt) == odp_packet_len(segmented_test_packet)); packet_compare_data(pkt, segmented_test_packet); -<<<<<<< HEAD odp_packet_free(pkt); } @@ -1498,8 +1497,6 @@ void packet_test_concat_extend_trunc(void) CU_ASSERT(odp_packet_len(pkt) == (cur_len - trunc_len)); cur_len = odp_packet_len(pkt); CU_ASSERT(cur_len == odp_packet_unshared_len(pkt)); -======= ->>>>>>> v1.13.0.0 odp_packet_free(pkt); @@ -1917,483 +1914,6 @@ void packet_test_extend_ref(void) odp_packet_free(max_pkt); } -void packet_test_concat_small(void) -{ - odp_pool_capability_t capa; - odp_pool_t pool; - odp_pool_param_t param; - odp_packet_t pkt, pkt2; - int ret; - uint8_t *data; - uint32_t i; - uint32_t len = 32000; - uint8_t buf[len]; - - CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0); - - if (capa.pkt.max_len && capa.pkt.max_len < len) - len = capa.pkt.max_len; - - odp_pool_param_init(¶m); - - param.type = ODP_POOL_PACKET; - param.pkt.len = len; - param.pkt.num = 100; - - pool = odp_pool_create("packet_pool_concat", ¶m); - CU_ASSERT(packet_pool != ODP_POOL_INVALID); - - pkt = odp_packet_alloc(pool, 1); - CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); - - data = odp_packet_data(pkt); - *data = 0; - - for (i = 0; i < len - 1; i++) { - pkt2 = odp_packet_alloc(pool, 1); - CU_ASSERT_FATAL(pkt2 != ODP_PACKET_INVALID); - - data = odp_packet_data(pkt2); - *data = i + 1; - - ret = odp_packet_concat(&pkt, pkt2); - CU_ASSERT(ret >= 0); - - if (ret < 0) { - odp_packet_free(pkt2); - break; - } - } - - CU_ASSERT(odp_packet_len(pkt) == len); - - len = odp_packet_len(pkt); - - memset(buf, 0, len); - CU_ASSERT(odp_packet_copy_to_mem(pkt, 0, len, buf) == 0); - - for (i = 0; i < len; i++) - CU_ASSERT(buf[i] == (i % 256)); - - odp_packet_free(pkt); - - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - -void packet_test_concat_extend_trunc(void) -{ - odp_pool_capability_t capa; - odp_pool_t pool; - odp_pool_param_t param; - odp_packet_t pkt, pkt2; - int i, ret; - uint32_t alloc_len, ext_len, trunc_len, cur_len; - uint32_t len = 1900; - - CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0); - - if (capa.pkt.max_len && capa.pkt.max_len < len) - len = capa.pkt.max_len; - - alloc_len = len / 8; - ext_len = len / 4; - trunc_len = len / 3; - - odp_pool_param_init(¶m); - - param.type = ODP_POOL_PACKET; - param.pkt.len = len; - param.pkt.num = 100; - - pool = odp_pool_create("packet_pool_concat", ¶m); - CU_ASSERT(packet_pool != ODP_POOL_INVALID); - - pkt = odp_packet_alloc(pool, alloc_len); - CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); - - cur_len = odp_packet_len(pkt); - - for (i = 0; i < 2; i++) { - pkt2 = odp_packet_alloc(pool, alloc_len); - CU_ASSERT_FATAL(pkt2 != ODP_PACKET_INVALID); - - ret = odp_packet_concat(&pkt, pkt2); - CU_ASSERT(ret >= 0); - - if (ret < 0) - odp_packet_free(pkt2); - - CU_ASSERT(odp_packet_len(pkt) == (cur_len + alloc_len)); - cur_len = odp_packet_len(pkt); - } - - ret = odp_packet_extend_tail(&pkt, ext_len, NULL, NULL); - CU_ASSERT(ret >= 0); - - CU_ASSERT(odp_packet_len(pkt) == (cur_len + ext_len)); - cur_len = odp_packet_len(pkt); - - ret = odp_packet_extend_head(&pkt, ext_len, NULL, NULL); - CU_ASSERT(ret >= 0); - - CU_ASSERT(odp_packet_len(pkt) == (cur_len + ext_len)); - cur_len = odp_packet_len(pkt); - - pkt2 = odp_packet_alloc(pool, alloc_len); - CU_ASSERT_FATAL(pkt2 != ODP_PACKET_INVALID); - - ret = odp_packet_concat(&pkt, pkt2); - CU_ASSERT(ret >= 0); - - if (ret < 0) - odp_packet_free(pkt2); - - CU_ASSERT(odp_packet_len(pkt) == (cur_len + alloc_len)); - cur_len = odp_packet_len(pkt); - - ret = odp_packet_trunc_head(&pkt, trunc_len, NULL, NULL); - CU_ASSERT(ret >= 0); - - CU_ASSERT(odp_packet_len(pkt) == (cur_len - trunc_len)); - cur_len = odp_packet_len(pkt); - - ret = odp_packet_trunc_tail(&pkt, trunc_len, NULL, NULL); - CU_ASSERT(ret >= 0); - - CU_ASSERT(odp_packet_len(pkt) == (cur_len - trunc_len)); - cur_len = odp_packet_len(pkt); - - odp_packet_free(pkt); - - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - -void packet_test_extend_small(void) -{ - odp_pool_capability_t capa; - odp_pool_t pool; - odp_pool_param_t param; - odp_packet_t pkt; - int ret, round; - uint8_t *data; - uint32_t i, seg_len; - int tail = 1; - uint32_t len = 32000; - uint8_t buf[len]; - - CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0); - - if (capa.pkt.max_len && capa.pkt.max_len < len) - len = capa.pkt.max_len; - - odp_pool_param_init(¶m); - - param.type = ODP_POOL_PACKET; - param.pkt.len = len; - param.pkt.num = 100; - - pool = odp_pool_create("packet_pool_extend", ¶m); - CU_ASSERT(packet_pool != ODP_POOL_INVALID); - - for (round = 0; round < 2; round++) { - pkt = odp_packet_alloc(pool, 1); - CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); - - data = odp_packet_data(pkt); - *data = 0; - - for (i = 0; i < len - 1; i++) { - if (tail) { - ret = odp_packet_extend_tail(&pkt, 1, - (void **)&data, - &seg_len); - CU_ASSERT(ret >= 0); - } else { - ret = odp_packet_extend_head(&pkt, 1, - (void **)&data, - &seg_len); - CU_ASSERT(ret >= 0); - } - - if (ret < 0) - break; - - if (tail) { - /* assert needs brackets */ - CU_ASSERT(seg_len == 1); - } else { - CU_ASSERT(seg_len > 0); - } - - *data = i + 1; - } - - CU_ASSERT(odp_packet_len(pkt) == len); - - len = odp_packet_len(pkt); - - memset(buf, 0, len); - CU_ASSERT(odp_packet_copy_to_mem(pkt, 0, len, buf) == 0); - - for (i = 0; i < len; i++) { - int match; - - if (tail) { - match = (buf[i] == (i % 256)); - CU_ASSERT(match); - } else { - match = (buf[len - 1 - i] == (i % 256)); - CU_ASSERT(match); - } - - /* Limit the number of failed asserts to - one per packet */ - if (!match) - break; - } - - odp_packet_free(pkt); - - tail = 0; - } - - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - -void packet_test_extend_large(void) -{ - odp_pool_capability_t capa; - odp_pool_t pool; - odp_pool_param_t param; - odp_packet_t pkt; - int ret, round; - uint8_t *data; - uint32_t i, seg_len, ext_len, cur_len, cur_data; - int tail = 1; - int num_div = 16; - int div = 1; - uint32_t len = 32000; - uint8_t buf[len]; - - CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0); - - if (capa.pkt.max_len && capa.pkt.max_len < len) - len = capa.pkt.max_len; - - odp_pool_param_init(¶m); - - param.type = ODP_POOL_PACKET; - param.pkt.len = len; - param.pkt.num = 100; - - pool = odp_pool_create("packet_pool_extend", ¶m); - CU_ASSERT(packet_pool != ODP_POOL_INVALID); - - for (round = 0; round < 2 * num_div; round++) { - ext_len = len / div; - cur_len = ext_len; - - pkt = odp_packet_alloc(pool, ext_len); - CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); - - cur_data = 0; - - if (tail) { - ret = fill_data_forward(pkt, 0, ext_len, &cur_data); - CU_ASSERT(ret == 0); - } else { - ret = fill_data_backward(pkt, 0, ext_len, &cur_data); - CU_ASSERT(ret == 0); - } - - while (cur_len < len) { - if ((len - cur_len) < ext_len) - ext_len = len - cur_len; - - if (tail) { - ret = odp_packet_extend_tail(&pkt, ext_len, - (void **)&data, - &seg_len); - CU_ASSERT(ret >= 0); - } else { - ret = odp_packet_extend_head(&pkt, ext_len, - (void **)&data, - &seg_len); - CU_ASSERT(ret >= 0); - } - - if (ret < 0) - break; - - if (tail) { - /* assert needs brackets */ - CU_ASSERT((seg_len > 0) && - (seg_len <= ext_len)); - ret = fill_data_forward(pkt, cur_len, ext_len, - &cur_data); - CU_ASSERT(ret == 0); - } else { - CU_ASSERT(seg_len > 0); - CU_ASSERT(data == odp_packet_data(pkt)); - ret = fill_data_backward(pkt, 0, ext_len, - &cur_data); - CU_ASSERT(ret == 0); - } - - cur_len += ext_len; - } - - CU_ASSERT(odp_packet_len(pkt) == len); - - len = odp_packet_len(pkt); - - memset(buf, 0, len); - CU_ASSERT(odp_packet_copy_to_mem(pkt, 0, len, buf) == 0); - - for (i = 0; i < len; i++) { - int match; - - if (tail) { - match = (buf[i] == (i % 256)); - CU_ASSERT(match); - } else { - match = (buf[len - 1 - i] == (i % 256)); - CU_ASSERT(match); - } - - /* Limit the number of failed asserts to - one per packet */ - if (!match) - break; - } - - odp_packet_free(pkt); - - div++; - if (div > num_div) { - /* test extend head */ - div = 1; - tail = 0; - } - } - - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - -void packet_test_extend_mix(void) -{ - odp_pool_capability_t capa; - odp_pool_t pool; - odp_pool_param_t param; - odp_packet_t pkt; - int ret, round; - uint8_t *data; - uint32_t i, seg_len, ext_len, cur_len, cur_data; - int small_count; - int tail = 1; - uint32_t len = 32000; - uint8_t buf[len]; - - CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0); - - if (capa.pkt.max_len && capa.pkt.max_len < len) - len = capa.pkt.max_len; - - odp_pool_param_init(¶m); - - param.type = ODP_POOL_PACKET; - param.pkt.len = len; - param.pkt.num = 100; - - pool = odp_pool_create("packet_pool_extend", ¶m); - CU_ASSERT(packet_pool != ODP_POOL_INVALID); - - for (round = 0; round < 2; round++) { - small_count = 30; - ext_len = len / 10; - cur_len = ext_len; - - pkt = odp_packet_alloc(pool, ext_len); - CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); - - cur_data = 0; - - if (tail) { - ret = fill_data_forward(pkt, 0, ext_len, &cur_data); - CU_ASSERT(ret == 0); - } else { - ret = fill_data_backward(pkt, 0, ext_len, &cur_data); - CU_ASSERT(ret == 0); - } - - while (cur_len < len) { - if (small_count) { - small_count--; - ext_len = len / 100; - } else { - ext_len = len / 4; - } - - if ((len - cur_len) < ext_len) - ext_len = len - cur_len; - - if (tail) { - ret = odp_packet_extend_tail(&pkt, ext_len, - (void **)&data, - &seg_len); - CU_ASSERT(ret >= 0); - CU_ASSERT((seg_len > 0) && - (seg_len <= ext_len)); - ret = fill_data_forward(pkt, cur_len, ext_len, - &cur_data); - CU_ASSERT(ret == 0); - } else { - ret = odp_packet_extend_head(&pkt, ext_len, - (void **)&data, - &seg_len); - CU_ASSERT(ret >= 0); - CU_ASSERT(seg_len > 0); - CU_ASSERT(data == odp_packet_data(pkt)); - ret = fill_data_backward(pkt, 0, ext_len, - &cur_data); - CU_ASSERT(ret == 0); - } - - cur_len += ext_len; - } - - CU_ASSERT(odp_packet_len(pkt) == len); - - len = odp_packet_len(pkt); - - memset(buf, 0, len); - CU_ASSERT(odp_packet_copy_to_mem(pkt, 0, len, buf) == 0); - - for (i = 0; i < len; i++) { - int match; - - if (tail) { - match = (buf[i] == (i % 256)); - CU_ASSERT(match); - } else { - match = (buf[len - 1 - i] == (i % 256)); - CU_ASSERT(match); - } - - /* Limit the number of failed asserts to - one per packet */ - if (!match) - break; - } - - odp_packet_free(pkt); - - tail = 0; - } - - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - void packet_test_align(void) { odp_packet_t pkt; @@ -2790,10 +2310,7 @@ odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_extend_small), ODP_TEST_INFO(packet_test_extend_large), ODP_TEST_INFO(packet_test_extend_mix), -<<<<<<< HEAD ODP_TEST_INFO(packet_test_extend_ref), -======= ->>>>>>> v1.13.0.0 ODP_TEST_INFO(packet_test_align), ODP_TEST_INFO(packet_test_offset), ODP_TEST_INFO(packet_test_ref),