> -----Original Message-----
> From: Bill Fischofer [mailto:bill.fischo...@linaro.org]
> Sent: Tuesday, October 17, 2017 2:59 PM
> To: Savolainen, Petri (Nokia - FI/Espoo) <petri.savolai...@nokia.com>
> Cc: lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [Linaro/odp] [PATCH API-NEXT v1] api: pool
> subparameters (#234)
> 
> On Tue, Oct 17, 2017 at 3:04 AM, Savolainen, Petri (Nokia - FI/Espoo)
> <petri.savolai...@nokia.com> wrote:
> >>  typedef struct odp_pool_param_t {
> >>         /** Pool type */
> >> @@ -192,17 +193,34 @@ typedef struct odp_pool_param_t {
> >>
> >>                 /** Parameters for packet pools */
> >>                 struct {
> >> -                       /** The number of packets that the pool must
> provide
> >> -                           that are packet length 'len' bytes or
> smaller.
> >> -                           The maximum value is defined by pool
> capability
> >> -                           pkt.max_num. */
> >> +                       /** Minimum number of 'len' byte packets.
> >> +                        *
> >> +                        *  The pool must contain at least this many
> packets
> >> +                        *  that are 'len' bytes or smaller. An
> implementation
> >> +                        *  may round up the value, as long as the
> 'max_num'
> >> +                        *  parameter below is not violated. The
> maximum value
> >> +                        *  for this field is defined by pool
> capability
> >> +                        *  pkt.max_num.
> >> +                        */
> >>                         uint32_t num;
> >>
> >> -                       /** Minimum packet length that the pool must
> provide
> >> -                           'num' packets. The number of packets may be
> less
> >> -                           than 'num' when packets are larger than
> 'len'.
> >> -                           The maximum value is defined by pool
> capability
> >> -                           pkt.max_len. Use 0 for default. */
> >> +                       /** Maximum number of packets.
> >> +                        *
> >> +                        *  This is the maximum number of packets of
> any length
> >> +                        *  that can be allocated from the pool. The
> maximum
> >> +                        *  value is defined by pool capability
> pkt.max_num.
> >> +                        *  Use 0 when there's no requirement for the
> maximum
> >> +                        *  number of packets. The default value is 0.
> >> +                        */
> >> +                       uint32_t max_num;
> >
> > I'd put max_num first so that num and len are adjacent parameters for
> > consistency with how the odp_pool_pkt_subparam_t is organized.
> >
> >
> > The logic is that num and max_num are close together, so are len and
> max_len (which does not show here, but follows len below).
> 
> Then putting max_num and max_len together first would make sense since
> they are the primary controls on the configuration. The individual num
> / len pairs that follow are the optimization advisory information.


Num and len are the primary controls. Max_num and max_len are optional (default 
== 0).

Now struct order is this ...

init(&p);
p.pkt.num     = 100;
p.pkt.max_num = 1000;
p.pkt.len     = 1500;
p.pkt.max_len = 9000;

... which is logical to me. If application does not define maximums, it's just:

init(&p);
p.pkt.num     = 100;
p.pkt.len     = 1500;


-Petri


Reply via email to