From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 51FCA8E76 for ; Fri, 11 Sep 2015 15:36:41 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 11 Sep 2015 06:36:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,511,1437462000"; d="scan'208";a="787413985" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 11 Sep 2015 06:36:20 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t8BDaJC9003294; Fri, 11 Sep 2015 14:36:19 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t8BDaJG7003822; Fri, 11 Sep 2015 14:36:19 +0100 Received: (from fanzhan2@localhost) by sivswdev02.ir.intel.com with id t8BDaJPN003818; Fri, 11 Sep 2015 14:36:19 +0100 From: roy.fan.zhang@intel.com To: dev@dpdk.org Date: Fri, 11 Sep 2015 14:35:46 +0100 Message-Id: <1441978548-3582-3-git-send-email-roy.fan.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1441978548-3582-1-git-send-email-roy.fan.zhang@intel.com> References: <1441978548-3582-1-git-send-email-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH 2/4] app/test: modify table and pipeline test X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 13:36:42 -0000 From: Fan Zhang Test_table has been modified to work on updated macros to access meta-data stored in the mbuf structure. Signed-off-by: Fan Zhang --- app/test/test_table.h | 8 ++++++-- app/test/test_table_combined.c | 28 +++++++++++++-------------- app/test/test_table_pipeline.c | 3 ++- app/test/test_table_tables.c | 44 ++++++++++++++++++++++-------------------- 4 files changed, 45 insertions(+), 38 deletions(-) diff --git a/app/test/test_table.h b/app/test/test_table.h index accc6f8..2077893 100644 --- a/app/test/test_table.h +++ b/app/test/test_table.h @@ -78,6 +78,8 @@ #define MP_FLAGS 0 /* Macros */ +#define APP_METADATA_OFFSET(offset) (sizeof(struct rte_mbuf) + (offset)) + #define RING_ENQUEUE(ring, value) do { \ struct rte_mbuf *m; \ uint32_t *k32, *signature; \ @@ -86,8 +88,10 @@ m = rte_pktmbuf_alloc(pool); \ if (m == NULL) \ return -1; \ - signature = RTE_MBUF_METADATA_UINT32_PTR(m, 0); \ - key = RTE_MBUF_METADATA_UINT8_PTR(m, 32); \ + signature = RTE_MBUF_METADATA_UINT32_PTR(m, \ + APP_METADATA_OFFSET(0)); \ + key = RTE_MBUF_METADATA_UINT8_PTR(m, \ + APP_METADATA_OFFSET(32)); \ k32 = (uint32_t *) key; \ k32[0] = (value); \ *signature = pipeline_test_hash(key, 0, 0); \ diff --git a/app/test/test_table_combined.c b/app/test/test_table_combined.c index dd09da5..5da005b 100644 --- a/app/test/test_table_combined.c +++ b/app/test/test_table_combined.c @@ -295,7 +295,7 @@ test_table_lpm_combined(void) struct rte_table_lpm_params lpm_params = { .n_rules = 1 << 16, .entry_unique_size = 8, - .offset = 0, + .offset = APP_METADATA_OFFSET(0), }; struct rte_table_lpm_key lpm_key = { @@ -355,7 +355,7 @@ test_table_lpm_ipv6_combined(void) .n_rules = 1 << 16, .number_tbl8s = 1 << 13, .entry_unique_size = 8, - .offset = 32, + .offset = APP_METADATA_OFFSET(32), }; struct rte_table_lpm_ipv6_key lpm_ipv6_key = { @@ -417,8 +417,8 @@ test_table_hash8lru(void) .n_entries = 1<<24, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key8lru[8]; @@ -475,8 +475,8 @@ test_table_hash16lru(void) .n_entries = 1<<16, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key16lru[16]; @@ -533,8 +533,8 @@ test_table_hash32lru(void) .n_entries = 1<<16, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key32lru[32]; @@ -592,8 +592,8 @@ test_table_hash8ext(void) .n_entries_ext = 1<<15, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key8ext[8]; @@ -658,8 +658,8 @@ test_table_hash16ext(void) .n_entries_ext = 1<<15, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key16ext[16]; @@ -724,8 +724,8 @@ test_table_hash32ext(void) .n_entries_ext = 1<<15, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key32ext[32]; diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c index a0a9e04..ff07cda 100644 --- a/app/test/test_table_pipeline.c +++ b/app/test/test_table_pipeline.c @@ -457,7 +457,8 @@ test_pipeline_single_filter(int test_type, int expected_count) rte_panic("Failed to alloc mbuf from pool\n"); return -1; } - key = RTE_MBUF_METADATA_UINT8_PTR(m, 32); + key = RTE_MBUF_METADATA_UINT8_PTR(m, + APP_METADATA_OFFSET(32)); k32 = (uint32_t *) key; k32[0] = 0xadadadad >> (j % 2); diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c index 566964b..581316e 100644 --- a/app/test/test_table_tables.c +++ b/app/test/test_table_tables.c @@ -52,8 +52,10 @@ table_test table_tests[] = { uint32_t *k32, *signature; \ uint8_t *key; \ mbuf = rte_pktmbuf_alloc(pool); \ - signature = RTE_MBUF_METADATA_UINT32_PTR(mbuf, 0); \ - key = RTE_MBUF_METADATA_UINT8_PTR(mbuf, 32); \ + signature = RTE_MBUF_METADATA_UINT32_PTR(mbuf, \ + APP_METADATA_OFFSET(0)); \ + key = RTE_MBUF_METADATA_UINT8_PTR(mbuf, \ + APP_METADATA_OFFSET(32)); \ memset(key, 0, 32); \ k32 = (uint32_t *) key; \ k32[0] = (value); \ @@ -206,7 +208,7 @@ test_table_array(void) /* Initialize params and create tables */ struct rte_table_array_params array_params = { .n_entries = 7, - .offset = 1 + .offset = APP_METADATA_OFFSET(1) }; table = rte_table_array_ops.f_create(NULL, 0, 1); @@ -226,13 +228,13 @@ test_table_array(void) return -3; array_params.n_entries = 1 << 24; - array_params.offset = 1; + array_params.offset = APP_METADATA_OFFSET(1); table = rte_table_array_ops.f_create(&array_params, 0, 1); if (table == NULL) return -4; - array_params.offset = 32; + array_params.offset = APP_METADATA_OFFSET(32); table = rte_table_array_ops.f_create(&array_params, 0, 1); if (table == NULL) @@ -324,7 +326,7 @@ test_table_lpm(void) struct rte_table_lpm_params lpm_params = { .n_rules = 1 << 24, .entry_unique_size = entry_size, - .offset = 1 + .offset = APP_METADATA_OFFSET(1) }; table = rte_table_lpm_ops.f_create(NULL, 0, entry_size); @@ -338,7 +340,7 @@ test_table_lpm(void) return -2; lpm_params.n_rules = 1 << 24; - lpm_params.offset = 32; + lpm_params.offset = APP_METADATA_OFFSET(32); lpm_params.entry_unique_size = 0; table = rte_table_lpm_ops.f_create(&lpm_params, 0, entry_size); @@ -481,7 +483,7 @@ test_table_lpm_ipv6(void) .n_rules = 1 << 24, .number_tbl8s = 1 << 21, .entry_unique_size = entry_size, - .offset = 32 + .offset = APP_METADATA_OFFSET(32) }; table = rte_table_lpm_ipv6_ops.f_create(NULL, 0, entry_size); @@ -512,7 +514,7 @@ test_table_lpm_ipv6(void) return -2; lpm_params.entry_unique_size = entry_size; - lpm_params.offset = 32; + lpm_params.offset = APP_METADATA_OFFSET(32); table = rte_table_lpm_ipv6_ops.f_create(&lpm_params, 0, entry_size); if (table == NULL) @@ -650,8 +652,8 @@ test_table_hash_lru_generic(struct rte_table_ops *ops) .n_entries = 1 << 10, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 1, - .key_offset = 32 + .signature_offset = APP_METADATA_OFFSET(1), + .key_offset = APP_METADATA_OFFSET(32) }; hash_params.n_entries = 0; @@ -661,20 +663,20 @@ test_table_hash_lru_generic(struct rte_table_ops *ops) return -1; hash_params.n_entries = 1 << 10; - hash_params.signature_offset = 1; + hash_params.signature_offset = APP_METADATA_OFFSET(1); table = ops->f_create(&hash_params, 0, 1); if (table == NULL) return -2; - hash_params.signature_offset = 0; - hash_params.key_offset = 1; + hash_params.signature_offset = APP_METADATA_OFFSET(0); + hash_params.key_offset = APP_METADATA_OFFSET(1); table = ops->f_create(&hash_params, 0, 1); if (table == NULL) return -3; - hash_params.key_offset = 32; + hash_params.key_offset = APP_METADATA_OFFSET(32); hash_params.f_hash = NULL; table = ops->f_create(&hash_params, 0, 1); @@ -765,8 +767,8 @@ test_table_hash_ext_generic(struct rte_table_ops *ops) .n_entries_ext = 1 << 4, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 1, - .key_offset = 32 + .signature_offset = APP_METADATA_OFFSET(1), + .key_offset = APP_METADATA_OFFSET(32) }; hash_params.n_entries = 0; @@ -782,19 +784,19 @@ test_table_hash_ext_generic(struct rte_table_ops *ops) return -2; hash_params.n_entries_ext = 1 << 4; - hash_params.signature_offset = 1; + hash_params.signature_offset = APP_METADATA_OFFSET(1); table = ops->f_create(&hash_params, 0, 1); if (table == NULL) return -2; - hash_params.signature_offset = 0; - hash_params.key_offset = 1; + hash_params.signature_offset = APP_METADATA_OFFSET(0); + hash_params.key_offset = APP_METADATA_OFFSET(1); table = ops->f_create(&hash_params, 0, 1); if (table == NULL) return -3; - hash_params.key_offset = 32; + hash_params.key_offset = APP_METADATA_OFFSET(32); hash_params.f_hash = NULL; table = ops->f_create(&hash_params, 0, 1); -- 2.1.0