[dpdk-dev] [PATCH 3/4] app/test_pipeline: modify pipeline test

roy.fan.zhang at intel.com roy.fan.zhang at intel.com
Fri Sep 11 15:35:47 CEST 2015


From: Fan Zhang <roy.fan.zhang at intel.com>

Test_pipeline has been modified to work on updated macros to access
meta-data stored in the mbuf structure.

Signed-off-by: Fan Zhang <roy.fan.zhang at intel.com>
---
 app/test-pipeline/main.h              |  2 ++
 app/test-pipeline/pipeline_hash.c     | 34 ++++++++++++++++++----------------
 app/test-pipeline/pipeline_lpm.c      |  2 +-
 app/test-pipeline/pipeline_lpm_ipv6.c |  2 +-
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/app/test-pipeline/main.h b/app/test-pipeline/main.h
index 0c90fc3..8dcd459 100644
--- a/app/test-pipeline/main.h
+++ b/app/test-pipeline/main.h
@@ -137,4 +137,6 @@ void app_main_loop_tx(void);
 #define APP_FLUSH 0x3FF
 #endif
 
+#define APP_METADATA_OFFSET(offset) (sizeof(struct rte_mbuf) + (offset))
+
 #endif /* _MAIN_H_ */
diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c
index 548615f..5e4e17f 100644
--- a/app/test-pipeline/pipeline_hash.c
+++ b/app/test-pipeline/pipeline_hash.c
@@ -163,8 +163,8 @@ app_main_loop_worker_pipeline_hash(void) {
 			.n_buckets_ext = 1 << 21,
 			.f_hash = test_hash,
 			.seed = 0,
-			.signature_offset = 0,
-			.key_offset = 32,
+			.signature_offset = APP_METADATA_OFFSET(0),
+			.key_offset = APP_METADATA_OFFSET(32),
 		};
 
 		struct rte_pipeline_table_params table_params = {
@@ -214,8 +214,8 @@ app_main_loop_worker_pipeline_hash(void) {
 		struct rte_table_hash_key8_ext_params table_hash_params = {
 			.n_entries = 1 << 24,
 			.n_entries_ext = 1 << 23,
-			.signature_offset = 0,
-			.key_offset = 32,
+			.signature_offset = APP_METADATA_OFFSET(0),
+			.key_offset = APP_METADATA_OFFSET(32),
 			.f_hash = test_hash,
 			.seed = 0,
 		};
@@ -238,8 +238,8 @@ app_main_loop_worker_pipeline_hash(void) {
 	{
 		struct rte_table_hash_key8_lru_params table_hash_params = {
 			.n_entries = 1 << 24,
-			.signature_offset = 0,
-			.key_offset = 32,
+			.signature_offset = APP_METADATA_OFFSET(0),
+			.key_offset = APP_METADATA_OFFSET(32),
 			.f_hash = test_hash,
 			.seed = 0,
 		};
@@ -263,8 +263,8 @@ app_main_loop_worker_pipeline_hash(void) {
 		struct rte_table_hash_key16_ext_params table_hash_params = {
 			.n_entries = 1 << 24,
 			.n_entries_ext = 1 << 23,
-			.signature_offset = 0,
-			.key_offset = 32,
+			.signature_offset = APP_METADATA_OFFSET(0),
+			.key_offset = APP_METADATA_OFFSET(32),
 			.f_hash = test_hash,
 			.seed = 0,
 		};
@@ -287,8 +287,8 @@ app_main_loop_worker_pipeline_hash(void) {
 	{
 		struct rte_table_hash_key16_lru_params table_hash_params = {
 			.n_entries = 1 << 24,
-			.signature_offset = 0,
-			.key_offset = 32,
+			.signature_offset = APP_METADATA_OFFSET(0),
+			.key_offset = APP_METADATA_OFFSET(32),
 			.f_hash = test_hash,
 			.seed = 0,
 		};
@@ -312,8 +312,8 @@ app_main_loop_worker_pipeline_hash(void) {
 		struct rte_table_hash_key32_ext_params table_hash_params = {
 			.n_entries = 1 << 24,
 			.n_entries_ext = 1 << 23,
-			.signature_offset = 0,
-			.key_offset = 32,
+			.signature_offset = APP_METADATA_OFFSET(0),
+			.key_offset = APP_METADATA_OFFSET(32),
 			.f_hash = test_hash,
 			.seed = 0,
 		};
@@ -337,8 +337,8 @@ app_main_loop_worker_pipeline_hash(void) {
 	{
 		struct rte_table_hash_key32_lru_params table_hash_params = {
 			.n_entries = 1 << 24,
-			.signature_offset = 0,
-			.key_offset = 32,
+			.signature_offset = APP_METADATA_OFFSET(0),
+			.key_offset = APP_METADATA_OFFSET(32),
 			.f_hash = test_hash,
 			.seed = 0,
 		};
@@ -456,8 +456,10 @@ app_main_loop_rx_metadata(void) {
 
 			m = app.mbuf_rx.array[j];
 			m_data = rte_pktmbuf_mtod(m, uint8_t *);
-			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));
 
 			if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) {
 				ip_hdr = (struct ipv4_hdr *)
diff --git a/app/test-pipeline/pipeline_lpm.c b/app/test-pipeline/pipeline_lpm.c
index b1a2c13..e098f8b 100644
--- a/app/test-pipeline/pipeline_lpm.c
+++ b/app/test-pipeline/pipeline_lpm.c
@@ -115,7 +115,7 @@ app_main_loop_worker_pipeline_lpm(void) {
 			.n_rules = 1 << 24,
 			.entry_unique_size =
 				sizeof(struct rte_pipeline_table_entry),
-			.offset = 32,
+			.offset = APP_METADATA_OFFSET(32),
 		};
 
 		struct rte_pipeline_table_params table_params = {
diff --git a/app/test-pipeline/pipeline_lpm_ipv6.c b/app/test-pipeline/pipeline_lpm_ipv6.c
index 3f24a2d..a5cd3a4 100644
--- a/app/test-pipeline/pipeline_lpm_ipv6.c
+++ b/app/test-pipeline/pipeline_lpm_ipv6.c
@@ -117,7 +117,7 @@ app_main_loop_worker_pipeline_lpm_ipv6(void) {
 			.number_tbl8s = 1 << 21,
 			.entry_unique_size =
 				sizeof(struct rte_pipeline_table_entry),
-			.offset = 32,
+			.offset = APP_METADATA_OFFSET(32),
 		};
 
 		struct rte_pipeline_table_params table_params = {
-- 
2.1.0



More information about the dev mailing list