This makes it possible for other implementations like ODP-DPDK to reuse classification code while using a different packet API.
Signed-off-by: Zoltan Kiss <zoltan.k...@linaro.org> --- platform/linux-generic/include/odp_classification_inlines.h | 2 +- platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++ platform/linux-generic/odp_classification.c | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h index 8bd010d..bac5b48 100644 --- a/platform/linux-generic/include/odp_classification_inlines.h +++ b/platform/linux-generic/include/odp_classification_inlines.h @@ -162,7 +162,7 @@ static inline int verify_pmr_dmac(const uint8_t *pkt_addr, uint64_t dmac_be = 0; const odph_ethhdr_t *eth; - if (!pkt_hdr->input_flags.eth) + if (!packet_hdr_has_eth(pkt_hdr)) return 0; eth = (const odph_ethhdr_t *)(pkt_addr + pkt_hdr->l2_offset); diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index b632ece..7974a20 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -267,6 +267,16 @@ odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt); /* Convert a buffer handle to a packet handle */ odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf); +static inline int packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr) +{ + return pkt_hdr->input_flags.l2; +} + +static inline int packet_hdr_has_eth(odp_packet_hdr_t *pkt_hdr) +{ + return pkt_hdr->input_flags.eth; +} + 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); diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 6c9f7c1..f5e4673 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -843,8 +843,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, const uint8_t *pkt_addr, const odph_vlanhdr_t *vlan; uint16_t qos; - if (hdr->input_flags.l2 && hdr->input_flags.vlan && - hdr->input_flags.eth) { + if (packet_hdr_has_l2(hdr) && hdr->input_flags.vlan && + packet_hdr_has_eth(hdr)) { eth = (const odph_ethhdr_t *)(pkt_addr + hdr->l2_offset); vlan = (const odph_vlanhdr_t *)(ð->type); qos = odp_be_to_cpu_16(vlan->tci); -- 1.9.1 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp