On Fri, Nov 6, 2015 at 6:33 AM, Petri Savolainen <[email protected] > wrote:
> Added input queue configuration parameters and functions > to setup multiple input queue and hashing. Added also > odp_pktio_input_queues to query the number of queues > and queue handles. Direct receive does not use queue > handles, but indexes. > > Signed-off-by: Petri Savolainen <[email protected]> > --- > include/odp/api/packet_io.h | 88 > +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 88 insertions(+) > > diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h > index 264fa75..bb0e67c 100644 > --- a/include/odp/api/packet_io.h > +++ b/include/odp/api/packet_io.h > @@ -19,6 +19,7 @@ extern "C" { > #endif > > #include <odp/api/packet_io_stats.h> > +#include <odp/api/queue.h> > > /** @defgroup odp_packet_io ODP PACKET IO > * Operations on a packet Input/Output interface. > @@ -85,6 +86,43 @@ typedef enum odp_pktio_output_mode_t { > } odp_pktio_output_mode_t; > > /** > + * Packet input hash protocols > + * > + * The list of protocol header field combinations, which are included into > + * packet input hash calculation. > + */ > +typedef enum odp_pktin_hash_proto_t { > + /** IPv4 addresses and UDP port numbers, non-fragmented packets */ > + ODP_PKTIN_HASH_IPV4_UDP = 0, > + /** IPv4 addresses and TCP port numbers, non-fragmented packets */ > + ODP_PKTIN_HASH_IPV4_TCP > At minimum we need to add IPV6 variants for these. We cannot define new APIs that only support IPv4. IPv6 is an absolute OPNFV requirement. > +} odp_pktin_hash_proto_t; > + > +/** > + * Packet input queue parameters > + */ > +typedef struct odp_pktio_input_queue_param_t { > + /** Enable lock-free receive operation per queue > + * 0: Receive is multi-thread safe, 1: Receive is lock-free */ > + odp_bool_t lock_free; > + > + /** Select protocol fields used for hashing */ > + odp_pktin_hash_proto_t hash_proto; > + > + /** Number of input queues to be created. More than one input queue > + * require input hashing. Hash_proto is ignore when num_queues is > one. > + * The value must be between 1 and interface capability. Queue > type is > + * defined by the input mode. */ > + unsigned num_queues; > + > + /** Queue parameters for creating input queues in > ODP_PKTIN_MODE_POLL > + * or ODP_PKTIN_MODE_SCHED modes. Scheduler parameters are > considered > + * only in ODP_PKTIN_MODE_SCHED mode. */ > + odp_queue_param_t queue_param; > + > +} odp_pktio_input_queue_param_t; > + > +/** > * Packet IO parameters > * > * In minimum, user must select input and output modes. Use 0 for > defaults. > @@ -158,6 +196,47 @@ odp_pktio_t odp_pktio_open(const char *dev, > odp_pool_t pool, > int odp_pktio_capability(odp_pktio_t pktio, odp_pktio_capability_t *capa); > > /** > + * Configure packet input queues > + * > + * Setup a number of packet input queues and configure those. The maximum > number > + * of queues is platform dependent and can be queried with > + * odp_pktio_capability(). Queue handles for input queues can be > requested with > + * odp_pktio_input_queues() after this call. All requested queues are > setup on > + * success, no queues are setup on failure. > + * > + * @param pktio Packet IO handle > + * @param param Packet input queue configuration parameters > + * > + * @retval 0 on success > + * @retval <0 on failure > + * > + * @see odp_pktio_capability(), odp_pktio_input_queues() > + */ > +int odp_pktio_input_queues_config(odp_pktio_t pktio, > + const odp_pktio_input_queue_param_t > *param); > + > +/** > + * Packet input queues > + * > + * Returns the number of input queues configured for the interface. > Outputs also > + * up to 'num' queue handles created for ODP_PKTIN_MODE_POLL and > + * ODP_PKTIN_MODE_SCHED modes. If return value is larger than 'num', > there are > + * more queues than the function was allowed to output handles. > + * > + * Depending on the input mode, packets (or events) from these queues are > + * received using odp_pktio_recv_queue(), odp_queue_deq(), > odp_schedule(), etc > + * calls. > + * > + * @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 input queues > + * @retval <0 on failure > + */ > +int odp_pktio_input_queues(odp_pktio_t pktio, odp_queue_t queues[], int > num); > + > +/** > * Start packet receive and transmit > * > * Activate packet receive and transmit on a previously opened or stopped > @@ -411,6 +490,15 @@ uint64_t odp_pktio_to_u64(odp_pktio_t pktio); > void odp_pktio_param_init(odp_pktio_param_t *param); > > /** > + * Initialize packet input queue parameters > + * > + * Initialize an odp_pktio_input_queue_param_t to its default values. > + * > + * @param param Input queue parameter structure to be initialized > + */ > +void odp_pktio_input_queue_param_init(odp_pktio_input_queue_param_t > *param); > + > +/** > * Print pktio info to the console > * > * Print implementation-defined pktio debug information to the console. > -- > 2.6.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
