[dpdk-dev] [PATCH v2] ring: fix minor memory free issue

2015-11-06 Thread John McNamara
Fix minor memory free issue in error clean-up.

Fixes: 651c505af862 ("ring: enhance device setup from rings")
Reported-by Coverity (CID 119258)

Signed-off-by: John McNamara 
---

V2:
* Add fixline.

 drivers/net/ring/rte_eth_ring.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cc60008..b91a643 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -363,9 +363,11 @@ rte_eth_from_rings(const char *name, struct rte_ring 
*const rx_queues[],
return data->port_id;

 error:
-   rte_free(data->rx_queues);
-   rte_free(data->tx_queues);
-   rte_free(data);
+   if (data) {
+   rte_free(data->rx_queues);
+   rte_free(data->tx_queues);
+   rte_free(data);
+   }
rte_free(internals);

return -1;
-- 
1.8.1.4



[dpdk-dev] [PATCH] ring: fix minor memory free issue

2015-11-06 Thread John McNamara
Fix minor memory free issue in error clean-up.

Reported-by Coverity (CID 119258)

Signed-off-by: John McNamara 
---
 drivers/net/ring/rte_eth_ring.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cc60008..9a31bce 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -363,8 +363,10 @@ rte_eth_from_rings(const char *name, struct rte_ring 
*const rx_queues[],
return data->port_id;

 error:
-   rte_free(data->rx_queues);
-   rte_free(data->tx_queues);
+   if (data) {
+   rte_free(data->rx_queues);
+   rte_free(data->tx_queues);
+   }
rte_free(data);
rte_free(internals);

-- 
1.8.1.4



[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-06 Thread Bruce Richardson
On Fri, Nov 06, 2015 at 05:10:07PM +, Bruce Richardson wrote:
> On Thu, Nov 05, 2015 at 04:09:18PM +0100, Adrien Mazarguil wrote:
> > 
> > I won't argue against this as it's obviously more complex than the original
> > method, however note that users of the RTE_PMD_DEBUG_TRACE() macro do not
> > have to modify their code. They shouldn't care about the implementation.
> > 
> > Also note that we can do much cleaner code if we drop the all macros
> > implementation using a (much easier to debug) static inline function,
> > only perhaps with a wrapper macro that provides __LINE__, __func__ and
> > __FILE__ as arguments. Nontrival code shouldn't be done in macros anyway.
> > 
> Getting something working with __FILE__ and probably __LINE__ would be easy 
> enough
> with a helper macro, but __func__ is not so easy as it's not a preprocessor 
> symbol
> [since the pre-processor has no idea what function you are in].
> 
> However, using func, here is the best I've come up with so far. It's not that
> pretty, but it's probably easier to work with than the macro version.
> 
>  #ifdef RTE_LIBRTE_ETHDEV_DEBUG
>  -#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
>  -   RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args)
>  +#define RTE_PMD_DEBUG_TRACE(...) \
>  +   rte_pmd_debug_trace(__func__, __VA_ARGS__)
>  +
>  +static inline void
>  +rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
>  +{
>  +   static __thread char buffer[128];
>  +   char *out_buf = buffer;
>  +   unsigned count;
>  +   va_list ap;
>  +
>  +   count = snprintf(buffer, sizeof(buffer), "%s: %s", func_name, fmt);
>  +   if (count >= sizeof(buffer)) { // truncated output
>  +   char *new_buf = malloc(count + 1);
>  +   if (new_buf == NULL) // no memory, just print 128 chars
>  +   goto print_buffer;
>  +   snprintf(new_buf, count + 1, "%s: %s", func_name, fmt);
>  +   va_start(ap, fmt);
>  +   rte_vlog(RTE_LOG_ERR, RTE_LOGTYPE_PMD, buffer, ap);
>  +   va_end(ap);
>  +   free(new_buf);
>  +   return;
>  +   }
>  +
>  +print_buffer:
>  +   va_start(ap, fmt);
>  +   rte_vlog(RTE_LOG_ERR, RTE_LOGTYPE_PMD, out_buf, ap);
>  +   va_end(ap);
>  +}
>   #else
>   #define RTE_PMD_DEBUG_TRACE(fmt, args...)
>   #endif
> 
> Comments or improvements?
> 
> /Bruce

And here's the version if we are happy to have file and line number instead of
function name. I think this might be the best option.

/Bruce

 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
 -#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
 -   RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args)
 +#define RTE_PMD_DEBUG_TRACE(...) \
 +   RTE_LOG(ERR, PMD, __FILE__", " RTE_STR(__LINE__) ": " __VA_ARGS__)
  #else
 -#define RTE_PMD_DEBUG_TRACE(fmt, args...)
 +#define RTE_PMD_DEBUG_TRACE(...)
  #endif




[dpdk-dev] [v2 1/1] librte_ether: fix coverity errors in rte_eth_copy_pci_info

2015-11-06 Thread Bernard Iremonger
add return statement to if branch

Dereferencing NULL pointer reported by Coverity, CID 119256.
Dereferencing NULL pointer reported by Coverity, CID 119257.

Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e0e1dca..1b73f29 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3276,6 +3276,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct 
rte_pci_device *pci_de
if ((eth_dev == NULL) || (pci_dev == NULL)) {
PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
eth_dev, pci_dev);
+   return;
}

eth_dev->data->dev_flags = 0;
-- 
1.9.1



[dpdk-dev] [v2 0/1] librte_ether: fix coverity errors

2015-11-06 Thread Bernard Iremonger
Changes in v2:
Add return statement to if branch instead of an else branch.

Bernard Iremonger (1):
  librte_ether: fix coverity errors in rte_eth_copy_pci_info

 lib/librte_ether/rte_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

-- 
1.9.1



[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-06 Thread Bruce Richardson
On Thu, Nov 05, 2015 at 04:09:18PM +0100, Adrien Mazarguil wrote:
> 
> I won't argue against this as it's obviously more complex than the original
> method, however note that users of the RTE_PMD_DEBUG_TRACE() macro do not
> have to modify their code. They shouldn't care about the implementation.
> 
> Also note that we can do much cleaner code if we drop the all macros
> implementation using a (much easier to debug) static inline function,
> only perhaps with a wrapper macro that provides __LINE__, __func__ and
> __FILE__ as arguments. Nontrival code shouldn't be done in macros anyway.
> 
Getting something working with __FILE__ and probably __LINE__ would be easy 
enough
with a helper macro, but __func__ is not so easy as it's not a preprocessor 
symbol
[since the pre-processor has no idea what function you are in].

However, using func, here is the best I've come up with so far. It's not that
pretty, but it's probably easier to work with than the macro version.

 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
 -#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
 -   RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args)
 +#define RTE_PMD_DEBUG_TRACE(...) \
 +   rte_pmd_debug_trace(__func__, __VA_ARGS__)
 +
 +static inline void
 +rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
 +{
 +   static __thread char buffer[128];
 +   char *out_buf = buffer;
 +   unsigned count;
 +   va_list ap;
 +
 +   count = snprintf(buffer, sizeof(buffer), "%s: %s", func_name, fmt);
 +   if (count >= sizeof(buffer)) { // truncated output
 +   char *new_buf = malloc(count + 1);
 +   if (new_buf == NULL) // no memory, just print 128 chars
 +   goto print_buffer;
 +   snprintf(new_buf, count + 1, "%s: %s", func_name, fmt);
 +   va_start(ap, fmt);
 +   rte_vlog(RTE_LOG_ERR, RTE_LOGTYPE_PMD, buffer, ap);
 +   va_end(ap);
 +   free(new_buf);
 +   return;
 +   }
 +
 +print_buffer:
 +   va_start(ap, fmt);
 +   rte_vlog(RTE_LOG_ERR, RTE_LOGTYPE_PMD, out_buf, ap);
 +   va_end(ap);
 +}
  #else
  #define RTE_PMD_DEBUG_TRACE(fmt, args...)
  #endif

Comments or improvements?

/Bruce


[dpdk-dev] [PATCH 1/1] librte_ether: fix coverity errors in rte_eth_copy_pci_info

2015-11-06 Thread Iremonger, Bernard
Hi Thomas,

> Subject: Re: [dpdk-dev] [PATCH 1/1] librte_ether: fix coverity errors in
> rte_eth_copy_pci_info
> 
> 2015-11-06 16:30, Bernard Iremonger:
> > add else branch to if statement.
> 
> I think a return statement would be more appropriate.
> 
I will add return statement instead.



Regards,

Bernard.




[dpdk-dev] [PATCH] test: fix eal_flags_autotest due to missing_n_flag test

2015-11-06 Thread Thomas Monjalon
2015-11-06 15:15, Pablo de Lara:
> eal_flags_autotest was broken after commit
> 19bfa4dd ("eal: make the -n argument optional"),
> since the unit test was checking that app would not run
> if -n flag was missing, which now it is possible.
> 
> Also, subtest test_missing_n_flag() has been renamed
> to test_invalid_n_flag(), as now -n flag is not compulsory.
> 
> Signed-off-by: Pablo de Lara 

Applied, thanks


[dpdk-dev] [PATCH v6 2/2] doc: add user-space ethtool sample app guide

2015-11-06 Thread Remy Horton
Signed-off-by: Remy Horton 
---
 doc/guides/rel_notes/release_2_2.rst |   1 +
 doc/guides/sample_app_ug/ethtool.rst | 173 +++
 doc/guides/sample_app_ug/index.rst   |   1 +
 3 files changed, 175 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/ethtool.rst

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..bafebb3 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -187,6 +187,7 @@ Libraries
 Examples
 

+* **ethtool: Added ethtool shim and sample application.**

 Other
 ~
diff --git a/doc/guides/sample_app_ug/ethtool.rst 
b/doc/guides/sample_app_ug/ethtool.rst
new file mode 100644
index 000..36d8dfc
--- /dev/null
+++ b/doc/guides/sample_app_ug/ethtool.rst
@@ -0,0 +1,173 @@
+
+..  BSD LICENSE
+Copyright(c) 2015 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.
+
+EthTool Sample Application
+==
+
+The Ethtool sample application shows an implementation of an
+EthTool-like API and provides a console environment that allows
+its use to query and change Ethernet card parameters. The sample
+is based upon a simple L2 frame reflector.
+
+Compiling the Application
+-
+
+To compile the application:
+
+#.  Go to the sample application directory:
+
+.. code-block:: console
+
+export RTE_SDK=/path/to/rte_sdk cd ${RTE_SD}/examples/ethtool
+
+#.  Set the target (a default target is used if not specified). For example:
+
+.. code-block:: console
+
+export RTE_TARGET=x86_64-native-linuxapp-gcc
+
+See the *DPDK Getting Started Guide* for possible RTE_TARGET values.
+
+#.  Build the application:
+
+.. code-block:: console
+
+make
+
+Running the Application
+---
+
+The application requires an available core for each port, plus one.
+The only available options are the standard ones for the EAL:
+
+.. code-block:: console
+
+./ethtool-app/ethtool-app/${RTE_TARGET}/ethtool [EAL options]
+
+Refer to the *DPDK Getting Started Guide* for general information on
+running applications and the Environment Abstraction Layer (EAL)
+options.
+
+Using the application
+-
+
+The application is console-driven using the cmdline DPDK interface:
+
+.. code-block:: console
+
+EthApp>
+
+From this interface the available commands and descriptions of what
+they do as as follows:
+
+drvinfo
+Print driver info
+eeprom
+Dump EEPROM to file
+link
+Print port link states
+macaddr
+Gets/sets MAC address
+mtu
+Set NIC MTU
+open
+Open port
+pause
+Get/set port pause state
+portstats
+Print port statistics
+regs
+Dump port register(s) to file
+ringparam
+Get/set ring parameters
+rxmode
+Toggle port Rx mode
+stop
+Stop port
+validate
+Check that given MAC address is valid unicast address
+vlan
+Add/remove VLAN id
+quit
+Exit program
+
+Explaination
+
+
+The sample program has two parts: A background `packet reflector`_
+that runs on a slave core, and a foreground `EthTool Shell`_ that
+runs on the master core. These are described below.
+
+Packet Reflector
+
+
+The background packet reflector is intended to demonstrate basic
+packet processing on NIC ports controlled by the EthTool shim.
+Each 

[dpdk-dev] [PATCH v6 1/2] example: add user-space ethtool sample application

2015-11-06 Thread Remy Horton
Further enhancements to the userspace ethtool implementation that was
submitted in 2.1 and packaged as a self-contained sample application.
Implements an rte_ethtool shim layer based on rte_ethdev API, along
with a command prompt driven demonstration application.

Signed-off-by: Remy Horton 
---
 MAINTAINERS   |   4 +
 examples/ethtool/Makefile |  48 ++
 examples/ethtool/ethtool-app/Makefile |  54 +++
 examples/ethtool/ethtool-app/ethapp.c | 873 ++
 examples/ethtool/ethtool-app/ethapp.h |  41 ++
 examples/ethtool/ethtool-app/main.c   | 305 
 examples/ethtool/lib/Makefile |  57 +++
 examples/ethtool/lib/rte_ethtool.c| 421 
 examples/ethtool/lib/rte_ethtool.h| 410 
 9 files changed, 2213 insertions(+)
 create mode 100644 examples/ethtool/Makefile
 create mode 100644 examples/ethtool/ethtool-app/Makefile
 create mode 100644 examples/ethtool/ethtool-app/ethapp.c
 create mode 100644 examples/ethtool/ethtool-app/ethapp.h
 create mode 100644 examples/ethtool/ethtool-app/main.c
 create mode 100644 examples/ethtool/lib/Makefile
 create mode 100644 examples/ethtool/lib/rte_ethtool.c
 create mode 100644 examples/ethtool/lib/rte_ethtool.h

diff --git a/MAINTAINERS b/MAINTAINERS
index c8be5d2..ee58d7a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -520,3 +520,7 @@ F: examples/tep_termination/
 F: examples/vmdq/
 F: examples/vmdq_dcb/
 F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst
+
+M: Remy Horton 
+F: examples/ethtool/
+F: doc/guides/sample_app_ug/ethtool.rst
diff --git a/examples/ethtool/Makefile b/examples/ethtool/Makefile
new file mode 100644
index 000..94f8ee3
--- /dev/null
+++ b/examples/ethtool/Makefile
@@ -0,0 +1,48 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2015 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.
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overwritten by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+ifneq ($(CONFIG_RTE_EXEC_ENV),"linuxapp")
+$(error This application can only operate in a linuxapp environment, \
+please change the definition of the RTE_TARGET environment variable)
+endif
+
+DIRS-y += lib ethtool-app
+
+include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/ethtool/ethtool-app/Makefile 
b/examples/ethtool/ethtool-app/Makefile
new file mode 100644
index 000..09c66ad
--- /dev/null
+++ b/examples/ethtool/ethtool-app/Makefile
@@ -0,0 +1,54 @@
+#   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 

[dpdk-dev] [PATCH v6 0/2] User-space ethtool sample application

2015-11-06 Thread Remy Horton
Further enhancements to the userspace ethtool implementation that was
submitted in 2.1 and packaged as a self-contained sample application.
Implements an rte_ethtool shim layer based on rte_ethdev API, along
with a command prompt driven demonstration application.

This patchset depends on:
* http://dpdk.org/dev/patchwork/patch/6563/
* http://dpdk.org/dev/patchwork/patch/8070/

v6:
* Fixed hang when run with zero available ports
* Fixed incorrect sanity check preventing EEPROM dumps
* Documentation additions
* Fixed RxMode accepting untagged packets
* Fixed ringparam allocation being too small

v5:
* Documentation changes

v4:
* Fixed assumption that master core always has id zero
* Changed 1:1 core-to-port to 2 core (ethtool & ports) design 
* Included the correct documentation..

v3:
* Made use of enums for core state.
* Fixed Makefile issue.
* Fixed incorrect assumption with core ids.
* Changed handling of more ports than cores.

v2:
* Replaced l2fwd base with simpler application.
* Added ringparam functions.
* Added documentation.

Remy Horton (2):
  example: add user-space ethtool sample application
  doc: add user-space ethtool sample app guide & release notes

 MAINTAINERS   |   4 +
 doc/guides/rel_notes/release_2_2.rst  |   1 +
 doc/guides/sample_app_ug/ethtool.rst  | 173 +++
 doc/guides/sample_app_ug/index.rst|   1 +
 examples/ethtool/Makefile |  48 ++
 examples/ethtool/ethtool-app/Makefile |  54 +++
 examples/ethtool/ethtool-app/ethapp.c | 873 ++
 examples/ethtool/ethtool-app/ethapp.h |  41 ++
 examples/ethtool/ethtool-app/main.c   | 305 
 examples/ethtool/lib/Makefile |  57 +++
 examples/ethtool/lib/rte_ethtool.c| 421 
 examples/ethtool/lib/rte_ethtool.h| 410 
 12 files changed, 2388 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/ethtool.rst
 create mode 100644 examples/ethtool/Makefile
 create mode 100644 examples/ethtool/ethtool-app/Makefile
 create mode 100644 examples/ethtool/ethtool-app/ethapp.c
 create mode 100644 examples/ethtool/ethtool-app/ethapp.h
 create mode 100644 examples/ethtool/ethtool-app/main.c
 create mode 100644 examples/ethtool/lib/Makefile
 create mode 100644 examples/ethtool/lib/rte_ethtool.c
 create mode 100644 examples/ethtool/lib/rte_ethtool.h

-- 
1.9.3



[dpdk-dev] [PATCH] autotest.py: increase memory for hash_autotest

2015-11-06 Thread Pablo de Lara
Hash_autotest is in test group 2 which had only 32 MB
of memory, which is increased to 64 MB to make it run.

Signed-off-by: Pablo de Lara 
---
 app/test/autotest_data.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py
index 0c3802b..6f34d6b 100644
--- a/app/test/autotest_data.py
+++ b/app/test/autotest_data.py
@@ -109,7 +109,7 @@ parallel_test_group_list = [
 },
 {
"Prefix":   "group_2",
-   "Memory" :  "32",
+   "Memory" :  "64",
"Tests" :
[
{
-- 
2.5.0



[dpdk-dev] [PATCH v2] i40e: fix the issue of not freeing memzone

2015-11-06 Thread Helin Zhang
This fixes the issue of not freeing memzone in a call to free the
memory for adminq DMA.

Signed-off-by: Helin Zhang 
---
 doc/guides/rel_notes/release_2_2.rst |  5 +
 drivers/net/i40e/base/i40e_osdep.h   |  2 +-
 drivers/net/i40e/i40e_ethdev.c   | 14 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

v2 changes:
Reworked debug messages.

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..eaa906c 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -150,6 +150,11 @@ Drivers

   Added discarding packets on VSI to the stats and rectify the old statistics.

+* **i40e: Fixed issue of not freeing memzone.**
+
+  Fixed the issue of not freeing memzone in the call to free the memory for
+  adminq DMA.
+
 * **vhost: Fixed Qemu shutdown.**

   Fixed issue with libvirt ``virsh destroy`` not killing the VM.
diff --git a/drivers/net/i40e/base/i40e_osdep.h 
b/drivers/net/i40e/base/i40e_osdep.h
index 70d2721..71077f0 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -146,7 +146,7 @@ struct i40e_dma_mem {
void *va;
u64 pa;
u32 size;
-   u64 id;
+   const void *zone;
 } __attribute__((packed));

 #define i40e_allocate_dma_mem(h, m, unused, s, a) \
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ddf3d38..9f06ec2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2910,15 +2910,13 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
u64 size,
u32 alignment)
 {
-   static uint64_t id = 0;
const struct rte_memzone *mz = NULL;
char z_name[RTE_MEMZONE_NAMESIZE];

if (!mem)
return I40E_ERR_PARAM;

-   id++;
-   snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
+   snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, rte_rand());
 #ifdef RTE_LIBRTE_XEN_DOM0
mz = rte_memzone_reserve_bounded(z_name, size, SOCKET_ID_ANY, 0,
 alignment, RTE_PGSIZE_2M);
@@ -2929,7 +2927,6 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
if (!mz)
return I40E_ERR_NO_MEMORY;

-   mem->id = id;
mem->size = size;
mem->va = mz->addr;
 #ifdef RTE_LIBRTE_XEN_DOM0
@@ -2937,6 +2934,9 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
 #else
mem->pa = mz->phys_addr;
 #endif
+   mem->zone = (const void *)mz;
+   PMD_DRV_LOG(DEBUG, "memzone %s allocated with physical address: %p",
+   mz->name, mem->pa);

return I40E_SUCCESS;
 }
@@ -2950,9 +2950,13 @@ enum i40e_status_code
 i40e_free_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
struct i40e_dma_mem *mem)
 {
-   if (!mem || !mem->va)
+   if (!mem)
return I40E_ERR_PARAM;

+   PMD_DRV_LOG(DEBUG, "memzone %s to be freed with physical address: %p",
+   ((const struct rte_memzone *)mem->zone)->name, mem->pa);
+   rte_memzone_free((const struct rte_memzone *)mem->zone);
+   mem->zone = NULL;
mem->va = NULL;
mem->pa = (u64)0;

-- 
1.9.3



[dpdk-dev] [PATCH] app/testpmd: fix wrong fdir help and doc

2015-11-06 Thread Wenzhuo Lu
After implementing the fdir new modes for x550, the CLIs are modified.
Forgot to update the related help info and doc.

Fixes: 53b2bb9b7ea7 ("app/testpmd: new flow director commands")
Signed-off-by: Wenzhuo Lu 
---
 app/test-pmd/cmdline.c  | 35 +++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 41 -
 2 files changed, 63 insertions(+), 13 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c637198..2d43efa 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -629,7 +629,7 @@ static void cmd_help_long_parsed(void *parsed_result,
" priority (prio_value) queue (queue_id)\n"
"Add/Del a flex filter.\n\n"

-   "flow_director_filter (port_id) (add|del|update)"
+   "flow_director_filter (port_id) mode IP 
(add|del|update)"
" flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)"
" src (src_ip_address) dst (dst_ip_address)"
" vlan (vlan_value) flexbytes (flexbytes_value)"
@@ -637,7 +637,7 @@ static void cmd_help_long_parsed(void *parsed_result,
" fd_id (fd_id_value)\n"
"Add/Del an IP type flow director filter.\n\n"

-   "flow_director_filter (port_id) (add|del|update)"
+   "flow_director_filter (port_id) mode IP 
(add|del|update)"
" flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp)"
" src (src_ip_address) (src_port)"
" dst (dst_ip_address) (dst_port)"
@@ -646,7 +646,7 @@ static void cmd_help_long_parsed(void *parsed_result,
" fd_id (fd_id_value)\n"
"Add/Del an UDP/TCP type flow director filter.\n\n"

-   "flow_director_filter (port_id) (add|del|update)"
+   "flow_director_filter (port_id) mode IP 
(add|del|update)"
" flow (ipv4-sctp|ipv6-sctp)"
" src (src_ip_address) (src_port)"
" dst (dst_ip_address) (dst_port)"
@@ -655,19 +655,42 @@ static void cmd_help_long_parsed(void *parsed_result,
" pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
"Add/Del a SCTP type flow director filter.\n\n"

-   "flow_director_filter (port_id) (add|del|update)"
+   "flow_director_filter (port_id) mode IP 
(add|del|update)"
" flow l2_payload ether (ethertype)"
" flexbytes (flexbytes_value) (drop|fwd)"
" pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
"Add/Del a l2 payload type flow director 
filter.\n\n"

+   "flow_director_filter (port_id) mode MAC-VLAN 
(add|del|update)"
+   " mac (mac_address) vlan (vlan_value)"
+   " flexbytes (flexbytes_value) (drop|fwd)"
+   " queue (queue_id) fd_id (fd_id_value)\n"
+   "Add/Del a MAC-VLAN flow director filter.\n\n"
+
+   "flow_director_filter (port_id) mode Tunnel 
(add|del|update)"
+   " mac (mac_address) vlan (vlan_value)"
+   " tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value)"
+   " flexbytes (flexbytes_value) (drop|fwd)"
+   " queue (queue_id) fd_id (fd_id_value)\n"
+   "Add/Del a Tunnel flow director filter.\n\n"
+
"flush_flow_director (port_id)\n"
"Flush all flow director entries of a device.\n\n"

-   "flow_director_mask (port_id) vlan (vlan_value)"
+   "flow_director_mask (port_id) mode IP vlan (vlan_value)"
" src_mask (ipv4_src) (ipv6_src) (src_port)"
" dst_mask (ipv4_dst) (ipv6_dst) (dst_port)\n"
-   "Set flow director mask.\n\n"
+   "Set flow director IP mask.\n\n"
+
+   "flow_director_mask (port_id) mode MAC-VLAN"
+   " vlan (vlan_value) mac (mac_value)\n"
+   "Set flow director MAC-VLAN mask.\n\n"
+
+   "flow_director_mask (port_id) mode Tunnel"
+   " vlan (vlan_value) mac (mac_value)"
+   " tunnel-type (tunnel_type_value)"
+   " tunnel-id (tunnel_id_value)\n"
+   "Set flow director Tunnel mask.\n\n"

"flow_director_flex_mask (port_id)"
" flow 
(none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 

[dpdk-dev] [PATCH 3/3] app/testpmd: fix ICC compile issue

2015-11-06 Thread Helin Zhang
It fixes compile issue on ICC 13.0.0.

Error logs:
app/test-pmd/cmdline.c(8160): error #188: enumerated type mixed
with another type
entry.input.flow.tunnel_flow.tunnel_type =

Signed-off-by: Helin Zhang 
---
 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c637198..38cf923 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -8158,7 +8158,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 >mac_addr,
 sizeof(struct ether_addr));
entry.input.flow.tunnel_flow.tunnel_type =
-   str2fdir_tunneltype(res->tunnel_type);
+   (enum rte_eth_fdir_tunnel_type)str2fdir_tunneltype(res->tunnel_type);
entry.input.flow.tunnel_flow.tunnel_id =
rte_cpu_to_be_32(res->tunnel_id_value);
}
-- 
1.8.1.4



[dpdk-dev] [PATCH 2/3] i40e: fix ICC compile issue

2015-11-06 Thread Helin Zhang
It fixes compile issue on ICC 13.0.0.

Error logs:
i40e_ethdev.c(7943): error #188: enumerated type mixed with another type
PMD_INIT_LOG(ERR,

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/i40e_ethdev.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ddf3d38..8c1809a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -7942,7 +7942,7 @@ i40e_vsi_get_bw_info(struct i40e_vsi *vsi)
if (ret) {
PMD_INIT_LOG(ERR,
 "couldn't get PF vsi bw config, err %s aq_err %s\n",
-i40e_stat_str(hw, ret),
+i40e_stat_str(hw, (enum i40e_status_code)ret),
 i40e_aq_str(hw, hw->aq.asq_last_status));
return -EINVAL;
}
@@ -7953,7 +7953,7 @@ i40e_vsi_get_bw_info(struct i40e_vsi *vsi)
if (ret) {
PMD_INIT_LOG(ERR,
 "couldn't get PF vsi ets bw config, err %s aq_err 
%s\n",
-i40e_stat_str(hw, ret),
+i40e_stat_str(hw, (enum i40e_status_code)ret),
 i40e_aq_str(hw, hw->aq.asq_last_status));
return -EINVAL;
}
@@ -8122,7 +8122,7 @@ i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 tc_map)
if (ret) {
PMD_INIT_LOG(ERR,
 "Failed updating vsi bw info, err %s aq_err %s",
-i40e_stat_str(hw, ret),
+i40e_stat_str(hw, (enum i40e_status_code)ret),
 i40e_aq_str(hw, hw->aq.asq_last_status));
goto out;
}
@@ -8173,9 +8173,9 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
if (ret) {
PMD_INIT_LOG(ERR,
 "Set DCB Config failed, err %s aq_err %s\n",
-i40e_stat_str(hw, ret),
+i40e_stat_str(hw, (enum i40e_status_code)ret),
 i40e_aq_str(hw, hw->aq.asq_last_status));
-   return ret;
+   return (enum i40e_status_code)ret;
}
/* set receive Arbiter to RR mode and ETS scheme by default */
for (i = 0; i <= I40E_PRTDCB_RETSTCC_MAX_INDEX; i++) {
-- 
1.8.1.4



[dpdk-dev] [PATCH 1/3] bonding: fix ICC compile issue

2015-11-06 Thread Helin Zhang
It fixes compile issue on ICC 13.0.0.

Error logs:
rte_eth_bond_pmd.c(1327): error #188: enumerated type
mixed with another type
slave_eth_dev->data->dev_conf.rxmode.mq_mode |= ETH_MQ_RX_RSS;

Signed-off-by: Helin Zhang 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index bbff664..1b71304 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1324,7 +1324,8 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,

slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf =

bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf;
-   slave_eth_dev->data->dev_conf.rxmode.mq_mode |= ETH_MQ_RX_RSS;
+   slave_eth_dev->data->dev_conf.rxmode.mq_mode |=
+   (enum rte_eth_rx_mq_mode)ETH_MQ_RX_RSS;
}

/* Configure device */
-- 
1.8.1.4



[dpdk-dev] [PATCH 0/3] fix compile issues

2015-11-06 Thread Helin Zhang
It fixes compile issues for bonding, i40e, and testpmd on ICC 13.0.0.

Helin Zhang (3):
  bonding: fix ICC compile issue
  i40e: fix ICC compile issue
  app/testpmd: fix ICC compile issue

 app/test-pmd/cmdline.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  3 ++-
 drivers/net/i40e/i40e_ethdev.c | 10 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

-- 
1.8.1.4



[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-06 Thread Richardson, Bruce


> -Original Message-
> From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
> 
> On Fri, Nov 06, 2015 at 02:39:31PM +, Richardson, Bruce wrote:
> [...]
> > > > Hi Adrien,
> > > >
> > > > I'm trying to dig into this a bit more now, and try out using a
> > > > static inline function, but I'm having trouble getting DPDK to
> > > > compile with the mlx drivers turned on in the config. I'm trying
> > > > to follow the
> > > instructions here:
> > > > http://dpdk.org/doc/guides/nics/mlx4.html, but it's not clearly
> > > > called out what requirements are for compilation vs requirements
> > > > for running
> > > the PMD.
> > > >
> > > > I'm running Fedora 23, and installed the libibverbs-devel package,
> > > > but when I compile I get the following error:
> > > >
> > > > == Build drivers/net/mlx4
> > > >   CC mlx4.o
> > > >   /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c: In function
> > > ?txq_cleanup?:
> > > >   /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c:886:37: error:
> > > storage size of ?params? isn?t known
> > > > struct ibv_exp_release_intf_params params;
> > > >^ compilation terminated
> > > > due to -Wfatal-errors.
> > > >
> > > > Any suggestions on the fix for this?
> > >
> > > This is a known issue, libibverbs-devel package from Fedora 23 most
> > > likely does not support extended types and functions required by
> > > mlx4. You should remove the packages that come with your
> > > distribution and install libraries versions from Mellanox OFED as
> described in the next section:
> > >
> > >  http://dpdk.org/doc/guides/nics/mlx4.html#getting-mellanox-ofed
> > >
> > > Note: no need to fully install OFED for compilation checks, you can
> > > extract an updated libibverbs package from the archive.
> > >
> > > --
> > > Adrien Mazarguil
> > > 6WIND
> >
> > Hi again,
> >
> > I've installed the libibverbs and libibverbs-devel packages from the
> > mellanox site, but I'm still getting the same error. Anything else I
> might be missing?
> >
> > $ rpm -qa | grep mlnx
> > libibverbs-devel-1.1.8mlnx1-OFED.3.1.1.0.0.x86_64
> > libmlx5-1.0.2mlnx1-OFED.3.1.1.0.3.x86_64
> > libmlx4-1.0.6mlnx1-OFED.3.1.1.0.0.x86_64
> > libibverbs-1.1.8mlnx1-OFED.3.1.1.0.0.x86_64
> > libmlx4-devel-1.0.6mlnx1-OFED.3.1.1.0.0.x86_64
> > libmlx5-devel-1.0.2mlnx1-OFED.3.1.1.0.3.x86_64
> 
> That's weird, 'struct ibv_exp_release_intf_param' must be defined in
> /usr/include/infiniband/verbs_exp.h, itself included by
> infiniband/verbs.h, both normally part of the libibverbs-devel package
> above.
> 
> Make sure you don't have an old version of infiniband/verbs.h somewhere
> else such as in /usr/local/include after a manual compilation of
> libibverbs.
> 
> --
> Adrien Mazarguil
> 6WIND

Thanks, that fixed it. There was a copy of the verbs headers in 
/usr/local/include, which is strange because I never remember having ever tried 
compiling up ibverbs before.

Anyway, problem solved for now.
Thanks for your help.
/Bruce


[dpdk-dev] [PATCH] test: fix eal_flags_autotest due to missing_n_flag test

2015-11-06 Thread Pablo de Lara
eal_flags_autotest was broken after commit
19bfa4dd ("eal: make the -n argument optional"),
since the unit test was checking that app would not run
if -n flag was missing, which now it is possible.

Also, subtest test_missing_n_flag() has been renamed
to test_invalid_n_flag(), as now -n flag is not compulsory.

Signed-off-by: Pablo de Lara 
---
 app/test/test.c   |  2 +-
 app/test/test_eal_flags.c | 33 +++--
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/app/test/test.c b/app/test/test.c
index e8992f4..b94199a 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -81,7 +81,7 @@ do_recursive_call(void)
{ "run_secondary_instances", test_mp_secondary },
{ "test_missing_c_flag", no_action },
{ "test_master_lcore_flag", no_action },
-   { "test_missing_n_flag", no_action },
+   { "test_invalid_n_flag", no_action },
{ "test_no_hpet_flag", no_action },
{ "test_whitelist_flag", no_action },
{ "test_invalid_b_flag", no_action },
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index e0aee2d..d9c0d93 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -674,13 +674,13 @@ test_master_lcore_flag(void)
 }

 /*
- * Test that the app doesn't run without the -n flag. In all cases
- * should give an error and fail to run.
+ * Test that the app doesn't run with invalid -n flag option.
+ * Final test ensures it does run with valid options as sanity check
  * Since -n is not compulsory for MP, we instead use --no-huge and --no-shconf
  * flags.
  */
 static int
-test_missing_n_flag(void)
+test_invalid_n_flag(void)
 {
 #ifdef RTE_EXEC_ENV_BSDAPP
/* BSD target doesn't support prefixes at this point */
@@ -696,26 +696,31 @@ test_missing_n_flag(void)

/* -n flag but no value */
const char *argv1[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", 
"-n"};
-   /* No -n flag at all */
-   const char *argv2[] = { prgname, prefix, no_huge, no_shconf, "-c", "1"};
/* bad numeric value */
-   const char *argv3[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", 
"-n", "e" };
+   const char *argv2[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", 
"-n", "e" };
/* out-of-range value */
-   const char *argv4[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", 
"-n", "9" };
+   const char *argv3[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", 
"-n", "9" };
/* sanity test - check with good value */
-   const char *argv5[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", 
"-n", "2" };
+   const char *argv4[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", 
"-n", "2" };
+   /* sanity test - check with no -n flag */
+   const char *argv5[] = { prgname, prefix, no_huge, no_shconf, "-c", "1"};

if (launch_proc(argv1) == 0
|| launch_proc(argv2) == 0
-   || launch_proc(argv3) == 0
-   || launch_proc(argv4) == 0) {
-   printf("Error - process ran without error when missing -n 
flag\n");
+   || launch_proc(argv3) == 0) {
+   printf("Error - process ran without error when"
+  "invalid -n flag\n");
return -1;
}
-   if (launch_proc(argv5) != 0) {
+   if (launch_proc(argv4) != 0) {
printf("Error - process did not run ok with valid num-channel 
value\n");
return -1;
}
+   if (launch_proc(argv5) != 0) {
+   printf("Error - process did not run ok without -n flag\n");
+   return -1;
+   }
+
return 0;
 }

@@ -1368,9 +1373,9 @@ test_eal_flags(void)
return ret;
}

-   ret = test_missing_n_flag();
+   ret = test_invalid_n_flag();
if (ret < 0) {
-   printf("Error in test_missing_n_flag()\n");
+   printf("Error in test_invalid_n_flag()\n");
return ret;
}

-- 
2.5.0



[dpdk-dev] [PATCH v3 14/14] eal: arm: define rte_smp_mb(), rte_smp_wmb(), rte_smp_rmb() for arm

2015-11-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 lib/librte_eal/common/include/arch/arm/rte_atomic.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic.h 
b/lib/librte_eal/common/include/arch/arm/rte_atomic.h
index f3f3b6e..454a12b 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic.h
@@ -39,4 +39,10 @@
 #include 
 #endif

+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_wmb()
+
+#define rte_smp_rmb() rte_rmb()
+
 #endif /* _RTE_ATOMIC_ARM_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH v3 13/14] eal: introduce rte_smp_*mb() for memory barriers to use between lcores

2015-11-06 Thread Jerin Jacob
This commit introduce rte_smp_mb(), rte_smp_wmb() and rte_smp_rmb(), in
order to enable memory barriers between lcores.
The patch does not provide any functional change for IA, the goal is to
have infrastructure for weakly ordered machines like ARM to work on DPDK.

Signed-off-by: Jerin Jacob 
Acked-by: Konstantin Ananyev 
---
 drivers/net/virtio/virtqueue.h |  8 +++
 drivers/net/xenvirt/rte_eth_xenvirt.c  |  4 ++--
 drivers/net/xenvirt/virtqueue.h|  2 +-
 .../common/include/arch/ppc_64/rte_atomic.h|  6 +
 .../common/include/arch/tile/rte_atomic.h  |  6 +
 .../common/include/arch/x86/rte_atomic.h   |  6 +
 lib/librte_eal/common/include/generic/rte_atomic.h | 27 ++
 lib/librte_ring/rte_ring.h |  8 +++
 8 files changed, 55 insertions(+), 12 deletions(-)

diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index 7789411..d233be6 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -53,12 +53,10 @@ struct rte_mbuf;
  * accesses through relaxed memory I/O windows, so smp_mb() et al are
  * sufficient.
  *
- * This driver is for virtio_pci on SMP and therefore can assume
- * weaker (compiler barriers)
  */
-#define virtio_mb()rte_mb()
-#define virtio_rmb()   rte_compiler_barrier()
-#define virtio_wmb()   rte_compiler_barrier()
+#define virtio_mb()rte_smp_mb()
+#define virtio_rmb()   rte_smp_rmb()
+#define virtio_wmb()   rte_smp_wmb()

 #ifdef RTE_PMD_PACKET_PREFETCH
 #define rte_packet_prefetch(p)  rte_prefetch1(p)
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c 
b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 73e8bce..8c33a02 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -99,7 +99,7 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t 
nb_pkts)

nb_used = VIRTQUEUE_NUSED(rxvq);

-   rte_compiler_barrier(); /* rmb */
+   rte_smp_rmb();
num = (uint16_t)(likely(nb_used <= nb_pkts) ? nb_used : nb_pkts);
num = (uint16_t)(likely(num <= VIRTIO_MBUF_BURST_SZ) ? num : 
VIRTIO_MBUF_BURST_SZ);
if (unlikely(num == 0)) return 0;
@@ -150,7 +150,7 @@ eth_xenvirt_tx(void *tx_queue, struct rte_mbuf **tx_pkts, 
uint16_t nb_pkts)
PMD_TX_LOG(DEBUG, "%d packets to xmit", nb_pkts);
nb_used = VIRTQUEUE_NUSED(txvq);

-   rte_compiler_barrier();   /* rmb */
+   rte_smp_rmb();

num = (uint16_t)(likely(nb_used <= VIRTIO_MBUF_BURST_SZ) ? nb_used : 
VIRTIO_MBUF_BURST_SZ);
num = virtqueue_dequeue_burst(txvq, snd_pkts, len, num);
diff --git a/drivers/net/xenvirt/virtqueue.h b/drivers/net/xenvirt/virtqueue.h
index eff6208..6dcb0ef 100644
--- a/drivers/net/xenvirt/virtqueue.h
+++ b/drivers/net/xenvirt/virtqueue.h
@@ -151,7 +151,7 @@ vq_ring_update_avail(struct virtqueue *vq, uint16_t 
desc_idx)
 */
avail_idx = (uint16_t)(vq->vq_ring.avail->idx & (vq->vq_nentries - 1));
vq->vq_ring.avail->ring[avail_idx] = desc_idx;
-   rte_compiler_barrier();  /* wmb , for IA memory model barrier is 
enough*/
+   rte_smp_wmb();
vq->vq_ring.avail->idx++;
 }

diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
index fb7af2b..b8bc2c0 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
@@ -72,6 +72,12 @@ extern "C" {
  */
 #definerte_rmb() {asm volatile("sync" : : : "memory"); }

+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_compiler_barrier()
+
+#define rte_smp_rmb() rte_compiler_barrier()
+
 /*- 16 bit atomic operations 
-*/
 /* To be compatible with Power7, use GCC built-in functions for 16 bit
  * operations */
diff --git a/lib/librte_eal/common/include/arch/tile/rte_atomic.h 
b/lib/librte_eal/common/include/arch/tile/rte_atomic.h
index 3dc8eb8..28825ff 100644
--- a/lib/librte_eal/common/include/arch/tile/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/tile/rte_atomic.h
@@ -79,6 +79,12 @@ static inline void rte_rmb(void)
__sync_synchronize();
 }

+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_compiler_barrier()
+
+#define rte_smp_rmb() rte_compiler_barrier()
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/common/include/arch/x86/rte_atomic.h 
b/lib/librte_eal/common/include/arch/x86/rte_atomic.h
index e93e8ee..41178c7 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_atomic.h
@@ -53,6 +53,12 @@ extern "C" {

 #definerte_rmb() _mm_lfence()

+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_compiler_barrier()
+
+#define rte_smp_rmb() rte_compiler_barrier()
+
 /*- 16 bit atomic operations 

[dpdk-dev] [PATCH v3 12/14] maintainers: claim responsibility for ARMv8

2015-11-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 MAINTAINERS | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index a8933eb..c44b328 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -128,6 +128,11 @@ ARM v7
 M: Jan Viktorin 
 F: lib/librte_eal/common/include/arch/arm/

+ARM v8
+M: Jerin Jacob 
+F: lib/librte_eal/common/include/arch/arm/*_64.h
+F: lib/librte_acl/acl_run_neon.*
+
 Intel x86
 M: Bruce Richardson 
 M: Konstantin Ananyev 
-- 
1.9.3



[dpdk-dev] [PATCH v3 11/14] updated release note for armv8 support for DPDK 2.2

2015-11-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 doc/guides/rel_notes/release_2_2.rst | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 43a3a3c..a3587a2 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -23,10 +23,11 @@ New Features

 * **Added vhost-user multiple queue support.**

-* **Introduce ARMv7 architecture**
+* **Introduce ARMv7 and ARMv8 architectures**

-  It is now possible to build DPDK for the ARMv7 platform and test with
-  virtual PMD drivers.
+  * It is now possible to build DPDK for the ARMv7 and ARMv8 platforms.
+  * ARMv7 can be tested with virtual PMD drivers.
+  * ARMv8 can be tested with virtual and physical PMD drivers.


 Resolved Issues
-- 
1.9.3



[dpdk-dev] [PATCH v3 10/14] mk: add support for thunderx machine target based on armv8-a

2015-11-06 Thread Jerin Jacob
Created the new thunderx machine target to address difference
in "cache line size" and "-mcpu=thunderx" vs default armv8-a machine target

Signed-off-by: Jerin Jacob 
---
 config/defconfig_arm64-thunderx-linuxapp-gcc | 56 +++
 mk/machine/thunderx/rte.vars.mk  | 58 
 2 files changed, 114 insertions(+)
 create mode 100644 config/defconfig_arm64-thunderx-linuxapp-gcc
 create mode 100644 mk/machine/thunderx/rte.vars.mk

diff --git a/config/defconfig_arm64-thunderx-linuxapp-gcc 
b/config/defconfig_arm64-thunderx-linuxapp-gcc
new file mode 100644
index 000..6b2048b
--- /dev/null
+++ b/config/defconfig_arm64-thunderx-linuxapp-gcc
@@ -0,0 +1,56 @@
+#   BSD LICENSE
+#
+#   Copyright (C) Cavium networks 2015. 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 Cavium networks 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="thunderx"
+
+CONFIG_RTE_ARCH="arm64"
+CONFIG_RTE_ARCH_ARM64=y
+CONFIG_RTE_ARCH_64=y
+CONFIG_RTE_ARCH_ARM_NEON=y
+
+CONFIG_RTE_FORCE_INTRINSICS=y
+
+CONFIG_RTE_TOOLCHAIN="gcc"
+CONFIG_RTE_TOOLCHAIN_GCC=y
+
+CONFIG_RTE_CACHE_LINE_SIZE=128
+
+CONFIG_RTE_IXGBE_INC_VECTOR=n
+CONFIG_RTE_LIBRTE_VIRTIO_PMD=n
+CONFIG_RTE_LIBRTE_IVSHMEM=n
+CONFIG_RTE_LIBRTE_FM10K_PMD=n
+CONFIG_RTE_LIBRTE_I40E_PMD=n
+
+CONFIG_RTE_LIBRTE_LPM=n
+CONFIG_RTE_LIBRTE_TABLE=n
+CONFIG_RTE_LIBRTE_PIPELINE=n
diff --git a/mk/machine/thunderx/rte.vars.mk b/mk/machine/thunderx/rte.vars.mk
new file mode 100644
index 000..e49f9e1
--- /dev/null
+++ b/mk/machine/thunderx/rte.vars.mk
@@ -0,0 +1,58 @@
+#   BSD LICENSE
+#
+#   Copyright (C) Cavium networks 2015. 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 Cavium networks 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.
+#
+
+#
+# machine:
+#
+#   - can define ARCH variable (overridden by cmdline value)
+#   - can define CROSS variable (overridden by cmdline value)
+#   - define MACHINE_CFLAGS variable (overridden by cmdline value)
+#   - define MACHINE_LDFLAGS variable 

[dpdk-dev] [PATCH v3 09/14] mk: add support for armv8 on top of armv7

2015-11-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 config/defconfig_arm64-armv8a-linuxapp-gcc | 56 +
 mk/arch/arm64/rte.vars.mk  | 58 ++
 mk/machine/armv8a/rte.vars.mk  | 58 ++
 3 files changed, 172 insertions(+)
 create mode 100644 config/defconfig_arm64-armv8a-linuxapp-gcc
 create mode 100644 mk/arch/arm64/rte.vars.mk
 create mode 100644 mk/machine/armv8a/rte.vars.mk

diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc 
b/config/defconfig_arm64-armv8a-linuxapp-gcc
new file mode 100644
index 000..49e7056
--- /dev/null
+++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
@@ -0,0 +1,56 @@
+#   BSD LICENSE
+#
+#   Copyright (C) Cavium networks 2015. 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 Cavium networks 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="armv8a"
+
+CONFIG_RTE_ARCH="arm64"
+CONFIG_RTE_ARCH_ARM64=y
+CONFIG_RTE_ARCH_64=y
+CONFIG_RTE_ARCH_ARM_NEON=y
+
+CONFIG_RTE_FORCE_INTRINSICS=y
+
+CONFIG_RTE_TOOLCHAIN="gcc"
+CONFIG_RTE_TOOLCHAIN_GCC=y
+
+CONFIG_RTE_CACHE_LINE_SIZE=64
+
+CONFIG_RTE_IXGBE_INC_VECTOR=n
+CONFIG_RTE_LIBRTE_VIRTIO_PMD=n
+CONFIG_RTE_LIBRTE_IVSHMEM=n
+CONFIG_RTE_LIBRTE_FM10K_PMD=n
+CONFIG_RTE_LIBRTE_I40E_PMD=n
+
+CONFIG_RTE_LIBRTE_LPM=n
+CONFIG_RTE_LIBRTE_TABLE=n
+CONFIG_RTE_LIBRTE_PIPELINE=n
diff --git a/mk/arch/arm64/rte.vars.mk b/mk/arch/arm64/rte.vars.mk
new file mode 100644
index 000..32e3a5f
--- /dev/null
+++ b/mk/arch/arm64/rte.vars.mk
@@ -0,0 +1,58 @@
+#   BSD LICENSE
+#
+#   Copyright (C) Cavium networks 2015. 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 Cavium networks 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.
+
+#
+# arch:
+#
+#   - define ARCH variable (overridden by cmdline or by previous
+# optional define in machine .mk)
+#   - define CROSS variable (overridden by cmdline or previous define
+# in machine .mk)
+#   - define CPU_CFLAGS variable (overridden by cmdline or previous
+# define 

[dpdk-dev] [PATCH v3 08/14] acl: arm64: acl implementation using NEON gcc intrinsic

2015-11-06 Thread Jerin Jacob
verified with testacl and acl_autotest applications on arm64 architecture.

Signed-off-by: Jerin Jacob 
---
 app/test-acl/main.c   |   4 +
 lib/librte_acl/Makefile   |   5 +
 lib/librte_acl/acl.h  |   4 +
 lib/librte_acl/acl_run_neon.c |  46 +++
 lib/librte_acl/acl_run_neon.h | 289 ++
 lib/librte_acl/rte_acl.c  |  25 
 lib/librte_acl/rte_acl.h  |   1 +
 7 files changed, 374 insertions(+)
 create mode 100644 lib/librte_acl/acl_run_neon.c
 create mode 100644 lib/librte_acl/acl_run_neon.h

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index 72ce83c..0b0c093 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -101,6 +101,10 @@ static const struct acl_alg acl_alg[] = {
.name = "avx2",
.alg = RTE_ACL_CLASSIFY_AVX2,
},
+   {
+   .name = "neon",
+   .alg = RTE_ACL_CLASSIFY_NEON,
+   },
 };

 static struct {
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 7a1cf8a..27f91d5 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -48,9 +48,14 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += rte_acl.c
 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
+ifeq ($(CONFIG_RTE_ARCH_ARM64),y)
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
+else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
+endif

 CFLAGS_acl_run_sse.o += -msse4.1
+CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized

 #
 # If the compiler supports AVX2 instructions,
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index eb4930c..09d6784 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -230,6 +230,10 @@ int
 rte_acl_classify_avx2(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run_neon.c b/lib/librte_acl/acl_run_neon.c
new file mode 100644
index 000..b014451
--- /dev/null
+++ b/lib/librte_acl/acl_run_neon.c
@@ -0,0 +1,46 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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 "acl_run_neon.h"
+
+int
+rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
+ uint32_t *results, uint32_t num, uint32_t categories)
+{
+   if (likely(num >= 8))
+   return search_neon_8(ctx, data, results, num, categories);
+   else if (num >= 4)
+   return search_neon_4(ctx, data, results, num, categories);
+   else
+   return rte_acl_classify_scalar(ctx, data, results, num,
+   categories);
+}
diff --git a/lib/librte_acl/acl_run_neon.h b/lib/librte_acl/acl_run_neon.h
new file mode 100644
index 000..cf7c57f
--- /dev/null
+++ b/lib/librte_acl/acl_run_neon.h
@@ -0,0 +1,289 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 

[dpdk-dev] [PATCH v3 07/14] app: test_cpuflags: test the new cpu flags added for arm64

2015-11-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 app/test/test_cpuflags.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/app/test/test_cpuflags.c b/app/test/test_cpuflags.c
index 557458f..e8d0ce7 100644
--- a/app/test/test_cpuflags.c
+++ b/app/test/test_cpuflags.c
@@ -120,6 +120,32 @@ test_cpuflags(void)
CHECK_FOR_FLAG(RTE_CPUFLAG_NEON);
 #endif

+#if defined(RTE_ARCH_ARM64)
+   printf("Check for FP:\t\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_FP);
+
+   printf("Check for ASIMD:\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_NEON);
+
+   printf("Check for EVTSTRM:\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_EVTSTRM);
+
+   printf("Check for AES:\t\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_AES);
+
+   printf("Check for PMULL:\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_PMULL);
+
+   printf("Check for SHA1:\t\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_SHA1);
+
+   printf("Check for SHA2:\t\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_SHA2);
+
+   printf("Check for CRC32:\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_CRC32);
+#endif
+
 #if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
printf("Check for SSE:\t\t");
CHECK_FOR_FLAG(RTE_CPUFLAG_SSE);
-- 
1.9.3



[dpdk-dev] [PATCH v3 06/14] eal: arm: ret_vector.h improvements

2015-11-06 Thread Jerin Jacob
added the definition of rte_xmm and xmm_t for acl noen implementation.
removed the emulated _mm_* functions

Signed-off-by: Jerin Jacob 
---
 lib/librte_eal/common/include/arch/arm/rte_vect.h | 54 +++
 1 file changed, 15 insertions(+), 39 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/arm/rte_vect.h 
b/lib/librte_eal/common/include/arch/arm/rte_vect.h
index 7d5de97..21cdb4d 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_vect.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_vect.h
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2015 RehiveTech. All rights reserved.
+ *   Copyright(c) 2015 Cavium Networks. All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -13,7 +13,7 @@
  *   notice, this list of conditions and the following disclaimer in
  *   the documentation and/or other materials provided with the
  *   distribution.
- * * Neither the name of RehiveTech nor the names of its
+ * * Neither the name of Cavium Networks nor the names of its
  *   contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
  *
@@ -33,49 +33,25 @@
 #ifndef _RTE_VECT_ARM_H_
 #define _RTE_VECT_ARM_H_

+#include "arm_neon.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif

-#define XMM_SIZE 16
-#define XMM_MASK (XMM_MASK - 1)
-
-typedef struct {
-   union uint128 {
-   uint8_t uint8[16];
-   uint32_t uint32[4];
-   } val;
-} __m128i;
-
-static inline __m128i
-_mm_set_epi32(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3)
-{
-   __m128i res;
-
-   res.val.uint32[0] = v0;
-   res.val.uint32[1] = v1;
-   res.val.uint32[2] = v2;
-   res.val.uint32[3] = v3;
-   return res;
-}
+typedef int32x4_t xmm_t;

-static inline __m128i
-_mm_loadu_si128(__m128i *v)
-{
-   __m128i res;
+#defineXMM_SIZE(sizeof(xmm_t))
+#defineXMM_MASK(XMM_SIZE - 1)

-   res = *v;
-   return res;
-}
-
-static inline __m128i
-_mm_load_si128(__m128i *v)
-{
-   __m128i res;
-
-   res = *v;
-   return res;
-}
+typedef union rte_xmm {
+   xmm_tx;
+   uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];
+   uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+   uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+   uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+   double   pd[XMM_SIZE / sizeof(double)];
+} __attribute__((aligned(16))) rte_xmm_t;

 #ifdef __cplusplus
 }
-- 
1.9.3



[dpdk-dev] [PATCH v3 05/14] eal: arm64: rte_memcpy_64.h version based on libc memcpy

2015-11-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_memcpy.h   |  4 +
 .../common/include/arch/arm/rte_memcpy_64.h| 93 ++
 2 files changed, 97 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_memcpy.h 
b/lib/librte_eal/common/include/arch/arm/rte_memcpy.h
index d9f5bf1..1d562c3 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_MEMCPY_ARM_H_
 #define _RTE_MEMCPY_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_MEMCPY_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h
new file mode 100644
index 000..917cdc1
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h
@@ -0,0 +1,93 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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_ARM64_H_
+#define _RTE_MEMCPY_ARM64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+#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(d, s, n)memcpy((d), (s), (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_ARM_64_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH v3 04/14] eal: arm64: add armv8-a version of rte_cycles_64.h

2015-11-06 Thread Jerin Jacob
cntcvt_el0 ticks are not based on cpu clk unlike rdtsc in x86.
Its a fixed clock running based at constant speed.
Though its a armv8-a implementer choice, typically it runs at 50 or 100 MHz

Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_cycles.h   |  4 ++
 .../common/include/arch/arm/rte_cycles_64.h| 71 ++
 2 files changed, 75 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_cycles_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles.h 
b/lib/librte_eal/common/include/arch/arm/rte_cycles.h
index b2372fa..a8009a0 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_cycles.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_cycles.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_CYCLES_ARM_H_
 #define _RTE_CYCLES_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_CYCLES_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
new file mode 100644
index 000..14f2612
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
@@ -0,0 +1,71 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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_ARM64_H_
+#define _RTE_CYCLES_ARM64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_cycles.h"
+
+/**
+ * Read the time base register.
+ *
+ * @return
+ *   The time base for this lcore.
+ */
+static inline uint64_t
+rte_rdtsc(void)
+{
+   uint64_t tsc;
+
+   asm volatile("mrs %0, cntvct_el0" : "=r" (tsc));
+   return tsc;
+}
+
+static inline uint64_t
+rte_rdtsc_precise(void)
+{
+   rte_mb();
+   return rte_rdtsc();
+}
+
+static inline uint64_t
+rte_get_tsc_cycles(void) { return rte_rdtsc(); }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_CYCLES_ARM64_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH v3 03/14] eal: arm64: add armv8-a version of rte_prefetch_64.h

2015-11-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_prefetch.h |  4 ++
 .../common/include/arch/arm/rte_prefetch_64.h  | 61 ++
 2 files changed, 65 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch.h 
b/lib/librte_eal/common/include/arch/arm/rte_prefetch.h
index 1f46697..aa37de5 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_prefetch.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_PREFETCH_ARM_H_
 #define _RTE_PREFETCH_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_PREFETCH_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
new file mode 100644
index 000..f9cc62e
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
@@ -0,0 +1,61 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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_ARM_64_H_
+#define _RTE_PREFETCH_ARM_64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_prefetch.h"
+
+static inline void rte_prefetch0(const volatile void *p)
+{
+   asm volatile ("PRFM PLDL1KEEP, [%0]" : : "r" (p));
+}
+
+static inline void rte_prefetch1(const volatile void *p)
+{
+   asm volatile ("PRFM PLDL2KEEP, [%0]" : : "r" (p));
+}
+
+static inline void rte_prefetch2(const volatile void *p)
+{
+   asm volatile ("PRFM PLDL3KEEP, [%0]" : : "r" (p));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PREFETCH_ARM_64_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH v3 02/14] eal: arm64: add armv8-a version of rte_cpuflags_64.h

2015-11-06 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_cpuflags.h |   4 +
 .../common/include/arch/arm/rte_cpuflags_64.h  | 152 +
 2 files changed, 156 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_cpuflags.h 
b/lib/librte_eal/common/include/arch/arm/rte_cpuflags.h
index 8de78d2..b8f6288 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_cpuflags.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_CPUFLAGS_ARM_H_
 #define _RTE_CPUFLAGS_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_CPUFLAGS_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h
new file mode 100644
index 000..7bcc12f
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h
@@ -0,0 +1,152 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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_ARM64_H_
+#define _RTE_CPUFLAGS_ARM64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "generic/rte_cpuflags.h"
+
+#ifndef AT_HWCAP
+#define AT_HWCAP 16
+#endif
+
+#ifndef AT_HWCAP2
+#define AT_HWCAP2 26
+#endif
+
+#ifndef AT_PLATFORM
+#define AT_PLATFORM 15
+#endif
+
+/* software based registers */
+enum cpu_register_t {
+   REG_HWCAP = 0,
+   REG_HWCAP2,
+   REG_PLATFORM,
+};
+
+/**
+ * Enumeration of all CPU features supported
+ */
+enum rte_cpu_flag_t {
+   RTE_CPUFLAG_FP = 0,
+   RTE_CPUFLAG_NEON,
+   RTE_CPUFLAG_EVTSTRM,
+   RTE_CPUFLAG_AES,
+   RTE_CPUFLAG_PMULL,
+   RTE_CPUFLAG_SHA1,
+   RTE_CPUFLAG_SHA2,
+   RTE_CPUFLAG_CRC32,
+   RTE_CPUFLAG_AARCH64,
+   /* The last item */
+   RTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */
+};
+
+static const struct feature_entry cpu_feature_table[] = {
+   FEAT_DEF(FP,0x0001, 0, REG_HWCAP,  0)
+   FEAT_DEF(NEON,  0x0001, 0, REG_HWCAP,  1)
+   FEAT_DEF(EVTSTRM,   0x0001, 0, REG_HWCAP,  2)
+   FEAT_DEF(AES,   0x0001, 0, REG_HWCAP,  3)
+   FEAT_DEF(PMULL, 0x0001, 0, REG_HWCAP,  4)
+   FEAT_DEF(SHA1,  0x0001, 0, REG_HWCAP,  5)
+   FEAT_DEF(SHA2,  0x0001, 0, REG_HWCAP,  6)
+   FEAT_DEF(CRC32, 0x0001, 0, REG_HWCAP,  7)
+   FEAT_DEF(AARCH64,   0x0001, 0, REG_PLATFORM, 1)
+};
+
+/*
+ * Read AUXV software register and get cpu features for ARM
+ */
+static inline void
+rte_cpu_get_features(__attribute__((unused)) uint32_t leaf,
+__attribute__((unused)) uint32_t subleaf,
+cpuid_registers_t out)
+{
+   int auxv_fd;
+   Elf64_auxv_t auxv;
+
+   auxv_fd = open("/proc/self/auxv", O_RDONLY);
+   assert(auxv_fd);
+   while (read(auxv_fd, ,
+   sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {
+   if (auxv.a_type == AT_HWCAP) {
+   out[REG_HWCAP] = auxv.a_un.a_val;
+   } else if (auxv.a_type == AT_HWCAP2) {
+   out[REG_HWCAP2] = auxv.a_un.a_val;
+   } else if (auxv.a_type == AT_PLATFORM) {
+ 

[dpdk-dev] [PATCH v3 01/14] eal: arm64: add armv8-a version of rte_atomic_64.h

2015-11-06 Thread Jerin Jacob
except rte_?wb() functions other functions are used from
RTE_FORCE_INTRINSICS=y scheme

Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_atomic.h   |  4 +
 .../common/include/arch/arm/rte_atomic_64.h| 88 ++
 2 files changed, 92 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_atomic_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic.h 
b/lib/librte_eal/common/include/arch/arm/rte_atomic.h
index f4f5783..f3f3b6e 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_ATOMIC_ARM_H_
 #define _RTE_ATOMIC_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_ATOMIC_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
new file mode 100644
index 000..671caa7
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
@@ -0,0 +1,88 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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_ARM64_H_
+#define _RTE_ATOMIC_ARM64_H_
+
+#ifndef RTE_FORCE_INTRINSICS
+#  error Platform must be built with CONFIG_RTE_FORCE_INTRINSICS
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_atomic.h"
+
+#define dmb(opt)  do { asm volatile("dmb " #opt : : : "memory"); } while (0)
+
+/**
+ * General memory barrier.
+ *
+ * Guarantees that the LOAD and STORE operations generated before the
+ * barrier occur before the LOAD and STORE operations generated after.
+ * This function is architecture dependent.
+ */
+static inline void rte_mb(void)
+{
+   dmb(ish);
+}
+
+/**
+ * Write memory barrier.
+ *
+ * Guarantees that the STORE operations generated before the barrier
+ * occur before the STORE operations generated after.
+ * This function is architecture dependent.
+ */
+static inline void rte_wmb(void)
+{
+   dmb(ishst);
+}
+
+/**
+ * Read memory barrier.
+ *
+ * Guarantees that the LOAD operations generated before the barrier
+ * occur before the LOAD operations generated after.
+ * This function is architecture dependent.
+ */
+static inline void rte_rmb(void)
+{
+   dmb(ishld);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_ATOMIC_ARM64_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH v3 00/14] DPDK armv8-a support

2015-11-06 Thread Jerin Jacob
This is the v3 patchset for ARMv8 that now sits on top of the v6 patch
(based on upstream 82fb702077f67585d64a07de0080e5cb6a924a72)
of the ARMv7 code by RehiveTech. It adds code into the same arm include
directory, reducing code duplication.

Tested on an ThunderX arm 64-bit arm server board, with PCI slots. Passes 
traffic
between two physical ports on an Intel 82599 dual-port 10Gig NIC. Should
work with many other NICS as long as there is no unaligned access to
device memory but not yet untested.

Compiles igb_uio, kni and all the physical device PMDs.

An entry has been added to the Release notes.

v1..v2

1) included  "Introduce rte_smp_*mb() for memory barriers to use between lcores"
patch ACK by Konstantin in v2 as
"eal: introduce rte_smp_*mb() for memory barriers to use between lcores"
please superseded the original one

2) defined rte_smp_mb(), rte_smp_wmb(), rte_smp_rmb() for arm
(1) and (2) fixes "Mbuf autotest" stress failure found in version 1

3) fixed white space issues with patch 8,9,10

4) disabled  CONFIG_RTE_LIBRTE_FM10K_PMD, CONFIG_RTE_LIBRTE_I40E_PMD
due to tmmintrin.h depenency or ARM

v2..v3

1) moved disabled  CONFIG_RTE_LIBRTE_FM10K_PMD, CONFIG_RTE_LIBRTE_I40E_PMD
to "mk: add support for armv8 on top of armv7" and
"mk: add support for thunderx machine target based on armv8-a"
to fix compilation issue per patch


NOTE:
Part of the work has been taken from David Hunt's v3 patch who was
initiated the armv8 port.


Notes on arm64 kernel configuration:

  Tested on using Ubuntu 14.04 LTS with a 3.18 kernel and igb_uio.
  ARM64 kernels does not have functional resource mapping of PCI memory
  (PCI_MMAP), so the pci driver needs to be patched to enable this. The
  symptom of this is when /sys/bus/pci/devices/:0X:00.Y directory is
  missing the resource0...N files for mmapping the device memory.

  Following patch fixes the PCI resource mapping issue om armv8.
  Its not yet up streamed.We are in the process of up streaming it.

  http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/358906.html


Jerin Jacob (14):
  eal: arm64: add armv8-a version of rte_atomic_64.h
  eal: arm64: add armv8-a version of rte_cpuflags_64.h
  eal: arm64: add armv8-a version of rte_prefetch_64.h
  eal: arm64: add armv8-a version of rte_cycles_64.h
  eal: arm64: rte_memcpy_64.h version based on libc memcpy
  eal: arm: ret_vector.h improvements
  app: test_cpuflags: test the new cpu flags added for arm64
  acl: arm64: acl implementation using NEON gcc intrinsic
  mk: add support for armv8 on top of armv7
  mk: add support for thunderx machine target based on armv8-a
  updated release note for armv8 support for DPDK 2.2
  maintainers: claim responsibility for ARMv8
  eal: introduce rte_smp_*mb() for memory barriers to use between lcores
  eal: arm: define rte_smp_mb(), rte_smp_wmb(), rte_smp_rmb() for arm

 MAINTAINERS|   5 +
 app/test-acl/main.c|   4 +
 app/test/test_cpuflags.c   |  26 ++
 config/defconfig_arm64-armv8a-linuxapp-gcc |  56 
 config/defconfig_arm64-thunderx-linuxapp-gcc   |  56 
 doc/guides/rel_notes/release_2_2.rst   |   7 +-
 drivers/net/virtio/virtqueue.h |   8 +-
 drivers/net/xenvirt/rte_eth_xenvirt.c  |   4 +-
 drivers/net/xenvirt/virtqueue.h|   2 +-
 lib/librte_acl/Makefile|   5 +
 lib/librte_acl/acl.h   |   4 +
 lib/librte_acl/acl_run_neon.c  |  46 
 lib/librte_acl/acl_run_neon.h  | 289 +
 lib/librte_acl/rte_acl.c   |  25 ++
 lib/librte_acl/rte_acl.h   |   1 +
 .../common/include/arch/arm/rte_atomic.h   |  10 +
 .../common/include/arch/arm/rte_atomic_64.h|  88 +++
 .../common/include/arch/arm/rte_cpuflags.h |   4 +
 .../common/include/arch/arm/rte_cpuflags_64.h  | 152 +++
 .../common/include/arch/arm/rte_cycles.h   |   4 +
 .../common/include/arch/arm/rte_cycles_64.h|  71 +
 .../common/include/arch/arm/rte_memcpy.h   |   4 +
 .../common/include/arch/arm/rte_memcpy_64.h|  93 +++
 .../common/include/arch/arm/rte_prefetch.h |   4 +
 .../common/include/arch/arm/rte_prefetch_64.h  |  61 +
 lib/librte_eal/common/include/arch/arm/rte_vect.h  |  54 ++--
 .../common/include/arch/ppc_64/rte_atomic.h|   6 +
 .../common/include/arch/tile/rte_atomic.h  |   6 +
 .../common/include/arch/x86/rte_atomic.h   |   6 +
 lib/librte_eal/common/include/generic/rte_atomic.h |  27 ++
 lib/librte_ring/rte_ring.h |   8 +-
 mk/arch/arm64/rte.vars.mk  |  58 +
 mk/machine/armv8a/rte.vars.mk  |  58 +
 mk/machine/thunderx/rte.vars.mk|  58 +
 34 files 

[dpdk-dev] [PATCH] doc: add entry for enic PMD Tx improvement to the 2.2 release notes.

2015-11-06 Thread johndale
Signed-off-by: johndale 
---
 doc/guides/rel_notes/release_2_2.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..8bc5fca 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -162,6 +162,9 @@ Drivers

   Fixed issue when releasing null control queue.

+* **enic: Improve Tx packet rate.**
+
+  Reduced frequency of Tx tail pointer updates to the nic.

 Libraries
 ~
-- 
2.4.3



[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-06 Thread Richardson, Bruce
> -Original Message-
> From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
> 
> Hi Bruce,
> 
> On Fri, Nov 06, 2015 at 11:52:44AM +, Bruce Richardson wrote:
> > +Adrien on To: line
> >
> > Email user/client fail on original. :-(
> >
> > - Forwarded message from Bruce Richardson
> >  -
> >
> > Date: Fri, 6 Nov 2015 11:49:05 +
> > From: Bruce Richardson 
> > To: Stephen Hemminger , Thomas Monjalon
> > , dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking
> > macros to header
> > User-Agent: Mutt/1.5.23 (2014-03-12)
> >
> > On Thu, Nov 05, 2015 at 04:09:18PM +0100, Adrien Mazarguil wrote:
> > > Bruce is asking for a consensus about -pedantic, whether we want to
> > > do the extra effort to support it in DPDK. Since I like checking for
> > > -pedantic errors, it's enabled for mlx4 and mlx5 when compiling
> > > these drivers in debugging mode. There is currently no established
> rule in DPDK against this.
> > >
> > > I'm arguing that most C headers (C compiler, libc, most libraries,
> > > even the Linux kernel in uapi to an extent) provide standards
> > > compliant includes because they cannot predict or force particular
> > > compilation flags on user applications.
> > >
> > > If we consider DPDK as a system wide library, I think we should do
> > > it as well in all installed header files. If we choose not to, then
> > > we must document that our code is not standard, -pedantic is
> > > unsupported and I'll have to drop it from mlx4 and mlx5.
> > >
> > > --
> > > Adrien Mazarguil
> > > 6WIND
> >
> > Hi Adrien,
> >
> > I'm trying to dig into this a bit more now, and try out using a static
> > inline function, but I'm having trouble getting DPDK to compile with
> > the mlx drivers turned on in the config. I'm trying to follow the
> instructions here:
> > http://dpdk.org/doc/guides/nics/mlx4.html, but it's not clearly called
> > out what requirements are for compilation vs requirements for running
> the PMD.
> >
> > I'm running Fedora 23, and installed the libibverbs-devel package, but
> > when I compile I get the following error:
> >
> > == Build drivers/net/mlx4
> >   CC mlx4.o
> >   /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c: In function
> ?txq_cleanup?:
> >   /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c:886:37: error:
> storage size of ?params? isn?t known
> > struct ibv_exp_release_intf_params params;
> >^ compilation terminated due to
> > -Wfatal-errors.
> >
> > Any suggestions on the fix for this?
> 
> This is a known issue, libibverbs-devel package from Fedora 23 most likely
> does not support extended types and functions required by mlx4. You should
> remove the packages that come with your distribution and install libraries
> versions from Mellanox OFED as described in the next section:
> 
>  http://dpdk.org/doc/guides/nics/mlx4.html#getting-mellanox-ofed
> 
> Note: no need to fully install OFED for compilation checks, you can
> extract an updated libibverbs package from the archive.
> 
> --
> Adrien Mazarguil
> 6WIND

Hi again,

I've installed the libibverbs and libibverbs-devel packages from the mellanox 
site, 
but I'm still getting the same error. Anything else I might be missing?

$ rpm -qa | grep mlnx
libibverbs-devel-1.1.8mlnx1-OFED.3.1.1.0.0.x86_64
libmlx5-1.0.2mlnx1-OFED.3.1.1.0.3.x86_64
libmlx4-1.0.6mlnx1-OFED.3.1.1.0.0.x86_64
libibverbs-1.1.8mlnx1-OFED.3.1.1.0.0.x86_64
libmlx4-devel-1.0.6mlnx1-OFED.3.1.1.0.0.x86_64
libmlx5-devel-1.0.2mlnx1-OFED.3.1.1.0.3.x86_64

Regards,
/Bruce


[dpdk-dev] [PATCH 3/3] i40e: refactor xstats queue handling

2015-11-06 Thread Harry van Haaren
This patch refactors the queue and priority statistic handling.
Generic queue stats are presented by rte_eth_xstats_get(), and the
i40e_xstats_get() exposes only the extra stats.

Signed-off-by: Harry van Haaren 
---
 drivers/net/i40e/i40e_ethdev.c | 112 -
 1 file changed, 65 insertions(+), 47 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ddf3d38..c3f0235 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -490,6 +490,9 @@ static const struct rte_i40e_xstats_name_off 
rte_i40e_stats_strings[] = {
{"tx_dropped", offsetof(struct i40e_eth_stats, tx_discards)},
 };

+#define I40E_NB_ETH_XSTATS (sizeof(rte_i40e_stats_strings) / \
+   sizeof(rte_i40e_stats_strings[0]))
+
 static const struct rte_i40e_xstats_name_off rte_i40e_hw_port_strings[] = {
{"tx_link_down_dropped", offsetof(struct i40e_hw_port_stats,
tx_dropped_link_down)},
@@ -556,15 +559,30 @@ static const struct rte_i40e_xstats_name_off 
rte_i40e_hw_port_strings[] = {
rx_lpi_count)},
 };

-/* Q Stats: 5 stats are exposed for each queue, implemented in xstats_get() */
-#define I40E_NB_HW_PORT_Q_STATS (8 * 5)
-
-#define I40E_NB_ETH_XSTATS (sizeof(rte_i40e_stats_strings) / \
-   sizeof(rte_i40e_stats_strings[0]))
 #define I40E_NB_HW_PORT_XSTATS (sizeof(rte_i40e_hw_port_strings) / \
sizeof(rte_i40e_hw_port_strings[0]))
-#define I40E_NB_XSTATS (I40E_NB_ETH_XSTATS + I40E_NB_HW_PORT_XSTATS + \
-   I40E_NB_HW_PORT_Q_STATS)
+
+static const struct rte_i40e_xstats_name_off rte_i40e_rxq_prio_strings[] = {
+   {"xon_packets", offsetof(struct i40e_hw_port_stats,
+   priority_xon_rx)},
+   {"xoff_packets", offsetof(struct i40e_hw_port_stats,
+   priority_xoff_rx)},
+};
+
+#define I40E_NB_RXQ_PRIO_XSTATS (sizeof(rte_i40e_rxq_prio_strings) / \
+   sizeof(rte_i40e_rxq_prio_strings[0]))
+
+static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
+   {"xon_packets", offsetof(struct i40e_hw_port_stats,
+   priority_xon_tx)},
+   {"xoff_packets", offsetof(struct i40e_hw_port_stats,
+   priority_xoff_tx)},
+   {"xon_to_xoff_packets", offsetof(struct i40e_hw_port_stats,
+   priority_xon_2_xoff)},
+};
+
+#define I40E_NB_TXQ_PRIO_XSTATS (sizeof(rte_i40e_txq_prio_strings) / \
+   sizeof(rte_i40e_txq_prio_strings[0]))

 static struct eth_driver rte_i40e_pmd = {
.pci_drv = {
@@ -2124,6 +2142,14 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
PMD_DRV_LOG(DEBUG, "* PF stats end 
");
 }

+static uint32_t
+i40e_xstats_calc_num(void)
+{
+   return I40E_NB_ETH_XSTATS + I40E_NB_HW_PORT_XSTATS +
+   (I40E_NB_RXQ_PRIO_XSTATS * 8) +
+   (I40E_NB_TXQ_PRIO_XSTATS * 8);
+}
+
 static void
 i40e_dev_xstats_reset(struct rte_eth_dev *dev)
 {
@@ -2145,18 +2171,20 @@ i40e_dev_xstats_get(struct rte_eth_dev *dev, struct 
rte_eth_xstats *xstats,
 {
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-   unsigned i, count = 0;
+   unsigned i, count, prio;
struct i40e_hw_port_stats *hw_stats = >stats;

-   if (n < I40E_NB_XSTATS)
-   return I40E_NB_XSTATS;
+   count = i40e_xstats_calc_num();
+   if (n < count)
+   return count;

i40e_read_stats_registers(pf, hw);

-   /* Reset */
if (xstats == NULL)
return 0;

+   count = 0;
+
/* Get stats from i40e_eth_stats struct */
for (i = 0; i < I40E_NB_ETH_XSTATS; i++) {
snprintf(xstats[count].name, sizeof(xstats[count].name),
@@ -2175,45 +2203,35 @@ i40e_dev_xstats_get(struct rte_eth_dev *dev, struct 
rte_eth_xstats *xstats,
count++;
}

-   /* Get per-queue stats from i40e_hw_port struct */
-   for (i = 0; i < 8; i++) {
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"rx_q%u_xon_priority_packets", i);
-   xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
-   offsetof(struct i40e_hw_port_stats,
-priority_xon_rx[i]));
-   count++;
-
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"rx_q%u_xoff_priority_packets", i);
-   xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
-   offsetof(struct i40e_hw_port_stats,
-priority_xoff_rx[i]));
-   count++;
-
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"tx_q%u_xon_priority_packets", 

[dpdk-dev] [PATCH 2/3] ixgbe: refactor xstats queue handling

2015-11-06 Thread Harry van Haaren
This patch refactors the queue handling. Generic queue stats are
handled by rte_eth_xstats_get() and the ixgbe_xstats_get() exposes
only the extra stats.

Signed-off-by: Harry van Haaren 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 132 ---
 1 file changed, 53 insertions(+), 79 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0b0bbcf..19ddb52 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -613,11 +613,25 @@ static const struct rte_ixgbe_xstats_name_off 
rte_ixgbe_stats_strings[] = {
   sizeof(rte_ixgbe_stats_strings[0]))

 /* Per-queue statistics */
-#define IXBGE_NB_8_PER_Q_STATS (8 * 7)
-#define IXBGE_NB_16_PER_Q_STATS (16 * 5)
-#define IXGBE_NB_Q_STATS (IXBGE_NB_8_PER_Q_STATS + IXBGE_NB_16_PER_Q_STATS)
+static const struct rte_ixgbe_xstats_name_off rte_ixgbe_rxq_strings[] = {
+   {"mbuf_allocation_errors", offsetof(struct ixgbe_hw_stats, rnbc)},
+   {"dropped", offsetof(struct ixgbe_hw_stats, mpc)},
+   {"xon_packets", offsetof(struct ixgbe_hw_stats, pxonrxc)},
+   {"xoff_packets", offsetof(struct ixgbe_hw_stats, pxoffrxc)},
+};
+
+#define IXGBE_NB_RXQ_PRIO_STATS (sizeof(rte_ixgbe_rxq_strings) / \
+  sizeof(rte_ixgbe_rxq_strings[0]))
+
+static const struct rte_ixgbe_xstats_name_off rte_ixgbe_txq_strings[] = {
+   {"xon_packets", offsetof(struct ixgbe_hw_stats, pxontxc)},
+   {"xoff_packets", offsetof(struct ixgbe_hw_stats, pxofftxc)},
+   {"xon_to_xoff_packets", offsetof(struct ixgbe_hw_stats,
+   pxon2offc)},
+};

-#define IXGBE_NB_XSTATS (IXGBE_NB_HW_STATS + IXGBE_NB_Q_STATS)
+#define IXGBE_NB_TXQ_PRIO_STATS (sizeof(rte_ixgbe_txq_strings) / \
+  sizeof(rte_ixgbe_txq_strings[0]))

 static const struct rte_ixgbe_xstats_name_off rte_ixgbevf_stats_strings[] = {
{"rx_multicast_packets", offsetof(struct ixgbevf_hw_stats, vfmprc)},
@@ -2513,6 +2527,13 @@ ixgbe_dev_stats_reset(struct rte_eth_dev *dev)
memset(stats, 0, sizeof(*stats));
 }

+/* This function calculates the number of xstats based on the current config */
+static unsigned
+ixgbe_xstats_calc_num(void) {
+   return IXGBE_NB_HW_STATS + (IXGBE_NB_RXQ_PRIO_STATS * 8) +
+   (IXGBE_NB_TXQ_PRIO_STATS * 8);
+}
+
 static int
 ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,
 unsigned n)
@@ -2522,7 +2543,9 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct 
rte_eth_xstats *xstats,
struct ixgbe_hw_stats *hw_stats =
IXGBE_DEV_PRIVATE_TO_STATS(dev->data->dev_private);
uint64_t total_missed_rx, total_qbrc, total_qprc, total_qprdc;
-   unsigned i, count = IXGBE_NB_XSTATS;
+   unsigned i, stat, count = 0;
+
+   count = ixgbe_xstats_calc_num();

if (n < count)
return count;
@@ -2551,81 +2574,30 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct 
rte_eth_xstats *xstats,
count++;
}

