Receive packets from all pktin queues. Improves backward compatibility. Signed-off-by: Matias Elo <matias....@nokia.com> --- platform/linux-generic/include/odp_packet_netmap.h | 1 + platform/linux-generic/pktio/netmap.c | 23 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/platform/linux-generic/include/odp_packet_netmap.h b/platform/linux-generic/include/odp_packet_netmap.h index 27efccb..3213cf3 100644 --- a/platform/linux-generic/include/odp_packet_netmap.h +++ b/platform/linux-generic/include/odp_packet_netmap.h @@ -45,6 +45,7 @@ typedef struct { odp_pktio_capability_t capa; /**< interface capabilities */ unsigned num_rx_queues; /**< number of pktin queues */ unsigned num_tx_queues; /**< number of pktout queues */ + unsigned cur_rx_queue; /**< current pktin queue */ odp_bool_t lockless_rx; /**< no locking for rx */ odp_bool_t lockless_tx; /**< no locking for tx */ } pkt_netmap_t; diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 36d7467..0c06f4a 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -454,7 +454,28 @@ static int netmap_recv_queue(pktio_entry_t *pktio_entry, int index, static int netmap_recv(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], unsigned num) { - return netmap_recv_queue(pktio_entry, 0, pkt_table, num); + unsigned i; + unsigned num_rx = 0; + unsigned queue_id = pktio_entry->s.pkt_nm.cur_rx_queue; + unsigned num_queues = pktio_entry->s.pkt_nm.num_rx_queues; + unsigned pkts_left = num; + odp_packet_t *pkt_table_cur = pkt_table; + + for (i = 0; i < num_queues && num_rx != num; i++) { + if (queue_id >= num_queues) + queue_id = 0; + + pkt_table_cur = &pkt_table[num_rx]; + pkts_left = num - num_rx; + + num_rx += netmap_recv_queue(pktio_entry, queue_id, + pkt_table_cur, pkts_left); + queue_id++; + } + pktio_entry->s.pkt_nm.cur_rx_queue = queue_id; + + return num_rx; + } /** -- 1.9.1 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp