[dpdk-dev] [PATCH v9] drivers/net:new PMD using tun/tap host interface

2016-10-13 Thread Keith Wiles
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
on the local host. The PMD allows for DPDK and the host to
communicate using a raw device interface on the host and in
the DPDK application. The device created is a Tap device with
a L2 packet header.

v9 - Fix up the docs to use correct syntax
v8 - Fix issue with tap_tx_queue_setup() not return zero on success.
v7 - Reword the comment in common_base and fix the data->name issue
v6 - fixed the checkpatch issues
v5 - merge in changes from list review see related emails
 fixed many minor edits
v4 - merge with latest driver changes
v3 - fix includes by removing ifdef for other type besides Linux
 Fix the copyright notice in the Makefile
v2 - merge all of the patches into one patch
 Fix a typo on naming the tap device
 Update the maintainers list

Signed-off-by: Keith Wiles 
---
 MAINTAINERS |   5 +
 config/common_base  |   9 +
 config/common_linuxapp  |   1 +
 doc/guides/nics/index.rst   |   1 +
 doc/guides/nics/tap.rst | 136 ++
 drivers/net/Makefile|   1 +
 drivers/net/tap/Makefile|  57 +++
 drivers/net/tap/rte_eth_tap.c   | 756 
 drivers/net/tap/rte_pmd_tap_version.map |   4 +
 mk/rte.app.mk   |   1 +
 10 files changed, 971 insertions(+)
 create mode 100644 doc/guides/nics/tap.rst
 create mode 100644 drivers/net/tap/Makefile
 create mode 100644 drivers/net/tap/rte_eth_tap.c
 create mode 100644 drivers/net/tap/rte_pmd_tap_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 8f5fa82..433d402 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -394,6 +394,11 @@ F: doc/guides/nics/pcap_ring.rst
 F: app/test/test_pmd_ring.c
 F: app/test/test_pmd_ring_perf.c

+Tap PMD
+M: Keith Wiles 
+F: drivers/net/tap
+F: doc/guides/nics/tap.rst
+
 Null Networking PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/
diff --git a/config/common_base b/config/common_base
index f5d2eff..47ef843 100644
--- a/config/common_base
+++ b/config/common_base
@@ -592,3 +592,12 @@ CONFIG_RTE_APP_TEST_RESOURCE_TAR=n
 CONFIG_RTE_TEST_PMD=y
 CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
 CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
+
+#
+# Compile the TAP PMD
+#
+# The TAP PMD is currently only built for Linux and the
+# option is enabled by default in common_linuxapp file,
+# set to 'n' in the common_base file.
+#
+CONFIG_RTE_LIBRTE_PMD_TAP=n
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2483dfa..782b503 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -44,3 +44,4 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
+CONFIG_RTE_LIBRTE_PMD_TAP=y
diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 92d56a5..f676a52 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -56,6 +56,7 @@ Network Interface Controller Drivers
 vhost
 vmxnet3
 pcap_ring
+tap

 **Figures**

diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
new file mode 100644
index 000..622b9e7
--- /dev/null
+++ b/doc/guides/nics/tap.rst
@@ -0,0 +1,136 @@
+..  BSD LICENSE
+Copyright(c) 2016 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.
+
+Tun/Tap Poll Mode Driver
+
+
+The ``rte_et

[dpdk-dev] [PATCH v8] drivers/net:new PMD using tun/tap host interface

2016-10-13 Thread Keith Wiles
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
on the local host. The PMD allows for DPDK and the host to
communicate using a raw device interface on the host and in
the DPDK application. The device created is a Tap device with
a L2 packet header.

v8 - Fix issue with tap_tx_queue_setup() not return zero on success.
v7 - Reword the comment in common_base and fix the data->name issue
v6 - fixed the checkpatch issues
v5 - merge in changes from list review see related emails
 fixed many minor edits
v4 - merge with latest driver changes
v3 - fix includes by removing ifdef for other type besides Linux
 Fix the copyright notice in the Makefile
v2 - merge all of the patches into one patch
 Fix a typo on naming the tap device
 Update the maintainers list

Signed-off-by: Keith Wiles 
---
 MAINTAINERS |   5 +
 config/common_base  |   9 +
 config/common_linuxapp  |   1 +
 doc/guides/nics/tap.rst | 138 ++
 drivers/net/Makefile|   1 +
 drivers/net/tap/Makefile|  57 +++
 drivers/net/tap/rte_eth_tap.c   | 756 
 drivers/net/tap/rte_pmd_tap_version.map |   4 +
 mk/rte.app.mk   |   1 +
 9 files changed, 972 insertions(+)
 create mode 100644 doc/guides/nics/tap.rst
 create mode 100644 drivers/net/tap/Makefile
 create mode 100644 drivers/net/tap/rte_eth_tap.c
 create mode 100644 drivers/net/tap/rte_pmd_tap_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index cd8d167..f905709 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -394,6 +394,11 @@ F: doc/guides/nics/pcap_ring.rst
 F: app/test/test_pmd_ring.c
 F: app/test/test_pmd_ring_perf.c

+Tap PMD
+M: Keith Wiles 
+F: drivers/net/tap
+F: doc/guides/nics/tap.rst
+
 Null Networking PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/
diff --git a/config/common_base b/config/common_base
index f5d2eff..47ef843 100644
--- a/config/common_base
+++ b/config/common_base
@@ -592,3 +592,12 @@ CONFIG_RTE_APP_TEST_RESOURCE_TAR=n
 CONFIG_RTE_TEST_PMD=y
 CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
 CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
+
+#
+# Compile the TAP PMD
+#
+# The TAP PMD is currently only built for Linux and the
+# option is enabled by default in common_linuxapp file,
+# set to 'n' in the common_base file.
+#
+CONFIG_RTE_LIBRTE_PMD_TAP=n
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2483dfa..782b503 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -44,3 +44,4 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
+CONFIG_RTE_LIBRTE_PMD_TAP=y
diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
new file mode 100644
index 000..bffc649
--- /dev/null
+++ b/doc/guides/nics/tap.rst
@@ -0,0 +1,138 @@
+..  BSD LICENSE
+Copyright(c) 2016 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.
+
+Tun/Tap Poll Mode Driver
+
+
+The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local
+host. The PMD allows for DPDK and the host to communicate using a raw device
+interface on the host and in the DPDK application.
+
+The device created is a TAP device, which sends/receives packet in a raw format
+with a L2 header. The usage for a TAP PMD is for connectivity to the local host

[dpdk-dev] [PATCH v7] drivers/net:new PMD using tun/tap host interface

2016-10-13 Thread Keith Wiles
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
on the local host. The PMD allows for DPDK and the host to
communicate using a raw device interface on the host and in
the DPDK application. The device created is a Tap device with
a L2 packet header.

v7 - Reword the comment in common_base and fix the data->name issue
v6 - fixed the checkpatch issues
v5 - merge in changes from list review see related emails
 fixed many minor edits
v4 - merge with latest driver changes
v3 - fix includes by removing ifdef for other type besides Linux
 Fix the copyright notice in the Makefile
v2 - merge all of the patches into one patch
 Fix a typo on naming the tap device
 Update the maintainers list

Signed-off-by: Keith Wiles 
---
 MAINTAINERS |   5 +
 config/common_base  |   9 +
 config/common_linuxapp  |   1 +
 doc/guides/nics/tap.rst | 138 ++
 drivers/net/Makefile|   1 +
 drivers/net/tap/Makefile|  57 +++
 drivers/net/tap/rte_eth_tap.c   | 754 
 drivers/net/tap/rte_pmd_tap_version.map |   4 +
 mk/rte.app.mk   |   1 +
 9 files changed, 970 insertions(+)
 create mode 100644 doc/guides/nics/tap.rst
 create mode 100644 drivers/net/tap/Makefile
 create mode 100644 drivers/net/tap/rte_eth_tap.c
 create mode 100644 drivers/net/tap/rte_pmd_tap_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index cd8d167..f905709 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -394,6 +394,11 @@ F: doc/guides/nics/pcap_ring.rst
 F: app/test/test_pmd_ring.c
 F: app/test/test_pmd_ring_perf.c

+Tap PMD
+M: Keith Wiles 
+F: drivers/net/tap
+F: doc/guides/nics/tap.rst
+
 Null Networking PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/
diff --git a/config/common_base b/config/common_base
index f5d2eff..47ef843 100644
--- a/config/common_base
+++ b/config/common_base
@@ -592,3 +592,12 @@ CONFIG_RTE_APP_TEST_RESOURCE_TAR=n
 CONFIG_RTE_TEST_PMD=y
 CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
 CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
+
+#
+# Compile the TAP PMD
+#
+# The TAP PMD is currently only built for Linux and the
+# option is enabled by default in common_linuxapp file,
+# set to 'n' in the common_base file.
+#
+CONFIG_RTE_LIBRTE_PMD_TAP=n
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2483dfa..782b503 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -44,3 +44,4 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
+CONFIG_RTE_LIBRTE_PMD_TAP=y
diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
new file mode 100644
index 000..bffc649
--- /dev/null
+++ b/doc/guides/nics/tap.rst
@@ -0,0 +1,138 @@
+..  BSD LICENSE
+Copyright(c) 2016 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.
+
+Tun/Tap Poll Mode Driver
+
+
+The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local
+host. The PMD allows for DPDK and the host to communicate using a raw device
+interface on the host and in the DPDK application.
+
+The device created is a TAP device, which sends/receives packet in a raw format
+with a L2 header. The usage for a TAP PMD is for connectivity to the local host
+using a TAP interface. When the TAP PMD is initialized it will cr

[dpdk-dev] [PATCH v6] drivers/net:new PMD using tun/tap host interface

2016-10-12 Thread Keith Wiles
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
on the local host. The PMD allows for DPDK and the host to
communicate using a raw device interface on the host and in
the DPDK application. The device created is a Tap device with
a L2 packet header.

v6 - fixed the checkpatch issues
v5 - merge in changes from list review see related emails
 fixed many minor edits
v4 - merge with latest driver changes
v3 - fix includes by removing ifdef for other type besides Linux
 Fix the copyright notice in the Makefile
v2 - merge all of the patches into one patch
 Fix a typo on naming the tap device
 Update the maintainers list

Signed-off-by: Keith Wiles 
---
 MAINTAINERS |   5 +
 config/common_base  |   5 +
 config/common_linuxapp  |   1 +
 doc/guides/nics/tap.rst | 138 ++
 drivers/net/Makefile|   1 +
 drivers/net/tap/Makefile|  57 +++
 drivers/net/tap/rte_eth_tap.c   | 759 
 drivers/net/tap/rte_pmd_tap_version.map |   4 +
 mk/rte.app.mk   |   1 +
 9 files changed, 971 insertions(+)
 create mode 100644 doc/guides/nics/tap.rst
 create mode 100644 drivers/net/tap/Makefile
 create mode 100644 drivers/net/tap/rte_eth_tap.c
 create mode 100644 drivers/net/tap/rte_pmd_tap_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index cd8d167..f905709 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -394,6 +394,11 @@ F: doc/guides/nics/pcap_ring.rst
 F: app/test/test_pmd_ring.c
 F: app/test/test_pmd_ring_perf.c

+Tap PMD
+M: Keith Wiles 
+F: drivers/net/tap
+F: doc/guides/nics/tap.rst
+
 Null Networking PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/
diff --git a/config/common_base b/config/common_base
index f5d2eff..356c631 100644
--- a/config/common_base
+++ b/config/common_base
@@ -592,3 +592,8 @@ CONFIG_RTE_APP_TEST_RESOURCE_TAR=n
 CONFIG_RTE_TEST_PMD=y
 CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
 CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
+
+#
+# Set TAP PMD to 'n' as it is only supported in Linux for now.
+#
+CONFIG_RTE_LIBRTE_PMD_TAP=n
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2483dfa..782b503 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -44,3 +44,4 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
+CONFIG_RTE_LIBRTE_PMD_TAP=y
diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
new file mode 100644
index 000..eed81ec
--- /dev/null
+++ b/doc/guides/nics/tap.rst
@@ -0,0 +1,138 @@
+..  BSD LICENSE
+Copyright(c) 2016 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.
+
+Tun/Tap Poll Mode Driver
+
+
+The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local
+host. The PMD allows for DPDK and the host to communicate using a raw device
+interface on the host and in the DPDK application.
+
+The device created is a TAP device, which sends/receives packet in a raw format
+with a L2 header. The usage for a TAP PMD is for connectivity to the local host
+using a TAP interface. When the TAP PMD is initialized it will create a number
+of tap devices in the host accessed via 'ifconfig -a' or 'ip' command. The
+commands can be used to assign and query the virtual like device.
+
+These TAP interfaces c

[dpdk-dev] [PATCH v5] drivers/net:new PMD using tun/tap host interface

2016-10-11 Thread Keith Wiles
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
on the local host. The PMD allows for DPDK and the host to
communicate using a raw device interface on the host and in
the DPDK application. The device created is a Tap device with
a L2 packet header.

v5 - merge in changes from list review see related emails.
 fixed checkpatch issues and many minor edits
v4 - merge with latest driver changes
v3 - fix includes by removing ifdef for other type besides Linux.
 Fix the copyright notice in the Makefile
v2 - merge all of the patches into one patch.
 Fix a typo on naming the tap device.
 Update the maintainers list

Signed-off-by: Keith Wiles 
---
 MAINTAINERS |   5 +
 config/common_base  |   5 +
 config/common_linuxapp  |   1 +
 doc/guides/nics/tap.rst | 138 ++
 drivers/net/Makefile|   1 +
 drivers/net/tap/Makefile|  57 +++
 drivers/net/tap/rte_eth_tap.c   | 767 
 drivers/net/tap/rte_pmd_tap_version.map |   4 +
 mk/rte.app.mk   |   1 +
 9 files changed, 979 insertions(+)
 create mode 100644 doc/guides/nics/tap.rst
 create mode 100644 drivers/net/tap/Makefile
 create mode 100644 drivers/net/tap/rte_eth_tap.c
 create mode 100644 drivers/net/tap/rte_pmd_tap_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index cd8d167..f905709 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -394,6 +394,11 @@ F: doc/guides/nics/pcap_ring.rst
 F: app/test/test_pmd_ring.c
 F: app/test/test_pmd_ring_perf.c

+Tap PMD
+M: Keith Wiles 
+F: drivers/net/tap
+F: doc/guides/nics/tap.rst
+
 Null Networking PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/
diff --git a/config/common_base b/config/common_base
index f5d2eff..356c631 100644
--- a/config/common_base
+++ b/config/common_base
@@ -592,3 +592,8 @@ CONFIG_RTE_APP_TEST_RESOURCE_TAR=n
 CONFIG_RTE_TEST_PMD=y
 CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
 CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
+
+#
+# Set TAP PMD to 'n' as it is only supported in Linux for now.
+#
+CONFIG_RTE_LIBRTE_PMD_TAP=n
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2483dfa..782b503 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -44,3 +44,4 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
+CONFIG_RTE_LIBRTE_PMD_TAP=y
diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
new file mode 100644
index 000..eed81ec
--- /dev/null
+++ b/doc/guides/nics/tap.rst
@@ -0,0 +1,138 @@
+..  BSD LICENSE
+Copyright(c) 2016 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.
+
+Tun/Tap Poll Mode Driver
+
+
+The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local
+host. The PMD allows for DPDK and the host to communicate using a raw device
+interface on the host and in the DPDK application.
+
+The device created is a TAP device, which sends/receives packet in a raw format
+with a L2 header. The usage for a TAP PMD is for connectivity to the local host
+using a TAP interface. When the TAP PMD is initialized it will create a number
+of tap devices in the host accessed via 'ifconfig -a' or 'ip' command. The
+commands can be used to assign and query the virtual like device.
+
+These TAP interfaces can be used with

[dpdk-dev] [PATCH v4] drivers/net:new PMD using tun/tap host interface

2016-10-04 Thread Keith Wiles
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
on the local host. The PMD allows for DPDK and the host to
communicate using a raw device interface on the host and in
the DPDK application. The device created is a Tap device with
a L2 packet header.

v4 - merge with latest driver changes
v3 - fix includes by removing ifdef for other type besides Linux.
 Fix the copyright notice in the Makefile
v2 - merge all of the patches into one patch.
 Fix a typo on naming the tap device.
 Update the maintainers list

Signed-off-by: Keith Wiles 
---
 MAINTAINERS |   5 +
 config/common_linuxapp  |   2 +
 doc/guides/nics/tap.rst |  84 
 drivers/net/Makefile|   1 +
 drivers/net/tap/Makefile|  57 +++
 drivers/net/tap/rte_eth_tap.c   | 866 
 drivers/net/tap/rte_pmd_tap_version.map |   4 +
 mk/rte.app.mk   |   1 +
 8 files changed, 1020 insertions(+)
 create mode 100644 doc/guides/nics/tap.rst
 create mode 100644 drivers/net/tap/Makefile
 create mode 100644 drivers/net/tap/rte_eth_tap.c
 create mode 100644 drivers/net/tap/rte_pmd_tap_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 7c33ad4..fad74e4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -392,6 +392,11 @@ F: doc/guides/nics/pcap_ring.rst
 F: app/test/test_pmd_ring.c
 F: app/test/test_pmd_ring_perf.c

+Tap PMD
+M: Keith Wiles 
+F: drivers/net/tap
+F: doc/guides/nics/tap.rst
+
 Null Networking PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2483dfa..59a2053 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -44,3 +44,5 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
+CONFIG_RTE_LIBRTE_PMD_TAP=y
+CONFIG_RTE_PMD_TAP_MAX_QUEUES=32
diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
new file mode 100644
index 000..072def8
--- /dev/null
+++ b/doc/guides/nics/tap.rst
@@ -0,0 +1,84 @@
+..  BSD LICENSE
+Copyright(c) 2016 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.
+
+Tun/Tap Poll Mode Driver
+
+
+The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local
+host. The PMD allows for DPDK and the host to communicate using a raw device
+interface on the host and in the DPDK application.
+
+The device created is a TAP device, which sends/receives packet in a raw format
+with a L2 header. The usage for a TAP PMD is for connectivity to the local host
+using a TAP interface. When the TAP PMD is initialized it will create a number
+of tap devices in the host accessed via 'ifconfig -a' or 'ip' command. The
+commands can be used to assign and query the virtual like device.
+
+These TAP interfaces can be used with wireshark or tcpdump or Pktgen-DPDK along
+with being able to be used as a network connection to the DPDK application. The
+method enable one or more interfaces is to use the --vdev=eth_tap option on the
+DPDK application  command line. Each --vdev=eth_tap option give will create an
+interface named dtap0, dtap1, ... and so forth.
+
+.. code-block:: console
+
+   The interfaced name can be changed by adding the iface=foo0
+   e.g. --vedv=eth_tap,iface=foo0 --vdev=eth_tap,iface=foo1, ...
+
+.. code-block:: console

[dpdk-dev] [PATCH v2] drivers/net:new PMD using tun/tap host interface

2016-09-16 Thread Keith Wiles
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
on the local host. The PMD allows for DPDK and the host to
communicate using a raw device interface on the host and in
the DPDK application. The device created is a Tap device with
a L2 packet header.

v2 - merge all of the patches into one patch.
 Fix a typo on naming the tap device.
 Update the maintainers list

Signed-off-by: Keith Wiles 
---
 MAINTAINERS |   5 +
 config/common_linuxapp  |   2 +
 doc/guides/nics/tap.rst |  84 +++
 drivers/net/Makefile|   1 +
 drivers/net/tap/Makefile|  60 +++
 drivers/net/tap/rte_eth_tap.c   | 872 
 drivers/net/tap/rte_pmd_tap_version.map |   4 +
 mk/rte.app.mk   |   1 +
 8 files changed, 1029 insertions(+)
 create mode 100644 doc/guides/nics/tap.rst
 create mode 100644 drivers/net/tap/Makefile
 create mode 100644 drivers/net/tap/rte_eth_tap.c
 create mode 100644 drivers/net/tap/rte_pmd_tap_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 7c33ad4..fad74e4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -392,6 +392,11 @@ F: doc/guides/nics/pcap_ring.rst
 F: app/test/test_pmd_ring.c
 F: app/test/test_pmd_ring_perf.c

+Tap PMD
+M: Keith Wiles 
+F: drivers/net/tap
+F: doc/guides/nics/tap.rst
+
 Null Networking PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2483dfa..59a2053 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -44,3 +44,5 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
+CONFIG_RTE_LIBRTE_PMD_TAP=y
+CONFIG_RTE_PMD_TAP_MAX_QUEUES=32
diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
new file mode 100644
index 000..072def8
--- /dev/null
+++ b/doc/guides/nics/tap.rst
@@ -0,0 +1,84 @@
+..  BSD LICENSE
+Copyright(c) 2016 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.
+
+Tun/Tap Poll Mode Driver
+
+
+The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local
+host. The PMD allows for DPDK and the host to communicate using a raw device
+interface on the host and in the DPDK application.
+
+The device created is a TAP device, which sends/receives packet in a raw format
+with a L2 header. The usage for a TAP PMD is for connectivity to the local host
+using a TAP interface. When the TAP PMD is initialized it will create a number
+of tap devices in the host accessed via 'ifconfig -a' or 'ip' command. The
+commands can be used to assign and query the virtual like device.
+
+These TAP interfaces can be used with wireshark or tcpdump or Pktgen-DPDK along
+with being able to be used as a network connection to the DPDK application. The
+method enable one or more interfaces is to use the --vdev=eth_tap option on the
+DPDK application  command line. Each --vdev=eth_tap option give will create an
+interface named dtap0, dtap1, ... and so forth.
+
+.. code-block:: console
+
+   The interfaced name can be changed by adding the iface=foo0
+   e.g. --vedv=eth_tap,iface=foo0 --vdev=eth_tap,iface=foo1, ...
+
+.. code-block:: console
+
+   Also the speed of the interface can be changed from 10G to whatever number
+   needed, but the interface does not enforce that speed.
+   e.g. --vd

[dpdk-dev] [PATCH 3/3] drivers/net:build support for new tap device driver

2016-09-15 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 config/common_linuxapp | 3 +++
 drivers/net/Makefile   | 1 +
 mk/rte.app.mk  | 1 +
 3 files changed, 5 insertions(+)

diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2483dfa..704c01c 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -44,3 +44,6 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
+CONFIG_RTE_LIBRTE_PMD_TAP=y
+CONFIG_RTE_PMD_TAP_MAX_QUEUES=32
+
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index bc93230..b4afa98 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -55,6 +55,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += tap

 ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 1a0095b..bd1d10f 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -129,6 +129,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST)  += -lrte_pmd_vhost
 endif # $(CONFIG_RTE_LIBRTE_VHOST)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)+= -lrte_pmd_vmxnet3_uio
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_TAP)+= -lrte_pmd_tap

 ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)   += -lrte_pmd_aesni_mb
-- 
2.8.0.GIT



[dpdk-dev] [PATCH 2/3] docs:tun/tap PMD information

2016-09-15 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/guides/nics/tap.rst | 84 +
 1 file changed, 84 insertions(+)
 create mode 100644 doc/guides/nics/tap.rst

diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
new file mode 100644
index 000..072def8
--- /dev/null
+++ b/doc/guides/nics/tap.rst
@@ -0,0 +1,84 @@
+..  BSD LICENSE
+Copyright(c) 2016 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.
+
+Tun/Tap Poll Mode Driver
+
+
+The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local
+host. The PMD allows for DPDK and the host to communicate using a raw device
+interface on the host and in the DPDK application.
+
+The device created is a TAP device, which sends/receives packet in a raw format
+with a L2 header. The usage for a TAP PMD is for connectivity to the local host
+using a TAP interface. When the TAP PMD is initialized it will create a number
+of tap devices in the host accessed via 'ifconfig -a' or 'ip' command. The
+commands can be used to assign and query the virtual like device.
+
+These TAP interfaces can be used with wireshark or tcpdump or Pktgen-DPDK along
+with being able to be used as a network connection to the DPDK application. The
+method enable one or more interfaces is to use the --vdev=eth_tap option on the
+DPDK application  command line. Each --vdev=eth_tap option give will create an
+interface named dtap0, dtap1, ... and so forth.
+
+.. code-block:: console
+
+   The interfaced name can be changed by adding the iface=foo0
+   e.g. --vedv=eth_tap,iface=foo0 --vdev=eth_tap,iface=foo1, ...
+
+.. code-block:: console
+
+   Also the speed of the interface can be changed from 10G to whatever number
+   needed, but the interface does not enforce that speed.
+   e.g. --vdev=eth_tap,iface=foo0,speed=25000
+
+After the DPDK application is started you can send and receive packets on the
+interface using the standard rx_burst/tx_burst APIs in DPDK. From the host 
point
+of view you can use any host tool like tcpdump, wireshark, ping, Pktgen and
+others to communicate with the DPDK application. The DPDK application may not
+understand network protocols like IPv4/6, UDP or TCP unless the application has
+been written to understand these protocols.
+
+If you need the interface as a real network interface meaning running and has
+a valid IP address then you can do this with the following commands:
+
+.. code-block:: console
+
+   sudo ip link set dtap0 up; sudo ip addr add 192.168.0.250/24 dev dtap0
+   sudo ip link set dtap1 up; sudo ip addr add 192.168.1.250/24 dev dtap1
+
+Please change the IP addresses as you see fit.
+
+If routing is enabled on the host you can also communicate with the DPDK App
+over the internet via a standard socket layer application as long as you 
account
+for the protocol handing in the application.
+
+If you have a Network Stack in your DPDK application or something like it you
+can utilize that stack to handle the network protocols. Plus you would be able
+to address the interface using an IP address assigned to the internal 
interface.
-- 
2.8.0.GIT



[dpdk-dev] [PATCH 1/3] drivers/net:new PMD using tun/tap host interface

2016-09-15 Thread Keith Wiles
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
on the local host. The PMD allows for DPDK and the host to
communicate using a raw device interface on the host and in
the DPDK application. The device created is a Tap device with
a L2 packet header.

Signed-off-by: Keith Wiles 
---
 drivers/net/tap/Makefile|  60 +++
 drivers/net/tap/rte_eth_tap.c   | 872 
 drivers/net/tap/rte_pmd_tap_version.map |   4 +
 3 files changed, 936 insertions(+)
 create mode 100644 drivers/net/tap/Makefile
 create mode 100644 drivers/net/tap/rte_eth_tap.c
 create mode 100644 drivers/net/tap/rte_pmd_tap_version.map

diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
new file mode 100644
index 000..442a2fe
--- /dev/null
+++ b/drivers/net/tap/Makefile
@@ -0,0 +1,60 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014 John W. Linville 
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014 6WIND S.A.
+#   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 $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_tap.a
+
+EXPORT_MAP := rte_pmd_tap_version.map
+
+LIBABIVER := 1
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += rte_eth_tap.c
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mempool
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_kvargs
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
new file mode 100644
index 000..027bb35
--- /dev/null
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -0,0 +1,872 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2016 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, STRIC

[dpdk-dev] [PATCH] spinlock:move constructor function out of header

2016-07-14 Thread Keith Wiles
Moving the rte_rtm_init() constructor routine out of the
header file and into a new rte_spinlock.c for all archs/platforms.
Having constructor routines in a header file is not a good
place to keep these types of functions.

