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

Message ID 1517407211-19105-12-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • [v2,1/11] linux-gen: packet: use inlined flow hash and ts set
Related show

Commit Message

Github ODP bot Jan. 31, 2018, 2 p.m.
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: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 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(-)

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;