diff mbox series

[v1,11/11] linux-gen: packet: inline packet input index function

Message ID 1517328009-16379-12-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v1,1/11] linux-gen: packet: use inlined flow hash set | expand

Commit Message

Github ODP bot Jan. 30, 2018, 4 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Inline packet input interface index function which may
be used frequently.

Signed-off-by: Petri Savolainen <petri.savolainen@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: ab7875c186fe80cfe103c5be5634b0eda312aed4
 **/
 platform/linux-generic/include/odp/api/plat/packet_inlines.h     | 8 ++++++++
 platform/linux-generic/include/odp/api/plat/packet_inlines_api.h | 5 +++++
 platform/linux-generic/odp_packet.c                              | 5 -----
 3 files changed, 13 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index dc7d464f2..0704abb2f 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -22,6 +22,7 @@ 
 
 #include <odp/api/plat/packet_inline_types.h>
 #include <odp/api/plat/pool_inline_types.h>
+#include <odp/api/plat/pktio_inlines.h>
 
 #include <string.h>
 
@@ -89,6 +90,13 @@  static inline odp_pktio_t _odp_packet_input(odp_packet_t pkt)
 	return _odp_pkt_get(pkt, odp_pktio_t, input);
 }
 
+static inline int _odp_packet_input_index(odp_packet_t pkt)
+{
+	odp_pktio_t pktio = _odp_packet_input(pkt);
+
+	return _odp_pktio_index(pktio);
+}
+
 static inline int _odp_packet_num_segs(odp_packet_t pkt)
 {
 	return _odp_pkt_get(pkt, uint8_t, segcount);
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
index 95adec66f..c451c4d6c 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
@@ -48,6 +48,11 @@  _ODP_INLINE odp_pktio_t odp_packet_input(odp_packet_t pkt)
 	return _odp_packet_input(pkt);
 }
 
+_ODP_INLINE int odp_packet_input_index(odp_packet_t pkt)
+{
+	return _odp_packet_input_index(pkt);
+}
+
 _ODP_INLINE int odp_packet_num_segs(odp_packet_t pkt)
 {
 	return _odp_packet_num_segs(pkt);
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 1909bae25..9c3be1bcc 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1269,11 +1269,6 @@  void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len,
  *
  */
 
-int odp_packet_input_index(odp_packet_t pkt)
-{
-	return _odp_pktio_index(packet_hdr(pkt)->input);
-}
-
 void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx)
 {
 	packet_hdr(pkt)->buf_hdr.buf_cctx = ctx;