The problem is with linking 3rd party libraries when
an application is not linked directly to dpdk libraries, which
in this case causes a missing symbol in the linking phase.

Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")

Originally submitted by Damjan Marion 

Signed-off-by: Keith Wiles 
---
 lib/librte_eal/bsdapp/eal/Makefile |  1 +
 lib/librte_eal/common/arch/arm/rte_spinlock.c  | 46 ++
 lib/librte_eal/common/arch/ppc_64/rte_spinlock.c   | 46 ++
 lib/librte_eal/common/arch/tile/rte_spinlock.c | 46 ++
 lib/librte_eal/common/arch/x86/rte_spinlock.c  | 46 ++
 .../common/include/arch/x86/rte_spinlock.h | 14 ++-
 lib/librte_eal/linuxapp/eal/Makefile   |  1 +
 7 files changed, 190 insertions(+), 10 deletions(-)
 create mode 100644 lib/librte_eal/common/arch/arm/rte_spinlock.c
 create mode 100644 lib/librte_eal/common/arch/ppc_64/rte_spinlock.c
 create mode 100644 lib/librte_eal/common/arch/tile/rte_spinlock.c
 create mode 100644 lib/librte_eal/common/arch/x86/rte_spinlock.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 698fa0a..cd93f5b 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -89,6 +89,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_keepalive.c

 # from arch dir
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_cpuflags.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_spinlock.c

 CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST)

diff --git a/lib/librte_eal/common/arch/arm/rte_spinlock.c 
b/lib/librte_eal/common/arch/arm/rte_spinlock.c
new file mode 100644
index 000..bc924e5
--- /dev/null
+++ b/lib/librte_eal/common/arch/arm/rte_spinlock.c
@@ -0,0 +1,46 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2016 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 "rte_cpuflags.h"
+
+/**< cache the flag to avoid the overhead of the function call */
+int rte_rtm_supported;
+
+static void __attribute__((constructor))
+rte_rtm_init(void)
+{
+   rte_rtm_supported = rte_cpu_get_flag_enabled(RTE_CPUFLAG_RTM);
+}
+
diff --git a/lib/librte_eal/common/arch/ppc_64/rte_spinlock.c 
b/lib/librte_eal/common/arch/ppc_64/rte_spinlock.c
new file mode 100644
index 000..bc924e5
--- /dev/null
+++ b/lib/librte_eal/common/arch/ppc_64/rte_spinlock.c
@@ -0,0 +1,46 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2016 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.
+ 

[dpdk-dev] [PATCH v2 2/2] fix building with clang-3.8.0 compiler

2016-06-26 Thread Keith Wiles
Latest clang compiler 3.8.0 on latest update of Ubuntu
creates a few more warnings on -Warray-bounds and extra
() around 'if' expressions.

Signed-off-by: Keith Wiles 
---
 app/test-pmd/Makefile| 3 +++
 app/test/Makefile| 3 +++
 drivers/net/bonding/Makefile | 4 
 drivers/net/fm10k/Makefile   | 2 ++
 drivers/net/i40e/Makefile| 2 ++
 lib/librte_cmdline/Makefile  | 6 ++
 lib/librte_eal/linuxapp/eal/Makefile | 8 
 7 files changed, 28 insertions(+)

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 2a0b5a5..14ab77c 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -59,6 +59,9 @@ SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c

 CFLAGS_cmdline.o := -D_GNU_SOURCE
+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_cmdline.o += -Wno-array-bounds
+endif

 # this application needs libraries first
 DEPDIRS-y += lib drivers
diff --git a/app/test/Makefile b/app/test/Makefile
index 2de8c7a..5593426 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -211,6 +211,9 @@ ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
 CFLAGS_test_memcpy.o += -fno-var-tracking-assignments
 CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
 endif
+else ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_test_errno.o += -Wno-array-bounds
+CFLAGS_test_devargs.o += -Wno-array-bounds
 endif

 # this application needs libraries first
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 504f2e8..ee5f44a 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -43,6 +43,10 @@ EXPORT_MAP := rte_eth_bond_version.map

 LIBABIVER := 1

+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_rte_eth_bond_args.o := -Wno-array-bounds
+endif
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index afcbd1d..d6c692d 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -59,6 +59,8 @@ CFLAGS_BASE_DRIVER += -Wno-strict-aliasing 
-Wno-format-extra-args
 CFLAGS_BASE_DRIVER += -Wno-unused-variable
 CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers

+CFLAGS_fm10k_ethdev.o := -Wno-array-bounds
+
 else
 #
 # CFLAGS for gcc
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 9ffef3f..3a9e5a1 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -60,6 +60,8 @@ CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
 CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast
 CFLAGS_BASE_DRIVER += -Wno-format-nonliteral
 CFLAGS_BASE_DRIVER += -Wno-unused-variable
+
+CFLAGS_i40e_hmc.o += -Wno-tautological-compare
 else
 CFLAGS_BASE_DRIVER  = -Wno-sign-compare
 CFLAGS_BASE_DRIVER += -Wno-unused-value
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 7d2d148..0af1d0a 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -40,6 +40,12 @@ EXPORT_MAP := rte_cmdline_version.map

 LIBABIVER := 2

+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_cmdline_cirbuf.o:= -Wno-parentheses-equality
+CFLAGS_cmdline_rdline.o:= -Wno-parentheses-equality
+CFLAGS_cmdline_parse_string.o:= -Wno-array-bounds
+endif
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := cmdline.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_cirbuf.c
diff --git a/lib/librte_eal/linuxapp/eal/Makefile 
b/lib/librte_eal/linuxapp/eal/Makefile
index 30b30f3..c771a85 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -125,6 +125,14 @@ CFLAGS_eal_common_options.o := -D_GNU_SOURCE
 CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
 CFLAGS_eal_common_lcore.o := -D_GNU_SOURCE

+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_eal_alarm.o += -Wno-parentheses-equality
+CFLAGS_eal_interrupts.o += -Wno-parentheses-equality
+CFLAGS_eal_common_options.o += -Wno-array-bounds
+CFLAGS_eal_pci.o += -Wno-parentheses-equality
+CFLAGS_eal_pci.o += -Wno-array-bounds
+endif
+
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-- 
2.8.0.GIT



[dpdk-dev] [PATCH v2 1/2] e1000:fix gcc test for clang builds

2016-06-26 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 drivers/net/e1000/Makefile | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index 5b801f5..1305163 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -48,7 +48,7 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
 # CFLAGS for icc
 #
 CFLAGS_BASE_DRIVER = -wd177 -wd181 -wd188 -wd869 -wd2259
-else
+else ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
 #
 # CFLAGS for gcc
 #
@@ -57,6 +57,9 @@ CFLAGS_BASE_DRIVER += -Wno-unused-variable
 ifeq ($(shell test $(GCC_VERSION) -ge 60 && echo 1), 1)
 CFLAGS_BASE_DRIVER += -Wno-misleading-indentation
 endif
+else
+CFLAGS_BASE_DRIVER = -Wno-uninitialized -Wno-unused-parameter
+CFLAGS_BASE_DRIVER += -Wno-unused-variable
 endif

 #
-- 
2.8.0.GIT



[dpdk-dev] [PATCH 2/2] fix building with clang-3.8.0 compiler

2016-06-26 Thread Keith Wiles
Latest clang compiler 3.8.0 on latest update of Ubuntu
creates a few more warnings on -Warray-bounds and extra
() around 'if' expressions.

Signed-off-by: Keith Wiles 
---
 app/test-pmd/Makefile| 3 +++
 app/test/Makefile| 3 +++
 drivers/net/bonding/Makefile | 4 
 drivers/net/fm10k/Makefile   | 2 ++
 drivers/net/i40e/Makefile| 2 ++
 lib/librte_cmdline/Makefile  | 6 ++
 lib/librte_eal/linuxapp/eal/Makefile | 7 +++
 7 files changed, 27 insertions(+)

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 2a0b5a5..14ab77c 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -59,6 +59,9 @@ SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c

 CFLAGS_cmdline.o := -D_GNU_SOURCE
+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_cmdline.o += -Wno-array-bounds
+endif

 # this application needs libraries first
 DEPDIRS-y += lib drivers
diff --git a/app/test/Makefile b/app/test/Makefile
index 2de8c7a..5593426 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -211,6 +211,9 @@ ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
 CFLAGS_test_memcpy.o += -fno-var-tracking-assignments
 CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
 endif
+else ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_test_errno.o += -Wno-array-bounds
+CFLAGS_test_devargs.o += -Wno-array-bounds
 endif

 # this application needs libraries first
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 504f2e8..ee5f44a 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -43,6 +43,10 @@ EXPORT_MAP := rte_eth_bond_version.map

 LIBABIVER := 1

+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_rte_eth_bond_args.o := -Wno-array-bounds
+endif
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index afcbd1d..d6c692d 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -59,6 +59,8 @@ CFLAGS_BASE_DRIVER += -Wno-strict-aliasing 
-Wno-format-extra-args
 CFLAGS_BASE_DRIVER += -Wno-unused-variable
 CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers

+CFLAGS_fm10k_ethdev.o := -Wno-array-bounds
+
 else
 #
 # CFLAGS for gcc
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 9ffef3f..3a9e5a1 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -60,6 +60,8 @@ CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
 CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast
 CFLAGS_BASE_DRIVER += -Wno-format-nonliteral
 CFLAGS_BASE_DRIVER += -Wno-unused-variable
+
+CFLAGS_i40e_hmc.o += -Wno-tautological-compare
 else
 CFLAGS_BASE_DRIVER  = -Wno-sign-compare
 CFLAGS_BASE_DRIVER += -Wno-unused-value
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 7d2d148..0af1d0a 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -40,6 +40,12 @@ EXPORT_MAP := rte_cmdline_version.map

 LIBABIVER := 2

+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_cmdline_cirbuf.o:= -Wno-parentheses-equality
+CFLAGS_cmdline_rdline.o:= -Wno-parentheses-equality
+CFLAGS_cmdline_parse_string.o:= -Wno-array-bounds
+endif
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := cmdline.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_cirbuf.c
diff --git a/lib/librte_eal/linuxapp/eal/Makefile 
b/lib/librte_eal/linuxapp/eal/Makefile
index 30b30f3..2ff8d62 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -125,6 +125,13 @@ CFLAGS_eal_common_options.o := -D_GNU_SOURCE
 CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
 CFLAGS_eal_common_lcore.o := -D_GNU_SOURCE

+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_eal_alarm.o += -Wno-parentheses-equality
+CFLAGS_eal_common_options.o += -Wno-array-bounds
+CFLAGS_eal_pci.o += -Wno-parentheses-equality
+CFLAGS_eal_pci.o += -Wno-array-bounds
+endif
+
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-- 
2.8.0.GIT



[dpdk-dev] [PATCH 1/2] e1000:fix gcc test for clang builds

2016-06-26 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 drivers/net/e1000/Makefile | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index 5b801f5..1305163 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -48,7 +48,7 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
 # CFLAGS for icc
 #
 CFLAGS_BASE_DRIVER = -wd177 -wd181 -wd188 -wd869 -wd2259
-else
+else ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
 #
 # CFLAGS for gcc
 #
@@ -57,6 +57,9 @@ CFLAGS_BASE_DRIVER += -Wno-unused-variable
 ifeq ($(shell test $(GCC_VERSION) -ge 60 && echo 1), 1)
 CFLAGS_BASE_DRIVER += -Wno-misleading-indentation
 endif
+else
+CFLAGS_BASE_DRIVER = -Wno-uninitialized -Wno-unused-parameter
+CFLAGS_BASE_DRIVER += -Wno-unused-variable
 endif

 #
-- 
2.8.0.GIT



[dpdk-dev] [PATCH v2] mbuf:rearrange mbuf to be more mbuf chain friendly

2016-06-25 Thread Keith Wiles
Move the next pointer to the first cacheline of the rte_mbuf structure
and move the offload values to the second cacheline to give better
performance to applications using chained mbufs.

Enabled by a configuration option CONFIG_RTE_MBUF_CHAIN_FRIENDLY default
is set to No.

Signed-off-by: Keith Wiles 
---
 config/common_base |  2 +
 .../linuxapp/eal/include/exec-env/rte_kni_common.h |  8 +++
 lib/librte_mbuf/rte_mbuf.h | 67 +++---
 3 files changed, 56 insertions(+), 21 deletions(-)

diff --git a/config/common_base b/config/common_base
index 379a791..f7c624e 100644
--- a/config/common_base
+++ b/config/common_base
@@ -405,6 +405,8 @@ CONFIG_RTE_LIBRTE_MBUF_DEBUG=n
 CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="ring_mp_mc"
 CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
+# Set to y if needing to be mbuf chain friendly.
+CONFIG_RTE_MBUF_CHAIN_FRIENDLY=n

 #
 # Compile librte_timer
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h 
b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index 2acdfd9..44d65cd 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -120,11 +120,19 @@ struct rte_kni_mbuf {
char pad2[4];
uint32_t pkt_len;   /**< Total pkt len: sum of all segment 
data_len. */
uint16_t data_len;  /**< Amount of data in segment buffer. */
+#ifdef RTE_MBUF_CHAIN_FRIENDLY
+   char pad3[8];
+   void *next;

/* fields on second cache line */
+   char pad4[16] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
+   void *pool;
+#else
+   /* fields on second cache line */
char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
void *pool;
void *next;
+#endif
 };

 /*
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 15e3a10..6e6ba0e 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -765,6 +765,28 @@ typedef uint8_t  MARKER8[0];  /**< generic marker with 1B 
alignment */
 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
* with a single assignment */

+typedef union {
+   uint32_t rss; /**< RSS hash result if RSS enabled */
+   struct {
+   union {
+   struct {
+   uint16_t hash;
+   uint16_t id;
+   };
+   uint32_t lo;
+   /**< Second 4 flexible bytes */
+   };
+   uint32_t hi;
+   /**< First 4 flexible bytes or FD ID, dependent on
+   PKT_RX_FDIR_* flag in ol_flags. */
+   } fdir;   /**< Filter identifier if FDIR enabled */
+   struct {
+   uint32_t lo;
+   uint32_t hi;
+   } sched;  /**< Hierarchical scheduler */
+   uint32_t usr; /**< User defined tags. See rte_distributor_process() 
*/
+} rss_hash_t;
+
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -824,28 +846,31 @@ struct rte_mbuf {
uint16_t data_len;/**< Amount of data in segment buffer. */
/** VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. */
uint16_t vlan_tci;
+#ifdef RTE_MBUF_CHAIN_FRIENDLY
+   /*
+* Move offload into the second cache line and next in the first.
+* Better performance for applications using chained mbufs to have
+* the next pointer in the first cache line.
+* If you change this structure, you must change the user-mode
+* version in rte_kni_common.h to match the new layout.
+*/
+   uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */
+   uint16_t vlan_tci_outer;  /**< Outer VLAN Tag Control Identifier (CPU 
order) */
+   struct rte_mbuf *next;/**< Next segment of scattered packet. */
+
+   /* second cache line - fields only used in slow path or on TX */
+   MARKER cacheline1 __rte_cache_min_aligned;
+
+   rss_hash_t hash;  /**< hash information */

union {
-   uint32_t rss; /**< RSS hash result if RSS enabled */
-   struct {
-   union {
-   struct {
-   uint16_t hash;
-   uint16_t id;
-   };
-   uint32_t lo;
-   /**< Second 4 flexible bytes */
-   };
-   uint32_t hi;
-   /**< First 4 flexible bytes or FD ID, dependent on
-PKT_RX_FDIR_* flag in ol_flags. */
-   } fdir;   

[dpdk-dev] [PATCH] ixgbe:enable configuration for old ptype behavior

2016-06-25 Thread Keith Wiles
The default behavior is to NOT support the old ptype behavior,
but enabling the configuration option the old ptype style
can be supported.

Add support for old behaviour until we have a cleaner solution using
a configuration option CONFIG_RTE_IXGBE_ENABLE_OLD_PTYPE_BEHAVIOUR,
which is defaulted to not set.

Signed-off-by: Keith Wiles 
---
 config/common_base |  2 ++
 drivers/net/ixgbe/ixgbe_ethdev.c   |  6 +
 drivers/net/ixgbe/ixgbe_rxtx_vec.c | 52 +++---
 3 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/config/common_base b/config/common_base
index bdde2e7..05e69bc 100644
--- a/config/common_base
+++ b/config/common_base
@@ -160,6 +160,8 @@ CONFIG_RTE_LIBRTE_IXGBE_DEBUG_DRIVER=n
 CONFIG_RTE_LIBRTE_IXGBE_PF_DISABLE_STRIP_CRC=n
 CONFIG_RTE_IXGBE_INC_VECTOR=y
 CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=y
+# Enable to restore old ptype behavior
+CONFIG_RTE_IXGBE_ENABLE_OLD_PTYPE_BEHAVIOR=n

 #
 # Compile burst-oriented I40E PMD driver
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index e11a431..068b92b 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3076,7 +3076,13 @@ ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev)
if (dev->rx_pkt_burst == ixgbe_recv_pkts ||
dev->rx_pkt_burst == ixgbe_recv_pkts_lro_single_alloc ||
dev->rx_pkt_burst == ixgbe_recv_pkts_lro_bulk_alloc ||
+#ifdef RTE_IXGBE_ENABLE_OLD_PTYPE_BEHAVIOR
+   dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc ||
+   dev->rx_pkt_burst == ixgbe_recv_pkts_vec ||
+   dev->rx_pkt_burst == ixgbe_recv_scattered_pkts_vec)
+#else
dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc)
+#endif
return ptypes;
return NULL;
 }
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec.c 
b/drivers/net/ixgbe/ixgbe_rxtx_vec.c
index 12190d2..2e0d50b 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec.c
@@ -228,6 +228,10 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
);
__m128i dd_check, eop_check;
uint8_t vlan_flags;
+#ifdef RTE_IXGBE_ENABLE_OLD_PTYPE_BEHAVIOR
+   __m128i desc_mask = _mm_set_epi32(0x, 0x,
+ 0x, 0x07F0);
+#endif

/* nb_pkts shall be less equal than RTE_IXGBE_MAX_RX_BURST */
nb_pkts = RTE_MIN(nb_pkts, RTE_IXGBE_MAX_RX_BURST);
@@ -268,8 +272,14 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
13, 12,  /* octet 12~13, 16 bits data_len */
0xFF, 0xFF,  /* skip high 16 bits pkt_len, zero out */
13, 12,  /* octet 12~13, low 16 bits pkt_len */
+#ifdef RTE_IXGBE_ENABLE_OLD_PTYPE_BEHAVIOR
+   0xFF, 0xFF,  /* skip high 16 bits pkt_type */
+   1,   /* octet 1, 8 bits pkt_type field */
+   0/* octet 0, 4 bits offset 4 pkt_type field */
+#else
0xFF, 0xFF,  /* skip 32 bit pkt_type */
0xFF, 0xFF
+#endif
);

/* Cache is empty -> need to scan the buffer rings, but first move
@@ -291,6 +301,9 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
for (pos = 0, nb_pkts_recd = 0; pos < nb_pkts;
pos += RTE_IXGBE_DESCS_PER_LOOP,
rxdp += RTE_IXGBE_DESCS_PER_LOOP) {
+#ifdef RTE_IXGBE_ENABLE_OLD_PTYPE_BEHAVIOR
+   __m128i descs0[RTE_IXGBE_DESCS_PER_LOOP];
+#endif
__m128i descs[RTE_IXGBE_DESCS_PER_LOOP];
__m128i pkt_mb1, pkt_mb2, pkt_mb3, pkt_mb4;
__m128i zero, staterr, sterr_tmp1, sterr_tmp2;
@@ -301,18 +314,30 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,

/* Read desc statuses backwards to avoid race condition */
/* A.1 load 4 pkts desc */
+#ifdef RTE_IXGBE_ENABLE_OLD_PTYPE_BEHAVIOR
+   descs0[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
+#else
descs[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
-
+#endif
/* B.2 copy 2 mbuf point into rx_pkts  */
_mm_storeu_si128((__m128i *)_pkts[pos], mbp1);

/* B.1 load 1 mbuf point */
mbp2 = _mm_loadu_si128((__m128i *)_ring[pos+2]);

+#ifdef RTE_IXGBE_ENABLE_OLD_PTYPE_BEHAVIOR
+   descs0[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
+
+   /* B.1 load 2 mbuf point */
+   descs0[1] = _mm_loadu_si128((__m128i *)(rxdp + 1));
+   descs0[0] = _mm_loadu_si128((__m128i *)(rxdp));
+#else
descs[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
+
/* B.1 load 2 mbuf point */
descs[1] = _mm_loadu_si128((__m128i *)(rxdp + 1));
descs[0] = _mm_l

[dpdk-dev] [PATCH] mbuf:rearrange mbuf to be more mbuf chain friendly

2016-06-25 Thread Keith Wiles
Move the next pointer to the first cacheline of the rte_mbuf structure
and move the offload values to the second cacheline to give better
performance to applications using chained mbufs.

Enabled by a configuration option CONFIG_RTE_MBUF_CHAIN_FRIENDLY default
is set to No.

Signed-off-by: Keith Wiles 
---
 config/common_base |  2 +
 .../linuxapp/eal/include/exec-env/rte_kni_common.h |  8 +++
 lib/librte_mbuf/rte_mbuf.h | 67 +++---
 3 files changed, 56 insertions(+), 21 deletions(-)

diff --git a/config/common_base b/config/common_base
index 3a04fba..bdde2e7 100644
--- a/config/common_base
+++ b/config/common_base
@@ -402,6 +402,8 @@ CONFIG_RTE_LIBRTE_MBUF=y
 CONFIG_RTE_LIBRTE_MBUF_DEBUG=n
 CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
+# Set to y if needing to be mbuf chain friendly.
+CONFIG_RTE_MBUF_CHAIN_FRIENDLY=n

 #
 # Compile librte_timer
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h 
b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index 2acdfd9..44d65cd 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -120,11 +120,19 @@ struct rte_kni_mbuf {
char pad2[4];
uint32_t pkt_len;   /**< Total pkt len: sum of all segment 
data_len. */
uint16_t data_len;  /**< Amount of data in segment buffer. */
+#ifdef RTE_MBUF_CHAIN_FRIENDLY
+   char pad3[8];
+   void *next;

/* fields on second cache line */
+   char pad4[16] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
+   void *pool;
+#else
+   /* fields on second cache line */
char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
void *pool;
void *next;
+#endif
 };

 /*
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 8798c41..d02ca28 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -758,6 +758,28 @@ typedef uint8_t  MARKER8[0];  /**< generic marker with 1B 
alignment */
 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
* with a single assignment */

+typedef union {
+   uint32_t rss; /**< RSS hash result if RSS enabled */
+   struct {
+   union {
+   struct {
+   uint16_t hash;
+   uint16_t id;
+   };
+   uint32_t lo;
+   /**< Second 4 flexible bytes */
+   };
+   uint32_t hi;
+   /**< First 4 flexible bytes or FD ID, dependent on
+   PKT_RX_FDIR_* flag in ol_flags. */
+   } fdir;   /**< Filter identifier if FDIR enabled */
+   struct {
+   uint32_t lo;
+   uint32_t hi;
+   } sched;  /**< Hierarchical scheduler */
+   uint32_t usr; /**< User defined tags. See rte_distributor_process() 
*/
+} rss_hash_t;
+
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -817,28 +839,31 @@ struct rte_mbuf {
uint16_t data_len;/**< Amount of data in segment buffer. */
/** VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. */
uint16_t vlan_tci;
+#ifdef RTE_MBUF_CHAIN_FRIENDLY
+   /*
+* Move offload into the second cache line and next in the first.
+* Better performance for applications using chained mbufs to have
+* the next pointer in the first cache line.
+* If you change this structure, you must change the user-mode
+* version in rte_kni_common.h to match the new layout.
+*/
+   uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */
+   uint16_t vlan_tci_outer;  /**< Outer VLAN Tag Control Identifier (CPU 
order) */
+   struct rte_mbuf *next;/**< Next segment of scattered packet. */
+
+   /* second cache line - fields only used in slow path or on TX */
+   MARKER cacheline1 __rte_cache_min_aligned;
+
+   rss_hash_t hash;  /**< hash information */

union {
-   uint32_t rss; /**< RSS hash result if RSS enabled */
-   struct {
-   union {
-   struct {
-   uint16_t hash;
-   uint16_t id;
-   };
-   uint32_t lo;
-   /**< Second 4 flexible bytes */
-   };
-   uint32_t hi;
-   /**< First 4 flexible bytes or FD ID, dependent on
-PKT_RX_FDIR_* flag in ol_flags. */
-   } fdir;   /**< Filter identifier if FDIR enabled */
-  

[dpdk-dev] [PATCH] tools:new tool for system info CPU, memory and huge pages

2016-05-13 Thread Keith Wiles
The new tool uses /sys/devices instead of /proc directory, which
does not exist on all systems. If the procfs is not available
then memory and huge page information is skipped.

The tool also can emit a json format in short or long form to
allow for machine readable information.

Here is the usage information:

Usage: sys_info.py [options]

Show the lcores layout with core id and socket(s).

Options:
--help or -h:
Display the usage information and quit

--long or -l:
Display the information in a machine readable long format.

--short or -s:
Display the information in a machine readable short format.

--pci or -p:
Display all of the Ethernet devices in the system using 'lspci'.

--version or -v:
Display the current version number of this script.

--debug or -d:
Output some debug information.

default:
Display the information in a human readable format.

Signed-off-by: Keith Wiles 
---
 tools/sys_info.py | 551 ++
 1 file changed, 551 insertions(+)
 create mode 100755 tools/sys_info.py

diff --git a/tools/sys_info.py b/tools/sys_info.py
new file mode 100755
index 000..5e09d12
--- /dev/null
+++ b/tools/sys_info.py
@@ -0,0 +1,551 @@
+#! /usr/bin/python
+#
+#   BSD LICENSE
+#
+#   Copyright(c) 2016 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.
+#
+
+import os, sys
+import getopt
+import json
+from os.path import exists, abspath, dirname, basename
+
+version = "0.1.3"
+
+# Global lists and flags
+machine_readable = 0
+show_pci = False
+debug_flag = False
+coremaps_flag = False
+
+sys_info = {}
+coremaps = {}
+
+def proc_cpuinfo_path():
+'''Return the cpu information from /proc'''
+return "/proc/cpuinfo"
+
+def proc_sysinfo_path():
+'''Return the system path string from /proc'''
+return "/proc/sysinfo"
+
+def proc_meminfo_path():
+'''Return the memory information path from /proc'''
+return "/proc/meminfo"
+
+def sys_system_path():
+'''Return the system path string from /sys'''
+return "/sys/devices/system"
+
+def read_file(path, whole_file=False):
+'''Read the first line of a file'''
+
+if os.access(path, os.F_OK) == False:
+print "Path (%s) Not found" % path
+return ""
+
+fd = open(path)
+if whole_file == True:
+lines = fd.readlines()
+else:
+line = fd.readline()
+fd.close()
+
+if whole_file == True:
+return lines
+
+return line
+
+def get_range(line):
+'''Split a line and convert to low/high values'''
+
+line = line.strip()
+
+if '-' in line:
+low, high = line.split("-")
+elif ',' in line:
+low, high = line.split(",")
+else:
+return [int(line)]
+
+return [int(low), int(high)]
+
+def get_ranges(line):
+'''Split a set of ranges into first low/high, second low/high value'''
+
+line = line.strip()
+
+first, second = line.split(',')
+
+f = get_range(first)
+s = get_range(second)
+
+return [f, s]
+
+def get_low(line):
+'''Return the low value in a range'''
+range = get_range(line)
+return int(range[0])
+
+def get_high(line):
+'''Return the high value in a range'''
+range = get_range(line)
+
+if len(range) > 1:
+   

[dpdk-dev] [PATCH] gcc compiler option -Og warnings fix

2016-04-01 Thread Keith Wiles
The new compiler option -Og causes a few warning on variables
being used before being set warnings. The new option allows better
debugging then -O0 without losing a lot of performance. This option
does not include -g debug symbol option.

Signed-off-by: Keith Wiles 
---
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +-
 lib/librte_lpm/rte_lpm6.c | 1 +
 lib/librte_vhost/vhost_rxtx.c | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
index 068694d..89709f8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -152,7 +152,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
   unsigned int buflen, int create)
 {
struct rte_pci_addr *loc = >addr;
-   unsigned int uio_num;
+   unsigned int uio_num = 0;
struct dirent *e;
DIR *dir;
char dirname[PATH_MAX];
diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index 4c44cd7..36565da 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -381,6 +381,7 @@ add_step(struct rte_lpm6 *lpm, struct rte_lpm6_tbl_entry 
*tbl,
int8_t bitshift;
uint8_t bits_covered;

+   *tbl_next = NULL;
/*
 * Calculate index to the table based on the number and position
 * of the bytes being inspected in this step.
diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index 750821a..acf3632 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -295,7 +295,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
for (i = 0; i < count; i++) {
uint16_t desc_idx = desc_indexes[i];
uint16_t used_idx = (res_start_idx + i) & (vq->size - 1);
-   uint32_t copied;
+   uint32_t copied = 0;
int err;

err = copy_mbuf_to_desc(dev, vq, pkts[i], desc_idx, );
@@ -531,7 +531,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t 
queue_id,
 {
struct vhost_virtqueue *vq;
uint32_t pkt_idx = 0, nr_used = 0;
-   uint16_t start, end;
+   uint16_t start = 0, end = 0;

LOG_DEBUG(VHOST_DATA, "(%"PRIu64") virtio_dev_merge_rx()\n",
dev->device_fh);
-- 
2.5.0



[dpdk-dev] [PATCH v3] config: remove duplicate configuration information

2016-03-04 Thread Keith Wiles
In order to cleanup the configuration files some and reduce
the number of duplicate configuration information. Add a new
file called common_base which contains just about all of the
configuration lines in one place. Then have the common_bsdapp,
common_linuxapp files include this one file. Then in those OS
specific files add the delta configuration lines.

Signed-off-by: Keith Wiles 
---
 config/common_base | 519 +
 config/common_bsdapp   | 436 +
 config/common_linuxapp | 460 +--
 3 files changed, 528 insertions(+), 887 deletions(-)
 create mode 100644 config/common_base

diff --git a/config/common_base b/config/common_base
new file mode 100644
index 000..0d30cd0
--- /dev/null
+++ b/config/common_base
@@ -0,0 +1,519 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2016 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.
+#
+
+#
+# The following three configs are for reference only and should be
+# enabled in the correct defconfig_XXX file(s).
+#
+
+
+#
+# machine can define specific variables or action for a specific board
+# RTE_MACHINE values are the directories in mk/machine/
+#
+CONFIG_RTE_MACHINE=
+
+#
+# define the architecture we compile for.
+# RTE_ARCH values are the directories in mk/arch/
+#
+CONFIG_RTE_ARCH=
+
+#
+# The compiler we use.
+# RTE_TOOLCHAIN values are the directories in mk/toolchain/
+#
+CONFIG_RTE_TOOLCHAIN=
+
+
+
+#
+# Use intrinsics or assembly code for key routines
+#
+CONFIG_RTE_FORCE_INTRINSICS=n
+
+#
+# Machine forces strict alignment constraints.
+#
+CONFIG_RTE_ARCH_STRICT_ALIGN=n
+
+#
+# Compile to share library
+#
+CONFIG_RTE_BUILD_SHARED_LIB=n
+
+#
+# Use newest code breaking previous ABI
+#
+CONFIG_RTE_NEXT_ABI=y
+
+#
+# Machine's cache line size
+#
+CONFIG_RTE_CACHE_LINE_SIZE=64
+
+#
+# Compile Environment Abstraction Layer
+#
+CONFIG_RTE_LIBRTE_EAL=y
+CONFIG_RTE_MAX_LCORE=128
+CONFIG_RTE_MAX_NUMA_NODES=8
+CONFIG_RTE_MAX_MEMSEG=256
+CONFIG_RTE_MAX_MEMZONE=2560
+CONFIG_RTE_MAX_TAILQ=32
+CONFIG_RTE_LOG_LEVEL=8
+CONFIG_RTE_LOG_HISTORY=256
+CONFIG_RTE_LIBEAL_USE_HPET=n
+CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
+CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
+CONFIG_RTE_EAL_IGB_UIO=n
+CONFIG_RTE_EAL_VFIO=n
+CONFIG_RTE_MALLOC_DEBUG=n
+
+# Default driver path (or "" to disable)
+CONFIG_RTE_EAL_PMD_PATH=""
+
+#
+# Special configurations in PCI Config Space for high performance
+#
+CONFIG_RTE_PCI_CONFIG=n
+CONFIG_RTE_PCI_EXTENDED_TAG=""
+CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE=0
+
+#
+# Compile Environment Abstraction Layer to support Vmware TSC map
+#
+CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y
+
+#
+# Compile the argument parser library
+#
+CONFIG_RTE_LIBRTE_KVARGS=y
+
+#
+# Compile generic ethernet library
+#
+CONFIG_RTE_LIBRTE_ETHER=y
+CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=n
+CONFIG_RTE_MAX_ETHPORTS=32
+CONFIG_RTE_MAX_QUEUES_PER_PORT=1024
+CONFIG_RTE_LIBRTE_IEEE1588=n
+CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
+CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
+
+#
+# Support NIC bypass logic
+#
+CONFIG_RTE_NIC_BYPASS=n
+
+#
+# Compile burst-oriented IGB & EM PMD drivers
+#
+CONFIG_RTE_LIBRTE_EM_PMD=y
+CONFIG_RTE_LIBRTE_IGB_PMD=y
+CONFIG_RTE_LIBRTE_E1000_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_T

[dpdk-dev] [PATCH] config: add missing CONFIG_RTE_ARCH_64 configurations

2016-03-04 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 config/defconfig_x86_64-native-bsdapp-clang | 1 +
 config/defconfig_x86_64-native-bsdapp-gcc   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/config/defconfig_x86_64-native-bsdapp-clang 
b/config/defconfig_x86_64-native-bsdapp-clang
index d2baf2c..8b870b3 100644
--- a/config/defconfig_x86_64-native-bsdapp-clang
+++ b/config/defconfig_x86_64-native-bsdapp-clang
@@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
 CONFIG_RTE_ARCH="x86_64"
 CONFIG_RTE_ARCH_X86_64=y
 CONFIG_RTE_ARCH_X86=y
+CONFIG_RTE_ARCH_64=y

 CONFIG_RTE_TOOLCHAIN="clang"
 CONFIG_RTE_TOOLCHAIN_CLANG=y
diff --git a/config/defconfig_x86_64-native-bsdapp-gcc 
b/config/defconfig_x86_64-native-bsdapp-gcc
index 5a6a4e8..4ea4433 100644
--- a/config/defconfig_x86_64-native-bsdapp-gcc
+++ b/config/defconfig_x86_64-native-bsdapp-gcc
@@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
 CONFIG_RTE_ARCH="x86_64"
 CONFIG_RTE_ARCH_X86_64=y
 CONFIG_RTE_ARCH_X86=y
+CONFIG_RTE_ARCH_64=y

 CONFIG_RTE_TOOLCHAIN="gcc"
 CONFIG_RTE_TOOLCHAIN_GCC=y
-- 
2.7.0



[dpdk-dev] [PATCH v2] config: remove duplicate configuration information

2016-03-04 Thread Keith Wiles
In order to cleanup the configuration files some and reduce
the number of duplicate configuration information. Add a new
file called common_base which contains just about all of the
configuration lines in one place. Then have the common_bsdapp,
common_linuxapp files include this one file. Then in those OS
specific files add the delta configuration lines.

Signed-off-by: Keith Wiles 
---

v2 - split out ARCH_64 missing defines into new patch.
 Turned off linux specific items in common_base and enable them
 in common_linux file.

 config/common_base | 524 +
 config/common_bsdapp   | 436 +---
 config/common_linuxapp | 460 +--
 3 files changed, 533 insertions(+), 887 deletions(-)
 create mode 100644 config/common_base

diff --git a/config/common_base b/config/common_base
new file mode 100644
index 000..7ce0bd8
--- /dev/null
+++ b/config/common_base
@@ -0,0 +1,524 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2016 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.
+#
+
+#
+# The following three configs are for reference only and should be
+# enabled in the correct defconfig_XXX file(s).
+#
+
+
+#
+# machine can define specific variables or action for a specific board
+# RTE_MACHINE values are the directories in mk/machine/
+#
+CONFIG_RTE_MACHINE=
+
+#
+# define the architecture we compile for.
+# RTE_ARCH values are the directories in mk/arch/
+#
+CONFIG_RTE_ARCH=
+
+#
+# The compiler we use.
+# RTE_TOOLCHAIN values are the directories in mk/toolchain/
+#
+CONFIG_RTE_TOOLCHAIN=
+
+
+
+#
+# Use intrinsics or assembly code for key routines
+#
+CONFIG_RTE_FORCE_INTRINSICS=n
+
+#
+# Machine forces strict alignment constraints.
+#
+CONFIG_RTE_ARCH_STRICT_ALIGN=n
+
+#
+# Compile to share library
+#
+CONFIG_RTE_BUILD_SHARED_LIB=n
+
+#
+# Combine to one single library
+#
+CONFIG_RTE_BUILD_COMBINE_LIBS=n
+
+#
+# Use newest code breaking previous ABI
+#
+CONFIG_RTE_NEXT_ABI=y
+
+#
+# Machine's cache line size
+#
+CONFIG_RTE_CACHE_LINE_SIZE=64
+
+#
+# Compile Environment Abstraction Layer
+#
+CONFIG_RTE_LIBRTE_EAL=y
+CONFIG_RTE_MAX_LCORE=128
+CONFIG_RTE_MAX_NUMA_NODES=8
+CONFIG_RTE_MAX_MEMSEG=256
+CONFIG_RTE_MAX_MEMZONE=2560
+CONFIG_RTE_MAX_TAILQ=32
+CONFIG_RTE_LOG_LEVEL=8
+CONFIG_RTE_LOG_HISTORY=256
+CONFIG_RTE_LIBEAL_USE_HPET=n
+CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
+CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
+CONFIG_RTE_EAL_IGB_UIO=n
+CONFIG_RTE_EAL_VFIO=n
+CONFIG_RTE_MALLOC_DEBUG=n
+
+# Default driver path (or "" to disable)
+CONFIG_RTE_EAL_PMD_PATH=""
+
+#
+# Special configurations in PCI Config Space for high performance
+#
+CONFIG_RTE_PCI_CONFIG=n
+CONFIG_RTE_PCI_EXTENDED_TAG=""
+CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE=0
+
+#
+# Compile Environment Abstraction Layer to support Vmware TSC map
+#
+CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y
+
+#
+# Compile the argument parser library
+#
+CONFIG_RTE_LIBRTE_KVARGS=y
+
+#
+# Compile generic ethernet library
+#
+CONFIG_RTE_LIBRTE_ETHER=y
+CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=n
+CONFIG_RTE_MAX_ETHPORTS=32
+CONFIG_RTE_MAX_QUEUES_PER_PORT=1024
+CONFIG_RTE_LIBRTE_IEEE1588=n
+CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
+CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
+
+#
+# Support NIC bypass logic
+#
+CONFIG_RTE_NIC_BYPASS=n
+
+#
+# Com

[dpdk-dev] [PATCH] eal: add missing long-options for short option arguments

2016-02-25 Thread Keith Wiles
A number of short options for EAL are missing long options
and this patch adds those missing options.

The missing long options are for:
-c add --coremask
-d add --driver
-l add --corelist
-m add --memsize
-n add --mem-channels
-r add --mem-ranks
-v add --version
Add an alias for --lcores using --lcore-map

Signed-off-by: Keith Wiles 
---
 doc/guides/testpmd_app_ug/run_app.rst  | 16 +++
 lib/librte_eal/common/eal_common_options.c | 31 --
 lib/librte_eal/common/eal_options.h| 16 +++
 3 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index f605564..753a013 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -38,18 +38,18 @@ The following are the EAL command-line options that can be 
used in conjunction w
 or any other DPDK application.
 See the DPDK Getting Started Guides for more information on these options.

-*   ``-c COREMASK``
+*   ``-c, --coremask COREMASK``

 Set the hexadecimal bitmask of the cores to run on.

-*   ``-l CORELIST``
+*   ``-l, --corelist CORELIST``

 List of cores to run on

 The argument format is ``[-c2][,c3[-c4],...]``
 where ``c1``, ``c2``, etc are core indexes between 0 and 128.

-*   ``--lcores COREMAP``
+*   ``--lcores COREMAP or --lcore-map COREMAP``

 Map lcore set to physical cpu set

@@ -66,7 +66,7 @@ See the DPDK Getting Started Guides for more information on 
these options.

 Core ID that is used as master.

-*   ``-n NUM``
+*   ``-n, --mem-channels NUM``

 Set the number of memory channels to use.

@@ -74,7 +74,7 @@ See the DPDK Getting Started Guides for more information on 
these options.

 Blacklist a PCI devise to prevent EAL from using it. Multiple -b options 
are allowed.

-*   ``-d LIB.so``
+*   ``-d, --driver LIB.so|DIR``

 Load an external driver. Multiple -d options are allowed.

@@ -82,15 +82,15 @@ See the DPDK Getting Started Guides for more information on 
these options.

 Add a PCI device in white list.

-*   ``-m MB``
+*   ``-m, --memsize MB``

 Memory to allocate. See also ``--socket-mem``.

-*   ``-r NUM``
+*   ``-r, --mem-ranks NUM``

 Set the number of memory ranks (auto-detected by default).

-*   ``-v``
+*   ``-v, --version``

 Display the version information on startup.

diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index 29942ea..cf9801d 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -95,6 +95,14 @@ eal_long_options[] = {
{OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM},
{OPT_VMWARE_TSC_MAP,0, NULL, OPT_VMWARE_TSC_MAP_NUM   },
{OPT_XEN_DOM0,  0, NULL, OPT_XEN_DOM0_NUM },
+   {OPT_COREMASK,  1, NULL, OPT_COREMASK_NUM },
+   {OPT_DRIVER,1, NULL, OPT_DRIVER_NUM   },
+   {OPT_CORELIST,  1, NULL, OPT_CORELIST_NUM },
+   {OPT_MEM_SIZE,  1, NULL, OPT_MEM_SIZE_NUM },
+   {OPT_MEM_CHANNELS,  1, NULL, OPT_MEM_CHANNELS_NUM },
+   {OPT_MEM_RANKS, 1, NULL, OPT_MEM_RANKS_NUM},
+   {OPT_VERSION,   0, NULL, OPT_VERSION_NUM  },
+   {OPT_LCORE_MAP, 1, NULL, OPT_LCORE_MAP_NUM},
{0, 0, NULL, 0}
 };

@@ -889,6 +897,7 @@ eal_parse_common_option(int opt, const char *optarg,
conf->log_level = log;
break;
}
+   case OPT_LCORE_MAP_NUM:
case OPT_LCORES_NUM:
if (eal_parse_lcores(optarg) < 0) {
RTE_LOG(ERR, EAL, "invalid parameter for --"
@@ -978,11 +987,13 @@ eal_common_usage(void)
 {
printf("[options]\n\n"
   "EAL common options:\n"
-  "  -c COREMASK Hexadecimal bitmask of cores to run on\n"
-  "  -l CORELIST List of cores to run on\n"
+  "  -c, --"OPT_COREMASK"  Hexadecimal bitmask of cores to run 
on\n"
+  "  -l, --"OPT_CORELIST"  List of cores to run on\n"
   "  The argument format is 
[-c2][,c3[-c4],...]\n"
   "  where c1, c2, etc are core indexes 
between 0 and %d\n"
-  "  --"OPT_LCORES" COREMAPMap lcore set to physical cpu set\n"
+  "(ex: 1-3,7,9-10) skipping 4,5,6 and 8 
cores.\n"
+  "  --"OPT_LCORES" COREMAP\n"
+  "  --"OPT_LCORE_MAP" COREMAP Map lcore set to physical cpu set\n"
   "  The argument format i

[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-02-22 Thread Keith Wiles
In order to cleanup the configuration files some and reduce
the number of duplicate configuration information. Add a new
file called common_base which contains just about all of the
configuration lines in one place. Then have the common_bsdapp,
common_linuxapp files include this one file. Then in those OS
specific files add the delta configuration lines.

Signed-off-by: Keith Wiles 
---
 config/common_base  | 498 
 config/common_bsdapp| 436 +---
 config/common_linuxapp  | 491 +--
 config/defconfig_x86_64-native-bsdapp-clang |   1 +
 config/defconfig_x86_64-native-bsdapp-gcc   |   1 +
 5 files changed, 518 insertions(+), 909 deletions(-)
 create mode 100644 config/common_base

diff --git a/config/common_base b/config/common_base
new file mode 100644
index 000..91a12eb
--- /dev/null
+++ b/config/common_base
@@ -0,0 +1,498 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2016 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.
+#
+
+#
+# Use intrinsics or assembly code for key routines
+#
+CONFIG_RTE_FORCE_INTRINSICS=n
+
+#
+# Machine forces strict alignment constraints.
+#
+CONFIG_RTE_ARCH_STRICT_ALIGN=n
+
+#
+# Compile to share library
+#
+CONFIG_RTE_BUILD_SHARED_LIB=n
+
+#
+# Combine to one single library
+#
+CONFIG_RTE_BUILD_COMBINE_LIBS=n
+
+#
+# Use newest code breaking previous ABI
+#
+CONFIG_RTE_NEXT_ABI=y
+
+#
+# Machine's cache line size
+#
+CONFIG_RTE_CACHE_LINE_SIZE=64
+
+#
+# Compile Environment Abstraction Layer
+#
+CONFIG_RTE_LIBRTE_EAL=y
+CONFIG_RTE_MAX_LCORE=128
+CONFIG_RTE_MAX_NUMA_NODES=8
+CONFIG_RTE_MAX_MEMSEG=256
+CONFIG_RTE_MAX_MEMZONE=2560
+CONFIG_RTE_MAX_TAILQ=32
+CONFIG_RTE_LOG_LEVEL=8
+CONFIG_RTE_LOG_HISTORY=256
+CONFIG_RTE_LIBEAL_USE_HPET=n
+CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
+CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
+CONFIG_RTE_EAL_IGB_UIO=y
+CONFIG_RTE_EAL_VFIO=y
+CONFIG_RTE_MALLOC_DEBUG=n
+
+# Default driver path (or "" to disable)
+CONFIG_RTE_EAL_PMD_PATH=""
+
+#
+# Special configurations in PCI Config Space for high performance
+#
+CONFIG_RTE_PCI_CONFIG=n
+CONFIG_RTE_PCI_EXTENDED_TAG=""
+CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE=0
+
+#
+# Compile Environment Abstraction Layer to support Vmware TSC map
+#
+CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y
+
+#
+# Compile the argument parser library
+#
+CONFIG_RTE_LIBRTE_KVARGS=y
+
+#
+# Compile generic ethernet library
+#
+CONFIG_RTE_LIBRTE_ETHER=y
+CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=n
+CONFIG_RTE_MAX_ETHPORTS=32
+CONFIG_RTE_MAX_QUEUES_PER_PORT=1024
+CONFIG_RTE_LIBRTE_IEEE1588=n
+CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
+CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
+
+#
+# Support NIC bypass logic
+#
+CONFIG_RTE_NIC_BYPASS=n
+
+#
+# Compile burst-oriented IGB & EM PMD drivers
+#
+CONFIG_RTE_LIBRTE_EM_PMD=y
+CONFIG_RTE_LIBRTE_IGB_PMD=y
+CONFIG_RTE_LIBRTE_E1000_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_TX_FREE=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_DRIVER=n
+CONFIG_RTE_LIBRTE_E1000_PF_DISABLE_STRIP_CRC=n
+
+#
+# Compile burst-oriented IXGBE PMD driver
+#
+CONFIG_RTE_LIBRTE_IXGBE_PMD=y
+CONFIG_RTE_LIBRTE_IXGBE_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_IXGBE_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_IXGBE_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_IXGBE_DEBUG_TX_FR

[dpdk-dev] [PATCH] doc: deprecation notice in 16.04 for rte_mempool changes

2016-02-12 Thread Keith Wiles
Deprecation notice for 16.04 for changes to occur in
release 16.07 for rte_mempool memory reduction.

Signed-off-by: Keith Wiles 
---
 doc/guides/rel_notes/deprecation.rst | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index e94d4a2..748a48d 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -49,3 +49,13 @@ Deprecation Notices
   commands (such as RETA update in testpmd).  This should impact
   CMDLINE_PARSE_RESULT_BUFSIZE, STR_TOKEN_SIZE and RDLINE_BUF_SIZE.
   It should be integrated in release 2.3.
+
+* ABI change is planned for the rte_mempool structure to allow mempool
+  cache support to be dynamic depending on the mempool being created
+  needing cache support. Saves about 1.5M of memory per rte_mempool structure
+  by removing the per lcore cache memory. Change will occur in DPDK 16.07
+  release and will skip the define RTE_NEXT_ABI in DPDK 16.04 release. The
+  code effected is app/test/test_mempool.c and librte_mempool/rte_mempool.[ch].
+  The rte_mempool.local_cache will be converted from an array to a pointer to
+  allow for dynamic allocation of the per lcore cache memory.
+
-- 
2.5.4 (Apple Git-61)



[dpdk-dev] [PATCH v4] mempool: reduce rte_mempool structure size

2016-02-12 Thread Keith Wiles
The rte_mempool structure is changed, which will cause an ABI change
for this structure. Providing backward compat is not reasonable
here as this structure is used in multiple defines/inlines.

Allow mempool cache support to be dynamic depending on if the
mempool being created needs cache support. Saves about 1.5M of
memory used by the rte_mempool structure.

Allocating small mempools which do not require cache can consume
larges amounts of memory if you have a number of these mempools.

Change to be effective in release 16.07.

Signed-off-by: Keith Wiles 
---
* Patch v4 remove RTE_NEXT_ABI ifdefs for 16.07 integration, plus split
  out the deprecation notice into another patch email for 16.04 release.
* Patch v3 fix up the ifdefs to correct some problems in removing ifdef
  lines. Added the ABI deprecation notice to the document file.
* Patch v2 to add some comments and setup for RTE_NEXT_ABI changes.

 app/test/test_mempool.c  |  4 +--
 lib/librte_mempool/rte_mempool.c | 55 ++--
 lib/librte_mempool/rte_mempool.h | 29 ++---
 3 files changed, 40 insertions(+), 48 deletions(-)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index f0f823b..10e1fa4 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -122,8 +122,8 @@ test_mempool_basic(void)
return -1;

printf("get private data\n");
-   if (rte_mempool_get_priv(mp) !=
-   (char*) mp + MEMPOOL_HEADER_SIZE(mp, mp->pg_num))
+   if (rte_mempool_get_priv(mp) != (char *)mp +
+   MEMPOOL_HEADER_SIZE(mp, mp->pg_num, mp->cache_size))
return -1;

printf("get physical address of an object\n");
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index aff5f6d..6f067f3 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -452,12 +452,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
/* compilation-time checks */
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool) &
  RTE_CACHE_LINE_MASK) != 0);
-#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_cache) &
  RTE_CACHE_LINE_MASK) != 0);
-   RTE_BUILD_BUG_ON((offsetof(struct rte_mempool, local_cache) &
- RTE_CACHE_LINE_MASK) != 0);
-#endif
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_debug_stats) &
  RTE_CACHE_LINE_MASK) != 0);
@@ -527,9 +523,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
 */
int head = sizeof(struct rte_mempool);
int new_size = (private_data_size + head) % page_size;
-   if (new_size) {
+   if (new_size)
private_data_size += page_size - new_size;
-   }
}

/* try to allocate tailq entry */
@@ -544,7 +539,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
 * store mempool objects. Otherwise reserve a memzone that is large
 * enough to hold mempool header and metadata plus mempool objects.
 */
-   mempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num) + private_data_size;
+   mempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num, cache_size);
+   mempool_size += private_data_size;
mempool_size = RTE_ALIGN_CEIL(mempool_size, RTE_MEMPOOL_ALIGN);
if (vaddr == NULL)
mempool_size += (size_t)objsz.total_size * n;
@@ -598,8 +594,15 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
mp->cache_flushthresh = CALC_CACHE_FLUSHTHRESH(cache_size);
mp->private_data_size = private_data_size;

+   /*
+* local_cache pointer is set even if cache_size is zero.
+* The local_cache points to just past the elt_pa[] array.
+*/
+   mp->local_cache = (struct rte_mempool_cache *)
+   ((char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num, 0));
+
/* calculate address of the first element for continuous mempool. */
-   obj = (char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num) +
+   obj = (char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num, cache_size) +
private_data_size;
obj = RTE_PTR_ALIGN_CEIL(obj, RTE_MEMPOOL_ALIGN);

