From: Petri Savolainen <petri.savolai...@linaro.org>

Use inlined version of flow hash set function. Also changed API
to use inlined timestamp function, so that the same function is
not implemented twice.

Signed-off-by: Petri Savolainen <petri.savolai...@linaro.org>
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 platform/linux-generic/include/odp_packet_internal.h | 7 +++++++
 platform/linux-generic/odp_packet.c                  | 6 ++----
 platform/linux-generic/pktio/dpdk.c                  | 4 ++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 01e0cae17..32e41d7f5 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -331,6 +331,13 @@ static inline int packet_hdr_has_ipv6(odp_packet_hdr_t 
*pkt_hdr)
        return pkt_hdr->p.input_flags.ipv6;
 }
 
+static inline void packet_set_flow_hash(odp_packet_hdr_t *pkt_hdr,
+                                       uint32_t flow_hash)
+{
+       pkt_hdr->flow_hash = flow_hash;
+       pkt_hdr->p.input_flags.flow_hash = 1;
+}
+
 static inline void packet_set_ts(odp_packet_hdr_t *pkt_hdr, odp_time_t *ts)
 {
        if (ts != NULL) {
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index a4cd05f62..8d6185987 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1352,16 +1352,14 @@ void odp_packet_flow_hash_set(odp_packet_t pkt, 
uint32_t flow_hash)
 {
        odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-       pkt_hdr->flow_hash = flow_hash;
-       pkt_hdr->p.input_flags.flow_hash = 1;
+       packet_set_flow_hash(pkt_hdr, flow_hash);
 }
 
 void odp_packet_ts_set(odp_packet_t pkt, odp_time_t timestamp)
 {
        odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-       pkt_hdr->timestamp = timestamp;
-       pkt_hdr->p.input_flags.timestamp = 1;
+       packet_set_ts(pkt_hdr, &timestamp);
 }
 
 /*
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 6fd4b1924..4ae72e10a 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -483,7 +483,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
                                           pktio_entry->s.config.parser.layer);
 
                if (mbuf->ol_flags & PKT_RX_RSS_HASH)
-                       odp_packet_flow_hash_set(pkt, mbuf->hash.rss);
+                       packet_set_flow_hash(pkt_hdr, mbuf->hash.rss);
 
                packet_set_ts(pkt_hdr, ts);
 
@@ -723,7 +723,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t 
*pktio_entry,
                                           pktio_entry->s.config.parser.layer);
 
                if (mbuf->ol_flags & PKT_RX_RSS_HASH)
-                       odp_packet_flow_hash_set(pkt, mbuf->hash.rss);
+                       packet_set_flow_hash(pkt_hdr, mbuf->hash.rss);
 
                packet_set_ts(pkt_hdr, ts);
 

Reply via email to