[dpdk-dev] [PATCH v2] examples: fix ip_pipeline to load PMD driver correctly

2016-10-04 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

There is typo in init.c of ip_pipeline example due to which,
invalid file path is added to -d option of EAL i.e path starting
with =.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 examples/ip_pipeline/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 0dbc332..d580ddf 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -236,7 +236,7 @@ app_init_eal(struct app_params *app)
}

if (p->add_driver) {
-   snprintf(buffer, sizeof(buffer), "-d=%s", p->add_driver);
+   snprintf(buffer, sizeof(buffer), "-d%s", p->add_driver);
app->eal_argv[n_args++] = strdup(buffer);
}

-- 
1.9.1



[dpdk-dev] [PATCH v2] examples: fix ip_pipeline to load PMD driver correctly

2016-10-04 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

v2: minor correction in patch to avoid space between -d option and driver path

Gowrishankar Muthukrishnan (1):
  examples: fix ip_pipeline to load PMD driver correctly

 examples/ip_pipeline/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.9.1



[dpdk-dev] [PATCH v6 9/9] table: align rte table hash structs for cache line size

2016-09-08 Thread gowrishankar muthukrishnan
Thanks Cristian and Thomas for your feedback. I have taken your suggestions
and sent out v7. Please check if the new patch is fine.

Thanks,
Gowrishankar

On Thursday 08 September 2016 03:10 PM, Dumitrescu, Cristian wrote:
>
>> -Original Message-
>> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
>> Sent: Thursday, September 8, 2016 10:36 AM
>> To: Gowrishankar Muthukrishnan 
>> Cc: dev at dpdk.org; Dumitrescu, Cristian ;
>> Chao Zhu ; Richardson, Bruce
>> ; Ananyev, Konstantin
>> ; Pradeep 
>> Subject: Re: [dpdk-dev] [PATCH v6 9/9] table: align rte table hash structs 
>> for
>> cache line size
>>
>> 2016-08-31 17:29, Dumitrescu, Cristian:
>>> From: Gowrishankar Muthukrishnan
>>>> rte table hash structs rte_bucket_4_8, rte_bucket_4_16 and
>>>> rte_bucket_4_32 have
>>>> to be cache aligned as required by their corresponding hash create
>> functions
>>>> rte_table_hash_create_key8_lru etc.
>>> Hi Gowrishankar,
>>>
>>> My understanding is you are trying to work around the check invoked by
>> the hash table create functions that verifies the size of the bucket header
>> structure is a multiple of the cache line, right?
>>> Given that the size of this structure is 1x, 2x or 3x times 64 bytes, the 
>>> check
>> passes on IA CPUs (cache line of 64 bytes; explicit alignment to cache line 
>> size
>> is not needed in order to make the size of the structure a multiple of cache
>> line), but not on PPC CPUs (cache line of 128 bytes), correct?
>>> I don't think your proposal provides the best way to fix this issue, since
>> your code leads to a considerable increase in the memory consumption used
>> per bucket in most cases:
>>> - 100% more memory for 8-byte key hash table
>>> - 0% more for 16-byte key hash table (code does not fix anything,
>> explicit alignment is not needed)
>>> - 50% more for 32-byte key hash table
>>>
>>> I suggest you simply change the check: instead of validating this data
>> structure is a multiple of cache line size, validate it is a multiple of 64 
>> bytes.
>>
>> Any news please?
>> The whole series is blocked for this patch.
>> Should we expect a v7?
> Yes, I think we should. Small fix for a considerable benefit.
>
>




[dpdk-dev] [PATCH v7 9/9] table: fix verification on hash bucket header alignment

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

In powerpc systems, rte table hash structs rte_bucket_4_8, rte_bucket_4_16 and
rte_bucket_4_32 are not cache aligned and hence verification on same would fail.
Instead of checking alignment on cpu cacheline, it could equally be tested as
multiple of 64 bytes.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 lib/librte_table/rte_table_hash_key16.c | 4 ++--
 lib/librte_table/rte_table_hash_key32.c | 4 ++--
 lib/librte_table/rte_table_hash_key8.c  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/librte_table/rte_table_hash_key16.c 
b/lib/librte_table/rte_table_hash_key16.c
index b7e000f..08d4d77 100644
--- a/lib/librte_table/rte_table_hash_key16.c
+++ b/lib/librte_table/rte_table_hash_key16.c
@@ -130,7 +130,7 @@ rte_table_hash_create_key16_lru(void *params,
/* Check input parameters */
if ((check_params_create_lru(p) != 0) ||
((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
-   ((sizeof(struct rte_bucket_4_16) % RTE_CACHE_LINE_SIZE) != 0))
+   ((sizeof(struct rte_bucket_4_16) % 64) != 0))
return NULL;
n_entries_per_bucket = 4;
key_size = 16;
@@ -344,7 +344,7 @@ rte_table_hash_create_key16_ext(void *params,
/* Check input parameters */
if ((check_params_create_ext(p) != 0) ||
((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
-   ((sizeof(struct rte_bucket_4_16) % RTE_CACHE_LINE_SIZE) != 0))
+   ((sizeof(struct rte_bucket_4_16) % 64) != 0))
return NULL;

n_entries_per_bucket = 4;
diff --git a/lib/librte_table/rte_table_hash_key32.c 
b/lib/librte_table/rte_table_hash_key32.c
index a7aba49..161f6b7 100644
--- a/lib/librte_table/rte_table_hash_key32.c
+++ b/lib/librte_table/rte_table_hash_key32.c
@@ -129,7 +129,7 @@ rte_table_hash_create_key32_lru(void *params,
/* Check input parameters */
if ((check_params_create_lru(p) != 0) ||
((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
-   ((sizeof(struct rte_bucket_4_32) % RTE_CACHE_LINE_SIZE) != 0)) {
+   ((sizeof(struct rte_bucket_4_32) % 64) != 0)) {
return NULL;
}
n_entries_per_bucket = 4;
@@ -337,7 +337,7 @@ rte_table_hash_create_key32_ext(void *params,
/* Check input parameters */
if ((check_params_create_ext(p) != 0) ||
((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
-   ((sizeof(struct rte_bucket_4_32) % RTE_CACHE_LINE_SIZE) != 0))
+   ((sizeof(struct rte_bucket_4_32) % 64) != 0))
return NULL;

n_entries_per_bucket = 4;
diff --git a/lib/librte_table/rte_table_hash_key8.c 
b/lib/librte_table/rte_table_hash_key8.c
index e2e2bdc..b04f60d 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -125,7 +125,7 @@ rte_table_hash_create_key8_lru(void *params, int socket_id, 
uint32_t entry_size)
/* Check input parameters */
if ((check_params_create_lru(p) != 0) ||
((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
-   ((sizeof(struct rte_bucket_4_8) % RTE_CACHE_LINE_SIZE) != 0)) {
+   ((sizeof(struct rte_bucket_4_8) % 64) != 0)) {
return NULL;
}
n_entries_per_bucket = 4;
@@ -332,7 +332,7 @@ rte_table_hash_create_key8_ext(void *params, int socket_id, 
uint32_t entry_size)
/* Check input parameters */
if ((check_params_create_ext(p) != 0) ||
((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
-   ((sizeof(struct rte_bucket_4_8) % RTE_CACHE_LINE_SIZE) != 0))
+   ((sizeof(struct rte_bucket_4_8) % 64) != 0))
return NULL;

n_entries_per_bucket = 4;
-- 
1.9.1



[dpdk-dev] [PATCH v7 8/9] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patch fixes ip_pipeline panic in app_init_core_map while preparing cpu
core map in powerpc with SMT off. cpu_core_map_compute_linux currently prepares
core mapping based on file existence in sysfs ie.

/sys/devices/system/cpu/cpu/topology/physical_package_id
  /sys/devices/system/cpu/cpu/topology/core_id

These files do not exist for lcores which are offline for any reason (as in
powerpc, while SMT is off). In this situation, this function should further
continue preparing map for other online lcores instead of returning with -1
for a first unavailable lcore.

Also, in SMT=off scenario for powerpc, lcore ids can not be always indexed from
0 upto 'number of cores present' (/sys/devices/system/cpu/present). For eg, for
an online lcore 32, core_id returned in sysfs is 112 where online lcores are
10 (as in one configuration), hence sysfs lcore id can not be checked with
indexing lcore number before positioning lcore map array.

Signed-off-by: Gowrishankar Muthukrishnan 
Acked by: Cristian Dumitrescu 
Acked-by: Chao Zhu 
---
 examples/ip_pipeline/cpu_core_map.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/examples/ip_pipeline/cpu_core_map.c 
b/examples/ip_pipeline/cpu_core_map.c
index cb088b1..dd8f678 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -351,8 +351,10 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
int lcore_socket_id =
cpu_core_map_get_socket_id_linux(lcore_id);

+#if !defined(RTE_ARCH_PPC_64)
if (lcore_socket_id < 0)
return -1;
+#endif

if (((uint32_t) lcore_socket_id) == socket_id)
n_detected++;
@@ -368,6 +370,7 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
cpu_core_map_get_socket_id_linux(
lcore_id);

+#if !defined(RTE_ARCH_PPC_64)
if (lcore_socket_id < 0)
return -1;

@@ -377,9 +380,14 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)

if (lcore_core_id < 0)
return -1;
+#endif

+#if !defined(RTE_ARCH_PPC_64)
if (((uint32_t) lcore_socket_id == socket_id) &&
((uint32_t) lcore_core_id == core_id)) {
+#else
+   if (((uint32_t) lcore_socket_id == socket_id)) {
+#endif
uint32_t pos = cpu_core_map_pos(map,
socket_id,
core_id_contig,
-- 
1.9.1



[dpdk-dev] [PATCH v7 7/9] pipeline: enable pipeline library for ppc64le

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patch enables librte_pipeline for ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
Acked-by: Chao Zhu 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 1fc8df2..f953e61 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -56,5 +56,3 @@ CONFIG_RTE_LIBRTE_PMD_BOND=n
 CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

-# This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v7 6/9] port: enable port library for ppc64le

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patch enables librte_port in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
Acked-by: Chao Zhu 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 0c7060f..1fc8df2 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,5 +57,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v7 5/9] sched: enable sched library for ppc64le

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patch enables librte_sched in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
Acked-by: Chao Zhu 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 41f67d5..0c7060f 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,6 +57,5 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v7 4/9] table: enable table library for ppc64le

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patch enables librte_table in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
Acked-by: Chao Zhu 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index dede34f..41f67d5 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -59,5 +59,4 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
 # This following libraries are not available on Power. So they're turned off.
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
-CONFIG_RTE_LIBRTE_TABLE=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v7 3/9] l3fwd: add altivec support for em_hash_key

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for em_mask_key function.

Signed-off-by: Gowrishankar Muthukrishnan 
Acked-by: Chao Zhu 
---
 examples/l3fwd/l3fwd_em.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index def5a02..6053a62 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -259,8 +259,16 @@ em_mask_key(void *key, xmm_t mask)

return vandq_s32(data, mask);
 }
+#elif defined(RTE_MACHINE_CPUFLAG_ALTIVEC)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   xmm_t data = vec_ld(0, (xmm_t *)(key));
+
+   return vec_and(data, mask);
+}
 #else
-#error No vector engine (SSE, NEON) available, check your toolchain
+#error No vector engine (SSE, NEON, ALTIVEC) available, check your toolchain
 #endif

 static inline uint8_t
-- 
1.9.1



[dpdk-dev] [PATCH v7 2/9] acl: add altivec intrinsics for dpdk acl on ppc_64

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patch adds port for ACL library in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
Acked-by: Konstantin Ananyev 
Acked-by: Chao Zhu 
---
 app/test-acl/main.c |   4 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 -
 lib/librte_acl/Makefile |   2 +
 lib/librte_acl/acl.h|   4 +
 lib/librte_acl/acl_run.h|   2 +
 lib/librte_acl/acl_run_altivec.c|  47 
 lib/librte_acl/acl_run_altivec.h| 329 
 lib/librte_acl/rte_acl.c|  13 ++
 lib/librte_acl/rte_acl.h|   1 +
 9 files changed, 402 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index d366981..1b2b176 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -105,6 +105,10 @@ static const struct acl_alg acl_alg[] = {
.name = "neon",
.alg = RTE_ACL_CLASSIFY_NEON,
},
+   {
+   .name = "altivec",
+   .alg = RTE_ACL_CLASSIFY_ALTIVEC,
+   },
 };

 static struct {
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 9ddf3c5..dede34f 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_TABLE=n
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 9803e9d..d05be66 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -52,6 +52,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
 ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) $(CONFIG_RTE_ARCH_ARM64)),)
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
 CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
+else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_altivec.c
 else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
 #check if flag for SSE4.1 is already on, if not set it up manually
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 09d6784..6664a55 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -234,6 +234,10 @@ int
 rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index b2fc42c..024f393 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -39,7 +39,9 @@

 #define MAX_SEARCHES_AVX16 16
 #define MAX_SEARCHES_SSE8  8
+#define MAX_SEARCHES_ALTIVEC8  8
 #define MAX_SEARCHES_SSE4  4
+#define MAX_SEARCHES_ALTIVEC4  4
 #define MAX_SEARCHES_SCALAR2

 #define GET_NEXT_4BYTES(prm, idx)  \
diff --git a/lib/librte_acl/acl_run_altivec.c b/lib/librte_acl/acl_run_altivec.c
new file mode 100644
index 000..3523526
--- /dev/null
+++ b/lib/librte_acl/acl_run_altivec.c
@@ -0,0 +1,47 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, 

[dpdk-dev] [PATCH v7 1/9] lpm: add altivec intrinsics for dpdk lpm on ppc_64

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for LPM library in DPDK.

Signed-off-by: Gowrishankar Muthukrishnan 
Acked-by: Chao Zhu 
---
 app/test/test_xmmt_ops.h   |  16 +++
 config/defconfig_ppc_64-power8-linuxapp-gcc|   1 -
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 +
 6 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
index de9c16f..42174d2 100644
--- a/app/test/test_xmmt_ops.h
+++ b/app/test/test_xmmt_ops.h
@@ -62,6 +62,22 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
 /* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
 #define vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0)

+#elif defined(RTE_ARCH_PPC_64)
+
+/* vect_* abstraction implementation using ALTIVEC */
+
+/* loads the xmm_t value from address p(does not need to be 16-byte aligned)*/
+#define vect_loadu_sil128(p) vec_ld(0, p)
+
+/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
+static inline xmm_t  __attribute__((always_inline))
+vect_set_epi32(int i3, int i2, int i1, int i0)
+{
+   xmm_t data = (xmm_t){i0, i1, i2, i3};
+
+   return data;
+}
+
 #endif

 #endif /* _TEST_XMMT_OPS_H_ */
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index bef8f49..9ddf3c5 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
new file mode 100644
index 000..05209e5
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
@@ -0,0 +1,60 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of IBM Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_PPC_64_H_
+#define _RTE_VECT_PPC_64_H_
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef vector signed int xmm_t;
+
+#defineXMM_SIZE(sizeof(xmm_t))
+#defineXMM_MASK(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+   xmm_tx;
+   uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];
+   uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+   uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+   uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+   double   pd[XMM_SIZE / sizeof(double)];
+} __attribute__((aligned(16))) rte_xmm_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_PPC_64_H_ */
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 656ade2..3dc549d 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -51,6 +51,8 @@ ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) 
$(CONFIG_RTE_ARCH_ARM64)),)
 SYMLI

[dpdk-dev] [PATCH v7 0/9] enable lpm, acl and other missing libraries in ppc64le

2016-09-08 Thread Gowrishankar
From: Gowrishankar Muthukrishnan <gowrishanka...@linux.vnet.ibm.com>

This patchset enables LPM, ACL and other few missing libs in ppc64le and also
address few patches in related examples (ip_pipeline and l3fwd).

Test report:
1. LPM and ACL unit tests passed.
   Steps:
   compile test app and run (with any needed params)
   lpm_autotest
   acl_autotest
   table_autotest
 test_table_lpm_combined fails same as in intel in current master.

2. Example ip_pipeline application verified for port forwarding.
   compile examples/ip_pipeline (adjust app_init_core_map
 param for ht to 1 in case of ppc64le in SMT=off mode).
   modify config/l3fwd.cfg as per enabled PMD ports.
   run ip_pipeline with config file option and check packets fwd.

v7 changes:
- removed enforcing cache alignment for table hash structs and
  instead check only for multiples of 64 bytes.

v6 changes:
- added cache alignment fix for rte hash table structs.

v5 changes:
- no change in lpm lib enablement
- no change in acl lib enablement
- config file changes individually for sched,table,port,pipeline
  lib enablement
- ip_pipeline patch description and changes flagged only for ppc64le.
   app_init_core_map changes removed (due to bug found and under 
   investigation only on ppc64le/smt=off case).

v4 changes:
- fix transition4 in acl_run_altivec.h for gcc strict-aliasing error.
  Thanks to Chao Zhu for bringing up.

v3 changes:
- rebase over master to fix conflict in examples/l3fwd/l3fwd_em.c

v2 changes:
- enabling libs in config included as part of lib changes itself.

Gowrishankar Muthukrishnan (9):
  lpm: add altivec intrinsics for dpdk lpm on ppc_64
  acl: add altivec intrinsics for dpdk acl on ppc_64
  l3fwd: add altivec support for em_hash_key
  table: enable table library for ppc64le
  sched: enable sched library for ppc64le
  port: enable port library for ppc64le
  pipeline: enable pipeline library for ppc64le
  ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64
  table: fix verification on hash bucket header alignment

 app/test-acl/main.c|   4 +
 app/test/test_xmmt_ops.h   |  16 +
 config/defconfig_ppc_64-power8-linuxapp-gcc|   7 -
 examples/ip_pipeline/cpu_core_map.c|   8 +
 examples/l3fwd/l3fwd_em.c  |  10 +-
 lib/librte_acl/Makefile|   2 +
 lib/librte_acl/acl.h   |   4 +
 lib/librte_acl/acl_run.h   |   2 +
 lib/librte_acl/acl_run_altivec.c   |  47 +++
 lib/librte_acl/acl_run_altivec.h   | 329 +
 lib/librte_acl/rte_acl.c   |  13 +
 lib/librte_acl/rte_acl.h   |   1 +
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 ++
 lib/librte_table/rte_table_hash_key16.c|   4 +-
 lib/librte_table/rte_table_hash_key32.c|   4 +-
 lib/librte_table/rte_table_hash_key8.c |   4 +-
 19 files changed, 659 insertions(+), 14 deletions(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

-- 
1.9.1



[dpdk-dev] [PATCH v6 9/9] table: align rte table hash structs for cache line size

2016-08-16 Thread Gowrishankar Muthukrishnan
rte table hash structs rte_bucket_4_8, rte_bucket_4_16 and rte_bucket_4_32 have
to be cache aligned as required by their corresponding hash create functions
rte_table_hash_create_key8_lru etc.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 lib/librte_table/rte_table_hash_key16.c | 4 ++--
 lib/librte_table/rte_table_hash_key32.c | 4 ++--
 lib/librte_table/rte_table_hash_key8.c  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_table/rte_table_hash_key16.c 
b/lib/librte_table/rte_table_hash_key16.c
index b7e000f..2102326 100644
--- a/lib/librte_table/rte_table_hash_key16.c
+++ b/lib/librte_table/rte_table_hash_key16.c
@@ -68,10 +68,10 @@ struct rte_bucket_4_16 {
uint64_t next_valid;

/* Cache line 1 */
-   uint64_t key[4][2];
+   uint64_t key[4][2] __rte_cache_aligned;

/* Cache line 2 */
-   uint8_t data[0];
+   uint8_t data[0] __rte_cache_aligned;
 };

 struct rte_table_hash {
diff --git a/lib/librte_table/rte_table_hash_key32.c 
b/lib/librte_table/rte_table_hash_key32.c
index a7aba49..619f63a 100644
--- a/lib/librte_table/rte_table_hash_key32.c
+++ b/lib/librte_table/rte_table_hash_key32.c
@@ -68,10 +68,10 @@ struct rte_bucket_4_32 {
uint64_t next_valid;

/* Cache lines 1 and 2 */
-   uint64_t key[4][4];
+   uint64_t key[4][4] __rte_cache_aligned;

/* Cache line 3 */
-   uint8_t data[0];
+   uint8_t data[0] __rte_cache_aligned;
 };

 struct rte_table_hash {
diff --git a/lib/librte_table/rte_table_hash_key8.c 
b/lib/librte_table/rte_table_hash_key8.c
index e2e2bdc..4d5e0cd 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -68,7 +68,7 @@ struct rte_bucket_4_8 {
uint64_t key[4];

/* Cache line 1 */
-   uint8_t data[0];
+   uint8_t data[0] __rte_cache_aligned;
 };

 struct rte_table_hash {
-- 
1.9.1



[dpdk-dev] [PATCH v6 8/9] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-08-16 Thread Gowrishankar Muthukrishnan
This patch fixes ip_pipeline panic in app_init_core_map while preparing cpu
core map in powerpc with SMT off. cpu_core_map_compute_linux currently prepares
core mapping based on file existence in sysfs ie.

/sys/devices/system/cpu/cpu/topology/physical_package_id
  /sys/devices/system/cpu/cpu/topology/core_id

These files do not exist for lcores which are offline for any reason (as in
powerpc, while SMT is off). In this situation, this function should further
continue preparing map for other online lcores instead of returning with -1
for a first unavailable lcore.

Also, in SMT=off scenario for powerpc, lcore ids can not be always indexed from
0 upto 'number of cores present' (/sys/devices/system/cpu/present). For eg, for
an online lcore 32, core_id returned in sysfs is 112 where online lcores are
10 (as in one configuration), hence sysfs lcore id can not be checked with
indexing lcore number before positioning lcore map array.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 examples/ip_pipeline/cpu_core_map.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/examples/ip_pipeline/cpu_core_map.c 
b/examples/ip_pipeline/cpu_core_map.c
index cb088b1..dd8f678 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -351,8 +351,10 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
int lcore_socket_id =
cpu_core_map_get_socket_id_linux(lcore_id);

+#if !defined(RTE_ARCH_PPC_64)
if (lcore_socket_id < 0)
return -1;
+#endif

if (((uint32_t) lcore_socket_id) == socket_id)
n_detected++;
@@ -368,6 +370,7 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
cpu_core_map_get_socket_id_linux(
lcore_id);

+#if !defined(RTE_ARCH_PPC_64)
if (lcore_socket_id < 0)
return -1;

@@ -377,9 +380,14 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)

if (lcore_core_id < 0)
return -1;
+#endif

+#if !defined(RTE_ARCH_PPC_64)
if (((uint32_t) lcore_socket_id == socket_id) &&
((uint32_t) lcore_core_id == core_id)) {
+#else
+   if (((uint32_t) lcore_socket_id == socket_id)) {
+#endif
uint32_t pos = cpu_core_map_pos(map,
socket_id,
core_id_contig,
-- 
1.9.1



[dpdk-dev] [PATCH v6 7/9] pipeline: enable pipeline library for ppc64le

2016-08-16 Thread Gowrishankar Muthukrishnan
This patch enables librte_pipeline for ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 1fc8df2..f953e61 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -56,5 +56,3 @@ CONFIG_RTE_LIBRTE_PMD_BOND=n
 CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

-# This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v6 6/9] port: enable port library for ppc64le

2016-08-16 Thread Gowrishankar Muthukrishnan
This patch enables librte_port in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 0c7060f..1fc8df2 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,5 +57,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v6 5/9] sched: enable sched library for ppc64le

2016-08-16 Thread Gowrishankar Muthukrishnan
This patch enables librte_sched in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 41f67d5..0c7060f 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,6 +57,5 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v6 4/9] table: enable table library for ppc64le

2016-08-16 Thread Gowrishankar Muthukrishnan
This patch enables librte_table in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index dede34f..41f67d5 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -59,5 +59,4 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
 # This following libraries are not available on Power. So they're turned off.
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
-CONFIG_RTE_LIBRTE_TABLE=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v6 3/9] l3fwd: add altivec support for em_hash_key

2016-08-16 Thread Gowrishankar Muthukrishnan
This patch adds ppc64le port for em_mask_key function.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 examples/l3fwd/l3fwd_em.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index def5a02..6053a62 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -259,8 +259,16 @@ em_mask_key(void *key, xmm_t mask)

return vandq_s32(data, mask);
 }
+#elif defined(RTE_MACHINE_CPUFLAG_ALTIVEC)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   xmm_t data = vec_ld(0, (xmm_t *)(key));
+
+   return vec_and(data, mask);
+}
 #else
-#error No vector engine (SSE, NEON) available, check your toolchain
+#error No vector engine (SSE, NEON, ALTIVEC) available, check your toolchain
 #endif

 static inline uint8_t
-- 
1.9.1



[dpdk-dev] [PATCH v6 2/9] acl: add altivec intrinsics for dpdk acl on ppc_64

2016-08-16 Thread Gowrishankar Muthukrishnan
This patch adds port for ACL library in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 app/test-acl/main.c |   4 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 -
 lib/librte_acl/Makefile |   2 +
 lib/librte_acl/acl.h|   4 +
 lib/librte_acl/acl_run.h|   2 +
 lib/librte_acl/acl_run_altivec.c|  47 
 lib/librte_acl/acl_run_altivec.h| 329 
 lib/librte_acl/rte_acl.c|  13 ++
 lib/librte_acl/rte_acl.h|   1 +
 9 files changed, 402 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index d366981..1b2b176 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -105,6 +105,10 @@ static const struct acl_alg acl_alg[] = {
.name = "neon",
.alg = RTE_ACL_CLASSIFY_NEON,
},
+   {
+   .name = "altivec",
+   .alg = RTE_ACL_CLASSIFY_ALTIVEC,
+   },
 };

 static struct {
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 9ddf3c5..dede34f 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_TABLE=n
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 9803e9d..d05be66 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -52,6 +52,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
 ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) $(CONFIG_RTE_ARCH_ARM64)),)
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
 CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
+else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_altivec.c
 else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
 #check if flag for SSE4.1 is already on, if not set it up manually
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 09d6784..6664a55 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -234,6 +234,10 @@ int
 rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index b2fc42c..024f393 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -39,7 +39,9 @@

 #define MAX_SEARCHES_AVX16 16
 #define MAX_SEARCHES_SSE8  8
+#define MAX_SEARCHES_ALTIVEC8  8
 #define MAX_SEARCHES_SSE4  4
+#define MAX_SEARCHES_ALTIVEC4  4
 #define MAX_SEARCHES_SCALAR2

 #define GET_NEXT_4BYTES(prm, idx)  \
diff --git a/lib/librte_acl/acl_run_altivec.c b/lib/librte_acl/acl_run_altivec.c
new file mode 100644
index 000..3523526
--- /dev/null
+++ b/lib/librte_acl/acl_run_altivec.c
@@ -0,0 +1,47 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABI

[dpdk-dev] [PATCH v6 0/9] enable lpm, acl and other missing libraries in ppc64le

2016-08-16 Thread Gowrishankar Muthukrishnan
This patchset enables LPM, ACL and other few missing libs in ppc64le and also
address few patches in related examples (ip_pipeline and l3fwd).

Test report:
1. LPM and ACL unit tests passed.
   Steps:
   compile test app and run (with any needed params)
   lpm_autotest
   acl_autotest
   table_autotest
 test_table_lpm_combined fails same as in intel in current master.

2. Example ip_pipeline application verified for port forwarding.
   compile examples/ip_pipeline (adjust app_init_core_map
 param for ht to 1 in case of ppc64le in SMT=off mode).
   modify config/l3fwd.cfg as per enabled PMD ports.
   run ip_pipeline with config file option and check packets fwd.

v6 changes:
- added cache alignment fix for rte hash table structs.

v5 changes:
- no change in lpm lib enablement
- no change in acl lib enablement
- config file changes individually for sched,table,port,pipeline
  lib enablement
- ip_pipeline patch description and changes flagged only for ppc64le.
   app_init_core_map changes removed (due to bug found and under 
   investigation only on ppc64le/smt=off case).

v4 changes:
- fix transition4 in acl_run_altivec.h for gcc strict-aliasing error.
  Thanks to Chao Zhu for bringing up.

v3 changes:
- rebase over master to fix conflict in examples/l3fwd/l3fwd_em.c

v2 changes:
- enabling libs in config included as part of lib changes itself.

Gowrishankar Muthukrishnan (9):
  lpm: add altivec intrinsics for dpdk lpm on ppc_64
  acl: add altivec intrinsics for dpdk acl on ppc_64
  l3fwd: add altivec support for em_hash_key
  table: enable table library for ppc64le
  sched: enable sched library for ppc64le
  port: enable port library for ppc64le
  pipeline: enable pipeline library for ppc64le
  ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64
  table: align rte table hash structs for cache line size

 app/test-acl/main.c|   4 +
 app/test/test_xmmt_ops.h   |  16 +
 config/defconfig_ppc_64-power8-linuxapp-gcc|   7 -
 examples/ip_pipeline/cpu_core_map.c|   8 +
 examples/l3fwd/l3fwd_em.c  |  10 +-
 lib/librte_acl/Makefile|   2 +
 lib/librte_acl/acl.h   |   4 +
 lib/librte_acl/acl_run.h   |   2 +
 lib/librte_acl/acl_run_altivec.c   |  47 +++
 lib/librte_acl/acl_run_altivec.h   | 329 +
 lib/librte_acl/rte_acl.c   |  13 +
 lib/librte_acl/rte_acl.h   |   1 +
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 ++
 lib/librte_table/rte_table_hash_key16.c|   4 +-
 lib/librte_table/rte_table_hash_key32.c|   4 +-
 lib/librte_table/rte_table_hash_key8.c |   2 +-
 19 files changed, 658 insertions(+), 13 deletions(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

-- 
1.9.1



[dpdk-dev] [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-08-12 Thread gowrishankar muthukrishnan
Hi Chao,
I have simplified the approach for this patch in v5.
* Including ppc64le specific changes
* App panic in creating core map only in SMT=off case, so that would be
   addressed separately.

Hoping with new patch set v5, your review would be easier.

Regards,
Gowrishankar

On Friday 12 August 2016 03:45 PM, Chao Zhu wrote:
> Another comment is, comment out lcore_socket_id check will influence other 
> architectures. If possible, I would like to make this change to Power 
> specific.
>
> -Original Message-
> From: gowrishankar muthukrishnan [mailto:gowrishankar.m at linux.vnet.ibm.com]
> Sent: 2016?8?12? 17:00
> To: Chao Zhu 
> Cc: dev at dpdk.org; 'Bruce Richardson' ; 
> 'Konstantin Ananyev' ; 'Thomas Monjalon' 
> ; 'Cristian Dumitrescu'  intel.com>; 'Pradeep' 
> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT 
> threads as in ppc64
>
> On Friday 12 August 2016 02:14 PM, Chao Zhu wrote:
>> Gowrishankar,
>>
>> I suggest to set the following value:
>>
>> n_max_cores_per_socket = 8
>> n_max_ht_per_core = 8
>>
>> This will cover most of the Power8 servers.
>> Any comments?
> Sure Chao. I will include this change in v5. If there are no other comments, 
> I can spin out v5, with changes in this patch.
>
> Regards,
> Gowrishankar
>> -Original Message-
>> From: gowrishankar muthukrishnan
>> [mailto:gowrishankar.m at linux.vnet.ibm.com]
>> Sent: 2016?8?11? 20:02
>> To: Chao Zhu 
>> Cc: dev at dpdk.org; 'Bruce Richardson' ;
>> 'Konstantin Ananyev' ; 'Thomas Monjalon'
>> ; 'Cristian Dumitrescu'
>> ; 'Pradeep' 
>> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying
>> SMT threads as in ppc64
>>
>> On Thursday 11 August 2016 03:59 PM, Chao Zhu wrote:
>>> Gowrishankar,
>>>
>>> Thanks for the detail.
>>> If my understanding is correct, Power8 has different chips. Some of the 
>>> OpenPOWER chips have 8 cores per socket. And the max threads per core is 8. 
>>> Should we support this in cpu_core_map_init()?
>>>
>>> Here's a dump from the OpenPOWER system.
>>> ==
>>> # lscpu
>>> Architecture:  ppc64le
>>> Byte Order:Little Endian
>>> CPU(s):64
>>> On-line CPU(s) list:   0,8,16,24,32,40,48,56
>>> Off-line CPU(s) list:  1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63
>>> Thread(s) per core:1
>>> Core(s) per socket:8
>>> Socket(s): 1
>>> NUMA node(s):  1
>>> Model: unknown
>>> L1d cache: 64K
>>> L1i cache: 32K
>>> L2 cache:  512K
>>> L3 cache:  8192K
>>> NUMA node0 CPU(s): 0,8,16,24,32,40,48,56
>>> =
>>>
>>>
>>>> +#if defined(RTE_ARCH_PPC_64)
>>>> +  app->core_map = cpu_core_map_init(2, 5, 1, 0); #else
>>>>
>>>> This value seems quite strange. Can you give more detail?
>> Based on config of tested server (as below output),
>>
>> CPU(s):80
>> On-line CPU(s) list:   0,8,16,24,32,40,48,56,64,72
>> Off-line CPU(s) list:
>> 1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63,65-71,73-79
>> Thread(s) per core:1  <<<
>> Core(s) per socket:5   <<<
>> Socket(s): 2   <<<
>> NUMA node(s):  2
>>
>> cpu_core_map_init parameters (2,5,1,0) were prepared. Instead, we can cap 
>> max sockets/core/ht counts to possible maximum supported today.
>>
>> Regards,
>> Gowrishankar
>>>>app->core_map = cpu_core_map_init(4, 32, 4, 0);
>>>> +#endif
>>> -Original Message-
>>> From: gowrishankar muthukrishnan
>>> [mailto:gowrishankar.m at linux.vnet.ibm.com]
>>> Sent: 2016?8?9? 19:14
>>> To: Chao Zhu ; dev at dpdk.org
>>> Cc: 'Bruce Richardson' ; 'Konstantin
>>> Ananyev' ; 'Thomas Monjalon'
>>> ; 'Cristian Dumitrescu'
>>> ; 'Pradeep' 
>>> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for
>>> varying SMT threads as in ppc64
>>>
>>> Hi Chao,
>>> Sure. Please find below one.
>>>
>>> This patch fixes ip_pipeline panic in app_init_core_map while preparing cpu 
>>> core map in powerpc with SMT off. cpu_core_map_compute_linux currently 
>>> prepares core mapping based on file existence in sysfs ie.
>>>
>>> /

[dpdk-dev] [PATCH v5 8/8] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-08-12 Thread Gowrishankar Muthukrishnan
This patch fixes ip_pipeline panic in app_init_core_map while preparing cpu
core map in powerpc with SMT off. cpu_core_map_compute_linux currently prepares
core mapping based on file existence in sysfs ie.

/sys/devices/system/cpu/cpu/topology/physical_package_id
  /sys/devices/system/cpu/cpu/topology/core_id

These files do not exist for lcores which are offline for any reason (as in
powerpc, while SMT is off). In this situation, this function should further
continue preparing map for other online lcores instead of returning with -1
for a first unavailable lcore.

Also, in SMT=off scenario for powerpc, lcore ids can not be always indexed from
0 upto 'number of cores present' (/sys/devices/system/cpu/present). For eg, for
an online lcore 32, core_id returned in sysfs is 112 where online lcores are
10 (as in one configuration), hence sysfs lcore id can not be checked with
indexing lcore number before positioning lcore map array.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 examples/ip_pipeline/cpu_core_map.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/examples/ip_pipeline/cpu_core_map.c 
b/examples/ip_pipeline/cpu_core_map.c
index cb088b1..dd8f678 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -351,8 +351,10 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
int lcore_socket_id =
cpu_core_map_get_socket_id_linux(lcore_id);

+#if !defined(RTE_ARCH_PPC_64)
if (lcore_socket_id < 0)
return -1;
+#endif

if (((uint32_t) lcore_socket_id) == socket_id)
n_detected++;
@@ -368,6 +370,7 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
cpu_core_map_get_socket_id_linux(
lcore_id);

+#if !defined(RTE_ARCH_PPC_64)
if (lcore_socket_id < 0)
return -1;

@@ -377,9 +380,14 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)

if (lcore_core_id < 0)
return -1;
+#endif

+#if !defined(RTE_ARCH_PPC_64)
if (((uint32_t) lcore_socket_id == socket_id) &&
((uint32_t) lcore_core_id == core_id)) {
+#else
+   if (((uint32_t) lcore_socket_id == socket_id)) {
+#endif
uint32_t pos = cpu_core_map_pos(map,
socket_id,
core_id_contig,
-- 
1.9.1



[dpdk-dev] [PATCH v5 7/8] pipeline: enable pipeline library for ppc64le

2016-08-12 Thread Gowrishankar Muthukrishnan
This patch enables librte_pipeline for ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 1fc8df2..f953e61 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -56,5 +56,3 @@ CONFIG_RTE_LIBRTE_PMD_BOND=n
 CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

-# This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v5 6/8] port: enable port library for ppc64le

2016-08-12 Thread Gowrishankar Muthukrishnan
This patch enables librte_port in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 0c7060f..1fc8df2 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,5 +57,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v5 5/8] sched: enable sched library for ppc64le

2016-08-12 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch enables librte_sched in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 41f67d5..0c7060f 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,6 +57,5 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v5 4/8] table: enable table library for ppc64le

2016-08-12 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch enables librte_table in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index dede34f..41f67d5 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -59,5 +59,4 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
 # This following libraries are not available on Power. So they're turned off.
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
-CONFIG_RTE_LIBRTE_TABLE=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
-- 
1.9.1



[dpdk-dev] [PATCH v5 3/8] l3fwd: add altivec support for em_hash_key

2016-08-12 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for em_mask_key function.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 examples/l3fwd/l3fwd_em.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index def5a02..6053a62 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -259,8 +259,16 @@ em_mask_key(void *key, xmm_t mask)

return vandq_s32(data, mask);
 }
+#elif defined(RTE_MACHINE_CPUFLAG_ALTIVEC)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   xmm_t data = vec_ld(0, (xmm_t *)(key));
+
+   return vec_and(data, mask);
+}
 #else
-#error No vector engine (SSE, NEON) available, check your toolchain
+#error No vector engine (SSE, NEON, ALTIVEC) available, check your toolchain
 #endif

 static inline uint8_t
-- 
1.9.1



[dpdk-dev] [PATCH v5 2/8] acl: add altivec intrinsics for dpdk acl on ppc_64

2016-08-12 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds port for ACL library in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 app/test-acl/main.c |   4 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 -
 lib/librte_acl/Makefile |   2 +
 lib/librte_acl/acl.h|   4 +
 lib/librte_acl/acl_run.h|   2 +
 lib/librte_acl/acl_run_altivec.c|  47 
 lib/librte_acl/acl_run_altivec.h| 329 
 lib/librte_acl/rte_acl.c|  13 ++
 lib/librte_acl/rte_acl.h|   1 +
 9 files changed, 402 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index d366981..1b2b176 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -105,6 +105,10 @@ static const struct acl_alg acl_alg[] = {
.name = "neon",
.alg = RTE_ACL_CLASSIFY_NEON,
},
+   {
+   .name = "altivec",
+   .alg = RTE_ACL_CLASSIFY_ALTIVEC,
+   },
 };

 static struct {
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 9ddf3c5..dede34f 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_TABLE=n
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 9803e9d..d05be66 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -52,6 +52,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
 ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) $(CONFIG_RTE_ARCH_ARM64)),)
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
 CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
+else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_altivec.c
 else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
 #check if flag for SSE4.1 is already on, if not set it up manually
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 09d6784..6664a55 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -234,6 +234,10 @@ int
 rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index b2fc42c..024f393 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -39,7 +39,9 @@

 #define MAX_SEARCHES_AVX16 16
 #define MAX_SEARCHES_SSE8  8
+#define MAX_SEARCHES_ALTIVEC8  8
 #define MAX_SEARCHES_SSE4  4
+#define MAX_SEARCHES_ALTIVEC4  4
 #define MAX_SEARCHES_SCALAR2

 #define GET_NEXT_4BYTES(prm, idx)  \
diff --git a/lib/librte_acl/acl_run_altivec.c b/lib/librte_acl/acl_run_altivec.c
new file mode 100644
index 000..3523526
--- /dev/null
+++ b/lib/librte_acl/acl_run_altivec.c
@@ -0,0 +1,47 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON AN

[dpdk-dev] [PATCH v5 1/8] lpm: add altivec intrinsics for dpdk lpm on ppc_64

2016-08-12 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for LPM library in DPDK.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 app/test/test_xmmt_ops.h   |  16 +++
 config/defconfig_ppc_64-power8-linuxapp-gcc|   1 -
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 +
 6 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
index de9c16f..42174d2 100644
--- a/app/test/test_xmmt_ops.h
+++ b/app/test/test_xmmt_ops.h
@@ -62,6 +62,22 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
 /* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
 #define vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0)

+#elif defined(RTE_ARCH_PPC_64)
+
+/* vect_* abstraction implementation using ALTIVEC */
+
+/* loads the xmm_t value from address p(does not need to be 16-byte aligned)*/
+#define vect_loadu_sil128(p) vec_ld(0, p)
+
+/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
+static inline xmm_t  __attribute__((always_inline))
+vect_set_epi32(int i3, int i2, int i1, int i0)
+{
+   xmm_t data = (xmm_t){i0, i1, i2, i3};
+
+   return data;
+}
+
 #endif

 #endif /* _TEST_XMMT_OPS_H_ */
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index bef8f49..9ddf3c5 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
new file mode 100644
index 000..05209e5
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
@@ -0,0 +1,60 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of IBM Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_PPC_64_H_
+#define _RTE_VECT_PPC_64_H_
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef vector signed int xmm_t;
+
+#defineXMM_SIZE(sizeof(xmm_t))
+#defineXMM_MASK(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+   xmm_tx;
+   uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];
+   uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+   uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+   uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+   double   pd[XMM_SIZE / sizeof(double)];
+} __attribute__((aligned(16))) rte_xmm_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_PPC_64_H_ */
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 656ade2..3dc549d 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -51,6 +51,8 @@ ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) 
$(CONFIG_RTE_ARCH_ARM64)),)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include +=

[dpdk-dev] [PATCH v5 0/8] enable lpm, acl and other missing libraries in ppc64le

2016-08-12 Thread Gowrishankar Muthukrishnan
This patchset enables LPM, ACL and other few missing libs in ppc64le and also
address few patches in related examples (ip_pipeline and l3fwd).

Test report:
1. LPM and ACL unit tests passed.
   Steps:
   compile test app and run (with any needed params)
   lpm_autotest
   acl_autotest

2. Example ip_pipeline application verified for port forwarding.
   compile examples/ip_pipeline (adjust app_init_core_map
 param for ht to 1 in case of ppc64le in SMT=off mode).
   modify config/l3fwd.cfg as per enabled PMD ports.
   run ip_pipeline with config file option and check packets fwd.

v5 changes:
- no change in lpm lib enablement
- no change in acl lib enablement
- config file changes individually for sched,table,port,pipeline
  lib enablement
- ip_pipeline patch description and changes flagged only for ppc64le.
   app_init_core_map changes removed (due to bug found and under 
   investigation only on ppc64le/smt=off case).

v4 changes:
- fix transition4 in acl_run_altivec.h for gcc strict-aliasing error.
  Thanks to Chao Zhu for bringing up.

v3 changes:
- rebase over master to fix conflict in examples/l3fwd/l3fwd_em.c

v2 changes:
- enabling libs in config included as part of lib changes itself.

Gowrishankar Muthukrishnan (3):
  port: enable port library for ppc64le
  pipeline: enable pipeline library for ppc64le
  ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

