[lng-odp] dpdk 17.08 backward compatibility issues with odp crypto

2017-11-28 Thread Krishna Garapati
Hi,

I am working on moving odp-dpdk from dpdk 17.02 to 17.08. But due to
updates in dpdk crypto which are not backward compatible, makes it
difficult to implement changes in odp-dpdk. One major update is moving
"AES_GCM & AES_CCM" algorithms to a separate enum called
"rte_crypto_aead_algorithm". This means dpdk now has three enums  auth,
cipher & aead. They each have separate crypto_xforms in terms of getting
capability params & their validation. From ODP crypto api perspective,
AES_GCM & AES_CCM are still part of both cipher_alogos & auth_algos.
Complexity arises when application asks for,

- capability for cipher & auth, implementation first needs to convert
cipher_algos to rte_cipher_algo or rte_aead_algo and set the cipher_xform
or aead_xform before asking dpdk for capability and map those capabilities
to odp_crypto_cipher_capability_t array. Same goes with Auth_algo. This
makes the implementation logic be unreadable.

- In 17.08 dpdk also supports cipher only, auth only. So when mixing this
feature with algos conversion also introduces complexity.

- getting the device based on cipher, auth, aead algos. In 17.08 dpdk
facilitates api's for respective crypto_xform for capability verification.
Currently when application wants to create a session, implementations
fetches the device that suits to the params sent in odp_session_params. So
when try to cross verify the params with corresponding crypto algo,
Implementation again does the conversion and set the right transform and
probe the corresponding crypto api.

I am starting this thread to see if it would be feasible to change the
crypto api in order to make the odp & implementation be more compatible
with dpdk and make use of all the new api's that were introduced in the
newer dpdk versions.

/Krishna


Re: [lng-odp] [PATCH 7/7] linux-gen: dpdk: enable zero-copy operation

2017-07-11 Thread Krishna Garapati
On 10 July 2017 at 15:11, Elo, Matias (Nokia - FI/Espoo) <
matias@nokia.com> wrote:

>
> > On 10 Jul 2017, at 12:17, Krishna Garapati <balakrishna.garapati@linaro.
> org> wrote:
> >
> >
> >
> > On 10 July 2017 at 10:13, Elo, Matias (Nokia - FI/Espoo) <
> matias@nokia.com> wrote:
> >
> > > +   pkt_pool = mbuf_pool_create(pkt_dpdk->
> pool_name,
> > > +   pool_entry->num,
> cache,
> > > +
>  pool_entry->max_seg_len +
> > > +
>  CONFIG_PACKET_HEADROOM,
> > > +   pkt_dpdk);
> > > instead of passing the whole pkt_dpdk struct, can you just pass
> odp_pool_t & calculate just data_room in the dequeue_bulk ?. This way the
> pool configuration will be more clearer & less dependent on pkt_dpdk.
> > >
> >
> > The value of 'data_room' is constant, so it doesn't make sense to
> recalculate it in the fast path every time pool_dequeue_bulk() is called.
> mbuf_pool_create() is only used by the dpdk pktio, so the dependency is not
> a problem.
> > I was actually referring to storing whole pkt_dpdk_t in to the
> "rte_mempool_set_ops_byname".
> > I see that it would be clear if we  just store odp_pool_t & store or
> calculate the data_room part some other means. I agree that it's not good
> to calculate data_room in the fast path.
> >
>
> Using odp_pool_t as the only argument would indeed be clearer. The
> problems is that the only way to pass arguments to pool_dequeue_bulk() is
> though rte_mempool struct and storing the 'data_room' there would not be
> any better.
>
> I originally intended to keep the mbuf_pool_create() arguments as close as
> possible to the rte_pktmbuf_pool_create() function but one option would be
> to change mbuf_pool_create() to use pool_entry* as argument.
>
> -> static struct rte_mempool *mbuf_pool_create(const char *name, pool_t
> *pool_entry)
>
> --> rte_mempool.pool_data = odp_pool_t
> --> rte_mempool.pool_config = pool_entry *
>
This change looks good to me.

/Krishna

>
>
>
> -Matias
>
>


Re: [lng-odp] [PATCH 7/7] linux-gen: dpdk: enable zero-copy operation

2017-07-10 Thread Krishna Garapati
On 10 July 2017 at 10:13, Elo, Matias (Nokia - FI/Espoo) <
matias@nokia.com> wrote:

>
> > +   pkt_pool = mbuf_pool_create(pkt_dpdk->pool_name,
> > +   pool_entry->num,
> cache,
> > +
>  pool_entry->max_seg_len +
> > +
>  CONFIG_PACKET_HEADROOM,
> > +   pkt_dpdk);
> > instead of passing the whole pkt_dpdk struct, can you just pass
> odp_pool_t & calculate just data_room in the dequeue_bulk ?. This way the
> pool configuration will be more clearer & less dependent on pkt_dpdk.
> >
>
> The value of 'data_room' is constant, so it doesn't make sense to
> recalculate it in the fast path every time pool_dequeue_bulk() is called.
> mbuf_pool_create() is only used by the dpdk pktio, so the dependency is not
> a problem.

I was actually referring to storing whole pkt_dpdk_t in to the
"rte_mempool_set_ops_byname". I see that it would be clear if we  just
store odp_pool_t & store or calculate the data_room part some other means.
I agree that it's not good to calculate data_room in the fast path.

/Krishna

>
> -Matias
>
>


Re: [lng-odp] [PATCH 7/7] linux-gen: dpdk: enable zero-copy operation

2017-07-07 Thread Krishna Garapati
On 3 July 2017 at 14:01, Matias Elo  wrote:

> Implements experimental zero-copy mode for DPDK pktio. This can be enabled
> with additional '--enable-dpdk-zero-copy' configure flag.
>
> This feature has been put behind an extra configure flag as it doesn't
> entirely adhere to the DPDK API and may behave unexpectedly with untested
> DPDK NIC drivers. Zero-copy operation has been tested with pcap, ixgbe, and
> i40e drivers.
>
> Signed-off-by: Matias Elo 
> ---
>  .../linux-generic/include/odp_buffer_internal.h|   2 +-
>  .../linux-generic/include/odp_packet_internal.h|  13 +
>  platform/linux-generic/include/odp_pool_internal.h |   4 +
>  platform/linux-generic/m4/odp_dpdk.m4  |  14 +-
>  platform/linux-generic/odp_pool.c  |   2 +
>  platform/linux-generic/pktio/dpdk.c| 676
> -
>  6 files changed, 562 insertions(+), 149 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_buffer_internal.h
> b/platform/linux-generic/include/odp_buffer_internal.h
> index 076abe9..78ea527 100644
> --- a/platform/linux-generic/include/odp_buffer_internal.h
> +++ b/platform/linux-generic/include/odp_buffer_internal.h
> @@ -109,7 +109,7 @@ struct odp_buffer_hdr_t {
>
> /* Data or next header */
> uint8_t data[0];
> -};
> +} ODP_ALIGNED_CACHE;
>
>  ODP_STATIC_ASSERT(CONFIG_PACKET_MAX_SEGS < 256,
>   "CONFIG_PACKET_MAX_SEGS_TOO_LARGE");
> diff --git a/platform/linux-generic/include/odp_packet_internal.h
> b/platform/linux-generic/include/odp_packet_internal.h
> index 11f2fdc..78569b6 100644
> --- a/platform/linux-generic/include/odp_packet_internal.h
> +++ b/platform/linux-generic/include/odp_packet_internal.h
> @@ -92,6 +92,12 @@ typedef struct {
> uint32_t l4_offset; /**< offset to L4 hdr (TCP, UDP, SCTP, also
> ICMP) */
>  } packet_parser_t;
>
> +/* Packet extra data length */
> +#define PKT_EXTRA_LEN 128
> +
> +/* Packet extra data types */
> +#define PKT_EXTRA_TYPE_DPDK 1
> +
>  /**
>   * Internal Packet header
>   *
> @@ -131,6 +137,13 @@ typedef struct {
> /* Result for crypto */
> odp_crypto_generic_op_result_t op_result;
>
> +#ifdef ODP_PKTIO_DPDK
> +   /* Type of extra data */
> +   uint8_t extra_type;
> +   /* Extra space for packet descriptors. E.g. DPDK mbuf  */
> +   uint8_t extra[PKT_EXTRA_LEN] ODP_ALIGNED_CACHE;
> +#endif
> +
> /* Packet data storage */
> uint8_t data[0];
>  } odp_packet_hdr_t;
> diff --git a/platform/linux-generic/include/odp_pool_internal.h
> b/platform/linux-generic/include/odp_pool_internal.h
> index ebb779d..acea079 100644
> --- a/platform/linux-generic/include/odp_pool_internal.h
> +++ b/platform/linux-generic/include/odp_pool_internal.h
> @@ -68,6 +68,10 @@ typedef struct pool_t {
> uint8_t *base_addr;
> uint8_t *uarea_base_addr;
>
> +   /* Used by DPDK zero-copy pktio */
> +   void*ext_desc;
> +   uint16_t ext_ref_count;
> +
> pool_cache_t local_cache[ODP_THREAD_COUNT_MAX];
>
> odp_shm_tring_shm;
> diff --git a/platform/linux-generic/m4/odp_dpdk.m4
> b/platform/linux-generic/m4/odp_dpdk.m4
> index 58d1472..edcc4c8 100644
> --- a/platform/linux-generic/m4/odp_dpdk.m4
> +++ b/platform/linux-generic/m4/odp_dpdk.m4
> @@ -9,6 +9,16 @@ AC_HELP_STRING([--with-dpdk-path=DIR   path to dpdk
> build directory]),
>  pktio_dpdk_support=yes],[])
>
>  
> ##
> +# Enable zero-copy DPDK pktio
> +###
> ###
> +zero_copy=0
> +AC_ARG_ENABLE([dpdk-zero-copy],
> +[  --enable-dpdk-zero-copy  enable experimental zero-copy DPDK pktio
> mode],
> +[if test x$enableval = xyes; then
> +zero_copy=1
> +fi])
> +
> +###
> ###
>  # Save and set temporary compilation flags
>  
> ##
>  OLD_CPPFLAGS=$CPPFLAGS
> @@ -38,9 +48,9 @@ then
>  done
>  DPDK_PMD+=--no-whole-archive
>
> -ODP_CFLAGS="$ODP_CFLAGS -DODP_PKTIO_DPDK"
> +ODP_CFLAGS="$ODP_CFLAGS -DODP_PKTIO_DPDK -DODP_DPDK_ZERO_COPY=$zero_
> copy"
>  AM_LDFLAGS="$AM_LDFLAGS -L$DPDK_PATH/lib -Wl,$DPDK_PMD"
> -LIBS="$LIBS -ldpdk -ldl -lpcap"
> +LIBS="$LIBS -ldpdk -ldl -lpcap -lm"
>  else
>  pktio_dpdk_support=no
>  fi
> diff --git a/platform/linux-generic/odp_pool.c
> b/platform/linux-generic/odp_pool.c
> index 5360b94..8a27c8a 100644
> --- a/platform/linux-generic/odp_pool.c
> +++ b/platform/linux-generic/odp_pool.c
> @@ -395,6 +395,8 @@ static odp_pool_t pool_create(const char *name,
> odp_pool_param_t *params,
> pool->uarea_size = uarea_size;
> pool->shm_size   = num * block_size;
> pool->uarea_shm_size = num * 

[lng-odp] discussion thread on pool create & rte_mbuf support in odp-cloud

2017-05-23 Thread Krishna Garapati
Fallowing are the open issues that requires discussion in odp-cloud
implementation,

- Currently in odp, pkt pool creation has no knowledge of pktio type as it
would need in case of odp-cloud if it wants to use the platform specific
API's (ex: dpdk) to create the pool through DDF (Driver framework).

- Also, weather odp-cloud runs with dpdk or not, odp library by default all
ways needs to link against dpdk as odp-cloud implementation may require to
include rte_mbuf in order to support dpdk.


/Krishna


Re: [lng-odp] [API-NEXT PATCHv3] api: crypto: change iv_len field to feature min-max len

2017-05-18 Thread Krishna Garapati
On 17 May 2017 at 22:29, Dmitry Eremin-Solenikov <
dmitry.ereminsoleni...@linaro.org> wrote:

> Balakrishna,
>
> On 17.05.2017 13:49, Balakrishna Garapati wrote:
> > dpdk pmd's require to minatain min, max, inc fields for all
> > crypto capabilitites. By making iv_len to feature like dpdk pmd's
> > it is easier to create cipher entires in odp based on key_len.
>
> Unless you'd like to express something more comlex than
> { .key_len = 128, .iv_len = 8 },
> { .key_len = 128, .iv_len = 12 },
> { .key_len = 192, .iv_len = 8 },
> { .key_len = 192, .iv_len = 12 },
> { .key_len = 256, .iv_len = 8 },
> { .key_len = 256, .iv_len = 12 },
>
> your suggestion adds more complexity.
>
instead of duplicating key_len's for different iv's I like to make a key
based array where the no.of entries can be limited by key_len index and
also limit the need to validate key_len for each entry.

>
> > Signed-off-by: Balakrishna Garapati 
> > ---
> >  since v1: fixed comments from v1,
> >- updated the description about the patch
> >- Fixed the bug in crypto validation
> >  since v2: if statement correction in validation "check_cipher_options"
> >
> >  include/odp/api/spec/crypto.h  | 12 +++-
> >  platform/linux-generic/odp_crypto.c|  8 +--
> >  .../validation/api/crypto/odp_crypto_test_inp.c| 81
> ++
> >  3 files changed, 37 insertions(+), 64 deletions(-)
> >
> > diff --git a/include/odp/api/spec/crypto.h
> b/include/odp/api/spec/crypto.h
> > index c47d314..a1b540a 100644
> > --- a/include/odp/api/spec/crypto.h
> > +++ b/include/odp/api/spec/crypto.h
> > @@ -497,7 +497,17 @@ typedef struct odp_crypto_cipher_capability_t {
> >   uint32_t key_len;
> >
> >   /** IV length in bytes */
> > - uint32_t iv_len;
> > + struct {
> > + /** Minimum iv length in bytes */
> > + uint32_t min;
> > +
> > + /** Maximum iv length in bytes */
> > + uint32_t max;
> > +
> > + /** Increment of supported lengths between min and max
> > +  *  (in bytes) */
> > + uint32_t inc;
> > + } iv_len;
> >
> >  } odp_crypto_cipher_capability_t;
> >
> > diff --git a/platform/linux-generic/odp_crypto.c
> b/platform/linux-generic/odp_crypto.c
> > index a0f3f7e..3e9b607 100644
> > --- a/platform/linux-generic/odp_crypto.c
> > +++ b/platform/linux-generic/odp_crypto.c
> > @@ -35,16 +35,16 @@
> >   * Keep sorted: first by key length, then by IV length
> >   */
> >  static const odp_crypto_cipher_capability_t cipher_capa_des[] = {
> > -{.key_len = 24, .iv_len = 8} };
> > +{.key_len = 24, .iv_len = {.min = 8, .max = 8, .inc = 0} } };
> >
> >  static const odp_crypto_cipher_capability_t cipher_capa_trides_cbc[] = {
> > -{.key_len = 24, .iv_len = 8} };
> > +{.key_len = 24, .iv_len = {.min = 8, .max = 8, .inc = 0} } };
> >
> >  static const odp_crypto_cipher_capability_t cipher_capa_aes_cbc[] = {
> > -{.key_len = 16, .iv_len = 16} };
> > +{.key_len = 16, .iv_len = {.min = 16, .max = 16, .inc = 0} } };
> >
> >  static const odp_crypto_cipher_capability_t cipher_capa_aes_gcm[] = {
> > -{.key_len = 16, .iv_len = 12} };
> > +{.key_len = 16, .iv_len = {.min = 12, .max = 12, .inc = 0} } };
> >
> >  /*
> >   * Authentication algorithm capabilities
> > diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> > index 24ea493..0f98fe5 100644
> > --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> > +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> > @@ -93,10 +93,6 @@ static void alg_test(odp_crypto_op_t op,
> >   odp_crypto_op_param_t op_params;
> >   uint8_t *data_addr;
> >   int data_off;
> > - odp_crypto_cipher_capability_t cipher_capa[MAX_ALG_CAPA];
> > - odp_crypto_auth_capability_t   auth_capa[MAX_ALG_CAPA];
> > - int num, i;
> > - int found;
> >
> >   rc = odp_crypto_capability();
> >   CU_ASSERT(!rc);
> > @@ -136,59 +132,6 @@ static void alg_test(odp_crypto_op_t op,
> >   CU_ASSERT(!rc);
> >   CU_ASSERT((~capa.auths.all_bits & capa.hw_auths.all_bits) == 0);
> >
> > - num = odp_crypto_cipher_capability(cipher_alg, cipher_capa,
> > -MAX_ALG_CAPA);
> > -
> > - if (cipher_alg != ODP_CIPHER_ALG_NULL) {
> > - CU_ASSERT(num > 0);
> > - found = 0;
> > - } else {
> > - CU_ASSERT(num == 0);
> > - found = 1;
> > - }
> > -
> > - CU_ASSERT(num <= MAX_ALG_CAPA);
> > -
> > - if (num > MAX_ALG_CAPA)
> > - num = MAX_ALG_CAPA;
> > -
> > - /* Search for the test case */
> > - for (i = 0; i < num; i++) {
> > - if (cipher_capa[i].key_len == cipher_key.length &&
> > - cipher_capa[i].iv_len  == ses_iv.length) {
> > - found = 1;
> > - 

Re: [lng-odp] [API-NEXT PATCH] api: crypto: change iv_len field to feature min-max len

2017-05-17 Thread Krishna Garapati
On 16 May 2017 at 17:46, Dmitry Eremin-Solenikov <
dmitry.ereminsoleni...@linaro.org> wrote:

> On 16.05.2017 10:43, Krishna Garapati wrote:
> >
> >
> > On 15 May 2017 at 19:38, Dmitry Eremin-Solenikov
> > <dmitry.ereminsoleni...@linaro.org
> > <mailto:dmitry.ereminsoleni...@linaro.org>> wrote:
> >
> > On 15.05.2017 15:42, Balakrishna Garapati wrote:
> > > This change is needed to support dpdk crypto pmd's
> >
> > Could you please be more specific, what are you trying to express. If
> > you need, you can provide several entries, one for each IV len.
> >
> > Yes you can create multiple entries of iv. But the issue comes when you
> > have the varied key_len as well (min, max, inc). So the permutation of
> > creating number of entries will be complex. This patch now can create
> > multiple entries based on key_len. I will send out a new version with
> > clear description.
>
> Just go with multiple entries, that is clearer way compared with iv_inc,
> in my opinion. Could you please be more specific and specify, what would
> be the entries in case of DPDK?

 The entries in DPDK is as mentioned in this patch (min, max, inc) for both
key_len & iv_len. It would be easier and cleaner creating and cross
verifying the entries based on one field ex: key_len.
/Krishna

>
> --
> With best wishes
> Dmitry
>


Re: [lng-odp] [API-NEXT PATCH] api: crypto: change iv_len field to feature min-max len

2017-05-16 Thread Krishna Garapati
On 15 May 2017 at 19:38, Dmitry Eremin-Solenikov <
dmitry.ereminsoleni...@linaro.org> wrote:

> On 15.05.2017 15:42, Balakrishna Garapati wrote:
> > This change is needed to support dpdk crypto pmd's
>
> Could you please be more specific, what are you trying to express. If
> you need, you can provide several entries, one for each IV len.
>
Yes you can create multiple entries of iv. But the issue comes when you
have the varied key_len as well (min, max, inc). So the permutation of
creating number of entries will be complex. This patch now can create
multiple entries based on key_len. I will send out a new version with clear
description.

>
> >
> > Signed-off-by: Balakrishna Garapati 
> > ---
> >  include/odp/api/spec/crypto.h  | 12 +++-
> >  platform/linux-generic/odp_crypto.c|  8 +--
> >  .../validation/api/crypto/odp_crypto_test_inp.c| 76
> +-
> >  3 files changed, 31 insertions(+), 65 deletions(-)
> >
> > diff --git a/include/odp/api/spec/crypto.h
> b/include/odp/api/spec/crypto.h
> > index c47d314..a1b540a 100644
> > --- a/include/odp/api/spec/crypto.h
> > +++ b/include/odp/api/spec/crypto.h
> > @@ -497,7 +497,17 @@ typedef struct odp_crypto_cipher_capability_t {
> >   uint32_t key_len;
> >
> >   /** IV length in bytes */
> > - uint32_t iv_len;
> > + struct {
> > + /** Minimum iv length in bytes */
> > + uint32_t min;
> > +
> > + /** Maximum iv length in bytes */
> > + uint32_t max;
> > +
> > + /** Increment of supported lengths between min and max
> > +  *  (in bytes) */
> > + uint32_t inc;
> > + } iv_len;
> >
> >  } odp_crypto_cipher_capability_t;
> >
> > diff --git a/platform/linux-generic/odp_crypto.c
> b/platform/linux-generic/odp_crypto.c
> > index a0f3f7e..3e9b607 100644
> > --- a/platform/linux-generic/odp_crypto.c
> > +++ b/platform/linux-generic/odp_crypto.c
> > @@ -35,16 +35,16 @@
> >   * Keep sorted: first by key length, then by IV length
> >   */
> >  static const odp_crypto_cipher_capability_t cipher_capa_des[] = {
> > -{.key_len = 24, .iv_len = 8} };
> > +{.key_len = 24, .iv_len = {.min = 8, .max = 8, .inc = 0} } };
> >
> >  static const odp_crypto_cipher_capability_t cipher_capa_trides_cbc[] = {
> > -{.key_len = 24, .iv_len = 8} };
> > +{.key_len = 24, .iv_len = {.min = 8, .max = 8, .inc = 0} } };
> >
> >  static const odp_crypto_cipher_capability_t cipher_capa_aes_cbc[] = {
> > -{.key_len = 16, .iv_len = 16} };
> > +{.key_len = 16, .iv_len = {.min = 16, .max = 16, .inc = 0} } };
> >
> >  static const odp_crypto_cipher_capability_t cipher_capa_aes_gcm[] = {
> > -{.key_len = 16, .iv_len = 12} };
> > +{.key_len = 16, .iv_len = {.min = 12, .max = 12, .inc = 0} } };
> >
> >  /*
> >   * Authentication algorithm capabilities
> > diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> > index 24ea493..628f150 100644
> > --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> > +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> > @@ -93,10 +93,6 @@ static void alg_test(odp_crypto_op_t op,
> >   odp_crypto_op_param_t op_params;
> >   uint8_t *data_addr;
> >   int data_off;
> > - odp_crypto_cipher_capability_t cipher_capa[MAX_ALG_CAPA];
> > - odp_crypto_auth_capability_t   auth_capa[MAX_ALG_CAPA];
> > - int num, i;
> > - int found;
> >
> >   rc = odp_crypto_capability();
> >   CU_ASSERT(!rc);
> > @@ -136,59 +132,6 @@ static void alg_test(odp_crypto_op_t op,
> >   CU_ASSERT(!rc);
> >   CU_ASSERT((~capa.auths.all_bits & capa.hw_auths.all_bits) == 0);
> >
> > - num = odp_crypto_cipher_capability(cipher_alg, cipher_capa,
> > -MAX_ALG_CAPA);
> > -
> > - if (cipher_alg != ODP_CIPHER_ALG_NULL) {
> > - CU_ASSERT(num > 0);
> > - found = 0;
> > - } else {
> > - CU_ASSERT(num == 0);
> > - found = 1;
> > - }
> > -
> > - CU_ASSERT(num <= MAX_ALG_CAPA);
> > -
> > - if (num > MAX_ALG_CAPA)
> > - num = MAX_ALG_CAPA;
> > -
> > - /* Search for the test case */
> > - for (i = 0; i < num; i++) {
> > - if (cipher_capa[i].key_len == cipher_key.length &&
> > - cipher_capa[i].iv_len  == ses_iv.length) {
> > - found = 1;
> > - break;
> > - }
> > - }
> > -
> > - CU_ASSERT(found);
> > -
> > - num = odp_crypto_auth_capability(auth_alg, auth_capa,
> MAX_ALG_CAPA);
> > -
> > - if (auth_alg != ODP_AUTH_ALG_NULL) {
> > - CU_ASSERT(num > 0);
> > - found = 0;
> > - } else {
> > - CU_ASSERT(num == 0);
> > - found = 1;
> > - }
> > -
> > - CU_ASSERT(num <= MAX_ALG_CAPA);
> > -
> > - if (num > 

Re: [lng-odp] [PATCHv2] abi: packet: restore abi compatibility for odp_packet_seg_t type

2017-04-13 Thread Krishna Garapati
Reviewed-by: Balakrishna Garapati <balakrishna.garap...@linaro.org>

/Krishna

On 13 April 2017 at 13:48, Bill Fischofer <bill.fischo...@linaro.org> wrote:

> When running in --enable-abi-compat=yes mode, all ODP types need to be
> of pointer width in the default ABI definition. The optimization of the
> odp_packet_seg_t type to uint8_t can only be supported when running in
> --enable-abi-compate=no mode. Change the ODP packet routines to use
> type converter routines that have varying definitions based on whether
> we're running in ABI compatibility mode and provide these variant
> definitions to enable proper ABI compatibility while still supporting an
> optimized typedef for non-ABI mode.
>
> This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2940
>
> Reported-by: Krishna Garapati <balakrishna.garap...@linaro.org>
> Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org>
> ---
> v2:
> - Incorporate changes suggested by Krishna
> - Added Reported-by attribution
>
>  include/odp/arch/default/api/abi/packet.h   |  7 +--
>  .../include/odp/api/plat/packet_inlines.h   | 21
> ++---
>  .../include/odp/api/plat/packet_types.h | 10 ++
>  platform/linux-generic/odp_packet.c | 12 +++-
>  4 files changed, 40 insertions(+), 10 deletions(-)
>
> diff --git a/include/odp/arch/default/api/abi/packet.h
> b/include/odp/arch/default/api/abi/packet.h
> index 60a41b8..4aac75b 100644
> --- a/include/odp/arch/default/api/abi/packet.h
> +++ b/include/odp/arch/default/api/abi/packet.h
> @@ -16,15 +16,18 @@ extern "C" {
>  /** @internal Dummy type for strong typing */
>  typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_packet_t;
>
> +/** @internal Dummy  type for strong typing */
> +typedef struct { char dummy; /**< *internal Dummy */ }
> _odp_abi_packet_seg_t;
> +
>  /** @ingroup odp_packet
>   *  @{
>   */
>
>  typedef _odp_abi_packet_t *odp_packet_t;
> -typedef uint8_todp_packet_seg_t;
> +typedef _odp_abi_packet_seg_t *odp_packet_seg_t;
>
>  #define ODP_PACKET_INVALID((odp_packet_t)0x)
> -#define ODP_PACKET_SEG_INVALID((odp_packet_seg_t)-1)
> +#define ODP_PACKET_SEG_INVALID((odp_packet_seg_t)0x)
>  #define ODP_PACKET_OFFSET_INVALID (0x0fff)
>
>  typedef enum {
> diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
> b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
> index eb36aa9..3dd643f 100644
> --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
> +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
> @@ -21,6 +21,20 @@
>  /** @internal Inline function offsets */
>  extern const _odp_packet_inline_offset_t _odp_packet_inline;
>
> +#if ODP_ABI_COMPAT == 1
> +/** @internal Inline function @param seg @return */
> +static inline uint32_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
> +{
> +   return _odp_typeval(seg);
> +}
> +
> +/** @internal Inline function @param ndx @return */
> +static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint32_t ndx)
> +{
> +   return _odp_cast_scalar(odp_packet_seg_t, ndx);
> +}
> +#endif
> +
>  /** @internal Inline function @param pkt @return */
>  static inline void *_odp_packet_data(odp_packet_t pkt)
>  {
> @@ -128,20 +142,21 @@ static inline odp_packet_seg_t
> _odp_packet_first_seg(odp_packet_t pkt)
>  {
> (void)pkt;
>
> -   return 0;
> +   return _odp_packet_seg_from_ndx(0);
>  }
>
>  /** @internal Inline function @param pkt @return */
>  static inline odp_packet_seg_t _odp_packet_last_seg(odp_packet_t pkt)
>  {
> -   return _odp_packet_num_segs(pkt) - 1;
> +   return _odp_packet_seg_from_ndx(_odp_packet_num_segs(pkt) - 1);
>  }
>
>  /** @internal Inline function @param pkt @param seg @return */
>  static inline odp_packet_seg_t _odp_packet_next_seg(odp_packet_t pkt,
> odp_packet_seg_t seg)
>  {
> -   if (odp_unlikely(seg >= _odp_packet_last_seg(pkt)))
> +   if (odp_unlikely(_odp_packet_seg_to_ndx(seg) >=
> +_odp_packet_seg_to_ndx(_odp_
> packet_last_seg(pkt
> return ODP_PACKET_SEG_INVALID;
>
> return seg + 1;
> diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h
> b/platform/linux-generic/include/odp/api/plat/packet_types.h
> index b8f665d..7e3c51e 100644
> --- a/platform/linux-generic/include/odp/api/plat/packet_types.h
> +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h
> @@ -40,6 +40,16 @@ typedef ODP_HANDLE_T(odp_pac

Re: [lng-odp] [PATCH] abi: packet: restore abi compatibility for odp_packet_seg_t type

2017-04-13 Thread Krishna Garapati
On 13 April 2017 at 00:06, Bill Fischofer  wrote:

> When running in --enable-abi-compat=yes mode, all ODP types need to be
> of pointer width in the default ABI definition. The optimization of the
> odp_packet_seg_t type to uint8_t can only be supported when running in
> --enable-abi-compate=no mode. Change the ODP packet routines to use
> type converter routines that have varying definitions based on whether
> we're running in ABI compatibility mode and provide these variant
> definitions to enable proper ABI compatibility while still supporting an
> optimized typedef for non-ABI mode.
>
> This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2940
>
> Signed-off-by: Bill Fischofer 
> ---
>  include/odp/arch/default/api/abi/packet.h   |  7 +--
>  .../include/odp/api/plat/packet_inlines.h   | 21
> ++---
>  .../include/odp/api/plat/packet_types.h | 10 ++
>  platform/linux-generic/odp_packet.c | 12 +++-
>  4 files changed, 40 insertions(+), 10 deletions(-)
>
> diff --git a/include/odp/arch/default/api/abi/packet.h
> b/include/odp/arch/default/api/abi/packet.h
> index 60a41b8..4aac75b 100644
> --- a/include/odp/arch/default/api/abi/packet.h
> +++ b/include/odp/arch/default/api/abi/packet.h
> @@ -16,15 +16,18 @@ extern "C" {
>  /** @internal Dummy type for strong typing */
>  typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_packet_t;
>
> +/** @internal Dummy  type for strong typing */
> +typedef struct { char dummy; /**< *internal Dummy */ }
> _odp_abi_packet_seg_t;
> +
>  /** @ingroup odp_packet
>   *  @{
>   */
>
>  typedef _odp_abi_packet_t *odp_packet_t;
> -typedef uint8_todp_packet_seg_t;
> +typedef _odp_abi_packet_seg_t *odp_packet_seg_t;
>
>  #define ODP_PACKET_INVALID((odp_packet_t)0x)
> -#define ODP_PACKET_SEG_INVALID((odp_packet_seg_t)-1)
> +#define ODP_PACKET_SEG_INVALID((odp_packet_seg_t)0x)
>  #define ODP_PACKET_OFFSET_INVALID (0x0fff)
>
>  typedef enum {
> diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
> b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
> index eb36aa9..bd735c1 100644
> --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
> +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
> @@ -21,6 +21,20 @@
>  /** @internal Inline function offsets */
>  extern const _odp_packet_inline_offset_t _odp_packet_inline;
>
> +#if ODP_ABI_COMPAT
>
Everywhere it explicitly says ODP_ABI_COMPAT == 1 or 0 except here. Would
be good to see it here the same way.

> +/** @internal Inline function @param seg @return */
> +static inline int _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
>
is "_ndx" a typo instead of _idx ?.

> +{
> +   return _odp_typeval(seg);
>
odp_typeval converts "seg" to uint32_t and we return it as int.

> +}
> +
> +/** @internal Inline function @param ndx @return */
> +static inline odp_packet_seg_t _odp_packet_seg_from_ndx(int ndx)
> +{
> +   return _odp_cast_scalar(odp_packet_seg_t, ndx);
> +}
> +#endif
> +
>  /** @internal Inline function @param pkt @return */
>  static inline void *_odp_packet_data(odp_packet_t pkt)
>  {
> @@ -128,20 +142,21 @@ static inline odp_packet_seg_t
> _odp_packet_first_seg(odp_packet_t pkt)
>  {
> (void)pkt;
>
> -   return 0;
> +   return _odp_packet_seg_from_ndx(0);
>  }
>
>  /** @internal Inline function @param pkt @return */
>  static inline odp_packet_seg_t _odp_packet_last_seg(odp_packet_t pkt)
>  {
> -   return _odp_packet_num_segs(pkt) - 1;
> +   return _odp_packet_seg_from_ndx(_odp_packet_num_segs(pkt) - 1);
>  }
>
>  /** @internal Inline function @param pkt @param seg @return */
>  static inline odp_packet_seg_t _odp_packet_next_seg(odp_packet_t pkt,
> odp_packet_seg_t seg)
>  {
> -   if (odp_unlikely(seg >= _odp_packet_last_seg(pkt)))
> +   if (odp_unlikely(_odp_packet_seg_to_ndx(seg) >=
> +_odp_packet_seg_to_ndx(_odp_
> packet_last_seg(pkt
> return ODP_PACKET_SEG_INVALID;
>
> return seg + 1;
> diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h
> b/platform/linux-generic/include/odp/api/plat/packet_types.h
> index b8f665d..59e8b2f 100644
> --- a/platform/linux-generic/include/odp/api/plat/packet_types.h
> +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h
> @@ -40,6 +40,16 @@ typedef ODP_HANDLE_T(odp_packet_t);
>
>  typedef uint8_t odp_packet_seg_t;
>
> +static inline int _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
> +{
> +   return (int)seg;
> +}
> +
> +static inline odp_packet_seg_t _odp_packet_seg_from_ndx(int ndx)
> +{
> +   return (odp_packet_seg_t)ndx;
> +}
> +
>  #define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1)
>
>  typedef enum {
> diff --git a/platform/linux-generic/odp_packet.c
> 

Re: [lng-odp] [PATCH v5 1/3] validation: packet: increase test pool size

2017-04-06 Thread Krishna Garapati
for this patch series,

Reviewed-by: Balakrishna Garapati 

/Krishna

On 31 March 2017 at 14:18, Matias Elo  wrote:

> Previously packet_test_concatsplit() could fail on some pool
> implementations as the pool ran out of buffers. Increase default pools size
> and use capability to make sure the value is valid.
>
> Signed-off-by: Matias Elo 
> ---
>  test/common_plat/validation/api/packet/packet.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/test/common_plat/validation/api/packet/packet.c
> b/test/common_plat/validation/api/packet/packet.c
> index 669122a..1997139 100644
> --- a/test/common_plat/validation/api/packet/packet.c
> +++ b/test/common_plat/validation/api/packet/packet.c
> @@ -13,6 +13,8 @@
>  #define PACKET_BUF_LEN ODP_CONFIG_PACKET_SEG_LEN_MIN
>  /* Reserve some tailroom for tests */
>  #define PACKET_TAILROOM_RESERVE  4
> +/* Number of packets in the test packet pool */
> +#define PACKET_POOL_NUM 300
>
>  static odp_pool_t packet_pool, packet_pool_no_uarea,
> packet_pool_double_uarea;
>  static uint32_t packet_len;
> @@ -109,6 +111,7 @@ int packet_suite_init(void)
> uint32_t udat_size;
> uint8_t data = 0;
> uint32_t i;
> +   uint32_t num = PACKET_POOL_NUM;
>
> if (odp_pool_capability() < 0) {
> printf("pool_capability failed\n");
> @@ -130,13 +133,15 @@ int packet_suite_init(void)
> segmented_packet_len = capa.pkt.min_seg_len *
>capa.pkt.max_segs_per_pkt;
> }
> +   if (capa.pkt.max_num != 0 && capa.pkt.max_num < num)
> +   num = capa.pkt.max_num;
>
> odp_pool_param_init();
>
> params.type   = ODP_POOL_PACKET;
> params.pkt.seg_len= capa.pkt.min_seg_len;
> params.pkt.len= capa.pkt.min_seg_len;
> -   params.pkt.num= 100;
> +   params.pkt.num= num;
> params.pkt.uarea_size = sizeof(struct udata_struct);
>
> packet_pool = odp_pool_create("packet_pool", );
> --
> 2.7.4
>
>


Re: [lng-odp] [PATCH] linux-generic: decouple odp_errno define from odp-linux

2017-04-04 Thread Krishna Garapati
ping

On 30 March 2017 at 15:31, Balakrishna Garapati <
balakrishna.garap...@linaro.org> wrote:

> makes it easy to define odp_errno to dpdk rteerrno and fixes
> linking issues.
>
> Signed-off-by: Balakrishna Garapati 
> ---
>  platform/linux-generic/Makefile.am|  1 +
>  platform/linux-generic/include/odp_errno_define.h | 27
> +++
>  platform/linux-generic/include/odp_internal.h |  3 +--
>  3 files changed, 29 insertions(+), 2 deletions(-)
>  create mode 100644 platform/linux-generic/include/odp_errno_define.h
>
> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/
> Makefile.am
> index 37835c3..5452915 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -125,6 +125,7 @@ noinst_HEADERS = \
>   ${srcdir}/include/odp_config_internal.h \
>   ${srcdir}/include/odp_crypto_internal.h \
>   ${srcdir}/include/odp_debug_internal.h \
> + ${srcdir}/include/odp_errno_define.h \
>   ${srcdir}/include/odp_forward_typedefs_internal.h \
>   ${srcdir}/include/odp_internal.h \
>   ${srcdir}/include/odp_name_table_internal.h \
> diff --git a/platform/linux-generic/include/odp_errno_define.h
> b/platform/linux-generic/include/odp_errno_define.h
> new file mode 100644
> index 000..9baa7d9
> --- /dev/null
> +++ b/platform/linux-generic/include/odp_errno_define.h
> @@ -0,0 +1,27 @@
> +/* Copyright (c) 2017, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP error number define
> + */
> +
> +
> +#ifndef ODP_ERRNO_DEFINE_H_
> +#define ODP_ERRNO_DEFINE_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +extern __thread int __odp_errno;
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/include/odp_internal.h
> b/platform/linux-generic/include/odp_internal.h
> index b313b1f..e1267cf 100644
> --- a/platform/linux-generic/include/odp_internal.h
> +++ b/platform/linux-generic/include/odp_internal.h
> @@ -20,11 +20,10 @@ extern "C" {
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> -extern __thread int __odp_errno;
> -
>  #define MAX_CPU_NUMBER 128
>
>  typedef struct {
> --
> 1.9.1
>
>


Re: [lng-odp] [PATCH] test: performance: lower the MAX_PKT_SIZE to 1518

2017-03-30 Thread Krishna Garapati
ping

On 24 March 2017 at 14:40, Balakrishna Garapati <
balakrishna.garap...@linaro.org> wrote:

> "bench_packet_tailroom" test fails on odp-dpdk with the pkt size 2048
> leaving no space for tailroom.
>
> Signed-off-by: Balakrishna Garapati 
> ---
>  test/common_plat/performance/odp_bench_packet.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/common_plat/performance/odp_bench_packet.c
> b/test/common_plat/performance/odp_bench_packet.c
> index 7a3a004..6b73423 100644
> --- a/test/common_plat/performance/odp_bench_packet.c
> +++ b/test/common_plat/performance/odp_bench_packet.c
> @@ -35,7 +35,7 @@
>  #define TEST_MIN_PKT_SIZE 64
>
>  /** Maximum test packet size */
> -#define TEST_MAX_PKT_SIZE 2048
> +#define TEST_MAX_PKT_SIZE 1518
>
>  /** Number of test runs per individual benchmark */
>  #define TEST_REPEAT_COUNT 1000
> @@ -78,7 +78,7 @@ ODP_STATIC_ASSERT((TEST_ALIGN_OFFSET + TEST_ALIGN_LEN)
> <= TEST_MIN_PKT_SIZE,
>
>  /** Test packet sizes */
>  const uint32_t test_packet_len[] = {WARM_UP, TEST_MIN_PKT_SIZE, 128, 256,
> 512,
> -   1024, 1518, TEST_MAX_PKT_SIZE};
> +   1024, TEST_MAX_PKT_SIZE};
>
>  /**
>   * Parsed command line arguments
> --
> 1.9.1
>
>


Re: [lng-odp] [API-NEXT PATCH v2 1/2] validation: packet: increase test pool size

2017-03-29 Thread Krishna Garapati
On 29 March 2017 at 12:51, Elo, Matias (Nokia - FI/Espoo) <
matias@nokia-bell-labs.com> wrote:

>
> > On 28 Mar 2017, at 17:21, Krishna Garapati <balakrishna.garapati@linaro.
> org> wrote:
> >
> > This pool size is not enough with odp-dpdk. It runs out of buffers hence
> the "packet_test_ref" fails. We should increase it to even higher size.
> > /Krishna
>
>
> OK, if you have the reference patches merged could you verify which value
> would be large enough?
>
300 seems to be a good number. I don't see any issue.

/Krishna

>
> -Matias
>
>


Re: [lng-odp] [API-NEXT PATCH v2 1/2] validation: packet: increase test pool size

2017-03-28 Thread Krishna Garapati
On 27 February 2017 at 13:18, Matias Elo  wrote:

> Previously packet_test_concatsplit() could fail on some pool
> implementations as the pool ran out of buffers. Increase default pools size
> and use capability to make sure the value is valid.
>
> Signed-off-by: Matias Elo 
> ---
> V2:
> - Add define PACKET_POOL_NUM for test packet pool size (Bala)
>
>  test/common_plat/validation/api/packet/packet.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/test/common_plat/validation/api/packet/packet.c
> b/test/common_plat/validation/api/packet/packet.c
> index 900c426..6ebc1fe 100644
> --- a/test/common_plat/validation/api/packet/packet.c
> +++ b/test/common_plat/validation/api/packet/packet.c
> @@ -13,6 +13,8 @@
>  #define PACKET_BUF_LEN ODP_CONFIG_PACKET_SEG_LEN_MIN
>  /* Reserve some tailroom for tests */
>  #define PACKET_TAILROOM_RESERVE  4
> +/* Number of packets in the test packet pool */
> +#define PACKET_POOL_NUM 200
>
This pool size is not enough with odp-dpdk. It runs out of buffers hence
the "packet_test_ref" fails. We should increase it to even higher size.
/Krishna

>
>  static odp_pool_t packet_pool, packet_pool_no_uarea,
> packet_pool_double_uarea;
>  static uint32_t packet_len;
> @@ -109,6 +111,7 @@ int packet_suite_init(void)
> uint32_t udat_size;
> uint8_t data = 0;
> uint32_t i;
> +   uint32_t num = PACKET_POOL_NUM;
>
> if (odp_pool_capability() < 0) {
> printf("pool_capability failed\n");
> @@ -128,13 +131,15 @@ int packet_suite_init(void)
> segmented_packet_len = capa.pkt.min_seg_len *
>capa.pkt.max_segs_per_pkt;
> }
> +   if (capa.pkt.max_num != 0 && capa.pkt.max_num < num)
> +   num = capa.pkt.max_num;
>
> odp_pool_param_init();
>
> params.type   = ODP_POOL_PACKET;
> params.pkt.seg_len= capa.pkt.min_seg_len;
> params.pkt.len= capa.pkt.min_seg_len;
> -   params.pkt.num= 100;
> +   params.pkt.num= num;
> params.pkt.uarea_size = sizeof(struct udata_struct);
>
> packet_pool = odp_pool_create("packet_pool", );
> --
> 2.7.4
>
>


Re: [lng-odp] [PATCHv3] validation: packet: do not require a max packet length

2017-03-24 Thread Krishna Garapati
Reviewed-by: Balakrishna Garapati 

/Krishna

On 23 March 2017 at 22:56, Bill Fischofer  wrote:

> Address bug https://bugs.linaro.org/show_bug.cgi?id=2908 by adding
> appropriate pool capability checks to the packet, pktio, and crypto tests
> to account for pkt.max_len, pkt.max_seg_len, or pkt.max_segs_per_pkt
> being zero, indicating these limits are bound only by available
> memory.
>
> Signed-off-by: Bill Fischofer 
> ---
>  test/common_plat/validation/api/crypto/crypto.c |  6 --
>  test/common_plat/validation/api/packet/packet.c | 13 +++--
>  test/common_plat/validation/api/pktio/pktio.c   | 11 +++
>  3 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/test/common_plat/validation/api/crypto/crypto.c
> b/test/common_plat/validation/api/crypto/crypto.c
> index e7c2bf3..94beb2f 100644
> --- a/test/common_plat/validation/api/crypto/crypto.c
> +++ b/test/common_plat/validation/api/crypto/crypto.c
> @@ -48,12 +48,14 @@ int crypto_init(odp_instance_t *inst)
> params.pkt.num = PKT_POOL_NUM;
> params.type= ODP_POOL_PACKET;
>
> -   if (PKT_POOL_LEN > pool_capa.pkt.max_seg_len) {
> +   if (pool_capa.pkt.max_seg_len &&
> +   PKT_POOL_LEN > pool_capa.pkt.max_seg_len) {
> fprintf(stderr, "Warning: small packet segment length\n");
> params.pkt.seg_len = pool_capa.pkt.max_seg_len;
> }
>
> -   if (PKT_POOL_LEN > pool_capa.pkt.max_len) {
> +   if (pool_capa.pkt.max_len &&
> +   PKT_POOL_LEN > pool_capa.pkt.max_len) {
> fprintf(stderr, "Pool max packet length too small\n");
> return -1;
> }
> diff --git a/test/common_plat/validation/api/packet/packet.c
> b/test/common_plat/validation/api/packet/packet.c
> index 900c426..669122a 100644
> --- a/test/common_plat/validation/api/packet/packet.c
> +++ b/test/common_plat/validation/api/packet/packet.c
> @@ -114,6 +114,8 @@ int packet_suite_init(void)
> printf("pool_capability failed\n");
> return -1;
> }
> +   if (capa.pkt.max_segs_per_pkt == 0)
> +   capa.pkt.max_segs_per_pkt = 10;
>
> /* Pick a typical packet size and decrement it to the single
> segment
>  * limit if needed (min_seg_len maybe equal to max_len
> @@ -366,6 +368,8 @@ void packet_test_alloc_segmented(void)
> int ret, i, num_alloc;
>
> CU_ASSERT_FATAL(odp_pool_capability() == 0);
> +   if (capa.pkt.max_segs_per_pkt == 0)
> +   capa.pkt.max_segs_per_pkt = 10;
>
> if (capa.pkt.max_len)
> max_len = capa.pkt.max_len;
> @@ -1847,6 +1851,9 @@ void packet_test_extend_ref(void)
>  {
> odp_packet_t max_pkt, ref;
> uint32_t hr, tr, max_len;
> +   odp_pool_capability_t capa;
> +
> +   CU_ASSERT_FATAL(odp_pool_capability() == 0);
>
> max_pkt = odp_packet_copy(segmented_test_packet,
>   odp_packet_pool(segmented_test_packet));
> @@ -1860,8 +1867,10 @@ void packet_test_extend_ref(void)
> odp_packet_push_tail(max_pkt, tr);
>
> /* Max packet should not be extendable at either end */
> -   CU_ASSERT(odp_packet_extend_tail(_pkt, 1, NULL, NULL) < 0);
> -   CU_ASSERT(odp_packet_extend_head(_pkt, 1, NULL, NULL) < 0);
> +   if (max_len == capa.pkt.max_len) {
> +   CU_ASSERT(odp_packet_extend_tail(_pkt, 1, NULL, NULL)
> < 0);
> +   CU_ASSERT(odp_packet_extend_head(_pkt, 1, NULL, NULL)
> < 0);
> +   }
>
> /* See if we can trunc and extend anyway */
> CU_ASSERT(odp_packet_trunc_tail(_pkt, hr + tr + 1,
> diff --git a/test/common_plat/validation/api/pktio/pktio.c
> b/test/common_plat/validation/api/pktio/pktio.c
> index 4f3c0c0..54f206e 100644
> --- a/test/common_plat/validation/api/pktio/pktio.c
> +++ b/test/common_plat/validation/api/pktio/pktio.c
> @@ -124,7 +124,7 @@ static void set_pool_len(odp_pool_param_t *params,
> odp_pool_capability_t *capa)
>  {
> uint32_t seg_len;
>
> -   seg_len = capa->pkt.max_seg_len;
> +   seg_len = capa->pkt.max_seg_len ? capa->pkt.max_seg_len :
> PKT_BUF_SIZE;
>
> switch (pool_segmentation) {
> case PKT_POOL_SEGMENTED:
> @@ -620,7 +620,8 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a,
> pktio_info_t *pktio_b,
>
> CU_ASSERT_FATAL(odp_pool_capability(_capa) == 0);
>
> -   if (packet_len > pool_capa.pkt.max_len)
> +   if (pool_capa.pkt.max_len &&
> +   packet_len > pool_capa.pkt.max_len)
> packet_len = pool_capa.pkt.max_len;
> }
>
> @@ -1689,7 +1690,8 @@ int pktio_check_send_failure(void)
> odp_pktio_close(pktio_tx);
>
> /* Failure test supports only single segment */
> -   if (pool_capa.pkt.max_seg_len < mtu + 32)
> +   if 

Re: [lng-odp] [PATCHv2] validation: packet: do not require a max packet length

2017-03-17 Thread Krishna Garapati
Reviewed-by: Balakrishna Garapati 

/Krishna

On 14 March 2017 at 14:55, Bill Fischofer  wrote:

> Address bug https://bugs.linaro.org/show_bug.cgi?id=2908 by adding
> appropriate pool capability checks to the packet and crypto tests
> to account for pkt.max_len, pkt.max_seg_len, or pkt.max_segs_per_pkt
> being zero, indicating these limits are bound only by available
> memory.
>
> Signed-off-by: Bill Fischofer 
> ---
>  test/common_plat/validation/api/crypto/crypto.c |  6 --
>  test/common_plat/validation/api/packet/packet.c | 13 +++--
>  2 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/test/common_plat/validation/api/crypto/crypto.c
> b/test/common_plat/validation/api/crypto/crypto.c
> index e7c2bf32..94beb2f1 100644
> --- a/test/common_plat/validation/api/crypto/crypto.c
> +++ b/test/common_plat/validation/api/crypto/crypto.c
> @@ -48,12 +48,14 @@ int crypto_init(odp_instance_t *inst)
> params.pkt.num = PKT_POOL_NUM;
> params.type= ODP_POOL_PACKET;
>
> -   if (PKT_POOL_LEN > pool_capa.pkt.max_seg_len) {
> +   if (pool_capa.pkt.max_seg_len &&
> +   PKT_POOL_LEN > pool_capa.pkt.max_seg_len) {
> fprintf(stderr, "Warning: small packet segment length\n");
> params.pkt.seg_len = pool_capa.pkt.max_seg_len;
> }
>
> -   if (PKT_POOL_LEN > pool_capa.pkt.max_len) {
> +   if (pool_capa.pkt.max_len &&
> +   PKT_POOL_LEN > pool_capa.pkt.max_len) {
> fprintf(stderr, "Pool max packet length too small\n");
> return -1;
> }
> diff --git a/test/common_plat/validation/api/packet/packet.c
> b/test/common_plat/validation/api/packet/packet.c
> index 900c4263..669122a7 100644
> --- a/test/common_plat/validation/api/packet/packet.c
> +++ b/test/common_plat/validation/api/packet/packet.c
> @@ -114,6 +114,8 @@ int packet_suite_init(void)
> printf("pool_capability failed\n");
> return -1;
> }
> +   if (capa.pkt.max_segs_per_pkt == 0)
> +   capa.pkt.max_segs_per_pkt = 10;
>
> /* Pick a typical packet size and decrement it to the single
> segment
>  * limit if needed (min_seg_len maybe equal to max_len
> @@ -366,6 +368,8 @@ void packet_test_alloc_segmented(void)
> int ret, i, num_alloc;
>
> CU_ASSERT_FATAL(odp_pool_capability() == 0);
> +   if (capa.pkt.max_segs_per_pkt == 0)
> +   capa.pkt.max_segs_per_pkt = 10;
>
> if (capa.pkt.max_len)
> max_len = capa.pkt.max_len;
> @@ -1847,6 +1851,9 @@ void packet_test_extend_ref(void)
>  {
> odp_packet_t max_pkt, ref;
> uint32_t hr, tr, max_len;
> +   odp_pool_capability_t capa;
> +
> +   CU_ASSERT_FATAL(odp_pool_capability() == 0);
>
> max_pkt = odp_packet_copy(segmented_test_packet,
>   odp_packet_pool(segmented_test_packet));
> @@ -1860,8 +1867,10 @@ void packet_test_extend_ref(void)
> odp_packet_push_tail(max_pkt, tr);
>
> /* Max packet should not be extendable at either end */
> -   CU_ASSERT(odp_packet_extend_tail(_pkt, 1, NULL, NULL) < 0);
> -   CU_ASSERT(odp_packet_extend_head(_pkt, 1, NULL, NULL) < 0);
> +   if (max_len == capa.pkt.max_len) {
> +   CU_ASSERT(odp_packet_extend_tail(_pkt, 1, NULL, NULL)
> < 0);
> +   CU_ASSERT(odp_packet_extend_head(_pkt, 1, NULL, NULL)
> < 0);
> +   }
>
> /* See if we can trunc and extend anyway */
> CU_ASSERT(odp_packet_trunc_tail(_pkt, hr + tr + 1,
> --
> 2.12.0.rc1
>
>


Re: [lng-odp] [PATCH] validation: packet: do not require a max packet length

2017-03-13 Thread Krishna Garapati
On 13 March 2017 at 15:02, Bill Fischofer  wrote:

> Address bug https://bugs.linaro.org/show_bug.cgi?id=2908 by checking
> the pool capability max packet length and modifying the test in
> test_extend_ref() to account for implementations that do not limit
> packet lengths.
>
> Signed-off-by: Bill Fischofer 
> ---
>  test/common_plat/validation/api/packet/packet.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/test/common_plat/validation/api/packet/packet.c
> b/test/common_plat/validation/api/packet/packet.c
> index 900c4263..5544c237 100644
> --- a/test/common_plat/validation/api/packet/packet.c
> +++ b/test/common_plat/validation/api/packet/packet.c
> @@ -1847,6 +1847,9 @@ void packet_test_extend_ref(void)
>  {
> odp_packet_t max_pkt, ref;
> uint32_t hr, tr, max_len;
> +   odp_pool_capability_t capa;
> +
> +   CU_ASSERT_FATAL(odp_pool_capability() == 0);
>
> max_pkt = odp_packet_copy(segmented_test_packet,
>   odp_packet_pool(segmented_test_packet));
> @@ -1860,8 +1863,10 @@ void packet_test_extend_ref(void)
> odp_packet_push_tail(max_pkt, tr);
>
> /* Max packet should not be extendable at either end */
> -   CU_ASSERT(odp_packet_extend_tail(_pkt, 1, NULL, NULL) < 0);
> -   CU_ASSERT(odp_packet_extend_head(_pkt, 1, NULL, NULL) < 0);
> +   if (max_len == capa.pkt.max_len) {
>
This capability is already defined in odp-dpdk as an internal capability.
And used to calculate & make sure at least one packet fits in the pool. So
my question was if odp-dpdk should use this internal capability to check
against the max packet size since dpdk has no such capability ?.

/Krishna

> +   CU_ASSERT(odp_packet_extend_tail(_pkt, 1, NULL, NULL)
> < 0);
> +   CU_ASSERT(odp_packet_extend_head(_pkt, 1, NULL, NULL)
> < 0);
> +   }
>
> /* See if we can trunc and extend anyway */
> CU_ASSERT(odp_packet_trunc_tail(_pkt, hr + tr + 1,
> --
> 2.12.0.rc1
>
>


Re: [lng-odp] [API-NEXT PATCH 1/4] validation: crypto: fix hw cipher/auth algorithm check

2017-01-11 Thread Krishna Garapati
for this series,

Reviewed-by: Balakrishna Garapati 

/Krishna

On 10 January 2017 at 13:09, Matias Elo  wrote:

> Some algorithms may be implemented using hardware and some using software.
> All supported algorithms should be set in capacity.auths /capacity.ciphers
> independent of implementation types.
>
> Signed-off-by: Matias Elo 
> ---
>  .../validation/api/crypto/odp_crypto_test_inp.c| 69
> ++
>  1 file changed, 31 insertions(+), 38 deletions(-)
>
> diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> index de9d6e4..db58344 100644
> --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
> @@ -47,7 +47,7 @@ static void alg_test(odp_crypto_op_t op,
>  uint32_t digest_len)
>  {
> odp_crypto_session_t session;
> -   odp_crypto_capability_t capability;
> +   odp_crypto_capability_t capa;
> int rc;
> odp_crypto_ses_create_err_t status;
> odp_bool_t posted;
> @@ -63,50 +63,43 @@ static void alg_test(odp_crypto_op_t op,
> int num, i;
> int found;
>
> -   rc = odp_crypto_capability();
> +   rc = odp_crypto_capability();
> CU_ASSERT(!rc);
>
> -   if (capability.hw_ciphers.all_bits) {
> -   if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&
> -   !(capability.hw_ciphers.bit.trides_cbc))
> -   rc = -1;
> -   if (cipher_alg == ODP_CIPHER_ALG_AES_CBC &&
> -   !(capability.hw_ciphers.bit.aes_cbc))
> -   rc = -1;
> -   if (cipher_alg == ODP_CIPHER_ALG_AES_GCM &&
> -   !(capability.hw_ciphers.bit.aes_gcm))
> -   rc = -1;
> -   } else {
> -   if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&
> -   !(capability.ciphers.bit.trides_cbc))
> -   rc = -1;
> -   if (cipher_alg == ODP_CIPHER_ALG_AES_CBC &&
> -   !(capability.ciphers.bit.aes_cbc))
> -   rc = -1;
> -   if (cipher_alg == ODP_CIPHER_ALG_AES_GCM &&
> -   !(capability.ciphers.bit.aes_gcm))
> -   rc = -1;
> -   }
> +   if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&
> +   !(capa.ciphers.bit.trides_cbc))
> +   rc = -1;
> +   if (cipher_alg == ODP_CIPHER_ALG_AES_CBC &&
> +   !(capa.ciphers.bit.aes_cbc))
> +   rc = -1;
> +   if (cipher_alg == ODP_CIPHER_ALG_AES_GCM &&
> +   !(capa.ciphers.bit.aes_gcm))
> +   rc = -1;
> +   if (cipher_alg == ODP_CIPHER_ALG_DES &&
> +   !(capa.ciphers.bit.des))
> +   rc = -1;
> +   if (cipher_alg == ODP_CIPHER_ALG_NULL &&
> +   !(capa.ciphers.bit.null))
> +   rc = -1;
>
> CU_ASSERT(!rc);
> +   CU_ASSERT((~capa.ciphers.all_bits & capa.hw_ciphers.all_bits) ==
> 0);
>
> -   if (capability.hw_auths.all_bits) {
> -   if (auth_alg == ODP_AUTH_ALG_AES_GCM &&
> -   !(capability.hw_auths.bit.aes_gcm))
> -   rc = -1;
> -   if (auth_alg == ODP_AUTH_ALG_NULL &&
> -   !(capability.hw_auths.bit.null))
> -   rc = -1;
> -   } else {
> -   if (auth_alg == ODP_AUTH_ALG_AES_GCM &&
> -   !(capability.auths.bit.aes_gcm))
> -   rc = -1;
> -   if (auth_alg == ODP_AUTH_ALG_NULL &&
> -   !(capability.auths.bit.null))
> -   rc = -1;
> -   }
> +   if (auth_alg == ODP_AUTH_ALG_AES_GCM &&
> +   !(capa.auths.bit.aes_gcm))
> +   rc = -1;
> +   if (auth_alg == ODP_AUTH_ALG_MD5_HMAC &&
> +   !(capa.auths.bit.md5_hmac))
> +   rc = -1;
> +   if (auth_alg == ODP_AUTH_ALG_NULL &&
> +   !(capa.auths.bit.null))
> +   rc = -1;
> +   if (auth_alg == ODP_AUTH_ALG_SHA256_HMAC &&
> +   !(capa.auths.bit.sha256_hmac))
> +   rc = -1;
>
> CU_ASSERT(!rc);
> +   CU_ASSERT((~capa.auths.all_bits & capa.hw_auths.all_bits) == 0);
>
> num = odp_crypto_cipher_capability(cipher_alg, cipher_capa,
>MAX_ALG_CAPA);
> --
> 2.7.4
>
>


Re: [lng-odp] [PATCHv3] example: hello: set cpu affinity from cgroup

2017-01-10 Thread Krishna Garapati
On 10 January 2017 at 16:46, Mike Holmes  wrote:

> On 10 January 2017 at 10:30, Maxim Uvarov  wrote:
>
> > On 01/10/17 18:08, Mike Holmes wrote:
> > >
> > >
> > > On 10 January 2017 at 10:02, Maxim Uvarov  > > > wrote:
> > >
> > > after one more look at this I think we need to remove affinity
> > setting
> > > from hello word app. It's really not needed and not related to odp.
> > >
> > >
> > > As a hello world, is it not useful to describe general usage ?
> > > I don't disagree with you, just asking if it helps to keep it.
> > >
> >
> > I think Hello world has to be minimal app. ODP can work with not bind to
> > cpu threads. But it will be good if 'hello' app will not any linux
> > specifics and can run on all environments like bare metal.
> >
>
> Makes sence
>
So shall I scrap this patch and send a new patch with different subject
name ?
/Krishna

>
>
> >
> > Maxim.
> >
> >
> >
> >
> > >
> > >
> > > Maxim.
> > >
> > > On 01/10/17 05:52, Balakrishna Garapati wrote:
> > > > This will resolve the test in ci when using cgroups.
> > > > odp_hello app fails to set cpu affinity to zero all ways
> > > > when cgroup doesn't include that cpu in the set.
> > > >
> > > > Fixes: https://bugs.linaro.org/show_bug.cgi?id=2806
> > > 
> > > >
> > > > Signed-off-by: Balakrishna Garapati
> > >  > > >
> > > > ---
> > > >
> > > >  since v2: Added link to bug
> > > >
> > > >  example/hello/odp_hello.c | 19 ---
> > > >  1 file changed, 16 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/example/hello/odp_hello.c
> b/example/hello/odp_hello.c
> > > > index 6d114ee..59a31b2 100644
> > > > --- a/example/hello/odp_hello.c
> > > > +++ b/example/hello/odp_hello.c
> > > > @@ -60,16 +60,29 @@ int main(int argc, char *argv[])
> > > >   options_t opt;
> > > >   pid_t pid;
> > > >   cpu_set_t cpu_set;
> > > > - int i;
> > > > + int i, ret, first_cpu = 0, cpu;
> > > > +
> > > > + pid = getpid();
> > > > + ret = sched_getaffinity(pid, sizeof(cpu_set_t), _set);
> > > > + if (ret < 0) {
> > > > + printf("get CPU affinity failed.\n");
> > > > + return -1;
> > > > + }
> > > > +
> > > > + for (cpu = 0; cpu < CPU_SETSIZE; cpu++) {
> > > > + if (CPU_ISSET(cpu, _set)) {
> > > > + first_cpu = cpu;
> > > > + break;
> > > > + }
> > > > + }
> > > >
> > > >   memset(, 0, sizeof(opt));
> > > > - opt.cpu = 0;
> > > > + opt.cpu = first_cpu;
> > > >   opt.num = 1;
> > > >
> > > >   if (parse_args(argc, argv, ))
> > > >   return -1;
> > > >
> > > > - pid = getpid();
> > > >   CPU_ZERO(_set);
> > > >   CPU_SET(opt.cpu, _set);
> > > >
> > > > --
> > > > 1.9.1
> > > >
> > >
> > >
> > >
> > >
> > > --
> > > Mike Holmes
> > > Program Manager - Linaro Networking Group
> > > Linaro.org * **│ *Open source software for ARM
> > SoCs
> > > "Work should be fun and collaborative, the rest follows"
> > >
> > > __
> > >
> > >
> >
> >
>
>
> --
> Mike Holmes
> Program Manager - Linaro Networking Group
> Linaro.org  *│ *Open source software for ARM SoCs
> "Work should be fun and collaborative, the rest follows"
>


Re: [lng-odp] [PATCHv3] platform: linux-generic: reading cpu affinity from cpuset

2016-12-06 Thread Krishna Garapati
On 2 December 2016 at 04:20, Yi He  wrote:

> The original code reads whole system cpuset, and provides no command line
> parameters to specify cpuset resources while launching ODP application.
> Thus can be an obstacle for the coexisting of multiple ODP applications.
>
> New code implies that ODP application launcher should prepare resource
> arrangements (cpuset etc) before launching the ODP applications, favours
> multiple ODP applications' coexistence, this patch looks good for me.
>
> Agree with Brian's 2 comments:
>
> Should this function be renamed to something like get_available_cpus?
>
sure, will rename it. Send you an other version

>
> In documentation, do we have a chapter covers "Run ODP Applications"
> topic? Can be a separate task.
>
I couldn't find any section like that. It can be a separate task.

/Krishna

>
> Thanks and Best Regards, Yi
>
>
>
> On 2 December 2016 at 03:38, Brian Brooks  wrote:
>
>> On 11/28 15:34:06, Balakrishna Garapati wrote:
>> > With this new proposal cpu affinity is read correctly especially
>> > when using cgroups otherwise wrong cpu mask is set.
>> >
>> > Fixes bug: https://bugs.linaro.org/show_bug.cgi?id=2472
>> >
>> > Signed-off-by: Balakrishna Garapati 
>> > ---
>> >
>> >  v1 to v2: added Description of the issue to the patch commit log.
>> >  v2 to v3: Resending the patch adding the log change from v1 to v2
>> >
>> >  platform/linux-generic/odp_cpumask.c | 69
>> +---
>> >  1 file changed, 16 insertions(+), 53 deletions(-)
>> >
>> > diff --git a/platform/linux-generic/odp_cpumask.c
>> b/platform/linux-generic/odp_cpumask.c
>> > index 6bf2632..7b0d80a 100644
>> > --- a/platform/linux-generic/odp_cpumask.c
>> > +++ b/platform/linux-generic/odp_cpumask.c
>> > @@ -227,71 +227,34 @@ int odp_cpumask_next(const odp_cpumask_t *mask,
>> int cpu)
>> >   */
>> >  static int get_installed_cpus(void)
>>
>> Should this function be renamed to something like get_available_cpus
>> since it returns the set of CPUs on which the calling thread is eligible
>> to run on instead of the set of CPUs in the entire system?
>>
>> >  {
>> > - char *numptr;
>> > - char *endptr;
>> > - long int cpu_idnum;
>> > - DIR  *d;
>> > - struct dirent *dir;
>> > + int cpu_idnum;
>> > + cpu_set_t cpuset;
>> > + int ret;
>> >
>> >   /* Clear the global cpumasks for control and worker CPUs */
>> >   odp_cpumask_zero(_global_data.control_cpus);
>> >   odp_cpumask_zero(_global_data.worker_cpus);
>> >
>> > - /*
>> > -  * Scan the /sysfs pseudo-filesystem for CPU info directories.
>> > -  * There should be one subdirectory for each installed logical CPU
>> > -  */
>> > - d = opendir("/sys/devices/system/cpu");
>> > - if (d) {
>> > - while ((dir = readdir(d)) != NULL) {
>> > - cpu_idnum = CPU_SETSIZE;
>> > -
>> > - /*
>> > -  * If the current directory entry doesn't
>> represent
>> > -  * a CPU info subdirectory then skip to the next
>> entry.
>> > -  */
>> > - if (dir->d_type == DT_DIR) {
>> > - if (!strncmp(dir->d_name, "cpu", 3)) {
>> > - /*
>> > -  * Directory name starts with
>> "cpu"...
>> > -  * Try to extract a CPU ID number
>> > -  * from the remainder of the
>> dirname.
>> > -  */
>> > - errno = 0;
>> > - numptr = dir->d_name;
>> > - numptr += 3;
>> > - cpu_idnum = strtol(numptr,
>> ,
>> > -10);
>> > - if (errno || (endptr == numptr))
>> > - continue;
>> > - } else {
>> > - continue;
>> > - }
>> > - } else {
>> > - continue;
>> > - }
>> > - /*
>> > -  * If we get here the current directory entry
>> specifies
>> > -  * a CPU info subdir for the CPU indexed by
>> cpu_idnum.
>> > -  */
>> > + CPU_ZERO();
>> > + ret = sched_getaffinity(0, sizeof(cpuset), );
>>
>> It would be great to add a note in the ODP spec that the application
>> thread
>> calling odp_global_init() must double check its cpuset. E.g. if called
>> from
>> a control plane thread that has already affinitized to control plane CPUs,
>> once odp_global_init() is called will the underlying ODP implementation
>> (and 

Re: [lng-odp] [PATCHv3] platform: linux-generic: reading cpu affinity from cpuset

2016-12-01 Thread Krishna Garapati
ping

/Krishna

On 28 November 2016 at 15:34, Balakrishna Garapati <
balakrishna.garap...@linaro.org> wrote:

> With this new proposal cpu affinity is read correctly especially
> when using cgroups otherwise wrong cpu mask is set.
>
> Fixes bug: https://bugs.linaro.org/show_bug.cgi?id=2472
>
> Signed-off-by: Balakrishna Garapati 
> ---
>
>  v1 to v2: added Description of the issue to the patch commit log.
>  v2 to v3: Resending the patch adding the log change from v1 to v2
>
>  platform/linux-generic/odp_cpumask.c | 69 +-
> --
>  1 file changed, 16 insertions(+), 53 deletions(-)
>
> diff --git a/platform/linux-generic/odp_cpumask.c
> b/platform/linux-generic/odp_cpumask.c
> index 6bf2632..7b0d80a 100644
> --- a/platform/linux-generic/odp_cpumask.c
> +++ b/platform/linux-generic/odp_cpumask.c
> @@ -227,71 +227,34 @@ int odp_cpumask_next(const odp_cpumask_t *mask, int
> cpu)
>   */
>  static int get_installed_cpus(void)
>  {
> -   char *numptr;
> -   char *endptr;
> -   long int cpu_idnum;
> -   DIR  *d;
> -   struct dirent *dir;
> +   int cpu_idnum;
> +   cpu_set_t cpuset;
> +   int ret;
>
> /* Clear the global cpumasks for control and worker CPUs */
> odp_cpumask_zero(_global_data.control_cpus);
> odp_cpumask_zero(_global_data.worker_cpus);
>
> -   /*
> -* Scan the /sysfs pseudo-filesystem for CPU info directories.
> -* There should be one subdirectory for each installed logical CPU
> -*/
> -   d = opendir("/sys/devices/system/cpu");
> -   if (d) {
> -   while ((dir = readdir(d)) != NULL) {
> -   cpu_idnum = CPU_SETSIZE;
> -
> -   /*
> -* If the current directory entry doesn't represent
> -* a CPU info subdirectory then skip to the next
> entry.
> -*/
> -   if (dir->d_type == DT_DIR) {
> -   if (!strncmp(dir->d_name, "cpu", 3)) {
> -   /*
> -* Directory name starts with
> "cpu"...
> -* Try to extract a CPU ID number
> -* from the remainder of the
> dirname.
> -*/
> -   errno = 0;
> -   numptr = dir->d_name;
> -   numptr += 3;
> -   cpu_idnum = strtol(numptr, ,
> -  10);
> -   if (errno || (endptr == numptr))
> -   continue;
> -   } else {
> -   continue;
> -   }
> -   } else {
> -   continue;
> -   }
> -   /*
> -* If we get here the current directory entry
> specifies
> -* a CPU info subdir for the CPU indexed by
> cpu_idnum.
> -*/
> +   CPU_ZERO();
> +   ret = sched_getaffinity(0, sizeof(cpuset), );
>
> -   /* Track number of logical CPUs discovered */
> -   if (odp_global_data.num_cpus_installed <
> -   (int)(cpu_idnum + 1))
> -   odp_global_data.num_cpus_installed =
> -   (int)(cpu_idnum + 1);
> +   if (ret < 0) {
> +   ODP_ERR("Failed to get cpu affinity");
> +   return -1;
> +   }
>
> +   for (cpu_idnum = 0; cpu_idnum < CPU_SETSIZE - 1; cpu_idnum++) {
> +   if (CPU_ISSET(cpu_idnum, )) {
> +   odp_global_data.num_cpus_installed++;
> /* Add the CPU to our default cpumasks */
> odp_cpumask_set(_global_data.control_cpus,
> -   (int)cpu_idnum);
> +   (int)cpu_idnum);
> odp_cpumask_set(_global_data.worker_cpus,
> -   (int)cpu_idnum);
> +   (int)cpu_idnum);
> }
> -   closedir(d);
> -   return 0;
> -   } else {
> -   return -1;
> }
> +
> +   return 0;
>  }
>
>  /*
> --
> 1.9.1
>
>


Re: [lng-odp] [PATCHv2] linux-gen: crypto: fix aes gcm decryption

2016-11-04 Thread Krishna Garapati
Reviewed-by: Balakrishna Garapati 

/Krishna

On 31 October 2016 at 15:53, Maxim Uvarov  wrote:

> On 31 October 2016 at 17:51, Maxim Uvarov  wrote:
>
> > We should first initialize, then set up decryption
> > and only then push blocks for decryption.
> > https://bugs.linaro.org/show_bug.cgi?id=2571
> >
> > Signed-off-by: Maxim Uvarov 
> > ---
> >  v2: clear reworking
> >
> >
> rewording :)
>
>
>
> >  btw, it was tested here:
> >  https://s3.amazonaws.com/archive.travis-ci.org/jobs/171998583/log.txt
> >
> >  platform/linux-generic/odp_crypto.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/platform/linux-generic/odp_crypto.c
> > b/platform/linux-generic/odp_crypto.c
> > index c7431e6..9e09d42 100644
> > --- a/platform/linux-generic/odp_crypto.c
> > +++ b/platform/linux-generic/odp_crypto.c
> > @@ -398,6 +398,8 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_crypto_op_
> params_t
> > *params,
> >
> > EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_enc);
> >
> > +   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag);
> > +
> > /* Authenticate header data (if any) without encrypting them */
> > if (aad_head < cipherdata) {
> > EVP_DecryptUpdate(ctx, NULL, _len,
> > @@ -414,8 +416,6 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_crypto_op_
> params_t
> > *params,
> >   auth_len - (aad_tail - aad_head));
> > }
> >
> > -   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag);
> > -
> > if (EVP_DecryptFinal_ex(ctx, cipherdata + cipher_len, _len)
> > < 0)
> > return ODP_CRYPTO_ALG_ERR_ICV_CHECK;
> >
> > --
> > 2.7.1.250.gff4ea60
> >
> >
>


Re: [lng-odp] [PATCHv3] linux-generic: configure: add conditional shared library support

2016-09-07 Thread Krishna Garapati
Reviewed-by: Balakrishna Garapati 

/Krishna

On 6 September 2016 at 17:46, Mike Holmes  wrote:

> Ping - any reviews for this so that we can have step one ABI compatibility
> by LAS16 ?
>
> On 30 August 2016 at 21:37, Bill Fischofer 
> wrote:
>
> > Add support for the --enable-shared=[yes|no] configure options.
> > --enable-shared=yes is the default and results in suppressing the use
> > of inlines for ODP API functions to enhance ABI compatibility at
> > potentially some performance cost. When --enable-shared=no is specified,
> > inlines are allowed to boost performance at the possible loss of ABI
> > compatibility.
> >
> > This patch addresses Bug https://bugs.linaro.org/show_bug.cgi?id=2490
> >
> > Note: This patch is a port of the corresponding enhancements made to
> > odp-dpdk with a few changes, mainly that inlines are now part of the
> > odp/api/plat directory, and all ODP APIs are now treated uniformly with
> > regard to whether inlining is permitted.
> >
> > Suggested-by: Zoltan Kiss 
> > Signed-off-by: Bill Fischofer 
> > ---
> > v3: Move .gitignore for inlines.h to platform/linux-generic.
> > Correct blank lines at EOF for git am
> >
> > v2: Add byteorder.h to list of APIs with controlled inlining
> >
> >  configure.ac   |   7 +
> >  example/Makefile.inc   |   3 +-
> >  helper/Makefile.am |   1 +
> >  platform/linux-generic/.gitignore  |   1 +
> >  platform/linux-generic/Makefile.am |   9 +
> >  platform/linux-generic/include/odp/api/atomic.h| 384
> > +---
> >  platform/linux-generic/include/odp/api/byteorder.h | 114 +-
> >  .../include/odp/api/plat/atomic_inlines.h  | 385
> > +
> >  .../include/odp/api/plat/byteorder_inlines.h   | 140 
> >  .../include/odp/api/plat/inlines.h.in  |  33 ++
> >  .../include/odp/api/plat/std_clib_inlines.h|  36 ++
> >  .../include/odp/api/plat/sync_inlines.h|  47 +++
> >  platform/linux-generic/include/odp/api/std_clib.h  |  18 +-
> >  platform/linux-generic/include/odp/api/sync.h  |  18 +-
> >  platform/linux-generic/m4/configure.m4 |   3 +-
> >  platform/linux-generic/odp_atomic.c|   3 +
> >  platform/linux-generic/odp_byteorder.c |  10 +
> >  platform/linux-generic/odp_std_clib.c  |  10 +
> >  platform/linux-generic/odp_sync.c  |  10 +
> >  19 files changed, 712 insertions(+), 520 deletions(-)
> >  create mode 100644 platform/linux-generic/.gitignore
> >  create mode 100644 platform/linux-generic/include/odp/api/plat/atomic_
> > inlines.h
> >  create mode 100644 platform/linux-generic/include/odp/api/plat/
> > byteorder_inlines.h
> >  create mode 100644 platform/linux-generic/include/odp/api/plat/inlines.
> > h.in
> >  create mode 100644 platform/linux-generic/
> include/odp/api/plat/std_clib_
> > inlines.h
> >  create mode 100644 platform/linux-generic/include/odp/api/plat/sync_
> > inlines.h
> >  create mode 100644 platform/linux-generic/odp_byteorder.c
> >  create mode 100644 platform/linux-generic/odp_std_clib.c
> >  create mode 100644 platform/linux-generic/odp_sync.c
> >
> > diff --git a/configure.ac b/configure.ac
> > index 6551287..982aff7 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -176,6 +176,13 @@ AM_CONDITIONAL([test_example], [test x$test_example
> =
> > xyes ])
> >  AM_CONDITIONAL([HAVE_DOXYGEN], [test "x${DOXYGEN}" = "xdoxygen"])
> >  AM_CONDITIONAL([user_guide], [test "x${user_guides}" = "xyes" ])
> >  AM_CONDITIONAL([HAVE_MSCGEN], [test "x${MSCGEN}" = "xmscgen"])
> > +if test x$enable_shared != xyes;
> > +then
> > +   _ODP_INLINES="_ODP_INLINES"
> > +else
> > +   _ODP_INLINES="_ODP_NO_INLINES"
> > +fi
> > +AC_SUBST(_ODP_INLINES)
> >
> >  
> > ##
> >  # Setup doxygen documentation
> > diff --git a/example/Makefile.inc b/example/Makefile.inc
> > index 70ba2c0..9fb2f29 100644
> > --- a/example/Makefile.inc
> > +++ b/example/Makefile.inc
> > @@ -6,6 +6,7 @@ AM_CFLAGS += \
> > -I$(top_srcdir)/example \
> > -I$(top_srcdir)/platform/@with_platform@/include \
> > -I$(top_srcdir)/include/ \
> > -   -I$(top_srcdir)/helper/include
> > +   -I$(top_srcdir)/helper/include \
> > +   -I$(top_builddir)/platform/@with_platform@/include
> >
> >  AM_LDFLAGS += -L$(LIB)
> > diff --git a/helper/Makefile.am b/helper/Makefile.am
> > index a82a11a..b6e6a1d 100644
> > --- a/helper/Makefile.am
> > +++ b/helper/Makefile.am
> > @@ -7,6 +7,7 @@ LIB   = $(top_builddir)/lib
> >  AM_CFLAGS  = -I$(srcdir)/include
> >  AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include
> >  AM_CFLAGS += -I$(top_srcdir)/include

[lng-odp] issue with odp_crypto validation suite

2016-09-06 Thread Krishna Garapati
>From odp crypto validation suite I see that the application is setting
"auth_cipher_text" flag from odp_crypto_session_params to "false" all ways
(Irrespective of ENCODE or DECODE). What this means from my understanding
is application wants to do "cipher first and then authentication".  And in
the odp_crypto implementation during session_create if the crypto operation
is ENCODE, this flag is set as is against the
"odp_crypto_generic_session_t->do_cipher_first" which actually instead
leads to do authentication then ciphering during crypto operation. This
feels wrong in some way. Any idea about this implementation ?.

/Krishna


Re: [lng-odp] [PATCH] test: performance: return when pkt alloc fails

2016-05-04 Thread Krishna Garapati
Thanks mike, I missed the comment received. my bad.

/Krishna

On 3 May 2016 at 23:33, Mike Holmes  wrote:

> merged
>
> Krishna, I made Maxims update and added his reviewed by for you
>
> On 25 April 2016 at 09:15, Maxim Uvarov  wrote:
>
>> On 04/11/16 12:11, Balakrishna Garapati wrote:
>>
>>> Resolving https://bugs.linaro.org/show_bug.cgi?id=2135 by return
>>> over packet allocation failure.
>>>
>>> Signed-off-by: Balakrishna Garapati 
>>> ---
>>>   test/performance/odp_crypto.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/test/performance/odp_crypto.c
>>> b/test/performance/odp_crypto.c
>>> index fe1c7b4..ca461e5 100644
>>> --- a/test/performance/odp_crypto.c
>>> +++ b/test/performance/odp_crypto.c
>>> @@ -550,6 +550,7 @@ run_measure_one(crypto_args_t *cargs,
>>> if (pkt == ODP_PACKET_INVALID) {
>>> app_err("failed to allocate
>>> buffer\n");
>>> rc = -1;
>>> +   return rc;
>>>
>> that has to be simple:
>> return -1;
>>
>> you can add my
>>  Reviewed-by: Maxim Uvarov 
>>
>> for updated version.
>>
>> Maxim.
>>
>> } else {
>>> void *mem = odp_packet_data(pkt);
>>>
>>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
>
> --
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org  *│ *Open source software for ARM SoCs
> "Work should be fun and collaborative, the rest follows"
>
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] helper: remove unused odph_linux_process_fork API

2016-05-02 Thread Krishna Garapati
On 2 May 2016 at 13:47, Mike Holmes  wrote:

> odph_linux_process_fork is not used by any ODP example or test, it is also
> untested by the helper test suite.
>
Just for the note, we use this api currently in our nginx_ofp app.

>
> odph_linux_process_fork is a wrapper for odph_linux_process_fork_n so
> just delete this, the impact if there are any users is very small.
>
 Agree, need a minor update in the app.

/Krishna

>
> Signed-off-by: Mike Holmes 
> ---
>  helper/include/odp/helper/linux.h | 18 --
>  helper/linux.c| 10 --
>  2 files changed, 28 deletions(-)
>
> diff --git a/helper/include/odp/helper/linux.h
> b/helper/include/odp/helper/linux.h
> index 7a6504f..a68f269 100644
> --- a/helper/include/odp/helper/linux.h
> +++ b/helper/include/odp/helper/linux.h
> @@ -80,24 +80,6 @@ int odph_linux_pthread_create(odph_linux_pthread_t
> *pthread_tbl,
>   */
>  void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num);
>
> -
> -/**
> - * Fork a process
> - *
> - * Forks and sets CPU affinity for the child process. Ignores 'start' and
> 'arg'
> - * thread parameters.
> - *
> - * @param[out] procPointer to process state info (for output)
> - * @param  cpu Destination CPU for the child process
> - * @param  thr_params  Linux helper thread parameters
> - *
> - * @return On success: 1 for the parent, 0 for the child
> - * On failure: -1 for the parent, -2 for the child
> - */
> -int odph_linux_process_fork(odph_linux_process_t *proc, int cpu,
> -   const odph_linux_thr_params_t *thr_params);
> -
> -
>  /**
>   * Fork a number of processes
>   *
> diff --git a/helper/linux.c b/helper/linux.c
> index 24e243b..a181322 100644
> --- a/helper/linux.c
> +++ b/helper/linux.c
> @@ -183,16 +183,6 @@ int odph_linux_process_fork_n(odph_linux_process_t
> *proc_tbl,
> return 1;
>  }
>
> -int odph_linux_process_fork(odph_linux_process_t *proc, int cpu,
> -   const odph_linux_thr_params_t *thr_params)
> -{
> -   odp_cpumask_t mask;
> -
> -   odp_cpumask_zero();
> -   odp_cpumask_set(, cpu);
> -   return odph_linux_process_fork_n(proc, , thr_params);
> -}
> -
>  int odph_linux_process_wait_n(odph_linux_process_t *proc_tbl, int num)
>  {
> pid_t pid;
> --
> 2.7.4
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH] validation: crypto: verify odp crypto capability

2016-04-22 Thread Krishna Garapati
On 22 April 2016 at 17:43, Christophe Milard 
wrote:

>
>
> On 22 April 2016 at 16:14, Balakrishna Garapati <
> balakrishna.garap...@linaro.org> wrote:
>
>> test update to verify the crypto capability fucntionality
>>
>> Signed-off-by: Balakrishna Garapati 
>> ---
>>  test/validation/crypto/odp_crypto_test_inp.c | 28
>> 
>>  1 file changed, 28 insertions(+)
>>
>> diff --git a/test/validation/crypto/odp_crypto_test_inp.c
>> b/test/validation/crypto/odp_crypto_test_inp.c
>> index fc125f7..b608a76 100644
>> --- a/test/validation/crypto/odp_crypto_test_inp.c
>> +++ b/test/validation/crypto/odp_crypto_test_inp.c
>> @@ -46,6 +46,7 @@ static void alg_test(odp_crypto_op_t op,
>>  )
>>  {
>> odp_crypto_session_t session;
>> +   odp_crypto_capability_t capability;
>> int rc;
>> odp_crypto_ses_create_err_t status;
>> odp_bool_t posted;
>> @@ -53,6 +54,33 @@ static void alg_test(odp_crypto_op_t op,
>> odp_crypto_compl_t compl_event;
>> odp_crypto_op_result_t result;
>>
>> +   /* Initialize crypto capability structure */
>> +   memset(, 0, sizeof(odp_crypto_capability_t));
>> +
>> +   rc = odp_crypto_capability();
>> +   CU_ASSERT(!rc);
>> +
>> +   if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&
>> +   !(capability.ciphers.bit.trides_cbc))
>> +   rc = -1;
>> +   if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC &&
>> +   !(capability.ciphers.bit.trides_cbc))
>> +   rc = -1;
>> +   if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM &&
>> +   !(capability.ciphers.bit.trides_cbc))
>> +   rc = -1;
>>
>
> You are testing 3 times the same bit here... copy/paster error?
>
You are right. I will fix it in the patch series.

>
> Christophe
>
>
>> +
>> +   CU_ASSERT(!rc);
>> +
>> +   if (auth_alg == ODP_AUTH_ALG_AES128_GCM &&
>> +   !(capability.auths.bit.aes128_gcm))
>> +   rc = -1;
>> +   if (auth_alg == ODP_AUTH_ALG_NULL &&
>> +   !(capability.auths.bit.null))
>> +   rc = -1;
>> +
>> +   CU_ASSERT(!rc);
>> +
>> /* Create a crypto session */
>> odp_crypto_session_params_t ses_params;
>> memset(_params, 0, sizeof(ses_params));
>> --
>> 1.9.1
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
> /Krishna
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] test: performance: return when pkt alloc fails

2016-04-21 Thread Krishna Garapati
ping

/Krishna

On 11 April 2016 at 11:11, Balakrishna Garapati <
balakrishna.garap...@linaro.org> wrote:

> Resolving https://bugs.linaro.org/show_bug.cgi?id=2135 by return
> over packet allocation failure.
>
> Signed-off-by: Balakrishna Garapati 
> ---
>  test/performance/odp_crypto.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c
> index fe1c7b4..ca461e5 100644
> --- a/test/performance/odp_crypto.c
> +++ b/test/performance/odp_crypto.c
> @@ -550,6 +550,7 @@ run_measure_one(crypto_args_t *cargs,
> if (pkt == ODP_PACKET_INVALID) {
> app_err("failed to allocate
> buffer\n");
> rc = -1;
> +   return rc;
> } else {
> void *mem = odp_packet_data(pkt);
>
> --
> 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 capability

2016-04-20 Thread Krishna Garapati
ping. Maxim, are you still waiting for any response for the comments on
this patch other than petri's explanation provided yesterday ?

/Krishna

On 18 April 2016 at 14:52, Maxim Uvarov  wrote:

> On 04/15/16 12:36, Petri Savolainen wrote:
>
>> Added crypto capability structure and cipher/authentication
>> algorithm bit masks needed by the structure.
>>
>> Signed-off-by: Petri Savolainen 
>> ---
>>   include/odp/api/spec/crypto.h | 88
>> +++
>>   1 file changed, 88 insertions(+)
>>
>> diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
>> index 7c6f9bc..ef106f6 100644
>> --- a/include/odp/api/spec/crypto.h
>> +++ b/include/odp/api/spec/crypto.h
>> @@ -89,6 +89,61 @@ typedef enum {
>>   } odp_auth_alg_t;
>> /**
>> + * Cipher algorithms in a bit field structure
>> + */
>> +typedef union odp_crypto_cipher_algos_t {
>> +   /** Cipher algorithms */
>> +   struct {
>> +   /** ODP_CIPHER_ALG_NULL */
>> +   uint32_t null   : 1;
>>
>
> Should NULL be here? Or just all fields need to be zero?
>
> Also variable name null might be not really good name for C, but we
> already use it.
>
> Maxim.
>
>
> +
>> +   /** ODP_CIPHER_ALG_DES */
>> +   uint32_t des: 1;
>> +
>> +   /** ODP_CIPHER_ALG_3DES_CBC */
>> +   uint32_t trides_cbc : 1;
>> +
>> +   /** ODP_CIPHER_ALG_AES128_CBC */
>> +   uint32_t aes128_cbc : 1;
>> +
>> +   /** ODP_CIPHER_ALG_AES128_GCM */
>> +   uint32_t aes128_gcm : 1;
>> +   } bit;
>> +
>> +   /** All bits of the bit field structure
>> + *
>> + * This field can be used to set/clear all flags, or bitwise
>> + * operations over the entire structure. */
>> +   uint32_t all_bits;
>> +} odp_crypto_cipher_algos_t;
>> +
>> +/**
>> + * Authentication algorithms in a bit field structure
>> + */
>> +typedef union odp_crypto_auth_algos_t {
>> +   /** Authentication algorithms */
>> +   struct {
>> +   /** ODP_AUTH_ALG_NULL */
>> +   uint32_t null   : 1;
>> +
>> +   /** ODP_AUTH_ALG_MD5_96 */
>> +   uint32_t md5_96 : 1;
>> +
>> +   /** ODP_AUTH_ALG_SHA256_128 */
>> +   uint32_t sha256_128 : 1;
>> +
>> +   /** ODP_AUTH_ALG_AES128_GCM */
>> +   uint32_t aes128_gcm : 1;
>> +   } bit;
>> +
>> +   /** All bits of the bit field structure
>> + *
>> + * This field can be used to set/clear all flags, or bitwise
>> + * operations over the entire structure. */
>> +   uint32_t all_bits;
>> +} odp_crypto_auth_algos_t;
>> +
>> +/**
>>* Crypto API key structure
>>*/
>>   typedef struct odp_crypto_key {
>> @@ -254,6 +309,39 @@ typedef struct odp_crypto_op_result {
>>   } odp_crypto_op_result_t;
>> /**
>> + * Crypto capabilities
>> + */
>> +typedef struct odp_crypto_capability_t {
>> +   /** Maximum number of crypto sessions */
>> +   uint32_t max_sessions;
>> +
>> +   /** Supported chipher algorithms */
>> +   odp_crypto_cipher_algos_t chiphers;
>> +
>> +   /** Chipher algorithms implemented with HW offload */
>> +   odp_crypto_cipher_algos_t hw_chiphers;
>> +
>> +   /** Supported authentication algorithms */
>> +   odp_crypto_auth_algos_t   auths;
>> +
>> +   /** Authentication algorithms implemented with HW offload */
>> +   odp_crypto_auth_algos_t   hw_auths;
>> +
>> +} odp_crypto_capability_t;
>> +
>> +/**
>> + * Query crypto capabilities
>> + *
>> + * Outputs crypto capabilities on success.
>> + *
>> + * @param[out] capa   Pointer to capability structure for output
>> + *
>> + * @retval 0 on success
>> + * @retval <0 on failure
>> + */
>> +int odp_crypto_capability(odp_crypto_capability_t *capa);
>> +
>> +/**
>>* Crypto session creation (synchronous)
>>*
>>* @param paramsSession parameters
>>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

2016-04-15 Thread Krishna Garapati
On 15 April 2016 at 11:36, Petri Savolainen 
wrote:

> Added crypto capability structure and cipher/authentication
> algorithm bit masks needed by the structure.
>
> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/spec/crypto.h | 88
> +++
>  1 file changed, 88 insertions(+)
>
> diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
> index 7c6f9bc..ef106f6 100644
> --- a/include/odp/api/spec/crypto.h
> +++ b/include/odp/api/spec/crypto.h
> @@ -89,6 +89,61 @@ typedef enum {
>  } odp_auth_alg_t;
>
>  /**
> + * Cipher algorithms in a bit field structure
> + */
> +typedef union odp_crypto_cipher_algos_t {
> +   /** Cipher algorithms */
> +   struct {
> +   /** ODP_CIPHER_ALG_NULL */
> +   uint32_t null   : 1;
> +
> +   /** ODP_CIPHER_ALG_DES */
> +   uint32_t des: 1;
> +
> +   /** ODP_CIPHER_ALG_3DES_CBC */
> +   uint32_t trides_cbc : 1;
> +
> +   /** ODP_CIPHER_ALG_AES128_CBC */
> +   uint32_t aes128_cbc : 1;
> +
> +   /** ODP_CIPHER_ALG_AES128_GCM */
> +   uint32_t aes128_gcm : 1;
> +   } bit;
> +
> +   /** All bits of the bit field structure
> + *
> + * This field can be used to set/clear all flags, or bitwise
> + * operations over the entire structure. */
> +   uint32_t all_bits;
> +} odp_crypto_cipher_algos_t;
> +
> +/**
> + * Authentication algorithms in a bit field structure
> + */
> +typedef union odp_crypto_auth_algos_t {
> +   /** Authentication algorithms */
> +   struct {
> +   /** ODP_AUTH_ALG_NULL */
> +   uint32_t null   : 1;
> +
> +   /** ODP_AUTH_ALG_MD5_96 */
> +   uint32_t md5_96 : 1;
> +
> +   /** ODP_AUTH_ALG_SHA256_128 */
> +   uint32_t sha256_128 : 1;
> +
> +   /** ODP_AUTH_ALG_AES128_GCM */
> +   uint32_t aes128_gcm : 1;
> +   } bit;
> +
> +   /** All bits of the bit field structure
> + *
> + * This field can be used to set/clear all flags, or bitwise
> + * operations over the entire structure. */
> +   uint32_t all_bits;
> +} odp_crypto_auth_algos_t;
> +
> +/**
>   * Crypto API key structure
>   */
>  typedef struct odp_crypto_key {
> @@ -254,6 +309,39 @@ typedef struct odp_crypto_op_result {
>  } odp_crypto_op_result_t;
>
>  /**
> + * Crypto capabilities
> + */
> +typedef struct odp_crypto_capability_t {
> +   /** Maximum number of crypto sessions */
> +   uint32_t max_sessions;
> +
> +   /** Supported chipher algorithms */
> +   odp_crypto_cipher_algos_t chiphers;
> +
> +   /** Chipher algorithms implemented with HW offload */
> +   odp_crypto_cipher_algos_t hw_chiphers;
> +
> +   /** Supported authentication algorithms */
> +   odp_crypto_auth_algos_t   auths;
> +
> +   /** Authentication algorithms implemented with HW offload */
> +   odp_crypto_auth_algos_t   hw_auths;
> +
> +} odp_crypto_capability_t;
> +
> +/**
> + * Query crypto capabilities
> + *
> + * Outputs crypto capabilities on success.
> + *
> + * @param[out] capa   Pointer to capability structure for output
> + *
> + * @retval 0 on success
>
 return 1 on success would be easier to interpret when we do if check.

> + * @retval <0 on failure
>
 what would be the reason for failure in this case ?.

> + */
> +int odp_crypto_capability(odp_crypto_capability_t *capa);
> +
> +/**
>   * Crypto session creation (synchronous)
>   *
>   * @param paramsSession parameters
> --
> 2.7.2
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp


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


Re: [lng-odp] [RFC] api: crypto capability support

2016-04-14 Thread Krishna Garapati
Thanks Petri, now it is clear what you have in mind. BTW, it looks like a
patch that can be proposed. So, please send it as patch version for review

/Krishna

On 14 April 2016 at 10:50, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> Hi,
>
> See under my proposal on using bit fields and a capability struct similar
> to what we have already for other APIs. Application may easily check if
> multiple ciphers are support and especially if those are implemented with
> HW offload.
>
> -Petri
>
>
> odp_crypto_ciphers_t ciphers;
> odp_pktio_capability_t capa;
>
> ciphers.all_bits   = 0;
> ciphers.3des_cbc   = 1;
> ciphers.aes128_cbc = 1;
>
> odp_crypto_capability();
>
> if (capa.chiphers.all_bits & ciphers.all_bits == 0) {
>  // 3des or aes are not supported
>  ...
>  return -1;
> }
>
> if (capa.hw_chiphers.all_bits & ciphers.all_bits == 0) {
>  // 3des or aes are not supported in HW
>  ...
> }
>
>
>
> typedef union odp_crypto_ciphers_t {
> /** Cipher algorithms */
> struct {
> /** ODP_CIPHER_ALG_NULL */
> uint32_t null   : 1;
>
> /** ODP_CIPHER_ALG_DES */
> uint32_t des: 1;
>
> /** ODP_CIPHER_ALG_3DES_CBC */
> uint32_t 3des_cbc   : 1;
>
> /** ODP_CIPHER_ALG_AES128_CBC */
> uint32_t aes128_cbc : 1;
>
> /** ODP_CIPHER_ALG_AES128_GCM */
> uint32_t aes128_gcm : 1;
>
> } bit;
>
> /** All bits of the bit field structure
>   *
>   * This field can be used to set/clear all flags, or bitwise
>   * operations over the entire structure. */
> uint32_t all_bits;
> } odp_crypto_ciphers_t;
>
>
> typedef union odp_crypto_auths_t {
> /** Cipher algorithms */
> struct {
> /** ODP_AUTH_ALG_NULL */
> uint32_t null   : 1;
>
> /** ODP_AUTH_ALG_MD5_96 */
> uint32_t md5_96 : 1;
>
> /** ODP_AUTH_ALG_SHA256_128 */
> uint32_t sha256_128 : 1;
>
> /** ODP_AUTH_ALG_AES128_GCM */
> uint32_t aes128_gcm : 1;
>
> } bit;
>
> /** All bits of the bit field structure
>   *
>   * This field can be used to set/clear all flags, or bitwise
>   * operations over the entire structure. */
> uint32_t all_bits;
> } odp_crypto_auths_t;
>
>
> typedef struct odp_crypto_capability_t {
> /** Maximum number of crypto sessions */
> uint32_t max_sessions;
>
> /** Supported chipher algorithms */
> odp_crypto_ciphers_t chiphers;
>
> /** Chipher algorithms implemented with HW offload */
> odp_crypto_ciphers_t hw_chiphers;
>
> /** Supported authentication algorithms */
> odp_crypto_auths_t auths;
>
> /** Authentication algorithms implemented with HW offload */
> odp_crypto_auths_t hw_auths;
>
> } odp_crypto_capability_t;
>
>
> /**
>  * Query crypto capabilities
>  *
>  * Outputs crypto capabilities on success.
>  *
>  * @param[out] capa   Pointer to capability structure for output
>  *
>  * @retval 0 on success
>  * @retval <0 on failure
>  */
> int odp_crypto_capability(odp_pktio_capability_t *capa);
>
>
>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> > Balakrishna Garapati
> > Sent: Wednesday, April 13, 2016 3:33 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [RFC] api: crypto capability support
> >
> > This RFC provides the support for the applicationis to inquire the given
> > cipher, authentication algorithms
> >
> > Signed-off-by: Balakrishna Garapati 
> > ---
> >  include/odp/api/spec/crypto.h | 30 ++
> >  1 file changed, 30 insertions(+)
> >
> > diff --git a/include/odp/api/spec/crypto.h
> b/include/odp/api/spec/crypto.h
> > index 41beedb..0def211 100644
> > --- a/include/odp/api/spec/crypto.h
> > +++ b/include/odp/api/spec/crypto.h
> > @@ -254,6 +254,18 @@ typedef struct odp_crypto_op_result {
> >  } odp_crypto_op_result_t;
> >
> >  /**
> > + * Crypto API capability result
> > + */
> > +typedef enum odp_crypto_capability_t {
> > + /** crypto algorithm not supported */
> > + ODP_CRYPTO_NO_SUPPORT = 0,
> > + /** crypto algorithm supported in hardware */
> > + ODP_CRYPTO_HW_SUPPORT,
> > + /** crypto algortihm supported in software */
> > + ODP_CRYPTO_SW_SUPPORT
> > +} odp_crypto_capability_t;
> > +
> > +/**
> >   * Crypto session creation (synchronous)
> >   *
> >   * @param paramsSession parameters
> > @@ -368,6 +380,24 @@ uint64_t
> > odp_crypto_session_to_u64(odp_crypto_session_t hdl);
> >  uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl);
> >
> >  /**
> > + * Verify the given crypto cipher algorithm support
> > + *
> > + * 

Re: [lng-odp] [PATCHv3] linux-generic:release memory during session destory

2016-03-23 Thread Krishna Garapati
It is referenced in the message. Fallowing is the commit
id: f4404beac33ba8fab6edeb6587067c366cb8d4b1

/Krishna

On 22 March 2016 at 18:48, Mike Holmes  wrote:

> The bug needs to be referenced in the git message, assume it is
> https://bugs.linaro.org/show_bug.cgi?id=2127
>
>
> On 18 March 2016 at 05:14, Maxim Uvarov  wrote:
>
>> changes are ok, but patch should match code style. Please fix and add
>> Bala's review to next version.
>>
>> perl ./scripts/checkpatch.pl
>> 0001-linux-generic-release-memory-during-session-destory.patch
>> WARNING: 'destory' may be misspelled - perhaps 'destroy'?
>> #4:
>> Subject: [PATCH] linux-generic:release memory during session destory
>>
>> ERROR: code indent should use tabs where possible
>> #20: FILE: platform/linux-generic/odp_crypto.c:707:
>> +if (generic->cipher.alg == ODP_CIPHER_ALG_AES128_GCM)$
>>
>> WARNING: please, no spaces at the start of a line
>> #20: FILE: platform/linux-generic/odp_crypto.c:707:
>> +if (generic->cipher.alg == ODP_CIPHER_ALG_AES128_GCM)$
>>
>> ERROR: code indent should use tabs where possible
>> #21: FILE: platform/linux-generic/odp_crypto.c:708:
>> + ^IEVP_CIPHER_CTX_free(generic->cipher.data.aes_gcm.ctx);$
>>
>> WARNING: please, no space before tabs
>> #21: FILE: platform/linux-generic/odp_crypto.c:708:
>> + ^IEVP_CIPHER_CTX_free(generic->cipher.data.aes_gcm.ctx);$
>>
>> WARNING: please, no spaces at the start of a line
>> #21: FILE: platform/linux-generic/odp_crypto.c:708:
>> + ^IEVP_CIPHER_CTX_free(generic->cipher.data.aes_gcm.ctx);$
>>
>> total: 2 errors, 4 warnings, 0 checks, 8 lines checked
>>
>> Thank you,
>> Maxim.
>>
>> On 03/16/16 16:22, Bala Manoharan wrote:
>>
>>> Reviewed-by: Balasubramanian Manoharan >> >
>>>
>>> On 15 March 2016 at 18:39, balakrishna.garapati <
>>> balakrishna.garap...@linaro.org >
>>> wrote:
>>>
>>> Signed-off-by: balakrishna.garapati
>>> >> >
>>> ---
>>>  platform/linux-generic/odp_crypto.c | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/platform/linux-generic/odp_crypto.c
>>> b/platform/linux-generic/odp_crypto.c
>>> index 08b479d..e468677 100644
>>> --- a/platform/linux-generic/odp_crypto.c
>>> +++ b/platform/linux-generic/odp_crypto.c
>>> @@ -704,6 +704,8 @@ int
>>> odp_crypto_session_destroy(odp_crypto_session_t session)
>>> odp_crypto_generic_session_t *generic;
>>>
>>> generic = (odp_crypto_generic_session_t *)(intptr_t)session;
>>> +if (generic->cipher.alg == ODP_CIPHER_ALG_AES128_GCM)
>>> +  EVP_CIPHER_CTX_free(generic->cipher.data.aes_gcm.ctx);
>>> memset(generic, 0, sizeof(*generic));
>>> free_session(generic);
>>> return 0;
>>> --
>>> 1.9.1
>>>
>>>
>>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
>
> --
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org  *│ *Open source software for ARM SoCs
> "Work should be fun and collaborative, the rest follows"
>
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] Does ODP support DPDK flow director feature APIs?

2015-12-14 Thread Krishna Garapati
including odp team.

/Krishna

On 13 December 2015 at 20:40, Dapeng Liu  wrote:

> Hi Wenxian,
>
> I checked the API document but failed to find a exact matching function.
> Just share my understanding with you.
>
> ODP has an event distribution model working as below:
> 1) packet classified to COS(class of service),
> 2) COS associated to queue
> 3) queue associated to worker thread.
> Although the worker thread could be created with pinned CPU with
> odph_linux_pthread_create. The problem is that packet classification at the
> first step is based on some certain fields in the frame, which is either IP
> or port or something else but hard to be the combination unless with some
> carefully defined offset and mask. Moreover user has to specify the desired
> matched value. So seemingly it is hard to achieve the flow(5-tuples) based
> distribution where we never specify the matched value.
>
> If it indeed turns out to be a missing function, I think it could be a
> good candidate feature in the future for ODP.
> However given the shallow understanding of ODP, I am probably wrong :)
>
> Let's wait for experts' comments.
>
> Best Regards,
> Dapeng
>
> ​
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4] example:generator:move verbose from worker to control

2015-08-20 Thread Krishna Garapati


  +static void print_global_stats(int num_workers)
  +{
  + uint64_t start, now, diff;
  + uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0;
  + int verbose_interval = 20, worker_count;
  + odp_thrmask_t thrd_mask;
  +
  + start = odp_time_cycles();
  + while (1) {
  + now = odp_time_cycles();
  + diff = odp_time_diff_cycles(start, now);
  + if (odp_time_cycles_to_ns(diff) 
  +verbose_interval * ODP_TIME_SEC) {
  + continue;
  + }

 There's no exit condition check in this loop above, so you'll wait up to
 verbose_interval extra seconds unnecessarily, for example when running
 with -n 100 the workers will finish quickly.

 +
  + start = odp_time_cycles();
  +
  + worker_count = odp_thrmask_worker(thrd_mask);

 There's a potential race here as the worker thread counts get
 incremented after the thread has started (rather than during the
 odph_linux_pthread_create() call), and it's pretty likely this code
 will be reached by the main thread before the workers have started.

 Should wait until worker count has reached num_workers before entering
 the loop.



 verbose_interval * ODP_TIME_SEC internally a sleep time before reaching
this check. Even if we introduce the worker_count == num_workers, we might
have to do a default sleep anyway to make sure we have workers up and
running otherwise we break the loop. do we still need a separate check for
this ?



  + if (worker_count  num_workers)
  + break;

 --
 Stuart.

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


Re: [lng-odp] [PATCHv7] example:generator:option to supply core mask

2015-08-19 Thread Krishna Garapati
Fixed all the comments in PATCHv8.

On 19 August 2015 at 11:49, Stuart Haslam stuart.has...@linaro.org wrote:

 On Wed, Aug 12, 2015 at 10:55:12AM +0200, Balakrishna.Garapati wrote:
  Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
  ---
   validate cpumask from parse_args and exit with a message
 
   example/generator/odp_generator.c | 72
 ---
   1 file changed, 52 insertions(+), 20 deletions(-)
 
  diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
  index bdee222..2ad4e27 100644
  --- a/example/generator/odp_generator.c
  +++ b/example/generator/odp_generator.c
  @@ -43,6 +43,7 @@
*/
   typedef struct {
int cpu_count;  /** system CPU count */
  + const char *mask;   /** s/core mask/CPU mask */

 In my previous comment I was asking to replace the text core mask with
 CPU mask.


Fixed the comment in PATCHv8


int if_count;   /** Number of interfaces to be used */
char **if_names;/** Array of pointers to interface names
 */
char *if_str;   /** Storage for interface names */
  @@ -645,18 +646,26 @@ int main(int argc, char *argv[])
if (args-appl.cpu_count)
num_workers = args-appl.cpu_count;
 
  - /* ping mode need two worker */
  - if (args-appl.mode == APPL_MODE_PING)
  - num_workers = 2;
  -
  - /* Get default worker cpumask */
num_workers = odp_cpumask_def_worker(cpumask, num_workers);
  + if (args-appl.mask) {
  + odp_cpumask_from_str(cpumask, args-appl.mask);
  + num_workers = odp_cpumask_count(cpumask);
  + }
  +
(void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
printf(cpu mask:   %s\n, cpumaskstr);
 
  + /* ping mode need two workers */
  + if (args-appl.mode == APPL_MODE_PING) {
  + if (num_workers  2) {
  + EXAMPLE_ERR(Need at least two worker threads\n);
  + exit(EXIT_FAILURE);
  + }
  + }
  +
/* Create packet pool */
memset(params, 0, sizeof(params));
params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
  @@ -704,12 +713,13 @@ int main(int argc, char *argv[])
memset(thread_tbl, 0, sizeof(thread_tbl));
 
if (args-appl.mode == APPL_MODE_PING) {
  - odp_cpumask_t cpu0_mask;
  + odp_cpumask_t cpu_mask;
odp_queue_t tq;
  + int cpu_first, cpu_next;
 
  - /* Previous code forced both threads to CPU 0 */
  - odp_cpumask_zero(cpu0_mask);
  - odp_cpumask_set(cpu0_mask, 0);
  + odp_cpumask_zero(cpu_mask);
  + cpu_first = odp_cpumask_first(cpumask);
  + odp_cpumask_set(cpu_mask, cpu_first);
 
tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
if (tq == ODP_QUEUE_INVALID)
  @@ -725,7 +735,7 @@ int main(int argc, char *argv[])
if (args-thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args-thread[1].mode = args-appl.mode;
  - odph_linux_pthread_create(thread_tbl[1], cpu0_mask,
  + odph_linux_pthread_create(thread_tbl[1], cpu_mask,
  gen_recv_thread,
 args-thread[1]);
 
tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
  @@ -742,7 +752,10 @@ int main(int argc, char *argv[])
if (args-thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args-thread[0].mode = args-appl.mode;
  - odph_linux_pthread_create(thread_tbl[0], cpu0_mask,
  + cpu_next = odp_cpumask_next(cpumask, cpu_first);
  + odp_cpumask_zero(cpu_mask);
  + odp_cpumask_set(cpu_mask, cpu_next);
  + odph_linux_pthread_create(thread_tbl[0], cpu_mask,
  gen_send_thread,
 args-thread[0]);
 
/* only wait send thread to join */
  @@ -824,11 +837,12 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
static struct option longopts[] = {
{interface, required_argument, NULL, 'I'},
{workers, required_argument, NULL, 'w'},
  + {cpumask, required_argument, NULL, 'c'},
{srcmac, required_argument, NULL, 'a'},
{dstmac, required_argument, NULL, 'b'},
  - {srcip, required_argument, NULL, 'c'},
  + {srcip, required_argument, NULL, 's'},
{dstip, required_argument, NULL, 'd'},
  - {packetsize, required_argument, NULL, 's'},
  + {packetsize, required_argument, NULL, 'p'},
{mode, required_argument, NULL, 'm'},
   

Re: [lng-odp] [PATCHv5] example:generator:option to supply core mask

2015-08-18 Thread Krishna Garapati
Stuart, you have reviewed the old patch. please look at the PATCHv7 
http://patches.opendataplane.org/patch/2723/;

On 18 August 2015 at 16:45, Stuart Haslam stuart.has...@linaro.org wrote:

 On Mon, Aug 10, 2015 at 02:27:46PM +0200, Balakrishna.Garapati wrote:
  Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
  ---
   Updated core mask usage, fixed the cpu limit check with core mask.
   example/generator/odp_generator.c | 65
 +++
   1 file changed, 45 insertions(+), 20 deletions(-)
 
  diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
  index bdee222..9408db1 100644
  --- a/example/generator/odp_generator.c
  +++ b/example/generator/odp_generator.c
  @@ -43,6 +43,7 @@
*/
   typedef struct {
int cpu_count;  /** system CPU count */
  + const char *mask;   /** s/core mask/CPU mask */

 In my previous comment I was asking to replace the text core mask with
 CPU mask.

int if_count;   /** Number of interfaces to be used */
char **if_names;/** Array of pointers to interface names
 */
char *if_str;   /** Storage for interface names */
  @@ -645,18 +646,31 @@ int main(int argc, char *argv[])
if (args-appl.cpu_count)
num_workers = args-appl.cpu_count;
 
  - /* ping mode need two worker */
  - if (args-appl.mode == APPL_MODE_PING)
  - num_workers = 2;
  + if (args-appl.mask) {
  + odp_cpumask_from_str(cpumask, args-appl.mask);
  + num_workers = odp_cpumask_count(cpumask);
  + if (odp_cpumask_last(cpumask)  odp_cpu_count()) {

 odp_cpumask_last() returns the ID of the last set CPU in the mask, which
 could well be greater than the number of CPUs as the numbering scheme is
 system specific.

  + num_workers = odp_cpumask_def_worker(cpumask,
  +  num_workers);
  + }

 I think we need to clarify a few things in this area as the purpose and
 expected usage of the odp_cpumask_def_worker() is not well defined.

 For now though, I would omit the check here and just attempt to start
 a thread on each CPU in the mask provided on the cmdline, and rely on
 the thread creation failing if it's an invalid CPU.. which would mean
 checking the return value of odph_linux_pthread_create()

  + } else {
  + num_workers = odp_cpumask_def_worker(cpumask,
 num_workers);
  + }
 
  - /* Get default worker cpumask */
  - num_workers = odp_cpumask_def_worker(cpumask, num_workers);
(void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
printf(cpu mask:   %s\n, cpumaskstr);
 
  + /* ping mode need two workers */
  + if (args-appl.mode == APPL_MODE_PING) {
  + if (num_workers  2) {
  + EXAMPLE_ERR(Need at least two worker threads\n);
  + exit(EXIT_FAILURE);
  + }
  + }
  +
/* Create packet pool */
memset(params, 0, sizeof(params));
params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
  @@ -704,12 +718,13 @@ int main(int argc, char *argv[])
memset(thread_tbl, 0, sizeof(thread_tbl));
 
if (args-appl.mode == APPL_MODE_PING) {
  - odp_cpumask_t cpu0_mask;
  + odp_cpumask_t cpu_mask;
odp_queue_t tq;
  + int cpu_first, cpu_next;
 
  - /* Previous code forced both threads to CPU 0 */
  - odp_cpumask_zero(cpu0_mask);
  - odp_cpumask_set(cpu0_mask, 0);
  + odp_cpumask_zero(cpu_mask);
  + cpu_first = odp_cpumask_first(cpumask);
  + odp_cpumask_set(cpu_mask, cpu_first);
 
tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
if (tq == ODP_QUEUE_INVALID)
  @@ -725,7 +740,7 @@ int main(int argc, char *argv[])
if (args-thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args-thread[1].mode = args-appl.mode;
  - odph_linux_pthread_create(thread_tbl[1], cpu0_mask,
  + odph_linux_pthread_create(thread_tbl[1], cpu_mask,
  gen_recv_thread,
 args-thread[1]);
 
tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
  @@ -742,7 +757,10 @@ int main(int argc, char *argv[])
if (args-thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args-thread[0].mode = args-appl.mode;
  - odph_linux_pthread_create(thread_tbl[0], cpu0_mask,
  + cpu_next = odp_cpumask_next(cpumask, cpu_first);
  + odp_cpumask_zero(cpu_mask);
  + odp_cpumask_set(cpu_mask, cpu_next);
  + 

Re: [lng-odp] [PATCHv4] example:generator:move verbose from worker to control

2015-08-13 Thread Krishna Garapati
Stuart, does this patch look ok ?

On 7 August 2015 at 15:37, Maxim Uvarov maxim.uva...@linaro.org wrote:

 On 08/07/15 15:23, Krishna Garapati wrote:

 I will look into the API replacement.  If I understood your comment
 correctly, I am already reusing the initial calculated num_workers and
 trying to compare it to the current workers to see if any thread has been
 exited. So that  we can break out from the loop. And this check happens
 only after each verbose_timeout, does it still effects the performance?.


 Ok, I did not release first that you use  odp_thrmask_worker() to check
 how many worker threads run now. I double checked with Bill and Stuart that
 we support dynamic workers and that function can be used in that way.




 And about the MAX_WORKERS, I kinda fixed the issue in the other patch
 [PATCHv4] example:generator:option to supply core mask (
 http://patches.opendataplane.org/patch/2561/).

 Can you look at that and give me comments which might be relevant patch
 for this comment?.

 Ok.

 Maxim.

 /Krishna

 Ma to  supply core mask

 On 7 August 2015 at 13:36, Maxim Uvarov maxim.uva...@linaro.org mailto:
 maxim.uva...@linaro.org wrote:

 On 08/07/15 12:00, Balakrishna.Garapati wrote:

 Signed-off-by: Balakrishna.Garapati
 balakrishna.garap...@linaro.org
 mailto:balakrishna.garap...@linaro.org

 ---
   Made updates to print recv stats based on mode

   example/generator/odp_generator.c | 81
 ---
   1 file changed, 67 insertions(+), 14 deletions(-)

 diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
 index bdee222..5d1c54a 100644
 --- a/example/generator/odp_generator.c
 +++ b/example/generator/odp_generator.c
 @@ -101,6 +101,7 @@ static void usage(char *progname);
   static int scan_ip(char *buf, unsigned int *paddr);
   static int scan_mac(char *in, odph_ethaddr_t *des);
   static void tv_sub(struct timeval *recvtime, struct timeval
 *sendtime);
 +static void print_global_stats(int num_workers);
 /**
* Sleep for the specified amount of milliseconds
 @@ -371,7 +372,6 @@ static odp_pktio_t create_pktio(const char
 *dev, odp_pool_t pool)
   static void *gen_send_thread(void *arg)
   {
 int thr;
 -   uint64_t start, now, diff;
 odp_pktio_t pktio;
 thread_args_t *thr_args;
 odp_queue_t outq_def;
 @@ -393,7 +393,6 @@ static void *gen_send_thread(void *arg)
 return NULL;
 }
   - start = odp_time_cycles();
 printf(  [%02i] created mode: SEND\n, thr);
 for (;;) {
 int err;
 @@ -434,15 +433,6 @@ static void *gen_send_thread(void *arg)
 = (unsigned int)args-appl.number) {
 break;
 }
 -
 -   now = odp_time_cycles();
 -   diff = odp_time_diff_cycles(start, now);
 -   if (odp_time_cycles_to_ns(diff)  20 *
 ODP_TIME_SEC) {
 -   start = odp_time_cycles();
 -   printf(  [%02i] total send: %ju\n,
 -  thr,
 odp_atomic_load_u64(counters.seq));
 -   fflush(stdout);
 -   }
 }
 /* receive number of reply pks until timeout */
 @@ -502,16 +492,16 @@ static void print_pkts(int thr,
 odp_packet_t pkt_tbl[], unsigned len)
 continue;
 odp_atomic_inc_u64(counters.ip);
 -   rlen += sprintf(msg, receive Packet proto:IP );
 buf = odp_packet_data(pkt);
 ip = (odph_ipv4hdr_t *)(buf +
 odp_packet_l3_offset(pkt));
 -   rlen += sprintf(msg + rlen, id %d ,
 -  odp_be_to_cpu_16(ip-id));
 offset = odp_packet_l4_offset(pkt);
 /* udp */
 if (ip-proto == ODPH_IPPROTO_UDP) {
 odp_atomic_inc_u64(counters.udp);
 +   rlen += sprintf(msg, receive Packet
 proto:IP );
 +   rlen += sprintf(msg + rlen, id %d ,
 +  odp_be_to_cpu_16(ip-id));
 udp = (odph_udphdr_t *)(buf + offset);
 rlen += sprintf(msg + rlen, UDP
 payload %d ,
 odp_be_to_cpu_16(udp-length) -
 @@ -589,6 +579,67 @@ static void *gen_recv_thread(void *arg)
 return arg;
   }
 +
 +/**
 + * printing verbose statistics

Re: [lng-odp] [PATCHv6] example:generator:option to supply core mask

2015-08-11 Thread Krishna Garapati
I will look at the suggestions and make the necessary changes. Thank you
for the comments.

On 11 August 2015 at 16:01, Maxim Uvarov maxim.uva...@linaro.org wrote:

 Hello Balakrishna,

 after some more thinking I think we not exactly right here.


 In parse:

 +   case 'c':
 +   appl_args-mask = optarg;
 +   break;


 we have to check that mask is valid. I.e. compare results:

 odp_cpumask_from_str(cpumask_args, args-appl.mask);

 num_workers_args = odp_cpumask_count(cpumask);
 and

 num_workers = odp_cpumask_def_worker(cpumask,  0);

 Following should match:

 1. num_workers_args =  num_workers
 2.  cpumask_args should be inside cpumask. (that check covers 1, so first
 is optional).
 3. num_workers = args.appl.cpu_count.

 If user requested core mask for workers which system can not provide, you
 should quit
 from program with readable message.


 Then on calculation workers you code will be very simple. Instead of:

 On 08/11/15 10:20, Balakrishna.Garapati wrote:

 +   if (args-appl.mask) {
 +   odp_cpumask_from_str(cpumask, args-appl.mask);
 +   num_workers = odp_cpumask_count(cpumask);
 +   if (odp_cpu_count()  (odp_cpumask_last(cpumask) + 1)) {
 +   num_workers = odp_cpumask_def_worker(cpumask,
 +num_workers);
 +   }
 +   } else {
 +   num_workers = odp_cpumask_def_worker(cpumask,
 num_workers);
 +   }


 it will be:

 +   num_workers = odp_cpumask_def_worker(cpumask, num_workers);


 +   if (args-appl.mask) {
 +   odp_cpumask_from_str(cpumask, args-appl.mask);
 +   num_workers = odp_cpumask_count(cpumask);
 }


 In that case you will not ovverrige cpu mask when you call
 odp_cpumask_def_worker() after calculation number cpus from command line.
 (code
 in that patch).

 Maxim.






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


Re: [lng-odp] [PATCHv4] example:generator:option to supply core mask

2015-08-10 Thread Krishna Garapati
I will make another patch v5 with the changes.

On 7 August 2015 at 16:24, Maxim Uvarov maxim.uva...@linaro.org wrote:

 Balakrishna,

 please also update usage() how to use thread mask here. And please find
 one commend inside.

 Best regards,
 Maxim.


 On 08/05/15 21:09, Balakrishna.Garapati wrote:

 Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
 ---
   Fixed the comments

   example/generator/odp_generator.c | 59
 ++-
   1 file changed, 40 insertions(+), 19 deletions(-)

 diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
 index bdee222..e364afa 100644
 --- a/example/generator/odp_generator.c
 +++ b/example/generator/odp_generator.c
 @@ -43,6 +43,7 @@
*/
   typedef struct {
 int cpu_count;  /** system CPU count */
 +   const char *mask;   /** s/core mask/CPU mask */
 int if_count;   /** Number of interfaces to be used */
 char **if_names;/** Array of pointers to interface names
 */
 char *if_str;   /** Storage for interface names */
 @@ -645,18 +646,27 @@ int main(int argc, char *argv[])
 if (args-appl.cpu_count)
 num_workers = args-appl.cpu_count;
   - /* ping mode need two worker */
 -   if (args-appl.mode == APPL_MODE_PING)
 -   num_workers = 2;
 +   if (args-appl.mask) {
 +   odp_cpumask_from_str(cpumask, args-appl.mask);
 +   num_workers = odp_cpumask_count(cpumask);

 here you got number mask from cmdline, convert it to count, but did not
 check that this count less then MAX_CPUS. So on access to
 array here might be seg. fault.  You can check it here or in page_args().

 +   } else {
 +   num_workers = odp_cpumask_def_worker(cpumask,
 num_workers);


 or call above function in both cases.



 +   }
   - /* Get default worker cpumask */
 -   num_workers = odp_cpumask_def_worker(cpumask, num_workers);
 (void)odp_cpumask_to_str(cpumask, cpumaskstr,
 sizeof(cpumaskstr));
 printf(num worker threads: %i\n, num_workers);
 printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
 printf(cpu mask:   %s\n, cpumaskstr);
   + /* ping mode need two workers */
 +   if (args-appl.mode == APPL_MODE_PING) {
 +   if (num_workers  2) {
 +   EXAMPLE_ERR(Need at least two worker threads\n);
 +   exit(EXIT_FAILURE);
 +   }
 +   }
 +
 /* Create packet pool */
 memset(params, 0, sizeof(params));
 params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
 @@ -704,12 +714,13 @@ int main(int argc, char *argv[])
 memset(thread_tbl, 0, sizeof(thread_tbl));
 if (args-appl.mode == APPL_MODE_PING) {
 -   odp_cpumask_t cpu0_mask;
 +   odp_cpumask_t cpu_mask;
 odp_queue_t tq;
 +   int cpu_first, cpu_next;
   - /* Previous code forced both threads to CPU 0 */
 -   odp_cpumask_zero(cpu0_mask);
 -   odp_cpumask_set(cpu0_mask, 0);
 +   odp_cpumask_zero(cpu_mask);
 +   cpu_first = odp_cpumask_first(cpumask);
 +   odp_cpumask_set(cpu_mask, cpu_first);
 tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
 if (tq == ODP_QUEUE_INVALID)
 @@ -725,7 +736,7 @@ int main(int argc, char *argv[])
 if (args-thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
 abort();
 args-thread[1].mode = args-appl.mode;
 -   odph_linux_pthread_create(thread_tbl[1], cpu0_mask,
 +   odph_linux_pthread_create(thread_tbl[1], cpu_mask,
   gen_recv_thread,
 args-thread[1]);
 tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
 @@ -742,7 +753,10 @@ int main(int argc, char *argv[])
 if (args-thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
 abort();
 args-thread[0].mode = args-appl.mode;
 -   odph_linux_pthread_create(thread_tbl[0], cpu0_mask,
 +   cpu_next = odp_cpumask_next(cpumask, cpu_first);
 +   odp_cpumask_zero(cpu_mask);
 +   odp_cpumask_set(cpu_mask, cpu_next);
 +   odph_linux_pthread_create(thread_tbl[0], cpu_mask,
   gen_send_thread,
 args-thread[0]);
 /* only wait send thread to join */
 @@ -824,11 +838,12 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
 static struct option longopts[] = {
 {interface, required_argument, NULL, 'I'},
 {workers, required_argument, NULL, 'w'},
 +   {cpumask, required_argument, NULL, 'c'},
 {srcmac, required_argument, NULL, 'a'},
 {dstmac, required_argument, NULL, 'b'},
 -   

Re: [lng-odp] [PATCHv2] example:generator:move verbose from worker to control

2015-08-06 Thread Krishna Garapati
made changes and pushed new version v3.

On 5 August 2015 at 18:39, Stuart Haslam stuart.has...@linaro.org wrote:

 On Tue, Aug 04, 2015 at 11:07:57AM +0200, Balakrishna.Garapati wrote:
  Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
  ---
   Added packet rate stats
   example/generator/odp_generator.c | 67
 ---
   1 file changed, 56 insertions(+), 11 deletions(-)
 
  diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
  index bdee222..aee6e7e 100644
  --- a/example/generator/odp_generator.c
  +++ b/example/generator/odp_generator.c
  @@ -101,6 +101,7 @@ static void usage(char *progname);
   static int scan_ip(char *buf, unsigned int *paddr);
   static int scan_mac(char *in, odph_ethaddr_t *des);
   static void tv_sub(struct timeval *recvtime, struct timeval *sendtime);
  +static void print_global_stats(void);
 
   /**
* Sleep for the specified amount of milliseconds
  @@ -371,7 +372,6 @@ static odp_pktio_t create_pktio(const char *dev,
 odp_pool_t pool)
   static void *gen_send_thread(void *arg)
   {
int thr;
  - uint64_t start, now, diff;
odp_pktio_t pktio;
thread_args_t *thr_args;
odp_queue_t outq_def;
  @@ -393,7 +393,6 @@ static void *gen_send_thread(void *arg)
return NULL;
}
 
  - start = odp_time_cycles();
printf(  [%02i] created mode: SEND\n, thr);
for (;;) {
int err;
  @@ -434,15 +433,6 @@ static void *gen_send_thread(void *arg)
= (unsigned int)args-appl.number) {
break;
}
  -
  - now = odp_time_cycles();
  - diff = odp_time_diff_cycles(start, now);
  - if (odp_time_cycles_to_ns(diff)  20 * ODP_TIME_SEC) {
  - start = odp_time_cycles();
  - printf(  [%02i] total send: %ju\n,
  -thr, odp_atomic_load_u64(counters.seq));
  - fflush(stdout);
  - }
}
 
/* receive number of reply pks until timeout */
  @@ -589,6 +579,59 @@ static void *gen_recv_thread(void *arg)
 
return arg;
   }
  +
  +/**
  + * printing verbose statistics
  + *
  + */
  +static void print_global_stats(void)
  +{
  + uint64_t start, now, diff;
  + uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0;
  + int loop_forever = 1, verbose_interval = 20;
  +
  + if (args-appl.timeout != -1 || args-appl.number  0)
  + loop_forever = 0;
  +
  + start = odp_time_cycles();
  + do {
  + pkts = 0;
  + now = odp_time_cycles();
  + diff = odp_time_diff_cycles(start, now);
  + if (odp_time_cycles_to_ns(diff) 
  + verbose_interval * ODP_TIME_SEC) {

 If you check  instead here and continue; the indentation level of the
 reset of the loop would be reduced.

  + start = odp_time_cycles();
  +
  + if (odp_atomic_load_u64(counters.seq)  0) {
  + pkts = odp_atomic_load_u64(counters.seq);

 Move this assignment outside of the condition to avoid loading the
 atomic twice. Actually I'm not sure about the condition at all, if you're
 in _UDP mode don't you want to print the number of sent packets even if
 it's 0?

  + printf( total send: %ju\n, pkts);

 PRIu64 as is used elsewhere

  + }
  +
  + pps = (pkts - pkts_prev) / verbose_interval;
  + if (pps  maximum_pps)
  + maximum_pps = pps;
  +
  + printf( % PRIu64  pps, % PRIu64  max pps \n,
  +pps, maximum_pps);

 checkpatch -

 WARNING: unnecessary whitespace before a quoted newline

 Also this print is only valid for _UDP mode but it will be printed (and
 always 0) in _RCV mode too.

  +
  + if (args-appl.mode == APPL_MODE_RCV ||
  + odp_atomic_load_u64(counters.icmp) != 0 ||
  + odp_atomic_load_u64(counters.udp) != 0) {
  + printf( total receive(icmp:%ju,
 udp:%ju)\n,

 PRIu64

  +odp_atomic_load_u64(counters.icmp),
  +odp_atomic_load_u64(counters.udp));

 At the minute this output is flooded by the receive Packet proto:IP ..
 lines that get printed unconditionally for every packet, I think they
 need go except for in ICMP mode.

 Also it would be better to print *either* UDP or ICMP counters rather
 than both, only one will be non-zero.

  + }
  +
  + if (args-appl.number  0 
  + odp_atomic_load_u64(counters.icmp) =
  + (unsigned int)args-appl.number)
  + break;

 This logic and the loop condition 

Re: [lng-odp] [PATCHv3] example:generator:option to supply core mask

2015-08-05 Thread Krishna Garapati
Fixed the comments in the new version.

On 5 August 2015 at 19:13, Stuart Haslam stuart.has...@linaro.org wrote:

 On Thu, Jul 30, 2015 at 01:24:01PM +0200, Balakrishna.Garapati wrote:
  Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
  ---
   changed the command line argument conventions.
   example/generator/odp_generator.c | 57
 ++-
   1 file changed, 39 insertions(+), 18 deletions(-)
 
  diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
  index d6ec758..19ad7b4 100644
  --- a/example/generator/odp_generator.c
  +++ b/example/generator/odp_generator.c
  @@ -42,6 +42,7 @@
*/
   typedef struct {
int cpu_count;  /** system CPU count */
  + const char *mask;   /** core mask */

 s/core mask/CPU mask/

int if_count;   /** Number of interfaces to be used */
char **if_names;/** Array of pointers to interface names
 */
char *if_str;   /** Storage for interface names */
  @@ -633,18 +634,27 @@ int main(int argc, char *argv[])
if (args-appl.cpu_count)
num_workers = args-appl.cpu_count;
 
  - /* ping mode need two worker */
  - if (args-appl.mode == APPL_MODE_PING)
  - num_workers = 2;
  + if (args-appl.mask) {
  + (void)odp_cpumask_from_str(cpumask, args-appl.mask);

 This (void) isn't needed as the function returns void anyway so you're
 not ignoring anything.

  + num_workers = odp_cpumask_count(cpumask);
  + } else {
  + num_workers = odp_cpumask_def_worker(cpumask,
 num_workers);
  + }
 
  - /* Get default worker cpumask */
  - num_workers = odp_cpumask_def_worker(cpumask, num_workers);
(void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
printf(cpu mask:   %s\n, cpumaskstr);
 
  + /* ping mode need two workers */
  + if (args-appl.mode == APPL_MODE_PING) {
  + if (num_workers  2) {
  + EXAMPLE_ERR(Need at least two worker threads\n);
  + exit(EXIT_FAILURE);
  + }
  + }
  +
/* Create packet pool */
memset(params, 0, sizeof(params));
params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
  @@ -692,12 +702,13 @@ int main(int argc, char *argv[])
memset(thread_tbl, 0, sizeof(thread_tbl));
 
if (args-appl.mode == APPL_MODE_PING) {
  - odp_cpumask_t cpu0_mask;
  + odp_cpumask_t cpu_mask;
odp_queue_t tq;
  +int cpu_first, cpu_next;

 checkpatch - space indented.

 
  - /* Previous code forced both threads to CPU 0 */
  - odp_cpumask_zero(cpu0_mask);
  - odp_cpumask_set(cpu0_mask, 0);
  + odp_cpumask_zero(cpu_mask);
  + cpu_first = odp_cpumask_first(cpumask);
  + odp_cpumask_set(cpu_mask, cpu_first);
 
tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
if (tq == ODP_QUEUE_INVALID)
  @@ -713,7 +724,7 @@ int main(int argc, char *argv[])
if (args-thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args-thread[1].mode = args-appl.mode;
  - odph_linux_pthread_create(thread_tbl[1], cpu0_mask,
  + odph_linux_pthread_create(thread_tbl[1], cpu_mask,
  gen_recv_thread,
 args-thread[1]);
 
tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
  @@ -730,7 +741,10 @@ int main(int argc, char *argv[])
if (args-thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args-thread[0].mode = args-appl.mode;
  - odph_linux_pthread_create(thread_tbl[0], cpu0_mask,
  + cpu_next = odp_cpumask_next(cpumask, cpu_first);
  + odp_cpumask_zero(cpu_mask);
  + odp_cpumask_set(cpu_mask, cpu_next);
  + odph_linux_pthread_create(thread_tbl[0], cpu_mask,
  gen_send_thread,
 args-thread[0]);
 
/* only wait send thread to join */
  @@ -812,11 +826,12 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
static struct option longopts[] = {
{interface, required_argument, NULL, 'I'},
{workers, required_argument, NULL, 'w'},
  + {coremask, required_argument, NULL, 'c'},

 cpumask

{srcmac, required_argument, NULL, 'a'},
{dstmac, required_argument, NULL, 'b'},
  - {srcip, required_argument, NULL, 'c'},
  + {srcip, required_argument, NULL, 's'},
{dstip, required_argument, NULL, 'd'},
  - {packetsize, required_argument, NULL, 

Re: [lng-odp] [PATCH] example:generator:option to supply core mask

2015-07-30 Thread Krishna Garapati
just for the info, This patch only enables and sets the cpu masks
correctly. Still working on the patch to fix the PING mode to run on the
supplied cpu mask instead of hard coded cpu0.

On 30 July 2015 at 10:02, Balakrishna.Garapati 
balakrishna.garap...@linaro.org wrote:

 Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
 ---
  This patch also includes changes to enable the option to support number
 of workers.
  example/generator/odp_generator.c | 35 +--
  1 file changed, 29 insertions(+), 6 deletions(-)

 diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
 index d6ec758..08cd577 100644
 --- a/example/generator/odp_generator.c
 +++ b/example/generator/odp_generator.c
 @@ -42,6 +42,7 @@
   */
  typedef struct {
 int cpu_count;  /** system CPU count */
 +   const char *mask;   /** core mask */
 int if_count;   /** Number of interfaces to be used */
 char **if_names;/** Array of pointers to interface names
 */
 char *if_str;   /** Storage for interface names */
 @@ -633,18 +634,27 @@ int main(int argc, char *argv[])
 if (args-appl.cpu_count)
 num_workers = args-appl.cpu_count;

 -   /* ping mode need two worker */
 -   if (args-appl.mode == APPL_MODE_PING)
 -   num_workers = 2;
 +   if (args-appl.mask) {
 +   (void)odp_cpumask_from_str(cpumask, args-appl.mask);
 +   num_workers = odp_cpumask_count(cpumask);
 +   } else {
 +   num_workers = odp_cpumask_def_worker(cpumask,
 num_workers);
 +   }

 -   /* Get default worker cpumask */
 -   num_workers = odp_cpumask_def_worker(cpumask, num_workers);
 (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));

 printf(num worker threads: %i\n, num_workers);
 printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
 printf(cpu mask:   %s\n, cpumaskstr);

 +   /* ping mode need two workers */
 +   if (args-appl.mode == APPL_MODE_PING) {
 +   if (num_workers  2) {
 +   EXAMPLE_ERR(Need at least two worker threads\n);
 +   exit(EXIT_FAILURE);
 +   }
 +   }
 +
 /* Create packet pool */
 memset(params, 0, sizeof(params));
 params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
 @@ -812,6 +822,7 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
 static struct option longopts[] = {
 {interface, required_argument, NULL, 'I'},
 {workers, required_argument, NULL, 'w'},
 +   {coremask, required_argument, NULL, 'k'},
 {srcmac, required_argument, NULL, 'a'},
 {dstmac, required_argument, NULL, 'b'},
 {srcip, required_argument, NULL, 'c'},
 @@ -831,7 +842,7 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
 appl_args-timeout = -1;

 while (1) {
 -   opt = getopt_long(argc, argv, +I:a:b:c:d:s:i:m:n:t:w:h,
 +   opt = getopt_long(argc, argv, +I:a:b:c:d:s:i:m:n:t:w:k:h,
 longopts, long_index);
 if (opt == -1)
 break;  /* No more options */
 @@ -840,6 +851,15 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
 case 'w':
 appl_args-cpu_count = atoi(optarg);
 break;
 +   case 'k':
 +   len = strlen(optarg);
 +   if (len == 0) {
 +   usage(argv[0]);
 +   exit(EXIT_FAILURE);
 +   }
 +
 +   appl_args-mask = optarg;
 +   break;
 /* parse packet-io interface names */
 case 'I':
 len = strlen(optarg);
 @@ -1029,6 +1049,9 @@ static void usage(char *progname)
  -t, --timeout only for ping mode, wait ICMP reply
 timeout seconds\n
  -i, --interval wait interval ms between sending each
 packet\n
 default is 1000ms. 0 for flood mode\n
 +-w, --workers specify number of workers need to be
 assigned to application\n
 +   default is to assign all\n
 +-k, --coremask to set on cores\n
\n
Optional OPTIONS\n
  -h, --help   Display help and exit.\n
 --
 1.9.1


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


Re: [lng-odp] [PATCHv1] example:generator:option to supply core mask

2015-07-30 Thread Krishna Garapati
Ignore this patch. Pushing another one with PATCHv2.

On 30 July 2015 at 12:54, Balakrishna.Garapati 
balakrishna.garap...@linaro.org wrote:

 Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
 ---

  Fixed cpu_mask for PING mode. The mask is set to what is actually
 supplied.

  example/generator/odp_generator.c | 51
 ++-
  1 file changed, 39 insertions(+), 12 deletions(-)

 diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
 index d6ec758..45257fd 100644
 --- a/example/generator/odp_generator.c
 +++ b/example/generator/odp_generator.c
 @@ -42,6 +42,7 @@
   */
  typedef struct {
 int cpu_count;  /** system CPU count */
 +   const char *mask;   /** core mask */
 int if_count;   /** Number of interfaces to be used */
 char **if_names;/** Array of pointers to interface names
 */
 char *if_str;   /** Storage for interface names */
 @@ -633,18 +634,27 @@ int main(int argc, char *argv[])
 if (args-appl.cpu_count)
 num_workers = args-appl.cpu_count;

 -   /* ping mode need two worker */
 -   if (args-appl.mode == APPL_MODE_PING)
 -   num_workers = 2;
 +   if (args-appl.mask) {
 +   (void)odp_cpumask_from_str(cpumask, args-appl.mask);
 +   num_workers = odp_cpumask_count(cpumask);
 +   } else {
 +   num_workers = odp_cpumask_def_worker(cpumask,
 num_workers);
 +   }

 -   /* Get default worker cpumask */
 -   num_workers = odp_cpumask_def_worker(cpumask, num_workers);
 (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));

 printf(num worker threads: %i\n, num_workers);
 printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
 printf(cpu mask:   %s\n, cpumaskstr);

 +   /* ping mode need two workers */
 +   if (args-appl.mode == APPL_MODE_PING) {
 +   if (num_workers  2) {
 +   EXAMPLE_ERR(Need at least two worker threads\n);
 +   exit(EXIT_FAILURE);
 +   }
 +   }
 +
 /* Create packet pool */
 memset(params, 0, sizeof(params));
 params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
 @@ -692,12 +702,13 @@ int main(int argc, char *argv[])
 memset(thread_tbl, 0, sizeof(thread_tbl));

 if (args-appl.mode == APPL_MODE_PING) {
 -   odp_cpumask_t cpu0_mask;
 +   odp_cpumask_t cpu_mask;
 odp_queue_t tq;
 +int cpu_first, cpu_next;

 -   /* Previous code forced both threads to CPU 0 */
 -   odp_cpumask_zero(cpu0_mask);
 -   odp_cpumask_set(cpu0_mask, 0);
 +   odp_cpumask_zero(cpu_mask);
 +   cpu_first = odp_cpumask_first(cpumask);
 +   odp_cpumask_set(cpu_mask, cpu_first);

 tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
 if (tq == ODP_QUEUE_INVALID)
 @@ -713,7 +724,7 @@ int main(int argc, char *argv[])
 if (args-thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
 abort();
 args-thread[1].mode = args-appl.mode;
 -   odph_linux_pthread_create(thread_tbl[1], cpu0_mask,
 +   odph_linux_pthread_create(thread_tbl[1], cpu_mask,
   gen_recv_thread,
 args-thread[1]);

 tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL);
 @@ -730,7 +741,10 @@ int main(int argc, char *argv[])
 if (args-thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
 abort();
 args-thread[0].mode = args-appl.mode;
 -   odph_linux_pthread_create(thread_tbl[0], cpu0_mask,
 +   cpu_next = odp_cpumask_next(cpumask, cpu_first);
 +   odp_cpumask_zero(cpu_mask);
 +   odp_cpumask_set(cpu_mask, cpu_next);
 +   odph_linux_pthread_create(thread_tbl[0], cpu_mask,
   gen_send_thread,
 args-thread[0]);

 /* only wait send thread to join */
 @@ -812,6 +826,7 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
 static struct option longopts[] = {
 {interface, required_argument, NULL, 'I'},
 {workers, required_argument, NULL, 'w'},
 +   {coremask, required_argument, NULL, 'k'},
 {srcmac, required_argument, NULL, 'a'},
 {dstmac, required_argument, NULL, 'b'},
 {srcip, required_argument, NULL, 'c'},
 @@ -831,7 +846,7 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
 appl_args-timeout = -1;

 while (1) {
 -   opt = getopt_long(argc, argv, +I:a:b:c:d:s:i:m:n:t:w:h,
 +   opt = getopt_long(argc, argv, +I:a:b:c:d:s:i:m:n:t:w:k:h,
   

Re: [lng-odp] [PATCH] example:generator:option to supply core mask

2015-07-30 Thread Krishna Garapati
I agree. I can make the changes.

On 30 July 2015 at 12:58, Stuart Haslam stuart.has...@linaro.org wrote:

 On Thu, Jul 30, 2015 at 10:02:46AM +0200, Balakrishna.Garapati wrote:
  Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
  ---
   This patch also includes changes to enable the option to support number
 of workers.
   example/generator/odp_generator.c | 35
 +--
   1 file changed, 29 insertions(+), 6 deletions(-)
 
  diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
  index d6ec758..08cd577 100644
  --- a/example/generator/odp_generator.c
  +++ b/example/generator/odp_generator.c
  @@ -42,6 +42,7 @@
*/
   typedef struct {
int cpu_count;  /** system CPU count */
  + const char *mask;   /** core mask */
int if_count;   /** Number of interfaces to be used */
char **if_names;/** Array of pointers to interface names
 */
char *if_str;   /** Storage for interface names */
  @@ -633,18 +634,27 @@ int main(int argc, char *argv[])
if (args-appl.cpu_count)
num_workers = args-appl.cpu_count;
 
  - /* ping mode need two worker */
  - if (args-appl.mode == APPL_MODE_PING)
  - num_workers = 2;
  + if (args-appl.mask) {
  + (void)odp_cpumask_from_str(cpumask, args-appl.mask);
  + num_workers = odp_cpumask_count(cpumask);
  + } else {
  + num_workers = odp_cpumask_def_worker(cpumask,
 num_workers);
  + }
 
  - /* Get default worker cpumask */
  - num_workers = odp_cpumask_def_worker(cpumask, num_workers);
(void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
printf(cpu mask:   %s\n, cpumaskstr);
 
  + /* ping mode need two workers */
  + if (args-appl.mode == APPL_MODE_PING) {
  + if (num_workers  2) {
  + EXAMPLE_ERR(Need at least two worker threads\n);
  + exit(EXIT_FAILURE);
  + }
  + }
  +
/* Create packet pool */
memset(params, 0, sizeof(params));
params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
  @@ -812,6 +822,7 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
static struct option longopts[] = {
{interface, required_argument, NULL, 'I'},
{workers, required_argument, NULL, 'w'},
  + {coremask, required_argument, NULL, 'k'},

 It would be better to use -c for coremask, on the assumption that we'll
 need to add the same to other examples and it's much more intuitive. I
 see that will mean needing to change the srcip short name, but it's
 fairly arbitrary as it is (a, b, c, d) and everyone seems to use the
 long name anyway.

{srcmac, required_argument, NULL, 'a'},
{dstmac, required_argument, NULL, 'b'},
{srcip, required_argument, NULL, 'c'},
  @@ -831,7 +842,7 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
appl_args-timeout = -1;
 
while (1) {
  - opt = getopt_long(argc, argv, +I:a:b:c:d:s:i:m:n:t:w:h,
  + opt = getopt_long(argc, argv, +I:a:b:c:d:s:i:m:n:t:w:k:h,
longopts, long_index);
if (opt == -1)
break;  /* No more options */
  @@ -840,6 +851,15 @@ static void parse_args(int argc, char *argv[],
 appl_args_t *appl_args)
case 'w':
appl_args-cpu_count = atoi(optarg);
break;
  + case 'k':
  + len = strlen(optarg);
  + if (len == 0) {

 Can this actually happen? won't getopt fail if you don't provide an
 argument?

  + usage(argv[0]);
  + exit(EXIT_FAILURE);
  + }
  +
  + appl_args-mask = optarg;
  + break;
/* parse packet-io interface names */
case 'I':
len = strlen(optarg);
  @@ -1029,6 +1049,9 @@ static void usage(char *progname)
 -t, --timeout only for ping mode, wait ICMP reply
 timeout seconds\n
 -i, --interval wait interval ms between sending each
 packet\n
default is 1000ms. 0 for flood mode\n
  +  -w, --workers specify number of workers need to be
 assigned to application\n
  + default is to assign all\n
  +  -k, --coremask to set on cores\n
   \n
   Optional OPTIONS\n
 -h, --help   Display help and exit.\n
  --
  1.9.1
 

___
lng-odp mailing 

Re: [lng-odp] [PATCHv2] example:generator:printing verbose output

2015-07-29 Thread Krishna Garapati
May be we can create an other task for this?. Steve mentioned that this
verbose is kind of urgent for the multi-node LAVA environment. Let me know
your views.

/Krishna

On 29 July 2015 at 16:40, Stuart Haslam stuart.has...@linaro.org wrote:

 On Wed, Jul 29, 2015 at 05:13:40PM +0300, Maxim Uvarov wrote:
  On 07/29/15 16:43, Stuart Haslam wrote:
  On Wed, Jul 29, 2015 at 04:10:06PM +0300, Maxim Uvarov wrote:
  On 07/29/15 16:02, Stuart Haslam wrote:
  On Wed, Jul 29, 2015 at 03:54:51PM +0300, Maxim Uvarov wrote:
  On 07/29/15 15:21, Stuart Haslam wrote:
  On Wed, Jul 29, 2015 at 01:12:23PM +0200, Balakrishna.Garapati
 wrote:
  corrected alignment issues
  This should go beneath the --- line so that it doesn't end up in the
  commit log.
  
  Signed-off-by: Balakrishna.Garapati 
 balakrishna.garap...@linaro.org
  ---
example/generator/odp_generator.c | 13 -
1 file changed, 12 insertions(+), 1 deletion(-)
  
  diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
  index d6ec758..5cf7e92 100644
  --- a/example/generator/odp_generator.c
  +++ b/example/generator/odp_generator.c
  @@ -26,6 +26,7 @@
#define MAX_WORKERS32 /** max number of
 works */
#define SHM_PKT_POOL_SIZE  (512*2048) /** pkt pool size
 */
#define SHM_PKT_POOL_BUF_SIZE  1856   /** pkt pool buf
 size */
  +#define DEFAULT_PKT_INTERVAL   1000 /** interval btw
 each pkt */
#define APPL_MODE_UDP0/** UDP mode */
#define APPL_MODE_PING   1/** ping mode */
  @@ -370,6 +371,7 @@ static odp_pktio_t create_pktio(const char
 *dev, odp_pool_t pool)
static void *gen_send_thread(void *arg)
{
  int thr;
  +   uint64_t start, now, diff;
  odp_pktio_t pktio;
  thread_args_t *thr_args;
  odp_queue_t outq_def;
  @@ -391,6 +393,7 @@ static void *gen_send_thread(void *arg)
  return NULL;
  }
  +   start = odp_time_cycles();
  printf(  [%02i] created mode: SEND\n, thr);
  for (;;) {
  int err;
  @@ -431,6 +434,14 @@ static void *gen_send_thread(void *arg)
  = (unsigned int)args-appl.number) {
  break;
  }
  +
  +   now = odp_time_cycles();
  +   diff = odp_time_diff_cycles(start, now);
  +   if (odp_time_cycles_to_ns(diff)  20 *
 ODP_TIME_SEC) {
  +   start = odp_time_cycles();
  +   printf(  [%02i] total send: %ju\n,
  +  thr,
 odp_atomic_load_u64(counters.seq));
  Need an fflush(stdout) here to ensure this is visible.
  There is \n so it should be visible when terminal will allow it. I
  think no need for explicit fush. Without \n flush is needed.
  
  It depends where the output is going, \n will typically only flush if
  output is to a terminal. If you're redirecting to a file, or piping
 the
  output through awk for example, it won't.
  
  do you need put to file or awk  counters from that loop?
  Yes actually I piped it through awk to add timestamps so that I could
  check timings after Krishna reported issues. More generally I was
  thinking about when running this from a script, and the principle of
  least surprise.
  
  I think on exist generator should return some summary which
  is valuable for logs and parse scripts. Here it should not delay on
 flush.
  If we care about delaying we should not be printing at all (from this
  thread).
  
  btw! why do we print from worker thread and not from control thread?
  l2fwd example as I remember prints from control.
 

 I mentioned that (in an off-list mail) to Krishna but said I thought it
 could be changed later, as it's complicated slightly by the different
 modes you can be running in and I figured it's not worth delaying this
 change over. It's questionable though.

 --
 Stuart.

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


Re: [lng-odp] ODP timer behavior

2015-07-27 Thread Krishna Garapati
Fallowing is the way how I am doing this,

now = odp_time_cycles();
diff = odp_time_diff_cycles(start, now);
if(odp_time_cycles_to_ns(diff)  10*ODP_TIME_SEC) {
start = odp_time_cycles();
printf(  [%02i] total send: %ju\n,
thr, odp_atomic_load_u64(counters.seq));
}

All the variables are 64 bit types.


/Krishna

On 27 July 2015 at 19:06, Krishna Garapati balakrishna.garap...@linaro.org
wrote:


 I am using x86_64 bit Arch.

 /Krishna

 On 27 July 2015 at 18:50, Christophe Milard christophe.mil...@linaro.org
 wrote:

 I wild guess you are using a 32 bit value and 10*ODP_TIME_SEC does not
 fit.
 (please confirm)

 Christophe

 On 27 July 2015 at 18:46, Krishna Garapati 
 balakrishna.garap...@linaro.org wrote:

 Hi,

 As part odp_generator verbose update, I am trying to use 10*ODP_TIME_SEC
 ( Second in nsec - api/time.h ) to keep the generator update stats for
 every 10 secs. When I try to test this scenario, seems like it's not
 actually considering this as actual 10 sec instead as 1 sec. Just wondering
 if anybody has observed this behavior?.  I am testing it on my Ubuntu work
 machine.

 /Krishna

 ___
 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] ODP timer behavior

2015-07-27 Thread Krishna Garapati
I am using x86_64 bit Arch.

/Krishna

On 27 July 2015 at 18:50, Christophe Milard christophe.mil...@linaro.org
wrote:

 I wild guess you are using a 32 bit value and 10*ODP_TIME_SEC does not fit.
 (please confirm)

 Christophe

 On 27 July 2015 at 18:46, Krishna Garapati 
 balakrishna.garap...@linaro.org wrote:

 Hi,

 As part odp_generator verbose update, I am trying to use 10*ODP_TIME_SEC
 ( Second in nsec - api/time.h ) to keep the generator update stats for
 every 10 secs. When I try to test this scenario, seems like it's not
 actually considering this as actual 10 sec instead as 1 sec. Just wondering
 if anybody has observed this behavior?.  I am testing it on my Ubuntu work
 machine.

 /Krishna

 ___
 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] ODP timer behavior

2015-07-27 Thread Krishna Garapati
Hi,

As part odp_generator verbose update, I am trying to use 10*ODP_TIME_SEC (
Second in nsec - api/time.h ) to keep the generator update stats for every
10 secs. When I try to test this scenario, seems like it's not actually
considering this as actual 10 sec instead as 1 sec. Just wondering if
anybody has observed this behavior?.  I am testing it on my Ubuntu work
machine.

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


[lng-odp] Will be on vacation fr 22/07 - 27/07

2015-07-21 Thread Krishna Garapati
Hi,

I will be on vacation this week starting from tomorrow. Will be back on
Monday 27th.

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


Re: [lng-odp] [PATCHV1] example:generator:print correct appl_mode

2015-07-09 Thread Krishna Garapati
Wrong version. Sent an other patch with correct version v2. Ignore this
patch.

/Krishna

On 9 July 2015 at 16:00, Balakrishna.Garapati 
balakrishna.garap...@linaro.org wrote:

 Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org
 ---
  example/generator/odp_generator.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

 diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
 index 0ff264c..15de035 100644
 --- a/example/generator/odp_generator.c
 +++ b/example/generator/odp_generator.c
 @@ -991,9 +991,11 @@ static void print_info(char *progname, appl_args_t
 *appl_args)
 printf(\n
Mode:);
 if (appl_args-mode == 0)
 -   PRINT_APPL_MODE(0);
 +   PRINT_APPL_MODE(APPL_MODE_UDP);
 +   else if (appl_args-mode == 1)
 +   PRINT_APPL_MODE(APPL_MODE_PING);
 else
 -   PRINT_APPL_MODE(0);
 +   PRINT_APPL_MODE(APPL_MODE_RCV);
 printf(\n\n);
 fflush(NULL);
  }
 --
 1.9.1


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


Re: [lng-odp] [PATCH] example:printing correct appl_mode

2015-07-09 Thread Krishna Garapati
PRINT_APPL_MODE prints  #mode (string)  mode (0,1 or 2).  if we pass 
appl_args-mode, it prints this as a string instead of ex: APPL_MODE_PING.

On 9 July 2015 at 15:48, Maxim Uvarov maxim.uva...@linaro.org wrote:

 On 07/09/15 16:43, Mike Holmes wrote:

 Subject should localize to the specific example
 example: generator: print correct appl_mode

 On 9 July 2015 at 09:32, Balakrishna.Garapati 
 balakrishna.garap...@linaro.org mailto:balakrishna.garap...@linaro.org
 wrote:

 Signed-off-by: Balakrishna.Garapati
 balakrishna.garap...@linaro.org
 mailto:balakrishna.garap...@linaro.org


 With fixed subject message
 Reviewed-by: Mike Holmes mike.hol...@linaro.org mailto:
 mike.hol...@linaro.org

 ---
  example/generator/odp_generator.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

 diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
 index 0ff264c..15de035 100644
 --- a/example/generator/odp_generator.c
 +++ b/example/generator/odp_generator.c
 @@ -991,9 +991,11 @@ static void print_info(char *progname,
 appl_args_t *appl_args)
 printf(\n
Mode:);
 if (appl_args-mode == 0)
 -   PRINT_APPL_MODE(0);
 +   PRINT_APPL_MODE(APPL_MODE_UDP);
 +   else if (appl_args-mode == 1)
 +   PRINT_APPL_MODE(APPL_MODE_PING);
 else
 -   PRINT_APPL_MODE(0);
 +   PRINT_APPL_MODE(APPL_MODE_RCV);


 How about?

 PRINT_APPL_MODE(appl_args-mode);

 Maxim.


 printf(\n\n);
 fflush(NULL);
  }
 --
 1.9.1

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




 --
 Mike Holmes
 Technical Manager - Linaro Networking Group
 Linaro.org http://www.linaro.org/***│ *Open source software for ARM
 SoCs



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


Re: [lng-odp] Requirement specs to update the odp generator

2015-07-03 Thread Krishna Garapati
Thanks bill. I will add this list to Jira cards.

/Krishna

On 2 July 2015 at 18:44, Bill Fischofer bill.fischo...@linaro.org wrote:

 That's a good start.  To this I'd add:

 1. Support for multiple concurrent I/O interfaces
 2. Traffic replay capability

 The latter is to be able to take things like Wireshark sample captures
 https://wiki.wireshark.org/SampleCaptures and send them to a DUT for
 validation testing.

 On Thu, Jul 2, 2015 at 7:25 AM, Krishna Garapati 
 balakrishna.garap...@linaro.org wrote:

 Hi,

 I like to start the discussion thread here to gather the the requirements
 to test the odp scheduling capabilities. That would be the input for
 updating odp generator for demo purpose. Some of the proposed requirements
 I heard are,

 1) using multiple flows of simple traffic
 2)  IPSec traffic generation

 Are they both still valid?. Do we have any more?.

 /Krishna



 ___
 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] Requirement specs to update the odp generator

2015-07-02 Thread Krishna Garapati
Hi,

I like to start the discussion thread here to gather the the requirements
to test the odp scheduling capabilities. That would be the input for
updating odp generator for demo purpose. Some of the proposed requirements
I heard are,

1) using multiple flows of simple traffic
2)  IPSec traffic generation

Are they both still valid?. Do we have any more?.

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