diff mbox

[API-NEXT,09/11] linux-generic: packet: add inline helper function for setting packet timestamp

Message ID 1460704874-21163-10-git-send-email-matias.elo@nokia.com
State Superseded
Headers show

Commit Message

Elo, Matias (Nokia - FI/Espoo) April 15, 2016, 7:21 a.m. UTC
Signed-off-by: Matias Elo <matias.elo@nokia.com>
---
 platform/linux-generic/include/odp_packet_internal.h | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index 0459286..b38e22e 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -285,6 +285,14 @@  static inline int packet_hdr_has_eth(odp_packet_hdr_t *pkt_hdr)
 	return pkt_hdr->input_flags.eth;
 }
 
+static inline void packet_set_ts(odp_packet_hdr_t *pkt_hdr, odp_time_t *ts)
+{
+	if (ts != NULL) {
+		pkt_hdr->timestamp = *ts;
+		pkt_hdr->input_flags.timestamp = 1;
+	}
+}
+
 int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr);
 
 int _odp_cls_parse(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr);