On 4 March 2016 at 15:21, Petri Savolainen <[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]>
> Signed-off-by: Juha-Matti Tilli <[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

> + *
> + * When an input queue has been configured with 'op_mode' value
> + * ODP_PKTIO_OP_MT_UNSAFE, the operation is optimized for single thread
> + * operation and the same queue must not be accessed simultaneously from
> + * multiple threads.
> + *
> + * @param      queues[]   Packet input queue handles for receiving packets
> + * @param      num_q      Number of input queues
> + * @param[out] from       Pointer for output of the source queue index.
> Ignored
> + *                        when NULL.
> + * @param[out] packets[]  Packet handle array for output of received
> packets
> + * @param      num        Maximum number of packets to receive
> + * @param      wait       Wait time specified as as follows:
> + *                        * ODP_PKTIN_NO_WAIT: Do not wait
> + *                        * ODP_PKTIN_WAIT:    Wait infinitely
> + *                        * Other values specify the minimum time to wait.
> + *                          Use odp_pktin_wait_time() to convert
> nanoseconds
> + *                          to a valid parameter value. Wait time may be
> + *                          rounded up a small, platform specific amount.
> + *
> + * @return Number of packets received
> + * @retval <0 on failure
> + */
> +int odp_pktin_recv_mq_tmo(const odp_pktin_queue_t queues[], unsigned
> num_q,
> +                         unsigned *from, odp_packet_t packets[], int num,
> +                         uint64_t wait);
> +
> +/**
> + * Packet input wait time
> + *
> + * Converts nanoseconds to wait time values for packet input functions.
> + *
> + * @param nsec   Minimum number of nanoseconds to wait
> + *
> + * @return Wait parameter value for packet input functions
> + */
> +uint64_t odp_pktin_wait_time(uint64_t nsec);
> +
> +/**
>   * Send packets directly to an interface output queue
>   *
>   * Sends out a number of packets to the interface output queue. When
> diff --git a/platform/linux-generic/include/odp/api/plat/packet_io_types.h
> b/platform/linux-generic/include/odp/api/plat/packet_io_types.h
> index cd43083..5a45321 100644
> --- a/platform/linux-generic/include/odp/api/plat/packet_io_types.h
> +++ b/platform/linux-generic/include/odp/api/plat/packet_io_types.h
> @@ -44,6 +44,9 @@ typedef struct odp_pktout_queue_t {
>
>  #define ODP_PKTIO_MACADDR_MAXSIZE 16
>
> +#define ODP_PKTIN_NO_WAIT 0
> +#define ODP_PKTIN_WAIT    UINT64_MAX
> +
>  /** Get printable format of odp_pktio_t */
>  static inline uint64_t odp_pktio_to_u64(odp_pktio_t hdl)
>  {
> --
> 2.7.2
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to