pci: separate ioport handlers per UIO driver
[dpdk.git] / app / test-pipeline / pipeline_hash.c
index 4598ad4..f8aac0d 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -140,7 +140,6 @@ app_main_loop_worker_pipeline_hash(void) {
                        .ops = &rte_port_ring_writer_ops,
                        .arg_create = (void *) &port_ring_params,
                        .f_action = NULL,
-                       .f_action_bulk = NULL,
                        .arg_ah = NULL,
                };
 
@@ -163,8 +162,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 +213,9 @@ 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),
+                       .key_mask = NULL,
                        .f_hash = test_hash,
                        .seed = 0,
                };
@@ -238,8 +238,9 @@ 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),
+                       .key_mask = NULL,
                        .f_hash = test_hash,
                        .seed = 0,
                };
@@ -263,10 +264,11 @@ 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,
+                       .key_mask = NULL,
                };
 
                struct rte_pipeline_table_params table_params = {
@@ -287,10 +289,11 @@ 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,
+                       .key_mask = NULL,
                };
 
                struct rte_pipeline_table_params table_params = {
@@ -312,8 +315,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 +340,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,23 +459,26 @@ 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 (m->ol_flags & PKT_RX_IPV4_HDR) {
+                       if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) {
                                ip_hdr = (struct ipv4_hdr *)
                                        &m_data[sizeof(struct ether_hdr)];
                                ip_dst = ip_hdr->dst_addr;
 
                                k32 = (uint32_t *) key;
                                k32[0] = ip_dst & 0xFFFFFF00;
-                       } else {
+                       } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) {
                                ipv6_hdr = (struct ipv6_hdr *)
                                        &m_data[sizeof(struct ether_hdr)];
                                ipv6_dst = ipv6_hdr->dst_addr;
 
                                memcpy(key, ipv6_dst, 16);
-                       }
+                       } else
+                               continue;
 
                        *signature = test_hash(key, 0, 0);
                }