aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/pktio/netmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/pktio/netmap.c')
-rw-r--r--platform/linux-generic/pktio/netmap.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index 59cb27654..4ea0d4ad9 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -593,7 +593,9 @@ static inline int netmap_pkt_to_odp(pktio_entry_t *pktio_entry,
uint16_t len, odp_time_t *ts)
{
odp_packet_t pkt;
- int ret;
+ odp_pool_t pool = pktio_entry->s.pkt_nm.pool;
+ odp_packet_hdr_t *pkt_hdr;
+ odp_packet_hdr_t parsed_hdr;
if (odp_unlikely(len > pktio_entry->s.pkt_nm.max_frame_len)) {
ODP_ERR("RX: frame too big %" PRIu16 " %zu!\n", len,
@@ -607,35 +609,32 @@ static inline int netmap_pkt_to_odp(pktio_entry_t *pktio_entry,
}
if (pktio_cls_enabled(pktio_entry)) {
- ret = _odp_packet_cls_enq(pktio_entry, (const uint8_t *)buf,
- len, ts);
- if (ret && ret != -ENOENT)
- return ret;
- return 0;
- } else {
- odp_packet_hdr_t *pkt_hdr;
-
- pkt = packet_alloc(pktio_entry->s.pkt_nm.pool, len, 1);
- if (pkt == ODP_PACKET_INVALID)
+ if (cls_classify_packet(pktio_entry, (const uint8_t *)buf, len,
+ &pool, &parsed_hdr))
return -1;
+ }
+ pkt = packet_alloc(pool, len, 1);
+ if (pkt == ODP_PACKET_INVALID)
+ return -1;
- pkt_hdr = odp_packet_hdr(pkt);
+ pkt_hdr = odp_packet_hdr(pkt);
- /* For now copy the data in the mbuf,
- worry about zero-copy later */
- if (odp_packet_copy_from_mem(pkt, 0, len, buf) != 0) {
- odp_packet_free(pkt);
- return -1;
- }
+ /* For now copy the data in the mbuf,
+ worry about zero-copy later */
+ if (odp_packet_copy_from_mem(pkt, 0, len, buf) != 0) {
+ odp_packet_free(pkt);
+ return -1;
+ }
+ pkt_hdr->input = pktio_entry->s.handle;
+ if (pktio_cls_enabled(pktio_entry))
+ copy_packet_parser_metadata(&parsed_hdr, pkt_hdr);
+ else
packet_parse_l2(pkt_hdr);
- pkt_hdr->input = pktio_entry->s.handle;
-
- packet_set_ts(pkt_hdr, ts);
+ packet_set_ts(pkt_hdr, ts);
- *pkt_out = pkt;
- }
+ *pkt_out = pkt;
return 1;
}