diff options
author | Janne Peltonen <janne.peltonen@nokia.com> | 2021-11-24 10:58:06 +0200 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2021-12-03 14:21:58 +0200 |
commit | 3d9d86e236ede49ae85e9542d50dc0ff03cf9e07 (patch) | |
tree | 8e345a7dedb8086c6751f8818377d3743f1ce799 /test/performance/odp_l2fwd.c | |
parent | ed981ed37322b60313ef14c50aa5682d194cec0e (diff) |
test: l2fwd: fix packet sending to not use vectors
ODP API supports packet vectors in packet reception from a pktin but
not in packet transmission to pktout. ODP implementations may support
packet vectors in TX too, but they are not required to do so.
Currently the -u flag enables packet vectors not only in RX but also
in TX. Fix the problem by not sending packets as vectors even
when the packets are reveived as vectors.
Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'test/performance/odp_l2fwd.c')
-rw-r--r-- | test/performance/odp_l2fwd.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 5f2fba4e7..dcfc1a157 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -457,9 +457,8 @@ static int run_worker_sched_mode_vector(void *arg) for (i = 0; i < pktvs; i++) { odp_packet_vector_t pkt_vec; odp_packet_t *pkt_tbl; - unsigned int tx_drops; int src_idx, dst_idx; - int pkts, sent; + int pkts; ODPH_ASSERT(odp_event_type(ev_tbl[i]) == ODP_EVENT_PACKET_VECTOR); pkt_vec = odp_packet_vector_from_event(ev_tbl[i]); @@ -470,7 +469,6 @@ static int run_worker_sched_mode_vector(void *arg) odp_packet_vector_free(pkt_vec); continue; } - odp_packet_vector_size_set(pkt_vec, pkts); /* packets from the same queue are from the same interface */ src_idx = odp_packet_input_index(pkt_tbl[0]); @@ -478,31 +476,13 @@ static int run_worker_sched_mode_vector(void *arg) dst_idx = gbl_args->dst_port_from_idx[src_idx]; fill_eth_addrs(pkt_tbl, pkts, dst_idx); - if (odp_unlikely(use_event_queue)) { - odp_event_t event = odp_packet_vector_to_event(pkt_vec); + send_packets(pkt_tbl, pkts, + use_event_queue, + tx_queue[dst_idx], + pktout[dst_idx], + stats); - sent = odp_queue_enq(tx_queue[dst_idx], event); - sent = odp_likely(sent == 0) ? pkts : 0; - } else { - sent = odp_pktout_send(pktout[dst_idx], pkt_tbl, pkts); - sent = odp_unlikely(sent < 0) ? 0 : sent; - } - - tx_drops = pkts - sent; - if (odp_unlikely(tx_drops)) { - int j; - - stats->s.tx_drops += tx_drops; - /* Drop rejected packets */ - for (j = sent; j < pkts; j++) - odp_packet_free(pkt_tbl[j]); - } - - /* Free packet vector if sending failed or in direct mode. */ - if (tx_drops || !use_event_queue) - odp_packet_vector_free(pkt_vec); - - stats->s.packets += pkts; + odp_packet_vector_free(pkt_vec); } } |