Re: [lng-odp] [PATCH v2] test: l2fwd: fill correct source ethernet address

2015-09-18 Thread Savolainen, Petri (Nokia - FI/Espoo)
Reviewed-by: Petri Savolainen 

> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> EXT Matias Elo
> Sent: Thursday, September 17, 2015 11:27 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH v2] test: l2fwd: fill correct source ethernet
> address
> 
> When running l2fwd in a VM using SR-IOV the host may drop
> packets if the source MAC address is not the same as that
> of the VF NIC. Modify test application so that the source
> MAC address is always filled correctly.
> 
> Signed-off-by: Matias Elo 
> ---
> 
> V2: Compare odp_pktio_mac_addr() return value to ODPH_ETHADDR_LEN
> 
>  test/performance/odp_l2fwd.c | 74 +++-
> 
>  1 file changed, 59 insertions(+), 15 deletions(-)
> 
> diff --git a/test/performance/odp_l2fwd.c
> b/test/performance/odp_l2fwd.c
> index 64fc1b2..cb31544 100644
> --- a/test/performance/odp_l2fwd.c
> +++ b/test/performance/odp_l2fwd.c
> @@ -105,6 +105,10 @@ typedef struct {
>   thread_args_t thread[MAX_WORKERS];
>   /** Table of pktio handles */
>   odp_pktio_t pktios[ODP_CONFIG_PKTIO_ENTRIES];
> + /** Table of port ethernet addresses */
> + odph_ethaddr_t port_eth_addr[ODP_CONFIG_PKTIO_ENTRIES];
> + /** Table of port default output queues */
> + odp_queue_t outq_def[ODP_CONFIG_PKTIO_ENTRIES];
>  } args_t;
> 
>  /** Global pointer to args */
> @@ -113,8 +117,10 @@ static args_t *gbl_args;
>  static odp_barrier_t barrier;
> 
>  /* helper funcs */
> -static inline odp_queue_t lookup_dest_q(odp_packet_t pkt);
> +static inline int lookup_dest_port(odp_packet_t pkt);
>  static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len);
> +static void fill_src_eth_addrs(odp_packet_t pkt_tbl[], unsigned num,
> +int dst_port);
>  static void parse_args(int argc, char *argv[], appl_args_t
> *appl_args);
>  static void print_info(char *progname, appl_args_t *appl_args);
>  static void usage(char *progname);
> @@ -126,7 +132,7 @@ static void usage(char *progname);
>   */
>  static void *pktio_queue_thread(void *arg)
>  {
> - int thr;
> + int thr, dst_port;
>   odp_queue_t outq_def;
>   odp_packet_t pkt;
>   odp_event_t ev;
> @@ -152,9 +158,12 @@ static void *pktio_queue_thread(void *arg)
>   continue;
>   }
> 
> - outq_def = lookup_dest_q(pkt);
> + dst_port = lookup_dest_port(pkt);
> +
> + fill_src_eth_addrs(, 1, dst_port);
> 
>   /* Enqueue the packet for output */
> + outq_def = gbl_args->outq_def[dst_port];
>   if (odp_queue_enq(outq_def, ev)) {
>   printf("  [%i] Queue enqueue failed.\n", thr);
>   odp_packet_free(pkt);
> @@ -169,12 +178,12 @@ static void *pktio_queue_thread(void *arg)
>  }
> 
>  /**
> - * Lookup the destination pktio for a given packet
> + * Lookup the destination port for a given packet
>   */
> -static inline odp_queue_t lookup_dest_q(odp_packet_t pkt)
> +static inline int lookup_dest_port(odp_packet_t pkt)
>  {
> - int i, src_idx, dst_idx;
> - odp_pktio_t pktio_src, pktio_dst;
> + int i, src_idx;
> + odp_pktio_t pktio_src;
> 
>   pktio_src = odp_packet_input(pkt);
> 
> @@ -185,10 +194,7 @@ static inline odp_queue_t
> lookup_dest_q(odp_packet_t pkt)
>   if (src_idx == -1)
>   LOG_ABORT("Failed to determine pktio input\n");
> 
> - dst_idx = (src_idx % 2 == 0) ? src_idx+1 : src_idx-1;
> - pktio_dst = gbl_args->pktios[dst_idx];
> -
> - return odp_pktio_outq_getdef(pktio_dst);
> + return (src_idx % 2 == 0) ? src_idx + 1 : src_idx - 1;
>  }
> 
>  /**
> @@ -233,6 +239,8 @@ static void *pktio_ifburst_thread(void *arg)
>   /* Drop packets with errors */
>   pkts_ok = drop_err_pkts(pkt_tbl, pkts);
>   if (pkts_ok > 0) {
> + fill_src_eth_addrs(pkt_tbl, pkts_ok, dst_idx);
> +
>   int sent = odp_pktio_send(pktio_dst, pkt_tbl,
> pkts_ok);
> 
>   sent = sent > 0 ? sent : 0;
> @@ -380,6 +388,7 @@ int main(int argc, char *argv[])
>   odp_shm_t shm;
>   odp_cpumask_t cpumask;
>   char cpumaskstr[ODP_CPUMASK_STR_SIZE];
> + odp_pktio_t pktio;
>   odp_pool_param_t params;
>   int ret;
> 
> @@ -452,12 +461,24 @@ int main(int argc, char *argv[])
>   odp_pool_print(pool);
> 
>   for (i = 0; i < gbl_args->appl.if_count; ++i) {
> - gbl_args->pktios[i] = create_pktio(gbl_args-
> >appl.if_names[i],
> -pool, gbl_args->appl.mode);
> - if (gbl_args->pktios[i] == ODP_PKTIO_INVALID)
> + pktio = create_pktio(gbl_args->appl.if_names[i],
> +  pool, gbl_args->appl.mode);
> + if (pktio == ODP_PKTIO_INVALID)
>   

Re: [lng-odp] [API NEXT PATCH v6 00/14] api: sysinfo: CPU frequency API clean up

2015-09-18 Thread Maxim Uvarov

Hello Hongbo,

can you please update patch series for top of api-next?

Check arm compilation:

odp_system_info.c:193:41: error: unused parameter 'id' 
[-Werror=unused-parameter]

 static uint64_t arch_cpu_hz_current(int id)


And x86 with all tests turned on:
./configure  --enable-test-vald  --enable-test-perf --enable-test-cpp  
--enable-debug CFLAGS="-O0 -g" --enable-debug --enable-debug-print


odp_scheduling.c:749:2: error: implicit declaration of function 
‘odp_sys_cpu_hz’ [-Werror=implicit-function-declaration]


Thanks,
Maxim.


On 09/17/15 16:50, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Reviewed-by: Petri Savolainen 



-Original Message-
From: EXT hongbo.zh...@freescale.com
[mailto:hongbo.zh...@freescale.com]
Sent: Thursday, September 17, 2015 4:10 PM
To: lng-odp@lists.linaro.org
Cc: mike.hol...@linaro.org; stuart.has...@arm.com; Savolainen, Petri
(Nokia - FI/Espoo); petri.savolai...@linaro.org;
ivan.khoronz...@linaro.org; Hongbo Zhang
Subject: [API NEXT PATCH v6 00/14] api: sysinfo: CPU frequency API
clean up

From: Hongbo Zhang 

v5 -> v6 changes:
- update tag in title to be more accurate
- merge patches in case of compile error, eg changing apis and updating
calling function come in one patch

v4 -> v5 changes:
- most obvious change is split some patches into even smaller patches
and re-arange the sequency for convenience of review
- change odp_cpu_id_*() to odp_cpu_*_id()

v3 -> v4 changes:
- rebase to latest odp version
- add odp_cpumask_available() to iterate each cpu

v2 -> v3 changes:
- move all CPU related API declaration into cpu.h
- refine tests for per-CPU APIs
- revise API for getting current frequency

v1 -> v2 changes:
- separate original 1/3 patch to two
- add validation patch to test new APIs
- other minor updates upon review comments

v1 notes:
The current API of getting CPU frequency is really ambiguous.
CPU has its max frequency, and if enabled, the current frequency may be
scaled from time to time, what's more, on some AMP platforms, cores are
heterogenous, they have different max and current frequencies.

This patch set cleans up these above issues.
Patch 1/3 makes cpu_hz and model_str to be per-CPU data, then on AMP
system, it is possible to acquire data for each different CPU.
Patch 2/3 makes it clear that the cpu_hz stands for max CPU frequency
Patch 3/3 adds new API to get the current CPU frequency if needed.

Due to lack of test platform, only x86 platform is implemented right
now,
the others should follow up if this patch set is accepted.

Hongbo Zhang (14):
   linux-generic: sysinfo: make the model_str per-CPU data
   linux-generic: sysinfo: make the cpu_hz per-CPU data
   api: sysinfo: move CPU model API to cpu.h
   api: sysinfo: move CPU Hz API to cpu.h
   api: cpu: add new API to get per-CPU model string
   api: cpu: add new API to get CPU max frequency
   api: cpu: add new API to get per-CPU max frequency
   linux-generic: sysinfo: revise odp_cpu_hz() to return current
 frequency
   api: cpu: add new API to get per-CPU current frequency
   api: cpumask: add new API odp_cpumask_all_available()
   validation: system: add validation for new CPU APIs
   example: update CPU Hz calling functions
   linux-generic: update CPU Hz calling functions
   test: update CPU Hz calling functions

  example/classifier/odp_classifier.c|   4 +-
  example/generator/odp_generator.c  |   2 +-
  example/ipsec/odp_ipsec.c  |   2 +-
  example/packet/odp_pktio.c |   2 +-
  example/timer/odp_timer_test.c |   6 +-
  include/odp/api/cpu.h  |  60 +
  include/odp/api/cpumask.h  |  10 ++
  include/odp/api/system_info.h  |  14 ---
  .../linux-generic/arch/linux/odp_time_cycles.c |   2 +-
  platform/linux-generic/include/odp_internal.h  |   6 +-
  platform/linux-generic/odp_cpumask_task.c  |  11 ++
  platform/linux-generic/odp_system_info.c   | 136
-
  platform/linux-generic/odp_time.c  |   4 +-
  test/api_test/odp_common.c |   4 +-
  test/performance/odp_atomic.c  |   4 +-
  test/performance/odp_l2fwd.c   |   2 +-
  test/performance/odp_scheduling.c  |   4 +-
  test/validation/system/system.c|  74 ++-
  test/validation/system/system.h|   8 +-
  19 files changed, 281 insertions(+), 74 deletions(-)

--
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 v3 0/5] preparation series before updating odp time API

2015-09-18 Thread Maxim Uvarov

Merged,
Maxim.

On 09/17/15 16:44, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Reviewed-by: Petri Savolainen 

Previously I checked all patches and found only the issue in patch 5/5, which 
is now fixed. There's no comments about v3, but I guess that's the only change.




-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
EXT Ivan Khoronzhuk
Sent: Thursday, September 17, 2015 11:31 AM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [PATCH v3 0/5] preparation series before updating
odp time API

This series contains corrections/fixes and is required before
changing time API.

V2:
https://lists.linaro.org/pipermail/lng-odp/2015-September/015355.html

Since v2:
   example: ipsec: avoid mixing of scheduler wait time and time API time
 - use time instead of wall time in commint msg
   linux-generic: odp_time: reutrn 0 if t2 = t1 for diff
 - corrected commit msg
   performance: odp_pktio_perf: fix potential overflow for burst_gap
 - swap burst_gap_cycles and cur_cycles in diff at init

Since v1:
   "example: timer: print timer ticks/ns table instead of cycles/ns"
 - included as new patch

Based on master.

CC:
stuart.has...@linaro.org
ola.liljed...@linaro.org
petri.savolai...@nokia.com

Ivan Khoronzhuk (5):
   example: timer: print timer ticks/ns table instead of cycles/ns
   example: ipsec: avoid mixing of scheduler wait time and time API time
   linux-generic: odp_time: reutrn 0 if t2 = t1 for diff
   performance: odp_pktio_perf: fix potential overflow for send_duration
   performance: odp_pktio_perf: fix potential overflow for burst_gap

  example/ipsec/odp_ipsec.c | 57 ++-

  example/timer/odp_timer_test.c| 22 +++
  platform/linux-generic/odp_time.c |  2 +-
  test/performance/odp_pktio_perf.c | 16 +--
  4 files changed, 40 insertions(+), 57 deletions(-)

--
1.9.1

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

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


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


[lng-odp] [PATCH] linux-generic: pktio: enable classifier only when needed

2015-09-18 Thread Petri Savolainen
Skip packet_classifier function as long as there's no pmr
set for an pktio interface.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/include/odp_packet_io_internal.h | 10 ++
 platform/linux-generic/odp_classification.c |  2 ++
 platform/linux-generic/odp_packet_io.c  |  6 ++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index a21c683..6b03051 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -109,6 +109,16 @@ static inline pktio_entry_t *get_pktio_entry(odp_pktio_t 
pktio)
return pktio_entry_ptr[pktio_to_id(pktio)];
 }
 