-   /* Per-Q stats, with 8 queues available */
-   for (i = 0; i < 8; i++) {
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"rx_q%u_mbuf_allocation_errors", i);
-   xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
-   offsetof(struct ixgbe_hw_stats, rnbc[i]));
-   count++;
-
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"rx_q%u_missed_packets", i);
-   xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
-   offsetof(struct ixgbe_hw_stats, mpc[i]));
-   count++;
-
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"rx_q%u_xon_priority_packets", i);
-   xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
-   offsetof(struct ixgbe_hw_stats, pxonrxc[i]));
-   count++;
-
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"tx_q%u_xon_priority_packets", i);
-   xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
-   offsetof(struct ixgbe_hw_stats, pxontxc[i]));
-   count++;
-
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"rx_q%u_xoff_priority_packets", i);
-   xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
-   offsetof(struct ixgbe_hw_stats, pxoffrxc[i]));
-   count++;
-
-   snprintf(xstats[count].name, sizeof(xstats[count].name),
-"tx_q%u_xoff_priority_packets", i);
-   xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
-   

[dpdk-dev] [PATCH 1/3] ethdev: xstats generic Q stats refactor

2015-11-06 Thread Harry van Haaren
This patch refactors the generic queue stats to be exposed
by rte_ethdev_xstats_get().

Signed-off-by: Harry van Haaren 
---
 lib/librte_ether/rte_ethdev.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e0e1dca..b464f30 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1515,7 +1515,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats 
*xstats,
dev = _eth_devices[port_id];

/* Return generic statistics */
-   count = RTE_NB_STATS;
+   count = RTE_NB_STATS + (dev->data->nb_rx_queues * RTE_NB_RXQ_STATS) +
+   (dev->data->nb_tx_queues * RTE_NB_TXQ_STATS);

/* implemented by the driver */
if (dev->dev_ops->xstats_get != NULL) {
@@ -1527,9 +1528,6 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats 
*xstats,

if (xcount < 0)
return xcount;
-   } else {
-   count += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;
-   count += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;
}

if (n < count + xcount)
@@ -1549,10 +1547,6 @@ rte_eth_xstats_get(uint8_t port_id, struct 
rte_eth_xstats *xstats,
xstats[count++].value = val;
}

-   /* if xstats_get() is implemented by the PMD, the Q stats are done */
-   if (dev->dev_ops->xstats_get != NULL)
-   return count + xcount;
-
/* per-rxq stats */
for (q = 0; q < dev->data->nb_rx_queues; q++) {
for (i = 0; i < RTE_NB_RXQ_STATS; i++) {
-- 
1.9.1



[dpdk-dev] [PATCH 0/3] xstats queue handling

2015-11-06 Thread Harry van Haaren
This patchset modifies how queue statistics are presented by
rte_eth_xstats_get() and each PMD's xstats_get().

Generic stats from the rte_eth_stats struct are presented by rte, and each
PMD can augment those stats with extra stats that are available (if any).

Currently ixgbe and i40e are the only NICs supporting queue xstats, and
they have been updated to conform with the new method of presentation.


Harry van Haaren (3):
  ethdev: xstats generic Q stats refactor
  ixgbe: refactor xstats queue handling
  i40e: refactor xstats queue handling

 drivers/net/i40e/i40e_ethdev.c   | 112 +++--
 drivers/net/ixgbe/ixgbe_ethdev.c | 132 ---
 lib/librte_ether/rte_ethdev.c|  10 +--
 3 files changed, 120 insertions(+), 134 deletions(-)

-- 
1.9.1



[dpdk-dev] [PATCH] reserve 'make install' for future use

2015-11-06 Thread Thomas Monjalon
2015-11-06 12:57, Bruce Richardson:
> So, any thoughts or comments on this? There has been lots of discussion in 
> this
> general area but nothing yet going into the release to try and improve the 
> situation.
> 
> Are we just going to kick the problem down the road to the 2.3 release?

I plan to check these patches in the coming days for an integration in 2.2.



[dpdk-dev] [PATCH] vhost: eventfd_link's minor number shall be specified

2015-11-06 Thread Xiaobo Chi
 eventfd_link_misc's minor number shall be MISC_DYNAMIC_MINOR to let Linux 
kernel dynamically assign one while loading.

Signed-off-by: Xiaobo Chi 
---
 lib/librte_vhost/eventfd_link/eventfd_link.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_vhost/eventfd_link/eventfd_link.c 
b/lib/librte_vhost/eventfd_link/eventfd_link.c
index c54a938..4b05b5a 100644
--- a/lib/librte_vhost/eventfd_link/eventfd_link.c
+++ b/lib/librte_vhost/eventfd_link/eventfd_link.c
@@ -249,6 +249,7 @@ static const struct file_operations eventfd_link_fops = {


 static struct miscdevice eventfd_link_misc = {
+   .minor = MISC_DYNAMIC_MINOR,
.name = "eventfd-link",
.fops = _link_fops,
 };
-- 
1.9.4.msysgit.2



[dpdk-dev] [PATCH] scripts: add git hook scripts for checkpatch and auto doc generation

2015-11-06 Thread Ferruh Yigit
On Fri, Nov 06, 2015 at 01:48:51PM +, Ferruh Yigit wrote:
> Sorry for duplication, previous patch is not in the patchwork, this is the
> exact same patch and re-sent for patchwork.
> 
Incase anybody interested patchwork error seems because of a special char in 
message header "Received" field.
Failed ones has: "... with ? id ..."

Not sure why specific host appends this char.

Thanks,
ferruh


[dpdk-dev] [PATCH] mk: fix ABI versioning compile error for combined shared library

2015-11-06 Thread Ferruh Yigit
Fixes following error:
  LD libdpdk.so
  /usr/bin/ld: /root/dpdk/build/lib/libdpdk.so: version node not found
  for symbol @DPDK_x.y

Defines version symbols in a fixed path libdpdk.map file and this
value hardcoded into makefile

Signed-off-by: Ferruh Yigit 
---
 drivers/net/Makefile |  3 +++
 lib/Makefile |  3 +++
 lib/libdpdk.map  | 12 
 mk/rte.sdkbuild.mk   |  2 +-
 mk/rte.sharelib.mk   |  1 +
 5 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 lib/libdpdk.map

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6da1ce2..d30018c 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -50,5 +50,8 @@ DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt

+ifeq ($(COMBINED_BUILD),1)
 include $(RTE_SDK)/mk/rte.sharelib.mk
+endif
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/Makefile b/lib/Makefile
index 9727b83..33d76a6 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -62,5 +62,8 @@ DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
 DIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += librte_ivshmem
 endif

+ifeq ($(COMBINED_BUILD),1)
 include $(RTE_SDK)/mk/rte.sharelib.mk
+endif
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/libdpdk.map b/lib/libdpdk.map
new file mode 100644
index 000..3988a3f
--- /dev/null
+++ b/lib/libdpdk.map
@@ -0,0 +1,12 @@
+DPDK_2.0 {
+
+};
+
+DPDK_2.1 {
+
+} DPDK_2.0;
+
+DPDK_2.2 {
+
+} DPDK_2.1;
+
diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk
index 38ec7bd..d4e3abf 100644
--- a/mk/rte.sdkbuild.mk
+++ b/mk/rte.sdkbuild.mk
@@ -94,7 +94,7 @@ $(ROOTDIRS-y):
@echo "== Build $@"
$(Q)$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile -C $(BUILDDIR)/$@ all
@if [ $@ = drivers -a $(CONFIG_RTE_BUILD_COMBINE_LIBS) = y ]; then \
-   $(MAKE) -f $(RTE_SDK)/lib/Makefile sharelib; \
+   COMBINED_BUILD=1 $(MAKE) -f $(RTE_SDK)/lib/Makefile sharelib; \
fi

 %_clean:
diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk
index 7bb7219..1f71fcb 100644
--- a/mk/rte.sharelib.mk
+++ b/mk/rte.sharelib.mk
@@ -40,6 +40,7 @@ LIB_ONE := lib$(RTE_LIBNAME).so
 else
 LIB_ONE := lib$(RTE_LIBNAME).a
 endif
+CPU_LDFLAGS += --version-script=$(SRCDIR)/lib/libdpdk.map
 endif

 .PHONY:sharelib
-- 
2.5.0



[dpdk-dev] [PATCH] mk: fix ABI versioning compile error for combined shared library

2015-11-06 Thread Ferruh Yigit
Sorry for duplication, previous patch is not in the patchwork, this is the
exact same patch and re-sent for patchwork.

Ferruh Yigit (1):
  mk: fix ABI versioning compile error for combined shared library

 drivers/net/Makefile |  3 +++
 lib/Makefile |  3 +++
 lib/libdpdk.map  | 12 
 mk/rte.sdkbuild.mk   |  2 +-
 mk/rte.sharelib.mk   |  1 +
 5 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 lib/libdpdk.map

-- 
2.5.0



[dpdk-dev] [PATCH] scripts: add git hook scripts for checkpatch and auto doc generation

2015-11-06 Thread Ferruh Yigit
These scripts are to automate some common tasks, scripts needs
to be deployed to specific folder to become active.

Scripts:
post-commit: Triggers after commit complete, re-generates api and
guides html documents. "RTE_DOC_OUT" environment variable configures
document output folder. Same script can be used on server side with
name "post-update", so documentation can auto updated after each push
to server.

post-merge: Same script as "post-commit", but triggered after git pull

pre-commit: Does a checkpatch check before commit started. If script
finds any error it will print warnings and fails. If  checkpatch
fails commit also fails. This guaranties every commit pass checkpatch.
Default script is /scripts/checkpatch.pl but this can be
changed by RTE_CHECKPATCH environment variable. Also a default list
of checkpatch ignore items defined, new ones can be added by IGNORE
environment variable.
This script can bypassed by commit "--no-verify" argument.

Deployment:
To make scripts active they need to be in /.git/hooks folder.
Alternatively "deploy.sh" script can be used, it simply copies all
scripts into proper folder. Script names are significant and
shouldn't changed.

Signed-off-by: Ferruh Yigit 
---
 scripts/git-hooks/deploy.sh   | 19 +++
 scripts/git-hooks/post-commit | 10 ++
 scripts/git-hooks/post-merge  | 10 ++
 scripts/git-hooks/pre-commit  | 44 +++
 4 files changed, 83 insertions(+)
 create mode 100755 scripts/git-hooks/deploy.sh
 create mode 100755 scripts/git-hooks/post-commit
 create mode 100755 scripts/git-hooks/post-merge
 create mode 100755 scripts/git-hooks/pre-commit

diff --git a/scripts/git-hooks/deploy.sh b/scripts/git-hooks/deploy.sh
new file mode 100755
index 000..0aa7ffb
--- /dev/null
+++ b/scripts/git-hooks/deploy.sh
@@ -0,0 +1,19 @@
+
+NAME=$(basename $0)
+
+if [ ! -f ${NAME} ]; then
+   echo "Please run script from folder where script is"
+   exit 1
+fi
+
+FILES=$(ls | grep -v ${NAME})
+
+TARGET_FOLDER="../../.git/hooks"
+
+if [ ! -d ${TARGET_FOLDER} ]; then
+   exit 2
+fi
+
+for f in ${FILES}; do
+   cp -i ${f} ${TARGET_FOLDER}/
+done;
diff --git a/scripts/git-hooks/post-commit b/scripts/git-hooks/post-commit
new file mode 100755
index 000..2a76f96
--- /dev/null
+++ b/scripts/git-hooks/post-commit
@@ -0,0 +1,10 @@
+#
+# Create docs after each commit
+#
+
+if [ -n "$RTE_DOC_OUT" ]; then
+   OUT_CMD="O=${RTE_DOC_OUT}"
+fi
+
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null
diff --git a/scripts/git-hooks/post-merge b/scripts/git-hooks/post-merge
new file mode 100755
index 000..2a76f96
--- /dev/null
+++ b/scripts/git-hooks/post-merge
@@ -0,0 +1,10 @@
+#
+# Create docs after each commit
+#
+
+if [ -n "$RTE_DOC_OUT" ]; then
+   OUT_CMD="O=${RTE_DOC_OUT}"
+fi
+
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null
diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit
new file mode 100755
index 000..102be73
--- /dev/null
+++ b/scripts/git-hooks/pre-commit
@@ -0,0 +1,44 @@
+#
+# Check patch with checkpatch script before commit
+#
+# If checkpatch fails, commit fails
+#
+# Sample command line can be like:
+# IGNORE="LINUX_VERSION_CODE,VOLATILE" 
RTE_CHACKPATCH=/linux/scripts/checkpatch.pl git commit
+#
+
+if [ -z "$RTE_CHECKPATCH" ]; then
+   RTE_CHECKPATCH=$PWD/scripts/checkpatch.pl
+fi
+
+if [ ! -x ${RTE_CHECKPATCH} ]; then
+   if [ -f ${RTE_CHECKPATCH} ]; then
+   echo "checkpatch script is not executable: ${RTE_CHECKPATCH}"
+   else
+   echo "checkpatch script not found: ${RTE_CHECKPATCH}"
+   fi
+   exit 2
+fi
+
+IGNORE_DEFAULT="LINUX_VERSION_CODE,\
+FILE_PATH_CHANGES,\
+VOLATILE,\
+PREFER_PACKED,\
+PREFER_ALIGNED,\
+PREFER_PRINTF,\
+PREFER_KERNEL_TYPES,\
+SPLIT_STRING,\
+LINE_SPACING,\
+PARENTHESIS_ALIGNMENT,\
+NETWORKING_BLOCK_COMMENT_STYLE,\
+NEW_TYPEDEFS,\
+COMPLEX_MACRO,\
+COMPARISON_TO_NULL"
+
+IGNORE_CMD="--ignore ${IGNORE_DEFAULT}"
+
+if [ -n "$IGNORE" ]; then
+   IGNORE_CMD="${IGNORE_CMD},${IGNORE}"
+fi
+
+exec git diff --cached | $RTE_CHECKPATCH ${IGNORE_CMD} --no-tree -q -
-- 
2.5.0



[dpdk-dev] [PATCH] scripts: add git hook scripts for checkpatch and auto doc generation

2015-11-06 Thread Ferruh Yigit
Sorry for duplication, previous patch is not in the patchwork, this is the
exact same patch and re-sent for patchwork.

Ferruh Yigit (1):
  scripts: add git hook scripts for checkpatch and auto doc generation

 scripts/git-hooks/deploy.sh   | 19 +++
 scripts/git-hooks/post-commit | 10 ++
 scripts/git-hooks/post-merge  | 10 ++
 scripts/git-hooks/pre-commit  | 44 +++
 4 files changed, 83 insertions(+)
 create mode 100755 scripts/git-hooks/deploy.sh
 create mode 100755 scripts/git-hooks/post-commit
 create mode 100755 scripts/git-hooks/post-merge
 create mode 100755 scripts/git-hooks/pre-commit

-- 
2.5.0



[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-06 Thread Adrien Mazarguil
Hi Bruce,

On Fri, Nov 06, 2015 at 11:52:44AM +, Bruce Richardson wrote:
> +Adrien on To: line
> 
> Email user/client fail on original. :-(
> 
> - Forwarded message from Bruce Richardson  
> -
> 
> Date: Fri, 6 Nov 2015 11:49:05 +
> From: Bruce Richardson 
> To: Stephen Hemminger , Thomas Monjalon 
> , dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to 
> header
> User-Agent: Mutt/1.5.23 (2014-03-12)
> 
> On Thu, Nov 05, 2015 at 04:09:18PM +0100, Adrien Mazarguil wrote:
> > Bruce is asking for a consensus about -pedantic, whether we want to do the
> > extra effort to support it in DPDK. Since I like checking for -pedantic
> > errors, it's enabled for mlx4 and mlx5 when compiling these drivers in
> > debugging mode. There is currently no established rule in DPDK against this.
> > 
> > I'm arguing that most C headers (C compiler, libc, most libraries, even the
> > Linux kernel in uapi to an extent) provide standards compliant includes
> > because they cannot predict or force particular compilation flags on
> > user applications.
> > 
> > If we consider DPDK as a system wide library, I think we should do it as
> > well in all installed header files. If we choose not to, then we must
> > document that our code is not standard, -pedantic is unsupported and I'll
> > have to drop it from mlx4 and mlx5.
> > 
> > -- 
> > Adrien Mazarguil
> > 6WIND
> 
> Hi Adrien,
> 
> I'm trying to dig into this a bit more now, and try out using a static inline
> function, but I'm having trouble getting DPDK to compile with the mlx drivers
> turned on in the config. I'm trying to follow the instructions here:
> http://dpdk.org/doc/guides/nics/mlx4.html, but it's not clearly called out 
> what
> requirements are for compilation vs requirements for running the PMD.
> 
> I'm running Fedora 23, and installed the libibverbs-devel package, but when I
> compile I get the following error:
> 
> == Build drivers/net/mlx4
>   CC mlx4.o
>   /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c: In function 
> ?txq_cleanup?:
>   /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c:886:37: error: storage 
> size of ?params? isn?t known
> struct ibv_exp_release_intf_params params;
>^
> compilation terminated due to -Wfatal-errors.
> 
> Any suggestions on the fix for this?

This is a known issue, libibverbs-devel package from Fedora 23 most likely
does not support extended types and functions required by mlx4. You should
remove the packages that come with your distribution and install libraries
versions from Mellanox OFED as described in the next section:

 http://dpdk.org/doc/guides/nics/mlx4.html#getting-mellanox-ofed

Note: no need to fully install OFED for compilation checks, you can extract
an updated libibverbs package from the archive.

-- 
Adrien Mazarguil
6WIND


[dpdk-dev] [PATCH] reserve 'make install' for future use

2015-11-06 Thread Bruce Richardson
So, any thoughts or comments on this? There has been lots of discussion in this
general area but nothing yet going into the release to try and improve the 
situation.

Are we just going to kick the problem down the road to the 2.3 release?

/Bruce


On Fri, Nov 06, 2015 at 10:24:13AM +, Bruce Richardson wrote:
> There has been some discussion on the list about various ways to get DPDK more
> standardised in how it compiles and how it can be installed into a system as
> a set of binaries.
> 
> One of the issues we face in that is that the 'make install' command is used 
> in
> DPDK to compile a copy of the SDK but not to place the resultant binaries in 
> the
> filesystem like other packages do. In order to allow us to have the option to
> use 'make install' in its common meaning in a future release we need to 
> replace
> it in our packages, and allow some time for the change to a new command to 
> bed-in.
> 
> This patchset therefore proposed to change "make install" to "make sdk" [and
> "make uninstall" to "make clean-sdk"]. Using the old commands now prints out
> an error message informing the user to use the new versions.
> 
> These new commands are ones that made sense to me - I'm happy enough to change
> them for something else people feel is more appropriate. The key point here is
> to move away from using "make install".
> 
> I would ask that if general agreement on this can be reached that such a 
> change
> be considered for 2.2, even though it is late in the day, as "freeing up" the
> make install command will potentially take multiple releases as not everyone 
> is
> on the latest version, and so waiting till 2.3 to make a change will push out
> any future re-use of a "make install" command by 4 months.
> 
> Regards,
> /Bruce
> 
> Bruce Richardson (1):
>   mk: rename 'make install' to 'make sdk'
> 
>  doc/guides/freebsd_gsg/build_dpdk.rst| 16 ++---
>  doc/guides/linux_gsg/build_dpdk.rst  | 22 +++---
>  doc/guides/nics/intel_vf.rst |  2 +-
>  doc/guides/prog_guide/dev_kit_root_make_help.rst | 18 ++---
>  doc/guides/sample_app_ug/tep_termination.rst |  3 +-
>  doc/guides/sample_app_ug/vhost.rst   |  3 +-
>  doc/guides/testpmd_app_ug/build_app.rst  |  2 +-
>  doc/guides/xen/pkt_switch.rst|  2 +-
>  mk/rte.sdk.mk| 88 
> 
>  mk/rte.sdkinstall.mk | 87 ---
>  mk/rte.sdkroot.mk| 13 +++-
>  scripts/gen-build-mk.sh  |  2 +-
>  12 files changed, 133 insertions(+), 125 deletions(-)
>  create mode 100644 mk/rte.sdk.mk
>  delete mode 100644 mk/rte.sdkinstall.mk
> 
> -- 
> 2.5.0
> 


[dpdk-dev] [PATCH v2 2/2] vhost: Add VHOST PMD

2015-11-06 Thread Tetsuya Mukawa
On 2015/11/06 11:22, Yuanhan Liu wrote:
> On Mon, Nov 02, 2015 at 12:58:57PM +0900, Tetsuya Mukawa wrote:
> ...
>> +
>> +static uint16_t
>> +eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
>> +{
>> +struct vhost_queue *r = q;
>> +uint16_t nb_rx = 0;
>> +
>> +if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
>> +return 0;
>> +
>> +rte_atomic32_set(>while_queuing, 1);
>> +
>> +if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
>> +goto out;
>> +
>> +/* Dequeue packets from guest TX queue */
>> +nb_rx = (uint16_t)rte_vhost_dequeue_burst(r->device,
>> +VIRTIO_TXQ, r->mb_pool, bufs, nb_bufs);
>> +
>> +r->rx_pkts += nb_rx;
>> +
>> +out:
>> +rte_atomic32_set(>while_queuing, 0);
>> +
>> +return nb_rx;
>> +}
>> +
>> +static uint16_t
>> +eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
>> +{
>> +struct vhost_queue *r = q;
>> +uint16_t i, nb_tx = 0;
>> +
>> +if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
>> +return 0;
>> +
>> +rte_atomic32_set(>while_queuing, 1);
>> +
>> +if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
>> +goto out;
>> +
>> +/* Enqueue packets to guest RX queue */
>> +nb_tx = (uint16_t)rte_vhost_enqueue_burst(r->device,
>> +VIRTIO_RXQ, bufs, nb_bufs);
>> +
> Michael, I'm wondering here might be the better place to do "automatic
> receive steering in multiqueue mode". I mean, as a library function,
> queueing/dequeueing packets to/from a specific virt queue is reasonable
> to me. It's upto the caller to pick the right queue, doing the queue
> steering.

Hi Liu,

Oops, I've found a bug here.
To support multiple queues in vhost PMD, I needed to store "queue_id" in
"vhost_queue" structure.
Then, I should call rte_vhost_enqueue_burst() with the value.

> As an eth dev, I guess that's the proper place to do things like that.
>
> Or, I'm thinking we could introduce another vhost function, for not
> breaking current API, to do that, returning the right queue, so that
> other applications (instead of the vhost pmd only) can use that as well.

I may not understand the steering function enough, but If we support the
steering function in vhost library or vhost PMD, how can we handle
"queue_id" parameter of TX functions?
Probably, we need to ignore the value In some cases.
This may confuse the users because they cannot observe the packets in
their specified queue.

So I guess it may be application responsibility to return packets to the
correct queue.
(But we should write a correct documentation about it)

> Tetsuya, just in case you missed the early discussion about automic
> receive steering, here is a link:
>
>   http://dpdk.org/ml/archives/dev/2015-October/025779.html
>

Thanks, I've checked it!

Tetsuya



[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-06 Thread Bruce Richardson
+Adrien on To: line

Email user/client fail on original. :-(

- Forwarded message from Bruce Richardson  
-

Date: Fri, 6 Nov 2015 11:49:05 +
From: Bruce Richardson 
To: Stephen Hemminger , Thomas Monjalon 
, dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to 
header
User-Agent: Mutt/1.5.23 (2014-03-12)

On Thu, Nov 05, 2015 at 04:09:18PM +0100, Adrien Mazarguil wrote:
> Bruce is asking for a consensus about -pedantic, whether we want to do the
> extra effort to support it in DPDK. Since I like checking for -pedantic
> errors, it's enabled for mlx4 and mlx5 when compiling these drivers in
> debugging mode. There is currently no established rule in DPDK against this.
> 
> I'm arguing that most C headers (C compiler, libc, most libraries, even the
> Linux kernel in uapi to an extent) provide standards compliant includes
> because they cannot predict or force particular compilation flags on
> user applications.
> 
> If we consider DPDK as a system wide library, I think we should do it as
> well in all installed header files. If we choose not to, then we must
> document that our code is not standard, -pedantic is unsupported and I'll
> have to drop it from mlx4 and mlx5.
> 
> -- 
> Adrien Mazarguil
> 6WIND

Hi Adrien,

I'm trying to dig into this a bit more now, and try out using a static inline
function, but I'm having trouble getting DPDK to compile with the mlx drivers
turned on in the config. I'm trying to follow the instructions here:
http://dpdk.org/doc/guides/nics/mlx4.html, but it's not clearly called out what
requirements are for compilation vs requirements for running the PMD.

I'm running Fedora 23, and installed the libibverbs-devel package, but when I
compile I get the following error:

== Build drivers/net/mlx4
  CC mlx4.o
  /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c: In function ?txq_cleanup?:
  /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c:886:37: error: storage 
size of ?params? isn?t known
struct ibv_exp_release_intf_params params;
   ^
compilation terminated due to -Wfatal-errors.

Any suggestions on the fix for this?

Thanks,
/Bruce



[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-06 Thread Bruce Richardson
On Thu, Nov 05, 2015 at 04:09:18PM +0100, Adrien Mazarguil wrote:
> Bruce is asking for a consensus about -pedantic, whether we want to do the
> extra effort to support it in DPDK. Since I like checking for -pedantic
> errors, it's enabled for mlx4 and mlx5 when compiling these drivers in
> debugging mode. There is currently no established rule in DPDK against this.
> 
> I'm arguing that most C headers (C compiler, libc, most libraries, even the
> Linux kernel in uapi to an extent) provide standards compliant includes
> because they cannot predict or force particular compilation flags on
> user applications.
> 
> If we consider DPDK as a system wide library, I think we should do it as
> well in all installed header files. If we choose not to, then we must
> document that our code is not standard, -pedantic is unsupported and I'll
> have to drop it from mlx4 and mlx5.
> 
> -- 
> Adrien Mazarguil
> 6WIND

Hi Adrien,

I'm trying to dig into this a bit more now, and try out using a static inline
function, but I'm having trouble getting DPDK to compile with the mlx drivers
turned on in the config. I'm trying to follow the instructions here:
http://dpdk.org/doc/guides/nics/mlx4.html, but it's not clearly called out what
requirements are for compilation vs requirements for running the PMD.

I'm running Fedora 23, and installed the libibverbs-devel package, but when I
compile I get the following error:

== Build drivers/net/mlx4
  CC mlx4.o
  /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c: In function ?txq_cleanup?:
  /home/bruce/ethdev-cleanup/drivers/net/mlx4/mlx4.c:886:37: error: storage 
size of ?params? isn?t known
struct ibv_exp_release_intf_params params;
   ^
compilation terminated due to -Wfatal-errors.

Any suggestions on the fix for this?

Thanks,
/Bruce



[dpdk-dev] [PATCH] i40e: fix the issue of not freeing memzone

2015-11-06 Thread Helin Zhang
This fixes the issue of not freeing memzone in a call to free the
memory for adminq DMA.

Signed-off-by: Helin Zhang 
---
 doc/guides/rel_notes/release_2_2.rst |  5 +
 drivers/net/i40e/base/i40e_osdep.h   |  2 +-
 drivers/net/i40e/i40e_ethdev.c   | 12 +++-
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..eaa906c 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -150,6 +150,11 @@ Drivers

   Added discarding packets on VSI to the stats and rectify the old statistics.

+* **i40e: Fixed issue of not freeing memzone.**
+
+  Fixed the issue of not freeing memzone in the call to free the memory for
+  adminq DMA.
+
 * **vhost: Fixed Qemu shutdown.**

   Fixed issue with libvirt ``virsh destroy`` not killing the VM.
diff --git a/drivers/net/i40e/base/i40e_osdep.h 
b/drivers/net/i40e/base/i40e_osdep.h
index 70d2721..71077f0 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -146,7 +146,7 @@ struct i40e_dma_mem {
void *va;
u64 pa;
u32 size;
-   u64 id;
+   const void *zone;
 } __attribute__((packed));

 #define i40e_allocate_dma_mem(h, m, unused, s, a) \
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ddf3d38..8d6c0fa 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2910,15 +2910,13 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
u64 size,
u32 alignment)
 {
-   static uint64_t id = 0;
const struct rte_memzone *mz = NULL;
char z_name[RTE_MEMZONE_NAMESIZE];

if (!mem)
return I40E_ERR_PARAM;

-   id++;
-   snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
+   snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, rte_rand());
 #ifdef RTE_LIBRTE_XEN_DOM0
mz = rte_memzone_reserve_bounded(z_name, size, SOCKET_ID_ANY, 0,
 alignment, RTE_PGSIZE_2M);
@@ -2929,7 +2927,6 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
if (!mz)
return I40E_ERR_NO_MEMORY;

-   mem->id = id;
mem->size = size;
mem->va = mz->addr;
 #ifdef RTE_LIBRTE_XEN_DOM0
@@ -2937,6 +2934,8 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
 #else
mem->pa = mz->phys_addr;
 #endif
+   mem->zone = (const void *)mz;
+   PMD_DRV_LOG(DEBUG, "memzone allocated: %p", mem->zone);

return I40E_SUCCESS;
 }
@@ -2950,9 +2949,12 @@ enum i40e_status_code
 i40e_free_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
struct i40e_dma_mem *mem)
 {
-   if (!mem || !mem->va)
+   if (!mem)
return I40E_ERR_PARAM;

+   PMD_DRV_LOG(DEBUG, "memzone to be freed: %p", mem->zone);
+   rte_memzone_free((const struct rte_memzone *)mem->zone);
+   mem->zone = NULL;
mem->va = NULL;
mem->pa = (u64)0;

-- 
1.9.3



[dpdk-dev] [PATCH v2] i40e: fix the issue of not freeing memzone

2015-11-06 Thread Thomas Monjalon
2015-11-06 15:57, Helin Zhang:
> This fixes the issue of not freeing memzone in a call to free the
> memory for adminq DMA.
> 
> Signed-off-by: Helin Zhang 

Please could you add a "Fixes:" line?
Thanks


[dpdk-dev] [RFC PATCH] vhost: remove lockless enqueue to virt ring

2015-11-06 Thread Tetsuya Mukawa
On 2015/11/05 19:21, Xie, Huawei wrote:
> If no objections, would remove the internal cmpset enqueue, should get
> some improved performance.
>
> No idea why commit message is lost:
> DPDK doesn't support receiving/transmitting packets from/to the same
> port/queue.
> Vhost pmd wraps vhost device as normal dpdk port. dpdkvhost based
> applications/switch
>  also treate virtio port and physical port both as ports, and have
> their  own
> lock implmentation when to enqueue packets to the same port. This patch
> removes
> the internal lockless vhost enqueue implmentation.
> On 11/5/2015 5:38 PM, Huawei Xie wrote:
>> Signed-off-by: Huawei Xie 

Hi Xie,

I think it's a good optimization.
But I  guess the patch will changes behavior of vhost library API.
For example, if someone has already implemented an application based on
the assumption that vhost library has internal lock, I doubt their
application will face an issue with this patch.

If it's correct, we might need to follow below steps.
http://dpdk.org/doc/guides/contributing/versioning.html

Thanks,
Tetsuya


[dpdk-dev] [PATCH] mk: rename 'make install' to 'make sdk'

2015-11-06 Thread Bruce Richardson
Since 'make install' is the standard command for installing packages
into the filesystem of a system - generally in /usr/local/ - it's use to
trigger compilation of the DPDK SDK was both confusing and preventing a
"true" 'make install' command from being implemented.

As a first step to improving our build and install system, this patch
renames the 'make install' and 'make uninstall' commands to 'make sdk'
and 'make clean-sdk' respectively.

Signed-off-by: Bruce Richardson 
---
 doc/build-sdk-quick.txt  |  4 +-
 doc/guides/freebsd_gsg/build_dpdk.rst| 16 ++---
 doc/guides/linux_gsg/build_dpdk.rst  | 22 +++---
 doc/guides/nics/intel_vf.rst |  2 +-
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 18 ++---
 doc/guides/rel_notes/deprecation.rst |  4 ++
 doc/guides/rel_notes/release_2_2.rst |  7 ++
 doc/guides/sample_app_ug/tep_termination.rst |  3 +-
 doc/guides/sample_app_ug/vhost.rst   |  3 +-
 doc/guides/testpmd_app_ug/build_app.rst  |  2 +-
 doc/guides/xen/pkt_switch.rst|  2 +-
 mk/rte.sdk.mk| 88 
 mk/rte.sdkinstall.mk | 87 ---
 mk/rte.sdkroot.mk| 13 +++-
 scripts/gen-build-mk.sh  |  2 +-
 tools/setup.sh   |  6 +-
 16 files changed, 149 insertions(+), 130 deletions(-)
 create mode 100644 mk/rte.sdk.mk
 delete mode 100644 mk/rte.sdkinstall.mk

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index bf18b48..c91b664 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -5,8 +5,8 @@ Build commands
all  same as build (default rule)
buildbuild in a configured directory
cleanremove files but keep configuration
-   install  build many targets (wildcard allowed) and install in 
DESTDIR
-   uninstallremove all installed targets
+   sdk  build many targets (wildcard allowed) in DESTDIR
+   clean-sdkremove all built targets
examples build examples for given targets (T=)
examples_clean   clean examples for given targets (T=)
 Build variables
diff --git a/doc/guides/freebsd_gsg/build_dpdk.rst 
b/doc/guides/freebsd_gsg/build_dpdk.rst
index 8eff599..d03dfe3 100644
--- a/doc/guides/freebsd_gsg/build_dpdk.rst
+++ b/doc/guides/freebsd_gsg/build_dpdk.rst
@@ -114,7 +114,7 @@ user. For the installation of the DPDK, the default options 
were used.
 make config -recursive command until no more dialogs are seen.


-Install the DPDK and Browse Sources
+Prepare the DPDK and Browse Sources
 ---

 First, uncompress the archive and move to the DPDK source directory:
@@ -136,8 +136,8 @@ The DPDK is composed of several directories:

 *   config, tools, scripts, mk: Framework-related makefiles, scripts and 
configuration

-Installation of the DPDK Target Environments
-
+Compiling the DPDK SDK for a Target Environment
+---

 The format of a DPDK target is:

@@ -168,23 +168,23 @@ directory in the form of:
 on which it is built.  For more information on this setting, and its
 possible values, see the *DPDK Programmers Guide*.

-To install and make the target, use "gmake install T=".
+To make the target, use "gmake sdk T=".

 For example to compile for FreeBSD* use:

 .. code-block:: console

-gmake install T=x86_64-native-bsdapp-clang
+gmake sdk T=x86_64-native-bsdapp-clang

 .. note::

If the compiler binary to be used does not correspond to that given in 
the
TOOLCHAIN part of the target, the compiler command may need to be 
explicitly
specified. For example, if compiling for gcc, where the gcc binary is 
called
-   gcc4.8, the command would need to be "gmake install T= 
CC=gcc4.8".
+   gcc4.8, the command would need to be "gmake sdk T= CC=gcc4.8".

-Browsing the Installed DPDK Environment Target
---
+Browsing the Compiled DPDK SDK
+--

 Once a target is created, it contains all the libraries and header files for 
the
 DPDK environment that are required to build customer applications.
diff --git a/doc/guides/linux_gsg/build_dpdk.rst 
b/doc/guides/linux_gsg/build_dpdk.rst
index 2680e66..13230f9 100644
--- a/doc/guides/linux_gsg/build_dpdk.rst
+++ b/doc/guides/linux_gsg/build_dpdk.rst
@@ -35,8 +35,8 @@ Compiling the DPDK Target from Source

 Parts of this process can also be done using the setup script described in 
Chapter 6 of this document.

-Install the DPDK and Browse Sources

+Prepare DPDK and Browse Sources
+---

 First, uncompress the 

[dpdk-dev] [PATCH] reserve 'make install' for future use

2015-11-06 Thread Bruce Richardson
There has been some discussion on the list about various ways to get DPDK more
standardised in how it compiles and how it can be installed into a system as
a set of binaries.

One of the issues we face in that is that the 'make install' command is used in
DPDK to compile a copy of the SDK but not to place the resultant binaries in the
filesystem like other packages do. In order to allow us to have the option to
use 'make install' in its common meaning in a future release we need to replace
it in our packages, and allow some time for the change to a new command to 
bed-in.

This patchset therefore proposed to change "make install" to "make sdk" [and
"make uninstall" to "make clean-sdk"]. Using the old commands now prints out
an error message informing the user to use the new versions.

These new commands are ones that made sense to me - I'm happy enough to change
them for something else people feel is more appropriate. The key point here is
to move away from using "make install".

I would ask that if general agreement on this can be reached that such a change
be considered for 2.2, even though it is late in the day, as "freeing up" the
make install command will potentially take multiple releases as not everyone is
on the latest version, and so waiting till 2.3 to make a change will push out
any future re-use of a "make install" command by 4 months.

Regards,
/Bruce

Bruce Richardson (1):
  mk: rename 'make install' to 'make sdk'

 doc/guides/freebsd_gsg/build_dpdk.rst| 16 ++---
 doc/guides/linux_gsg/build_dpdk.rst  | 22 +++---
 doc/guides/nics/intel_vf.rst |  2 +-
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 18 ++---
 doc/guides/sample_app_ug/tep_termination.rst |  3 +-
 doc/guides/sample_app_ug/vhost.rst   |  3 +-
 doc/guides/testpmd_app_ug/build_app.rst  |  2 +-
 doc/guides/xen/pkt_switch.rst|  2 +-
 mk/rte.sdk.mk| 88 
 mk/rte.sdkinstall.mk | 87 ---
 mk/rte.sdkroot.mk| 13 +++-
 scripts/gen-build-mk.sh  |  2 +-
 12 files changed, 133 insertions(+), 125 deletions(-)
 create mode 100644 mk/rte.sdk.mk
 delete mode 100644 mk/rte.sdkinstall.mk

-- 
2.5.0



[dpdk-dev] [PATCH v2 2/2] vhost: Add VHOST PMD

2015-11-06 Thread Yuanhan Liu
On Mon, Nov 02, 2015 at 12:58:57PM +0900, Tetsuya Mukawa wrote:
...
> +
> +static uint16_t
> +eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> +{
> + struct vhost_queue *r = q;
> + uint16_t nb_rx = 0;
> +
> + if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
> + return 0;
> +
> + rte_atomic32_set(>while_queuing, 1);
> +
> + if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
> + goto out;
> +
> + /* Dequeue packets from guest TX queue */
> + nb_rx = (uint16_t)rte_vhost_dequeue_burst(r->device,
> + VIRTIO_TXQ, r->mb_pool, bufs, nb_bufs);
> +
> + r->rx_pkts += nb_rx;
> +
> +out:
> + rte_atomic32_set(>while_queuing, 0);
> +
> + return nb_rx;
> +}
> +
> +static uint16_t
> +eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> +{
> + struct vhost_queue *r = q;
> + uint16_t i, nb_tx = 0;
> +
> + if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
> + return 0;
> +
> + rte_atomic32_set(>while_queuing, 1);
> +
> + if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
> + goto out;
> +
> + /* Enqueue packets to guest RX queue */
> + nb_tx = (uint16_t)rte_vhost_enqueue_burst(r->device,
> + VIRTIO_RXQ, bufs, nb_bufs);
> +

Michael, I'm wondering here might be the better place to do "automatic
receive steering in multiqueue mode". I mean, as a library function,
queueing/dequeueing packets to/from a specific virt queue is reasonable
to me. It's upto the caller to pick the right queue, doing the queue
steering.

As an eth dev, I guess that's the proper place to do things like that.

Or, I'm thinking we could introduce another vhost function, for not
breaking current API, to do that, returning the right queue, so that
other applications (instead of the vhost pmd only) can use that as well.

Tetsuya, just in case you missed the early discussion about automic
receive steering, here is a link:

  http://dpdk.org/ml/archives/dev/2015-October/025779.html


--yliu


[dpdk-dev] [PATCH] app/testpmd: fix wrong fdir help and doc

2015-11-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: Lu, Wenzhuo
> Sent: Friday, November 06, 2015 7:50 AM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo; Lu, Wenzhuo
> Subject: [PATCH] app/testpmd: fix wrong fdir help and doc
> 
> After implementing the fdir new modes for x550, the CLIs are modified.
> Forgot to update the related help info and doc.
> 
> Fixes: 53b2bb9b7ea7 ("app/testpmd: new flow director commands")
> Signed-off-by: Wenzhuo Lu 

Acked-by: Pablo de Lara 


[dpdk-dev] [PATCH v3 08/14] acl: arm64: acl implementation using NEON gcc intrinsic

2015-11-06 Thread Ananyev, Konstantin


> -Original Message-
> From: Jerin Jacob [mailto:jerin.jacob at caviumnetworks.com]
> Sent: Friday, November 06, 2015 9:40 AM
> To: dev at dpdk.org
> Cc: thomas.monjalon at 6wind.com; Hunt, David; viktorin at rehivetech.com; 
> Ananyev, Konstantin; Jerin Jacob
> Subject: [dpdk-dev] [PATCH v3 08/14] acl: arm64: acl implementation using 
> NEON gcc intrinsic
> 
> verified with testacl and acl_autotest applications on arm64 architecture.
> 
> Signed-off-by: Jerin Jacob 
> ---

Didn't test it on ARM, but from x86 perspective all seems ok. 

Acked-by: Konstantin Ananyev 



[dpdk-dev] BUG: DPDK i40e does not work with VFIO

2015-11-06 Thread Stephen Hemminger
On Thu, 5 Nov 2015 09:19:25 -0800
Stephen Hemminger  wrote:

> On my machine, i40e will not startup if using VFIO.
> 
> PMD: rte_i40evf_pmd_init():  >>
> PMD: rte_i40e_pmd_init():  >>
> PMD: eth_i40e_dev_init():  >>
> PMD: i40e_set_symmetric_hash_enable_per_port(): Symmetric hash has already 
> been disabled
> PMD: eth_i40e_dev_init(): Failed to init adminq: -54
> 
> The normal Linux driver works correctly. Firmware has been updated to the 
> latest version.
> 
> Like my earlier experience with fm10k, I suspect that Intel never tests i40e 
> with IOMMU,
> and only tested with igb_uio.

I found the issue. It was a problem with older version of Xen DOM0 patches
which were still outstanding in the internal development package.


[dpdk-dev] [PATCH v2] i40e: fix the issue of not freeing memzone

2015-11-06 Thread Wu, Jingjing


> -Original Message-
> From: Zhang, Helin
> Sent: Friday, November 06, 2015 3:57 PM
> To: dev at dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin
> Subject: [PATCH v2] i40e: fix the issue of not freeing memzone
> 
> This fixes the issue of not freeing memzone in a call to free the memory for
> adminq DMA.
> 
> Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 



[dpdk-dev] [PATCH v6 0/7] support for netronome nfp-6xxx card

2015-11-06 Thread Alejandro Lucero
Yes.

There was a bug in 1.8 affecting how BARs are used in the device, but this
should be fixed in 2.2

On Thu, Nov 5, 2015 at 11:42 PM, Stephen Hemminger <
stephen at networkplumber.org> wrote:

> On Thu, 05 Nov 2015 11:59:59 +0100
> Vincent JARDIN  wrote:
>
> >
> > On 05/11/2015 11:43, Alejandro.Lucero wrote:
> > > From: "Alejandro.Lucero" 
> > >
> > > This patchset adds a new PMD for Netronome nfp-6xxx card.
> > > Just PCI Virtual Functions supported.
> > > Using this PMD requires previous Netronome BSP installation.
> > >
> >
> > I understand that this PMD needs a kernel driver which is not upstream
> > yet. Am I correct?
> >
> >
> https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/drivers/net/ethernet
> >
> >
> > Best regards,
> >Vincent
> >
>
> Does this driver work with VFIO?
>


[dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload

2015-11-06 Thread Xu, Qian Q
Tested-by: Qian Xu 

- Test Commit: c4d404d7c1257465176deb5bb8c84e627d2d5eee
- OS/Kernel: Fedora 21/4.1.8
- GCC: gcc (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)
- CPU: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz
- NIC: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
- Target: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 
01)
- Total 1 cases, 1 passed, 0 failed. Legacy vhost + virtio-pmd can work well 
with TSO. 

Test Case 1:  test_legacy_vhost+ virtio-pmd tso 
===

On host:

1. Start VM with legacy-vhost as backend::

taskset -c 4-6  /home/qxu10/qemu-2.2.0/x86_64-softmmu/qemu-system-x86_64 
-object memory-backend-file, id=mem,size=2048M,mem-path=/mnt/huge,share=on 
-numa node,memdev=mem -mem-prealloc \
-enable-kvm -m 2048 -smp 4 -cpu host -name dpdk1-vm1 \
-drive file=/home/img/dpdk1-vm1.img \
-netdev tap,id=vhost3,ifname=tap_vhost3,vhost=on,script=no \
-device virtio-net pci,netdev=vhost3,mac=52:54:00:00:00:01,id=net3 \
-netdev tap,id=ipvm1,ifname=tap3,script=/etc/qemu-ifup -device 
rtl8139,netdev=ipvm1,id=net0,mac=00:00:00:00:00:01 \
-localtime -nographic

2.  Set up the bridge on host: 

brctl addbr br1
brctl addif br1 ens260f0 # The interface is 85:00.0 connected to ixia card3 
port9
brctl addif br1 tap0
brctl addif br1 tap1

ifconfig ens260f0 up
ifconfig ens260f0 promisc
ifconfig tap0 up
ifconfig tap1 up
ifconfig tap0 promisc
ifconfig tap1 promisc
brctl stp br1 off
ifconfig br1 up
brctl show

3. Disable firewall and Network manager on host:

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl stop ip6tables.service
systemctl disable ip6tables.service
systemctl stop iptables.service
systemctl disable iptables.service
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

4.  Let br1 learn the MAC : 02:00:00:00:00:00, since in the VM, the virtio 
device run testpmd, then it will send packets with the DEST MAC as 
02:00:00:00:00:00. Then the br1 will know this packet can go to the NIC and 
then it will go back to the traffic generator. So here we send a packet from 
IXIA with the SRC MAC=02:00:00:00:00:00 and DEST MAC=52:54:00:00:00:01 to let 
the br1 know the MAC. We can verify the macs that the bridge knows by running: 
brctl br1 showmacs

port no mac addris local?   ageing timer
  3 02:00:00:00:00:00   no 6.06
  1 42:fa:45:4d:aa:4d   yes0.00
  1 42:fa:45:4d:aa:4d   yes0.00
  1 52:54:00:00:00:01   no 6.06
  2 8e:d7:22:bf:c9:8d   yes0.00
  2 8e:d7:22:bf:c9:8d   yes0.00
  3 90:e2:ba:4a:55:1c   yes0.00
  3 90:e2:ba:4a:55:1c   yes0.00


On guest:

5. ensure the dpdk folder copied to the guest with the same config file and 
build process as host. Then bind 2 virtio devices to igb_uio and start testpmd, 
below is the step for reference::

.//tools/dpdk_nic_bind.py --bind igb_uio 00:03.0 

.//x86_64-native-linuxapp-gcc/app/test-pmd/testpmd -c f -n 4 
-- -i --txqflags 0x0f00 --max-pkt-len 9000 

$ >set fwd csum

$ >tso set 1000 0
$ >tso set 1000 1

$ >start 

6.  Send TCP packets to virtio1, and the packet size is 5000, then at the 
virtio side, it will receive 1 packet ant let vhost to do TSO, vhost will let 
NIC do TSO, so at IXIA, we expected 5 packets, each ~1k size, then also capture 
the received packets and check if the checksum is correct.

Result:  All the behavior is expected and cksum is correct. So the case is PASS.


Thanks
Qian


-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Xu, Qian Q
Sent: Thursday, November 05, 2015 6:45 PM
To: Thomas Monjalon
Cc: dev at dpdk.org; Michael S. Tsirkin
Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload

OK, I will check it tomorrow. 
Another comment is that "Legacy vhost + virtio-pmd" is not the common use case. 
Firstly, in this case, virtio-pmd has no TCP/IP stack, TSO is not very 
meaningful; secondly, we can't get performance benefit from this case compared 
to "Legacy vhost+ legacy virtio". So I'm afraid no customer would like to try 
this case since the fake TSO and poor performance. 


Thanks
Qian


-Original Message-
From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] 
Sent: Thursday, November 05, 2015 5:02 PM
To: Xu, Qian Q
Cc: Liu, Jijiang; dev at dpdk.org; Michael S. Tsirkin
Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload

2015-11-05 08:49, Xu, Qian Q:
> Test Case 1:  test_dpdk vhost+ virtio-pmd tso 
[...]
> Test Case 2:  test_dpdk vhost+legacy virtio iperf tso
[...]
> Yes please, I'd like to see a test report showing this virtio running with 
> Linux vhost and without vhost.
> We must check that the checksum is well offloaded and sent packets are valids.
> 

[dpdk-dev] [PATCH 2/3] i40e: fix ICC compile issue

2015-11-06 Thread De Lara Guarch, Pablo
Hi Helin,


> -Original Message-
> From: Zhang, Helin
> Sent: Friday, November 06, 2015 7:49 AM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo; Zhang, Helin
> Subject: [PATCH 2/3] i40e: fix ICC compile issue
> 
> It fixes compile issue on ICC 13.0.0.
> 
> Error logs:
> i40e_ethdev.c(7943): error #188: enumerated type mixed with another type
> PMD_INIT_LOG(ERR,
> 
> Signed-off-by: Helin Zhang 
> ---
>  drivers/net/i40e/i40e_ethdev.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index ddf3d38..8c1809a 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -7942,7 +7942,7 @@ i40e_vsi_get_bw_info(struct i40e_vsi *vsi)
>   if (ret) {
>   PMD_INIT_LOG(ERR,
>"couldn't get PF vsi bw config, err %s aq_err %s\n",
> -  i40e_stat_str(hw, ret),
> +  i40e_stat_str(hw, (enum i40e_status_code)ret),
>i40e_aq_str(hw, hw->aq.asq_last_status));
>   return -EINVAL;
>   }
> @@ -7953,7 +7953,7 @@ i40e_vsi_get_bw_info(struct i40e_vsi *vsi)
>   if (ret) {
>   PMD_INIT_LOG(ERR,
>"couldn't get PF vsi ets bw config, err %s aq_err
> %s\n",
> -  i40e_stat_str(hw, ret),
> +  i40e_stat_str(hw, (enum i40e_status_code)ret),
>i40e_aq_str(hw, hw->aq.asq_last_status));
>   return -EINVAL;
>   }
> @@ -8122,7 +8122,7 @@ i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 tc_map)
>   if (ret) {
>   PMD_INIT_LOG(ERR,
>"Failed updating vsi bw info, err %s aq_err %s",
> -  i40e_stat_str(hw, ret),
> +  i40e_stat_str(hw, (enum i40e_status_code)ret),
>i40e_aq_str(hw, hw->aq.asq_last_status));
>   goto out;
>   }
> @@ -8173,9 +8173,9 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
>   if (ret) {
>   PMD_INIT_LOG(ERR,
>"Set DCB Config failed, err %s aq_err %s\n",
> -  i40e_stat_str(hw, ret),
> +  i40e_stat_str(hw, (enum i40e_status_code)ret),
>i40e_aq_str(hw, hw->aq.asq_last_status));
> - return ret;
> + return (enum i40e_status_code)ret;
>   }
>   /* set receive Arbiter to RR mode and ETS scheme by default */
>   for (i = 0; i <= I40E_PRTDCB_RETSTCC_MAX_INDEX; i++) {
> --
> 1.8.1.4

I think it is best to change the variable type, instead of casting,
since i40e_aq_query_vsi_bw_config for instance is returning a enum 
i40e_status_code and not an int.

Thanks,
Pablo



[dpdk-dev] [PATCH 1/3] bonding: fix ICC compile issue

2015-11-06 Thread De Lara Guarch, Pablo
Hi Helin,

> -Original Message-
> From: Zhang, Helin
> Sent: Friday, November 06, 2015 7:49 AM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo; Zhang, Helin
> Subject: [PATCH 1/3] bonding: fix ICC compile issue
> 
> It fixes compile issue on ICC 13.0.0.
> 
> Error logs:
> rte_eth_bond_pmd.c(1327): error #188: enumerated type
> mixed with another type
> slave_eth_dev->data->dev_conf.rxmode.mq_mode |= ETH_MQ_RX_RSS;
> 
> Signed-off-by: Helin Zhang 

There is already a patch for this:

http://dpdk.org/dev/patchwork/patch/8698/



[dpdk-dev] [PATCH] i40e: fix the issue of not freeing memzone

2015-11-06 Thread Zhang, Helin


> -Original Message-
> From: Wu, Jingjing
> Sent: Friday, November 6, 2015 1:40 PM
> To: Zhang, Helin; dev at dpdk.org
> Subject: RE: [PATCH] i40e: fix the issue of not freeing memzone
> 
> > -   static uint64_t id = 0;
> > const struct rte_memzone *mz = NULL;
> > char z_name[RTE_MEMZONE_NAMESIZE];
> >
> > if (!mem)
> > return I40E_ERR_PARAM;
> >
> > -   id++;
> > -   snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
> > +   snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, rte_rand());
> 
> Why change id++ to rte_rand() ?
Don't need to maintain the ID, which may have race condition issue.
Get a random data is good enough. Some other PMDs are using tsc count for the 
similar purpose.

> 
> >  #ifdef RTE_LIBRTE_XEN_DOM0
> > mz = rte_memzone_reserve_bounded(z_name, size, SOCKET_ID_ANY, 0,
> >  alignment, RTE_PGSIZE_2M);
> > @@ -2929,7 +2927,6 @@
> > i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
> > if (!mz)
> > return I40E_ERR_NO_MEMORY;
> >
> > -   mem->id = id;
> > mem->size = size;
> > mem->va = mz->addr;
> >  #ifdef RTE_LIBRTE_XEN_DOM0
> > @@ -2937,6 +2934,8 @@
> > i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
> > #else
> > mem->pa = mz->phys_addr;
> >  #endif
> > +   mem->zone = (const void *)mz;
> > +   PMD_DRV_LOG(DEBUG, "memzone allocated: %p", mem->zone);
> >
> Why not print the name of mem_zone instead of pointer?
Good idea to print the name instead, and possible physical address, virtual 
address, etc.

Regards,
Helin

> 
> 
> Thanks
> Jingjing


[dpdk-dev] [RFC PATCH] vhost: remove lockless enqueue to virt ring

2015-11-06 Thread Xie, Huawei
On 11/6/2015 9:48 AM, Changchun Ouyang wrote:
>
>
> > From: huawei.xie at intel.com
> > To: huawei.xie at intel.com; dev at dpdk.org
> > Date: Thu, 5 Nov 2015 10:21:41 +
> > CC: haifeng.lin at intel.com; ann.zhuangyanying at huawei.com
> > Subject: Re: [dpdk-dev] [RFC PATCH] vhost: remove lockless enqueue
> to virt ring
> >
> > If no objections, would remove the internal cmpset enqueue, should get
> > some improved performance.
>
> I think it is good.
> The vhost sample also need some changes for this modification.
> do we have the percentage of gaining when removing the lock?
The atomic cmpset is a costly operation.
We plan to implement vhost/virtio performance test example, which will
cover the most common scenarios.
/huawei
>
> thanks and regards,
> Changchun
>


[dpdk-dev] [PATCH] i40e: fix the issue of not freeing memzone

2015-11-06 Thread Wu, Jingjing
> - static uint64_t id = 0;
>   const struct rte_memzone *mz = NULL;
>   char z_name[RTE_MEMZONE_NAMESIZE];
> 
>   if (!mem)
>   return I40E_ERR_PARAM;
> 
> - id++;
> - snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
> + snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, rte_rand());

Why change id++ to rte_rand() ?

>  #ifdef RTE_LIBRTE_XEN_DOM0
>   mz = rte_memzone_reserve_bounded(z_name, size,
> SOCKET_ID_ANY, 0,
>alignment, RTE_PGSIZE_2M);
> @@ -2929,7 +2927,6 @@
> i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
>   if (!mz)
>   return I40E_ERR_NO_MEMORY;
> 
> - mem->id = id;
>   mem->size = size;
>   mem->va = mz->addr;
>  #ifdef RTE_LIBRTE_XEN_DOM0
> @@ -2937,6 +2934,8 @@
> i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
> #else
>   mem->pa = mz->phys_addr;
>  #endif
> + mem->zone = (const void *)mz;
> + PMD_DRV_LOG(DEBUG, "memzone allocated: %p", mem->zone);
> 
Why not print the name of mem_zone instead of pointer?


Thanks
Jingjing


[dpdk-dev] [RFC PATCH] vhost: remove lockless enqueue to virt ring

2015-11-06 Thread Xie, Huawei
On 11/6/2015 9:43 AM, Tetsuya Mukawa wrote:
> On 2015/11/05 19:21, Xie, Huawei wrote:
>> If no objections, would remove the internal cmpset enqueue, should get
>> some improved performance.
>>
>> No idea why commit message is lost:
>> DPDK doesn't support receiving/transmitting packets from/to the same
>> port/queue.
>> Vhost pmd wraps vhost device as normal dpdk port. dpdkvhost based
>> applications/switch
>>  also treate virtio port and physical port both as ports, and have
>> their  own
>> lock implmentation when to enqueue packets to the same port. This patch
>> removes
>> the internal lockless vhost enqueue implmentation.
>> On 11/5/2015 5:38 PM, Huawei Xie wrote:
>>> Signed-off-by: Huawei Xie 
> Hi Xie,
>
> I think it's a good optimization.
> But I  guess the patch will changes behavior of vhost library API.
> For example, if someone has already implemented an application based on
> the assumption that vhost library has internal lock, I doubt their
> application will face an issue with this patch.
Yes, i understand. If we have an improper implementation, we fix it as
early as possible. I prefer to remove the internal lock currently. The
last thing i want to do is maintain two APIs.
Would follow the ABI process.
>
> If it's correct, we might need to follow below steps.
> http://dpdk.org/doc/guides/contributing/versioning.html
>
> Thanks,
> Tetsuya
>



[dpdk-dev] [RFC 5/5] vhost/container: change mode of vhost listening socket

2015-11-06 Thread Jianfeng Tan
Change vhost listening socket mode so that users in groups and
others can connect to vhost listening socket.

Signed-off-by: Huawei Xie 
Signed-off-by: Jianfeng Tan 
---
 lib/librte_vhost/vhost_user/vhost-net-user.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c 
b/lib/librte_vhost/vhost_user/vhost-net-user.c
index 2dc0547..7b24f7c 100644
--- a/lib/librte_vhost/vhost_user/vhost-net-user.c
+++ b/lib/librte_vhost/vhost_user/vhost-net-user.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -137,6 +138,10 @@ uds_socket(const char *path)
if (ret == -1)
goto err;

+   ret = chmod(un.sun_path, 0666);
+   if (ret == 0)
+   RTE_LOG(INFO, VHOST_CONFIG, "chmod 0666, ok\n");
+
return sockfd;

 err:
-- 
2.1.4



[dpdk-dev] [RFC 4/5] virtio/container: adjust memory initialization process

2015-11-06 Thread Jianfeng Tan
When using virtio for container, we should specify --no-huge so
that in memory initialization, shm_open() is used to alloc memory
from tmpfs filesystem /dev/shm/.

Signed-off-by: Huawei Xie 
Signed-off-by: Jianfeng Tan 
---
 lib/librte_eal/common/include/rte_memory.h |  5 +++
 lib/librte_eal/linuxapp/eal/eal_memory.c   | 58 --
 lib/librte_mempool/rte_mempool.c   | 16 -
 3 files changed, 69 insertions(+), 10 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_memory.h 
b/lib/librte_eal/common/include/rte_memory.h
index 1bed415..9c1effc 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -100,6 +100,7 @@ struct rte_memseg {
int32_t socket_id;  /**< NUMA socket ID. */
uint32_t nchannel;  /**< Number of channels. */
uint32_t nrank; /**< Number of ranks. */
+   int fd; /**< fd used for share this memory */
 #ifdef RTE_LIBRTE_XEN_DOM0
 /**< store segment MFNs */
uint64_t mfn[DOM0_NUM_MEMBLOCK];
@@ -128,6 +129,10 @@ int rte_mem_lock_page(const void *virt);
  */
 phys_addr_t rte_mem_virt2phy(const void *virt);

+
+int
+rte_memseg_info_get(int index, int *pfd, uint64_t *psize, void **paddr);
+
 /**
  * Get the layout of the available physical memory.
  *
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
b/lib/librte_eal/linuxapp/eal/eal_memory.c
index ac2745e..9abbfc6 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -80,6 +80,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 

 #include 
 #include 
@@ -143,6 +146,18 @@ rte_mem_lock_page(const void *virt)
return mlock((void*)aligned, page_size);
 }

+int
+rte_memseg_info_get(int index, int *pfd, uint64_t *psize, void **paddr)
+{
+   struct rte_mem_config *mcfg;
+   mcfg = rte_eal_get_configuration()->mem_config;
+
+   *pfd = mcfg->memseg[index].fd;
+   *psize = (uint64_t)mcfg->memseg[index].len;
+   *paddr = (void *)(uint64_t)mcfg->memseg[index].addr;
+   return 0;
+}
+
 /*
  * Get physical address of any mapped virtual address in the current process.
  */
@@ -1044,6 +1059,42 @@ calc_num_pages_per_socket(uint64_t * memory,
return total_num_pages;
 }

+static void *
+rte_eal_shm_create(int *pfd)
+{
+   int ret, fd;
+   char filepath[256];
+   void *vaddr;
+   uint64_t size = internal_config.memory;
+
+   sprintf(filepath, "/%s_cvio", internal_config.hugefile_prefix);
+
+   fd = shm_open(filepath, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
+   if (fd < 0) {
+   rte_panic("shm_open %s failed: %s\n", filepath, 
strerror(errno));
+   }
+   ret = flock(fd, LOCK_EX);
+   if (ret < 0) {
+   close(fd);
+   rte_panic("flock %s failed: %s\n", filepath, strerror(errno));
+   }
+
+   ret = ftruncate(fd, size);
+   if (ret < 0) {
+   rte_panic("ftruncate failed: %s\n", strerror(errno));
+   }
+   /* flag: MAP_HUGETLB */
+   vaddr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+   if (vaddr == MAP_FAILED) {
+   rte_panic("mmap failed: %s\n", strerror(errno));
+   }
+   memset(vaddr, 0, size);
+   *pfd = fd;
+
+   return vaddr;
+}
+
+
 /*
  * Prepare physical memory mapping: fill configuration structure with
  * these infos, return 0 on success.
@@ -1072,7 +1123,9 @@ rte_eal_hugepage_init(void)
int new_pages_count[MAX_HUGEPAGE_SIZES];
 #endif

+#ifndef RTE_VIRTIO_VDEV
test_proc_pagemap_readable();
+#endif

memset(used_hp, 0, sizeof(used_hp));

@@ -1081,8 +1134,8 @@ rte_eal_hugepage_init(void)

/* hugetlbfs can be disabled */
if (internal_config.no_hugetlbfs) {
-   addr = mmap(NULL, internal_config.memory, PROT_READ | 
PROT_WRITE,
-   MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+   int fd;
+   addr = rte_eal_shm_create();
if (addr == MAP_FAILED) {
RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__,
strerror(errno));
@@ -1093,6 +1146,7 @@ rte_eal_hugepage_init(void)
mcfg->memseg[0].hugepage_sz = RTE_PGSIZE_4K;
mcfg->memseg[0].len = internal_config.memory;
mcfg->memseg[0].socket_id = 0;
+   mcfg->memseg[0].fd = fd;
return 0;
}

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index e57cbbd..8f8852b 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -453,13 +453,6 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
rte_errno = EINVAL;
return NULL;
}
-
-   /* check that we have both VA and PA */
-   if (vaddr != NULL && 

[dpdk-dev] [RFC 3/5] virtio/container: unify desc->addr assignment

2015-11-06 Thread Jianfeng Tan
Unify desc->addr assignment using RTE_MBUF_DATA_DMA_ADDR. virtio
for vm uses physical address, while virtio for container uses
virtual address.

Signed-off-by: Huawei Xie 
Signed-off-by: Jianfeng Tan 
---
 drivers/net/virtio/virtio_rxtx.c| 9 -
 drivers/net/virtio/virtio_rxtx_simple.c | 9 -
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 5770fa2..1cfb2b9 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -191,8 +191,7 @@ virtqueue_enqueue_recv_refill(struct virtqueue *vq, struct 
rte_mbuf *cookie)

start_dp = vq->vq_ring.desc;
start_dp[idx].addr =
-   (uint64_t)(cookie->buf_physaddr + RTE_PKTMBUF_HEADROOM
-   - hw->vtnet_hdr_size);
+   RTE_MBUF_DATA_DMA_ADDR(cookie) - hw->vtnet_hdr_size;
start_dp[idx].len =
cookie->buf_len - RTE_PKTMBUF_HEADROOM + hw->vtnet_hdr_size;
start_dp[idx].flags =  VRING_DESC_F_WRITE;
@@ -343,7 +342,7 @@ virtio_dev_vring_start(struct virtqueue *vq, int queue_type)
VIRTIO_WRITE_REG_2(vq->hw, VIRTIO_PCI_QUEUE_SEL,
vq->vq_queue_index);
VIRTIO_WRITE_REG_4(vq->hw, VIRTIO_PCI_QUEUE_PFN,
-   vq->mz->phys_addr >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);
+   vq->vq_ring_mem >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);
} else if (queue_type == VTNET_TQ) {
if (use_simple_rxtx) {
int mid_idx  = vq->vq_nentries >> 1;
@@ -366,12 +365,12 @@ virtio_dev_vring_start(struct virtqueue *vq, int 
queue_type)
VIRTIO_WRITE_REG_2(vq->hw, VIRTIO_PCI_QUEUE_SEL,
vq->vq_queue_index);
VIRTIO_WRITE_REG_4(vq->hw, VIRTIO_PCI_QUEUE_PFN,
-   vq->mz->phys_addr >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);
+   vq->vq_ring_mem >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);
} else {
VIRTIO_WRITE_REG_2(vq->hw, VIRTIO_PCI_QUEUE_SEL,
vq->vq_queue_index);
VIRTIO_WRITE_REG_4(vq->hw, VIRTIO_PCI_QUEUE_PFN,
-   vq->mz->phys_addr >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);
+   vq->vq_ring_mem >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);
}
 }

diff --git a/drivers/net/virtio/virtio_rxtx_simple.c 
b/drivers/net/virtio/virtio_rxtx_simple.c
index ff3c11a..d1bb4c4 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -80,8 +80,8 @@ virtqueue_enqueue_recv_refill_simple(struct virtqueue *vq,
vq->sw_ring[desc_idx] = cookie;

start_dp = vq->vq_ring.desc;
-   start_dp[desc_idx].addr = (uint64_t)((uintptr_t)cookie->buf_physaddr +
-   RTE_PKTMBUF_HEADROOM - sizeof(struct virtio_net_hdr));
+   start_dp[desc_idx].addr = RTE_MBUF_DATA_DMA_ADDR(cookie)
+   - sizeof(struct virtio_net_hdr);
start_dp[desc_idx].len = cookie->buf_len -
RTE_PKTMBUF_HEADROOM + sizeof(struct virtio_net_hdr);

@@ -118,9 +118,8 @@ virtio_rxq_rearm_vec(struct virtqueue *rxvq)
p = (uintptr_t)_ring[i]->rearm_data;
*(uint64_t *)p = rxvq->mbuf_initializer;

-   start_dp[i].addr =
-   (uint64_t)((uintptr_t)sw_ring[i]->buf_physaddr +
-   RTE_PKTMBUF_HEADROOM - sizeof(struct virtio_net_hdr));
+   start_dp[i].addr = RTE_MBUF_DATA_DMA_ADDR(sw_ring[i])
+   - sizeof(struct virtio_net_hdr);
start_dp[i].len = sw_ring[i]->buf_len -
RTE_PKTMBUF_HEADROOM + sizeof(struct virtio_net_hdr);
}
-- 
2.1.4



[dpdk-dev] [RFC 2/5] virtio/container: add a new virtual device named eth_cvio

2015-11-06 Thread Jianfeng Tan
Add a new virtual device named eth_cvio, it can be used just like
eth_ring, eth_null, etc. Configured paramters include number of rx,
tx, cq, path of vhost unix socket, and queue size. The major
difference with virtio for vm is that here we use virtual address
instead of physical address for vhost to calculate relative address.

Signed-off-by: Huawei Xie 
Signed-off-by: Jianfeng Tan 
---
 drivers/net/virtio/virtio_ethdev.c | 319 +
 drivers/net/virtio/virtio_ethdev.h |  16 ++
 drivers/net/virtio/virtqueue.h |   9 +-
 3 files changed, 275 insertions(+), 69 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 6001108..b5e2126 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -56,6 +56,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "virtio_ethdev.h"
 #include "virtio_pci.h"
@@ -63,7 +64,6 @@
 #include "virtqueue.h"
 #include "virtio_rxtx.h"

-
 static int eth_virtio_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
 static int  virtio_dev_configure(struct rte_eth_dev *dev);
@@ -164,8 +164,7 @@ virtio_send_command(struct virtqueue *vq, struct 
virtio_pmd_ctrl *ctrl,
if ((vq->vq_free_cnt < ((uint32_t)pkt_num + 2)) || (pkt_num < 1))
return -1;

-   memcpy(vq->virtio_net_hdr_mz->addr, ctrl,
-   sizeof(struct virtio_pmd_ctrl));
+   memcpy(vq->virtio_net_hdr_vaddr, ctrl, sizeof(struct virtio_pmd_ctrl));

/*
 * Format is enforced in qemu code:
@@ -174,14 +173,14 @@ virtio_send_command(struct virtqueue *vq, struct 
virtio_pmd_ctrl *ctrl,
 * One RX packet for ACK.
 */
vq->vq_ring.desc[head].flags = VRING_DESC_F_NEXT;
-   vq->vq_ring.desc[head].addr = vq->virtio_net_hdr_mz->phys_addr;
+   vq->vq_ring.desc[head].addr = vq->virtio_net_hdr_mem;
vq->vq_ring.desc[head].len = sizeof(struct virtio_net_ctrl_hdr);
vq->vq_free_cnt--;
i = vq->vq_ring.desc[head].next;

for (k = 0; k < pkt_num; k++) {
vq->vq_ring.desc[i].flags = VRING_DESC_F_NEXT;
-   vq->vq_ring.desc[i].addr = vq->virtio_net_hdr_mz->phys_addr
+   vq->vq_ring.desc[i].addr = vq->virtio_net_hdr_mem
+ sizeof(struct virtio_net_ctrl_hdr)
+ sizeof(ctrl->status) + sizeof(uint8_t)*sum;
vq->vq_ring.desc[i].len = dlen[k];
@@ -191,7 +190,7 @@ virtio_send_command(struct virtqueue *vq, struct 
virtio_pmd_ctrl *ctrl,
}

vq->vq_ring.desc[i].flags = VRING_DESC_F_WRITE;
-   vq->vq_ring.desc[i].addr = vq->virtio_net_hdr_mz->phys_addr
+   vq->vq_ring.desc[i].addr = vq->virtio_net_hdr_mem
+ sizeof(struct virtio_net_ctrl_hdr);
vq->vq_ring.desc[i].len = sizeof(ctrl->status);
vq->vq_free_cnt--;
@@ -236,7 +235,7 @@ virtio_send_command(struct virtqueue *vq, struct 
virtio_pmd_ctrl *ctrl,
PMD_INIT_LOG(DEBUG, "vq->vq_free_cnt=%d\nvq->vq_desc_head_idx=%d",
vq->vq_free_cnt, vq->vq_desc_head_idx);

-   memcpy(, vq->virtio_net_hdr_mz->addr,
+   memcpy(, vq->virtio_net_hdr_vaddr,
sizeof(struct virtio_pmd_ctrl));

return result.status;
@@ -374,66 +373,79 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
}
}

-   /*
-* Virtio PCI device VIRTIO_PCI_QUEUE_PF register is 32bit,
-* and only accepts 32 bit page frame number.
-* Check if the allocated physical memory exceeds 16TB.
-*/
-   if ((mz->phys_addr + vq->vq_ring_size - 1) >> 
(VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
-   PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!");
-   rte_free(vq);
-   return -ENOMEM;
-   }
-
memset(mz->addr, 0, sizeof(mz->len));
vq->mz = mz;
-   vq->vq_ring_mem = mz->phys_addr;
vq->vq_ring_virt_mem = mz->addr;
-   PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem:  0x%"PRIx64, 
(uint64_t)mz->phys_addr);
-   PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64, 
(uint64_t)(uintptr_t)mz->addr);
+
+   if (dev->dev_type == RTE_ETH_DEV_PCI) {
+   vq->vq_ring_mem = mz->phys_addr;
+
+   /* Virtio PCI device VIRTIO_PCI_QUEUE_PF register is 32bit,
+* and only accepts 32 bit page frame number.
+* Check if the allocated physical memory exceeds 16TB.
+*/
+   uint64_t last_physaddr = vq->vq_ring_mem + vq->vq_ring_size - 1;
+   if (last_physaddr >> (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
+   PMD_INIT_LOG(ERR, "vring address shouldn't be above 
16TB!");
+   rte_free(vq);
+   return -ENOMEM;
+   }
+   }
+#ifdef RTE_VIRTIO_VDEV
+   else { /* RTE_ETH_DEV_VIRTUAL */
+

[dpdk-dev] [RFC 1/5] virtio/container: add handler for ioport rd/wr

2015-11-06 Thread Jianfeng Tan
Add handler to turn ioport rd/wr into vhost user unix socket msgs.
Add field, like kickfd, callfd in struct virtio_hw.
Add CONFIG_RTE_VIRTIO_VDEV to control virtio vdev, disabled by default.

Signed-off-by: Huawei Xie 
Signed-off-by: Jianfeng Tan 
---
 config/common_linuxapp  |   5 +
 drivers/net/virtio/Makefile |   4 +
 drivers/net/virtio/vhost-user.c | 433 
 drivers/net/virtio/vhost-user.h | 137 +
 drivers/net/virtio/virtio_pci.h |  32 ++-
 5 files changed, 610 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/virtio/vhost-user.c
 create mode 100644 drivers/net/virtio/vhost-user.h

diff --git a/config/common_linuxapp b/config/common_linuxapp
index c1d4bbd..99dd348 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -477,3 +477,8 @@ CONFIG_RTE_APP_TEST=y
 CONFIG_RTE_TEST_PMD=y
 CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
 CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
+
+#
+# Enable virtio support for container
+#
+#CONFIG_RTE_VIRTIO_VDEV=y
diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
index 43835ba..dddf125 100644
--- a/drivers/net/virtio/Makefile
+++ b/drivers/net/virtio/Makefile
@@ -52,6 +52,10 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx_simple.c

+ifeq ($(CONFIG_RTE_VIRTIO_VDEV),y)
+   SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += vhost-user.c
+endif
+
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_ether
 DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_mempool lib/librte_mbuf
diff --git a/drivers/net/virtio/vhost-user.c b/drivers/net/virtio/vhost-user.c
new file mode 100644
index 000..d0960ce
--- /dev/null
+++ b/drivers/net/virtio/vhost-user.c
@@ -0,0 +1,433 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2015 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 "virtio_pci.h"
+#include "virtio_logs.h"
+#include "virtio_ethdev.h"
+#include "virtqueue.h"
+#include "vhost-user.h"
+
+static int
+vhost_user_read(int fd, void *buf, int len, int *fds, int fd_num)
+{
+   struct msghdr msgh;
+   struct iovec iov;
+   int r;
+
+   size_t fd_size = fd_num * sizeof(int);
+   char control[CMSG_SPACE(fd_size)];
+   struct cmsghdr *cmsg;
+
+   memset(, 0, sizeof(msgh));
+   memset(control, 0, sizeof(control));
+
+   iov.iov_base = (uint8_t *)buf;
+   iov.iov_len = len;
+
+   msgh.msg_iov = 
+   msgh.msg_iovlen = 1;
+
+   msgh.msg_control = control;
+   msgh.msg_controllen = sizeof(control);
+
+   cmsg = CMSG_FIRSTHDR();
+
+   cmsg->cmsg_len = CMSG_LEN(fd_size);
+   cmsg->cmsg_level = SOL_SOCKET;
+   cmsg->cmsg_type = SCM_RIGHTS;
+   memcpy(CMSG_DATA(cmsg), fds, fd_size);
+
+   do {
+   r = sendmsg(fd, , 0);
+   } while (r < 0 && errno == EINTR);
+
+   return r;
+}
+
+static int
+vhost_user_write(int fd, VhostUserMsg *msg)
+{
+   uint32_t valid_flags = VHOST_USER_REPLY_MASK | VHOST_USER_VERSION;
+   int ret, sz_hdr = VHOST_USER_HDR_SIZE, sz_payload;
+   
+
+   ret 

[dpdk-dev] [RFC 0/5] virtio support for container

2015-11-06 Thread Jianfeng Tan
This patchset only acts as a PoC to request the community for comments.

This patchset is to provide high performance networking interface
(virtio) for container-based DPDK applications. The way of starting
DPDK applications in containers with ownership of NIC devices
exclusively is beyond the scope. The basic idea here is to present
a new virtual device (named eth_cvio), which can be discovered
and initialized in container-based DPDK applications rte_eal_init().
To minimize the change, we reuse already-existing virtio frontend
driver code (driver/net/virtio/).

Compared to QEMU/VM case, virtio device framework (translates I/O
port r/w operations into unix socket/cuse protocol, which is originally
provided in QEMU),  is integrated in virtio frontend driver. Aka, this
new converged driver actually plays the role of original frontend
driver and the role of QEMU device framework.

The biggest difference here lies in how to calculate relative address
for backend. The principle of virtio is that: based on one or multiple
shared memory segments, vhost maintains a reference system with
the base addresses and length of these segments so that an address
from VM comes (usually GPA, Guest Physical Address), vhost can
translate it into self-recognizable address (aka VVA, Vhost Virtual
Address). To decrease the overhead of address translation, we should
maintain as few segments as better. In the context of virtual machines,
GPA is always locally continuous. So it's a good choice. In container's
case, CVA (Container Virtual Address) can be used. This means that:
a. when set_base_addr, CVA address is used; b. when preparing RX's
descriptors, CVA address is used; c. when transmitting packets, CVA is
filled in TX's descriptors; d. in TX and CQ's header, CVA is used.

How to share memory? In VM's case, qemu always shares all physical
layout to backend. But it's not feasible for a container, as a process,
to share all virtual memory regions to backend. So only specified
virtual memory regions (type is shared) are sent to backend. It leads
to a limitation that only addresses in these areas can be used to
transmit or receive packets. For now, the shared memory is created
in /dev/shm using shm_open() in the memory initialization process.

How to use?

a. Apply the patch of virtio for container. We need two copies of
patched code (referred as dpdk-app/ and dpdk-vhost/)

b. To compile container apps:
$: cd dpdk-app
$: vim config/common_linuxapp (uncomment "CONFIG_RTE_VIRTIO_VDEV=y")
$: make config RTE_SDK=`pwd` T=x86_64-native-linuxapp-gcc
$: make install RTE_SDK=`pwd` T=x86_64-native-linuxapp-gcc
$: make -C examples/l2fwd RTE_SDK=`pwd` T=x86_64-native-linuxapp-gcc

c. To build a docker image using Dockerfile below.
$: cat ./Dockerfile
FROM ubuntu:latest
WORKDIR /usr/src/dpdk
COPY . /usr/src/dpdk
CMD ["/usr/src/dpdk/examples/l2fwd/build/l2fwd", "-c", "0xc", "-n", "4", 
"--no-huge", "--no-pci", 
"--vdev=eth_cvio0,queue_num=256,rx=1,tx=1,cq=0,path=/var/run/usvhost", "--", 
"-p", "0x1"]
$: docker build -t dpdk-app-l2fwd .

d. To compile vhost:
$: cd dpdk-vhost
$: make config RTE_SDK=`pwd` T=x86_64-native-linuxapp-gcc
$: make install RTE_SDK=`pwd` T=x86_64-native-linuxapp-gcc
$: make -C examples/vhost RTE_SDK=`pwd` T=x86_64-native-linuxapp-gcc

e. Start vhost-switch
$: ./examples/vhost/build/vhost-switch -c 3 -n 4 --socket-mem 1024,1024 -- -p 
0x1 --stats 1

f. Start docker
$: docker run -i -t -v :/var/run/usvhost 
dpdk-app-l2fwd

Signed-off-by: Huawei Xie 
Signed-off-by: Jianfeng Tan 

Jianfeng Tan (5):
  virtio/container: add handler for ioport rd/wr
  virtio/container: add a new virtual device named eth_cvio
  virtio/container: unify desc->addr assignment
  virtio/container: adjust memory initialization process
  vhost/container: change mode of vhost listening socket

 config/common_linuxapp   |   5 +
 drivers/net/virtio/Makefile  |   4 +
 drivers/net/virtio/vhost-user.c  | 433 +++
 drivers/net/virtio/vhost-user.h  | 137 +
 drivers/net/virtio/virtio_ethdev.c   | 319 +++-
 drivers/net/virtio/virtio_ethdev.h   |  16 +
 drivers/net/virtio/virtio_pci.h  |  32 +-
 drivers/net/virtio/virtio_rxtx.c |   9 +-
 drivers/net/virtio/virtio_rxtx_simple.c  |   9 +-
 drivers/net/virtio/virtqueue.h   |   9 +-
 lib/librte_eal/common/include/rte_memory.h   |   5 +
 lib/librte_eal/linuxapp/eal/eal_memory.c |  58 +++-
 lib/librte_mempool/rte_mempool.c |  16 +-
 lib/librte_vhost/vhost_user/vhost-net-user.c |   5 +
 14 files changed, 967 insertions(+), 90 deletions(-)
 create mode 100644 drivers/net/virtio/vhost-user.c
 create mode 100644 drivers/net/virtio/vhost-user.h

-- 
2.1.4



[dpdk-dev] [RFC PATCH] vhost: remove lockless enqueue to virt ring

2015-11-06 Thread Changchun Ouyang


> From: huawei.xie at intel.com
> To: huawei.xie at intel.com; dev at dpdk.org
> Date: Thu, 5 Nov 2015 10:21:41 +
> CC: haifeng.lin at intel.com; ann.zhuangyanying at huawei.com
> Subject: Re: [dpdk-dev] [RFC PATCH] vhost: remove lockless enqueue to virt
> ring
> 
> If no objections, would remove the internal cmpset enqueue, should get
> some improved performance.
I think it is good.The vhost sample also need some changes for this 
modification.do we have the percentage of gaining when removing the lock?

thanks and regards,Changchun
> 
> No idea why commit message is lost:
> DPDK doesn't support receiving/transmitting packets from/to the same
> port/queue.
> Vhost pmd wraps vhost device as normal dpdk port. dpdkvhost based
> applications/switch
>  also treate virtio port and physical port both as ports, and have
> their  own
> lock implmentation when to enqueue packets to the same port. This patch
> removes
> the internal lockless vhost enqueue implmentation.
> On 11/5/2015 5:38 PM, Huawei Xie wrote:
> > Signed-off-by: Huawei Xie 
> 



[dpdk-dev] [PATCH] vhost: fix mmap failure as len not aligned with hugepage size

2015-11-06 Thread Changchun Ouyang


> From: jianfeng.tan at intel.com
> To: dev at dpdk.org
> Date: Fri, 30 Oct 2015 07:51:53 +0800
> Subject: [dpdk-dev] [PATCH] vhost: fix mmap failure as len not aligned with   
> hugepage size
> 
> This patch fixes a bug under lower version linux kernel, mmap() fails when
> length is not aligned with hugepage size.
> 
> Signed-off-by: Jianfeng Tan 
Acked-by: Changchun Ouyang > --->  
lib/librte_vhost/vhost_user/virtio-net-user.c | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c 
> b/lib/librte_vhost/vhost_user/virtio-net-user.c
> index a998ad8..641561c 100644
> --- a/lib/librte_vhost/vhost_user/virtio-net-user.c
> +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
> @@ -147,6 +147,10 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct 
> VhostUserMsg *pmsg)
>   /* This is ugly */
>   mapped_size = memory.regions[idx].memory_size +
>   memory.regions[idx].mmap_offset;
> +
> + alignment = get_blk_size(pmsg->fds[idx]);
> + mapped_size = RTE_ALIGN_CEIL(mapped_size, alignment);
> +
>   mapped_address = (uint64_t)(uintptr_t)mmap(NULL,
>   mapped_size,
>   PROT_READ | PROT_WRITE, MAP_SHARED,
> @@ -154,9 +158,11 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct 
> VhostUserMsg *pmsg)
>   0);
>  
>   RTE_LOG(INFO, VHOST_CONFIG,
> - "mapped region %d fd:%d to %p sz:0x%"PRIx64" 
> off:0x%"PRIx64"\n",
> + "mapped region %d fd:%d to:%p sz:0x%"PRIx64" "
> + "off:0x%"PRIx64" align:0x%"PRIx64"\n",
>   idx, pmsg->fds[idx], (void *)(uintptr_t)mapped_address,
> - mapped_size, memory.regions[idx].mmap_offset);
> + mapped_size, memory.regions[idx].mmap_offset,
> + alignment);
>  
>   if (mapped_address == (uint64_t)(uintptr_t)MAP_FAILED) {
>   RTE_LOG(ERR, VHOST_CONFIG,
> @@ -166,7 +172,7 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct 
> VhostUserMsg *pmsg)
>  
>   pregion_orig[idx].mapped_address = mapped_address;
>   pregion_orig[idx].mapped_size = mapped_size;
> - pregion_orig[idx].blksz = get_blk_size(pmsg->fds[idx]);
> + pregion_orig[idx].blksz = alignment;
>   pregion_orig[idx].fd = pmsg->fds[idx];
>  
>   mapped_address +=  memory.regions[idx].mmap_offset;
> -- 
> 2.1.4
>