diff mbox

[API-NEXT,PATCHv4,01/11] linux-generic: packet: move flow_hash present flag to correct location

Message ID 1461197655-23743-2-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer April 21, 2016, 12:14 a.m. UTC
From: Matias Elo <matias.elo@nokia.com>

Move flow_hash present flag to the same location as all the
other packet input and protocol flags.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/include/odp_packet_internal.h | 3 ++-
 platform/linux-generic/odp_packet.c                  | 2 +-
 platform/linux-generic/odp_packet_flags.c            | 4 ++--
 platform/linux-generic/pktio/dpdk.c                  | 6 ++----
 4 files changed, 7 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index 47f4ff8..edff533 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -41,6 +41,8 @@  typedef union {
 		uint32_t parsed_l2:1; /**< L2 parsed */
 		uint32_t parsed_all:1;/**< Parsing complete */
 
+		uint32_t flow_hash:1; /**< Flow hash present */
+
 		uint32_t l2:1;        /**< known L2 protocol present */
 		uint32_t l3:1;        /**< known L3 protocol present */
 		uint32_t l4:1;        /**< known L4 protocol present */
@@ -149,7 +151,6 @@  typedef struct {
 
 	odp_pktio_t input;
 
-	uint32_t has_hash:1;      /**< Flow hash present */
 	uint32_t flow_hash;      /**< Flow hash value */
 
 	odp_crypto_generic_op_result_t op_result;  /**< Result for crypto */
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index ef0a7d3..2c06e97 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -453,7 +453,7 @@  void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash)
 	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
 
 	pkt_hdr->flow_hash = flow_hash;
-	pkt_hdr->has_hash = 1;
+	pkt_hdr->input_flags.flow_hash = 1;
 }
 
 int odp_packet_is_segmented(odp_packet_t pkt)
diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c
index ecaa3a3..5d93f57 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -176,7 +176,7 @@  int odp_packet_has_flow_hash(odp_packet_t pkt)
 {
 	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
 
-	return pkt_hdr->has_hash;
+	return pkt_hdr->input_flags.flow_hash;
 }
 
 odp_packet_color_t odp_packet_color(odp_packet_t pkt)
@@ -335,5 +335,5 @@  void odp_packet_has_flow_hash_clr(odp_packet_t pkt)
 {
 	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
 
-	pkt_hdr->has_hash = 0;
+	pkt_hdr->input_flags.flow_hash = 0;
 }
diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index 4aff57c..0e57d90 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -701,10 +701,8 @@  static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
 
 			pkt_hdr->input = pktio_entry->s.handle;
 
-			if (mbuf->ol_flags & PKT_RX_RSS_HASH) {
-				pkt_hdr->has_hash = 1;
-				pkt_hdr->flow_hash = mbuf->hash.rss;
-			}
+			if (mbuf->ol_flags & PKT_RX_RSS_HASH)
+				odp_packet_flow_hash_set(pkt, mbuf->hash.rss);
 
 			pkt_table[nb_pkts++] = pkt;
 		}