[dpdk-dev] [PATCH v4 4/6] ether: Check VMDq RSS mode

2015-01-06 Thread Vlad Zolotarov

On 01/06/15 03:56, Ouyang, Changchun wrote:
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Monday, January 5, 2015 6:10 PM
>> To: Ouyang, Changchun;dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v4 4/6] ether: Check VMDq RSS mode
>>
>>
>> On 01/05/15 03:00, Ouyang, Changchun wrote:
 -Original Message-
 From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
 Sent: Sunday, January 4, 2015 5:46 PM
 To: Ouyang, Changchun;dev at dpdk.org
 Subject: Re: [dpdk-dev] [PATCH v4 4/6] ether: Check VMDq RSS mode


 On 01/04/15 10:58, Ouyang, Changchun wrote:
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Sunday, January 4, 2015 4:45 PM
>> To: Ouyang, Changchun;dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v4 4/6] ether: Check VMDq RSS mode
>>
>>
>> On 01/04/15 09:18, Ouyang Changchun wrote:
>>> Check mq mode for VMDq RSS, handle it correctly instead of
>>> returning an error; Also remove the limitation of per pool queue
>>> number has max value of 1, because the per pool queue number
>> could
>>> be 2 or 4 if it is VMDq RSS mode;
>>>
>>> The number of rxq specified in config will determine the mq mode
>>> for
>> VMDq RSS.
>>> Signed-off-by: Changchun Ouyang
>>> ---
>>>  lib/librte_ether/rte_ethdev.c | 39
>> ++-
>>>  1 file changed, 34 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/lib/librte_ether/rte_ethdev.c
>>> b/lib/librte_ether/rte_ethdev.c index 95f2ceb..59ff325 100644
>>> --- a/lib/librte_ether/rte_ethdev.c
>>> +++ b/lib/librte_ether/rte_ethdev.c
>>> @@ -510,8 +510,7 @@ rte_eth_dev_check_mq_mode(uint8_t
>> port_id,
>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>
>>> if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
>>> /* check multi-queue mode */
>>> -   if ((dev_conf->rxmode.mq_mode ==
>> ETH_MQ_RX_RSS) ||
>>> -   (dev_conf->rxmode.mq_mode ==
>> ETH_MQ_RX_DCB) ||
>>> +   if ((dev_conf->rxmode.mq_mode ==
>> ETH_MQ_RX_DCB) ||
>>> (dev_conf->rxmode.mq_mode ==
>> ETH_MQ_RX_DCB_RSS)
>> ||
>>> (dev_conf->txmode.mq_mode ==
>> ETH_MQ_TX_DCB)) {
>>> /* SRIOV only works in VMDq enable mode
>> */ @@ -
>> 525,7 +524,6 @@
>>> rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q,
>> uint16_t nb_tx_q,
>>> }
>>>
>>> switch (dev_conf->rxmode.mq_mode) {
>>> -   case ETH_MQ_RX_VMDQ_RSS:
>>> case ETH_MQ_RX_VMDQ_DCB:
>>> case ETH_MQ_RX_VMDQ_DCB_RSS:
>>> /* DCB/RSS VMDQ in SRIOV mode, not
>> implement
>> yet */ @@ -534,6
>>> +532,39 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t
>> nb_rx_q, uint16_t nb_tx_q,
>>> "unsupported VMDQ
>> mq_mode
>> rx %u\n",
>>> port_id, dev_conf-
>>> rxmode.mq_mode);
>>> return (-EINVAL);
>>> +   case ETH_MQ_RX_RSS:
>>> +   PMD_DEBUG_TRACE("ethdev port_id=%"
>> PRIu8
>>> +   " SRIOV active, "
>>> +   "Rx mq mode is changed
>> from:"
>>> +   "mq_mode %u into VMDQ
>> mq_mode %u\n",
>>> +   port_id,
>>> +   dev_conf-
>>> rxmode.mq_mode,
>>> +   dev->data-
>>> dev_conf.rxmode.mq_mode);
>>> +   case ETH_MQ_RX_VMDQ_RSS:
>>> +   dev->data->dev_conf.rxmode.mq_mode =
>> ETH_MQ_RX_VMDQ_RSS;
>>> +   if (nb_rx_q <
>> RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) {
 Missed that before: shouldn't it be "<=" here?
>>> Agree with you, need <= here, I will fix it in v5
>>>
>>> +   switch (nb_rx_q) {
>>> +   case 1:
>>> +   case 2:
>>> +
>>  RTE_ETH_DEV_SRIOV(dev).active =
>>> +   ETH_64_POOLS;
>>> +   break;
>>> +   case 4:
>>> +
>>  RTE_ETH_DEV_SRIOV(dev).active =
>>> +   ETH_32_POOLS;
>>> +   break;
>>> +   default:
>>> +
>>  PMD_DEBUG_TRACE("ethdev
>> port_id=%d"
>>> +   " SRIOV active, "
>>> +   

[dpdk-dev] [PATCH v2 12/12] mk: introduce Tilera Tile architecture

2015-01-06 Thread Zhigang Lu
Add defconfig and rte.vars.mk files for Tile architecture.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 config/defconfig_tile-tilegx-linuxapp-gcc | 78 +++
 mk/arch/tile/rte.vars.mk  | 59 +++
 mk/machine/tilegx/rte.vars.mk | 58 +++
 3 files changed, 195 insertions(+)
 create mode 100644 config/defconfig_tile-tilegx-linuxapp-gcc
 create mode 100644 mk/arch/tile/rte.vars.mk
 create mode 100644 mk/machine/tilegx/rte.vars.mk

diff --git a/config/defconfig_tile-tilegx-linuxapp-gcc 
b/config/defconfig_tile-tilegx-linuxapp-gcc
new file mode 100644
index 000..5a944d5
--- /dev/null
+++ b/config/defconfig_tile-tilegx-linuxapp-gcc
@@ -0,0 +1,78 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Tilera 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.
+#
+
+#include "common_linuxapp"
+
+CONFIG_RTE_MACHINE="tilegx"
+
+CONFIG_RTE_ARCH="tile"
+CONFIG_RTE_ARCH_TILE=y
+CONFIG_RTE_ARCH_64=y
+
+CONFIG_RTE_TOOLCHAIN="gcc"
+CONFIG_RTE_TOOLCHAIN_GCC=y
+CONFIG_RTE_TOOLCHAIN_DEBUG=y
+
+CONFIG_RTE_FORCE_INTRINSICS=y
+CONFIG_RTE_LIBNAME="tile_dpdk"
+CONFIG_RTE_MAX_LCORE=128
+CONFIG_RTE_PKTMBUF_HEADROOM=66
+
+#
+# Compile burst-oriented MPIPE PMD driver
+#
+CONFIG_RTE_LIBRTE_MPIPE_PMD=y
+CONFIG_RTE_LIBRTE_MPIPE_DEBUG_INIT=y
+CONFIG_RTE_LIBRTE_MPIPE_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_MPIPE_DEBUG_TX=n
+
+# Note: TileGx doesn't have this support
+CONFIG_RTE_EAL_IGB_UIO=n
+CONFIG_RTE_EAL_VFIO=n
+CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n
+CONFIG_RTE_LIBRTE_EM_PMD=n
+CONFIG_RTE_LIBRTE_IGB_PMD=n
+CONFIG_RTE_LIBRTE_IXGBE_PMD=n
+CONFIG_RTE_LIBRTE_I40E_PMD=n
+CONFIG_RTE_LIBRTE_VIRTIO_PMD=n
+CONFIG_RTE_LIBRTE_VMXNET3_PMD=n
+CONFIG_RTE_LIBRTE_PMD_BOND=n
+CONFIG_RTE_LIBRTE_ENIC_PMD=n
+
+# The following libraries are not available on TileGx.
+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_KNI=n
diff --git a/mk/arch/tile/rte.vars.mk b/mk/arch/tile/rte.vars.mk
new file mode 100644
index 000..238bbe2
--- /dev/null
+++ b/mk/arch/tile/rte.vars.mk
@@ -0,0 +1,59 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Tilera 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 DIRE

[dpdk-dev] [PATCH v2 11/12] eal: allow empty set of compile time cpuflags

2015-01-06 Thread Zhigang Lu
On architectures that do not rely on RTE_COMPILE_TIME_CPUFLAGS, the
compile_time_flags[] array can end up being zero sized.  This results in a
compiler complaint in the subsequent loop.  Pulling out the array size
computation silences this complaint.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 lib/librte_eal/common/eal_common_cpuflags.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_cpuflags.c 
b/lib/librte_eal/common/eal_common_cpuflags.c
index 6fd360c..7a1ca26 100644
--- a/lib/librte_eal/common/eal_common_cpuflags.c
+++ b/lib/librte_eal/common/eal_common_cpuflags.c
@@ -62,10 +62,12 @@ rte_cpu_check_supported(void)
static const enum rte_cpu_flag_t compile_time_flags[] = {
RTE_COMPILE_TIME_CPUFLAGS
};
+   unsigned count =
+   sizeof(compile_time_flags)/sizeof(compile_time_flags[0]);
unsigned i;
int ret;

-   for (i = 0; i < 
sizeof(compile_time_flags)/sizeof(compile_time_flags[0]); i++) {
+   for (i = 0; i < count; i++) {
ret = rte_cpu_get_flag_enabled(compile_time_flags[i]);

if (ret < 0) {
-- 
2.1.2



[dpdk-dev] [PATCH v2 10/12] app/test: remove architecture specific code from cpuflags test

2015-01-06 Thread Zhigang Lu
Test all defined CPU flags for supported architectures so that we
do not have to include conditional compilation for each architecture
in app test case.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 app/test/test_cpuflags.c | 78 
 1 file changed, 5 insertions(+), 73 deletions(-)

diff --git a/app/test/test_cpuflags.c b/app/test/test_cpuflags.c
index 5aeba5d..1a58c03 100644
--- a/app/test/test_cpuflags.c
+++ b/app/test/test_cpuflags.c
@@ -77,81 +77,13 @@ cpu_flag_result(int result)
 static int
 test_cpuflags(void)
 {
-   int result;
+   int i, result;
printf("\nChecking for flags from different registers...\n");

-#ifdef RTE_ARCH_PPC_64
-   printf("Check for PPC64:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_PPC64);
-
-   printf("Check for PPC32:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_PPC32);
-
-   printf("Check for VSX:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_VSX);
-
-   printf("Check for DFP:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_DFP);
-
-   printf("Check for FPU:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_FPU);
-
-   printf("Check for SMT:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_SMT);
-
-   printf("Check for MMU:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_MMU);
-
-   printf("Check for ALTIVEC:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_ALTIVEC);
-
-   printf("Check for ARCH_2_06:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_ARCH_2_06);
-
-   printf("Check for ARCH_2_07:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_ARCH_2_07);
-
-   printf("Check for ICACHE_SNOOP:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_ICACHE_SNOOP);
-#else
-   printf("Check for SSE:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_SSE);
-
-   printf("Check for SSE2:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_SSE2);
-
-   printf("Check for SSE3:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_SSE3);
-
-   printf("Check for SSE4.1:\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_SSE4_1);
-
-   printf("Check for SSE4.2:\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_SSE4_2);
-
-   printf("Check for AVX:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_AVX);
-
-   printf("Check for AVX2:\t\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_AVX2);
-
-   printf("Check for TRBOBST:\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_TRBOBST);
-
-   printf("Check for ENERGY_EFF:\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_ENERGY_EFF);
-
-   printf("Check for LAHF_SAHF:\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_LAHF_SAHF);
-
-   printf("Check for 1GB_PG:\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_1GB_PG);
-
-   printf("Check for INVTSC:\t");
-   CHECK_FOR_FLAG(RTE_CPUFLAG_INVTSC);
-
-
-#endif
+   for (i = 0; i < RTE_CPUFLAG_NUMFLAGS; i++) {
+   printf("Check for %s:\t\t", cpu_feature_table[i].name);
+   CHECK_FOR_FLAG(i);
+   }

/*
 * Check if invalid data is handled properly
-- 
2.1.2



[dpdk-dev] [PATCH v2 09/12] eal/tile: add CPU flags operations for TileGx

2015-01-06 Thread Zhigang Lu
This patch adds empty functions for CPU flags operations to support DPDK,
since tile processor doesn't have CPU flag hardware registers.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 .../common/include/arch/tile/rte_cpuflags.h| 78 ++
 1 file changed, 78 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_cpuflags.h

diff --git a/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h 
b/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h
new file mode 100644
index 000..872e38c
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h
@@ -0,0 +1,78 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Tilera 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_CPUFLAGS_TILE_H_
+#define _RTE_CPUFLAGS_TILE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+#include 
+
+#include "generic/rte_cpuflags.h"
+
+enum rte_cpu_flag_t {
+   RTE_CPUFLAG_SSE4_1 = 0, /**< SSE4_1 */
+   /* The last item */
+   RTE_CPUFLAG_NUMFLAGS,   /**< This should always be the last! */
+};
+
+static const struct feature_entry cpu_feature_table[] = {
+   FEAT_DEF(SSE4_1, 0x, 0, 0, 0)
+};
+
+static inline void
+rte_cpu_get_features(__rte_unused uint32_t leaf,
+__rte_unused uint32_t subleaf,
+__rte_unused cpuid_registers_t out)
+{
+}
+
+static inline int
+rte_cpu_get_flag_enabled(__rte_unused enum rte_cpu_flag_t feature)
+{
+   if (feature >= RTE_CPUFLAG_NUMFLAGS)
+   /* Flag does not match anything in the feature tables */
+   return -ENOENT;
+
+   return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_CPUFLAGS_TILE_H_ */
-- 
2.1.2



[dpdk-dev] [PATCH v2 08/12] eal/tile: add vector operations for TileGx

2015-01-06 Thread Zhigang Lu
Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 .../common/include/arch/tile/rte_common_vect.h | 49 ++
 1 file changed, 49 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_common_vect.h

diff --git a/lib/librte_eal/common/include/arch/tile/rte_common_vect.h 
b/lib/librte_eal/common/include/arch/tile/rte_common_vect.h
new file mode 100644
index 000..f759a20
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_common_vect.h
@@ -0,0 +1,49 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Tilera 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_COMMON_VECT_TILE_H_
+#define _RTE_COMMON_VECT_TILE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_common_vect.h"
+
+typedef long __m128i __attribute__ ((__vector_size__ (16)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_COMMON__VECT_X86_H_ */
-- 
2.1.2



[dpdk-dev] [PATCH v2 07/12] eal: split vector operations to architecture specific

2015-01-06 Thread Zhigang Lu
This patch splits vector operations from DPDK and push them
to architecture specific arch directories, so that other processor
architecture can implement its own vector functions to support DPDK.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 lib/librte_eal/common/Makefile |  3 +-
 .../common/include/arch/ppc_64/rte_common_vect.h   | 73 +
 .../common/include/arch/x86/rte_common_vect.h  | 81 +++
 .../common/include/generic/rte_common_vect.h   | 51 
 lib/librte_eal/common/include/rte_common_vect.h| 93 --
 5 files changed, 206 insertions(+), 95 deletions(-)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_common_vect.h
 create mode 100644 lib/librte_eal/common/include/arch/x86/rte_common_vect.h
 create mode 100644 lib/librte_eal/common/include/generic/rte_common_vect.h
 delete mode 100644 lib/librte_eal/common/include/rte_common_vect.h

diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 52c1a5f..02cac22 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -39,7 +39,6 @@ INC += rte_rwlock.h rte_tailq.h rte_interrupts.h rte_alarm.h
 INC += rte_string_fns.h rte_version.h rte_tailq_elem.h
 INC += rte_eal_memconfig.h rte_malloc_heap.h
 INC += rte_hexdump.h rte_devargs.h rte_dev.h
-INC += rte_common_vect.h
 INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h

 ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)
@@ -47,7 +46,7 @@ INC += rte_warnings.h
 endif

 GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h
-GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h
+GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_common_vect.h
 # defined in mk/arch/$(RTE_ARCH)/rte.vars.mk
 ARCH_DIR ?= $(RTE_ARCH)
 ARCH_INC := $(notdir $(wildcard 
$(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_common_vect.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_common_vect.h
new file mode 100644
index 000..485b7eb
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_common_vect.h
@@ -0,0 +1,73 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (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_COMMON_VECT_PPC_64_H_
+#define _RTE_COMMON_VECT_PPC_64_H_
+
+/**
+ * @file
+ *
+ * RTE SSE/AVX related header.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_common_vect.h"
+
+#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
+
+#ifdef __SSE__
+#include 
+#endif
+
+#ifdef __SSE2__
+#include 
+#endif
+
+#if defined(__SSE4_2__) || defined(__SSE4_1__)
+#include 
+#endif
+
+#else
+
+#include 
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_COMMON__VECT_PPC_64_H_ */
diff --git a/lib/librte_eal/common/include/arch/x86/rte_common_vect.h 
b/lib/librte_eal/common/include/arch/x86/rte_common_vect.h
new file mode 100644
index 000..5ffe3fb
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/x86/rte_common_vect.h
@@ -0,0 +1,81 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided tha

[dpdk-dev] [PATCH v2 06/12] eal/tile: add cycle operations for TileGx

2015-01-06 Thread Zhigang Lu
This patch adds CPU TSC read operations for TileGx.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 .../common/include/arch/tile/rte_cycles.h  | 64 ++
 1 file changed, 64 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_cycles.h

diff --git a/lib/librte_eal/common/include/arch/tile/rte_cycles.h 
b/lib/librte_eal/common/include/arch/tile/rte_cycles.h
new file mode 100644
index 000..74e11cf
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_cycles.h
@@ -0,0 +1,64 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Tilera 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_CYCLES_TILE_H_
+#define _RTE_CYCLES_TILE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_cycles.h"
+
+#include 
+
+static inline uint64_t
+rte_rdtsc(void)
+{
+   return get_cycle_count();
+}
+
+static inline uint64_t
+rte_rdtsc_precise(void)
+{
+   return rte_rdtsc();
+}
+
+static inline uint64_t
+rte_get_tsc_cycles(void) { return rte_rdtsc(); }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_CYCLES_TILE_H_ */
-- 
2.1.2



[dpdk-dev] [PATCH v2 05/12] eal/tile: add memcpy operations for TileGx

2015-01-06 Thread Zhigang Lu
Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 .../common/include/arch/tile/rte_memcpy.h  | 97 ++
 1 file changed, 97 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_memcpy.h

diff --git a/lib/librte_eal/common/include/arch/tile/rte_memcpy.h 
b/lib/librte_eal/common/include/arch/tile/rte_memcpy.h
new file mode 100644
index 000..ef68787
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_memcpy.h
@@ -0,0 +1,97 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Tilera 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_MEMCPY_TILE_H_
+#define _RTE_MEMCPY_TILE_H_
+
+#include 
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_memcpy.h"
+
+static inline void
+rte_mov16(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 16);
+}
+
+static inline void
+rte_mov32(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 32);
+}
+
+static inline void
+rte_mov48(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 48);
+}
+
+static inline void
+rte_mov64(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 64);
+}
+
+static inline void
+rte_mov128(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 128);
+}
+
+static inline void
+rte_mov256(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 256);
+}
+
+#define rte_memcpy(dst, src, n)  \
+   ((__builtin_constant_p(n)) ?  \
+   memcpy((dst), (src), (n)) :  \
+   rte_memcpy_func((dst), (src), (n)))
+
+static inline void *
+rte_memcpy_func(void *dst, const void *src, size_t n)
+{
+   return memcpy(dst, src, n);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MEMCPY_TILE_H_ */
-- 
2.1.2



[dpdk-dev] [PATCH v2 04/12] eal/tile: add prefetch operations for TileGx

2015-01-06 Thread Zhigang Lu
Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 .../common/include/arch/tile/rte_prefetch.h| 62 ++
 1 file changed, 62 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_prefetch.h

diff --git a/lib/librte_eal/common/include/arch/tile/rte_prefetch.h 
b/lib/librte_eal/common/include/arch/tile/rte_prefetch.h
new file mode 100644
index 000..01a5d21
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_prefetch.h
@@ -0,0 +1,62 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Tilera 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_PREFETCH_TILE_H_
+#define _RTE_PREFETCH_TILE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_prefetch.h"
+
+static inline void rte_prefetch0(volatile void *p)
+{
+   __builtin_prefetch((const void *)(uintptr_t)p, 0, 3);
+}
+
+static inline void rte_prefetch1(volatile void *p)
+{
+   __builtin_prefetch((const void *)(uintptr_t)p, 0, 2);
+}
+
+static inline void rte_prefetch2(volatile void *p)
+{
+   __builtin_prefetch((const void *)(uintptr_t)p, 0, 1);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PREFETCH_TILE_H_ */
-- 
2.1.2



[dpdk-dev] [PATCH v2 03/12] eal/tile: add spinlock operations for TileGx

2015-01-06 Thread Zhigang Lu
TileGx uses generic spinlock operations.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 .../common/include/arch/tile/rte_spinlock.h| 47 ++
 1 file changed, 47 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_spinlock.h

diff --git a/lib/librte_eal/common/include/arch/tile/rte_spinlock.h 
b/lib/librte_eal/common/include/arch/tile/rte_spinlock.h
new file mode 100644
index 000..1dc224e
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_spinlock.h
@@ -0,0 +1,47 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Tilera 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_SPINLOCK_TILE_H_
+#define _RTE_SPINLOCK_TILE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_spinlock.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_SPINLOCK_TILE_H_ */
-- 
2.1.2



[dpdk-dev] [PATCH v2 02/12] eal/tile: add byte order operations for TileGx

2015-01-06 Thread Zhigang Lu
This patch adds architecture specific byte swap and endianness
operations for TileGx.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 .../common/include/arch/tile/rte_byteorder.h   | 70 ++
 1 file changed, 70 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_byteorder.h

diff --git a/lib/librte_eal/common/include/arch/tile/rte_byteorder.h 
b/lib/librte_eal/common/include/arch/tile/rte_byteorder.h
new file mode 100644
index 000..38f3a23
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_byteorder.h
@@ -0,0 +1,70 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Tilera 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_BYTEORDER_TILE_H_
+#define _RTE_BYTEORDER_TILE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_byteorder.h"
+
+/*
+ * __builtin_bswap16 is only available gcc 4.8 and upwards
+ */
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
+#define rte_bswap16(x) ((uint16_t)rte_constant_bswap16(x))
+#endif
+
+#define rte_cpu_to_le_16(x) (x)
+#define rte_cpu_to_le_32(x) (x)
+#define rte_cpu_to_le_64(x) (x)
+
+#define rte_cpu_to_be_16(x) rte_bswap16(x)
+#define rte_cpu_to_be_32(x) rte_bswap32(x)
+#define rte_cpu_to_be_64(x) rte_bswap64(x)
+
+#define rte_le_to_cpu_16(x) (x)
+#define rte_le_to_cpu_32(x) (x)
+#define rte_le_to_cpu_64(x) (x)
+
+#define rte_be_to_cpu_16(x) rte_bswap16(x)
+#define rte_be_to_cpu_32(x) rte_bswap32(x)
+#define rte_be_to_cpu_64(x) rte_bswap64(x)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_BYTEORDER_TILE_H_ */
-- 
2.1.2



[dpdk-dev] [PATCH v2 01/12] eal/tile: add atomic operations for TileGx

2015-01-06 Thread Zhigang Lu
This patch adds architecture specific memory barrier operations for
TileGx.

Signed-off-by: Zhigang Lu 
Signed-off-by: Cyril Chemparathy 
---
 .../common/include/arch/tile/rte_atomic.h  | 62 ++
 1 file changed, 62 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_atomic.h

diff --git a/lib/librte_eal/common/include/arch/tile/rte_atomic.h 
b/lib/librte_eal/common/include/arch/tile/rte_atomic.h
new file mode 100644
index 000..24c9b0a
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_atomic.h
@@ -0,0 +1,62 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014 Tilera Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Tilera 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_ATOMIC_TILE_H_
+#define _RTE_ATOMIC_TILE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_atomic.h"
+
+static inline void rte_mb(void)
+{
+   __sync_synchronize();
+}
+
+static inline void rte_wmb(void)
+{
+   __sync_synchronize();
+}
+
+static inline void rte_rmb(void)
+{
+   __sync_synchronize();
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_ATOMIC_TILE_H_ */
-- 
2.1.2



[dpdk-dev] [PATCH v4 6/6] testpmd: Set Rx VMDq RSS mode

2015-01-06 Thread Vlad Zolotarov

On 01/06/15 04:01, Ouyang, Changchun wrote:
>
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Monday, January 5, 2015 6:12 PM
>> To: Ouyang, Changchun; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v4 6/6] testpmd: Set Rx VMDq RSS mode
>>
>>
>> On 01/05/15 04:38, Ouyang, Changchun wrote:
 -Original Message-
 From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
 Sent: Sunday, January 4, 2015 5:47 PM
 To: Ouyang, Changchun; dev at dpdk.org
 Subject: Re: [dpdk-dev] [PATCH v4 6/6] testpmd: Set Rx VMDq RSS mode


 On 01/04/15 11:01, Ouyang, Changchun wrote:
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Sunday, January 4, 2015 4:50 PM
>> To: Ouyang, Changchun; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v4 6/6] testpmd: Set Rx VMDq RSS
>> mode
>>
>>
>> On 01/04/15 09:18, Ouyang Changchun wrote:
>>> Set VMDq RSS mode if it has VF(VF number is more than 1) and has
>>> RSS
>> information.
>>> Signed-off-by: Changchun Ouyang 
>>> ---
>>>  app/test-pmd/testpmd.c | 10 ++
>>>  1 file changed, 10 insertions(+)
>>>
>>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
>>> 8c69756..6230f8b 100644
>>> --- a/app/test-pmd/testpmd.c
>>> +++ b/app/test-pmd/testpmd.c
>>> @@ -1708,6 +1708,16 @@ init_port_config(void)
>>> port->dev_conf.rxmode.mq_mode =
>> ETH_MQ_RX_NONE;
>>> }
>>>
>>> +   if (port->dev_info.max_vfs != 0) {
>>> +   if (port-
>>> dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
>>> +   port->dev_conf.rxmode.mq_mode =
>>> +   ETH_MQ_RX_VMDQ_RSS;
>>> +   else {
>>> +   port->dev_conf.rxmode.mq_mode =
>> ETH_MQ_RX_NONE;
>>> +   port->dev_conf.txmode.mq_mode =
>> ETH_MQ_TX_NONE;
>>
>> And what about the txmode.mq_mode when RSS is available (the :if"
 clause)?
> I think we can keep its original value for txmode.mq_mode, so don't
 change its value. How do you think of it?

 I agree that not changing a Tx mq_mode in both cases would be better.
>>> In the else clause, set txmode.mq_mode as ETH_MQ_TX_NONE explicitly
>> to
>>> make sure it is neither ETH_MQ_TX_DCB, ETH_MQ_TX_VMDQ_DCB, nor
>> ETH_MQ_TX_VMDQ_ONLY.
>>
>> It's not obvious to me why u should do that since AFAIK any of these modes
>> requires RX_RSS. Do I miss anything?
> No, I don't think so, in the else clause, it doesn't need rx_rss, and no way 
> to do it,
> because the case is there is no rss configuration information(note: in the 
> else clause, dev_conf.rx_adv_conf.rss_conf.rss_hf == 0).
>
> So ETH_MQ_RX_NONE for rx_mode, and ETH_MQ_TX_NONE for tx_mode.

Of course, however, in general, one may ask, why u configure TX MQ mode 
in "else" clause an don't do it in the "if" one. Possibly the "if" case 
in TX MQ context has been handled elsewhere but this is what makes this 
code confusing: to make it the most readable u'd rather configure the 
same feature set in both "if" and "else".
For instance:

if (bla-bla) {
   tx_mode = X1;
   rx_mode = X2;
} else {
  tx_mode = Y1;
  rx_mode = Y2;
}

Look at the non-SR-IOV clause right above the "if-else" block u've 
added. Why don't they configure tx_mode there? Is it a bug in their code?
By the way, u forgot to fix the remark below

/* In SR-IOV mode, RSS mode is not available */

which is located a few lines above the code u've added. ;)

>
> Thanks
> Changchun
>
>



[dpdk-dev] [PATCH v4 3/6] ixgbe: Get VF queue number

2015-01-06 Thread Vlad Zolotarov

On 01/06/15 03:54, Ouyang, Changchun wrote:
>
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Monday, January 5, 2015 6:07 PM
>> To: Ouyang, Changchun; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v4 3/6] ixgbe: Get VF queue number
>>
>>
>> On 01/05/15 04:59, Ouyang, Changchun wrote:
 -Original Message-
 From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
 Sent: Sunday, January 4, 2015 4:39 PM
 To: Ouyang, Changchun; dev at dpdk.org
 Subject: Re: [dpdk-dev] [PATCH v4 3/6] ixgbe: Get VF queue number


 On 01/04/15 09:18, Ouyang Changchun wrote:
> Get the available Rx and Tx queue number when receiving
 IXGBE_VF_GET_QUEUES message from VF.
> Signed-off-by: Changchun Ouyang 
> ---
> lib/librte_pmd_ixgbe/ixgbe_pf.c | 35
 ++-
> 1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> b/lib/librte_pmd_ixgbe/ixgbe_pf.c index 495aff5..cbb0145 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
> @@ -53,6 +53,8 @@
> #include "ixgbe_ethdev.h"
>
> #define IXGBE_MAX_VFTA (128)
> +#define IXGBE_VF_MSG_SIZE_DEFAULT 1 #define
> +IXGBE_VF_GET_QUEUE_MSG_SIZE 5
>
> static inline uint16_t
> dev_num_vf(struct rte_eth_dev *eth_dev) @@ -491,9 +493,36 @@
> ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf,
> uint32_t
 *msgbuf)
> }
>
> static int
> +ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t
> +*msgbuf) {
> + struct ixgbe_vf_info *vfinfo =
> + *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
> dev_private);
> + uint32_t default_q = vf * RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
> +
> + /* Verify if the PF supports the mbox APIs version or not */
> + switch (vfinfo[vf].api_version) {
> + case ixgbe_mbox_api_20:
> + case ixgbe_mbox_api_11:
> + break;
> + default:
> + return -1;
> + }
> +
> + /* Notify VF of Rx and Tx queue number */
> + msgbuf[IXGBE_VF_RX_QUEUES] =
 RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
> + msgbuf[IXGBE_VF_TX_QUEUES] =
 RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
> +
> + /* Notify VF of default queue */
> + msgbuf[IXGBE_VF_DEF_QUEUE] = default_q;
 What about IXGBE_VF_TRANS_VLAN field?
>>> This field is used for vlan strip or dcb case, which the vf rss don't need 
>>> it.
>> But VFs do support VLAN stripping and u don't add it to just RSS. If VFs do 
>> not
>> support VLAN stripping in the DPDK yet they should and then we will need
>> this field.
> If I don't miss your point, you also agree it is not related to vf rss 
> itself, right?

Right.

> As for Vlan stripping, it need another patch to support it.

Well, at least put some fat comment in bold there that some the fields 
in the command is not filled and why. ;)

>
> +
> + return 0;
> +}
> +
> +static int
> ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
> {
>   uint16_t mbx_size = IXGBE_VFMAILBOX_SIZE;
> + uint16_t msg_size = IXGBE_VF_MSG_SIZE_DEFAULT;
>   uint32_t msgbuf[IXGBE_VFMAILBOX_SIZE];
>   int32_t retval;
>   struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> @@ -537,6 +566,10 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev
>> *dev,
 uint16_t vf)
>   case IXGBE_VF_API_NEGOTIATE:
>   retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
>   break;
> + case IXGBE_VF_GET_QUEUES:
> + retval = ixgbe_get_vf_queues(dev, vf, msgbuf);
> + msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
 Although the msg_size semantics and motivation is clear, if u want to do
>> then
 do it all the way - add it to all other cases too not just to
 IXGBE_VF_GET_QUEUES.
 For instance, why do u write all 16 DWORDS for API negotiation (only 2 are
 required) and only here u decided to get "greedy"? ;)

 My point is: either drop it completely or fix all other places as well.
>>> This is because the actual message size required by 2 different
>> message(api-negotiation and vf-get-queue)
>>> are different, the first one require only 4 bytes, the second one need 20
>> bytes.
>>> If both use 4 bytes, then the second one will have incomplete message.
>>> If both use 20 bytes, then the first one will contain garbage info which is 
>>> not
>> necessary at all.
>>> So the code logic looks as above.
>> I understood the motivation at the first place but as I've explained
>> above we already bring the garbage for some opcodes like API
>> negotiation. So, u should either fix it for all opcodes like u did for
>> GET_QUEUES or just drop it in GET_QUEUES and fix it for all opcode

[dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic

2015-01-06 Thread Vlad Zolotarov

On 01/06/15 03:11, Ouyang, Changchun wrote:
>
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Monday, January 5, 2015 9:02 PM
>> To: Richardson, Bruce; Ouyang, Changchun
>> Cc: dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
>>
>>
>> On 01/05/15 12:38, Bruce Richardson wrote:
>>> On Thu, Dec 25, 2014 at 01:46:54AM +, Ouyang, Changchun wrote:
 Hi,

> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Wednesday, December 24, 2014 5:59 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
>
>>>>
> On the contrary - it's a very good idea! We use DPDK on Amazon's
> guests with enhanced networking and we have no access to the PF. We
> still need to know the RSS redirection rules for our VF pool. From
> the 82599 spec, chapter
> 4.6.10.1.1: "redirection table is common to all the pools and only
> indicates the queue inside the pool to use once the pool is chosen".
> In that case we need to get the whole 128 entries of the RETA. Is
> there a reason why we can't have it?
>
 Due to hardware limitation, VF could not query its own reta table,
 because there is not its own reta, The reta table shared by pf and all vfs.
 If you need know it, query them on pf is feasible way to do it.

>>> It's not feasible if you only have access to a guest. :-) IMHO since
>>> the guest is seeing the results of the RSS redirection table, it
>>> should be able to query the table, if it wants. It should not,
>>> however, be able to modify the table, as it is owned by the PF.
>> This is exactly what I meant! ;)
>> The problem at the moment is that upstream PF driver has no VF-PF
>> command for that and I'm in the process of pushing the patch for it.
>> Then it's accepted (and pushed into the Amazon's HV ;)) then DPDK's VF
>> driver may proceed with what u and me are suggesting.
> Besides lack of command between pf and vf, another issue, pf also need know 
> which entries from the whole 128 entries in reta table are assigned
> To a specified vf.

First of all PF knows since it configures it for a VF in a x550 and for 
older devices the (whole) RETA is shared between the PF and VF. There is 
a per-pool RTYPE[n].RQPL
register that defines the number of lsb's from the redirection table to 
consider (see my patch series "ixgbevf: Allow querying VFs RSS 
indirection table and key" in the netdev list).

>
>> Not related question to Intel guys: I can't find a x550 spec in the net.
>> Can anybody tell me where it may be found? ;)
> AFAIK, not yet

Well, too bad... ;) I'll have to hope I guessed right during the driver 
reverse engineering... ;)

>
>>> Regards,
>>> /Bruce
>>>



[dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic

2015-01-06 Thread Vlad Zolotarov

On 01/06/15 03:11, Ouyang, Changchun wrote:
>
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Monday, January 5, 2015 9:02 PM
>> To: Richardson, Bruce; Ouyang, Changchun
>> Cc: dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
>>
>>
>> On 01/05/15 12:38, Bruce Richardson wrote:
>>> On Thu, Dec 25, 2014 at 01:46:54AM +, Ouyang, Changchun wrote:
 Hi,

> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Wednesday, December 24, 2014 5:59 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
>
>>>>
> On the contrary - it's a very good idea! We use DPDK on Amazon's
> guests with enhanced networking and we have no access to the PF. We
> still need to know the RSS redirection rules for our VF pool. From
> the 82599 spec, chapter
> 4.6.10.1.1: "redirection table is common to all the pools and only
> indicates the queue inside the pool to use once the pool is chosen".
> In that case we need to get the whole 128 entries of the RETA. Is
> there a reason why we can't have it?
>
 Due to hardware limitation, VF could not query its own reta table,
 because there is not its own reta, The reta table shared by pf and all vfs.
 If you need know it, query them on pf is feasible way to do it.

>>> It's not feasible if you only have access to a guest. :-) IMHO since
>>> the guest is seeing the results of the RSS redirection table, it
>>> should be able to query the table, if it wants. It should not,
>>> however, be able to modify the table, as it is owned by the PF.
>> This is exactly what I meant! ;)
>> The problem at the moment is that upstream PF driver has no VF-PF
>> command for that and I'm in the process of pushing the patch for it.
>> Then it's accepted (and pushed into the Amazon's HV ;)) then DPDK's VF
>> driver may proceed with what u and me are suggesting.
> Besides lack of command between pf and vf, another issue, pf also need know 
> which entries from the whole 128 entries in reta table are assigned
> To a specified vf.

First of all PF knows since it configures it for a VF in a x550 and for 
older devices the (whole) RETA is shared between the PF and VF. There is 
a per-pool RTYPE[n].RQPL
register that defines the number of lsb's from the redirection table to 
consider (see my patch series "ixgbevf: Allow querying VFs RSS 
indirection table and key" in the netdev list).

>
>> Not related question to Intel guys: I can't find a x550 spec in the net.
>> Can anybody tell me where it may be found? ;)
> AFAIK, not yet

Well, too bad... ;) I'll have to hope I guessed right during the driver 
reverse engineering... ;)

>
>>> Regards,
>>> /Bruce
>>>



[dpdk-dev] [PATCH v4 7/7] Move common functions in eal_pci.c

2015-01-06 Thread Ravi Kerur
Changes in v4
Move common functions in eal_pci.c to librte_eal/common/
eal_common_pci.c file.

Following functions are moved to eal_common_pci.c file.

void *pci_map_resource(void *requested_addr, const int vfio_fd,
  const char *devname, off_t offset, size_t size);
int pci_addr_comparison(struct rte_pci_addr *addr,
struct rte_pci_addr *addr2);
int rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr,
struct rte_pci_device *dev);

Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
common function.
Fix checkpatch warnings and errors.

Changes in v3
N/A

Changes in v2
N/A

Changes in v1
N/A

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/eal_pci.c| 127 +
 lib/librte_eal/common/eal_common_pci.c | 171 -
 lib/librte_eal/common/eal_private.h|  60 ++
 lib/librte_eal/linuxapp/eal/eal_pci.c  | 113 +--
 lib/librte_eal/linuxapp/eal/eal_pci_init.h |   6 -
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c  |  36 ++
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c |   9 +-
 7 files changed, 245 insertions(+), 277 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 74ecce7..5c81ea3 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -109,7 +109,7 @@ TAILQ_HEAD(uio_res_list, uio_resource);
 static struct uio_res_list *uio_res_list = NULL;

 /* unbind kernel driver for this device */
-static int
+int
 pci_unbind_kernel_driver(struct rte_pci_device *dev __rte_unused)
 {
RTE_LOG(ERR, EAL, "RTE_PCI_DRV_FORCE_UNBIND flag is not implemented "
@@ -117,45 +117,6 @@ pci_unbind_kernel_driver(struct rte_pci_device *dev 
__rte_unused)
return -ENOTSUP;
 }

-/* map a particular resource from a file */
-static void *
-pci_map_resource(void *requested_addr, const char *devname, off_t offset,
-size_t size)
-{
-   int fd;
-   void *mapaddr;
-
-   /*
-* open devname, to mmap it
-*/
-   fd = open(devname, O_RDWR);
-   if (fd < 0) {
-   RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-   devname, strerror(errno));
-   goto fail;
-   }
-
-   /* Map the PCI memory resource of device */
-   mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE,
-   MAP_SHARED, fd, offset);
-   close(fd);
-   if (mapaddr == MAP_FAILED ||
-   (requested_addr != NULL && mapaddr != requested_addr)) {
-   RTE_LOG(ERR, EAL, "%s(): cannot mmap(%s(%d), %p, 0x%lx, 0x%lx):"
-   " %s (%p)\n", __func__, devname, fd, requested_addr,
-   (unsigned long)size, (unsigned long)offset,
-   strerror(errno), mapaddr);
-   goto fail;
-   }
-
-   RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
-
-   return mapaddr;
-
-fail:
-   return NULL;
-}
-
 static int
 pci_uio_map_secondary(struct rte_pci_device *dev)
 {
@@ -169,7 +130,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
continue;

for (i = 0; i != uio_res->nb_maps; i++) {
-   if (pci_map_resource(uio_res->maps[i].addr,
+   if (pci_map_resource(uio_res->maps[i].addr, INT_MIN,
 uio_res->path,
 (off_t)uio_res->maps[i].offset,
 (size_t)uio_res->maps[i].size)
@@ -187,7 +148,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 }

 /* map the PCI resource of a PCI device in virtual memory */
-static int
+int
 pci_uio_map_resource(struct rte_pci_device *dev)
 {
int i, j;
@@ -253,7 +214,8 @@ pci_uio_map_resource(struct rte_pci_device *dev)
maps[j].phaddr = dev->mem_resource[i].phys_addr;
maps[j].size = dev->mem_resource[i].len;
if (maps[j].addr != NULL ||
-   (mapaddr = pci_map_resource(NULL, devname, (off_t)offset,
+   (mapaddr = pci_map_resource(NULL, INT_MIN, devname,
+   (off_t)offset,
(size_t)maps[j].size)
) == NULL) {
rte_free(uio_res);
@@ -270,20 +232,6 @@ pci_uio_map_resource(struct rte_pci_device *dev)
return (0);
 }

-/* Compare two PCI device addresses. */
-static int
-pci_addr_comparison(struct rte_pci_addr *addr, struct rte_pci_addr *addr2)
-{
-   uint64_t dev_addr = (addr->domain << 24) + (addr->bus << 16) + 
(addr->devid << 8) + addr->function;
-   uint64_t dev_addr2 = (addr2->domain << 24) + (addr2->bus << 16) + 
(addr2->devid << 8) + addr2->function;
-
-   if (dev_addr > dev_addr2)
-   return 1;
-   else
-  

[dpdk-dev] [PATCH v4 6/7] Move common functions in eal_memory.c

2015-01-06 Thread Ravi Kerur
Changes in v4
Make rte_eal_hugepage_init and rte_eal_hugepage_attach as
wrapper functions for BSD.

Changes in v3
Changed subject to be more explicit on file name inclusion.

Changes in v2
Use common function names rte_eal_hugepage_init and
rte_eal_hugepage_attach for BSD and Linux. Update comments about its
actuality in function declaration.

Changes in v1
Move common functions in eal_memory.c to librte_eal/common/
eal_common_memory.c file.

Following functions are moved to eal_common_memory.c file

static int rte_eal_memdevice_init(void); int rte_eal_memory_init(void);

Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/eal_memory.c| 47 +++
 lib/librte_eal/common/eal_common_memory.c | 38 +++--
 lib/librte_eal/common/eal_private.h   | 22 +++
 lib/librte_eal/linuxapp/eal/eal_memory.c  | 36 ++-
 4 files changed, 76 insertions(+), 67 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c 
b/lib/librte_eal/bsdapp/eal/eal_memory.c
index 65ee87d..7a7d9d7 100644
--- a/lib/librte_eal/bsdapp/eal/eal_memory.c
+++ b/lib/librte_eal/bsdapp/eal/eal_memory.c
@@ -59,7 +59,7 @@ rte_mem_virt2phy(const void *virtaddr)
return RTE_BAD_PHYS_ADDR;
 }

-static int
+static inline int
 rte_eal_contigmem_init(void)
 {
struct rte_mem_config *mcfg;
@@ -130,7 +130,16 @@ rte_eal_contigmem_init(void)
return 0;
 }

-static int
+/*
+ * Wrapper function to initialize contigmem.
+ */
+int
+rte_eal_hugepage_init(void)
+{
+   return rte_eal_contigmem_init();
+}
+
+static inline int
 rte_eal_contigmem_attach(void)
 {
const struct hugepage_info *hpi;
@@ -190,35 +199,11 @@ error:
return -1;
 }

-
-static int
-rte_eal_memdevice_init(void)
-{
-   struct rte_config *config;
-
-   if (rte_eal_process_type() == RTE_PROC_SECONDARY)
-   return 0;
-
-   config = rte_eal_get_configuration();
-   config->mem_config->nchannel = internal_config.force_nchannel;
-   config->mem_config->nrank = internal_config.force_nrank;
-
-   return 0;
-}
-
-/* init memory subsystem */
+/*
+ * Wrapper function to attach contigmem.
+ */
 int
-rte_eal_memory_init(void)
+rte_eal_hugepage_attach(void)
 {
-   RTE_LOG(INFO, EAL, "Setting up physically contiguous memory...\n");
-   const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
-   rte_eal_contigmem_init() :
-   rte_eal_contigmem_attach();
-   if (retval < 0)
-   return -1;
-
-   if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
-   return -1;
-
-   return 0;
+   return rte_eal_contigmem_attach();
 }
diff --git a/lib/librte_eal/common/eal_common_memory.c 
b/lib/librte_eal/common/eal_common_memory.c
index 77830f8..cb27930 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -46,6 +46,7 @@
 #include 

 #include "eal_private.h"
+#include "eal_internal_cfg.h"

 /*
  * Return a pointer to a read-only table of struct rte_physmem_desc
@@ -70,7 +71,7 @@ rte_eal_get_physmem_size(void)
/* get pointer to global configuration */
mcfg = rte_eal_get_configuration()->mem_config;

-   for (i=0; imemseg[i].addr == NULL)
break;

@@ -90,7 +91,7 @@ rte_dump_physmem_layout(FILE *f)
/* get pointer to global configuration */
mcfg = rte_eal_get_configuration()->mem_config;

-   for (i=0; imemseg[i].addr == NULL)
break;

@@ -119,3 +120,36 @@ unsigned rte_memory_get_nrank(void)
 {
return rte_eal_get_configuration()->mem_config->nrank;
 }
+
+static int
+rte_eal_memdevice_init(void)
+{
+   struct rte_config *config;
+
+   if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+   return 0;
+
+   config = rte_eal_get_configuration();
+   config->mem_config->nchannel = internal_config.force_nchannel;
+   config->mem_config->nrank = internal_config.force_nrank;
+
+   return 0;
+}
+
+/* init memory subsystem */
+int
+rte_eal_memory_init(void)
+{
+   RTE_LOG(INFO, EAL, "Setting up physically contiguous memory...\n");
+   const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
+   rte_eal_hugepage_init() :
+   rte_eal_hugepage_attach();
+
+   if (retval < 0)
+   return -1;
+
+   if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
+   return -1;
+
+   return 0;
+}
diff --git a/lib/librte_eal/common/eal_private.h 
b/lib/librte_eal/common/eal_private.h
index f907e79..71ba5fd 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -326,4 +326,26 @@ int set_tsc_freq_from_clock(void);
  */
 void rte_set_tsc_hz(uint64_t tsc_hz);

+/**
+ * This function prepares physical memory mapping
+ * i.e. hugepages on Linux

[dpdk-dev] [PATCH v4 5/7] Move common functions in eal_timer.c

2015-01-06 Thread Ravi Kerur
Changes in v4
Removed extern declaration of eal_tsc_resolution_hz,
instead provided _set_ API.
Make set_tsc_freq_from_clock as wrapper function for BSD.

Changes in v3
Changed subject to be more explicit on file name inclusion.

Changes in v2
Use common function name set_tsc_freq_from_sysctl for BSD and Linux.
Update comments about its actuality in function declaration.

Changes in v1
Move common functions in eal_timer.c to librte_eal/common/
eal_common_timer.c file.

Following functions are  moved to eal_common_timer.c file

void rte_delay_us(unsigned us);
uint64_t rte_get_tsc_hz(void);
static void set_tsc_freq_fallback(void);
void set_tsc_freq(void);

Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile   |   1 +
 lib/librte_eal/bsdapp/eal/eal_timer.c|  54 +++--
 lib/librte_eal/common/eal_common_timer.c | 101 +++
 lib/librte_eal/common/eal_private.h  |  24 
 lib/librte_eal/linuxapp/eal/Makefile |   1 +
 lib/librte_eal/linuxapp/eal/eal_timer.c  |  55 ++---
 6 files changed, 140 insertions(+), 96 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_timer.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index e01b5f3..a86123c 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -76,6 +76,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_timer.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/eal_timer.c 
b/lib/librte_eal/bsdapp/eal/eal_timer.c
index 3163496..bbcc69d 100644
--- a/lib/librte_eal/bsdapp/eal/eal_timer.c
+++ b/lib/librte_eal/bsdapp/eal/eal_timer.c
@@ -56,29 +56,12 @@

 enum timer_source eal_timer_source = EAL_TIMER_TSC;

-/* The frequency of the RDTSC timer resolution */
-static uint64_t eal_tsc_resolution_hz = 0;
-
-void
-rte_delay_us(unsigned us)
-{
-   const uint64_t start = rte_get_timer_cycles();
-   const uint64_t ticks = (uint64_t)us * rte_get_timer_hz() / 1E6;
-   while ((rte_get_timer_cycles() - start) < ticks)
-   rte_pause();
-}
-
-uint64_t
-rte_get_tsc_hz(void)
-{
-   return eal_tsc_resolution_hz;
-}
-
-static int
+static inline int
 set_tsc_freq_from_sysctl(void)
 {
size_t sz;
int tmp;
+   uint64_t tsc_hz;

sz = sizeof(tmp);
tmp = 0;
@@ -95,42 +78,23 @@ set_tsc_freq_from_sysctl(void)
else if (tmp != 1)
RTE_LOG(WARNING, EAL, "TSC is not invariant\n");

-   sz = sizeof(eal_tsc_resolution_hz);
-   if (sysctlbyname("machdep.tsc_freq", &eal_tsc_resolution_hz, &sz, NULL, 
0)) {
+   sz = sizeof(tsc_hz);
+   if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) {
RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
return -1;
}
+   rte_set_tsc_hz(tsc_hz);

return 0;
 }

-static void
-set_tsc_freq_fallback(void)
-{
-   RTE_LOG(WARNING, EAL, "WARNING: clock_gettime cannot use "
-   "CLOCK_MONOTONIC_RAW and HPET is not available"
-   " - clock timings may be less accurate.\n");
-   /* assume that the sleep(1) will sleep for 1 second */
-   uint64_t start = rte_rdtsc();
-   sleep(1);
-   eal_tsc_resolution_hz = rte_rdtsc() - start;
-}
-
 /*
- * This function measures the TSC frequency. It uses a variety of approaches.
- *
- * 1. Read the TSC frequency value provided by the kernel
- * 2. If above does not work, just sleep for 1 second and tune off that,
- *printing a warning about inaccuracy of timing
+ * Wrapper function to get TSC frequency from sysctl.
  */
-static void
-set_tsc_freq(void)
+int
+set_tsc_freq_from_clock(void)
 {
-   if (set_tsc_freq_from_sysctl() < 0)
-   set_tsc_freq_fallback();
-
-   RTE_LOG(INFO, EAL, "TSC frequency is ~%"PRIu64" KHz\n",
-   eal_tsc_resolution_hz/1000);
+   return set_tsc_freq_from_sysctl();
 }

 int
diff --git a/lib/librte_eal/common/eal_common_timer.c 
b/lib/librte_eal/common/eal_common_timer.c
new file mode 100644
index 000..2a511d0
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_timer.c
@@ -0,0 +1,101 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the fo

[dpdk-dev] [PATCH v4 4/7] Move common functions in eal_lcore.c

2015-01-06 Thread Ravi Kerur
Changes in v4
Implement cpu_detected() for BSD.
Have common RTE_LOG for Linux and BSD in rte_eal_cpu_init().
Remove RTE_EXEC_ENV_BSDAPP in common file.

Changes in v3
Changed subject to be more explicit on file name inclusion.

Changes in v2
None

Changes in v1
Move common function in eal_lcore.c to librte_eal/common/
eal_common_lcore.c file.

Following function is  moved to eal_common_lcore.c file

int rte_eal_cpu_init(void);

Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
common function.
Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile   |  1 +
 lib/librte_eal/bsdapp/eal/eal_lcore.c| 61 +---
 lib/librte_eal/common/eal_common_lcore.c | 95 
 lib/librte_eal/common/eal_private.h  | 21 +++
 lib/librte_eal/linuxapp/eal/Makefile |  1 +
 lib/librte_eal/linuxapp/eal/eal_lcore.c  | 55 +-
 6 files changed, 136 insertions(+), 98 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_lcore.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index c0b73e9..e01b5f3 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -75,6 +75,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/eal_lcore.c 
b/lib/librte_eal/bsdapp/eal/eal_lcore.c
index 662f024..bf37603 100644
--- a/lib/librte_eal/bsdapp/eal/eal_lcore.c
+++ b/lib/librte_eal/bsdapp/eal/eal_lcore.c
@@ -43,10 +43,19 @@
 #include "eal_private.h"

 /* No topology information available on FreeBSD including NUMA info */
-#define cpu_core_id(X) 0
-#define cpu_socket_id(X) 0
+unsigned
+cpu_core_id(__attribute__((unused)) unsigned lcore_id)
+{
+   return 0;
+}

-static int
+unsigned
+cpu_socket_id(__attribute__((unused)) unsigned lcore_id)
+{
+   return 0;
+}
+
+static inline int
 get_ncpus(void)
 {
int mib[2] = {CTL_HW, HW_NCPU};
@@ -58,50 +67,10 @@ get_ncpus(void)
return ncpu;
 }

-/*
- * fill the cpu_info structure with as much info as we can get.
- * code is similar to linux version, but sadly available info is less.
- */
+/* Check if a cpu is present by the presence of the cpu information for it */
 int
-rte_eal_cpu_init(void)
+cpu_detected(unsigned lcore_id)
 {
-   /* pointer to global configuration */
-   struct rte_config *config = rte_eal_get_configuration();
-   unsigned lcore_id;
-   unsigned count = 0;
-
const unsigned ncpus = get_ncpus();
-   /*
-* Parse the maximum set of logical cores, detect the subset of running
-* ones and enable them by default.
-*/
-   for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
-   lcore_config[lcore_id].detected = (lcore_id < ncpus);
-   if (lcore_config[lcore_id].detected == 0) {
-   config->lcore_role[lcore_id] = ROLE_OFF;
-   continue;
-   }
-   /* By default, each detected core is enabled */
-   config->lcore_role[lcore_id] = ROLE_RTE;
-   lcore_config[lcore_id].core_id = cpu_core_id(lcore_id);
-   lcore_config[lcore_id].socket_id = cpu_socket_id(lcore_id);
-   if (lcore_config[lcore_id].socket_id >= RTE_MAX_NUMA_NODES)
-#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID
-   lcore_config[lcore_id].socket_id = 0;
-#else
-   rte_panic("Socket ID (%u) is greater than "
-   "RTE_MAX_NUMA_NODES (%d)\n",
-   lcore_config[lcore_id].socket_id, 
RTE_MAX_NUMA_NODES);
-#endif
-   RTE_LOG(DEBUG, EAL, "Detected lcore %u\n",
-   lcore_id);
-   count++;
-   }
-   /* Set the count of enabled logical cores of the EAL configuration */
-   config->lcore_count = count;
-   RTE_LOG(DEBUG, EAL, "Support maximum %u logical core(s) by 
configuration.\n",
-   RTE_MAX_LCORE);
-   RTE_LOG(DEBUG, EAL, "Detected %u lcore(s)\n", config->lcore_count);
-
-   return 0;
+   return (lcore_id < ncpus);
 }
diff --git a/lib/librte_eal/common/eal_common_lcore.c 
b/lib/librte_eal/common/eal_common_lcore.c
new file mode 100644
index 000..8a1ffd6
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_lcore.c
@@ -0,0 +1,95 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modificatio

[dpdk-dev] [PATCH v4 3/7] Move common functions in eal.c

2015-01-06 Thread Ravi Kerur
Changes in v4
Remove eal_externs.h file, instead use  _get_ and _set_ APIS
to access those variables.
Split eal_common.c into eal_common_system.c and
and eal_common_runtime.c
rte_eal prefix functions are moved to _runtime_ and
eal prefix functions are moved to _system_ files respectively

Changes in v3
Changed subject to be more explicit on file name inclusion.

Changes in v2
In function rte_eal_config_create remove #ifdef _BSDAPP_
and initialize mem_cfg_addr unconditionally.

Changes in v1
Move common functions in eal.c to librte_eal/common/eal_common.c.

Following functions are moved to eal_common.c file.

struct rte_config *rte_eal_get_configuration(void);
int eal_parse_sysfs_value(const char *filename, unsigned long *val);
static void rte_eal_config_create(void);
enum rte_proc_type_t eal_proc_type_detect(void);
void rte_eal_config_init(void);
rte_usage_hook_t rte_set_application_usage_hook(rte_usage_hook_t usage_func);
inline size_t eal_get_hugepage_mem_size(void);
void eal_check_mem_on_local_socket(void);
int sync_func(__attribute__((unused)) void *arg);
inline void rte_eal_mcfg_complete(void);
int rte_eal_has_hugepages(void);
enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id);
enum rte_proc_type_t rte_eal_process_type(void);

Makefile changes to reflect new files added.
Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile |   2 +
 lib/librte_eal/bsdapp/eal/eal.c| 269 --
 lib/librte_eal/common/eal_common_runtime.c | 201 
 lib/librte_eal/common/eal_common_system.c  | 203 
 lib/librte_eal/common/eal_hugepages.h  |   1 +
 lib/librte_eal/common/eal_private.h|  78 
 lib/librte_eal/linuxapp/eal/Makefile   |   2 +
 lib/librte_eal/linuxapp/eal/eal.c  | 290 +
 8 files changed, 563 insertions(+), 483 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_runtime.c
 create mode 100644 lib/librte_eal/common/eal_common_system.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 92dd9a6..c0b73e9 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -58,6 +58,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c

 # from common dir
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_system.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_runtime.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_memzone.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_launch.c
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 69f3c03..4bba352 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -83,27 +83,6 @@

 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)

-/* Allow the application to print its usage message too if set */
-static rte_usage_hook_trte_application_usage_hook = NULL;
-/* early configuration structure, when memory config is not mmapped */
-static struct rte_mem_config early_mem_config;
-
-/* define fd variable here, because file needs to be kept open for the
- * duration of the program, as we hold a write lock on it in the primary proc 
*/
-static int mem_cfg_fd = -1;
-
-static struct flock wr_lock = {
-   .l_type = F_WRLCK,
-   .l_whence = SEEK_SET,
-   .l_start = offsetof(struct rte_mem_config, memseg),
-   .l_len = sizeof(early_mem_config.memseg),
-};
-
-/* Address of global and public configuration */
-static struct rte_config rte_config = {
-   .mem_config = &early_mem_config,
-};
-
 /* internal configuration (per-core) */
 struct lcore_config lcore_config[RTE_MAX_LCORE];

@@ -113,160 +92,58 @@ struct internal_config internal_config;
 /* used by rte_rdtsc() */
 int rte_cycles_vmware_tsc_map;

-/* Return a pointer to the configuration structure */
-struct rte_config *
-rte_eal_get_configuration(void)
-{
-   return &rte_config;
-}
-
-/* parse a sysfs (or other) file containing one integer value */
-int
-eal_parse_sysfs_value(const char *filename, unsigned long *val)
+inline void *
+rte_eal_get_mem_cfg_addr(void)
 {
-   FILE *f;
-   char buf[BUFSIZ];
-   char *end = NULL;
-
-   if ((f = fopen(filename, "r")) == NULL) {
-   RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
-   __func__, filename);
-   return -1;
-   }
-
-   if (fgets(buf, sizeof(buf), f) == NULL) {
-   RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
-   __func__, filename);
-   fclose(f);
-   return -1;
-   }
-   *val = strtoul(buf, &end, 0);
-   if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
-   RTE_LOG(ERR, E

[dpdk-dev] [PATCH v4 2/7] Move common functions in eal_thread.c

2015-01-06 Thread Ravi Kerur
Changes in v4
None

Changes in v3
Changed subject to be more explicit on file name inclusion.

Changes in v2
None

Changes in v1
eal_thread.c has minor differences between Linux and BSD, move
entire file into common directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate on minor differences.
Rename eal_thread.c to eal_common_thread.c
Makefile changes to reflect file move and name change.
Fix checkpatch warnings.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile|   6 +-
 lib/librte_eal/bsdapp/eal/eal_thread.c| 233 
 lib/librte_eal/common/eal_common_thread.c | 248 ++
 lib/librte_eal/linuxapp/eal/Makefile  |   6 +-
 lib/librte_eal/linuxapp/eal/eal_thread.c  | 233 
 5 files changed, 254 insertions(+), 472 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_thread.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 9b83e11..92dd9a6 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -50,7 +50,6 @@ CFLAGS += $(WERROR_FLAGS) -O3
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) := eal.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_memory.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
@@ -73,16 +72,17 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c

 CFLAGS_eal.o := -D_GNU_SOURCE
-#CFLAGS_eal_thread.o := -D_GNU_SOURCE
+#CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
 CFLAGS_eal_log.o := -D_GNU_SOURCE
 CFLAGS_eal_common_log.o := -D_GNU_SOURCE

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-CFLAGS_eal_thread.o += -Wno-return-type
+CFLAGS_eal_common_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif

diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c 
b/lib/librte_eal/bsdapp/eal/eal_thread.c
deleted file mode 100644
index ab05368..000
--- a/lib/librte_eal/bsdapp/eal/eal_thread.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of Intel Corporation nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "eal_private.h"
-#include "eal_thread.h"
-
-RTE_DEFINE_PER_LCORE(unsigned, _lcore_id);
-
-/*
- * Send a message to a slave lcore identified by slave_id to call a
- * function f with argument arg. Once the execution is done, the
- * remote lcore switch in FINISHED state.
- */
-int
-rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)
-{
-   int n;
-   char c = 0;
-

[dpdk-dev] [PATCH v4 1/7] Move common functions in eal_debug.c

2015-01-06 Thread Ravi Kerur
Changes in v4
None

Changes in v3
Changed subject to be more explicit on file name inclusion.

Changes in v2
Remove rte_dump_registers() function since it is not implemented.
Fix comment for _rte_exit()

Changes in v1
eal_debug.c has no difference between Linux and BSD, move
entire file into common directory.
Rename eal_debug.c to eal_common_debug.c
Makefile changes to reflect file move and name change.
Fix checkpatch warnings.

Signed-off-by: Ravi Kerur 
---
 app/test/test_debug.c |   1 -
 lib/librte_eal/bsdapp/eal/Makefile|   2 +-
 lib/librte_eal/bsdapp/eal/eal_debug.c | 113 --
 lib/librte_eal/common/eal_common_debug.c  | 106 
 lib/librte_eal/common/include/rte_debug.h |   7 --
 lib/librte_eal/linuxapp/eal/Makefile  |   2 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c   | 113 --
 7 files changed, 108 insertions(+), 236 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c

diff --git a/app/test/test_debug.c b/app/test/test_debug.c
index 7c3ee92..01d4b76 100644
--- a/app/test/test_debug.c
+++ b/app/test/test_debug.c
@@ -136,7 +136,6 @@ static int
 test_debug(void)
 {
rte_dump_stack();
-   rte_dump_registers();
if (test_panic() < 0)
return -1;
if (test_exit() < 0)
diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index d434882..9b83e11 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -53,7 +53,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
@@ -73,6 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/eal_debug.c 
b/lib/librte_eal/bsdapp/eal/eal_debug.c
deleted file mode 100644
index 44fc4f3..000
--- a/lib/librte_eal/bsdapp/eal/eal_debug.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of Intel Corporation nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-   void *func[BACKTRACE_SIZE];
-   char **symb = NULL;
-   int size;
-
-   size = backtrace(func, BACKTRACE_SIZE);
-   symb = backtrace_symbols(func, size);
-   while (size > 0) {
-   rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
-   "%d: [%s]\n", size, symb[size - 1]);
-   

[dpdk-dev] [PATCH v4 0/7] Move EAL common function

2015-01-06 Thread Ravi Kerur
Fix v3 PATCH review comments from Thomas.
eal_common.c is further split into eal_common_system.c and
eal_common_runtime.c files with appropriate functions.
eal_externs.h file is removed and _get_ and _set_ APIs are
used to access variables.
Functions with same signature in Linux and BSD but different
names are kept intact but Linux function name is used as
wrapper for BSD.
Added eal_pci.c in v4 PATCH.
New files added follow _common_ naming conventions.
Tested against Ubuntu and FreeBSD.

Ravi Kerur (7):
  Move common functions in eal_debug.c
  Move common functions in eal_thread.c
  Move common functions in eal.c
  Move common functions in eal_lcore.c
  Move common functions in eal_timer.c
  Move common functions in eal_memory.c
  Move common functions in eal_pci.c

 app/test/test_debug.c  |   1 -
 lib/librte_eal/bsdapp/eal/Makefile |  12 +-
 lib/librte_eal/bsdapp/eal/eal.c| 269 --
 lib/librte_eal/bsdapp/eal/eal_debug.c  | 113 ---
 lib/librte_eal/bsdapp/eal/eal_lcore.c  |  61 ++
 lib/librte_eal/bsdapp/eal/eal_memory.c |  47 ++---
 lib/librte_eal/bsdapp/eal/eal_pci.c| 127 +
 lib/librte_eal/bsdapp/eal/eal_thread.c | 233 ---
 lib/librte_eal/bsdapp/eal/eal_timer.c  |  54 +-
 lib/librte_eal/common/eal_common_debug.c   | 106 +++
 lib/librte_eal/common/eal_common_lcore.c   |  95 ++
 lib/librte_eal/common/eal_common_memory.c  |  38 +++-
 lib/librte_eal/common/eal_common_pci.c | 171 -
 lib/librte_eal/common/eal_common_runtime.c | 201 
 lib/librte_eal/common/eal_common_system.c  | 203 
 lib/librte_eal/common/eal_common_thread.c  | 248 
 lib/librte_eal/common/eal_common_timer.c   | 101 ++
 lib/librte_eal/common/eal_hugepages.h  |   1 +
 lib/librte_eal/common/eal_private.h| 205 
 lib/librte_eal/common/include/rte_debug.h  |   7 -
 lib/librte_eal/linuxapp/eal/Makefile   |  12 +-
 lib/librte_eal/linuxapp/eal/eal.c  | 290 +
 lib/librte_eal/linuxapp/eal/eal_debug.c| 113 ---
 lib/librte_eal/linuxapp/eal/eal_lcore.c|  55 +-
 lib/librte_eal/linuxapp/eal/eal_memory.c   |  36 +---
 lib/librte_eal/linuxapp/eal/eal_pci.c  | 113 +--
 lib/librte_eal/linuxapp/eal/eal_pci_init.h |   6 -
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c  |  36 +---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c |   9 +-
 lib/librte_eal/linuxapp/eal/eal_thread.c   | 233 ---
 lib/librte_eal/linuxapp/eal/eal_timer.c|  55 +-
 31 files changed, 1522 insertions(+), 1729 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_lcore.c
 create mode 100644 lib/librte_eal/common/eal_common_runtime.c
 create mode 100644 lib/librte_eal/common/eal_common_system.c
 create mode 100644 lib/librte_eal/common/eal_common_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_timer.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c

-- 
1.9.1



[dpdk-dev] [PATCH v4 0/7] Move EAL common function

2015-01-06 Thread Ravi Kerur
Fix v3 PATCH review comments from Thomas.
eal_common.c is further split into eal_common_system.c and
eal_common_runtime.c files with appropriate functions.
eal_externs.h file is removed and _get_ and _set_ APIs are
used to access variables.
Functions with same signature in Linux and BSD but different
names are kept intact but Linux function name is used as
wrapper for BSD.
Added eal_pci.c in v4 PATCH.
New files added follow _common_ naming conventions.
Tested against Ubuntu and FreeBSD.

Ravi Kerur (7):
  Move common functions in eal_debug.c
  Move common functions in eal_thread.c
  Move common functions in eal.c
  Move common functions in eal_lcore.c
  Move common functions in eal_timer.c
  Move common functions in eal_memory.c
  Move common functions in eal_pci.c

 app/test/test_debug.c  |   1 -
 lib/librte_eal/bsdapp/eal/Makefile |  12 +-
 lib/librte_eal/bsdapp/eal/eal.c| 269 --
 lib/librte_eal/bsdapp/eal/eal_debug.c  | 113 ---
 lib/librte_eal/bsdapp/eal/eal_lcore.c  |  61 ++
 lib/librte_eal/bsdapp/eal/eal_memory.c |  47 ++---
 lib/librte_eal/bsdapp/eal/eal_pci.c| 127 +
 lib/librte_eal/bsdapp/eal/eal_thread.c | 233 ---
 lib/librte_eal/bsdapp/eal/eal_timer.c  |  54 +-
 lib/librte_eal/common/eal_common_debug.c   | 106 +++
 lib/librte_eal/common/eal_common_lcore.c   |  95 ++
 lib/librte_eal/common/eal_common_memory.c  |  38 +++-
 lib/librte_eal/common/eal_common_pci.c | 171 -
 lib/librte_eal/common/eal_common_runtime.c | 201 
 lib/librte_eal/common/eal_common_system.c  | 203 
 lib/librte_eal/common/eal_common_thread.c  | 248 
 lib/librte_eal/common/eal_common_timer.c   | 101 ++
 lib/librte_eal/common/eal_hugepages.h  |   1 +
 lib/librte_eal/common/eal_private.h| 205 
 lib/librte_eal/common/include/rte_debug.h  |   7 -
 lib/librte_eal/linuxapp/eal/Makefile   |  12 +-
 lib/librte_eal/linuxapp/eal/eal.c  | 290 +
 lib/librte_eal/linuxapp/eal/eal_debug.c| 113 ---
 lib/librte_eal/linuxapp/eal/eal_lcore.c|  55 +-
 lib/librte_eal/linuxapp/eal/eal_memory.c   |  36 +---
 lib/librte_eal/linuxapp/eal/eal_pci.c  | 113 +--
 lib/librte_eal/linuxapp/eal/eal_pci_init.h |   6 -
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c  |  36 +---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c |   9 +-
 lib/librte_eal/linuxapp/eal/eal_thread.c   | 233 ---
 lib/librte_eal/linuxapp/eal/eal_timer.c|  55 +-
 31 files changed, 1522 insertions(+), 1729 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_lcore.c
 create mode 100644 lib/librte_eal/common/eal_common_runtime.c
 create mode 100644 lib/librte_eal/common/eal_common_system.c
 create mode 100644 lib/librte_eal/common/eal_common_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_timer.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c

-- 
1.9.1



[dpdk-dev] [RFC] resolve conflict between net/ethernet.h and rte_ethdev.h

2015-01-06 Thread Thomas Monjalon
2014-12-27 15:13, Stephen Hemminger:
> This is a patch to address the conflict between 
> and the definitions in . It has two side effects
> worth discussion:
>   1. It forces inclusion of net/ethernet.h
>   2. It has definition to deal with the differing structure elements
>  in the two versions of struct ether_addr.
> 
> By doing this ether_ntoa and related functions can be used without
> messing with prototypes.
> 
> Alternative is more complex #ifdef magic like linux/libc-compat.h

[...]

> +#include 

[...]

> +/* Deprecated definition to allow for compatiablity with net/ethernet.h */
> +#define addr_bytes   ether_addr_octet

This is defining a common identifier without prefix.
So it will be forbidden to use addr_bytes as variable name.
I understand you are trying to keep compatibility with both structures,
but the drawback is really nasty.
Is there another solution? Or at least, we could mark it as deprecated and
remove it in release 2.1.

-- 
Thomas


[dpdk-dev] [PATCH v6 5/6] enicpmd: DPDK-ENIC PMD interface

2015-01-06 Thread Thomas Monjalon
2014-12-30 04:45, Sujith Sankar:
> On 29/12/14 1:45 pm, "Wu, Jingjing"  wrote:
> >I found that in perfect fdir is also supported in enic driver.
> >
> >During the R1.8 development, we defined a new dev_ops call filter_ctrl,
> >which can be used to control kinds of filters, flow director is included
> >too. Which is mentioned in
> >http://www.dpdk.org/ml/archives/dev/2014-September/005179.html .
> >In R1.8, filter_ctrl is only used by i40e driver. And we also planned use
> >it in the existing ixgbe/e1000 driver in the next days. The old APIs such
> >as fdir_add_perfect_filter, fdir_remove_perfect_filter can be replaced
> >then.
> 
> Hi Jingjing,
> Thanks for the info and the link.  I shall take a look at it.
> It looks like bringing in one interface for all filter related operations.
>  I believe ENIC should also move to it.

Yes please.
It is planned to remove or deprecate old flow director API.

-- 
Thomas


[dpdk-dev] l3fwd error, port 0 is not present on the board

2015-01-06 Thread Thomas Monjalon
2015-01-02 09:07, Lyn M:
> In my original post, I thought my choice of hex portmask -p 0x3 was causing
> this issue -- now I know that was not the case.  But, I am still curious
> about how the hex portmask is determined.  Since I only have two ports
> bound to igb_uio, my hex postmask will always be 0x3?  What if I choose to
> bind other ports to igb_uio?  Is there a Linux command I can run to
> determine what mask to use with the -p option?

That's something which could be done.
Port numbering is defined by probing order. Does a tool showing the (dry-run)
probed devices, their number and mask, would help you?
By the way, you are welcome to try developing it.

-- 
Thomas


[dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new rte_acl_classify() method

2015-01-06 Thread Ananyev, Konstantin

Hi Neil,
Any further comments on that one?
Konstantin

> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ananyev, Konstantin
> Sent: Thursday, December 18, 2014 3:02 PM
> To: Neil Horman
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new 
> rte_acl_classify() method
> 
> 
> 
> > -Original Message-
> > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > Sent: Wednesday, December 17, 2014 8:28 PM
> > To: Ananyev, Konstantin
> > Cc: dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new 
> > rte_acl_classify() method
> >
> > On Wed, Dec 17, 2014 at 07:22:06PM +, Ananyev, Konstantin wrote:
> > > > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > > > Sent: Wednesday, December 17, 2014 3:33 PM
> > > > To: Ananyev, Konstantin
> > > > Cc: dev at dpdk.org
> > > > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new 
> > > > rte_acl_classify() method
> > > >
> > > > On Tue, Dec 16, 2014 at 04:16:48PM +, Ananyev, Konstantin wrote:
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > > > > > Sent: Monday, December 15, 2014 8:21 PM
> > > > > > To: Ananyev, Konstantin
> > > > > > Cc: dev at dpdk.org
> > > > > > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new 
> > > > > > rte_acl_classify() method
> > > > > >
> > > > > > On Mon, Dec 15, 2014 at 04:33:47PM +, Ananyev, Konstantin wrote:
> > > > > > > Hi Neil,
> > > > > > >
> > > > > > > > -Original Message-
> > > > > > > > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > > > > > > > Sent: Monday, December 15, 2014 4:00 PM
> > > > > > > > To: Ananyev, Konstantin
> > > > > > > > Cc: dev at dpdk.org
> > > > > > > > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as 
> > > > > > > > new rte_acl_classify() method
> > > > > > > >
> > > > > > > > On Sun, Dec 14, 2014 at 06:10:52PM +, Konstantin Ananyev 
> > > > > > > > wrote:
> > > > > > > > > Introduce new classify() method that uses AVX2 instructions.
> > > > > > > > > From my measurements:
> > > > > > > > > On HSW boards when processing >= 16 packets per call,
> > > > > > > > > AVX2 method outperforms it's SSE counterpart by 10-25%,
> > > > > > > > > (depending on the ruleset).
> > > > > > > > > At runtime, this method is selected as default one on HW that 
> > > > > > > > > supports AVX2.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Konstantin Ananyev  > > > > > > > > intel.com>
> > > > > > > > > ---
> > > > > > > > >  lib/librte_acl/Makefile   |   9 +
> > > > > > > > >  lib/librte_acl/acl.h  |   4 +
> > > > > > > > >  lib/librte_acl/acl_run.h  |   2 +-
> > > > > > > > >  lib/librte_acl/acl_run_avx2.c |  58 +
> > > > > > > > >  lib/librte_acl/acl_run_avx2.h | 305 
> > > > > > > > >  lib/librte_acl/acl_run_sse.c  | 537 
> > > > > > > > > +-
> > > > > > > > >  lib/librte_acl/acl_run_sse.h  | 533 
> > > > > > > > > +
> > > > > > > > >  lib/librte_acl/rte_acl.c  |   5 +-
> > > > > > > > >  lib/librte_acl/rte_acl.h  |   2 +
> > > > > > > > >  9 files changed, 917 insertions(+), 538 deletions(-)
> > > > > > > > >  create mode 100644 lib/librte_acl/acl_run_avx2.c
> > > > > > > > >  create mode 100644 lib/librte_acl/acl_run_avx2.h
> > > > > > > > >  create mode 100644 lib/librte_acl/acl_run_sse.h
> > > > > > > > >
> > > > > > > > > diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
> > > > > > > > > index 65e566d..223ec31 100644
> > > > > > > > > --- a/lib/librte_acl/Makefile
> > > > > > > > > +++ b/lib/librte_acl/Makefile
> > > > > > > > > @@ -45,8 +45,17 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_bld.c
> > > > > > > > >  SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_gen.c
> > > > > > > > >  SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
> > > > > > > > >  SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
> > > > > > > > > +SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_avx2.c
> > > > > > > > >
> > > > > > > > >  CFLAGS_acl_run_sse.o += -msse4.1
> > > > > > > > > +ifeq ($(CC), icc)
> > > > > > > > > +CFLAGS_acl_run_avx2.o += -march=core-avx2
> > > > > > > > > +else ifneq ($(shell \
> > > > > > > > > +test $(GCC_MAJOR_VERSION) -le 4 -a $(GCC_MINOR_VERSION) -le 
> > > > > > > > > 6 && echo 1), 1)
> > > > > > > > > +CFLAGS_acl_run_avx2.o += -mavx2
> > > > > > > > > +else
> > > > > > > > > +CFLAGS_acl_run_avx2.o += -msse4.1
> > > > > > > > > +endif
> > > > > > > > >
> > > > > > > > This seems broken.  You've unilaterally included acl_run_avx2.c 
> > > > > > > > in the build
> > > > > > > > list above, but only enable -mavx2 if the compiler is at least 
> > > > > > > > gcc 4.6.
> > > > > > >
> > > > > > > Actually 4.7 (before that version, as I know,  gcc doesn't 
> > > > > > > support avx2)
> > > > > > >
> > > > > > > >  Unless
> > > > > > > > you want to make gcc 4.

[dpdk-dev] l3fwd error, port 0 is not present on the board

2015-01-06 Thread Bruce Richardson
On Tue, Jan 06, 2015 at 10:02:25AM +0100, Thomas Monjalon wrote:
> 2015-01-02 09:07, Lyn M:
> > In my original post, I thought my choice of hex portmask -p 0x3 was causing
> > this issue -- now I know that was not the case.  But, I am still curious
> > about how the hex portmask is determined.  Since I only have two ports
> > bound to igb_uio, my hex postmask will always be 0x3?  What if I choose to
> > bind other ports to igb_uio?  Is there a Linux command I can run to
> > determine what mask to use with the -p option?
> 
> That's something which could be done.
> Port numbering is defined by probing order. Does a tool showing the (dry-run)
> probed devices, their number and mask, would help you?
> By the way, you are welcome to try developing it.
> 
> -- 
> Thomas

The port numbering should generally be in the same order as the ports are listed
in dpdk_nic_bind script, so perhaps we could just add a documentation note to 
that effect.

/Bruce


[dpdk-dev] [PATCH 4/7] Move EAL common functions

2015-01-06 Thread Ravi Kerur
Inline 

On Mon, Jan 5, 2015 at 12:38 PM, Thomas Monjalon 
wrote:

> 2015-01-05 10:56, Ravi Kerur:
> > On Mon, Jan 5, 2015 at 7:59 AM, Thomas Monjalon <
> thomas.monjalon at 6wind.com>
> > wrote:
> > > 2014-12-25 10:33, Ravi Kerur:
> > > > Move common functions in eal.c to librte_eal/common directory.
> > > [...]
> > > >  lib/librte_eal/common/eal_common.c| 328
> ++
> > > >  lib/librte_eal/common/eal_externs.h   |  42 +
> > >
> > > I don't agree with these new files.
> > > We must try to keep a semantic organization. The file
> eal_common_options.c
> > > would be better for option-related functions.
> > > Maybe that the split between system config, runtime config and internal
> > > config
> > > must be reworked.
> > >
> > > By the way, it would be nice to avoid extern variables.
> >
> >  I have taken care of your comments and will generate v4 patch.
>
> Please do not forget v4 word and changelog when sending patches.
> Check http://dpdk.org/dev#send
>
> > Currently I have moved common functions in eal.c into
> > "eal_common_system_options.c" file. Are you suggesting that we further
> > divide "eal_common_options.c" and "eal_common_system_options.c(new file
> > added)" into 3 separate files i.e.
> >
> > eal_common_system_options.c
> > eal_common_runtime_options.c
> > eal_common_internal_options.c
>
> You are already doing big changes. So let's iterate with existing files and
> avoid creating new ones.
> eal_common_options.c must be kept. But if some code is not really related
> to
> runtime options, we could consider adding a new file eal_common_config.c,
> not
> sure about this one.
>
> --
>

 i have divided eal_common.c (new file which was added in v1 PATCH)
into eal_common_system.c and eal_common_runtime.c and have moved
appropriate functions into it. If file names are not appropriate or changes
are not worth doing the split, I will merge them back into
eal_common_config.c.

Thanks.

> Thomas
>


[dpdk-dev] [PATCH v3 6/6] Move common functions in eal_memory.c

2015-01-06 Thread Ravi Kerur
I have added wrapper function for BSD.

On Mon, Jan 5, 2015 at 1:17 PM, Thomas Monjalon 
wrote:

> 2014-12-30 11:37, Ravi Kerur:
> > Use common function names rte_eal_hugepage_init and
> > rte_eal_hugepage_attach for BSD and Linux.
>
> I'd like to be sure that using hugepage wording instead of contigmem
> is not too weird for BSD people.
> Do not forget that we have a kernel module called contigmem.
> Here, an ifdef or a wrapper seems appropriate to keep right wording.
>
> --
> Thomas
>


[dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new rte_acl_classify() method

2015-01-06 Thread Neil Horman
On Tue, Jan 06, 2015 at 09:57:40AM +, Ananyev, Konstantin wrote:
> 
> Hi Neil,
> Any further comments on that one?
> Konstantin
> 
No, I'm good.  You're comment regarding compiler support makes sense (though its
really unfortunate that we have to do that).  Still need to address the ifdefery
around the method array however.
Neil

> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ananyev, Konstantin
> > Sent: Thursday, December 18, 2014 3:02 PM
> > To: Neil Horman
> > Cc: dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new 
> > rte_acl_classify() method
> > 
> > 
> > 
> > > -Original Message-
> > > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > > Sent: Wednesday, December 17, 2014 8:28 PM
> > > To: Ananyev, Konstantin
> > > Cc: dev at dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new 
> > > rte_acl_classify() method
> > >
> > > On Wed, Dec 17, 2014 at 07:22:06PM +, Ananyev, Konstantin wrote:
> > > > > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > > > > Sent: Wednesday, December 17, 2014 3:33 PM
> > > > > To: Ananyev, Konstantin
> > > > > Cc: dev at dpdk.org
> > > > > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new 
> > > > > rte_acl_classify() method
> > > > >
> > > > > On Tue, Dec 16, 2014 at 04:16:48PM +, Ananyev, Konstantin wrote:
> > > > > >
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > > > > > > Sent: Monday, December 15, 2014 8:21 PM
> > > > > > > To: Ananyev, Konstantin
> > > > > > > Cc: dev at dpdk.org
> > > > > > > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as new 
> > > > > > > rte_acl_classify() method
> > > > > > >
> > > > > > > On Mon, Dec 15, 2014 at 04:33:47PM +, Ananyev, Konstantin 
> > > > > > > wrote:
> > > > > > > > Hi Neil,
> > > > > > > >
> > > > > > > > > -Original Message-
> > > > > > > > > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > > > > > > > > Sent: Monday, December 15, 2014 4:00 PM
> > > > > > > > > To: Ananyev, Konstantin
> > > > > > > > > Cc: dev at dpdk.org
> > > > > > > > > Subject: Re: [dpdk-dev] [PATCH 10/17] librte_acl: add AVX2 as 
> > > > > > > > > new rte_acl_classify() method
> > > > > > > > >
> > > > > > > > > On Sun, Dec 14, 2014 at 06:10:52PM +, Konstantin Ananyev 
> > > > > > > > > wrote:
> > > > > > > > > > Introduce new classify() method that uses AVX2 instructions.
> > > > > > > > > > From my measurements:
> > > > > > > > > > On HSW boards when processing >= 16 packets per call,
> > > > > > > > > > AVX2 method outperforms it's SSE counterpart by 10-25%,
> > > > > > > > > > (depending on the ruleset).
> > > > > > > > > > At runtime, this method is selected as default one on HW 
> > > > > > > > > > that supports AVX2.
> > > > > > > > > >
> > > > > > > > > > Signed-off-by: Konstantin Ananyev  > > > > > > > > > intel.com>
> > > > > > > > > > ---
> > > > > > > > > >  lib/librte_acl/Makefile   |   9 +
> > > > > > > > > >  lib/librte_acl/acl.h  |   4 +
> > > > > > > > > >  lib/librte_acl/acl_run.h  |   2 +-
> > > > > > > > > >  lib/librte_acl/acl_run_avx2.c |  58 +
> > > > > > > > > >  lib/librte_acl/acl_run_avx2.h | 305 
> > > > > > > > > > 
> > > > > > > > > >  lib/librte_acl/acl_run_sse.c  | 537 
> > > > > > > > > > +-
> > > > > > > > > >  lib/librte_acl/acl_run_sse.h  | 533 
> > > > > > > > > > +
> > > > > > > > > >  lib/librte_acl/rte_acl.c  |   5 +-
> > > > > > > > > >  lib/librte_acl/rte_acl.h  |   2 +
> > > > > > > > > >  9 files changed, 917 insertions(+), 538 deletions(-)
> > > > > > > > > >  create mode 100644 lib/librte_acl/acl_run_avx2.c
> > > > > > > > > >  create mode 100644 lib/librte_acl/acl_run_avx2.h
> > > > > > > > > >  create mode 100644 lib/librte_acl/acl_run_sse.h
> > > > > > > > > >
> > > > > > > > > > diff --git a/lib/librte_acl/Makefile 
> > > > > > > > > > b/lib/librte_acl/Makefile
> > > > > > > > > > index 65e566d..223ec31 100644
> > > > > > > > > > --- a/lib/librte_acl/Makefile
> > > > > > > > > > +++ b/lib/librte_acl/Makefile
> > > > > > > > > > @@ -45,8 +45,17 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += 
> > > > > > > > > > acl_bld.c
> > > > > > > > > >  SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_gen.c
> > > > > > > > > >  SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
> > > > > > > > > >  SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
> > > > > > > > > > +SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_avx2.c
> > > > > > > > > >
> > > > > > > > > >  CFLAGS_acl_run_sse.o += -msse4.1
> > > > > > > > > > +ifeq ($(CC), icc)
> > > > > > > > > > +CFLAGS_acl_run_avx2.o += -march=core-avx2
> > > > > > > > > > +else ifneq ($(shell \
> > > > > > > > > > +test $(GCC_MAJOR_VERSION) -le 4 -a $(GCC_MINOR_VERSION) 
> > > > > > > > > > -le 6 && echo 1), 1)
> > > > > > > > > > +CFLAGS_acl_run_a

[dpdk-dev] [PATCH v4 6/6] testpmd: Set Rx VMDq RSS mode

2015-01-06 Thread Ouyang, Changchun


> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Monday, January 5, 2015 6:12 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 6/6] testpmd: Set Rx VMDq RSS mode
> 
> 
> On 01/05/15 04:38, Ouyang, Changchun wrote:
> >
> >> -Original Message-
> >> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> >> Sent: Sunday, January 4, 2015 5:47 PM
> >> To: Ouyang, Changchun; dev at dpdk.org
> >> Subject: Re: [dpdk-dev] [PATCH v4 6/6] testpmd: Set Rx VMDq RSS mode
> >>
> >>
> >> On 01/04/15 11:01, Ouyang, Changchun wrote:
>  -Original Message-
>  From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>  Sent: Sunday, January 4, 2015 4:50 PM
>  To: Ouyang, Changchun; dev at dpdk.org
>  Subject: Re: [dpdk-dev] [PATCH v4 6/6] testpmd: Set Rx VMDq RSS
>  mode
> 
> 
>  On 01/04/15 09:18, Ouyang Changchun wrote:
> > Set VMDq RSS mode if it has VF(VF number is more than 1) and has
> > RSS
>  information.
> > Signed-off-by: Changchun Ouyang 
> > ---
> > app/test-pmd/testpmd.c | 10 ++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 8c69756..6230f8b 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -1708,6 +1708,16 @@ init_port_config(void)
> > port->dev_conf.rxmode.mq_mode =
>  ETH_MQ_RX_NONE;
> > }
> >
> > +   if (port->dev_info.max_vfs != 0) {
> > +   if (port-
> >dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
> > +   port->dev_conf.rxmode.mq_mode =
> > +   ETH_MQ_RX_VMDQ_RSS;
> > +   else {
> > +   port->dev_conf.rxmode.mq_mode =
>  ETH_MQ_RX_NONE;
> > +   port->dev_conf.txmode.mq_mode =
>  ETH_MQ_TX_NONE;
> 
>  And what about the txmode.mq_mode when RSS is available (the :if"
> >> clause)?
> >>> I think we can keep its original value for txmode.mq_mode, so don't
> >> change its value. How do you think of it?
> >>
> >> I agree that not changing a Tx mq_mode in both cases would be better.
> > In the else clause, set txmode.mq_mode as ETH_MQ_TX_NONE explicitly
> to
> > make sure it is neither ETH_MQ_TX_DCB, ETH_MQ_TX_VMDQ_DCB, nor
> ETH_MQ_TX_VMDQ_ONLY.
> 
> It's not obvious to me why u should do that since AFAIK any of these modes
> requires RX_RSS. Do I miss anything?

No, I don't think so, in the else clause, it doesn't need rx_rss, and no way to 
do it,
because the case is there is no rss configuration information(note: in the else 
clause, dev_conf.rx_adv_conf.rss_conf.rss_hf == 0). 

So ETH_MQ_RX_NONE for rx_mode, and ETH_MQ_TX_NONE for tx_mode.

> >
> >>> Thanks
> >>> Changchun
> >>>
> >>>



[dpdk-dev] [PATCH v4 4/6] ether: Check VMDq RSS mode

2015-01-06 Thread Ouyang, Changchun


> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Monday, January 5, 2015 6:10 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 4/6] ether: Check VMDq RSS mode
> 
> 
> On 01/05/15 03:00, Ouyang, Changchun wrote:
> >
> >> -Original Message-
> >> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> >> Sent: Sunday, January 4, 2015 5:46 PM
> >> To: Ouyang, Changchun; dev at dpdk.org
> >> Subject: Re: [dpdk-dev] [PATCH v4 4/6] ether: Check VMDq RSS mode
> >>
> >>
> >> On 01/04/15 10:58, Ouyang, Changchun wrote:
>  -Original Message-
>  From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>  Sent: Sunday, January 4, 2015 4:45 PM
>  To: Ouyang, Changchun; dev at dpdk.org
>  Subject: Re: [dpdk-dev] [PATCH v4 4/6] ether: Check VMDq RSS mode
> 
> 
>  On 01/04/15 09:18, Ouyang Changchun wrote:
> > Check mq mode for VMDq RSS, handle it correctly instead of
> > returning an error; Also remove the limitation of per pool queue
> > number has max value of 1, because the per pool queue number
> could
> > be 2 or 4 if it is VMDq RSS mode;
> >
> > The number of rxq specified in config will determine the mq mode
> > for
>  VMDq RSS.
> > Signed-off-by: Changchun Ouyang 
> > ---
> > lib/librte_ether/rte_ethdev.c | 39
>  ++-
> > 1 file changed, 34 insertions(+), 5 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_ethdev.c
> > b/lib/librte_ether/rte_ethdev.c index 95f2ceb..59ff325 100644
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -510,8 +510,7 @@ rte_eth_dev_check_mq_mode(uint8_t
> port_id,
> > uint16_t nb_rx_q, uint16_t nb_tx_q,
> >
> > if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
> > /* check multi-queue mode */
> > -   if ((dev_conf->rxmode.mq_mode ==
> ETH_MQ_RX_RSS) ||
> > -   (dev_conf->rxmode.mq_mode ==
> ETH_MQ_RX_DCB) ||
> > +   if ((dev_conf->rxmode.mq_mode ==
> ETH_MQ_RX_DCB) ||
> > (dev_conf->rxmode.mq_mode ==
> ETH_MQ_RX_DCB_RSS)
>  ||
> > (dev_conf->txmode.mq_mode ==
> ETH_MQ_TX_DCB)) {
> > /* SRIOV only works in VMDq enable mode
> */ @@ -
>  525,7 +524,6 @@
> > rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q,
>  uint16_t nb_tx_q,
> > }
> >
> > switch (dev_conf->rxmode.mq_mode) {
> > -   case ETH_MQ_RX_VMDQ_RSS:
> > case ETH_MQ_RX_VMDQ_DCB:
> > case ETH_MQ_RX_VMDQ_DCB_RSS:
> > /* DCB/RSS VMDQ in SRIOV mode, not
> implement
>  yet */ @@ -534,6
> > +532,39 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t
>  nb_rx_q, uint16_t nb_tx_q,
> > "unsupported VMDQ
> mq_mode
>  rx %u\n",
> > port_id, dev_conf-
> > rxmode.mq_mode);
> > return (-EINVAL);
> > +   case ETH_MQ_RX_RSS:
> > +   PMD_DEBUG_TRACE("ethdev port_id=%"
> PRIu8
> > +   " SRIOV active, "
> > +   "Rx mq mode is changed
> from:"
> > +   "mq_mode %u into VMDQ
>  mq_mode %u\n",
> > +   port_id,
> > +   dev_conf-
> >rxmode.mq_mode,
> > +   dev->data-
> > dev_conf.rxmode.mq_mode);
> > +   case ETH_MQ_RX_VMDQ_RSS:
> > +   dev->data->dev_conf.rxmode.mq_mode =
>  ETH_MQ_RX_VMDQ_RSS;
> > +   if (nb_rx_q <
>  RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) {
> >> Missed that before: shouldn't it be "<=" here?
> > Agree with you, need <= here, I will fix it in v5
> >
> > +   switch (nb_rx_q) {
> > +   case 1:
> > +   case 2:
> > +
>   RTE_ETH_DEV_SRIOV(dev).active =
> > +   ETH_64_POOLS;
> > +   break;
> > +   case 4:
> > +
>   RTE_ETH_DEV_SRIOV(dev).active =
> > +   ETH_32_POOLS;
> > +   break;
> > +   default:
> > +
>   PMD_DEBUG_TRACE("ethdev
>  port_id=%d"
> > +   " SRIOV active, "
> > +   "queue number
> inva

[dpdk-dev] [PATCH v4 3/6] ixgbe: Get VF queue number

2015-01-06 Thread Ouyang, Changchun


> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Monday, January 5, 2015 6:07 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 3/6] ixgbe: Get VF queue number
> 
> 
> On 01/05/15 04:59, Ouyang, Changchun wrote:
> >
> >> -Original Message-
> >> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> >> Sent: Sunday, January 4, 2015 4:39 PM
> >> To: Ouyang, Changchun; dev at dpdk.org
> >> Subject: Re: [dpdk-dev] [PATCH v4 3/6] ixgbe: Get VF queue number
> >>
> >>
> >> On 01/04/15 09:18, Ouyang Changchun wrote:
> >>> Get the available Rx and Tx queue number when receiving
> >> IXGBE_VF_GET_QUEUES message from VF.
> >>> Signed-off-by: Changchun Ouyang 
> >>> ---
> >>>lib/librte_pmd_ixgbe/ixgbe_pf.c | 35
> >> ++-
> >>>1 file changed, 34 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> >>> b/lib/librte_pmd_ixgbe/ixgbe_pf.c index 495aff5..cbb0145 100644
> >>> --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> >>> +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
> >>> @@ -53,6 +53,8 @@
> >>>#include "ixgbe_ethdev.h"
> >>>
> >>>#define IXGBE_MAX_VFTA (128)
> >>> +#define IXGBE_VF_MSG_SIZE_DEFAULT 1 #define
> >>> +IXGBE_VF_GET_QUEUE_MSG_SIZE 5
> >>>
> >>>static inline uint16_t
> >>>dev_num_vf(struct rte_eth_dev *eth_dev) @@ -491,9 +493,36 @@
> >>> ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf,
> >>> uint32_t
> >> *msgbuf)
> >>>}
> >>>
> >>>static int
> >>> +ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t
> >>> +*msgbuf) {
> >>> + struct ixgbe_vf_info *vfinfo =
> >>> + *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
> >>> dev_private);
> >>> + uint32_t default_q = vf * RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
> >>> +
> >>> + /* Verify if the PF supports the mbox APIs version or not */
> >>> + switch (vfinfo[vf].api_version) {
> >>> + case ixgbe_mbox_api_20:
> >>> + case ixgbe_mbox_api_11:
> >>> + break;
> >>> + default:
> >>> + return -1;
> >>> + }
> >>> +
> >>> + /* Notify VF of Rx and Tx queue number */
> >>> + msgbuf[IXGBE_VF_RX_QUEUES] =
> >> RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
> >>> + msgbuf[IXGBE_VF_TX_QUEUES] =
> >> RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
> >>> +
> >>> + /* Notify VF of default queue */
> >>> + msgbuf[IXGBE_VF_DEF_QUEUE] = default_q;
> >> What about IXGBE_VF_TRANS_VLAN field?
> > This field is used for vlan strip or dcb case, which the vf rss don't need 
> > it.
> 
> But VFs do support VLAN stripping and u don't add it to just RSS. If VFs do 
> not
> support VLAN stripping in the DPDK yet they should and then we will need
> this field.

If I don't miss your point, you also agree it is not related to vf rss itself, 
right?
As for Vlan stripping, it need another patch to support it.

> >
> >>> +
> >>> + return 0;
> >>> +}
> >>> +
> >>> +static int
> >>>ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
> >>>{
> >>>   uint16_t mbx_size = IXGBE_VFMAILBOX_SIZE;
> >>> + uint16_t msg_size = IXGBE_VF_MSG_SIZE_DEFAULT;
> >>>   uint32_t msgbuf[IXGBE_VFMAILBOX_SIZE];
> >>>   int32_t retval;
> >>>   struct ixgbe_hw *hw =
> >>> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> >>> @@ -537,6 +566,10 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev
> *dev,
> >> uint16_t vf)
> >>>   case IXGBE_VF_API_NEGOTIATE:
> >>>   retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
> >>>   break;
> >>> + case IXGBE_VF_GET_QUEUES:
> >>> + retval = ixgbe_get_vf_queues(dev, vf, msgbuf);
> >>> + msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
> >> Although the msg_size semantics and motivation is clear, if u want to do
> then
> >> do it all the way - add it to all other cases too not just to
> >> IXGBE_VF_GET_QUEUES.
> >> For instance, why do u write all 16 DWORDS for API negotiation (only 2 are
> >> required) and only here u decided to get "greedy"? ;)
> >>
> >> My point is: either drop it completely or fix all other places as well.
> > This is because the actual message size required by 2 different
> message(api-negotiation and vf-get-queue)
> > are different, the first one require only 4 bytes, the second one need 20
> bytes.
> > If both use 4 bytes, then the second one will have incomplete message.
> > If both use 20 bytes, then the first one will contain garbage info which is 
> > not
> necessary at all.
> > So the code logic looks as above.
> 
> I understood the motivation at the first place but as I've explained
> above we already bring the garbage for some opcodes like API
> negotiation. So, u should either fix it for all opcodes like u did for
> GET_QUEUES or just drop it in GET_QUEUES and fix it for all opcodes in a
> different patch.

Here maybe I miss your point, my understanding is that  4 bytes are enough for 
all other opcode except for get_queue opcode,
 get_queues is the only one that need 20 

[dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic

2015-01-06 Thread Ouyang, Changchun


> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Monday, January 5, 2015 9:02 PM
> To: Richardson, Bruce; Ouyang, Changchun
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
> 
> 
> On 01/05/15 12:38, Bruce Richardson wrote:
> > On Thu, Dec 25, 2014 at 01:46:54AM +, Ouyang, Changchun wrote:
> >> Hi,
> >>
> >>> -Original Message-
> >>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> >>> Sent: Wednesday, December 24, 2014 5:59 PM
> >>> To: Ouyang, Changchun; dev at dpdk.org
> >>> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
> >>>
> >   >
> >>> On the contrary - it's a very good idea! We use DPDK on Amazon's
> >>> guests with enhanced networking and we have no access to the PF. We
> >>> still need to know the RSS redirection rules for our VF pool. From
> >>> the 82599 spec, chapter
> >>> 4.6.10.1.1: "redirection table is common to all the pools and only
> >>> indicates the queue inside the pool to use once the pool is chosen".
> >>> In that case we need to get the whole 128 entries of the RETA. Is
> >>> there a reason why we can't have it?
> >>>
> >> Due to hardware limitation, VF could not query its own reta table,
> >> because there is not its own reta, The reta table shared by pf and all vfs.
> >> If you need know it, query them on pf is feasible way to do it.
> >>
> > It's not feasible if you only have access to a guest. :-) IMHO since
> > the guest is seeing the results of the RSS redirection table, it
> > should be able to query the table, if it wants. It should not,
> > however, be able to modify the table, as it is owned by the PF.
> 
> This is exactly what I meant! ;)
> The problem at the moment is that upstream PF driver has no VF-PF
> command for that and I'm in the process of pushing the patch for it.
> Then it's accepted (and pushed into the Amazon's HV ;)) then DPDK's VF
> driver may proceed with what u and me are suggesting.

Besides lack of command between pf and vf, another issue, pf also need know 
which entries from the whole 128 entries in reta table are assigned 
To a specified vf. 

> 
> Not related question to Intel guys: I can't find a x550 spec in the net.
> Can anybody tell me where it may be found? ;)

AFAIK, not yet

> >
> > Regards,
> > /Bruce
> >



[dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic

2015-01-06 Thread Ouyang, Changchun


> -Original Message-
> From: Richardson, Bruce
> Sent: Monday, January 5, 2015 6:38 PM
> To: Ouyang, Changchun
> Cc: Vlad Zolotarov; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
> 
> On Thu, Dec 25, 2014 at 01:46:54AM +, Ouyang, Changchun wrote:
> > Hi,
> >
> > > -Original Message-
> > > From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> > > Sent: Wednesday, December 24, 2014 5:59 PM
> > > To: Ouyang, Changchun; dev at dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
> > >
>  >
> > > On the contrary - it's a very good idea! We use DPDK on Amazon's
> > > guests with enhanced networking and we have no access to the PF. We
> > > still need to know the RSS redirection rules for our VF pool. From
> > > the 82599 spec, chapter
> > > 4.6.10.1.1: "redirection table is common to all the pools and only
> > > indicates the queue inside the pool to use once the pool is chosen".
> > > In that case we need to get the whole 128 entries of the RETA. Is
> > > there a reason why we can't have it?
> > >
> > Due to hardware limitation, VF could not query its own reta table,
> > because there is not its own reta, The reta table shared by pf and all vfs.
> > If you need know it, query them on pf is feasible way to do it.
> >
> It's not feasible if you only have access to a guest. :-) IMHO since the 
> guest is
> seeing the results of the RSS redirection table, it should be able to query 
> the
> table, if it wants. It should not, however, be able to modify the table, as 
> it is
> owned by the PF.

Understand the situation, but the real issue is that the guest has no way to 
know the rss redirection table, so it could not query it.



[dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS

2015-01-06 Thread Ouyang, Changchun


> -Original Message-
> From: Richardson, Bruce
> Sent: Monday, January 5, 2015 6:29 PM
> To: Ouyang, Changchun
> Cc: Vlad Zolotarov; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS
> 
> On Fri, Dec 26, 2014 at 01:52:25AM +, Ouyang, Changchun wrote:
> >
> >
> > > -Original Message-
> > > From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> > > Sent: Thursday, December 25, 2014 9:20 PM
> > > To: Ouyang, Changchun; dev at dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS
> > >
>  >
> > > Like I said before, trying to guess what user wants is a way to
> > > making a code that is very hard to use and to maintain. Pls., just
> > > return an error and let the user code deal with it the way he/she
> > > really wants and not the way u *think* he/she wants.
> > >
> > I didn't disagree on this, either :-)
> > If you have strong reason for this way and more guys agree with it, I
> > will modify it probably in v4.
> > > >
> +1 on returning error.
It does in v4 patch.