diff mbox series

[v1,4/4] linux-gen: pktio: loop: fix recv if classier bit is enabled

Message ID 1503003607-14013-5-git-send-email-odpbot@yandex.ru
State New
Headers show
Series None | expand

Commit Message

Github ODP bot Aug. 17, 2017, 9 p.m. UTC
From: Maxim Uvarov <maxim.uvarov@linaro.org>


Do not use fake header and just classify recived patched from
loop ring.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 131 (muvarov:master_loop_cls_fix)
 ** https://github.com/Linaro/odp/pull/131
 ** Patch: https://github.com/Linaro/odp/pull/131.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: 30f51ee13b0bf800873a9be2c9a15b6a0c1db14d
 **/
 platform/linux-generic/pktio/loop.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index c825393a..68abb6d8 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -58,7 +58,6 @@  static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 	odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX];
 	queue_t queue;
 	odp_packet_hdr_t *pkt_hdr;
-	odp_packet_hdr_t parsed_hdr;
 	odp_packet_t pkt;
 	odp_time_t ts_val;
 	odp_time_t *ts = NULL;
@@ -84,7 +83,7 @@  static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 
 		pkt = packet_from_buf_hdr(hdr_tbl[i]);
 		pkt_len = odp_packet_len(pkt);
-
+		pkt_hdr = odp_packet_hdr(pkt);
 
 		if (pktio_cls_enabled(pktio_entry)) {
 			odp_packet_t new_pkt;
@@ -106,14 +105,16 @@  static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 			} else {
 				pkt_addr = odp_packet_data(pkt);
 			}
+
 			ret = cls_classify_packet(pktio_entry, pkt_addr,
 						  pkt_len, seg_len,
-						  &new_pool, &parsed_hdr);
+						  &new_pool, pkt_hdr);
 			if (ret) {
 				failed++;
 				odp_packet_free(pkt);
 				continue;
 			}
+
 			if (new_pool != odp_packet_pool(pkt)) {
 				new_pkt = odp_packet_copy(pkt, new_pool);
 
@@ -125,21 +126,14 @@  static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 				}
 				pkt = new_pkt;
 			}
-		}
-		pkt_hdr = odp_packet_hdr(pkt);
-
-		pkt_hdr->input = pktio_entry->s.handle;
-
-		if (pktio_cls_enabled(pktio_entry))
-			copy_packet_cls_metadata(&parsed_hdr, pkt_hdr);
-		else
+		} else {
 			packet_parse_layer(pkt_hdr,
 					   pktio_entry->s.config.parser.layer);
+		}
 
 		packet_set_ts(pkt_hdr, ts);
-
+		pkt_hdr->input = pktio_entry->s.handle;
 		pktio_entry->s.stats.in_octets += pkt_len;
-
 		pkts[num_rx++] = pkt;
 	}