[lng-odp] [Bug 2137] CID 158531: Missing break in switch: odp_crypto.c

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2137

Krishna Garapati  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #1 from Krishna Garapati  ---
Fallowing commit id fixes this issue,

ID: 226416206efc01fe5ccb34014e110f858ebb2f87

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 2141] test/performance/odp_crypto valgrind uninitialised value

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2141

Krishna Garapati  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Krishna Garapati  ---
Fallowing commit id resolves this issue,

ID: 03d383af4f1c19f8ed229e358942992f8852c813

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

2016-03-28 Thread Bill Fischofer
We can discuss this during tomorrow's ODP call.  Jerin, can you join us for
that?  15:00 UTC.  Thanks.

On Mon, Mar 28, 2016 at 11:26 AM, Jerin Jacob <
jerin.ja...@caviumnetworks.com> wrote:

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

Re: [lng-odp] [API-NEXT PATCH 5/6] api: pktio: add checksum offload options

2016-03-28 Thread Bala Manoharan
On 28 March 2016 at 19:14, Bill Fischofer  wrote:

>
>
> On Mon, Mar 28, 2016 at 5:25 AM, Bala Manoharan  > wrote:
>
>>
>>
>> Regards,
>> Bala
>>
>> On 24 March 2016 at 20:19, Petri Savolainen 
>> wrote:
>>
>>> Added options for selecting IP/UDP/TCP/SCTP checksum offload on
>>> packet input and output. Packets with input checksum failure are
>>> either dropped or reported with packet_has_l3/l4_error flags.
>>>
>>> Signed-off-by: Petri Savolainen 
>>> ---
>>>  include/odp/api/spec/packet_io.h | 66
>>> +++-
>>>  1 file changed, 65 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/odp/api/spec/packet_io.h
>>> b/include/odp/api/spec/packet_io.h
>>> index 767a1b2..f9df7c3 100644
>>> --- a/include/odp/api/spec/packet_io.h
>>> +++ b/include/odp/api/spec/packet_io.h
>>> @@ -246,7 +246,9 @@ typedef struct odp_pktio_param_t {
>>>  /**
>>>   * Packet input configuration options bit field
>>>   *
>>> - * Packet input configuration options listed in a bit field structure.
>>> + * Packet input configuration options listed in a bit field structure.
>>> Depending
>>> + * on configuration erroneous packets are either dropped or marked with
>>> error
>>> + * flags (see e.g. odp_packet_has_error() and
>>> odp_packet_has_l3_error()).
>>>   */
>>>  typedef union odp_pktin_config_opt_t {
>>> /** Option flags */
>>> @@ -257,6 +259,34 @@ typedef union odp_pktin_config_opt_t {
>>> /** Timestamp (at least) IEEE1588 / PTP packets
>>>   * on packet input */
>>> uint64_t ts_ptp: 1;
>>> +
>>> +   /** Check IPv4 header checksum on packet input */
>>> +   uint64_t ipv4_chksum   : 1;
>>> +
>>> +   /** Check UDP checksum on packet input */
>>> +   uint64_t udp_chksum: 1;
>>> +
>>> +   /** Check TCP checksum on packet input */
>>> +   uint64_t tcp_chksum: 1;
>>> +
>>> +   /** Check SCTP checksum on packet input */
>>> +   uint64_t sctp_chksum   : 1;
>>> +
>>> +   /** Drop packets with an IPv4 error on packet input */
>>> +   uint64_t drop_ipv4_err : 1;
>>> +
>>> +   /** Drop packets with an IPv6 error on packet input */
>>> +   uint64_t drop_ipv6_err : 1;
>>> +
>>> +   /** Drop packets with a UDP error on packet input */
>>> +   uint64_t drop_udp_err  : 1;
>>> +
>>> +   /** Drop packets with a TCP error on packet input */
>>> +   uint64_t drop_tcp_err  : 1;
>>> +
>>> +   /** Drop packets with a SCTP error on packet input */
>>> +   uint64_t drop_sctp_err : 1;
>>> +
>>>
>>
>> We have an existing mechanism in classifier where the application can
>> configure an error CoS so that the packets with error are sent to
>> Error_CoS. So do we really need this mechanism at the interface level to
>> drop packets with error.
>>
>> } bit;
>>>
>>> /** All bits of the bit field structure
>>> @@ -267,6 +297,35 @@ typedef union odp_pktin_config_opt_t {
>>>  } odp_pktin_config_opt_t;
>>>
>>>  /**
>>> + * Packet output configuration options bit field
>>> + *
>>> + * Packet output configuration options listed in a bit field structure.
>>> + */
>>> +typedef union odp_pktout_config_opt_t {
>>> +   /** Option flags */
>>> +   struct {
>>> +   /** Insert IPv4 header checksum on packet output */
>>> +   uint64_t ipv4_chksum  : 1;
>>> +
>>> +   /** Insert UDP checksum on packet output */
>>> +   uint64_t udp_chksum   : 1;
>>> +
>>> +   /** Insert TCP checksum on packet output */
>>> +   uint64_t tcp_chksum   : 1;
>>> +
>>> +   /** Insert SCTP checksum on packet output */
>>> +   uint64_t sctp_chksum  : 1;
>>> +
>>> +   } bit;
>>>
>>
>> IMO, since L3/L4 checksum calculation is a per packet operation it might
>> be better to add this in packet meta data so that if the application does
>> not modify the packet then there is no need to re-calculate the L3/L4
>> checksum. Hence if an application modifies a particular packet it can set
>> the checksum calculation bit on that packet and the implementation will
>> calculate and insert checksum for the specific packet before transmission.
>> By having this as a per-packet parameter there is no need to calculate
>> checksum for all packets in the interface.
>>
>
> That's a good point.  But I don't view these as exclusive.  It makes sense
> to enable/disable checksum offload at the interface level and then provide
> override capabilities on a per-packet basis so that only exceptional
> packets need additional attributes.
>
>

I am really not sure if we need this parameter in two places usually the
packets which require checksum recalculation are newly created packets 

Re: [lng-odp] [PATCH] test:performance:initialize undefined values

2016-03-28 Thread Maxim Uvarov

patch was merged,
Maxim.

On 03/25/16 18:53, Bill Fischofer wrote:



On Fri, Mar 25, 2016 at 5:30 AM, Balakrishna Garapati 
> wrote:


Signed-off-by: Balakrishna Garapati
>


Reviewed-by: Bill Fischofer >


---
 v1:fix for valgrind erros from crypto test
https://bugs.linaro.org/show_bug.cgi?id=2141

 test/performance/odp_crypto.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/performance/odp_crypto.c
b/test/performance/odp_crypto.c
index 5fd339d..6bd5cf5 100644
--- a/test/performance/odp_crypto.c
+++ b/test/performance/odp_crypto.c
@@ -726,6 +726,8 @@ int main(int argc, char *argv[])
odp_cpumask_t cpumask;
char cpumaskstr[ODP_CPUMASK_STR_SIZE];

+   memset(, 0, sizeof(cargs));
+
/* Parse and store the application arguments */
parse_args(argc, argv, );

--
1.9.1

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




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


Re: [lng-odp] [PATCH 1/2] checkpatch.pl: do not require kstrtoint

2016-03-28 Thread Maxim Uvarov

Ok, Mike thanks, I merged that patch.

Please consider only v2 for review.

Maxim.

On 03/28/16 19:17, Mike Holmes wrote:



On 28 March 2016 at 11:23, Maxim Uvarov > wrote:


For one line sscanf checkpatch requires kernels kstrtoint
helper function. Comment this check out.


I dont think we should patch check-patch, why is this not covered with 
the .checkpatch.conf ?


I sent a patch for disabling this via the normal mechanism last year 
"checkpatch.conf add SSCANF_TO_KSTRTO exception"



Signed-off-by: Maxim Uvarov >
---
 scripts/checkpatch.pl  | 38
+++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/scripts/checkpatch.pl 
b/scripts/checkpatch.pl 
index 16316b9..8882757 100755
--- a/scripts/checkpatch.pl 
+++ b/scripts/checkpatch.pl 
@@ -5093,25 +5093,25 @@ sub process {
}

 # check for simple sscanf that should be kstrto
-   if ($^V && $^V ge 5.10.0 &&
-   defined $stat &&
-   $line =~ /\bsscanf\b/) {
-   my $lc = $stat =~ tr@\n@@;
-   $lc = $lc + $linenr;
-   my $stat_real = raw_line($linenr, 0);
-   for (my $count = $linenr + 1; $count <=
$lc; $count++) {
-   $stat_real = $stat_real . "\n" .
raw_line($count, 0);
-   }
-   if ($stat_real =~
/\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
-   my $format = $6;
-   my $count = $format =~ tr@%@%@;
-   if ($count == 1 &&
-   $format =~
/^"\%(?i:ll[udxi]|[udxi]ll|ll|[hl]h?[udxi]|[udxi][hl]h?|[hl]h?|[udxi])"$/)
{
-  WARN("SSCANF_TO_KSTRTO",
-"Prefer kstrto
to single variable sscanf\n" . "$here\n$stat_real\n");
-   }
-   }
-   }
+#  if ($^V && $^V ge 5.10.0 &&
+#  defined $stat &&
+#  $line =~ /\bsscanf\b/) {
+#  my $lc = $stat =~ tr@\n@@;
+#  $lc = $lc + $linenr;
+#  my $stat_real = raw_line($linenr, 0);
+#  for (my $count = $linenr + 1; $count <=
$lc; $count++) {
+#  $stat_real = $stat_real . "\n" .
raw_line($count, 0);
+#  }
+#  if ($stat_real =~
/\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
+#  my $format = $6;
+#  my $count = $format =~ tr@%@%@;
+#  if ($count == 1 &&
+#  $format =~
/^"\%(?i:ll[udxi]|[udxi]ll|ll|[hl]h?[udxi]|[udxi][hl]h?|[hl]h?|[udxi])"$/)
{
+# WARN("SSCANF_TO_KSTRTO",
+#   "Prefer kstrto
to single variable sscanf\n" . "$here\n$stat_real\n");
+#  }
+#  }
+#  }

 # check for new externs in .h files.
if ($realfile =~ /\.h$/ &&
--
2.7.1.250.gff4ea60

___
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 1/6] checkpatch.conf add SSCANF_TO_KSTRTO exception

2016-03-28 Thread Maxim Uvarov

Merged this patch with fix in the comment.

Maxim.

On 08/25/15 22:58, Mike Holmes wrote:



On 25 August 2015 at 14:56, Maxim Uvarov > wrote:


On 08/25/15 18:26, Mike Holmes wrote:

This is not the kernel, ignore this recommendation

Signed-off-by: Mike Holmes >
---
  .checkpatch.conf | 1 +
  1 file changed, 1 insertion(+)

diff --git a/.checkpatch.conf b/.checkpatch.conf
index fbbb146..3e3baa3 100644
--- a/.checkpatch.conf
+++ b/.checkpatch.conf
@@ -1,5 +1,6 @@
  --no-tree
  --strict
+--ignore SSCANF_TO_KSTRTO
  --ignore=NEW_TYPEDEFS
  --ignore=DEPRECATED_VARIABLE


did you miss "=" ?


Ah I did but it works either way, will fix


Maxim.

  --codespell


___
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



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


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

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

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

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

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


Re: [lng-odp] [PATCH 1/2] checkpatch.pl: do not require kstrtoint

2016-03-28 Thread Mike Holmes
On 28 March 2016 at 11:23, Maxim Uvarov  wrote:

> For one line sscanf checkpatch requires kernels kstrtoint
> helper function. Comment this check out.
>

I dont think we should patch check-patch, why is this not covered with the
.checkpatch.conf ?

I sent a patch for disabling this via the normal mechanism last year
"checkpatch.conf add SSCANF_TO_KSTRTO exception"


>
> Signed-off-by: Maxim Uvarov 
> ---
>  scripts/checkpatch.pl | 38 +++---
>  1 file changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 16316b9..8882757 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5093,25 +5093,25 @@ sub process {
> }
>
>  # check for simple sscanf that should be kstrto
> -   if ($^V && $^V ge 5.10.0 &&
> -   defined $stat &&
> -   $line =~ /\bsscanf\b/) {
> -   my $lc = $stat =~ tr@\n@@;
> -   $lc = $lc + $linenr;
> -   my $stat_real = raw_line($linenr, 0);
> -   for (my $count = $linenr + 1; $count <= $lc;
> $count++) {
> -   $stat_real = $stat_real . "\n" .
> raw_line($count, 0);
> -   }
> -   if ($stat_real =~
> /\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
> -   my $format = $6;
> -   my $count = $format =~ tr@%@%@;
> -   if ($count == 1 &&
> -   $format =~
> /^"\%(?i:ll[udxi]|[udxi]ll|ll|[hl]h?[udxi]|[udxi][hl]h?|[hl]h?|[udxi])"$/) {
> -   WARN("SSCANF_TO_KSTRTO",
> -"Prefer kstrto to
> single variable sscanf\n" . "$here\n$stat_real\n");
> -   }
> -   }
> -   }
> +#  if ($^V && $^V ge 5.10.0 &&
> +#  defined $stat &&
> +#  $line =~ /\bsscanf\b/) {
> +#  my $lc = $stat =~ tr@\n@@;
> +#  $lc = $lc + $linenr;
> +#  my $stat_real = raw_line($linenr, 0);
> +#  for (my $count = $linenr + 1; $count <= $lc;
> $count++) {
> +#  $stat_real = $stat_real . "\n" .
> raw_line($count, 0);
> +#  }
> +#  if ($stat_real =~
> /\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
> +#  my $format = $6;
> +#  my $count = $format =~ tr@%@%@;
> +#  if ($count == 1 &&
> +#  $format =~
> /^"\%(?i:ll[udxi]|[udxi]ll|ll|[hl]h?[udxi]|[udxi][hl]h?|[hl]h?|[udxi])"$/) {
> +#  WARN("SSCANF_TO_KSTRTO",
> +#   "Prefer kstrto to
> single variable sscanf\n" . "$here\n$stat_real\n");
> +#  }
> +#  }
> +#  }
>
>  # check for new externs in .h files.
> if ($realfile =~ /\.h$/ &&
> --
> 2.7.1.250.gff4ea60
>
> ___
> 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


[lng-odp] [PATCH 5/5] linux-generic: add support for initial cpumasks

2016-03-28 Thread Gary S. Robertson
These code changes depend on the addition of control and worker
cpumask pointers to the ODP initialization parameters,
and implement the change in behavior suggested with that patch.
They serve as the 'glue' between the input of the new ODP API
initial cpuset masks and the use of those new cpumasks by the
ODP application or instance.

These changes allow multiple concurrent ODP instances to
be given CPU resources which do not conflict with one another,
so multiple ODP instances can coexist harmoniously with
any isolation support on the underlying platform
as well as with one another.

Specifically: if either of the cpumask pointers are NULL when
calling odp_init_global(), then that function creates
'best-guess' default values for the unspecified cpumasks and
saves those defaults into global variables for later reference.

However, if the cpumasks are valid and their pointers
initialized prior to calling odp_init_global() then
that routine saves their contents into the global variables
instead of the default cpumasks.

When odp_cpumask_default_control() or odp_cpumask_default_worker()
are called they build the caller's cpumasks based on the
saved contents of the global cpumask variables.

Signed-off-by: Gary S. Robertson 
---
 platform/linux-generic/include/odp_internal.h |   2 +-
 platform/linux-generic/odp_cpumask.c  | 177 --
 platform/linux-generic/odp_init.c |   2 +-
 3 files changed, 165 insertions(+), 16 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 567b1fb..ef165ac 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -69,7 +69,7 @@ extern struct odp_global_data_s odp_global_data;
 int _odp_term_global(enum init_stage stage);
 int _odp_term_local(enum init_stage stage);
 
-int odp_cpumask_init_global(void);
+int odp_cpumask_init_global(const odp_init_t *params);
 int odp_cpumask_term_global(void);
 
 int odp_system_info_init(void);
diff --git a/platform/linux-generic/odp_cpumask.c 
b/platform/linux-generic/odp_cpumask.c
index 320ca8e..fd672e2 100644
--- a/platform/linux-generic/odp_cpumask.c
+++ b/platform/linux-generic/odp_cpumask.c
@@ -10,6 +10,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -215,8 +216,7 @@ int odp_cpumask_next(const odp_cpumask_t *mask, int cpu)
 
 /*
  * This function obtains system information specifying which cpus are
- * available at boot time. These data are then used to produce cpumasks of
- * configured CPUs without concern over isolation support.
+ * available at boot time.
  */
 static int get_installed_cpus(void)
 {
@@ -288,21 +288,22 @@ static int get_installed_cpus(void)
 }
 
 /*
- * This function creates reasonable default cpumasks for control and worker
- * tasks from the set of CPUs available at boot time.
+ * This function creates reasonable default cpumasks for control tasks
+ * from the set of CPUs available at boot time.
+ * This function assumes that the global control cpumask contains
+ * a list of all installed CPUs, and that no control cpumask was specified.
  */
-int odp_cpumask_init_global(void)
+static void init_default_control_cpumask(int worker_cpus_default)
 {
odp_cpumask_t *control_mask = _global_data.control_cpus;
odp_cpumask_t *worker_mask = _global_data.worker_cpus;
int i;
-   int retval = -1;
 
-   if (!get_installed_cpus()) {
-   /* CPU 0 is only used for workers on uniprocessor systems */
-   if (odp_global_data.num_cpus_installed > 1)
-   odp_cpumask_clr(worker_mask, 0);
+   /* (Bits for all available CPUs are SET in control cpumask) */
+
+   if (worker_cpus_default) {
/*
+* The worker cpumask was also unspecified...
 * If only one or two CPUs installed, use CPU 0 for control.
 * Otherwise leave it for the kernel and start with CPU 1.
 */
@@ -319,15 +320,163 @@ int odp_cpumask_init_global(void)
 * reserve remaining CPUs for workers
 */
odp_cpumask_clr(control_mask, 0);
-   odp_cpumask_clr(worker_mask, 1);
-   for (i = 2; i < CPU_SETSIZE; i++) {
+   for (i = 2; i < odp_global_data.num_cpus_installed; i++)
if (odp_cpumask_isset(worker_mask, i))
odp_cpumask_clr(control_mask, i);
+   }
+   } else {
+   /*
+* The worker cpumask was specified so first ensure
+* the control cpumask does not overlap any worker CPUs
+   

[lng-odp] [PATCH 4/5] api: init: add control/worker cpumasks to init data

2016-03-28 Thread Gary S. Robertson
Adds pointers to externally supplied cpumasks for
control and worker CPUs to the ODP global init data
which is passed as an argument to odp_init_global.
The intent is to allow an external entity to pass in
lists of the CPU resources available to the current
ODP application.

It is assumed that these pointers would be NULL
unless explicitly populated prior to calling
odp_init_global.

odp_init_global would respond to NULL pointers
here by ensuring that odp_cpumask_default_control and
odp_cpumask_default_worker would return the
platform-specific default CPU configurations.

If these pointers were not NULL when odp_init_global was called,
then the above functions would return cpumasks reflecting the
(possibly amended) contents of the referenced cpumasks
instead of the platform defaults.

Signed-off-by: Gary S. Robertson 
---
 include/odp/api/spec/init.h | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h
index 47ebd54..df91ed8 100644
--- a/include/odp/api/spec/init.h
+++ b/include/odp/api/spec/init.h
@@ -31,6 +31,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 
 /** @defgroup odp_initialization ODP INITIALIZATION
  *  Initialisation operations.
@@ -123,6 +124,32 @@ typedef struct odp_init_t {
Valid range is from 0 to platform specific maximum. Set both
num_worker and num_control to zero for default number of threads. */
int num_control;
+   /** Pointer to bit mask mapping CPUs available to this ODP instance
+   for running worker threads.
+   Initialize to a NULL pointer to use default CPU mapping.
+   When the mask is defined, odp_cpumask_default_worker()
+   uses it instead of returning a default mask.
+   Applications code should not access this cpumask directly.
+   Valid range of CPUs and optimal CPU selection
+   are platform specific, but generally it is recommended that:
+   * worker CPUs are dedicated to run only ODP worker threads
+ (one thread per CPU)
+   * worker and control masks do not overlap
+   * different ODP instances do not specify overlapping
+ worker masks
+*/
+   odp_cpumask_t *worker_cpus;
+   /** Pointer to bit mask mapping CPUs available to this ODP instance
+   for running control threads.
+   Initialize to a NULL pointer to use default CPU mapping.
+   When the mask is defined, odp_cpumask_default_control()
+   uses it instead of returning a default mask.
+   Applications code should not access this cpumask directly.
+   Valid range of CPUs and optimal CPU selection
+   are platform specific, but generally it is recommended that
+   worker and control masks do not overlap.
+*/
+   odp_cpumask_t *control_cpus;
/** Replacement for the default log fn */
odp_log_func_t log_fn;
/** Replacement for the default abort fn */
-- 
1.9.1

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


[lng-odp] [PATCH 3/5] linux-generic: Make cpu detection work with NO_HZ_FULL

2016-03-28 Thread Gary S. Robertson
sched_getaffinity() and pthread_getaffinity_np() do not return
an accurate mask of all CPUs in the machine when the kernel
is compiled with NO_HZ_FULL support.

See Linaro BUG 2027 for details.
https://bugs.linaro.org/show_bug.cgi?id=2027

This code replaces the 'getaffinity' based CPU discovery logic
-and- removes any exclusivity between default control and worker
cpumasks, based on an assumption that external cpumask specifications
will segregate CPUs if needed.

The results of these changes which address BUG 2027 are:
(1) all CPUs known to the kernel at boot time are considered
for use by ODP regardless of the default CPU affinity masks
set by the kernel scheduler,
(2) the default control and worker cpumasks are given reasonable
values based on the set of installed CPUs

Also - this code:
(a) adds control and worker cpumasks to the linux-generic global data
(b) adds logic to odp_cpumask.c to initialize these masks
(c) calls the new cpumask initialization logic from odp_init_global()
(d) reduces odp_cpumask_default_control() and
odp_cpumask_default_worker() to use the content of these new
cpumasks without modification.
These changes provide prerequisite infrastructure for pending changes
which will allow ODP to accept cpumasks passed in
from external entities such as a provisioning service.

Signed-off-by: Gary S. Robertson 
---
 platform/linux-generic/include/odp_internal.h |   7 ++
 platform/linux-generic/odp_cpumask.c  | 126 ++
 platform/linux-generic/odp_cpumask_task.c |  70 +-
 platform/linux-generic/odp_init.c |   9 +-
 platform/linux-generic/odp_system_info.c  |  13 +--
 5 files changed, 187 insertions(+), 38 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 679d9d2..567b1fb 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -18,6 +18,7 @@ extern "C" {
 #endif
 
 #include 
+#include 
 #include 
 #include 
 
@@ -40,6 +41,9 @@ struct odp_global_data_s {
odp_log_func_t log_fn;
odp_abort_func_t abort_fn;
odp_system_info_t system_info;
+   odp_cpumask_t control_cpus;
+   odp_cpumask_t worker_cpus;
+   int num_cpus_installed;
 };
 
 enum init_stage {
@@ -65,6 +69,9 @@ extern struct odp_global_data_s odp_global_data;
 int _odp_term_global(enum init_stage stage);
 int _odp_term_local(enum init_stage stage);
 
+int odp_cpumask_init_global(void);
+int odp_cpumask_term_global(void);
+
 int odp_system_info_init(void);
 int odp_system_info_term(void);
 
diff --git a/platform/linux-generic/odp_cpumask.c 
b/platform/linux-generic/odp_cpumask.c
index 4249f1d..320ca8e 100644
--- a/platform/linux-generic/odp_cpumask.c
+++ b/platform/linux-generic/odp_cpumask.c
@@ -15,6 +15,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 /** @internal Compile time assert */
 _ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE,
   "ODP_CPUMASK_SIZE__SIZE_ERROR");
@@ -208,3 +212,125 @@ int odp_cpumask_next(const odp_cpumask_t *mask, int cpu)
return cpu;
return -1;
 }
+
+/*
+ * This function obtains system information specifying which cpus are
+ * available at boot time. These data are then used to produce cpumasks of
+ * configured CPUs without concern over isolation support.
+ */
+static int get_installed_cpus(void)
+{
+   char *numptr;
+   char *endptr;
+   long int cpu_idnum;
+   DIR  *d;
+   struct dirent *dir;
+
+   /* 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;
+ 

[lng-odp] [PATCH 1/5] test: correct worker count calculation

2016-03-28 Thread Gary S. Robertson
During the process of addressing Linaro BUG 2027 which relates to
inaccurate reporting of available CPUs by ODP linux-generic when
running atop a kernel compiled with NO_HZ_FULL support,
a number of instances were encountered in the validation and
performance test software where incorrect methods were used to
determine the proper (or maximum) number of worker threads to create.

See Linaro BUG 2027 for details.
https://bugs.linaro.org/show_bug.cgi?id=2027

The use of odp_cpu_count() for this purpose is incorrect and
deprecated... odp_cpumask_default_worker() should always be used
to determine the set and number of CPUs available for creating
worker threads.

The use of odp_cpu_count() for this purpose in conjunction with the
correct means of determining available CPUs resulted in some tests
hanging in calls to odp_barrier_wait() as the barriers were initialized
to expect threads on ALL CPUs rather than on worker CPUs alone...
and there were too few worker threads created to satisfy the barriers.

The changes below correct all instances I could find of this deprecated
technique and allowed all tests to complete successfully with the
BUG 2027 patch applied. (BTW they also run correctly without that patch
after the application of the modifications included here.)

Signed-off-by: Gary S. Robertson 
---
 test/validation/shmem/shmem.c |  3 ++-
 test/validation/timer/timer.c | 18 ++
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/test/validation/shmem/shmem.c b/test/validation/shmem/shmem.c
index ba4973d..0bf38d2 100644
--- a/test/validation/shmem/shmem.c
+++ b/test/validation/shmem/shmem.c
@@ -52,6 +52,7 @@ void shmem_test_odp_shm_sunnyday(void)
pthrd_arg thrdarg;
odp_shm_t shm;
test_shared_data_t *test_shared_data;
+   odp_cpumask_t unused;
 
shm = odp_shm_reserve(TESTNAME,
  sizeof(test_shared_data_t), ALIGE_SIZE, 0);
@@ -70,7 +71,7 @@ void shmem_test_odp_shm_sunnyday(void)
test_shared_data->foo = TEST_SHARE_FOO;
test_shared_data->bar = TEST_SHARE_BAR;
 
-   thrdarg.numthrds = odp_cpu_count();
+   thrdarg.numthrds = odp_cpumask_default_worker(, 0);
 
if (thrdarg.numthrds > MAX_WORKERS)
thrdarg.numthrds = MAX_WORKERS;
diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
index 7b76dbf..aad11aa 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -14,7 +14,8 @@
 #endif
 
 #include 
-#include 
+#include 
+#include 
 #include "odp_cunit_common.h"
 #include "test_debug.h"
 #include "timer.h"
@@ -41,12 +42,6 @@ static odp_atomic_u32_t ndelivtoolate;
  * caches may make this number lower than the capacity of the pool  */
 static odp_atomic_u32_t timers_allocated;
 
-/** @private min() function */
-static int min(int a, int b)
-{
-   return a < b ? a : b;
-}
-
 /* @private Timer helper structure */
 struct test_timer {
odp_timer_t tim; /* Timer handle */
@@ -457,10 +452,17 @@ void timer_test_odp_timer_all(void)
int rc;
odp_pool_param_t params;
odp_timer_pool_param_t tparam;
+   odp_cpumask_t unused;
+
/* Reserve at least one core for running other processes so the timer
 * test hopefully can run undisturbed and thus get better timing
 * results. */
-   int num_workers = min(odp_cpu_count() - 1, MAX_WORKERS);
+   int num_workers = odp_cpumask_default_worker(, 0);
+
+   /* force to max CPU count */
+   if (num_workers > MAX_WORKERS)
+   num_workers = MAX_WORKERS;
+
/* On a single-CPU machine run at least one thread */
if (num_workers < 1)
num_workers = 1;
-- 
1.9.1

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


[lng-odp] [PATCH 2/5] test: allow more than one control cpu

2016-03-28 Thread Gary S. Robertson
A second issue was discovered in the validation test code after fixing
bug 2027 and creating default cpumasks containing all installed CPUs.

See Linaro BUG 2027 for details.
https://bugs.linaro.org/show_bug.cgi?id=2027

The cpumask validation test expected exactly one control CPU and
returned an error otherwise.
This change considers one or more control CPUs to be correct.

Signed-off-by: Gary S. Robertson 
---
 test/validation/cpumask/cpumask.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/validation/cpumask/cpumask.c 
b/test/validation/cpumask/cpumask.c
index 017332a..24e67b0 100644
--- a/test/validation/cpumask/cpumask.c
+++ b/test/validation/cpumask/cpumask.c
@@ -67,7 +67,7 @@ void cpumask_test_odp_cpumask_def(void)
mask_count = odp_cpumask_count();
CU_ASSERT(mask_count == num_control);
 
-   CU_ASSERT(num_control == 1);
+   CU_ASSERT(num_control >= 1);
CU_ASSERT(num_worker <= available_cpus);
CU_ASSERT(num_worker > 0);
 }
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH V5 0/5] fix BUG 2027 & add init cpumasks

2016-03-28 Thread Gary S. Robertson
This patch series replaces the patches previously submitted with subjects:

ODP API: add control/worker cpumasks to init data -and-
linux-generic: add support for initial cpumasks

The addition of the ability for ODP to accept control and worker
cpumasks from external sources is impacted by the code for fixing
Linaro BUG 2027 .

Consequently I have added the BUG 2027 fix patches
to this API change as prerequisites.

The modifications presented here accomplish the following:
  (1) fix the validation and performance tests as needed in order to
  prevent hanging in barrier-wait due to deprecated means of
  determining the number of CPUs available for worker threads
  (2) replace the 'CPU affinity' based methods of determining the set
  of installed CPUs with logic which works regardless of the
  isolation / NO_HZ_FULL support in the underlying kernel
  (3) default to reasonable non-overlapping control and worker cpumasks
  conforming to suggestions from Petri S.
  (4) extend the ODP API to add control and worker cpumasks to the
  initialization data recognized by odp_init_global() -and-
  (5) allow externally specified control and/or worker cpumasks to
  safely override the default cpumask settings when
  odp_init_global() is called

API header descriptive comments have been modified per suggestions from
Petri S. and external specification of cpumasks containing uninstalled
CPUs now causes odp_init_global() to fail instead of silently ignoring
the uninstalled CPUs.

Additionally the linux-generic implementation code changes have been
refactored to be more consistent with the layout of existing code.
Specifically, the cpumask initialization logic has been moved from
odp_init.c into odp_cpumask.c so that only calls to the new functions
are added to odp_init.c, and the enhanced cpumask support is contained
in cpumask-related sources.

Gary S. Robertson (5):
  test: correct worker count calculation
  test: allow more than one control cpu
  linux-generic: Make cpu detection work with NO_HZ_FULL
  api: init: add control/worker cpumasks to init data
  linux-generic: add support for initial cpumasks

 include/odp/api/spec/init.h   |  27 +++
 platform/linux-generic/include/odp_internal.h |   7 +
 platform/linux-generic/odp_cpumask.c  | 275 ++
 platform/linux-generic/odp_cpumask_task.c |  70 ---
 platform/linux-generic/odp_init.c |   9 +-
 platform/linux-generic/odp_system_info.c  |  13 +-
 test/validation/cpumask/cpumask.c |   2 +-
 test/validation/shmem/shmem.c |   3 +-
 test/validation/timer/timer.c |  18 +-
 9 files changed, 376 insertions(+), 48 deletions(-)

-- 
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 PATCHv2 2/4] api: cpu: add routines for obtaining socket ids

2016-03-28 Thread Maxim Uvarov

Jerin,  do you thin that we need both?

Maxim.

On 03/24/16 14:10, Bill Fischofer wrote:
Thanks, Jerin.  So is an odp_cpu_socket_id() function not interesting 
to you and odp_pktio_socket_id() is what's wanted/needed?  Or are you 
saying we should have both?


On Thu, Mar 24, 2016 at 2:32 AM, Jerin Jacob 
> wrote:


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

I think you meant NUMA platform like ThunderX.

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

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

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

something like below in HW perspective.

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

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

Jerin

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




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


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


[lng-odp] [PATCH] example: packet: add odp_term_global

2016-03-28 Thread Maxim Uvarov
Add odp_term_global and comment that it will never
be called.
https://bugs.linaro.org/show_bug.cgi?id=1706

Signed-off-by: Maxim Uvarov 
---
 example/packet/odp_pktio.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index dd3e8e3..3e0fdf0 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -438,11 +438,18 @@ int main(int argc, char *argv[])
/* Master thread waits for other threads to exit */
odph_linux_pthread_join(thread_tbl, num_workers);
 
+   /* Application wait for crtl+c to be interrupted,
+   * code bellow is never reachable. Keep it in current
+   * example to  emphasize that final termination has to
+   * be with odp_term_global().
+   */
+
free(args->appl.if_names);
free(args->appl.if_str);
free(args);
-   printf("Exit\n\n");
 
+   odp_term_local();
+   odp_term_global();
return 0;
 }
 
-- 
2.7.1.250.gff4ea60

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


[lng-odp] [PATCH 2/2] linux-generic: system info: check return codes for sscanf

2016-03-28 Thread Maxim Uvarov
Check return codes for Coverity issues:
https://bugs.linaro.org/show_bug.cgi?id=2129

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/odp_system_info.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 395b274..0277c3b 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -66,7 +66,8 @@ static int systemcpu_cache_line_size(void)
 
if (fgets(str, sizeof(str), file) != NULL) {
/* Read cache line size */
-   sscanf(str, "%i", );
+   if (sscanf(str, "%i", ) != 1)
+   size = 0;
}
 
fclose(file);
@@ -99,7 +100,9 @@ static int huge_page_size(void)
 
while ((dirent = readdir(dir)) != NULL) {
int temp = 0;
-   sscanf(dirent->d_name, "hugepages-%i", );
+
+   if (sscanf(dirent->d_name, "hugepages-%i", ) != 1)
+   continue;
 
if (temp > size)
size = temp;
@@ -110,7 +113,7 @@ static int huge_page_size(void)
return 0;
}
 
-   return size*1024;
+   return size * 1024;
 }
 
 
-- 
2.7.1.250.gff4ea60

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


[lng-odp] [PATCH 1/2] checkpatch.pl: do not require kstrtoint

2016-03-28 Thread Maxim Uvarov
For one line sscanf checkpatch requires kernels kstrtoint
helper function. Comment this check out.

Signed-off-by: Maxim Uvarov 
---
 scripts/checkpatch.pl | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 16316b9..8882757 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5093,25 +5093,25 @@ sub process {
}
 
 # check for simple sscanf that should be kstrto
-   if ($^V && $^V ge 5.10.0 &&
-   defined $stat &&
-   $line =~ /\bsscanf\b/) {
-   my $lc = $stat =~ tr@\n@@;
-   $lc = $lc + $linenr;
-   my $stat_real = raw_line($linenr, 0);
-   for (my $count = $linenr + 1; $count <= $lc; $count++) {
-   $stat_real = $stat_real . "\n" . 
raw_line($count, 0);
-   }
-   if ($stat_real =~ 
/\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
-   my $format = $6;
-   my $count = $format =~ tr@%@%@;
-   if ($count == 1 &&
-   $format =~ 
/^"\%(?i:ll[udxi]|[udxi]ll|ll|[hl]h?[udxi]|[udxi][hl]h?|[hl]h?|[udxi])"$/) {
-   WARN("SSCANF_TO_KSTRTO",
-"Prefer kstrto to single 
variable sscanf\n" . "$here\n$stat_real\n");
-   }
-   }
-   }
+#  if ($^V && $^V ge 5.10.0 &&
+#  defined $stat &&
+#  $line =~ /\bsscanf\b/) {
+#  my $lc = $stat =~ tr@\n@@;
+#  $lc = $lc + $linenr;
+#  my $stat_real = raw_line($linenr, 0);
+#  for (my $count = $linenr + 1; $count <= $lc; $count++) {
+#  $stat_real = $stat_real . "\n" . 
raw_line($count, 0);
+#  }
+#  if ($stat_real =~ 
/\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
+#  my $format = $6;
+#  my $count = $format =~ tr@%@%@;
+#  if ($count == 1 &&
+#  $format =~ 
/^"\%(?i:ll[udxi]|[udxi]ll|ll|[hl]h?[udxi]|[udxi][hl]h?|[hl]h?|[udxi])"$/) {
+#  WARN("SSCANF_TO_KSTRTO",
+#   "Prefer kstrto to single 
variable sscanf\n" . "$here\n$stat_real\n");
+#  }
+#  }
+#  }
 
 # check for new externs in .h files.
if ($realfile =~ /\.h$/ &&
-- 
2.7.1.250.gff4ea60

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


Re: [lng-odp] [API-NEXT PATCHv2 4/4] validation: thread: add numa validation funciton tests

2016-03-28 Thread Mike Holmes
Ack

On 24 March 2016 at 18:06, Bill Fischofer  wrote:

> These tests were modeled after some of the other tests for CPU APIs which
> basically just confirm that an implementation for them exists.  Since ODP
> doesn't stipulate what these must return I'm not sure what more we can do.
> I suppose an identify test for odp_cpu_socket_id() ==
> odp_cpu_socket_id_cpu(odp_cpu_id()) would make sense, but I can't think of
> much beyond that.  Note that since linux-generic doesn't itself do anything
> with NUMA these routines are going to return ODP_SOCKET_ID_ANY.
>
> On Thu, Mar 24, 2016 at 1:36 PM, Mike Holmes 
> wrote:
>
>>
>>
>> On 23 March 2016 at 18:19, Bill Fischofer 
>> wrote:
>>
>>> Add basic touch tests for odp_cpu_socket_id() and odp_cpu_socket_id_cpu()
>>>
>>
>> Do we gain anything except loosing the reminder from LCOV that this needs
>> testing if we apply this patch, it does not look like it makes many
>> assertions on the behaviour it expects.
>>
>>
>>>
>>> Signed-off-by: Bill Fischofer 
>>> ---
>>>  test/validation/thread/thread.c | 14 ++
>>>  test/validation/thread/thread.h |  2 ++
>>>  2 files changed, 16 insertions(+)
>>>
>>> diff --git a/test/validation/thread/thread.c
>>> b/test/validation/thread/thread.c
>>> index 5cbec83..b70bc63 100644
>>> --- a/test/validation/thread/thread.c
>>> +++ b/test/validation/thread/thread.c
>>> @@ -20,6 +20,18 @@ void thread_test_odp_cpu_id(void)
>>> CU_PASS();
>>>  }
>>>
>>> +void thread_test_odp_cpu_socket_id(void)
>>> +{
>>> +   (void)odp_cpu_socket_id();
>>> +   CU_PASS();
>>> +}
>>> +
>>> +void thread_test_odp_cpu_socket_id_cpu(void)
>>> +{
>>> +   (void)odp_cpu_socket_id_cpu(odp_cpu_id());
>>> +   CU_PASS();
>>> +}
>>> +
>>>  void thread_test_odp_thread_id(void)
>>>  {
>>> (void)odp_thread_id();
>>> @@ -97,6 +109,8 @@ void thread_test_odp_thrmask_control(void)
>>>
>>>  odp_testinfo_t thread_suite[] = {
>>> ODP_TEST_INFO(thread_test_odp_cpu_id),
>>> +   ODP_TEST_INFO(thread_test_odp_cpu_socket_id),
>>> +   ODP_TEST_INFO(thread_test_odp_cpu_socket_id_cpu),
>>> ODP_TEST_INFO(thread_test_odp_thread_id),
>>> ODP_TEST_INFO(thread_test_odp_thread_count),
>>> ODP_TEST_INFO(thread_test_odp_thrmask_to_from_str),
>>> diff --git a/test/validation/thread/thread.h
>>> b/test/validation/thread/thread.h
>>> index f8ea710..8d24479 100644
>>> --- a/test/validation/thread/thread.h
>>> +++ b/test/validation/thread/thread.h
>>> @@ -16,6 +16,8 @@
>>>  #endif
>>>  #include "mask_common.h"
>>>  void thread_test_odp_cpu_id(void);
>>> +void thread_test_odp_cpu_socket_id(void);
>>> +void thread_test_odp_cpu_socket_id_cpu(void);
>>>  void thread_test_odp_thread_id(void);
>>>  void thread_test_odp_thread_count(void);
>>>  void thread_test_odp_thrmask_control(void);
>>> --
>>> 2.5.0
>>>
>>> ___
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>>
>>
>>
>>
>> --
>> Mike Holmes
>> Technical Manager - Linaro Networking Group
>> Linaro.org  *│ *Open source software for ARM SoCs
>> "Work should be fun and collaborative, the rest follows"
>>
>>
>>
>


-- 
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] linux-generic: traffic-manager: fix integer handling issue

2016-03-28 Thread Bill Fischofer
+1 on Maxim's suggested changes.

On Mon, Mar 28, 2016 at 9:37 AM, Maxim Uvarov 
wrote:

> On 03/28/16 08:28, Balasubramanian Manoharan wrote:
>
>> Fixes: https://bugs.linaro.org/show_bug.cgi?id=2122
>>
>> Signed-off-by: Balasubramanian Manoharan 
>> ---
>>   platform/linux-generic/odp_timer_wheel.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/platform/linux-generic/odp_timer_wheel.c
>> b/platform/linux-generic/odp_timer_wheel.c
>> index 638edf4..8b8ca87 100644
>> --- a/platform/linux-generic/odp_timer_wheel.c
>> +++ b/platform/linux-generic/odp_timer_wheel.c
>> @@ -167,7 +167,8 @@ static uint32_t _odp_internal_ilog2(uint64_t value)
>> uint32_t bit_shift;
>> for (bit_shift = 0; bit_shift < 64; bit_shift++) {
>> -   pwr_of_2 = 1 << bit_shift;
>> +   /* FIX: BUG2122 Coverity issue */
>> +   pwr_of_2 = (uint64_t)1 << bit_shift;
>>
> 1. I think comment has to be removed.
> 2. 1ULL << bit_shift  - isn't it better?
>
> Maxim.
>
>> if (value == pwr_of_2)
>> return bit_shift;
>> else if (value < pwr_of_2)
>>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] linux-generic: traffic-manager: fix integer handling issue

2016-03-28 Thread Maxim Uvarov

On 03/28/16 08:28, Balasubramanian Manoharan wrote:

Fixes: https://bugs.linaro.org/show_bug.cgi?id=2122

Signed-off-by: Balasubramanian Manoharan 
---
  platform/linux-generic/odp_timer_wheel.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_timer_wheel.c 
b/platform/linux-generic/odp_timer_wheel.c
index 638edf4..8b8ca87 100644
--- a/platform/linux-generic/odp_timer_wheel.c
+++ b/platform/linux-generic/odp_timer_wheel.c
@@ -167,7 +167,8 @@ static uint32_t _odp_internal_ilog2(uint64_t value)
uint32_t bit_shift;
  
  	for (bit_shift = 0; bit_shift < 64; bit_shift++) {

-   pwr_of_2 = 1 << bit_shift;
+   /* FIX: BUG2122 Coverity issue */
+   pwr_of_2 = (uint64_t)1 << bit_shift;

1. I think comment has to be removed.
2. 1ULL << bit_shift  - isn't it better?

Maxim.

if (value == pwr_of_2)
return bit_shift;
else if (value < pwr_of_2)


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


[lng-odp] [Bug 2058] odp_init_local user-doc does not describe the thread type

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2058

Maxim Uvarov  changed:

   What|Removed |Added

 CC||maxim.uva...@linaro.org

--- Comment #2 from Maxim Uvarov  ---
commit d9f682c894b503a87e7c24f2de1edf4e48b01f5d
Author: Bill Fischofer 
Date:   Wed Feb 24 18:11:32 2016 -0600

doc: userguide: add thread type description to odp_init_local() discussion

This addresses Bug https://bugs.linaro.org/show_bug.cgi?id=2058

Signed-off-by: Bill Fischofer 
Signed-off-by: Maxim Uvarov 

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] linux-generic: traffic-manager: fix integer handling issue

2016-03-28 Thread Bill Fischofer
On Mon, Mar 28, 2016 at 12:28 AM, Balasubramanian Manoharan <
bala.manoha...@linaro.org> wrote:

> Fixes: https://bugs.linaro.org/show_bug.cgi?id=2122
>
> Signed-off-by: Balasubramanian Manoharan 
>

Reviewed-by: Bill Fischofer 


> ---
>  platform/linux-generic/odp_timer_wheel.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/odp_timer_wheel.c
> b/platform/linux-generic/odp_timer_wheel.c
> index 638edf4..8b8ca87 100644
> --- a/platform/linux-generic/odp_timer_wheel.c
> +++ b/platform/linux-generic/odp_timer_wheel.c
> @@ -167,7 +167,8 @@ static uint32_t _odp_internal_ilog2(uint64_t value)
> uint32_t bit_shift;
>
> for (bit_shift = 0; bit_shift < 64; bit_shift++) {
> -   pwr_of_2 = 1 << bit_shift;
> +   /* FIX: BUG2122 Coverity issue */
> +   pwr_of_2 = (uint64_t)1 << bit_shift;
> if (value == pwr_of_2)
> return bit_shift;
> else if (value < pwr_of_2)
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv2] doc: userguide: add thread type description to odp_init_local() discussion

2016-03-28 Thread Maxim Uvarov

Looks good,
Merged!

Maxim.

On 03/26/16 22:49, Bill Fischofer wrote:
Ping.  Needs review and merge to resolve bug 
https://bugs.linaro.org/show_bug.cgi?id=2058


On Tue, Mar 1, 2016 at 2:38 PM, Mike Holmes > wrote:



On 1 March 2016 at 15:00, Bill Fischofer
> wrote:

I don't think so.  What would you change there?  It's an
overview and doesn't show parameters to any ODP API calls.


Ok


On Tue, Mar 1, 2016 at 1:55 PM, Mike Holmes
> wrote:

does the diagram need an update too ?


http://docs.opendataplane.org/master/linux-generic/output/users-guide.html#_initialization

It shows calling these apis.

On 24 February 2016 at 19:11, Bill Fischofer
> wrote:

This addresses Bug
https://bugs.linaro.org/show_bug.cgi?id=2058

Signed-off-by: Bill Fischofer
>
---
 doc/users-guide/users-guide.adoc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/users-guide/users-guide.adoc
b/doc/users-guide/users-guide.adoc
index bbb53a7..68e9de5 100644
--- a/doc/users-guide/users-guide.adoc
+++ b/doc/users-guide/users-guide.adoc
@@ -498,9 +498,10 @@ suitable for the ODP API.
 Calling odp_init_global() establishes the ODP API
framework and MUST be
 called before any other ODP API may be called. Note
that it is only called
 once per application. Following global
initialization, each thread in turn
-calls 'odp_init_local()' is called. This establishes
the local ODP thread
+calls 'odp_init_local()'. This establishes the local
ODP thread
 context for that thread and MUST be called before
other ODP APIs may be
-called by that thread.
+called by that thread. The sole argument to this call
is the _thread type_,
+which is either +ODP_THREAD_WORKER+ or
+ODP_THREAD_CONTROL+.

 === Shutdown
 Shutdown is the logical reverse of the initialization
procedure, with
--
2.5.0

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




-- 
Mike Holmes

Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source
software for ARM SoCs
"Work should be fun and collborative, the rest follows"





-- 
Mike Holmes

Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for
ARM SoCs
"Work should be fun and collborative, the rest follows"




___
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 5/6] api: pktio: add checksum offload options

2016-03-28 Thread Bill Fischofer
On Mon, Mar 28, 2016 at 5:25 AM, Bala Manoharan 
wrote:

>
>
> Regards,
> Bala
>
> On 24 March 2016 at 20:19, Petri Savolainen 
> wrote:
>
>> Added options for selecting IP/UDP/TCP/SCTP checksum offload on
>> packet input and output. Packets with input checksum failure are
>> either dropped or reported with packet_has_l3/l4_error flags.
>>
>> Signed-off-by: Petri Savolainen 
>> ---
>>  include/odp/api/spec/packet_io.h | 66
>> +++-
>>  1 file changed, 65 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/odp/api/spec/packet_io.h
>> b/include/odp/api/spec/packet_io.h
>> index 767a1b2..f9df7c3 100644
>> --- a/include/odp/api/spec/packet_io.h
>> +++ b/include/odp/api/spec/packet_io.h
>> @@ -246,7 +246,9 @@ typedef struct odp_pktio_param_t {
>>  /**
>>   * Packet input configuration options bit field
>>   *
>> - * Packet input configuration options listed in a bit field structure.
>> + * Packet input configuration options listed in a bit field structure.
>> Depending
>> + * on configuration erroneous packets are either dropped or marked with
>> error
>> + * flags (see e.g. odp_packet_has_error() and odp_packet_has_l3_error()).
>>   */
>>  typedef union odp_pktin_config_opt_t {
>> /** Option flags */
>> @@ -257,6 +259,34 @@ typedef union odp_pktin_config_opt_t {
>> /** Timestamp (at least) IEEE1588 / PTP packets
>>   * on packet input */
>> uint64_t ts_ptp: 1;
>> +
>> +   /** Check IPv4 header checksum on packet input */
>> +   uint64_t ipv4_chksum   : 1;
>> +
>> +   /** Check UDP checksum on packet input */
>> +   uint64_t udp_chksum: 1;
>> +
>> +   /** Check TCP checksum on packet input */
>> +   uint64_t tcp_chksum: 1;
>> +
>> +   /** Check SCTP checksum on packet input */
>> +   uint64_t sctp_chksum   : 1;
>> +
>> +   /** Drop packets with an IPv4 error on packet input */
>> +   uint64_t drop_ipv4_err : 1;
>> +
>> +   /** Drop packets with an IPv6 error on packet input */
>> +   uint64_t drop_ipv6_err : 1;
>> +
>> +   /** Drop packets with a UDP error on packet input */
>> +   uint64_t drop_udp_err  : 1;
>> +
>> +   /** Drop packets with a TCP error on packet input */
>> +   uint64_t drop_tcp_err  : 1;
>> +
>> +   /** Drop packets with a SCTP error on packet input */
>> +   uint64_t drop_sctp_err : 1;
>> +
>>
>
> We have an existing mechanism in classifier where the application can
> configure an error CoS so that the packets with error are sent to
> Error_CoS. So do we really need this mechanism at the interface level to
> drop packets with error.
>
> } bit;
>>
>> /** All bits of the bit field structure
>> @@ -267,6 +297,35 @@ typedef union odp_pktin_config_opt_t {
>>  } odp_pktin_config_opt_t;
>>
>>  /**
>> + * Packet output configuration options bit field
>> + *
>> + * Packet output configuration options listed in a bit field structure.
>> + */
>> +typedef union odp_pktout_config_opt_t {
>> +   /** Option flags */
>> +   struct {
>> +   /** Insert IPv4 header checksum on packet output */
>> +   uint64_t ipv4_chksum  : 1;
>> +
>> +   /** Insert UDP checksum on packet output */
>> +   uint64_t udp_chksum   : 1;
>> +
>> +   /** Insert TCP checksum on packet output */
>> +   uint64_t tcp_chksum   : 1;
>> +
>> +   /** Insert SCTP checksum on packet output */
>> +   uint64_t sctp_chksum  : 1;
>> +
>> +   } bit;
>>
>
> IMO, since L3/L4 checksum calculation is a per packet operation it might
> be better to add this in packet meta data so that if the application does
> not modify the packet then there is no need to re-calculate the L3/L4
> checksum. Hence if an application modifies a particular packet it can set
> the checksum calculation bit on that packet and the implementation will
> calculate and insert checksum for the specific packet before transmission.
> By having this as a per-packet parameter there is no need to calculate
> checksum for all packets in the interface.
>

That's a good point.  But I don't view these as exclusive.  It makes sense
to enable/disable checksum offload at the interface level and then provide
override capabilities on a per-packet basis so that only exceptional
packets need additional attributes.



> +
>> +   /** All bits of the bit field structure
>> + *
>> + * This field can be used to set/clear all flags, or bitwise
>> + * operations over the entire structure. */
>> +   uint64_t all_bits;
>> +} odp_pktout_config_opt_t;
>> +
>> +/**
>>   * Packet IO configuration options
>>   *
>>   * Packet IO interface level 

Re: [lng-odp] [PATCH] test:performance:add break statement to switch(opt)

2016-03-28 Thread Maxim Uvarov

Merged,
Maxim.

On 03/25/16 20:14, Bill Fischofer wrote:



On Fri, Mar 25, 2016 at 11:49 AM, Balakrishna Garapati 
> wrote:


Signed-off-by: Balakrishna Garapati
>


Reviewed-by: Bill Fischofer >


---
 v1:Fixes missing break between switch(opt)
https://bugs.linaro.org/show_bug.cgi?id=2137

 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 5fd339d..54f5046 100644
--- a/test/performance/odp_crypto.c
+++ b/test/performance/odp_crypto.c
@@ -858,6 +858,7 @@ static void parse_args(int argc, char *argv[],
crypto_args_t *cargs)
usage(argv[0]);
exit(-1);
}
+   break;
case 'd':
cargs->debug_packets = 1;
break;
--
1.9.1

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




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


[lng-odp] [Bug 2146] CID 159395: Security best practices violations: shmem_linux.c

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2146

Mike Holmes  changed:

   What|Removed |Added

   Assignee|lng-odp@lists.linaro.org|christophe.mil...@linaro.or
   ||g

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 2147] CID 159394: Resource leaks: shmem_odp.c

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2147

Mike Holmes  changed:

   What|Removed |Added

   Assignee|lng-odp@lists.linaro.org|christophe.mil...@linaro.or
   ||g

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 2148] CID 159393: Error handling issues: shmem_linux.c

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2148

Mike Holmes  changed:

   What|Removed |Added

Summary|CID 159393:  Error handling |CID 159393:  Error handling
   |issues  |issues: shmem_linux.c
   Assignee|lng-odp@lists.linaro.org|christophe.mil...@linaro.or
   ||g

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 2149] New: CID 159392: Memory - illegal accesses

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2149

Bug ID: 2149
   Summary: CID 159392:  Memory - illegal accesses
   Product: OpenDataPlane - linux- generic reference
   Version: 1.8
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: General ODP
  Assignee: lng-odp@lists.linaro.org
  Reporter: mike.hol...@linaro.org

/platform/linux-generic/test/shmem/shmem_linux.c: 103 in main()
97  int fifo_fd;
98  char shm_devname[PATH_MAX];/* shared mem device name, under /dev/shm */
99  int shm_fd;
100 test_shared_linux_data_t *addr;
101
102 /* odp app is in the same directory as this file: */
>>> CID 159392:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
>>> Calling strncpy with a maximum size argument of 4096 bytes on 
>>> destination array "prg_name" of size 4096 bytes might leave the destination 
>>> string unterminated.
103 strncpy(prg_name, argv[0], PATH_MAX);
104 sprintf(odp_name, "%s/%s", dirname(prg_name), ODP_APP_NAME);
105
106 /* start the ODP application: */
107 odp_app = fork();
108 if (odp_app < 0)  /* error */

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 2148] New: CID 159393: Error handling issues

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2148

Bug ID: 2148
   Summary: CID 159393:  Error handling issues
   Product: OpenDataPlane - linux- generic reference
   Version: 1.8
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: General ODP
  Assignee: lng-odp@lists.linaro.org
  Reporter: mike.hol...@linaro.org

/platform/linux-generic/test/shmem/shmem_odp.c: 50 in shmem_test_odp_shm_proc()
44  CU_ASSERT_FATAL(mkfifo(fifo_name, 0666) == 0);
45
46  /* read from the fifo: the linux process result: */
47  fd = open(fifo_name, O_RDONLY);
48  CU_ASSERT_FATAL(fd >= 0);
49
>>> CID 159393:  Error handling issues  (NEGATIVE_RETURNS)
>>> "fd" is passed to a parameter that cannot be negative.
50  CU_ASSERT(read(fd, _result, sizeof(char)) == 1);
51  CU_ASSERT_FATAL(test_result == TEST_SUCCESS);
52
53  CU_ASSERT(odp_shm_free(shm) == 0);
54 }
55

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 2146] New: CID 159395: Security best practices violations: shmem_linux.c

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2146

Bug ID: 2146
   Summary: CID 159395:  Security best practices violations:
shmem_linux.c
   Product: OpenDataPlane - linux- generic reference
   Version: 1.8
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: General ODP
  Assignee: lng-odp@lists.linaro.org
  Reporter: mike.hol...@linaro.org

/platform/linux-generic/test/shmem/shmem_linux.c: 123 in main()
117 sprintf(fifo_name, FIFO_NAME_FMT, odp_app);
118 while (access(fifo_name, W_OK) != 0) {
119 sleep(1);
120 if  (nb_sec++ == 30)
121 exit(1);
122 }
>>> CID 159395:  Security best practices violations  (TOCTOU)
>>> Calling function "open" that uses "fifo_name" after a check function. 
>>> This can cause a time-of-check, time-of-use race condition.
123 fifo_fd = open(fifo_name, O_WRONLY);
124 printf("pipe found\n");
125
126 /* the linux named pipe has now been found, meaning that the
127  * ODP application is up and running, and has allocated shmem.
128  * check to see if linux can see the created shared memory: */

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 2147] New: CID 159394: Resource leaks: shmem_odp.c

2016-03-28 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=2147

Bug ID: 2147
   Summary: CID 159394:  Resource leaks: shmem_odp.c
   Product: OpenDataPlane - linux- generic reference
   Version: 1.8
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: General ODP
  Assignee: lng-odp@lists.linaro.org
  Reporter: mike.hol...@linaro.org

/platform/linux-generic/test/shmem/shmem_odp.c: 54 in shmem_test_odp_shm_proc()
48  CU_ASSERT_FATAL(fd >= 0);
49
50  CU_ASSERT(read(fd, _result, sizeof(char)) == 1);
51  CU_ASSERT_FATAL(test_result == TEST_SUCCESS);
52
53  CU_ASSERT(odp_shm_free(shm) == 0);
>>> CID 159394:  Resource leaks  (RESOURCE_LEAK)
>>> Handle variable "fd" going out of scope leaks the handle.
54 }
55
56 odp_testinfo_t shmem_suite[] = {
57  ODP_TEST_INFO(shmem_test_odp_shm_proc),
58  ODP_TEST_INFO_NULL,
59 };

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH 5/6] api: pktio: add checksum offload options

2016-03-28 Thread Bala Manoharan
Regards,
Bala

On 24 March 2016 at 20:19, Petri Savolainen 
wrote:

> Added options for selecting IP/UDP/TCP/SCTP checksum offload on
> packet input and output. Packets with input checksum failure are
> either dropped or reported with packet_has_l3/l4_error flags.
>
> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/spec/packet_io.h | 66
> +++-
>  1 file changed, 65 insertions(+), 1 deletion(-)
>
> diff --git a/include/odp/api/spec/packet_io.h
> b/include/odp/api/spec/packet_io.h
> index 767a1b2..f9df7c3 100644
> --- a/include/odp/api/spec/packet_io.h
> +++ b/include/odp/api/spec/packet_io.h
> @@ -246,7 +246,9 @@ typedef struct odp_pktio_param_t {
>  /**
>   * Packet input configuration options bit field
>   *
> - * Packet input configuration options listed in a bit field structure.
> + * Packet input configuration options listed in a bit field structure.
> Depending
> + * on configuration erroneous packets are either dropped or marked with
> error
> + * flags (see e.g. odp_packet_has_error() and odp_packet_has_l3_error()).
>   */
>  typedef union odp_pktin_config_opt_t {
> /** Option flags */
> @@ -257,6 +259,34 @@ typedef union odp_pktin_config_opt_t {
> /** Timestamp (at least) IEEE1588 / PTP packets
>   * on packet input */
> uint64_t ts_ptp: 1;
> +
> +   /** Check IPv4 header checksum on packet input */
> +   uint64_t ipv4_chksum   : 1;
> +
> +   /** Check UDP checksum on packet input */
> +   uint64_t udp_chksum: 1;
> +
> +   /** Check TCP checksum on packet input */
> +   uint64_t tcp_chksum: 1;
> +
> +   /** Check SCTP checksum on packet input */
> +   uint64_t sctp_chksum   : 1;
> +
> +   /** Drop packets with an IPv4 error on packet input */
> +   uint64_t drop_ipv4_err : 1;
> +
> +   /** Drop packets with an IPv6 error on packet input */
> +   uint64_t drop_ipv6_err : 1;
> +
> +   /** Drop packets with a UDP error on packet input */
> +   uint64_t drop_udp_err  : 1;
> +
> +   /** Drop packets with a TCP error on packet input */
> +   uint64_t drop_tcp_err  : 1;
> +
> +   /** Drop packets with a SCTP error on packet input */
> +   uint64_t drop_sctp_err : 1;
> +
>

We have an existing mechanism in classifier where the application can
configure an error CoS so that the packets with error are sent to
Error_CoS. So do we really need this mechanism at the interface level to
drop packets with error.

} bit;
>
> /** All bits of the bit field structure
> @@ -267,6 +297,35 @@ typedef union odp_pktin_config_opt_t {
>  } odp_pktin_config_opt_t;
>
>  /**
> + * Packet output configuration options bit field
> + *
> + * Packet output configuration options listed in a bit field structure.
> + */
> +typedef union odp_pktout_config_opt_t {
> +   /** Option flags */
> +   struct {
> +   /** Insert IPv4 header checksum on packet output */
> +   uint64_t ipv4_chksum  : 1;
> +
> +   /** Insert UDP checksum on packet output */
> +   uint64_t udp_chksum   : 1;
> +
> +   /** Insert TCP checksum on packet output */
> +   uint64_t tcp_chksum   : 1;
> +
> +   /** Insert SCTP checksum on packet output */
> +   uint64_t sctp_chksum  : 1;
> +
> +   } bit;
>

IMO, since L3/L4 checksum calculation is a per packet operation it might be
better to add this in packet meta data so that if the application does not
modify the packet then there is no need to re-calculate the L3/L4 checksum.
Hence if an application modifies a particular packet it can set the
checksum calculation bit on that packet and the implementation will
calculate and insert checksum for the specific packet before transmission.
By having this as a per-packet parameter there is no need to calculate
checksum for all packets in the interface.

> +
> +   /** All bits of the bit field structure
> + *
> + * This field can be used to set/clear all flags, or bitwise
> + * operations over the entire structure. */
> +   uint64_t all_bits;
> +} odp_pktout_config_opt_t;
> +
> +/**
>   * Packet IO configuration options
>   *
>   * Packet IO interface level configuration options. Use
> odp_pktio_capability()
> @@ -279,6 +338,11 @@ typedef struct odp_pktio_config_t {
>  *  Default value for all bits is zero. */
> odp_pktin_config_opt_t pktin;
>
> +   /** Packet output configuration options bit field
> +*
> +*  Default value for all bits is zero. */
> +   odp_pktout_config_opt_t pktout;
> +
>  } odp_pktio_config_t;
>
>  /**
> --
> 2.7.2
>
> ___
> lng-odp mailing 

Re: [lng-odp] [API-NEXT PATCH 4/6] api: pktio: add classifier enable pktin_queue_param

2016-03-28 Thread Bala Manoharan
On 24 March 2016 at 20:19, Petri Savolainen 
wrote:

> Added explicit classifier enable option for pktin event
> queues. Hashing and classification cannot be enabled at the
> same time. Pktin_queue_config may create target queues for
> classification or application may create those later.
>
> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/spec/packet_io.h | 40
> ++--
>  1 file changed, 30 insertions(+), 10 deletions(-)
>
> diff --git a/include/odp/api/spec/packet_io.h
> b/include/odp/api/spec/packet_io.h
> index 6af1ebb..767a1b2 100644
> --- a/include/odp/api/spec/packet_io.h
> +++ b/include/odp/api/spec/packet_io.h
> @@ -161,25 +161,45 @@ typedef struct odp_pktin_queue_param_t {
>   * applicable. */
> odp_pktio_op_mode_t op_mode;
>
> +   /** Enable classifier
> + *
> + * * 0: Classifier is disabled (default)
> + * * 1: Classifier is enabled. Use classifier instead of flow
> hashing
> + *  to direct incoming packets into pktin event queues.
> Classifier
> + *  can be enabled only in ODP_PKTIN_MODE_SCHED and
> + *  ODP_PKTIN_MODE_QUEUE modes. */
> +   odp_bool_t classifier_enable;
> +
> /** Enable flow hashing
> - * 0: Do not hash flows
> - * 1: Hash flows to input queues */
> + *
> + * * 0: Do not hash flows (default)
> + * * 1: Enable flow hashing. Use flow hashing instead of
> classifier to
> + *  spread incoming packets into input queues. Hashing can be
> + *  enabled in all modes. */
> odp_bool_t hash_enable;
>

IMO, a short description can be added stating that both 'hash_enable' and
'classifier_enable' can NOT be true at the same time and that only one of
the two values can be true.

Regards,
Bala

>
> -   /** Protocol field selection for hashing. Multiple protocols can be
> - * selected. */
> +   /** Protocol field selection for hashing
> + *
> + * Multiple protocols can be selected. Ignored when 'hash_enable'
> is
> + * zero. The default value is all bits zero. */
> odp_pktin_hash_proto_t hash_proto;
>
> -   /** Number of input queues to be created. More than one input queue
> - * require input hashing or classifier setup. Hash_proto is
> ignored
> - * when hash_enable is zero or num_queues is one. This value must
> be
> - * between 1 and interface capability. Queue type is defined by
> the
> +   /** Number of input queues to be created
> + *
> + * When classifier is enabled the number of queues may be zero
> + * (in odp_pktin_queue_config() step), otherwise at least one
> + * queue is required. More than one input queues require either
> flow
> + * hashing or classifier enabled. The maximum value is defined by
> + * pktio capability 'max_input_queues'. Queue type is defined by
> the
>   * input mode. The default value is 1. */
> unsigned num_queues;
>
> -   /** Queue parameters for creating input queues in
> ODP_PKTIN_MODE_QUEUE
> +   /** Queue parameters
> + *
> + * These are used for input queue creation in ODP_PKTIN_MODE_QUEUE
>   * or ODP_PKTIN_MODE_SCHED modes. Scheduler parameters are
> considered
> - * only in ODP_PKTIN_MODE_SCHED mode. */
> + * only in ODP_PKTIN_MODE_SCHED mode. Default values are defined
> in
> + * odp_queue_param_t documentation. */
> odp_queue_param_t queue_param;
>
>  } odp_pktin_queue_param_t;
> --
> 2.7.2
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] linux-generic: tm: reduce byte range to prevent array overflow

2016-03-28 Thread Maxim Uvarov

Merged,
Maxim.

On 03/28/16 10:58, Bala Manoharan wrote:
Reviewed-by: Balasubramanian Manoharan >


Regards,
Bala

On 27 March 2016 at 01:57, Bill Fischofer > wrote:


Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2120 by reducing
the random array guard by one to ensure that at least two bytes of
random
data remain before accessing them.

Signed-off-by: Bill Fischofer >
---
 platform/linux-generic/odp_traffic_mngr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_traffic_mngr.c
b/platform/linux-generic/odp_traffic_mngr.c
index 99dc020..08e83c1 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -154,7 +154,7 @@ static uint16_t tm_random16(tm_random_data_t
*tm_random_data)
uint32_t buf_idx;
uint16_t rand8a, rand8b;

-   if (256 <= tm_random_data->next_random_byte)
+   if (255 <= tm_random_data->next_random_byte)
tm_init_random_data(tm_random_data);

/* Collect 2 random bytes and return them. Endianness does
NOT matter
--
2.5.0

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




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


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


Re: [lng-odp] [PATCH] linux-generic: tm: reduce byte range to prevent array overflow

2016-03-28 Thread Bala Manoharan
Reviewed-by: Balasubramanian Manoharan 

Regards,
Bala

On 27 March 2016 at 01:57, Bill Fischofer  wrote:

> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2120 by reducing
> the random array guard by one to ensure that at least two bytes of random
> data remain before accessing them.
>
> Signed-off-by: Bill Fischofer 
> ---
>  platform/linux-generic/odp_traffic_mngr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/odp_traffic_mngr.c
> b/platform/linux-generic/odp_traffic_mngr.c
> index 99dc020..08e83c1 100644
> --- a/platform/linux-generic/odp_traffic_mngr.c
> +++ b/platform/linux-generic/odp_traffic_mngr.c
> @@ -154,7 +154,7 @@ static uint16_t tm_random16(tm_random_data_t
> *tm_random_data)
> uint32_t buf_idx;
> uint16_t rand8a, rand8b;
>
> -   if (256 <= tm_random_data->next_random_byte)
> +   if (255 <= tm_random_data->next_random_byte)
> tm_init_random_data(tm_random_data);
>
> /* Collect 2 random bytes and return them.  Endianness does NOT
> matter
> --
> 2.5.0
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp