From: EXT Bala Manoharan [mailto:[email protected]] Sent: Friday, March 04, 2016 12:16 PM To: Savolainen, Petri (Nokia - FI/Espoo) <[email protected]> Cc: LNG ODP Mailman List <[email protected]> Subject: Re: [lng-odp] [API-NEXT PATCH 1/2] api: pktio: add recv from multiple queues with tmo
On 4 March 2016 at 15:21, Petri Savolainen <[email protected]<mailto:[email protected]>> wrote: Added odp_pktin_recv_mq_tmo() which allows application to poll multiple input queues (interfaces) with single call. The call includes timeout parameter which allows thread to e.g. sleep while waiting for more packets to arrive and thus avoid 100% CPU utilization when packet rate is low. Signed-off-by: Petri Savolainen <[email protected]<mailto:[email protected]>> Signed-off-by: Juha-Matti Tilli <[email protected]<mailto:[email protected]>> --- include/odp/api/spec/packet_io.h | 55 ++++++++++++++++++++++ .../include/odp/api/plat/packet_io_types.h | 3 ++ 2 files changed, 58 insertions(+) diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 302d431..0932cf0 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -63,6 +63,15 @@ extern "C" { * Actual MAC address sizes may be different. */ +/** + * @def ODP_PKTIN_NO_WAIT + * Do not wait on packet input + */ + +/** + * @def ODP_PKTIN_WAIT + * Wait infinitely on packet input + */ /** * Packet input mode @@ -530,6 +539,52 @@ odp_pktio_t odp_pktio_lookup(const char *name); int odp_pktin_recv(odp_pktin_queue_t queue, odp_packet_t packets[], int num); /** + * Receive packets directly from multiple interface input queues + * + * Receives up to 'num' packets from one of the specified pktio interface input + * queues. The index of the source queue is stored into 'from' output + * parameter. If there are no packets available on any of the queues, waits for + * packets depeding on 'wait' parameter value. Returns the number of packets + * received. A Minor query, since there are more than one input queue and 'num' packets are returned from only one of the input queue what happens when more than one input queue contains the packet? Is there any inherent priority order to be maintained by the implementation? Correct me if I am wrong but these input queues are created based on hash parameters and does not contain any priority value. Regards, Bala No priority order. We could say that queue[0] is checked always first, etc. But I think we can leave it implementation specific in which order queues are checked (at least for now). Application can use the plain recv() in between of these calls to poll “high” priority queues more of than the others. -Petri
_______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