gowrishankar (5):
  lpm: add altivec intrinsics for dpdk lpm on ppc_64
  acl: add altivec intrinsics for dpdk acl on ppc_64
  l3fwd: add altivec support for em_hash_key
  table: enable table library for ppc64le
  sched: enable sched library for ppc64le

 app/test-acl/main.c|   4 +
 app/test/test_xmmt_ops.h   |  16 +
 config/defconfig_ppc_64-power8-linuxapp-gcc|   7 -
 examples/ip_pipeline/cpu_core_map.c|   8 +
 examples/l3fwd/l3fwd_em.c  |  10 +-
 lib/librte_acl/Makefile|   2 +
 lib/librte_acl/acl.h   |   4 +
 lib/librte_acl/acl_run.h   |   2 +
 lib/librte_acl/acl_run_altivec.c   |  47 +++
 lib/librte_acl/acl_run_altivec.h   | 329 +
 lib/librte_acl/rte_acl.c   |  13 +
 lib/librte_acl/rte_acl.h   |   1 +
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 ++
 16 files changed, 653 insertions(+), 8 deletions(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

-- 
1.9.1



[dpdk-dev] [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-08-12 Thread gowrishankar muthukrishnan
On Friday 12 August 2016 03:45 PM, Chao Zhu wrote:
> Another comment is, comment out lcore_socket_id check will influence other 
> architectures. If possible, I would like to make this change to Power 
> specific.

Hi Chao,
I am revisiting cpu_core_map_init() fn. I realize, all we handle is max 
values of socket/core/ht.
So, ideally the function should not break in any arch.

In my quick test w/o adjusting prev max values (4,32,4,0), only for ht > 
1, creating cpu map panics
in ppc i.e (4,32,1,0) is able to create core map and app runs. I 
continue to debug this and fix
this example app separately.

So, I will be sending powerpc specific enablement of lpm,acl,port,table 
and sched in v5.
Example ip_pipeline will be fixed in separate patch.

Thanks,
Gowrishankar
> -Original Message-
> From: gowrishankar muthukrishnan [mailto:gowrishankar.m at linux.vnet.ibm.com]
> Sent: 2016?8?12? 17:00
> To: Chao Zhu 
> Cc: dev at dpdk.org; 'Bruce Richardson' ; 
> 'Konstantin Ananyev' ; 'Thomas Monjalon' 
> ; 'Cristian Dumitrescu'  intel.com>; 'Pradeep' 
> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT 
> threads as in ppc64
>
> On Friday 12 August 2016 02:14 PM, Chao Zhu wrote:
>> Gowrishankar,
>>
>> I suggest to set the following value:
>>
>> n_max_cores_per_socket = 8
>> n_max_ht_per_core = 8
>>
>> This will cover most of the Power8 servers.
>> Any comments?
> Sure Chao. I will include this change in v5. If there are no other comments, 
> I can spin out v5, with changes in this patch.
>
> Regards,
> Gowrishankar
>> -Original Message-
>> From: gowrishankar muthukrishnan
>> [mailto:gowrishankar.m at linux.vnet.ibm.com]
>> Sent: 2016?8?11? 20:02
>> To: Chao Zhu 
>> Cc: dev at dpdk.org; 'Bruce Richardson' ;
>> 'Konstantin Ananyev' ; 'Thomas Monjalon'
>> ; 'Cristian Dumitrescu'
>> ; 'Pradeep' 
>> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying
>> SMT threads as in ppc64
>>
>> On Thursday 11 August 2016 03:59 PM, Chao Zhu wrote:
>>> Gowrishankar,
>>>
>>> Thanks for the detail.
>>> If my understanding is correct, Power8 has different chips. Some of the 
>>> OpenPOWER chips have 8 cores per socket. And the max threads per core is 8. 
>>> Should we support this in cpu_core_map_init()?
>>>
>>> Here's a dump from the OpenPOWER system.
>>> ==
>>> # lscpu
>>> Architecture:  ppc64le
>>> Byte Order:Little Endian
>>> CPU(s):64
>>> On-line CPU(s) list:   0,8,16,24,32,40,48,56
>>> Off-line CPU(s) list:  1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63
>>> Thread(s) per core:1
>>> Core(s) per socket:8
>>> Socket(s): 1
>>> NUMA node(s):  1
>>> Model: unknown
>>> L1d cache: 64K
>>> L1i cache: 32K
>>> L2 cache:  512K
>>> L3 cache:  8192K
>>> NUMA node0 CPU(s): 0,8,16,24,32,40,48,56
>>> =
>>>
>>>
>>>> +#if defined(RTE_ARCH_PPC_64)
>>>> +  app->core_map = cpu_core_map_init(2, 5, 1, 0); #else
>>>>
>>>> This value seems quite strange. Can you give more detail?
>> Based on config of tested server (as below output),
>>
>> CPU(s):80
>> On-line CPU(s) list:   0,8,16,24,32,40,48,56,64,72
>> Off-line CPU(s) list:
>> 1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63,65-71,73-79
>> Thread(s) per core:1  <<<
>> Core(s) per socket:5   <<<
>> Socket(s): 2   <<<
>> NUMA node(s):  2
>>
>> cpu_core_map_init parameters (2,5,1,0) were prepared. Instead, we can cap 
>> max sockets/core/ht counts to possible maximum supported today.
>>
>> Regards,
>> Gowrishankar
>>>>app->core_map = cpu_core_map_init(4, 32, 4, 0);
>>>> +#endif
>>> -Original Message-
>>> From: gowrishankar muthukrishnan
>>> [mailto:gowrishankar.m at linux.vnet.ibm.com]
>>> Sent: 2016?8?9? 19:14
>>> To: Chao Zhu ; dev at dpdk.org
>>> Cc: 'Bruce Richardson' ; 'Konstantin
>>> Ananyev' ; 'Thomas Monjalon'
>>> ; 'Cristian Dumitrescu'
>>> ; 'Pradeep' 
>>> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for
>>> varying SMT threads as in ppc64
>>>
>>> Hi Chao,
>>> Sure. Please find below one.
>>>

[dpdk-dev] [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-08-12 Thread gowrishankar muthukrishnan
On Friday 12 August 2016 02:14 PM, Chao Zhu wrote:
> Gowrishankar,
>
> I suggest to set the following value:
>
> n_max_cores_per_socket = 8
> n_max_ht_per_core = 8
>
> This will cover most of the Power8 servers.
> Any comments?
Sure Chao. I will include this change in v5. If there are no other comments,
I can spin out v5, with changes in this patch.

Regards,
Gowrishankar
>
> -----Original Message-
> From: gowrishankar muthukrishnan [mailto:gowrishankar.m at linux.vnet.ibm.com]
> Sent: 2016?8?11? 20:02
> To: Chao Zhu 
> Cc: dev at dpdk.org; 'Bruce Richardson' ; 
> 'Konstantin Ananyev' ; 'Thomas Monjalon' 
> ; 'Cristian Dumitrescu'  intel.com>; 'Pradeep' 
> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT 
> threads as in ppc64
>
> On Thursday 11 August 2016 03:59 PM, Chao Zhu wrote:
>> Gowrishankar,
>>
>> Thanks for the detail.
>> If my understanding is correct, Power8 has different chips. Some of the 
>> OpenPOWER chips have 8 cores per socket. And the max threads per core is 8. 
>> Should we support this in cpu_core_map_init()?
>>
>> Here's a dump from the OpenPOWER system.
>> ==
>> # lscpu
>> Architecture:  ppc64le
>> Byte Order:Little Endian
>> CPU(s):64
>> On-line CPU(s) list:   0,8,16,24,32,40,48,56
>> Off-line CPU(s) list:  1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63
>> Thread(s) per core:1
>> Core(s) per socket:8
>> Socket(s): 1
>> NUMA node(s):  1
>> Model: unknown
>> L1d cache: 64K
>> L1i cache: 32K
>> L2 cache:  512K
>> L3 cache:  8192K
>> NUMA node0 CPU(s): 0,8,16,24,32,40,48,56
>> =
>>
>>
>>> +#if defined(RTE_ARCH_PPC_64)
>>> +   app->core_map = cpu_core_map_init(2, 5, 1, 0); #else
>>>
>>> This value seems quite strange. Can you give more detail?
> Based on config of tested server (as below output),
>
> CPU(s):80
> On-line CPU(s) list:   0,8,16,24,32,40,48,56,64,72
> Off-line CPU(s) list:
> 1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63,65-71,73-79
> Thread(s) per core:1  <<<
> Core(s) per socket:5   <<<
> Socket(s): 2   <<<
> NUMA node(s):  2
>
> cpu_core_map_init parameters (2,5,1,0) were prepared. Instead, we can cap max 
> sockets/core/ht counts to possible maximum supported today.
>
> Regards,
> Gowrishankar
>>> app->core_map = cpu_core_map_init(4, 32, 4, 0);
>>> +#endif
>> -Original Message-
>> From: gowrishankar muthukrishnan
>> [mailto:gowrishankar.m at linux.vnet.ibm.com]
>> Sent: 2016?8?9? 19:14
>> To: Chao Zhu ; dev at dpdk.org
>> Cc: 'Bruce Richardson' ; 'Konstantin
>> Ananyev' ; 'Thomas Monjalon'
>> ; 'Cristian Dumitrescu'
>> ; 'Pradeep' 
>> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying
>> SMT threads as in ppc64
>>
>> Hi Chao,
>> Sure. Please find below one.
>>
>> This patch fixes ip_pipeline panic in app_init_core_map while preparing cpu 
>> core map in powerpc with SMT off. cpu_core_map_compute_linux currently 
>> prepares core mapping based on file existence in sysfs ie.
>>
>> /sys/devices/system/cpu/cpu/topology/physical_package_id
>>  /sys/devices/system/cpu/cpu/topology/core_id
>>
>> These files do not exist for lcores which are offline for any reason (as in 
>> powerpc, while SMT is off). In this situation, this function should further 
>> continue preparing map for other online lcores instead of returning with -1 
>> for a first unavailable lcore.
>>
>> Also, in SMT=off scenario for powerpc, lcore ids can not be always
>> indexed from
>> 0 upto 'number of cores present' (/sys/devices/system/cpu/present).
>> For eg, for an online lcore 32, core_id returned in sysfs is 112 where
>> online lcores are
>> 10 (as in one configuration), hence sysfs lcore id can not be checked with 
>> indexing lcore number before positioning lcore map array.
>>
>> Thanks,
>> Gowrishankar
>>
>> On Tuesday 09 August 2016 02:37 PM, Chao Zhu wrote:
>>> Gowrishankar,
>>>
>>> Can you give more description about this patch?
>>> Thank you!
>>>
>>> -Original Message-
>>> From: Gowrishankar Muthukrishnan
>>> [mailto:gowrishankar.m at linux.vnet.ibm.com]
>>> Sent: 2016?8?6? 20:33
>>> To:

[dpdk-dev] [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-08-11 Thread gowrishankar muthukrishnan
On Thursday 11 August 2016 03:59 PM, Chao Zhu wrote:
> Gowrishankar,
>
> Thanks for the detail.
> If my understanding is correct, Power8 has different chips. Some of the 
> OpenPOWER chips have 8 cores per socket. And the max threads per core is 8. 
> Should we support this in cpu_core_map_init()?
>
> Here's a dump from the OpenPOWER system.
> ==
> # lscpu
> Architecture:  ppc64le
> Byte Order:Little Endian
> CPU(s):64
> On-line CPU(s) list:   0,8,16,24,32,40,48,56
> Off-line CPU(s) list:  1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63
> Thread(s) per core:1
> Core(s) per socket:8
> Socket(s): 1
> NUMA node(s):  1
> Model: unknown
> L1d cache: 64K
> L1i cache: 32K
> L2 cache:  512K
> L3 cache:  8192K
> NUMA node0 CPU(s): 0,8,16,24,32,40,48,56
> =
>
>
>> +#if defined(RTE_ARCH_PPC_64)
>> +app->core_map = cpu_core_map_init(2, 5, 1, 0); #else
>>
>> This value seems quite strange. Can you give more detail?

Based on config of tested server (as below output),

CPU(s):80
On-line CPU(s) list:   0,8,16,24,32,40,48,56,64,72
Off-line CPU(s) list: 
1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63,65-71,73-79
Thread(s) per core:1  <<<
Core(s) per socket:5   <<<
Socket(s): 2   <<<
NUMA node(s):  2

cpu_core_map_init parameters (2,5,1,0) were prepared. Instead, we can 
cap max sockets/core/ht
counts to possible maximum supported today.

Regards,
Gowrishankar
>>
>>  app->core_map = cpu_core_map_init(4, 32, 4, 0);
>> +#endif
>
> -Original Message-
> From: gowrishankar muthukrishnan [mailto:gowrishankar.m at linux.vnet.ibm.com]
> Sent: 2016?8?9? 19:14
> To: Chao Zhu ; dev at dpdk.org
> Cc: 'Bruce Richardson' ; 'Konstantin Ananyev' 
> ; 'Thomas Monjalon'  6wind.com>; 'Cristian Dumitrescu' ; 
> 'Pradeep' 
> Subject: Re: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT 
> threads as in ppc64
>
> Hi Chao,
> Sure. Please find below one.
>
> This patch fixes ip_pipeline panic in app_init_core_map while preparing cpu 
> core map in powerpc with SMT off. cpu_core_map_compute_linux currently 
> prepares core mapping based on file existence in sysfs ie.
>
> /sys/devices/system/cpu/cpu/topology/physical_package_id
> /sys/devices/system/cpu/cpu/topology/core_id
>
> These files do not exist for lcores which are offline for any reason (as in 
> powerpc, while SMT is off). In this situation, this function should further 
> continue preparing map for other online lcores instead of returning with -1 
> for a first unavailable lcore.
>
> Also, in SMT=off scenario for powerpc, lcore ids can not be always indexed 
> from
> 0 upto 'number of cores present' (/sys/devices/system/cpu/present). For eg, 
> for an online lcore 32, core_id returned in sysfs is 112 where online lcores 
> are
> 10 (as in one configuration), hence sysfs lcore id can not be checked with 
> indexing lcore number before positioning lcore map array.
>
> Thanks,
> Gowrishankar
>
> On Tuesday 09 August 2016 02:37 PM, Chao Zhu wrote:
>> Gowrishankar,
>>
>> Can you give more description about this patch?
>> Thank you!
>>
>> -Original Message-
>> From: Gowrishankar Muthukrishnan
>> [mailto:gowrishankar.m at linux.vnet.ibm.com]
>> Sent: 2016?8?6? 20:33
>> To: dev at dpdk.org
>> Cc: Chao Zhu ; Bruce Richardson
>> ; Konstantin Ananyev
>> ; Thomas Monjalon
>> ; Cristian Dumitrescu
>> ; Pradeep ;
>> gowrishankar 
>> Subject: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT
>> threads as in ppc64
>>
>> From: gowrishankar 
>>
>> offline lcore would still refer to original core id and this has to be
>> considered while creating cpu core mask.
>>
>> Signed-off-by: Gowrishankar 
>> ---
>>config/defconfig_ppc_64-power8-linuxapp-gcc |  3 ---
>>examples/ip_pipeline/cpu_core_map.c | 12 +---
>>examples/ip_pipeline/init.c |  4 
>>3 files changed, 5 insertions(+), 14 deletions(-)
>>
>> diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc
>> b/config/defconfig_ppc_64-power8-linuxapp-gcc
>> index dede34f..a084672 100644
>> --- a/config/defconfig_ppc_64-power8-linuxapp-gcc
>> +++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
>> @@ -58,6 +58,3 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
>>
>># This following libraries are

[dpdk-dev] [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-08-09 Thread gowrishankar muthukrishnan
Hi Chao,
Sure. Please find below one.

This patch fixes ip_pipeline panic in app_init_core_map while preparing cpu
core map in powerpc with SMT off. cpu_core_map_compute_linux currently 
prepares
core mapping based on file existence in sysfs ie.

/sys/devices/system/cpu/cpu/topology/physical_package_id
   /sys/devices/system/cpu/cpu/topology/core_id

These files do not exist for lcores which are offline for any reason (as in
powerpc, while SMT is off). In this situation, this function should further
continue preparing map for other online lcores instead of returning with -1
for a first unavailable lcore.

Also, in SMT=off scenario for powerpc, lcore ids can not be always 
indexed from
0 upto 'number of cores present' (/sys/devices/system/cpu/present). For 
eg, for
an online lcore 32, core_id returned in sysfs is 112 where online lcores are
10 (as in one configuration), hence sysfs lcore id can not be checked with
indexing lcore number before positioning lcore map array.

Thanks,
Gowrishankar

On Tuesday 09 August 2016 02:37 PM, Chao Zhu wrote:
> Gowrishankar,
>
> Can you give more description about this patch?
> Thank you!
>
> -Original Message-
> From: Gowrishankar Muthukrishnan [mailto:gowrishankar.m at linux.vnet.ibm.com]
> Sent: 2016?8?6? 20:33
> To: dev at dpdk.org
> Cc: Chao Zhu ; Bruce Richardson
> ; Konstantin Ananyev
> ; Thomas Monjalon  6wind.com>;
> Cristian Dumitrescu ; Pradeep
> ; gowrishankar 
> Subject: [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT
> threads as in ppc64
>
> From: gowrishankar 
>
> offline lcore would still refer to original core id and this has to be
> considered while creating cpu core mask.
>
> Signed-off-by: Gowrishankar 
> ---
>   config/defconfig_ppc_64-power8-linuxapp-gcc |  3 ---
>   examples/ip_pipeline/cpu_core_map.c | 12 +---
>   examples/ip_pipeline/init.c |  4 
>   3 files changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc
> b/config/defconfig_ppc_64-power8-linuxapp-gcc
> index dede34f..a084672 100644
> --- a/config/defconfig_ppc_64-power8-linuxapp-gcc
> +++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
> @@ -58,6 +58,3 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
>
>   # This following libraries are not available on Power. So they're turned
> off.
>   CONFIG_RTE_LIBRTE_SCHED=n
> -CONFIG_RTE_LIBRTE_PORT=n
> -CONFIG_RTE_LIBRTE_TABLE=n
> -CONFIG_RTE_LIBRTE_PIPELINE=n
> diff --git a/examples/ip_pipeline/cpu_core_map.c
> b/examples/ip_pipeline/cpu_core_map.c
> index cb088b1..482e68e 100644
> --- a/examples/ip_pipeline/cpu_core_map.c
> +++ b/examples/ip_pipeline/cpu_core_map.c
> @@ -351,9 +351,6 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
>   int lcore_socket_id =
>   cpu_core_map_get_socket_id_linux(lcore_id);
>
> - if (lcore_socket_id < 0)
> - return -1;
> -
>   if (((uint32_t) lcore_socket_id) == socket_id)
>   n_detected++;
>   }
> @@ -368,18 +365,11 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
>   cpu_core_map_get_socket_id_linux(
>   lcore_id);
>
> - if (lcore_socket_id < 0)
> - return -1;
> -
> Why to remove the lcore_socket_id check?
>
>   int lcore_core_id =
>   cpu_core_map_get_core_id_linux(
>   lcore_id);
>
> - if (lcore_core_id < 0)
> - return -1;
> -
> - if (((uint32_t) lcore_socket_id ==
> socket_id) &&
> - ((uint32_t) lcore_core_id ==
> core_id)) {
> + if ((uint32_t) lcore_socket_id == socket_id)
> {
>   uint32_t pos = cpu_core_map_pos(map,
>   socket_id,
>   core_id_contig,
> diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index
> cd167f6..60c931f 100644
> --- a/examples/ip_pipeline/init.c
> +++ b/examples/ip_pipeline/init.c
> @@ -61,7 +61,11 @@ static void
>   app_init_core_map(struct app_params *app)  {
>   APP_LOG(app, HIGH, "Initializing CPU core map ...");
> +#if defined(RTE_ARCH_PPC_64)
> + app->core_map = cpu_core_map_init(2, 5, 1, 0); #else
>
> This value seems quite strange. Can you give more detail?
>
>   app->core_map = cpu_core_map_init(4, 32, 4, 0);
> +#endif
>
>   if (app->core_map == NULL)
>   rte_panic("Cannot create CPU core map\n");
> --
> 1.9.1
>
>
>




[dpdk-dev] [PATCH v4 6/6] l3fwd: add altivec support for em_hash_key

2016-08-06 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for em_mask_key function.

Signed-off-by: Gowrishankar 
---
 examples/l3fwd/l3fwd_em.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index def5a02..6053a62 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -259,8 +259,16 @@ em_mask_key(void *key, xmm_t mask)

return vandq_s32(data, mask);
 }
+#elif defined(RTE_MACHINE_CPUFLAG_ALTIVEC)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   xmm_t data = vec_ld(0, (xmm_t *)(key));
+
+   return vec_and(data, mask);
+}
 #else
-#error No vector engine (SSE, NEON) available, check your toolchain
+#error No vector engine (SSE, NEON, ALTIVEC) available, check your toolchain
 #endif

 static inline uint8_t
-- 
1.9.1



[dpdk-dev] [PATCH v4 5/6] sched: enable sched library for ppc64le

2016-08-06 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch enables librte_sched in ppc64le.

Signed-off-by: Gowrishankar 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index a084672..f953e61 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -56,5 +56,3 @@ CONFIG_RTE_LIBRTE_PMD_BOND=n
 CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

-# This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_SCHED=n
-- 
1.9.1



[dpdk-dev] [PATCH v4 4/6] table: cache align rte_bucket_4_8

2016-08-06 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

Align rte_bucket_4_8 for cache line.

Signed-off-by: Gowrishankar 
---
 lib/librte_table/rte_table_hash_key8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_table/rte_table_hash_key8.c 
b/lib/librte_table/rte_table_hash_key8.c
index e2e2bdc..4d5e0cd 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -68,7 +68,7 @@ struct rte_bucket_4_8 {
uint64_t key[4];

/* Cache line 1 */
-   uint8_t data[0];
+   uint8_t data[0] __rte_cache_aligned;
 };

 struct rte_table_hash {
-- 
1.9.1



[dpdk-dev] [PATCH v4 3/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-08-06 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

offline lcore would still refer to original core id and this has to
be considered while creating cpu core mask.

Signed-off-by: Gowrishankar 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc |  3 ---
 examples/ip_pipeline/cpu_core_map.c | 12 +---
 examples/ip_pipeline/init.c |  4 
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index dede34f..a084672 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -58,6 +58,3 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
 CONFIG_RTE_LIBRTE_SCHED=n
-CONFIG_RTE_LIBRTE_PORT=n
-CONFIG_RTE_LIBRTE_TABLE=n
-CONFIG_RTE_LIBRTE_PIPELINE=n
diff --git a/examples/ip_pipeline/cpu_core_map.c 
b/examples/ip_pipeline/cpu_core_map.c
index cb088b1..482e68e 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -351,9 +351,6 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
int lcore_socket_id =
cpu_core_map_get_socket_id_linux(lcore_id);

-   if (lcore_socket_id < 0)
-   return -1;
-
if (((uint32_t) lcore_socket_id) == socket_id)
n_detected++;
}
@@ -368,18 +365,11 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
cpu_core_map_get_socket_id_linux(
lcore_id);

-   if (lcore_socket_id < 0)
-   return -1;
-
int lcore_core_id =
cpu_core_map_get_core_id_linux(
lcore_id);

-   if (lcore_core_id < 0)
-   return -1;
-
-   if (((uint32_t) lcore_socket_id == socket_id) &&
-   ((uint32_t) lcore_core_id == core_id)) {
+   if ((uint32_t) lcore_socket_id == socket_id) {
uint32_t pos = cpu_core_map_pos(map,
socket_id,
core_id_contig,
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..60c931f 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -61,7 +61,11 @@ static void
 app_init_core_map(struct app_params *app)
 {
APP_LOG(app, HIGH, "Initializing CPU core map ...");
+#if defined(RTE_ARCH_PPC_64)
+   app->core_map = cpu_core_map_init(2, 5, 1, 0);
+#else
app->core_map = cpu_core_map_init(4, 32, 4, 0);
+#endif

if (app->core_map == NULL)
rte_panic("Cannot create CPU core map\n");
-- 
1.9.1



[dpdk-dev] [PATCH v4 2/6] acl: add altivec intrinsics for dpdk acl on ppc_64

2016-08-06 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds port for ACL library in ppc64le.

Signed-off-by: Gowrishankar 
---
 app/test-acl/main.c |   4 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 -
 lib/librte_acl/Makefile |   2 +
 lib/librte_acl/acl.h|   4 +
 lib/librte_acl/acl_run.h|   2 +
 lib/librte_acl/acl_run_altivec.c|  47 
 lib/librte_acl/acl_run_altivec.h| 329 
 lib/librte_acl/rte_acl.c|  13 ++
 lib/librte_acl/rte_acl.h|   1 +
 9 files changed, 402 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index d366981..1b2b176 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -105,6 +105,10 @@ static const struct acl_alg acl_alg[] = {
.name = "neon",
.alg = RTE_ACL_CLASSIFY_NEON,
},
+   {
+   .name = "altivec",
+   .alg = RTE_ACL_CLASSIFY_ALTIVEC,
+   },
 };

 static struct {
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 9ddf3c5..dede34f 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_TABLE=n
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 9803e9d..d05be66 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -52,6 +52,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
 ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) $(CONFIG_RTE_ARCH_ARM64)),)
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
 CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
+else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_altivec.c
 else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
 #check if flag for SSE4.1 is already on, if not set it up manually
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 09d6784..6664a55 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -234,6 +234,10 @@ int
 rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index b2fc42c..024f393 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -39,7 +39,9 @@

 #define MAX_SEARCHES_AVX16 16
 #define MAX_SEARCHES_SSE8  8
+#define MAX_SEARCHES_ALTIVEC8  8
 #define MAX_SEARCHES_SSE4  4
+#define MAX_SEARCHES_ALTIVEC4  4
 #define MAX_SEARCHES_SCALAR2

 #define GET_NEXT_4BYTES(prm, idx)  \
diff --git a/lib/librte_acl/acl_run_altivec.c b/lib/librte_acl/acl_run_altivec.c
new file mode 100644
index 000..3523526
--- /dev/null
+++ b/lib/librte_acl/acl_run_altivec.c
@@ -0,0 +1,47 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LI

[dpdk-dev] [PATCH v4 1/6] lpm: add altivec intrinsics for dpdk lpm on ppc_64

2016-08-06 Thread Gowrishankar Muthukrishnan
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for LPM library in DPDK.

Signed-off-by: Gowrishankar 
---
 app/test/test_xmmt_ops.h   |  16 +++
 config/defconfig_ppc_64-power8-linuxapp-gcc|   1 -
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 +
 6 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
index de9c16f..42174d2 100644
--- a/app/test/test_xmmt_ops.h
+++ b/app/test/test_xmmt_ops.h
@@ -62,6 +62,22 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
 /* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
 #define vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0)

+#elif defined(RTE_ARCH_PPC_64)
+
+/* vect_* abstraction implementation using ALTIVEC */
+
+/* loads the xmm_t value from address p(does not need to be 16-byte aligned)*/
+#define vect_loadu_sil128(p) vec_ld(0, p)
+
+/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
+static inline xmm_t  __attribute__((always_inline))
+vect_set_epi32(int i3, int i2, int i1, int i0)
+{
+   xmm_t data = (xmm_t){i0, i1, i2, i3};
+
+   return data;
+}
+
 #endif

 #endif /* _TEST_XMMT_OPS_H_ */
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index bef8f49..9ddf3c5 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
new file mode 100644
index 000..05209e5
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
@@ -0,0 +1,60 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of IBM Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_PPC_64_H_
+#define _RTE_VECT_PPC_64_H_
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef vector signed int xmm_t;
+
+#defineXMM_SIZE(sizeof(xmm_t))
+#defineXMM_MASK(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+   xmm_tx;
+   uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];
+   uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+   uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+   uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+   double   pd[XMM_SIZE / sizeof(double)];
+} __attribute__((aligned(16))) rte_xmm_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_PPC_64_H_ */
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 656ade2..3dc549d 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -51,6 +51,8 @@ ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) 
$(CONFIG_RTE_ARCH_ARM64)),)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include +=

[dpdk-dev] [PATCH v4 0/6] enable lpm, acl and other missing libraries in ppc64le

2016-08-06 Thread Gowrishankar Muthukrishnan
This patchset enables LPM, ACL and other few missing libs in ppc64le and also
address few patches in related examples (ip_pipeline and l3fwd).

Test report:
LPM and ACL unit tests passed.

RTE>>acl_autotest 
ACL: allocation of 25166728 bytes on socket 33 for ACL_acl_ctx failed
ACL: rte_acl_add_rules(acl_ctx): rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_add_rules(acl_ctx): rule #1 is invalid
acl context @0x3effe07ffb80
  socket_id=-1
  alg=5
  max_rules=196608
  rule_size=128
  num_rules=0
  num_categories=0
  num_tries=0
acl context @0x3effe07ffb80
  socket_id=-1
  alg=5
  max_rules=196608
  rule_size=128
  num_rules=0
  num_categories=0
  num_tries=0
running test_convert_rules(acl_ipv4vlan_tuple)
running test_convert_rules(acl_ipv4vlan_tuple, RTE_ACL_FIELD_TYPE_BITMASK type 
for IPv4)
running test_convert_rules(acl_ipv4vlan_tuple, RTE_ACL_FIELD_TYPE_RANGE type 
for IPv4)
running test_convert_rules(acl_ipv4vlan_tuple: swap VLAN and PORTs order)
running test_convert_rules(acl_ipv4vlan_tuple: swap SRC and DST IPv4 order)
Test OK
RTE>>lpm_autotest 
Test OK

v4 changes:
- fix transition4 in acl_run_altivec.h for gcc strict-aliasing error.
  Thanks to Chao Zhu for bringing up.

v3 changes:
- rebase over master to fix conflict in examples/l3fwd/l3fwd_em.c

v2 changes:
- enabling libs in config included as part of lib changes itself.

gowrishankar (6):
  lpm: add altivec intrinsics for dpdk lpm on ppc_64
  acl: add altivec intrinsics for dpdk acl on ppc_64
  ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64
  table: cache align rte_bucket_4_8
  sched: enable sched library for ppc64le
  l3fwd: add altivec support for em_hash_key

 app/test-acl/main.c|   4 +
 app/test/test_xmmt_ops.h   |  16 +
 config/defconfig_ppc_64-power8-linuxapp-gcc|   7 -
 examples/ip_pipeline/cpu_core_map.c|  12 +-
 examples/ip_pipeline/init.c|   4 +
 examples/l3fwd/l3fwd_em.c  |  10 +-
 lib/librte_acl/Makefile|   2 +
 lib/librte_acl/acl.h   |   4 +
 lib/librte_acl/acl_run.h   |   2 +
 lib/librte_acl/acl_run_altivec.c   |  47 +++
 lib/librte_acl/acl_run_altivec.h   | 329 +
 lib/librte_acl/rte_acl.c   |  13 +
 lib/librte_acl/rte_acl.h   |   1 +
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 ++
 lib/librte_table/rte_table_hash_key8.c |   2 +-
 18 files changed, 651 insertions(+), 20 deletions(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

-- 
1.9.1



[dpdk-dev] [PATCH v2 0/6] enable lpm, acl and other missing libraries in ppc64le

2016-07-18 Thread gowrishankar muthukrishnan
Hi Chao,
I just tried building dpdk master with these patches in ubuntu 16.04 le 
guest
and I could able to.

test at ubuntu:~/DPDK$ make install T=ppc_64-power8-linuxapp-gcc -j16

.
   INSTALL-MAP test.map
   INSTALL-APP test
Build complete [ppc_64-power8-linuxapp-gcc]
Installation cannot run with T defined and DESTDIR undefined
test at ubuntu:~/DPDK$ uname -a
Linux ubuntu 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:30:22 UTC 
2016 ppc64le ppc64le ppc64le GNU/Linux

test at ubuntu:~/DPDK$ gcc --version
gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609

May be you need to check gcc again.

Thanks,
Gowrishankar

On Monday 18 July 2016 02:24 PM, Chao Zhu wrote:
> Gowrishankar,
>
> I still get this error with the v3 patches. My OS is Ubuntu 16.04 LTS
> ppc64le. GCC version: Ubuntu/IBM 5.3.1-14ubuntu2
> Can you help to check again?
>
> In file included from
> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.c:34:0:
> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h: In function
> 'transition4':
> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h:198:2: error:
> dereferencing type-punned pointer will break strict-aliasing rules
> [-Werror=strict-aliasing]
>*indices1 = (xmm_t){((uint32_t *))[0], ((uint32_t *))[1],
>^
> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h:202:2: error:
> dereferencing type-punned pointer will break strict-aliasing rules
> [-Werror=strict-aliasing]
>*indices2 = (xmm_t){((uint32_t *))[0], ((uint32_t *))[1],
>    ^
>
>
>
> -Original Message-
> From: gowrishankar [mailto:gowrishankar.m at linux.vnet.ibm.com]
> Sent: 2016?7?16? 15:59
> To: Chao Zhu;dev at dpdk.org
> Cc: 'Bruce Richardson'; 'Konstantin Ananyev'
> ; 'Thomas Monjalon'
> ; 'Cristian Dumitrescu'
> ; 'Pradeep'
> Subject: Re: [PATCH v2 0/6] enable lpm, acl and other missing libraries in
> ppc64le
>
> Hi Chao,
> I did not face this error. Even I verified today with tip of master
> 6596554... .
> However I had patch conflict for examples/l3fwd/l3fwd_em.c which is fixed
> now and v3 patch set sent recently. Could you please check.
>
> Thanks,
> Gowrishankar
> On Friday 15 July 2016 08:45 AM, Chao Zhu wrote:
>> Gowrishankar,
>>
>> When I tried the patches, I got some compilation error:
>>
>> In file included from
>> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.c:34:0:
>> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h: In function
>> 'transition4':
>> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h:198:2: error:
>> dereferencing type-punned pointer will break strict-aliasing rules
>> [-Werror=strict-aliasing]
>> *indices1 = (xmm_t){((uint32_t *))[0], ((uint32_t *))[1],
>> ^
>> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h:202:2: error:
>> dereferencing type-punned pointer will break strict-aliasing rules
>> [-Werror=strict-aliasing]
>> *indices2 = (xmm_t){((uint32_t *))[0], ((uint32_t *))[1],
>>
>> Can you help to take a look?
>>
>>
>> -----Original Message-
>> From: Gowrishankar [mailto:gowrishankar.m at linux.vnet.ibm.com]
>> Sent: 2016?7?10? 15:51
>> To:dev at dpdk.org
>> Cc: Chao Zhu; Bruce Richardson
>> ; Konstantin Ananyev
>> ; Thomas Monjalon
>> ; Cristian Dumitrescu
>> ; Pradeep;
>> gowrishankar
>> Subject: [PATCH v2 0/6] enable lpm, acl and other missing libraries in
>> ppc64le
>>
>> From: gowrishankar
>>
>> This patchset enables LPM, ACL and other few missing libs in ppc64le
>> and also address few patches in related examples (ip_pipeline and l3fwd).
>>
>> Test report:
>> LPM and ACL unit tests verified as in patch set v1.
>> Same results as before observed.
>>
>> v2 changes:
>> - enabling libs in config included as part of lib changes itself.
>>
>> gowrishankar (6):
>> lpm: add altivec intrinsics for dpdk lpm on ppc_64
>> acl: add altivec intrinsics for dpdk acl on ppc_64
>> ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64
>> table: cache align rte_bucket_4_8
>> sched: enable sched library for ppc64le
>> l3fwd: add altivec support for em_hash_key
>>
>>app/test-acl/main.c|   4 +
>>app/test/test_xmmt_ops.h   |  16 +
>>config/defconfig_ppc_64-power8-linuxapp-gcc|   7 -
>>examples/ip_pipeline/cpu_core_map.c|  12 +-
>>examples/ip_pipeline/init.c|   4 +
>>examples/l3fwd/l3fwd_em.c  |   8 +
>>lib/librte_acl/Makefile|   2 +
>>

[dpdk-dev] librte_meter compilation fails on IBM Power8

2016-07-16 Thread gowrishankar
I remember I came across this problem some time back (not sure on which 
tip of
master), but certainly it is no more appearing now (atleast today tip 
65965546 ..)
Just an update.

Thanks,
Gowrishankar
On Friday 24 June 2016 03:19 PM, Chao Zhu wrote:
> I can repeat this problem by "export EXTRA_CFLAGS="-O0 -g"" on Power8. But
> I'm not sure why this happens. The "-O3 -g" option works properly. I'll
> investigate more.
>
> -Original Message-
> From: Dumitrescu, Cristian [mailto:cristian.dumitrescu at intel.com]
> Sent: 2016?6?24? 1:26
> To: N?lio Laranjeiro ; Chao Zhu  linux.
> vnet.ibm.com>
> Cc: dev at dpdk.org
> Subject: RE: librte_meter compilation fails on IBM Power8
>
>
>
>> -Original Message-
>> From: N?lio Laranjeiro [mailto:nelio.laranjeiro at 6wind.com]
>> Sent: Wednesday, June 22, 2016 1:31 PM
>> To: Dumitrescu, Cristian ; Chao Zhu
>> 
>> Cc: dev at dpdk.org
>> Subject: librte_meter compilation fails on IBM Power8
>>
>> Hi Cristian, Chao,
>>
>> I have encountered a compilation failure on IBM Power8 when compiling
>> master branch with EXTRA_CFLAGS='-O0 -g':
>>
>>/root/nl/dpdk.org/build/lib/librte_meter.a(rte_meter.o): In function
>> `rte_meter_get_tb_params':
>>/root/nl/dpdk.org/lib/librte_meter/rte_meter.c:57: undefined
>> reference to `ceil'
>>
>> Seems related to commit 43f4364d.
>>
>> I don't have the time to search more deeply, I hope it can help.
>>
>> Regards,
>>
>> --
>> N?lio Laranjeiro
>> 6WIND
> I am not sure what the problem might be for IBM Power8.
>
> ceil() is a function defined in math library, we include math.h header file
> in rte_meter.c and we also link the library properly in the Makefile by
> using LDLIBS += -lm, therefore I do not see any issue in the library code.
>
> Thanks,
> Cristian
>
>
>




[dpdk-dev] [PATCH v2 0/6] enable lpm, acl and other missing libraries in ppc64le

2016-07-16 Thread gowrishankar
Hi Chao,
I did not face this error. Even I verified today with tip of master 
6596554... .
However I had patch conflict for examples/l3fwd/l3fwd_em.c which is
fixed now and v3 patch set sent recently. Could you please check.

Thanks,
Gowrishankar
On Friday 15 July 2016 08:45 AM, Chao Zhu wrote:
> Gowrishankar,
>
> When I tried the patches, I got some compilation error:
>
> In file included from
> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.c:34:0:
> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h: In function
> 'transition4':
> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h:198:2: error:
> dereferencing type-punned pointer will break strict-aliasing rules
> [-Werror=strict-aliasing]
>*indices1 = (xmm_t){((uint32_t *))[0], ((uint32_t *))[1],
>^
> /root/test/sub/dpdk/lib/librte_acl/acl_run_altivec.h:202:2: error:
> dereferencing type-punned pointer will break strict-aliasing rules
> [-Werror=strict-aliasing]
>*indices2 = (xmm_t){((uint32_t *))[0], ((uint32_t *))[1],
>
> Can you help to take a look?
>
>
> -Original Message-
> From: Gowrishankar [mailto:gowrishankar.m at linux.vnet.ibm.com]
> Sent: 2016?7?10? 15:51
> To: dev at dpdk.org
> Cc: Chao Zhu ; Bruce Richardson
> ; Konstantin Ananyev
> ; Thomas Monjalon  6wind.com>;
> Cristian Dumitrescu ; Pradeep
> ; gowrishankar 
> Subject: [PATCH v2 0/6] enable lpm, acl and other missing libraries in
> ppc64le
>
> From: gowrishankar 
>
> This patchset enables LPM, ACL and other few missing libs in ppc64le and
> also address few patches in related examples (ip_pipeline and l3fwd).
>
> Test report:
> LPM and ACL unit tests verified as in patch set v1.
> Same results as before observed.
>
> v2 changes:
> - enabling libs in config included as part of lib changes itself.
>
> gowrishankar (6):
>lpm: add altivec intrinsics for dpdk lpm on ppc_64
>acl: add altivec intrinsics for dpdk acl on ppc_64
>ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64
>table: cache align rte_bucket_4_8
>sched: enable sched library for ppc64le
>l3fwd: add altivec support for em_hash_key
>
>   app/test-acl/main.c|   4 +
>   app/test/test_xmmt_ops.h   |  16 +
>   config/defconfig_ppc_64-power8-linuxapp-gcc|   7 -
>   examples/ip_pipeline/cpu_core_map.c|  12 +-
>   examples/ip_pipeline/init.c|   4 +
>   examples/l3fwd/l3fwd_em.c  |   8 +
>   lib/librte_acl/Makefile|   2 +
>   lib/librte_acl/acl.h   |   4 +
>   lib/librte_acl/acl_run.h   |   2 +
>   lib/librte_acl/acl_run_altivec.c   |  47 +++
>   lib/librte_acl/acl_run_altivec.h   | 328
> +
>   lib/librte_acl/rte_acl.c   |  13 +
>   lib/librte_acl/rte_acl.h   |   1 +
>   .../common/include/arch/ppc_64/rte_vect.h  |  60 
>   lib/librte_lpm/Makefile|   2 +
>   lib/librte_lpm/rte_lpm.h   |   2 +
>   lib/librte_lpm/rte_lpm_altivec.h   | 154 ++
>   lib/librte_table/rte_table_hash_key8.c |   2 +-
>   18 files changed, 649 insertions(+), 19 deletions(-)  create mode 100644
> lib/librte_acl/acl_run_altivec.c  create mode 100644
> lib/librte_acl/acl_run_altivec.h  create mode 100644
> lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
>   create mode 100644 lib/librte_lpm/rte_lpm_altivec.h
>
> --
> 1.9.1
>
>
>




[dpdk-dev] [PATCH v3 6/6] l3fwd: add altivec support for em_hash_key

2016-07-16 Thread Gowrishankar Muthukrishnan
This patch adds ppc64le port for em_mask_key function.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 examples/l3fwd/l3fwd_em.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index def5a02..6053a62 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -259,8 +259,16 @@ em_mask_key(void *key, xmm_t mask)

return vandq_s32(data, mask);
 }
+#elif defined(RTE_MACHINE_CPUFLAG_ALTIVEC)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   xmm_t data = vec_ld(0, (xmm_t *)(key));
+
+   return vec_and(data, mask);
+}
 #else
-#error No vector engine (SSE, NEON) available, check your toolchain
+#error No vector engine (SSE, NEON, ALTIVEC) available, check your toolchain
 #endif

 static inline uint8_t
-- 
1.9.1



[dpdk-dev] [PATCH v3 5/6] sched: enable sched library for ppc64le

2016-07-16 Thread Gowrishankar Muthukrishnan
This patch enables librte_sched in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index a084672..f953e61 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -56,5 +56,3 @@ CONFIG_RTE_LIBRTE_PMD_BOND=n
 CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

-# This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_SCHED=n
-- 
1.9.1



[dpdk-dev] [PATCH v3 4/6] table: cache align rte_bucket_4_8

2016-07-16 Thread Gowrishankar Muthukrishnan
Align rte_bucket_4_8 for cache line.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 lib/librte_table/rte_table_hash_key8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_table/rte_table_hash_key8.c 
b/lib/librte_table/rte_table_hash_key8.c
index e2e2bdc..4d5e0cd 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -68,7 +68,7 @@ struct rte_bucket_4_8 {
uint64_t key[4];

/* Cache line 1 */
-   uint8_t data[0];
+   uint8_t data[0] __rte_cache_aligned;
 };

 struct rte_table_hash {
-- 
1.9.1



[dpdk-dev] [PATCH v3 3/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-07-16 Thread Gowrishankar Muthukrishnan
offline lcore would still refer to original core id and this has to
be considered while creating cpu core mask.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc |  3 ---
 examples/ip_pipeline/cpu_core_map.c | 12 +---
 examples/ip_pipeline/init.c |  4 
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index dede34f..a084672 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -58,6 +58,3 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
 CONFIG_RTE_LIBRTE_SCHED=n
-CONFIG_RTE_LIBRTE_PORT=n
-CONFIG_RTE_LIBRTE_TABLE=n
-CONFIG_RTE_LIBRTE_PIPELINE=n
diff --git a/examples/ip_pipeline/cpu_core_map.c 
b/examples/ip_pipeline/cpu_core_map.c
index cb088b1..482e68e 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -351,9 +351,6 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
int lcore_socket_id =
cpu_core_map_get_socket_id_linux(lcore_id);

-   if (lcore_socket_id < 0)
-   return -1;
-
if (((uint32_t) lcore_socket_id) == socket_id)
n_detected++;
}
@@ -368,18 +365,11 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
cpu_core_map_get_socket_id_linux(
lcore_id);

-   if (lcore_socket_id < 0)
-   return -1;
-
int lcore_core_id =
cpu_core_map_get_core_id_linux(
lcore_id);

-   if (lcore_core_id < 0)
-   return -1;
-
-   if (((uint32_t) lcore_socket_id == socket_id) &&
-   ((uint32_t) lcore_core_id == core_id)) {
+   if ((uint32_t) lcore_socket_id == socket_id) {
uint32_t pos = cpu_core_map_pos(map,
socket_id,
core_id_contig,
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..60c931f 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -61,7 +61,11 @@ static void
 app_init_core_map(struct app_params *app)
 {
APP_LOG(app, HIGH, "Initializing CPU core map ...");
+#if defined(RTE_ARCH_PPC_64)
+   app->core_map = cpu_core_map_init(2, 5, 1, 0);
+#else
app->core_map = cpu_core_map_init(4, 32, 4, 0);
+#endif

if (app->core_map == NULL)
rte_panic("Cannot create CPU core map\n");
-- 
1.9.1



[dpdk-dev] [PATCH v3 2/6] acl: add altivec intrinsics for dpdk acl on ppc_64

2016-07-16 Thread Gowrishankar Muthukrishnan
This patch adds port for ACL library in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 app/test-acl/main.c |   4 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 -
 lib/librte_acl/Makefile |   2 +
 lib/librte_acl/acl.h|   4 +
 lib/librte_acl/acl_run.h|   2 +
 lib/librte_acl/acl_run_altivec.c|  47 
 lib/librte_acl/acl_run_altivec.h| 328 
 lib/librte_acl/rte_acl.c|  13 ++
 lib/librte_acl/rte_acl.h|   1 +
 9 files changed, 401 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index d366981..1b2b176 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -105,6 +105,10 @@ static const struct acl_alg acl_alg[] = {
.name = "neon",
.alg = RTE_ACL_CLASSIFY_NEON,
},
+   {
+   .name = "altivec",
+   .alg = RTE_ACL_CLASSIFY_ALTIVEC,
+   },
 };

 static struct {
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 9ddf3c5..dede34f 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_TABLE=n
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 9803e9d..d05be66 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -52,6 +52,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
 ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) $(CONFIG_RTE_ARCH_ARM64)),)
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
 CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
+else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_altivec.c
 else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
 #check if flag for SSE4.1 is already on, if not set it up manually
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 09d6784..6664a55 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -234,6 +234,10 @@ int
 rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index b2fc42c..024f393 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -39,7 +39,9 @@

 #define MAX_SEARCHES_AVX16 16
 #define MAX_SEARCHES_SSE8  8
+#define MAX_SEARCHES_ALTIVEC8  8
 #define MAX_SEARCHES_SSE4  4
+#define MAX_SEARCHES_ALTIVEC4  4
 #define MAX_SEARCHES_SCALAR2

 #define GET_NEXT_4BYTES(prm, idx)  \
diff --git a/lib/librte_acl/acl_run_altivec.c b/lib/librte_acl/acl_run_altivec.c
new file mode 100644
index 000..3523526
--- /dev/null
+++ b/lib/librte_acl/acl_run_altivec.c
@@ -0,0 +1,47 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABI

[dpdk-dev] [PATCH v3 1/6] lpm: add altivec intrinsics for dpdk lpm on ppc_64

2016-07-16 Thread Gowrishankar Muthukrishnan
This patch adds ppc64le port for LPM library in DPDK.

Signed-off-by: Gowrishankar Muthukrishnan 
---
 app/test/test_xmmt_ops.h   |  16 +++
 config/defconfig_ppc_64-power8-linuxapp-gcc|   1 -
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 +
 6 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
index de9c16f..42174d2 100644
--- a/app/test/test_xmmt_ops.h
+++ b/app/test/test_xmmt_ops.h
@@ -62,6 +62,22 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
 /* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
 #define vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0)

+#elif defined(RTE_ARCH_PPC_64)
+
+/* vect_* abstraction implementation using ALTIVEC */
+
+/* loads the xmm_t value from address p(does not need to be 16-byte aligned)*/
+#define vect_loadu_sil128(p) vec_ld(0, p)
+
+/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
+static inline xmm_t  __attribute__((always_inline))
+vect_set_epi32(int i3, int i2, int i1, int i0)
+{
+   xmm_t data = (xmm_t){i0, i1, i2, i3};
+
+   return data;
+}
+
 #endif

 #endif /* _TEST_XMMT_OPS_H_ */
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index bef8f49..9ddf3c5 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
new file mode 100644
index 000..05209e5
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
@@ -0,0 +1,60 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of IBM Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_PPC_64_H_
+#define _RTE_VECT_PPC_64_H_
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef vector signed int xmm_t;
+
+#defineXMM_SIZE(sizeof(xmm_t))
+#defineXMM_MASK(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+   xmm_tx;
+   uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];
+   uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+   uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+   uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+   double   pd[XMM_SIZE / sizeof(double)];
+} __attribute__((aligned(16))) rte_xmm_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_PPC_64_H_ */
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 656ade2..3dc549d 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -51,6 +51,8 @@ ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) 
$(CONFIG_RTE_ARCH_ARM64)),)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include += rte_lpm_neon.h
 else ifeq ($(CONFIG_RTE_A

[dpdk-dev] [PATCH v3 0/6] enable lpm, acl and other missing libraries in ppc64le

2016-07-16 Thread Gowrishankar Muthukrishnan
This patchset enables LPM, ACL and other few missing libs in ppc64le and also
address few patches in related examples (ip_pipeline and l3fwd).

Test report:
LPM and ACL unit tests passed.

RTE>>acl_autotest 
ACL: allocation of 25166728 bytes on socket 33 for ACL_acl_ctx failed
ACL: rte_acl_add_rules(acl_ctx): rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_add_rules(acl_ctx): rule #1 is invalid
acl context @0x3efded7ffb80
  socket_id=-1
  alg=5
  max_rules=196608
  rule_size=128
  num_rules=0
  num_categories=0
  num_tries=0
acl context @0x3efded7ffb80
  socket_id=-1
  alg=5
  max_rules=196608
  rule_size=128
  num_rules=0
  num_categories=0
  num_tries=0
running test_convert_rules(acl_ipv4vlan_tuple)
running test_convert_rules(acl_ipv4vlan_tuple, RTE_ACL_FIELD_TYPE_BITMASK type 
for IPv4)
running test_convert_rules(acl_ipv4vlan_tuple, RTE_ACL_FIELD_TYPE_RANGE type 
for IPv4)
running test_convert_rules(acl_ipv4vlan_tuple: swap VLAN and PORTs order)
running test_convert_rules(acl_ipv4vlan_tuple: swap SRC and DST IPv4 order)
Test OK
RTE>>lpm_autotest 
Test OK
RTE>>

v3 changes:
- rebase over master to fix conflict in examples/l3fwd/l3fwd_em.c

v2 changes:
- enabling libs in config included as part of lib changes itself.

gowrishankar (6):
  lpm: add altivec intrinsics for dpdk lpm on ppc_64
  acl: add altivec intrinsics for dpdk acl on ppc_64
  ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64
  table: cache align rte_bucket_4_8
  sched: enable sched library for ppc64le
  l3fwd: add altivec support for em_hash_key

 app/test-acl/main.c|   4 +
 app/test/test_xmmt_ops.h   |  16 +
 config/defconfig_ppc_64-power8-linuxapp-gcc|   7 -
 examples/ip_pipeline/cpu_core_map.c|  12 +-
 examples/ip_pipeline/init.c|   4 +
 examples/l3fwd/l3fwd_em.c  |  10 +-
 lib/librte_acl/Makefile|   2 +
 lib/librte_acl/acl.h   |   4 +
 lib/librte_acl/acl_run.h   |   2 +
 lib/librte_acl/acl_run_altivec.c   |  47 +++
 lib/librte_acl/acl_run_altivec.h   | 328 +
 lib/librte_acl/rte_acl.c   |  13 +
 lib/librte_acl/rte_acl.h   |   1 +
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 ++
 lib/librte_table/rte_table_hash_key8.c |   2 +-
 18 files changed, 650 insertions(+), 20 deletions(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

-- 
1.9.1



[dpdk-dev] [PATCH v2 0/6] enable lpm, acl and other missing libraries in ppc64le

2016-07-11 Thread gowrishankar
Hi Chao,

On Monday 11 July 2016 02:25 PM, Chao Zhu wrote:
> Gowrishankar,
>
> Nice patches! Do you have some function test result? I need some time to
> verify the patches.

Please find below lpm and acl units tests (Test OK at the end of each 
tests).


# ./app/test
< EAL/PMD logs>
APP: HPET is not enabled, using TSC as default timer
RTE>>lpm_autotest
No. routes = 1076806
Route distribution per prefix width:
DEPTHQUANTITY (PERCENT)
---
01  0 (0.00)
02  0 (0.00)
03  1 (0.00)
04  0 (0.00)
05  3 (0.00)
06  2 (0.00)
07  4 (0.00)
08201 (0.02)
09 37 (0.00)
10 55 (0.01)
11 97 (0.01)
12381 (0.04)
13775 (0.07)
14   2104 (0.20)
15   3712 (0.34)
16  69319 (6.44)
17  12983 (1.21)
18  23667 (2.20)
19  69068 (6.41)
20  62354 (5.79)
21  48531 (4.51)
22  72355 (6.72)
23  85427 (7.93)
24 583900 (54.23)
25   2654 (0.25)
26   5650 (0.52)
27   6467 (0.60)
28   7127 (0.66)
29  12936 (1.20)
30   5999 (0.56)
31 13 (0.00)
32984 (0.09)

Unique added entries = 1039948
Used table 24 entries = 11343198 (67.6107%)
64 byte Cache entries used = 360735 (23087040 bytes)
Average LPM Add: 110820 cycles
Average LPM Lookup: 34.5 cycles (fails = 19.3%)
BULK LPM Lookup: 31.5 cycles (fails = 19.3%)
LPM LookupX4: 29.5 cycles (fails = 19.3%)
Average LPM Delete: 63841.6 cycles
Test OK

RTE>>acl_autotest
ACL: allocation of 25166728 bytes on socket 33 for ACL_acl_ctx failed
ACL: rte_acl_add_rules(acl_ctx): rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_ipv4vlan_add_rules: rule #1 is invalid
ACL: rte_acl_add_rules(acl_ctx): rule #1 is invalid
ACL: Gen phase for ACL "acl_ctx":
runtime memory footprint on socket -1:
single nodes/bytes used: 0/0
quad nodes/vectors/bytes used: 0/0/0
DFA nodes/group64/bytes used: 1/4/4104
match nodes/bytes used: 1/128
total: 6432 bytes
max limit: 18446744073709551615 bytes
ACL: Build phase for ACL "acl_ctx":
node limit for tree split: 2048
nodes created: 2
memory consumed: 8388615
ACL: trie 0: number of rules: 16, indexes: 1
ACL: Gen phase for ACL "acl_ctx":
runtime memory footprint on socket -1:
single nodes/bytes used: 22/176
quad nodes/vectors/bytes used: 30/104/832
DFA nodes/group64/bytes used: 6/19/11784
match nodes/bytes used: 6/768
total: 15760 bytes
max limit: 18446744073709551615 bytes
ACL: Build phase for ACL "acl_ctx":
node limit for tree split: 2048
nodes created: 64
memory consumed: 8388615
ACL: trie 0: number of rules: 6000, indexes: 4
acl context @0x3efded3b3400
   socket_id=-1
   alg=5
   max_rules=196608
   rule_size=128
   num_rules=0
   num_categories=0
   num_tries=0
acl context @0x3efded3b3400
   socket_id=-1
   alg=5
   max_rules=196608
   rule_size=128
   num_rules=0
   num_categories=0
   num_tries=0
ACL: Gen phase for ACL "acl_ctx":
runtime memory footprint on socket -1:
single nodes/bytes used: 974/7792
quad nodes/vectors/bytes used: 816/3211/25688
DFA nodes/group64/bytes used: 137/289/150024
match nodes/bytes used: 1181/151168
total: 336880 bytes
max limit: 18446744073709551615 bytes
ACL: Build phase for ACL "acl_ctx":
node limit for tree split: 2048
nodes created: 3108
memory consumed: 8388615
ACL: trie 0: number of rules: 15, indexes: 4
ACL: trie 1: number of rules: 12, indexes: 5
ACL: Gen phase for ACL "acl_ctx":
runtime memory footprint on socket -1:
single nodes/bytes used: 974/7792
quad nodes/vectors/bytes used: 816/3211/25688
DFA nodes/group64/bytes used: 137/289/150024
match nodes/bytes used: 1181/151168
total: 336880 bytes
max limit: 18446744073709551615 bytes
ACL: Build phase for ACL "acl_ctx":
node limit for tree split: 2048
nodes created: 3108
memory consumed: 8388615
ACL: trie 0: number of rules: 15, indexes: 4
ACL: trie 1: number of rules: 12, indexes: 5
ACL: Build phase for ACL "acl_ctx":
node limit for tree split: 2048
nodes created: 0
memory consumed: 8388615
ACL: Gen phase for ACL "acl_ctx":
runtime memory footprint on socket -1:
single nodes/bytes used: 974/7792
quad nodes/vectors/bytes used: 816/3211/25688
DFA nodes/group64/bytes used: 137/289/150024
match nodes/bytes used: 1181/151168
total: 336880 bytes
max limit: 18446744073709551615 bytes
ACL: Build phase for ACL "acl_ctx":
node limit for tree split: 2048
nodes created: 3108
memory consumed: 8388615
ACL: trie 0: number of rules: 15, indexes: 4
ACL: trie 1: number of rules: 12, indexes: 5
ACL: Gen phase for ACL "acl_ctx":
runtime memory footprint on socket -1:
single nodes/bytes used: 974/7792

[dpdk-dev] [PATCH v2 6/6] l3fwd: add altivec support for em_hash_key

2016-07-10 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for em_mask_key function.

Signed-off-by: Gowrishankar 
---
 examples/l3fwd/l3fwd_em.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index fc59243..3e261d1 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -259,6 +259,14 @@ em_mask_key(void *key, xmm_t mask)

return vandq_s32(data, mask);
 }
+#elif defined(RTE_MACHINE_CPUFLAG_ALTIVEC)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   xmm_t data = vec_ld(0, (xmm_t *)(key));
+
+   return vec_and(data, mask);
+}
 #endif

 static inline uint8_t
-- 
1.9.1



[dpdk-dev] [PATCH v2 5/6] sched: enable sched library for ppc64le

2016-07-10 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch enables librte_sched in ppc64le.

Signed-off-by: Gowrishankar 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 94f09a7..bbd5568 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -56,5 +56,3 @@ CONFIG_RTE_LIBRTE_PMD_BOND=n
 CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

-# This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_SCHED=n
-- 
1.9.1



[dpdk-dev] [PATCH v2 4/6] table: cache align rte_bucket_4_8

2016-07-10 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

Align rte_bucket_4_8 for cache line.

Signed-off-by: Gowrishankar 
---
 lib/librte_table/rte_table_hash_key8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_table/rte_table_hash_key8.c 
b/lib/librte_table/rte_table_hash_key8.c
index e2e2bdc..4d5e0cd 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -68,7 +68,7 @@ struct rte_bucket_4_8 {
uint64_t key[4];

/* Cache line 1 */
-   uint8_t data[0];
+   uint8_t data[0] __rte_cache_aligned;
 };

 struct rte_table_hash {
-- 
1.9.1



[dpdk-dev] [PATCH v2 3/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-07-10 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

offline lcore would still refer to original core id and this has to
be considered while creating cpu core mask.

Signed-off-by: Gowrishankar 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc |  3 ---
 examples/ip_pipeline/cpu_core_map.c | 12 +---
 examples/ip_pipeline/init.c |  4 
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 2ae26d9..94f09a7 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -58,6 +58,3 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
 CONFIG_RTE_LIBRTE_SCHED=n
-CONFIG_RTE_LIBRTE_PORT=n
-CONFIG_RTE_LIBRTE_TABLE=n
-CONFIG_RTE_LIBRTE_PIPELINE=n
diff --git a/examples/ip_pipeline/cpu_core_map.c 
b/examples/ip_pipeline/cpu_core_map.c
index cb088b1..482e68e 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -351,9 +351,6 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
int lcore_socket_id =
cpu_core_map_get_socket_id_linux(lcore_id);

-   if (lcore_socket_id < 0)
-   return -1;
-
if (((uint32_t) lcore_socket_id) == socket_id)
n_detected++;
}
@@ -368,18 +365,11 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
cpu_core_map_get_socket_id_linux(
lcore_id);

-   if (lcore_socket_id < 0)
-   return -1;
-
int lcore_core_id =
cpu_core_map_get_core_id_linux(
lcore_id);

-   if (lcore_core_id < 0)
-   return -1;
-
-   if (((uint32_t) lcore_socket_id == socket_id) &&
-   ((uint32_t) lcore_core_id == core_id)) {
+   if ((uint32_t) lcore_socket_id == socket_id) {
uint32_t pos = cpu_core_map_pos(map,
socket_id,
core_id_contig,
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 83422e8..4acd38c 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -59,7 +59,11 @@ static void
 app_init_core_map(struct app_params *app)
 {
APP_LOG(app, HIGH, "Initializing CPU core map ...");
+#if defined(RTE_ARCH_PPC_64)
+   app->core_map = cpu_core_map_init(2, 5, 1, 0);
+#else
app->core_map = cpu_core_map_init(4, 32, 4, 0);
+#endif

if (app->core_map == NULL)
rte_panic("Cannot create CPU core map\n");
-- 
1.9.1



[dpdk-dev] [PATCH v2 2/6] acl: add altivec intrinsics for dpdk acl on ppc_64

2016-07-10 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds port for ACL library in ppc64le.

Signed-off-by: Gowrishankar 
---
 app/test-acl/main.c |   4 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 -
 lib/librte_acl/Makefile |   2 +
 lib/librte_acl/acl.h|   4 +
 lib/librte_acl/acl_run.h|   2 +
 lib/librte_acl/acl_run_altivec.c|  47 
 lib/librte_acl/acl_run_altivec.h| 328 
 lib/librte_acl/rte_acl.c|  13 ++
 lib/librte_acl/rte_acl.h|   1 +
 9 files changed, 401 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index 0b0c093..3bee0de 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -105,6 +105,10 @@ static const struct acl_alg acl_alg[] = {
.name = "neon",
.alg = RTE_ACL_CLASSIFY_NEON,
},
+   {
+   .name = "altivec",
+   .alg = RTE_ACL_CLASSIFY_ALTIVEC,
+   },
 };

 static struct {
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 211ef18..2ae26d9 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_TABLE=n
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 2e394c9..6810552 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -52,6 +52,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
 ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) $(CONFIG_RTE_ARCH_ARM64)),)
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
 CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized
+else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_altivec.c
 else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
 #check if flag for SSE4.1 is already on, if not set it up manually
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 09d6784..6664a55 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -234,6 +234,10 @@ int
 rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index b2fc42c..024f393 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -39,7 +39,9 @@

 #define MAX_SEARCHES_AVX16 16
 #define MAX_SEARCHES_SSE8  8
+#define MAX_SEARCHES_ALTIVEC8  8
 #define MAX_SEARCHES_SSE4  4
+#define MAX_SEARCHES_ALTIVEC4  4
 #define MAX_SEARCHES_SCALAR2

 #define GET_NEXT_4BYTES(prm, idx)  \
diff --git a/lib/librte_acl/acl_run_altivec.c b/lib/librte_acl/acl_run_altivec.c
new file mode 100644
index 000..3523526
--- /dev/null
+++ b/lib/librte_acl/acl_run_altivec.c
@@ -0,0 +1,47 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LI

[dpdk-dev] [PATCH v2 1/6] lpm: add altivec intrinsics for dpdk lpm on ppc_64

2016-07-10 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for LPM library in DPDK.

Signed-off-by: Gowrishankar 
---
 app/test/test_xmmt_ops.h   |  16 +++
 config/defconfig_ppc_64-power8-linuxapp-gcc|   1 -
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 +
 6 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
index de9c16f..42174d2 100644
--- a/app/test/test_xmmt_ops.h
+++ b/app/test/test_xmmt_ops.h
@@ -62,6 +62,22 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
 /* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
 #define vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0)

+#elif defined(RTE_ARCH_PPC_64)
+
+/* vect_* abstraction implementation using ALTIVEC */
+
+/* loads the xmm_t value from address p(does not need to be 16-byte aligned)*/
+#define vect_loadu_sil128(p) vec_ld(0, p)
+
+/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
+static inline xmm_t  __attribute__((always_inline))
+vect_set_epi32(int i3, int i2, int i1, int i0)
+{
+   xmm_t data = (xmm_t){i0, i1, i2, i3};
+
+   return data;
+}
+
 #endif

 #endif /* _TEST_XMMT_OPS_H_ */
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 9eb0cc4..211ef18 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,7 +57,6 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
new file mode 100644
index 000..05209e5
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
@@ -0,0 +1,60 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of IBM Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_PPC_64_H_
+#define _RTE_VECT_PPC_64_H_
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef vector signed int xmm_t;
+
+#defineXMM_SIZE(sizeof(xmm_t))
+#defineXMM_MASK(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+   xmm_tx;
+   uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];
+   uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+   uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+   uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+   double   pd[XMM_SIZE / sizeof(double)];
+} __attribute__((aligned(16))) rte_xmm_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_PPC_64_H_ */
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 656ade2..3dc549d 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -51,6 +51,8 @@ ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) 
$(CONFIG_RTE_ARCH_ARM64)),)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include +=

[dpdk-dev] [PATCH v2 0/6] enable lpm, acl and other missing libraries in ppc64le

2016-07-10 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patchset enables LPM, ACL and other few missing libs in ppc64le and also
address few patches in related examples (ip_pipeline and l3fwd).

Test report:
LPM and ACL unit tests verified as in patch set v1.
Same results as before observed.

v2 changes:
- enabling libs in config included as part of lib changes itself.

gowrishankar (6):
  lpm: add altivec intrinsics for dpdk lpm on ppc_64
  acl: add altivec intrinsics for dpdk acl on ppc_64
  ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64
  table: cache align rte_bucket_4_8
  sched: enable sched library for ppc64le
  l3fwd: add altivec support for em_hash_key

 app/test-acl/main.c|   4 +
 app/test/test_xmmt_ops.h   |  16 +
 config/defconfig_ppc_64-power8-linuxapp-gcc|   7 -
 examples/ip_pipeline/cpu_core_map.c|  12 +-
 examples/ip_pipeline/init.c|   4 +
 examples/l3fwd/l3fwd_em.c  |   8 +
 lib/librte_acl/Makefile|   2 +
 lib/librte_acl/acl.h   |   4 +
 lib/librte_acl/acl_run.h   |   2 +
 lib/librte_acl/acl_run_altivec.c   |  47 +++
 lib/librte_acl/acl_run_altivec.h   | 328 +
 lib/librte_acl/rte_acl.c   |  13 +
 lib/librte_acl/rte_acl.h   |   1 +
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 ++
 lib/librte_table/rte_table_hash_key8.c |   2 +-
 18 files changed, 649 insertions(+), 19 deletions(-)
 create mode 100644 lib/librte_acl/acl_run_altivec.c
 create mode 100644 lib/librte_acl/acl_run_altivec.h
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

-- 
1.9.1



[dpdk-dev] [PATCH 1/6] config: enable lpm, port, table, pipeline, acl, sched libraries for ppc64le

2016-07-09 Thread gowrishankar
Hi Thomas,

On Friday 08 July 2016 06:27 PM, Thomas Monjalon wrote:
> The comment and these lines can be removed and rely on default 
> enabling in config/common_base. I suggest to enable (remove disabling) 
> a feature at a time in the patch fixing the feature for PPC. 

Sure. So, do you suggest to send individual patchset (or patch) for each 
feature being enabled, one by one ?.

Thanks,
Gowrishankar



[dpdk-dev] [PATCH 6/6] l3fwd: add altivec support for em_hash_key

2016-07-07 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for em_mask_key function.

Signed-off-by: Gowrishankar 
---
 examples/l3fwd/l3fwd_em.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index fc59243..3e261d1 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -259,6 +259,14 @@ em_mask_key(void *key, xmm_t mask)

return vandq_s32(data, mask);
 }
+#elif defined(RTE_MACHINE_CPUFLAG_ALTIVEC)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   xmm_t data = vec_ld(0, (xmm_t *)(key));
+
+   return vec_and(data, mask);
+}
 #endif

 static inline uint8_t
-- 
1.9.1



[dpdk-dev] [PATCH 5/6] ip_pipeline: fix lcore mapping for varying SMT threads as in ppc64

2016-07-07 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

offline lcore would still refer to original core id and this has to
be considered while creating cpu core mask.

Signed-off-by: Gowrishankar 
---
 examples/ip_pipeline/cpu_core_map.c | 12 +---
 examples/ip_pipeline/init.c |  4 
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/examples/ip_pipeline/cpu_core_map.c 
b/examples/ip_pipeline/cpu_core_map.c
index cb088b1..482e68e 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -351,9 +351,6 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
int lcore_socket_id =
cpu_core_map_get_socket_id_linux(lcore_id);

-   if (lcore_socket_id < 0)
-   return -1;
-
if (((uint32_t) lcore_socket_id) == socket_id)
n_detected++;
}
@@ -368,18 +365,11 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
cpu_core_map_get_socket_id_linux(
lcore_id);

-   if (lcore_socket_id < 0)
-   return -1;
-
int lcore_core_id =
cpu_core_map_get_core_id_linux(
lcore_id);

-   if (lcore_core_id < 0)
-   return -1;
-
-   if (((uint32_t) lcore_socket_id == socket_id) &&
-   ((uint32_t) lcore_core_id == core_id)) {
+   if ((uint32_t) lcore_socket_id == socket_id) {
uint32_t pos = cpu_core_map_pos(map,
socket_id,
core_id_contig,
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 83422e8..4acd38c 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -59,7 +59,11 @@ static void
 app_init_core_map(struct app_params *app)
 {
APP_LOG(app, HIGH, "Initializing CPU core map ...");
+#if defined(RTE_ARCH_PPC_64)
+   app->core_map = cpu_core_map_init(2, 5, 1, 0);
+#else
app->core_map = cpu_core_map_init(4, 32, 4, 0);
+#endif

if (app->core_map == NULL)
rte_panic("Cannot create CPU core map\n");
-- 
1.9.1



[dpdk-dev] [PATCH 4/6] table: cache align rte_bucket_4_8

2016-07-07 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

Align rte_bucket_4_8 for cache line.

Signed-off-by: Gowrishankar 
---
 lib/librte_table/rte_table_hash_key8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_table/rte_table_hash_key8.c 
b/lib/librte_table/rte_table_hash_key8.c
index e2e2bdc..4d5e0cd 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -68,7 +68,7 @@ struct rte_bucket_4_8 {
uint64_t key[4];

/* Cache line 1 */
-   uint8_t data[0];
+   uint8_t data[0] __rte_cache_aligned;
 };

 struct rte_table_hash {
-- 
1.9.1



[dpdk-dev] [PATCH 2/6] lpm: add altivec intrinsics for dpdk lpm on ppc_64

2016-07-07 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

This patch adds ppc64le port for LPM library in DPDK.

Signed-off-by: Gowrishankar 
---
 app/test/test_xmmt_ops.h   |  16 +++
 .../common/include/arch/ppc_64/rte_vect.h  |  60 
 lib/librte_lpm/Makefile|   2 +
 lib/librte_lpm/rte_lpm.h   |   2 +
 lib/librte_lpm/rte_lpm_altivec.h   | 154 +
 5 files changed, 234 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
 create mode 100644 lib/librte_lpm/rte_lpm_altivec.h

diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
index de9c16f..42174d2 100644
--- a/app/test/test_xmmt_ops.h
+++ b/app/test/test_xmmt_ops.h
@@ -62,6 +62,22 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
 /* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
 #define vect_set_epi32(i3, i2, i1, i0) _mm_set_epi32(i3, i2, i1, i0)

+#elif defined(RTE_ARCH_PPC_64)
+
+/* vect_* abstraction implementation using ALTIVEC */
+
+/* loads the xmm_t value from address p(does not need to be 16-byte aligned)*/
+#define vect_loadu_sil128(p) vec_ld(0, p)
+
+/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
+static inline xmm_t  __attribute__((always_inline))
+vect_set_epi32(int i3, int i2, int i1, int i0)
+{
+   xmm_t data = (xmm_t){i0, i1, i2, i3};
+
+   return data;
+}
+
 #endif

 #endif /* _TEST_XMMT_OPS_H_ */
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
new file mode 100644
index 000..05209e5
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_vect.h
@@ -0,0 +1,60 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2016.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of IBM Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_PPC_64_H_
+#define _RTE_VECT_PPC_64_H_
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef vector signed int xmm_t;
+
+#defineXMM_SIZE(sizeof(xmm_t))
+#defineXMM_MASK(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+   xmm_tx;
+   uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];
+   uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+   uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+   uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+   double   pd[XMM_SIZE / sizeof(double)];
+} __attribute__((aligned(16))) rte_xmm_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_PPC_64_H_ */
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 656ade2..3dc549d 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -51,6 +51,8 @@ ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) 
$(CONFIG_RTE_ARCH_ARM64)),)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include += rte_lpm_neon.h
 else ifeq ($(CONFIG_RTE_ARCH_X86),y)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include += rte_lpm_sse.h
+else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
+SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include += rte_lpm_altivec.h
 endif

 # this lib needs eal
diff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h
index 2df1d67..dbe5483 100644
--- a/lib/librte_lpm/rte_lpm.h
+++ b/lib/librte_lpm/rte_lpm.h
@@ -480,6 +480,8 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, 
uint32_t hop[4],

 #if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64)
 #include "rte_lpm_neon.h&

[dpdk-dev] [PATCH 1/6] config: enable lpm, port, table, pipeline, acl, sched libraries for ppc64le

2016-07-07 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

In this patch, DPDK libraries such as LPM, port, table, pipeline, ACL,
and sched are enabled for ppc64le.

Signed-off-by: Gowrishankar 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 9eb0cc4..02d15bc 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,9 +57,9 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
-CONFIG_RTE_LIBRTE_ACL=n
-CONFIG_RTE_LIBRTE_SCHED=n
-CONFIG_RTE_LIBRTE_PORT=n
-CONFIG_RTE_LIBRTE_TABLE=n
-CONFIG_RTE_LIBRTE_PIPELINE=n
+CONFIG_RTE_LIBRTE_LPM=y
+CONFIG_RTE_LIBRTE_ACL=y
+CONFIG_RTE_LIBRTE_SCHED=y
+CONFIG_RTE_LIBRTE_PORT=y
+CONFIG_RTE_LIBRTE_TABLE=y
+CONFIG_RTE_LIBRTE_PIPELINE=y
-- 
1.9.1



[dpdk-dev] [PATCH 0/6] enable lpm, acl and other missing libraries in ppc64le

2016-07-07 Thread Gowrishankar
This patchset enables LPM, ACL and other few missing libs in ppc64le and also
address few patches in related examples (ip_pipeline and l3fwd).


Test report:

LPM autotest test results as below.

RTE>>lpm_autotest 
No. routes = 1076806
Route distribution per prefix width: 
DEPTHQUANTITY (PERCENT)
--- 
01  0 (0.00)
02  0 (0.00)
03  1 (0.00)
04  0 (0.00)
05  3 (0.00)
06  2 (0.00)
07  4 (0.00)
08201 (0.02)
09 37 (0.00)
10 55 (0.01)
11 97 (0.01)
12381 (0.04)
13775 (0.07)
14   2104 (0.20)
15   3712 (0.34)
16  69319 (6.44)
17  12983 (1.21)
18  23667 (2.20)
19  69068 (6.41)
20  62354 (5.79)
21  48531 (4.51)
22  72355 (6.72)
23  85427 (7.93)
24 583900 (54.23)
25   2654 (0.25)
26   5650 (0.52)
27   6467 (0.60)
28   7127 (0.66)
29  12936 (1.20)
30   5999 (0.56)
31 13 (0.00)
32984 (0.09)

Unique added entries = 1039948
Used table 24 entries = 11343198 (67.6107%)
64 byte Cache entries used = 360735 (23087040 bytes)
Average LPM Add: 110766 cycles
Average LPM Lookup: 34.5 cycles (fails = 19.3%)
BULK LPM Lookup: 31.5 cycles (fails = 19.3%)
LPM LookupX4: 29.5 cycles (fails = 19.3%)
Average LPM Delete: 63813.8 cycles
Test OK
RTE>>

ACL autotest test results as below:

..
...
ACL: trie 0: number of rules: 17, indexes: 4
ACL: trie 1: number of rules: 10, indexes: 5
ACL: Gen phase for ACL "acl_ctx":
runtime memory footprint on socket -1:
single nodes/bytes used: 8822/70576
quad nodes/vectors/bytes used: 12788/53374/426992
DFA nodes/group64/bytes used: 2175/4359/2233864
match nodes/bytes used: 24100/3084800
total: 5818432 bytes
max limit: 18446744073709551615 bytes
ACL: Build phase for ACL "acl_ctx":
node limit for tree split: 16384
nodes created: 47885
memory consumed: 100663380
ACL: trie 0: number of rules: 22, indexes: 5
ACL: trie 1: number of rules: 5, indexes: 5
Test OK
RTE>>

Thanks.



[dpdk-dev] [PATCH 1/6] config: enable lpm, port, table, pipeline, acl, sched libraries for ppc64le

2016-07-07 Thread Gowrishankar
From: gowrishankar <gowrishanka...@linux.vnet.ibm.com>

In this patch, DPDK libraries such as LPM, port, table, pipeline, ACL,
and sched are enabled for ppc64le.

Signed-off-by: Gowrishankar 
---
 config/defconfig_ppc_64-power8-linuxapp-gcc | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index 9eb0cc4..02d15bc 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -57,9 +57,9 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n

 # This following libraries are not available on Power. So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
-CONFIG_RTE_LIBRTE_ACL=n
-CONFIG_RTE_LIBRTE_SCHED=n
-CONFIG_RTE_LIBRTE_PORT=n
-CONFIG_RTE_LIBRTE_TABLE=n
-CONFIG_RTE_LIBRTE_PIPELINE=n
+CONFIG_RTE_LIBRTE_LPM=y
+CONFIG_RTE_LIBRTE_ACL=y
+CONFIG_RTE_LIBRTE_SCHED=y
+CONFIG_RTE_LIBRTE_PORT=y
+CONFIG_RTE_LIBRTE_TABLE=y
+CONFIG_RTE_LIBRTE_PIPELINE=y
-- 
1.9.1



[dpdk-dev] linking error with dpdk

2016-06-20 Thread gowrishankar
On Saturday 18 June 2016 01:13 PM, Raja Jayapal wrote:
> Hi All,
>
> I am trying to install dpdk with ovs, but am getting the linking errors.
> Downloaded and tried with dpdk 2.0/2.2/16.04 and latest ovs.
>
> DPDK : wget http://dpdk.org/browse/dpdk/snapshot/dpdk-2.0.0.tar.gz and wget 
> http://dpdk.org/browse/dpdk/snapshot/dpdk-2.2.0.tar.gz
> OVS : git clone https://github.com/openvswitch/ovs.git
>
>   ./configure --with-dpdk=/home/ubuntu/raja2/dpdk-2.2.0
> - - - - - - -
> checking target hint for cgcc... x86_64
> checking whether make has GNU make $(if) extension... yes
> checking whether dpdk datapath is enabled... yes
> checking for /home/ubuntu/raja2/dpdk-2.2.0/include/rte_config.h... no
> checking for /home/ubuntu/raja2/dpdk-2.2.0/include/dpdk/rte_config.h... no
> configure: error: Could not find DPDK libraries in 
> /home/ubuntu/raja2/dpdk-2.2.0/lib

You need to have CONFIG_RTE_BUILD_COMBINE_LIBS=y if you are trying 
dpdk-2.2.0 or less.

As Ferruh replied earlier, refer to dpdk version what INSTALL.DPDK.md 
suggests.

Thanks,
Gowrishankar
> ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var 
> --with-dpdk=/home/ubuntu/raja1/dpdk-2.0.0/x86_64-native-linuxapp-gcc/ 
> --enable-ssl
>   - - - - - - - - - -
> checking whether gcc -std=gnu99 accepts -Wno-unused-parameter... yes
> checking target hint for cgcc... x86_64
> checking whether make has GNU make $(if) extension... yes
> checking whether dpdk datapath is enabled... yes
> checking for 
> /home/ubuntu/raja1/dpdk-2.0.0/x86_64-native-linuxapp-gcc//include/rte_config.h...
>  yes
> configure: error: Could not find DPDK libraries in 
> /home/ubuntu/raja1/dpdk-2.0.0/x86_64-native-linuxapp-gcc//lib
> ubuntu at 01HW462422:~/raja1/ovs$
>
> Installed dpdk successfully, but when i build ovs with dpdk i am getting the 
> linking error in all the three versions of dpdk.
> Is there any specific version in which the dpdk-ovs will only work, if so 
> please let me know.
>
> Thanks,
> Raja
> =-=-=
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>




[dpdk-dev] [PATCH] eal/ppc: fix secondary process to map hugepages in correct order

2016-03-17 Thread gowrishankar
Could this patch be reviewed please.

Thanks,
Gowrishankar

On Monday 07 March 2016 07:43 PM, Gowrishankar wrote:
> From: Gowri Shankar 
>
> For a secondary process address space to map hugepages from every segment of
> primary process, hugepage_file entries has to be mapped reversely from the
> list that primary process updated for every segment. This is for a reason 
> that,
> in ppc64, hugepages are sorted for decrementing addresses.
>
> Signed-off-by: Gowrishankar 
> ---
>   lib/librte_eal/linuxapp/eal/eal_memory.c |   26 --
>   1 file changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
> b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index 5b9132c..6aea5d0 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -1400,7 +1400,7 @@ rte_eal_hugepage_attach(void)
>   {
>   const struct rte_mem_config *mcfg = 
> rte_eal_get_configuration()->mem_config;
>   const struct hugepage_file *hp = NULL;
> - unsigned num_hp = 0;
> + unsigned num_hp = 0, mapped_hp = 0;
>   unsigned i, s = 0; /* s used to track the segment number */
>   off_t size;
>   int fd, fd_zero = -1, fd_hugepage = -1;
> @@ -1486,14 +1486,12 @@ rte_eal_hugepage_attach(void)
>   goto error;
>   }
>
> - num_hp = size / sizeof(struct hugepage_file);
> - RTE_LOG(DEBUG, EAL, "Analysing %u files\n", num_hp);
> -
>   s = 0;
>   while (s < RTE_MAX_MEMSEG && mcfg->memseg[s].len > 0){
>   void *addr, *base_addr;
>   uintptr_t offset = 0;
>   size_t mapping_size;
> + unsigned int index;
>   #ifdef RTE_LIBRTE_IVSHMEM
>   /*
>* if segment has ioremap address set, it's an IVSHMEM segment 
> and
> @@ -1504,6 +1502,8 @@ rte_eal_hugepage_attach(void)
>   continue;
>   }
>   #endif
> + num_hp = mcfg->memseg[s].len / mcfg->memseg[s].hugepage_sz;
> + RTE_LOG(DEBUG, EAL, "Analysing %u files in segment %u\n", 
> num_hp, s);
>   /*
>* free previously mapped memory so we can map the
>* hugepages into the space
> @@ -1514,18 +1514,23 @@ rte_eal_hugepage_attach(void)
>   /* find the hugepages for this segment and map them
>* we don't need to worry about order, as the server sorted the
>* entries before it did the second mmap of them */
> +#ifdef RTE_ARCH_PPC_64
> + for (i = num_hp-1; i < num_hp && offset < mcfg->memseg[s].len; 
> i--){
> +#else
>   for (i = 0; i < num_hp && offset < mcfg->memseg[s].len; i++){
> - if (hp[i].memseg_id == (int)s){
> - fd = open(hp[i].filepath, O_RDWR);
> +#endif
> + index = i + mapped_hp;
> + if (hp[index].memseg_id == (int)s){
> + fd = open(hp[index].filepath, O_RDWR);
>   if (fd < 0) {
>   RTE_LOG(ERR, EAL, "Could not open %s\n",
> - hp[i].filepath);
> + hp[index].filepath);
>   goto error;
>   }
>   #ifdef RTE_EAL_SINGLE_FILE_SEGMENTS
> - mapping_size = hp[i].size * hp[i].repeated;
> + mapping_size = hp[index].size * 
> hp[index].repeated;
>   #else
> - mapping_size = hp[i].size;
> + mapping_size = hp[index].size;
>   #endif
>   addr = mmap(RTE_PTR_ADD(base_addr, offset),
>   mapping_size, PROT_READ | 
> PROT_WRITE,
> @@ -1534,7 +1539,7 @@ rte_eal_hugepage_attach(void)
>   if (addr == MAP_FAILED ||
>   addr != RTE_PTR_ADD(base_addr, 
> offset)) {
>   RTE_LOG(ERR, EAL, "Could not mmap %s\n",
> - hp[i].filepath);
> + hp[index].filepath);
>   goto error;
>   }
>   offset+=mapping_size;
> @@ -1543,6 +1548,7 @@ rte_eal_hugepage_attach(void)
>   RTE_LOG(DEBUG, EAL, "Mapped segment %u of size 0x%llx\n", s,
>   (unsigned long long)mcfg->memseg[s].len);
>   s++;
> + mapped_hp += num_hp;
>   }
>   /* unmap the hugepage config file, since we are done using it */
>   munmap((void *)(uintptr_t)hp, size);




[dpdk-dev] [PATCH] eal/ppc: fix secondary process to map hugepages in correct order

2016-03-07 Thread Gowrishankar
From: Gowri Shankar <gowrishanka...@linux.vnet.ibm.com>

For a secondary process address space to map hugepages from every segment of
primary process, hugepage_file entries has to be mapped reversely from the
list that primary process updated for every segment. This is for a reason that,
in ppc64, hugepages are sorted for decrementing addresses.

Signed-off-by: Gowrishankar 
---
 lib/librte_eal/linuxapp/eal/eal_memory.c |   26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 5b9132c..6aea5d0 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -1400,7 +1400,7 @@ rte_eal_hugepage_attach(void)
 {
const struct rte_mem_config *mcfg = 
rte_eal_get_configuration()->mem_config;
const struct hugepage_file *hp = NULL;
-   unsigned num_hp = 0;
+   unsigned num_hp = 0, mapped_hp = 0;
unsigned i, s = 0; /* s used to track the segment number */
off_t size;
int fd, fd_zero = -1, fd_hugepage = -1;
@@ -1486,14 +1486,12 @@ rte_eal_hugepage_attach(void)
goto error;
}

-   num_hp = size / sizeof(struct hugepage_file);
-   RTE_LOG(DEBUG, EAL, "Analysing %u files\n", num_hp);
-
s = 0;
while (s < RTE_MAX_MEMSEG && mcfg->memseg[s].len > 0){
void *addr, *base_addr;
uintptr_t offset = 0;
size_t mapping_size;
+   unsigned int index;
 #ifdef RTE_LIBRTE_IVSHMEM
/*
 * if segment has ioremap address set, it's an IVSHMEM segment 
and
@@ -1504,6 +1502,8 @@ rte_eal_hugepage_attach(void)
continue;
}
 #endif
+   num_hp = mcfg->memseg[s].len / mcfg->memseg[s].hugepage_sz;
+   RTE_LOG(DEBUG, EAL, "Analysing %u files in segment %u\n", 
num_hp, s);
/*
 * free previously mapped memory so we can map the
 * hugepages into the space
@@ -1514,18 +1514,23 @@ rte_eal_hugepage_attach(void)
/* find the hugepages for this segment and map them
 * we don't need to worry about order, as the server sorted the
 * entries before it did the second mmap of them */
+#ifdef RTE_ARCH_PPC_64
+   for (i = num_hp-1; i < num_hp && offset < mcfg->memseg[s].len; 
i--){
+#else
for (i = 0; i < num_hp && offset < mcfg->memseg[s].len; i++){
-   if (hp[i].memseg_id == (int)s){
-   fd = open(hp[i].filepath, O_RDWR);
+#endif
+   index = i + mapped_hp;
+   if (hp[index].memseg_id == (int)s){
+   fd = open(hp[index].filepath, O_RDWR);
if (fd < 0) {
RTE_LOG(ERR, EAL, "Could not open %s\n",
-   hp[i].filepath);
+   hp[index].filepath);
goto error;
}
 #ifdef RTE_EAL_SINGLE_FILE_SEGMENTS
-   mapping_size = hp[i].size * hp[i].repeated;
+   mapping_size = hp[index].size * 
hp[index].repeated;
 #else
-   mapping_size = hp[i].size;
+   mapping_size = hp[index].size;
 #endif
addr = mmap(RTE_PTR_ADD(base_addr, offset),
mapping_size, PROT_READ | 
PROT_WRITE,
@@ -1534,7 +1539,7 @@ rte_eal_hugepage_attach(void)
if (addr == MAP_FAILED ||
addr != RTE_PTR_ADD(base_addr, 
offset)) {
RTE_LOG(ERR, EAL, "Could not mmap %s\n",
-   hp[i].filepath);
+   hp[index].filepath);
goto error;
}
offset+=mapping_size;
@@ -1543,6 +1548,7 @@ rte_eal_hugepage_attach(void)
RTE_LOG(DEBUG, EAL, "Mapped segment %u of size 0x%llx\n", s,
(unsigned long long)mcfg->memseg[s].len);
s++;
+   mapped_hp += num_hp;
}
/* unmap the hugepage config file, since we are done using it */
munmap((void *)(uintptr_t)hp, size);
-- 
1.7.10.4



[dpdk-dev] [ovs-dev] dpdkvhostuser fail to alloc memory when receive packet from other host

2015-06-17 Thread gowrishankar
On Wednesday 17 June 2015 03:19 PM, Du, Fan wrote:
> Hi,
>
> I'm playing dpdkvhostuser ports with latest DPDK and ovs master tree with 
> iperf benchmarking.
> When kvm guest1(backed up dpdkvhostuser port)siting on HOST1 is receiving 
> packets from either other physical HOST2,
> or similar kvm guest2 with dpdkvhostuser port siting on HOST2. The 
> connectivity will break, iperf show no bandwidth and stall finally.

In my setup where kvm guest1 receives packets from phy host through ovs 
switch (vhost-user),
I do not find this problem. I am on top of below commit fyi.

commit 7d1ced01772de541d6692c7d5604210e274bcd37 (ovs)

Btw, I checked tx case for guest as well. qemu I am using is of version 
2.3.0. Is your qemu of version above 2.2
if allotting more than 1GB guest memory.

Could you also share hugepages params passed to kernel.

Regards,
Gowri Shankar

>
> Other test scenario like, two kvm guest sitting on one host, or a single kvm 
> guest send packets to a physical host works like a charm.
>
> Swiitch debug option on, dpdk lib spit as below:
> VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
> VHOST_CONFIG: vring call idx:0 file:62
> VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
> VHOST_CONFIG: vring call idx:0 file:58
>
> VHOST_DATA: F0 Failed to allocate memory for mbuf. mbuf_pool:0x7fc7411ab5c0
> VHOST_DATA: F0 Failed to allocate memory for mbuf. mbuf_pool:0x7fc7411ab5c0
> VHOST_DATA: F0 Failed to allocate memory for mbuf. mbuf_pool:0x7fc7411ab5c0
> VHOST_DATA: F0 Failed to allocate memory for mbuf. mbuf_pool:0x7fc7411ab5c0
> VHOST_DATA: F0 Failed to allocate memory for mbuf. mbuf_pool:0x7fc7411ab5c0
> VHOST_DATA: F0 Failed to allocate memory for mbuf. mbuf_pool:0x7fc7411ab5c0
> VHOST_DATA: F0 Failed to allocate memory for mbuf. mbuf_pool:0x7fc7411ab5c0
> VHOST_DATA: F0 Failed to allocate memory for mbuf. mbuf_pool:0x7fc7411ab5c0
>
> After some tweaks of logging code, and looks like bad things happens within 
> below code snippet:
> In lib/librte_vhost/vhost_rxtx.c function: rte_vhost_dequeue_burst
>
> 612 vb_offset = 0;
> 613 vb_avail = desc->len;
> 614 /* Allocate an mbuf and populate the structure. */
> 615 m = rte_pktmbuf_alloc(mbuf_pool);
> 616 if (unlikely(m == NULL)) {
> 617 RTE_LOG(ERR, VHOST_DATA,
> 618 "F0 Failed to allocate memory for mbuf. 
> mbuf_pool:%p\n", mbuf_pool);
> 619 break;
> 620 }
> 621 seg_offset = 0;
> 622 seg_avail = m->buf_len - RTE_PKTMBUF_HEADROOM;
> 623 cpy_len = RTE_MIN(vb_avail, seg_avail);
>
>
>
> ___
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev