From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C9761A0561; Mon, 20 Apr 2020 14:13:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C451D1D5BA; Mon, 20 Apr 2020 14:12:12 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5A3601D5AF for ; Mon, 20 Apr 2020 14:12:06 +0200 (CEST) IronPort-SDR: dS85Dg9XICHmZJLq6q1LV79y0BRNG3xweDd9nIiBGbfrOaReqFzBVcTDilXh9xFcMNm/DKzP6r +t2nGOM/OPVA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2020 05:12:05 -0700 IronPort-SDR: MbmwZttsirEPF5QO6e/BiWsqS1I85WH0ttQvsoNMsmO6uIpZnmKy8EvYU4O8/qWpXpLycGUs2T t/+WoYYo/i1A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,406,1580803200"; d="scan'208";a="401810640" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by orsmga004.jf.intel.com with ESMTP; 20 Apr 2020 05:12:03 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, jielong.zjl@antfin.com, Konstantin Ananyev Date: Mon, 20 Apr 2020 13:11:12 +0100 Message-Id: <20200420121113.9327-10-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200420121113.9327-1-konstantin.ananyev@intel.com> References: <20200418163225.17635-1-konstantin.ananyev@intel.com> <20200420121113.9327-1-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCH v6 09/10] test/ring: add functional tests for new sync modes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Extend test_ring_autotest with new test-cases for RTS/HTS sync modes. Signed-off-by: Konstantin Ananyev Acked-by: Honnappa Nagarahalli --- app/test/test_ring.c | 93 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 20 deletions(-) diff --git a/app/test/test_ring.c b/app/test/test_ring.c index fbcd109b1..e21557cd9 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -203,7 +203,8 @@ test_ring_negative_tests(void) * Random number of elements are enqueued and dequeued. */ static int -test_ring_burst_bulk_tests1(unsigned int api_type) +test_ring_burst_bulk_tests1(unsigned int api_type, unsigned int create_flags, + const char *tname) { struct rte_ring *r; void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL; @@ -213,12 +214,11 @@ test_ring_burst_bulk_tests1(unsigned int api_type) const unsigned int rsz = RING_SIZE - 1; for (i = 0; i < RTE_DIM(esize); i++) { - test_ring_print_test_string("Test standard ring", api_type, - esize[i]); + test_ring_print_test_string(tname, api_type, esize[i]); /* Create the ring */ r = test_ring_create("test_ring_burst_bulk_tests", esize[i], - RING_SIZE, SOCKET_ID_ANY, 0); + RING_SIZE, SOCKET_ID_ANY, create_flags); /* alloc dummy object pointers */ src = test_ring_calloc(RING_SIZE * 2, esize[i]); @@ -294,7 +294,8 @@ test_ring_burst_bulk_tests1(unsigned int api_type) * dequeued data. */ static int -test_ring_burst_bulk_tests2(unsigned int api_type) +test_ring_burst_bulk_tests2(unsigned int api_type, unsigned int create_flags, + const char *tname) { struct rte_ring *r; void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL; @@ -302,12 +303,11 @@ test_ring_burst_bulk_tests2(unsigned int api_type) unsigned int i; for (i = 0; i < RTE_DIM(esize); i++) { - test_ring_print_test_string("Test standard ring", api_type, - esize[i]); + test_ring_print_test_string(tname, api_type, esize[i]); /* Create the ring */ r = test_ring_create("test_ring_burst_bulk_tests", esize[i], - RING_SIZE, SOCKET_ID_ANY, 0); + RING_SIZE, SOCKET_ID_ANY, create_flags); /* alloc dummy object pointers */ src = test_ring_calloc(RING_SIZE * 2, esize[i]); @@ -390,7 +390,8 @@ test_ring_burst_bulk_tests2(unsigned int api_type) * Enqueue and dequeue to cover the entire ring length. */ static int -test_ring_burst_bulk_tests3(unsigned int api_type) +test_ring_burst_bulk_tests3(unsigned int api_type, unsigned int create_flags, + const char *tname) { struct rte_ring *r; void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL; @@ -398,12 +399,11 @@ test_ring_burst_bulk_tests3(unsigned int api_type) unsigned int i, j; for (i = 0; i < RTE_DIM(esize); i++) { - test_ring_print_test_string("Test standard ring", api_type, - esize[i]); + test_ring_print_test_string(tname, api_type, esize[i]); /* Create the ring */ r = test_ring_create("test_ring_burst_bulk_tests", esize[i], - RING_SIZE, SOCKET_ID_ANY, 0); + RING_SIZE, SOCKET_ID_ANY, create_flags); /* alloc dummy object pointers */ src = test_ring_calloc(RING_SIZE * 2, esize[i]); @@ -465,7 +465,8 @@ test_ring_burst_bulk_tests3(unsigned int api_type) * Enqueue till the ring is full and dequeue till the ring becomes empty. */ static int -test_ring_burst_bulk_tests4(unsigned int api_type) +test_ring_burst_bulk_tests4(unsigned int api_type, unsigned int create_flags, + const char *tname) { struct rte_ring *r; void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL; @@ -474,12 +475,11 @@ test_ring_burst_bulk_tests4(unsigned int api_type) unsigned int num_elems; for (i = 0; i < RTE_DIM(esize); i++) { - test_ring_print_test_string("Test standard ring", api_type, - esize[i]); + test_ring_print_test_string(tname, api_type, esize[i]); /* Create the ring */ r = test_ring_create("test_ring_burst_bulk_tests", esize[i], - RING_SIZE, SOCKET_ID_ANY, 0); + RING_SIZE, SOCKET_ID_ANY, create_flags); /* alloc dummy object pointers */ src = test_ring_calloc(RING_SIZE * 2, esize[i]); @@ -815,7 +815,23 @@ test_ring_with_exact_size(void) static int test_ring(void) { + int32_t rc; unsigned int i, j; + const char *tname; + + static const struct { + uint32_t create_flags; + const char *name; + } test_sync_modes[] = { + { + RING_F_MP_RTS_ENQ | RING_F_MC_RTS_DEQ, + "Test MT_RTS ring", + }, + { + RING_F_MP_HTS_ENQ | RING_F_MC_HTS_DEQ, + "Test MT_HTS ring", + }, + }; /* Negative test cases */ if (test_ring_negative_tests() < 0) @@ -832,30 +848,67 @@ test_ring(void) * The test cases are split into smaller test cases to * help clang compile faster. */ + tname = "Test standard ring"; + for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1) for (i = TEST_RING_THREAD_DEF; i <= TEST_RING_THREAD_MPMC; i <<= 1) - if (test_ring_burst_bulk_tests1(i | j) < 0) + if (test_ring_burst_bulk_tests1(i | j, 0, tname) < 0) goto test_fail; for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1) for (i = TEST_RING_THREAD_DEF; i <= TEST_RING_THREAD_MPMC; i <<= 1) - if (test_ring_burst_bulk_tests2(i | j) < 0) + if (test_ring_burst_bulk_tests2(i | j, 0, tname) < 0) goto test_fail; for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1) for (i = TEST_RING_THREAD_DEF; i <= TEST_RING_THREAD_MPMC; i <<= 1) - if (test_ring_burst_bulk_tests3(i | j) < 0) + if (test_ring_burst_bulk_tests3(i | j, 0, tname) < 0) goto test_fail; for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1) for (i = TEST_RING_THREAD_DEF; i <= TEST_RING_THREAD_MPMC; i <<= 1) - if (test_ring_burst_bulk_tests4(i | j) < 0) + if (test_ring_burst_bulk_tests4(i | j, 0, tname) < 0) + goto test_fail; + + /* Burst and bulk operations with MT_RTS and MT_HTS sync modes */ + for (i = 0; i != RTE_DIM(test_sync_modes); i++) { + for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; + j <<= 1) { + + rc = test_ring_burst_bulk_tests1( + TEST_RING_THREAD_DEF | j, + test_sync_modes[i].create_flags, + test_sync_modes[i].name); + if (rc < 0) + goto test_fail; + + rc = test_ring_burst_bulk_tests2( + TEST_RING_THREAD_DEF | j, + test_sync_modes[i].create_flags, + test_sync_modes[i].name); + if (rc < 0) goto test_fail; + rc = test_ring_burst_bulk_tests3( + TEST_RING_THREAD_DEF | j, + test_sync_modes[i].create_flags, + test_sync_modes[i].name); + if (rc < 0) + goto test_fail; + + rc = test_ring_burst_bulk_tests3( + TEST_RING_THREAD_DEF | j, + test_sync_modes[i].create_flags, + test_sync_modes[i].name); + if (rc < 0) + goto test_fail; + } + } + /* dump the ring status */ rte_ring_list_dump(stdout); -- 2.17.1