diff mbox series

[API-NEXT,v2,1/2] api: queue: added queue size param

Message ID 1490960803-6549-1-git-send-email-petri.savolainen@linaro.org
State Superseded
Headers show
Series [API-NEXT,v2,1/2] api: queue: added queue size param | expand

Commit Message

Petri Savolainen March 31, 2017, 11:46 a.m. UTC
Added capability information about maximum number of queues
and queue sizes. Both are defined per queue type, since
plain and scheduled queues may have different implementations
(e.g. one uses HW while the other is SW).

Added queue size parameter, which specifies how large
storage size application requires in minimum.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
 include/odp/api/spec/queue.h | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

-- 
2.8.1

Comments

Bill Fischofer March 31, 2017, 2:59 p.m. UTC | #1
On Fri, Mar 31, 2017 at 6:46 AM, Petri Savolainen
<petri.savolainen@linaro.org> wrote:
> Added capability information about maximum number of queues

> and queue sizes. Both are defined per queue type, since

> plain and scheduled queues may have different implementations

> (e.g. one uses HW while the other is SW).

>

> Added queue size parameter, which specifies how large

> storage size application requires in minimum.

>

> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

> ---

>  include/odp/api/spec/queue.h | 33 ++++++++++++++++++++++++++++++++-

>  1 file changed, 32 insertions(+), 1 deletion(-)

>

> diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h

> index 7972fea..55b7e44 100644

> --- a/include/odp/api/spec/queue.h

> +++ b/include/odp/api/spec/queue.h

> @@ -100,7 +100,7 @@ typedef enum odp_queue_op_mode_t {

>   * Queue capabilities

>   */

>  typedef struct odp_queue_capability_t {

> -       /** Maximum number of event queues */

> +       /** Maximum number of event queues of any type */


The documentation note that a value of zero means unlimited should be
included here, however this does raise a question of how we deal with
implementations where the max number of event queues is fixed (HW
limit) but the number of plain queues is unlimited since they are just
malloc'd.  Given this possibility, does a consolidated max_queues
value even make any sense since applications would always need to
double-check the individual queue type limits anyway?

>         uint32_t max_queues;

>

>         /** Maximum number of ordered locks per queue */

> @@ -112,6 +112,28 @@ typedef struct odp_queue_capability_t {

>         /** Number of scheduling priorities */

>         unsigned sched_prios;

>

> +       /** Plain queue capabilities */

> +       struct {

> +               /** Maximum number of a plain queues. */

> +               uint32_t max_num;

> +

> +               /** Maximum number of events a plain queue can store

> +                 * simultaneously. The value of zero means unlimited. */

> +               uint32_t max_size;

> +

> +       } plain;

> +

> +       /** Scheduled queue capabilities */

> +       struct {

> +               /** Maximum number of a scheduled queues. */

> +               uint32_t max_num;

> +

> +               /** Maximum number of events a scheduled queue can store

> +                 * simultaneously. The value of zero means unlimited. */

> +               uint32_t max_size;

> +

> +       } sched;

> +

>  } odp_queue_capability_t;

>

>  /**

> @@ -165,6 +187,15 @@ typedef struct odp_queue_param_t {

>           * The implementation may use this value as a hint for the number of

>           * context data bytes to prefetch. Default value is zero (no hint). */

>         uint32_t context_len;

> +

> +       /** Queue size

> +         *

> +         * The queue must be able to store in minimum this many events


grammar: at minimum

> +         * simultaneously. The value must not exceed 'max_size' queue

> +         * capability. The value of zero means implementation specific

> +         * default size. */

> +       uint32_t size;

> +

>  } odp_queue_param_t;

>

>  /**

> --

> 2.8.1

>
Savolainen, Petri (Nokia - FI/Espoo) April 3, 2017, 9:32 a.m. UTC | #2
> -----Original Message-----

> From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

> Sent: Friday, March 31, 2017 5:59 PM

> To: Petri Savolainen <petri.savolainen@linaro.org>

> Cc: lng-odp-forward <lng-odp@lists.linaro.org>

> Subject: Re: [lng-odp] [API-NEXT PATCH v2 1/2] api: queue: added queue

> size param

> 

> On Fri, Mar 31, 2017 at 6:46 AM, Petri Savolainen

> <petri.savolainen@linaro.org> wrote:

> > Added capability information about maximum number of queues

> > and queue sizes. Both are defined per queue type, since

> > plain and scheduled queues may have different implementations

> > (e.g. one uses HW while the other is SW).

> >

> > Added queue size parameter, which specifies how large

> > storage size application requires in minimum.

> >

> > Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

> > ---

> >  include/odp/api/spec/queue.h | 33 ++++++++++++++++++++++++++++++++-

> >  1 file changed, 32 insertions(+), 1 deletion(-)

> >

> > diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h

> > index 7972fea..55b7e44 100644

> > --- a/include/odp/api/spec/queue.h

> > +++ b/include/odp/api/spec/queue.h

> > @@ -100,7 +100,7 @@ typedef enum odp_queue_op_mode_t {

> >   * Queue capabilities

> >   */

> >  typedef struct odp_queue_capability_t {

> > -       /** Maximum number of event queues */

> > +       /** Maximum number of event queues of any type */

> 

> The documentation note that a value of zero means unlimited should be

> included here, however this does raise a question of how we deal with

> implementations where the max number of event queues is fixed (HW

> limit) but the number of plain queues is unlimited since they are just

> malloc'd.  Given this possibility, does a consolidated max_queues

> value even make any sense since applications would always need to

> double-check the individual queue type limits anyway?



Zero did not and still it does not indicate unlimited. I think in practice there will be some limit for each  resource (number of queues, pools, pktios, ...). For example, each queue needs to be able to store name, context pointer, etc metadata which consumes memory.

Number of events in a queue is different thing since e.g. a linked list implementation can link all events from all pools without additional overhead. Queue does not limit queue size, but pool does.

This can still be used to check how using one queue type limits the other. I'll add a sentence about that:

typedef struct odp_queue_capability_t {
	/** Maximum number of event queues of any type. Use this in addition to
	  * queue type specific 'max_num', if both queue types are used
	  * simultaneously. */
	uint32_t max_queues;


For example, if the same HW queue manager queues are used to implement both types ...

max_queues    == 100
plain.max_num == 100
sched.max_num == 100


... if two different implementations

max_queues    == 200
plain.max_num == 150
sched.max_num ==  50


> > +

> > +       /** Queue size

> > +         *

> > +         * The queue must be able to store in minimum this many events

> 

> grammar: at minimum


OK.

-Petri
diff mbox series

Patch

diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h
index 7972fea..55b7e44 100644
--- a/include/odp/api/spec/queue.h
+++ b/include/odp/api/spec/queue.h
@@ -100,7 +100,7 @@  typedef enum odp_queue_op_mode_t {
  * Queue capabilities
  */
 typedef struct odp_queue_capability_t {
-	/** Maximum number of event queues */
+	/** Maximum number of event queues of any type */
 	uint32_t max_queues;
 
 	/** Maximum number of ordered locks per queue */
@@ -112,6 +112,28 @@  typedef struct odp_queue_capability_t {
 	/** Number of scheduling priorities */
 	unsigned sched_prios;
 
+	/** Plain queue capabilities */
+	struct {
+		/** Maximum number of a plain queues. */
+		uint32_t max_num;
+
+		/** Maximum number of events a plain queue can store
+		  * simultaneously. The value of zero means unlimited. */
+		uint32_t max_size;
+
+	} plain;
+
+	/** Scheduled queue capabilities */
+	struct {
+		/** Maximum number of a scheduled queues. */
+		uint32_t max_num;
+
+		/** Maximum number of events a scheduled queue can store
+		  * simultaneously. The value of zero means unlimited. */
+		uint32_t max_size;
+
+	} sched;
+
 } odp_queue_capability_t;
 
 /**
@@ -165,6 +187,15 @@  typedef struct odp_queue_param_t {
 	  * The implementation may use this value as a hint for the number of
 	  * context data bytes to prefetch. Default value is zero (no hint). */
 	uint32_t context_len;
+
+	/** Queue size
+	  *
+	  * The queue must be able to store in minimum this many events
+	  * simultaneously. The value must not exceed 'max_size' queue
+	  * capability. The value of zero means implementation specific
+	  * default size. */
+	uint32_t size;
+
 } odp_queue_param_t;
 
 /**