Re: [lng-odp] [PATCH] linux-gen: sysinfo: check for overflow

2016-10-27 Thread Bill Fischofer
On Thu, Oct 27, 2016 at 9:42 AM, Maxim Uvarov 
wrote:

> In near future cpu mhz more likely will not overflow 64
> bit value, but it makes sense to add  assert for
> overflow check.
> https://bugs.linaro.org/show_bug.cgi?id=2425
>
> Signed-off-by: Maxim Uvarov 
> ---
>  platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
> b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
> index 96127ec..5aefd81 100644
> --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
> +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
> @@ -5,7 +5,9 @@
>   */
>
>  #include 
> +#include 
>  #include 
> +#include 
>
>  int cpuinfo_parser(FILE *file, system_info_t *sysinfo)
>  {
> @@ -68,8 +70,11 @@ uint64_t odp_cpu_hz_current(int id)
> }
>
> fclose(file);
> -   if (mhz)
> +   if (mhz) {
> +   /* check for overflow */
> +   ODP_ASSERT((ULLONG_MAX / 100) > mhz);
>

I'm not sure that Coverity understands ODP_ASSERT. Have we tried running
this to see if it resolves the Coverity issue? If not, I'd rather just mark
it as a known false positive.


> return (uint64_t)(mhz * 100.0);
> +   }
>
> return 0;
>  }
> --
> 2.7.1.250.gff4ea60
>
>


Re: [lng-odp] [PATCH 1/2] test: perf: add new ordered pktio application

2016-10-27 Thread Maxim Uvarov

On 10/27/16 16:51, Elo, Matias (Nokia - FI/Espoo) wrote:

Ping.



On 11 Oct 2016, at 16:21, Matias Elo  wrote:

Add new test application for ordered queue functionality and performance
validation. The application sets sequence numbers to incoming packets using
ordered pktin queues and ordered context locks. After being tagged packets
are enqueued to atomic queues based on flow hash (IPv4 5-tuple). In atomic
flow processing the sequence number is validated and packet is sent to
selected output interface.

Main options:
-m: Input queue type can be changed to atomic or parallel to enable easy
performance comparison. With parallel input queues the packet order is
not maintained.
-r: Number of input queues per interface
-f: Number of atomic flow queues per interface
-e: Number of extra input processing rounds. This can be used to simulate
"fat pipe" traffic processing.

Signed-off-by: Matias Elo 
---
test/common_plat/performance/.gitignore  |1 +
test/common_plat/performance/Makefile.am |7 +-
test/common_plat/performance/dummy_crc.h |  493 
test/common_plat/performance/odp_pktio_ordered.c | 1331 ++
4 files changed, 1831 insertions(+), 1 deletion(-)
create mode 100644 test/common_plat/performance/dummy_crc.h
create mode 100644 test/common_plat/performance/odp_pktio_ordered.c

diff --git a/test/common_plat/performance/.gitignore 
b/test/common_plat/performance/.gitignore
index 1527d25..8bb18f5 100644
--- a/test/common_plat/performance/.gitignore
+++ b/test/common_plat/performance/.gitignore
@@ -3,6 +3,7 @@
odp_atomic
odp_crypto
odp_l2fwd
+odp_pktio_ordered
odp_pktio_perf
odp_sched_latency
odp_scheduling
diff --git a/test/common_plat/performance/Makefile.am 
b/test/common_plat/performance/Makefile.am
index f184609..790ddae 100644
--- a/test/common_plat/performance/Makefile.am
+++ b/test/common_plat/performance/Makefile.am
@@ -5,6 +5,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
EXECUTABLES = odp_crypto$(EXEEXT) odp_pktio_perf$(EXEEXT)

COMPILE_ONLY = odp_l2fwd$(EXEEXT) \
+  odp_pktio_ordered$(EXEEXT) \
   odp_sched_latency$(EXEEXT) \
   odp_scheduling$(EXEEXT)

@@ -22,15 +23,19 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)

odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static
odp_crypto_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
+odp_pktio_ordered_LDFLAGS = $(AM_LDFLAGS) -static
+odp_pktio_ordered_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
odp_sched_latency_LDFLAGS = $(AM_LDFLAGS) -static
odp_sched_latency_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test

noinst_HEADERS = \
- $(top_srcdir)/test/test_debug.h
+ $(top_srcdir)/test/test_debug.h \
+ dummy_crc.h

dist_odp_crypto_SOURCES = odp_crypto.c
+dist_odp_pktio_ordered_SOURCES = odp_pktio_ordered.c
dist_odp_sched_latency_SOURCES = odp_sched_latency.c
dist_odp_scheduling_SOURCES = odp_scheduling.c
dist_odp_pktio_perf_SOURCES = odp_pktio_perf.c
diff --git a/test/common_plat/performance/dummy_crc.h 
b/test/common_plat/performance/dummy_crc.h
new file mode 100644
index 000..38da444
--- /dev/null
+++ b/test/common_plat/performance/dummy_crc.h
@@ -0,0 +1,493 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ 

Re: [lng-odp] [PATCH 1/2] test: perf: add new ordered pktio application

2016-10-27 Thread Maxim Uvarov

On 10/27/16 16:51, Elo, Matias (Nokia - FI/Espoo) wrote:

+  "Usage: %s OPTIONS\n"
>+  "  E.g. %s -i eth0,eth1 -t 1\n"
>+  " In the above example,\n"
>+  " eth0 will send pkts to eth1 and vice versa\n"
>+  " eth2 will send pkts to eth3 and vice versa\n"
>+  "\n"

that need to be corrected.

Maxim.


[lng-odp] [PATCHv2] linux-generic: packet: add fall through comments to parser

2016-10-27 Thread Bill Fischofer
Address bug https://bugs.linaro.org/show_bug.cgi?id=2565 by adding
comments to the parser's switch statement to document the fact that
fall through is intentional.

Signed-off-by: Bill Fischofer 
---
Changes for v2:
- Address Maxim's comments on comment alignment

 platform/linux-generic/odp_packet.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 714794a..c2b26fd 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1182,6 +1182,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
 
switch (prs->parsed_layers) {
case LAYER_NONE:
+   /* Fall through */
+
case LAYER_L2:
{
const _odp_ethhdr_t *eth;
@@ -1254,6 +1256,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
if (layer == LAYER_L2)
return prs->error_flags.all != 0;
}
+   /* Fall through */
+
case LAYER_L3:
{
offset = prs->l3_offset;
@@ -1292,6 +1296,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
if (layer == LAYER_L3)
return prs->error_flags.all != 0;
}
+   /* Fall through */
+
case LAYER_L4:
{
offset = prs->l4_offset;
@@ -1341,6 +1347,7 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
prs->parsed_layers = LAYER_L4;
break;
}
+
case LAYER_ALL:
break;
 
-- 
2.7.4



Re: [lng-odp] [PATCH] linux-generic: packet: add fall through comments to parser

2016-10-27 Thread Maxim Uvarov

On 10/27/16 10:56, Elo, Matias (Nokia - FI/Espoo) wrote:

Reviewed-by: Matias Elo 


On 26 Oct 2016, at 15:47, Bill Fischofer  wrote:

Address bug https://bugs.linaro.org/show_bug.cgi?id=2565 by adding
comments to the parser's switch statement to document the fact that
fall through is intentional.

Signed-off-by: Bill Fischofer 
---
platform/linux-generic/odp_packet.c | 7 +++
1 file changed, 7 insertions(+)

diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 714794a..e43636b 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1182,6 +1182,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,

switch (prs->parsed_layers) {
case LAYER_NONE:
+   /* Fall through */


indent here is 1 tab from 'case' in over 2 cases it's the same. Please 
make code look more nice with

same indent level.

Maxim.

+
case LAYER_L2:
{
const _odp_ethhdr_t *eth;
@@ -1254,6 +1256,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
if (layer == LAYER_L2)
return prs->error_flags.all != 0;
}
+   /* Fall through */
+
case LAYER_L3:
{
offset = prs->l3_offset;
@@ -1292,6 +1296,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
if (layer == LAYER_L3)
return prs->error_flags.all != 0;
}
+   /* Fall through */
+
case LAYER_L4:
{
offset = prs->l4_offset;
@@ -1341,6 +1347,7 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
prs->parsed_layers = LAYER_L4;
break;
}
+
case LAYER_ALL:
break;

--
2.7.4





[lng-odp] [PATCH] linux-gen: sysinfo: check for overflow

2016-10-27 Thread Maxim Uvarov
In near future cpu mhz more likely will not overflow 64
bit value, but it makes sense to add  assert for
overflow check.
https://bugs.linaro.org/show_bug.cgi?id=2425

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 96127ec..5aefd81 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -5,7 +5,9 @@
  */
 
 #include 
+#include 
 #include 
+#include 
 
 int cpuinfo_parser(FILE *file, system_info_t *sysinfo)
 {
@@ -68,8 +70,11 @@ uint64_t odp_cpu_hz_current(int id)
}
 
fclose(file);
-   if (mhz)
+   if (mhz) {
+   /* check for overflow */
+   ODP_ASSERT((ULLONG_MAX / 100) > mhz);
return (uint64_t)(mhz * 100.0);
+   }
 
return 0;
 }
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [RFC API-NEXT PATCH] api: packet: add packet reference apis

2016-10-27 Thread Bala Manoharan
Regards,
Bala


On 27 October 2016 at 19:38, Bill Fischofer  wrote:
>
>
> On Thu, Oct 27, 2016 at 7:26 AM, Bala Manoharan 
> wrote:
>>
>> On 26 October 2016 at 23:17, Bill Fischofer 
>> wrote:
>> >
>> >
>> > On Wed, Oct 26, 2016 at 12:19 PM, Bala Manoharan
>> > 
>> > wrote:
>> >>
>> >> On 26 October 2016 at 07:26, Bill Fischofer 
>> >> wrote:
>> >> > Add the following five packet APIs:
>> >> >
>> >> > - odp_packet_ref_static()
>> >> > - odp_packet_ref()
>> >> > - odp_packet_ref_pkt()
>> >> > - odp_packet_is_a_ref()
>> >> > - odp_packet_is_referenced()
>> >> >
>> >> > Signed-off-by: Bill Fischofer 
>> >> > ---
>> >> >  include/odp/api/spec/packet.h | 143
>> >> > ++
>> >> >  1 file changed, 143 insertions(+)
>> >> >
>> >> > diff --git a/include/odp/api/spec/packet.h
>> >> > b/include/odp/api/spec/packet.h
>> >> > index 4a14f2d..7e347c5 100644
>> >> > --- a/include/odp/api/spec/packet.h
>> >> > +++ b/include/odp/api/spec/packet.h
>> >> > @@ -846,6 +846,149 @@ int odp_packet_split(odp_packet_t *pkt,
>> >> > uint32_t
>> >> > len, odp_packet_t *tail);
>> >> >
>> >> >  /*
>> >> >   *
>> >> > + * References
>> >> > + * 
>> >> > + *
>> >> > + */
>> >> > +
>> >> > +/**
>> >> > + * Create a static reference to a packet
>> >> > + *
>> >> > + * Create a (shared) reference to a base packet. A static reference
>> >> > is
>> >> > used to
>> >> > + * retain a copy of the packet so that the storage behind it is not
>> >> > freed
>> >> > + * until all references to the packet are freed. This can be used,
>> >> > for
>> >> > + * example, to support efficient retransmission processing.
>> >> > + *
>> >> > + * @param pktHandle of the base packet for which a static
>> >> > reference
>> >> > is
>> >> > + *   to be created.
>> >> > + *
>> >> > + * @returnHandle of the reference packet
>> >> > + * @retval ODP_PACKET_INVALID Operation failed. Base packet remains
>> >> > unchanged.
>> >> > + *
>> >> > + * @note The intent of a static reference is that both the base
>> >> > packet
>> >> > and the
>> >> > + *   returned reference should be treated as read-only after
>> >> > this
>> >> > + *   call. Results are unpredictable if this restriction is not
>> >> > observed.
>> >> > + *
>> >> > + * @note Static references have restrictions but may have
>> >> > performance
>> >> > + *   advantages on some platforms if the caller does not intend
>> >> > to
>> >> > modify
>> >> > + *   the reference packet. If modification is needed (e.g., to
>> >> > prefix a
>> >> > + *   unique header onto the packet) then odp_packet_ref() should
>> >> > be
>> >> > used.
>> >> > + */
>> >> > +odp_packet_t odp_packet_ref_static(odp_packet_t pkt);
>> >> > +
>> >> > +/**
>> >> > + * Create a reference to a packet
>> >> > + *
>> >> > + * Create a (shared) reference to a base packet starting at a
>> >> > specified
>> >> > byte
>> >> > + * offset. This reference may be used as an argument to header
>> >> > manipulation
>> >> > + * APIs to prefix a unique header onto the shared base. The storage
>> >> > associated
>> >> > + * with the base packet is not freed until all references to it are
>> >> > freed,
>> >> > + * which permits easy multicasting or retransmission processing to
>> >> > be
>> >> > + * performed.
>> >> > + *
>> >> > + * @param pktHandle of the base packet for which a reference is
>> >> > to
>> >> > be
>> >> > + *   created.
>> >> > + *
>> >> > + * @param offset Byte offset in the base packet at which the shared
>> >> > reference
>> >> > + *   is to begin. Must be in the range
>> >> > 0..odp_packet_len(pkt)-1.
>> >> > + *
>> >> > + * @returnHandle of the reference packet
>> >> > + * @retval ODP_PACKET_INVALID Operation failed. Base packet remains
>> >> > unchanged.
>> >> > + *
>> >> > + * @note This operation prepends a zero-length header onto the base
>> >> > packet
>> >> > + *   beginning at the specified offset. This header is always
>> >> > drawn
>> >> > from
>> >> > + *   the same pool as the base packet.
>> >> > + *
>> >> > + * @note Because references are unique packets, any bytes pushed
>> >> > onto
>> >> > the head
>> >> > + *   of a reference via odp_packet_push_head() or
>> >> > odp_packet_extend_head()
>> >> > + *   are unique to this reference and are not seen by any other
>> >> > reference
>> >> > + *   to the same base packet.
>> >> > + *
>> >> > + * @note The base pkt used as input to this routine may itself by a
>> >> > reference
>> >> > + *   to some other base packet. Implementations MAY restrict the
>> >> > ability
>> >> > + *   to create such compound references. Attempts to exceed any
>> >> > + *   implementation limits in this regard will result in this
>> >> > call
>> >> > failing
>> >> > + *   and returning ODP_PACKET_INVALID.
>> >> > + *
>> >> > + * @note If the caller does not indend to push a 

Re: [lng-odp] [RFC API-NEXT PATCH] api: packet: add packet reference apis

2016-10-27 Thread Bill Fischofer
On Thu, Oct 27, 2016 at 9:09 AM, Bala Manoharan 
wrote:

> Regards,
> Bala
>
>
> On 27 October 2016 at 19:38, Bill Fischofer 
> wrote:
> >
> >
> > On Thu, Oct 27, 2016 at 7:26 AM, Bala Manoharan <
> bala.manoha...@linaro.org>
> > wrote:
> >>
> >> On 26 October 2016 at 23:17, Bill Fischofer 
> >> wrote:
> >> >
> >> >
> >> > On Wed, Oct 26, 2016 at 12:19 PM, Bala Manoharan
> >> > 
> >> > wrote:
> >> >>
> >> >> On 26 October 2016 at 07:26, Bill Fischofer <
> bill.fischo...@linaro.org>
> >> >> wrote:
> >> >> > Add the following five packet APIs:
> >> >> >
> >> >> > - odp_packet_ref_static()
> >> >> > - odp_packet_ref()
> >> >> > - odp_packet_ref_pkt()
> >> >> > - odp_packet_is_a_ref()
> >> >> > - odp_packet_is_referenced()
> >> >> >
> >> >> > Signed-off-by: Bill Fischofer 
> >> >> > ---
> >> >> >  include/odp/api/spec/packet.h | 143
> >> >> > ++
> >> >> >  1 file changed, 143 insertions(+)
> >> >> >
> >> >> > diff --git a/include/odp/api/spec/packet.h
> >> >> > b/include/odp/api/spec/packet.h
> >> >> > index 4a14f2d..7e347c5 100644
> >> >> > --- a/include/odp/api/spec/packet.h
> >> >> > +++ b/include/odp/api/spec/packet.h
> >> >> > @@ -846,6 +846,149 @@ int odp_packet_split(odp_packet_t *pkt,
> >> >> > uint32_t
> >> >> > len, odp_packet_t *tail);
> >> >> >
> >> >> >  /*
> >> >> >   *
> >> >> > + * References
> >> >> > + * 
> >> >> > + *
> >> >> > + */
> >> >> > +
> >> >> > +/**
> >> >> > + * Create a static reference to a packet
> >> >> > + *
> >> >> > + * Create a (shared) reference to a base packet. A static
> reference
> >> >> > is
> >> >> > used to
> >> >> > + * retain a copy of the packet so that the storage behind it is
> not
> >> >> > freed
> >> >> > + * until all references to the packet are freed. This can be used,
> >> >> > for
> >> >> > + * example, to support efficient retransmission processing.
> >> >> > + *
> >> >> > + * @param pktHandle of the base packet for which a static
> >> >> > reference
> >> >> > is
> >> >> > + *   to be created.
> >> >> > + *
> >> >> > + * @returnHandle of the reference packet
> >> >> > + * @retval ODP_PACKET_INVALID Operation failed. Base packet
> remains
> >> >> > unchanged.
> >> >> > + *
> >> >> > + * @note The intent of a static reference is that both the base
> >> >> > packet
> >> >> > and the
> >> >> > + *   returned reference should be treated as read-only after
> >> >> > this
> >> >> > + *   call. Results are unpredictable if this restriction is
> not
> >> >> > observed.
> >> >> > + *
> >> >> > + * @note Static references have restrictions but may have
> >> >> > performance
> >> >> > + *   advantages on some platforms if the caller does not
> intend
> >> >> > to
> >> >> > modify
> >> >> > + *   the reference packet. If modification is needed (e.g., to
> >> >> > prefix a
> >> >> > + *   unique header onto the packet) then odp_packet_ref()
> should
> >> >> > be
> >> >> > used.
> >> >> > + */
> >> >> > +odp_packet_t odp_packet_ref_static(odp_packet_t pkt);
> >> >> > +
> >> >> > +/**
> >> >> > + * Create a reference to a packet
> >> >> > + *
> >> >> > + * Create a (shared) reference to a base packet starting at a
> >> >> > specified
> >> >> > byte
> >> >> > + * offset. This reference may be used as an argument to header
> >> >> > manipulation
> >> >> > + * APIs to prefix a unique header onto the shared base. The
> storage
> >> >> > associated
> >> >> > + * with the base packet is not freed until all references to it
> are
> >> >> > freed,
> >> >> > + * which permits easy multicasting or retransmission processing to
> >> >> > be
> >> >> > + * performed.
> >> >> > + *
> >> >> > + * @param pktHandle of the base packet for which a reference
> is
> >> >> > to
> >> >> > be
> >> >> > + *   created.
> >> >> > + *
> >> >> > + * @param offset Byte offset in the base packet at which the
> shared
> >> >> > reference
> >> >> > + *   is to begin. Must be in the range
> >> >> > 0..odp_packet_len(pkt)-1.
> >> >> > + *
> >> >> > + * @returnHandle of the reference packet
> >> >> > + * @retval ODP_PACKET_INVALID Operation failed. Base packet
> remains
> >> >> > unchanged.
> >> >> > + *
> >> >> > + * @note This operation prepends a zero-length header onto the
> base
> >> >> > packet
> >> >> > + *   beginning at the specified offset. This header is always
> >> >> > drawn
> >> >> > from
> >> >> > + *   the same pool as the base packet.
> >> >> > + *
> >> >> > + * @note Because references are unique packets, any bytes pushed
> >> >> > onto
> >> >> > the head
> >> >> > + *   of a reference via odp_packet_push_head() or
> >> >> > odp_packet_extend_head()
> >> >> > + *   are unique to this reference and are not seen by any
> other
> >> >> > reference
> >> >> > + *   to the same base packet.
> >> >> > + *
> >> >> > + * @note The base pkt used as input to this routine may itself

[lng-odp] [Bug 2512] validation: TCP checksum update

2016-10-27 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2512

--- Comment #4 from Bala Manoharan  ---
V2 posted: http://patches.linaro.org/patch/79654/

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Re: [lng-odp] [RFC API-NEXT PATCH] api: packet: add packet reference apis

2016-10-27 Thread Bill Fischofer
On Thu, Oct 27, 2016 at 7:26 AM, Bala Manoharan 
wrote:

> On 26 October 2016 at 23:17, Bill Fischofer 
> wrote:
> >
> >
> > On Wed, Oct 26, 2016 at 12:19 PM, Bala Manoharan <
> bala.manoha...@linaro.org>
> > wrote:
> >>
> >> On 26 October 2016 at 07:26, Bill Fischofer 
> >> wrote:
> >> > Add the following five packet APIs:
> >> >
> >> > - odp_packet_ref_static()
> >> > - odp_packet_ref()
> >> > - odp_packet_ref_pkt()
> >> > - odp_packet_is_a_ref()
> >> > - odp_packet_is_referenced()
> >> >
> >> > Signed-off-by: Bill Fischofer 
> >> > ---
> >> >  include/odp/api/spec/packet.h | 143
> >> > ++
> >> >  1 file changed, 143 insertions(+)
> >> >
> >> > diff --git a/include/odp/api/spec/packet.h
> >> > b/include/odp/api/spec/packet.h
> >> > index 4a14f2d..7e347c5 100644
> >> > --- a/include/odp/api/spec/packet.h
> >> > +++ b/include/odp/api/spec/packet.h
> >> > @@ -846,6 +846,149 @@ int odp_packet_split(odp_packet_t *pkt, uint32_t
> >> > len, odp_packet_t *tail);
> >> >
> >> >  /*
> >> >   *
> >> > + * References
> >> > + * 
> >> > + *
> >> > + */
> >> > +
> >> > +/**
> >> > + * Create a static reference to a packet
> >> > + *
> >> > + * Create a (shared) reference to a base packet. A static reference
> is
> >> > used to
> >> > + * retain a copy of the packet so that the storage behind it is not
> >> > freed
> >> > + * until all references to the packet are freed. This can be used,
> for
> >> > + * example, to support efficient retransmission processing.
> >> > + *
> >> > + * @param pktHandle of the base packet for which a static
> reference
> >> > is
> >> > + *   to be created.
> >> > + *
> >> > + * @returnHandle of the reference packet
> >> > + * @retval ODP_PACKET_INVALID Operation failed. Base packet remains
> >> > unchanged.
> >> > + *
> >> > + * @note The intent of a static reference is that both the base
> packet
> >> > and the
> >> > + *   returned reference should be treated as read-only after this
> >> > + *   call. Results are unpredictable if this restriction is not
> >> > observed.
> >> > + *
> >> > + * @note Static references have restrictions but may have performance
> >> > + *   advantages on some platforms if the caller does not intend
> to
> >> > modify
> >> > + *   the reference packet. If modification is needed (e.g., to
> >> > prefix a
> >> > + *   unique header onto the packet) then odp_packet_ref() should
> be
> >> > used.
> >> > + */
> >> > +odp_packet_t odp_packet_ref_static(odp_packet_t pkt);
> >> > +
> >> > +/**
> >> > + * Create a reference to a packet
> >> > + *
> >> > + * Create a (shared) reference to a base packet starting at a
> specified
> >> > byte
> >> > + * offset. This reference may be used as an argument to header
> >> > manipulation
> >> > + * APIs to prefix a unique header onto the shared base. The storage
> >> > associated
> >> > + * with the base packet is not freed until all references to it are
> >> > freed,
> >> > + * which permits easy multicasting or retransmission processing to be
> >> > + * performed.
> >> > + *
> >> > + * @param pktHandle of the base packet for which a reference is
> to
> >> > be
> >> > + *   created.
> >> > + *
> >> > + * @param offset Byte offset in the base packet at which the shared
> >> > reference
> >> > + *   is to begin. Must be in the range
> >> > 0..odp_packet_len(pkt)-1.
> >> > + *
> >> > + * @returnHandle of the reference packet
> >> > + * @retval ODP_PACKET_INVALID Operation failed. Base packet remains
> >> > unchanged.
> >> > + *
> >> > + * @note This operation prepends a zero-length header onto the base
> >> > packet
> >> > + *   beginning at the specified offset. This header is always
> drawn
> >> > from
> >> > + *   the same pool as the base packet.
> >> > + *
> >> > + * @note Because references are unique packets, any bytes pushed onto
> >> > the head
> >> > + *   of a reference via odp_packet_push_head() or
> >> > odp_packet_extend_head()
> >> > + *   are unique to this reference and are not seen by any other
> >> > reference
> >> > + *   to the same base packet.
> >> > + *
> >> > + * @note The base pkt used as input to this routine may itself by a
> >> > reference
> >> > + *   to some other base packet. Implementations MAY restrict the
> >> > ability
> >> > + *   to create such compound references. Attempts to exceed any
> >> > + *   implementation limits in this regard will result in this
> call
> >> > failing
> >> > + *   and returning ODP_PACKET_INVALID.
> >> > + *
> >> > + * @note If the caller does not indend to push a header onto the
> >> > returned
> >> > + *   reference, the odp_packet_ref_static() API may be used. This
> >> > may be a
> >> > + *   more efficient means of obtaining another reference to a
> base
> >> > packet
> >> > + *   that will be treated as read-only.
> >

Re: [lng-odp] [PATCH] example: l3fwd: prevent possible use of uninitialised variables

2016-10-27 Thread Bill Fischofer
On Thu, Oct 27, 2016 at 8:42 AM, Matias Elo  wrote:

> Fixes bug https://bugs.linaro.org/show_bug.cgi?id=2564
>
> Signed-off-by: Matias Elo 
>

Reviewed-by: Bill Fischofer 


> ---
>  example/l3fwd/odp_l3fwd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c
> index fa1b299..8919bd3 100644
> --- a/example/l3fwd/odp_l3fwd.c
> +++ b/example/l3fwd/odp_l3fwd.c
> @@ -309,7 +309,9 @@ static int run_worker(void *arg)
> }
> }
>
> -   num_pktio = thr_arg->nb_pktio;
> +   if (num_pktio == 0)
> +   LOG_ABORT("No pktio devices found\n");
> +
> if_idx = input_ifs[pktio];
> inq = input_queues[pktio];
>
> --
> 2.7.4
>
>


[lng-odp] [PATCH 1/2] test: perf: add new ordered pktio application

2016-10-27 Thread Elo, Matias (Nokia - FI/Espoo)
Ping.


> On 11 Oct 2016, at 16:21, Matias Elo  wrote:
> 
> Add new test application for ordered queue functionality and performance
> validation. The application sets sequence numbers to incoming packets using
> ordered pktin queues and ordered context locks. After being tagged packets
> are enqueued to atomic queues based on flow hash (IPv4 5-tuple). In atomic
> flow processing the sequence number is validated and packet is sent to
> selected output interface.
> 
> Main options:
> -m: Input queue type can be changed to atomic or parallel to enable easy
>performance comparison. With parallel input queues the packet order is
>not maintained.
> -r: Number of input queues per interface
> -f: Number of atomic flow queues per interface
> -e: Number of extra input processing rounds. This can be used to simulate
>"fat pipe" traffic processing.
> 
> Signed-off-by: Matias Elo 
> ---
> test/common_plat/performance/.gitignore  |1 +
> test/common_plat/performance/Makefile.am |7 +-
> test/common_plat/performance/dummy_crc.h |  493 
> test/common_plat/performance/odp_pktio_ordered.c | 1331 ++
> 4 files changed, 1831 insertions(+), 1 deletion(-)
> create mode 100644 test/common_plat/performance/dummy_crc.h
> create mode 100644 test/common_plat/performance/odp_pktio_ordered.c
> 
> diff --git a/test/common_plat/performance/.gitignore 
> b/test/common_plat/performance/.gitignore
> index 1527d25..8bb18f5 100644
> --- a/test/common_plat/performance/.gitignore
> +++ b/test/common_plat/performance/.gitignore
> @@ -3,6 +3,7 @@
> odp_atomic
> odp_crypto
> odp_l2fwd
> +odp_pktio_ordered
> odp_pktio_perf
> odp_sched_latency
> odp_scheduling
> diff --git a/test/common_plat/performance/Makefile.am 
> b/test/common_plat/performance/Makefile.am
> index f184609..790ddae 100644
> --- a/test/common_plat/performance/Makefile.am
> +++ b/test/common_plat/performance/Makefile.am
> @@ -5,6 +5,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
> EXECUTABLES = odp_crypto$(EXEEXT) odp_pktio_perf$(EXEEXT)
> 
> COMPILE_ONLY = odp_l2fwd$(EXEEXT) \
> +odp_pktio_ordered$(EXEEXT) \
>  odp_sched_latency$(EXEEXT) \
>  odp_scheduling$(EXEEXT)
> 
> @@ -22,15 +23,19 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
> 
> odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static
> odp_crypto_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
> +odp_pktio_ordered_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_pktio_ordered_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
> odp_sched_latency_LDFLAGS = $(AM_LDFLAGS) -static
> odp_sched_latency_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
> odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
> odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
> 
> noinst_HEADERS = \
> -   $(top_srcdir)/test/test_debug.h
> +   $(top_srcdir)/test/test_debug.h \
> +   dummy_crc.h
> 
> dist_odp_crypto_SOURCES = odp_crypto.c
> +dist_odp_pktio_ordered_SOURCES = odp_pktio_ordered.c
> dist_odp_sched_latency_SOURCES = odp_sched_latency.c
> dist_odp_scheduling_SOURCES = odp_scheduling.c
> dist_odp_pktio_perf_SOURCES = odp_pktio_perf.c
> diff --git a/test/common_plat/performance/dummy_crc.h 
> b/test/common_plat/performance/dummy_crc.h
> new file mode 100644
> index 000..38da444
> --- /dev/null
> +++ b/test/common_plat/performance/dummy_crc.h
> @@ -0,0 +1,493 @@
> +/* Copyright (c) 2016, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/*-
> + *   BSD LICENSE
> + *
> + *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
> + *   All rights reserved.
> + *
> + *   Redistribution and use in source and binary forms, with or without
> + *   modification, are permitted provided that the following conditions
> + *   are met:
> + *
> + * * Redistributions of source code must retain the above copyright
> + *   notice, this list of conditions and the following disclaimer.
> + * * Redistributions in binary form must reproduce the above copyright
> + *   notice, this list of conditions and the following disclaimer in
> + *   the documentation and/or other materials provided with the
> + *   distribution.
> + * * Neither the name of Intel Corporation nor the names of its
> + *   contributors may be used to endorse or promote products derived
> + *   from this software without specific prior written permission.
> + *
> + *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> + *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF US

[lng-odp] [PATCH] example: l3fwd: prevent possible use of uninitialised variables

2016-10-27 Thread Matias Elo
Fixes bug https://bugs.linaro.org/show_bug.cgi?id=2564

Signed-off-by: Matias Elo 
---
 example/l3fwd/odp_l3fwd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c
index fa1b299..8919bd3 100644
--- a/example/l3fwd/odp_l3fwd.c
+++ b/example/l3fwd/odp_l3fwd.c
@@ -309,7 +309,9 @@ static int run_worker(void *arg)
}
}
 
-   num_pktio = thr_arg->nb_pktio;
+   if (num_pktio == 0)
+   LOG_ABORT("No pktio devices found\n");
+
if_idx = input_ifs[pktio];
inq = input_queues[pktio];
 
-- 
2.7.4



Re: [lng-odp] [PATCH] linux-generic: config: add missing doxygen documentation for abi macros

2016-10-27 Thread Maxim Uvarov

Merged,
Maxim.

On 10/19/16 18:01, Mike Holmes wrote:

On 19 October 2016 at 08:09, Bill Fischofer  wrote:

Fix Bug https://bugs.linaro.org/show_bug.cgi?id=2553 by adding missing
doxygen documentation for the internal macros ODP_ABI_COMPAT and _STATIC.

Signed-off-by: Bill Fischofer 

Reviewed-by: Mike Holmes 



---
  .../linux-generic/include/odp/api/plat/static_inline.h.in | 11 +++
  1 file changed, 11 insertions(+)

diff --git a/platform/linux-generic/include/odp/api/plat/static_inline.h.in 
b/platform/linux-generic/include/odp/api/plat/static_inline.h.in
index acee5f3..4562a22 100644
--- a/platform/linux-generic/include/odp/api/plat/static_inline.h.in
+++ b/platform/linux-generic/include/odp/api/plat/static_inline.h.in
@@ -17,6 +17,17 @@
  extern "C" {
  #endif

+/**
+ * @internal
+ * @def ODP_ABI_COMPAT
+ * Control ABI compatibility
+ */
+
+/**
+ * @internal
+ * @def _STATIC
+ * Control conditional static inline expansions for ABI compatibility
+ */
  #if @ODP_ABI_COMPAT@
  #define ODP_ABI_COMPAT 1
  #define _STATIC
--
2.7.4








[lng-odp] [PATCHv2 1/1] validation: classification: fix TCP/UDP checksum update

2016-10-27 Thread Balasubramanian Manoharan
Fixes https://bugs.linaro.org/show_bug.cgi?id=2512

Signed-off-by: Balasubramanian Manoharan 
---
v2: Incorporates review comments
 .../api/classification/odp_classification_common.c | 14 +-
 .../api/classification/odp_classification_test_pmr.c   |  3 +++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/test/common_plat/validation/api/classification/odp_classification_common.c 
b/test/common_plat/validation/api/classification/odp_classification_common.c
index 7a42ac7..2923a71 100644
--- a/test/common_plat/validation/api/classification/odp_classification_common.c
+++ b/test/common_plat/validation/api/classification/odp_classification_common.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include "test_debug.h"
 
 typedef struct cls_test_packet {
odp_u32be_t magic;
@@ -291,6 +292,8 @@ odp_packet_t create_packet_len(odp_pool_t pool, bool vlan,
parse_ipv4_string(CLS_DEFAULT_SADDR, &addr, &mask);
ip->src_addr = odp_cpu_to_be_32(addr);
ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN;
+   odp_packet_has_ipv4_set(pkt, 1);
+
if (flag_udp)
ip->tot_len = odp_cpu_to_be_16(ODPH_UDPHDR_LEN + payload_len +
   ODPH_IPV4HDR_LEN);
@@ -318,14 +321,23 @@ odp_packet_t create_packet_len(odp_pool_t pool, bool vlan,
udp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
udp->length = odp_cpu_to_be_16(payload_len + ODPH_UDPHDR_LEN);
udp->chksum = 0;
+   odp_packet_has_udp_set(pkt, 1);
+   if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) {
+   LOG_ERR("odph_udp_tcp_chksum failed\n");
+   return ODP_PACKET_INVALID;
+   }
} else {
odp_packet_l4_offset_set(pkt, offset);
tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
tcp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT);
tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
tcp->hl = ODPH_TCPHDR_LEN / 4;
-   /* TODO: checksum field has to be updated */
tcp->cksm = 0;
+   odp_packet_has_tcp_set(pkt, 1);
+   if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) {
+   LOG_ERR("odph_udp_tcp_chksum failed\n");
+   return ODP_PACKET_INVALID;
+   }
}
 
/* set pkt sequence number */
diff --git 
a/test/common_plat/validation/api/classification/odp_classification_test_pmr.c 
b/test/common_plat/validation/api/classification/odp_classification_test_pmr.c
index c8bbf50..88fbf8f 100644
--- 
a/test/common_plat/validation/api/classification/odp_classification_test_pmr.c
+++ 
b/test/common_plat/validation/api/classification/odp_classification_test_pmr.c
@@ -717,6 +717,7 @@ void classification_test_pmr_term_dmac(void)
 
/* Other packets delivered to default queue */
pkt = create_packet(pkt_pool, false, &seq, false);
+   CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
memset(eth->dst.addr, 0, ODPH_ETHADDR_LEN);
CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
@@ -1102,6 +1103,7 @@ static void classification_test_pmr_term_daddr(void)
/* packet with dst ip address matching PMR rule to be
received in the CoS queue*/
pkt = create_packet(pkt_pool, false, &seq, false);
+   CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
@@ -1122,6 +1124,7 @@ static void classification_test_pmr_term_daddr(void)
 
/* Other packets delivered to default queue */
pkt = create_packet(pkt_pool, false, &seq, false);
+   CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
seqno = cls_pkt_get_seq(pkt);
CU_ASSERT(seqno != TEST_SEQ_INVALID);
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
-- 
1.9.1