@@ -613,9 +616,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
mp->elt_va_start = (uintptr_t)obj;
mp->elt_pa[0] = mp->phys_addr +
(mp->elt_va_start - (uintptr_t)mp);
-
-   /* mempool elements in a separate chunk of memory. */
} else {
+   /* mempool elements in a separate chunk of memory. */
mp->elt_va_start = (uintptr_t)vaddr;
 

[dpdk-dev] [PATCH v3] mempool: reduce rte_mempool structure size

2016-02-10 Thread Keith Wiles
The rte_mempool structure is changed, which will cause an ABI change
for this structure. Providing backward compat is not reasonable
here as this structure is used in multiple defines/inlines.

Allow mempool cache support to be dynamic depending on if the
mempool being created needs cache support. Saves about 1.5M of
memory used by the rte_mempool structure.

Allocating small mempools which do not require cache can consume
larges amounts of memory if you have a number of these mempools.

Signed-off-by: Keith Wiles 
---
* Patch v3 fix up the ifdefs to correct some problems in removing ifdef
  lines. Added the ABI deprecation notice to the document file.
* Patch v2 to add some comments and setup for RTE_NEXT_ABI changes.

 app/test/test_mempool.c  |  5 +++
 doc/guides/rel_notes/deprecation.rst |  7 +++
 lib/librte_mempool/rte_mempool.c | 82 +---
 lib/librte_mempool/rte_mempool.h | 46 
 4 files changed, 127 insertions(+), 13 deletions(-)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index f0f823b..f3fba50 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -122,8 +122,13 @@ test_mempool_basic(void)
return -1;

printf("get private data\n");
+#ifdef RTE_NEXT_ABI
+   if (rte_mempool_get_priv(mp) != (char *)mp +
+   MEMPOOL_HEADER_SIZE(mp, mp->pg_num, mp->cache_size))
+#else
if (rte_mempool_get_priv(mp) !=
(char*) mp + MEMPOOL_HEADER_SIZE(mp, mp->pg_num))
+#endif
return -1;

printf("get physical address of an object\n");
diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index e94d4a2..1b9d25e 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -49,3 +49,10 @@ Deprecation Notices
   commands (such as RETA update in testpmd).  This should impact
   CMDLINE_PARSE_RESULT_BUFSIZE, STR_TOKEN_SIZE and RDLINE_BUF_SIZE.
   It should be integrated in release 2.3.
+
+* ABI change is planned for the rte_mempool structure to allow mempool
+  cache support to be dynamic depending on the mempool being created
+  needing cache support. Saves about 1.5M of memory per rte_mempool structure
+  by removing the per lcore cache memory. Change will occur after DPDK 16.04
+  release.
+
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index aff5f6d..5f21eaa 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -452,12 +452,17 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
/* compilation-time checks */
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool) &
  RTE_CACHE_LINE_MASK) != 0);
+#ifdef RTE_NEXT_ABI
+   RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_cache) &
+ RTE_CACHE_LINE_MASK) != 0);
+#else
 #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_cache) &
  RTE_CACHE_LINE_MASK) != 0);
RTE_BUILD_BUG_ON((offsetof(struct rte_mempool, local_cache) &
  RTE_CACHE_LINE_MASK) != 0);
 #endif
+#endif /* RTE_NEXT_ABI */
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_debug_stats) &
  RTE_CACHE_LINE_MASK) != 0);
@@ -527,9 +532,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
 */
int head = sizeof(struct rte_mempool);
int new_size = (private_data_size + head) % page_size;
-   if (new_size) {
+   if (new_size)
private_data_size += page_size - new_size;
-   }
}

/* try to allocate tailq entry */
@@ -544,7 +548,12 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
 * store mempool objects. Otherwise reserve a memzone that is large
 * enough to hold mempool header and metadata plus mempool objects.
 */
+#ifdef RTE_NEXT_ABI
+   mempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num, cache_size);
+   mempool_size += private_data_size;
+#else
mempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num) + private_data_size;
+#endif /* RTE_NEXT_ABI */
mempool_size = RTE_ALIGN_CEIL(mempool_size, RTE_MEMPOOL_ALIGN);
if (vaddr == NULL)
mempool_size += (size_t)objsz.total_size * n;
@@ -598,9 +607,22 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
mp->cache_flushthresh = CALC_CACHE_FLUSHTHRESH(cache_size);
mp->private_data_size = private_data_size;

+#ifdef RTE_NEXT_ABI
+   /*
+* local_cache pointer is set even if cache_size is zero.
+* The local_cache points to just past the elt_pa[] array.
+

[dpdk-dev] [PATCH] mk: add makefile extention support

2016-02-09 Thread Keith Wiles
Adding support to the build system to allow for Makefile.XXX
extention to a subtree, which already has Makefiles. These
Makefiles could be from the autotools and others places. Using
the Makefile extention RTE_MKFILE_SUFFIX in a makefile subtree
using 'export RTE_MKFILE_SUFFIX=.XXX' to use Makefile.XXX in
that subtree.

The main reason I needed this feature was to integrate a autotool
open source projects with DPDK and keep the original Makefiles.

Signed-off-by: Keith Wiles 
---
 mk/internal/rte.extvars.mk |  2 +-
 mk/rte.bsdmodule.mk|  6 +++---
 mk/rte.extsubdir.mk|  2 +-
 mk/rte.module.mk   |  6 +++---
 mk/rte.sdkbuild.mk | 10 +-
 mk/rte.sdkconfig.mk|  6 +++---
 mk/rte.sdkdepdirs.mk   | 10 +-
 mk/rte.sdkgcov.mk  |  2 +-
 mk/rte.sdktest.mk  |  2 +-
 mk/rte.subdir.mk   | 14 +++---
 10 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk
index 040d39f..3361551 100644
--- a/mk/internal/rte.extvars.mk
+++ b/mk/internal/rte.extvars.mk
@@ -48,7 +48,7 @@ ifeq ("$(origin M)", "command line")
 RTE_EXTMK := $(abspath $(M))
 endif
 endif
-RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
+RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX)
 export RTE_EXTMK

 # RTE_SDK_BIN must point to .config, include/ and lib/.
diff --git a/mk/rte.bsdmodule.mk b/mk/rte.bsdmodule.mk
index 86b92ff..e8a504a 100644
--- a/mk/rte.bsdmodule.mk
+++ b/mk/rte.bsdmodule.mk
@@ -80,7 +80,7 @@ build: _postbuild

 # build module
 $(MODULE).ko: $(SRCS_LINKS)
-   $(Q)if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; 
fi
+   $(Q)if [ ! -f $(notdir Makefile)$(RTE_MKFILE_SUFFIX) ]; then ln -nfs 
$(SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX) . ; fi
$(Q)if [ ! -f $(notdir BSDmakefile) ]; then ln -nfs 
$(SRCDIR)/BSDmakefile . ; fi
$(Q)MAKEFLAGS= $(BSDMAKE)

@@ -100,11 +100,11 @@ clean: _postclean
 # do a make clean and remove links
 .PHONY: doclean
 doclean:
-   $(Q)if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; 
fi
+   $(Q)if [ ! -f $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then ln -nfs 
$(SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX) . ; fi
$(Q)$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) clean
$(Q)$(foreach FILE,$(SRCS-y) $(SRCS-n) $(SRCS-),\
if [ -h $(notdir $(FILE)) ]; then rm -f $(notdir $(FILE)) ; fi 
;)
-   $(Q)if [ -h $(notdir Makefile) ]; then rm -f $(notdir Makefile) ; fi
+   $(Q)if [ -h $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then rm -f 
$(notdir Makefile$(RTE_MKFILE_SUFFIX)) ; fi
$(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) \
$(INSTALL-FILES-all)

diff --git a/mk/rte.extsubdir.mk b/mk/rte.extsubdir.mk
index f50f006..55d4e16 100644
--- a/mk/rte.extsubdir.mk
+++ b/mk/rte.extsubdir.mk
@@ -45,7 +45,7 @@ clean: $(DIRS-y)
 $(DIRS-y):
@echo "== $@"
$(Q)$(MAKE) -C $(@) \
-   M=$(CURDIR)/$(@)/Makefile \
+   M=$(CURDIR)/$(@)/Makefile$(RTE_MKFILE_SUFFIX) \
O=$(BASE_OUTPUT)/$(CUR_SUBDIR)/$(@)/$(RTE_TARGET) \
BASE_OUTPUT=$(BASE_OUTPUT) \
CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
diff --git a/mk/rte.module.mk b/mk/rte.module.mk
index 53ed4fe..6477bbe 100644
--- a/mk/rte.module.mk
+++ b/mk/rte.module.mk
@@ -76,7 +76,7 @@ build: _postbuild

 # build module
 $(MODULE).ko: $(SRCS_LINKS)
-   @if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi
+   @if [ ! -f $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then ln -nfs 
$(SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX) . ; fi
@$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) \
CC="$(KERNELCC)" CROSS_COMPILE=$(CROSS) V=$(if $V,1,0)

@@ -97,11 +97,11 @@ clean: _postclean
 # do a make clean and remove links
 .PHONY: doclean
 doclean:
-   @if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi
+   @if [ ! -f $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then ln -nfs 
$(SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX) . ; fi
$(Q)$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) clean
@$(foreach FILE,$(SRCS-y) $(SRCS-n) $(SRCS-),\
if [ -h $(notdir $(FILE)) ]; then rm -f $(notdir $(FILE)) ; fi 
;)
-   @if [ -h $(notdir Makefile) ]; then rm -f $(notdir Makefile) ; fi
+   @if [ -h $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then rm -f $(notdir 
Makefile$(RTE_MKFILE_SUFFIX)) ; fi
@rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) \
$(INSTALL-FILES-all)

diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk
index 85f603c..3860843 100644
--- a/mk/rte.sdkbuild.mk
+++ b/mk/rte.sdkbuild.mk
@@ -76,15 +76,15 @@ clean: $(CLEANDIRS)
 $(ROOTDIRS-y):
@[ -d $(BUILDDIR)/$@ ] || mkdir -p $(BUILDDIR)/$@
@echo "== Build $@"
-   $(Q)$(MAKE) S=$@ -f $(RTE_SRC

[dpdk-dev] [PATCH v2] mempool: reduce rte_mempool structure size

2016-02-09 Thread Keith Wiles
Patch v2 to add some comments and setup for RTE_NEXT_ABI changes.

The rte_mempool structure is changed, which will cause an ABI change
for this structure. Providing backward compat is not reasonable
here as this structure is used in multiple defines/inlines.

Allow mempool cache support to be dynamic depending on if the
mempool being created needs cache support. Saves about 1.5M of
memory used by the rte_mempool structure.

Allocating small mempools which do not require cache can consume
larges amounts of memory if you have a number of these mempools.

Signed-off-by: Keith Wiles 
---
 app/test/test_mempool.c |  5 ++
 config/defconfig_x86_64-native-linuxapp-gcc |  5 ++
 lib/librte_mempool/rte_mempool.c| 83 ++---
 lib/librte_mempool/rte_mempool.h| 57 +++-
 4 files changed, 143 insertions(+), 7 deletions(-)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 72f8fb6..2829d40 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -122,8 +122,13 @@ test_mempool_basic(void)
return -1;

printf("get private data\n");
+#ifdef RTE_NEXT_ABI
+   if (rte_mempool_get_priv(mp) != (char *)mp +
+   MEMPOOL_HEADER_SIZE(mp, mp->pg_num, mp->cache_size))
+#else
if (rte_mempool_get_priv(mp) !=
(char*) mp + MEMPOOL_HEADER_SIZE(mp, mp->pg_num))
+#endif
return -1;

printf("get physical address of an object\n");
diff --git a/config/defconfig_x86_64-native-linuxapp-gcc 
b/config/defconfig_x86_64-native-linuxapp-gcc
index 60baf5b..02e9ace 100644
--- a/config/defconfig_x86_64-native-linuxapp-gcc
+++ b/config/defconfig_x86_64-native-linuxapp-gcc
@@ -40,3 +40,8 @@ CONFIG_RTE_ARCH_64=y

 CONFIG_RTE_TOOLCHAIN="gcc"
 CONFIG_RTE_TOOLCHAIN_GCC=y
+CONFIG_RTE_BUILD_SHARED_LIB=y
+CONFIG_RTE_NEXT_ABI=n
+CONFIG_RTE_EAL_IGB_UIO=n
+CONFIG_RTE_LIBRTE_KNI=n
+CONFIG_RTE_KNI_KMOD=n
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index aff5f6d..c61dc44 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -452,12 +452,17 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
/* compilation-time checks */
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool) &
  RTE_CACHE_LINE_MASK) != 0);
+#ifdef RTE_NEXT_ABI
+   RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_cache) &
+ RTE_CACHE_LINE_MASK) != 0);
+#else
 #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_cache) &
  RTE_CACHE_LINE_MASK) != 0);
RTE_BUILD_BUG_ON((offsetof(struct rte_mempool, local_cache) &
  RTE_CACHE_LINE_MASK) != 0);
 #endif
+#endif /* RTE_NEXT_ABI */
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_debug_stats) &
  RTE_CACHE_LINE_MASK) != 0);
@@ -527,9 +532,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
 */
int head = sizeof(struct rte_mempool);
int new_size = (private_data_size + head) % page_size;
-   if (new_size) {
+   if (new_size)
private_data_size += page_size - new_size;
-   }
}

/* try to allocate tailq entry */
@@ -544,7 +548,12 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
 * store mempool objects. Otherwise reserve a memzone that is large
 * enough to hold mempool header and metadata plus mempool objects.
 */
+#ifdef RTE_NEXT_ABI
+   mempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num, cache_size);
+   mempool_size += private_data_size;
+#else
mempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num) + private_data_size;
+#endif /* RTE_NEXT_ABI */
mempool_size = RTE_ALIGN_CEIL(mempool_size, RTE_MEMPOOL_ALIGN);
if (vaddr == NULL)
mempool_size += (size_t)objsz.total_size * n;
@@ -598,9 +607,22 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
mp->cache_flushthresh = CALC_CACHE_FLUSHTHRESH(cache_size);
mp->private_data_size = private_data_size;

+#ifdef RTE_NEXT_ABI
+   /*
+* local_cache pointer is set even if cache_size is zero.
+* The local_cache points to just past the elt_pa[] array.
+*/
+   mp->local_cache = (struct rte_mempool_cache *)
+   ((char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num, 0));
+
+   /* calculate address of the first element for continuous mempool. */
+   obj = (char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num, cache_size) +
+   private_data_size;
+#else
/* calculate address of the first element for continuou

[dpdk-dev] [PATCH] mempool: Reduce rte_mempool structure size

2016-02-02 Thread Keith Wiles
The rte_mempool structure is changed, which will cause an ABI change
for this structure.

Allow mempool cache support to be dynamic depending on if the
mempool being created needs cache support. Saves about 1.5M of
memory used by the rte_mempool structure. Performance does not seem
to be effected running l3fwd and the test_mempool execution passed.

Allocating small mempools which do not require cache can consume
larges amounts of memory if you have a number of these mempools.

Signed-off-by: Keith Wiles 
---
 app/test/test_mempool.c  |  4 +--
 lib/librte_mempool/rte_mempool.c | 56 ++--
 lib/librte_mempool/rte_mempool.h | 29 ++---
 3 files changed, 40 insertions(+), 49 deletions(-)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 72f8fb6..7b479f8 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -122,8 +122,8 @@ test_mempool_basic(void)
return -1;

printf("get private data\n");
-   if (rte_mempool_get_priv(mp) !=
-   (char*) mp + MEMPOOL_HEADER_SIZE(mp, mp->pg_num))
+   if (rte_mempool_get_priv(mp) != (char *)mp +
+   MEMPOOL_HEADER_SIZE(mp, mp->pg_num, mp->cache_size))
return -1;

printf("get physical address of an object\n");
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index aff5f6d..bdf8e2e 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -450,15 +450,11 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
int page_size = getpagesize();

/* compilation-time checks */
+#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool) &
  RTE_CACHE_LINE_MASK) != 0);
-#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_cache) &
  RTE_CACHE_LINE_MASK) != 0);
-   RTE_BUILD_BUG_ON((offsetof(struct rte_mempool, local_cache) &
- RTE_CACHE_LINE_MASK) != 0);
-#endif
-#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_debug_stats) &
  RTE_CACHE_LINE_MASK) != 0);
RTE_BUILD_BUG_ON((offsetof(struct rte_mempool, stats) &
@@ -527,9 +523,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
 */
int head = sizeof(struct rte_mempool);
int new_size = (private_data_size + head) % page_size;
-   if (new_size) {
+   if (new_size)
private_data_size += page_size - new_size;
-   }
}

/* try to allocate tailq entry */
@@ -544,7 +539,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
 * store mempool objects. Otherwise reserve a memzone that is large
 * enough to hold mempool header and metadata plus mempool objects.
 */
-   mempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num) + private_data_size;
+   mempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num, cache_size);
+   mempool_size += private_data_size;
mempool_size = RTE_ALIGN_CEIL(mempool_size, RTE_MEMPOOL_ALIGN);
if (vaddr == NULL)
mempool_size += (size_t)objsz.total_size * n;
@@ -598,8 +594,15 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
mp->cache_flushthresh = CALC_CACHE_FLUSHTHRESH(cache_size);
mp->private_data_size = private_data_size;

+   /*
+* local_cache pointer is set even if cache_size is zero.
+* The local_cache points to just past the elt_pa[] array.
+*/
+   mp->local_cache = (struct rte_mempool_cache *)
+   ((char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num, 0));
+
/* calculate address of the first element for continuous mempool. */
-   obj = (char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num) +
+   obj = (char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num, cache_size) +
private_data_size;
obj = RTE_PTR_ALIGN_CEIL(obj, RTE_MEMPOOL_ALIGN);

@@ -613,9 +616,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
mp->elt_va_start = (uintptr_t)obj;
mp->elt_pa[0] = mp->phys_addr +
(mp->elt_va_start - (uintptr_t)mp);
-
-   /* mempool elements in a separate chunk of memory. */
} else {
+   /* mempool elements in a separate chunk of memory. */
mp->elt_va_start = (uintptr_t)vaddr;
memcpy(mp->elt_pa, paddr, sizeof (mp->elt_pa[0]) * pg_num);
}
@@ -645,19 +647,15 @@ unsigned
 rte_mempool_count(const struct rte_mempool *mp)
 {
unsigned count;
+   unsigned lcore_id;

count = rte_ring_count(

[dpdk-dev] [PATCH] Remove the extra blank lines in the output

2015-12-08 Thread Keith Wiles
The output for the core list included an extra linefeed making
the number of lines displayed much larger then required.

Signed-off-by: Keith Wiles 
---
 tools/cpu_layout.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/cpu_layout.py b/tools/cpu_layout.py
index 20a409d..d38d0b5 100755
--- a/tools/cpu_layout.py
+++ b/tools/cpu_layout.py
@@ -92,4 +92,4 @@ for c in cores:
 print "Core %s" % str(c).ljust(max_core_id_len),
 for s in sockets:
 print str(core_map[(s,c)]).ljust(max_core_map_len),
-print "\n"
+print ""
-- 
2.3.0



[dpdk-dev] [PATCH] eal:Change log output to DEBUG instead of INFO

2015-09-10 Thread Keith Wiles
When log level is set to 7 (INFO) these messages are still displayed
and should be set to DEBUG.

Signed-off-by: Keith Wiles 
---
 lib/librte_eal/common/eal_common_memory.c  | 2 +-
 lib/librte_eal/common/eal_common_timer.c   | 2 +-
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_memory.c 
b/lib/librte_eal/common/eal_common_memory.c
index b647573..6155752 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -139,7 +139,7 @@ rte_eal_memdevice_init(void)
 int
 rte_eal_memory_init(void)
 {
-   RTE_LOG(INFO, EAL, "Setting up physically contiguous memory...\n");
+   RTE_LOG(DEBUG, EAL, "Setting up physically contiguous memory...\n");

const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
rte_eal_hugepage_init() :
diff --git a/lib/librte_eal/common/eal_common_timer.c 
b/lib/librte_eal/common/eal_common_timer.c
index 72371b8..c4227cd 100644
--- a/lib/librte_eal/common/eal_common_timer.c
+++ b/lib/librte_eal/common/eal_common_timer.c
@@ -81,6 +81,6 @@ set_tsc_freq(void)
if (!freq)
freq = estimate_tsc_freq();

-   RTE_LOG(INFO, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq / 1000);
+   RTE_LOG(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq / 1000);
eal_tsc_resolution_hz = freq;
 }
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
index 0e6c48a..e0c13de 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
@@ -904,7 +904,7 @@ pci_vfio_enable(void)

/* return 0 if VFIO modules not loaded */
if (module_vfio_type1 == 0) {
-   RTE_LOG(INFO, EAL, "VFIO modules not all loaded, "
+   RTE_LOG(DEBUG, EAL, "VFIO modules not all loaded, "
"skip VFIO support...\n");
return 0;
}
-- 
2.3.0



[dpdk-dev] [PATCH v2] log:Change magic number on RTE_LOG_LEVEL to an enum name

2015-08-02 Thread Keith Wiles
Config files used RTE_LOG_LEVEL=8 to set log level to DEBUG. Using
a the RTE_LOG_ is easier to maintain.

Converted the RTE_LOG_ define into a enum of values with
the same names to reduce maintaining the define values.

The change is to use an enum in place of a magic number, plus
we get the benefit of seeing the enum name in the debugger
instead of a number.

The rte_logs was set after options parsing, defaulting to
RTE_LOG_LEVEL, and it is now initialized at RTE_LOG_LEVEL
without behavioral change.

Signed-off-by: Keith Wiles 
---
 config/common_bsdapp|  6 --
 config/common_linuxapp  |  6 --
 lib/librte_eal/common/eal_common_log.c  |  4 ++--
 lib/librte_eal/common/include/rte_log.h | 18 ++
 4 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 2c6eb40..b2e9462 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -102,12 +102,14 @@ CONFIG_RTE_MAX_NUMA_NODES=8
 CONFIG_RTE_MAX_MEMSEG=256
 CONFIG_RTE_MAX_MEMZONE=2560
 CONFIG_RTE_MAX_TAILQ=32
-CONFIG_RTE_LOG_LEVEL=8
-CONFIG_RTE_LOG_HISTORY=256
 CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
 CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
 CONFIG_RTE_MALLOC_DEBUG=n

+# RTE_LOG_XXX = DEBUG, INFO, NOTICE, WARNING or ERR
+CONFIG_RTE_LOG_LEVEL=RTE_LOG_DEBUG
+CONFIG_RTE_LOG_HISTORY=256
+
 #
 # FreeBSD contiguous memory driver settings
 #
diff --git a/config/common_linuxapp b/config/common_linuxapp
index bda9a63..eb0f659 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -102,8 +102,6 @@ CONFIG_RTE_MAX_NUMA_NODES=8
 CONFIG_RTE_MAX_MEMSEG=256
 CONFIG_RTE_MAX_MEMZONE=2560
 CONFIG_RTE_MAX_TAILQ=32
-CONFIG_RTE_LOG_LEVEL=8
-CONFIG_RTE_LOG_HISTORY=256
 CONFIG_RTE_LIBEAL_USE_HPET=n
 CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
 CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
@@ -111,6 +109,10 @@ CONFIG_RTE_EAL_IGB_UIO=y
 CONFIG_RTE_EAL_VFIO=y
 CONFIG_RTE_MALLOC_DEBUG=n

+# RTE_LOG_XXX = DEBUG, INFO, NOTICE, WARNING or ERR
+CONFIG_RTE_LOG_LEVEL=RTE_LOG_DEBUG
+CONFIG_RTE_LOG_HISTORY=256
+
 #
 # Special configurations in PCI Config Space for high performance
 #
diff --git a/lib/librte_eal/common/eal_common_log.c 
b/lib/librte_eal/common/eal_common_log.c
index 1ae8de7..6ed6743 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -82,7 +82,7 @@ static struct log_history_list log_history;
 /* global log structure */
 struct rte_logs rte_logs = {
.type = ~0,
-   .level = RTE_LOG_DEBUG,
+   .level = RTE_LOG_LEVEL,
.file = NULL,
 };

@@ -93,7 +93,7 @@ static int history_enabled = 1;

 /**
  * This global structure stores some informations about the message
- * that is currently beeing processed by one lcore
+ * that is currently being processed by one lcore
  */
 struct log_cur_msg {
uint32_t loglevel; /**< log level - see rte_log.h */
diff --git a/lib/librte_eal/common/include/rte_log.h 
b/lib/librte_eal/common/include/rte_log.h
index 24a55cc..be75a45 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -89,14 +89,16 @@ extern struct rte_logs rte_logs;
 #define RTE_LOGTYPE_USER8   0x8000 /**< User-defined log type 8. */

 /* Can't use 0, as it gives compiler warnings */
-#define RTE_LOG_EMERG1U  /**< System is unusable.   */
-#define RTE_LOG_ALERT2U  /**< Action must be taken immediately. */
-#define RTE_LOG_CRIT 3U  /**< Critical conditions.  */
-#define RTE_LOG_ERR  4U  /**< Error conditions. */
-#define RTE_LOG_WARNING  5U  /**< Warning conditions.   */
-#define RTE_LOG_NOTICE   6U  /**< Normal but significant condition. */
-#define RTE_LOG_INFO 7U  /**< Informational.*/
-#define RTE_LOG_DEBUG8U  /**< Debug-level messages. */
+enum {
+   RTE_LOG_EMERG=1,/**< System is unusable.   */
+   RTE_LOG_ALERT,  /**< Action must be taken immediately. */
+   RTE_LOG_CRIT,   /**< Critical conditions.  */
+   RTE_LOG_ERR,/**< Error conditions. */
+   RTE_LOG_WARNING,/**< Warning conditions.   */
+   RTE_LOG_NOTICE, /**< Normal but significant condition. */
+   RTE_LOG_INFO,   /**< Informational.*/
+   RTE_LOG_DEBUG   /**< Debug-level messages. */
+};

 /** The default log stream. */
 extern FILE *eal_default_log_stream;
-- 
2.3.0



[dpdk-dev] [PATCH v2] eal:Fix log messages always being printed from rte_eal_cpu_init

2015-06-08 Thread Keith Wiles
The RTE_LOG(DEBUG, ...) messages in rte_eal_cpu_init() are printed
even when the log level on the command line was set to INFO or lower.

The problem is the rte_eal_cpu_init() routine was called before
the command line args are scanned. Setting --log-level=7 now
correctly does not print the messages from the rte_eal_cpu_init() routine.

Signed-off-by: Keith Wiles 
---
 lib/librte_eal/bsdapp/eal/eal.c   | 42 ++-
 lib/librte_eal/linuxapp/eal/eal.c | 42 ++-
 2 files changed, 74 insertions(+), 10 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 43e8a47..0112617 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -306,6 +306,38 @@ eal_get_hugepage_mem_size(void)
return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;
 }

+/* Parse the arguments for --log-level only */
+static void
+eal_log_level_parse(int argc, char **argv)
+{
+   int opt;
+   char **argvopt;
+   int option_index;
+
+   argvopt = argv;
+
+   eal_reset_internal_config(_config);
+
+   while ((opt = getopt_long(argc, argvopt, eal_short_options,
+ eal_long_options, _index)) != EOF) {
+
+   int ret;
+
+   /* getopt is not happy, stop right now */
+   if (opt == '?')
+   break;
+
+   ret = (opt == OPT_LOG_LEVEL_NUM)?
+   eal_parse_common_option(opt, optarg, _config) 
: 0;
+
+   /* common parser is not happy */
+   if (ret < 0)
+   break;
+   }
+
+   optind = 0; /* reset getopt lib */
+}
+
 /* Parse the argument given in the command line of the application */
 static int
 eal_parse_args(int argc, char **argv)
@@ -317,8 +349,6 @@ eal_parse_args(int argc, char **argv)

argvopt = argv;

-   eal_reset_internal_config(_config);
-
while ((opt = getopt_long(argc, argvopt, eal_short_options,
  eal_long_options, _index)) != EOF) {

@@ -447,6 +477,11 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_log_early_init() < 0)
rte_panic("Cannot init early logs\n");

+   eal_log_level_parse(argc, argv);
+
+   /* set log level as early as possible */
+   rte_set_log_level(internal_config.log_level);
+
if (rte_eal_cpu_init() < 0)
rte_panic("Cannot detect lcores\n");

@@ -454,9 +489,6 @@ rte_eal_init(int argc, char **argv)
if (fctret < 0)
exit(1);

-   /* set log level as early as possible */
-   rte_set_log_level(internal_config.log_level);
-
if (internal_config.no_hugetlbfs == 0 &&
internal_config.process_type != RTE_PROC_SECONDARY &&
eal_hugepage_info_init() < 0)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index bd770cf..4f8d0d9 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -499,6 +499,38 @@ eal_get_hugepage_mem_size(void)
return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;
 }

+/* Parse the arguments for --log-level only */
+static void
+eal_log_level_parse(int argc, char **argv)
+{
+   int opt;
+   char **argvopt;
+   int option_index;
+
+   argvopt = argv;
+
+   eal_reset_internal_config(_config);
+
+   while ((opt = getopt_long(argc, argvopt, eal_short_options,
+ eal_long_options, _index)) != EOF) {
+
+   int ret;
+
+   /* getopt is not happy, stop right now */
+   if (opt == '?')
+   break;
+
+   ret = (opt == OPT_LOG_LEVEL_NUM)?
+   eal_parse_common_option(opt, optarg, _config) 
: 0;
+
+   /* common parser is not happy */
+   if (ret < 0)
+   break;
+   }
+
+   optind = 0; /* reset getopt lib */
+}
+
 /* Parse the argument given in the command line of the application */
 static int
 eal_parse_args(int argc, char **argv)
@@ -511,8 +543,6 @@ eal_parse_args(int argc, char **argv)

argvopt = argv;

-   eal_reset_internal_config(_config);
-
while ((opt = getopt_long(argc, argvopt, eal_short_options,
  eal_long_options, _index)) != EOF) {

@@ -717,6 +747,11 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_log_early_init() < 0)
rte_panic("Cannot init early logs\n");

+   eal_log_level_parse(argc, argv);
+
+   /* set log level as early as possible */
+   rte_set_log_level(internal_config.log_level);
+
if (rte_eal_cpu_init() < 0)
rte_panic("Cannot detect lcores\n");

@@ -724,9 +759,6 @@ rte_eal_init(int argc, char **argv)
i

[dpdk-dev] [PATCH] log:Change magic number on RTE_LOG_LEVEL to a define

2015-06-06 Thread Keith Wiles
Config files used RTE_LOG_LEVEL=8 to set log level to DEBUG. Using
a the RTE_LOG_ is easier to maintain.

Converted the RTE_LOG_ defines into a enum of values with
the same names for to reduct maintaining the values and allow
debuggers to print the name of the value.

Signed-off-by: Keith Wiles 
---
 config/common_bsdapp|  8 +++-
 config/common_linuxapp  |  8 +++-
 lib/librte_eal/common/eal_common_log.c  |  4 ++--
 lib/librte_eal/common/include/rte_log.h | 19 +++
 4 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 0b169c8..97bbcbd 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -93,12 +93,18 @@ CONFIG_RTE_MAX_NUMA_NODES=8
 CONFIG_RTE_MAX_MEMSEG=256
 CONFIG_RTE_MAX_MEMZONE=2560
 CONFIG_RTE_MAX_TAILQ=32
-CONFIG_RTE_LOG_LEVEL=8
 CONFIG_RTE_LOG_HISTORY=256
 CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
 CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n

 #
+# Log level use: RTE_LOG_XXX
+#   XXX = NOOP, EMERG, ALERT, CRIT, ERR, WARNING, NOTICE, INFO or DEBUG
+#   Look in rte_log.h for others if any.
+#
+CONFIG_RTE_LOG_LEVEL=RTE_LOG_DEBUG
+
+#
 # FreeBSD contiguous memory driver settings
 #
 CONFIG_RTE_CONTIGMEM_MAX_NUM_BUFS=64
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 5deb55a..886fc66 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -93,7 +93,6 @@ CONFIG_RTE_MAX_NUMA_NODES=8
 CONFIG_RTE_MAX_MEMSEG=256
 CONFIG_RTE_MAX_MEMZONE=2560
 CONFIG_RTE_MAX_TAILQ=32
-CONFIG_RTE_LOG_LEVEL=8
 CONFIG_RTE_LOG_HISTORY=256
 CONFIG_RTE_LIBEAL_USE_HPET=n
 CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
@@ -102,6 +101,13 @@ CONFIG_RTE_EAL_IGB_UIO=y
 CONFIG_RTE_EAL_VFIO=y

 #
+# Log level use: RTE_LOG_XXX
+#   XXX = NOOP, EMERG, ALERT, CRIT, ERR, WARNING, NOTICE, INFO or DEBUG
+#   Look in rte_log.h for others if any.
+#
+CONFIG_RTE_LOG_LEVEL=RTE_LOG_DEBUG
+
+#
 # Special configurations in PCI Config Space for high performance
 #
 CONFIG_RTE_PCI_CONFIG=n
diff --git a/lib/librte_eal/common/eal_common_log.c 
b/lib/librte_eal/common/eal_common_log.c
index fe3d7d5..3dcceab 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -82,7 +82,7 @@ static struct log_history_list log_history;
 /* global log structure */
 struct rte_logs rte_logs = {
.type = ~0,
-   .level = RTE_LOG_DEBUG,
+   .level = RTE_LOG_LEVEL,
.file = NULL,
 };

@@ -93,7 +93,7 @@ static int history_enabled = 1;

 /**
  * This global structure stores some informations about the message
- * that is currently beeing processed by one lcore
+ * that is currently being processed by one lcore
  */
 struct log_cur_msg {
uint32_t loglevel; /**< log level - see rte_log.h */
diff --git a/lib/librte_eal/common/include/rte_log.h 
b/lib/librte_eal/common/include/rte_log.h
index 3b467c1..e7e893e 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -89,14 +89,17 @@ extern struct rte_logs rte_logs;
 #define RTE_LOGTYPE_USER8   0x8000 /**< User-defined log type 8. */

 /* Can't use 0, as it gives compiler warnings */
-#define RTE_LOG_EMERG1U  /**< System is unusable.   */
-#define RTE_LOG_ALERT2U  /**< Action must be taken immediately. */
-#define RTE_LOG_CRIT 3U  /**< Critical conditions.  */
-#define RTE_LOG_ERR  4U  /**< Error conditions. */
-#define RTE_LOG_WARNING  5U  /**< Warning conditions.   */
-#define RTE_LOG_NOTICE   6U  /**< Normal but significant condition. */
-#define RTE_LOG_INFO 7U  /**< Informational.*/
-#define RTE_LOG_DEBUG8U  /**< Debug-level messages. */
+enum {
+   RTE_LOG_NOOP = 0,   /**< Noop not used (zero entry)*/
+   RTE_LOG_EMERG,  /**< System is unusable.   */
+   RTE_LOG_ALERT,  /**< Action must be taken immediately. */
+   RTE_LOG_CRIT,   /**< Critical conditions.  */
+   RTE_LOG_ERR,/**< Error conditions. */
+   RTE_LOG_WARNING,/**< Warning conditions.   */
+   RTE_LOG_NOTICE, /**< Normal but significant condition. */
+   RTE_LOG_INFO,   /**< Informational.*/
+   RTE_LOG_DEBUG   /**< Debug-level messages. */
+};

 /** The default log stream. */
 extern FILE *eal_default_log_stream;
-- 
2.3.0



[dpdk-dev] [PATCH] eal:Fix log messages always being printed from rte_eal_cpu_init

2015-06-06 Thread Keith Wiles
The RTE_LOG(DEBUG, ...) messages in rte_eal_cpu_init() are printed
even when the log level on the command line was set to INFO or lower.

The problem is the rte_eal_cpu_init() routine was called before
the command line args are scanned. Setting --log-level=7 now
correctly does not print the messages from the rte_eal_cpu_init() routine.

Signed-off-by: Keith Wiles 
---
 lib/librte_eal/bsdapp/eal/eal.c   | 43 ++-
 lib/librte_eal/linuxapp/eal/eal.c | 43 ++-
 2 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 43e8a47..ca10f2c 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -306,6 +306,38 @@ eal_get_hugepage_mem_size(void)
return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;
 }

+/* Parse the arguments for --log-level only */
+static void
+eal_log_level_parse(int argc, char **argv)
+{
+   int opt;
+   char **argvopt;
+   int option_index;
+
+   argvopt = argv;
+
+   eal_reset_internal_config(_config);
+
+   while ((opt = getopt_long(argc, argvopt, eal_short_options,
+ eal_long_options, _index)) != EOF) {
+
+   int ret;
+
+   /* getopt is not happy, stop right now */
+   if (opt == '?')
+   break;
+
+   ret = (opt == OPT_LOG_LEVEL_NUM)?
+   eal_parse_common_option(opt, optarg, _config) 
: 0;
+
+   /* common parser is not happy */
+   if (ret < 0)
+   break;
+   }
+
+   optind = 0; /* reset getopt lib */
+}
+
 /* Parse the argument given in the command line of the application */
 static int
 eal_parse_args(int argc, char **argv)
@@ -317,8 +349,6 @@ eal_parse_args(int argc, char **argv)

argvopt = argv;

-   eal_reset_internal_config(_config);
-
while ((opt = getopt_long(argc, argvopt, eal_short_options,
  eal_long_options, _index)) != EOF) {

@@ -447,6 +477,12 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_log_early_init() < 0)
rte_panic("Cannot init early logs\n");

+   eal_log_level_parse(argc, argv);
+
+   /* set log level as early as possible */
+   rte_set_log_level(internal_config.log_level);
+
+   RTE_LOG(INFO, EAL,  "DPDK Version %s\n", rte_version());
if (rte_eal_cpu_init() < 0)
rte_panic("Cannot detect lcores\n");

@@ -454,9 +490,6 @@ rte_eal_init(int argc, char **argv)
if (fctret < 0)
exit(1);

-   /* set log level as early as possible */
-   rte_set_log_level(internal_config.log_level);
-
if (internal_config.no_hugetlbfs == 0 &&
internal_config.process_type != RTE_PROC_SECONDARY &&
eal_hugepage_info_init() < 0)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index bd770cf..090ec99 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -499,6 +499,38 @@ eal_get_hugepage_mem_size(void)
return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;
 }

+/* Parse the arguments for --log-level only */
+static void
+eal_log_level_parse(int argc, char **argv)
+{
+   int opt;
+   char **argvopt;
+   int option_index;
+
+   argvopt = argv;
+
+   eal_reset_internal_config(_config);
+
+   while ((opt = getopt_long(argc, argvopt, eal_short_options,
+ eal_long_options, _index)) != EOF) {
+
+   int ret;
+
+   /* getopt is not happy, stop right now */
+   if (opt == '?')
+   break;
+
+   ret = (opt == OPT_LOG_LEVEL_NUM)?
+   eal_parse_common_option(opt, optarg, _config) 
: 0;
+
+   /* common parser is not happy */
+   if (ret < 0)
+   break;
+   }
+
+   optind = 0; /* reset getopt lib */
+}
+
 /* Parse the argument given in the command line of the application */
 static int
 eal_parse_args(int argc, char **argv)
@@ -511,8 +543,6 @@ eal_parse_args(int argc, char **argv)

argvopt = argv;

-   eal_reset_internal_config(_config);
-
while ((opt = getopt_long(argc, argvopt, eal_short_options,
  eal_long_options, _index)) != EOF) {

@@ -717,6 +747,12 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_log_early_init() < 0)
rte_panic("Cannot init early logs\n");

+   eal_log_level_parse(argc, argv);
+
+   /* set log level as early as possible */
+   rte_set_log_level(internal_config.log_level);
+
+   RTE_LOG(INFO, EAL, "DPDK Version %s\n", rte_version());
if (rte_eal_cpu_init(

[dpdk-dev] [RFC PATCH] eal:Add new API for parsing args at rte_eal_init time

2015-06-03 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 lib/librte_eal/bsdapp/eal/eal.c | 20 
 lib/librte_eal/common/include/rte_eal.h | 32 
 2 files changed, 52 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 43e8a47..a228576 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -557,6 +557,26 @@ rte_eal_init(int argc, char **argv)
return fctret;
 }

+/* Launch threads, called at application init() and parse app args. */
+int
+rte_eal_init_parse(int argc, char **argv,
+   int (*parse)(int, char **))
+{
+   int ret;
+
+   ret = rte_eal_init(argc, argv);
+   if ((ret >= 0) && (parse != NULL)) {
+   argc -= ret;
+   argv += ret;
+
+   int rval = parse(argc, argv);
+   if (rval < 0)
+   return rval;
+   ret += rval;/* Return the total args parsed */
+   }
+   return ret;
+}
+
 /* get core role */
 enum rte_lcore_role_t
 rte_eal_lcore_role(unsigned lcore_id)
diff --git a/lib/librte_eal/common/include/rte_eal.h 
b/lib/librte_eal/common/include/rte_eal.h
index 1385a73..c04f295 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -153,6 +153,38 @@ int rte_eal_iopl_init(void);
  *   - On failure, a negative error value.
  */
 int rte_eal_init(int argc, char **argv);
+
+/**
+ * Initialize the Environment Abstraction Layer (EAL) and parse local args.
+ *
+ * This function is to be executed on the MASTER lcore only, as soon
+ * as possible in the application's main() function.
+ *
+ * The function finishes the initialization process before main() is called.
+ * It puts the SLAVE lcores in the WAIT state.
+ *
+ * When the multi-partition feature is supported, depending on the
+ * configuration (if CONFIG_RTE_EAL_MAIN_PARTITION is disabled), this
+ * function waits to ensure that the magic number is set before
+ * returning. See also the rte_eal_get_configuration() function. Note:
+ * This behavior may change in the future.
+ *
+ * @param argc
+ *   The argc argument that was given to the main() function.
+ * @param argv
+ *   The argv argument that was given to the main() function.
+ * @param parse
+ *   The parse function pointer from user int (*parse)(int, char **);
+ * @return
+ *   - On success, the number of parsed arguments, which is greater or
+ * equal to zero. After the call to rte_eal_init(),
+ * all arguments argv[x] with x < ret may be modified and should
+ * not be accessed by the application.
+ *   - On failure, a negative error value.
+ */
+int rte_eal_init_parse(int argc, char **argv,
+   int (*parse)(int, char **));
+
 /**
  * Usage function typedef used by the application usage function.
  *
-- 
2.3.0



[dpdk-dev] [PATCH v10 2/2] mk:Introduce the EXTRA_LDLIBS variable

2015-05-14 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 mk/rte.app.mk| 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..bf18b48 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker library options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index 04f1d4e..7dc2de6 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -411,6 +411,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 333b007..e522c12 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -218,7 +218,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 4fc582a..1a2043a 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -141,7 +141,7 @@ _LDLIBS-y += $(EXECENV_LDLIBS)
 _LDLIBS-y += --end-group
 _LDLIBS-y += --no-whole-archive

-LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS)
+LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)

 .PHONY: all
 all: install
-- 
2.3.0



[dpdk-dev] [PATCH v10 1/2] mk:Simplify the ifdefs in the makefile

2015-05-14 Thread Keith Wiles
Simplify the ifdefs in rte.app.mk to make the code more
readable and maintainable by introducing a internal
_LDLIBS-y variable to build up the LDLIBS variable.

The new internal variable _LDLIBS-y should not be
used outside of the rte.app.mk file.

Signed-off-by: Keith Wiles 
---
 mk/rte.app.mk | 243 +++---
 1 file changed, 61 insertions(+), 182 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index af8a1b0..4fc582a 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014-2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,218 +51,97 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+_LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
 # Order is important: from higher level to lower level
 #
-LDLIBS += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+_LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
+_LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)+= -l$(RTE_LIBNAME)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
+ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)+= -lrte_distributor
+_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)+= -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)+= -lrte_kni
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)+= -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)   += -lrte_pipeline
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)  += -lrte_table
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)   += -lrte_port
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)  += -lrte_timer
+_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)   += -lrte_hash
+_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)   += -lrte_jobstats
+_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)+= -lrte_lpm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)  += -lrte_power
+_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)+= -lrte_acl
+_LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)   += -lpcap

-ifeq ($(CONFIG_RTE_LIBRTE_VHOST)$(CONFIG_RTE_LIBRTE_VHOST_USER),yn)
-LDLIBS += -lfuse
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lfuse
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -libverbs
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)   += -libverbs

-LDLIBS += --start-group
+_LDLIBS-y += --start-group

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
-LDLIBS += -lrte_kvargs
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
-LDLIBS += -lrte_mbuf
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-LDLIBS += -lrte_ip_frag
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
-LDLIBS += -lethdev
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
-LDLIBS += -lrte_cmdline
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),y)
-LDLIBS += -lrte_cfgfile
-endif
-
-ifeq

[dpdk-dev] [PATCH v9 2/2] mk:Introduce the EXTRA_LDLIBS variable

2015-05-13 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..bf18b48 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker library options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index 04f1d4e..7dc2de6 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -411,6 +411,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 333b007..e522c12 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -218,7 +218,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v9 1/2] mk:Simplify the ifdefs in the makefile

2015-05-13 Thread Keith Wiles
Simplify the ifdefs in rte.app.mk to make the code more
readable and maintainable by introducing a internal
_LDLIBS-y variable to build up the LDLIBS variable.

The new internal variable _LDLIBS-y should not be
used outside of the rte.app.mk file.

Signed-off-by: Keith Wiles 
---
 mk/rte.app.mk | 243 +++---
 1 file changed, 61 insertions(+), 182 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index af8a1b0..1a2043a 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014-2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,218 +51,97 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+_LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
 # Order is important: from higher level to lower level
 #
-LDLIBS += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+_LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
+_LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)+= -l$(RTE_LIBNAME)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
+ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)+= -lrte_distributor
+_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)+= -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)+= -lrte_kni
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)+= -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)   += -lrte_pipeline
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)  += -lrte_table
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)   += -lrte_port
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)  += -lrte_timer
+_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)   += -lrte_hash
+_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)   += -lrte_jobstats
+_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)+= -lrte_lpm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)  += -lrte_power
+_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)+= -lrte_acl
+_LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)   += -lpcap

-ifeq ($(CONFIG_RTE_LIBRTE_VHOST)$(CONFIG_RTE_LIBRTE_VHOST_USER),yn)
-LDLIBS += -lfuse
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lfuse
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -libverbs
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)   += -libverbs

-LDLIBS += --start-group
+_LDLIBS-y += --start-group

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
-LDLIBS += -lrte_kvargs
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
-LDLIBS += -lrte_mbuf
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-LDLIBS += -lrte_ip_frag
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
-LDLIBS += -lethdev
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
-LDLIBS += -lrte_cmdline
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),y)
-LDLIBS += -lrte_cfgfile
-endif
-
-ifeq

[dpdk-dev] [PATCH v8 2/2] mk:Update Docs for new EXTRA_LDLIBS variable

2015-05-12 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index 5bfef58..50bfe34 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 333b007..e522c12 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -218,7 +218,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v8 1/2] mk:Simplify the ifdefs in rte.app.mk

2015-05-12 Thread Keith Wiles
Simplify the ifdefs in rte.app.mk to make the code more
readable and maintainable by moving LDLIBS variable to
use the same style as LDLIBS-y being used in the rest
of the code. The new internal variable _LDLIBS should
not be used outside of the rte.app.mk file.

Signed-off-by: Keith Wiles 
---
 mk/rte.app.mk | 242 +++---
 1 file changed, 60 insertions(+), 182 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..b8030d2 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014-2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+_LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+_LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+_LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)+= -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)+= -lrte_distributor
+_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)+= -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)+= -lrte_kni
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)+= -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)   += -lrte_pipeline
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)  += -lrte_table
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)   += -lrte_port
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)  += -lrte_timer
+_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)   += -lrte_hash
+_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)   += -lrte_jobstats
+_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)+= -lrte_lpm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)  += -lrte_power
+_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)+= -lrte_acl
+_LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)   += -lpcap

-ifeq ($(CONFIG_RTE_LIBRTE_VHOST)$(CONFIG_RTE_LIBRTE_VHOST_USER),yn)
-LDLIBS += -lfuse
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lfuse
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -libverbs
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)   += -libverbs

-LDLIBS += --start-group
+_LDLIBS-y += --start-group

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
-LDLIBS += -lrte_kvargs
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
-LDLIBS += -lrte_mbuf
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-LDLIBS += -lrte_ip_frag
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
-LDLIBS += -lethdev
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
-LDLIBS += -lrte_cmdline
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),y

[dpdk-dev] [PATCH v7 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-05-11 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index 5bfef58..50bfe34 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 333b007..e522c12 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -218,7 +218,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v7 1/2] Simplify the ifdefs in rte.app.mk

2015-05-11 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly. The new internal variable _LDLIBS
should not be used outside of the rte.app.mk file.

Signed-off-by: Keith Wiles 
---
 mk/rte.app.mk | 242 +++---
 1 file changed, 60 insertions(+), 182 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..b8030d2 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014-2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+_LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+_LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+_LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)+= -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)+= -lrte_distributor
+_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)+= -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)+= -lrte_kni
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)+= -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)   += -lrte_pipeline
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)  += -lrte_table
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)   += -lrte_port
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)  += -lrte_timer
+_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)   += -lrte_hash
+_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)   += -lrte_jobstats
+_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)+= -lrte_lpm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)  += -lrte_power
+_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)+= -lrte_acl
+_LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)   += -lpcap

-ifeq ($(CONFIG_RTE_LIBRTE_VHOST)$(CONFIG_RTE_LIBRTE_VHOST_USER),yn)
-LDLIBS += -lfuse
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lfuse
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -libverbs
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)   += -libverbs

-LDLIBS += --start-group
+_LDLIBS-y += --start-group

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
-LDLIBS += -lrte_kvargs
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
-LDLIBS += -lrte_mbuf
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-LDLIBS += -lrte_ip_frag
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
-LDLIBS += -lethdev
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS

[dpdk-dev] [PATCH] Remove NO_AUTOLIBS option

2015-05-01 Thread Keith Wiles
NO_AUTOLIBS is not required as it was not used or defined in the config files.

Signed-off-by: Keith Wiles 
---
 mk/rte.app.mk | 5 -
 1 file changed, 5 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index b8030d2..b63e346 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -54,11 +54,8 @@ endif
 _LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
-# Include libraries depending on config if NO_AUTOLIBS is not set
 # Order is important: from higher level to lower level
 #
-ifeq ($(NO_AUTOLIBS),)
-
 _LDLIBS-y += --whole-archive

 _LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)+= -l$(RTE_LIBNAME)
@@ -143,8 +140,6 @@ _LDLIBS-y += $(EXECENV_LDLIBS)
 _LDLIBS-y += --end-group
 _LDLIBS-y += --no-whole-archive

-endif # ifeq ($(NO_AUTOLIBS),)
-
 LDLIBS += $(_LDLIBS-y) $(EXTRA_LDLIBS)

 .PHONY: all
-- 
2.3.0



[dpdk-dev] [PATCH v6 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-05-01 Thread Keith Wiles
Removed the LDLIBS-y reference as it is not required.

Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/build_app.rst  | 2 +-
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/build_app.rst 
b/doc/guides/prog_guide/build_app.rst
index d4a3261..983a48d 100644
--- a/doc/guides/prog_guide/build_app.rst
+++ b/doc/guides/prog_guide/build_app.rst
@@ -123,6 +123,6 @@ chapter for details.

 *   CPPFLAGS: The flags to use to provide flags to the C preprocessor (only 
useful when assembling .S files)

-*   LDLIBS: A list of libraries to link with (for example, -L /path/to/libfoo 
- lfoo)
+*   LDLIBS: A list of libraries to link with (for example, -L /path/to/libfoo 
- lfoo) Use EXTRA_LDLIBS to add more options.

 *   NO_AUTOLIBS: If set, the libraries provided by the framework will not be 
included in the LDLIBS variable automatically.
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index cf5c96f..b8ef167 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 4f30192..fdc5fea 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -205,7 +205,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v6 1/2] Simplify the ifdefs in rte.app.mk.

2015-05-01 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly. The new internal variable _LDLIBS
should not be used outside of the rte.app.mk file. The makefiles
can still use LDLIBS, but I would suggest using EXTRA_LDLIBS instead.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 242 +
 3 files changed, 63 insertions(+), 185 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..b8030d2 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014-2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+_LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+_LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+_LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)+= -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)+= -lrte_distributor
+_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)+= -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)+= -lrte_kni
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)+= -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)   += -lrte_pipeline
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)  += -lrte_table
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)   += -lrte_port
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)  += -lrte_timer
+_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)   += -lrte_hash
+_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)   += -lrte_jobstats
+_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)+= -lrte_lpm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)  += -lrte_power
+_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)+= -lrte_acl
+_LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

 endif

[dpdk-dev] [PATCH v5 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-30 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/build_app.rst  | 2 +-
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/build_app.rst 
b/doc/guides/prog_guide/build_app.rst
index d4a3261..0680dee 100644
--- a/doc/guides/prog_guide/build_app.rst
+++ b/doc/guides/prog_guide/build_app.rst
@@ -123,6 +123,6 @@ chapter for details.

 *   CPPFLAGS: The flags to use to provide flags to the C preprocessor (only 
useful when assembling .S files)

-*   LDLIBS: A list of libraries to link with (for example, -L /path/to/libfoo 
- lfoo)
+*   LDLIBS-y: A list of libraries to link with (for example, -L 
/path/to/libfoo - lfoo) Use EXTRA_LDLIBS to add more options.

 *   NO_AUTOLIBS: If set, the libraries provided by the framework will not be 
included in the LDLIBS variable automatically.
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index cf5c96f..b8ef167 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 4f30192..fdc5fea 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -205,7 +205,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v5 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-30 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly. The new internal variable _LDLIBS
should not be used outside of the rte.app.mk file. The makefiles
can still use LDLIBS, but I would suggest using EXTRA_LDLIBS instead.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 242 +
 3 files changed, 63 insertions(+), 185 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..b8030d2 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014-2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+_LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+_LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+_LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)+= -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)+= -lrte_distributor
+_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)+= -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)+= -lrte_kni
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)+= -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)   += -lrte_pipeline
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)  += -lrte_table
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)   += -lrte_port
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)  += -lrte_timer
+_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)   += -lrte_hash
+_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)   += -lrte_jobstats
+_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)+= -lrte_lpm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)  += -lrte_power
+_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)+= -lrte_acl
+_LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

 endif

[dpdk-dev] [PATCH v4 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/build_app.rst  | 2 +-
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/build_app.rst 
b/doc/guides/prog_guide/build_app.rst
index d4a3261..0680dee 100644
--- a/doc/guides/prog_guide/build_app.rst
+++ b/doc/guides/prog_guide/build_app.rst
@@ -123,6 +123,6 @@ chapter for details.

 *   CPPFLAGS: The flags to use to provide flags to the C preprocessor (only 
useful when assembling .S files)

-*   LDLIBS: A list of libraries to link with (for example, -L /path/to/libfoo 
- lfoo)
+*   LDLIBS-y: A list of libraries to link with (for example, -L 
/path/to/libfoo - lfoo) Use EXTRA_LDLIBS to add more options.

 *   NO_AUTOLIBS: If set, the libraries provided by the framework will not be 
included in the LDLIBS variable automatically.
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index cf5c96f..b8ef167 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 4f30192..fdc5fea 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -205,7 +205,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v4 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 254 ++---
 mk/rte.hostapp.mk  |   4 +-
 mk/rte.shared.mk   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..c41de82 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
+LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)   += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif

[dpdk-dev] [PATCH v3 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/build_app.rst  | 2 +-
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/build_app.rst 
b/doc/guides/prog_guide/build_app.rst
index d4a3261..0680dee 100644
--- a/doc/guides/prog_guide/build_app.rst
+++ b/doc/guides/prog_guide/build_app.rst
@@ -123,6 +123,6 @@ chapter for details.

 *   CPPFLAGS: The flags to use to provide flags to the C preprocessor (only 
useful when assembling .S files)

-*   LDLIBS: A list of libraries to link with (for example, -L /path/to/libfoo 
- lfoo)
+*   LDLIBS-y: A list of libraries to link with (for example, -L 
/path/to/libfoo - lfoo) Use EXTRA_LDLIBS to add more options.

 *   NO_AUTOLIBS: If set, the libraries provided by the framework will not be 
included in the LDLIBS variable automatically.
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index cf5c96f..b8ef167 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 4f30192..fdc5fea 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -205,7 +205,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v3 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 254 ++---
 mk/rte.hostapp.mk  |   4 +-
 mk/rte.shared.mk   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..ed471ad 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
+LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)   += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+LDLIBS

[dpdk-dev] [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index cf5c96f..b8ef167 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 4f30192..fdc5fea 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -205,7 +205,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v2 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 254 ++---
 mk/rte.hostapp.mk  |   4 +-
 mk/rte.shared.mk   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..ed471ad 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
+LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)   += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+LDLIBS

[dpdk-dev] [PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-28 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 254 ++---
 mk/rte.hostapp.mk  |   4 +-
 mk/rte.shared.mk   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..ed471ad 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
+LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)   += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+LDLIBS

[dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-28 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Signed-off-by: Keith Wiles 
---
 mk/rte.app.mk | 253 ++
 mk/rte.hostapp.mk |   4 +-
 mk/rte.shared.mk  |  12 +--
 3 files changed, 74 insertions(+), 195 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..af38975 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,94 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-CONFIG_RTE_BUILD_COMBINE_LIBS)  += -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)+= -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)+= -lrte_reorder

-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
+ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)+= -lrte_kni
+LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)+= -lrte_ivshmem
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)   += -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)  += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)   += -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)  += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)   += -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)   += -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)+= -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)  += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)+= -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)   += -lpcap

 ifeq ($(CONFIG_RTE_LIBRTE_VHOST)$(CONFIG_RTE_LIBRTE_VHOST_USER),yn)
-LDLIBS += -lfuse
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lfuse
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -libverbs
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)   += -libverbs

-LDLIBS += --start-group
+LDLIBS-y += --start-group

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
-LDLIBS += -lrte_kvargs
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
-LDLIBS += -lrte_mbuf
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-LDLIBS += -lrte_ip_frag
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
-LDLIBS += -lethdev
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif

[dpdk-dev] [RFC PATCH 4/4 v2] Update PMD files for new common device support

2015-04-13 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 lib/librte_pmd_af_packet/rte_eth_af_packet.c |  38 +--
 lib/librte_pmd_bond/rte_eth_bond_8023ad.c|  18 +-
 lib/librte_pmd_bond/rte_eth_bond_alb.c   |  10 +-
 lib/librte_pmd_bond/rte_eth_bond_api.c   | 142 +-
 lib/librte_pmd_bond/rte_eth_bond_args.c  |   2 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c   | 164 +--
 lib/librte_pmd_bond/rte_eth_bond_private.h   |   2 +-
 lib/librte_pmd_e1000/em_ethdev.c | 156 +--
 lib/librte_pmd_e1000/em_rxtx.c   |  94 +++
 lib/librte_pmd_e1000/igb_ethdev.c| 302 ++---
 lib/librte_pmd_e1000/igb_pf.c|  86 +++---
 lib/librte_pmd_e1000/igb_rxtx.c  | 168 ++--
 lib/librte_pmd_enic/enic.h   |   4 +-
 lib/librte_pmd_enic/enic_ethdev.c| 140 +-
 lib/librte_pmd_enic/enic_main.c  |  30 +-
 lib/librte_pmd_fm10k/fm10k_ethdev.c  | 154 +--
 lib/librte_pmd_fm10k/fm10k_rxtx.c|   4 +-
 lib/librte_pmd_i40e/i40e_ethdev.c| 172 ++--
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 194 ++---
 lib/librte_pmd_i40e/i40e_fdir.c  |  28 +-
 lib/librte_pmd_i40e/i40e_pf.c|   8 +-
 lib/librte_pmd_i40e/i40e_rxtx.c  |  88 +++---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c  | 392 +--
 lib/librte_pmd_ixgbe/ixgbe_fdir.c|  50 ++--
 lib/librte_pmd_ixgbe/ixgbe_pf.c  | 114 
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c| 276 +--
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c|   6 +-
 lib/librte_pmd_mlx4/mlx4.c   |   2 +-
 lib/librte_pmd_null/rte_eth_null.c   |  36 +--
 lib/librte_pmd_pcap/rte_eth_pcap.c   |   2 +-
 lib/librte_pmd_ring/rte_eth_ring.c   |  36 +--
 lib/librte_pmd_virtio/virtio_ethdev.c| 120 
 lib/librte_pmd_virtio/virtio_rxtx.c  |  20 +-
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c  |  64 ++---
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c|  40 +--
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c |   2 +-
 36 files changed, 1580 insertions(+), 1584 deletions(-)

diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c 
b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
index 2ac50ba..4735fb3 100644
--- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
+++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
@@ -231,7 +231,7 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
 static int
 eth_dev_start(struct rte_eth_dev *dev)
 {
-   dev->data->dev_link.link_status = 1;
+   ETH_DATA(dev)->dev_link.link_status = 1;
return 0;
 }

@@ -243,7 +243,7 @@ eth_dev_stop(struct rte_eth_dev *dev)
 {
unsigned i;
int sockfd;
-   struct pmd_internals *internals = dev->data->dev_private;
+   struct pmd_internals *internals = _DD_PRIVATE(dev);

for (i = 0; i < internals->nb_queues; i++) {
sockfd = internals->rx_queue[i].sockfd;
@@ -254,7 +254,7 @@ eth_dev_stop(struct rte_eth_dev *dev)
close(sockfd);
}

-   dev->data->dev_link.link_status = 0;
+   ETH_DATA(dev)->dev_link.link_status = 0;
 }

 static int
@@ -266,16 +266,16 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
 static void
 eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
-   struct pmd_internals *internals = dev->data->dev_private;
+   struct pmd_internals *internals = _DD_PRIVATE(dev);

-   dev_info->driver_name = drivername;
-   dev_info->if_index = internals->if_index;
+   dev_info->di.driver_name = drivername;
+   dev_info->di.if_index = internals->if_index;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
dev_info->max_rx_queues = (uint16_t)internals->nb_queues;
dev_info->max_tx_queues = (uint16_t)internals->nb_queues;
dev_info->min_rx_bufsize = 0;
-   dev_info->pci_dev = NULL;
+   dev_info->di.pci_dev = NULL;
 }

 static void
@@ -283,7 +283,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats 
*igb_stats)
 {
unsigned i, imax;
unsigned long rx_total = 0, tx_total = 0, tx_err_total = 0;
-   const struct pmd_internals *internal = dev->data->dev_private;
+   const struct pmd_internals *internal = _DD_PRIVATE(dev);

imax = (internal->nb_queues < RTE_ETHDEV_QUEUE_STAT_CNTRS ?
internal->nb_queues : RTE_ETHDEV_QUEUE_STAT_CNTRS);
@@ -310,7 +310,7 @@ static void
 eth_stats_reset(struct rte_eth_dev *dev)
 {
unsigned i;
-   struct pmd_internals *internal = dev->data->dev_private;
+   struct pmd_internals *internal = _DD_PRIVATE(dev);

for (i = 0; i < internal->nb_queues; i++)
  

[dpdk-dev] [RFC PATCH 3/4 v2] Add the test file changes for common device support

2015-04-13 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 app/test-pmd/config.c |   6 +-
 app/test-pmd/testpmd.h|   4 +-
 app/test/test_kni.c   |  12 ++--
 app/test/test_link_bonding.c  |  24 
 app/test/virtual_pmd.c| 106 +-
 examples/link_status_interrupt/main.c |   6 +-
 6 files changed, 79 insertions(+), 79 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index f788ed5..6e70add 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -415,7 +415,7 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
   (unsigned)reg_off);
return 1;
}
-   pci_len = ports[port_id].dev_info.pci_dev->mem_resource[0].len;
+   pci_len = ports[port_id].dev_info.di.pci_dev->mem_resource[0].len;
if (reg_off >= pci_len) {
printf("Port %d: register offset %u (0x%X) out of port PCI "
   "resource (length=%"PRIu64")\n",
@@ -641,7 +641,7 @@ ring_dma_zone_lookup(const char *ring_name, uint8_t 
port_id, uint16_t q_id)
const struct rte_memzone *mz;

snprintf(mz_name, sizeof(mz_name), "%s_%s_%d_%d",
-ports[port_id].dev_info.driver_name, ring_name, port_id, q_id);
+ports[port_id].dev_info.di.driver_name, ring_name, port_id, 
q_id);
mz = rte_memzone_lookup(mz_name);
if (mz == NULL)
printf("%s ring memory zoneof (port %d, queue %d) not"
@@ -698,7 +698,7 @@ ring_rx_descriptor_display(const struct rte_memzone 
*ring_mz,

memset(_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, _info);
-   if (strstr(dev_info.driver_name, "i40e") != NULL) {
+   if (strstr(dev_info.di.driver_name, "i40e") != NULL) {
/* 32 bytes RX descriptor, i40e only */
struct igb_ring_desc_32_bytes *ring =
(struct igb_ring_desc_32_bytes *)ring_mz->addr;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 389fc24..af4e280 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -438,7 +438,7 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
uint32_t reg_v;

reg_addr = (void *)
-   ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
+   ((char *)port->dev_info.di.pci_dev->mem_resource[0].addr +
reg_off);
reg_v = *((volatile uint32_t *)reg_addr);
return rte_le_to_cpu_32(reg_v);
@@ -453,7 +453,7 @@ port_pci_reg_write(struct rte_port *port, uint32_t reg_off, 
uint32_t reg_v)
void *reg_addr;

reg_addr = (void *)
-   ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
+   ((char *)port->dev_info.di.pci_dev->mem_resource[0].addr +
reg_off);
*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
 }
diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 608901d..456dd65 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -387,8 +387,8 @@ test_kni_processing(uint8_t port_id, struct rte_mempool *mp)
memset(, 0, sizeof(ops));

rte_eth_dev_info_get(port_id, );
-   conf.addr = info.pci_dev->addr;
-   conf.id = info.pci_dev->id;
+   conf.addr = info.di.pci_dev->addr;
+   conf.id = info.di.pci_dev->id;
snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);

/* core id 1 configured for kernel thread */
@@ -555,8 +555,8 @@ test_kni(void)
memset(, 0, sizeof(conf));
memset(, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, );
-   conf.addr = info.pci_dev->addr;
-   conf.id = info.pci_dev->id;
+   conf.addr = info.di.pci_dev->addr;
+   conf.id = info.di.pci_dev->id;
conf.group_id = (uint16_t)port_id;
conf.mbuf_size = MAX_PACKET_SZ;

@@ -584,8 +584,8 @@ test_kni(void)
memset(, 0, sizeof(info));
memset(, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, );
-   conf.addr = info.pci_dev->addr;
-   conf.id = info.pci_dev->id;
+   conf.addr = info.di.pci_dev->addr;
+   conf.id = info.di.pci_dev->id;
conf.group_id = (uint16_t)port_id;
conf.mbuf_size = MAX_PACKET_SZ;

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 8c24314..20e74c3 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -1179,7 +1179,7 @@ int test_lsc_interrupt_count;

 static void
 test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,
-   enum rte_eth_event_type type  __rte_unused, void *param 
__rte_unused)
+   enum rte_dev_event_type type  __rte_unused, void *param 
__rte_unused)
 {
pthread_mutex_lock();
test_lsc_interrupt_count++;
@@ -123

[dpdk-dev] [RFC PATCH 2/4 v2] Add the ethdev changes for multiple device support

2015-04-13 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 lib/librte_ether/rte_ethdev.c | 944 +-
 lib/librte_ether/rte_ethdev.h | 340 ---
 2 files changed, 466 insertions(+), 818 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e20cca5..0c68d8d 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -77,38 +77,20 @@
 #define PMD_DEBUG_TRACE(fmt, args...)
 #endif

-/* Macros for checking for restricting functions to primary instance only */
-#define PROC_PRIMARY_OR_ERR_RET(retval) do { \
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-   PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
-   return (retval); \
-   } \
-} while(0)
-#define PROC_PRIMARY_OR_RET() do { \
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-   PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
-   return; \
-   } \
-} while(0)
-
-/* Macros to check for invlaid function pointers in dev_ops structure */
-#define FUNC_PTR_OR_ERR_RET(func, retval) do { \
-   if ((func) == NULL) { \
-   PMD_DEBUG_TRACE("Function not supported\n"); \
-   return (retval); \
-   } \
-} while(0)
-#define FUNC_PTR_OR_RET(func) do { \
-   if ((func) == NULL) { \
-   PMD_DEBUG_TRACE("Function not supported\n"); \
-   return; \
-   } \
-} while(0)
-
-static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
 struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
-static struct rte_eth_dev_data *rte_eth_dev_data = NULL;
-static uint8_t nb_ports = 0;
+
+static struct eth_dev_global eth_globals = {
+.devs   = _eth_devices[0],
+.data   = NULL,
+.nb_ports   = 0,
+.max_ports  = RTE_MAX_ETHPORTS,
+.dflt_mtu   = ETHER_MTU,
+.dev_size   = sizeof(struct rte_eth_dev),
+.data_size  = sizeof(struct rte_eth_dev_data),
+.mz_dev_data= "rte_eth_dev_data"
+};
+
+struct eth_dev_global * rte_eth_globals = _globals;

 /* spinlock for eth device callbacks */
 static rte_spinlock_t rte_eth_dev_cb_lock = RTE_SPINLOCK_INITIALIZER;
@@ -155,49 +137,30 @@ static struct rte_eth_xstats_name_off 
rte_txq_stats_strings[] = {
sizeof(rte_txq_stats_strings[0]))


-/**
- * The user application callback description.
- *
- * It contains callback address to be registered by user application,
- * the pointer to the parameters for callback, and the event type.
- */
-struct rte_eth_dev_callback {
-   TAILQ_ENTRY(rte_eth_dev_callback) next; /**< Callbacks list */
-   rte_eth_dev_cb_fn cb_fn;/**< Callback address */
-   void *cb_arg;   /**< Parameter for callback */
-   enum rte_eth_event_type event;  /**< Interrupt event type */
-   uint32_t active;/**< Callback is executing */
-};
-
 enum {
STAT_QMAP_TX = 0,
STAT_QMAP_RX
 };

-enum {
-   DEV_DETACHED = 0,
-   DEV_ATTACHED
-};
-
 static inline void
 rte_eth_dev_data_alloc(void)
 {
const unsigned flags = 0;
const struct rte_memzone *mz;

-   if (rte_eal_process_type() == RTE_PROC_PRIMARY){
-   mz = rte_memzone_reserve(MZ_RTE_ETH_DEV_DATA,
-   RTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data),
+   if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+   mz = rte_memzone_reserve(eth_globals.mz_dev_data,
+   eth_globals.max_ports * eth_globals.data_size,
rte_socket_id(), flags);
} else
-   mz = rte_memzone_lookup(MZ_RTE_ETH_DEV_DATA);
+   mz = rte_memzone_lookup(eth_globals.mz_dev_data);
if (mz == NULL)
rte_panic("Cannot allocate memzone for ethernet port data\n");

-   rte_eth_dev_data = mz->addr;
+   eth_globals.data = mz->addr;
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-   memset(rte_eth_dev_data, 0,
-   RTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data));
+   memset(eth_globals.data, 0,
+   eth_globals.max_ports * eth_globals.data_size);
 }

 struct rte_eth_dev *
@@ -205,9 +168,9 @@ rte_eth_dev_allocated(const char *name)
 {
unsigned i;

-   for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+   for (i = 0; i < eth_globals.max_ports; i++) {
if ((rte_eth_devices[i].attached == DEV_ATTACHED) &&
-   strcmp(rte_eth_devices[i].data->name, name) == 0)
+   strcmp(_DD(_eth_devices[i], name), name) == 0)
return _eth_devices[i];
}
return NULL;
@@ -218,26 +181,26 @@ rte_eth_dev_find_fr

[dpdk-dev] [RFC PATCH 1/4 v2] Adding the common device files for multiple device support

2015-04-13 Thread Keith Wiles
Add the eal_common_device.c and rte_common_device.h and include the
build support changes.

Signed-off-by: Keith Wiles 
---
 lib/librte_eal/bsdapp/eal/Makefile|   1 +
 lib/librte_eal/common/Makefile|   1 +
 lib/librte_eal/common/eal_common_device.c | 185 ++
 lib/librte_eal/common/include/rte_common_device.h | 674 ++
 lib/librte_eal/common/include/rte_log.h   |   1 +
 lib/librte_eal/linuxapp/eal/Makefile  |   1 +
 lib/librte_kni/rte_kni.c  |   4 +-
 7 files changed, 865 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_device.c
 create mode 100644 lib/librte_eal/common/include/rte_common_device.h

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 2357cfa..7bb2689 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -78,6 +78,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_device.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 3ea3bbf..c4bf805 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -40,6 +40,7 @@ INC += rte_string_fns.h rte_version.h
 INC += rte_eal_memconfig.h rte_malloc_heap.h
 INC += rte_hexdump.h rte_devargs.h rte_dev.h
 INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
+INC += rte_common_device.h

 ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)
 INC += rte_warnings.h
diff --git a/lib/librte_eal/common/eal_common_device.c 
b/lib/librte_eal/common/eal_common_device.c
new file mode 100644
index 000..a9ef925
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_device.c
@@ -0,0 +1,185 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2014 6WIND S.A.
+ *   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 "rte_common_device.h"
+
+void *
+rte_dev_add_callback(struct rte_dev_rxtx_callback ** cbp,
+   void * fn, void *user_param)
+{
+   struct rte_dev_rxtx_callback *cb;
+
+   cb = rte_zmalloc(NULL, sizeof(*cb), 0);
+
+   if (cb == NULL) {
+   rte_errno = ENOMEM;
+   return NULL;
+   }
+
+   cb->fn.vp = fn;
+   cb->param = user_param;
+   cb->next = *cbp;
+   *cbp = cb;
+   return cb;
+}
+
+int
+rte_dev_remove_callback(struct rte_dev_rxtx_callback ** cbp,
+   struct rte_dev_rxtx_callback *user_cb)
+{
+   struct rte_dev_rxtx_callback *cb = *cbp;
+   struct rte_dev_rxtx_callback *prev_cb;
+
+   /* Reset head pointer and remove user cb if first in the list. */
+   if (cb == user_cb) {
+   *cbp = user_cb->next;
+   return 0;
+   }
+
+   /* Remove the user cb from the callback list. */
+   do {
+   prev_cb = cb;
+   cb = cb->next;

[dpdk-dev] [RFC PATCH 0/4 v2] Extending DPDK with multiple device support

2015-04-13 Thread Keith Wiles
Hi All,

Here is a set of RFC patches to update DPDK to support a generic set of
devices. The patches that follow create two files eal_common_device.h
and rte_common_device.c and then a few items in rte_ethdev.[ch] were moved
to cleanup those files by moving the device generic values and functions
into a common set of device generic files.

In the rte_common_device.h file are a couple of macros to abstract a few
common items from rte_ethdev.h which are not ethernet specific. These
generic device specific structure members are place into macros to be
placed at the top of each new device type crypto, hardware offload, dpi,
compression and possible others to be defined later. In version 2 I used
nested structures a bit cleaner from the macro design, but modified a lot
more files.

Most of the changes are to update the code to locate the new location of
the members in the nested structures. To not try and rewrite code I
used macros to help hide the changes, but these constructs are now used
in a lot of files withint DPDK.

I did not pull the Rx/Tx Routines into a common function, but it could be
done if everyone agrees. It does not mean every device will use a common
Rx/Tx routine. Without pulling Rx/Tx routines into a common file allows
the device writer to have similar or different set of routines.

These patches do not contain any new devices as these are being work on
today. I could have included the DPI (dpidev) routines we did in the PoC,
but the DPI is not open source.

More cleanup of ethdev could be done to remove NIC specific features not
supported in all devices and someone needs to do that cleanup IMO.

The code is untested and I wanted to get something our for others to poke
at today and more could be pulled out of ethdev as well. I/We will be
looking at testing the code as we get more completed.

I have not finished up the crypto APIs yet, but I am planning to work on
those additions today. The crypto code we are using is the Quick Assist
code found on 01.org, but we need to update the code to be move DPDK
friendly.

The QAT code does have a modified like API similar to Linux Kernel crypto
API and I want to review that code first.

Regards,
++Keith


Keith Wiles (4):
  Adding the common device files for multiple device support
  Add the ethdev changes for multiple device support
  Add the test file changes for common device support
  Update PMD files for new common device support

 app/test-pmd/config.c |   6 +-
 app/test-pmd/testpmd.h|   4 +-
 app/test/test_kni.c   |  12 +-
 app/test/test_link_bonding.c  |  24 +-
 app/test/virtual_pmd.c| 106 +--
 examples/link_status_interrupt/main.c |   6 +-
 lib/librte_eal/bsdapp/eal/Makefile|   1 +
 lib/librte_eal/common/Makefile|   1 +
 lib/librte_eal/common/eal_common_device.c | 185 +
 lib/librte_eal/common/include/rte_common_device.h | 674 +++
 lib/librte_eal/common/include/rte_log.h   |   1 +
 lib/librte_eal/linuxapp/eal/Makefile  |   1 +
 lib/librte_ether/rte_ethdev.c | 944 +-
 lib/librte_ether/rte_ethdev.h | 340 ++--
 lib/librte_kni/rte_kni.c  |   4 +-
 lib/librte_pmd_af_packet/rte_eth_af_packet.c  |  38 +-
 lib/librte_pmd_bond/rte_eth_bond_8023ad.c |  18 +-
 lib/librte_pmd_bond/rte_eth_bond_alb.c|  10 +-
 lib/librte_pmd_bond/rte_eth_bond_api.c| 142 ++--
 lib/librte_pmd_bond/rte_eth_bond_args.c   |   2 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c| 164 ++--
 lib/librte_pmd_bond/rte_eth_bond_private.h|   2 +-
 lib/librte_pmd_e1000/em_ethdev.c  | 156 ++--
 lib/librte_pmd_e1000/em_rxtx.c|  94 +--
 lib/librte_pmd_e1000/igb_ethdev.c | 302 +++
 lib/librte_pmd_e1000/igb_pf.c |  86 +-
 lib/librte_pmd_e1000/igb_rxtx.c   | 168 ++--
 lib/librte_pmd_enic/enic.h|   4 +-
 lib/librte_pmd_enic/enic_ethdev.c | 140 ++--
 lib/librte_pmd_enic/enic_main.c   |  30 +-
 lib/librte_pmd_fm10k/fm10k_ethdev.c   | 154 ++--
 lib/librte_pmd_fm10k/fm10k_rxtx.c |   4 +-
 lib/librte_pmd_i40e/i40e_ethdev.c | 172 ++--
 lib/librte_pmd_i40e/i40e_ethdev_vf.c  | 194 ++---
 lib/librte_pmd_i40e/i40e_fdir.c   |  28 +-
 lib/librte_pmd_i40e/i40e_pf.c |   8 +-
 lib/librte_pmd_i40e/i40e_rxtx.c   |  88 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c   | 392 -
 lib/librte_pmd_ixgbe/ixgbe_fdir.c |  50 +-
 lib/librte_pmd_ixgbe/ixgbe_pf.c   | 114 ++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 276 +++
 lib/librte_pmd_ixgbe

[dpdk-dev] [RFC PATCH 4/4] Update the rte_ethdev.[ch] files for the new device generic changes.

2015-04-08 Thread Keith Wiles
rte_ethdev.c (main points):
  - Collect up the globals and static variables in the file into a new 
rte_eth_globals structure.
  - Update the global references to use the new global structure
  - Move parts of the callback routines into eal_common_device.c to all other 
device a common routine
  - Moved the debug macros PROC_PRIMARY_OR_ERR_RET, PROC_PRIMARY_OR_RET, 
FUNC_PTR_OR_ERR_RET and
FUNC_PTR_OR_RET into the rte_common_device.h as a common macro between 
devices.

rte_ethdev.h (main points):
  - Replace the first couple members in rte_eth_dev_info to commmon macro
  - Remove rte_eth_dev_cb_list define an use common rte_dev_cb_list instead
  - Move eth_[rt]x_burst_t to dev_[rt]x_burst_t in eal_common_device.h
  - Move rte_[rt]x_callback typedefs to eal_common_device.h as they are generic
  - Move rte_eth_dev_type to eal_common_device.h and rename to rte_dev_type
  - Move rte_eth_event_type to eal_common_device.h and rename to 
rte_dev_event_type
  - Replace the content of rte_eth_dev with macro RTE_COMMON_DEV in 
eal_common_device.h
Replace part of the content of rte_eth_dev_data with macro 
RTE_COMMON_DEV_DATA
Replace part of the content of rte_eth_dev_info with macro 
RTE_COMMON_DEV_INFO
  - Added the new global device structure to hold device local data instead of 
globals.
  - Some of the simple functions rte_eth_dev_count and others now call 
rte_dev_count() via macro.

The eal_common_device.c and rte_common_device.h could merged into 
eal_common_dev.c and
rte_common_dev.h, which is not done here as to not effect those files.

Signed-off-by: Keith Wiles 
---
 lib/librte_ether/rte_ethdev.c | 290 +-
 lib/librte_ether/rte_ethdev.h | 225 ++--
 2 files changed, 126 insertions(+), 389 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e20cca5..84cef16 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -77,38 +77,20 @@
 #define PMD_DEBUG_TRACE(fmt, args...)
 #endif

-/* Macros for checking for restricting functions to primary instance only */
-#define PROC_PRIMARY_OR_ERR_RET(retval) do { \
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-   PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
-   return (retval); \
-   } \
-} while(0)
-#define PROC_PRIMARY_OR_RET() do { \
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-   PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
-   return; \
-   } \
-} while(0)
-
-/* Macros to check for invlaid function pointers in dev_ops structure */
-#define FUNC_PTR_OR_ERR_RET(func, retval) do { \
-   if ((func) == NULL) { \
-   PMD_DEBUG_TRACE("Function not supported\n"); \
-   return (retval); \
-   } \
-} while(0)
-#define FUNC_PTR_OR_RET(func) do { \
-   if ((func) == NULL) { \
-   PMD_DEBUG_TRACE("Function not supported\n"); \
-   return; \
-   } \
-} while(0)
-
-static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
 struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
