Re: [lng-odp] [API-NEXT PATCH v2 00/16] A scalable software scheduler

2017-04-06 Thread Jerin Jacob
-Original Message-
> Date: Thu, 6 Apr 2017 12:54:10 +0200
> From: Ola Liljedahl 
> To: Brian Brooks 
> Cc: Jerin Jacob ,
>  "lng-odp@lists.linaro.org" 
> Subject: Re: [lng-odp] [API-NEXT PATCH v2 00/16] A scalable software
>  scheduler
> 
> On 5 April 2017 at 18:50, Brian Brooks  wrote:
> > On 04/05 21:27:37, Jerin Jacob wrote:
> >> -Original Message-
> >> > Date: Tue, 4 Apr 2017 13:47:52 -0500
> >> > From: Brian Brooks 
> >> > To: lng-odp@lists.linaro.org
> >> > Subject: [lng-odp] [API-NEXT PATCH v2 00/16] A scalable software 
> >> > scheduler
> >> > X-Mailer: git-send-email 2.12.2
> >> >
> >> > This work derives from Ola Liljedahl's prototype [1] which introduced a
> >> > scalable scheduler design based on primarily lock-free algorithms and
> >> > data structures designed to decrease contention. A thread searches
> >> > through a data structure containing only queues that are both non-empty
> >> > and allowed to be scheduled to that thread. Strict priority scheduling is
> >> > respected, and (W)RR scheduling may be used within queues of the same 
> >> > priority.
> >> > Lastly, pre-scheduling or stashing is not employed since it is optional
> >> > functionality that can be implemented in the application.
> >> >
> >> > In addition to scalable ring buffers, the algorithm also uses unbounded
> >> > concurrent queues. LL/SC and CAS variants exist in cases where absense of
> >> > ABA problem cannot be proved, and also in cases where the compiler's 
> >> > atomic
> >> > built-ins may not be lowered to the desired instruction(s). Finally, a 
> >> > version
> >> > of the algorithm that uses locks is also provided.
> >> >
> >> > See platform/linux-generic/include/odp_config_internal.h for further 
> >> > build
> >> > time configuration.
> >> >
> >> > Use --enable-schedule-scalable to conditionally compile this scheduler
> >> > into the library.
> >>
> >> This is an interesting stuff.
> >>
> >> Do you have any performance/latency numbers in comparison to exiting 
> >> scheduler
> >> for completing say two stage(ORDERED->ATOMIC) or N stage pipeline on any 
> >> platform?
> It is still a SW implementation, there is overhead accessed with queue
> enqueue/dequeue and the scheduling itself.
> So for an N-stage pipeline, overhead will accumulate.
> If only a subset of threads are associated with each stage (this could
> be beneficial for I-cache hit rate), there will be less need for
> scalability.
> What is the recommended strategy here for OCTEON/ThunderX?

In the view of portable event driven applications(Works on both
embedded and server capable chips), the SW schedule is an important piece.

> All threads/cores share all work?

That is the recommend one in HW as it supports nativity. But HW provides
means to partition the work load based on odp schedule groups


> 
> >
> > To give an idea, the avg latency reported by odp_sched_latency is down to 
> > half
> > that of other schedulers (pre-scheduling/stashing disabled) on 4c A53, 16c 
> > A57,
> > and 12c broadwell. We are still preparing numbers, and I think it's worth 
> > mentioning
> > that they are subject to change as this patch series changes over time.
> >
> > I am not aware of an existing benchmark that involves switching between 
> > different
> > queue types. Perhaps this is happening in an example app?
> This could be useful in e.g. IPsec termination. Use an atomic stage
> for the replay protection check and update. Now ODP has ordered locks
> for that so the "atomic" (exclusive) section can be achieved from an
> ordered processing stage. Perhaps Jerin knows some other application
> that utilises two-stage ORDERED->ATOMIC processing.

We see ORDERED->ATOMIC as main use case for basic packet forward.Stage
1(ORDERED) to process on N cores and Stage2(ATOMIC) to maintain the ingress
order.


> 
> >
> >> When we say scalable scheduler, What application/means used to quantify
> >> scalablity??
> It starts with the design, use non-blocking data structures and try to
> distribute data to threads so that they do not access shared data very
> often. Some of this is a little detrimental to single-threaded
> performance, you need to use more atomic operations. It seems to work
> well on ARM (A53, A57) though, the penalty is higher on x86 (x86 is
> very good with spin locks, cmpxc

Re: [lng-odp] [API-NEXT PATCH v2 00/16] A scalable software scheduler

2017-04-05 Thread Jerin Jacob
-Original Message-
> Date: Tue, 4 Apr 2017 13:47:52 -0500
> From: Brian Brooks 
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCH v2 00/16] A scalable software scheduler
> X-Mailer: git-send-email 2.12.2
> 
> This work derives from Ola Liljedahl's prototype [1] which introduced a
> scalable scheduler design based on primarily lock-free algorithms and
> data structures designed to decrease contention. A thread searches
> through a data structure containing only queues that are both non-empty
> and allowed to be scheduled to that thread. Strict priority scheduling is
> respected, and (W)RR scheduling may be used within queues of the same 
> priority.
> Lastly, pre-scheduling or stashing is not employed since it is optional
> functionality that can be implemented in the application.
> 
> In addition to scalable ring buffers, the algorithm also uses unbounded
> concurrent queues. LL/SC and CAS variants exist in cases where absense of
> ABA problem cannot be proved, and also in cases where the compiler's atomic
> built-ins may not be lowered to the desired instruction(s). Finally, a version
> of the algorithm that uses locks is also provided.
> 
> See platform/linux-generic/include/odp_config_internal.h for further build
> time configuration.
> 
> Use --enable-schedule-scalable to conditionally compile this scheduler
> into the library.

This is an interesting stuff.

Do you have any performance/latency numbers in comparison to exiting scheduler
for completing say two stage(ORDERED->ATOMIC) or N stage pipeline on any 
platform?

When we say scalable scheduler, What application/means used to quantify
scalablity??
Do you have any numbers in comparison to existing scheduler to show
magnitude of the scalablity on any platform?



Re: [lng-odp] thread/shmem discussion summary V4

2016-06-09 Thread Jerin Jacob
On Thu, Jun 09, 2016 at 03:20:23PM +0200, Christophe Milard wrote:
> Yes, we do have name lookup functions to get handles, but I cannot see
> what would make these the only way to retrieve handles from ODP.
> Why couldn't your first process send the handle to the second process
> via another IPC, e.g. unix sockets, signaling, message passing or even
> writing/reading to a file?
> My point is: Do you agree that an ODP handle for a given ODP object is
> unique within an ODP instance, meaning that if a thread B gets the
> handle from process A, regardless of how, B will be able to use that
> handle...
>  Or
> Do you think that your lookup functions could return 2 differents
> handles in 2 different threads (for the same ODP object name), meaning
> that the scope of the handle is actually the ODP thread.?

Two different process may return 2 different handles for a physical
resource on multiprocess environment. Portable applications should
not send the "handles" in some other means to other process(like IPC)
and access it.Instead, use lookup API to get the handle in other process
for a given odp resource.

Jerin

> 
> Thanks,
> 
> Christophe.
> 
> On 9 June 2016 at 14:54, Jerin Jacob  wrote:
> > On Thu, Jun 09, 2016 at 02:13:49PM +0200, Christophe Milard wrote:
> >> Bill:
> >> S19: When you write:"These addresses are intended to be used within
> >> the scope of the calling thread and should not be assumed to have any
> >> validity outside of that context", do you really mean this, regardless
> >> on how ODP threads are implemented?
> >>
> >> Jerrin:
> >> S18: your answer to S18 is confusing me. see my returned question in
> >> the doc. please answer it :-)
> >
> > |Christophe to Jerin: if 2 different ODP threads are expected to retrieve
> > |each its own handle
> > |via lookup calls, aren't you saying that handles are NOT valid over the
> > |whole ODP
> > |instance? If you are just saying that ODP may provide additional APIs to
> > |retrieve handles,
> > |then fine, as long as the usage of this APIs is optionnal and passing
> > |the handles via IPC is as good
> >
> > We do have ODP API for the name to handle lookup. For instance a _true_
> > multi-process ODP implementation(i.e Second process NOT derived from first
> > process(two ODP process started at two terminals on different cores),
> > one as primary and other one secondary). In those cases only way to
> > share the handles is through ODP lookup API)
> >
> > Jerin
> >
> >>
> >> All: I have updated the doc with a summary table and the comments from
> >> Jon Rosen. Please, check that What I wrote matches what you think.
> >>
> >> I have also added a list of possible behaviour (numbered A to F) for
> >> S19. Can you read these and pick your choice? If none of these
> >> alternative match your choice, please add your description.
> >>
> >> Christophe
> >>
> >> On 9 June 2016 at 02:53, Bill Fischofer  wrote:
> >> >
> >> >
> >> > On Wed, Jun 8, 2016 at 10:54 AM, Yi He  wrote:
> >> >>
> >> >> Hi, Christophe and team
> >> >>
> >> >> For the shmem part:
> >> >>
> >> >> S18: yes
> >> >> S19, S20: I agree with Bill's comments are very accurate and formalized.
> >> >>
> >> >> S21: to cover the case shm addresses(pointers) passed within data
> >> >> structure
> >> >>
> >> >> especially think of cases:
> >> >> 3) Context pointer getters (odp_queue_context(),
> >> >> odp_packet_user_ptr(), odp_timeout_user_ptr(),
> >> >> odp_tm_node_context(), odp_tm_queue_context(), and
> >> >> I agree with the solution, only feel it may meet difficulties
> >> >> in runtime:
> >> >>
> >> >> According to man page:
> >> >> Using shmat() with shmaddr equal to NULL is the preferred,
> >> >> portable way of attaching a shared memory segment. Be aware
> >> >> that the shared memory segment attached in this way may be
> >> >> attached at different addresses in different processes.
> >> >> Therefore, any pointers maintained within the shared memory
> >> >> must be made relative (typically to the starting address of
> >> >> the segment), rather than absolute.
> >> >> I found an alternate sweetheart only available in Windows,
> >> >> called based pointers (C++)

Re: [lng-odp] thread/shmem discussion summary V4

2016-06-09 Thread Jerin Jacob
On Thu, Jun 09, 2016 at 02:13:49PM +0200, Christophe Milard wrote:
> Bill:
> S19: When you write:"These addresses are intended to be used within
> the scope of the calling thread and should not be assumed to have any
> validity outside of that context", do you really mean this, regardless
> on how ODP threads are implemented?
> 
> Jerrin:
> S18: your answer to S18 is confusing me. see my returned question in
> the doc. please answer it :-)

|Christophe to Jerin: if 2 different ODP threads are expected to retrieve
|each its own handle
|via lookup calls, aren't you saying that handles are NOT valid over the
|whole ODP
|instance? If you are just saying that ODP may provide additional APIs to
|retrieve handles,
|then fine, as long as the usage of this APIs is optionnal and passing
|the handles via IPC is as good

We do have ODP API for the name to handle lookup. For instance a _true_
multi-process ODP implementation(i.e Second process NOT derived from first
process(two ODP process started at two terminals on different cores),
one as primary and other one secondary). In those cases only way to
share the handles is through ODP lookup API)

Jerin

> 
> All: I have updated the doc with a summary table and the comments from
> Jon Rosen. Please, check that What I wrote matches what you think.
> 
> I have also added a list of possible behaviour (numbered A to F) for
> S19. Can you read these and pick your choice? If none of these
> alternative match your choice, please add your description.
> 
> Christophe
> 
> On 9 June 2016 at 02:53, Bill Fischofer  wrote:
> >
> >
> > On Wed, Jun 8, 2016 at 10:54 AM, Yi He  wrote:
> >>
> >> Hi, Christophe and team
> >>
> >> For the shmem part:
> >>
> >> S18: yes
> >> S19, S20: I agree with Bill's comments are very accurate and formalized.
> >>
> >> S21: to cover the case shm addresses(pointers) passed within data
> >> structure
> >>
> >> especially think of cases:
> >> 3) Context pointer getters (odp_queue_context(),
> >> odp_packet_user_ptr(), odp_timeout_user_ptr(),
> >> odp_tm_node_context(), odp_tm_queue_context(), and
> >> I agree with the solution, only feel it may meet difficulties
> >> in runtime:
> >>
> >> According to man page:
> >> Using shmat() with shmaddr equal to NULL is the preferred,
> >> portable way of attaching a shared memory segment. Be aware
> >> that the shared memory segment attached in this way may be
> >> attached at different addresses in different processes.
> >> Therefore, any pointers maintained within the shared memory
> >> must be made relative (typically to the starting address of
> >> the segment), rather than absolute.
> >> I found an alternate sweetheart only available in Windows,
> >> called based pointers (C++)
> >> https://msdn.microsoft.com/en-us/library/57a97k4e.aspx
> >>
> >> Maybe we can spent some time to look for a counterpart in
> >> std C world, that will be perfect.
> >
> >
> > For students of programming history, or those old enough to remember, the
> > concept of BASED storage originated in the (now ancient) programming
> > language PL/I. Pointers to BASED storage were stored as offsets and the
> > compiler automatically handled the relative addressing. They are very
> > convenient for this sort of purpose.
> >
> >>
> >>
> >> S23: agree with Bill's comments covered the cases.
> >>
> >> Thanks and best regards, Yi
> >>
> >> On 8 June 2016 at 17:04, Christophe Milard 
> >> wrote:
> >>>
> >>> OK. good that you agree (and please update the shared doc so it
> >>> becomes the central point of information).
> >>> There is something I like though, in your willingness to decouple the
> >>> function and the pinning...
> >>> Even if I am not sure this can be enforced by ODP at all time (as
> >>> already stated), there is definitively a point in helping the
> >>> application that with to do so. So please keep an eye on that!
> >>>
> >>> Your opinion on S19 S20 and S21 would be very welcome as well... This
> >>> is the main hurting point
> >>>
> >>> Christophe
> >>>
> >>> On 8 June 2016 at 09:41, Yi He  wrote:
> >>> > Hi, thanks Christophe and happy to discuss with and learn from team in
> >>> > yesterday's ARCH call :)
> >>> >
> >>> > The question which triggers this kind of thinking is: how to use ODP as
> >>> > a
> >>> > framework to produce re-usable building blocks to compose "Network
> >>> > Function
> >>> > Instance" in runtime, since until runtime it will prepare resources for
> >>> > function to settle down, thus comes the thought of seperating function
> >>> > implementation and launching.
> >>> >
> >>> > I agree your point it seems upper layer consideration, I'll have some
> >>> > time
> >>> > to gain deeper understanding and knowledge on how upstair playings,
> >>> > thus I
> >>> > agree to the current S11, S12, S13, S14, S15, S16, S17 approach and we
> >>> > can
> >>> > revisit if really realized upper layer programming practise/model
> >>> > affects
> >>> > ODP's design in this aspect.
> >>> >
> >>> > Best Regards, Yi
> >>> >

Re: [lng-odp] thread/shmem discussion summary V4

2016-06-08 Thread Jerin Jacob
On Fri, Jun 03, 2016 at 11:15:43AM +0200, Christophe Milard wrote:
> since V3: Update following Bill's comments
> since V2: Update following Barry and Bill's comments
> since V1: Update following arch call 31 may 2016
> 
> This is a tentative to sum up the discussions around the thread/process
> that have been happening these last weeks.
> Sorry for the formalism of this mail, but it seems we need accuracy
> here...
> 
> This summary is organized as follows:
> 
> It is a set of statements, each of them expecting a separate answer
> from you. When no specific ODP version is specified, the statement
> regards the"ultimate" goal (i.e what we want eventually to achieve).
> Each statement is prefixed with:
>   - a statement number for further reference (e.g. S1)
>   - a status word (one of 'agreed' or 'open', or 'closed').
> Agreed statements expect a yes/no answers: 'yes' meaning that you
> acknowledge that this is your understanding of the agreement and will
> not nack an implementation based on this statement. You can comment
> after a yes, but your comment will not block any implementation based
> on the agreed statement. A 'no' implies that the statement does not
> reflect your understanding of the agreement, or you refuse the
> proposal.
> Any 'no' received on an 'agreed' statement will push it back as 'open'.
> Open statements are fully open for further discussion.
> 
> S1  -agreed: an ODP thread is an OS/platform concurrent execution
> environment object (as opposed to an ODP objects). No more specific
> definition is given by the ODP API itself.
> 
> Barry: YES
> Bill: Yes

Jerin: Yes

> 
> ---
> 
> S2  -agreed: Each ODP implementation must tell what is allowed to be
> used as ODP thread for that specific implementation: a linux-based
> implementation, for instance, will have to state whether odp threads
> can be linux pthread, linux processes, or both, or any other type of
> concurrent execution environment. ODP implementations can put any
> restriction they wish on what an ODP thread is allowed to be. This
> should be documented in the ODP implementation documentation.
> 
> Barry: YES
> Bill: Yes

Jerin: Yes, Apart from Linux process or thread based implementation, an
implementation may select to have bare-metal execution environment(i.e
without any OS)

> 
> ---
> 
> S3  -agreed: in the linux generic ODP implementation a odpthread will be
> either:
> * a linux process descendant (or same as) the odp instantiation
> process.
> * a pthread 'member' of a linux process descendant (or same
> as) the odp instantiation process.
> 
> Barry: YES
> Bill: Yes
> 
> ---
> 
> S4  -agreed: For monarch, the linux generic ODP implementation only
> supports odp thread as pthread member of the instantiation process.
> 
> Barry: YES
> Bill: Yes
> 
> ---
> 
> S5  -agreed: whether multiple instances of ODP can be run on the same
> machine is left as a implementation decision. The ODP implementation
> document should state what is supported and any restriction is allowed.
> 
> Barry: YES
> Bill: Yes

Jerin: Yes

> 
> ---
> 
> S6  -agreed: The l-g odp implementation will support multiple odp
> instances whose instantiation processes are different and not
> ancestor/descendant of each others. Different instances of ODP will,
> of course, be restricted in sharing common OS ressources (The total
> amount of memory available for each ODP instances may decrease as the
> number of instances increases, the access to network interfaces will
> probably be granted to the first instance grabbing the interface and
> denied to others... some other rule may apply when sharing other
> common ODP ressources.)
> 
> Bill: Yes
> 
> ---
> 
> S7  -agreed: the l-g odp implementation will not support multiple ODP
> instances initiated from the same linux process (calling
> odp_init_global() multiple times).
> As an illustration, This means that a single process P is not allowed
> to execute the following calls (in any order)
> instance1 = odp_init_global()
> instance2 = odp_init_global()
> pthread_create (and, in that thread, run odp_local_init(instance1) )
> pthread_create (and, in that thread, run odp_local_init(instance2) )
> 
> Bill: Yes
> 
> ---
> 
> S8  -agreed: the l-g odp implementation will not support multiple ODP
> instances initiated from related linux processes (descendant/ancestor
> of each other), hence enabling ODP 'sub-instance'? As an illustration,
> this means that the following is not supported:
> instance1 = odp_init_global()
> pthread_create (and, in that thread, run odp_local_init(instance1) )
> if (fork()==0) {
> instance2 = odp_init_global()
> pthread_create (and, in that thread, run odp_local_init(instance2) )
> }
> 
> Bill: Yes
> 
> 
> 
> S9  -agreed: the odp instance passed as parameter to odp_local_init()
> must alwa

Re: [lng-odp] [API-NEXT PATCHv2 2/4] api: cpu: add routines for obtaining socket ids

2016-03-28 Thread Jerin Jacob
On Mon, Mar 28, 2016 at 06:41:29PM +0300, Maxim Uvarov wrote:
> Jerin,  do you thin that we need both?

Both are requried. But not sure about invoking odp_pktio_socket_id()
before odp_pktio_open is the correct approach or not ?(as mentioed
earlier in the mail).

How about other devices in the framework, queue, crypto etc?

>
> Maxim.
>
> On 03/24/16 14:10, Bill Fischofer wrote:
> >Thanks, Jerin.  So is an odp_cpu_socket_id() function not interesting to
> >you and odp_pktio_socket_id() is what's wanted/needed?  Or are you saying
> >we should have both?
> >
> >On Thu, Mar 24, 2016 at 2:32 AM, Jerin Jacob
> >mailto:jerin.ja...@caviumnetworks.com>>
> >wrote:
> >
> >On Thu, Mar 24, 2016 at 01:46:44AM +0200, Nikolay Nikolaev wrote:
> >> On Thu, Mar 24, 2016 at 12:19 AM, Bill Fischofer
> >> mailto:bill.fischo...@linaro.org>>
> >wrote:
> >> >
> >> > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines
> >>
> >> I wonder how those are going to be implemented on non-NUMA systems
> >> like ThunderX?
> >
> >I think you meant NUMA platform like ThunderX.
> >
> >From HW perspective, any resources which explicitly connected by ODP
> >application (like passing odp_pool_t in odp_pktio_open)
> >should be on the same node for the optimal performance.
> >
> >IMO, We should have "get socked id" function to know where the
> >pktio is
> >physically connected up and then connect the resource chain from the
> >application.
> >
> >But the issue here is that application need to know the pktio
> >socket id
> >without opening it.
> >
> >something like below in HW perspective.
> >
> >socket_id = odp_pktio_socket_id()
> >pool = odp_pool_create(socket_id...)
> >pktio = odp_pktio_open(pool)
> >
> >and to make sure to run odp_pktin_recv() on the socket_id which
> >was created earlier.
> >
> >Jerin
> >
> >> Jerin do you have any comments here?
> >>
> >> regards,
> >> Nikolay Nikolaev
> >>
> >> >
> >> >
> >> > Signed-off-by: Bill Fischofer  ><mailto:bill.fischo...@linaro.org>>
> >> > ---
> >> >  include/odp/api/spec/cpu.h | 25 +
> >> >  1 file changed, 25 insertions(+)
> >> >
> >> > diff --git a/include/odp/api/spec/cpu.h
> >b/include/odp/api/spec/cpu.h
> >> > index f0e20c4..d383c3b 100644
> >> > --- a/include/odp/api/spec/cpu.h
> >> > +++ b/include/odp/api/spec/cpu.h
> >> > @@ -36,6 +36,31 @@ extern "C" {
> >> >  int odp_cpu_id(void);
> >> >
> >> >  /**
> >> > + * CPU socket id
> >> > + *
> >> > + * Returns the socket id associated with the calling CPU on
> >NUMA systems.
> >> > + * Socket ID numbering is system specific.
> >> > + *
> >> > + * @return Socket ID of the calling CPU
> >> > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on
> >a NUMA system.
> >> > + */
> >> > +uint32_t odp_cpu_socket_id(void);
> >> > +
> >> > +/**
> >> > + * CPU socket id of designated CPU
> >> > + *
> >> > + * Returns the socket id associated with a specific CPU on
> >NUMA systems.
> >> > + * Socket ID numbering is system specific.
> >> > + *
> >> > + * @param cpu_id ID of the CPU for which socket ID
> >information is requested.
> >> > + *
> >> > + * @return Socket ID of the designated CPU
> >> > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown
> >or caller is
> >> > + *   not running on a NUMA system.
> >> > + */
> >> > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);
> >> > +
> >> > +/**
> >> >   * CPU count
> >> >   *
> >> >   * Report the number of CPU's available to this ODP program.
> >> > --
> >> > 2.5.0
> >> >
> >> > ___
> >> > lng-odp mailing list
> >> > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
> >> > https://lists.linaro.org/mailman/listinfo/lng-odp
> >
> >
> >
> >
> >___
> >lng-odp mailing list
> >lng-odp@lists.linaro.org
> >https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv2 2/4] api: cpu: add routines for obtaining socket ids

2016-03-24 Thread Jerin Jacob
On Thu, Mar 24, 2016 at 01:46:44AM +0200, Nikolay Nikolaev wrote:
> On Thu, Mar 24, 2016 at 12:19 AM, Bill Fischofer
>  wrote:
> >
> > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines
> 
> I wonder how those are going to be implemented on non-NUMA systems
> like ThunderX?

I think you meant NUMA platform like ThunderX.

From HW perspective, any resources which explicitly connected by ODP
application (like passing odp_pool_t in odp_pktio_open)
should be on the same node for the optimal performance.

IMO, We should have "get socked id" function to know where the pktio is
physically connected up and then connect the resource chain from the
application.

But the issue here is that application need to know the pktio socket id
without opening it.

something like below in HW perspective.

socket_id = odp_pktio_socket_id()
pool = odp_pool_create(socket_id...)
pktio = odp_pktio_open(pool)

and to make sure to run odp_pktin_recv() on the socket_id which
was created earlier.

Jerin

> Jerin do you have any comments here?
> 
> regards,
> Nikolay Nikolaev
> 
> >
> >
> > Signed-off-by: Bill Fischofer 
> > ---
> >  include/odp/api/spec/cpu.h | 25 +
> >  1 file changed, 25 insertions(+)
> >
> > diff --git a/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h
> > index f0e20c4..d383c3b 100644
> > --- a/include/odp/api/spec/cpu.h
> > +++ b/include/odp/api/spec/cpu.h
> > @@ -36,6 +36,31 @@ extern "C" {
> >  int odp_cpu_id(void);
> >
> >  /**
> > + * CPU socket id
> > + *
> > + * Returns the socket id associated with the calling CPU on NUMA systems.
> > + * Socket ID numbering is system specific.
> > + *
> > + * @return Socket ID of the calling CPU
> > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on a NUMA system.
> > + */
> > +uint32_t odp_cpu_socket_id(void);
> > +
> > +/**
> > + * CPU socket id of designated CPU
> > + *
> > + * Returns the socket id associated with a specific CPU on NUMA systems.
> > + * Socket ID numbering is system specific.
> > + *
> > + * @param cpu_id ID of the CPU for which socket ID information is 
> > requested.
> > + *
> > + * @return Socket ID of the designated CPU
> > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown or caller is
> > + *   not running on a NUMA system.
> > + */
> > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);
> > +
> > +/**
> >   * CPU count
> >   *
> >   * Report the number of CPU's available to this ODP program.
> > --
> > 2.5.0
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH] api: clib: added standard c library api

2015-10-19 Thread Jerin Jacob
On Fri, Oct 16, 2015 at 03:13:48PM +0300, Petri Savolainen wrote:
> Some C library calls are often used in data plane code. This
> API enables possibility to HW optimized implementation of those.
> Added first memcpy and memset.
> 
> Signed-off-by: Petri Savolainen 

Reviewed-by: Jerin Jacob 

> ---
>  include/odp.h |  1 +
>  include/odp/api/std_clib.h| 64 
> +++
>  platform/linux-generic/Makefile.am|  2 +
>  platform/linux-generic/include/odp/std_clib.h | 30 +
>  4 files changed, 97 insertions(+)
>  create mode 100644 include/odp/api/std_clib.h
>  create mode 100644 platform/linux-generic/include/odp/std_clib.h
> 
> diff --git a/include/odp.h b/include/odp.h
> index 825c7e1..f2cd2d3 100644
> --- a/include/odp.h
> +++ b/include/odp.h
> @@ -56,6 +56,7 @@ extern "C" {
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #ifdef __cplusplus
>  }
> diff --git a/include/odp/api/std_clib.h b/include/odp/api/std_clib.h
> new file mode 100644
> index 000..2119ec4
> --- /dev/null
> +++ b/include/odp/api/std_clib.h
> @@ -0,0 +1,64 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP version of often used C library calls
> + */
> +
> +#ifndef ODP_API_STD_CLIB_H_
> +#define ODP_API_STD_CLIB_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * @defgroup odp_std_clib ODP STD CLIB
> + * @details
> + * ODP version of often used C library calls
> + * @{
> + */
> +
> +/**
> + * Memcpy
> + *
> + * ODP version of C library memcpy function. It copies 'num' bytes from 
> source
> + * to destination address. Source and destination memory blocks must not
> + * overlap.
> + *
> + * @param dstPointer to destination memory block
> + * @param srcPointer to source memory block
> + * @param numNumber of bytes to copy
> + *
> + * @return 'dst' address
> + */
> +void *odp_memcpy(void *dst, const void *src, size_t num);
> +
> +/**
> + * Memset
> + *
> + * ODP version of C library memset function. It sets 'value' to first 'num'
> + * bytes of memory block pointed by 'ptr'.
> + *
> + * @param ptrPointer to the memory block
> + * @param value  Value to be set
> + * @param numNumber of bytes to set
> + *
> + * @return 'ptr' address
> + */
> +void *odp_memset(void *ptr, int value, size_t num);
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/Makefile.am 
> b/platform/linux-generic/Makefile.am
> index 85c976d..fc202cc 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -41,6 +41,7 @@ odpinclude_HEADERS = \
> $(srcdir)/include/odp/shared_memory.h \
> $(srcdir)/include/odp/spinlock.h \
> $(srcdir)/include/odp/spinlock_recursive.h \
> +   $(srcdir)/include/odp/std_clib.h \
> $(srcdir)/include/odp/std_types.h \
> $(srcdir)/include/odp/sync.h \
> $(srcdir)/include/odp/system_info.h \
> @@ -108,6 +109,7 @@ odpapiinclude_HEADERS = \
> $(top_srcdir)/include/odp/api/shared_memory.h \
> $(top_srcdir)/include/odp/api/spinlock.h \
> $(top_srcdir)/include/odp/api/spinlock_recursive.h \
> +   $(top_srcdir)/include/odp/api/std_clib.h \
> $(top_srcdir)/include/odp/api/std_types.h \
> $(top_srcdir)/include/odp/api/sync.h \
> $(top_srcdir)/include/odp/api/system_info.h \
> diff --git a/platform/linux-generic/include/odp/std_clib.h 
> b/platform/linux-generic/include/odp/std_clib.h
> new file mode 100644
> index 000..c939c48
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/std_clib.h
> @@ -0,0 +1,30 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#ifndef ODP_PLAT_STD_CLIB_H_
> +#define ODP_PLAT_STD_CLIB_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +
> +static inline void *odp_memcpy(void *dst, const void *src, size_t num)
> +{
> + return memcpy(dst, src, num);
> +}
> +
> +static inline void *odp_memset(void *ptr, int value, size_t num)
> +{
> + return memset(ptr, value, num);
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> -- 
> 2.6.0
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH v3 1/3] api: packet: allow access to packet RSS hash values

2015-08-20 Thread Jerin Jacob
On Thu, Aug 20, 2015 at 03:20:46PM +0100, Zoltan Kiss wrote:
> Hi,
> 
> On 20/08/15 11:53, Jerin Jacob wrote:
> >How about following change in OVS plarform specific packet_get_hash code.
> >odp_packet_rss_hash_set
> >kind of interface wont fit correctly in octeon  platform as hash
> >identifier used by hardware in subsequent HW based queue operations
> >
> >static inline uint32_t
> >packet_get_hash(struct dp_packet *p)
> >{
> >#ifdef DPDK_NETDEV
> > return p->mbuf.hash.rss;
> >#else
> >#ifdef ODP_NETDEV
> > unit32_t hash;
> > hash = odp_packet_rss_hash(p->odp_pkt);
> > if (OVS_UNLIKELY(!hash)
> > hash = odp_packet_generate_rss_hash(p->odp_pkt);
> > return hash;
> >#endif
> > return p->rss_hash;
> >#endif
> >}
> 
> I was thinking about this too, but I see two problems:
> 
> 1. OVS changes the hash if the packet is currently recirculated:
> 
> https://github.com/openvswitch/ovs/blob/master/lib/dpif-netdev.c#L3125
> 
> And as far as I can see, it doesn't recalculate the hash when the
> recirculation is finished. So the final hash of the packet at the end won't
> be what the platform would generate. OVS doesn't seem to care about it, I
> think the assumption is that the platform won't use this hash anymore, and
> it's role is finished after matching in EMC.
> My first idea to sort this out is to check for recirculation depth in
> netdev_send(), before the send of course. If it's true, then we can
> regenerate the hash using odp_packet_generate_rss_hash()

if its not true then other option could be to hold additional data in
ODP meta data.

> 
> 2. Minor thing, but if the platform is only able to do this from software
> (like DPDK), it should better be as fast as OVS's hashing at least. OVS uses
> CRC32 on SSE4 x64 CPUs, and Murmurhash on others. I don't know how do they

DPDK do have low level HW accelerated API's for crc 4 and 8 bytes.
Implementing 5 tuple based on CRC on ODP-DPDK port will NOT be be any issue.
And armv8 also has advanced SIMD instruction for CRC 8,4,2 and 1 bytes

> compare e.g. with Toeplitz, but I guess they choose them because they are
> more suitable for the purpose.

I guess RSS hash algorithm used Intel nic is Toeplitz to get good
packet distribution using RSS(not for lookup)




___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH v3 1/3] api: packet: allow access to packet RSS hash values

2015-08-20 Thread Jerin Jacob
On Thu, Aug 20, 2015 at 04:52:29PM +0530, Santosh Shukla wrote:
> On 20 August 2015 at 16:23, Jerin Jacob  
> wrote:
> > On Thu, Aug 20, 2015 at 03:30:23PM +0530, Santosh Shukla wrote:
> >> On 20 August 2015 at 14:48, Balasubramanian Manoharan
> >>  wrote:
> >> >
> >> >
> >> > On Sunday 16 August 2015 06:14 PM, Santosh Shukla wrote:
> >> >>
> >> >> On 15 August 2015 at 00:12, Zoltan Kiss  wrote:
> >> >>>
> >> >>> Applications can read the computed hash (if any) and set it if they
> >> >>> changed the packet headers or if the platform haven't calculated the
> >> >>> hash.
> >> >>>
> >> >>> Signed-off-by: Zoltan Kiss 
> >> >>> ---
> >> >>> v2:
> >> >>> - focus on RSS hash only
> >> >>> - use setter/getter's
> >> >>>
> >> >>> v3:
> >> >>> - do not mention pointers
> >> >>> - add a note
> >> >>> - add new patches for implementation and test
> >> >>>
> >> >>>   include/odp/api/packet.h | 30 ++
> >> >>>   1 file changed, 30 insertions(+)
> >> >>>
> >> >>> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> >> >>> index 3a454b5..1ae24bc 100644
> >> >>> --- a/include/odp/api/packet.h
> >> >>> +++ b/include/odp/api/packet.h
> >> >>> @@ -48,6 +48,11 @@ extern "C" {
> >> >>>* Invalid packet segment
> >> >>>*/
> >> >>>
> >> >>> +/**
> >> >>> + * @def ODP_PACKET_RSS_INVALID
> >> >>> + * RSS hash is not set
> >> >>> + */
> >> >>> +
> >> >>>   /*
> >> >>>*
> >> >>>* Alloc and free
> >> >>> @@ -605,6 +610,31 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
> >> >>>   int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
> >> >>>
> >> >>>   /**
> >> >>> + * RSS hash value
> >> >>> + *
> >> >>> + * Returns the RSS hash stored for the packet.
> >> >>> + *
> >> >>> + * @param  pkt  Packet handle
> >> >>> + *
> >> >>> + * @return  Hash value
> >> >>> + * @retval ODP_PACKET_RSS_INVALID if RSS hash is not set.
> >> >>> + */
> >> >>> +uint32_t odp_packet_rss_hash(odp_packet_t pkt);
> >> >>> +
> >> >>> +/**
> >> >>> + * Set RSS hash value
> >> >>> + *
> >> >>> + * Store the RSS hash for the packet.
> >> >>> + *
> >> >>> + * @param  pkt  Packet handle
> >> >>> + * @param  rss_hash Hash value to set
> >> >>> + *
> >> >>> + * @note If the application changes the packet header, it might want 
> >> >>> to
> >> >>> + * recalculate this value and set it.
> >> >>> + */
> >> >>> +void odp_packet_rss_hash_set(odp_packet_t pkt, uint32_t rss_hash);
> >> >
> >> > Can this use-case be handled by calling
> >> > odp_packet_generate_rss_hash(odp_packet_t pkt) function where the rss 
> >> > gets
> >> > generated by the implementation rather than being set from application 
> >> > using
> >> > odp_packet_set_rss_hash() function?
> >> >
> >>
> >> Bala, As we discussed and in summary for rest; Considering ovs example
> >> : ovs uses sw based rss_hash only when HW not supporting rss Or HW
> >> generated rss is zero.
> >>
> >> hash = packet_get_hash(packet);
> >> if (OVS_UNLIKELY(!hash)) {
> >> hash = miniflow_hash_5tuple(mf, 0);
> >> packet_set_hash(packet, hash);
> >> }
> >> return hash;
> >>
> >> and rss_hash generation is inside ovs dp_packet (middle  layer), It is
> >
> > How about following change in OVS plarform specific packet_get_hash code.
> > odp_packet_rss_hash_set
> > kind of interface wont fit correctly in octeon  platform as hash
> > identifier used by hardware in subsequent HW based queue operations
> >
> > static inline 

Re: [lng-odp] [API-NEXT PATCH v3 1/3] api: packet: allow access to packet RSS hash values

2015-08-20 Thread Jerin Jacob
On Thu, Aug 20, 2015 at 03:30:23PM +0530, Santosh Shukla wrote:
> On 20 August 2015 at 14:48, Balasubramanian Manoharan
>  wrote:
> >
> >
> > On Sunday 16 August 2015 06:14 PM, Santosh Shukla wrote:
> >>
> >> On 15 August 2015 at 00:12, Zoltan Kiss  wrote:
> >>>
> >>> Applications can read the computed hash (if any) and set it if they
> >>> changed the packet headers or if the platform haven't calculated the
> >>> hash.
> >>>
> >>> Signed-off-by: Zoltan Kiss 
> >>> ---
> >>> v2:
> >>> - focus on RSS hash only
> >>> - use setter/getter's
> >>>
> >>> v3:
> >>> - do not mention pointers
> >>> - add a note
> >>> - add new patches for implementation and test
> >>>
> >>>   include/odp/api/packet.h | 30 ++
> >>>   1 file changed, 30 insertions(+)
> >>>
> >>> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> >>> index 3a454b5..1ae24bc 100644
> >>> --- a/include/odp/api/packet.h
> >>> +++ b/include/odp/api/packet.h
> >>> @@ -48,6 +48,11 @@ extern "C" {
> >>>* Invalid packet segment
> >>>*/
> >>>
> >>> +/**
> >>> + * @def ODP_PACKET_RSS_INVALID
> >>> + * RSS hash is not set
> >>> + */
> >>> +
> >>>   /*
> >>>*
> >>>* Alloc and free
> >>> @@ -605,6 +610,31 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
> >>>   int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
> >>>
> >>>   /**
> >>> + * RSS hash value
> >>> + *
> >>> + * Returns the RSS hash stored for the packet.
> >>> + *
> >>> + * @param  pkt  Packet handle
> >>> + *
> >>> + * @return  Hash value
> >>> + * @retval ODP_PACKET_RSS_INVALID if RSS hash is not set.
> >>> + */
> >>> +uint32_t odp_packet_rss_hash(odp_packet_t pkt);
> >>> +
> >>> +/**
> >>> + * Set RSS hash value
> >>> + *
> >>> + * Store the RSS hash for the packet.
> >>> + *
> >>> + * @param  pkt  Packet handle
> >>> + * @param  rss_hash Hash value to set
> >>> + *
> >>> + * @note If the application changes the packet header, it might want to
> >>> + * recalculate this value and set it.
> >>> + */
> >>> +void odp_packet_rss_hash_set(odp_packet_t pkt, uint32_t rss_hash);
> >
> > Can this use-case be handled by calling
> > odp_packet_generate_rss_hash(odp_packet_t pkt) function where the rss gets
> > generated by the implementation rather than being set from application using
> > odp_packet_set_rss_hash() function?
> >
> 
> Bala, As we discussed and in summary for rest; Considering ovs example
> : ovs uses sw based rss_hash only when HW not supporting rss Or HW
> generated rss is zero.
> 
> hash = packet_get_hash(packet);
> if (OVS_UNLIKELY(!hash)) {
> hash = miniflow_hash_5tuple(mf, 0);
> packet_set_hash(packet, hash);
> }
> return hash;
> 
> and rss_hash generation is inside ovs dp_packet (middle  layer), It is

How about following change in OVS plarform specific packet_get_hash code.
odp_packet_rss_hash_set
kind of interface wont fit correctly in octeon  platform as hash
identifier used by hardware in subsequent HW based queue operations

static inline uint32_t
packet_get_hash(struct dp_packet *p)
{
#ifdef DPDK_NETDEV
return p->mbuf.hash.rss;
#else
#ifdef ODP_NETDEV
unit32_t hash;
hash = odp_packet_rss_hash(p->odp_pkt);
if (OVS_UNLIKELY(!hash)
hash = odp_packet_generate_rss_hash(p->odp_pkt);
return hash;
#endif
return p->rss_hash;
#endif
}


> with in ovs implementation, Not exposed to application layer, so
> application won't need to generate rss / update, so no possibility of
> rss mis-match /corruption.
> 
> > Regards,
> > Bala
> >
> >>> +
> >>> +/**
> >>>* Tests if packet is segmented
> >>>*
> >>>* @param pkt  Packet handle
> >>> --
> >>
> >> Reviewed-by : Santosh Shukla 
> >>
> >>> 1.9.1
> >>>
> >>> ___
> >>> lng-odp mailing list
> >>> lng-odp@lists.linaro.org
> >>> https://lists.linaro.org/mailman/listinfo/lng-odp
> >>
> >> ___
> >> lng-odp mailing list
> >> lng-odp@lists.linaro.org
> >> https://lists.linaro.org/mailman/listinfo/lng-odp
> >
> >
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH] api: crypto: add crypto IPSec extension

2015-07-30 Thread Jerin Jacob
On Wed, Jul 22, 2015 at 11:26:03AM +0300, alexandru.badici...@linaro.org wrote:
> From: Alexandru Badicioiu 
> 
> This patch adds IPSec protocol processing capabilities to crypto
> sesssions. Implementations which have these capabilities in hardware
> crypto engines can use the extension to offload the application from
> IPSec protocol processing.
> 
> Signed-off-by: Alexandru Badicioiu 
> ---
>  include/odp/api/crypto_ipsec.h |  110 
> 
>  platform/linux-generic/include/odp/crypto.h|2 +
>  .../include/odp/plat/crypto_ipsec_types.h  |   53 ++
>  3 files changed, 165 insertions(+), 0 deletions(-)
>  create mode 100644 include/odp/api/crypto_ipsec.h
>  create mode 100644 
> platform/linux-generic/include/odp/plat/crypto_ipsec_types.h
> 
> diff --git a/include/odp/api/crypto_ipsec.h b/include/odp/api/crypto_ipsec.h
> new file mode 100644
> index 000..e59fea4
> --- /dev/null
> +++ b/include/odp/api/crypto_ipsec.h
> @@ -0,0 +1,110 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:  BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP crypto IPSec extension
> + */
> +
> +#ifndef ODP_API_CRYPTO_IPSEC_H_
> +#define ODP_API_CRYPTO_IPSEC_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * @enum odp_ipsec_outhdr_type
> + * IPSec tunnel outer header type
> + *
> + * @enum odp_ipsec_ar_ws
> + * IPSec Anti-replay window size
> + *
> + */
> +
> +typedef struct odp_ipsec_params {
> + uint32_t spi;/** SPI value */
> + uint32_t seq;/** Initial SEQ number */
> + enum odp_ipsec_ar_ws ar_ws; /** Anti-replay window size -
> + inbound session with authentication */
> + odp_bool_t esn; /** Use extended sequence numbers */
> + odp_bool_t auto_iv; /** Auto IV generation for each operation. */
> + uint16_t out_hdr_size;   /** outer header size - tunnel mode */
> + uint8_t *out_hdr;/** outer header - tunnel mode */
> + enum odp_ipsec_outhdr_type out_hdr_type; /* outer header type -
> + tunnel mode */
> + odp_bool_t ip_csum; /** update/verify ip header checksum */
> + odp_bool_t ip_dttl; /** decrement ttl - tunnel mode encap & decap */
> + odp_bool_t remove_outer_hdr; /** remove outer header - tunnel mode 
> decap */
> + odp_bool_t copy_dscp;   /** DiffServ Copy - Copy the IPv4 TOS or
> + IPv6 Traffic Class byte from the inner/outer
> + IP header to the outer/inner IP header -
> + tunnel mode encap & decap */
> + odp_bool_t copy_df; /** Copy DF bit - copy the DF bit from
> + the inner IP header to the
> + outer IP header - tunnel mode encap */
> + odp_bool_t nat_t;   /** NAT-T encapsulation enabled - tunnel mode */
> + odp_bool_t udp_csum;/** Update/verify UDP csum when NAT-T enabled */
> +
> +} odp_ipsec_params_t;
> +
> +/**
> + * @enum odp_ipsec_mode:ODP_IPSEC_MODE_TUNNEL
> + * IPSec tunnel mode
> + *
> + * @enum odp_ipsec_mode:ODP_IPSEC_MODE_TRANSPORT
> + * IPSec transport mode
> + *
> + * @enum odp_ipsec_proto
> + * IPSec protocol
> + */
> +
> +/**
> + * Configure crypto session for IPsec processing
> + *
> + * Configures a crypto session for IPSec protocol processing.
> + * Packets submitted to an IPSec enabled session will have
> + * relevant IPSec headers/trailers and tunnel headers
> + * added/removed by the crypto implementation.
> + * For example, the input packet for an IPSec ESP transport
> + * enabled session should be the clear text packet with
> + * no ESP headers/trailers prepared in advance for crypto operation.
> + * The output packet will have ESP header, IV, trailer and the ESP ICV
> + * added by crypto implementation.
> + * Depending on the particular capabilities of an implementation and
> + * the parameters enabled by application, the application may be
> + * partially or completely offloaded from IPSec protocol processing.
> + * For example, if an implementation does not support checksum
> + * update for IP header after adding ESP header the application
> + * should update after crypto IPSec operation.

How a portable application knows what are the pending operations ?


> + *
> + * If an implementation does not support a particular set of
> + * arguments it should return error.
> + *
> + * @param sessionSession handle
> + * @param ipsec_mode IPSec protocol mode
> + * @param ipsec_protoIPSec protocol
> + * @param ipsec_params   IPSec parameters. Parameters which are not
> + *   relevant for selected protocol & mode are ignored -
> + *   e.g. outer_hdr/size set for ESP transport mode.
> + * @retval 0 on success
> + * @retval <0 

Re: [lng-odp] [API-NEXT PATCH 1/3] api: queue: allow for anonymous queues

2015-07-13 Thread Jerin Jacob
On Mon, Jul 13, 2015 at 04:11:28PM -0500, Bill Fischofer wrote:
> Signed-off-by: Bill Fischofer 
> ---
>  include/odp/api/queue.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/odp/api/queue.h b/include/odp/api/queue.h
> index 297067d..7f46892 100644
> --- a/include/odp/api/queue.h
> +++ b/include/odp/api/queue.h
> @@ -86,7 +86,7 @@ typedef struct odp_queue_param_t {
>   * Queue create
>   *
>   * @param nameQueue name
> - * @param typeQueue type
> + * @param typeQueue type, or NULL for an anonymous queue.

new anonymous queue description added to param 'type', Not to param 'name'

>   * @param param   Queue parameters. Uses defaults if NULL.
>   *
>   * @return Queue handle
> -- 
> 2.1.4
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 2/2] validation: timer: introduce CONFIG_MIN_TICK option in timer test case

2015-06-25 Thread Jerin Jacob
On Wed, Jun 24, 2015 at 01:34:07PM +0200, Ola Liljedahl wrote:
> On 10 June 2015 at 16:08, Jerin Jacob 
> wrote:
> 
> > This option is to specify minimum number ticks
> > (delta between future tick and current tick) required to successfully
> > reset/set the timer.
> >
> > some hardware timer implementations needs at least two ticks gap between
> > "current tick" and "future tick" to cancel/set timer and let timer test
> > case aware of this behavior by introducing CONFIG_MIN_TICK
> >
> > Signed-off-by: Jerin Jacob 
> > ---
> >  test/validation/odp_timer.c | 57
> > -
> >  1 file changed, 36 insertions(+), 21 deletions(-)
> >
> > diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> > index 5dfc06a..d13c12e 100644
> > --- a/test/validation/odp_timer.c
> > +++ b/test/validation/odp_timer.c
> > @@ -242,10 +242,11 @@ static void handle_tmo(odp_event_t ev, bool stale,
> > uint64_t prev_tick)
> > if (ttp != NULL && ttp->tick != TICK_INVALID)
> > CU_FAIL("Stale timeout for active timer");
> > } else {
> > -   if (!odp_timeout_fresh(tmo))
> > +   if (!odp_timeout_fresh(tmo) && ttp->tick != TICK_INVALID)
> >
> Why are we checking ttp->tick as well?
> Checking that ttp->tick != TICK_INVALID for a fresh timeout should perhaps
> be a separate check? Not combined with checking the return value of
> odp_timeout_fresh().
> 
> 
> 
> > CU_FAIL("Wrong status (stale) for fresh timeout");
> > /* Fresh timeout => local timer must have matching tick */
> > -   if (ttp != NULL && ttp->tick != tick) {
> > +   if (ttp != NULL && ttp->tick != TICK_INVALID &&
> > +   ttp->tick != tick) {
> >
> Basically the same comment here.
> 
> LOG_DBG("Wrong tick: expected %"PRIu64" actual
> > %"PRIu64"\n",
> > ttp->tick, tick);
> > CU_FAIL("odp_timeout_tick() wrong tick");
> > @@ -268,6 +269,17 @@ static void handle_tmo(odp_event_t ev, bool stale,
> > uint64_t prev_tick)
> > }
> >  }
> >
> > +#define NAME "timer_pool"
> > +#define RES (10 * ODP_TIME_MSEC / 3)
> > +#define MIN (10 * ODP_TIME_MSEC / 3)
> > +#define MAX (100 * ODP_TIME_MSEC)
> > +
> > +/*
> > + * Minimum tick(s)(delta between future tick and current tick)
> > + * required to successfully reset/set the timer
> > + */
> > +#define CONFIG_MIN_TICK 1
> >
> Is this a candidate for a proper ODP API?
> Something you could retrieve from
> odp_timer_pool_info()/odp_timer_pool_info_t?
> It seems applications should know this value in order not to request
> timeouts to close in time and either fail or have to repeat the timer set
> operation with increasing tick values which causes unnecessary overhead.
> 
> +

I agree, Its better to expose the minimum ticks required to program the
HW from the current tick as part of API. I do agree that "min_tmo"  part
of odp_timer_pool_param_t is not useful, its really overlapping with
resolution. I guess it can be made it as output parameter in
info structure but I would like return as min value in ticks not in ns.
As HW has restriction only on ticks not in time domain.

> >  /* @private Worker thread entrypoint which performs timer
> > alloc/set/cancel/free
> >   * tests */
> >  static void *worker_entrypoint(void *arg TEST_UNUSED)
> > @@ -305,7 +317,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
> > /* Initial set all timers with a random expiration time */
> > uint32_t nset = 0;
> > for (i = 0; i < NTIMERS; i++) {
> > -   uint64_t tck = odp_timer_current_tick(tp) + 1 +
> > +   uint64_t tck = odp_timer_current_tick(tp) +
> > CONFIG_MIN_TICK +
> >odp_timer_ns_to_tick(tp,
> > (rand_r(&seed) %
> > RANGE_MS)
> > * 100ULL);
> > @@ -329,9 +341,9 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
> > for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) {
> > odp_event_t ev;
> > while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
> > -   /* S

[lng-odp] [PATCH] validation: pktio: remove linux-generic internal header file from validation test

2015-06-16 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 test/validation/pktio/pktio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 8cfa269..5911ca7 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include "pktio.h"
-- 
2.1.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 2/2] validation: timer: introduce CONFIG_MIN_TICK option in timer test case

2015-06-10 Thread Jerin Jacob
This option is to specify minimum number ticks
(delta between future tick and current tick) required to successfully
reset/set the timer.

some hardware timer implementations needs at least two ticks gap between
"current tick" and "future tick" to cancel/set timer and let timer test
case aware of this behavior by introducing CONFIG_MIN_TICK

Signed-off-by: Jerin Jacob 
---
 test/validation/odp_timer.c | 57 -
 1 file changed, 36 insertions(+), 21 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 5dfc06a..d13c12e 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -242,10 +242,11 @@ static void handle_tmo(odp_event_t ev, bool stale, 
uint64_t prev_tick)
if (ttp != NULL && ttp->tick != TICK_INVALID)
CU_FAIL("Stale timeout for active timer");
} else {
-   if (!odp_timeout_fresh(tmo))
+   if (!odp_timeout_fresh(tmo) && ttp->tick != TICK_INVALID)
CU_FAIL("Wrong status (stale) for fresh timeout");
/* Fresh timeout => local timer must have matching tick */
-   if (ttp != NULL && ttp->tick != tick) {
+   if (ttp != NULL && ttp->tick != TICK_INVALID &&
+   ttp->tick != tick) {
LOG_DBG("Wrong tick: expected %"PRIu64" actual 
%"PRIu64"\n",
ttp->tick, tick);
CU_FAIL("odp_timeout_tick() wrong tick");
@@ -268,6 +269,17 @@ static void handle_tmo(odp_event_t ev, bool stale, 
uint64_t prev_tick)
}
 }
 
+#define NAME "timer_pool"
+#define RES (10 * ODP_TIME_MSEC / 3)
+#define MIN (10 * ODP_TIME_MSEC / 3)
+#define MAX (100 * ODP_TIME_MSEC)
+
+/*
+ * Minimum tick(s)(delta between future tick and current tick)
+ * required to successfully reset/set the timer
+ */
+#define CONFIG_MIN_TICK 1
+
 /* @private Worker thread entrypoint which performs timer alloc/set/cancel/free
  * tests */
 static void *worker_entrypoint(void *arg TEST_UNUSED)
@@ -305,7 +317,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
/* Initial set all timers with a random expiration time */
uint32_t nset = 0;
for (i = 0; i < NTIMERS; i++) {
-   uint64_t tck = odp_timer_current_tick(tp) + 1 +
+   uint64_t tck = odp_timer_current_tick(tp) + CONFIG_MIN_TICK +
   odp_timer_ns_to_tick(tp,
(rand_r(&seed) % RANGE_MS)
* 100ULL);
@@ -329,9 +341,9 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) {
odp_event_t ev;
while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
-   /* Subtract one from prev_tick to allow for timeouts
-* to be delivered a tick late */
-   handle_tmo(ev, false, prev_tick - 1);
+   /* Subtract CONFIG_MIN_TICK from prev_tick to allow
+* for timeouts to be delivered a tick late */
+   handle_tmo(ev, false, prev_tick - CONFIG_MIN_TICK);
nrcv++;
}
prev_tick = odp_timer_current_tick(tp);
@@ -340,10 +352,11 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
(rand_r(&seed) % 2 == 0)) {
/* Timer active, cancel it */
rc = odp_timer_cancel(tt[i].tim, &tt[i].ev);
-   if (rc != 0)
+   if (rc != 0) {
+   tt[i].tick = TICK_INVALID;
/* Cancel failed, timer already expired */
ntoolate++;
-   tt[i].tick = TICK_INVALID;
+   }
ncancel++;
} else {
if (tt[i].ev != ODP_EVENT_INVALID)
@@ -352,8 +365,10 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
else
/* Timer active => reset */
nreset++;
-   uint64_t tck = 1 + odp_timer_ns_to_tick(tp,
-  (rand_r(&seed) % RANGE_MS) * 100ULL);
+   uint64_t tck = CONFIG_MIN_TICK +
+  odp_timer_ns_to_tick(tp,
+   (rand_r(&seed) % RANGE_MS)
+   * 100ULL);
odp_timer_set_t rc;
uint64_t cur_tick;
   

[lng-odp] [PATCH 1/2] validation: timer: added an assert to catch any timer dispatch race to different worker and/or queue

2015-06-10 Thread Jerin Jacob
timer validation program creates each worker thread and associate a
private queue for event delivery. With out this assert its difficult debug
if there is any race issue in timer event dispatch.

Signed-off-by: Jerin Jacob 
---
 test/validation/odp_timer.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 88f5208..5dfc06a 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -44,7 +44,8 @@ struct test_timer {
odp_timer_t tim; /* Timer handle */
odp_event_t ev;  /* Timeout event */
odp_event_t ev2; /* Copy of event handle */
-   uint64_t tick; /* Expiration tick or TICK_INVALID */
+   uint64_t tick;   /* Expiration tick or TICK_INVALID */
+   int tid; /* Allocated thread id */
 };
 
 #define TICK_INVALID (~(uint64_t)0)
@@ -223,6 +224,8 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t 
prev_tick)
uint64_t tick = odp_timeout_tick(tmo);
struct test_timer *ttp = odp_timeout_user_ptr(tmo);
 
+   CU_ASSERT_FATAL(ttp->tid == odp_thread_id());
+
if (tim == ODP_TIMER_INVALID)
CU_FAIL("odp_timeout_timer() invalid timer");
if (ttp == NULL)
@@ -294,6 +297,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
CU_FAIL_FATAL("Failed to allocate timeout");
tt[i].ev2 = tt[i].ev;
tt[i].tick = TICK_INVALID;
+   tt[i].tid = odp_thread_id();
}
 
odp_barrier_wait(&test_barrier);
-- 
2.1.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v1] validation: timer: save expected expiration tick only on success

2015-06-10 Thread Jerin Jacob
On Tue, Jun 09, 2015 at 08:26:28AM +0530, Jerin Jacob wrote:

ping.

> otherwise "tt[i].tick" in "handle_tmo" will be a wrong value
> in case timer set failed due to
> ODP_TIMER_NOEVENT(failed to cancel the outstanding timer).
> 
> some hardware timer implementations needs at least two ticks gap between
> "current tick" and "future tick" to cancel the outstanding active timer.
> 
> Signed-off-by: Jerin Jacob 
> Reviewed-by: Ola Liljedahl 
> ---
> v1: enclosed braces around the new "if" check as other if/else-branches use 
> braces
> 
>  test/validation/odp_timer.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> index 554b353..88f5208 100644
> --- a/test/validation/odp_timer.c
> +++ b/test/validation/odp_timer.c
> @@ -365,9 +365,10 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
>   } else if (rc != ODP_TIMER_SUCCESS) {
>   /* Set/reset failed, timer already expired */
>   ntoolate++;
> + } else if (rc == ODP_TIMER_SUCCESS) {
> + /* Save expected expiration tick on success */
> + tt[i].tick = cur_tick + tck;
>   }
> - /* Save expected expiration tick */
> - tt[i].tick = cur_tick + tck;
>   }
>   struct timespec ts;
>   ts.tv_sec = 0;
> -- 
> 2.1.0
> 
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v1] validation: timer: save expected expiration tick only on success

2015-06-08 Thread Jerin Jacob
otherwise "tt[i].tick" in "handle_tmo" will be a wrong value
in case timer set failed due to
ODP_TIMER_NOEVENT(failed to cancel the outstanding timer).

some hardware timer implementations needs at least two ticks gap between
"current tick" and "future tick" to cancel the outstanding active timer.

Signed-off-by: Jerin Jacob 
Reviewed-by: Ola Liljedahl 
---
v1: enclosed braces around the new "if" check as other if/else-branches use 
braces

 test/validation/odp_timer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 554b353..88f5208 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -365,9 +365,10 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
} else if (rc != ODP_TIMER_SUCCESS) {
/* Set/reset failed, timer already expired */
ntoolate++;
+   } else if (rc == ODP_TIMER_SUCCESS) {
+   /* Save expected expiration tick on success */
+   tt[i].tick = cur_tick + tck;
}
-   /* Save expected expiration tick */
-   tt[i].tick = cur_tick + tck;
}
struct timespec ts;
ts.tv_sec = 0;
-- 
2.1.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] validation: timer: save expected expiration tick only on success

2015-06-05 Thread Jerin Jacob
otherwise "tt[i].tick" in "handle_tmo" will be a wrong value
in case timer set failed due to
ODP_TIMER_NOEVENT(failed to cancel the outstanding timer).

some hardware timer implementations needs at least two ticks gap between
"current tick" and "future tick" to cancel the outstanding active timer.

Signed-off-by: Jerin Jacob 
---
 test/validation/odp_timer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 554b353..852343a 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -365,9 +365,9 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
} else if (rc != ODP_TIMER_SUCCESS) {
/* Set/reset failed, timer already expired */
ntoolate++;
-   }
-   /* Save expected expiration tick */
-   tt[i].tick = cur_tick + tck;
+   } else if (rc == ODP_TIMER_SUCCESS)
+   /* Save expected expiration tick on success */
+   tt[i].tick = cur_tick + tck;
}
struct timespec ts;
ts.tv_sec = 0;
-- 
2.1.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [RFCv3] Add message I/O (MSGIO) API's

2015-06-02 Thread Jerin Jacob
On Tue, Jun 02, 2015 at 02:36:47PM +0200, Benoît Ganne wrote:
> Hi Ola, all,
> 
> On 05/27/2015 10:08 AM, Ola Liljedahl wrote:
> >Here is my third attempt at a ODP API for MSGIO - asynchronous message 
> >passing
> >based IPC for a shared nothing architecture.
> 
> I understand the value of this, but I feel I need to ask the question: does
> it really belong to ODP ? My understanding so far was that ODP should not
> try to replace OS services: for example, thread or process related API were
> ruled out. This looks to me a lot like D-BUS or ZeroMQ (or  favorite solution here>). Wouldn't it be better to let the application
> select what they want to use instead of providing our own?

+1 and I am not sure how much value addition it has in hardware abstraction 
perspective.
Most of the HW accelerated platforms will map odp_msg_t as packet and 
odp_msgio_t as pktio
then it will boils down to a helper function that creates the
vlan packet/message from given message(uint8_t *), src, dst 48 bit address

> 
> ben
> 
> >IPC/message passing can be separated into a number of different layers.
> >1) Message formats and protocols (as seen by the user).
> >2) API - defines syntax and semantics of MSGIO operations.
> >3) Transport interface - defines a binary packet format used by MSGIO
> >endpoints/implementations. Cf. OSI network layer.
> >4) Transport layer - implements the transport of message packet between
> >different endpoints. Cf. OSI link layer.
> >
> >#1 is application specific and there are many different standards (e.g. Linux
> >Netlink, NETCONF, OpenFlow, YouNameIt) intended for different use cases.
> >#3 may be implementation specific but is important for interoperatibility
> >(binary compatibility). If the user message (payload), operation and
> >parameters are encoded in a well-defined way (e.g. some kind of packet format
> >which includes operation, sender and receiver addresses, payload etc),
> >inter-operatibility between different ODP/MSGIO implementations may be
> >achieved or simplified.
> >#4 is implementation (platform) specific.
> >
> >This proposal focuses on the API which is fundamental for source code
> >compatibility between different platforms (ODP implementations) - this being
> >the primary purpose of ODP. A packet format for messages will be specified as
> >part of the reference implementation and may be seen as a proposal for a
> >standard packet format for binary compatibility between different ODP/MSGIO
> >implementations.
> >
> >All MSGIO calls are non-blocking (with the possible exception of
> >odp_msgio_create, odp_msgio_activate and odp_msgio_destroy). Message
> >transfer is asynchronous so it is not possible to return any status
> >operation concerning the eventual (or remote) result of an operation.
> >
> >The semantics of MSGIO message passing is that sending a message to an 
> >endpoint
> >will always look like it succeeds. The appearance of endpoints is explicitly
> >notified through user-defined messages specified in the odp_msgio_lookup()
> >call. Similarly, the disappearance (e.g. death of or otherwise lost 
> >connection
> >to endpoint) is also explicitly notified through user-defined messages
> >specified in the odp_msgio_monitor() call. The send call does not fail 
> >because
> >the addressed endpoint has disappeared, the message is just silently 
> >discarded.
> >
> >Message delivery into the recipient address space is ordered (per priority)
> >and reliable. Delivery of message N implies delivery of all messages  >(of the same priority). All messages (accepted by MSGIO send operation) will
> >be delivered up to the point of endpoint termination or lost connection
> >where no more messages will be delivered. Actual reception (dequeueing) and
> >processing by the recipient is not guaranteed (use end-to-end 
> >acknowledgements
> >for that).
> >
> >MSGIO endpoints can be seen as interfaces (taps) to an internal reliable
> >multidrop network where each endpoint has a unique address which is only
> >valid for the lifetime of the endpoint. I.e. if an endpoint is destroyed
> >and then recreated (with the same name), the new endpoint will have a
> >new unique address (eventually endpoints addresses will have to be recycled
> >but not for a very long time). Endpoints names do not necessarily have to be
> >unique. The scope of message network is not defined but it is expected that
> >the scope by default corresponds to an OS instance (e.g. virtual machine).
> >
> >Proposed transport packet for message I/O (not visible to the user):
> >uint8_t dest_addr[6]; /* Unique address of destination endpoint */
> >uint8_t src_addr[6]; /* Unique address of source endpoint */
> >uint16_t frametype_o; /* Outer frametype, 0x8100 */
> >uint16_t pcp_vid; /* 3 bits of Priority Code Point, 5 bits reserved */
> >uint16_t frametype_i; /* Inner frametype, TBD */
> >uint8_t payload[]; /* User message */
> >Looks very much like a VLAN-tagged Ethernet frame so should easily be
> >transported by a

Re: [lng-odp] [API-NEXT PATCH] api-next: pktio: add odp_pktio_send_complete() definition

2015-05-29 Thread Jerin Jacob
On Fri, May 29, 2015 at 04:21:03PM +0200, Ola Liljedahl wrote:
> On 29 May 2015 at 13:55, Zoltan Kiss  wrote:
> 
> >
> >
> > On 28/05/15 17:40, Ola Liljedahl wrote:
> >
> >> On 28 May 2015 at 17:23, Zoltan Kiss  >> > wrote:
> >>
> >>
> >>
> >> On 28/05/15 16:00, Ola Liljedahl wrote:
> >>
> >> I disprove of this solution. TX completion processing (cleaning TX
> >> descriptor rings after transmission complete) is an implementation
> >> (hardware) aspect and should be hidden from the application.
> >>
> >>
> >> Unfortunately you can't, if you want your pktio application work
> >> with poll mode drivers. In that case TX completion interrupt (can
> >> be) disabled and the application has to control that as well. In
> >> case of DPDK you just call the send function (with 0 packets, if you
> >> don't have anything to send at the time)
> >>
> >> Why do you have to retire transmitted packet if you are not transmitting
> >> new packets (and need those descriptors in the TX ring)?
> >>
> > Because otherwise they are a memory leak.
> 
> They are not leaked! They are still in the TX ring, just waiting to get
> retired.
> 
> 
> > Those buffers might be needed somewhere else. If they are only released
> > when you send/receive packets out next time, you are in trouble, because
> > that might never happen. Especially when that event is blocked because your
> > TX ring is full of unreleased packets.
> 
> Having to few buffers is always a problem. You don't want to have too large
> RX/TX rings because that just increases buffering and latency ("buffer
> bloat" problem).
> 
> 
> >
> >  Does the
> >
> >> application have too few packets in the pool so that reception will
> >> suffer?
> >>
> > Let me approach the problem from a different angle: the current workaround
> > is that you have to allocate a pool with _loooads_ of buffers, so you have
> > a good chance you never run out of free buffers. Probably. Because it still
> > doesn't guarantee that there will be a next send/receive event on that
> > interface to release the packets.
> 
> 
> 
> >
> >
> >
> >
> >>
> >>
> >>   There isn't
> >>
> >> any corresponding call that refills the RX descriptor rings with
> >> fresh
> >> buffers.
> >>
> >> You can do that in the receive function, I think that's how the
> >> drivers are doing it generally.
> >>
> >>
> >> The completion processing can be performed from any ODP call, not
> >> necessary odp_pktio_send().
> >>
> >>
> >> I think "any" is not specific enough. Which one?
> >>
> >> odp_pktio_recv, odp_schedule. Wherever the application blocks or busy
> >> waits waiting for more packets.
> >>
> > We do that already on odp_pktio_recv. It doesn't help, because you can
> > only release the buffers held in the current interface's TX ring. You can't
> > do anything about other interfaces.
> >
> Why not?
> 
> There is no guarantee that the application thread calling odp_pktio_recv()
> on one interface is the only one transmitting on that specific egress
> interface. In the general case, all threads may be using all pktio
> interfaces for both reception and transmission.
> 
> I mean, you could trigger TX completion on every interface every time you
> > receive on one, but that would be a scalability nightmare.
> 
> Maybe not every time. I expect a more creative solution than this. Perhaps
> when you run out of buffers in the pool?
> 
> 
> 
> >
> >
> >
> >>
> >>
> >> Can you provide a vague draft how would you fix the l2fwd example
> >> below?
> >>
> >> I don't think anything needs fixing on the application level.
> >>
> >
> > Wrong. odp_l2fwd uses one packet pool, receives from pktio_src and then if
> > there is anything received, it sends it out on pktio_dst.
> 
> This specific application has this specific behavior. Are you sure this is
> a general solution? I am not.
> 
> 
> > Let's say the pool has 576 elements, and the interfaces uses 256 RX and
> > 256 TX descriptors. You start with 2*256 buffers kept in the two RX ring.
> > Let's say you receive the first 64 packets, you refill the RX ring
> > immediately, so now you're out of buffers. You can send out that 64, but in
> > the next iteration odp_pktio_recv() will return 0 because it can't refill
> > the RX descriptors. (and the driver won't give you back any buffer unless
> > you can refill it). And now you are in an infinite loop, recv will always
> > return 0, because you never release the packets.
> >
> The size of the pool should somehow be correlated with the size of the RX
> and TX rings for "best performance" (whatever this means). But I also think
> that the system should function regardless of RX/TX ring sizes and pool
> size, "function" meaning not deadlock.
> 
> There are several ways to fix this:
> > - tell the application writer that if you see deadlocks, increase the
> > element size of the buffer. I doubt anyone would ever use ODP 

[lng-odp] [PATCH] validation: schedule: fix maybe-uninitialized warnings when odp_schedule() compile as inline function

2015-05-28 Thread Jerin Jacob
use of CU_ASSERT(from == queue) in 'test_schedule_pause_resume'
odp_schedule.c: In function 'test_schedule_pause_resume':
odp_schedule.c:573:3: error: 'from' may be used uninitialized
in this function [-Werror=maybe-uninitialized]

use of CU_ASSERT(from != ODP_QUEUE_INVALID) in 'schedule_common_'
odp_schedule.c: In function 'schedule_common_':
odp_schedule.c:218:4: error: 'from' may be used uninitialized
in this function [-Werror=maybe-uninitialized]

Signed-off-by: Jerin Jacob 
---
 test/validation/odp_scheduler.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/validation/odp_scheduler.c b/test/validation/odp_scheduler.c
index a3ac505..c2eb996 100644
--- a/test/validation/odp_scheduler.c
+++ b/test/validation/odp_scheduler.c
@@ -179,7 +179,7 @@ static void *schedule_common_(void *arg)
while (1) {
odp_event_t ev;
odp_buffer_t buf;
-   odp_queue_t from;
+   odp_queue_t from = ODP_QUEUE_INVALID;
int num = 0;
int locked;
 
@@ -569,6 +569,7 @@ static void test_schedule_pause_resume(void)
}
 
for (i = 0; i < NUM_BUFS_BEFORE_PAUSE; i++) {
+   from = ODP_QUEUE_INVALID;
ev = odp_schedule(&from, ODP_SCHED_NO_WAIT);
CU_ASSERT(from == queue);
buf = odp_buffer_from_event(ev);
-- 
2.1.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: queue: schedule parameters are not valid for poll type queue

2015-05-27 Thread Jerin Jacob
On Wed, May 27, 2015 at 07:38:26AM -0400, Mike Holmes wrote:
> On 27 May 2015 at 00:17, Jacob, Jerin 
> wrote:
> 
> >
> > Not completely understood your concern.If you are concerned about the
> > coverage of "odp_queue_sched_type" API
> > then odp_queue unit can be extended to create schedule type queue and add
> > "odp_queue_sched_type" API  coverage.
> > But in any case, We should remove the  odp_queue_sched_type() call on
> > pooled queues.
> >
> 
> My thought was that we have very poor sunny day coverage, and we should
> extend that and ensure such cases are accurate as you propose. But in
> addition calling the API in other combinations actually helps define the
> APIs behavior. In this case the current test is not correct but may add
> value the the testing ?
> 
> I have not looked in detail - just asking if there was merit to keeping a
> copy of this as a "bad" test.

IMO, No merit in keeping the bad test.

> 
> 
> 
> >
> >
> > From: Mike Holmes 
> > Sent: Tuesday, May 26, 2015 8:14 PM
> > To: Jacob, Jerin
> > Cc: lng-odp
> > Subject: Re: [lng-odp] [PATCH] validation: queue: schedule parameters are
> > not valid for poll type queue
> >
> >
> > If this is not a valid sunny day test, should we rename it and retain it
> > as a valid test case for  passing an non valid params ?
> >
> >
> > On 22 May 2015 at 07:43, Jerin Jacob 
> > wrote:
> >  Signed-off-by: Jerin Jacob 
> > ---
> >  test/validation/odp_queue.c | 8 +---
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
> > index 5123939..01a704c 100644
> > --- a/test/validation/odp_queue.c
> > +++ b/test/validation/odp_queue.c
> > @@ -45,24 +45,18 @@ static void test_odp_queue_sunnyday(void)
> > odp_buffer_t buf;
> > odp_event_t ev;
> > odp_pool_t msg_pool;
> > -   odp_queue_param_t param;
> > odp_event_t *pev_tmp;
> > int i, deq_ret, ret;
> > int nr_deq_entries = 0;
> > int max_iteration = CONFIG_MAX_ITERATION;
> > void *prtn = NULL;
> >
> > -   memset(¶m, 0, sizeof(param));
> > -   param.sched.sync  = ODP_SCHED_SYNC_NONE;
> > -
> > queue_creat_id = odp_queue_create("test_queue",
> > - ODP_QUEUE_TYPE_POLL, ¶m);
> > + ODP_QUEUE_TYPE_POLL, NULL);
> > CU_ASSERT(ODP_QUEUE_INVALID != queue_creat_id);
> >
> > CU_ASSERT_EQUAL(ODP_QUEUE_TYPE_POLL,
> > odp_queue_type(queue_creat_id));
> > -   CU_ASSERT_EQUAL(ODP_SCHED_SYNC_NONE,
> > -   odp_queue_sched_type(queue_creat_id));
> >
> > queue_id = odp_queue_lookup("test_queue");
> > CU_ASSERT_EQUAL(queue_creat_id, queue_id);
> > --
> > 2.1.0
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
> >
> >
> >
> >
> >  --
> >
> >
> >
> >
> >
> > Mike Holmes
> > Technical Manager - Linaro Networking Group
> > Linaro.org │ Open  source software for ARM SoCs
> >
> >
> >
> >
> >
> 
> 
> 
> -- 
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] validation: queue: schedule parameters are not valid for poll type queue

2015-05-22 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 test/validation/odp_queue.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
index 5123939..01a704c 100644
--- a/test/validation/odp_queue.c
+++ b/test/validation/odp_queue.c
@@ -45,24 +45,18 @@ static void test_odp_queue_sunnyday(void)
odp_buffer_t buf;
odp_event_t ev;
odp_pool_t msg_pool;
-   odp_queue_param_t param;
odp_event_t *pev_tmp;
int i, deq_ret, ret;
int nr_deq_entries = 0;
int max_iteration = CONFIG_MAX_ITERATION;
void *prtn = NULL;
 
-   memset(¶m, 0, sizeof(param));
-   param.sched.sync  = ODP_SCHED_SYNC_NONE;
-
queue_creat_id = odp_queue_create("test_queue",
- ODP_QUEUE_TYPE_POLL, ¶m);
+ ODP_QUEUE_TYPE_POLL, NULL);
CU_ASSERT(ODP_QUEUE_INVALID != queue_creat_id);
 
CU_ASSERT_EQUAL(ODP_QUEUE_TYPE_POLL,
odp_queue_type(queue_creat_id));
-   CU_ASSERT_EQUAL(ODP_SCHED_SYNC_NONE,
-   odp_queue_sched_type(queue_creat_id));
 
queue_id = odp_queue_lookup("test_queue");
CU_ASSERT_EQUAL(queue_creat_id, queue_id);
-- 
2.1.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] odp timer unit test case question

