diff mbox

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

Message ID 1461225572-18238-10-git-send-email-matias.elo@nokia.com
State Accepted
Commit f6226cb73a7c3eb3a2cb726fff5543ea2772ae53
Headers show

Commit Message

Elo, Matias (Nokia - FI/Espoo) April 21, 2016, 7:59 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 1005535..7421d71 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);