-static struct rte_eth_dev_data *rte_eth_dev_data = NULL;
-static uint8_t nb_ports = 0;
+
+static struct rte_eth_global eth_globals = {
+.devs   = _eth_devices[0],
+.data   = NULL,
+.nb_ports   = 0,
+.max_ports  = RTE_MAX_ETHPORTS,
+.dflt_mtu   = ETHER_MTU,
+.dev_size   = sizeof(struct rte_eth_dev),
+.data_size  = sizeof(struct rte_eth_dev_data),
+.mz_dev_data= "rte_eth_dev_data"
+};
+
+struct rte_eth_global * rte_eth_globals = _globals;

 /* spinlock for eth device callbacks */
 static rte_spinlock_t rte_eth_dev_cb_lock = RTE_SPINLOCK_INITIALIZER;
@@ -155,30 +137,11 @@ static struct rte_eth_xstats_name_off 
rte_txq_stats_strings[] = {
sizeof(rte_txq_stats_strings[0]))


-/**
- * The user application callback description.
- *
- * It contains callback address to be registered by user application,
- * the pointer to the parameters for callback, and the event type.
- */
-struct rte_eth_dev_callback {
-   TAILQ_ENTRY(rte_eth_dev_callback) next; /**< Callbacks list */
-   rte_eth_dev_cb_fn cb_fn;/**< Callback address */
-   void *cb_arg;   /**< Parameter for callback */
-   enum rte_eth_event_type event;  /**< Interrupt event type */
-   uint32_t active;/**< Callback is executing */
-};
-
 enum {
STAT_QMAP_TX = 0,
STAT_QMAP_RX
 };

-enum {
-   DEV_DETACHED = 0,
-   DEV_ATTACHED
-};
-
 static inline void
 rte_eth_dev_data_alloc(void)
 {
@@ -186,18 +149,18 @@ rte_eth_dev_data_alloc(void)
const struct rte_memzone *mz;

if (rte_eal_process_type() == RTE_

[dpdk-dev] [RFC PATCH 3/4] Update files to build new device generic common files and headers.

2015-04-08 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 lib/librte_eal/bsdapp/eal/Makefile  | 1 +
 lib/librte_eal/common/Makefile  | 1 +
 lib/librte_eal/common/include/rte_log.h | 1 +
 lib/librte_eal/linuxapp/eal/Makefile| 1 +
 4 files changed, 4 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 2357cfa..7bb2689 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -78,6 +78,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_device.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 3ea3bbf..c4bf805 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -40,6 +40,7 @@ INC += rte_string_fns.h rte_version.h
 INC += rte_eal_memconfig.h rte_malloc_heap.h
 INC += rte_hexdump.h rte_devargs.h rte_dev.h
 INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
+INC += rte_common_device.h

 ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)
 INC += rte_warnings.h
diff --git a/lib/librte_eal/common/include/rte_log.h 
b/lib/librte_eal/common/include/rte_log.h
index f83a0d9..543deb7 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -77,6 +77,7 @@ extern struct rte_logs rte_logs;
 #define RTE_LOGTYPE_PORT0x2000 /**< Log related to port. */
 #define RTE_LOGTYPE_TABLE   0x4000 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE 0x8000 /**< Log related to pipeline. */
+#define RTE_LOGTYPE_DEV 0x0001 /**< Log related to device. */

 /* these log types can be used in an application */
 #define RTE_LOGTYPE_USER1   0x0100 /**< User-defined log type 1. */
diff --git a/lib/librte_eal/linuxapp/eal/Makefile 
b/lib/librte_eal/linuxapp/eal/Makefile
index 01f7b70..935720a 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -90,6 +90,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_device.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 CFLAGS_eal_interrupts.o := -D_GNU_SOURCE
-- 
2.3.0



[dpdk-dev] [RFC PATCH 2/4] Add the new common device header and C file.

2015-04-08 Thread Keith Wiles
Move a number of device specific define, structures and functions
into a generic device base set of files for all device not just Ethernet.

Signed-off-by: Keith Wiles 
---
 lib/librte_eal/common/eal_common_device.c | 185 +++
 lib/librte_eal/common/include/rte_common_device.h | 617 ++
 2 files changed, 802 insertions(+)
 create mode 100644 lib/librte_eal/common/eal_common_device.c
 create mode 100644 lib/librte_eal/common/include/rte_common_device.h

diff --git a/lib/librte_eal/common/eal_common_device.c 
b/lib/librte_eal/common/eal_common_device.c
new file mode 100644
index 000..a9ef925
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_device.c
@@ -0,0 +1,185 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2014 6WIND S.A.
+ *   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 "rte_common_device.h"
+
+void *
+rte_dev_add_callback(struct rte_dev_rxtx_callback ** cbp,
+   void * fn, void *user_param)
+{
+   struct rte_dev_rxtx_callback *cb;
+
+   cb = rte_zmalloc(NULL, sizeof(*cb), 0);
+
+   if (cb == NULL) {
+   rte_errno = ENOMEM;
+   return NULL;
+   }
+
+   cb->fn.vp = fn;
+   cb->param = user_param;
+   cb->next = *cbp;
+   *cbp = cb;
+   return cb;
+}
+
+int
+rte_dev_remove_callback(struct rte_dev_rxtx_callback ** cbp,
+   struct rte_dev_rxtx_callback *user_cb)
+{
+   struct rte_dev_rxtx_callback *cb = *cbp;
+   struct rte_dev_rxtx_callback *prev_cb;
+
+   /* Reset head pointer and remove user cb if first in the list. */
+   if (cb == user_cb) {
+   *cbp = user_cb->next;
+   return 0;
+   }
+
+   /* Remove the user cb from the callback list. */
+   do {
+   prev_cb = cb;
+   cb = cb->next;
+
+   if (cb == user_cb) {
+   prev_cb->next = user_cb->next;
+   return 0;
+   }
+   } while (cb != NULL);
+
+   /* Callback wasn't found. */
+   return (-EINVAL);
+}
+
+int
+rte_dev_callback_register(struct rte_dev_cb_list * cb_list,
+   rte_spinlock_t * lock,
+   enum rte_dev_event_type event,
+   rte_dev_cb_fn cb_fn, void *cb_arg)
+{
+   struct rte_dev_callback *cb;
+
+   rte_spinlock_lock(lock);
+
+   TAILQ_FOREACH(cb, cb_list, next) {
+   if (cb->cb_fn == cb_fn &&
+   cb->cb_arg == cb_arg &&
+   cb->event == event) {
+   break;
+   }
+   }
+
+   /* create a new callback. */
+   if (cb == NULL && (cb = rte_zmalloc("INTR_USER_CALLBACK",
+   sizeof(struct rte_dev_callback), 0)) != NULL) {
+   cb->cb_fn = cb_fn;
+   cb->cb_arg = cb_arg;
+   cb->event = event;
+   TAILQ_INSERT_TAIL(cb_list, cb, next);
+   }
+
+   rte_spinlock_unlock(lock);
+   return ((cb == NULL) ? -ENOMEM : 0);
+}
+
+int
+rte_dev_callback_unregister(struct rte_dev_cb_list * cb_list,
+   rte_spinlock_t * l

[dpdk-dev] [RFC PATCH 1/4] Rename of device types to be generic device names.

2015-04-08 Thread Keith Wiles
Rename the RTE_ETH_PCI, VIRTUAL, ... to be RTE_DEV_PCI, ... names.

Signed-off-by: Keith Wiles 
---
 app/test/test_link_bonding.c | 10 +-
 app/test/virtual_pmd.c   |  4 ++--
 examples/link_status_interrupt/main.c|  6 +++---
 lib/librte_pmd_af_packet/rte_eth_af_packet.c |  2 +-
 lib/librte_pmd_bond/rte_eth_bond_api.c   |  6 +++---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c   | 12 ++--
 lib/librte_pmd_bond/rte_eth_bond_private.h   |  2 +-
 lib/librte_pmd_e1000/em_ethdev.c |  8 
 lib/librte_pmd_e1000/em_rxtx.c   |  4 ++--
 lib/librte_pmd_e1000/igb_ethdev.c|  2 +-
 lib/librte_pmd_i40e/i40e_ethdev.c|  4 ++--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c  |  2 +-
 lib/librte_pmd_mlx4/mlx4.c   |  2 +-
 lib/librte_pmd_null/rte_eth_null.c   |  2 +-
 lib/librte_pmd_pcap/rte_eth_pcap.c   |  2 +-
 lib/librte_pmd_ring/rte_eth_ring.c   |  2 +-
 lib/librte_pmd_virtio/virtio_ethdev.c|  2 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c |  2 +-
 18 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 8c24314..1e1bc01 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -1179,7 +1179,7 @@ int test_lsc_interrupt_count;

 static void
 test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,
-   enum rte_eth_event_type type  __rte_unused, void *param 
__rte_unused)
+   enum rte_dev_event_type type  __rte_unused, void *param 
__rte_unused)
 {
pthread_mutex_lock();
test_lsc_interrupt_count++;
@@ -1231,7 +1231,7 @@ test_status_interrupt(void)

/* register link status change interrupt callback */
rte_eth_dev_callback_register(test_params->bonded_port_id,
-   RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback,
+   RTE_DEV_EVENT_INTR_LSC, test_bonding_lsc_event_callback,
_params->bonded_port_id);

slave_count = 
rte_eth_bond_active_slaves_get(test_params->bonded_port_id,
@@ -1298,7 +1298,7 @@ test_status_interrupt(void)

/* unregister lsc callback before exiting */
rte_eth_dev_callback_unregister(test_params->bonded_port_id,
-   RTE_ETH_EVENT_INTR_LSC, 
test_bonding_lsc_event_callback,
+   RTE_DEV_EVENT_INTR_LSC, 
test_bonding_lsc_event_callback,
_params->bonded_port_id);

/* Clean up and remove slaves from bonded device */
@@ -2031,7 +2031,7 @@ 
test_roundrobin_verfiy_polling_slave_link_status_change(void)

/* Register link status change interrupt callback */
rte_eth_dev_callback_register(test_params->bonded_port_id,
-   RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback,
+   RTE_DEV_EVENT_INTR_LSC, test_bonding_lsc_event_callback,
_params->bonded_port_id);

/* link status change callback for first slave link up */
@@ -2059,7 +2059,7 @@ 
test_roundrobin_verfiy_polling_slave_link_status_change(void)

/* Un-Register link status change interrupt callback */
rte_eth_dev_callback_unregister(test_params->bonded_port_id,
-   RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback,
+   RTE_DEV_EVENT_INTR_LSC, test_bonding_lsc_event_callback,
_params->bonded_port_id);


diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index f163562..6143bfb 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -478,7 +478,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_t 
port_id,

vrtl_eth_dev->data->dev_link.link_status = link_status;

-   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_DEV_EVENT_INTR_LSC);
 }

 int