2015-05-21 Thread Jerin Jacob
On Wed, May 20, 2015 at 05:28:24PM +0200, Ola Liljedahl wrote:
> On 20 May 2015 at 16:16, Jerin Jacob  wrote:
> > On Wed, May 20, 2015 at 12:42:29PM +0200, Ola Liljedahl wrote:
> >> On 20 May 2015 at 06:56, Jerin Jacob  
> >> wrote:
> >> > On Wed, May 20, 2015 at 12:25:12AM +0200, Ola Liljedahl wrote:
> >> >> On 19 May 2015 at 15:34, Jacob,  Jerin  
> >> >> wrote:
> >> >> > Ola,
> >> >> >
> >> >> > Is there any specific reason for following check in timer validation 
> >> >> > test ?
> >> >> pa
> >> >> >
> >> >> > diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> >> >> > index 554b353..724026e 100644
> >> >> > --- a/test/validation/odp_timer.c
> >> >> > +++ b/test/validation/odp_timer.c
> >> >> > @@ -260,7 +260,7 @@ static void handle_tmo(odp_event_t ev, bool 
> >> >> > stale, uint64_t prev_tick)
> >> >> >
> >> >> > if (ttp != NULL) {
> >> >> > /* Internal error */
> >> >> > -   CU_ASSERT_FATAL(ttp->ev == ODP_EVENT_INVALID);
> >> >> > +-->CU_ASSERT_FATAL(ttp->ev == ODP_EVENT_INVALID);
> >> >> > ttp->ev = ev;
> >> >> > }
> >> >> >  }
> >> >> >
> >> >> > AFAIU, I should be CU_ASSERT_FATAL(ttp->ev != ODP_EVENT_INVALID) as
> >> >> > tt[i].ev = odp_timeout_to_event(odp_timeout_alloc(tbp)) specified 
> >> >> > while preparing  all timers.
> >> >> Yes the timers are still inactive and the timeout event is stored in
> >> >> the 'ev' member.
> >> >>
> >> >> handle_timeout() is called for received timeouts (timer has expired).
> >> >> In that case, the corresponding 'ev' member should not contain any
> >> >> timeout event.
> >> >>
> >> >> >
> >> >> > Am I missing something in the timer specification ?
> >> >> Or the timer specification is missing something?
> >> >>
> >> >> odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev); (line 309) is supposed
> >> >> to grab the timeout event (on success) and clear the variable (write
> >> >> ODP_TIMEOUT_INVALID), that's why the timeout is passed by reference
> >> >> ("&tt[i].ev").
> >> >>
> >> >> Possibly this is not specified clearly enough in timer.h:
> >> >>  * @param[in,out] tmo_ev  Reference to an event variable that points to
> >> >>  * timeout event or NULL to reuse the existing timeout event. Any 
> >> >> existing
> >> >>  * timeout event that is replaced by a successful set operation will be
> >> >>  * returned here.
> >> >>
> >> >> The new timeout event is read from *tmo_ev. The old timeout event (if
> >> >> timer was active) or ODP_TIMEOUT_INVALID (if timer was inactive) is
> >> >> stored in *tmo_ev. I hope this is at least clear in the reference
> >> >> implementation.
> >> >
> >> > We are on same page, except the last notes
> >> > IMO, linux generic timer implementation details leaked into creating the 
> >> > test case.
> >> Well I don't agree and I hope I can convince you.
> >>
> >> >
> >> > AFAIU, *tmo_ev should have the event that used for _arming_ the timer so
> >> > that application can do some look up after receiving event through queue 
> >> > or something similar..
> >> > What is the point of providing "ODP_TIMEOUT_INVALID" to application 
> >> > back, What the
> >> > use of it for the application.
> >> It is possible to set an already active timer (which then is already
> >> associated with a timeout). If the user specifies a new timeout, the
> >> old timeout must be returned to the user (because all alloc and free
> >> of timeouts is the responsibility of the user). So any old timeout
> >> (for an already active timer) is return in "*tmo_ev". But it is
> >> possible that the timer has already expired (and the timeout been
> >> delivered) or wasn't active to start with. We want the application to
> >> be able to differ between these two scenarios and we achieve this by
&g

Re: [lng-odp] odp timer unit test case question

2015-05-20 Thread Jerin Jacob
On Wed, May 20, 2015 at 12:42:29PM +0200, Ola Liljedahl wrote:
> On 20 May 2015 at 06:56, Jerin Jacob  wrote:
> > On Wed, May 20, 2015 at 12:25:12AM +0200, Ola Liljedahl wrote:
> >> On 19 May 2015 at 15:34, Jacob,  Jerin  
> >> wrote:
> >> > Ola,
> >> >
> >> > Is there any specific reason for following check in timer validation 
> >> > test ?
> >> pa
> >> >
> >> > diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> >> > index 554b353..724026e 100644
> >> > --- a/test/validation/odp_timer.c
> >> > +++ b/test/validation/odp_timer.c
> >> > @@ -260,7 +260,7 @@ static void handle_tmo(odp_event_t ev, bool stale, 
> >> > uint64_t prev_tick)
> >> >
> >> > if (ttp != NULL) {
> >> > /* Internal error */
> >> > -   CU_ASSERT_FATAL(ttp->ev == ODP_EVENT_INVALID);
> >> > +-->CU_ASSERT_FATAL(ttp->ev == ODP_EVENT_INVALID);
> >> > ttp->ev = ev;
> >> > }
> >> >  }
> >> >
> >> > AFAIU, I should be CU_ASSERT_FATAL(ttp->ev != ODP_EVENT_INVALID) as
> >> > tt[i].ev = odp_timeout_to_event(odp_timeout_alloc(tbp)) specified while 
> >> > preparing  all timers.
> >> Yes the timers are still inactive and the timeout event is stored in
> >> the 'ev' member.
> >>
> >> handle_timeout() is called for received timeouts (timer has expired).
> >> In that case, the corresponding 'ev' member should not contain any
> >> timeout event.
> >>
> >> >
> >> > Am I missing something in the timer specification ?
> >> Or the timer specification is missing something?
> >>
> >> odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev); (line 309) is supposed
> >> to grab the timeout event (on success) and clear the variable (write
> >> ODP_TIMEOUT_INVALID), that's why the timeout is passed by reference
> >> ("&tt[i].ev").
> >>
> >> Possibly this is not specified clearly enough in timer.h:
> >>  * @param[in,out] tmo_ev  Reference to an event variable that points to
> >>  * timeout event or NULL to reuse the existing timeout event. Any existing
> >>  * timeout event that is replaced by a successful set operation will be
> >>  * returned here.
> >>
> >> The new timeout event is read from *tmo_ev. The old timeout event (if
> >> timer was active) or ODP_TIMEOUT_INVALID (if timer was inactive) is
> >> stored in *tmo_ev. I hope this is at least clear in the reference
> >> implementation.
> >
> > We are on same page, except the last notes
> > IMO, linux generic timer implementation details leaked into creating the 
> > test case.
> Well I don't agree and I hope I can convince you.
> 
> >
> > AFAIU, *tmo_ev should have the event that used for _arming_ the timer so
> > that application can do some look up after receiving event through queue or 
> > something similar..
> > What is the point of providing "ODP_TIMEOUT_INVALID" to application back, 
> > What the
> > use of it for the application.
> It is possible to set an already active timer (which then is already
> associated with a timeout). If the user specifies a new timeout, the
> old timeout must be returned to the user (because all alloc and free
> of timeouts is the responsibility of the user). So any old timeout
> (for an already active timer) is return in "*tmo_ev". But it is
> possible that the timer has already expired (and the timeout been
> delivered) or wasn't active to start with. We want the application to
> be able to differ between these two scenarios and we achieve this by
> updating "*tmo_ev" accordingly. When the timer_set call return, if
> *tmo_ev != ODP_EVENT_INVALID, an timeout has been returned and the
> application needs to do something with it. If *tno_ev ==
> ODP_EVENT_INVALID, no timeout was returned.


Just to understand the usecase, What application is gonna do with returned 
*tmp_ev
if timer is active and it returned the associated timeout ?
it can't free as it will be cause double free when it comes back in
app mainloop(it will have odp_timeout_free() there).

and application can't use the "returned associated timeout" for long time
what if it event is delivered and  free'ed it in the main loop.
Typical main loop application
processing will be check for event type, process it and free the resources

Is this scheme is replacement 

Re: [lng-odp] odp timer unit test case question

2015-05-19 Thread Jerin Jacob
On Wed, May 20, 2015 at 12:25:12AM +0200, Ola Liljedahl wrote:
> On 19 May 2015 at 15:34, Jacob,  Jerin  wrote:
> > Ola,
> >
> > Is there any specific reason for following check in timer validation test ?
> pa
> >
> > diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> > index 554b353..724026e 100644
> > --- a/test/validation/odp_timer.c
> > +++ b/test/validation/odp_timer.c
> > @@ -260,7 +260,7 @@ static void handle_tmo(odp_event_t ev, bool stale, 
> > uint64_t prev_tick)
> >
> > if (ttp != NULL) {
> > /* Internal error */
> > -   CU_ASSERT_FATAL(ttp->ev == ODP_EVENT_INVALID);
> > +-->CU_ASSERT_FATAL(ttp->ev == ODP_EVENT_INVALID);
> > ttp->ev = ev;
> > }
> >  }
> >
> > AFAIU, I should be CU_ASSERT_FATAL(ttp->ev != ODP_EVENT_INVALID) as
> > tt[i].ev = odp_timeout_to_event(odp_timeout_alloc(tbp)) specified while 
> > preparing  all timers.
> Yes the timers are still inactive and the timeout event is stored in
> the 'ev' member.
> 
> handle_timeout() is called for received timeouts (timer has expired).
> In that case, the corresponding 'ev' member should not contain any
> timeout event.
> 
> >
> > Am I missing something in the timer specification ?
> Or the timer specification is missing something?
> 
> odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev); (line 309) is supposed
> to grab the timeout event (on success) and clear the variable (write
> ODP_TIMEOUT_INVALID), that's why the timeout is passed by reference
> ("&tt[i].ev").
> 
> Possibly this is not specified clearly enough in timer.h:
>  * @param[in,out] tmo_ev  Reference to an event variable that points to
>  * timeout event or NULL to reuse the existing timeout event. Any existing
>  * timeout event that is replaced by a successful set operation will be
>  * returned here.
> 
> The new timeout event is read from *tmo_ev. The old timeout event (if
> timer was active) or ODP_TIMEOUT_INVALID (if timer was inactive) is
> stored in *tmo_ev. I hope this is at least clear in the reference
> implementation.

We are on same page, except the last notes
IMO, linux generic timer implementation details leaked into creating the test 
case.

AFAIU, *tmo_ev should have the event that used for _arming_ the timer so 
that application can do some look up after receiving event through queue or 
something similar..
What is the point of providing "ODP_TIMEOUT_INVALID" to application back, What 
the
use of it for the application.

IMO, two way we can come to a conclusion for this issue.
1) Remove CU_ASSERT_FATAL(ttp->ev == ODP_EVENT_INVALID) in handle_tmo function 
in unit testcase
2) Or some reason, If application wants ODP_TIMEOUT_INVALID(for inactive case) 
in *tmo_ev
lets update the specification so that it will clear for odp implementer

any thought from application perspective ?


> 
> >
> > Thanks,
> > Jerin.
> >
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] NUMA aware memory allocation?

2015-05-08 Thread Jerin Jacob
On Thu, May 07, 2015 at 05:00:54PM +0100, Zoltan Kiss wrote:

> Hi,
> 
> I'm not aware of any such interface, but others with more knowledge can
> comment about it. The ODP-DPDK implementation creates buffer pools on the
> NUMA node where the pool create function were actually called.

current ODP spec is not NUMA aware. We need to have API to support nodes 
enumeration and
explicit node parameter to alloc/free resource from specific node like 
odp_shm_reserve_onnode(node, ...)
and while keeping existing API odp_shm_reserve() allocated on node where the 
current code runs


> 
> Regards,
> 
> Zoli
> 
> On 07/05/15 16:32, Gábor Sándor Enyedi wrote:
> >Hi!
> >
> >I just started to test ODP, trying to write my first application, but
> >found a problem: if I want to write NUMA aware code, how should I
> >allocate memory close to a given thread? I mean, I know there is
> >libnuma, but should I use it? I guess not, but I cannot find memory
> >allocation functions in ODP. Is there a function similar to
> >numa_alloc_onnode()?
> >Thanks,
> >
> >Gabor
> >___
> >lng-odp mailing list
> >lng-odp@lists.linaro.org
> >https://lists.linaro.org/mailman/listinfo/lng-odp
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2] example: timer: remove global variables to share the data between workers

2015-05-07 Thread Jerin Jacob
On Wed, Apr 29, 2015 at 03:49:06PM -0400, Mike Holmes wrote:
> On 27 April 2015 at 12:19, Jerin Jacob 
> wrote:
> 
> > use the odp_shared_memory allocater instead of global variables to enable
> > the timer example to run on baremetal/linux process execution environments
> >
> > Signed-off-by: Jerin Jacob 
> >
> 
> Reviewed-and-tested-by: Mike Holmes 

Ping..

> 
> 
> > ---
> >
> > Changes in v2
> > - rebased
> > - added an error check for odp_shm_reserve()
> >
> >  example/timer/odp_timer_test.c | 128
> > ++---
> >  1 file changed, 69 insertions(+), 59 deletions(-)
> >
> > diff --git a/example/timer/odp_timer_test.c
> > b/example/timer/odp_timer_test.c
> > index 526342b..5e4306e 100644
> > --- a/example/timer/odp_timer_test.c
> > +++ b/example/timer/odp_timer_test.c
> > @@ -33,18 +33,21 @@ typedef struct {
> > int tmo_count; /**< Timeout count*/
> >  } test_args_t;
> >
> > -
> > -/** @private Barrier for test synchronisation */
> > -static odp_barrier_t test_barrier;
> > -
> > -/** @private Pool handle */
> > -static odp_pool_t pool;
> > -
> > -/** @private Timer pool handle */
> > -static odp_timer_pool_t tp;
> > -
> > -/** @private Number of timeouts to receive */
> > -static odp_atomic_u32_t remain;
> > +/** @private Helper struct for timers */
> > +struct test_timer {
> > +   odp_timer_t tim;
> > +   odp_event_t ev;
> > +};
> > +
> > +/** Test global variables */
> > +typedef struct {
> > +   test_args_t args;   /**< Test argunments*/
> > +   odp_barrier_t test_barrier; /**< Barrier for test
> > synchronisation*/
> > +   odp_pool_t pool;/**< pool handle*/
> > +   odp_timer_pool_t tp;/**< Timer pool handle*/
> > +   odp_atomic_u32_t remain;/**< Number of timeouts to
> > receive*/
> > +   struct test_timer tt[256];  /**< Array of all timer helper
> > structs*/
> > +} test_globals_t;
> >
> >  /** @private Timer set status ASCII strings */
> >  static const char *timerset2str(odp_timer_set_t val)
> > @@ -63,14 +66,6 @@ static const char *timerset2str(odp_timer_set_t val)
> > }
> >  };
> >
> > -/** @private Helper struct for timers */
> > -struct test_timer {
> > -   odp_timer_t tim;
> > -   odp_event_t ev;
> > -};
> > -
> > -/** @private Array of all timer helper structs */
> > -static struct test_timer tt[256];
> >
> >  /** @private test timeout */
> >  static void free_event(odp_event_t ev)
> > @@ -108,7 +103,7 @@ static void remove_prescheduled_events(void)
> >  }
> >
> >  /** @private test timeout */
> > -static void test_abs_timeouts(int thr, test_args_t *args)
> > +static void test_abs_timeouts(int thr, test_globals_t *gbls)
> >  {
> > uint64_t period;
> > uint64_t period_ns;
> > @@ -121,30 +116,30 @@ static void test_abs_timeouts(int thr, test_args_t
> > *args)
> >
> > queue = odp_queue_lookup("timer_queue");
> >
> > -   period_ns = args->period_us*ODP_TIME_USEC;
> > -   period= odp_timer_ns_to_tick(tp, period_ns);
> > +   period_ns = gbls->args.period_us*ODP_TIME_USEC;
> > +   period= odp_timer_ns_to_tick(gbls->tp, period_ns);
> >
> > EXAMPLE_DBG("  [%i] period %"PRIu64" ticks,  %"PRIu64" ns\n", thr,
> > period, period_ns);
> >
> > EXAMPLE_DBG("  [%i] current tick %"PRIu64"\n", thr,
> > -   odp_timer_current_tick(tp));
> > +   odp_timer_current_tick(gbls->tp));
> >
> > -   ttp = &tt[thr - 1]; /* Thread starts at 1 */
> > -   ttp->tim = odp_timer_alloc(tp, queue, ttp);
> > +   ttp = &gbls->tt[thr];
> > +   ttp->tim = odp_timer_alloc(gbls->tp, queue, ttp);
> > if (ttp->tim == ODP_TIMER_INVALID) {
> > EXAMPLE_ERR("Failed to allocate timer\n");
> > return;
> > }
> > -   tmo = odp_timeout_alloc(pool);
> > +   tmo = odp_timeout_alloc(gbls->pool);
> > if (tmo == ODP_TIMEOUT_INVALID) {
> > EXAMPLE_ERR("Failed to allocate timeout\n");
> > return;
> > }
> > ttp->ev = odp_timeout_to_event(tmo

[lng-odp] [PATCH v2] example: timer: remove global variables to share the data between workers

2015-04-27 Thread Jerin Jacob
use the odp_shared_memory allocater instead of global variables to enable
the timer example to run on baremetal/linux process execution environments

Signed-off-by: Jerin Jacob 
---

Changes in v2
- rebased
- added an error check for odp_shm_reserve()

 example/timer/odp_timer_test.c | 128 ++---
 1 file changed, 69 insertions(+), 59 deletions(-)

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 526342b..5e4306e 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -33,18 +33,21 @@ typedef struct {
int tmo_count; /**< Timeout count*/
 } test_args_t;
 
-
-/** @private Barrier for test synchronisation */
-static odp_barrier_t test_barrier;
-
-/** @private Pool handle */
-static odp_pool_t pool;
-
-/** @private Timer pool handle */
-static odp_timer_pool_t tp;
-
-/** @private Number of timeouts to receive */
-static odp_atomic_u32_t remain;
+/** @private Helper struct for timers */
+struct test_timer {
+   odp_timer_t tim;
+   odp_event_t ev;
+};
+
+/** Test global variables */
+typedef struct {
+   test_args_t args;   /**< Test argunments*/
+   odp_barrier_t test_barrier; /**< Barrier for test synchronisation*/
+   odp_pool_t pool;/**< pool handle*/
+   odp_timer_pool_t tp;/**< Timer pool handle*/
+   odp_atomic_u32_t remain;/**< Number of timeouts to receive*/
+   struct test_timer tt[256];  /**< Array of all timer helper structs*/
+} test_globals_t;
 
 /** @private Timer set status ASCII strings */
 static const char *timerset2str(odp_timer_set_t val)
@@ -63,14 +66,6 @@ static const char *timerset2str(odp_timer_set_t val)
}
 };
 
-/** @private Helper struct for timers */
-struct test_timer {
-   odp_timer_t tim;
-   odp_event_t ev;
-};
-
-/** @private Array of all timer helper structs */
-static struct test_timer tt[256];
 
 /** @private test timeout */
 static void free_event(odp_event_t ev)
@@ -108,7 +103,7 @@ static void remove_prescheduled_events(void)
 }
 
 /** @private test timeout */
-static void test_abs_timeouts(int thr, test_args_t *args)
+static void test_abs_timeouts(int thr, test_globals_t *gbls)
 {
uint64_t period;
uint64_t period_ns;
@@ -121,30 +116,30 @@ static void test_abs_timeouts(int thr, test_args_t *args)
 
queue = odp_queue_lookup("timer_queue");
 
-   period_ns = args->period_us*ODP_TIME_USEC;
-   period= odp_timer_ns_to_tick(tp, period_ns);
+   period_ns = gbls->args.period_us*ODP_TIME_USEC;
+   period= odp_timer_ns_to_tick(gbls->tp, period_ns);
 
EXAMPLE_DBG("  [%i] period %"PRIu64" ticks,  %"PRIu64" ns\n", thr,
period, period_ns);
 
EXAMPLE_DBG("  [%i] current tick %"PRIu64"\n", thr,
-   odp_timer_current_tick(tp));
+   odp_timer_current_tick(gbls->tp));
 
-   ttp = &tt[thr - 1]; /* Thread starts at 1 */
-   ttp->tim = odp_timer_alloc(tp, queue, ttp);
+   ttp = &gbls->tt[thr];
+   ttp->tim = odp_timer_alloc(gbls->tp, queue, ttp);
if (ttp->tim == ODP_TIMER_INVALID) {
EXAMPLE_ERR("Failed to allocate timer\n");
return;
}
-   tmo = odp_timeout_alloc(pool);
+   tmo = odp_timeout_alloc(gbls->pool);
if (tmo == ODP_TIMEOUT_INVALID) {
EXAMPLE_ERR("Failed to allocate timeout\n");
return;
}
ttp->ev = odp_timeout_to_event(tmo);
-   tick = odp_timer_current_tick(tp);
+   tick = odp_timer_current_tick(gbls->tp);
 
-   while ((int)odp_atomic_load_u32(&remain) > 0) {
+   while ((int)odp_atomic_load_u32(&gbls->remain) > 0) {
odp_event_t ev;
odp_timer_set_t rc;
 
@@ -169,7 +164,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
/* Check if odp_schedule() timed out, possibly there
 * are no remaining timeouts to receive */
} while (ev == ODP_EVENT_INVALID &&
-(int)odp_atomic_load_u32(&remain) > 0);
+(int)odp_atomic_load_u32(&gbls->remain) > 0);
 
if (ev == ODP_EVENT_INVALID)
break; /* No more timeouts */
@@ -190,7 +185,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
}
EXAMPLE_DBG("  [%i] timeout, tick %"PRIu64"\n", thr, tick);
 
-   odp_atomic_dec_u32(&remain);
+   odp_atomic_dec_u32(&gbls->remain);
}
 
/* Cancel and free last timer used */
@@ -219,9 +214,9 @@ static void *run_thread(void *ptr)
 {
int thr;
odp_pool_t m

Re: [lng-odp] [PATCH] example: timer: remove global variables to share the data between workers

2015-04-24 Thread Jerin Jacob
On Fri, Apr 24, 2015 at 11:39:58AM +0300, Maxim Uvarov wrote:
> On 04/20/15 11:28, Jerin Jacob wrote:
> >+/* Reserve memory for test_globals_t from shared mem */
> >+shm = odp_shm_reserve("shm_test_globals", sizeof(test_globals_t),
> >+  ODP_CACHE_LINE_SIZE, 0);
> 
> if (ODP_SHM_INVALID == shm)
> return -1;
> 
> >+gbls = odp_shm_addr(shm);
> >+
> >+if (gbls == NULL) {
> >+EXAMPLE_ERR("Error: shared mem alloc failed.\n");
> >+return -1;
> >+}
> that is not needed.

This check should be required. odp_shm_addr() can return NULL. 
Above proposed ODP_SHM_INVALID == shm check
may not be required as odp_shm_addr() function will return NULL if shm == 
ODP_SHM_INVALID


> 
> 
> Thanks,
> Maxim.
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH v2] timer: Add missing platform handles to u64 conversion functions

2015-04-24 Thread Jerin Jacob
On Fri, Apr 24, 2015 at 11:46:53AM +0300, Maxim Uvarov wrote:
> Hi Jerin,
> 
> you you only removed RFC and Petri added sign-off to that patch you should
> include it to patch without rfc.
> 
> also "v1..v2..." should go after --- line in patch. In that case git am just
> skips that comment.

Thanks for pointing it out.

> 
> Patch merged to api-next.
> 
> Thanks,
> Maxim.
> 
> On 04/24/15 09:14, Jerin Jacob wrote:
> >On Mon, Apr 20, 2015 at 04:22:15PM +0530, Jerin Jacob wrote:
> >
> >ping
> >
> >>v1..v2 Removed RFC
> >>
> >>
> >>Signed-off-by: Jerin Jacob 
> >>---
> >>  include/odp/api/timer.h | 39 +++
> >>  1 file changed, 39 insertions(+)
> >>
> >>diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
> >>index 0dc9415..435c004 100644
> >>--- a/include/odp/api/timer.h
> >>+++ b/include/odp/api/timer.h
> >>@@ -366,6 +366,45 @@ odp_timeout_t odp_timeout_alloc(odp_pool_t pool);
> >>  void odp_timeout_free(odp_timeout_t tmo);
> >>  /**
> >>+ * Get printable value for an odp_timer_pool_t
> >>+ *
> >>+ * @param hdl  odp_timer_pool_t handle to be printed
> >>+ * @return uint64_t value that can be used to print/display this
> >>+ * handle
> >>+ *
> >>+ * @note This routine is intended to be used for diagnostic purposes
> >>+ * to enable applications to generate a printable value that represents
> >>+ * an odp_timer_pool_t handle.
> >>+ */
> >>+uint64_t odp_timer_pool_to_u64(odp_timer_pool_t hdl);
> >>+
> >>+/**
> >>+ * Get printable value for an odp_timer_t
> >>+ *
> >>+ * @param hdl  odp_timer_t handle to be printed
> >>+ * @return uint64_t value that can be used to print/display this
> >>+ * handle
> >>+ *
> >>+ * @note This routine is intended to be used for diagnostic purposes
> >>+ * to enable applications to generate a printable value that represents
> >>+ * an odp_timer_t handle.
> >>+ */
> >>+uint64_t odp_timer_to_u64(odp_timer_t hdl);
> >>+
> >>+/**
> >>+ * Get printable value for an odp_timeout_t
> >>+ *
> >>+ * @param hdl  odp_timeout_t handle to be printed
> >>+ * @return uint64_t value that can be used to print/display this
> >>+ * handle
> >>+ *
> >>+ * @note This routine is intended to be used for diagnostic purposes
> >>+ * to enable applications to generate a printable value that represents
> >>+ * an odp_timeout_t handle.
> >>+ */
> >>+uint64_t odp_timeout_to_u64(odp_timeout_t hdl);
> >>+
> >>+/**
> >>   * @}
> >>   */
> >>-- 
> >>2.1.0
> >>
> >___
> >lng-odp mailing list
> >lng-odp@lists.linaro.org
> >https://lists.linaro.org/mailman/listinfo/lng-odp
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] example: timer: remove global variables to share the data between workers

2015-04-23 Thread Jerin Jacob
On Mon, Apr 20, 2015 at 02:05:50PM +0530, Jerin Jacob wrote:

ping

> Adding the the complete git commit log for the commit
> 
> example: timer: remove global variables to share the data between workers.
> use the odp_shared_memory allocater instead to enable the timer example
> to run on baremetal/linux process execution environments.
> 
> 
> On Mon, Apr 20, 2015 at 01:58:01PM +0530, Jerin Jacob wrote:
> > Signed-off-by: Jerin Jacob 
> > ---
> >  example/timer/odp_timer_test.c | 124 
> > +
> >  1 file changed, 65 insertions(+), 59 deletions(-)
> > 
> > diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> > index 6b60ec4..876bf33 100644
> > --- a/example/timer/odp_timer_test.c
> > +++ b/example/timer/odp_timer_test.c
> > @@ -39,18 +39,21 @@ typedef struct {
> > int tmo_count; /**< Timeout count*/
> >  } test_args_t;
> >  
> > -
> > -/** @private Barrier for test synchronisation */
> > -static odp_barrier_t test_barrier;
> > -
> > -/** @private Pool handle */
> > -static odp_pool_t pool;
> > -
> > -/** @private Timer pool handle */
> > -static odp_timer_pool_t tp;
> > -
> > -/** @private Number of timeouts to receive */
> > -static odp_atomic_u32_t remain;
> > +/** @private Helper struct for timers */
> > +struct test_timer {
> > +   odp_timer_t tim;
> > +   odp_event_t ev;
> > +};
> > +
> > +/** Test global variables */
> > +typedef struct {
> > +   test_args_t args;   /**< Test argunments*/
> > +   odp_barrier_t test_barrier; /**< Barrier for test synchronisation*/
> > +   odp_pool_t pool;/**< pool handle*/
> > +   odp_timer_pool_t tp;/**< Timer pool handle*/
> > +   odp_atomic_u32_t remain;/**< Number of timeouts to receive*/
> > +   struct test_timer tt[256];  /**< Array of all timer helper structs*/
> > +} test_globals_t;
> >  
> >  /** @private Timer set status ASCII strings */
> >  static const char *timerset2str(odp_timer_set_t val)
> > @@ -69,17 +72,9 @@ static const char *timerset2str(odp_timer_set_t val)
> > }
> >  };
> >  
> > -/** @private Helper struct for timers */
> > -struct test_timer {
> > -   odp_timer_t tim;
> > -   odp_event_t ev;
> > -};
> > -
> > -/** @private Array of all timer helper structs */
> > -static struct test_timer tt[256];
> >  
> >  /** @private test timeout */
> > -static void test_abs_timeouts(int thr, test_args_t *args)
> > +static void test_abs_timeouts(int thr, test_globals_t *gbls)
> >  {
> > uint64_t period;
> > uint64_t period_ns;
> > @@ -92,30 +87,30 @@ static void test_abs_timeouts(int thr, test_args_t 
> > *args)
> >  
> > queue = odp_queue_lookup("timer_queue");
> >  
> > -   period_ns = args->period_us*ODP_TIME_USEC;
> > -   period= odp_timer_ns_to_tick(tp, period_ns);
> > +   period_ns = gbls->args.period_us*ODP_TIME_USEC;
> > +   period= odp_timer_ns_to_tick(gbls->tp, period_ns);
> >  
> > EXAMPLE_DBG("  [%i] period %"PRIu64" ticks,  %"PRIu64" ns\n", thr,
> > period, period_ns);
> >  
> > EXAMPLE_DBG("  [%i] current tick %"PRIu64"\n", thr,
> > -   odp_timer_current_tick(tp));
> > +   odp_timer_current_tick(gbls->tp));
> >  
> > -   ttp = &tt[thr - 1]; /* Thread starts at 1 */
> > -   ttp->tim = odp_timer_alloc(tp, queue, ttp);
> > +   ttp = &gbls->tt[thr];
> > +   ttp->tim = odp_timer_alloc(gbls->tp, queue, ttp);
> > if (ttp->tim == ODP_TIMER_INVALID) {
> > EXAMPLE_ERR("Failed to allocate timer\n");
> > return;
> > }
> > -   tmo = odp_timeout_alloc(pool);
> > +   tmo = odp_timeout_alloc(gbls->pool);
> > if (tmo == ODP_TIMEOUT_INVALID) {
> > EXAMPLE_ERR("Failed to allocate timeout\n");
> > return;
> > }
> > ttp->ev = odp_timeout_to_event(tmo);
> > -   tick = odp_timer_current_tick(tp);
> > +   tick = odp_timer_current_tick(gbls->tp);
> >  
> > -   while ((int)odp_atomic_load_u32(&remain) > 0) {
> > +   while ((int)odp_atomic_load_u32(&gbls->remain) > 0) {
> > odp_event_t ev;
> > odp_timer_set_t rc;
> >  
> > @@ -140,7 +135,7 @@ static void test_abs_timeouts(i

Re: [lng-odp] [API-NEXT PATCH v2] timer: Add missing platform handles to u64 conversion functions

2015-04-23 Thread Jerin Jacob
On Mon, Apr 20, 2015 at 04:22:15PM +0530, Jerin Jacob wrote:

ping

> v1..v2 Removed RFC
> 
> 
> Signed-off-by: Jerin Jacob 
> ---
>  include/odp/api/timer.h | 39 +++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
> index 0dc9415..435c004 100644
> --- a/include/odp/api/timer.h
> +++ b/include/odp/api/timer.h
> @@ -366,6 +366,45 @@ odp_timeout_t odp_timeout_alloc(odp_pool_t pool);
>  void odp_timeout_free(odp_timeout_t tmo);
>  
>  /**
> + * Get printable value for an odp_timer_pool_t
> + *
> + * @param hdl  odp_timer_pool_t handle to be printed
> + * @return uint64_t value that can be used to print/display this
> + * handle
> + *
> + * @note This routine is intended to be used for diagnostic purposes
> + * to enable applications to generate a printable value that represents
> + * an odp_timer_pool_t handle.
> + */
> +uint64_t odp_timer_pool_to_u64(odp_timer_pool_t hdl);
> +
> +/**
> + * Get printable value for an odp_timer_t
> + *
> + * @param hdl  odp_timer_t handle to be printed
> + * @return uint64_t value that can be used to print/display this
> + * handle
> + *
> + * @note This routine is intended to be used for diagnostic purposes
> + * to enable applications to generate a printable value that represents
> + * an odp_timer_t handle.
> + */
> +uint64_t odp_timer_to_u64(odp_timer_t hdl);
> +
> +/**
> + * Get printable value for an odp_timeout_t
> + *
> + * @param hdl  odp_timeout_t handle to be printed
> + * @return uint64_t value that can be used to print/display this
> + * handle
> + *
> + * @note This routine is intended to be used for diagnostic purposes
> + * to enable applications to generate a printable value that represents
> + * an odp_timeout_t handle.
> + */
> +uint64_t odp_timeout_to_u64(odp_timeout_t hdl);
> +
> +/**
>   * @}
>   */
>  
> -- 
> 2.1.0
> 
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH v2] timer: Add missing platform handles to u64 conversion functions

2015-04-20 Thread Jerin Jacob
v1..v2 Removed RFC


Signed-off-by: Jerin Jacob 
---
 include/odp/api/timer.h | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
index 0dc9415..435c004 100644
--- a/include/odp/api/timer.h
+++ b/include/odp/api/timer.h
@@ -366,6 +366,45 @@ odp_timeout_t odp_timeout_alloc(odp_pool_t pool);
 void odp_timeout_free(odp_timeout_t tmo);
 
 /**
+ * Get printable value for an odp_timer_pool_t
+ *
+ * @param hdl  odp_timer_pool_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timer_pool_t handle.
+ */
+uint64_t odp_timer_pool_to_u64(odp_timer_pool_t hdl);
+
+/**
+ * Get printable value for an odp_timer_t
+ *
+ * @param hdl  odp_timer_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timer_t handle.
+ */
+uint64_t odp_timer_to_u64(odp_timer_t hdl);
+
+/**
+ * Get printable value for an odp_timeout_t
+ *
+ * @param hdl  odp_timeout_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timeout_t handle.
+ */
+uint64_t odp_timeout_to_u64(odp_timeout_t hdl);
+
+/**
  * @}
  */
 
-- 
2.1.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC API-NEXT PATCH] timer: Add missing platform handles to u64 conversion functions

2015-04-20 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/timer.h | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
index 0dc9415..435c004 100644
--- a/include/odp/api/timer.h
+++ b/include/odp/api/timer.h
@@ -366,6 +366,45 @@ odp_timeout_t odp_timeout_alloc(odp_pool_t pool);
 void odp_timeout_free(odp_timeout_t tmo);
 
 /**
+ * Get printable value for an odp_timer_pool_t
+ *
+ * @param hdl  odp_timer_pool_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timer_pool_t handle.
+ */
+uint64_t odp_timer_pool_to_u64(odp_timer_pool_t hdl);
+
+/**
+ * Get printable value for an odp_timer_t
+ *
+ * @param hdl  odp_timer_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timer_t handle.
+ */
+uint64_t odp_timer_to_u64(odp_timer_t hdl);
+
+/**
+ * Get printable value for an odp_timeout_t
+ *
+ * @param hdl  odp_timeout_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timeout_t handle.
+ */
+uint64_t odp_timeout_to_u64(odp_timeout_t hdl);
+
+/**
  * @}
  */
 
-- 
2.1.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] example: timer: remove global variables to share the data between workers

2015-04-20 Thread Jerin Jacob
Adding the the complete git commit log for the commit

example: timer: remove global variables to share the data between workers.
use the odp_shared_memory allocater instead to enable the timer example
to run on baremetal/linux process execution environments.


On Mon, Apr 20, 2015 at 01:58:01PM +0530, Jerin Jacob wrote:
> Signed-off-by: Jerin Jacob 
> ---
>  example/timer/odp_timer_test.c | 124 
> +
>  1 file changed, 65 insertions(+), 59 deletions(-)
> 
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index 6b60ec4..876bf33 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -39,18 +39,21 @@ typedef struct {
>   int tmo_count; /**< Timeout count*/
>  } test_args_t;
>  
> -
> -/** @private Barrier for test synchronisation */
> -static odp_barrier_t test_barrier;
> -
> -/** @private Pool handle */
> -static odp_pool_t pool;
> -
> -/** @private Timer pool handle */
> -static odp_timer_pool_t tp;
> -
> -/** @private Number of timeouts to receive */
> -static odp_atomic_u32_t remain;
> +/** @private Helper struct for timers */
> +struct test_timer {
> + odp_timer_t tim;
> + odp_event_t ev;
> +};
> +
> +/** Test global variables */
> +typedef struct {
> + test_args_t args;   /**< Test argunments*/
> + odp_barrier_t test_barrier; /**< Barrier for test synchronisation*/
> + odp_pool_t pool;/**< pool handle*/
> + odp_timer_pool_t tp;/**< Timer pool handle*/
> + odp_atomic_u32_t remain;/**< Number of timeouts to receive*/
> + struct test_timer tt[256];  /**< Array of all timer helper structs*/
> +} test_globals_t;
>  
>  /** @private Timer set status ASCII strings */
>  static const char *timerset2str(odp_timer_set_t val)
> @@ -69,17 +72,9 @@ static const char *timerset2str(odp_timer_set_t val)
>   }
>  };
>  
> -/** @private Helper struct for timers */
> -struct test_timer {
> - odp_timer_t tim;
> - odp_event_t ev;
> -};
> -
> -/** @private Array of all timer helper structs */
> -static struct test_timer tt[256];
>  
>  /** @private test timeout */
> -static void test_abs_timeouts(int thr, test_args_t *args)
> +static void test_abs_timeouts(int thr, test_globals_t *gbls)
>  {
>   uint64_t period;
>   uint64_t period_ns;
> @@ -92,30 +87,30 @@ static void test_abs_timeouts(int thr, test_args_t *args)
>  
>   queue = odp_queue_lookup("timer_queue");
>  
> - period_ns = args->period_us*ODP_TIME_USEC;
> - period= odp_timer_ns_to_tick(tp, period_ns);
> + period_ns = gbls->args.period_us*ODP_TIME_USEC;
> + period= odp_timer_ns_to_tick(gbls->tp, period_ns);
>  
>   EXAMPLE_DBG("  [%i] period %"PRIu64" ticks,  %"PRIu64" ns\n", thr,
>   period, period_ns);
>  
>   EXAMPLE_DBG("  [%i] current tick %"PRIu64"\n", thr,
> - odp_timer_current_tick(tp));
> + odp_timer_current_tick(gbls->tp));
>  
> - ttp = &tt[thr - 1]; /* Thread starts at 1 */
> - ttp->tim = odp_timer_alloc(tp, queue, ttp);
> + ttp = &gbls->tt[thr];
> + ttp->tim = odp_timer_alloc(gbls->tp, queue, ttp);
>   if (ttp->tim == ODP_TIMER_INVALID) {
>   EXAMPLE_ERR("Failed to allocate timer\n");
>   return;
>   }
> - tmo = odp_timeout_alloc(pool);
> + tmo = odp_timeout_alloc(gbls->pool);
>   if (tmo == ODP_TIMEOUT_INVALID) {
>   EXAMPLE_ERR("Failed to allocate timeout\n");
>   return;
>   }
>   ttp->ev = odp_timeout_to_event(tmo);
> - tick = odp_timer_current_tick(tp);
> + tick = odp_timer_current_tick(gbls->tp);
>  
> - while ((int)odp_atomic_load_u32(&remain) > 0) {
> + while ((int)odp_atomic_load_u32(&gbls->remain) > 0) {
>   odp_event_t ev;
>   odp_timer_set_t rc;
>  
> @@ -140,7 +135,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
>   /* Check if odp_schedule() timed out, possibly there
>* are no remaining timeouts to receive */
>   } while (ev == ODP_EVENT_INVALID &&
> -  (int)odp_atomic_load_u32(&remain) > 0);
> +  (int)odp_atomic_load_u32(&gbls->remain) > 0);
>  
>   if (ev == ODP_EVENT_INVALID)
>   break; /* No more timeouts */
> @@ -161,7 +156,7 @@ static vo

