From 37072db5ae3644223769ce9ea65d93ff25c9fe81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jere=20Lepp=C3=A4nen?= Date: Mon, 31 Jan 2022 11:57:56 +0200 Subject: linux-gen: cls: move parse call out of _odp_cls_classify_packet() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of calling _odp_packet_parse_common() in _odp_cls_classify_packet(), make the call in pktio before the classify call. This is cleaner and makes for better error handling. Signed-off-by: Jere Leppänen Reviewed-by: Matias Elo Reviewed-by: Petri Savolainen --- platform/linux-generic/pktio/loop.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'platform/linux-generic/pktio/loop.c') diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index f50145d52..0a81e7085 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -203,9 +203,17 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, pkt_addr = odp_packet_data(pkt); } + ret = _odp_packet_parse_common(&pkt_hdr->p, pkt_addr, pkt_len, + seg_len, ODP_PROTO_LAYER_ALL, + pktio_entry->s.in_chksums); + if (ret < 0) { + failed++; + odp_packet_free(pkt); + continue; + } + ret = _odp_cls_classify_packet(pktio_entry, pkt_addr, - pkt_len, seg_len, - &new_pool, pkt_hdr, true); + &new_pool, pkt_hdr); if (ret) { failed++; odp_packet_free(pkt); -- cgit v1.2.3