[lng-odp] [Bug 2512] validation: TCP checksum update

2016-10-27 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2512

--- Comment #3 from Mike Holmes  ---
Patch on list http://patches.opendataplane.org/patch/6951/ needs V2

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[lng-odp] [Bug 2494] Extend odp_pktio_capability_t to include minimal pool size required by pktio implementation.

2016-10-27 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2494

--- Comment #2 from Bala Manoharan  ---
Hi,

If we allow the pktio implementation to create the packet pool then it is not
possible to link a single pool to more than one pktio interface.

This issue could be resolved by pktio implementation adding the additional
required buffers internally or maintaining an internal pool to handle the
additional buffer requirement.

Pls clarify if i am missing something. 

Regards,
Bala

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Re: [lng-odp] [RFC API-NEXT PATCH] api: packet: add packet reference apis

2016-10-27 Thread Bala Manoharan
On 26 October 2016 at 23:17, Bill Fischofer  wrote:
>
>
> On Wed, Oct 26, 2016 at 12:19 PM, Bala Manoharan 
> wrote:
>>
>> On 26 October 2016 at 07:26, Bill Fischofer 
>> wrote:
>> > Add the following five packet APIs:
>> >
>> > - odp_packet_ref_static()
>> > - odp_packet_ref()
>> > - odp_packet_ref_pkt()
>> > - odp_packet_is_a_ref()
>> > - odp_packet_is_referenced()
>> >
>> > Signed-off-by: Bill Fischofer 
>> > ---
>> >  include/odp/api/spec/packet.h | 143
>> > ++
>> >  1 file changed, 143 insertions(+)
>> >
>> > diff --git a/include/odp/api/spec/packet.h
>> > b/include/odp/api/spec/packet.h
>> > index 4a14f2d..7e347c5 100644
>> > --- a/include/odp/api/spec/packet.h
>> > +++ b/include/odp/api/spec/packet.h
>> > @@ -846,6 +846,149 @@ int odp_packet_split(odp_packet_t *pkt, uint32_t
>> > len, odp_packet_t *tail);
>> >
>> >  /*
>> >   *
>> > + * References
>> > + * 
>> > + *
>> > + */
>> > +
>> > +/**
>> > + * Create a static reference to a packet
>> > + *
>> > + * Create a (shared) reference to a base packet. A static reference is
>> > used to
>> > + * retain a copy of the packet so that the storage behind it is not
>> > freed
>> > + * until all references to the packet are freed. This can be used, for
>> > + * example, to support efficient retransmission processing.
>> > + *
>> > + * @param pktHandle of the base packet for which a static reference
>> > is
>> > + *   to be created.
>> > + *
>> > + * @returnHandle of the reference packet
>> > + * @retval ODP_PACKET_INVALID Operation failed. Base packet remains
>> > unchanged.
>> > + *
>> > + * @note The intent of a static reference is that both the base packet
>> > and the
>> > + *   returned reference should be treated as read-only after this
>> > + *   call. Results are unpredictable if this restriction is not
>> > observed.
>> > + *
>> > + * @note Static references have restrictions but may have performance
>> > + *   advantages on some platforms if the caller does not intend to
>> > modify
>> > + *   the reference packet. If modification is needed (e.g., to
>> > prefix a
>> > + *   unique header onto the packet) then odp_packet_ref() should be
>> > used.
>> > + */
>> > +odp_packet_t odp_packet_ref_static(odp_packet_t pkt);
>> > +
>> > +/**
>> > + * Create a reference to a packet
>> > + *
>> > + * Create a (shared) reference to a base packet starting at a specified
>> > byte
>> > + * offset. This reference may be used as an argument to header
>> > manipulation
>> > + * APIs to prefix a unique header onto the shared base. The storage
>> > associated
>> > + * with the base packet is not freed until all references to it are
>> > freed,
>> > + * which permits easy multicasting or retransmission processing to be
>> > + * performed.
>> > + *
>> > + * @param pktHandle of the base packet for which a reference is to
>> > be
>> > + *   created.
>> > + *
>> > + * @param offset Byte offset in the base packet at which the shared
>> > reference
>> > + *   is to begin. Must be in the range
>> > 0..odp_packet_len(pkt)-1.
>> > + *
>> > + * @returnHandle of the reference packet
>> > + * @retval ODP_PACKET_INVALID Operation failed. Base packet remains
>> > unchanged.
>> > + *
>> > + * @note This operation prepends a zero-length header onto the base
>> > packet
>> > + *   beginning at the specified offset. This header is always drawn
>> > from
>> > + *   the same pool as the base packet.
>> > + *
>> > + * @note Because references are unique packets, any bytes pushed onto
>> > the head
>> > + *   of a reference via odp_packet_push_head() or
>> > odp_packet_extend_head()
>> > + *   are unique to this reference and are not seen by any other
>> > reference
>> > + *   to the same base packet.
>> > + *
>> > + * @note The base pkt used as input to this routine may itself by a
>> > reference
>> > + *   to some other base packet. Implementations MAY restrict the
>> > ability
>> > + *   to create such compound references. Attempts to exceed any
>> > + *   implementation limits in this regard will result in this call
>> > failing
>> > + *   and returning ODP_PACKET_INVALID.
>> > + *
>> > + * @note If the caller does not indend to push a header onto the
>> > returned
>> > + *   reference, the odp_packet_ref_static() API may be used. This
>> > may be a
>> > + *   more efficient means of obtaining another reference to a base
>> > packet
>> > + *   that will be treated as read-only.
>> > + */
>> > +odp_packet_t odp_packet_ref(odp_packet_t pkt, uint32_t offset);
>> > +
>> > +/**
>> > + * Create a reference to another packet from a header packet
>> > + *
>> > + * Create a (shared) reference to a base packet starting at a specified
>> > byte
>> > + * offset by prepending a header packet. The resulting reference
>> > consists of
>> > + * the unshared

Re: [lng-odp] [PATCH] linux-generic: packet: add fall through comments to parser

2016-10-27 Thread Elo, Matias (Nokia - FI/Espoo)

Reviewed-by: Matias Elo 

> On 26 Oct 2016, at 15:47, Bill Fischofer  wrote:
> 
> Address bug https://bugs.linaro.org/show_bug.cgi?id=2565 by adding
> comments to the parser's switch statement to document the fact that
> fall through is intentional.
> 
> Signed-off-by: Bill Fischofer 
> ---
> platform/linux-generic/odp_packet.c | 7 +++
> 1 file changed, 7 insertions(+)
> 
> diff --git a/platform/linux-generic/odp_packet.c 
> b/platform/linux-generic/odp_packet.c
> index 714794a..e43636b 100644
> --- a/platform/linux-generic/odp_packet.c
> +++ b/platform/linux-generic/odp_packet.c
> @@ -1182,6 +1182,8 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
> 
>   switch (prs->parsed_layers) {
>   case LAYER_NONE:
> + /* Fall through */
> +
>   case LAYER_L2:
>   {
>   const _odp_ethhdr_t *eth;
> @@ -1254,6 +1256,8 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
>   if (layer == LAYER_L2)
>   return prs->error_flags.all != 0;
>   }
> + /* Fall through */
> +
>   case LAYER_L3:
>   {
>   offset = prs->l3_offset;
> @@ -1292,6 +1296,8 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
>   if (layer == LAYER_L3)
>   return prs->error_flags.all != 0;
>   }
> + /* Fall through */
> +
>   case LAYER_L4:
>   {
>   offset = prs->l4_offset;
> @@ -1341,6 +1347,7 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
>   prs->parsed_layers = LAYER_L4;
>   break;
>   }
> +
>   case LAYER_ALL:
>   break;
> 
> -- 
> 2.7.4
>