+static inline int pktio_cls_enabled(pktio_entry_t *entry)
+{
+   return entry->s.cls_enabled;
+}
+
+static inline void pktio_cls_enabled_set(pktio_entry_t *entry, int ena)
+{
+   entry->s.cls_enabled = ena;
+}
+
 int pktin_poll(pktio_entry_t *entry);
 
 extern const pktio_if_ops_t sock_mmsg_pktio_ops;
diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index 6c1aff4..7809a42 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -488,6 +488,7 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
pktio_entry->s.cls.pmr[num_pmr] = pmr;
pktio_entry->s.cls.cos[num_pmr] = cos;
pktio_entry->s.cls.num_pmr++;
+   pktio_cls_enabled_set(pktio_entry, 1);
UNLOCK(_entry->s.cls.lock);
 
return 0;
@@ -625,6 +626,7 @@ int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, 
odp_pktio_t src_pktio,
pktio_entry->s.cls.pmr[num_pmr] = pmr;
pktio_entry->s.cls.cos[num_pmr] = cos;
pktio_entry->s.cls.num_pmr++;
+   pktio_cls_enabled_set(pktio_entry, 1);
UNLOCK(_entry->s.cls.lock);
 
return 0;
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index d724933..aa2b566 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -154,9 +154,7 @@ static void unlock_entry_classifier(pktio_entry_t *entry)
 static void init_pktio_entry(pktio_entry_t *entry)
 {
set_taken(entry);
-   /* Currently classifier is enabled by default. It should be enabled
-  only when used. */
-   entry->s.cls_enabled = 1;
+   pktio_cls_enabled_set(entry, 0);
entry->s.inq_default = ODP_QUEUE_INVALID;
 
pktio_classifier_init(entry);
@@ -642,7 +640,7 @@ int pktin_poll(pktio_entry_t *entry)
buf = _odp_packet_to_buffer(pkt_tbl[i]);
hdr = odp_buf_to_hdr(buf);
 
-   if (entry->s.cls_enabled) {
+   if (pktio_cls_enabled(entry)) {
if (packet_classifier(entry->s.handle, pkt_tbl[i]) < 0)
hdr_tbl[num_enq++] = hdr;
} else {
-- 
2.5.3

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


Re: [lng-odp] [PATCH] linux-generic: pktio: enable classifier only when needed

2015-09-18 Thread Bala Manoharan
In this case the packet will not be dispatched to the default CoS in
the scenario when the application configures only the default CoS and
not the PMRs.
Is this the expected behaviour? in case not then
pktio_cls_enabled_set() should be configured in the
odp_pktio_default_cos_set() function also.


Regards,
Bala

On 18 September 2015 at 17:17, Petri Savolainen
 wrote:
> Skip packet_classifier function as long as there's no pmr
> set for an pktio interface.
>
> Signed-off-by: Petri Savolainen 
> ---
>  platform/linux-generic/include/odp_packet_io_internal.h | 10 ++
>  platform/linux-generic/odp_classification.c |  2 ++
>  platform/linux-generic/odp_packet_io.c  |  6 ++
>  3 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
> b/platform/linux-generic/include/odp_packet_io_internal.h
> index a21c683..6b03051 100644
> --- a/platform/linux-generic/include/odp_packet_io_internal.h
> +++ b/platform/linux-generic/include/odp_packet_io_internal.h
> @@ -109,6 +109,16 @@ static inline pktio_entry_t *get_pktio_entry(odp_pktio_t 
> pktio)
> return pktio_entry_ptr[pktio_to_id(pktio)];
>  }
>
> +static inline int pktio_cls_enabled(pktio_entry_t *entry)
> +{
> +   return entry->s.cls_enabled;
> +}
> +
> +static inline void pktio_cls_enabled_set(pktio_entry_t *entry, int ena)
> +{
> +   entry->s.cls_enabled = ena;
> +}
> +
>  int pktin_poll(pktio_entry_t *entry);
>
>  extern const pktio_if_ops_t sock_mmsg_pktio_ops;
> diff --git a/platform/linux-generic/odp_classification.c 
> b/platform/linux-generic/odp_classification.c
> index 6c1aff4..7809a42 100644
> --- a/platform/linux-generic/odp_classification.c
> +++ b/platform/linux-generic/odp_classification.c
> @@ -488,6 +488,7 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
> pktio_entry->s.cls.pmr[num_pmr] = pmr;
> pktio_entry->s.cls.cos[num_pmr] = cos;
> pktio_entry->s.cls.num_pmr++;
> +   pktio_cls_enabled_set(pktio_entry, 1);
> UNLOCK(_entry->s.cls.lock);
>
> return 0;
> @@ -625,6 +626,7 @@ int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, 
> odp_pktio_t src_pktio,
> pktio_entry->s.cls.pmr[num_pmr] = pmr;
> pktio_entry->s.cls.cos[num_pmr] = cos;
> pktio_entry->s.cls.num_pmr++;
> +   pktio_cls_enabled_set(pktio_entry, 1);
> UNLOCK(_entry->s.cls.lock);
>
> return 0;
> diff --git a/platform/linux-generic/odp_packet_io.c 
> b/platform/linux-generic/odp_packet_io.c
> index d724933..aa2b566 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -154,9 +154,7 @@ static void unlock_entry_classifier(pktio_entry_t *entry)
>  static void init_pktio_entry(pktio_entry_t *entry)
>  {
> set_taken(entry);
> -   /* Currently classifier is enabled by default. It should be enabled
> -  only when used. */
> -   entry->s.cls_enabled = 1;
> +   pktio_cls_enabled_set(entry, 0);
> entry->s.inq_default = ODP_QUEUE_INVALID;
>
> pktio_classifier_init(entry);
> @@ -642,7 +640,7 @@ int pktin_poll(pktio_entry_t *entry)
> buf = _odp_packet_to_buffer(pkt_tbl[i]);
> hdr = odp_buf_to_hdr(buf);
>
> -   if (entry->s.cls_enabled) {
> +   if (pktio_cls_enabled(entry)) {
> if (packet_classifier(entry->s.handle, pkt_tbl[i]) < 
> 0)
> hdr_tbl[num_enq++] = hdr;
> } else {
> --
> 2.5.3
>
> ___
> 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] Change in lng/odp[master]: debian/control: fix build-depends

2015-09-18 Thread Maxim Uvarov (Code Review)
Maxim Uvarov has posted comments on this change.

Change subject: debian/control: fix build-depends
..


Patch Set 2:

Merged, thanks!

Maxim.

-- 
To view, visit https://review.linaro.org/7928
To unsubscribe, visit https://review.linaro.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2deec68f7d19c9b25e39d836ba9b845e067535ed
Gerrit-PatchSet: 2
Gerrit-Project: lng/odp
Gerrit-Branch: master
Gerrit-Owner: Riku Voipio 
Gerrit-Reviewer: Anders Roxell 
Gerrit-Reviewer: Maxim Uvarov 
Gerrit-HasComments: No
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] linux-generic: pktio: enable classifier only when needed

2015-09-18 Thread Bill Fischofer
Good catch.  The classifier can be completely bypassed only if there are no
classification rules (default or PMRs) in effect.  Presumably the
classifier itself can contain fastpath processing if only a default CoS is
in effect.

On Fri, Sep 18, 2015 at 5:25 AM, Bala Manoharan 
wrote:

> In this case the packet will not be dispatched to the default CoS in
> the scenario when the application configures only the default CoS and
> not the PMRs.
> Is this the expected behaviour? in case not then
> pktio_cls_enabled_set() should be configured in the
> odp_pktio_default_cos_set() function also.
>
>
> Regards,
> Bala
>
> On 18 September 2015 at 17:17, Petri Savolainen
>  wrote:
> > Skip packet_classifier function as long as there's no pmr
> > set for an pktio interface.
> >
> > Signed-off-by: Petri Savolainen 
> > ---
> >  platform/linux-generic/include/odp_packet_io_internal.h | 10 ++
> >  platform/linux-generic/odp_classification.c |  2 ++
> >  platform/linux-generic/odp_packet_io.c  |  6 ++
> >  3 files changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/platform/linux-generic/include/odp_packet_io_internal.h
> b/platform/linux-generic/include/odp_packet_io_internal.h
> > index a21c683..6b03051 100644
> > --- a/platform/linux-generic/include/odp_packet_io_internal.h
> > +++ b/platform/linux-generic/include/odp_packet_io_internal.h
> > @@ -109,6 +109,16 @@ static inline pktio_entry_t
> *get_pktio_entry(odp_pktio_t pktio)
> > return pktio_entry_ptr[pktio_to_id(pktio)];
> >  }
> >
> > +static inline int pktio_cls_enabled(pktio_entry_t *entry)
> > +{
> > +   return entry->s.cls_enabled;
> > +}
> > +
> > +static inline void pktio_cls_enabled_set(pktio_entry_t *entry, int ena)
> > +{
> > +   entry->s.cls_enabled = ena;
> > +}
> > +
> >  int pktin_poll(pktio_entry_t *entry);
> >
> >  extern const pktio_if_ops_t sock_mmsg_pktio_ops;
> > diff --git a/platform/linux-generic/odp_classification.c
> b/platform/linux-generic/odp_classification.c
> > index 6c1aff4..7809a42 100644
> > --- a/platform/linux-generic/odp_classification.c
> > +++ b/platform/linux-generic/odp_classification.c
> > @@ -488,6 +488,7 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
> > pktio_entry->s.cls.pmr[num_pmr] = pmr;
> > pktio_entry->s.cls.cos[num_pmr] = cos;
> > pktio_entry->s.cls.num_pmr++;
> > +   pktio_cls_enabled_set(pktio_entry, 1);
> > UNLOCK(_entry->s.cls.lock);
> >
> > return 0;
> > @@ -625,6 +626,7 @@ int odp_pktio_pmr_match_set_cos(odp_pmr_set_t
> pmr_set_id, odp_pktio_t src_pktio,
> > pktio_entry->s.cls.pmr[num_pmr] = pmr;
> > pktio_entry->s.cls.cos[num_pmr] = cos;
> > pktio_entry->s.cls.num_pmr++;
> > +   pktio_cls_enabled_set(pktio_entry, 1);
> > UNLOCK(_entry->s.cls.lock);
> >
> > return 0;
> > diff --git a/platform/linux-generic/odp_packet_io.c
> b/platform/linux-generic/odp_packet_io.c
> > index d724933..aa2b566 100644
> > --- a/platform/linux-generic/odp_packet_io.c
> > +++ b/platform/linux-generic/odp_packet_io.c
> > @@ -154,9 +154,7 @@ static void unlock_entry_classifier(pktio_entry_t
> *entry)
> >  static void init_pktio_entry(pktio_entry_t *entry)
> >  {
> > set_taken(entry);
> > -   /* Currently classifier is enabled by default. It should be
> enabled
> > -  only when used. */
> > -   entry->s.cls_enabled = 1;
> > +   pktio_cls_enabled_set(entry, 0);
> > entry->s.inq_default = ODP_QUEUE_INVALID;
> >
> > pktio_classifier_init(entry);
> > @@ -642,7 +640,7 @@ int pktin_poll(pktio_entry_t *entry)
> > buf = _odp_packet_to_buffer(pkt_tbl[i]);
> > hdr = odp_buf_to_hdr(buf);
> >
> > -   if (entry->s.cls_enabled) {
> > +   if (pktio_cls_enabled(entry)) {
> > if (packet_classifier(entry->s.handle,
> pkt_tbl[i]) < 0)
> > hdr_tbl[num_enq++] = hdr;
> > } else {
> > --
> > 2.5.3
> >
> > ___
> > 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] validation:classification: Add fix for classification tests

2015-09-18 Thread ion.grigore
From: Grigore Ion 

odph_ipv4_csum_update should be used to update the checksum inside a pkt,
as it is used in all the other examples and tests different from
classification. Thus the prototype of the function should return void,
because the intention was to update a value not to return something. These
being said it is wrong(on LE platforms) to do a cpu_to_be conversion
and an assignment operation in classification_test(this is
already done inside)

Signed-off-by: Grigore Ion 
---
 .../classification/odp_classification_tests.c  |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/validation/classification/odp_classification_tests.c 
b/test/validation/classification/odp_classification_tests.c
index a4072c4..1c944b2 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -251,7 +251,7 @@ odp_packet_t create_packet(bool vlan)
seqno = odp_atomic_fetch_inc_u32();
ip->id = odp_cpu_to_be_16(seqno);
ip->chksum = 0;
-   ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
+   odph_ipv4_csum_update(pkt);
offset += ODPH_IPV4HDR_LEN;
 
/* udp */
@@ -444,7 +444,7 @@ void test_cls_pmr_chain(void)
parse_ipv4_string(CLS_PMR_CHAIN_SADDR, , );
ip->src_addr = odp_cpu_to_be_32(addr);
ip->chksum = 0;
-   ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
+   odph_ipv4_csum_update(pkt);
 
udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
udp->src_port = odp_cpu_to_be_16(CLS_PMR_CHAIN_SPORT);
@@ -462,7 +462,7 @@ void test_cls_pmr_chain(void)
parse_ipv4_string(CLS_PMR_CHAIN_SADDR, , );
ip->src_addr = odp_cpu_to_be_32(addr);
ip->chksum = 0;
-   ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
+   odph_ipv4_csum_update(pkt);
 
enqueue_loop_interface(pkt);
pkt = receive_packet(, ODP_TIME_SEC);
@@ -782,7 +782,7 @@ void test_pktio_pmr_match_set_cos(void)
parse_ipv4_string(CLS_PMR_SET_SADDR, , );
ip->src_addr = odp_cpu_to_be_32(addr);
ip->chksum = 0;
-   ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
+   odph_ipv4_csum_update(pkt);
 
udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
udp->src_port = odp_cpu_to_be_16(CLS_PMR_SET_SPORT);
-- 
1.7.3.4

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