Balasubramanian Manoharan(bala-manoharan) replied on github web page:

platform/linux-generic/odp_packet.c
line 23
@@ -2544,3 +2544,41 @@ int odp_packet_has_ref(odp_packet_t pkt)
 
        return 0;
 }
+
+odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt)
+{
+       odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+
+       if (pkt_hdr->p.input_flags.ipv4)
+               return ODP_PROTO_L3_TYPE_IPV4;
+       else if (pkt_hdr->p.input_flags.ipv6)
+               return ODP_PROTO_L3_TYPE_IPV6;
+       else if (pkt_hdr->p.input_flags.arp)
+               return ODP_PROTO_L3_TYPE_ARP;
+
+       return ODP_PROTO_L3_TYPE_NONE;
+}
+
+odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt)
+{
+       odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+
+       if (pkt_hdr->p.input_flags.tcp)


Comment:
Why don't we use a switch case instead of a nested if-else?

https://github.com/Linaro/odp/pull/463#discussion_r167484074
updated_at 2018-02-12 08:02:46

Reply via email to