On Mon, Mar 30, 2015 at 12:23 PM, Petri Savolainen < [email protected]> wrote:
> API changes enable multiple packet input queues and control > hashing of incoming packets into those. Packet IO start and > stop were added to have more controlled packet IO setup phase. > > Signed-off-by: Petri Savolainen <[email protected]> > --- > include/odp/api/packet_io.h | 88 > ++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 87 insertions(+), 1 deletion(-) > > diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h > index d34041c..99a5d5d 100644 > --- a/include/odp/api/packet_io.h > +++ b/include/odp/api/packet_io.h > @@ -18,6 +18,9 @@ > extern "C" { > #endif > > +#include <odp/queue.h> > +#include <odp/schedule_types.h> > + > /** @defgroup odp_packet_io ODP PACKET IO > * Operations on a packet. > * @{ > @@ -58,11 +61,36 @@ enum odp_pktio_input_mode { > }; > > /** > + * Packet input queue hashing > + * > + * Input queue hashing algorithm is implementation specific. This > enumeration > + * selects the packet fields used in input queue hashing. Queue selection > is > + * implementation specific for packets missing the fields. > + */ > +enum odp_pktio_input_hash { > + /** No specific fields defined */ > + ODP_PKTIN_HASH_NONE = 0, > + /** IPv4/v6 addresses */ > + ODP_PKTIN_HASH_IP, > + /** UDP ports and IPv4/v6 addresses */ > + ODP_PKTIN_HASH_UDP_IP, > + /** TCP ports and IPv4/v6 addresses */ > + ODP_PKTIN_HASH_TCP_IP > Are these names intended to imply concatenation order for hashing? That is, UDP_IP means has on UDP port followed by IP address? If not then should these be ODP_PKTIN_IP_UDP, etc. to reflect the Layer 4 qualification to the Layer 3 hash? > +}; > + > +/** > * Packet IO parameters > + * > */ > typedef struct odp_pktio_param_t { > /** Packet input mode */ > enum odp_pktio_input_mode in_mode; > + /** Packet input queue hashing */ > + enum odp_pktio_input_hash in_hash; > + /** Number of input queues requested. Use 0 for default. */ > + uint32_t in_queues; > + /** Scheduler parameters for input queues */ > + odp_schedule_param_t sched; > } odp_pktio_param_t; > > /** > @@ -74,7 +102,19 @@ typedef struct odp_pktio_param_t { > * device. > * > * Packet IO parameters provide interface level configuration options. > - * In minimum, user must select the input mode. Use 0 for defaults. > + * User must select the input mode. ODP_PKTIN_MODE_RECV does not have > input > + * queues or support for classification, but application polls interface > + * directly. ODP_PKTIN_MODE_SCHED and _POLL modes have input queue(s) and > may > + * have classification enabled. Predefined input queue hashing options are > + * provided to spread incoming packets to queues. User can request a > number of > + * input queues, but odp_pktio_inq_count() returns number of queues > allocated > + * for the interface. User may create 1 to odp_pktio_inq_count() queues > with > + * odp_pktio_inq_create() before calling odp_pktio_start(). Queue type is > + * selected by the packet input mode. In case of ODP_PKTIN_MODE_SCHED, > input > + * queues share the schedule parameters. > + * > + * @note Queues may be added or removed (with odp_queue_destroy()) only > when > + * packet receive/transmit is not active. > * > * @param dev Packet IO device name > * @param pool Pool from which to allocate buffers for storing packets > @@ -92,6 +132,52 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t > pool, > const odp_pktio_param_t *param); > > /** > + * Create packet input queue > + * > + * Creates new input queue for the packet IO interface. Queue type (POLL > or > + * SCHED) is defined by the packet input mode parameter. The call returns > + * failure if maximum number of input queues is exceeded. > + * > + * Packet IO in ODP_PKTIN_MODE_RECV mode cannot have input queues. > + * > + * @param pktio Packet IO handle > + * @param name Queue name > + * > + * @return Queue handle > + * @retval ODP_QUEUE_INVALID on failure > + */ > +odp_queue_t odp_pktio_inq_create(odp_pktio_t pktio, const char *name); > + > +/** > + * Number of packet input queues > + * > + * @param pktio Packet IO handle > + * > + * @return Number of packet input queues > + */ > +uint32_t odp_pktio_inq_count(odp_pktio_t pktio); > + > +/** > + * Start packet receive and transmit > + * > + * @param pktio Packet IO handle > + * > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_pktio_start(odp_pktio_t pktio); > + > +/** > + * Stop packet receive and transmit > + * > + * @param pktio Packet IO handle > + * > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_pktio_stop(odp_pktio_t pktio); > + > +/** > * Close a packet IO interface > * > * @param pktio Packet IO handle > -- > 2.3.4 > > _______________________________________________ > 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