[lng-odp] [PATCH] example: timer: remove global variables to share the data between workers

2015-04-20 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 example/timer/odp_timer_test.c | 124 +
 1 file changed, 65 insertions(+), 59 deletions(-)

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 6b60ec4..876bf33 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -39,18 +39,21 @@ typedef struct {
int tmo_count; /**< Timeout count*/
 } test_args_t;
 
-
-/** @private Barrier for test synchronisation */
-static odp_barrier_t test_barrier;
-
-/** @private Pool handle */
-static odp_pool_t pool;
-
-/** @private Timer pool handle */
-static odp_timer_pool_t tp;
-
-/** @private Number of timeouts to receive */
-static odp_atomic_u32_t remain;
+/** @private Helper struct for timers */
+struct test_timer {
+   odp_timer_t tim;
+   odp_event_t ev;
+};
+
+/** Test global variables */
+typedef struct {
+   test_args_t args;   /**< Test argunments*/
+   odp_barrier_t test_barrier; /**< Barrier for test synchronisation*/
+   odp_pool_t pool;/**< pool handle*/
+   odp_timer_pool_t tp;/**< Timer pool handle*/
+   odp_atomic_u32_t remain;/**< Number of timeouts to receive*/
+   struct test_timer tt[256];  /**< Array of all timer helper structs*/
+} test_globals_t;
 
 /** @private Timer set status ASCII strings */
 static const char *timerset2str(odp_timer_set_t val)
@@ -69,17 +72,9 @@ static const char *timerset2str(odp_timer_set_t val)
}
 };
 
-/** @private Helper struct for timers */
-struct test_timer {
-   odp_timer_t tim;
-   odp_event_t ev;
-};
-
-/** @private Array of all timer helper structs */
-static struct test_timer tt[256];
 
 /** @private test timeout */
-static void test_abs_timeouts(int thr, test_args_t *args)
+static void test_abs_timeouts(int thr, test_globals_t *gbls)
 {
uint64_t period;
uint64_t period_ns;
@@ -92,30 +87,30 @@ static void test_abs_timeouts(int thr, test_args_t *args)
 
queue = odp_queue_lookup("timer_queue");
 
-   period_ns = args->period_us*ODP_TIME_USEC;
-   period= odp_timer_ns_to_tick(tp, period_ns);
+   period_ns = gbls->args.period_us*ODP_TIME_USEC;
+   period= odp_timer_ns_to_tick(gbls->tp, period_ns);
 
EXAMPLE_DBG("  [%i] period %"PRIu64" ticks,  %"PRIu64" ns\n", thr,
period, period_ns);
 
EXAMPLE_DBG("  [%i] current tick %"PRIu64"\n", thr,
-   odp_timer_current_tick(tp));
+   odp_timer_current_tick(gbls->tp));
 
-   ttp = &tt[thr - 1]; /* Thread starts at 1 */
-   ttp->tim = odp_timer_alloc(tp, queue, ttp);
+   ttp = &gbls->tt[thr];
+   ttp->tim = odp_timer_alloc(gbls->tp, queue, ttp);
if (ttp->tim == ODP_TIMER_INVALID) {
EXAMPLE_ERR("Failed to allocate timer\n");
return;
}
-   tmo = odp_timeout_alloc(pool);
+   tmo = odp_timeout_alloc(gbls->pool);
if (tmo == ODP_TIMEOUT_INVALID) {
EXAMPLE_ERR("Failed to allocate timeout\n");
return;
}
ttp->ev = odp_timeout_to_event(tmo);
-   tick = odp_timer_current_tick(tp);
+   tick = odp_timer_current_tick(gbls->tp);
 
-   while ((int)odp_atomic_load_u32(&remain) > 0) {
+   while ((int)odp_atomic_load_u32(&gbls->remain) > 0) {
odp_event_t ev;
odp_timer_set_t rc;
 
@@ -140,7 +135,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
/* Check if odp_schedule() timed out, possibly there
 * are no remaining timeouts to receive */
} while (ev == ODP_EVENT_INVALID &&
-(int)odp_atomic_load_u32(&remain) > 0);
+(int)odp_atomic_load_u32(&gbls->remain) > 0);
 
if (ev == ODP_EVENT_INVALID)
break; /* No more timeouts */
@@ -161,7 +156,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
}
EXAMPLE_DBG("  [%i] timeout, tick %"PRIu64"\n", thr, tick);
 
-   odp_atomic_dec_u32(&remain);
+   odp_atomic_dec_u32(&gbls->remain);
}
 
/* Cancel and free last timer used */
@@ -187,9 +182,9 @@ static void *run_thread(void *ptr)
 {
int thr;
odp_pool_t msg_pool;
-   test_args_t *args;
+   test_globals_t *gbls;
 
-   args = ptr;
+   gbls = ptr;
thr  = odp_thread_id();
 
printf("Thread %i starts on cpu %i\n", thr, odp_cpu_id());
@@ -204,9 +199,9 @@ static void *run_thread(void *ptr)
return NULL;
}
 
-   odp_barrier_wait(&test_barrier);
+ 

Re: [lng-odp] NO ODP API for Packet classification and Packet Shaping

2015-04-07 Thread Jerin Jacob
On Tue, Apr 07, 2015 at 01:58:51PM +0300, Taras Kondratiuk wrote:
> On 04/07/2015 12:40 PM, Jerin Jacob wrote:
> >On Tue, Apr 07, 2015 at 12:01:30PM +0300, Taras Kondratiuk wrote:
> >>On 04/06/2015 07:41 PM, Bill Fischofer wrote:
> >>>I would call these "pool groups" for symmetry with "queue groups" and so
> >>>the API would be odp_pool_create_group(), odp_pool_destroy_group(), etc.
> >>
> >>If it is called "pool group", then it sounds like a separate
> >>abstraction. Which in turn needs a separate type and new API functions
> >>to destroy or attach to somewhere (pktio, CoS, etc.).
> >
> >We have introduced the new classification term ODP_PMR_LEN to
> >address "Segmentation optimization" use case by attaching
> >different pools based on packet len.
> >
> >Are we introducing the new composite pool schematics because
> >ODP_PMR_LEN cannot implemented in hardware ?
> 
> Hi Jerin,
> 
> I've described in this thread why ODP_PMR_LEN does not address
> this use-case correctly. It sets too strict classification rules,
> which are not needed in this use-case.

Hi Taras,

Got the use-case description from the thread. If application really _demands_ 
for such
fine grained memory optimization then composite pool OR additional hint in the 
pool creation
is the way to go









___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] NO ODP API for Packet classification and Packet Shaping

2015-04-07 Thread Jerin Jacob
On Tue, Apr 07, 2015 at 12:01:30PM +0300, Taras Kondratiuk wrote:
> On 04/06/2015 07:41 PM, Bill Fischofer wrote:
> >I would call these "pool groups" for symmetry with "queue groups" and so
> >the API would be odp_pool_create_group(), odp_pool_destroy_group(), etc.
> 
> If it is called "pool group", then it sounds like a separate
> abstraction. Which in turn needs a separate type and new API functions
> to destroy or attach to somewhere (pktio, CoS, etc.).

We have introduced the new classification term ODP_PMR_LEN to 
address "Segmentation optimization" use case by attaching
different pools based on packet len.

Are we introducing the new composite pool schematics because
ODP_PMR_LEN cannot implemented in hardware ?


> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [RFC v3 0/4] Move the definition of odp syncronizers abstract types to platform

2015-03-20 Thread Jerin Jacob
On Wed, Mar 18, 2015 at 11:29:03AM -0500, Bill Fischofer wrote:

Ping

> This version looks good.  For this series:
> 
> Reviewed-and-tested-by: Bill Fischofer 
> 
> On Wed, Mar 18, 2015 at 9:11 AM, Jerin Jacob  > wrote:
> 
> > Move the definition of odp syncronizers abstract types to platform
> > from public headerfile.
> > This will allow the platform to define odp syncronizers abstract type.
> > Useful when native SDK has definition of the odp syncronizers and
> > ODP implementation decides to reuses them.
> >
> > v1..v2 Corrected the Doxygen documentation issues identified by Petri
> > v2..v3 Fixed compilation issues in 'make distcheck' identified by Bill
> >
> >
> > Jerin Jacob (4):
> >   spinlock: allow platform to override odp_spinlock_t
> >   rwlock: allow platform to override odp_rwlock_t
> >   ticketlock: allow platform to override odp_ticketlock_t
> >   barrier: allow platform to override odp_barrier_t
> >
> >  include/odp/api/barrier.h  |  7 +---
> >  include/odp/api/rwlock.h   | 11 +
> >  include/odp/api/spinlock.h | 10 +
> >  include/odp/api/ticketlock.h   | 12 +-
> >  platform/linux-generic/Makefile.am |  4 ++
> >  platform/linux-generic/include/odp/barrier.h   |  1 +
> >  .../linux-generic/include/odp/plat/barrier_types.h | 47
> > +
> >  .../linux-generic/include/odp/plat/rwlock_types.h  | 48
> > ++
> >  .../include/odp/plat/spinlock_types.h  | 46
> > +
> >  .../include/odp/plat/ticketlock_types.h| 46
> > +
> >  platform/linux-generic/include/odp/rwlock.h|  2 +
> >  platform/linux-generic/include/odp/spinlock.h  |  2 +
> >  platform/linux-generic/include/odp/ticketlock.h|  2 +
> >  13 files changed, 205 insertions(+), 33 deletions(-)
> >  create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h
> >  create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h
> >  create mode 100644
> > platform/linux-generic/include/odp/plat/spinlock_types.h
> >  create mode 100644
> > platform/linux-generic/include/odp/plat/ticketlock_types.h
> >
> > --
> > 2.1.0
> >
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
> >

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v3 3/4] ticketlock: allow platform to override odp_ticketlock_t

2015-03-18 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/ticketlock.h   | 12 +-
 platform/linux-generic/Makefile.am |  1 +
 .../include/odp/plat/ticketlock_types.h| 46 ++
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 4 files changed, 51 insertions(+), 10 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

diff --git a/include/odp/api/ticketlock.h b/include/odp/api/ticketlock.h
index e088e8b..e395ac4 100644
--- a/include/odp/api/ticketlock.h
+++ b/include/odp/api/ticketlock.h
@@ -18,10 +18,6 @@
 extern "C" {
 #endif
 
-
-#include 
-#include 
-
 /** @addtogroup odp_synchronizers
  * Operations on ticket locks.
  * Acquiring a ticket lock happens in two phases. First the threads takes a
@@ -32,13 +28,9 @@ extern "C" {
  */
 
 /**
- * ODP ticket lock
+ * @typedef odp_ticketlock_t
+ * ODP ticketlock
  */
-typedef struct odp_ticketlock_t {
-   odp_atomic_u32_t  next_ticket; /**< @private Next ticket */
-   odp_atomic_u32_t  cur_ticket;  /**< @private Current ticket */
-} odp_ticketlock_t;
-
 
 /**
  * Initialize ticket lock.
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 200523c..cef7ecc 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -63,6 +63,7 @@ odpplatinclude_HEADERS = \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/spinlock_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/strong_types.h \
+ 
$(top_srcdir)/platform/linux-generic/include/odp/plat/ticketlock_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/timer_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/version_types.h
 
diff --git a/platform/linux-generic/include/odp/plat/ticketlock_types.h 
b/platform/linux-generic/include/odp/plat/ticketlock_types.h
new file mode 100644
index 000..be93085
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/ticketlock_types.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP ticketlock
+ */
+
+#ifndef ODP_TICKETLOCK_TYPES_H_
+#define ODP_TICKETLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP ticketlock
+ */
+struct odp_ticketlock_s {
+   odp_atomic_u32_t  next_ticket; /**< Next ticket */
+   odp_atomic_u32_t  cur_ticket;  /**< Current ticket */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_ticketlock_s odp_ticketlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/ticketlock.h 
b/platform/linux-generic/include/odp/ticketlock.h
index fc7f438..658e27f 100644
--- a/platform/linux-generic/include/odp/ticketlock.h
+++ b/platform/linux-generic/include/odp/ticketlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  Operations on ticket locks.
  *  @{
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v3 1/4] spinlock: allow platform to override odp_spinlock_t

2015-03-18 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/spinlock.h | 10 +
 platform/linux-generic/Makefile.am |  1 +
 .../include/odp/plat/spinlock_types.h  | 46 ++
 platform/linux-generic/include/odp/spinlock.h  |  2 +
 4 files changed, 51 insertions(+), 8 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h

diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h
index 5cde123..9a5a929 100644
--- a/include/odp/api/spinlock.h
+++ b/include/odp/api/spinlock.h
@@ -18,21 +18,15 @@
 extern "C" {
 #endif
 
-
-#include 
-
 /** @addtogroup odp_synchronizers
  *  Operations on spin locks.
  *  @{
  */
 
 /**
- * ODP spinlock type
+ * @typedef odp_spinlock_t
+ * ODP spinlock
  */
-typedef struct odp_spinlock_t {
-   char lock;  /**< @private lock flag, should match odp_atomic_flag_t */
-} odp_spinlock_t;
-
 
 /**
  * Initialize spin lock.
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 9aed113..9749df6 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -60,6 +60,7 @@ odpplatinclude_HEADERS = \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/queue_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/schedule_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \
+ 
$(top_srcdir)/platform/linux-generic/include/odp/plat/spinlock_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/strong_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/timer_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/version_types.h
diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h 
b/platform/linux-generic/include/odp/plat/spinlock_types.h
new file mode 100644
index 000..83d306b
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/spinlock_types.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP spinlock
+ */
+
+#ifndef ODP_SPINLOCK_TYPES_H_
+#define ODP_SPINLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP spinlock
+ */
+struct odp_spinlock_s {
+   char lock;  /**< lock flag, should match odp_atomic_flag_t */
+};
+
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_spinlock_s odp_spinlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/spinlock.h 
b/platform/linux-generic/include/odp/spinlock.h
index e02df49..7dbb1c4 100644
--- a/platform/linux-generic/include/odp/spinlock.h
+++ b/platform/linux-generic/include/odp/spinlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v3 4/4] barrier: allow platform to override odp_barrier_t

2015-03-18 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/barrier.h  |  7 +---
 platform/linux-generic/Makefile.am |  1 +
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 47 ++
 4 files changed, 50 insertions(+), 6 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h

diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h
index 35f0981..28310ba 100644
--- a/include/odp/api/barrier.h
+++ b/include/odp/api/barrier.h
@@ -18,20 +18,15 @@
 extern "C" {
 #endif
 
-
 /** @addtogroup odp_synchronizers
  *  Synchronize threads.
  *  @{
  */
 
 /**
+ * @typedef odp_barrier_t
  * ODP thread synchronization barrier
  */
-typedef struct odp_barrier_t {
-   uint32_t count;  /**< @private Thread count */
-   odp_atomic_u32_t bar;/**< @private Barrier counter */
-} odp_barrier_t;
-
 
 /**
  * Initialize barrier with thread count.
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index cef7ecc..e5558ac 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -48,6 +48,7 @@ odpinclude_HEADERS = \
 odpplatincludedir= $(includedir)/odp/plat
 odpplatinclude_HEADERS = \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/atomic_types.h \
+ 
$(top_srcdir)/platform/linux-generic/include/odp/plat/barrier_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/buffer_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/byteorder_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/classification_types.h \
diff --git a/platform/linux-generic/include/odp/barrier.h 
b/platform/linux-generic/include/odp/barrier.h
index d63c219..7ea5a6b 100644
--- a/platform/linux-generic/include/odp/barrier.h
+++ b/platform/linux-generic/include/odp/barrier.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 /** @ingroup odp_synchronizers
  *  @{
diff --git a/platform/linux-generic/include/odp/plat/barrier_types.h 
b/platform/linux-generic/include/odp/plat/barrier_types.h
new file mode 100644
index 000..c8c978d
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/barrier_types.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP barrier
+ */
+
+#ifndef ODP_BARRIER_TYPES_H_
+#define ODP_BARRIER_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+/**
+ * @internal
+ * ODP thread synchronization barrier
+ */
+struct odp_barrier_s {
+   uint32_t count;  /**< Thread count */
+   odp_atomic_u32_t bar;/**< Barrier counter */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_barrier_s odp_barrier_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v3 0/4] Move the definition of odp syncronizers abstract types to platform

2015-03-18 Thread Jerin Jacob
Move the definition of odp syncronizers abstract types to platform
from public headerfile.
This will allow the platform to define odp syncronizers abstract type.
Useful when native SDK has definition of the odp syncronizers and
ODP implementation decides to reuses them.

v1..v2 Corrected the Doxygen documentation issues identified by Petri
v2..v3 Fixed compilation issues in 'make distcheck' identified by Bill


Jerin Jacob (4):
  spinlock: allow platform to override odp_spinlock_t
  rwlock: allow platform to override odp_rwlock_t
  ticketlock: allow platform to override odp_ticketlock_t
  barrier: allow platform to override odp_barrier_t

 include/odp/api/barrier.h  |  7 +---
 include/odp/api/rwlock.h   | 11 +
 include/odp/api/spinlock.h | 10 +
 include/odp/api/ticketlock.h   | 12 +-
 platform/linux-generic/Makefile.am |  4 ++
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 47 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 48 ++
 .../include/odp/plat/spinlock_types.h  | 46 +
 .../include/odp/plat/ticketlock_types.h| 46 +
 platform/linux-generic/include/odp/rwlock.h|  2 +
 platform/linux-generic/include/odp/spinlock.h  |  2 +
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 13 files changed, 205 insertions(+), 33 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v3 2/4] rwlock: allow platform to override odp_rwlock_t

2015-03-18 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/rwlock.h   | 11 +
 platform/linux-generic/Makefile.am |  1 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 48 ++
 platform/linux-generic/include/odp/rwlock.h|  2 +
 4 files changed, 53 insertions(+), 9 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h

diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
index 950b83a..d730a70 100644
--- a/include/odp/api/rwlock.h
+++ b/include/odp/api/rwlock.h
@@ -13,8 +13,6 @@
  * ODP RW Locks
  */
 
-#include 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -29,14 +27,9 @@ extern "C" {
  */
 
 /**
- * The odp_rwlock_t type.
+ * @typedef odp_rwlock_t
+ * ODP rwlock
  */
-typedef struct {
-   odp_atomic_u32_t cnt; /**< @private lock count
-   0 lock not taken
-   -1 write lock taken
-   >0 read lock(s) taken */
-} odp_rwlock_t;
 
 
 /**
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 9749df6..200523c 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -58,6 +58,7 @@ odpplatinclude_HEADERS = \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/packet_io_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/pool_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/queue_types.h \
+ 
$(top_srcdir)/platform/linux-generic/include/odp/plat/rwlock_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/schedule_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/spinlock_types.h \
diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h 
b/platform/linux-generic/include/odp/plat/rwlock_types.h
new file mode 100644
index 000..bd46e57
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP rwlock
+ */
+
+#ifndef ODP_RWLOCK_TYPES_H_
+#define ODP_RWLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP rwlock
+ */
+struct odp_rwlock_s {
+   odp_atomic_u32_t cnt; /**< lock count
+   0 lock not taken
+   -1 write lock taken
+   >0 read lock(s) taken */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_rwlock_s odp_rwlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/rwlock.h 
b/platform/linux-generic/include/odp/rwlock.h
index 06320f6..ca88ff7 100644
--- a/platform/linux-generic/include/odp/rwlock.h
+++ b/platform/linux-generic/include/odp/rwlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v2 2/4] rwlock: allow platform to override odp_rwlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/rwlock.h   | 11 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 48 ++
 platform/linux-generic/include/odp/rwlock.h|  2 +
 3 files changed, 52 insertions(+), 9 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h

diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
index 950b83a..d730a70 100644
--- a/include/odp/api/rwlock.h
+++ b/include/odp/api/rwlock.h
@@ -13,8 +13,6 @@
  * ODP RW Locks
  */
 
-#include 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -29,14 +27,9 @@ extern "C" {
  */
 
 /**
- * The odp_rwlock_t type.
+ * @typedef odp_rwlock_t
+ * ODP rwlock
  */
-typedef struct {
-   odp_atomic_u32_t cnt; /**< @private lock count
-   0 lock not taken
-   -1 write lock taken
-   >0 read lock(s) taken */
-} odp_rwlock_t;
 
 
 /**
diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h 
b/platform/linux-generic/include/odp/plat/rwlock_types.h
new file mode 100644
index 000..bd46e57
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP rwlock
+ */
+
+#ifndef ODP_RWLOCK_TYPES_H_
+#define ODP_RWLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP rwlock
+ */
+struct odp_rwlock_s {
+   odp_atomic_u32_t cnt; /**< lock count
+   0 lock not taken
+   -1 write lock taken
+   >0 read lock(s) taken */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_rwlock_s odp_rwlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/rwlock.h 
b/platform/linux-generic/include/odp/rwlock.h
index 06320f6..ca88ff7 100644
--- a/platform/linux-generic/include/odp/rwlock.h
+++ b/platform/linux-generic/include/odp/rwlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v2 3/4] ticketlock: allow platform to override odp_ticketlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/ticketlock.h   | 12 +-
 .../include/odp/plat/ticketlock_types.h| 46 ++
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 3 files changed, 50 insertions(+), 10 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

diff --git a/include/odp/api/ticketlock.h b/include/odp/api/ticketlock.h
index e088e8b..e395ac4 100644
--- a/include/odp/api/ticketlock.h
+++ b/include/odp/api/ticketlock.h
@@ -18,10 +18,6 @@
 extern "C" {
 #endif
 
-
-#include 
-#include 
-
 /** @addtogroup odp_synchronizers
  * Operations on ticket locks.
  * Acquiring a ticket lock happens in two phases. First the threads takes a
@@ -32,13 +28,9 @@ extern "C" {
  */
 
 /**
- * ODP ticket lock
+ * @typedef odp_ticketlock_t
+ * ODP ticketlock
  */
-typedef struct odp_ticketlock_t {
-   odp_atomic_u32_t  next_ticket; /**< @private Next ticket */
-   odp_atomic_u32_t  cur_ticket;  /**< @private Current ticket */
-} odp_ticketlock_t;
-
 
 /**
  * Initialize ticket lock.
diff --git a/platform/linux-generic/include/odp/plat/ticketlock_types.h 
b/platform/linux-generic/include/odp/plat/ticketlock_types.h
new file mode 100644
index 000..be93085
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/ticketlock_types.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP ticketlock
+ */
+
+#ifndef ODP_TICKETLOCK_TYPES_H_
+#define ODP_TICKETLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP ticketlock
+ */
+struct odp_ticketlock_s {
+   odp_atomic_u32_t  next_ticket; /**< Next ticket */
+   odp_atomic_u32_t  cur_ticket;  /**< Current ticket */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_ticketlock_s odp_ticketlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/ticketlock.h 
b/platform/linux-generic/include/odp/ticketlock.h
index fc7f438..658e27f 100644
--- a/platform/linux-generic/include/odp/ticketlock.h
+++ b/platform/linux-generic/include/odp/ticketlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  Operations on ticket locks.
  *  @{
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v2 4/4] barrier: allow platform to override odp_barrier_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/barrier.h  |  7 +---
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 47 ++
 3 files changed, 49 insertions(+), 6 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h

diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h
index 35f0981..28310ba 100644
--- a/include/odp/api/barrier.h
+++ b/include/odp/api/barrier.h
@@ -18,20 +18,15 @@
 extern "C" {
 #endif
 
-
 /** @addtogroup odp_synchronizers
  *  Synchronize threads.
  *  @{
  */
 
 /**
+ * @typedef odp_barrier_t
  * ODP thread synchronization barrier
  */
-typedef struct odp_barrier_t {
-   uint32_t count;  /**< @private Thread count */
-   odp_atomic_u32_t bar;/**< @private Barrier counter */
-} odp_barrier_t;
-
 
 /**
  * Initialize barrier with thread count.
diff --git a/platform/linux-generic/include/odp/barrier.h 
b/platform/linux-generic/include/odp/barrier.h
index d63c219..7ea5a6b 100644
--- a/platform/linux-generic/include/odp/barrier.h
+++ b/platform/linux-generic/include/odp/barrier.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 /** @ingroup odp_synchronizers
  *  @{
diff --git a/platform/linux-generic/include/odp/plat/barrier_types.h 
b/platform/linux-generic/include/odp/plat/barrier_types.h
new file mode 100644
index 000..c8c978d
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/barrier_types.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP barrier
+ */
+
+#ifndef ODP_BARRIER_TYPES_H_
+#define ODP_BARRIER_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+/**
+ * @internal
+ * ODP thread synchronization barrier
+ */
+struct odp_barrier_s {
+   uint32_t count;  /**< Thread count */
+   odp_atomic_u32_t bar;/**< Barrier counter */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_barrier_s odp_barrier_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v2 0/4] Move the definition of odp syncronizers abstract types to platform

2015-03-17 Thread Jerin Jacob
Move the definition of odp syncronizers abstract types to platform
from public headerfile.
This will allow platform define odp syncronizers abstract type.
Useful when native SDK has definition of the odp syncronizers and
ODP implementation decides to reuses them.

v1..v2 Corrected Doxygen documentation issues proposed by Petri


Jerin Jacob (4):
  spinlock: allow platform to override odp_spinlock_t
  rwlock: allow platform to override odp_rwlock_t
  ticketlock: allow platform to override odp_ticketlock_t
  barrier: allow platform to override odp_barrier_t

 include/odp/api/barrier.h  |  7 +---
 include/odp/api/rwlock.h   | 11 +
 include/odp/api/spinlock.h | 10 +
 include/odp/api/ticketlock.h   | 12 +-
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 47 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 48 ++
 .../include/odp/plat/spinlock_types.h  | 46 +
 .../include/odp/plat/ticketlock_types.h| 46 +
 platform/linux-generic/include/odp/rwlock.h|  2 +
 platform/linux-generic/include/odp/spinlock.h  |  2 +
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 12 files changed, 201 insertions(+), 33 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v2 1/4] spinlock: allow platform to override odp_spinlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/spinlock.h | 10 +
 .../include/odp/plat/spinlock_types.h  | 46 ++
 platform/linux-generic/include/odp/spinlock.h  |  2 +
 3 files changed, 50 insertions(+), 8 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h

diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h
index 5cde123..9a5a929 100644
--- a/include/odp/api/spinlock.h
+++ b/include/odp/api/spinlock.h
@@ -18,21 +18,15 @@
 extern "C" {
 #endif
 
-
-#include 
-
 /** @addtogroup odp_synchronizers
  *  Operations on spin locks.
  *  @{
  */
 
 /**
- * ODP spinlock type
+ * @typedef odp_spinlock_t
+ * ODP spinlock
  */
-typedef struct odp_spinlock_t {
-   char lock;  /**< @private lock flag, should match odp_atomic_flag_t */
-} odp_spinlock_t;
-
 
 /**
  * Initialize spin lock.
diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h 
b/platform/linux-generic/include/odp/plat/spinlock_types.h
new file mode 100644
index 000..83d306b
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/spinlock_types.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP spinlock
+ */
+
+#ifndef ODP_SPINLOCK_TYPES_H_
+#define ODP_SPINLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP spinlock
+ */
+struct odp_spinlock_s {
+   char lock;  /**< lock flag, should match odp_atomic_flag_t */
+};
+
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_spinlock_s odp_spinlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/spinlock.h 
b/platform/linux-generic/include/odp/spinlock.h
index e02df49..7dbb1c4 100644
--- a/platform/linux-generic/include/odp/spinlock.h
+++ b/platform/linux-generic/include/odp/spinlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC 3/4] ticketlock: allow platform to override odp_ticketlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/ticketlock.h   | 12 --
 .../include/odp/plat/ticketlock_types.h| 43 ++
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 3 files changed, 45 insertions(+), 12 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

diff --git a/include/odp/api/ticketlock.h b/include/odp/api/ticketlock.h
index e088e8b..40ac00f 100644
--- a/include/odp/api/ticketlock.h
+++ b/include/odp/api/ticketlock.h
@@ -18,10 +18,6 @@
 extern "C" {
 #endif
 
-
-#include 
-#include 
-
 /** @addtogroup odp_synchronizers
  * Operations on ticket locks.
  * Acquiring a ticket lock happens in two phases. First the threads takes a
@@ -31,14 +27,6 @@ extern "C" {
  *  @{
  */
 
-/**
- * ODP ticket lock
- */
-typedef struct odp_ticketlock_t {
-   odp_atomic_u32_t  next_ticket; /**< @private Next ticket */
-   odp_atomic_u32_t  cur_ticket;  /**< @private Current ticket */
-} odp_ticketlock_t;
-
 
 /**
  * Initialize ticket lock.
diff --git a/platform/linux-generic/include/odp/plat/ticketlock_types.h 
b/platform/linux-generic/include/odp/plat/ticketlock_types.h
new file mode 100644
index 000..3cb76cb
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/ticketlock_types.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP ticketlock
+ */
+
+#ifndef ODP_TICKETLOCK_TYPES_H_
+#define ODP_TICKETLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+/**
+ * ODP ticket lock
+ */
+typedef struct odp_ticketlock_t {
+   odp_atomic_u32_t  next_ticket; /**< @private Next ticket */
+   odp_atomic_u32_t  cur_ticket;  /**< @private Current ticket */
+} odp_ticketlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/ticketlock.h 
b/platform/linux-generic/include/odp/ticketlock.h
index fc7f438..658e27f 100644
--- a/platform/linux-generic/include/odp/ticketlock.h
+++ b/platform/linux-generic/include/odp/ticketlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  Operations on ticket locks.
  *  @{
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC 4/4] barrier: allow platform to override odp_barrier_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/barrier.h  |  9 -
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 44 ++
 3 files changed, 45 insertions(+), 9 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h

diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h
index 35f0981..0e79e02 100644
--- a/include/odp/api/barrier.h
+++ b/include/odp/api/barrier.h
@@ -18,20 +18,11 @@
 extern "C" {
 #endif
 
-
 /** @addtogroup odp_synchronizers
  *  Synchronize threads.
  *  @{
  */
 
-/**
- * ODP thread synchronization barrier
- */
-typedef struct odp_barrier_t {
-   uint32_t count;  /**< @private Thread count */
-   odp_atomic_u32_t bar;/**< @private Barrier counter */
-} odp_barrier_t;
-
 
 /**
  * Initialize barrier with thread count.
diff --git a/platform/linux-generic/include/odp/barrier.h 
b/platform/linux-generic/include/odp/barrier.h
index d63c219..7ea5a6b 100644
--- a/platform/linux-generic/include/odp/barrier.h
+++ b/platform/linux-generic/include/odp/barrier.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 /** @ingroup odp_synchronizers
  *  @{
diff --git a/platform/linux-generic/include/odp/plat/barrier_types.h 
b/platform/linux-generic/include/odp/plat/barrier_types.h
new file mode 100644
index 000..614b9b1
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/barrier_types.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP barrier
+ */
+
+#ifndef ODP_BARRIER_TYPES_H_
+#define ODP_BARRIER_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+/**
+ * ODP thread synchronization barrier
+ */
+typedef struct odp_barrier_t {
+   uint32_t count;  /**< @private Thread count */
+   odp_atomic_u32_t bar;/**< @private Barrier counter */
+} odp_barrier_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC 0/4] Move the definition of odp syncronizers abstract types to platform

2015-03-17 Thread Jerin Jacob
Move the definition of odp syncronizers abstract types to platform
from public headerfile.
This will allow platform define odp syncronizers abstract type.
Useful when native SDK has definition of the odp syncronizers and
ODP implementation decides to reuses them.

Jerin Jacob (4):
  spinlock: allow platform to override odp_spinlock_t
  rwlock: allow platform to override odp_rwlock_t
  ticketlock: allow platform to override odp_ticketlock_t
  barrier: allow platform to override odp_barrier_t

 include/odp/api/barrier.h  |  9 -
 include/odp/api/rwlock.h   | 12 --
 include/odp/api/spinlock.h | 10 -
 include/odp/api/ticketlock.h   | 12 --
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 44 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 45 ++
 .../include/odp/plat/spinlock_types.h  | 42 
 .../include/odp/plat/ticketlock_types.h| 43 +
 platform/linux-generic/include/odp/rwlock.h|  2 +
 platform/linux-generic/include/odp/spinlock.h  |  2 +
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 12 files changed, 181 insertions(+), 43 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC 2/4] rwlock: allow platform to override odp_rwlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/rwlock.h   | 12 --
 .../linux-generic/include/odp/plat/rwlock_types.h  | 45 ++
 platform/linux-generic/include/odp/rwlock.h|  2 +
 3 files changed, 47 insertions(+), 12 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h

diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
index 950b83a..233e471 100644
--- a/include/odp/api/rwlock.h
+++ b/include/odp/api/rwlock.h
@@ -13,8 +13,6 @@
  * ODP RW Locks
  */
 
-#include 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -28,16 +26,6 @@ extern "C" {
  *  @{
  */
 
-/**
- * The odp_rwlock_t type.
- */
-typedef struct {
-   odp_atomic_u32_t cnt; /**< @private lock count
-   0 lock not taken
-   -1 write lock taken
-   >0 read lock(s) taken */
-} odp_rwlock_t;
-
 
 /**
  * Initialize a reader/writer lock.
diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h 
b/platform/linux-generic/include/odp/plat/rwlock_types.h
new file mode 100644
index 000..0adae5a
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP rwlock
+ */
+
+#ifndef ODP_RWLOCK_TYPES_H_
+#define ODP_RWLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+/**
+ * The odp_rwlock_t type.
+ */
+typedef struct {
+   odp_atomic_u32_t cnt; /**< @private lock count
+   0 lock not taken
+   -1 write lock taken
+   >0 read lock(s) taken */
+} odp_rwlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/rwlock.h 
b/platform/linux-generic/include/odp/rwlock.h
index 06320f6..ca88ff7 100644
--- a/platform/linux-generic/include/odp/rwlock.h
+++ b/platform/linux-generic/include/odp/rwlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC 1/4] spinlock: allow platform to override odp_spinlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/spinlock.h | 10 --
 .../include/odp/plat/spinlock_types.h  | 42 ++
 platform/linux-generic/include/odp/spinlock.h  |  2 ++
 3 files changed, 44 insertions(+), 10 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h

diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h
index 5cde123..9288034 100644
--- a/include/odp/api/spinlock.h
+++ b/include/odp/api/spinlock.h
@@ -18,21 +18,11 @@
 extern "C" {
 #endif
 
-
-#include 
-
 /** @addtogroup odp_synchronizers
  *  Operations on spin locks.
  *  @{
  */
 
-/**
- * ODP spinlock type
- */
-typedef struct odp_spinlock_t {
-   char lock;  /**< @private lock flag, should match odp_atomic_flag_t */
-} odp_spinlock_t;
-
 
 /**
  * Initialize spin lock.
diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h 
b/platform/linux-generic/include/odp/plat/spinlock_types.h
new file mode 100644
index 000..edb752f
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/spinlock_types.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP spinlock
+ */
+
+#ifndef ODP_SPINLOCK_TYPES_H_
+#define ODP_SPINLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+/**
+ * ODP spinlock type
+ */
+typedef struct odp_spinlock_t {
+   char lock;  /**< @private lock flag, should match odp_atomic_flag_t */
+} odp_spinlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/spinlock.h 
b/platform/linux-generic/include/odp/spinlock.h
index e02df49..7dbb1c4 100644
--- a/platform/linux-generic/include/odp/spinlock.h
+++ b/platform/linux-generic/include/odp/spinlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] classification tests scheduled queues

2015-02-03 Thread Jerin Jacob
On Tue, Feb 03, 2015 at 01:07:15PM +, Radu-Andrei Bulie wrote:
> As I said in my comment we could use two approaches.(poll or data path 
> thread).

How about the scheme(#define IPSEC_POLL_QUEUES) followed in existing 
example/ipsec to 
abstract polled vs schedule mode ?

> The one you mentioned reflects the model of the reference applications. 
> Classification test itself, for the present moment,  is a functional test and 
> does not target
> performance. So I don't see a major difference in using poll or a data path 
> thread.
> 
> 
> Regards,
> 
> Radu
> 
> 
> 
> -Original Message-
> From: Ola Liljedahl [mailto:ola.liljed...@linaro.org] 
> Sent: Tuesday, February 03, 2015 2:59 PM
> To: Bulie Radu-Andrei-B37577
> Cc: lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] classification tests scheduled queues
> 
> Wouldn't it be better to modify the validation program to make sure 
> scheduling is always performed on a data path thread?
> We want to promote usage of the scheduler, HW-accelerated classification and 
> scheduling are some of the differentiators of ODP.
> 
> On 3 February 2015 at 13:53, Radu-Andrei Bulie  
> wrote:
> > Hi,
> >
> >
> >
> > I have a comment regarding the scheduling approach in the 
> > classification validation tests (this also can be extended to other 
> > tests which use the same pattern).
> >
> > The schedule function should be called in context of a data path 
> > thread that is bound to a known core (the same model as in pktio 
> > application for instance).  Otherwise
> >
> > (as in the mentioned test) the main process (in this case the cunit 
> > test) can be scheduled by Linux on any core – e.g core 0 – that is not 
> > in the data path. In this situation no dequeue will occur,  because 
> > the scheduling does not take place on a data path thread (unlike  the 
> > case for pktio application where there is a  cpu dedicated to control path).
> >
> > From the linux-generic perspective,  there is no apparent issue in 
> > using the schedule function in this context. But as it is given in the 
> > reference application, the purpose of the scheduling is to function on 
> > the data path and thus to provide the advantages given by different 
> > SoCs acceleration implementations. (there will always be a control 
> > core and some data path cores).
> >
> > Thus, being in accordance with the reference applications from odp, I 
> > suggest replacing the scheduled queues with poll queues or create a 
> > separate thread which receives the packet, otherwise the test will 
> > function only on linux generic implementation.
> >
> >
> >
> > PS: I could send the patch (using poll queues approach) if we reach a 
> > consensus.
> >
> >
> >
> >
> >
> > Regards,
> >
> >
> >
> > Radu
> >
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
> >
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 2/3] validation: buffer: fix for the use of cached return value of odp_packet_last_seg

2015-01-28 Thread Jerin Jacob
On Wed, Jan 28, 2015 at 12:02:45PM -0500, Mike Holmes wrote:
> Any resolution, I know there have been discussions on going but I need to
> know if this is in 0.10.0

According to Petri, Application expects to reuse the seg handle after push/pull 
operations.
so, No need to change the existing specification hence this patch is not 
applicable. 
validation: buffer: check the return value of odp_packet_l?_offset_set can be 
included in 0.10


> 
> On 27 January 2015 at 09:12, Mike Holmes  wrote:
> 
> > Can we resolve this for 0.10.0
> >
> > On 25 January 2015 at 22:40, Jerin Jacob 
> > wrote:
> >
> >> On Sun, Jan 25, 2015 at 03:01:24PM +0200, Taras Kondratiuk wrote:
> >> > On 01/24/2015 08:06 PM, Bill Fischofer wrote:
> >> > > The issue is not whether the number of segments is changed but whether
> >> > > the pkt handle is changed.  APIs that potentially substitute a new
> >> > > handle must return a handle.  If a handle is not returned then the
> >> input
> >> > > handle is unchanged, however behavior of subsequent APIs against that
> >> > > handle may of course change.  To take a trivial example,
> >> > > odp_packet_len() will obviously change following a push/pull even
> >> though
> >> > > the same handle is used.
> >> > >
> >> > > I agree with Jerin that we really need to take care to not overspecify
> >> > > behavior on ODP APIs.  API observable effects should be minimally
> >> > > specified to allow implementations latitude in how best to map the
> >> > > required behavior to their platform.  In the case of push/pull the
> >> > > purpose is simply to add or subtract bytes at the start or end of a
> >> > > packet.  That's the essential function of these APIs and is the only
> >> > > thing that should be specified as required behavior.
> >> > >
> >> > > In the case of segmentation there are two philosophies one can adopt.
> >> > > The first is that the application desires and needs to have explicit
> >> > > control over packet segmentation.  The second is that any packet
> >> > > segmentation is the responsibility of the implementation and the
> >> > > application need only be aware that packets may be segmented and take
> >> > > that into account in its design, realizing that segments are the units
> >> > > of contiguous addressability.  The former is a very software-centric
> >> > > view which provides limited opportunity for implementations to
> >> optimize
> >> > > performance, and may in fact be impossible to implement efficiently on
> >> > > some platforms.  The latter requires that existing software-centric
> >> > > applications may need some more redesign to better adapt to ODP.  But
> >> > > the benefits of such adaptation is cleaner portability across a wider
> >> > > range of platforms with optimal performance on each, and that's really
> >> > > the goal of ODP.
> >> >
> >> > I agree on most of these items and I do understand Jerin's restrictions,
> >> > but my main point: current test does follow specification. If it can't
> >> > be implemented efficiently on a platform, then specification should be
> >> > changed first.
> >>
> >> OK, How about following change in the specification ?
> >>
> >> diff --git a/platform/linux-generic/include/api/odp_packet.h
> >> b/platform/linux-generic/include/api/odp_packet.h
> >> index 920a593..e418e42 100644
> >> --- a/platform/linux-generic/include/api/odp_packet.h
> >> +++ b/platform/linux-generic/include/api/odp_packet.h
> >> @@ -244,7 +244,7 @@ void *odp_packet_tail(odp_packet_t pkt);
> >>   * headroom -= len
> >>   * data -= len
> >>   *
> >> - * Operation does not modify packet segmentation or move data. Handles
> >> and
> >> + * Operation does not modify packet segmentation or move data. pkt
> >> handle and
> >>   * pointers remain valid. User is responsible to update packet metadata
> >>   * offsets when needed.
> >>   *
> >> @@ -272,7 +272,7 @@ void *odp_packet_push_head(odp_packet_t pkt, uint32_t
> >> len);
> >>   * headroom += len
> >>   * data += len
> >>   *
> >> - * Operation does not modify packet segmentation or move data. Handles
> >> and
> >> + * Operation does not modify packet s

Re: [lng-odp] [PATCH 2/3] validation: buffer: fix for the use of cached return value of odp_packet_last_seg

2015-01-25 Thread Jerin Jacob
On Sun, Jan 25, 2015 at 03:01:24PM +0200, Taras Kondratiuk wrote:
> On 01/24/2015 08:06 PM, Bill Fischofer wrote:
> > The issue is not whether the number of segments is changed but whether
> > the pkt handle is changed.  APIs that potentially substitute a new
> > handle must return a handle.  If a handle is not returned then the input
> > handle is unchanged, however behavior of subsequent APIs against that
> > handle may of course change.  To take a trivial example,
> > odp_packet_len() will obviously change following a push/pull even though
> > the same handle is used.
> > 
> > I agree with Jerin that we really need to take care to not overspecify
> > behavior on ODP APIs.  API observable effects should be minimally
> > specified to allow implementations latitude in how best to map the
> > required behavior to their platform.  In the case of push/pull the
> > purpose is simply to add or subtract bytes at the start or end of a
> > packet.  That's the essential function of these APIs and is the only
> > thing that should be specified as required behavior.  
> > 
> > In the case of segmentation there are two philosophies one can adopt. 
> > The first is that the application desires and needs to have explicit
> > control over packet segmentation.  The second is that any packet
> > segmentation is the responsibility of the implementation and the
> > application need only be aware that packets may be segmented and take
> > that into account in its design, realizing that segments are the units
> > of contiguous addressability.  The former is a very software-centric
> > view which provides limited opportunity for implementations to optimize
> > performance, and may in fact be impossible to implement efficiently on
> > some platforms.  The latter requires that existing software-centric
> > applications may need some more redesign to better adapt to ODP.  But
> > the benefits of such adaptation is cleaner portability across a wider
> > range of platforms with optimal performance on each, and that's really
> > the goal of ODP.
> 
> I agree on most of these items and I do understand Jerin's restrictions,
> but my main point: current test does follow specification. If it can't
> be implemented efficiently on a platform, then specification should be
> changed first.

OK, How about following change in the specification ?

diff --git a/platform/linux-generic/include/api/odp_packet.h 
b/platform/linux-generic/include/api/odp_packet.h
index 920a593..e418e42 100644
--- a/platform/linux-generic/include/api/odp_packet.h
+++ b/platform/linux-generic/include/api/odp_packet.h
@@ -244,7 +244,7 @@ void *odp_packet_tail(odp_packet_t pkt);
  * headroom -= len
  * data -= len
  *
- * Operation does not modify packet segmentation or move data. Handles and
+ * Operation does not modify packet segmentation or move data. pkt handle and
  * pointers remain valid. User is responsible to update packet metadata
  * offsets when needed.
  *
@@ -272,7 +272,7 @@ void *odp_packet_push_head(odp_packet_t pkt, uint32_t len);
  * headroom += len
  * data += len
  *
- * Operation does not modify packet segmentation or move data. Handles and
+ * Operation does not modify packet segmentation or move data. pkt handle and
  * pointers remain valid. User is responsible to update packet metadata
  * offsets when needed.
  *
@@ -302,7 +302,7 @@ void *odp_packet_pull_head(odp_packet_t pkt, uint32_t len);
  * tail += len
  * tailroom -= len
  *
- * Operation does not modify packet segmentation or move data. Handles,
+ * Operation does not modify packet segmentation or move data. pkt handle,
  * pointers and offsets remain valid.
  *
  * @param pkt  Packet handle
@@ -331,7 +331,7 @@ void *odp_packet_push_tail(odp_packet_t pkt, uint32_t len);
  * tail -= len
  * tailroom += len
  *
- * Operation does not modify packet segmentation or move data. Handles and
+ * Operation does not modify packet segmentation or move data. pkt handle and
  * pointers remain valid. User is responsible to update packet metadata
  * offsets when needed.
  *





___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: add odp_schedule_pause and odp_schedule_resume tests

2015-01-20 Thread Jerin Jacob
On Tue, Jan 20, 2015 at 04:25:41PM -0600, Bill Fischofer wrote:
> My questions were answered.  For now scheduling caches are non-transparent
> and applications wishing to pause scheduling must drain any cached events
> prior to exiting the scheduling loop.  We can revisit this post v1.0 when
> we discuss various recovery scenarios.

+1

> 
> On Tue, Jan 20, 2015 at 3:47 PM, Mike Holmes  wrote:
> 
> > It is still not clear to me in writing that we want this, we did discuss
> > it earlier but Jerin, Bill and Ola have questions on this thread and I am
> > not sure they are all addressed.
> >
> > On 20 January 2015 at 16:34, Maxim Uvarov  wrote:
> >
> >> Who review this patch please add review-by.
> >>
> >> Mike please add yours because it's validation patch.
> >>
> >> Maxim.
> >>
> >>
> >> On 01/20/2015 05:23 PM, Ciprian Barbu wrote:
> >>
> >>> PING!
> >>>
> >>> On Wed, Jan 14, 2015 at 7:14 PM, Mike Holmes 
> >>> wrote:
> >>>
> >>>> Without any clear change in sight,  lets test what we have, this has
> >>>> been on
> >>>> the list for a month
> >>>>
> >>>> On 14 January 2015 at 08:35, Ciprian Barbu 
> >>>> wrote:
> >>>>
> >>>>> On Wed, Jan 14, 2015 at 3:28 PM, Ola Liljedahl <
> >>>>> ola.liljed...@linaro.org>
> >>>>> wrote:
> >>>>>
> >>>>>> On 7 January 2015 at 20:41, Mike Holmes 
> >>>>>> wrote:
> >>>>>>
> >>>>>>> I am unsure if I need to pay attention to this for 0.7.0
> >>>>>>>
> >>>>>> We need to have a decision (and implementation) for ODP 1.0 though.
> >>>>>> Scheduling and its semantics are important aspects of ODP.
> >>>>>>
> >>>>> The odp_schedule_pause API is already documented and implemented, I
> >>>>> didn't exactly catch from Petri if we will keep the behavior for 1.0,
> >>>>> but what is the problem with covering this API in its current form for
> >>>>> at least 0.7 and 0.8?
> >>>>>
> >>>>>  On 7 January 2015 at 04:39, Ciprian Barbu 
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> On Tue, Jan 6, 2015 at 4:03 PM, Bill Fischofer
> >>>>>>>>  wrote:
> >>>>>>>>
> >>>>>>>>> I think it's something we need to discuss during the sync call.
> >>>>>>>>>
> >>>>>>>>> On Tue, Jan 6, 2015 at 7:48 AM, Mike Holmes <
> >>>>>>>>> mike.hol...@linaro.org>
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>>> Should a bug be made to track a needed change or is it important
> >>>>>>>>>> for
> >>>>>>>>>> 1.0
> >>>>>>>>>> and needs to be in the delta doc ?
> >>>>>>>>>>
> >>>>>>>>>> On 6 January 2015 at 08:40, Bill Fischofer
> >>>>>>>>>> 
> >>>>>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Caches should be transparent.  While this may be needed here,
> >>>>>>>>>>> it's
> >>>>>>>>>>> a
> >>>>>>>>>>> poor
> >>>>>>>>>>> set of semantics to expose as part of the formal APIs.  This is
> >>>>>>>>>>> definitely
> >>>>>>>>>>> something we need to address.  My suggestion is that a
> >>>>>>>>>>> odp_schedule_pause()
> >>>>>>>>>>> should cause an implicit cache flush if the implementation is
> >>>>>>>>>>> using a
> >>>>>>>>>>> scheduling cache.  That way any cache being used is truly
> >>>>>>>>>>> transparent
> >>>>>>>>>>> and
> >>>>>>>>>>> moreover there won't be unnecessary delays in event processing
> >>>>>>>>>>> since
> >>>>>

Re: [lng-odp] odp_packet API queries

2015-01-20 Thread Jerin Jacob
On Mon, Jan 19, 2015 at 10:17:22AM -0600, Bill Fischofer wrote:
> On Mon, Jan 19, 2015 at 10:00 AM, Jerin Jacob <
> jerin.ja...@caviumnetworks.com> wrote:
> 
> > On Mon, Jan 19, 2015 at 09:26:08AM -0600, Bill Fischofer wrote:
> > > On Mon, Jan 19, 2015 at 7:22 AM, Jerin Jacob <
> > jerin.ja...@caviumnetworks.com
> > > > wrote:
> > >
> > > > On Mon, Jan 19, 2015 at 06:09:34AM -0600, Bill Fischofer wrote:
> > > > > I think Petri should weigh in on these questions.  For the first one,
> > > > what
> > > > > problems do you anticipate some platforms having with that equation?
> > > >
> > > > I have two issues around the unit test case,
> > > > 1) packet_len = ODP_CONFIG_PACKET_BUF_LEN_MIN -
> > ODP_CONFIG_PACKET_HEADROOM
> > > > -
> > > > ODP_CONFIG_PACKET_TAILROOM creates two segments in my platform and
> > > > tailroom/headroom expects
> > > > to work within a segment ?
> > > >
> > >
> > > Can you elaborate on why this is the case?  The intent here was to define
> > > what constituted a single segment so if it's not accomplishing that goal
> > it
> > > would be useful to understand why not.
> >
> > OK. We have segment specific meta data(as I mentioned in beginning of the
> > mail thread)
> > in each segment that can't be counted in
> > ODP_CONFIG_PACKET_HEADROOM and/or ODP_CONFIG_PACKET_TAILROOM.
> >
> 
> If it's metadata then is doesn't come out of either of these. Regardless of
> how a platform stores metadata it is not addressable by the application as
> part of the packet and hence not included in
> ODP_CONFIG_PACKET_BUF_LEN_MIN.  So the equation should still hold.

ODP_CONFIG_PACKET_BUF_LEN_MIN has special hardware constraints(like size should 
be 
multiple of cache line size etc). If we are changing the 
ODP_CONFIG_PACKET_BUF_LEN_MIN
to hold the equations the it will create hole(unused space in buffer) for no 
reason. For example, if
segment specific meta data is 8 bytes and cache size 128 byte..in this case 
each buffer will waste
around 120 bytes.



> 
> You're articulating why applications neither know nor care about physical
> segment sizes used by implementations. The only thing applications can see
> are the logical segments exposed by the ODP APIs.
> 
> 
> >
> >
> > >
> > > >
> > > > 2) pool creation with number of buffers as one and creating a segmented
> > > > buffers as
> > > > packet_len is more than one segment.
> > > >
> > >
> > > A packet (I use that term here since in our current definition only
> > packets
> > > can support segmentation or headroom) is an object that consists of
> > packet
> > > metadata plus packet data.  Packet data is stored in one or more
> > segments,
> > > depending on how the pool it is allocated from is created, but
> > independent
> > > of the number of segments used to store this data it is still a single
> > > packet.  So num_bufs (which will presumably be num_packets in the new
> > pool
> > > definitions) always has a precise meaning.
> >
> > but it has to be num_bufs == num_packet segments
> 
> 
> And why is that?  They are logically different concepts.  Conflating them
> only leads to confusion.
> 
> 
> > >
> > >
> > > >
> > > > >
> > > > > I think the cleanest solution would be to have the platform segment
> > size
> > > > > for a given pool accessible as pool metadata, e.g.,
> > > > > odp_pool_seg_size(pool), but the real issue is why does the
> > application
> > > > > want this information?  If an application wants to ensure that
> > packets
> > > > are
> > > > > unsegmented then the simplest solution is to re-introduce the notion
> > of
> > > > > unsegmented pools.  If an application creates an unsegmented pool
> > then by
> > > > > definition any object allocated from that pool will only consist of a
> > > > > single segment.  By contrast, if the application is designed to
> > support
> > > > > segments then it shouldn't care.
> > > >
> > > > IMO, its simple to add a ODP_CONFIG or odp_packet_alloc of len == 0 for
> > > > default packet size
> > > >
> > >
> > > ODP_CONFIG is how we're doing things now.  More specific configurations
> > > should be doable on a per-pool basis (subject to 

Re: [lng-odp] [PATCH] helper: ip: add IP protocol value for sctp

2015-01-20 Thread Jerin Jacob
On Mon, Jan 19, 2015 at 06:49:35PM +0300, Maxim Uvarov wrote:
> On 01/19/2015 02:44 PM, Jerin Jacob wrote:
> >Signed-off-by: Jerin Jacob 
> >---
> >  helper/include/odph_ip.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> >diff --git a/helper/include/odph_ip.h b/helper/include/odph_ip.h
> >index 272fd96..f2638ba 100644
> >--- a/helper/include/odph_ip.h
> >+++ b/helper/include/odph_ip.h
> >@@ -167,6 +167,7 @@ typedef struct ODP_PACKED {
> >  #define ODPH_IPPROTO_FRAG0x2C /**< IPv6 Fragment (44) */
> >  #define ODPH_IPPROTO_AH  0x33 /**< Authentication Header (51) */
> >  #define ODPH_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) 
> > */
> >+#define ODPH_IPPROTO_SCTP0x84 /**< Stream Control Transmission (132) */
> >  #define ODPH_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */
> >  /**@}*/
> We planned to remove IP stucturues and defines from ODP headers and use
> systems.
> If for now nobody uses that define can you, in your case use it from:
> /usr/include/netinet/in.h

Including the system header files in bare metal build
is bit difficult as it has lot dependency.


> IPPROTO_SCTP = 132,/* Stream Control Transmission Protocol.  */
> 
> Regards,
> Maxim.
> 
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] odp_packet API queries

2015-01-19 Thread Jerin Jacob
On Mon, Jan 19, 2015 at 09:26:08AM -0600, Bill Fischofer wrote:
> On Mon, Jan 19, 2015 at 7:22 AM, Jerin Jacob  > wrote:
> 
> > On Mon, Jan 19, 2015 at 06:09:34AM -0600, Bill Fischofer wrote:
> > > I think Petri should weigh in on these questions.  For the first one,
> > what
> > > problems do you anticipate some platforms having with that equation?
> >
> > I have two issues around the unit test case,
> > 1) packet_len = ODP_CONFIG_PACKET_BUF_LEN_MIN - ODP_CONFIG_PACKET_HEADROOM
> > -
> > ODP_CONFIG_PACKET_TAILROOM creates two segments in my platform and
> > tailroom/headroom expects
> > to work within a segment ?
> >
> 
> Can you elaborate on why this is the case?  The intent here was to define
> what constituted a single segment so if it's not accomplishing that goal it
> would be useful to understand why not.

OK. We have segment specific meta data(as I mentioned in beginning of the mail 
thread) 
in each segment that can't be counted in
ODP_CONFIG_PACKET_HEADROOM and/or ODP_CONFIG_PACKET_TAILROOM.


> 
> >
> > 2) pool creation with number of buffers as one and creating a segmented
> > buffers as
> > packet_len is more than one segment.
> >
> 
> A packet (I use that term here since in our current definition only packets
> can support segmentation or headroom) is an object that consists of packet
> metadata plus packet data.  Packet data is stored in one or more segments,
> depending on how the pool it is allocated from is created, but independent
> of the number of segments used to store this data it is still a single
> packet.  So num_bufs (which will presumably be num_packets in the new pool
> definitions) always has a precise meaning.

but it has to be num_bufs == num_packet segments

> 
> 
> >
> > >
> > > I think the cleanest solution would be to have the platform segment size
> > > for a given pool accessible as pool metadata, e.g.,
> > > odp_pool_seg_size(pool), but the real issue is why does the application
> > > want this information?  If an application wants to ensure that packets
> > are
> > > unsegmented then the simplest solution is to re-introduce the notion of
> > > unsegmented pools.  If an application creates an unsegmented pool then by
> > > definition any object allocated from that pool will only consist of a
> > > single segment.  By contrast, if the application is designed to support
> > > segments then it shouldn't care.
> >
> > IMO, its simple to add a ODP_CONFIG or odp_packet_alloc of len == 0 for
> > default packet size
> >
> 
> ODP_CONFIG is how we're doing things now.  More specific configurations
> should be doable on a per-pool basis (subject to implementation
> restrictions) given an expanded odp_pool_param_t definition.
> 
> 
> >
> > >
> > > On Mon, Jan 19, 2015 at 3:27 AM, Jerin Jacob <
> > jerin.ja...@caviumnetworks.com
> > > > wrote:
> > >
> > > > On Sat, Jan 17, 2015 at 09:45:12AM -0600, Bill Fischofer wrote:
> > > > > Application-visible sizes refer to application-visible data.
> > Metadata is
> > > > > always implementation-specific and not included in such counts.
> > Metadata
> > > > > is "off books" data that is associated with the packet but is not
> > part of
> > > > > any addressable packet storage. The advantage of having a packet
> > object
> > > > is
> > > > > that the packet APIs can refer to the packet independent of any
> > > > > implementation and not to how the packet may be represented in
> > storage
> > > > on a
> > > > > particular platform.
> > > >
> > > > But coming back to my question, How an application can create a one
> > segment
> > > > full length packet ?
> > > > Following equation may not be correct in all platforms
> > > > packet_len = ODP_CONFIG_PACKET_BUF_LEN_MIN -
> > ODP_CONFIG_PACKET_HEADROOM -
> > > > ODP_CONFIG_PACKET_TAILROOM;
> > > >
> > > >
> > > > >
> > > > > Trying to reason about buffers that are used to store packet data is
> > > > > inherently non-portable and should be discouraged. Hopefully the
> > switch
> > > > to
> > > > > events will help move us in that direction since packets are no
> > longer a
> > > > > type of buffer using the new nomenclature.
> > > >
> > > > Should we remove  odp_buffer_size(buf) == odp_packet_buf_len(pkt)) test
&

Re: [lng-odp] odp_packet API queries

2015-01-19 Thread Jerin Jacob
On Mon, Jan 19, 2015 at 06:09:34AM -0600, Bill Fischofer wrote:
> I think Petri should weigh in on these questions.  For the first one, what
> problems do you anticipate some platforms having with that equation?

I have two issues around the unit test case,
1) packet_len = ODP_CONFIG_PACKET_BUF_LEN_MIN - ODP_CONFIG_PACKET_HEADROOM -
ODP_CONFIG_PACKET_TAILROOM creates two segments in my platform and 
tailroom/headroom expects 
to work within a segment ?

2) pool creation with number of buffers as one and creating a segmented buffers 
as
packet_len is more than one segment.

> 
> I think the cleanest solution would be to have the platform segment size
> for a given pool accessible as pool metadata, e.g.,
> odp_pool_seg_size(pool), but the real issue is why does the application
> want this information?  If an application wants to ensure that packets are
> unsegmented then the simplest solution is to re-introduce the notion of
> unsegmented pools.  If an application creates an unsegmented pool then by
> definition any object allocated from that pool will only consist of a
> single segment.  By contrast, if the application is designed to support
> segments then it shouldn't care.

IMO, its simple to add a ODP_CONFIG or odp_packet_alloc of len == 0 for default 
packet size

> 
> On Mon, Jan 19, 2015 at 3:27 AM, Jerin Jacob  > wrote:
> 
> > On Sat, Jan 17, 2015 at 09:45:12AM -0600, Bill Fischofer wrote:
> > > Application-visible sizes refer to application-visible data.  Metadata is
> > > always implementation-specific and not included in such counts.  Metadata
> > > is "off books" data that is associated with the packet but is not part of
> > > any addressable packet storage. The advantage of having a packet object
> > is
> > > that the packet APIs can refer to the packet independent of any
> > > implementation and not to how the packet may be represented in storage
> > on a
> > > particular platform.
> >
> > But coming back to my question, How an application can create a one segment
> > full length packet ?
> > Following equation may not be correct in all platforms
> > packet_len = ODP_CONFIG_PACKET_BUF_LEN_MIN - ODP_CONFIG_PACKET_HEADROOM -
> > ODP_CONFIG_PACKET_TAILROOM;
> >
> >
> > >
> > > Trying to reason about buffers that are used to store packet data is
> > > inherently non-portable and should be discouraged. Hopefully the switch
> > to
> > > events will help move us in that direction since packets are no longer a
> > > type of buffer using the new nomenclature.
> >
> > Should we remove  odp_buffer_size(buf) == odp_packet_buf_len(pkt)) test
> > case
> > or wait for event rework to happen ?
> >
> > >
> > > On Sat, Jan 17, 2015 at 5:52 AM, Jacob, Jerin <
> > > jerin.ja...@caviumnetworks.com> wrote:
> > >
> > > > Some odp_packet API queries based on exiting odp packet unit test case,
> > > >
> > > > 1) In exiting odp packet unit test case, In order to create one full
> > > > length packet in one segment,
> > > > We have used following formula,
> > > > packet_len = ODP_CONFIG_PACKET_BUF_LEN_MIN -
> > ODP_CONFIG_PACKET_HEADROOM -
> > > > ODP_CONFIG_PACKET_TAILROOM;
> > > >
> > > > This may not be valid in all platform if the packet segment has segment
> > > > specific meta data.
> > > > I think, we need to create either new ODP_CONFIG to define the default
> > > > packet size
> > > > or odp_packet_alloc of len == 0 can be used to create default packet
> > size.
> > > >
> > > > 2) If buffer is NOT aware of segmentation then odp_buffer_size(buf) of
> > > > packet should be ODP_CONFIG_PACKET_BUF_LEN_MIN
> > > > instead of odp_buffer_size(buf) == odp_packet_buf_len(pkt)) .
> > > >
> > > > Any thoughts ?
> > > >
> > > > - Jerin
> > > > ___
> > > > lng-odp mailing list
> > > > lng-odp@lists.linaro.org
> > > > http://lists.linaro.org/mailman/listinfo/lng-odp
> > > >
> >

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] helper: ip: add IP protocol value for sctp

2015-01-19 Thread Jerin Jacob
On Mon, Jan 19, 2015 at 06:13:42AM -0600, Bill Fischofer wrote:
> Two questions:
> 
> 
>1. We previously said we didn't need SCTP support for ODP v1.0, so why
>is this needed?

Then there is a disconnect, exiting API has reference to SCTP

/**
 * Check for SCTP
 *
 * @param pkt Packet handle
 * @return 1 if packet contains an SCTP header, 0 otherwise
 */
int odp_packet_has_sctp(odp_packet_t pkt);

/**
 * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP)
 *
 * @param pkt Packet handle
 * @return 1 if packet contains a valid & known L4 header, 0 otherwise
 */
int odp_packet_has_l4(odp_packet_t pkt);


>2. This is a helper, so it's not necessarily constrained by what may be
>covered by ODP v1.0, but in that case why limit this to SCTP?  There are
>lots of other IP protocols that this helper file doesn't define besides
>SCTP. Should they be included as well?
> 
> 
> 
> On Mon, Jan 19, 2015 at 5:44 AM, Jerin Jacob  > wrote:
> 
> > Signed-off-by: Jerin Jacob 
> > ---
> >  helper/include/odph_ip.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/helper/include/odph_ip.h b/helper/include/odph_ip.h
> > index 272fd96..f2638ba 100644
> > --- a/helper/include/odph_ip.h
> > +++ b/helper/include/odph_ip.h
> > @@ -167,6 +167,7 @@ typedef struct ODP_PACKED {
> >  #define ODPH_IPPROTO_FRAG0x2C /**< IPv6 Fragment (44) */
> >  #define ODPH_IPPROTO_AH  0x33 /**< Authentication Header (51) */
> >  #define ODPH_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload
> > (50) */
> > +#define ODPH_IPPROTO_SCTP0x84 /**< Stream Control Transmission (132)
> > */
> >  #define ODPH_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */
> >
> >  /**@}*/
> > --
> > 1.9.3
> >
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
> >

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] helper: ip: add IP protocol value for sctp

2015-01-19 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 helper/include/odph_ip.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/helper/include/odph_ip.h b/helper/include/odph_ip.h
index 272fd96..f2638ba 100644
--- a/helper/include/odph_ip.h
+++ b/helper/include/odph_ip.h
@@ -167,6 +167,7 @@ typedef struct ODP_PACKED {
 #define ODPH_IPPROTO_FRAG0x2C /**< IPv6 Fragment (44) */
 #define ODPH_IPPROTO_AH  0x33 /**< Authentication Header (51) */
 #define ODPH_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */
+#define ODPH_IPPROTO_SCTP0x84 /**< Stream Control Transmission (132) */
 #define ODPH_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */
 
 /**@}*/
-- 
1.9.3


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 00/15] Event introduction

2015-01-19 Thread Jerin Jacob
On Mon, Jan 19, 2015 at 11:26:04AM +0100, Ola Liljedahl wrote:
> On 17 January 2015 at 16:28, Bill Fischofer  wrote:
> > In the new model no buffers are queueable.  Only events are queueable.
> But you can convert a buffer handle to the corresponding event handle
> and enqueue the event. Thus buffers must have the metadata that allows
> them to be enqueued and scheduled.

Then its like a queueable buffer only.


> 
> > Events can contain buffers, packets, timeouts, etc., but are logically
> > distinct from them as they are the queueable/schedulable entity.
> >
> > On Sat, Jan 17, 2015 at 6:16 AM, Jerin Jacob
> >  wrote:
> >>
> >> On Thu, Jan 15, 2015 at 05:40:08PM +0200, Petri Savolainen wrote:
> >> > This patches introduces odp_event_t and replaces with that the usage of
> >> > odp_buffer_t as the super class for other "buffer types". What used to
> >> > be a
> >> > buffer type is now an event type.
> >>
> >> Should we also introduce a new buffer type that NOT queueable to odp_queue
> >> ?
> >> If some application is using the buffers only for the storage then I think
> >> this
> >> new type make sense as queueable buffers will take more resources and
> >> additional meta data(for hardware buffer schedule manager)
> Wouldn't such buffers be more related to some type of malloc-like
> memory manager?
> ODP could use a multicore friendly memory manager for variable size
> objects. Could such a memory manager be implemented by HW and thus be
> considered as a part of the SoC abstraction layer? Or would it be a
> pure SW construct and basically just a utility library?

No, I was considering the abstraction for the fixed size buffer pool only.
The new type can used to allocate a buffer pool from hardware fixed size buffer 
manager
without any metadata for queueable. something like,

pool = odp_buffer_pool_create();
odp_buffer_t x = odp_buffer_alloc(pool); // for queueable buffers

odp_buffer_xxx_t x = odp_buffer_xxx_alloc(pool);// for non queueable buffers, 
only for storage




> 
> >>
> >>
> >> >
> >> > There are some lines over 80 char, since those are caused by temporary
> >> > event <-> buffer, packet -> event -> buffer conversions and should be
> >> > cleaned up
> >> > from the implementation anyway.
> >> >
> >> > Petri Savolainen (15):
> >> >   api: event: Add odp_event_t
> >> >   api: event: odp_schedule and odp_queue_enq
> >> >   api: event: schedule_multi and queue_enq_multi
> >> >   api: event: odp_queue_deq
> >> >   api: event: odp_queue_deq_multi
> >> >   api: buffer: Removed odp_buffer_type
> >> >   api: packet: Removed odp_packet_to_buffer
> >> >   api: packet: Removed odp_packet_from_buffer
> >> >   api: timer: Use odp_event_t instead of odp_buffer_t
> >> >   api: crypto: Use odp_event_t instead of odp_buffer_t
> >> >   linux-generic: crypto: Use packet alloc for packet
> >> >   api: buffer_pool: Rename odp_buffer_pool.h to odp_pool.h
> >> >   api: pool: Rename pool params and remove buffer types
> >> >   api: pool: Rename odp_buffer_pool_ to odp_pool_
> >> >   api: config: Renamed ODP_CONFIG_BUFFER_POOLS
> >> >
> >> >  example/generator/odp_generator.c  |  38 ++---
> >> >  example/ipsec/odp_ipsec.c  |  70 
> >> >  example/ipsec/odp_ipsec_cache.c|   4 +-
> >> >  example/ipsec/odp_ipsec_cache.h|   2 +-
> >> >  example/ipsec/odp_ipsec_loop_db.c  |   2 +-
> >> >  example/ipsec/odp_ipsec_loop_db.h  |  12 +-
> >> >  example/ipsec/odp_ipsec_stream.c   |  20 +--
> >> >  example/ipsec/odp_ipsec_stream.h   |   2 +-
> >> >  example/l2fwd/odp_l2fwd.c  |  28 +--
> >> >  example/packet/odp_pktio.c |  28 +--
> >> >  example/timer/odp_timer_test.c |  64 +++
> >> >  platform/linux-generic/Makefile.am |   4 +-
> >> >  platform/linux-generic/include/api/odp.h   |   3 +-
> >> >  platform/linux-generic/include/api/odp_buffer.h|  40 +++--
> >> >  .../linux-generic/include/api/odp_buffer_pool.h| 177
> >> > ---
> >> >  .../linux-generic/include/api/odp_classification.h |   2 +-
> >> >  platform/linux-generic/include/api/odp_

Re: [lng-odp] odp_packet API queries

2015-01-19 Thread Jerin Jacob
On Sat, Jan 17, 2015 at 09:45:12AM -0600, Bill Fischofer wrote:
> Application-visible sizes refer to application-visible data.  Metadata is
> always implementation-specific and not included in such counts.  Metadata
> is "off books" data that is associated with the packet but is not part of
> any addressable packet storage. The advantage of having a packet object is
> that the packet APIs can refer to the packet independent of any
> implementation and not to how the packet may be represented in storage on a
> particular platform.

But coming back to my question, How an application can create a one segment
full length packet ? 
Following equation may not be correct in all platforms 
packet_len = ODP_CONFIG_PACKET_BUF_LEN_MIN - ODP_CONFIG_PACKET_HEADROOM -
ODP_CONFIG_PACKET_TAILROOM;


> 
> Trying to reason about buffers that are used to store packet data is
> inherently non-portable and should be discouraged. Hopefully the switch to
> events will help move us in that direction since packets are no longer a
> type of buffer using the new nomenclature.

Should we remove  odp_buffer_size(buf) == odp_packet_buf_len(pkt)) test case
or wait for event rework to happen ?

> 
> On Sat, Jan 17, 2015 at 5:52 AM, Jacob, Jerin <
> jerin.ja...@caviumnetworks.com> wrote:
> 
> > Some odp_packet API queries based on exiting odp packet unit test case,
> >
> > 1) In exiting odp packet unit test case, In order to create one full
> > length packet in one segment,
> > We have used following formula,
> > packet_len = ODP_CONFIG_PACKET_BUF_LEN_MIN - ODP_CONFIG_PACKET_HEADROOM -
> > ODP_CONFIG_PACKET_TAILROOM;
> >
> > This may not be valid in all platform if the packet segment has segment
> > specific meta data.
> > I think, we need to create either new ODP_CONFIG to define the default
> > packet size
> > or odp_packet_alloc of len == 0 can be used to create default packet size.
> >
> > 2) If buffer is NOT aware of segmentation then odp_buffer_size(buf) of
> > packet should be ODP_CONFIG_PACKET_BUF_LEN_MIN
> > instead of odp_buffer_size(buf) == odp_packet_buf_len(pkt)) .
> >
> > Any thoughts ?
> >
> > - Jerin
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
> >

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 2/3] validation: buffer: fix for the use of cached return value of odp_packet_last_seg

2015-01-18 Thread Jerin Jacob
On Sun, Jan 18, 2015 at 12:22:12AM +0200, Taras Kondratiuk wrote:
> On 01/17/2015 01:29 PM, Jerin Jacob wrote:
> > odp_packet_seg_t is an opaque type, based on the implementation, the return
> > value of odp_packet_last_seg can be changed after headroom/tailroom 
> > push/pull
> > operation.
> 
> No. By definition headroom/tailroom push/pull operations don't change
> segmentation. So the last segment must remain the same.

For cavium, odp_packet_seg_t pretty much defined by the hardware spec   
(its next seg data addr and data size of the next segment) so obviously
size of the segment will change after the tailroom push/pull operation. 

If odp specification demands for same seg handle value then I need to map it as 
pointer which 
points to the value. But its adds additional overhead for no good and even if 
we make 
it as pointer, it will fail in case of odp_packet_del_data.

IMO, enforcing applications to not cache the odp_packet_seg_t for 
headroom/tailroom push/pull and odp_packet_add/del_data will give freedom to
implementation to map best odp_packet_seg_t for the hardware.

- Jerin

> 
> > 
> > Signed-off-by: Jerin Jacob 
> > ---
> >  test/validation/buffer/odp_packet_test.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/test/validation/buffer/odp_packet_test.c 
> > b/test/validation/buffer/odp_packet_test.c
> > index b6fa028..7c2b169 100644
> > --- a/test/validation/buffer/odp_packet_test.c
> > +++ b/test/validation/buffer/odp_packet_test.c
> > @@ -289,6 +289,9 @@ static void _verify_tailroom_shift(odp_packet_t pkt,
> > tail = odp_packet_pull_tail(pkt, -shift);
> > }
> >  
> > +   seg = odp_packet_last_seg(pkt);
> > +   CU_ASSERT(seg != ODP_SEGMENT_INVALID);
> > +
> > CU_ASSERT(tail != NULL);
> > CU_ASSERT(odp_packet_seg_data_len(pkt, seg) == seg_data_len + shift);
> > CU_ASSERT(odp_packet_len(pkt) == pkt_data_len + shift);
> > 
> 
> 
> -- 
> Taras Kondratiuk

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 00/15] Event introduction

2015-01-17 Thread Jerin Jacob
On Thu, Jan 15, 2015 at 05:40:08PM +0200, Petri Savolainen wrote:
> This patches introduces odp_event_t and replaces with that the usage of
> odp_buffer_t as the super class for other "buffer types". What used to be a
> buffer type is now an event type.

Should we also introduce a new buffer type that NOT queueable to odp_queue ?
If some application is using the buffers only for the storage then I think this
new type make sense as queueable buffers will take more resources and 
additional meta data(for hardware buffer schedule manager)


> 
> There are some lines over 80 char, since those are caused by temporary
> event <-> buffer, packet -> event -> buffer conversions and should be cleaned 
> up
> from the implementation anyway.
> 
> Petri Savolainen (15):
>   api: event: Add odp_event_t
>   api: event: odp_schedule and odp_queue_enq
>   api: event: schedule_multi and queue_enq_multi
>   api: event: odp_queue_deq
>   api: event: odp_queue_deq_multi
>   api: buffer: Removed odp_buffer_type
>   api: packet: Removed odp_packet_to_buffer
>   api: packet: Removed odp_packet_from_buffer
>   api: timer: Use odp_event_t instead of odp_buffer_t
>   api: crypto: Use odp_event_t instead of odp_buffer_t
>   linux-generic: crypto: Use packet alloc for packet
>   api: buffer_pool: Rename odp_buffer_pool.h to odp_pool.h
>   api: pool: Rename pool params and remove buffer types
>   api: pool: Rename odp_buffer_pool_ to odp_pool_
>   api: config: Renamed ODP_CONFIG_BUFFER_POOLS
> 
>  example/generator/odp_generator.c  |  38 ++---
>  example/ipsec/odp_ipsec.c  |  70 
>  example/ipsec/odp_ipsec_cache.c|   4 +-
>  example/ipsec/odp_ipsec_cache.h|   2 +-
>  example/ipsec/odp_ipsec_loop_db.c  |   2 +-
>  example/ipsec/odp_ipsec_loop_db.h  |  12 +-
>  example/ipsec/odp_ipsec_stream.c   |  20 +--
>  example/ipsec/odp_ipsec_stream.h   |   2 +-
>  example/l2fwd/odp_l2fwd.c  |  28 +--
>  example/packet/odp_pktio.c |  28 +--
>  example/timer/odp_timer_test.c |  64 +++
>  platform/linux-generic/Makefile.am |   4 +-
>  platform/linux-generic/include/api/odp.h   |   3 +-
>  platform/linux-generic/include/api/odp_buffer.h|  40 +++--
>  .../linux-generic/include/api/odp_buffer_pool.h| 177 ---
>  .../linux-generic/include/api/odp_classification.h |   2 +-
>  platform/linux-generic/include/api/odp_config.h|   4 +-
>  platform/linux-generic/include/api/odp_crypto.h|  16 +-
>  platform/linux-generic/include/api/odp_event.h |  59 +++
>  platform/linux-generic/include/api/odp_packet.h|  29 ++--
>  platform/linux-generic/include/api/odp_packet_io.h |   4 +-
>  .../linux-generic/include/api/odp_platform_types.h |  10 +-
>  platform/linux-generic/include/api/odp_pool.h  | 189 
> +
>  platform/linux-generic/include/api/odp_queue.h |  32 ++--
>  platform/linux-generic/include/api/odp_schedule.h  |  32 ++--
>  platform/linux-generic/include/api/odp_timer.h |  56 +++---
>  .../linux-generic/include/odp_buffer_inlines.h |   6 +-
>  .../linux-generic/include/odp_buffer_internal.h|  20 ++-
>  .../include/odp_buffer_pool_internal.h |  22 +--
>  .../linux-generic/include/odp_crypto_internal.h|   2 +-
>  .../linux-generic/include/odp_packet_internal.h|   8 +-
>  platform/linux-generic/include/odp_packet_socket.h |  10 +-
>  platform/linux-generic/odp_buffer.c|  12 +-
>  platform/linux-generic/odp_buffer_pool.c   | 133 +++
>  platform/linux-generic/odp_crypto.c|  29 ++--
>  platform/linux-generic/odp_event.c |  19 +++
>  platform/linux-generic/odp_packet.c|  34 ++--
>  platform/linux-generic/odp_packet_io.c |  14 +-
>  platform/linux-generic/odp_packet_socket.c |  10 +-
>  platform/linux-generic/odp_queue.c |  18 +-
>  platform/linux-generic/odp_schedule.c  |  48 +++---
>  platform/linux-generic/odp_timer.c |  35 ++--
>  test/performance/odp_scheduling.c  | 105 +++-
>  43 files changed, 806 insertions(+), 646 deletions(-)
>  delete mode 100644 platform/linux-generic/include/api/odp_buffer_pool.h
>  create mode 100644 platform/linux-generic/include/api/odp_event.h
>  create mode 100644 platform/linux-generic/include/api/odp_pool.h
>  create mode 100644 platform/linux-generic/odp_event.c
> 
> -- 
> 2.2.2
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 1/3] validation: buffer: check the return value of odp_packet_l?_offset_set

2015-01-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 test/validation/buffer/odp_packet_test.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/validation/buffer/odp_packet_test.c 
b/test/validation/buffer/odp_packet_test.c
index d073b49..b6fa028 100644
--- a/test/validation/buffer/odp_packet_test.c
+++ b/test/validation/buffer/odp_packet_test.c
@@ -167,11 +167,15 @@ static void packet_layer_offsets(void)
const uint32_t l2_off = 2;
const uint32_t l3_off = l2_off + 14;
const uint32_t l4_off = l3_off + 14;
+   int ret;
 
/* Set offsets to the same value */
-   odp_packet_l2_offset_set(pkt, l2_off);
-   odp_packet_l3_offset_set(pkt, l2_off);
-   odp_packet_l4_offset_set(pkt, l2_off);
+   ret = odp_packet_l2_offset_set(pkt, l2_off);
+   CU_ASSERT(ret == 0);
+   ret = odp_packet_l3_offset_set(pkt, l2_off);
+   CU_ASSERT(ret == 0);
+   ret = odp_packet_l4_offset_set(pkt, l2_off);
+   CU_ASSERT(ret == 0);
 
/* Addresses should be the same */
l2_addr = odp_packet_l2_ptr(pkt, &seg_len);
-- 
1.9.3


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 2/3] validation: buffer: fix for the use of cached return value of odp_packet_last_seg

2015-01-17 Thread Jerin Jacob
odp_packet_seg_t is an opaque type, based on the implementation, the return
value of odp_packet_last_seg can be changed after headroom/tailroom push/pull
operation.

Signed-off-by: Jerin Jacob 
---
 test/validation/buffer/odp_packet_test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/validation/buffer/odp_packet_test.c 
b/test/validation/buffer/odp_packet_test.c
index b6fa028..7c2b169 100644
--- a/test/validation/buffer/odp_packet_test.c
+++ b/test/validation/buffer/odp_packet_test.c
@@ -289,6 +289,9 @@ static void _verify_tailroom_shift(odp_packet_t pkt,
tail = odp_packet_pull_tail(pkt, -shift);
}
 
+   seg = odp_packet_last_seg(pkt);
+   CU_ASSERT(seg != ODP_SEGMENT_INVALID);
+
CU_ASSERT(tail != NULL);
CU_ASSERT(odp_packet_seg_data_len(pkt, seg) == seg_data_len + shift);
CU_ASSERT(odp_packet_len(pkt) == pkt_data_len + shift);
-- 
1.9.3


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 3/3] validation: buffer: enable packet validation test to run on SW emulated odp packet pool on HW

2015-01-17 Thread Jerin Jacob
If a platform is limited to one HW packet pool then odp implementation
can implement the virtual odp packet pools using same the HW packet pool(if the 
block size is same)
In this specific test case has created a packet buffer pool on init with 100 
buffers
and later a packet buffer pool of one buffer. So in this specific case 
assumption of later pool
have only one buffer is not valid.

Signed-off-by: Jerin Jacob 
---
 test/validation/buffer/odp_packet_test.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/test/validation/buffer/odp_packet_test.c 
b/test/validation/buffer/odp_packet_test.c
index 7c2b169..86b6a04 100644
--- a/test/validation/buffer/odp_packet_test.c
+++ b/test/validation/buffer/odp_packet_test.c
@@ -58,8 +58,6 @@ static void packet_alloc_free(void)
packet = odp_packet_alloc(pool, packet_len);
CU_ASSERT_FATAL(packet != ODP_PACKET_INVALID);
CU_ASSERT(odp_packet_len(packet) == packet_len);
-   /** @todo: is it correct to assume the pool had only one buffer? */
-   CU_ASSERT_FATAL(odp_packet_alloc(pool, packet_len) == 
ODP_PACKET_INVALID)
 
odp_packet_free(packet);
 
-- 
1.9.3


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2] example: ipsec: corrected create_ipsec_cache_entry's out_pool argument handle type

2015-01-09 Thread Jerin Jacob

ping..

On Tue, Jan 06, 2015 at 10:07:32PM -0600, Bill Fischofer wrote:
> On Tue, Jan 6, 2015 at 9:29 PM, Jerin Jacob 
> wrote:
> 
> > Signed-off-by: Jerin Jacob 
> >
> 
> Reviewed-by: Bill Fischofer 
> 
> 
> > ---
> >  example/ipsec/odp_ipsec_cache.c | 2 +-
> >  example/ipsec/odp_ipsec_cache.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/example/ipsec/odp_ipsec_cache.c
> > b/example/ipsec/odp_ipsec_cache.c
> > index 7a0c813..4447163 100644
> > --- a/example/ipsec/odp_ipsec_cache.c
> > +++ b/example/ipsec/odp_ipsec_cache.c
> > @@ -41,7 +41,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
> >  crypto_api_mode_e api_mode,
> >  bool in,
> >  odp_queue_t completionq,
> > -odp_buffer_t out_pool)
> > +odp_buffer_pool_t out_pool)
> >  {
> > odp_crypto_session_params_t params;
> > ipsec_cache_entry_t *entry;
> > diff --git a/example/ipsec/odp_ipsec_cache.h
> > b/example/ipsec/odp_ipsec_cache.h
> > index 2cbaabd..8d9d393 100644
> > --- a/example/ipsec/odp_ipsec_cache.h
> > +++ b/example/ipsec/odp_ipsec_cache.h
> > @@ -90,7 +90,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
> >  crypto_api_mode_e api_mode,
> >  bool in,
> >  odp_queue_t completionq,
> > -odp_buffer_t out_pool);
> > +odp_buffer_pool_t out_pool);
> >
> >  /**
> >   * Find a matching IPsec cache entry for input packet
> > --
> > 1.9.3
> >
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
> >

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v2] example: ipsec: corrected create_ipsec_cache_entry's out_pool argument handle type

2015-01-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 example/ipsec/odp_ipsec_cache.c | 2 +-
 example/ipsec/odp_ipsec_cache.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index 7a0c813..4447163 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -41,7 +41,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 crypto_api_mode_e api_mode,
 bool in,
 odp_queue_t completionq,
-odp_buffer_t out_pool)
+odp_buffer_pool_t out_pool)
 {
odp_crypto_session_params_t params;
ipsec_cache_entry_t *entry;
diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h
index 2cbaabd..8d9d393 100644
--- a/example/ipsec/odp_ipsec_cache.h
+++ b/example/ipsec/odp_ipsec_cache.h
@@ -90,7 +90,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 crypto_api_mode_e api_mode,
 bool in,
 odp_queue_t completionq,
-odp_buffer_t out_pool);
+odp_buffer_pool_t out_pool);
 
 /**
  * Find a matching IPsec cache entry for input packet
-- 
1.9.3


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] ipsec: corrected create_ipsec_cache_entry's out_pool argument handle type

2015-01-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 example/ipsec/odp_ipsec_cache.c | 2 +-
 example/ipsec/odp_ipsec_cache.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index 7a0c813..4447163 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -41,7 +41,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 crypto_api_mode_e api_mode,
 bool in,
 odp_queue_t completionq,
-odp_buffer_t out_pool)
+odp_buffer_pool_t out_pool)
 {
odp_crypto_session_params_t params;
ipsec_cache_entry_t *entry;
diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h
index 2cbaabd..8d9d393 100644
--- a/example/ipsec/odp_ipsec_cache.h
+++ b/example/ipsec/odp_ipsec_cache.h
@@ -90,7 +90,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 crypto_api_mode_e api_mode,
 bool in,
 odp_queue_t completionq,
-odp_buffer_t out_pool);
+odp_buffer_pool_t out_pool);
 
 /**
  * Find a matching IPsec cache entry for input packet
-- 
1.9.3


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2] validation: add odp_time test

2015-01-03 Thread Jerin Jacob
On Mon, Dec 29, 2014 at 11:08:58AM -0500, Mike Holmes wrote:
> Add odp_time_x API tests
> 
> Signed-off-by: Mike Holmes 
> ---
> v2:
> fix bad auto merge of Makefile.am
> clean up names
> 
>  test/validation/.gitignore  |  1 +
>  test/validation/Makefile.am |  5 ++--
>  test/validation/odp_time.c  | 71 
> +
>  3 files changed, 75 insertions(+), 2 deletions(-)
>  create mode 100644 test/validation/odp_time.c
> 
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index d08db73..40ea12d 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -8,3 +8,4 @@ odp_shm
>  odp_system
>  odp_pktio
>  odp_buffer
> +odp_time
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index c0545b7..692e1a6 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,9 +6,9 @@ AM_LDFLAGS += -static
>  TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
>  
>  if ODP_CUNIT_ENABLED
> -TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run 
> odp_buffer odp_system
> +TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run 
> odp_buffer odp_system odp_time
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio 
> odp_buffer odp_system
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio 
> odp_buffer odp_system odp_time
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>  odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
>  endif
> @@ -27,3 +27,4 @@ dist_odp_buffer_SOURCES = buffer/odp_buffer_pool_test.c \
> buffer/odp_packet_test.c \
> odp_buffer.c common/odp_cunit_common.c
>  dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
> +dist_odp_time_SOURCES = odp_time.c common/odp_cunit_common.c
> diff --git a/test/validation/odp_time.c b/test/validation/odp_time.c
> new file mode 100644
> index 000..75be1f0
> --- /dev/null
> +++ b/test/validation/odp_time.c
> @@ -0,0 +1,71 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include 
> +#include "odp_cunit_common.h"
> +
> +#define TOLERANCE 1
> +#define BUSY_LOOP_CNT 100
> +
> +/* check that a cycles difference gives a reasonable result */
> +static void test_odp_cycles_diff(void)
> +{
> + /* volatile to stop optimization of busy loop */
> + volatile int count;
> + uint64_t diff, cycles1, cycles2;
> +
> + cycles1 = odp_time_cycles();
> +
> + while (count < BUSY_LOOP_CNT) {

local variable count is uninitialized.

> + count++;
> + };
> +
> + cycles2 = odp_time_cycles();
> + CU_ASSERT(cycles2 > cycles1);
> +
> + diff = odp_time_diff_cycles(cycles1, cycles2);
> + CU_ASSERT(diff > 0);
> +}
> +
> +/* check that a negative cycles difference gives a reasonable result */
> +static void test_odp_cycles_negative_diff(void)
> +{
> + uint64_t diff, cycles1, cycles2;
> + cycles1 = 10;
> + cycles2 = 5;
> + diff = odp_time_diff_cycles(cycles1, cycles2);
> + CU_ASSERT(diff > 0);
> +}
> +
> +/* check that related conversions come back to the same value */
> +static void test_odp_time_conversion(void)
> +{
> + uint64_t ns1, ns2, cycles;
> + uint64_t upper_limit, lower_limit;
> + ns1 = 100;
> + cycles = odp_time_ns_to_cycles(ns1);
> + CU_ASSERT(cycles > 0);
> +
> + ns2 = odp_time_cycles_to_ns(cycles);
> +
> + /* need to check within arithmetic tolerance that the same
> +  * value in ns is returned after conversions */
> + upper_limit = ns1 + TOLERANCE;
> + lower_limit = ns1 - TOLERANCE;
> + CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
> +}
> +
> +CU_TestInfo test_odp_time[] = {
> + {"cycles diff", test_odp_cycles_diff},
> + {"negative diff", test_odp_cycles_negative_diff},
> + {"conversion", test_odp_time_conversion},
> +  CU_TEST_INFO_NULL
> +};
> +
> +CU_SuiteInfo odp_testsuites[] = {
> + {"Time", NULL, NULL, NULL, NULL, test_odp_time},
> +  CU_SUITE_INFO_NULL
> +};
> -- 
> 2.1.0
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: thread: add thread tests

2015-01-01 Thread Jerin Jacob
On Wed, Dec 31, 2014 at 11:30:03AM -0500, Mike Holmes wrote:
> On 31 December 2014 at 01:33, Jerin Jacob 
> wrote:
> 
> > On Mon, Dec 29, 2014 at 09:24:01PM -0500, Mike Holmes wrote:
> > > Add tests for odp_thread_core and odp_thread_id
> > >
> > > Signed-off-by: Mike Holmes 
> > > ---
> > >  test/validation/.gitignore   |  1 +
> > >  test/validation/Makefile.am  |  5 +++--
> > >  test/validation/odp_thread.c | 47
> > 
> > >  3 files changed, 51 insertions(+), 2 deletions(-)
> > >  create mode 100644 test/validation/odp_thread.c
> > >
> > > diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> > > index d08db73..5b80834 100644
> > > --- a/test/validation/.gitignore
> > > +++ b/test/validation/.gitignore
> > > @@ -8,3 +8,4 @@ odp_shm
> > >  odp_system
> > >  odp_pktio
> > >  odp_buffer
> > > +odp_thread
> > > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> > > index c0545b7..d52fbdb 100644
> > > --- a/test/validation/Makefile.am
> > > +++ b/test/validation/Makefile.am
> > > @@ -6,9 +6,9 @@ AM_LDFLAGS += -static
> > >  TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
> > >
> > >  if ODP_CUNIT_ENABLED
> > > -TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> > odp_pktio_run odp_buffer odp_system
> > > +TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> > odp_pktio_run odp_buffer odp_system odp_thread
> > >  check_PROGRAMS = ${bin_PROGRAMS}
> > > -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> > odp_pktio odp_buffer odp_system
> > > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> > odp_pktio odp_buffer odp_system odp_thread
> > >  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> > >  odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
> > >  endif
> > > @@ -27,3 +27,4 @@ dist_odp_buffer_SOURCES =
> > buffer/odp_buffer_pool_test.c \
> > > buffer/odp_packet_test.c \
> > > odp_buffer.c common/odp_cunit_common.c
> > >  dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
> > > +dist_odp_thread_SOURCES = odp_thread.c common/odp_cunit_common.c
> > > diff --git a/test/validation/odp_thread.c b/test/validation/odp_thread.c
> > > new file mode 100644
> > > index 000..1c03b16
> > > --- /dev/null
> > > +++ b/test/validation/odp_thread.c
> > > @@ -0,0 +1,47 @@
> > > +/* Copyright (c) 2014, Linaro Limited
> > > + * All rights reserved.
> > > + *
> > > + * SPDX-License-Identifier: BSD-3-Clause
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +
> > > +static void *run_thread_id_core(void *arg)
> > > +{
> > > + int thr, core;
> > > + pthrd_arg *thrdarg = arg;
> > > +
> > > + thr = odp_thread_id();
> > > + core = odp_thread_core();
> > > +
> > > + /* cores start from 0 */
> > > + CU_ASSERT((core >= 0) && (core <= thrdarg->numthrds-1));
> >
> > thrdarg is pointing to the stack(allocated in test_odp_thread_id_core()).
> > Use odp shared mem
> > to share the data between the cores or in this case,
> > odp_sys_core_count()/MAX_WORKERS can
> > be use here to find thrdarg->numthrds in run_thread_id_core()
> >
> >
> Will do
> 
> 
> > > + /* threads start from 1 */
> > > + CU_ASSERT((thr >= 1) && (core <= thrdarg->numthrds));
> >
> > Is there any specific reason why thread id has to be start from one(Why
> > not zero)?
> >
> 
> Only because in this test the main thread will have run and so it will have
> taken 0 already.

Its bit of odp platform implementation specific.Runtime environments like 
baremetal may map
thread to core directly.so in that case, core 0(thread 0) can be executed in
run_thread_id_core(). IMO, we need to change the assert to thr >= 0


> 
> 
> >
> > > + return arg;
> > > +}
> > > +
> > > +static void test_odp_thread_id_core(void)
> > > +{
> > > + pthrd_arg thrdarg;
> > > +
> > > + thrdarg.numthrds = odp_sys_core_count();
> > > +
> > > + if (thrdarg.numthrds > MAX_WORKERS)
> > > + thrdarg.numthrds = MAX_WORKERS;
> > > +
> > > + odp_cunit_thread_create(run_thread_id_core, &thrdarg);
> > > + odp_cunit_thread_exit(&thrdarg);
> > > +}
> > > +
> > > +CU_TestInfo test_odp_thread[] = {
> > > + {"id & core range",  test_odp_thread_id_core},
> > > + CU_TEST_INFO_NULL,
> > > +};
> > > +
> > > +CU_SuiteInfo odp_testsuites[] = {
> > > + {"Thread", NULL, NULL, NULL, NULL, test_odp_thread},
> > > + CU_SUITE_INFO_NULL,
> > > +};
> > > +
> > > --
> > > 2.1.0
> > >
> > >
> > > ___
> > > lng-odp mailing list
> > > lng-odp@lists.linaro.org
> > > http://lists.linaro.org/mailman/listinfo/lng-odp
> >
> 
> 
> 
> -- 
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: thread: add thread tests

2014-12-30 Thread Jerin Jacob
On Mon, Dec 29, 2014 at 09:24:01PM -0500, Mike Holmes wrote:
> Add tests for odp_thread_core and odp_thread_id
> 
> Signed-off-by: Mike Holmes 
> ---
>  test/validation/.gitignore   |  1 +
>  test/validation/Makefile.am  |  5 +++--
>  test/validation/odp_thread.c | 47 
> 
>  3 files changed, 51 insertions(+), 2 deletions(-)
>  create mode 100644 test/validation/odp_thread.c
> 
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index d08db73..5b80834 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -8,3 +8,4 @@ odp_shm
>  odp_system
>  odp_pktio
>  odp_buffer
> +odp_thread
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index c0545b7..d52fbdb 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,9 +6,9 @@ AM_LDFLAGS += -static
>  TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
>  
>  if ODP_CUNIT_ENABLED
> -TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run 
> odp_buffer odp_system
> +TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run 
> odp_buffer odp_system odp_thread
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio 
> odp_buffer odp_system
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio 
> odp_buffer odp_system odp_thread
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>  odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
>  endif
> @@ -27,3 +27,4 @@ dist_odp_buffer_SOURCES = buffer/odp_buffer_pool_test.c \
> buffer/odp_packet_test.c \
> odp_buffer.c common/odp_cunit_common.c
>  dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
> +dist_odp_thread_SOURCES = odp_thread.c common/odp_cunit_common.c
> diff --git a/test/validation/odp_thread.c b/test/validation/odp_thread.c
> new file mode 100644
> index 000..1c03b16
> --- /dev/null
> +++ b/test/validation/odp_thread.c
> @@ -0,0 +1,47 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include 
> +#include 
> +
> +static void *run_thread_id_core(void *arg)
> +{
> + int thr, core;
> + pthrd_arg *thrdarg = arg;
> +
> + thr = odp_thread_id();
> + core = odp_thread_core();
> +
> + /* cores start from 0 */
> + CU_ASSERT((core >= 0) && (core <= thrdarg->numthrds-1));

thrdarg is pointing to the stack(allocated in test_odp_thread_id_core()). Use 
odp shared mem
to share the data between the cores or in this case, 
odp_sys_core_count()/MAX_WORKERS can
be use here to find thrdarg->numthrds in run_thread_id_core()

> + /* threads start from 1 */
> + CU_ASSERT((thr >= 1) && (core <= thrdarg->numthrds));

Is there any specific reason why thread id has to be start from one(Why not 
zero)?

> + return arg;
> +}
> +
> +static void test_odp_thread_id_core(void)
> +{
> + pthrd_arg thrdarg;
> +
> + thrdarg.numthrds = odp_sys_core_count();
> +
> + if (thrdarg.numthrds > MAX_WORKERS)
> + thrdarg.numthrds = MAX_WORKERS;
> +
> + odp_cunit_thread_create(run_thread_id_core, &thrdarg);
> + odp_cunit_thread_exit(&thrdarg);
> +}
> +
> +CU_TestInfo test_odp_thread[] = {
> + {"id & core range",  test_odp_thread_id_core},
> + CU_TEST_INFO_NULL,
> +};
> +
> +CU_SuiteInfo odp_testsuites[] = {
> + {"Thread", NULL, NULL, NULL, NULL, test_odp_thread},
> + CU_SUITE_INFO_NULL,
> +};
> +
> -- 
> 2.1.0
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v3] validation: add odp_system test

2014-12-21 Thread Jerin Jacob
On Fri, Dec 19, 2014 at 01:23:31PM -0500, Mike Holmes wrote:
> add tests for ODP system_info interface
> 
> Signed-off-by: Mike Holmes 

Reviewed by: Jerin Jacob 

> ---
> 
> Add additional assert to page size
> 
>  test/validation/.gitignore   |  1 +
>  test/validation/Makefile.am  |  9 +-
>  test/validation/odp_system.c | 76 
> 
>  3 files changed, 85 insertions(+), 1 deletion(-)
>  create mode 100644 test/validation/odp_system.c
> 
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 32834ae..a388488 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -5,3 +5,4 @@ odp_queue
>  odp_crypto
>  odp_schedule
>  odp_shm
> +odp_system
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index a12fdfa..247175f 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,8 +6,14 @@ AM_LDFLAGS += -static
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_system
> +odp_init_LDFLAGS = $(AM_LDFLAGS)
> +odp_queue_LDFLAGS = $(AM_LDFLAGS)
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> +odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> +odp_shm_CFLAGS = $(AM_CFLAGS)
> +odp_shm_LDFLAGS = $(AM_LDFLAGS)
> +odp_system_LDFLAGS = $(AM_LDFLAGS)
>  endif
>  
>  dist_odp_init_SOURCES = odp_init.c
> @@ -18,3 +24,4 @@ dist_odp_crypto_SOURCES = 
> crypto/odp_crypto_test_async_inp.c \
> odp_crypto.c common/odp_cunit_common.c
>  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
>  dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
> +dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
> diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
> new file mode 100644
> index 000..2afd4a7
> --- /dev/null
> +++ b/test/validation/odp_system.c
> @@ -0,0 +1,76 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include "odp.h"
> +#include "odp_cunit_common.h"
> +
> +static void test_odp_sys_core_count(void)
> +{
> + int cores;
> +
> + cores = odp_sys_core_count();
> + CU_ASSERT(0 < cores);
> +}
> +
> +static void test_odp_sys_cache_line_size(void)
> +{
> + uint64_t cache_size;
> +
> + cache_size = odp_sys_cache_line_size();
> + CU_ASSERT(0 < cache_size);
> + CU_ASSERT(ODP_CACHE_LINE_SIZE == cache_size);
> +}
> +
> +static void test_odp_sys_cpu_model_str(void)
> +{
> + char model[128];
> +
> + strcpy(model, odp_sys_cpu_model_str());
> + CU_ASSERT(strlen(model) > 0);
> + CU_ASSERT(strlen(model) < 127);
> +}
> +
> +static void test_odp_sys_page_size(void)
> +{
> + uint64_t page;
> +
> + page = odp_sys_page_size();
> + CU_ASSERT(0 < page);
> + CU_ASSERT(ODP_PAGE_SIZE == page);
> +}
> +
> +static void test_odp_sys_huge_page_size(void)
> +{
> + uint64_t page;
> +
> + page = odp_sys_huge_page_size();
> + CU_ASSERT(0 < page);
> +}
> +
> +static void test_odp_sys_cpu_hz(void)
> +{
> + uint64_t hz;
> +
> + hz = odp_sys_cpu_hz();
> + CU_ASSERT(0 < hz);
> +}
> +
> +CU_TestInfo test_odp_system[] = {
> + {"odp_sys_core_count",  test_odp_sys_core_count},
> + {"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
> + {"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
> + {"odp_sys_page_size",  test_odp_sys_page_size},
> + {"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
> + {"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
> + CU_TEST_INFO_NULL,
> +};
> +
> +CU_SuiteInfo odp_testsuites[] = {
> + {"System Info", NULL, NULL, NULL, NULL,
> +  test_odp_system},
> +  CU_SUITE_INFO_NULL,
> +};
> +
> -- 
> 2.1.0
> 

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4 3/4] validation: pktio: add mac, promisc and mtu tests

2014-12-18 Thread Jerin Jacob
On Thu, Dec 18, 2014 at 02:04:16PM +0300, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov 
> ---
>  test/validation/odp_pktio.c | 108 
> 
>  1 file changed, 99 insertions(+), 9 deletions(-)
> 
> diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
> index 75a9859..a1773dd 100644
> --- a/test/validation/odp_pktio.c
> +++ b/test/validation/odp_pktio.c
> @@ -403,6 +403,93 @@ static void test_odp_pktio_sched_multi(void)
>   pktio_test_txrx(ODP_QUEUE_TYPE_SCHED, 4);
>  }
>  
> +static void pktio_test_mtu(void)
> +{
> + int i;
> + int ret;
> + int def;
> + odp_pktio_t pktio = create_pktio(iface_name[0]);
> +
> + def = odp_pktio_mtu(pktio);
> + CU_ASSERT(def > 0);
> +
> + for (i = 9000; i > 100; i /= 2) {
> + printf(" %d ", i);
> +
> + ret = odp_pktio_set_mtu(pktio, i);
> + if (ret) {
> + if (i <= 1500) {
> + CU_ASSERT(0);
> + } else {
> + printf("(Not supported)");
> + continue;
> + }
> + }
> +
> + ret = odp_pktio_mtu(pktio);
> + CU_ASSERT(i == ret);
> + }
> +
> + ret = odp_pktio_set_mtu(pktio, def);
> + CU_ASSERT(0 == ret);
> +
> + ret = odp_pktio_close(pktio);
> + CU_ASSERT(ret == 0);
> +
> + return;
> +}
> +
> +static void pktio_test_promisc(void)
> +{
> + int ret;
> + odp_pktio_t pktio = create_pktio(iface_name[0]);
> +
> + ret = odp_pktio_promisc_mode_set(pktio, 1);
> + CU_ASSERT(0 == ret);
> +
> + /* Check */
> + ret = odp_pktio_promisc_mode(pktio);
> + CU_ASSERT(1 == ret);
> +
> + ret = odp_pktio_promisc_mode_set(pktio, 0);
> + CU_ASSERT(0 == ret);
> +
> + /* Check */
> + ret = odp_pktio_promisc_mode(pktio);
> + CU_ASSERT(0 == ret);
> +
> + ret = odp_pktio_close(pktio);
> + CU_ASSERT(ret == 0);

promiscuous mode can be tested by sending the packet with different destination 
mac address
with existing test frame work.Doesn't make much sense to add the test without 
checking
the actual functionality.

> +
> + return;
> +}
> +
> +static void pktio_test_mac(void)
> +{
> + unsigned char mac_addr[ODPH_ETHADDR_LEN];
> + size_t mac_len;
> + int ret;
> + odp_pktio_t pktio = create_pktio(iface_name[0]);
> +
> + printf("testing mac for %s\n", iface_name[0]);
> +
> + mac_len = odp_pktio_mac_addr(pktio, mac_addr, ODPH_ETHADDR_LEN);
> + CU_ASSERT(ODPH_ETHADDR_LEN == mac_len);
> +
> + printf(" %X:%X:%X:%X:%X:%X ",
> +mac_addr[0], mac_addr[1], mac_addr[2],
> +mac_addr[3], mac_addr[4], mac_addr[5]);
> +
> + /* Fail case */
> + mac_len = odp_pktio_mac_addr(pktio, mac_addr, 2);
> + CU_ASSERT(0 == mac_len);
> +
> + ret = odp_pktio_close(pktio);
> + CU_ASSERT(ret == 0);
> +
> + return;
> +}
> +
>  static void test_odp_pktio_open(void)
>  {
>   odp_pktio_t pktio;
> @@ -483,19 +570,22 @@ static int term_pktio_suite(void)
>  }
>  
>  CU_TestInfo pktio_tests[] = {
> - {"pktio open", test_odp_pktio_open},
> - {"pktio close",test_odp_pktio_close},
> - {"pktio inq",  test_odp_pktio_inq},
> - {"pktio outq", test_odp_pktio_outq},
> - {"pktio poll queues",  test_odp_pktio_poll_queue},
> - {"pktio poll multi",   test_odp_pktio_poll_multi},
> - {"pktio sched queues", test_odp_pktio_sched_queue},
> - {"pktio sched multi",  test_odp_pktio_sched_multi},
> + {"pktio open",  test_odp_pktio_open},
> + {"pktio close", test_odp_pktio_close},
> + {"pktio inq",   test_odp_pktio_inq},
> + {"pktio outq",  test_odp_pktio_outq},
> + {"pktio poll queues",   test_odp_pktio_poll_queue},
> + {"pktio poll multi",test_odp_pktio_poll_multi},
> + {"pktio sched queues",  test_odp_pktio_sched_queue},
> + {"pktio sched multi",   test_odp_pktio_sched_multi},
> + {"pktio mtu",   pktio_test_mtu},
> + {"pktio promisc mode",  pktio_test_promisc},
> + {"pktio mac",   pktio_test_mac},
>   CU_TEST_INFO_NULL
>  };
>  
>  CU_SuiteInfo odp_testsuites[] = {
> - {"odp_pktio",
> + {"Packet I/O",
>   init_pktio_suite, term_pktio_suite, NULL, NULL, pktio_tests},
>   CU_SUITE_INFO_NULL
>  };
> -- 
> 1.8.5.1.163.gd7aced9
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv3] validation: synchronizer tests

2014-12-17 Thread Jerin Jacob
On Wed, Dec 17, 2014 at 04:40:01PM +, Mario Torrecillas Rodriguez wrote:
> This version of the patch should fix all the issues mentioned so far (by
> Jerin and Maxim, I believe).


v3 looks good. Tested and verfied on non x86 hardware.

Three minor commments
1) Not sure I understand the logic behind setting the global_mem->g_num_threads 
as MAX_WORKERS/ 2.
It can be MAX_WORKERS;

2) Add odp_synchronizers in .gitignore

3) Needs to fix a bunch of checkpatch warnings, I think, we can ignore the 
first and second warning about volatile

$ ./scripts/checkpatch.pl -f test/validation/odp_synchronizers.c
WARNING: Use of volatile is usually wrong: see 
Documentation/volatile-considered-harmful.txt
#41: FILE: validation/odp_synchronizers.c:41:
+typedef volatile uint32_t volatile_u32_t, *ptr_volatile_u32_t;

WARNING: Use of volatile is usually wrong: see 
Documentation/volatile-considered-harmful.txt
#42: FILE: validation/odp_synchronizers.c:42:
+typedef volatile uint64_t volatile_u64_t, *ptr_volatile_u64_t;

WARNING: Avoid line continuations in quoted strings
#189: FILE: validation/odp_synchronizers.c:189:
+   printf("thread_num=%u got bad barrier_cnts of \

WARNING: Avoid line continuations in quoted strings
#243: FILE: validation/odp_synchronizers.c:243:
+   printf("\nThread %u (id=%d core=%d) had %u barrier_errs in \

WARNING: line over 80 characters
#440: FILE: validation/odp_synchronizers.c:440:
+   
odp_barrier_wait(&global_mem->barrier_array[resync_idx++]);

WARNING: Avoid line continuations in quoted strings
#444: FILE: validation/odp_synchronizers.c:444:
+   printf("\nThread %u (id=%d core=%d) had %u sync_failures in \

WARNING: line over 80 characters
#527: FILE: validation/odp_synchronizers.c:527:
+   
odp_barrier_wait(&global_mem->barrier_array[resync_idx++]);

WARNING: Avoid line continuations in quoted strings
#532: FILE: validation/odp_synchronizers.c:532:
+   printf("\nThread %u (id=%d core=%d) had %u sync_failures and \

WARNING: line over 80 characters
#612: FILE: validation/odp_synchronizers.c:612:
+   
odp_barrier_wait(&global_mem->barrier_array[resync_idx++]);

WARNING: Avoid line continuations in quoted strings
#617: FILE: validation/odp_synchronizers.c:617:
+   printf("\nThread %u (id=%d core=%d) had %u sync_failures and \

WARNING: line over 80 characters
#691: FILE: validation/odp_synchronizers.c:691:
+   
odp_barrier_wait(&global_mem->barrier_array[resync_idx++]);

WARNING: Avoid line continuations in quoted strings
#695: FILE: validation/odp_synchronizers.c:695:
+   printf("\nThread %u (id=%d core=%d) had %u sync_failures in \


- Jerin

> 
> Cheers,
> Mario.
> 
> On 17/12/2014 16:31, "Mario Torrecillas Rodriguez"
>  wrote:
> 
> >First set of synchronizer tests. This patch includes tests for locks,
> >barriers and atomics ("sunny day" tests only).
> >Most of this code comes from Barry Spinney and Yan Songming.
> >
> >Please note that this code depends on ticketlock_trylock
> >
> >Signed-off-by: Mario Torrecillas Rodriguez
> >
> >---
> >(This code contribution is provided under the terms of agreement
> >LES-LTM-21309)
> >
> >Changes from previous version:
> >Removed new header file and used ODP's thread API instead
> >Other minor changes
> >
> > test/validation/Makefile.am |5 +-
> > test/validation/odp_synchronizers.c | 1142
> >+++
> > 2 files changed, 1146 insertions(+), 1 deletion(-)
> > create mode 100644 test/validation/odp_synchronizers.c
> >
> >diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> >index d0b5426..d867684 100644
> >--- a/test/validation/Makefile.am
> >+++ b/test/validation/Makefile.am
> >@@ -6,7 +6,7 @@ AM_LDFLAGS += -static
> > if ODP_CUNIT_ENABLED
> > TESTS = ${bin_PROGRAMS}
> > check_PROGRAMS = ${bin_PROGRAMS}
> >-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> >+bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> >odp_synchronizers
> > odp_init_LDFLAGS = $(AM_LDFLAGS)
> > odp_queue_LDFLAGS = $(AM_LDFLAGS)
> > odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> >@@ -15,6 +15,7 @@ odp_shm_CFLAGS = $(AM_CFLAGS)
> > odp_shm_LDFLAGS = $(AM_LDFLAGS)
> > odp_schedule_CFLAGS = $(AM_CFLAGS)
> > odp_schedule_LDFLAGS = $(AM_LDFLAGS)
> >+odp_synchronizers_LDFLAGS = $(AM_LDFLAGS)
> > endif
> > 
> > dist_odp_init_SOURCES = odp_init.c
> >@@ -29,3 +30,5 @@ dist_odp_schedule_SOURCES = odp_schedule.c
> >common/odp_cunit_common.c
> > #For Linux generic the unimplemented crypto API functions break the
> > #regression TODO: https://bugs.linaro.org/show_bug.cgi?id=975
> > XFAIL_TESTS=odp_crypto
> >+dist_odp_synchronizers_SOURCES = odp_synchronizers.c \
> >+ common/odp_cunit_common.c
> >diff --git a/test/validation/odp_synchronizers.c
> >b/test/validation/odp_synchronizers.c
> >new file mode 100644

Re: [lng-odp] [PATCH] validation: add odp_schedule_pause and odp_schedule_resume tests

2014-12-17 Thread Jerin Jacob
On Wed, Dec 17, 2014 at 03:10:11PM +0200, Ciprian Barbu wrote:
> Signed-off-by: Ciprian Barbu 
> ---
>  test/validation/odp_schedule.c | 63 
> ++
>  1 file changed, 58 insertions(+), 5 deletions(-)
> 
> diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c
> index 31be742..bdbcf77 100644
> --- a/test/validation/odp_schedule.c
> +++ b/test/validation/odp_schedule.c
> @@ -11,9 +11,11 @@
>  #define MSG_POOL_SIZE(4*1024*1024)
>  #define QUEUES_PER_PRIO  16
>  #define BUF_SIZE 64
> -#define TEST_NUM_BUFS100
> +#define NUM_BUFS 100
>  #define BURST_BUF_SIZE   4
> -#define TEST_NUM_BUFS_EXCL   1
> +#define NUM_BUFS_EXCL1
> +#define NUM_BUFS_PAUSE   1000
> +#define NUM_BUFS_BEFORE_PAUSE10
>  
>  #define GLOBALS_SHM_NAME "test_globals"
>  #define MSG_POOL_NAME"msg_pool"
> @@ -229,7 +231,7 @@ static void schedule_common(odp_schedule_sync_t sync, int 
> num_queues,
>   args.sync = sync;
>   args.num_queues = num_queues;
>   args.num_prio = num_prio;
> - args.num_bufs = TEST_NUM_BUFS;
> + args.num_bufs = NUM_BUFS;
>   args.num_cores = 1;
>   args.enable_schd_multi = enable_schd_multi;
>   args.enable_excl_atomic = 0;/* Not needed with a single core */
> @@ -261,9 +263,9 @@ static void parallel_execute(odp_schedule_sync_t sync, 
> int num_queues,
>   thr_args->num_queues = num_queues;
>   thr_args->num_prio = num_prio;
>   if (enable_excl_atomic)
> - thr_args->num_bufs = TEST_NUM_BUFS_EXCL;
> + thr_args->num_bufs = NUM_BUFS_EXCL;
>   else
> - thr_args->num_bufs = TEST_NUM_BUFS;
> + thr_args->num_bufs = NUM_BUFS;
>   thr_args->num_cores = globals->core_count;
>   thr_args->enable_schd_multi = enable_schd_multi;
>   thr_args->enable_excl_atomic = enable_excl_atomic;
> @@ -459,6 +461,56 @@ static void test_schedule_multi_1q_mt_a_excl(void)
>ENABLE_EXCL_ATOMIC);
>  }
>  
> +static void test_schedule_pause_resume(void)
> +{
> + odp_queue_t queue;
> + odp_buffer_t buf;
> + odp_queue_t from;
> + int i;
> + int local_bufs = 0;
> +
> + queue = odp_queue_lookup("sched_0_0_n");
> + CU_ASSERT(queue != ODP_QUEUE_INVALID);
> +
> + pool = odp_buffer_pool_lookup(MSG_POOL_NAME);
> + CU_ASSERT_FATAL(pool != ODP_BUFFER_POOL_INVALID);
> +
> +
> + for (i = 0; i < NUM_BUFS_PAUSE; i++) {
> + buf = odp_buffer_alloc(pool);
> + CU_ASSERT(buf != ODP_BUFFER_INVALID);
> + odp_queue_enq(queue, buf);
> + }
> +
> + for (i = 0; i < NUM_BUFS_BEFORE_PAUSE; i++) {
> + buf = odp_schedule(&from, ODP_SCHED_NO_WAIT);
> + CU_ASSERT(from == queue);
> + odp_buffer_free(buf);
> + }
> +
> + odp_schedule_pause();
> +
> + while (1) {
> + buf = odp_schedule(&from, ODP_SCHED_NO_WAIT);
> + if (buf == ODP_BUFFER_INVALID)
> + break;
> +
> + CU_ASSERT(from == queue);
> + odp_buffer_free(buf);
> + local_bufs++;
> + }
> +
> + CU_ASSERT(local_bufs < NUM_BUFS_PAUSE - NUM_BUFS_BEFORE_PAUSE);

Whats is the expected behavior here, Shouldn't it be CU_ASSERT(local_bufs == 0) 
? 
meaning, the complete pause ?

> +
> + odp_schedule_resume();
> +
> + for (i = local_bufs + NUM_BUFS_BEFORE_PAUSE; i < NUM_BUFS_PAUSE; i++) {
> + buf = odp_schedule(&from, ODP_SCHED_WAIT);
> + CU_ASSERT(from == queue);
> + odp_buffer_free(buf);
> + }
> +}
> +
>  static int create_queues(void)
>  {
>   int i, j, prios;
> @@ -594,6 +646,7 @@ struct CU_TestInfo test_odp_schedule[] = {
>   {"schedule_multi_mq_mt_prio_a", test_schedule_multi_mq_mt_prio_a},
>   {"schedule_multi_mq_mt_prio_o", test_schedule_multi_mq_mt_prio_o},
>   {"schedule_multi_1q_mt_a_excl", test_schedule_multi_1q_mt_a_excl},
> + {"schedule_pause_resume",   test_schedule_pause_resume},
>   CU_TEST_INFO_NULL,
>  };
>  
> -- 
> 1.8.3.2
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 3/3] test: odp_timer.h: cunit test

2014-12-17 Thread Jerin Jacob
On Wed, Dec 17, 2014 at 11:05:52AM +0100, Ola Liljedahl wrote:
> On 17 December 2014 at 10:19, Jerin Jacob
>  wrote:
> > On Wed, Dec 17, 2014 at 09:28:48AM +0530, Jerin Jacob wrote:
> >> On Mon, Dec 08, 2014 at 11:49:46PM +0100, Ola Liljedahl wrote:
> >> > Signed-off-by: Ola Liljedahl 
> >> > ---
> >> > (This document/code contribution attached is provided under the terms of
> >> > agreement LES-LTM-21309)
> >> > A new cunit test program test/validation/odp_timer.c for the updated 
> >> > timer API.
> >> >
> >> >  test/validation/.gitignore  |   1 +
> >> >  test/validation/Makefile.am |   4 +-
> >> >  test/validation/odp_timer.c | 336 
> >> > 
> >> >  3 files changed, 340 insertions(+), 1 deletion(-)
> >> >  create mode 100644 test/validation/odp_timer.c
> >> >
> >> > diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> >> > index 37e2594..586def0 100644
> >> > --- a/test/validation/.gitignore
> >> > +++ b/test/validation/.gitignore
> >> > @@ -4,3 +4,4 @@ odp_init
> >> >  odp_queue
> >> >  odp_crypto
> >> >  odp_shm
> >> > +odp_timer
> >> > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> >> > index 8547085..043bf4c 100644
> >> > --- a/test/validation/Makefile.am
> >> > +++ b/test/validation/Makefile.am
> >> > @@ -6,13 +6,14 @@ AM_LDFLAGS += -static
> >> >  if ODP_CUNIT_ENABLED
> >> >  TESTS = ${bin_PROGRAMS}
> >> >  check_PROGRAMS = ${bin_PROGRAMS}
> >> > -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> >> > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_timer
> >> >  odp_init_LDFLAGS = $(AM_LDFLAGS)
> >> >  odp_queue_LDFLAGS = $(AM_LDFLAGS)
> >> >  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> >> >  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> >> >  odp_shm_CFLAGS = $(AM_CFLAGS)
> >> >  odp_shm_LDFLAGS = $(AM_LDFLAGS)
> >> > +odp_timer_LDFLAGS = $(AM_LDFLAGS)
> >> >  endif
> >> >
> >> >  dist_odp_init_SOURCES = odp_init.c
> >> > @@ -22,3 +23,4 @@ dist_odp_crypto_SOURCES = 
> >> > crypto/odp_crypto_test_async_inp.c \
> >> >   crypto/odp_crypto_test_rng.c \
> >> >   odp_crypto.c common/odp_cunit_common.c
> >> >  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> >> > +dist_odp_timer_SOURCES = odp_timer.c common/odp_cunit_common.c
> >> > diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> >> > new file mode 100644
> >> > index 000..4b6b872
> >> > --- /dev/null
> >> > +++ b/test/validation/odp_timer.c
> >> > @@ -0,0 +1,336 @@
> >> > +/* Copyright (c) 2014, Linaro Limited
> >> > + * All rights reserved.
> >> > + *
> >> > + * SPDX-License-Identifier: BSD-3-Clause
> >> > + */
> >> > +
> >> > +/**
> >> > + * @file
> >> > + */
> >> > +
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include "odp_cunit_common.h"
> >> > +
> >> > +/** @private Timeout range in milliseconds (ms) */
> >> > +#define RANGE_MS 2000
> >> > +
> >> > +/** @private Number of timers per thread */
> >> > +#define NTIMERS 2000
> >> > +
> >> > +/** @private Timeout pool size per thread */
> >> > +#define TMO_POOL_SIZE  (512 * NTIMERS)
> >> > +
> >> > +/** @private Barrier for thread synchronisation */
> >> > +static odp_barrier_t test_barrier;
> >> > +
> >> > +/** @private Timeout buffer pool handle used by all threads */
> >> > +static odp_buffer_pool_t tbp;
> >> > +
> >> > +/** @private Timer pool handle used by all threads */
> >> > +static odp_timer_pool_t tp;
> >> > +
> >> > +/** @private min() function */
> >> > +static int min(int a, int b)
> >> > +{
> >> > +   return a < b ? a : b;
> >> > +}
> >> > +
> >> > +/* @private Timer helper structure */
> >> > +struct test

Re: [lng-odp] [PATCH 3/3] test: odp_timer.h: cunit test

2014-12-17 Thread Jerin Jacob
On Wed, Dec 17, 2014 at 09:28:48AM +0530, Jerin Jacob wrote:
> On Mon, Dec 08, 2014 at 11:49:46PM +0100, Ola Liljedahl wrote:
> > Signed-off-by: Ola Liljedahl 
> > ---
> > (This document/code contribution attached is provided under the terms of
> > agreement LES-LTM-21309)
> > A new cunit test program test/validation/odp_timer.c for the updated timer 
> > API.
> > 
> >  test/validation/.gitignore  |   1 +
> >  test/validation/Makefile.am |   4 +-
> >  test/validation/odp_timer.c | 336 
> > 
> >  3 files changed, 340 insertions(+), 1 deletion(-)
> >  create mode 100644 test/validation/odp_timer.c
> > 
> > diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> > index 37e2594..586def0 100644
> > --- a/test/validation/.gitignore
> > +++ b/test/validation/.gitignore
> > @@ -4,3 +4,4 @@ odp_init
> >  odp_queue
> >  odp_crypto
> >  odp_shm
> > +odp_timer
> > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> > index 8547085..043bf4c 100644
> > --- a/test/validation/Makefile.am
> > +++ b/test/validation/Makefile.am
> > @@ -6,13 +6,14 @@ AM_LDFLAGS += -static
> >  if ODP_CUNIT_ENABLED
> >  TESTS = ${bin_PROGRAMS}
> >  check_PROGRAMS = ${bin_PROGRAMS}
> > -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_timer
> >  odp_init_LDFLAGS = $(AM_LDFLAGS)
> >  odp_queue_LDFLAGS = $(AM_LDFLAGS)
> >  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> >  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> >  odp_shm_CFLAGS = $(AM_CFLAGS)
> >  odp_shm_LDFLAGS = $(AM_LDFLAGS)
> > +odp_timer_LDFLAGS = $(AM_LDFLAGS)
> >  endif
> >  
> >  dist_odp_init_SOURCES = odp_init.c
> > @@ -22,3 +23,4 @@ dist_odp_crypto_SOURCES = 
> > crypto/odp_crypto_test_async_inp.c \
> >   crypto/odp_crypto_test_rng.c \
> >   odp_crypto.c common/odp_cunit_common.c
> >  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> > +dist_odp_timer_SOURCES = odp_timer.c common/odp_cunit_common.c
> > diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> > new file mode 100644
> > index 000..4b6b872
> > --- /dev/null
> > +++ b/test/validation/odp_timer.c
> > @@ -0,0 +1,336 @@
> > +/* Copyright (c) 2014, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier: BSD-3-Clause
> > + */
> > +
> > +/**
> > + * @file
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include "odp_cunit_common.h"
> > +
> > +/** @private Timeout range in milliseconds (ms) */
> > +#define RANGE_MS 2000
> > +
> > +/** @private Number of timers per thread */
> > +#define NTIMERS 2000
> > +
> > +/** @private Timeout pool size per thread */
> > +#define TMO_POOL_SIZE  (512 * NTIMERS)
> > +
> > +/** @private Barrier for thread synchronisation */
> > +static odp_barrier_t test_barrier;
> > +
> > +/** @private Timeout buffer pool handle used by all threads */
> > +static odp_buffer_pool_t tbp;
> > +
> > +/** @private Timer pool handle used by all threads */
> > +static odp_timer_pool_t tp;
> > +
> > +/** @private min() function */
> > +static int min(int a, int b)
> > +{
> > +   return a < b ? a : b;
> > +}
> > +
> > +/* @private Timer helper structure */
> > +struct test_timer {
> > +   odp_timer_t tim; /* Timer handle */
> > +   odp_buffer_t buf; /* Timeout buffer */
> > +   odp_buffer_t buf2; /* Copy of buffer handle */
> > +   uint64_t tick; /* Expiration tick or ODP_TICK_INVALID */
> > +};
> > +
> > +/* @private Handle a received (timeout) buffer */
> > +static void handle_tmo(odp_buffer_t buf, bool stale, uint64_t prev_tick)
> > +{
> > +   odp_timer_t tim = ODP_TIMER_INVALID;
> > +   uint64_t tick = ODP_TICK_INVALID;
> > +   struct test_timer *ttp = NULL;
> > +
> > +   /* Use assert() for correctness check of test program itself */
> > +   assert(buf != ODP_BUFFER_INVALID);
> > +   if (!odp_timer_tmo_metadata(buf, &tim, &tick, (void **)&ttp)) {
> > +   /* Not a default timeout buffer */
> > +   CU_FAIL("Unexpected buffer type received");
> > +   return;
> > +   }
> > +
> > +   if (tim == ODP_TIMER_INVALID)
> > +  

Re: [lng-odp] [PATCH 3/3] test: odp_timer.h: cunit test

2014-12-16 Thread Jerin Jacob
On Mon, Dec 08, 2014 at 11:49:46PM +0100, Ola Liljedahl wrote:
> Signed-off-by: Ola Liljedahl 
> ---
> (This document/code contribution attached is provided under the terms of
> agreement LES-LTM-21309)
> A new cunit test program test/validation/odp_timer.c for the updated timer 
> API.
> 
>  test/validation/.gitignore  |   1 +
>  test/validation/Makefile.am |   4 +-
>  test/validation/odp_timer.c | 336 
> 
>  3 files changed, 340 insertions(+), 1 deletion(-)
>  create mode 100644 test/validation/odp_timer.c
> 
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 37e2594..586def0 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -4,3 +4,4 @@ odp_init
>  odp_queue
>  odp_crypto
>  odp_shm
> +odp_timer
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index 8547085..043bf4c 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,13 +6,14 @@ AM_LDFLAGS += -static
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_timer
>  odp_init_LDFLAGS = $(AM_LDFLAGS)
>  odp_queue_LDFLAGS = $(AM_LDFLAGS)
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
>  odp_shm_CFLAGS = $(AM_CFLAGS)
>  odp_shm_LDFLAGS = $(AM_LDFLAGS)
> +odp_timer_LDFLAGS = $(AM_LDFLAGS)
>  endif
>  
>  dist_odp_init_SOURCES = odp_init.c
> @@ -22,3 +23,4 @@ dist_odp_crypto_SOURCES = 
> crypto/odp_crypto_test_async_inp.c \
> crypto/odp_crypto_test_rng.c \
> odp_crypto.c common/odp_cunit_common.c
>  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> +dist_odp_timer_SOURCES = odp_timer.c common/odp_cunit_common.c
> diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> new file mode 100644
> index 000..4b6b872
> --- /dev/null
> +++ b/test/validation/odp_timer.c
> @@ -0,0 +1,336 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "odp_cunit_common.h"
> +
> +/** @private Timeout range in milliseconds (ms) */
> +#define RANGE_MS 2000
> +
> +/** @private Number of timers per thread */
> +#define NTIMERS 2000
> +
> +/** @private Timeout pool size per thread */
> +#define TMO_POOL_SIZE(512 * NTIMERS)
> +
> +/** @private Barrier for thread synchronisation */
> +static odp_barrier_t test_barrier;
> +
> +/** @private Timeout buffer pool handle used by all threads */
> +static odp_buffer_pool_t tbp;
> +
> +/** @private Timer pool handle used by all threads */
> +static odp_timer_pool_t tp;
> +
> +/** @private min() function */
> +static int min(int a, int b)
> +{
> + return a < b ? a : b;
> +}
> +
> +/* @private Timer helper structure */
> +struct test_timer {
> + odp_timer_t tim; /* Timer handle */
> + odp_buffer_t buf; /* Timeout buffer */
> + odp_buffer_t buf2; /* Copy of buffer handle */
> + uint64_t tick; /* Expiration tick or ODP_TICK_INVALID */
> +};
> +
> +/* @private Handle a received (timeout) buffer */
> +static void handle_tmo(odp_buffer_t buf, bool stale, uint64_t prev_tick)
> +{
> + odp_timer_t tim = ODP_TIMER_INVALID;
> + uint64_t tick = ODP_TICK_INVALID;
> + struct test_timer *ttp = NULL;
> +
> + /* Use assert() for correctness check of test program itself */
> + assert(buf != ODP_BUFFER_INVALID);
> + if (!odp_timer_tmo_metadata(buf, &tim, &tick, (void **)&ttp)) {
> + /* Not a default timeout buffer */
> + CU_FAIL("Unexpected buffer type received");
> + return;
> + }
> +
> + if (tim == ODP_TIMER_INVALID)
> + CU_FAIL("odp_timer_tmo_metadata() invalid timer");
> + if (tick == ODP_TICK_INVALID)
> + CU_FAIL("odp_timer_tmo_metadata() invalid tick");
> + if (ttp == NULL)
> + CU_FAIL("odp_timer_tmo_metadata() null user ptr");
> +
> + if (ttp->buf2 != buf)
> + CU_FAIL("odp_timer_tmo_metadata() wrong user ptr");
> + if (ttp->tim != tim)
> + CU_FAIL("odp_timer_tmo_metadata() wrong timer");
> + if (stale) {
> + /* Stale timeout => timer must have invalid tick */
> + if (ttp->tick != ODP_TICK_INVALID)
> + CU_FAIL("Stale timeout for active timer");
> + } else {
> + /* Fresh timeout => timer must have matching tick */
> + if (ttp->tick != tick)
> + CU_FAIL("odp_timer_tmo_metadata() wrong tick");
> + /* Check that timeout was delivered 'timely' */
> + if (tick > odp_timer_current_tick(tp))
> + CU_FAIL("Timeout delivered too early");
> 

Re: [lng-odp] [PATCH 1/1] validation: synchronizer tests

2014-12-16 Thread Jerin Jacob
On Tue, Dec 16, 2014 at 10:15:20AM +, Mario Torrecillas Rodriguez wrote:
> This is a first stab at synchroniser tests, which contains contributions
> from Yan and Barry. I reviewed the code, fixed a couple of functional
> issues, merged both in a common test suite and adapted most of the coding
> style issues.
> It can be applied on top of the latest commit, however it depends on the
> ticketlock_try_lock patch, so this needs to be applied too before
> compiling it (or you can comment out the try lock calls in
> odp_synchronizers.c).
> 
> We still need more tests, especially for atomics, since the ones we have
> at the moment target functionality in the absence of other threads.
> 
> Mario.
> 
> On 16/12/2014 09:44, "Mario Torrecillas Rodriguez"
>  wrote:
> 
> >(This code contribution is provided under the terms of agreement
> >LES-LTM-21309)
> >
> >First set of synchronizer tests. This patch includes tests for locks,
> >barriers and atomics ("sunny day" tests only).
> >Most of this code comes from Barry Spinney and Yan Songming.
> >
> >Please note that this code depends on ticketlock_trylock
> >
> >Signed-off-by: Mario Torrecillas Rodriguez
> >
> >---
> > test/validation/Makefile.am   |7 +-
> > test/validation/common/odp_common.c   |  241 ++
> > test/validation/common/odp_common.h   |   28 +
> > test/validation/common/odp_cunit_common.c |5 +
> > test/validation/common/odp_cunit_common.h |1 +
> > test/validation/odp_synchronizers.c   | 1149
> >+
> > 6 files changed, 1430 insertions(+), 1 deletion(-)
> > create mode 100644 test/validation/common/odp_common.c
> > create mode 100644 test/validation/common/odp_common.h
> > create mode 100644 test/validation/odp_synchronizers.c
> >
> >diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> >index d0b5426..38bd47c 100644
> >--- a/test/validation/Makefile.am
> >+++ b/test/validation/Makefile.am
> >@@ -6,7 +6,7 @@ AM_LDFLAGS += -static
> > if ODP_CUNIT_ENABLED
> > TESTS = ${bin_PROGRAMS}
> > check_PROGRAMS = ${bin_PROGRAMS}
> >-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> >+bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> >odp_synchronizers
> > odp_init_LDFLAGS = $(AM_LDFLAGS)
> > odp_queue_LDFLAGS = $(AM_LDFLAGS)
> > odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> >@@ -15,6 +15,8 @@ odp_shm_CFLAGS = $(AM_CFLAGS)
> > odp_shm_LDFLAGS = $(AM_LDFLAGS)
> > odp_schedule_CFLAGS = $(AM_CFLAGS)
> > odp_schedule_LDFLAGS = $(AM_LDFLAGS)
> >+odp_synchronizers_LDFLAGS = $(AM_LDFLAGS)
> >+odp_synchronizers_LDFLAGS = $(AM_LDFLAGS)

duplicate odp_synchronizers_LDFLAGS


> > endif
> > 
> > dist_odp_init_SOURCES = odp_init.c
> >@@ -29,3 +31,6 @@ dist_odp_schedule_SOURCES = odp_schedule.c
> >common/odp_cunit_common.c
> > #For Linux generic the unimplemented crypto API functions break the
> > #regression TODO: https://bugs.linaro.org/show_bug.cgi?id=975
> > XFAIL_TESTS=odp_crypto
> >+dist_odp_synchronizers_SOURCES = odp_synchronizers.c \
> >+common/odp_cunit_common.c \
> >+common/odp_common.c
> >diff --git a/test/validation/common/odp_common.c
> >b/test/validation/common/odp_common.c
> >new file mode 100644
> >index 000..1b55569
> >--- /dev/null
> >+++ b/test/validation/common/odp_common.c
> >@@ -0,0 +1,241 @@
> >+/* Copyright (c) 2013, Linaro Limited
> >+ * All rights reserved.
> >+ *
> >+ * SPDX-License-Identifier: BSD-3-Clause
> >+ */
> >+
> >+/**
> >+ * @file
> >+ *
> >+ * ODP test application common
> >+ */
> >+
> >+#if defined(__x86_64) || defined(__x86_64__)
> >+#define X86
> >+#else
> >+#define TILERA
> >+#endif

Broken logic,  !X86 != TILERA.. !X86 can be ARM

> >+
> >+
> >+#ifdef TILERA
> >+#include 
> >+#include 
> >+#endif
> >+
> >+#define _GNU_SOURCE
> >+#define __USE_GNU
> >+#include 
> >+
> >+#include 
> >+#include 
> >+#include 
> >+#include 
> >+#include 
> >+#include 
> >+#include 
> >+
> >+/* Globals */
> >+static pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads table*/
> >+static int num_workers;   /**< number 
> >of workers  */
> >+
> >+typedef struct {
> >+pthrd_arg  user_arg;
> >+thread_fcn_ptr_t user_fcn;
> >+uint32_t thread_num;
> >+int32_t  cpu;
> >+} thread_args_t;
> >+
> >+static thread_args_t g_thread_args[MAX_WORKERS];
> >+
> >+#ifdef TILERA
> >+
> >+static cpu_set_t dataplane_cpus;
> >+static cpu_set_t other_cpus;
> >+static cpu_set_t total_cpus;
> >+static uint32_t  num_dataplane_cpus;
> >+static uint32_t  total_num_cpus;
> >+
> >+static void get_all_cpus(uint32_t num_threads, odp_coremask_t *all_cpus)
> >+{
> >+uint32_t num_other_cpus, idx, cpu;
> >+
> >+tmc_cpus_get_dataplane_cpus(&dataplane_cpus);
> >+tmc_cpus_get_online_cpus(&other_cpus);
> >+tmc_cpus_remove_cpus(&other_cpus, &dataplane_cpus);
> >+tmc_cpus_

Re: [lng-odp] [PATCH v2] validation: add odp_system test

2014-12-14 Thread Jerin Jacob
On Fri, Dec 12, 2014 at 03:40:29PM -0500, Mike Holmes wrote:
> Add tests for ODP system_info interface
> 
> Signed-off-by: Mike Holmes 
> ---
> 
> This api has poor documentaion, these testis attempt to do something sensible
> against linux-generic in its present form.
> 
>  test/validation/.gitignore   |  1 +
>  test/validation/Makefile.am  |  4 ++-
>  test/validation/odp_system.c | 73 
> 
>  3 files changed, 77 insertions(+), 1 deletion(-)
>  create mode 100644 test/validation/odp_system.c
> 
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 32834ae..a388488 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -5,3 +5,4 @@ odp_queue
>  odp_crypto
>  odp_schedule
>  odp_shm
> +odp_system
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index d0b5426..98376b9 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,7 +6,7 @@ AM_LDFLAGS += -static
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_system
>  odp_init_LDFLAGS = $(AM_LDFLAGS)
>  odp_queue_LDFLAGS = $(AM_LDFLAGS)
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> @@ -15,6 +15,7 @@ odp_shm_CFLAGS = $(AM_CFLAGS)
>  odp_shm_LDFLAGS = $(AM_LDFLAGS)
>  odp_schedule_CFLAGS = $(AM_CFLAGS)
>  odp_schedule_LDFLAGS = $(AM_LDFLAGS)
> +odp_system_LDFLAGS = $(AM_LDFLAGS)
>  endif
>  
>  dist_odp_init_SOURCES = odp_init.c
> @@ -25,6 +26,7 @@ dist_odp_crypto_SOURCES = 
> crypto/odp_crypto_test_async_inp.c \
> odp_crypto.c common/odp_cunit_common.c
>  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
>  dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
> +dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
>  
>  #For Linux generic the unimplemented crypto API functions break the
>  #regression TODO: https://bugs.linaro.org/show_bug.cgi?id=975
> diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
> new file mode 100644
> index 000..dfad677
> --- /dev/null
> +++ b/test/validation/odp_system.c
> @@ -0,0 +1,73 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include "odp.h"
> +#include "odp_cunit_common.h"
> +
> +static void test_odp_sys_core_count(void)
> +{
> + int cores;
> +
> + cores = odp_sys_core_count();
> + CU_ASSERT(0 < cores);
> +}
> +
> +static void test_odp_sys_cache_line_size(void)
> +{
> + int cache_size;
> +
> + cache_size = odp_sys_cache_line_size();
> + CU_ASSERT(0 < cache_size);

May be we can add one more assert here,
CU_ASSERT(ODP_CACHE_LINE_SIZE == cache_size)


> +}
> +
> +static void test_odp_sys_cpu_model_str(void)
> +{
> + char model[128];
> +
> + snprintf(model, 128, "%s", odp_sys_cpu_model_str());
> + CU_ASSERT(strlen(model) <= 127);
> + CU_ASSERT_PTR_NOT_NULL(odp_sys_cpu_model_str());
> +}
> +
> +static void test_odp_sys_page_size(void)
> +{
> + uint64_t page;
> +
> + page = odp_sys_page_size();
> + CU_ASSERT(0 < page);
> +}
> +
> +static void test_odp_sys_huge_page_size(void)
> +{
> + uint64_t page;
> +
> + page = odp_sys_huge_page_size();
> + CU_ASSERT(0 < page || 0 == page);
> +}
> +
> +static void test_odp_sys_cpu_hz(void)
> +{
> + uint64_t hz;
> +
> + hz = odp_sys_cpu_hz();
> + CU_ASSERT(0 < hz);
> +}
> +
> +CU_TestInfo test_odp_system[] = {
> + {"odp_sys_core_count",  test_odp_sys_core_count},
> + {"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
> + {"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
> + {"odp_sys_page_size",  test_odp_sys_page_size},
> + {"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
> + {"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
> + CU_TEST_INFO_NULL,
> +};
> +
> +CU_SuiteInfo odp_testsuites[] = {
> + {"System Info", NULL, NULL, NULL, NULL,
> +  test_odp_system},
> +  CU_SUITE_INFO_NULL,
> +};
> -- 
> 2.1.0
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] configure.ac check for atomic operations support

2014-12-14 Thread Jerin Jacob
On Fri, Dec 12, 2014 at 10:56:26PM +0100, Ola Liljedahl wrote:
> On 12 December 2014 at 16:59, Mike Holmes  wrote:
> >
> >
> > On 12 December 2014 at 10:51, Maxim Uvarov  wrote:
> >>
> >> On 12/12/2014 06:47 PM, Taras Kondratiuk wrote:
> >>>
> >>> On 12/12/2014 05:03 PM, Maxim Uvarov wrote:
> 
>  Odp atomic operations based on compiler build-ins. Make
>  sure that compiler supports such operation at configure
>  stage.
> >>>
> >>> This check should be limited to platforms that use gcc atomics.
> >>
> >> Do we have such platforms?
> >
> >
> > __OCTEON__ directly swappes out gcc, infact that pre processor switch
> > affects other files in linux-generic too.
> >
> > static inline uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom)
> > {
> > #if defined __OCTEON__
> >>---uint32_t ret;
> >>---__asm__ __volatile__ ("syncws");
> >>---__asm__ __volatile__ ("lai %0,(%2)" : "=r" (ret), "+m" (atom) :
> >>--->--->---  "r" (atom));
> >>---return ret;
> > #else
> >>---return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED);
> > #endif
> > }
> This is an OCTEON-special for just one function. I didn't want to
> remove it. But I am not sure it is actually needed. Shouldn't the
> compiler be able to generate the appropriate OCTEON-specific
> instructions (e.g. laa(d), saa(d), lai(d), lad(d) etc), gcc has
> supported OCTEON since version 4.4? Also I don't understand the reason
> for the syncw *before* the lai (load-atomic-increment) but perhaps the
> load-atomic instructions (which shouldn't linger in the write buffer
> like stores) need to be treated differently.

I generated the dis-assembly of octeon gcc generated output,
Compiler does generate appropriate instruction for __atomic_fetch* instructions.
and if the contract is "__ATOMIC_RELAXED" then "syncws" can be removed.

Typical use case for putting "syncw" before the lai operation to make sure 
cpu does not change the order of "lai" and "instructions before it"
as octeon is weakly ordered cpu for better performance.

> 
> I think this OCTEON-fix should either be removed or there should be
> specials for most if not all of the functions in odp_atomic.h

Yes, It can be removed if the contract is "__ATOMIC_RELAXED".

Do we have any specific reason to keep the API as odp_atomic_*, if its
an "__ATOMIC_RELAXED" memory model then its better to rename as counters.


> >
> >
> >>
> >>
> >>
> >> Maxim.
> >>
> >>
> >> ___
> >> lng-odp mailing list
> >> lng-odp@lists.linaro.org
> >> http://lists.linaro.org/mailman/listinfo/lng-odp
> >
> >
> >
> > --
> > Mike Holmes
> > Linaro  Sr Technical Manager
> > LNG - ODP
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
> >

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4] validation: schedule: initial testcases

2014-12-12 Thread Jerin Jacob
On Thu, Dec 11, 2014 at 01:07:26PM -0500, Mike Holmes wrote:
> On 11 December 2014 at 10:43, Ciprian Barbu 
> wrote:
> 
> > Signed-off-by: Ciprian Barbu 
> >

Reviewed-and-Tested-by: Jerin Jacob 

> 
> Reviewed-by: Mike Holmes 
> 
> My issues are covered, we will need to implement the clean up to compliment
>  schd_suite_init, once those APIs are in the repo.
> 
> Mike
> 
> 
> 
> > ---
> > v4:
> >  - fixes after Jerin's comments
> >  - removed tests_global_init and made it suite init function
> > v3:
> >  - changes after Mike's review
> >  - removed duplicate check of end of test in schedule_common_
> > v2:
> >  - rebased against ODP tip
> >  - fixed some bugs
> >  - added some defines to clearly see the testcase parameters
> >
> >  test/validation/.gitignore |   1 +
> >  test/validation/Makefile.am|   5 +-
> >  test/validation/odp_schedule.c | 607
> > +
> >  3 files changed, 612 insertions(+), 1 deletion(-)
> >  create mode 100644 test/validation/odp_schedule.c
> >
> > diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> > index 37e2594..32834ae 100644
> > --- a/test/validation/.gitignore
> > +++ b/test/validation/.gitignore
> > @@ -3,4 +3,5 @@
> >  odp_init
> >  odp_queue
> >  odp_crypto
> > +odp_schedule
> >  odp_shm
> > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> > index 8547085..3670c76 100644
> > --- a/test/validation/Makefile.am
> > +++ b/test/validation/Makefile.am
> > @@ -6,13 +6,15 @@ AM_LDFLAGS += -static
> >  if ODP_CUNIT_ENABLED
> >  TESTS = ${bin_PROGRAMS}
> >  check_PROGRAMS = ${bin_PROGRAMS}
> > -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> >  odp_init_LDFLAGS = $(AM_LDFLAGS)
> >  odp_queue_LDFLAGS = $(AM_LDFLAGS)
> >  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> >  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> >  odp_shm_CFLAGS = $(AM_CFLAGS)
> >  odp_shm_LDFLAGS = $(AM_LDFLAGS)
> > +odp_schedule_CFLAGS = $(AM_CFLAGS)
> > +odp_schedule_LDFLAGS = $(AM_LDFLAGS)
> >  endif
> >
> >  dist_odp_init_SOURCES = odp_init.c
> > @@ -22,3 +24,4 @@ dist_odp_crypto_SOURCES =
> > crypto/odp_crypto_test_async_inp.c \
> >   crypto/odp_crypto_test_rng.c \
> >   odp_crypto.c common/odp_cunit_common.c
> >  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> > +dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
> > diff --git a/test/validation/odp_schedule.c
> > b/test/validation/odp_schedule.c
> > new file mode 100644
> > index 000..9d410e4
> > --- /dev/null
> > +++ b/test/validation/odp_schedule.c
> > @@ -0,0 +1,607 @@
> > +/* Copyright (c) 2014, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier: BSD-3-Clause
> > + */
> > +
> > +#include 
> > +#include "odp_cunit_common.h"
> > +
> > +#define MAX_WORKERS_THREADS32
> > +#define MSG_POOL_SIZE  (4*1024*1024)
> > +#define QUEUES_PER_PRIO16
> > +#define BUF_SIZE   64
> > +#define TEST_NUM_BUFS  100
> > +#define BURST_BUF_SIZE 4
> > +#define TEST_NUM_BUFS_EXCL 1
> > +
> > +#define GLOBALS_SHM_NAME   "test_globals"
> > +#define MSG_POOL_NAME  "msg_pool"
> > +#define SHM_MSG_POOL_NAME  "shm_msg_pool"
> > +#define SHM_THR_ARGS_NAME  "shm_thr_args"
> > +
> > +#define ONE_Q  1
> > +#define MANY_QSQUEUES_PER_PRIO
> > +
> > +#define ONE_PRIO   1
> > +
> > +#define SCHD_ONE   0
> > +#define SCHD_MULTI 1
> > +
> > +#define DISABLE_EXCL_ATOMIC0
> > +#define ENABLE_EXCL_ATOMIC 1
> > +
> > +
> > +/* Test global variables */
> > +typedef struct {
> > +   int core_count;
> > +   odp_barrier_t barrier;
> > +   odp_schedule_prio_t current_prio;
> > +   int prio_buf_count;
> > +   odp_ticketlock_t count_lock;
> > +   odp_spinlock_t atomic_lock;
> > +} test_globals_t;
> > +
> > +typedef struct ODP_PACKED {
> > +   pthrd_arg thrdarg;
> > +   odp_schedule_sync_t sync;
> > +   int num_queues;
> > +   int num_prio;
> > + 

Re: [lng-odp] [PATCHv3] validation: schedule: initial testcases

2014-12-10 Thread Jerin Jacob
> +}
> +
> +/* Many queues many threads check priority ODP_SCHED_SYNC_ORDERED multi */
> +static void test_schedule_multi_mq_mt_prio_o(void)
> +{
> + int prio = odp_schedule_num_prio();
> + parallel_execute(ODP_SCHED_SYNC_ORDERED, MANY_QS, prio, SCHD_MULTI, 0);
> +}
> +
> +/* 1 queue many threads check exclusive access on ATOMIC queues multi */
> +static void test_schedule_multi_1q_mt_a_excl(void)
> +{
> + parallel_execute(ODP_SCHED_SYNC_ATOMIC, ONE_Q, ONE_PRIO, SCHD_MULTI,
> +  ENABLE_EXCL_ATOMIC);
> +}
> +
> +static int create_queues(void)
> +{
> + int i, j, prios;
> +
> + prios = odp_schedule_num_prio();
> +
> + for (i = 0; i < prios; i++) {
> + odp_queue_param_t p;
> + p.sched.prio  = i;
> + p.sched.group = ODP_SCHED_GROUP_DEFAULT;
> +
> + for (j = 0; j < QUEUES_PER_PRIO; j++) {
> + /* Per sched sync type */
> + char name[32];
> + odp_queue_t q;
> +
> + snprintf(name, sizeof(name), "sched_%d_%d_n", i, j);
> + p.sched.sync = ODP_SCHED_SYNC_NONE;
> + q = odp_queue_create(name, ODP_QUEUE_TYPE_SCHED, &p);
> +
> + if (q == ODP_QUEUE_INVALID) {
> + printf("Schedule queue create failed.\n");
> + return -1;
> + }
> +
> + snprintf(name, sizeof(name), "sched_%d_%d_a", i, j);
> + p.sched.sync = ODP_SCHED_SYNC_ATOMIC;
> + q = odp_queue_create(name, ODP_QUEUE_TYPE_SCHED, &p);
> +
> + if (q == ODP_QUEUE_INVALID) {
> + printf("Schedule queue create failed.\n");
> + return -1;
> + }
> +
> + snprintf(name, sizeof(name), "sched_%d_%d_o", i, j);
> + p.sched.sync = ODP_SCHED_SYNC_ORDERED;
> + q = odp_queue_create(name, ODP_QUEUE_TYPE_SCHED, &p);
> +
> + if (q == ODP_QUEUE_INVALID) {
> + printf("Schedule queue create failed.\n");
> + return -1;
> + }
> + }
> + }
> +
> + return 0;
> +}
> +
> +int tests_global_init(void)
> +{
> +     odp_shm_t shm;
> + void *pool_base;
> + odp_buffer_pool_t pool;
> + test_globals_t *globals;
> + thread_args_t *thr_args;
> +
> + shm = odp_shm_reserve(SHM_MSG_POOL_NAME, MSG_POOL_SIZE,
> +   ODP_CACHE_LINE_SIZE, 0);
> + pool_base = odp_shm_addr(shm);
> + if (pool_base == NULL) {
> + printf("Shared memory reserve failed.\n");
> + return -1;
> + }
> +
> + pool = odp_buffer_pool_create(MSG_POOL_NAME, pool_base, MSG_POOL_SIZE,
> +   BUF_SIZE, ODP_CACHE_LINE_SIZE,
> +   ODP_BUFFER_TYPE_RAW);
> + if (pool == ODP_BUFFER_POOL_INVALID) {
> + printf("Pool creation failed (msg).\n");
> + return -1;
> + }
> +
> + shm = odp_shm_reserve(GLOBALS_SHM_NAME,
> +   sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0);
> +
> + globals = odp_shm_addr(shm);
> +
> + if (globals == NULL) {
> + printf("Shared memory reserve failed (globals).\n");
> + return -1;
> + }
> +
> + memset(globals, 0, sizeof(test_globals_t));
> +
> + globals->core_count = odp_sys_core_count();
> + if (globals->core_count > MAX_WORKERS)
> + globals->core_count = MAX_WORKERS;
> +
> + shm = odp_shm_reserve(SHM_THR_ARGS_NAME, sizeof(thread_args_t),
> +   ODP_CACHE_LINE_SIZE, 0);
> + thr_args = odp_shm_addr(shm);
> +
> + if (thr_args == NULL) {
> + printf("Shared memory reserve failed (thr_args).\n");
> + return -1;
> + }
> +
> + memset(thr_args, 0, sizeof(thread_args_t));
> +
> + /* Barrier to sync test case execution */
> + odp_barrier_init(&globals->barrier, globals->core_count);
> + odp_spinlock_init(&globals->count_lock);
> + odp_spinlock_init(&globals->atomic_lock);
> +
> + if (!create_queues())
> + return -1;

Broken logic, create_queues() returns 0 for success case.

You can add my Reviewed and Tested by: after fixing the above issues.
Reviewed-and-Tested-by: Jerin Jacob 


Re: [lng-odp] [PATCH v5] cunit: add shm test

2014-11-28 Thread Jerin Jacob
On Thu, Nov 27, 2014 at 10:03:10PM -0500, Yan Sonming wrote:
> Add odp_cunit_common.c for common cunit function and add the cunit
> test for the api in odp_share_memory.h which include the new api implement
> odp_shm_free
> 
> Signed-off-by: Yan Songming 
> ---
> v5 fix the problem which Jerin and Taras found.
> v4 change the style of cunit test.
> v3 change common file to test/common and fix the problem Jerin found.
> v2 fix some problem which maxim and mike found.
> ---
>  test/validation/Makefile.am   |   5 +-
>  test/validation/common/odp_cunit_common.c |  37 +
>  test/validation/common/odp_cunit_common.h |  35 +
>  test/validation/odp_shm.c | 124 
> ++
>  4 files changed, 200 insertions(+), 1 deletion(-)
>  create mode 100644 test/validation/common/odp_cunit_common.c
>  create mode 100644 test/validation/common/odp_cunit_common.h
>  create mode 100644 test/validation/odp_shm.c
> 
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index 0b831d0..4bee2ab 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,11 +6,13 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
>  odp_init_LDFLAGS = $(AM_LDFLAGS)
>  odp_queue_LDFLAGS = $(AM_LDFLAGS)
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> +odp_shm_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/common
> +odp_shm_LDFLAGS = $(AM_LDFLAGS)
>  endif
>  
>  dist_odp_init_SOURCES = odp_init.c
> @@ -18,3 +20,4 @@ dist_odp_queue_SOURCES = odp_queue.c
>  dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
> crypto/odp_crypto_test_sync_inp.c \
> odp_crypto.c
> +dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> diff --git a/test/validation/common/odp_cunit_common.c 
> b/test/validation/common/odp_cunit_common.c
> new file mode 100644
> index 000..885b981
> --- /dev/null
> +++ b/test/validation/common/odp_cunit_common.c
> @@ -0,0 +1,37 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP test application common
> + */
> +
> +#include 
> +#include 
> +#include "odp_cunit_common.h"
> +#include "odph_linux.h"
> +/* Globals */
> +static odph_linux_pthread_t thread_tbl[MAX_WORKERS];
> +
> +/** create test thread */
> +int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg)
> +{
> + /* Create and init additional threads */
> + odph_linux_pthread_create(thread_tbl, arg->numthrds, 0, func_ptr,
> +   (void *)arg);
> +
> + return 0;
> +}
> +
> +/** exit from test thread */
> +int odp_cunit_thread_exit(pthrd_arg *arg)
> +{
> + /* Wait for other threads to exit */
> + odph_linux_pthread_join(thread_tbl, arg->numthrds);
> +
> + return 0;
> +}
> diff --git a/test/validation/common/odp_cunit_common.h 
> b/test/validation/common/odp_cunit_common.h
> new file mode 100644
> index 000..5eec376
> --- /dev/null
> +++ b/test/validation/common/odp_cunit_common.h
> @@ -0,0 +1,35 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP test application common headers
> + */
> +
> +#ifndef ODP_CUNICT_COMMON_H
> +#define ODP_CUNICT_COMMON_H
> +
> +#define MAX_WORKERS 32 /**< Maximum number of work threads */
> +
> +typedef struct {
> + uint32_t foo;
> + uint32_t bar;
> +} test_shared_data_t;
> +
> +/**
> + * Thread argument
> + */
> +typedef struct {
> + int testcase; /**< specifies which set of API's to exercise */
> + int numthrds; /**< no of pthreads to create */
> +} pthrd_arg;
> +
> +/** create thread fro start_routine function */
> +extern int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg);
> +extern int odp_cunit_thread_exit(pthrd_arg *);
> +
> +#endif /* ODP_COMMON_H */

Nit: ODP_COMMON_H -> ODP_CUNICT_COMMON_H

after that you can add my reviewed and tested by,

Reviewed and Tested by: Jerin Jacob 


> diff --git a/test/validation/odp_shm.c b/test/validation/odp_shm.c
> new file mode 100644
> index 000..be2b52b
> --- /dev/null
> +++ b/test/validation/odp_shm.c
> @@ -0,0 +1,1

Re: [lng-odp] [PATCH v4] cunit: add shm test

2014-11-27 Thread Jerin Jacob
On Thu, Nov 27, 2014 at 05:43:57AM -0500, Yan Sonming wrote:
> Add odp_cunit_common.c for common cunit function and add the cunit
> test for the api in odp_share_memory.h which include the new api
> implement odp_shm_free.
> 
> Signed-off-by: Yan Songming 
> ---
> v4 change the style of cunit test.
> v3 change common file to test/common and fix the problem Jerin found.
> v2 fix some problem which maxim and mike found.
> ---
>  test/validation/Makefile.am   |   7 +-
>  test/validation/common/odp_cunit_common.c |  37 +
>  test/validation/common/odp_cunit_common.h |  35 +
>  test/validation/odp_shm.c | 121 
> ++
>  4 files changed, 198 insertions(+), 2 deletions(-)
>  create mode 100644 test/validation/common/odp_cunit_common.c
>  create mode 100644 test/validation/common/odp_cunit_common.h
>  create mode 100644 test/validation/odp_shm.c
> 
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index 0b831d0..86200d4 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,11 +6,13 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
>  odp_init_LDFLAGS = $(AM_LDFLAGS)
>  odp_queue_LDFLAGS = $(AM_LDFLAGS)
> -odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> +odp_crypto_CFLAGS = $(AM_CFLAGS) -I./crypto
>  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> +odp_shm_CFLAGS = $(AM_CFLAGS) -I./common
> +odp_shm_LDFLAGS = $(AM_LDFLAGS)
>  endif
>  
>  dist_odp_init_SOURCES = odp_init.c
> @@ -18,3 +20,4 @@ dist_odp_queue_SOURCES = odp_queue.c
>  dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
> crypto/odp_crypto_test_sync_inp.c \
> odp_crypto.c
> +dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> diff --git a/test/validation/common/odp_cunit_common.c 
> b/test/validation/common/odp_cunit_common.c
> new file mode 100644
> index 000..885b981
> --- /dev/null
> +++ b/test/validation/common/odp_cunit_common.c
> @@ -0,0 +1,37 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP test application common
> + */
> +
> +#include 
> +#include 
> +#include "odp_cunit_common.h"
> +#include "odph_linux.h"
> +/* Globals */
> +static odph_linux_pthread_t thread_tbl[MAX_WORKERS];
> +
> +/** create test thread */
> +int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg)
> +{
> + /* Create and init additional threads */
> + odph_linux_pthread_create(thread_tbl, arg->numthrds, 0, func_ptr,
> +   (void *)arg);
> +
> + return 0;
> +}
> +
> +/** exit from test thread */
> +int odp_cunit_thread_exit(pthrd_arg *arg)
> +{
> + /* Wait for other threads to exit */
> + odph_linux_pthread_join(thread_tbl, arg->numthrds);
> +
> + return 0;
> +}
> diff --git a/test/validation/common/odp_cunit_common.h 
> b/test/validation/common/odp_cunit_common.h
> new file mode 100644
> index 000..5eec376
> --- /dev/null
> +++ b/test/validation/common/odp_cunit_common.h
> @@ -0,0 +1,35 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP test application common headers
> + */
> +
> +#ifndef ODP_CUNICT_COMMON_H
> +#define ODP_CUNICT_COMMON_H
> +
> +#define MAX_WORKERS 32 /**< Maximum number of work threads */
> +
> +typedef struct {
> + uint32_t foo;
> + uint32_t bar;
> +} test_shared_data_t;
> +
> +/**
> + * Thread argument
> + */
> +typedef struct {
> + int testcase; /**< specifies which set of API's to exercise */
> + int numthrds; /**< no of pthreads to create */
> +} pthrd_arg;
> +
> +/** create thread fro start_routine function */
> +extern int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg);
> +extern int odp_cunit_thread_exit(pthrd_arg *);
> +
> +#endif /* ODP_COMMON_H */
> diff --git a/test/validation/odp_shm.c b/test/validation/odp_shm.c
> new file mode 100644
> index 000..431509d
> --- /dev/null
> +++ b/test/validation/odp_shm.c
> @@ -0,0 +1,121 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include "odp.h"
> +#include "CUnit/Basic.h"
> +#include "odp_cunit_common.h"
> +
> +#define ALIGE_SIZE  (128)
> +#define TESTNAME "cunit_test_shared_data"
> +#define TEST_SHARE_FOO (0xf0f0f0f0)
> +#define TEST_SHARE_BAR (0xf0f0f0f)
> +
> +static void *run_shm_thread(void *arg)
> +{
> + odp_shm_info_t  info;
> + odp_shm_t shm;
> + test_shared_data_t *test_shared_data;
> + int thr;
> +
> + thr = odp_thread_id();
> + printf("Thread %i starts\n", 

Re: [lng-odp] [PATCH 2/2] linux-generic: odp_pktio_open loop0 support

2014-11-26 Thread Jerin Jacob
On Wed, Nov 26, 2014 at 05:05:14PM +0300, Maxim Uvarov wrote:
> On 11/26/2014 04:33 PM, Taras Kondratiuk wrote:
> >On 11/26/2014 03:23 PM, Jerin Jacob wrote:
> >>On Wed, Nov 26, 2014 at 02:53:50PM +0300, Maxim Uvarov wrote:
> >>>On 11/26/2014 12:25 PM, Ola Liljedahl wrote:
> >>>>On 26 November 2014 at 09:39, Alexandru Badicioiu
> >>>> wrote:
> >>>>>This patch has no description. The title is not self explanatory
> >>>>>either.
> >>>>>Also the existence of eth0 should be verified  before mapping the
> >>>>>loop0 to
> >>>>>eth0 - some platforms may use other interface names (e.g. fmX-gby
> >>>>>for FSL
> >>>>>DPAA platforms).  I think a better solution would be to enumerate the
> >>>>>available interfaces  and pick a suitable one.
> >>>>I second that opinion. On my ChromeBook (great development
> >>>>platforms!), the only Ethernet-like
> >>>>interface is called mlan0.
> >>>Hm, renaming should be done to some predictable name. eth0 is very
> >>>common
> >>>for linux.
> >>>If it's not so that can be changed with export
> >>>ODP_PKTIO_LOOPDEV="mlan0".
> >>>
> >>>I can walk over the list but not sure how to select interface that can
> >>>be
> >>>used.
> >>
> >>IMO we should  have an ODP API to enumerate all the available pktio
> >>ports
> >>in a given platform as strings along with a bitmap to represent their
> >>capability(like PKTIO_CAP_LOOPBACK)
> >>So that application can choose the pktio based on the capability.
> >>We can use our odp___next API model for enumeration.
> >
> >+1
> >
> >Instead of bitmap it can some struct.
> 
> 
> Any hint how that can be implemented on linux-generic for v1?

How about mapping to linux lo loopback device ?

lo: flags=73  mtu 65536
inet 127.0.0.1  netmask 255.0.0.0
inet6 ::1  prefixlen 128  scopeid 0x10
loop  txqueuelen 0  (Local Loopback)
RX packets 580  bytes 48524 (47.3 KiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 580  bytes 48524 (47.3 KiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


> 
> 

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 2/2] linux-generic: odp_pktio_open loop0 support

2014-11-26 Thread Jerin Jacob
On Wed, Nov 26, 2014 at 02:53:50PM +0300, Maxim Uvarov wrote:
> On 11/26/2014 12:25 PM, Ola Liljedahl wrote:
> >On 26 November 2014 at 09:39, Alexandru Badicioiu
> > wrote:
> >>This patch has no description. The title is not self explanatory either.
> >>Also the existence of eth0 should be verified  before mapping the loop0 to
> >>eth0 - some platforms may use other interface names (e.g. fmX-gby for FSL
> >>DPAA platforms).  I think a better solution would be to enumerate the
> >>available interfaces  and pick a suitable one.
> >I second that opinion. On my ChromeBook (great development
> >platforms!), the only Ethernet-like
> >interface is called mlan0.
> Hm, renaming should be done to some predictable name. eth0 is very common
> for linux.
> If it's not so that can be changed with export ODP_PKTIO_LOOPDEV="mlan0".
> 
> I can walk over the list but not sure how to select interface that can be
> used.

IMO we should  have an ODP API to enumerate all the available pktio ports 
in a given platform as strings along with a bitmap to represent their 
capability(like PKTIO_CAP_LOOPBACK)
So that application can choose the pktio based on the capability.
We can use our odp___next API model for enumeration.

> 
> Maxim.
> 
> 
> >
> >>
> >>On 25 November 2014 at 18:24, Maxim Uvarov  wrote:
> >>>Signed-off-by: Maxim Uvarov 
> >>>---
> >>>  platform/linux-generic/odp_packet_io.c | 27 +++
> >>>  1 file changed, 27 insertions(+)
> >>>
> >>>diff --git a/platform/linux-generic/odp_packet_io.c
> >>>b/platform/linux-generic/odp_packet_io.c
> >>>index c523350..501b2e9 100644
> >>>--- a/platform/linux-generic/odp_packet_io.c
> >>>+++ b/platform/linux-generic/odp_packet_io.c
> >>>@@ -156,6 +156,33 @@ odp_pktio_t odp_pktio_open(const char *dev,
> >>>odp_buffer_pool_t pool)
> >>> pktio_entry_t *pktio_entry;
> >>> int res;
> >>> int fanout = 1;
> >>>+   char loop0[IFNAMSIZ] = "eth0"; /* linux-generic loop0 device*/
> >This comment is strange. If ODP uses an interface like "eth0", how can
> >that be a loopback interface?
> >Won't packet I/O using this interface be mapped onto the real Ethernet
> >interface and sent onto the physical link?
> >
> >-- Ola
> >
> >>>+   char *loop_hint;
> >>>+
> >>>+   if (strlen(dev) > IFNAMSIZ) {
> >>>+   /* ioctl names limitation */
> >>>+   ODP_ERR("pktio name %s is too big, limit is %d bytes\n",
> >>>+   dev, IFNAMSIZ);
> >>>+   return ODP_PKTIO_INVALID;
> >>>+   }
> >>>+
> >>>+   loop_hint = getenv("ODP_PKTIO_LOOPDEV");
> >>>+   if (!strncmp(dev, "loop0", 5)) {
> >>>+   if (loop_hint && (strlen(loop_hint) > 0)) {
> >>>+   if (strlen(loop_hint) > IFNAMSIZ) {
> >>>+   ODP_ERR("pktio name %s is too big, limit
> >>>is %d bytes\n",
> >>>+   loop_hint, IFNAMSIZ);
> >>>+   return ODP_PKTIO_INVALID;
> >>>+   }
> >>>+
> >>>+   memset(loop0, 0, IFNAMSIZ);
> >>>+   memcpy(loop0, loop_hint, strlen(loop_hint));
> >>>+   ODP_DBG("pktio rename loop0 to %s\n", loop_hint);
> >>>+   } else {
> >>>+   ODP_DBG("pktio rename loop0 to eth0\n");
> >>>+   dev = loop0;
> >>>+   }
> >>>+   }
> >>>
> >>> id = alloc_lock_pktio_entry();
> >>> if (id == ODP_PKTIO_INVALID) {
> >>>--
> >>>1.8.5.1.163.gd7aced9
> >>>
> >>>
> >>>___
> >>>lng-odp mailing list
> >>>lng-odp@lists.linaro.org
> >>>http://lists.linaro.org/mailman/listinfo/lng-odp
> >>
> >>
> >>___
> >>lng-odp mailing list
> >>lng-odp@lists.linaro.org
> >>http://lists.linaro.org/mailman/listinfo/lng-odp
> >>
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2] cunit: add shm test

2014-11-25 Thread Jerin Jacob
On Tue, Nov 25, 2014 at 06:13:37PM +0800, yan.songm...@linaro.org wrote:
> ->There is nothing wrong in existing "odph_linux_pthread_create". All I am 
> saying that, Don't allocate
> ->the memory from stack to share the data between different execution 
> context. "pthrd_arg thrdarg" its from stack,
> ->you can allocate it from odp shared memeory to share between different 
> cores.
> 
> I just have some confuse.
> Yes, i know you say that the stack will not work in environment other than 
> linux.
> So , i think other API, such as  odph_linux_pthread_create won't work in 
> other environment too,.

Expected, Its a helper function and its not part of normative ODP 
specification. 
But the contract between ODP normative API and APP should be maintained like 
use odp shared memory
to share the data between different execution context

>  We have a lot of thing like this. Maybe we need to change them all.
> 
> 
> 
> yan.songm...@linaro.org
>  
> From: Jerin Jacob
> Date: 2014-11-25 17:14
> To: yan.songm...@linaro.org
> CC: lng-odp@lists.linaro.org
> Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test
> On Tue, Nov 25, 2014 at 03:39:20PM +0800, yan.songm...@linaro.org wrote:
> > 
> > I think if we use other environment. We can't even use any API in 
> > odp_linux.h which is used in many file of odp.
> > This photo blew show  the file which used 'odph_linux_pthread_create'. 
> > There are more than ten places to use it .
> > If we do need to consider this. I think we should make the rule and change 
> > all the place to use it before.
>  
> static void test_odp_shm_sunnyday(void)
> {
> pthrd_arg thrdarg;
>  
> There is nothing wrong in existing "odph_linux_pthread_create". All I am 
> saying that, Don't allocate
> the memory from stack to share the data between different execution context. 
> "pthrd_arg thrdarg" its from stack,
> you can allocate it from odp shared memeory to share between different cores.
>  
> thrdarg.testcase = ODP_SHM_TEST;
> thrdarg.numthrds = odp_sys_core_count();
>  
> odp_cunit_thread_create(run_shm_thread, &thrdarg);
>  
>  
> > 
> > 
> > 
> > 
> > yan.songm...@linaro.org
> >  
> > From: Jerin Jacob
> > Date: 2014-11-25 15:57
> > To: yan.songm...@linaro.org
> > CC: lng-odp@lists.linaro.org
> > Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test
> > On Tue, Nov 25, 2014 at 03:03:47PM +0800, yan.songm...@linaro.org wrote:
> > > Jerin,
> > > 
> > > >ODP API's are execution environment agnostic. We have a odp 
> > > >implementation
> > > >that supports both linux and baremetal.
> > > 
> > > I saw the code of odp_shared_memory is in 'odp/platform/linux-generic',
> > > except for 'linux-generic' i don't see any other directory means it 
> > > support other environment.
> >  
> > Cavium's ODP implementation is not yet public.
> >  
> > > 
> > > 
> > > 
> > > 
> > > yan.songm...@linaro.org
> > >  
> > > From: Jerin Jacob
> > > Date: 2014-11-24 20:12
> > > To: yan.songm...@linaro.org
> > > CC: lng-odp@lists.linaro.org
> > > Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test
> > > On Mon, Nov 24, 2014 at 05:22:28PM +0800, yan.songm...@linaro.org wrote:
> > > > Hi Jerin,
> > > > Thanks for reading this patch. I'll change the problem of  the use of 
> > > > 'shm'.
> > > > 
> > > > 
> > > > ->IMO, We should avoid using variables allocated from stack to share
> > > > ->the data between different execution context.
> > > > ->It will work in linux threaded run-time environment.But it will
> > > > ->have issues in different run-time environment like bare-metal.
> > > > ->IMO if any memory needs to be shared across different
> > > > ->execution environment should use the memory allocated from odp shared 
> > > > mem.
> > > > 
> > > > Sorry ,i can't get it . You mean that sometimes we don't use odp in 
> > > > linux ?
> > >  
> > > ODP API's are execution environment agnostic. We have a odp implementation
> > > that supports both linux and baremetal.
> > >  
> > > > If so , i think we use this only in linux, if not  there are a lot of 
> > > > api will not work. 
> > > > This cunit test is for shm, so if i use it to test its

Re: [lng-odp] [PATCH v2] cunit: add shm test

2014-11-25 Thread Jerin Jacob
On Tue, Nov 25, 2014 at 03:39:20PM +0800, yan.songm...@linaro.org wrote:
> 
> I think if we use other environment. We can't even use any API in odp_linux.h 
> which is used in many file of odp.
> This photo blew show  the file which used 'odph_linux_pthread_create'. There 
> are more than ten places to use it .
> If we do need to consider this. I think we should make the rule and change 
> all the place to use it before.

static void test_odp_shm_sunnyday(void)
{
 pthrd_arg thrdarg;

There is nothing wrong in existing "odph_linux_pthread_create". All I am saying 
that, Don't allocate
the memory from stack to share the data between different execution context. 
"pthrd_arg thrdarg" its from stack,
you can allocate it from odp shared memeory to share between different cores.

 thrdarg.testcase = ODP_SHM_TEST;
 thrdarg.numthrds = odp_sys_core_count();

 odp_cunit_thread_create(run_shm_thread, &thrdarg);


> 
> 
> 
> 
> yan.songm...@linaro.org
>  
> From: Jerin Jacob
> Date: 2014-11-25 15:57
> To: yan.songm...@linaro.org
> CC: lng-odp@lists.linaro.org
> Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test
> On Tue, Nov 25, 2014 at 03:03:47PM +0800, yan.songm...@linaro.org wrote:
> > Jerin,
> > 
> > >ODP API's are execution environment agnostic. We have a odp implementation
> > >that supports both linux and baremetal.
> > 
> > I saw the code of odp_shared_memory is in 'odp/platform/linux-generic',
> > except for 'linux-generic' i don't see any other directory means it support 
> > other environment.
>  
> Cavium's ODP implementation is not yet public.
>  
> > 
> > 
> > 
> > 
> > yan.songm...@linaro.org
> >  
> > From: Jerin Jacob
> > Date: 2014-11-24 20:12
> > To: yan.songm...@linaro.org
> > CC: lng-odp@lists.linaro.org
> > Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test
> > On Mon, Nov 24, 2014 at 05:22:28PM +0800, yan.songm...@linaro.org wrote:
> > > Hi Jerin,
> > > Thanks for reading this patch. I'll change the problem of  the use of 
> > > 'shm'.
> > > 
> > > 
> > > ->IMO, We should avoid using variables allocated from stack to share
> > > ->the data between different execution context.
> > > ->It will work in linux threaded run-time environment.But it will
> > > ->have issues in different run-time environment like bare-metal.
> > > ->IMO if any memory needs to be shared across different
> > > ->execution environment should use the memory allocated from odp shared 
> > > mem.
> > > 
> > > Sorry ,i can't get it . You mean that sometimes we don't use odp in linux 
> > > ?
> >  
> > ODP API's are execution environment agnostic. We have a odp implementation
> > that supports both linux and baremetal.
> >  
> > > If so , i think we use this only in linux, if not  there are a lot of api 
> > > will not work. 
> > > This cunit test is for shm, so if i use it to test itself is not a good 
> > > idea.
> >  
> > Other way around to look its, its sunnyday test to check the shared memory
> > accessibly across the different odp execution context.
> >  
> > >  
> > > 
> > > 
> > > yan.songm...@linaro.org
> > >  
> > > From: Jerin Jacob
> > > Date: 2014-11-24 15:21
> > > To: Yan Songming
> > > CC: lng-odp@lists.linaro.org
> > > Subject: Re: [lng-odp] [PATCH v2] cunit: add shm test
> > > On Thu, Nov 20, 2014 at 10:54:55PM +0800, Yan Songming wrote:
> > > > Add odp_cunit_common.c for common cunit function and add the cunit
> > > > test for the api in odp_share_memory.h which include the new api 
> > > > implement
> > > > odp_shm_free.
> > > > 
> > > > Signed-off-by: Yan Songming 
> > > > ---
> > > > v2 fix some problem which maxim and mike found.
> > > > ---
> > > >  test/validation/Makefile.am|   4 +-
> > > >  test/validation/odp_cunit_common.c |  37 
> > > >  test/validation/odp_cunit_common.h |  41 +
> > > >  test/validation/odp_shm.c  | 121 
> > > > +
> > > >  4 files changed, 202 insertions(+), 1 deletion(-)
> > > >  create mode 100644 test/validation/odp_cunit_common.c
> > > >  create mode 100644 test/validation/odp_cunit_common.h
> > > >  create mode 100644 test/validation/odp_shm.c
> >

Re: [lng-odp] [PATCH v2] cunit: add shm test

2014-11-24 Thread Jerin Jacob
On Tue, Nov 25, 2014 at 03:03:47PM +0800, yan.songm...@linaro.org wrote:
> Jerin,
> 
> >ODP API's are execution environment agnostic. We have a odp implementation
> >that supports both linux and baremetal.
> 
> I saw the code of odp_shared_memory is in 'odp/platform/linux-generic',
> except for 'linux-generic' i don't see any other directory means it support 
> other environment.

Cavium's ODP implementation is not yet public.

> 
> 
> 
> 
> yan.songm...@linaro.org
>  
> From: Jerin Jacob
> Date: 2014-11-24 20:12
> To: yan.songm...@linaro.org
> CC: lng-odp@lists.linaro.org
> Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test
> On Mon, Nov 24, 2014 at 05:22:28PM +0800, yan.songm...@linaro.org wrote:
> > Hi Jerin,
> > Thanks for reading this patch. I'll change the problem of  the use of 'shm'.
> > 
> > 
> > ->IMO, We should avoid using variables allocated from stack to share
> > ->the data between different execution context.
> > ->It will work in linux threaded run-time environment.But it will
> > ->have issues in different run-time environment like bare-metal.
> > ->IMO if any memory needs to be shared across different
> > ->execution environment should use the memory allocated from odp shared mem.
> > 
> > Sorry ,i can't get it . You mean that sometimes we don't use odp in linux ?
>  
> ODP API's are execution environment agnostic. We have a odp implementation
> that supports both linux and baremetal.
>  
> > If so , i think we use this only in linux, if not  there are a lot of api 
> > will not work. 
> > This cunit test is for shm, so if i use it to test itself is not a good 
> > idea.
>  
> Other way around to look its, its sunnyday test to check the shared memory
> accessibly across the different odp execution context.
>  
> >  
> > 
> > 
> > yan.songm...@linaro.org
> >  
> > From: Jerin Jacob
> > Date: 2014-11-24 15:21
> > To: Yan Songming
> > CC: lng-odp@lists.linaro.org
> > Subject: Re: [lng-odp] [PATCH v2] cunit: add shm test
> > On Thu, Nov 20, 2014 at 10:54:55PM +0800, Yan Songming wrote:
> > > Add odp_cunit_common.c for common cunit function and add the cunit
> > > test for the api in odp_share_memory.h which include the new api implement
> > > odp_shm_free.
> > > 
> > > Signed-off-by: Yan Songming 
> > > ---
> > > v2 fix some problem which maxim and mike found.
> > > ---
> > >  test/validation/Makefile.am|   4 +-
> > >  test/validation/odp_cunit_common.c |  37 
> > >  test/validation/odp_cunit_common.h |  41 +
> > >  test/validation/odp_shm.c  | 121 
> > > +
> > >  4 files changed, 202 insertions(+), 1 deletion(-)
> > >  create mode 100644 test/validation/odp_cunit_common.c
> > >  create mode 100644 test/validation/odp_cunit_common.h
> > >  create mode 100644 test/validation/odp_shm.c
> > > 
> > > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> > > index 2e1b991..5992f72 100644
> > > --- a/test/validation/Makefile.am
> > > +++ b/test/validation/Makefile.am
> > > @@ -6,11 +6,12 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit
> > >  if ODP_CUNIT_ENABLED
> > >  TESTS = ${bin_PROGRAMS}
> > >  check_PROGRAMS = ${bin_PROGRAMS}
> > > -bin_PROGRAMS = odp_init odp_queue odp_crypto
> > > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> > >  odp_init_LDFLAGS = $(AM_LDFLAGS)
> > >  odp_queue_LDFLAGS = $(AM_LDFLAGS)
> > >  odp_crypto_CFLAGS = $(AM_CFLAGS) -I./crypto
> > >  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> > > +odp_shm_LDFLAGS = $(AM_LDFLAGS)
> > >  endif
> > >  
> > >  dist_odp_init_SOURCES = odp_init.c
> > > @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c
> > >  dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
> > >crypto/odp_crypto_test_sync_inp.c \
> > >odp_crypto.c
> > > +dist_odp_shm_SOURCES = odp_shm.c odp_cunit_common.c
> > > diff --git a/test/validation/odp_cunit_common.c 
> > > b/test/validation/odp_cunit_common.c
> > > new file mode 100644
> > > index 000..885b981
> > > --- /dev/null
> > > +++ b/test/validation/odp_cunit_common.c
> > > @@ -0,0 +1,37 @@
> > > +/* Copyright (c) 2014, Linaro Limited
> > > + * All rights reserved.
> > > + *
>

Re: [lng-odp] [PATCH v2] cunit: add shm test

2014-11-24 Thread Jerin Jacob
On Mon, Nov 24, 2014 at 05:22:28PM +0800, yan.songm...@linaro.org wrote:
> Hi Jerin,
> Thanks for reading this patch. I'll change the problem of  the use of 'shm'.
> 
> 
> ->IMO, We should avoid using variables allocated from stack to share
> ->the data between different execution context.
> ->It will work in linux threaded run-time environment.But it will
> ->have issues in different run-time environment like bare-metal.
> ->IMO if any memory needs to be shared across different
> ->execution environment should use the memory allocated from odp shared mem.
> 
> Sorry ,i can't get it . You mean that sometimes we don't use odp in linux ?

ODP API's are execution environment agnostic. We have a odp implementation
that supports both linux and baremetal.

> If so , i think we use this only in linux, if not  there are a lot of api 
> will not work. 
> This cunit test is for shm, so if i use it to test itself is not a good idea.

Other way around to look its, its sunnyday test to check the shared memory
accessibly across the different odp execution context.

>  
> 
> 
> yan.songm...@linaro.org
>  
> From: Jerin Jacob
> Date: 2014-11-24 15:21
> To: Yan Songming
> CC: lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [PATCH v2] cunit: add shm test
> On Thu, Nov 20, 2014 at 10:54:55PM +0800, Yan Songming wrote:
> > Add odp_cunit_common.c for common cunit function and add the cunit
> > test for the api in odp_share_memory.h which include the new api implement
> > odp_shm_free.
> > 
> > Signed-off-by: Yan Songming 
> > ---
> > v2 fix some problem which maxim and mike found.
> > ---
> >  test/validation/Makefile.am|   4 +-
> >  test/validation/odp_cunit_common.c |  37 
> >  test/validation/odp_cunit_common.h |  41 +
> >  test/validation/odp_shm.c  | 121 
> > +
> >  4 files changed, 202 insertions(+), 1 deletion(-)
> >  create mode 100644 test/validation/odp_cunit_common.c
> >  create mode 100644 test/validation/odp_cunit_common.h
> >  create mode 100644 test/validation/odp_shm.c
> > 
> > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> > index 2e1b991..5992f72 100644
> > --- a/test/validation/Makefile.am
> > +++ b/test/validation/Makefile.am
> > @@ -6,11 +6,12 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit
> >  if ODP_CUNIT_ENABLED
> >  TESTS = ${bin_PROGRAMS}
> >  check_PROGRAMS = ${bin_PROGRAMS}
> > -bin_PROGRAMS = odp_init odp_queue odp_crypto
> > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> >  odp_init_LDFLAGS = $(AM_LDFLAGS)
> >  odp_queue_LDFLAGS = $(AM_LDFLAGS)
> >  odp_crypto_CFLAGS = $(AM_CFLAGS) -I./crypto
> >  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> > +odp_shm_LDFLAGS = $(AM_LDFLAGS)
> >  endif
> >  
> >  dist_odp_init_SOURCES = odp_init.c
> > @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c
> >  dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
> >crypto/odp_crypto_test_sync_inp.c \
> >odp_crypto.c
> > +dist_odp_shm_SOURCES = odp_shm.c odp_cunit_common.c
> > diff --git a/test/validation/odp_cunit_common.c 
> > b/test/validation/odp_cunit_common.c
> > new file mode 100644
> > index 000..885b981
> > --- /dev/null
> > +++ b/test/validation/odp_cunit_common.c
> > @@ -0,0 +1,37 @@
> > +/* Copyright (c) 2014, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier: BSD-3-Clause
> > + */
> > +
> > +/**
> > + * @file
> > + *
> > + * ODP test application common
> > + */
> > +
> > +#include 
> > +#include 
> > +#include "odp_cunit_common.h"
> > +#include "odph_linux.h"
> > +/* Globals */
> > +static odph_linux_pthread_t thread_tbl[MAX_WORKERS];
> > +
> > +/** create test thread */
> > +int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg)
> > +{
> > + /* Create and init additional threads */
> > + odph_linux_pthread_create(thread_tbl, arg->numthrds, 0, func_ptr,
> > +   (void *)arg);
> > +
> > + return 0;
> > +}
> > +
> > +/** exit from test thread */
> > +int odp_cunit_thread_exit(pthrd_arg *arg)
> > +{
> > + /* Wait for other threads to exit */
> > + odph_linux_pthread_join(thread_tbl, arg->numthrds);
> > +
> > + return 0;
> > +}
> > diff --git a/test/validation/odp_cunit_common.h 
> > b/test/validation/odp_cunit_common.h
> > new file mode 100644
> >

  1   2   >