Added output queue configuration parameters and functions for setting up multiple output queues. Added also a function to query the number of output queues.
Signed-off-by: Petri Savolainen <[email protected]> --- include/odp/api/packet_io.h | 69 ++++++++++++++++++++++ .../include/odp/plat/packet_io_types.h | 2 + 2 files changed, 71 insertions(+) diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h index 07aaa7d..8c17718 100644 --- a/include/odp/api/packet_io.h +++ b/include/odp/api/packet_io.h @@ -48,6 +48,11 @@ extern "C" { */ /** + * @typedef odp_pktout_queue_t + * Direct packet output queue handle + */ + +/** * @def ODP_PKTIO_INVALID * Invalid packet IO handle */ @@ -148,6 +153,22 @@ typedef struct odp_pktio_input_queue_param_t { } odp_pktio_input_queue_param_t; /** + * Packet output queue parameters + * + * These parameters are used only in ODP_PKTOUT_MODE_SEND mode. + */ +typedef struct odp_pktio_output_queue_param_t { + /** Enable performance optimization for single thread per queue + * 0: Queue is multi-thread safe, 1: Queue is for single thread */ + odp_bool_t single_thr; + + /** Number of output queues to be created. The value must be between + * 1 and interface capability */ + unsigned num_queues; + +} odp_pktio_output_queue_param_t; + +/** * Packet IO parameters * * In minimum, user must select input and output modes. Use 0 for defaults. @@ -241,6 +262,25 @@ int odp_pktio_input_queues_config(odp_pktio_t pktio, const odp_pktio_input_queue_param_t *param); /** + * Configure packet output queues + * + * Setup a number of packet output queues and configure those. The maximum + * number of queues is platform dependent and can be queried with + * odp_pktio_capability(). All requested queues are setup on success, no + * queues are setup on failure. + * + * @param pktio Packet IO handle + * @param param Packet output queue configuration parameters + * + * @retval 0 on success + * @retval <0 on failure + * + * @see odp_pktio_capability(), odp_pktio_pktout_queues() + */ +int odp_pktio_output_queues_config(odp_pktio_t pktio, + const odp_pktio_output_queue_param_t *param); + +/** * Queues for packet input * * Returns the number of input queues configured for the interface in @@ -282,6 +322,26 @@ int odp_pktio_pktin_queues(odp_pktio_t pktio, odp_pktin_queue_t queues[], int num); /** + * Direct packet output queues + * + * Returns the number of output queues configured for the interface in + * ODP_PKTOUT_MODE_SEND mode. Outputs up to 'num' queue handles when the + * 'queues' array pointer is not NULL. If return value is larger than 'num', + * there are more queues than the function was allowed to output. + * + * Packets are sent to these queues with odp_pktio_send_queue(). + * + * @param pktio Packet IO handle + * @param[out] queues Points to an array of queue handles for output + * @param num Maximum number of queue handles to output + * + * @return Number of packet output queues + * @retval <0 on failure + */ +int odp_pktio_pktout_queues(odp_pktio_t pktio, odp_pktout_queue_t queues[], + int num); + +/** * Start packet receive and transmit * * Activate packet receive and transmit on a previously opened or stopped @@ -567,6 +627,15 @@ void odp_pktio_param_init(odp_pktio_param_t *param); void odp_pktio_input_queue_param_init(odp_pktio_input_queue_param_t *param); /** + * Initialize packet output queue parameters + * + * Initialize an odp_pktio_output_queue_param_t to its default values. + * + * @param param Output queue parameter structure to be initialized + */ +void odp_pktio_output_queue_param_init(odp_pktio_output_queue_param_t *param); + +/** * Print pktio info to the console * * Print implementation-defined pktio debug information to the console. diff --git a/platform/linux-generic/include/odp/plat/packet_io_types.h b/platform/linux-generic/include/odp/plat/packet_io_types.h index 2e229c3..1086463 100644 --- a/platform/linux-generic/include/odp/plat/packet_io_types.h +++ b/platform/linux-generic/include/odp/plat/packet_io_types.h @@ -30,6 +30,8 @@ typedef ODP_HANDLE_T(odp_pktio_t); typedef ODP_HANDLE_T(odp_pktin_queue_t); +typedef ODP_HANDLE_T(odp_pktout_queue_t); + #define ODP_PKTIO_INVALID _odp_cast_scalar(odp_pktio_t, 0) #define ODP_PKTIO_ANY _odp_cast_scalar(odp_pktio_t, ~0) -- 2.6.2 _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
