Re: [lng-odp] [PATCH 5/8] add fbk hash table

2015-10-09 Thread Ola Liljedahl
On 9 October 2015 at 10:33, HePeng  wrote:

>
> 在 2015年10月9日,下午4:26,Ola Liljedahl  写道:
>
> On 8 October 2015 at 14:43, HePeng  wrote:
>
>>
>> 在 2015年10月8日,下午8:13,Ola Liljedahl  写道:
>>
>> On 8 October 2015 at 10:02, Bill Fischofer 
>> wrote:
>>
>>> Trying to keep the rte_ prefix would be confusing.  One of the precepts
>>> of ODP is that it doesn't preclude an application also using an underlying
>>> SDK in addition to ODP APIs.  Whether that makes sense is up to the
>>> application, of course.  But if ODP were to start using other prefixes I'd
>>> imagine that would get very messy.
>>
>> It would also be confusing to have functions that use odp_ naming
>> conventions but don't behave like ODP functions (with regards to e.g.
>> handling and returning errors or checking parameters).
>>
>> We can fix this by wrapping these functions.
>>
> I don't follow you. How can you make these function behave like ODP
> functions by "wrapping" them?
> Me thinks you have to modify the implementation in order to change the
> behaviour.
>
>
> I mean that perhaps not all the functions needs to be changed, only the
> exposed ones (APIs). Some functions are static and are only used in
> the internal of implementation, these functions can reserve their code.
>
Static functions can have whatever names you like. But if their
implementation contributes to the behaviour as seen by callers of the
public functions, that behaviour must be compliant with the ODP style.


>
>
>  But considering that the internal code is already ready, I am thinking
>> reserve the code of *static* functions (internal implementations)?
>>
>>
>>
>>
>> So if we rename code imported from e.g. DPDK, we should also convert it
>> to behave like proper ODP functions. That we can base the implementation on
>> preexisting code is just incidental and should not affect how the code
>> behaves.
>>
>>
>>> On Wednesday, October 7, 2015, Ola Liljedahl 
>>> wrote:
>>>
 On 23 September 2015 at 19:51, Maxim Uvarov 
 wrote:

>
>
> On 09/20/15 07:04, rujiacs wrote:
>
>> Signed-off-by: rujiacs 
>> ---
>>   helper/hash_fbk.c| 179 
>>   helper/include/odp/helper/hash_fbk.h | 404
>> +++
>>   2 files changed, 583 insertions(+)
>>   create mode 100644 helper/hash_fbk.c
>>   create mode 100644 helper/include/odp/helper/hash_fbk.h
>>
>> diff --git a/helper/hash_fbk.c b/helper/hash_fbk.c
>> new file mode 100644
>> index 000..eae7596
>> --- /dev/null
>> +++ b/helper/hash_fbk.c
>> @@ -0,0 +1,179 @@
>> +/**
>> + *   BSD LICENSE
>> + *
>> + *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
>> + *   All rights reserved.
>> + *
>> + *   Redistribution and use in source and binary forms, with or
>> without
>> + *   modification, are permitted provided that the following
>> conditions
>> + *   are met:
>> + *
>> + * * Redistributions of source code must retain the above
>> copyright
>> + *   notice, this list of conditions and the following
>> disclaimer.
>> + * * Redistributions in binary form must reproduce the above
>> copyright
>> + *   notice, this list of conditions and the following
>> disclaimer in
>> + *   the documentation and/or other materials provided with the
>> + *   distribution.
>> + * * Neither the name of Intel Corporation nor the names of its
>> + *   contributors may be used to endorse or promote products
>> derived
>> + *   from this software without specific prior written
>> permission.
>> + *
>> + *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
>> CONTRIBUTORS
>> + *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
>> NOT
>> + *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
>> FITNESS FOR
>> + *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
>> COPYRIGHT
>> + *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
>> INCIDENTAL,
>> + *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>> + *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
>> OF USE,
>> + *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>> ON ANY
>> + *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
>> TORT
>> + *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
>> THE USE
>> + *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
>> DAMAGE.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +

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

2015-10-09 Thread Ola Liljedahl
On 9 October 2015 at 09:34, Alexandru Badicioiu <
alexandru.badici...@linaro.org> wrote:

> The problem you raised is not strictly related to this patch.
> A crypto session has an output queue (for async mode) where the results ,
> including the operation status, will be delivered. There is nothing in the
> API to prevent using a pktio output queue for crypto completion events but
> the pktio should be able to process the event as the application would do.
> In this case an extension of pktio functionality would be required.
>
Yes but I was thinking of some change (in API and implementation) where the
output of the crypto operations is the actual packet (with L2/L3
encapsulation), not a crypto completion event.


>
> Alex
>
>
> On 8 October 2015 at 20:13, Ola Liljedahl 
> wrote:
>
>> Can this proposal be extended to handle inline IPsec processing, e.g.
>> encrypt and encapsulate packet (include Ethernet framing) and then send to
>> (enqueue) to some user-defined queue (which might be a pktio output queue)?
>> Need some way to report errors and other conditions back to SW so might
>> need some kind of ipsec notification event.
>> Something for the ingress side as well, e.g. connect user-defined queues
>> to IPsec input queue(s) and then specify corresponding output queues.
>>
>>
>> On 31 July 2015 at 11:30, Alexandru Badicioiu <
>> alexandru.badici...@linaro.org> wrote:
>>
>>>
>>>
>>> On 30 July 2015 at 17:44, Stuart Haslam 
>>> wrote:
>>>
 On Thu, Jul 30, 2015 at 02:42:08PM +0300, Alexandru Badicioiu wrote:
 > On 30 July 2015 at 13:50, Stuart Haslam 
 wrote:
 >
 > > 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 <
 alexandru.badici...@linaro.org>
 > > > ---
 > > >  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 */
 > >
 > > This name is pretty cryptic, how about just replay_window?
 > >
 > [Alex] The standard name for this parameter is anti-replay window. In
 the
 > context of IPSec this should not be cryptic (odp_ipsec_arw vs
 odp_arw). If
 > your suggestion is to replace the name of the struct member - ar_ws
 with
 > replay_window I'm fine with it but not the name of the enum
 > (odp_ipsec_ar_ws).
 > Or maybe change it to enum odp_ipsec_arw.

 I meant the variable name, don't mind about the enum name.
 [Alex] I'm OK with the change.

 > >
 > > > + 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 */
 > > > + 

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

2015-10-09 Thread Alexandru Badicioiu
This was a long discussion some time ago and the result was that crypto
output should be abstracted in the form of the completion event and access
functions would retrieve status and output packets. Also the implementation
is in charge with crypto completion event allocation and not the
application even if this is not really supported in HW.
The previous approach was that application supplied the completion event as
being the output packet but this was regarded as a hack.

Alex

On 9 October 2015 at 11:28, Ola Liljedahl  wrote:

> On 9 October 2015 at 09:34, Alexandru Badicioiu <
> alexandru.badici...@linaro.org> wrote:
>
>> The problem you raised is not strictly related to this patch.
>> A crypto session has an output queue (for async mode) where the results ,
>> including the operation status, will be delivered. There is nothing in the
>> API to prevent using a pktio output queue for crypto completion events but
>> the pktio should be able to process the event as the application would do.
>> In this case an extension of pktio functionality would be required.
>>
> Yes but I was thinking of some change (in API and implementation) where
> the output of the crypto operations is the actual packet (with L2/L3
> encapsulation), not a crypto completion event.
>
>
>>
>> Alex
>>
>>
>> On 8 October 2015 at 20:13, Ola Liljedahl 
>> wrote:
>>
>>> Can this proposal be extended to handle inline IPsec processing, e.g.
>>> encrypt and encapsulate packet (include Ethernet framing) and then send to
>>> (enqueue) to some user-defined queue (which might be a pktio output queue)?
>>> Need some way to report errors and other conditions back to SW so might
>>> need some kind of ipsec notification event.
>>> Something for the ingress side as well, e.g. connect user-defined queues
>>> to IPsec input queue(s) and then specify corresponding output queues.
>>>
>>>
>>> On 31 July 2015 at 11:30, Alexandru Badicioiu <
>>> alexandru.badici...@linaro.org> wrote:
>>>


 On 30 July 2015 at 17:44, Stuart Haslam 
 wrote:

> On Thu, Jul 30, 2015 at 02:42:08PM +0300, Alexandru Badicioiu wrote:
> > On 30 July 2015 at 13:50, Stuart Haslam 
> wrote:
> >
> > > 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 <
> alexandru.badici...@linaro.org>
> > > > ---
> > > >  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 */
> > >
> > > This name is pretty cryptic, how about just replay_window?
> > >
> > [Alex] The standard name for this parameter is anti-replay window.
> In the
> > context of IPSec this should 

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

2015-10-09 Thread Ola Liljedahl
On 9 October 2015 at 10:37, Alexandru Badicioiu <
alexandru.badici...@linaro.org> wrote:

> This was a long discussion some time ago and the result was that crypto
> output should be abstracted in the form of the completion event and access
> functions would retrieve status and output packets. Also the implementation
> is in charge with crypto completion event allocation and not the
> application even if this is not really supported in HW.
>
Yes that is useful for lookaside crypto/IPsec operations and my intention
is not to change that. But this model is not useful for inline IPsec
acceleration. We need a new or (preferably?) extended API for that. That's
what I am asking about.

I know not all silicon vendors would be able to support inline IPsec
acceleration in HW. But with an Event Machine-like programming model where
the application uses per-queue call-backs, inline IPsec acceleration can be
implemented/emulated in SW. Even if this model is not exposed to the user,
an ODP implementation should be able to do something like it "under the
hood".


The previous approach was that application supplied the completion event as
> being the output packet but this was regarded as a hack.
>
> Alex
>
> On 9 October 2015 at 11:28, Ola Liljedahl 
> wrote:
>
>> On 9 October 2015 at 09:34, Alexandru Badicioiu <
>> alexandru.badici...@linaro.org> wrote:
>>
>>> The problem you raised is not strictly related to this patch.
>>> A crypto session has an output queue (for async mode) where the results
>>> , including the operation status, will be delivered. There is nothing in
>>> the API to prevent using a pktio output queue for crypto completion events
>>> but the pktio should be able to process the event as the application would
>>> do.
>>> In this case an extension of pktio functionality would be required.
>>>
>> Yes but I was thinking of some change (in API and implementation) where
>> the output of the crypto operations is the actual packet (with L2/L3
>> encapsulation), not a crypto completion event.
>>
>>
>>>
>>> Alex
>>>
>>>
>>> On 8 October 2015 at 20:13, Ola Liljedahl 
>>> wrote:
>>>
 Can this proposal be extended to handle inline IPsec processing, e.g.
 encrypt and encapsulate packet (include Ethernet framing) and then send to
 (enqueue) to some user-defined queue (which might be a pktio output queue)?
 Need some way to report errors and other conditions back to SW so might
 need some kind of ipsec notification event.
 Something for the ingress side as well, e.g. connect user-defined
 queues to IPsec input queue(s) and then specify corresponding output 
 queues.


 On 31 July 2015 at 11:30, Alexandru Badicioiu <
 alexandru.badici...@linaro.org> wrote:

>
>
> On 30 July 2015 at 17:44, Stuart Haslam 
> wrote:
>
>> On Thu, Jul 30, 2015 at 02:42:08PM +0300, Alexandru Badicioiu wrote:
>> > On 30 July 2015 at 13:50, Stuart Haslam 
>> wrote:
>> >
>> > > 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 <
>> alexandru.badici...@linaro.org>
>> > > > ---
>> > > >  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

Re: [lng-odp] [PATCH 5/8] add fbk hash table

2015-10-09 Thread Ola Liljedahl
On 8 October 2015 at 14:43, HePeng  wrote:

>
> 在 2015年10月8日,下午8:13,Ola Liljedahl  写道:
>
> On 8 October 2015 at 10:02, Bill Fischofer 
> wrote:
>
>> Trying to keep the rte_ prefix would be confusing.  One of the precepts
>> of ODP is that it doesn't preclude an application also using an underlying
>> SDK in addition to ODP APIs.  Whether that makes sense is up to the
>> application, of course.  But if ODP were to start using other prefixes I'd
>> imagine that would get very messy.
>
> It would also be confusing to have functions that use odp_ naming
> conventions but don't behave like ODP functions (with regards to e.g.
> handling and returning errors or checking parameters).
>
> We can fix this by wrapping these functions.
>
I don't follow you. How can you make these function behave like ODP
functions by "wrapping" them?
Me thinks you have to modify the implementation in order to change the
behaviour.

 But considering that the internal code is already ready, I am thinking
> reserve the code of *static* functions (internal implementations)?
>
>
>
>
> So if we rename code imported from e.g. DPDK, we should also convert it to
> behave like proper ODP functions. That we can base the implementation on
> preexisting code is just incidental and should not affect how the code
> behaves.
>
>
>> On Wednesday, October 7, 2015, Ola Liljedahl 
>> wrote:
>>
>>> On 23 September 2015 at 19:51, Maxim Uvarov 
>>> wrote:
>>>


 On 09/20/15 07:04, rujiacs wrote:

> Signed-off-by: rujiacs 
> ---
>   helper/hash_fbk.c| 179 
>   helper/include/odp/helper/hash_fbk.h | 404
> +++
>   2 files changed, 583 insertions(+)
>   create mode 100644 helper/hash_fbk.c
>   create mode 100644 helper/include/odp/helper/hash_fbk.h
>
> diff --git a/helper/hash_fbk.c b/helper/hash_fbk.c
> new file mode 100644
> index 000..eae7596
> --- /dev/null
> +++ b/helper/hash_fbk.c
> @@ -0,0 +1,179 @@
> +/**
> + *   BSD LICENSE
> + *
> + *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> + *   All rights reserved.
> + *
> + *   Redistribution and use in source and binary forms, with or
> without
> + *   modification, are permitted provided that the following
> conditions
> + *   are met:
> + *
> + * * Redistributions of source code must retain the above
> copyright
> + *   notice, this list of conditions and the following disclaimer.
> + * * Redistributions in binary form must reproduce the above
> copyright
> + *   notice, this list of conditions and the following disclaimer
> in
> + *   the documentation and/or other materials provided with the
> + *   distribution.
> + * * Neither the name of Intel Corporation nor the names of its
> + *   contributors may be used to endorse or promote products
> derived
> + *   from this software without specific prior written permission.
> + *
> + *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS
> + *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS FOR
> + *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> COPYRIGHT
> + *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL,
> + *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE,
> + *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ON ANY
> + *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
> TORT
> + *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> THE USE
> + *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> DAMAGE.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include "odph_debug.h"
> +#include 
> +
> +static TAILQ_HEAD(, odp_fbk_hash_table) fbk_hash_list;
> +static odp_rwlock_t fbk_hash_lock;
> +
> +void
> +odp_fbk_hash_list_init()
> +{
> +TAILQ_INIT(_hash_list);
> +odp_rwlock_init(_hash_lock);
> +}
> +
> +/**
> + * Performs a lookup for an existing hash table, and returns a
> pointer to
> + * the table if found.
> + *
> + * @param name
> + *   Name of the hash table to find
> + *
> + * @return
> + *   pointer to hash table structure or NULL on error.
> + */
> +struct odp_fbk_hash_table *
> 

Re: [lng-odp] [PATCH 5/8] add fbk hash table

2015-10-09 Thread HePeng

> 在 2015年10月9日,下午4:36,Ola Liljedahl  写道:
> 
> On 9 October 2015 at 10:33, HePeng  > wrote:
> 
>> 在 2015年10月9日,下午4:26,Ola Liljedahl > > 写道:
>> 
>> On 8 October 2015 at 14:43, HePeng > > wrote:
>> 
>>> 在 2015年10月8日,下午8:13,Ola Liljedahl >> > 写道:
>>> 
>>> On 8 October 2015 at 10:02, Bill Fischofer >> > wrote:
>>> Trying to keep the rte_ prefix would be confusing.  One of the precepts of 
>>> ODP is that it doesn't preclude an application also using an underlying SDK 
>>> in addition to ODP APIs.  Whether that makes sense is up to the 
>>> application, of course.  But if ODP were to start using other prefixes I'd 
>>> imagine that would get very messy.
>>> It would also be confusing to have functions that use odp_ naming 
>>> conventions but don't behave like ODP functions (with regards to e.g. 
>>> handling and returning errors or checking parameters).
>> 
>> We can fix this by wrapping these functions.
>> I don't follow you. How can you make these function behave like ODP 
>> functions by "wrapping" them?
>> Me thinks you have to modify the implementation in order to change the 
>> behaviour.
> 
> I mean that perhaps not all the functions needs to be changed, only the 
> exposed ones (APIs). Some functions are static and are only used in  
> the internal of implementation, these functions can reserve their code. 
> Static functions can have whatever names you like. But if their 
> implementation contributes to the behaviour as seen by callers of the public 
> functions, that behaviour must be compliant with the ODP style.

I see. Thanks. 


>  
> 
>> 
>>  But considering that the internal code is already ready, I am thinking 
>> reserve the code of *static* functions (internal implementations)?
>> 
>> 
>> 
>>> 
>>> So if we rename code imported from e.g. DPDK, we should also convert it to 
>>> behave like proper ODP functions. That we can base the implementation on 
>>> preexisting code is just incidental and should not affect how the code 
>>> behaves.
>>> 
>>> 
>>> On Wednesday, October 7, 2015, Ola Liljedahl >> > wrote:
>>> On 23 September 2015 at 19:51, Maxim Uvarov > 
>>> wrote:
>>> 
>>> 
>>> On 09/20/15 07:04, rujiacs wrote:
>>> Signed-off-by: rujiacs >
>>> ---
>>>   helper/hash_fbk.c| 179 
>>>   helper/include/odp/helper/hash_fbk.h | 404 
>>> +++
>>>   2 files changed, 583 insertions(+)
>>>   create mode 100644 helper/hash_fbk.c
>>>   create mode 100644 helper/include/odp/helper/hash_fbk.h
>>> 
>>> diff --git a/helper/hash_fbk.c b/helper/hash_fbk.c
>>> new file mode 100644
>>> index 000..eae7596
>>> --- /dev/null
>>> +++ b/helper/hash_fbk.c
>>> @@ -0,0 +1,179 @@
>>> +/**
>>> + *   BSD LICENSE
>>> + *
>>> + *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
>>> + *   All rights reserved.
>>> + *
>>> + *   Redistribution and use in source and binary forms, with or without
>>> + *   modification, are permitted provided that the following conditions
>>> + *   are met:
>>> + *
>>> + * * Redistributions of source code must retain the above copyright
>>> + *   notice, this list of conditions and the following disclaimer.
>>> + * * Redistributions in binary form must reproduce the above copyright
>>> + *   notice, this list of conditions and the following disclaimer in
>>> + *   the documentation and/or other materials provided with the
>>> + *   distribution.
>>> + * * Neither the name of Intel Corporation nor the names of its
>>> + *   contributors may be used to endorse or promote products derived
>>> + *   from this software without specific prior written permission.
>>> + *
>>> + *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>>> + *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>>> + *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>>> + *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
>>> + *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>>> + *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>>> + *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>>> + *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>>> + *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>>> + *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>>> + *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>>> + */
>>> +
>>> +#include 
>>> +#include 
>>> 

Re: [lng-odp] [PATCH] checkpatch: escape left braces in regex

2015-10-09 Thread Nicolas Morey-Chaisemartin
It is actually already fixed in the Linux kernel.
Shoud we import the latest checkpatch then?

$ git show 4e5d56bdf892e18832a6540b63ebf709966bce2a
commit 4e5d56bdf892e18832a6540b63ebf709966bce2a
Author: Eddie Kovsky 
Date:   Wed Sep 9 15:37:52 2015 -0700

checkpatch: fix left brace warning
   
Using checkpatch.pl with Perl 5.22.0 generates the following warning:
   
Unescaped left brace in regex is deprecated, passed through in regex;
   
This patch fixes the warnings by escaping occurrences of the left brace
inside the regular expression.
   
Signed-off-by: Eddie Kovsky 
Cc: Joe Perches 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 577241e..ba47dab 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3571,7 +3571,7 @@ sub process {
 # function brace can't be on same line, except for #defines of do while,
 # or if closed on same line
if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
-   !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
+   !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
if (ERROR("OPEN_BRACE",
  "open brace '{' following function declarations go on the 
next line\n" . $herecurr) &&
$fix) {
@@ -4083,8 +4083,8 @@ sub process {
 ## }
 
 #need space before brace following if, while, etc
-   if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
-   $line =~ /do{/) {
+   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+   $line =~ /do\{/) {
if (ERROR("SPACING",
  "space required before the open brace '{'\n" . $herecurr) &&
$fix) {
@@ -4531,7 +4531,7 @@ sub process {
$dstat !~ /^for\s*$Constant$/ &&# for (...)
$dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&   # 
for (...) bar()
$dstat !~ /^do\s*{/ &&  # do {...
-   $dstat !~ /^\({/ && # ({...
+   $dstat !~ /^\(\{/ &&# ({...
$ctx !~ 
/^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
{
$ctx =~ s/\n*$//;


On 10/09/2015 09:44 AM, Nicolas Morey-Chaisemartin wrote:
> I guess it should. But I'm not sure where the upstream is.
> It may even be fixed there.
>
> Nicolas
>
> On 10/08/2015 06:20 PM, Mike Holmes wrote:
>> Should this go upstream also ?
>>
>> On 8 October 2015 at 14:46, Nicolas Morey-Chaisemartin 
>> wrote:
>>
>>> Latest Perl version marks unescaped left braces as deprecated in regexp
>>>
>>> Unescaped left brace in regex is deprecated, passed through in regex;
>>>  marked by <-- HERE in m/\#\s*define.*do\s{ <-- HERE /
>>>  at ./scripts/checkpatch.pl line 3414.
>>>
>>> Escape all open left braces that caused warnings
>>>
>>> Signed-off-by: Nicolas Morey-Chaisemartin 
>>> ---
>>>  scripts/checkpatch.pl | 8 
>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>>> index 4983a0c..893da37 100755
>>> --- a/scripts/checkpatch.pl
>>> +++ b/scripts/checkpatch.pl
>>> @@ -3411,7 +3411,7 @@ sub process {
>>>  # function brace can't be on same line, except for #defines of do while,
>>>  # or if closed on same line
>>> if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
>>> -   !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
>>> +   !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
>>> if (ERROR("OPEN_BRACE",
>>>   "open brace '{' following function
>>> declarations go on the next line\n" . $herecurr) &&
>>> $fix) {
>>> @@ -3923,8 +3923,8 @@ sub process {
>>>  ## }
>>>
>>>  #need space before brace following if, while, etc
>>> -   if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
>>> -   $line =~ /do{/) {
>>> +   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
>>> +   $line =~ /do\{/) {
>>> if (ERROR("SPACING",
>>>   "space required before the open brace
>>> '{'\n" . $herecurr) &&
>>> $fix) {
>>> @@ -4377,7 +4377,7 @@ sub process {
>>> $dstat !~ /^for\s*$Constant$/ &&
>>>   # for (...)
>>> $dstat !~
>>> /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&   # for (...) bar()
>>> $dstat !~ /^do\s*{/ &&
>>>   # do {...
>>> -   $dstat !~ /^\({/ &&
>>>  # ({...
>>> +   $dstat !~ /^\(\{/ &&
>>> 

Re: [lng-odp] [PATCH 5/8] add fbk hash table

2015-10-09 Thread HePeng

> 在 2015年10月9日,下午4:26,Ola Liljedahl  写道:
> 
> On 8 October 2015 at 14:43, HePeng  > wrote:
> 
>> 在 2015年10月8日,下午8:13,Ola Liljedahl > > 写道:
>> 
>> On 8 October 2015 at 10:02, Bill Fischofer > > wrote:
>> Trying to keep the rte_ prefix would be confusing.  One of the precepts of 
>> ODP is that it doesn't preclude an application also using an underlying SDK 
>> in addition to ODP APIs.  Whether that makes sense is up to the application, 
>> of course.  But if ODP were to start using other prefixes I'd imagine that 
>> would get very messy.
>> It would also be confusing to have functions that use odp_ naming 
>> conventions but don't behave like ODP functions (with regards to e.g. 
>> handling and returning errors or checking parameters).
> 
> We can fix this by wrapping these functions.
> I don't follow you. How can you make these function behave like ODP functions 
> by "wrapping" them?
> Me thinks you have to modify the implementation in order to change the 
> behaviour.

I mean that perhaps not all the functions needs to be changed, only the exposed 
ones (APIs). Some functions are static and are only used in  
the internal of implementation, these functions can reserve their code. 

> 
>  But considering that the internal code is already ready, I am thinking 
> reserve the code of *static* functions (internal implementations)?
> 
> 
> 
>> 
>> So if we rename code imported from e.g. DPDK, we should also convert it to 
>> behave like proper ODP functions. That we can base the implementation on 
>> preexisting code is just incidental and should not affect how the code 
>> behaves.
>> 
>> 
>> On Wednesday, October 7, 2015, Ola Liljedahl > > wrote:
>> On 23 September 2015 at 19:51, Maxim Uvarov > 
>> wrote:
>> 
>> 
>> On 09/20/15 07:04, rujiacs wrote:
>> Signed-off-by: rujiacs >
>> ---
>>   helper/hash_fbk.c| 179 
>>   helper/include/odp/helper/hash_fbk.h | 404 
>> +++
>>   2 files changed, 583 insertions(+)
>>   create mode 100644 helper/hash_fbk.c
>>   create mode 100644 helper/include/odp/helper/hash_fbk.h
>> 
>> diff --git a/helper/hash_fbk.c b/helper/hash_fbk.c
>> new file mode 100644
>> index 000..eae7596
>> --- /dev/null
>> +++ b/helper/hash_fbk.c
>> @@ -0,0 +1,179 @@
>> +/**
>> + *   BSD LICENSE
>> + *
>> + *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
>> + *   All rights reserved.
>> + *
>> + *   Redistribution and use in source and binary forms, with or without
>> + *   modification, are permitted provided that the following conditions
>> + *   are met:
>> + *
>> + * * Redistributions of source code must retain the above copyright
>> + *   notice, this list of conditions and the following disclaimer.
>> + * * Redistributions in binary form must reproduce the above copyright
>> + *   notice, this list of conditions and the following disclaimer in
>> + *   the documentation and/or other materials provided with the
>> + *   distribution.
>> + * * Neither the name of Intel Corporation nor the names of its
>> + *   contributors may be used to endorse or promote products derived
>> + *   from this software without specific prior written permission.
>> + *
>> + *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> + *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>> + *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>> + *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
>> + *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>> + *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>> + *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>> + *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>> + *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> + *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>> + *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include "odph_debug.h"
>> +#include 
>> +
>> +static TAILQ_HEAD(, odp_fbk_hash_table) fbk_hash_list;
>> +static odp_rwlock_t fbk_hash_lock;
>> +
>> +void
>> +odp_fbk_hash_list_init()
>> +{
>> +TAILQ_INIT(_hash_list);
>> +odp_rwlock_init(_hash_lock);
>> +}
>> +
>> +/**
>> + * Performs a lookup for an existing hash table, and returns a pointer to
>> + * the table if found.
>> + *
>> + * @param name
>> + *   Name of the hash table to find
>> + *
>> + * @return
>> 

[lng-odp] [PATCH v2 3/6] test: l2fwd: fix crash when accuracy is set to 0

2015-10-09 Thread Matias Elo
Application crashes if accuracy option is set to zero
(division by zero). Disable statistics printing if accuracy
<= 0.

Signed-off-by: Matias Elo 
---
 test/performance/odp_l2fwd.c | 59 +++-
 1 file changed, 37 insertions(+), 22 deletions(-)

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index d15ec28..d1a5b07 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -341,41 +341,56 @@ static odp_pktio_t create_pktio(const char *dev, 
odp_pool_t pool)
  *
  */
 static int print_speed_stats(int num_workers, stats_t **thr_stats,
- int duration, int timeout)
+int duration, int timeout)
 {
-   uint64_t pkts, pkts_prev = 0, pps, drops, maximum_pps = 0;
-   int i, elapsed = 0;
+   uint64_t pkts = 0;
+   uint64_t pkts_prev = 0;
+   uint64_t pps;
+   uint64_t drops;
+   uint64_t maximum_pps = 0;
+   int i;
+   int elapsed = 0;
+   int stats_enabled = 0;
int loop_forever = (duration == 0);
 
+   if (timeout > 0)
+   stats_enabled = 1;
+
/* Wait for all threads to be ready*/
odp_barrier_wait();
 
do {
-   pkts = 0;
-   drops = 0;
+   if (stats_enabled) {
+   pkts = 0;
+   drops = 0;
 
-   sleep(timeout);
+   sleep(timeout);
 
-   for (i = 0; i < num_workers; i++) {
-   pkts += thr_stats[i]->packets;
-   drops += thr_stats[i]->drops;
+   for (i = 0; i < num_workers; i++) {
+   pkts += thr_stats[i]->packets;
+   drops += thr_stats[i]->drops;
+   }
+   pps = (pkts - pkts_prev) / timeout;
+   if (pps > maximum_pps)
+   maximum_pps = pps;
+   printf("%" PRIu64 " pps, %" PRIu64 " max pps, ",  pps,
+  maximum_pps);
+
+   printf(" %" PRIu64 " total drops\n", drops);
+
+   elapsed += timeout;
+   pkts_prev = pkts;
+   } else {
+   sleep(1);
+   elapsed += 1;
}
-   pps = (pkts - pkts_prev) / timeout;
-   if (pps > maximum_pps)
-   maximum_pps = pps;
-   printf("%" PRIu64 " pps, %" PRIu64 " max pps, ",  pps,
-  maximum_pps);
-
-   printf(" %" PRIu64 " total drops\n", drops);
-
-   elapsed += timeout;
-   pkts_prev = pkts;
} while (loop_forever || (elapsed < duration));
 
-   printf("TEST RESULT: %" PRIu64 " maximum packets per second.\n",
-  maximum_pps);
+   if (stats_enabled)
+   printf("TEST RESULT: %" PRIu64 " maximum packets per second.\n",
+  maximum_pps);
 
-   return pkts > 100 ? 0 : -1;
+   return 0;
 }
 
 /**
-- 
1.9.1

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


[lng-odp] [PATCH v2 0/6] l2fwd test improvements

2015-10-09 Thread Matias Elo
Added various improvements to the l2fwd test application:
- Supports using odd number of ports
- Scheduler queue type can be selected
- Added options for enabling/disabling eth address filling 

New options:
-d, --dst_change <0/1>: Enable/disable changing packets' dst eth addresses
-s, --src_change <0/1>: Enable/disable changing packets' src eth addresses
-m, --mode <0>: Send packets directly from NIC (default)
   <1>: Send packets through scheduler sync none queues
   <2>: Send packets through scheduler sync atomic queues
   <3>: Send packets through scheduler sync ordered queues

v2:
- Rebased to master
- Word copy ethernet addresses

Matias Elo (6):
  test: l2fwd: add option to change destination eth addresses
  test: l2fwd: add option to select scheduler queue type
  test: l2fwd: fix crash when accuracy is set to 0
  test: l2fwd: add support for using odd number of ports
  test: l2fwd: add option to disable filling eth addresses
  test: l2fwd: word copy ethernet addresses

 test/performance/odp_l2fwd.c | 272 +--
 1 file changed, 183 insertions(+), 89 deletions(-)

-- 
1.9.1

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


Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support

2015-10-09 Thread Savolainen, Petri (Nokia - FI/Espoo)
There’s no dependency to netmap unless the user requests to use it with 
“--with-netmap-path” configure option. So, the switch is there (in this patch).

-Petri


From: EXT Mike Holmes [mailto:mike.hol...@linaro.org]
Sent: Thursday, October 08, 2015 9:01 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: EXT Ola Liljedahl; Elo, Matias (Nokia - FI/Espoo); LNG ODP Mailman List
Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio 
support

Are there any complications when packaging for deb / RPM, conceivably you want 
this to depend on netmap, but in many cases you dont want that.

Should there be a configure switch to optionally create the packages with a 
dependency ?

On 7 October 2015 at 13:47, Savolainen, Petri (Nokia - FI/Espoo) 
> wrote:
The odp-netmap was in practice this level of modification to linux-generic – 
just use netmap for packet io instead of sockets. If user has netmap installed, 
linux-generic utilizes it instead of sockets  and we can get up to 5 Mpps per 
core (roughly 10x improvement to sockets). Linux-generic is more suitable for 
demos, testing, validation, etc with that kind of packet rate than with poor 
sockets. There are some small things to tune, optimize and simplify (e.g. usage 
of locks) in linux-generic which may give some more performance.

-Petri


From: lng-odp 
[mailto:lng-odp-boun...@lists.linaro.org]
 On Behalf Of EXT Ola Liljedahl
Sent: Wednesday, October 07, 2015 3:30 PM
To: Elo, Matias (Nokia - FI/Espoo)
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio 
support

ODP linux-generic is still a (s)low-performing reference implementation, even 
with better performing pktio. Do we want to change that and optimize 
linux-generic (and likely make it less suitable for its original purpose, how 
important is that) Or should we performance optimize ODP-netmap instead?

-- Ola


On 29 September 2015 at 08:28, Matias Elo 
> wrote:
Added new netmap pktio interface type which operates in the
same manner as the existing socket io interfaces. The code
is based on the odp-netmap branch.

Using netmap io requires netmap headers and loaded netmap
kernel module. Netmap can be installed from
https://github.com/luigirizzo/netmap. ODP netmap support is
enabled using --with-netmap-path= configuration
option.

If netmap kernel module is loaded when starting ODP
application netmap io will be used by default. If the module
is not found standard socket io is used. Netmap io can be
disabled with ODP_PKTIO_DISABLE_NETMAP environment variable.

Signed-off-by: Matias Elo >
---
 configure.ac   |  44 
+++
 example/generator/odp_generator.c  |   3 +-
 example/ipsec/odp_ipsec.c  |   3 +-
 example/packet/odp_pktio.c |   3 +-
 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_packet_io_internal.h |   3 +
 platform/linux-generic/include/odp_packet_netmap.h |  24 ++
 platform/linux-generic/pktio/io_ops.c  |   1 +
 platform/linux-generic/pktio/netmap.c  | 331 +
 platform/linux-generic/pktio/socket.c  |   4 +
 test/performance/odp_l2fwd.c   |   3 +-
 11 files changed, 417 insertions(+), 4 deletions(-)
 create mode 100644 platform/linux-generic/include/odp_packet_netmap.h
 create mode 100644 platform/linux-generic/pktio/netmap.c

diff --git a/configure.ac 
b/configure.ac
index 15dc6cf..67e2133 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,6 +167,30 @@ AC_ARG_ENABLE([test-cpp],
 AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ])

 ##
+# Enable netmap support
+##
+netmap_support=no
+ODP_NETMAP=0
+AC_ARG_ENABLE([netmap_support],
+[  --enable-netmap-support  include netmap IO support],
+[if test x$enableval = xyes; then
+netmap_support=yes
+ODP_NETMAP=1
+fi])
+
+##
+# Set optional netmap path
+##
+AC_ARG_WITH([netmap-path],
+AC_HELP_STRING([--with-netmap-path=DIR   path to netmap root directory],
+   [(or in the default path if not specified).]),
+[NETMAP_PATH=$withval
+AM_CPPFLAGS="$AM_CPPFLAGS -I$NETMAP_PATH/sys"
+netmap_support=yes
+ODP_NETMAP=1],[])
+ODP_CFLAGS="$ODP_CFLAGS -DODP_NETMAP=$ODP_NETMAP"
+
+##
 # 

Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support

2015-10-09 Thread Christophe Milard
Hi Mike.

I have read through this patch: I haven't dared marking it as reviewed as I
am not sure about some part of it, especialy related to the build
environment. The pktio part is very close to what I did when merging and
looked fine to me. Also the debate regarding whether this should be merged
(or not) in linux generic was still going on on the last ARCH call: I am
not sure it is best (because I don't really see where the line should be
drawn between the "reference goal" of the linux generic implementation and
how much it should be optimised for performence. But I'll support this
change now, as I want to make some progress!
I think the next step is to see how this behave in CI: I expect it to run
as fine as the normal linux-generic, but I will dig into it if lcov still
fails. We already have a bug report for that.

On 9 October 2015 at 08:25, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> There’s no dependency to netmap unless the user requests to use it with
> “--with-netmap-path” configure option. So, the switch is there (in this
> patch).
>
>
>
> -Petri
>
>
>
>
>
> *From:* EXT Mike Holmes [mailto:mike.hol...@linaro.org]
> *Sent:* Thursday, October 08, 2015 9:01 PM
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* EXT Ola Liljedahl; Elo, Matias (Nokia - FI/Espoo); LNG ODP Mailman
> List
>
> *Subject:* Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap
> pktio support
>
>
>
> Are there any complications when packaging for deb / RPM, conceivably you
> want this to depend on netmap, but in many cases you dont want that.
>
>
>
> Should there be a configure switch to optionally create the packages with
> a dependency ?
>
>
>
> On 7 October 2015 at 13:47, Savolainen, Petri (Nokia - FI/Espoo) <
> petri.savolai...@nokia.com> wrote:
>
> The odp-netmap was in practice this level of modification to linux-generic
> – just use netmap for packet io instead of sockets. If user has netmap
> installed, linux-generic utilizes it instead of sockets  and we can get up
> to 5 Mpps per core (roughly 10x improvement to sockets). Linux-generic is
> more suitable for demos, testing, validation, etc with that kind of packet
> rate than with poor sockets. There are some small things to tune, optimize
> and simplify (e.g. usage of locks) in linux-generic which may give some
> more performance.
>
>
>
> -Petri
>
>
>
>
>
> *From:* lng-odp [mailto:lng-odp-boun...@lists.linaro.org] *On Behalf Of *EXT
> Ola Liljedahl
> *Sent:* Wednesday, October 07, 2015 3:30 PM
> *To:* Elo, Matias (Nokia - FI/Espoo)
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap
> pktio support
>
>
>
> ODP linux-generic is still a (s)low-performing reference implementation,
> even with better performing pktio. Do we want to change that and optimize
> linux-generic (and likely make it less suitable for its original purpose,
> how important is that) Or should we performance optimize ODP-netmap instead?
>
>
>
> -- Ola
>
>
>
>
>
> On 29 September 2015 at 08:28, Matias Elo  wrote:
>
> Added new netmap pktio interface type which operates in the
> same manner as the existing socket io interfaces. The code
> is based on the odp-netmap branch.
>
> Using netmap io requires netmap headers and loaded netmap
> kernel module. Netmap can be installed from
> https://github.com/luigirizzo/netmap. ODP netmap support is
> enabled using --with-netmap-path= configuration
> option.
>
> If netmap kernel module is loaded when starting ODP
> application netmap io will be used by default. If the module
> is not found standard socket io is used. Netmap io can be
> disabled with ODP_PKTIO_DISABLE_NETMAP environment variable.
>
> Signed-off-by: Matias Elo 
> ---
>  configure.ac   |  44 +++
>  example/generator/odp_generator.c  |   3 +-
>  example/ipsec/odp_ipsec.c  |   3 +-
>  example/packet/odp_pktio.c |   3 +-
>  platform/linux-generic/Makefile.am |   2 +
>  .../linux-generic/include/odp_packet_io_internal.h |   3 +
>  platform/linux-generic/include/odp_packet_netmap.h |  24 ++
>  platform/linux-generic/pktio/io_ops.c  |   1 +
>  platform/linux-generic/pktio/netmap.c  | 331
> +
>  platform/linux-generic/pktio/socket.c  |   4 +
>  test/performance/odp_l2fwd.c   |   3 +-
>  11 files changed, 417 insertions(+), 4 deletions(-)
>  create mode 100644 platform/linux-generic/include/odp_packet_netmap.h
>  create mode 100644 platform/linux-generic/pktio/netmap.c
>
> diff --git a/configure.ac b/configure.ac
> index 15dc6cf..67e2133 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -167,6 +167,30 @@ AC_ARG_ENABLE([test-cpp],
>  AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ])
>
>  ##
> +# Enable 

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

2015-10-09 Thread Alexandru Badicioiu
The problem you raised is not strictly related to this patch.
A crypto session has an output queue (for async mode) where the results ,
including the operation status, will be delivered. There is nothing in the
API to prevent using a pktio output queue for crypto completion events but
the pktio should be able to process the event as the application would do.
In this case an extension of pktio functionality would be required.

Alex


On 8 October 2015 at 20:13, Ola Liljedahl  wrote:

> Can this proposal be extended to handle inline IPsec processing, e.g.
> encrypt and encapsulate packet (include Ethernet framing) and then send to
> (enqueue) to some user-defined queue (which might be a pktio output queue)?
> Need some way to report errors and other conditions back to SW so might
> need some kind of ipsec notification event.
> Something for the ingress side as well, e.g. connect user-defined queues
> to IPsec input queue(s) and then specify corresponding output queues.
>
>
> On 31 July 2015 at 11:30, Alexandru Badicioiu <
> alexandru.badici...@linaro.org> wrote:
>
>>
>>
>> On 30 July 2015 at 17:44, Stuart Haslam  wrote:
>>
>>> On Thu, Jul 30, 2015 at 02:42:08PM +0300, Alexandru Badicioiu wrote:
>>> > On 30 July 2015 at 13:50, Stuart Haslam 
>>> wrote:
>>> >
>>> > > 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 */
>>> > >
>>> > > This name is pretty cryptic, how about just replay_window?
>>> > >
>>> > [Alex] The standard name for this parameter is anti-replay window. In
>>> the
>>> > context of IPSec this should not be cryptic (odp_ipsec_arw vs
>>> odp_arw). If
>>> > your suggestion is to replace the name of the struct member - ar_ws
>>> with
>>> > replay_window I'm fine with it but not the name of the enum
>>> > (odp_ipsec_ar_ws).
>>> > Or maybe change it to enum odp_ipsec_arw.
>>>
>>> I meant the variable name, don't mind about the enum name.
>>> [Alex] I'm OK with the change.
>>>
>>> > >
>>> > > > + 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 */
>>> > >
>>> > > Can these be 0 and NULL if the application wants tunnel mode but
>>> wants
>>> > > to handle the outer header itself? (i.e. add ESP head/tail and
>>> include
>>> > > inner IP header in encap data)
>>> > >
>>> > [Alex] Yes, that is the intended usage. If requested mode is tunnel and
>>> > there's no out_hdr specified, the application has to add 

[lng-odp] [API-NEXTv7 0/5] ODP_PMR_CUSTOM_FRAME support

2015-10-09 Thread Nicolas Morey-Chaisemartin
v7:  - fix classiefier unit tests
 - split add ODP_PMR_CUSTOM_FRAME in 2
   - One patch changes odp_pmr_create signature to use a struct instead of 
arg list
   - Second one only adds ODP_PMR_CUSTOM_FRAME to the api

v6:  - rebase on latest api-next

v5:  - change linux-generic pmr_term_value_t fields offset and
   val_sz from uint16_t to uint32_t to match API types

v4:  - move definitions prior to any API modifiction to improve
   readability
 - change comment so that odp_pmr_match_t.offset is ignored
   if not used instead of enforcing a 0 value

v3:  - split the api patch in two: 1st one to modify api, 2nd one
   to move declarations for readability

v2:  - rename ODP_PMR_OFFSET_ABS to ODP_PMR_CUSTOM_FRAME
 - better doc (including the fact that ODP_PMR_CUSTOM_FRAME
   should be applied before other PMR)
 - reuse odp_pmr_match_t for both single PMR and PMR sets
   creation

Benoît Ganne (3):
  api: classification: move odp_pmr_match_t definition
  linux-generic: classification: implement ODP_PMR_CUSTOM_FRAME matching
  example: classifier: implement ODP_PMR_CUSTOM_FRAME match

Nicolas Morey-Chaisemartin (2):
  api: classification: use a structure instead of many args for
odp_pmr_create
  api: classification: add ODP_PMR_CUSTOM_FRAME

 example/classifier/odp_classifier.c| 96 +-
 include/odp/api/classification.h   | 55 ++---
 .../include/odp_classification_datamodel.h |  2 +
 .../include/odp_classification_inlines.h   | 21 +
 platform/linux-generic/odp_classification.c| 42 +-
 .../classification/odp_classification_basic.c  | 18 +++-
 .../classification/odp_classification_tests.c  | 28 +--
 7 files changed, 186 insertions(+), 76 deletions(-)

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


[lng-odp] [API-NEXTv7 5/5] example: classifier: implement ODP_PMR_CUSTOM_FRAME match

2015-10-09 Thread Nicolas Morey-Chaisemartin
Signed-off-by: Benoît Ganne 
---
 example/classifier/odp_classifier.c | 86 ++---
 1 file changed, 70 insertions(+), 16 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index 689313d..fa10809 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -53,11 +53,12 @@ typedef struct {
odp_pmr_t pmr;  /**< Associated pmr handle */
odp_atomic_u64_t packet_count;  /**< count of received packets */
char queue_name[ODP_QUEUE_NAME_LEN];/**< queue name */
-   int val_sz; /**< size of the pmr term */
struct {
odp_pmr_term_e term;/**< odp pmr term value */
-   uint32_t val;   /**< pmr term value */
-   uint32_t mask;  /**< pmr term mask */
+   uint64_t val;   /**< pmr term value */
+   uint64_t mask;  /**< pmr term mask */
+   uint32_t val_sz;/**< size of the pmr term */
+   uint32_t offset;/**< pmr term offset */
} rule;
char value[DISPLAY_STRING_LEN]; /**< Display string for value */
char mask[DISPLAY_STRING_LEN];  /**< Display string for mask */
@@ -86,7 +87,8 @@ static void print_info(char *progname, appl_args_t 
*appl_args);
 static void usage(char *progname);
 static void configure_cos_queue(odp_pktio_t pktio, appl_args_t *args);
 static void configure_default_queue(odp_pktio_t pktio, appl_args_t *args);
-static int convert_str_to_pmr_enum(char *token, odp_pmr_term_e *term);
+static int convert_str_to_pmr_enum(char *token, odp_pmr_term_e *term,
+  uint32_t *offset);
 static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char 
*optarg);
 
 static inline
@@ -151,12 +153,13 @@ void print_cls_statistics(appl_args_t *args)
 }
 
 static inline
-int parse_ipv4_addr(const char *ipaddress, uint32_t *addr)
+int parse_ipv4_addr(const char *ipaddress, uint64_t *addr)
 {
-   int b[4];
+   uint32_t b[4];
int converted;
 
-   converted = sscanf(ipaddress, "%d.%d.%d.%d",
+   converted = sscanf(ipaddress, "%" SCNx32 ".%" SCNx32
+  ".%" SCNx32 ".%" SCNx32,
[3], [2], [1], [0]);
if (4 != converted)
return -1;
@@ -170,16 +173,42 @@ int parse_ipv4_addr(const char *ipaddress, uint32_t *addr)
 }
 
 static inline
-int parse_ipv4_mask(const char *str, uint32_t *mask)
+int parse_mask(const char *str, uint64_t *mask)
 {
-   uint32_t b;
+   uint64_t b;
int ret;
 
-   ret = sscanf(str, "%" SCNx32, );
+   ret = sscanf(str, "%" SCNx64, );
*mask = b;
return ret != 1;
 }
 
+static
+int parse_value(const char *str, uint64_t *val, unsigned int *val_sz)
+{
+   size_t len;
+   size_t i;
+   int converted;
+   union {
+   uint64_t u64;
+   uint8_t u8[8];
+   } buf = {.u64 = 0};
+
+   len = strlen(str);
+   if (len > 2 * sizeof(buf))
+   return -1;
+
+   for (i = 0; i < len; i += 2) {
+   converted = sscanf([i], "%2" SCNx8, [i / 2]);
+   if (1 != converted)
+   return -1;
+   }
+
+   *val = buf.u64;
+   *val_sz = len / 2;
+   return 0;
+}
+
 /**
  * Create a pktio handle, optionally associating a default input queue.
  *
@@ -365,7 +394,8 @@ static void configure_cos_queue(odp_pktio_t pktio, 
appl_args_t *args)
.term = stats->rule.term,
.val = >rule.val,
.mask = >rule.mask,
-   .val_sz = stats->val_sz
+   .val_sz = stats->rule.val_sz,
+   .offset = stats->rule.offset
};
 
stats->pmr = odp_pmr_create();
@@ -585,7 +615,8 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned 
len)
}
 }
 
-static int convert_str_to_pmr_enum(char *token, odp_pmr_term_e *term)
+static int convert_str_to_pmr_enum(char *token, odp_pmr_term_e *term,
+  uint32_t *offset)
 {
if (NULL == token)
return -1;
@@ -593,6 +624,13 @@ static int convert_str_to_pmr_enum(char *token, 
odp_pmr_term_e *term)
if (0 == strcasecmp(token, "ODP_PMR_SIP_ADDR")) {
*term = ODP_PMR_SIP_ADDR;
return 0;
+   } else {
+   errno = 0;
+   *offset = strtoul(token, NULL, 0);
+   if (errno)
+   return -1;
+   *term = ODP_PMR_CUSTOM_FRAME;
+   return 0;
}
return -1;
 }
@@ -606,6 +644,7 @@ static int parse_pmr_policy(appl_args_t *appl_args, char 
*argv[], char *optarg)
odp_pmr_term_e term;
global_statistics *stats;
char *pmr_str;
+   uint32_t offset;
 
policy_count = 

[lng-odp] [API-NEXTv7 4/5] linux-generic: classification: implement ODP_PMR_CUSTOM_FRAME matching

2015-10-09 Thread Nicolas Morey-Chaisemartin
Signed-off-by: Benoît Ganne 
---
 .../include/odp_classification_datamodel.h  |  2 ++
 .../include/odp_classification_inlines.h| 21 +
 platform/linux-generic/odp_classification.c |  7 +++
 3 files changed, 30 insertions(+)

diff --git a/platform/linux-generic/include/odp_classification_datamodel.h 
b/platform/linux-generic/include/odp_classification_datamodel.h
index cb970f1..4358fca 100644
--- a/platform/linux-generic/include/odp_classification_datamodel.h
+++ b/platform/linux-generic/include/odp_classification_datamodel.h
@@ -57,6 +57,8 @@ typedef struct pmr_term_value {
odp_pmr_term_e  term;   /* PMR Term */
uint64_tval;/**< Value to be matched */
uint64_tmask;   /**< Masked set of bits to be matched */
+   uint32_toffset; /**< Offset if term == ODP_PMR_CUSTOM_FRAME */
+   uint32_tval_sz; /**< Size of the value to be matched */
 } pmr_term_value_t;
 
 /*
diff --git a/platform/linux-generic/include/odp_classification_inlines.h 
b/platform/linux-generic/include/odp_classification_inlines.h
index a093211..7f13530 100644
--- a/platform/linux-generic/include/odp_classification_inlines.h
+++ b/platform/linux-generic/include/odp_classification_inlines.h
@@ -223,6 +223,27 @@ static inline int verify_pmr_ld_vni(uint8_t *pkt_addr 
ODP_UNUSED,
ODP_UNIMPLEMENTED();
return 0;
 }
+
+static inline int verify_pmr_custom_frame(uint8_t *pkt_addr,
+ odp_packet_hdr_t *pkt_hdr,
+ pmr_term_value_t *term_value)
+{
+   uint64_t val = 0;
+   uint32_t offset = term_value->offset;
+   uint32_t val_sz = term_value->val_sz;
+
+   ODP_ASSERT(val_sz <= ODP_PMR_TERM_BYTES_MAX);
+
+   if (pkt_hdr->frame_len <= offset + val_sz)
+   return 0;
+
+   memcpy(, pkt_addr + offset, val_sz);
+   if (term_value->val == (val & term_value->mask))
+   return 1;
+
+   return 0;
+}
+
 static inline int verify_pmr_eth_type_0(uint8_t *pkt_addr ODP_UNUSED,
odp_packet_hdr_t *pkt_hdr ODP_UNUSED,
pmr_term_value_t *term_value ODP_UNUSED)
diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index 45f62ba..d5ca13f 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -448,6 +448,8 @@ static void odp_pmr_create_term(pmr_term_value_t *value,
const odp_pmr_match_t *match)
 {
value->term = match->term;
+   value->offset = match->offset;
+   value->val_sz = match->val_sz;
value->val = 0;
value->mask = 0;
memcpy(>val, match->val, match->val_sz);
@@ -761,6 +763,11 @@ int verify_pmr(pmr_t *pmr, uint8_t *pkt_addr, 
odp_packet_hdr_t *pkt_hdr)
   term_value))
pmr_failure = 1;
break;
+   case ODP_PMR_CUSTOM_FRAME:
+   if (!verify_pmr_custom_frame(pkt_addr, pkt_hdr,
+term_value))
+   pmr_failure = 1;
+   break;
case ODP_PMR_INNER_HDR_OFF:
break;
}
-- 
2.6.1.3.g8d02103


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


Re: [lng-odp] [PATCH] checkpatch: escape left braces in regex

2015-10-09 Thread Nicolas Morey-Chaisemartin
I guess it should. But I'm not sure where the upstream is.
It may even be fixed there.

Nicolas

On 10/08/2015 06:20 PM, Mike Holmes wrote:
> Should this go upstream also ?
>
> On 8 October 2015 at 14:46, Nicolas Morey-Chaisemartin 
> wrote:
>
>> Latest Perl version marks unescaped left braces as deprecated in regexp
>>
>> Unescaped left brace in regex is deprecated, passed through in regex;
>>  marked by <-- HERE in m/\#\s*define.*do\s{ <-- HERE /
>>  at ./scripts/checkpatch.pl line 3414.
>>
>> Escape all open left braces that caused warnings
>>
>> Signed-off-by: Nicolas Morey-Chaisemartin 
>> ---
>>  scripts/checkpatch.pl | 8 
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 4983a0c..893da37 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -3411,7 +3411,7 @@ sub process {
>>  # function brace can't be on same line, except for #defines of do while,
>>  # or if closed on same line
>> if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
>> -   !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
>> +   !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
>> if (ERROR("OPEN_BRACE",
>>   "open brace '{' following function
>> declarations go on the next line\n" . $herecurr) &&
>> $fix) {
>> @@ -3923,8 +3923,8 @@ sub process {
>>  ## }
>>
>>  #need space before brace following if, while, etc
>> -   if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
>> -   $line =~ /do{/) {
>> +   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
>> +   $line =~ /do\{/) {
>> if (ERROR("SPACING",
>>   "space required before the open brace
>> '{'\n" . $herecurr) &&
>> $fix) {
>> @@ -4377,7 +4377,7 @@ sub process {
>> $dstat !~ /^for\s*$Constant$/ &&
>>   # for (...)
>> $dstat !~
>> /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&   # for (...) bar()
>> $dstat !~ /^do\s*{/ &&
>>   # do {...
>> -   $dstat !~ /^\({/ &&
>>  # ({...
>> +   $dstat !~ /^\(\{/ &&
>>   # ({...
>> $ctx !~
>> /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
>> {
>> $ctx =~ s/\n*$//;
>> --
>> 2.6.0.3.g4057e08
>>
>> ___
>> 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 1/5] Add Jhash and CRC functions

2015-10-09 Thread Mike Holmes
On Oct 8, 2015 10:55 PM, "HePeng"  wrote:
>
> We should first added a generic hash API to api-next, and then provide
crc and jhash implementations?
>
> I am not clear about how hash functions can be added into ODP. Should we
first present a proposal ?

Yes, send a proposal if you have one.

A lot of APIs have been initially created as a patch that just contains the
new definitions and the doxygen documentation for them. When there is
agreement  on the api the implimentation  and tests have followed.
Bringing it up in the Tuesday calls can move it faster with live discussion.

>
> In fact, jhash, cuckoo hash and fbk hash tables are part of the patches
we are preparing for the algorithmic APIs I proposed before.
>
> See the thread in the maillist
>
> https://lists.linaro.org/pipermail/lng-odp/2015-August/014665.html
>
>
>
>> 在 2015年10月8日,下午3:44,Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> 写道:
>>
>>
>>
>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
Ola Liljedahl
>> Sent: Wednesday, October 07, 2015 6:12 PM
>> To: HePeng
>> Cc: 杨馥榕; LNG ODP Mailman List
>> Subject: Re: [lng-odp] [PATCH 1/5] Add Jhash and CRC functions
>>
>> On 7 October 2015 at 16:36, HePeng  wrote:
>>>
>>>

 在 2015年10月7日,下午9:05,Ola Liljedahl  写道:

 We did some talking about this on some ODP architecture call but I
don't remember the outcome.

 ODP started out as a networking HW abstraction and does include some
CPU abstractions (e.g. atomics). So e.g. CRC support definitively fits into
this scheme and could be added to the public API. A function that
specifically provides jhash does not fit in IMO as I don't think any HW
implements jhash. A generic hash function (with jhash as the default
SW-implementation) can be seen as a HW abstraction. The alternative is to
put jhash support as an ODP helper (as the patch does).

>>>
>>>
>>> So you mean that we should split the whole patch into two parts, one is
for public APIs, the other is for SW jhash?
>>
>> This is my suggestion but I want to hear Petri's view on this.
>>
>> I think it makes sense to add  CRC as a proper ODP API. It could be
first just a synchronous function call (crypto API style - async completion
event option could follow if needed). There could be couple of functions:
one for user defined polynomial, and another ones for mostly used
polynomials. For example:
>>
>> odp/include/hash.h
>>
>> // Calculate CRC using the given polynomial
>> uint32_t odp_hash_crc(const void *data, uint32_t data_len, uint32_t
init_val, uint32_t polynomial)
>>
>> // Calculate CRC32
>> uint32_t odp_hash_crc32(const void *data, uint32_t data_len, uint32_t
init_val);
>>
>> // Calculate CRC32C
>> uint32_t odp_hash_crc32c(const void *data, uint32_t data_len, uint32_t
init_val);
>>
>> -Petri
>>
>>
>>
>
>
>
> ___
> 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] [API-NEXTv7 3/5] api: classification: add ODP_PMR_CUSTOM_FRAME

2015-10-09 Thread Nicolas Morey-Chaisemartin
The application can now specify a packet offset
in PMR rules. This offset is absolute from the
frame start. It is used to extract the PMR value.

This is useful to support arbitrary backplane
protocols and extensions.

Signed-off-by: Benoît Ganne 
---
 include/odp/api/classification.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index a62528c..380d91b 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -237,6 +237,11 @@ typedef enum odp_pmr_term {
ODP_PMR_IPSEC_SPI,  /**< IPsec session identifier(*val=uint32_t)*/
ODP_PMR_LD_VNI, /**< NVGRE/VXLAN network identifier
(*val=uint32_t)*/
+   ODP_PMR_CUSTOM_FRAME,   /**< Custom match rule, offset from start of
+   frame. The match is defined by the offset, the
+   expected value, and its size. They must be
+   applied before any other PMR.
+   (*val=uint8_t[val_sz])*/
 
/** Inner header may repeat above values with this offset */
ODP_PMR_INNER_HDR_OFF = 32
@@ -250,6 +255,9 @@ typedef struct odp_pmr_match_t {
const void  *val;   /**< Value to be matched */
const void  *mask;  /**< Masked set of bits to be matched */
uint32_tval_sz;  /**< Size of the term value */
+   uint32_toffset;  /**< User-defined offset in packet
+Used if term == ODP_PMR_CUSTOM_FRAME only,
+ignored otherwise */
 } odp_pmr_match_t;
 
 /**
-- 
2.6.1.3.g8d02103


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


[lng-odp] [API-NEXTv7 2/5] api: classification: use a structure instead of many args for odp_pmr_create

2015-10-09 Thread Nicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin 
---
 example/classifier/odp_classifier.c| 12 +---
 include/odp/api/classification.h   | 31 +++
 platform/linux-generic/odp_classification.c| 35 ++
 .../classification/odp_classification_basic.c  | 18 +--
 .../classification/odp_classification_tests.c  | 28 -
 5 files changed, 71 insertions(+), 53 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index 7790313..689313d 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -361,10 +361,14 @@ static void configure_cos_queue(odp_pktio_t pktio, 
appl_args_t *args)
sprintf(cos_name, "CoS%s", stats->queue_name);
stats->cos = odp_cos_create(cos_name);
 
-   stats->pmr = odp_pmr_create(stats->rule.term,
-   >rule.val,
-   >rule.mask,
-   stats->val_sz);
+   const odp_pmr_match_t match = {
+   .term = stats->rule.term,
+   .val = >rule.val,
+   .mask = >rule.mask,
+   .val_sz = stats->val_sz
+   };
+
+   stats->pmr = odp_pmr_create();
qparam.sched.prio = i % odp_schedule_num_prio();
qparam.sched.sync = ODP_SCHED_SYNC_NONE;
qparam.sched.group = ODP_SCHED_GROUP_ALL;
diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index e6f14cc..a62528c 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -243,38 +243,24 @@ typedef enum odp_pmr_term {
 } odp_pmr_term_e;
 
 /**
- * Following structure is used to define composite packet matching rules
- * in the form of an array of individual match rules.
- * The underlying platform may not support all or any specific combination
- * of value match rules, and the application should take care
- * of inspecting the return value when installing such rules, and perform
- * appropriate fallback action.
+ * Following structure is used to define a packet matching rule
  */
 typedef struct odp_pmr_match_t {
odp_pmr_term_e  term;   /**< PMR term value to be matched */
const void  *val;   /**< Value to be matched */
const void  *mask;  /**< Masked set of bits to be matched */
-   unsigned intval_sz;  /**< Size of the term value */
+   uint32_tval_sz;  /**< Size of the term value */
 } odp_pmr_match_t;
 
 /**
  * Create a packet match rule with mask and value
  *
- * @param[in]  termOne of the enumerated values supported
- * @param[in]  val Value to match against the packet header
- * in native byte order.
- * @param[in]  maskMask to indicate which bits of the header
- * should be matched ('1') and
- * which should be ignored ('0')
- * @param[in]  val_sz  Size of the val and mask arguments,
- * that must match the value size requirement of the
- * specific term.
+ * @param[in]  match   packet matching rule definition
  *
  * @return Handle of the matching rule
  * @retval ODP_PMR_INVAL on failure
  */
-odp_pmr_t odp_pmr_create(odp_pmr_term_e term, const void *val,
-const void *mask, uint32_t val_sz);
+odp_pmr_t odp_pmr_create(const odp_pmr_match_t *match);
 
 /**
  * Invalidate a packet match rule and vacate its resources
@@ -332,7 +318,12 @@ unsigned odp_pmr_terms_avail(void);
  */
 
 /**
- * Create a composite packet match rule
+ * Create a composite packet match rule in the form of an array of individual
+ * match rules.
+ * The underlying platform may not support all or any specific combination
+ * of value match rules, and the application should take care
+ * of inspecting the return value when installing such rules, and perform
+ * appropriate fallback action.
  *
  * @param[in]  num_terms   Number of terms in the match rule.
  * @param[in]  terms   Array of num_terms entries, one entry per
@@ -344,7 +335,7 @@ unsigned odp_pmr_terms_avail(void);
  * underlying platform classification engine
  * @retval <0 on failure
  */
-int odp_pmr_match_set_create(int num_terms, odp_pmr_match_t *terms,
+int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
 odp_pmr_set_t *pmr_set_id);
 
 /**
diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index dd12a00..45f62ba 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -444,12 +444,22 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
  

[lng-odp] [API-NEXTv7 1/5] api: classification: move odp_pmr_match_t definition

2015-10-09 Thread Nicolas Morey-Chaisemartin
This patch move the odp_pmr_match_t structure definition
to prepare the introduction of the new ODP_PMR_CUSTOM_FRAME
term.

Signed-off-by: Benoît Ganne 
---
 include/odp/api/classification.h | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index 2fdb767..e6f14cc 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -243,6 +243,21 @@ typedef enum odp_pmr_term {
 } odp_pmr_term_e;
 
 /**
+ * Following structure is used to define composite packet matching rules
+ * in the form of an array of individual match rules.
+ * The underlying platform may not support all or any specific combination
+ * of value match rules, and the application should take care
+ * of inspecting the return value when installing such rules, and perform
+ * appropriate fallback action.
+ */
+typedef struct odp_pmr_match_t {
+   odp_pmr_term_e  term;   /**< PMR term value to be matched */
+   const void  *val;   /**< Value to be matched */
+   const void  *mask;  /**< Masked set of bits to be matched */
+   unsigned intval_sz;  /**< Size of the term value */
+} odp_pmr_match_t;
+
+/**
  * Create a packet match rule with mask and value
  *
  * @param[in]  termOne of the enumerated values supported
@@ -312,21 +327,6 @@ unsigned long long odp_pmr_terms_cap(void);
 unsigned odp_pmr_terms_avail(void);
 
 /**
- * Following structure is used to define composite packet matching rules
- * in the form of an array of individual match rules.
- * The underlying platform may not support all or any specific combination
- * of value match rules, and the application should take care
- * of inspecting the return value when installing such rules, and perform
- * appropriate fallback action.
- */
-typedef struct odp_pmr_match_t {
-   odp_pmr_term_e  term;   /**< PMR term value to be matched */
-   const void  *val;   /**< Value to be matched */
-   const void  *mask;  /**< Masked set of bits to be matched */
-   unsigned intval_sz;  /**< Size of the term value */
-} odp_pmr_match_t;
-
-/**
  * @typedef odp_pmr_set_t
  * An opaque handle to a composite packet match rule-set
  */
-- 
2.6.1.3.g8d02103


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


Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support

2015-10-09 Thread Savolainen, Petri (Nokia - FI/Espoo)
This is same level of optimization than using mmap type sockets instead of 
basic sockets. It’s an alternative way to get packets into linux-generic. The 
optimization talk should start after this point (after packet receive from the 
network): how much we optimize SW classifier, how much SW queues, how much SW 
scheduler, …

As said in the call, I don’t expect that linux-generic SW implementation is 
optimized to the last bit, just make sure that there’s no obvious performance 
(or code readability) bugs. For example, set / copy data only once (now we 
double init some packet header fields), use locks wisely (now we double lock 
sometimes), do conversions only ones (now we convert the same offset to the 
same pointer in every step it’s used), …

The line should at: “follow good (multi-thread) programming  practices”. Maybe 
linux-generic performance (with netmap) is around 30-50% of odp-dpdk 
performance (instead of 1% with sockets), which is already usable for early 
application development/testing  (and it always has the latest API version 
supported).

-Petri




From: EXT Christophe Milard [mailto:christophe.mil...@linaro.org]
Sent: Friday, October 09, 2015 9:58 AM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: EXT Mike Holmes; LNG ODP Mailman List
Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio 
support

Hi Mike.

I have read through this patch: I haven't dared marking it as reviewed as I am 
not sure about some part of it, especialy related to the build environment. The 
pktio part is very close to what I did when merging and looked fine to me. Also 
the debate regarding whether this should be merged (or not) in linux generic 
was still going on on the last ARCH call: I am not sure it is best (because I 
don't really see where the line should be drawn between the "reference goal" of 
the linux generic implementation and how much it should be optimised for 
performence. But I'll support this change now, as I want to make some progress!
I think the next step is to see how this behave in CI: I expect it to run as 
fine as the normal linux-generic, but I will dig into it if lcov still fails. 
We already have a bug report for that.

On 9 October 2015 at 08:25, Savolainen, Petri (Nokia - FI/Espoo) 
> wrote:
There’s no dependency to netmap unless the user requests to use it with 
“--with-netmap-path” configure option. So, the switch is there (in this patch).

-Petri


From: EXT Mike Holmes 
[mailto:mike.hol...@linaro.org]
Sent: Thursday, October 08, 2015 9:01 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: EXT Ola Liljedahl; Elo, Matias (Nokia - FI/Espoo); LNG ODP Mailman List

Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio 
support

Are there any complications when packaging for deb / RPM, conceivably you want 
this to depend on netmap, but in many cases you dont want that.

Should there be a configure switch to optionally create the packages with a 
dependency ?

On 7 October 2015 at 13:47, Savolainen, Petri (Nokia - FI/Espoo) 
> wrote:
The odp-netmap was in practice this level of modification to linux-generic – 
just use netmap for packet io instead of sockets. If user has netmap installed, 
linux-generic utilizes it instead of sockets  and we can get up to 5 Mpps per 
core (roughly 10x improvement to sockets). Linux-generic is more suitable for 
demos, testing, validation, etc with that kind of packet rate than with poor 
sockets. There are some small things to tune, optimize and simplify (e.g. usage 
of locks) in linux-generic which may give some more performance.

-Petri


From: lng-odp 
[mailto:lng-odp-boun...@lists.linaro.org]
 On Behalf Of EXT Ola Liljedahl
Sent: Wednesday, October 07, 2015 3:30 PM
To: Elo, Matias (Nokia - FI/Espoo)
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio 
support

ODP linux-generic is still a (s)low-performing reference implementation, even 
with better performing pktio. Do we want to change that and optimize 
linux-generic (and likely make it less suitable for its original purpose, how 
important is that) Or should we performance optimize ODP-netmap instead?

-- Ola


On 29 September 2015 at 08:28, Matias Elo 
> wrote:
Added new netmap pktio interface type which operates in the
same manner as the existing socket io interfaces. The code
is based on the odp-netmap branch.

Using netmap io requires netmap headers and loaded netmap
kernel module. Netmap can be installed from
https://github.com/luigirizzo/netmap. ODP netmap support is
enabled using --with-netmap-path= configuration
option.

If netmap kernel module is loaded when starting ODP
application netmap io will be used by default. If the module
is not found standard socket io 

[lng-odp] [PATCHv9 5/8] helpers: remove odp_ prefix for tests source files

2015-10-09 Thread Maxim Uvarov
Prefixed were removed for validation test suite and to
be consistent we need to do the same for helpers.

Signed-off-by: Maxim Uvarov 
---
 helper/test/.gitignore   |  9 +
 helper/test/Makefile.am  | 16 
 helper/test/{odp_chksum.c => chksum.c}   |  3 +--
 helper/test/{odp_process.c => process.c} |  3 ++-
 helper/test/{odp_thread.c => thread.c}   |  3 ++-
 5 files changed, 18 insertions(+), 16 deletions(-)
 rename helper/test/{odp_chksum.c => chksum.c} (98%)
 rename helper/test/{odp_process.c => process.c} (96%)
 rename helper/test/{odp_thread.c => thread.c} (96%)

diff --git a/helper/test/.gitignore b/helper/test/.gitignore
index 213bc5e..0c7e81f 100644
--- a/helper/test/.gitignore
+++ b/helper/test/.gitignore
@@ -1,6 +1,7 @@
 *.trs
 *.log
-odp_chksum
-odp_process
-odp_thread
-odph_pause
+chksum
+process
+thread
+pause
+ring
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index 7b73602..f6a3f83 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -5,9 +5,9 @@ AM_LDFLAGS += -static
 
 TESTS_ENVIRONMENT += TEST_DIR=${builddir}
 
-EXECUTABLES = odp_chksum$(EXEEXT) \
-  odp_thread$(EXEEXT) \
-  odp_process$(EXEEXT)
+EXECUTABLES = chksum$(EXEEXT) \
+  thread$(EXEEXT) \
+  process$(EXEEXT)
 
 COMPILE_ONLY =
 
@@ -22,8 +22,8 @@ dist_bin_SCRIPTS =
 bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
 
 
-dist_odp_chksum_SOURCES = odp_chksum.c
-dist_odp_thread_SOURCES = odp_thread.c
-odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
-dist_odp_process_SOURCES = odp_process.c
-odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
+dist_chksum_SOURCES = chksum.c
+dist_thread_SOURCES = thread.c
+thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
+dist_process_SOURCES = process.c
+process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
diff --git a/helper/test/odp_chksum.c b/helper/test/chksum.c
similarity index 98%
rename from helper/test/odp_chksum.c
rename to helper/test/chksum.c
index 1d417a8..c987905 100644
--- a/helper/test/odp_chksum.c
+++ b/helper/test/chksum.c
@@ -64,10 +64,9 @@ static int scan_ip(const char *buf, unsigned int *paddr)
if (paddr)
*paddr = part1 << 24 | part2 << 16 | part3 << 8 | part4;
return 1;
-   } else {
-   printf("not good ip %d:%d:%d:%d/n", part1, part2, part3, part4);
}
 
+   printf("not good ip %d:%d:%d:%d/n", part1, part2, part3, part4);
return 0;
 }
 
diff --git a/helper/test/odp_process.c b/helper/test/process.c
similarity index 96%
rename from helper/test/odp_process.c
rename to helper/test/process.c
index d3a5943..280b0ff 100644
--- a/helper/test/odp_process.c
+++ b/helper/test/process.c
@@ -53,7 +53,8 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
cpu = odp_cpumask_first(_mask);
printf("the first CPU:  %i\n", cpu);
 
-   /* reserve cpu 0 for the control plane so remove it from the default 
mask */
+   /* reserve cpu 0 for the control plane so remove it from
+* the default mask */
odp_cpumask_clr(_mask, 0);
num_workers = odp_cpumask_count(_mask);
(void)odp_cpumask_to_str(_mask, cpumaskstr, sizeof(cpumaskstr));
diff --git a/helper/test/odp_thread.c b/helper/test/thread.c
similarity index 96%
rename from helper/test/odp_thread.c
rename to helper/test/thread.c
index 1de30ab..87b4c57 100644
--- a/helper/test/odp_thread.c
+++ b/helper/test/thread.c
@@ -54,7 +54,8 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
cpu = odp_cpumask_first(_mask);
printf("the first CPU:  %i\n", cpu);
 
-   /* reserve cpu 0 for the control plane so remove it from the default 
mask */
+   /* reserve cpu 0 for the control plane so remove it from
+* the default mask */
odp_cpumask_clr(_mask, 0);
num_workers = odp_cpumask_count(_mask);
(void)odp_cpumask_to_str(_mask, cpumaskstr, sizeof(cpumaskstr));
-- 
1.9.1

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


[lng-odp] [PATCHv9 8/8] linux-generic: internal ipc_pktio test

2015-10-09 Thread Maxim Uvarov
2 example ipc pktio applications create ipc pktio to each other and do
packet transfer, validation magic numbers and packets sequence counters
inside it.

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/Makefile.am |   1 +
 platform/linux-generic/m4/configure.m4 |   3 +-
 platform/linux-generic/test/Makefile.am|   3 +-
 platform/linux-generic/test/pktio_ipc/.gitignore   |   1 +
 platform/linux-generic/test/pktio_ipc/Makefile.am  |  15 ++
 platform/linux-generic/test/pktio_ipc/ipc_common.c | 150 
 platform/linux-generic/test/pktio_ipc/ipc_common.h |  71 ++
 platform/linux-generic/test/pktio_ipc/pktio_ipc1.c | 268 +
 platform/linux-generic/test/pktio_ipc/pktio_ipc2.c | 142 +++
 .../linux-generic/test/pktio_ipc/pktio_ipc_run |  55 +
 10 files changed, 707 insertions(+), 2 deletions(-)
 create mode 100644 platform/linux-generic/test/pktio_ipc/.gitignore
 create mode 100644 platform/linux-generic/test/pktio_ipc/Makefile.am
 create mode 100644 platform/linux-generic/test/pktio_ipc/ipc_common.c
 create mode 100644 platform/linux-generic/test/pktio_ipc/ipc_common.h
 create mode 100644 platform/linux-generic/test/pktio_ipc/pktio_ipc1.c
 create mode 100644 platform/linux-generic/test/pktio_ipc/pktio_ipc2.c
 create mode 100755 platform/linux-generic/test/pktio_ipc/pktio_ipc_run

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 71353dd..6fe2f1a 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -5,6 +5,7 @@ include $(top_srcdir)/platform/Makefile.inc
 
 AM_CFLAGS +=  -I$(srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/include
+AM_CFLAGS +=  -I$(top_srcdir)/helper
 AM_CFLAGS +=  -I$(top_srcdir)/helper/include
 
 include_HEADERS = \
diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index 9658274..3a2d743 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -21,4 +21,5 @@ m4_include([platform/linux-generic/m4/odp_openssl.m4])
 
 AC_CONFIG_FILES([platform/linux-generic/Makefile
 platform/linux-generic/test/Makefile
-platform/linux-generic/test/pktio/Makefile])
+platform/linux-generic/test/pktio/Makefile
+platform/linux-generic/test/pktio_ipc/Makefile])
diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index 7d1ce1b..db98d28 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -1,10 +1,11 @@
 include $(top_srcdir)/test/Makefile.inc
 TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
 
-ODP_MODULES = pktio
+ODP_MODULES = pktio pktio_ipc
 
 if test_vald
 TESTS = pktio/pktio_run \
+   pktio_ipc/pktio_ipc_run \
${top_builddir}/test/validation/buffer/buffer_main$(EXEEXT) \

${top_builddir}/test/validation/classification/classification_main$(EXEEXT) \
${top_builddir}/test/validation/cpumask/cpumask_main$(EXEEXT) \
diff --git a/platform/linux-generic/test/pktio_ipc/.gitignore 
b/platform/linux-generic/test/pktio_ipc/.gitignore
new file mode 100644
index 000..d2a7ce2
--- /dev/null
+++ b/platform/linux-generic/test/pktio_ipc/.gitignore
@@ -0,0 +1 @@
+pktio_ipc
diff --git a/platform/linux-generic/test/pktio_ipc/Makefile.am 
b/platform/linux-generic/test/pktio_ipc/Makefile.am
new file mode 100644
index 000..adf6294
--- /dev/null
+++ b/platform/linux-generic/test/pktio_ipc/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/test/Makefile.inc
+TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
+
+bin_PROGRAMS = pktio_ipc1\
+   pktio_ipc2
+
+pktio_ipc1_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+pktio_ipc1_LDFLAGS = $(AM_LDFLAGS) -static
+pktio_ipc2_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+pktio_ipc2_LDFLAGS = $(AM_LDFLAGS) -static
+
+noinst_HEADERS = $(top_srcdir)/test/test_debug.h
+
+dist_pktio_ipc1_SOURCES = pktio_ipc1.c ipc_common.c
+dist_pktio_ipc2_SOURCES = pktio_ipc2.c ipc_common.c
diff --git a/platform/linux-generic/test/pktio_ipc/ipc_common.c 
b/platform/linux-generic/test/pktio_ipc/ipc_common.c
new file mode 100644
index 000..7a84b07
--- /dev/null
+++ b/platform/linux-generic/test/pktio_ipc/ipc_common.c
@@ -0,0 +1,150 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "ipc_common.h"
+
+/** Application argument */
+char *pktio_name;
+
+/** Run time in seconds */
+int run_time_sec;
+
+int ipc_odp_packet_sendall(odp_pktio_t pktio,
+  odp_packet_t pkt_tbl[], int num)
+{
+   int ret;
+   int sent = 0;
+   uint64_t start_cycle;
+   uint64_t diff;
+
+   start_cycle = odp_time_cycles();
+
+   while (sent != num) {
+   ret = odp_pktio_send(pktio, _tbl[sent], num 

[lng-odp] [PATCHv9 1/8] helper: ring: update ring with shm proc argument

2015-10-09 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 helper/include/odp/helper/ring.h | 2 ++
 helper/ring.c| 9 -
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/helper/include/odp/helper/ring.h b/helper/include/odp/helper/ring.h
index 65c32ad..5e640a7 100644
--- a/helper/include/odp/helper/ring.h
+++ b/helper/include/odp/helper/ring.h
@@ -158,6 +158,8 @@ typedef struct odph_ring {
 
 #define ODPH_RING_F_SP_ENQ 0x0001 /* The default enqueue is 
"single-producer".*/
 #define ODPH_RING_F_SC_DEQ 0x0002 /* The default dequeue is 
"single-consumer".*/
+#define ODPH_RING_SHM_PROC 0x0004 /* If set - ring is visible from different
+   processes. Default is thread visible. */
 #define ODPH_RING_QUOT_EXCEED (1 << 31)  /* Quota exceed for burst ops */
 #define ODPH_RING_SZ_MASK  (unsigned)(0x0fff) /* Ring size mask */
 
diff --git a/helper/ring.c b/helper/ring.c
index 3122173..844abf7 100644
--- a/helper/ring.c
+++ b/helper/ring.c
@@ -158,8 +158,14 @@ odph_ring_create(const char *name, unsigned count, 
unsigned flags)
char ring_name[ODPH_RING_NAMESIZE];
odph_ring_t *r;
size_t ring_size;
+   uint32_t shm_flag;
odp_shm_t shm;
 
+   if (flags & ODPH_RING_SHM_PROC)
+   shm_flag = ODP_SHM_PROC;
+   else
+   shm_flag = 0;
+
/* count must be a power of 2 */
if (!RING_VAL_IS_POWER_2(count) || (count > ODPH_RING_SZ_MASK)) {
ODPH_ERR("Requested size is invalid, must be power of 2, and do 
not exceed the size limit %u\n",
@@ -172,7 +178,8 @@ odph_ring_create(const char *name, unsigned count, unsigned 
flags)
 
odp_rwlock_write_lock();
/* reserve a memory zone for this ring.*/
-   shm = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE, 0);
+   shm = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE,
+ shm_flag);
 
r = odp_shm_addr(shm);
 
-- 
1.9.1

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


[lng-odp] [PATCHv9 2/8] linux-generic: create internal pool create function with shm flags

2015-10-09 Thread Maxim Uvarov
On init odp creates odp_sched_pool. We can not modify API to add new
parameter to odp_pool_param_t and this pool should not be shared
between different processes. To do that implemented internal linux-generic
function with parameters to created shm.
Note: create shm before and then provide it to the pool does not work
because shm argument likely will be dropped from odp_pool_create() (patch
already posted.).

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/include/odp_pool_internal.h |  4 
 platform/linux-generic/odp_pool.c  | 11 +--
 platform/linux-generic/odp_schedule.c  |  3 +--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/include/odp_pool_internal.h 
b/platform/linux-generic/include/odp_pool_internal.h
index 136db2c..6781703 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -347,6 +347,10 @@ static inline uint32_t odp_buffer_pool_tailroom(odp_pool_t 
pool)
return odp_pool_to_entry(pool)->s.tailroom;
 }
 
+odp_pool_t _pool_create(const char *name,
+   odp_pool_param_t *params,
+   uint32_t shmflags);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_pool.c 
b/platform/linux-generic/odp_pool.c
index 30d4b2b..2036c2a 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -144,7 +144,9 @@ int odp_pool_term_local(void)
  * Pool creation
  */
 
-odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params)
+odp_pool_t _pool_create(const char *name,
+   odp_pool_param_t *params,
+   uint32_t shmflags)
 {
odp_pool_t pool_hdl = ODP_POOL_INVALID;
pool_entry_t *pool;
@@ -290,7 +292,7 @@ odp_pool_t odp_pool_create(const char *name, 
odp_pool_param_t *params)
 
shm = odp_shm_reserve(pool->s.name,
  pool->s.pool_size,
- ODP_PAGE_SIZE, 0);
+ ODP_PAGE_SIZE, shmflags);
if (shm == ODP_SHM_INVALID) {
POOL_UNLOCK(>s.lock);
return ODP_POOL_INVALID;
@@ -403,6 +405,11 @@ odp_pool_t odp_pool_create(const char *name, 
odp_pool_param_t *params)
return pool_hdl;
 }
 
+odp_pool_t odp_pool_create(const char *name,
+  odp_pool_param_t *params)
+{
+   return _pool_create(name, params, ODP_SHM_PROC);
+}
 
 odp_pool_t odp_pool_lookup(const char *name)
 {
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 827fcf0..c66c177 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -140,8 +140,7 @@ int odp_schedule_init_global(void)
params.buf.num   = NUM_SCHED_CMD;
params.type  = ODP_POOL_BUFFER;
 
-   pool = odp_pool_create("odp_sched_pool", );
-
+   pool = _pool_create("odp_sched_pool", , 0);
if (pool == ODP_POOL_INVALID) {
ODP_ERR("Schedule init: Pool create failed.\n");
return -1;
-- 
1.9.1

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


[lng-odp] [PATCHv9 6/8] helper: move ring test to helper

2015-10-09 Thread Maxim Uvarov
Move ring test to helper and kill not needed api_test
directory. Unfortunately odp_ring_test.c had some old
dirty code so I had to clean up it to to use cunit and
latest helper apis.

Signed-off-by: Maxim Uvarov 
---
 configure.ac   |   1 -
 helper/ring.c  |   1 +
 helper/test/Makefile.am|   6 +-
 .../api_test/odp_ring_test.c => helper/test/ring.c | 100 -
 test/Makefile.am   |   2 +-
 test/api_test/.gitignore   |   2 -
 test/api_test/Makefile.am  |  13 ---
 test/api_test/odp_common.c |  91 ---
 test/api_test/odp_common.h |  42 -
 9 files changed, 63 insertions(+), 195 deletions(-)
 rename test/api_test/odp_ring_test.c => helper/test/ring.c (86%)
 delete mode 100644 test/api_test/.gitignore
 delete mode 100644 test/api_test/Makefile.am
 delete mode 100644 test/api_test/odp_common.c
 delete mode 100644 test/api_test/odp_common.h

diff --git a/configure.ac b/configure.ac
index 15dc6cf..d90b09b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -292,7 +292,6 @@ AC_CONFIG_FILES([Makefile
 pkgconfig/libodphelper.pc
 scripts/Makefile
 test/Makefile
-test/api_test/Makefile
 test/performance/Makefile
 test/validation/Makefile
 test/validation/buffer/Makefile
diff --git a/helper/ring.c b/helper/ring.c
index fe01c5d..9052628 100644
--- a/helper/ring.c
+++ b/helper/ring.c
@@ -644,3 +644,4 @@ int odph_ring_dequeue_burst(odph_ring_t *r, void 
**obj_table, unsigned n)
else
return odph_ring_mc_dequeue_burst(r, obj_table, n);
 }
+
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index f6a3f83..3e0df0b 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -1,13 +1,15 @@
 include $(top_srcdir)/test/Makefile.inc
 
 AM_CFLAGS += -I$(srcdir)/common
+AM_CFLAGS += -I$(top_srcdir)/test/validation/common
 AM_LDFLAGS += -static
 
 TESTS_ENVIRONMENT += TEST_DIR=${builddir}
 
 EXECUTABLES = chksum$(EXEEXT) \
   thread$(EXEEXT) \
-  process$(EXEEXT)
+  process$(EXEEXT) \
+  ring$(EXEEXT)
 
 COMPILE_ONLY =
 
@@ -27,3 +29,5 @@ dist_thread_SOURCES = thread.c
 thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
 dist_process_SOURCES = process.c
 process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
+dist_ring_SOURCES = ring.c
+ring_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
diff --git a/test/api_test/odp_ring_test.c b/helper/test/ring.c
similarity index 86%
rename from test/api_test/odp_ring_test.c
rename to helper/test/ring.c
index e8a962a..ca2199d 100644
--- a/test/api_test/odp_ring_test.c
+++ b/helper/test/ring.c
@@ -37,7 +37,6 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
 /**
  * @file
  *
@@ -48,14 +47,24 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
+#include 
 
 #define RING_SIZE 4096
 #define MAX_BULK 32
 
-#define RING_TEST_BASIC
+enum {
+   ODP_RING_TEST_BASIC,
+   ODP_RING_TEST_STRESS,
+};
+
+/* local struct for ring_thread argument */
+typedef struct {
+   pthrd_arg thrdarg;
+   int stress_type;
+} ring_arg_t;
 
 static int test_ring_basic(odph_ring_t *r)
 {
@@ -64,24 +73,24 @@ static int test_ring_basic(odph_ring_t *r)
unsigned i, num_elems;
 
/* alloc dummy object pointers */
-   src = malloc(RING_SIZE*2*sizeof(void *));
+   src = malloc(RING_SIZE * 2 * sizeof(void *));
if (src == NULL) {
LOG_ERR("failed to allocate test ring src memory\n");
goto fail;
}
-   for (i = 0; i < RING_SIZE*2; i++)
+   for (i = 0; i < RING_SIZE * 2; i++)
src[i] = (void *)(unsigned long)i;
 
cur_src = src;
 
/* alloc some room for copied objects */
-   dst = malloc(RING_SIZE*2*sizeof(void *));
+   dst = malloc(RING_SIZE * 2 * sizeof(void *));
if (dst == NULL) {
LOG_ERR("failed to allocate test ring dst memory\n");
goto fail;
}
 
-   memset(dst, 0, RING_SIZE*2*sizeof(void *));
+   memset(dst, 0, RING_SIZE * 2 * sizeof(void *));
cur_dst = dst;
 
printf("Test SP & SC basic functions\n");
@@ -251,7 +260,7 @@ static int producer_fn(void)
void **src = NULL;
 
/* alloc dummy object pointers */
-   src = malloc(MAX_BULK*2*sizeof(void *));
+   src = malloc(MAX_BULK * 2 * sizeof(void *));
if (src == NULL) {
LOG_ERR("failed to allocate producer memory.\n");
return -1;
@@ -275,7 +284,7 @@ static int consumer_fn(void)
void **src = NULL;
 
/* alloc dummy object pointers */
-   src = 

Re: [lng-odp] [PATCH] checkpatch: escape left braces in regex

2015-10-09 Thread Nicolas Morey-Chaisemartin
OK. Just submitted the cherry picked patch on the ML.

On 10/09/2015 02:13 PM, Maxim Uvarov wrote:
> On 10/09/15 12:21, Nicolas Morey-Chaisemartin wrote:
>> It is actually already fixed in the Linux kernel.
>> Shoud we import the latest checkpatch then?
>
> we should cherry-pick that change if we have real problem.
>
> Other changes are optional, you can review them if there is reason to
> apply them. Usually I do check patch update once a year or with begging
> new major update. Because of all our local changes should be in updated
> version also.
>
> Regards,
> Maxim.
>>
>> $ git show 4e5d56bdf892e18832a6540b63ebf709966bce2a
>> commit 4e5d56bdf892e18832a6540b63ebf709966bce2a
>> Author: Eddie Kovsky 
>> Date:   Wed Sep 9 15:37:52 2015 -0700
>>
>>  checkpatch: fix left brace warning
>>  Using checkpatch.pl with Perl 5.22.0 generates the following 
>> warning:
>>  Unescaped left brace in regex is deprecated, passed through in 
>> regex;
>>  This patch fixes the warnings by escaping occurrences of the left 
>> brace
>>  inside the regular expression.
>>  Signed-off-by: Eddie Kovsky 
>>  Cc: Joe Perches 
>>  Signed-off-by: Andrew Morton 
>>  Signed-off-by: Linus Torvalds 
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 577241e..ba47dab 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -3571,7 +3571,7 @@ sub process {
>>   # function brace can't be on same line, except for #defines of do while,
>>   # or if closed on same line
>>  if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
>> -   !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
>> +   !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
>>  if (ERROR("OPEN_BRACE",
>>"open brace '{' following function declarations go on the 
>> next line\n" . $herecurr) &&
>>  $fix) {
>> @@ -4083,8 +4083,8 @@ sub process {
>>   ## }
>> #need space before brace following if, while, etc
>> -   if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
>> -   $line =~ /do{/) {
>> +   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
>> +   $line =~ /do\{/) {
>>  if (ERROR("SPACING",
>>"space required before the open brace '{'\n" . $herecurr) 
>> &&
>>  $fix) {
>> @@ -4531,7 +4531,7 @@ sub process {
>>  $dstat !~ /^for\s*$Constant$/ &&# for (...)
>>  $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&   
>> # for (...) bar()
>>  $dstat !~ /^do\s*{/ &&  # do {...
>> -   $dstat !~ /^\({/ && # ({...
>> +   $dstat !~ /^\(\{/ &&# ({...
>>  $ctx !~ 
>> /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
>>  {
>>  $ctx =~ s/\n*$//;
>>
>>
>> On 10/09/2015 09:44 AM, Nicolas Morey-Chaisemartin wrote:
>>> I guess it should. But I'm not sure where the upstream is.
>>> It may even be fixed there.
>>>
>>> Nicolas
>>>
>>> On 10/08/2015 06:20 PM, Mike Holmes wrote:
 Should this go upstream also ?

 On 8 October 2015 at 14:46, Nicolas Morey-Chaisemartin 
 wrote:

> Latest Perl version marks unescaped left braces as deprecated in regexp
>
> Unescaped left brace in regex is deprecated, passed through in regex;
>   marked by <-- HERE in m/\#\s*define.*do\s{ <-- HERE /
>   at ./scripts/checkpatch.pl line 3414.
>
> Escape all open left braces that caused warnings
>
> Signed-off-by: Nicolas Morey-Chaisemartin 
> ---
>   scripts/checkpatch.pl | 8 
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 4983a0c..893da37 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3411,7 +3411,7 @@ sub process {
>   # function brace can't be on same line, except for #defines of do while,
>   # or if closed on same line
>  if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
> -   !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
> +   !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
>  if (ERROR("OPEN_BRACE",
>"open brace '{' following function
> declarations go on the next line\n" . $herecurr) &&
>  $fix) {
> @@ -3923,8 +3923,8 @@ sub process {
>   ## }
>
>   #need space before brace following if, while, etc
> -   if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
> -   $line =~ 

[lng-odp] [PATCH] checkpatch: fix left brace warning

2015-10-09 Thread Nicolas Morey-Chaisemartin
Using checkpatch.pl with Perl 5.22.0 generates the following warning:

Unescaped left brace in regex is deprecated, passed through in regex;

This patch fixes the warnings by escaping occurrences of the left brace
inside the regular expression.

Signed-off-by: Eddie Kovsky 
Cc: Joe Perches 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
---
 scripts/checkpatch.pl | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 577241e..ba47dab 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3571,7 +3571,7 @@ sub process {
 # function brace can't be on same line, except for #defines of do while,
 # or if closed on same line
if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
-   !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
+   !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
if (ERROR("OPEN_BRACE",
  "open brace '{' following function 
declarations go on the next line\n" . $herecurr) &&
$fix) {
@@ -4083,8 +4083,8 @@ sub process {
 ## }
 
 #need space before brace following if, while, etc
-   if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
-   $line =~ /do{/) {
+   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+   $line =~ /do\{/) {
if (ERROR("SPACING",
  "space required before the open brace '{'\n" 
. $herecurr) &&
$fix) {
@@ -4531,7 +4531,7 @@ sub process {
$dstat !~ /^for\s*$Constant$/ &&
# for (...)
$dstat !~ 
/^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&   # for (...) bar()
$dstat !~ /^do\s*{/ &&  
# do {...
-   $dstat !~ /^\({/ && 
# ({...
+   $dstat !~ /^\(\{/ &&
# ({...
$ctx !~ 
/^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
{
$ctx =~ s/\n*$//;
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH 1/2] api: pktio link

2015-10-09 Thread Maxim Uvarov

On 10/08/15 15:26, Ola Liljedahl wrote:
On 17 September 2015 at 18:03, Nicolas Morey-Chaisemartin 
> wrote:


Polling the link status makes sense but isn't setting the link
state a bit redundant with pktio start/stop ?

On meeting we figured out that someone can unplug cable and it's not 
related to pktio_start/ stop. Link status has to be separate.


I also think that applications should not be able to (attempt to) 
control the link state. The link state is actually decided by the PHY 
per auto-negotiation configurations and of course what the peer PHY 
(if any) supports. Setting auto-neg configurations or requesting 
auto-neg is also out of scope for ordinary applications.


An alternative API would have a call that returns the speed of a 
network (pktio) interface, e.g. 10/100/1000/1. Add some values for 
unknown speed (0?) and link down (error code, -1?). When using a 
virtual network interface (e.g. paravirtualised interface terminated 
by a hypervisor/vSwitch), a nominal link speed could be returned or 
perhaps some special value to indicate a virtual interface without any 
physical link speed.



If we do not need to modify link state/speed then it's reasonable to 
return simple struct as Petri wrote.


Ola, from my view app should not know if it's running on virtual 
environment or on real hw. If odp call says that link is down that means 
that current pktio link is down. And app has no idea is it's virtual or 
physical. For that reason I think Petris structure works well.


Maxim.



On 09/17/2015 03:56 PM, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov >
> ---
>  include/odp/api/packet_io.h | 22 ++
>  1 file changed, 22 insertions(+)
>
> diff --git a/include/odp/api/packet_io.h
b/include/odp/api/packet_io.h
> index 9b930bd..631aec2 100644
> --- a/include/odp/api/packet_io.h
> +++ b/include/odp/api/packet_io.h
> @@ -345,6 +345,28 @@ int odp_pktio_headroom_set(odp_pktio_t
pktio, uint32_t headroom);
>  uint64_t odp_pktio_to_u64(odp_pktio_t pktio);
>
>  /**
> + * Determine if link is up or down for a packet IO interface.
> + *
> + * @param[in] pktio Packet IO handle.
> + *
> + * @retval  1 link is up.
> + * @retval  0 link is down.
> + * @retval <0 on failure
> +*/
> +int odp_pktio_link(odp_pktio_t pktio);
> +
> +/**
> + * Up/Down link on a packet IO interface.
> + *
> + * @param[in] pktio  Packet IO handle.
> + * @param[in] enable 1 to link up, 0 to link down.
> + *
> + * @retval 0 on success
> + * @retval <0 on failure
> + */
> +int odp_pktio_link_set(odp_pktio_t pktio, odp_bool_t up);
> +
> +/**
>   * @}
>   */
>

___
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 0/2] linux-generic: cpu: fix cycle lost while cycle counter overflow

2015-10-09 Thread Maxim Uvarov

Petri, Ola, can you please review that patches?

Thank you,
Maxim.

On 10/05/15 15:58, Ivan Khoronzhuk wrote:

This series fixes cycle lost while counter overflow.
First patch move diff function in one place.
Second corrects diff function.

Based on api-next as it corrects new cpu cycle api.

Ivan Khoronzhuk (2):
   linux-generic: use cycles_diff for time API also
   linux-generic: cpu: fix cycle lost while cycle counter overflow

  platform/linux-generic/Makefile.am|  1 +
  platform/linux-generic/include/odp_cpu_internal.h | 29 +++
  platform/linux-generic/odp_cpu.c  |  6 ++---
  platform/linux-generic/odp_time.c |  6 ++---
  4 files changed, 34 insertions(+), 8 deletions(-)
  create mode 100644 platform/linux-generic/include/odp_cpu_internal.h



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


[lng-odp] [PATCH v2 5/6] test: l2fwd: add option to disable filling eth addresses

2015-10-09 Thread Matias Elo
By default every packet's source MAC address is filled to
match the output port. Add option to disable this to enable
testing packet forwarding without touching the packets.

Signed-off-by: Matias Elo 
---
 test/performance/odp_l2fwd.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 4a0938d..06116c2 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -70,6 +70,7 @@ typedef struct {
int accuracy;   /**< Number of seconds to get and print 
statistics */
char *if_str;   /**< Storage for interface names */
int dst_change; /**< Change destination eth addresses > */
+   int src_change; /**< Change source eth addresses > */
 } appl_args_t;
 
 static int exit_threads;   /**< Break workers loop if set to 1 */
@@ -623,11 +624,16 @@ static void fill_eth_addrs(odp_packet_t pkt_tbl[], 
unsigned num, int dst_port)
odph_ethhdr_t *eth;
unsigned i;
 
+   if (!gbl_args->appl.dst_change && !gbl_args->appl.src_change)
+   return;
+
for (i = 0; i < num; ++i) {
pkt = pkt_tbl[i];
if (odp_packet_has_eth(pkt)) {
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
-   eth->src = gbl_args->port_eth_addr[dst_port];
+
+   if (gbl_args->appl.src_change)
+   eth->src = gbl_args->port_eth_addr[dst_port];
 
if (gbl_args->appl.dst_change)
eth->dst = gbl_args->dst_eth_addr[dst_port];
@@ -656,15 +662,17 @@ static void parse_args(int argc, char *argv[], 
appl_args_t *appl_args)
{"interface", required_argument, NULL, 'i'},
{"mode", required_argument, NULL, 'm'},
{"dst_change", required_argument, NULL, 'd'},
+   {"src_change", required_argument, NULL, 's'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};
 
appl_args->time = 0; /* loop forever if time to run is 0 */
appl_args->accuracy = 1; /* get and print pps stats second */
+   appl_args->src_change = 1; /* change eth src address by default */
 
while (1) {
-   opt = getopt_long(argc, argv, "+c:+t:+a:i:m:d:h",
+   opt = getopt_long(argc, argv, "+c:+t:+a:i:m:d:s:h",
  longopts, _index);
 
if (opt == -1)
@@ -734,6 +742,9 @@ static void parse_args(int argc, char *argv[], appl_args_t 
*appl_args)
case 'd':
appl_args->dst_change = atoi(optarg);
break;
+   case 's':
+   appl_args->src_change = atoi(optarg);
+   break;
case 'h':
usage(argv[0]);
exit(EXIT_SUCCESS);
@@ -819,6 +830,8 @@ static void usage(char *progname)
   "  (default is 1 second).\n"
   "  -d, --dst_change  0: Don't change packets' dst eth addresses 
(default)\n"
   "1: Change packets' dst eth addresses\n"
+  "  -s, --src_change  0: Don't change packets' src eth 
addresses\n"
+  "1: Change packets' src eth addresses 
(default)\n"
   "  -h, --help   Display help and exit.\n\n"
   " environment variables: ODP_PKTIO_DISABLE_NETMAP\n"
   "ODP_PKTIO_DISABLE_SOCKET_MMAP\n"
-- 
1.9.1

___
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-10-09 Thread Alexandru Badicioiu
So you would like inline/synchronous API mode to have a completion queue
too? What would be the use for it?

On 9 October 2015 at 13:01, Ola Liljedahl  wrote:

> On 9 October 2015 at 10:37, Alexandru Badicioiu <
> alexandru.badici...@linaro.org> wrote:
>
>> This was a long discussion some time ago and the result was that crypto
>> output should be abstracted in the form of the completion event and access
>> functions would retrieve status and output packets. Also the implementation
>> is in charge with crypto completion event allocation and not the
>> application even if this is not really supported in HW.
>>
> Yes that is useful for lookaside crypto/IPsec operations and my intention
> is not to change that. But this model is not useful for inline IPsec
> acceleration. We need a new or (preferably?) extended API for that. That's
> what I am asking about.
>
> I know not all silicon vendors would be able to support inline IPsec
> acceleration in HW. But with an Event Machine-like programming model where
> the application uses per-queue call-backs, inline IPsec acceleration can be
> implemented/emulated in SW. Even if this model is not exposed to the user,
> an ODP implementation should be able to do something like it "under the
> hood".
>
>
> The previous approach was that application supplied the completion event
>> as being the output packet but this was regarded as a hack.
>>
>> Alex
>>
>> On 9 October 2015 at 11:28, Ola Liljedahl 
>> wrote:
>>
>>> On 9 October 2015 at 09:34, Alexandru Badicioiu <
>>> alexandru.badici...@linaro.org> wrote:
>>>
 The problem you raised is not strictly related to this patch.
 A crypto session has an output queue (for async mode) where the results
 , including the operation status, will be delivered. There is nothing in
 the API to prevent using a pktio output queue for crypto completion events
 but the pktio should be able to process the event as the application would
 do.
 In this case an extension of pktio functionality would be required.

>>> Yes but I was thinking of some change (in API and implementation) where
>>> the output of the crypto operations is the actual packet (with L2/L3
>>> encapsulation), not a crypto completion event.
>>>
>>>

 Alex


 On 8 October 2015 at 20:13, Ola Liljedahl 
 wrote:

> Can this proposal be extended to handle inline IPsec processing, e.g.
> encrypt and encapsulate packet (include Ethernet framing) and then send to
> (enqueue) to some user-defined queue (which might be a pktio output 
> queue)?
> Need some way to report errors and other conditions back to SW so
> might need some kind of ipsec notification event.
> Something for the ingress side as well, e.g. connect user-defined
> queues to IPsec input queue(s) and then specify corresponding output 
> queues.
>
>
> On 31 July 2015 at 11:30, Alexandru Badicioiu <
> alexandru.badici...@linaro.org> wrote:
>
>>
>>
>> On 30 July 2015 at 17:44, Stuart Haslam 
>> wrote:
>>
>>> On Thu, Jul 30, 2015 at 02:42:08PM +0300, Alexandru Badicioiu wrote:
>>> > On 30 July 2015 at 13:50, Stuart Haslam 
>>> wrote:
>>> >
>>> > > 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 <
>>> alexandru.badici...@linaro.org>
>>> > > > ---
>>> > > >  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
>>> > > > + */
>>> > > 

[lng-odp] [PATCHv9 0/8] IPC (pktio)

2015-10-09 Thread Maxim Uvarov
v9: reworked patches according to Connect agreements:
- linux-generic only pktio;
- 2 separate symmetric apps with same init process;
- does not matter which app was run first;
- init process for 2 apps is the same;

Maxim Uvarov (8):
  helper: ring: update ring with shm proc argument
  linux-generic: create internal pool create function with shm flags
  move odph_pause inside linux-generic
  helper: flag to not link ring to linked list
  helpers: remove odp_ prefix for tests source files
  helper: move ring test to helper
  linux-generic: add ipc pktio support
  linux-generic: internal ipc_pktio test

 configure.ac   |   1 -
 helper/Makefile.am |   4 +-
 helper/include/odp/helper/ring.h   |   7 +-
 helper/ring.c  |  15 +-
 helper/test/.gitignore |   9 +-
 helper/test/Makefile.am|  22 +-
 helper/test/{odp_chksum.c => chksum.c} |   3 +-
 helper/test/odph_pause.c   |  14 -
 helper/test/{odp_process.c => process.c}   |   3 +-
 .../api_test/odp_ring_test.c => helper/test/ring.c | 100 +--
 helper/test/{odp_thread.c => thread.c} |   3 +-
 platform/linux-generic/Makefile.am |   4 +
 .../linux-generic/include/odp_buffer_internal.h|   3 +
 .../linux-generic/include/odp_packet_io_internal.h |  35 +
 .../include/odp_packet_io_ipc_internal.h   |  51 ++
 .../linux-generic/include/odp_pause_internal.h |   4 +-
 platform/linux-generic/include/odp_pool_internal.h |   4 +
 platform/linux-generic/include/odp_shm_internal.h  |  20 +
 platform/linux-generic/m4/configure.m4 |   3 +-
 platform/linux-generic/odp_packet_io.c |   1 +
 platform/linux-generic/odp_pool.c  |  22 +-
 platform/linux-generic/odp_schedule.c  |   3 +-
 platform/linux-generic/odp_shared_memory.c |  10 +-
 platform/linux-generic/pktio/io_ops.c  |   1 +
 platform/linux-generic/pktio/ipc.c | 720 +
 platform/linux-generic/pktio/ring.c|   1 +
 platform/linux-generic/test/Makefile.am|   3 +-
 platform/linux-generic/test/pktio_ipc/.gitignore   |   1 +
 platform/linux-generic/test/pktio_ipc/Makefile.am  |  15 +
 platform/linux-generic/test/pktio_ipc/ipc_common.c | 150 +
 platform/linux-generic/test/pktio_ipc/ipc_common.h |  71 ++
 platform/linux-generic/test/pktio_ipc/pktio_ipc1.c | 268 
 platform/linux-generic/test/pktio_ipc/pktio_ipc2.c | 142 
 .../linux-generic/test/pktio_ipc/pktio_ipc_run |  55 ++
 test/Makefile.am   |   2 +-
 test/api_test/.gitignore   |   2 -
 test/api_test/Makefile.am  |  13 -
 test/api_test/odp_common.c |  91 ---
 test/api_test/odp_common.h |  42 --
 39 files changed, 1672 insertions(+), 246 deletions(-)
 rename helper/test/{odp_chksum.c => chksum.c} (98%)
 delete mode 100644 helper/test/odph_pause.c
 rename helper/test/{odp_process.c => process.c} (96%)
 rename test/api_test/odp_ring_test.c => helper/test/ring.c (86%)
 rename helper/test/{odp_thread.c => thread.c} (96%)
 create mode 100644 platform/linux-generic/include/odp_packet_io_ipc_internal.h
 rename helper/odph_pause.h => 
platform/linux-generic/include/odp_pause_internal.h (93%)
 create mode 100644 platform/linux-generic/include/odp_shm_internal.h
 create mode 100644 platform/linux-generic/pktio/ipc.c
 create mode 12 platform/linux-generic/pktio/ring.c
 create mode 100644 platform/linux-generic/test/pktio_ipc/.gitignore
 create mode 100644 platform/linux-generic/test/pktio_ipc/Makefile.am
 create mode 100644 platform/linux-generic/test/pktio_ipc/ipc_common.c
 create mode 100644 platform/linux-generic/test/pktio_ipc/ipc_common.h
 create mode 100644 platform/linux-generic/test/pktio_ipc/pktio_ipc1.c
 create mode 100644 platform/linux-generic/test/pktio_ipc/pktio_ipc2.c
 create mode 100755 platform/linux-generic/test/pktio_ipc/pktio_ipc_run
 delete mode 100644 test/api_test/.gitignore
 delete mode 100644 test/api_test/Makefile.am
 delete mode 100644 test/api_test/odp_common.c
 delete mode 100644 test/api_test/odp_common.h

-- 
1.9.1

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


Re: [lng-odp] [PATCH] checkpatch: escape left braces in regex

2015-10-09 Thread Maxim Uvarov

On 10/09/15 12:21, Nicolas Morey-Chaisemartin wrote:

It is actually already fixed in the Linux kernel.
Shoud we import the latest checkpatch then?


we should cherry-pick that change if we have real problem.

Other changes are optional, you can review them if there is reason to
apply them. Usually I do check patch update once a year or with begging
new major update. Because of all our local changes should be in updated
version also.

Regards,
Maxim.


$ git show 4e5d56bdf892e18832a6540b63ebf709966bce2a
commit 4e5d56bdf892e18832a6540b63ebf709966bce2a
Author: Eddie Kovsky 
Date:   Wed Sep 9 15:37:52 2015 -0700

 checkpatch: fix left brace warning

 Using checkpatch.pl with Perl 5.22.0 generates the following warning:

 Unescaped left brace in regex is deprecated, passed through in regex;

 This patch fixes the warnings by escaping occurrences of the left brace

 inside the regular expression.

 Signed-off-by: Eddie Kovsky 

 Cc: Joe Perches 
 Signed-off-by: Andrew Morton 
 Signed-off-by: Linus Torvalds 

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 577241e..ba47dab 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3571,7 +3571,7 @@ sub process {
  # function brace can't be on same line, except for #defines of do while,
  # or if closed on same line
 if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
-   !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
+   !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
 if (ERROR("OPEN_BRACE",
   "open brace '{' following function declarations go on the next 
line\n" . $herecurr) &&
 $fix) {
@@ -4083,8 +4083,8 @@ sub process {
  ## }
  
  #need space before brace following if, while, etc

-   if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
-   $line =~ /do{/) {
+   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+   $line =~ /do\{/) {
 if (ERROR("SPACING",
   "space required before the open brace '{'\n" . $herecurr) &&
 $fix) {
@@ -4531,7 +4531,7 @@ sub process {
 $dstat !~ /^for\s*$Constant$/ &&# for (...)
 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&   # 
for (...) bar()
 $dstat !~ /^do\s*{/ &&  # do {...
-   $dstat !~ /^\({/ && # ({...
+   $dstat !~ /^\(\{/ &&# ({...
 $ctx !~ 
/^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
 {
 $ctx =~ s/\n*$//;


On 10/09/2015 09:44 AM, Nicolas Morey-Chaisemartin wrote:

I guess it should. But I'm not sure where the upstream is.
It may even be fixed there.

Nicolas

On 10/08/2015 06:20 PM, Mike Holmes wrote:

Should this go upstream also ?

On 8 October 2015 at 14:46, Nicolas Morey-Chaisemartin 
wrote:


Latest Perl version marks unescaped left braces as deprecated in regexp

Unescaped left brace in regex is deprecated, passed through in regex;
  marked by <-- HERE in m/\#\s*define.*do\s{ <-- HERE /
  at ./scripts/checkpatch.pl line 3414.

Escape all open left braces that caused warnings

Signed-off-by: Nicolas Morey-Chaisemartin 
---
  scripts/checkpatch.pl | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4983a0c..893da37 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3411,7 +3411,7 @@ sub process {
  # function brace can't be on same line, except for #defines of do while,
  # or if closed on same line
 if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
-   !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
+   !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
 if (ERROR("OPEN_BRACE",
   "open brace '{' following function
declarations go on the next line\n" . $herecurr) &&
 $fix) {
@@ -3923,8 +3923,8 @@ sub process {
  ## }

  #need space before brace following if, while, etc
-   if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
-   $line =~ /do{/) {
+   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+   $line =~ /do\{/) {
 if (ERROR("SPACING",
   "space required before the open brace
'{'\n" . $herecurr) &&
 $fix) {
@@ -4377,7 +4377,7 @@ sub process {
 $dstat !~ /^for\s*$Constant$/ &&
   # for (...)
 $dstat !~
/^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&   # for 

[lng-odp] [PATCH v2 1/6] test: l2fwd: add option to change destination eth addresses

2015-10-09 Thread Matias Elo
 If the application is being run on a host connected to a
 switch, not changing the ethernet destination may cause
 loops. Added an option to change the destination ethernet
 address. The destination addresses follow the format
 02:00:00:00:00:XX where the final octet is the output
 port number.

Signed-off-by: Matias Elo 
---
 test/performance/odp_l2fwd.c | 46 ++--
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 812d47f..6755673 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -75,6 +75,7 @@ typedef struct {
int time;   /**< Time in seconds to run. */
int accuracy;   /**< Number of seconds to get and print 
statistics */
char *if_str;   /**< Storage for interface names */
+   int dst_change; /**< Change destination eth addresses > */
 } appl_args_t;
 
 static int exit_threads;   /**< Break workers loop if set to 1 */
@@ -107,6 +108,8 @@ typedef struct {
odp_pktio_t pktios[ODP_CONFIG_PKTIO_ENTRIES];
/** Table of port ethernet addresses */
odph_ethaddr_t port_eth_addr[ODP_CONFIG_PKTIO_ENTRIES];
+   /** Table of dst ethernet addresses */
+   odph_ethaddr_t dst_eth_addr[ODP_CONFIG_PKTIO_ENTRIES];
/** Table of port default output queues */
odp_queue_t outq_def[ODP_CONFIG_PKTIO_ENTRIES];
 } args_t;
@@ -119,8 +122,8 @@ static odp_barrier_t barrier;
 /* helper funcs */
 static inline int lookup_dest_port(odp_packet_t pkt);
 static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len);
-static void fill_src_eth_addrs(odp_packet_t pkt_tbl[], unsigned num,
-  int dst_port);
+static void fill_eth_addrs(odp_packet_t pkt_tbl[], unsigned num,
+  int dst_port);
 static void parse_args(int argc, char *argv[], appl_args_t *appl_args);
 static void print_info(char *progname, appl_args_t *appl_args);
 static void usage(char *progname);
@@ -160,7 +163,7 @@ static void *pktio_queue_thread(void *arg)
 
dst_port = lookup_dest_port(pkt);
 
-   fill_src_eth_addrs(, 1, dst_port);
+   fill_eth_addrs(, 1, dst_port);
 
/* Enqueue the packet for output */
outq_def = gbl_args->outq_def[dst_port];
@@ -239,7 +242,7 @@ static void *pktio_ifburst_thread(void *arg)
/* Drop packets with errors */
pkts_ok = drop_err_pkts(pkt_tbl, pkts);
if (pkts_ok > 0) {
-   fill_src_eth_addrs(pkt_tbl, pkts_ok, dst_idx);
+   fill_eth_addrs(pkt_tbl, pkts_ok, dst_idx);
 
int sent = odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok);
 
@@ -388,6 +391,7 @@ int main(int argc, char *argv[])
odp_shm_t shm;
odp_cpumask_t cpumask;
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
+   odph_ethaddr_t new_addr;
odp_pktio_t pktio;
odp_pool_param_t params;
int ret;
@@ -478,6 +482,15 @@ int main(int argc, char *argv[])
if (gbl_args->appl.mode == APPL_MODE_PKT_QUEUE)
gbl_args->outq_def[i] = odp_pktio_outq_getdef(pktio);
 
+   /* Save destination eth address */
+   if (gbl_args->appl.dst_change) {
+   /* 02:00:00:00:00:XX */
+   memset(_addr, 0, sizeof(odph_ethaddr_t));
+   new_addr.addr[0] = 0x02;
+   new_addr.addr[5] = i;
+   gbl_args->dst_eth_addr[i] = new_addr;
+   }
+
ret = odp_pktio_start(pktio);
if (ret) {
LOG_ERR("Error: unable to start %s\n",
@@ -563,14 +576,13 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned 
len)
 }
 
 /**
- * Fill packets' eth src addresses according to the destination port
+ * Fill packets' eth addresses according to the destination port
  *
  * @param pkt_tbl  Array of packets
  * @param num  Number of packets in the array
  * @param dst_port Destination port
  */
-static void fill_src_eth_addrs(odp_packet_t pkt_tbl[], unsigned num,
-  int dst_port)
+static void fill_eth_addrs(odp_packet_t pkt_tbl[], unsigned num, int dst_port)
 {
odp_packet_t pkt;
odph_ethhdr_t *eth;
@@ -581,6 +593,9 @@ static void fill_src_eth_addrs(odp_packet_t pkt_tbl[], 
unsigned num,
if (odp_packet_has_eth(pkt)) {
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
eth->src = gbl_args->port_eth_addr[dst_port];
+
+   if (gbl_args->appl.dst_change)
+   eth->dst = gbl_args->dst_eth_addr[dst_port];
}
}
 }
@@ -603,9 +618,10 @@ static void parse_args(int argc, char *argv[], appl_args_t 
*appl_args)
  

[lng-odp] [PATCH v2 6/6] test: l2fwd: word copy ethernet addresses

2015-10-09 Thread Matias Elo
Optimize ethernet address filling by using word copy.

Signed-off-by: Matias Elo 
---
 test/performance/odp_l2fwd.c | 43 +++
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 06116c2..62736c3 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -92,6 +92,14 @@ typedef struct {
 } thread_args_t;
 
 /**
+ * Optimized type for storing ethernet addresses
+ */
+typedef union {
+   uint8_t u8[6];
+   uint16_t u16[3];
+} eth_addr_t;
+
+/**
  * Grouping of all global data
  */
 typedef struct {
@@ -102,9 +110,9 @@ typedef struct {
/** Table of pktio handles */
odp_pktio_t pktios[ODP_CONFIG_PKTIO_ENTRIES];
/** Table of port ethernet addresses */
-   odph_ethaddr_t port_eth_addr[ODP_CONFIG_PKTIO_ENTRIES];
+   eth_addr_t port_eth_addr[ODP_CONFIG_PKTIO_ENTRIES];
/** Table of dst ethernet addresses */
-   odph_ethaddr_t dst_eth_addr[ODP_CONFIG_PKTIO_ENTRIES];
+   eth_addr_t dst_eth_addr[ODP_CONFIG_PKTIO_ENTRIES];
/** Table of port default output queues */
odp_queue_t outq_def[ODP_CONFIG_PKTIO_ENTRIES];
/** Table of dst ports */
@@ -430,7 +438,7 @@ int main(int argc, char *argv[])
odp_shm_t shm;
odp_cpumask_t cpumask;
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
-   odph_ethaddr_t new_addr;
+   eth_addr_t new_addr;
odp_pktio_t pktio;
odp_pool_param_t params;
int ret;
@@ -505,7 +513,7 @@ int main(int argc, char *argv[])
gbl_args->pktios[i] = pktio;
 
/* Save interface ethernet address */
-   if (odp_pktio_mac_addr(pktio, gbl_args->port_eth_addr[i].addr,
+   if (odp_pktio_mac_addr(pktio, gbl_args->port_eth_addr[i].u8,
   ODPH_ETHADDR_LEN) != ODPH_ETHADDR_LEN) {
LOG_ERR("Error: interface ethernet address unknown\n");
exit(EXIT_FAILURE);
@@ -518,9 +526,9 @@ int main(int argc, char *argv[])
/* Save destination eth address */
if (gbl_args->appl.dst_change) {
/* 02:00:00:00:00:XX */
-   memset(_addr, 0, sizeof(odph_ethaddr_t));
-   new_addr.addr[0] = 0x02;
-   new_addr.addr[5] = i;
+   memset(_addr, 0, sizeof(eth_addr_t));
+   new_addr.u8[0] = 0x02;
+   new_addr.u8[5] = i;
gbl_args->dst_eth_addr[i] = new_addr;
}
 
@@ -623,6 +631,8 @@ static void fill_eth_addrs(odp_packet_t pkt_tbl[], unsigned 
num, int dst_port)
odp_packet_t pkt;
odph_ethhdr_t *eth;
unsigned i;
+   uint16_t *dw;
+   uint16_t *sw;
 
if (!gbl_args->appl.dst_change && !gbl_args->appl.src_change)
return;
@@ -632,11 +642,20 @@ static void fill_eth_addrs(odp_packet_t pkt_tbl[], 
unsigned num, int dst_port)
if (odp_packet_has_eth(pkt)) {
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
 
-   if (gbl_args->appl.src_change)
-   eth->src = gbl_args->port_eth_addr[dst_port];
-
-   if (gbl_args->appl.dst_change)
-   eth->dst = gbl_args->dst_eth_addr[dst_port];
+   if (gbl_args->appl.src_change) {
+   sw = gbl_args->port_eth_addr[dst_port].u16;
+   dw = (uint16_t *)eth->src.addr;
+   dw[0] = sw[0];
+   dw[1] = sw[1];
+   dw[2] = sw[2];
+   }
+   if (gbl_args->appl.dst_change) {
+   sw = gbl_args->dst_eth_addr[dst_port].u16;
+   dw = (uint16_t *)eth->dst.addr;
+   dw[0] = sw[0];
+   dw[1] = sw[1];
+   dw[2] = sw[2];
+   }
}
}
 }
-- 
1.9.1

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


[lng-odp] [PATCHv9 3/8] move odph_pause inside linux-generic

2015-10-09 Thread Maxim Uvarov
Move odph_pause inside linux-generic. Validation test is also useless
with such move.

Signed-off-by: Maxim Uvarov 
---
 helper/Makefile.am |  4 +---
 helper/ring.c  |  2 +-
 helper/test/Makefile.am|  4 +---
 helper/test/odph_pause.c   | 14 --
 platform/linux-generic/Makefile.am |  1 +
 .../linux-generic/include/odp_pause_internal.h |  4 ++--
 6 files changed, 6 insertions(+), 23 deletions(-)
 delete mode 100644 helper/test/odph_pause.c
 rename helper/odph_pause.h => 
platform/linux-generic/include/odp_pause_internal.h (93%)

diff --git a/helper/Makefile.am b/helper/Makefile.am
index 1a74e8e..cde8af2 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -19,9 +19,7 @@ helperinclude_HEADERS = \
  $(srcdir)/include/odp/helper/tcp.h\
  $(srcdir)/include/odp/helper/udp.h
 
-noinst_HEADERS = \
-$(srcdir)/odph_debug.h \
-$(srcdir)/odph_pause.h
+noinst_HEADERS = $(srcdir)/odph_debug.h
 
 __LIB__libodphelper_la_SOURCES = \
linux.c \
diff --git a/helper/ring.c b/helper/ring.c
index 844abf7..6bb2bda 100644
--- a/helper/ring.c
+++ b/helper/ring.c
@@ -71,7 +71,7 @@
 
 #include 
 #include 
-#include "odph_pause.h"
+#include "odp_pause_internal.h"
 #include 
 #include 
 #include 
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index fbf5a9b..7b73602 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -7,8 +7,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
 
 EXECUTABLES = odp_chksum$(EXEEXT) \
   odp_thread$(EXEEXT) \
-  odp_process$(EXEEXT)\
-  odph_pause$(EXEEXT)
+  odp_process$(EXEEXT)
 
 COMPILE_ONLY =
 
@@ -28,4 +27,3 @@ dist_odp_thread_SOURCES = odp_thread.c
 odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
 dist_odp_process_SOURCES = odp_process.c
 odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
-odph_pause_SOURCES = odph_pause.c
diff --git a/helper/test/odph_pause.c b/helper/test/odph_pause.c
deleted file mode 100644
index f5f5da3..000
--- a/helper/test/odph_pause.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include 
-#include "../odph_pause.h"
-
-int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
-{
-   odph_pause();
-   return 0;
-}
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 4c79730..b9ed3b0 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -128,6 +128,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_packet_io_internal.h \
  ${srcdir}/include/odp_packet_io_queue.h \
  ${srcdir}/include/odp_packet_socket.h \
+ ${srcdir}/include/odp_pause_internal.h \
  ${srcdir}/include/odp_pool_internal.h \
  ${srcdir}/include/odp_queue_internal.h \
  ${srcdir}/include/odp_schedule_internal.h \
diff --git a/helper/odph_pause.h 
b/platform/linux-generic/include/odp_pause_internal.h
similarity index 93%
rename from helper/odph_pause.h
rename to platform/linux-generic/include/odp_pause_internal.h
index 5618f1f..ad2c628 100644
--- a/helper/odph_pause.h
+++ b/platform/linux-generic/include/odp_pause_internal.h
@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#ifndef ODPH_PAUSE_H_
-#define ODPH_PAUSE_H_
+#ifndef ODP_PAUSE_INTERNAL_H_
+#define ODP_PAUSE_INTERNAL_H_
 
 #ifdef __cplusplus
 extern "C" {
-- 
1.9.1

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


[lng-odp] [PATCHv9 7/8] linux-generic: add ipc pktio support

2015-10-09 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_buffer_internal.h|   3 +
 .../linux-generic/include/odp_packet_io_internal.h |  35 +
 .../include/odp_packet_io_ipc_internal.h   |  51 ++
 platform/linux-generic/include/odp_shm_internal.h  |  20 +
 platform/linux-generic/odp_packet_io.c |   1 +
 platform/linux-generic/odp_pool.c  |  11 +-
 platform/linux-generic/odp_shared_memory.c |  10 +-
 platform/linux-generic/pktio/io_ops.c  |   1 +
 platform/linux-generic/pktio/ipc.c | 720 +
 platform/linux-generic/pktio/ring.c|   1 +
 11 files changed, 851 insertions(+), 4 deletions(-)
 create mode 100644 platform/linux-generic/include/odp_packet_io_ipc_internal.h
 create mode 100644 platform/linux-generic/include/odp_shm_internal.h
 create mode 100644 platform/linux-generic/pktio/ipc.c
 create mode 12 platform/linux-generic/pktio/ring.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index b9ed3b0..71353dd 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -151,9 +151,11 @@ __LIB__libodp_la_SOURCES = \
   odp_packet_flags.c \
   odp_packet_io.c \
   pktio/io_ops.c \
+  pktio/ipc.c \
   pktio/loop.c \
   pktio/socket.c \
   pktio/socket_mmap.c \
+  pktio/ring.c \
   odp_pool.c \
   odp_queue.c \
   odp_rwlock.c \
diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index 4cacca1..a078e52 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -132,6 +132,9 @@ struct odp_buffer_hdr_t {
uint32_t uarea_size; /* size of user area */
uint32_t segcount;   /* segment count */
uint32_t segsize;/* segment size */
+   /* ipc mapped process can not walk over pointers,
+* offset has to be used */
+   uint64_t ipc_addr_offset[ODP_BUFFER_MAX_SEG];
void*addr[ODP_BUFFER_MAX_SEG]; /* block addrs */
uint64_t order;  /* sequence for ordered queues */
queue_entry_t   *origin_qe;  /* ordered queue origin */
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 6b03051..62e6829 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -23,6 +23,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -36,6 +37,38 @@ typedef struct {
odp_bool_t promisc; /**< promiscuous mode state */
 } pkt_loop_t;
 
+typedefstruct {
+   /* TX */
+   struct  {
+   odph_ring_t *prod; /**< ODP ring for IPC msg packets
+ indexes transmitted to shared
+ memory */
+   odph_ring_t *cons; /**< ODP ring for IPC msg packets
+   indexes already processed by remote
+   process */
+   } m; /* master */
+   /* RX */
+   struct {
+   odph_ring_t *prod; /**< ODP ring for IPC msg packets
+   indexes received from shared
+memory (from remote process) */
+   odph_ring_t *cons; /**< ODP ring for IPC msg packets
+   indexes already processed by
+   current process */
+   } s; /* slave */
+   void*pool_base; /**< Remote pool base addr */
+   void*pool_mdata_base;   /**< Remote pool mdata base 
addr */
+   uint64_tpkt_size;   /**< Packet size in remote pool 
*/
+   odp_pool_t  pool;   /**< Pool of main process */
+   odp_shm_t   pool_shm;   /**< Shm memory for remote pool 
*/
+   enum {
+   ODP_PKTIO_TYPE_IPC = 0,
+   ODP_PKTIO_TYPE_IPC_SLAVE
+   } type; /**< define if it's master or slave process */
+   int  ready; /**< 1 - pktio is ready and can recv/send packet, 0 - not 
yet ready */
+   void *pinfo;
+} _ipc_pktio_t;
+
 struct pktio_entry {
const struct pktio_if_ops *ops; /**< Implementation specific methods */
odp_spinlock_t 

Re: [lng-odp] [PATCH] example:ipsec: Using environment varibale for pktio mode.

2015-10-09 Thread Maxim Uvarov

Merged,
Maxim.

On 10/07/15 13:23, nikhil.agar...@freescale.com wrote:

From: Nikhil Agarwal 

Pktio input mode of operation should be derived from
environment variable input instead of compile time flag.

Signed-off-by: Nikhil Agarwal 
---
  example/ipsec/odp_ipsec.c | 9 -
  1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 96effe2..bc1d00e 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -515,11 +515,10 @@ void initialize_intf(char *intf)
  
  	memset(_param, 0, sizeof(pktio_param));
  
-#ifdef IPSEC_POLL_QUEUES

-   pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
-#else
-   pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
-#endif
+   if (getenv("ODP_IPSEC_USE_POLL_QUEUES"))
+   pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
+   else
+   pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
  
  	/*

 * Open a packet IO instance for thread and get default output queue


___
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-10-09 Thread Ola Liljedahl
On 9 October 2015 at 12:48, Alexandru Badicioiu <
alexandru.badici...@linaro.org> wrote:

> So you would like inline/synchronous API mode to have a completion queue
> too? What would be the use for it?
>
I think we are misunderstanding each other and I haven't been very detailed.

The output of IPsec egress processing must be a queue (e.g. pktio queue)
where complete packets (L2/L3 encapsulation specified by the user) are
enqueued. But there probably also needs to be a queue for sending
notifications of errors or other exceptional events (e.g. SA not found,
seqno nears the end etc).

I haven't tried to understand exactly what is needed for inline IPsec on
ingress.


> On 9 October 2015 at 13:01, Ola Liljedahl 
> wrote:
>
>> On 9 October 2015 at 10:37, Alexandru Badicioiu <
>> alexandru.badici...@linaro.org> wrote:
>>
>>> This was a long discussion some time ago and the result was that crypto
>>> output should be abstracted in the form of the completion event and access
>>> functions would retrieve status and output packets. Also the implementation
>>> is in charge with crypto completion event allocation and not the
>>> application even if this is not really supported in HW.
>>>
>> Yes that is useful for lookaside crypto/IPsec operations and my intention
>> is not to change that. But this model is not useful for inline IPsec
>> acceleration. We need a new or (preferably?) extended API for that. That's
>> what I am asking about.
>>
>> I know not all silicon vendors would be able to support inline IPsec
>> acceleration in HW. But with an Event Machine-like programming model where
>> the application uses per-queue call-backs, inline IPsec acceleration can be
>> implemented/emulated in SW. Even if this model is not exposed to the user,
>> an ODP implementation should be able to do something like it "under the
>> hood".
>>
>>
>> The previous approach was that application supplied the completion event
>>> as being the output packet but this was regarded as a hack.
>>>
>>> Alex
>>>
>>> On 9 October 2015 at 11:28, Ola Liljedahl 
>>> wrote:
>>>
 On 9 October 2015 at 09:34, Alexandru Badicioiu <
 alexandru.badici...@linaro.org> wrote:

> The problem you raised is not strictly related to this patch.
> A crypto session has an output queue (for async mode) where the
> results , including the operation status, will be delivered. There is
> nothing in the API to prevent using a pktio output queue for crypto
> completion events but the pktio should be able to process the event as the
> application would do.
> In this case an extension of pktio functionality would be required.
>
 Yes but I was thinking of some change (in API and implementation) where
 the output of the crypto operations is the actual packet (with L2/L3
 encapsulation), not a crypto completion event.


>
> Alex
>
>
> On 8 October 2015 at 20:13, Ola Liljedahl 
> wrote:
>
>> Can this proposal be extended to handle inline IPsec processing, e.g.
>> encrypt and encapsulate packet (include Ethernet framing) and then send 
>> to
>> (enqueue) to some user-defined queue (which might be a pktio output 
>> queue)?
>> Need some way to report errors and other conditions back to SW so
>> might need some kind of ipsec notification event.
>> Something for the ingress side as well, e.g. connect user-defined
>> queues to IPsec input queue(s) and then specify corresponding output 
>> queues.
>>
>>
>> On 31 July 2015 at 11:30, Alexandru Badicioiu <
>> alexandru.badici...@linaro.org> wrote:
>>
>>>
>>>
>>> On 30 July 2015 at 17:44, Stuart Haslam 
>>> wrote:
>>>
 On Thu, Jul 30, 2015 at 02:42:08PM +0300, Alexandru Badicioiu wrote:
 > On 30 July 2015 at 13:50, Stuart Haslam 
 wrote:
 >
 > > 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 <
 alexandru.badici...@linaro.org>
 > > > ---
 > > >  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 

Re: [lng-odp] [PATCH 5/8] add fbk hash table

2015-10-09 Thread Maxim Uvarov

Please specify git commit hash related to original code.

I'm thinking how to maintain that in future.  And looks like there will 
be no way other then walk over all new patches
and modify them to our odp code. In that case reference to original git 
base will be helpful.


Thank you,
Maxim.


On 10/09/15 11:37, HePeng wrote:


在 2015年10月9日,下午4:36,Ola Liljedahl > 写道:


On 9 October 2015 at 10:33, HePeng > wrote:




在 2015年10月9日,下午4:26,Ola Liljedahl
> 写道:

On 8 October 2015 at 14:43, HePeng > wrote:



在 2015年10月8日,下午8:13,Ola Liljedahl
> 写道:

On 8 October 2015 at 10:02, Bill Fischofer
> wrote:

Trying to keep the rte_ prefix would be confusing.  One
of the precepts of ODP is that it doesn't preclude an
application also using an underlying SDK in addition to
ODP APIs. Whether that makes sense is up to the
application, of course.  But if ODP were to start using
other prefixes I'd imagine that would get very messy.

It would also be confusing to have functions that use odp_
naming conventions but don't behave like ODP functions
(with regards to e.g. handling and returning errors or
checking parameters).

We can fix this by wrapping these functions.

I don't follow you. How can you make these function behave like
ODP functions by "wrapping" them?
Me thinks you have to modify the implementation in order to
change the behaviour.


I mean that perhaps not all the functions needs to be changed,
only the exposed ones (APIs). Some functions are static and are
only used in
the internal of implementation, these functions can reserve their
code.

Static functions can have whatever names you like. But if their 
implementation contributes to the behaviour as seen by callers of the 
public functions, that behaviour must be compliant with the ODP style.


I see. Thanks.






 But considering that the internal code is already ready, I
am thinking reserve the code of *static* functions (internal
implementations)?





So if we rename code imported from e.g. DPDK, we should
also convert it to behave like proper ODP functions. That
we can base the implementation on preexisting code is just
incidental and should not affect how the code behaves.


On Wednesday, October 7, 2015, Ola Liljedahl
> wrote:

On 23 September 2015 at 19:51, Maxim Uvarov
 wrote:



On 09/20/15 07:04, rujiacs wrote:

Signed-off-by: rujiacs 
---
helper/hash_fbk.c | 179 
helper/include/odp/helper/hash_fbk.h | 404
+++
  2 files changed, 583 insertions(+)
  create mode 100644 helper/hash_fbk.c
  create mode 100644
helper/include/odp/helper/hash_fbk.h

diff --git a/helper/hash_fbk.c
b/helper/hash_fbk.c
new file mode 100644
index 000..eae7596
--- /dev/null
+++ b/helper/hash_fbk.c
@@ -0,0 +1,179 @@
+/**
+ *   BSD LICENSE
+ *
+ *  Copyright(c) 2010-2014 Intel
Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *  Redistribution and use in source and
binary forms, with or without
+ *  modification, are permitted provided
that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code
must retain the above copyright
+ *  notice, this list of conditions and
the following disclaimer.
+ * * Redistributions in binary form
must reproduce the above copyright
+ *  notice, this list of conditions and
the following 

Re: [lng-odp] Using config.h

2015-10-09 Thread Nicolas Morey-Chaisemartin


On 09/01/2015 02:23 PM, Maxim Uvarov wrote:
> On 09/01/15 15:07, Nicolas Morey-Chaisemartin wrote:
>>
>> On 09/01/2015 12:39 PM, Maxim Uvarov wrote:
>>> On 09/01/15 11:45, Nicolas Morey-Chaisemartin wrote:
 Hi,

 I'm having a small issue with the performance/scheduler test. It requires 
 clock_gettime which is not necessary available on every platform 
 (including some of our compilation modes).
 The config.h file generated by configure contains a define 
 HAVE_CLOCK_GETTIME which could be used. But it doesn't seem any file is 
 currently depending on this one and I'm not sure what the proper way to 
 include it would be.

 Any insight on this?

 Nicolas
>>> For linux-generic it will be nice to have something runnable on every 
>>> platform. What alternative is? gettimeofday() ?
>>>
>>> Maxim.
>>>
>> I agree. This test actually only display the difference between odp_cycle 
>> counters and the clock_gettime.
>> It is not really needed for the test !
>> Couldn't we split this in two ?
>>
>> Still it would be nice to be able to use the config.h file.
>> Things like this:
>>  if (appl_args->interval <= 200 && geteuid() != 0) {
>>  EXAMPLE_ERR("should be root user\n");
>>  exit(EXIT_FAILURE);
>>  }
>> are very Linux oriented and just adding a ifdef around is probably enough.
>>
>> Nicolas
> geteuid() migth not work on bare metal. For pktio we check for root in bash 
> script. But in fact yes some pktio (raw sockets) need root permissions. I 
> think geteuid() can
> be inside linux-generic pktio code, under .init. For other apis somewhere 
> also under implementation init.
>
> Maxim.
>
>

init isn't a good place because it will also be called during make check and 
all runs using only loop interfaces.
open might be a better place, but I don't think it is even necessary.
If the user is not root (or does not have the raw net something capabilities), 
the socket creating will fail with an errno that should be helpful enough for 
the user.

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


[lng-odp] [API-NEXT PATCHv4 0/4] api: packet reference count support

2015-10-09 Thread Maxim Uvarov
v4: remove following checks from test case:
/* Handles should be different */
CU_ASSERT(pkt != pkt_ref);
/* Debug print also should have refcount bits */
CU_ASSERT(odp_packet_to_u64(pkt) !=
  odp_packet_to_u64(pkt_ref));

v3:
In linux-generic implementation:
- ref counters bit uses to create reference packet handle;

Maxim Uvarov (4):
  api: packet reference count support
  linux-generic: packet reference count support
  linix-generic: _odp_pri account 64 bits
  validation: packet: test packet reference count

 include/odp/api/config.h   |  5 ++
 include/odp/api/packet.h   |  9 +++
 .../linux-generic/include/odp/plat/strong_types.h  |  2 +-
 .../linux-generic/include/odp_buffer_internal.h|  8 ++-
 .../linux-generic/include/odp_packet_internal.h| 18 ++
 platform/linux-generic/odp_packet.c| 65 --
 test/validation/packet/packet.c| 31 +++
 test/validation/packet/packet.h|  1 +
 8 files changed, 132 insertions(+), 7 deletions(-)

-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv4 1/4] api: packet reference count support

2015-10-09 Thread Maxim Uvarov
Add api for packet reference count support. Which is useful in case:
 - multicast support
 - TCP retransmission
 - traffic generator

Introduced new call: newpkt = odp_packet_create_ref(pkt) which creates
reference to original packet, but handles for reference packet and original
are different.

Signed-off-by: Maxim Uvarov 
---
 include/odp/api/config.h | 5 +
 include/odp/api/packet.h | 9 +
 2 files changed, 14 insertions(+)

diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index 295b10d..985290a 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -126,6 +126,11 @@ extern "C" {
  */
 #define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
 
+/**
+ * Maximum packet references.
+ */
+#define ODP_CONFIG_PACKET_REFS 2
+
 /** Maximum number of shared memory blocks.
  *
  * This the the number of separate SHM areas that can be reserved concurrently
diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 5d46b7b..f9745fb 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -125,6 +125,15 @@ odp_packet_t odp_packet_from_event(odp_event_t ev);
  */
 odp_event_t odp_packet_to_event(odp_packet_t pkt);
 
+/**
+ * Create reference for packet handle
+ *
+ * @param pkt  Packet handle
+ *
+ * @return New packet handle
+ */
+odp_packet_t odp_packet_create_ref(odp_packet_t pkt);
+
 /*
  *
  * Pointers and lengths
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv4 2/4] linux-generic: packet reference count support

2015-10-09 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 .../linux-generic/include/odp_buffer_internal.h|  8 ++-
 .../linux-generic/include/odp_packet_internal.h| 18 ++
 platform/linux-generic/odp_packet.c| 65 --
 3 files changed, 85 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index 7f3fa1c..8416113 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -66,7 +66,11 @@ _ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX %
 
 #define ODP_BUFFER_POOL_BITS   ODP_BITSIZE(ODP_CONFIG_POOLS)
 #define ODP_BUFFER_SEG_BITSODP_BITSIZE(ODP_BUFFER_MAX_SEG)
-#define ODP_BUFFER_INDEX_BITS  (32 - ODP_BUFFER_POOL_BITS - 
ODP_BUFFER_SEG_BITS)
+#define ODP_PACKET_REFS_BITS  ODP_BITSIZE(ODP_CONFIG_PACKET_REFS)
+
+#define ODP_BUFFER_INDEX_BITS  (32 - ODP_BUFFER_POOL_BITS - \
+ODP_BUFFER_SEG_BITS - \
+ODP_PACKET_REFS_BITS)
 #define ODP_BUFFER_PREFIX_BITS (ODP_BUFFER_POOL_BITS + ODP_BUFFER_INDEX_BITS)
 #define ODP_BUFFER_MAX_POOLS   (1 << ODP_BUFFER_POOL_BITS)
 #define ODP_BUFFER_MAX_BUFFERS (1 << ODP_BUFFER_INDEX_BITS)
@@ -80,6 +84,7 @@ typedef union odp_buffer_bits_t {
uint32_t u32;
struct {
 #if ODP_BYTE_ORDER == ODP_BIG_ENDIAN
+   uint32_t ref:ODP_PACKET_REFS_BITS;
uint32_t pool_id:ODP_BUFFER_POOL_BITS;
uint32_t index:ODP_BUFFER_INDEX_BITS;
uint32_t seg:ODP_BUFFER_SEG_BITS;
@@ -87,6 +92,7 @@ typedef union odp_buffer_bits_t {
uint32_t seg:ODP_BUFFER_SEG_BITS;
uint32_t index:ODP_BUFFER_INDEX_BITS;
uint32_t pool_id:ODP_BUFFER_POOL_BITS;
+   uint32_t ref:ODP_PACKET_REFS_BITS;
 #endif
};
 
diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index ba2cd7e..2d6b58f 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -272,12 +272,30 @@ odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl);
 
 int _odp_packet_parse(odp_packet_hdr_t *pkt_hdr);
 
+void _odp_packet_init(odp_packet_t pkt);
+void _odp_packet_get(odp_packet_t pkt);
+uint32_t _odp_packet_put(odp_packet_t pkt);
+
 /* Convert a packet handle to a buffer handle */
 odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt);
 
 /* Convert a buffer handle to a packet handle */
 odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf);
 
+/*  Internal debug function to check if packet has references
+ *
+ * @param pkt  Packet handle
+ * @retval 0   Packet does not have references
+ * @retval 1   Packet has references
+*/
+static inline int _odp_packet_refcheck(odp_packet_t pkt)
+{
+   odp_buffer_t buf = _odp_packet_to_buffer(pkt);
+   odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
+
+   return odp_atomic_load_u32(>ref_count) - 1;
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 209a6e6..f6c5509 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -28,28 +28,34 @@
 odp_packet_t odp_packet_alloc(odp_pool_t pool_hdl, uint32_t len)
 {
pool_entry_t *pool = odp_pool_to_entry(pool_hdl);
+   odp_packet_t pkt = ODP_PACKET_INVALID;
 
if (pool->s.params.type != ODP_POOL_PACKET)
return ODP_PACKET_INVALID;
 
/* Handle special case for zero-length packets */
if (len == 0) {
-   odp_packet_t pkt =
+   pkt =
(odp_packet_t)buffer_alloc(pool_hdl,
   pool->s.params.buf.size);
-   if (pkt != ODP_PACKET_INVALID)
+   if (pkt != ODP_PACKET_INVALID) {
pull_tail(odp_packet_hdr(pkt),
  pool->s.params.buf.size);
-
+   _odp_packet_init(pkt);
+   }
return pkt;
}
 
-   return (odp_packet_t)buffer_alloc(pool_hdl, len);
+   pkt = (odp_packet_t)buffer_alloc(pool_hdl, len);
+   if (pkt != ODP_PACKET_INVALID)
+   _odp_packet_init(pkt);
+   return pkt;
 }
 
 void odp_packet_free(odp_packet_t pkt)
 {
-   odp_buffer_free((odp_buffer_t)pkt);
+   if (!_odp_packet_put(pkt))
+   odp_buffer_free((odp_buffer_t)pkt);
 }
 
 int odp_packet_reset(odp_packet_t pkt, uint32_t len)
@@ -85,6 +91,46 @@ odp_event_t odp_packet_to_event(odp_packet_t pkt)
return (odp_event_t)pkt;
 }
 
+void _odp_packet_init(odp_packet_t pkt)
+{
+   odp_buffer_t buf = _odp_packet_to_buffer(pkt);
+   odp_buffer_hdr_t 

[lng-odp] [API-NEXT PATCHv4 3/4] linix-generic: _odp_pri account 64 bits

2015-10-09 Thread Maxim Uvarov
_odp_pri returns uint64_t value but actually accounts only 32 bit.
In my case that lead to return the same value for printed packets
with additional handle bits.

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/include/odp/plat/strong_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp/plat/strong_types.h 
b/platform/linux-generic/include/odp/plat/strong_types.h
index a53d763..843e2d2 100644
--- a/platform/linux-generic/include/odp/plat/strong_types.h
+++ b/platform/linux-generic/include/odp/plat/strong_types.h
@@ -25,7 +25,7 @@
 #endif
 
 /** Internal macro to get value of an ODP handle */
-#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
+#define _odp_typeval(handle) ((uint64_t)(uintptr_t)(handle))
 
 /** Internal macro to get printable value of an ODP handle */
 #define _odp_pri(handle) ((uint64_t)_odp_typeval(handle))
-- 
1.9.1

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


[lng-odp] [PATCH 2/2] linux-generic: netmap: sync tx queues

2015-10-09 Thread Matias Elo
Sync tx queues to recover from overload. Previously send
could get permanently stuck here.

Signed-off-by: Matias Elo 
---
 platform/linux-generic/pktio/netmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 19dc697..ab4667e 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -240,8 +240,10 @@ static int netmap_send(pktio_entry_t *pktio_entry, 
odp_packet_t pkt_table[],
else
break;
}
-   if (odp_unlikely(i == NM_INJECT_RETRIES))
+   if (odp_unlikely(i == NM_INJECT_RETRIES)) {
+   ioctl(nm_desc->fd, NIOCTXSYNC, NULL);
break;
+   }
}
for (i = 0; i < nb_tx; i++)
odp_packet_free(pkt_table[i]);
-- 
1.9.1

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


Re: [lng-odp] [API-NEXT PATCHv4 1/4] api: packet reference count support

2015-10-09 Thread Nicolas Morey-Chaisemartin


On 10/09/2015 02:59 PM, Maxim Uvarov wrote:
> Add api for packet reference count support. Which is useful in case:
>  - multicast support
>  - TCP retransmission
>  - traffic generator
>
> Introduced new call: newpkt = odp_packet_create_ref(pkt) which creates
> reference to original packet, but handles for reference packet and original
> are different.
"May" be different  more than "are". But not a big deal as only in the commit 
message.

>
> Signed-off-by: Maxim Uvarov 
> ---
>  include/odp/api/config.h | 5 +
>  include/odp/api/packet.h | 9 +
>  2 files changed, 14 insertions(+)
>
> diff --git a/include/odp/api/config.h b/include/odp/api/config.h
> index 295b10d..985290a 100644
> --- a/include/odp/api/config.h
> +++ b/include/odp/api/config.h
> @@ -126,6 +126,11 @@ extern "C" {
>   */
>  #define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
>  
> +/**
> + * Maximum packet references.
> + */
> +#define ODP_CONFIG_PACKET_REFS 2
> +
>  /** Maximum number of shared memory blocks.
>   *
>   * This the the number of separate SHM areas that can be reserved 
> concurrently
> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> index 5d46b7b..f9745fb 100644
> --- a/include/odp/api/packet.h
> +++ b/include/odp/api/packet.h
> @@ -125,6 +125,15 @@ odp_packet_t odp_packet_from_event(odp_event_t ev);
>   */
>  odp_event_t odp_packet_to_event(odp_packet_t pkt);
>  
> +/**
> + * Create reference for packet handle
> + *
> + * @param pkt  Packet handle
> + *
> + * @return New packet handle
> + */
> +odp_packet_t odp_packet_create_ref(odp_packet_t pkt);
> +
>  /*
>   *
>   * Pointers and lengths

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


[lng-odp] [PATCH] configure: move all AM_CONDITIONAL to configure.ac

2015-10-09 Thread Nicolas Morey-Chaisemartin

Platform specific m4 files cannot define AM_CONDITIONAL.
Even if not used outside of the platform specific file, configure will
exit with an error if another platform does not set this conditional:

  configure: error: conditional "netmap_support" was never defined.
  Usually this means the macro was only invoked conditionally.

Solve this by setting a default status do disabled/no at the top configure,
which can be overridden by the platform m4 files. And then set the
AM_CONDITIONAl in the top configure.ac for every platform to see.

Signed-off-by: Nicolas Morey-Chaisemartin 
---
 configure.ac| 14 ++
 platform/linux-generic/m4/odp_netmap.m4 |  3 ---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 92f9d39..5d84f92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,14 @@ AC_SUBST([with_platform])
 AC_SUBST([platform_with_platform], ["platform/${with_platform}"])
 AC_SUBST([platform_with_platform_test], ["platform/${with_platform}/test"])
 
+##
+# Prepare default values for platform specific optional features
+##
+netmap_support=no
+
+##
+# Run platform specific checks and settings
+##
 if test "${with_platform}" == "linux-generic";
 then
 m4_include([./platform/linux-generic/m4/configure.m4])
@@ -88,6 +96,12 @@ else
 exit 1
 fi
 
+##
+# Set conditionals as computed within platform specific files
+##
+AM_CONDITIONAL([netmap_support], [test x$netmap_support = xyes ])
+
+
 AC_ARG_WITH([sdk-install-path],
 AC_HELP_STRING([--with-sdk-install-path=DIR path to external libs and headers],
  [(or in the default path if not specified).]),
diff --git a/platform/linux-generic/m4/odp_netmap.m4 
b/platform/linux-generic/m4/odp_netmap.m4
index 02cd3d3..72c3fab 100644
--- a/platform/linux-generic/m4/odp_netmap.m4
+++ b/platform/linux-generic/m4/odp_netmap.m4
@@ -1,7 +1,6 @@
 ##
 # Enable netmap support
 ##
-netmap_support=no
 AC_ARG_ENABLE([netmap_support],
 [  --enable-netmap-support  include netmap IO support],
 [if test x$enableval = xyes; then
@@ -36,8 +35,6 @@ else
 netmap_support=no
 fi
 
-AM_CONDITIONAL([netmap_support], [test x$netmap_support = xyes ])
-
 # Disable cast errors until the problem in netmap_user.h is fixed upstream
 if test x$netmap_support = xyes
 then
-- 
2.6.1.3.g8d02103

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


[lng-odp] [API-NEXT PATCHv4 4/4] validation: packet: test packet reference count

2015-10-09 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 test/validation/packet/packet.c | 31 +++
 test/validation/packet/packet.h |  1 +
 2 files changed, 32 insertions(+)

diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c
index 0c749c3..384125f 100644
--- a/test/validation/packet/packet.c
+++ b/test/validation/packet/packet.c
@@ -778,6 +778,36 @@ void packet_test_offset(void)
CU_ASSERT_PTR_NOT_NULL(ptr);
 }
 
+void packet_test_ref(void)
+{
+   odp_packet_t pkt = test_packet;
+   odp_packet_t pkt_ref;
+   uint32_t pkt_len = odp_packet_len(pkt);
+   uint8_t *data_buf1;
+   uint8_t *data_buf2;
+
+   data_buf1 = malloc(pkt_len);
+   CU_ASSERT_PTR_NOT_NULL_FATAL(data_buf1);
+   data_buf2 = malloc(pkt_len);
+   CU_ASSERT_PTR_NOT_NULL_FATAL(data_buf2);
+
+   pkt_ref = odp_packet_create_ref(pkt);
+
+   /* Check that packet data is the same for pkt and pkt_ref */
+   CU_ASSERT(!odp_packet_copydata_out(pkt, 0, pkt_len, data_buf1));
+   CU_ASSERT(!odp_packet_copydata_out(pkt_ref, 0, pkt_len, data_buf2));
+   CU_ASSERT(!memcmp(data_buf1, data_buf2, pkt_len));
+
+   odp_packet_free(pkt_ref);
+
+   /* Check original packet data after free reference. */
+   CU_ASSERT(!odp_packet_copydata_out(pkt, 0, pkt_len, data_buf2));
+   CU_ASSERT(!memcmp(data_buf1, data_buf2, pkt_len));
+
+   free(data_buf1);
+   free(data_buf2);
+}
+
 CU_TestInfo packet_suite[] = {
_CU_TEST_INFO(packet_test_alloc_free),
_CU_TEST_INFO(packet_test_alloc_segmented),
@@ -797,6 +827,7 @@ CU_TestInfo packet_suite[] = {
_CU_TEST_INFO(packet_test_copy),
_CU_TEST_INFO(packet_test_copydata),
_CU_TEST_INFO(packet_test_offset),
+   _CU_TEST_INFO(packet_test_ref),
CU_TEST_INFO_NULL,
 };
 
diff --git a/test/validation/packet/packet.h b/test/validation/packet/packet.h
index f8a16a8..d1feff8 100644
--- a/test/validation/packet/packet.h
+++ b/test/validation/packet/packet.h
@@ -28,6 +28,7 @@ void packet_test_add_rem_data(void);
 void packet_test_copy(void);
 void packet_test_copydata(void);
 void packet_test_offset(void);
+void packet_test_ref(void);
 
 /* test arrays: */
 extern CU_TestInfo packet_suite[];
-- 
1.9.1

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


[lng-odp] [PATCH 1/2] linux-generic: netmap: use default interface config

2015-10-09 Thread Matias Elo
Don't override interface default configuration options.

Signed-off-by: Matias Elo 
---
 platform/linux-generic/pktio/netmap.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 54e7043..19dc697 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -151,22 +151,10 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
if ((pkt_nm->if_flags & IFF_UP) == 0)
ODP_DBG("%s is down\n", pktio_entry->s.name);
 
-   err = netmap_do_ioctl(pktio_entry, SIOCETHTOOL, ETHTOOL_SGSO);
-   if (err)
-   ODP_DBG("ETHTOOL_SGSO not supported\n");
-
-   err = netmap_do_ioctl(pktio_entry, SIOCETHTOOL, ETHTOOL_STSO);
-   if (err)
-   ODP_DBG("ETHTOOL_STSO not supported\n");
-
err = mac_addr_get_fd(sockfd, netdev, pkt_nm->if_mac);
if (err)
goto error;
 
-   err = netmap_do_ioctl(pktio_entry, SIOCETHTOOL, ETHTOOL_STXCSUM);
-   if (err)
-   ODP_DBG("ETHTOOL_STXCSUM not supported\n");
-
return 0;
 
 error:
-- 
1.9.1

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