@@ -580,7 +580,7 @@ virtual_ethdev_create(const char *name, struct ether_addr 
*mac_addr,
goto err;

/* reserve an ethdev entry */
-   eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+   eth_dev = rte_eth_dev_allocate(name, RTE_DEV_PCI);
if (eth_dev == NULL)
goto err;

diff --git a/examples/link_status_interrupt/main.c 
b/examples/link_status_interrupt/main.c
index e6fb218..9e31028 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -516,14 +516,14 @@ lsi_parse_args(int argc, char **argv)
  *  void.
  */
 static void
-lsi_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
+lsi_event_callback(uint8_t port_id, enum rte_dev_event_type type, void *param)
 {
struct rte_eth_link link;

RTE_SET_USED(param);

printf("\n\nIn registered callback...\n"

[dpdk-dev] [RFC PATCH 0/4] Extending DPDK to have more devices supported

2015-04-08 Thread Keith Wiles
Hi All,

Here is a set of RFC patches to update DPDK to support a generic set of
devices. The patches that follow create two files eal_common_device.h
and rte_common_device.c and then a few items in rte_ethdev.[ch] were moved
to cleanup those files by moving the device generic values and functions
into a common set of device generic files.

In the rte_common_device.h file are a couple of macros to abstract a few
common items from rte_ethdev.h which are not ethernet specific. These
generic device specific structure members are place into macros to be
placed at the top of each new device type crypto, hardware offload, dpi,
compression and possible others to be defined later.
 Note: could have used nested structures, but required a larger change set.

I did not pull the Rx/Tx Routines into a common function, but it could be
done if everyone agrees. It does not mean every device will use a common
Rx/Tx routine. Without pulling Rx/Tx routines into a common file allows
the device writer to have similar or different set of routines.

These patches do not contain any new devices as these are being work on
today.

More cleanup of ethdev could be done to remove NIC specific features not
supported in all devices and someone needs to do that cleanup IMO.

The code is untested and I wanted to get something our for others to poke at
today and more could be pulled out of ethdev as well. I/We will be looking
at testing the code as we get more completed.

I have not finished up the crypto APIs yet, but I am planning to work on
those additions today. The crypto code we are using is the Quick Assist code
found on 01.org, but we need to update the code to be move DPDK friendly.

The QAT code does have a modified like API similar to Linux Kernel crypto API
and I want to review that code first.

Regards,
++Keith

Keith Wiles (4):
  Rename of device types to be generic device names.
  Add the new common device header and C file.
  Update files to build new device generic common files and headers.
  Update the rte_ethdev.[ch] files for the new device generic changes.

 app/test/test_link_bonding.c  |  10 +-
 app/test/virtual_pmd.c|   4 +-
 examples/link_status_interrupt/main.c |   6 +-
 lib/librte_eal/bsdapp/eal/Makefile|   1 +
 lib/librte_eal/common/Makefile|   1 +
 lib/librte_eal/common/eal_common_device.c | 185 +++
 lib/librte_eal/common/include/rte_common_device.h | 617 ++
 lib/librte_eal/common/include/rte_log.h   |   1 +
 lib/librte_eal/linuxapp/eal/Makefile  |   1 +
 lib/librte_ether/rte_ethdev.c | 290 ++
 lib/librte_ether/rte_ethdev.h | 225 +++-
 lib/librte_pmd_af_packet/rte_eth_af_packet.c  |   2 +-
 lib/librte_pmd_bond/rte_eth_bond_api.c|   6 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c|  12 +-
 lib/librte_pmd_bond/rte_eth_bond_private.h|   2 +-
 lib/librte_pmd_e1000/em_ethdev.c  |   8 +-
 lib/librte_pmd_e1000/em_rxtx.c|   4 +-
 lib/librte_pmd_e1000/igb_ethdev.c |   2 +-
 lib/librte_pmd_i40e/i40e_ethdev.c |   4 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c   |   2 +-
 lib/librte_pmd_mlx4/mlx4.c|   2 +-
 lib/librte_pmd_null/rte_eth_null.c|   2 +-
 lib/librte_pmd_pcap/rte_eth_pcap.c|   2 +-
 lib/librte_pmd_ring/rte_eth_ring.c|   2 +-
 lib/librte_pmd_virtio/virtio_ethdev.c |   2 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c  |   2 +-
 26 files changed, 969 insertions(+), 426 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_device.c
 create mode 100644 lib/librte_eal/common/include/rte_common_device.h

-- 
2.3.0



[dpdk-dev] [PATCH] Move mk/rte.extvars.mk to mk/internal/rte.extvars.mk

2015-03-04 Thread Keith Wiles
Move the rte.extvars.mk to an internal directory and
update rte.vars.mk to find the file in the new location.

Signed-off-by: Keith Wiles 
---
 mk/internal/rte.extvars.mk | 81 ++
 mk/rte.extvars.mk  | 81 --
 mk/rte.vars.mk |  4 +--
 3 files changed, 83 insertions(+), 83 deletions(-)
 create mode 100644 mk/internal/rte.extvars.mk
 delete mode 100644 mk/rte.extvars.mk

diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk
new file mode 100644
index 000..3e5a990
--- /dev/null
+++ b/mk/internal/rte.extvars.mk
@@ -0,0 +1,81 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided 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.
+
+#
+# directory where sources are located
+#
+ifdef S
+ifeq ("$(origin S)", "command line")
+RTE_SRCDIR := $(abspath $(S))
+endif
+endif
+RTE_SRCDIR  ?= $(CURDIR)
+export RTE_SRCDIR
+
+#
+# Makefile to call once $(RTE_OUTPUT) is created
+#
+ifdef M
+ifeq ("$(origin M)", "command line")
+RTE_EXTMK := $(abspath $(M))
+endif
+endif
+RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
+export RTE_EXTMK
+
+RTE_SDK_BIN := $(RTE_SDK)/$(RTE_TARGET)
+
+#
+# Output files wil go in a separate directory: default output is
+# $(RTE_SRCDIR)/build
+# Output dir can be given as command line using "O="
+#
+ifdef O
+ifeq ("$(origin O)", "command line")
+RTE_OUTPUT := $(abspath $(O))
+endif
+endif
+RTE_OUTPUT ?= $(RTE_SRCDIR)/build
+export RTE_OUTPUT
+
+# if we are building an external application, include SDK
+# configuration and include project configuration if any
+include $(RTE_SDK_BIN)/.config
+ifneq ($(wildcard $(RTE_OUTPUT)/.config),)
+  include $(RTE_OUTPUT)/.config
+endif
+# remove double-quotes from config names
+RTE_ARCH := $(CONFIG_RTE_ARCH:"%"=%)
+RTE_MACHINE := $(CONFIG_RTE_MACHINE:"%"=%)
+RTE_EXEC_ENV := $(CONFIG_RTE_EXEC_ENV:"%"=%)
+RTE_TOOLCHAIN := $(CONFIG_RTE_TOOLCHAIN:"%"=%)
+
+
diff --git a/mk/rte.extvars.mk b/mk/rte.extvars.mk
deleted file mode 100644
index 3e5a990..000
--- a/mk/rte.extvars.mk
+++ /dev/null
@@ -1,81 +0,0 @@
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-# * Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution.
-# * Neither the name of Intel Corporation nor the names of its
-#   contributors may be used to endorse or promote products derived
-#   from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   

[dpdk-dev] [PATCH] External app builds need to locate common make fragments and includes.

2015-02-28 Thread Keith Wiles
When building an external application like Pktgen and using the proper
makefile fragments rte.extXYZ.mk NOT rte.XYZ.mk files as you would
use with example applications in the same RTE_SDK directory the rte.extXYZ.mk
files are missing some defines/includes.

  1 - Add missing tests for RTE_SDK/RTE_TARGET not defined code.
  2 - The build of external applications are forced to be verbose ouput
  as the Q=@ define is not present.
  3 - Missing include of target/generic/rte.vars.mk file which includes
  the information to locate the rte_config.h and other DPDK include
  files.

A patch like this one was submitted before and was rejected because it
seemed it was not required, because target/generic/rte.vars.mk already
included by rte.vars.mk.

This is not the cause for external applications like Pktgen which are
built outside of the RTE_SDK directory and only include the rte.extXYZ.mk
makefile fragments.

Signed-off-by: Keith Wiles 
---
 mk/rte.extvars.mk | 36 ++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/mk/rte.extvars.mk b/mk/rte.extvars.mk
index 3e5a990..e6c6401 100644
--- a/mk/rte.extvars.mk
+++ b/mk/rte.extvars.mk
@@ -30,8 +30,19 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 #
-# directory where sources are located
+# To be included at the beginning of all RTE external user Makefiles. This
+# .mk will define the RTE environment variables by including the
+# config file of SDK. It also includes the config file from external
+# application if any.
 #
+
+ifeq ($(RTE_SDK),)
+$(error RTE_SDK is not defined)
+endif
+ifeq ($(wildcard $(RTE_SDK)),)
+$(error RTE_SDK variable points to an invalid location)
+endif
+
 ifdef S
 ifeq ("$(origin S)", "command line")
 RTE_SRCDIR := $(abspath $(S))
@@ -40,6 +51,16 @@ endif
 RTE_SRCDIR  ?= $(CURDIR)
 export RTE_SRCDIR

+# define Q to '@' or not. $(Q) is used to prefix all shell commands to
+# be executed silently.
+Q=@
+ifdef V
+ifeq ("$(origin V)", "command line")
+Q=
+endif
+endif
+export Q
+
 #
 # Makefile to call once $(RTE_OUTPUT) is created
 #
@@ -51,6 +72,13 @@ endif
 RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
 export RTE_EXTMK

+# RTE_TARGET is deducted from config when we are building the SDK.
+# Else, when building an external app, RTE_TARGET must be specified
+# by the user.
+ifeq ($(RTE_TARGET),)
+$(error RTE_TARGET is not defined)
+endif
+
 RTE_SDK_BIN := $(RTE_SDK)/$(RTE_TARGET)

 #
@@ -78,4 +106,8 @@ RTE_MACHINE := $(CONFIG_RTE_MACHINE:"%"=%)
 RTE_EXEC_ENV := $(CONFIG_RTE_EXEC_ENV:"%"=%)
 RTE_TOOLCHAIN := $(CONFIG_RTE_TOOLCHAIN:"%"=%)

-
+ifneq ($(wildcard $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.vars.mk),)
+include $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.vars.mk
+else
+include $(RTE_SDK)/mk/target/generic/rte.vars.mk
+endif
-- 
2.3.0



[dpdk-dev] [PATCH] Missing use of macro rte_eth_dev_is_valid_port()

2015-02-26 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 lib/librte_ether/rte_ethdev.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index bb94ccb..6fd89d7 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3541,7 +3541,7 @@ rte_eth_add_rx_callback(uint8_t port_id, uint16_t 
queue_id,
return NULL;
 #endif
/* check input parameters */
-   if (port_id >= nb_ports || fn == NULL ||
+   if (!rte_eth_dev_is_valid_port(port_id) || fn == NULL ||
queue_id >= rte_eth_devices[port_id].data->nb_rx_queues) {
rte_errno = EINVAL;
return NULL;
@@ -3570,7 +3570,7 @@ rte_eth_add_tx_callback(uint8_t port_id, uint16_t 
queue_id,
return NULL;
 #endif
/* check input parameters */
-   if (port_id >= nb_ports || fn == NULL ||
+   if (!rte_eth_dev_is_valid_port(port_id) || fn == NULL ||
queue_id >= rte_eth_devices[port_id].data->nb_tx_queues) {
rte_errno = EINVAL;
return NULL;
@@ -3598,7 +3598,7 @@ rte_eth_remove_rx_callback(uint8_t port_id, uint16_t 
queue_id,
return (-ENOTSUP);
 #endif
/* Check input parameters. */
-   if (port_id >= nb_ports || user_cb == NULL ||
+   if (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL ||
queue_id >= rte_eth_devices[port_id].data->nb_rx_queues) {
return (-EINVAL);
}
@@ -3637,7 +3637,7 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t 
queue_id,
return (-ENOTSUP);
 #endif
/* Check input parameters. */
-   if (port_id >= nb_ports || user_cb == NULL ||
+   if (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL ||
queue_id >= rte_eth_devices[port_id].data->nb_tx_queues) {
return (-EINVAL);
}
-- 
2.3.0



[dpdk-dev] [PATCH] Remove unused static function revert_protocol_type() causing error with clang

2015-02-23 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 13 -
 1 file changed, 13 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index ad903d4..ea6f13d 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -3809,19 +3809,6 @@ convert_protocol_type(uint8_t protocol_value)
return IXGBE_FILTER_PROTOCOL_NONE;
 }

-static inline uint8_t
-revert_protocol_type(enum ixgbe_5tuple_protocol protocol)
-{
-   if (protocol == IXGBE_FILTER_PROTOCOL_TCP)
-   return IPPROTO_TCP;
-   else if (protocol == IXGBE_FILTER_PROTOCOL_UDP)
-   return IPPROTO_UDP;
-   else if (protocol == IXGBE_FILTER_PROTOCOL_SCTP)
-   return IPPROTO_SCTP;
-   else
-   return 0;
-}
-
 /*
  * add a 5tuple filter
  *
-- 
2.3.0



[dpdk-dev] [PATCH] Add Q variable to external builds to be quite

2015-02-14 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 mk/rte.extvars.mk | 4 
 1 file changed, 4 insertions(+)

diff --git a/mk/rte.extvars.mk b/mk/rte.extvars.mk
index 3e5a990..83a5721 100644
--- a/mk/rte.extvars.mk
+++ b/mk/rte.extvars.mk
@@ -66,6 +66,10 @@ endif
 RTE_OUTPUT ?= $(RTE_SRCDIR)/build
 export RTE_OUTPUT

+# define Q to '@' or not. $(Q) is used to prefix all shell commands to
+# be executed silently.
+Q=@
+
 # if we are building an external application, include SDK
 # configuration and include project configuration if any
 include $(RTE_SDK_BIN)/.config
-- 
2.3.0



[dpdk-dev] [RFC] Clang errors with bit fields and setting value of ~0.

2014-11-29 Thread Keith Wiles
error: implicit truncation from 'int' to bitfield
  changes value from -1 to 127 [-Werror,-Wbitfield-constant-conversion]
tx_offload_mask.l2_len = ~0;
Converted to use correct bit values
tx_offload_mask.l2_len = 0x7f;

Signer-off-by: Keith Wiles 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 8559ef6..de5ae09 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -381,7 +381,7 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
mss_l4len_idx |= (ctx_idx << IXGBE_ADVTXD_IDX_SHIFT);

if (ol_flags & PKT_TX_VLAN_PKT) {
-   tx_offload_mask.vlan_tci = ~0;
+   tx_offload_mask.vlan_tci = 0x;
}

/* check if TCP segmentation required for this packet */
@@ -391,17 +391,17 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
IXGBE_ADVTXD_TUCMD_L4T_TCP |
IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT;

-   tx_offload_mask.l2_len = ~0;
-   tx_offload_mask.l3_len = ~0;
-   tx_offload_mask.l4_len = ~0;
-   tx_offload_mask.tso_segsz = ~0;
+   tx_offload_mask.l2_len = 0x7f;
+   tx_offload_mask.l3_len = 0x1ff;
+   tx_offload_mask.l4_len = 0xff;
+   tx_offload_mask.tso_segsz = 0x;
mss_l4len_idx |= tx_offload.tso_segsz << IXGBE_ADVTXD_MSS_SHIFT;
mss_l4len_idx |= tx_offload.l4_len << IXGBE_ADVTXD_L4LEN_SHIFT;
} else { /* no TSO, check if hardware checksum is needed */
if (ol_flags & PKT_TX_IP_CKSUM) {
type_tucmd_mlhl = IXGBE_ADVTXD_TUCMD_IPV4;
-   tx_offload_mask.l2_len = ~0;
-   tx_offload_mask.l3_len = ~0;
+   tx_offload_mask.l2_len = 0x7f;
+   tx_offload_mask.l3_len = 0x1ff;
}

switch (ol_flags & PKT_TX_L4_MASK) {
@@ -409,23 +409,23 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_UDP |
IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT;
mss_l4len_idx |= sizeof(struct udp_hdr) << 
IXGBE_ADVTXD_L4LEN_SHIFT;
-   tx_offload_mask.l2_len = ~0;
-   tx_offload_mask.l3_len = ~0;
+   tx_offload_mask.l2_len = 0x7f;
+   tx_offload_mask.l3_len = 0x1ff;
break;
case PKT_TX_TCP_CKSUM:
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP |
IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT;
mss_l4len_idx |= sizeof(struct tcp_hdr) << 
IXGBE_ADVTXD_L4LEN_SHIFT;
-   tx_offload_mask.l2_len = ~0;
-   tx_offload_mask.l3_len = ~0;
-   tx_offload_mask.l4_len = ~0;
+   tx_offload_mask.l2_len = 0x7f;
+   tx_offload_mask.l3_len = 0x1ff;
+   tx_offload_mask.l4_len = 0xff;
break;
case PKT_TX_SCTP_CKSUM:
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_SCTP |
IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT;
mss_l4len_idx |= sizeof(struct sctp_hdr) << 
IXGBE_ADVTXD_L4LEN_SHIFT;
-   tx_offload_mask.l2_len = ~0;
-   tx_offload_mask.l3_len = ~0;
+   tx_offload_mask.l2_len = 0x7f;
+   tx_offload_mask.l3_len = 0x1ff;
break;
default:
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_RSV |
-- 
1.9.1



[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Roger Keith Wiles

> On Nov 24, 2014, at 11:04 AM, Neil Horman  wrote:
> 
> On Mon, Nov 24, 2014 at 10:12:33AM -0600, Roger Keith Wiles wrote:
>> Burn, it is not like we are going to add a huge number of new options in the 
>> future and run out of letters.
>> 
> No, but what about the application authors that need to accomodate all of the
> dpdk command line options as well?

The application authors are not effected. The application authors can use any 
options after the ?--? as DPDK does not define these options correct except in 
the example applications.

> Neil
> 
>>> On Nov 24, 2014, at 8:52 AM, Venkatesan, Venky >> intel.com> wrote:
>>> 
>>> 
>>> On 11/24/2014 5:28 AM, Bruce Richardson wrote:
>>>> On Mon, Nov 24, 2014 at 02:19:16PM +0100, Thomas Monjalon wrote:
>>>>> Hi Bruce and Neil,
>>>>> 
>>>>> 2014-11-24 11:28, Bruce Richardson:
>>>>>> On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
>>>>>>> On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
>>>>>>>> From: Didier Pallard 
>>>>>>>> 
>>>>>>>> In current version, used cores can only be specified using a bitmask.
>>>>>>>> It will now be possible to specify cores in 2 different ways:
>>>>>>>> - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
>>>>>>>> - Using a list in following format: -l [-c2][,c3[-c4],...]
>>>>>>>> 
>>>>>>>> The letter -l can stand for lcore or list.
>>>>>>>> 
>>>>>>>> -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
>>>>>>> Do you want to burn an option letter on that?  It seems like it might 
>>>>>>> be better
>>>>>>> to search the string for 0x and base the selection of bitmap of list 
>>>>>>> parsing
>>>>>>> based on its presence or absence.
>>>>> It was the initial proposal (in April):
>>>>>   http://dpdk.org/ml/archives/dev/2014-April/002173.html
>>>>> And I liked keeping only 1 option;
>>>>>   http://dpdk.org/ml/archives/dev/2014-May/002722.html
>>>>> But Anatoly raised the compatibility problem:
>>>>>   http://dpdk.org/ml/archives/dev/2014-May/002723.html
>>>>> Then there was no other comment so Didier and I reworked a separate 
>>>>> option.
>>>>> 
>>>>>> The existing coremask parsing always assumes a hex coremask, so just 
>>>>>> looking
>>>>>> for a 0x will not work. I prefer this scheme of using a new flag for 
>>>>>> this method
>>>>>> of specifying the cores to use.
>>>>>> 
>>>>>> If you don't want to use up a single-letter option, two alternatives:
>>>>>> 1) use a long option instead.
>>>>>> 2) if the -c parameter includes a "-" or a ",", treat it as a new-style 
>>>>>> option,
>>>>>> otherwise treat as old. The only abiguity here would be for specifying a 
>>>>>> single
>>>>>> core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to 
>>>>>> run on.
>>>>>> [0 is obviously a named core as it's an invalid mask, and A-F are 
>>>>>> obviously
>>>>>> masks.] If we did want this scheme, I would suggest that we allow 
>>>>>> trailing
>>>>>> commas in the list specifier, so we can force users to clear ambiguity by
>>>>>> either writing "0x6" or "6," i.e. disallow ambiguous values to avoid 
>>>>>> problems.
>>>>>> However, this is probably more work that it's worth to avoid using up a 
>>>>>> letter
>>>>>> option.
>>>>>> 
>>>>>> I'd prefer any of these options to breaking backward compatibility in 
>>>>>> this case.
>>>>> We need a consensus here.
>>>>> Who is supporting a "burn" of an one-letter option with clear usage?
>>>>> Who is supporting a "re-merge" of the 2 syntaxes with more complicated 
>>>>> rules
>>>>> (list syntax is triggered by presence of "-" or ",")?
>>>>> 
>>>> Burn!
>>> Burn ^ 2 ;)
>> 
>> 



[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Roger Keith Wiles
Burn, it is not like we are going to add a huge number of new options in the 
future and run out of letters.

> On Nov 24, 2014, at 8:52 AM, Venkatesan, Venky  intel.com> wrote:
> 
> 
> On 11/24/2014 5:28 AM, Bruce Richardson wrote:
>> On Mon, Nov 24, 2014 at 02:19:16PM +0100, Thomas Monjalon wrote:
>>> Hi Bruce and Neil,
>>> 
>>> 2014-11-24 11:28, Bruce Richardson:
 On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
> On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
>> From: Didier Pallard 
>> 
>> In current version, used cores can only be specified using a bitmask.
>> It will now be possible to specify cores in 2 different ways:
>> - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
>> - Using a list in following format: -l [-c2][,c3[-c4],...]
>> 
>> The letter -l can stand for lcore or list.
>> 
>> -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
> Do you want to burn an option letter on that?  It seems like it might be 
> better
> to search the string for 0x and base the selection of bitmap of list 
> parsing
> based on its presence or absence.
>>> It was the initial proposal (in April):
>>> http://dpdk.org/ml/archives/dev/2014-April/002173.html
>>> And I liked keeping only 1 option;
>>> http://dpdk.org/ml/archives/dev/2014-May/002722.html
>>> But Anatoly raised the compatibility problem:
>>> http://dpdk.org/ml/archives/dev/2014-May/002723.html
>>> Then there was no other comment so Didier and I reworked a separate option.
>>> 
 The existing coremask parsing always assumes a hex coremask, so just 
 looking
 for a 0x will not work. I prefer this scheme of using a new flag for this 
 method
 of specifying the cores to use.
 
 If you don't want to use up a single-letter option, two alternatives:
 1) use a long option instead.
 2) if the -c parameter includes a "-" or a ",", treat it as a new-style 
 option,
 otherwise treat as old. The only abiguity here would be for specifying a 
 single
 core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to 
 run on.
 [0 is obviously a named core as it's an invalid mask, and A-F are obviously
 masks.] If we did want this scheme, I would suggest that we allow trailing
 commas in the list specifier, so we can force users to clear ambiguity by
 either writing "0x6" or "6," i.e. disallow ambiguous values to avoid 
 problems.
 However, this is probably more work that it's worth to avoid using up a 
 letter
 option.
 
 I'd prefer any of these options to breaking backward compatibility in this 
 case.
>>> We need a consensus here.
>>> Who is supporting a "burn" of an one-letter option with clear usage?
>>> Who is supporting a "re-merge" of the 2 syntaxes with more complicated rules
>>> (list syntax is triggered by presence of "-" or ",")?
>>> 
>> Burn!
> Burn ^ 2 ;)



[dpdk-dev] [PATCH] Add external parser support for unknown commands.

2014-11-02 Thread Keith Wiles
Allow for a external parser to handle the command line if the
command is not found and the developer has called the routine
int cmdline_set_external_parser(struct cmdline * cl,
cmdline_external_parser_t parser);
function to set the function pointer.

The function for the external parser function should return 
CMDLINE_PARSE_NOMATCH
if not able to match the command requested or zero is handled.

Prototype of external routine:
int (*cmdline_external_parser_t)(struct cmdline * cl, const char * buy);

Signed-off-by: Keith Wiles 
---
 lib/librte_cmdline/cmdline.h   |  4 
 lib/librte_cmdline/cmdline_parse.c | 12 +++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/librte_cmdline/cmdline.h b/lib/librte_cmdline/cmdline.h
index 4c28d37..f15d996 100644
--- a/lib/librte_cmdline/cmdline.h
+++ b/lib/librte_cmdline/cmdline.h
@@ -65,6 +65,8 @@
 extern "C" {
 #endif

+typedef int (*cmdline_external_parser_t)(struct cmdline * cl, const char * 
buf);
+
 struct cmdline {
int s_in;
int s_out;
@@ -74,6 +76,7 @@ struct cmdline {
 #ifdef RTE_EXEC_ENV_LINUXAPP
struct termios oldterm;
 #endif
+   cmdline_external_parser_t   external_parser;
 };

 struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int 
s_in, int s_out);
@@ -85,6 +88,7 @@ int cmdline_in(struct cmdline *cl, const char *buf, int size);
 int cmdline_write_char(struct rdline *rdl, char c);
 void cmdline_interact(struct cmdline *cl);
 void cmdline_quit(struct cmdline *cl);
+void cmdline_set_external_parser(struct cmdline * cl, 
cmdline_external_parser_t parser);

 #ifdef __cplusplus
 }
diff --git a/lib/librte_cmdline/cmdline_parse.c 
b/lib/librte_cmdline/cmdline_parse.c
index 940480d..a65ae70 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -212,6 +212,14 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf,
return i;
 }

+/* Set or disable external parser */
+void
+cmdline_set_external_parser(struct cmdline *cl, cmdline_external_parser_t 
parser)
+{
+   /* If parser is NULL it allows for disabling external parser */
+   if ( cl )
+   cl->external_parser = parser;
+}

 int
 cmdline_parse(struct cmdline *cl, const char * buf)
@@ -320,7 +328,9 @@ cmdline_parse(struct cmdline *cl, const char * buf)
/* no match */
else {
debug_printf("No match err=%d\n", err);
-   return err;
+   if ( cl->external_parser == NULL )
+   return err;
+   return cl->external_parser(cl, buf);
}

return linelen;
-- 
2.1.0



[dpdk-dev] [PATCH] Allow verbose output for INSTALL-SHARED

2014-11-02 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 mk/rte.shared.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk
index 42feee7..e64d471 100644
--- a/mk/rte.shared.mk
+++ b/mk/rte.shared.mk
@@ -114,7 +114,7 @@ $(SHARED): $(OBJS-y) $(LDLIBS_FILES) $(DEP_$(SHARED)) FORCE
 #
 $(RTE_OUTPUT)/lib/$(SHARED): $(SHARED)
@echo "  INSTALL-SHARED $(SHARED)"
-   @[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib
+   $(Q)[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib
$(Q)cp -f $(SHARED) $(RTE_OUTPUT)/lib

 #
-- 
2.1.0



[dpdk-dev] [PATCH v2] __mempool_get_bulk: remove useless variable

2014-10-09 Thread Keith Wiles
Remove n_orig variable as it is not required.

Signed-off-by: Keith Wiles 
---
 lib/librte_mempool/rte_mempool.h | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 95f19f9..c602cbc 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -945,9 +945,6 @@ __mempool_get_bulk(struct rte_mempool *mp, void **obj_table,
   unsigned n, int is_mc)
 {
int ret;
-#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
-   unsigned n_orig = n;
-#endif
 #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
struct rte_mempool_cache *cache;
uint32_t index, len;
@@ -988,7 +985,7 @@ __mempool_get_bulk(struct rte_mempool *mp, void **obj_table,

cache->len -= n;

-   __MEMPOOL_STAT_ADD(mp, get_success, n_orig);
+   __MEMPOOL_STAT_ADD(mp, get_success, n);

return 0;

@@ -1002,9 +999,9 @@ ring_dequeue:
ret = rte_ring_sc_dequeue_bulk(mp->ring, obj_table, n);

if (ret < 0)
-   __MEMPOOL_STAT_ADD(mp, get_fail, n_orig);
+   __MEMPOOL_STAT_ADD(mp, get_fail, n);
else
-   __MEMPOOL_STAT_ADD(mp, get_success, n_orig);
+   __MEMPOOL_STAT_ADD(mp, get_success, n);

return ret;
 }
-- 
2.1.0



[dpdk-dev] [PATCH v3] Adding the routines rte_pktmbuf_alloc_bulk() and rte_pktmbuf_free_bulk()

2014-10-07 Thread Keith Wiles
Minor helper routines to mirror the mempool routines and remove the code
from applications. Routine used to allocate and free bulk set of mbufs.

Combined __rte_mbuf_raw_alloc_bulk into the rte_pktmbuf_alloc_bulk function.
Fixed up the comments to state the correct return values.

Signed-off-by: Keith Wiles 
---
 lib/librte_mbuf/rte_mbuf.h | 55 ++
 1 file changed, 55 insertions(+)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 1c6e115..337611b 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -671,6 +671,44 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 }

 /**
+ * Allocate a list of mbufs from a mempool into a mbuf array.
+ *
+ * This mbuf list contains one segment per mbuf, which has a length of 0. The 
pointer
+ * to data is initialized to have some bytes of headroom in the buffer
+ * (if buffer size allows).
+ *
+ * The routine is just a simple wrapper routine to reduce code in the 
application and
+ * provide a cleaner API for multiple mbuf requests.
+ *
+ * @param mp
+ *   The mempool from which the mbuf is allocated.
+ * @param m_list
+ *   An array of mbuf pointers, cnt must be less then or equal to the size of 
the array.
+ * @param cnt
+ *   Number of slots in the m_list array to fill.
+ * @return
+ *   - cnt is returned if a successful allocation.
+ *   - <0 negative number is an error code.
+ */
+static inline int __attribute__((always_inline))
+rte_pktmbuf_alloc_bulk(struct rte_mempool *mp, struct rte_mbuf *m_list[], 
int16_t cnt)
+{
+   int ret;
+
+   ret = rte_mempool_get_bulk(mp, (void **)m_list, cnt);
+   if ( ret == 0 ) {
+   ret = cnt;
+   while(cnt--) {
+#ifdef RTE_MBUF_REFCNT
+   rte_mbuf_refcnt_set(*m_list, 1);
+#endif /* RTE_MBUF_REFCNT */
+   rte_pktmbuf_reset(*m_list++);
+   }
+   }
+   return ret;
+}
+
+/**
  * Free a segment of a packet mbuf into its original mempool.
  *
  * Free an mbuf, without parsing other segments in case of chained
@@ -708,6 +746,23 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
}
 }

+/**
+ * Free a list of packet mbufs back into its original mempool.
+ *
+ * Free a list of mbufs by calling rte_pktmbuf_free() in a loop as a wrapper 
function.
+ *
+ * @param m_list
+ *   An array of rte_mbuf pointers to be freed.
+ * @param npkts
+ *   Number of packets to free in m_list.
+ */
+static inline void __attribute__((always_inline))
+rte_pktmbuf_free_bulk(struct rte_mbuf *m_list[], int16_t npkts)
+{
+   while(npkts--)
+   rte_pktmbuf_free(*m_list++);
+}
+
 #ifdef RTE_MBUF_REFCNT

 /**
-- 
2.1.0



[dpdk-dev] [PATCH v2] Adding the routines rte_pktmbuf_alloc_bulk() and rte_pktmbuf_free_bulk()

2014-10-06 Thread Keith Wiles
Minor helper routines to mirror the mempool routines and remove the code
from applications. The ixgbe_rxtx_vec.c routine could be changed to use
the ret_pktmbuf_alloc_bulk() routine inplace of rte_mempool_get_bulk().

Combined __rte_mbuf_raw_alloc_bulk into the rte_pktmbuf_alloc_bulk function.
Fixed up the comments to state the correct return values.

Signed-off-by: Keith Wiles 
---
 lib/librte_mbuf/rte_mbuf.h | 55 ++
 1 file changed, 55 insertions(+)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 1c6e115..337611b 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -671,6 +671,44 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 }

 /**
+ * Allocate a list of mbufs from a mempool into a mbuf array.
+ *
+ * This mbuf list contains one segment per mbuf, which has a length of 0. The 
pointer
+ * to data is initialized to have some bytes of headroom in the buffer
+ * (if buffer size allows).
+ *
+ * The routine is just a simple wrapper routine to reduce code in the 
application and
+ * provide a cleaner API for multiple mbuf requests.
+ *
+ * @param mp
+ *   The mempool from which the mbuf is allocated.
+ * @param m_list
+ *   An array of mbuf pointers, cnt must be less then or equal to the size of 
the array.
+ * @param cnt
+ *   Number of slots in the m_list array to fill.
+ * @return
+ *   - cnt is returned if a successful allocation.
+ *   - <0 negative number is an error code.
+ */
+static inline int __attribute__((always_inline))
+rte_pktmbuf_alloc_bulk(struct rte_mempool *mp, struct rte_mbuf *m_list[], 
int16_t cnt)
+{
+   int ret;
+
+   ret = rte_mempool_get_bulk(mp, (void **)m_list, cnt);
+   if ( ret == 0 ) {
+   ret = cnt;
+   while(cnt--) {
+#ifdef RTE_MBUF_REFCNT
+   rte_mbuf_refcnt_set(*m_list, 1);
+#endif /* RTE_MBUF_REFCNT */
+   rte_pktmbuf_reset(*m_list++);
+   }
+   }
+   return ret;
+}
+
+/**
  * Free a segment of a packet mbuf into its original mempool.
  *
  * Free an mbuf, without parsing other segments in case of chained
@@ -708,6 +746,23 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
}
 }

+/**
+ * Free a list of packet mbufs back into its original mempool.
+ *
+ * Free a list of mbufs by calling rte_pktmbuf_free() in a loop as a wrapper 
function.
+ *
+ * @param m_list
+ *   An array of rte_mbuf pointers to be freed.
+ * @param npkts
+ *   Number of packets to free in m_list.
+ */
+static inline void __attribute__((always_inline))
+rte_pktmbuf_free_bulk(struct rte_mbuf *m_list[], int16_t npkts)
+{
+   while(npkts--)
+   rte_pktmbuf_free(*m_list++);
+}
+
 #ifdef RTE_MBUF_REFCNT

 /**
-- 
2.1.0



[dpdk-dev] [PATCH v4] Clang compile error with RTE_LIBRTE_MEMPOOL_DEBUG enabled.

2014-10-05 Thread Keith Wiles
When enabling RTE_LIBRTE_MEMPOOL_DEBUG and compiling with clang
compiler an error occurs, because ifdefed code now includes GCC pragmas.

GCC 4.4 is when push_options and pop_options pragma show up.

Rework to include Thomas?s suggestion to drop push/pop pragma directives for
ignore/error directives.

Signed-off-by: Keith Wiles 
---
 lib/librte_mempool/rte_mempool.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 95f19f9..163de86 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -313,7 +313,6 @@ static inline void __mempool_write_trailer_cookie(void *obj)
  */
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
 #ifndef __INTEL_COMPILER
-#pragma GCC push_options
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
 static inline void __mempool_check_cookies(const struct rte_mempool *mp,
@@ -380,7 +379,7 @@ static inline void __mempool_check_cookies(const struct 
rte_mempool *mp,
}
 }
 #ifndef __INTEL_COMPILER
-#pragma GCC pop_options
+#pragma GCC diagnostic error "-Wcast-qual"
 #endif
 #else
 #define __mempool_check_cookies(mp, obj_table_const, n, free) do {} while(0)
-- 
2.1.0



[dpdk-dev] [PATCH 1/1] Adding the routines rte_pktmbuf_alloc_bulk() and rte_pktmbuf_free_bulk()

2014-10-04 Thread Keith Wiles
Minor helper routines to mirror the mempool routines and remove the code
from applications. The ixgbe_rxtx_vec.c routine could be changed to use
the ret_pktmbuf_alloc_bulk() routine inplace of rte_mempool_get_bulk().

Signed-off-by: Keith Wiles 
---
 lib/librte_mbuf/rte_mbuf.h | 77 ++
 1 file changed, 77 insertions(+)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 1c6e115..f298621 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -546,6 +546,41 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
 }

 /**
+ * @internal Allocate a list of mbufs from mempool *mp*.
+ * The use of that function is reserved for RTE internal needs.
+ * Please use rte_pktmbuf_alloc_bulk().
+ *
+ * @param mp
+ *   The mempool from which mbuf is allocated.
+ * @param m_list
+ *   The array to place the allocated rte_mbufs pointers.
+ * @param cnt
+ *   The number of mbufs to allocate
+ * @return
+ *   - 0 if the number of mbufs allocated was ok
+ *   - <0 is an ERROR.
+ */
+static inline int __rte_mbuf_raw_alloc_bulk(struct rte_mempool *mp, struct 
rte_mbuf *m_list[], int cnt)
+{
+   struct rte_mbuf *m;
+   int ret;
+
+   ret = rte_mempool_get_bulk(mp, (void **)m_list, cnt);
+   if ( ret == 0 ) {
+   int i;
+   for(i = 0; i < cnt; i++) {
+   m = *m_list++;
+#ifdef RTE_MBUF_REFCNT
+   rte_mbuf_refcnt_set(m, 1);
+#endif /* RTE_MBUF_REFCNT */
+   rte_pktmbuf_reset(m);
+   }
+   ret = cnt;
+   }
+   return ret;
+}
+
+/**
  * Allocate a new mbuf from a mempool.
  *
  * This new mbuf contains one segment, which has a length of 0. The pointer
@@ -671,6 +706,32 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 }

 /**
+ * Allocate a list of mbufs from a mempool into a mbufs array.
+ *
+ * This mbuf list contains one segment per mbuf, which has a length of 0. The 
pointer
+ * to data is initialized to have some bytes of headroom in the buffer
+ * (if buffer size allows).
+ *
+ * The routine is just a simple wrapper routine to reduce code in the 
application and
+ * provide a cleaner API for multiple mbuf requests.
+ *
+ * @param mp
+ *   The mempool from which the mbuf is allocated.
+ * @param m_list
+ *   An array of mbuf pointers, cnt must be less then or equal to the size of 
the list.
+ * @param cnt
+ *   Number of slots in the m_list array to fill.
+ * @return
+ *   - The number of valid mbufs pointers in the m_list array.
+ *   - Zero if the request cnt could not be allocated.
+ */
+static inline int __attribute__((always_inline))
+rte_pktmbuf_alloc_bulk(struct rte_mempool *mp, struct rte_mbuf *m_list[], 
int16_t cnt)
+{
+   return __rte_mbuf_raw_alloc_bulk(mp, m_list, cnt);
+}
+
+/**
  * Free a segment of a packet mbuf into its original mempool.
  *
  * Free an mbuf, without parsing other segments in case of chained
@@ -708,6 +769,22 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
}
 }

+/**
+ * Free a list of packet mbufs back into its original mempool.
+ *
+ * Free a list of mbufs by calling rte_pktmbuf_free() in a loop as a wrapper 
function.
+ *
+ * @param m_list
+ *   An array of rte_mbuf pointers to be freed.
+ * @param npkts
+ *   Number of packets to free in list.
+ */
+static inline void rte_pktmbuf_free_bulk(struct rte_mbuf *m_list[], int16_t 
npkts)
+{
+   while(npkts--)
+   rte_pktmbuf_free(*m_list++);
+}
+
 #ifdef RTE_MBUF_REFCNT

 /**
-- 
2.1.0



[dpdk-dev] [PATCH 1/2] Move the error check inside __mempool_check_cookies()

2014-10-04 Thread Keith Wiles
Three places check for the return value from __mempool_get_bulk to be zero
and then call the debug routine __mempool_check_cookies(). The test is
not required if moved into the debug routine. Minor cleanup and mostly
does not effect performance, unless the is not removed by the compiler
in the case where teh debug routine is not defined.

Signed-off-by: Keith Wiles 
---
 lib/librte_mempool/rte_mempool.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 597cf4f..154fdd4 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -325,6 +325,9 @@ static inline void __mempool_check_cookies(const struct 
rte_mempool *mp,
void *obj;
void **obj_table;

+   if ( n < 0 )
+   return;
+
/* Force to drop the "const" attribute. This is done only when
 * DEBUG is enabled */
tmp = (void *) obj_table_const;
@@ -1029,8 +1032,7 @@ rte_mempool_mc_get_bulk(struct rte_mempool *mp, void 
**obj_table, unsigned n)
 {
int ret;
ret = __mempool_get_bulk(mp, obj_table, n, 1);
-   if (ret == 0)
-   __mempool_check_cookies(mp, obj_table, n, 1);
+   __mempool_check_cookies(mp, obj_table, n, 1);
return ret;
 }

@@ -1058,8 +1060,7 @@ rte_mempool_sc_get_bulk(struct rte_mempool *mp, void 
**obj_table, unsigned n)
 {
int ret;
ret = __mempool_get_bulk(mp, obj_table, n, 0);
-   if (ret == 0)
-   __mempool_check_cookies(mp, obj_table, n, 1);
+   __mempool_check_cookies(mp, obj_table, n, 1);
return ret;
 }

@@ -1091,8 +1092,7 @@ rte_mempool_get_bulk(struct rte_mempool *mp, void 
**obj_table, unsigned n)
int ret;
ret = __mempool_get_bulk(mp, obj_table, n,
 !(mp->flags & MEMPOOL_F_SC_GET));
-   if (ret == 0)
-   __mempool_check_cookies(mp, obj_table, n, 1);
+   __mempool_check_cookies(mp, obj_table, n, 1);
return ret;
 }

-- 
2.1.0



[dpdk-dev] [PATCH] Clang compile error with RTE_LIBRTE_MEMPOOL_DEBUG enabled.

2014-09-27 Thread Keith Wiles
When enabling RTE_LIBRTE_MEMPOOL_DEBUG and compiling with clang
compiler an error occurs, because ifdefed code now includes GCC pragmas.

Signed-off-by: Keith Wiles 
---
 lib/librte_mempool/rte_mempool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 95f19f9..299d4d7 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -312,7 +312,7 @@ static inline void __mempool_write_trailer_cookie(void *obj)
  *   - 2: just check that cookie is valid (free or allocated)
  */
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
-#ifndef __INTEL_COMPILER
+#ifdef __GCC__
 #pragma GCC push_options
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
@@ -379,7 +379,7 @@ static inline void __mempool_check_cookies(const struct 
rte_mempool *mp,
}
}
 }
-#ifndef __INTEL_COMPILER
+#ifdef __GCC__
 #pragma GCC pop_options
 #endif
 #else
-- 
2.1.0



[dpdk-dev] [PATCH] Clang compile error with RTE_LIBRTE_MEMPOOL_DEBUG enabled.

2014-09-27 Thread Keith Wiles
When enabling RTE_LIBRTE_MEMPOOL_DEBUG and compiling with clang
compiler an error occurs, because ifdefed code now includes GCC pragmas.

Signed-off-by: Keith Wiles 
---
 lib/librte_mempool/rte_mempool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 95f19f9..299d4d7 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -312,7 +312,7 @@ static inline void __mempool_write_trailer_cookie(void *obj)
  *   - 2: just check that cookie is valid (free or allocated)
  */
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
-#ifndef __INTEL_COMPILER
+#ifdef __GCC__
 #pragma GCC push_options
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
@@ -379,7 +379,7 @@ static inline void __mempool_check_cookies(const struct 
rte_mempool *mp,
}
}
 }
-#ifndef __INTEL_COMPILER
+#ifdef __GCC__
 #pragma GCC pop_options
 #endif
 #else
-- 
2.1.0