[API-NEXT,v3,1/11] linux-gen: packet: add odp_packet_l2_type() implementation

Message ID 1519761609-20848-2-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series
  • [API-NEXT,v3,1/11] linux-gen: packet: add odp_packet_l2_type() implementation
Related show

Commit Message

Github ODP bot Feb. 27, 2018, 7:59 p.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 502 (lumag:ipsec-imp-upd)
 ** https://github.com/Linaro/odp/pull/502
 ** Patch: https://github.com/Linaro/odp/pull/502.patch
 ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae
 ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544
 **/
 platform/linux-generic/odp_packet.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch

diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 666a4617c..2459a3aa8 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -2485,6 +2485,16 @@  int odp_packet_has_ref(odp_packet_t pkt)
 	return 0;
 }
 
+odp_proto_l2_type_t odp_packet_l2_type(odp_packet_t pkt)
+{
+	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
+
+	if (pkt_hdr->p.input_flags.eth)
+		return ODP_PROTO_L2_TYPE_ETH;
+
+	return ODP_PROTO_L2_TYPE_NONE;
+}
+
 odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt)
 {
 	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);