Add thunderx (LP: #1691659) 90/6790/1
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Thu, 18 May 2017 11:12:50 +0000 (13:12 +0200)
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>
Fri, 19 May 2017 10:28:51 +0000 (12:28 +0200)
To make arm support useful on more devices add, enable and fix thunderx
networking - that is the nicvf pmd (LP: #1691659)

Change-Id: I17f1d6d63d31df05f1af09054ffddcb478c54dd3
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
debian/patches/nicvf-0001-net-thunderx-check-data-offset-alignment-requirement.patch [new file with mode: 0644]
debian/patches/nicvf-0002-net-thunderx-fix-32-bit-build.patch [new file with mode: 0644]
debian/patches/nicvf-0003-config-enable-thunderx-nicvf.patch [new file with mode: 0644]
debian/patches/nicvf-0004-net-thunderx-sync-mailbox-definitions-with-Linux-PF-.patch [new file with mode: 0644]
debian/patches/nicvf-0005-net-thunderx-wait-to-complete-during-link-update.patch [new file with mode: 0644]
debian/patches/nicvf-0006-mk-fix-lib-filtering-when-linking-app.patch [new file with mode: 0644]
debian/patches/nicvf-0007-net-thunderx-disable-PMD-for-old-compilers.patch [new file with mode: 0644]
debian/patches/nicvf-0008-net-thunderx-fix-stats-access-out-of-bounds.patch [new file with mode: 0644]
debian/patches/nicvf-0009-config-set-cache-line-as-128B-for-generic-arm64.patch [new file with mode: 0644]
debian/patches/nicvf-0010-net-thunderx-fix-deadlock-in-Rx-path.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/nicvf-0001-net-thunderx-check-data-offset-alignment-requirement.patch b/debian/patches/nicvf-0001-net-thunderx-check-data-offset-alignment-requirement.patch
new file mode 100644 (file)
index 0000000..d5402b8
--- /dev/null
@@ -0,0 +1,58 @@
+From 34c2e7026fb30f6756d2c84d07d99c94106bb2ab Mon Sep 17 00:00:00 2001
+From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Date: Mon, 13 Mar 2017 13:32:11 +0530
+Subject: [PATCH] net/thunderx: check data offset alignment requirement
+
+nicvf HW expects the DMA address of the packet data to be
+aligned with cache line size.
+
+Packet data offset is a function of struct mbuf size,
+mbuf private size and headroom. mbuf private size can
+be changed from the application in pool creation, this
+check detects HW alignment requirement constraint in pmd
+start function.
+
+Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
+---
+ drivers/net/thunderx/nicvf_ethdev.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=34c2e7026fb30f6756d2c84d07d99c94106bb2ab
+Original-Author: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+--- a/drivers/net/thunderx/nicvf_ethdev.c
++++ b/drivers/net/thunderx/nicvf_ethdev.c
+@@ -1407,7 +1407,7 @@
+ nicvf_vf_start(struct rte_eth_dev *dev, struct nicvf *nic, uint32_t rbdrsz)
+ {
+       int ret;
+-      uint16_t qidx;
++      uint16_t qidx, data_off;
+       uint32_t total_rxq_desc, nb_rbdr_desc, exp_buffs;
+       uint64_t mbuf_phys_off = 0;
+       struct nicvf_rxq *rxq;
+@@ -1448,10 +1448,18 @@
+                                    nic->vf_id, qidx, rxq->pool->name);
+                       return -ENOMEM;
+               }
+-              rxq->mbuf_phys_off -= nicvf_mbuff_meta_length(mbuf);
+-              rxq->mbuf_phys_off -= RTE_PKTMBUF_HEADROOM;
++              data_off = nicvf_mbuff_meta_length(mbuf);
++              data_off += RTE_PKTMBUF_HEADROOM;
+               rte_pktmbuf_free(mbuf);
++              if (data_off % RTE_CACHE_LINE_SIZE) {
++                      PMD_INIT_LOG(ERR, "%s: unaligned data_off=%d delta=%d",
++                              rxq->pool->name, data_off,
++                              data_off % RTE_CACHE_LINE_SIZE);
++                      return -EINVAL;
++              }
++              rxq->mbuf_phys_off -= data_off;
++
+               if (mbuf_phys_off == 0)
+                       mbuf_phys_off = rxq->mbuf_phys_off;
+               if (mbuf_phys_off != rxq->mbuf_phys_off) {
diff --git a/debian/patches/nicvf-0002-net-thunderx-fix-32-bit-build.patch b/debian/patches/nicvf-0002-net-thunderx-fix-32-bit-build.patch
new file mode 100644 (file)
index 0000000..f5653d1
--- /dev/null
@@ -0,0 +1,58 @@
+From 6d76fde7dba39769c64bee03b62593cc66a1b0e3 Mon Sep 17 00:00:00 2001
+From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Date: Sun, 19 Mar 2017 20:18:46 +0530
+Subject: [PATCH] net/thunderx: fix 32-bit build
+
+Fixes: e438796617dc ("net/thunderx: add PMD skeleton")
+
+Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+---
+ drivers/net/thunderx/nicvf_struct.h | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=6d76fde7dba39769c64bee03b62593cc66a1b0e3
+Original-Author: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h
+index c900e12..5bc6d57 100644
+--- a/drivers/net/thunderx/nicvf_struct.h
++++ b/drivers/net/thunderx/nicvf_struct.h
+@@ -43,8 +43,8 @@
+ #include <rte_memory.h>
+ struct nicvf_rbdr {
+-      uint64_t rbdr_status;
+-      uint64_t rbdr_door;
++      uintptr_t rbdr_status;
++      uintptr_t rbdr_door;
+       struct rbdr_entry_t *desc;
+       nicvf_phys_addr_t phys;
+       uint32_t buffsz;
+@@ -58,8 +58,8 @@ struct nicvf_txq {
+       union sq_entry_t *desc;
+       nicvf_phys_addr_t phys;
+       struct rte_mbuf **txbuffs;
+-      uint64_t sq_head;
+-      uint64_t sq_door;
++      uintptr_t sq_head;
++      uintptr_t sq_door;
+       struct rte_mempool *pool;
+       struct nicvf *nic;
+       void (*pool_free)(struct nicvf_txq *sq);
+@@ -74,8 +74,8 @@ struct nicvf_txq {
+ struct nicvf_rxq {
+       uint64_t mbuf_phys_off;
+-      uint64_t cq_status;
+-      uint64_t cq_door;
++      uintptr_t cq_status;
++      uintptr_t cq_door;
+       nicvf_phys_addr_t phys;
+       union cq_entry_t *desc;
+       struct nicvf_rbdr *shared_rbdr;
+-- 
+2.7.4
+
diff --git a/debian/patches/nicvf-0003-config-enable-thunderx-nicvf.patch b/debian/patches/nicvf-0003-config-enable-thunderx-nicvf.patch
new file mode 100644 (file)
index 0000000..465dd49
--- /dev/null
@@ -0,0 +1,62 @@
+From 0bc8874b3b2c2da74bb955ce2de2da7eb009a8bf Mon Sep 17 00:00:00 2001
+From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Date: Sun, 19 Mar 2017 20:18:48 +0530
+Subject: [PATCH] config: enable thunderx nicvf
+
+Enable Thunderx nicvf PMD driver in the common
+config as it does not have build dependency
+with any external library and/or architecture.
+
+Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+---
+ config/common_base                           |  2 +-
+ config/defconfig_arm64-thunderx-linuxapp-gcc | 10 ----------
+ doc/guides/nics/thunderx.rst                 |  3 +--
+ 3 files changed, 2 insertions(+), 13 deletions(-)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=0bc8874b3b2c2da74bb955ce2de2da7eb009a8bf
+Original-Author: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+--- a/config/common_base
++++ b/config/common_base
+@@ -264,7 +264,7 @@
+ #
+ # Compile burst-oriented Cavium Thunderx NICVF PMD driver
+ #
+-CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=n
++CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=y
+ CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_INIT=n
+ CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_RX=n
+ CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_TX=n
+--- a/config/defconfig_arm64-thunderx-linuxapp-gcc
++++ b/config/defconfig_arm64-thunderx-linuxapp-gcc
+@@ -36,13 +36,3 @@
+ CONFIG_RTE_CACHE_LINE_SIZE=128
+ CONFIG_RTE_MAX_NUMA_NODES=2
+ CONFIG_RTE_MAX_LCORE=96
+-
+-#
+-# Compile Cavium Thunderx NICVF PMD driver
+-#
+-CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=y
+-CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_INIT=n
+-CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_RX=n
+-CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_TX=n
+-CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_DRIVER=n
+-CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX=n
+--- a/doc/guides/nics/thunderx.rst
++++ b/doc/guides/nics/thunderx.rst
+@@ -77,9 +77,8 @@
+ The following options can be modified in the ``config`` file.
+ Please note that enabling debugging options may affect system performance.
+-- ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD`` (default ``n``)
++- ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD`` (default ``y``)
+-  By default it is enabled only for defconfig_arm64-thunderx-* config.
+   Toggle compilation of the ``librte_pmd_thunderx_nicvf`` driver.
+ - ``CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_INIT`` (default ``n``)
diff --git a/debian/patches/nicvf-0004-net-thunderx-sync-mailbox-definitions-with-Linux-PF-.patch b/debian/patches/nicvf-0004-net-thunderx-sync-mailbox-definitions-with-Linux-PF-.patch
new file mode 100644 (file)
index 0000000..2ff3a2d
--- /dev/null
@@ -0,0 +1,80 @@
+From 2d5a4b62ff2d7b79ca937a5c88654deecf4aa986 Mon Sep 17 00:00:00 2001
+From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Date: Mon, 20 Mar 2017 19:40:40 +0530
+Subject: [PATCH] net/thunderx: sync mailbox definitions with Linux PF driver
+
+- bgx_link_status mbox definition was changed in Linux
+commit 1cc702591bae ("net: thunderx: Add ethtool support")
+- NIC_MBOX_MSG_RES_BIT related changes were never part of Linux PF driver
+
+Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+---
+ drivers/net/thunderx/base/nicvf_mbox.c |  7 ++-----
+ drivers/net/thunderx/base/nicvf_mbox.h | 11 +++--------
+ 2 files changed, 5 insertions(+), 13 deletions(-)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=2d5a4b62ff2d7b79ca937a5c88654deecf4aa986
+Original-Author: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+--- a/drivers/net/thunderx/base/nicvf_mbox.c
++++ b/drivers/net/thunderx/base/nicvf_mbox.c
+@@ -62,9 +62,6 @@
+       [NIC_MBOX_MSG_RESET_STAT_COUNTER] = "NIC_MBOX_MSG_RESET_STAT_COUNTER",
+       [NIC_MBOX_MSG_CFG_DONE]           = "NIC_MBOX_MSG_CFG_DONE",
+       [NIC_MBOX_MSG_SHUTDOWN]           = "NIC_MBOX_MSG_SHUTDOWN",
+-      [NIC_MBOX_MSG_RES_BIT]            = "NIC_MBOX_MSG_RES_BIT",
+-      [NIC_MBOX_MSG_RSS_SIZE_RES_BIT]   = "NIC_MBOX_MSG_RSS_SIZE",
+-      [NIC_MBOX_MSG_ALLOC_SQS_RES_BIT]  = "NIC_MBOX_MSG_ALLOC_SQS",
+ };
+ static inline const char * __attribute__((unused))
+@@ -176,7 +173,7 @@
+       case NIC_MBOX_MSG_NACK:
+               nic->pf_nacked = true;
+               break;
+-      case NIC_MBOX_MSG_RSS_SIZE_RES_BIT:
++      case NIC_MBOX_MSG_RSS_SIZE:
+               nic->rss_info.rss_size = mbx.rss_size.ind_tbl_size;
+               nic->pf_acked = true;
+               break;
+@@ -186,7 +183,7 @@
+               nic->speed = mbx.link_status.speed;
+               nic->pf_acked = true;
+               break;
+-      case NIC_MBOX_MSG_ALLOC_SQS_RES_BIT:
++      case NIC_MBOX_MSG_ALLOC_SQS:
+               assert_primary(nic);
+               if (mbx.sqs_alloc.qs_count != nic->sqs_count) {
+                       nicvf_log_error("Received %" PRIu8 "/%" PRIu8
+--- a/drivers/net/thunderx/base/nicvf_mbox.h
++++ b/drivers/net/thunderx/base/nicvf_mbox.h
+@@ -68,16 +68,10 @@
+ #define       NIC_MBOX_MSG_ALLOC_SQS          0x12    /* Allocate secondary Qset */
+ #define       NIC_MBOX_MSG_LOOPBACK           0x16    /* Set interface in loopback */
+ #define       NIC_MBOX_MSG_RESET_STAT_COUNTER 0x17    /* Reset statistics counters */
+-#define       NIC_MBOX_MSG_CFG_DONE           0x7E    /* VF configuration done */
+-#define       NIC_MBOX_MSG_SHUTDOWN           0x7F    /* VF is being shutdown */
+-#define       NIC_MBOX_MSG_RES_BIT            0x80    /* Reset bit from PF */
++#define       NIC_MBOX_MSG_CFG_DONE           0xF0    /* VF configuration done */
++#define       NIC_MBOX_MSG_SHUTDOWN           0xF1    /* VF is being shutdown */
+ #define       NIC_MBOX_MSG_MAX                0x100   /* Maximum number of messages */
+-#define NIC_MBOX_MSG_RSS_SIZE_RES_BIT \
+-      (NIC_MBOX_MSG_RSS_SIZE | NIC_MBOX_MSG_RES_BIT)
+-#define NIC_MBOX_MSG_ALLOC_SQS_RES_BIT \
+-      (NIC_MBOX_MSG_ALLOC_SQS | NIC_MBOX_MSG_RES_BIT)
+-
+ /* Get vNIC VF configuration */
+ struct nic_cfg_msg {
+       uint8_t    msg;
+@@ -157,6 +151,7 @@
+ /* Physical interface link status */
+ struct bgx_link_status {
+       uint8_t    msg;
++      uint8_t    mac_type;
+       uint8_t    link_up;
+       uint8_t    duplex;
+       uint32_t   speed;
diff --git a/debian/patches/nicvf-0005-net-thunderx-wait-to-complete-during-link-update.patch b/debian/patches/nicvf-0005-net-thunderx-wait-to-complete-during-link-update.patch
new file mode 100644 (file)
index 0000000..32937a1
--- /dev/null
@@ -0,0 +1,59 @@
+From 0cca56708d781b42561e382fcbcb1f1647b932b9 Mon Sep 17 00:00:00 2001
+From: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
+Date: Fri, 31 Mar 2017 15:57:49 +0200
+Subject: [PATCH] net/thunderx: wait to complete during link update
+
+Some DPDK applications/examples check link status on their
+start. NICVF does not wait for the link, so those apps fail.
+
+Wait up to 9 seconds for the link as other PMDs do in order
+to fix those apps/examples.
+
+Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
+Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+---
+ drivers/net/thunderx/nicvf_ethdev.c | 21 +++++++++++++++++----
+ 1 file changed, 17 insertions(+), 4 deletions(-)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=0cca56708d781b42561e382fcbcb1f1647b932b9
+Original-Author: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+--- a/drivers/net/thunderx/nicvf_ethdev.c
++++ b/drivers/net/thunderx/nicvf_ethdev.c
+@@ -145,16 +145,29 @@
+  * Return 0 means link status changed, -1 means not changed
+  */
+ static int
+-nicvf_dev_link_update(struct rte_eth_dev *dev,
+-                    int wait_to_complete __rte_unused)
++nicvf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
+ {
++#define CHECK_INTERVAL 100  /* 100ms */
++#define MAX_CHECK_TIME 90   /* 9s (90 * 100ms) in total */
+       struct rte_eth_link link;
+       struct nicvf *nic = nicvf_pmd_priv(dev);
++      int i;
+       PMD_INIT_FUNC_TRACE();
+-      memset(&link, 0, sizeof(link));
+-      nicvf_set_eth_link_status(nic, &link);
++      if (wait_to_complete) {
++              /* rte_eth_link_get() might need to wait up to 9 seconds */
++              for (i = 0; i < MAX_CHECK_TIME; i++) {
++                      memset(&link, 0, sizeof(link));
++                      nicvf_set_eth_link_status(nic, &link);
++                      if (link.link_status)
++                              break;
++                      rte_delay_ms(CHECK_INTERVAL);
++              }
++      } else {
++              memset(&link, 0, sizeof(link));
++              nicvf_set_eth_link_status(nic, &link);
++      }
+       return nicvf_atomic_write_link_status(dev, &link);
+ }
diff --git a/debian/patches/nicvf-0006-mk-fix-lib-filtering-when-linking-app.patch b/debian/patches/nicvf-0006-mk-fix-lib-filtering-when-linking-app.patch
new file mode 100644 (file)
index 0000000..5009336
--- /dev/null
@@ -0,0 +1,71 @@
+From ab338eb44ebb79840dab1de2742c07070ae3bf0e Mon Sep 17 00:00:00 2001
+From: Olivier Matz <olivier.matz@6wind.com>
+Date: Thu, 6 Apr 2017 16:14:55 +0200
+Subject: [PATCH] mk: fix lib filtering when linking app
+
+I get the following error when linking the test application:
+  build/lib/librte_pmd_thunderx_nicvf.a(nicvf_hw.o):
+  In function `nicvf_qsize_regbit':
+  drivers/net/thunderx/base/nicvf_hw.c:451: undefined reference to `log2'
+  build/lib/librte_pmd_thunderx_nicvf.a(nicvf_hw.o):
+  In function `nicvf_rss_reta_update':
+  drivers/net/thunderx/base/nicvf_hw.c:804: undefined reference to `log2'
+  build/lib/librte_pmd_thunderx_nicvf.a(nicvf_hw.o):
+  In function `nicvf_rss_reta_query':
+  drivers/net/thunderx/base/nicvf_hw.c:825: undefined reference to `log2'
+
+While I don't know why it does not happen for a default build, the error
+can be explained. The link command line is:
+
+   gcc -o test ... *.o ... -Wl,-lm ... -Wl,-lrte_pmd_thunderx_nicvf ...
+
+rte_pmd_thunderx_nicvf needs the math library, and it should be
+added after. This is not the case because the test application also
+adds the math library.
+
+The makefile already filters the libraries, but it keeps the first
+occurrence of the lib. Instead, the last one should be kept.
+
+Fixes: edf4d331dcdb ("mk: eliminate duplicates from libraries list")
+Cc: stable@dpdk.org
+
+Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
+Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
+---
+ mk/rte.app.mk | 19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=ab338eb44ebb79840dab1de2742c07070ae3bf0e
+Original-Author: Olivier Matz <olivier.matz@6wind.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+--- a/mk/rte.app.mk
++++ b/mk/rte.app.mk
+@@ -168,10 +168,21 @@
+ LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
+-# Eliminate duplicates without sorting
+-LDLIBS := $(shell echo $(LDLIBS) | \
+-      awk '{for (i = 1; i <= NF; i++) { \
+-              if ($$i !~ /^-l.*/ || !seen[$$i]++) print $$i }}')
++# all the words except the first one
++allbutfirst = $(wordlist 2,$(words $(1)),$(1))
++
++# Eliminate duplicates without sorting, only keep the last occurrence
++filter-libs = \
++      $(if $(1),$(strip\
++              $(if \
++                      $(and \
++                              $(filter $(firstword $(1)),$(call allbutfirst,$(1))),\
++                              $(filter -l%,$(firstword $(1)))),\
++                      ,\
++                      $(firstword $(1))) \
++              $(call filter-libs,$(call allbutfirst,$(1)))))
++
++LDLIBS := $(call filter-libs,$(LDLIBS))
+ ifeq ($(RTE_DEVEL_BUILD)$(CONFIG_RTE_BUILD_SHARED_LIB),yy)
+ LDFLAGS += -rpath=$(RTE_SDK_BIN)/lib
diff --git a/debian/patches/nicvf-0007-net-thunderx-disable-PMD-for-old-compilers.patch b/debian/patches/nicvf-0007-net-thunderx-disable-PMD-for-old-compilers.patch
new file mode 100644 (file)
index 0000000..6159049
--- /dev/null
@@ -0,0 +1,80 @@
+From 0b9ce550c4f60a69da558da6044e1b394256b43c Mon Sep 17 00:00:00 2001
+From: Ferruh Yigit <ferruh.yigit@intel.com>
+Date: Thu, 6 Apr 2017 18:05:09 +0100
+Subject: [PATCH] net/thunderx: disable PMD for old compilers
+
+Disable for gcc < 4.7 and icc <= 14.0
+
+PMD uses some compiler builtins and new compiler options. Tested with
+gcc 4.5.1 and following were not supported:
+
+option:
+-Ofast
+
+macros:
+_Static_assert
+
+__ORDER_LITTLE_ENDIAN__
+__ORDER_BIG_ENDIAN__
+__BYTE_ORDER__
+
+__atomic_fetch_add
+__ATOMIC_ACQUIRE
+__atomic_load_n
+__ATOMIC_RELAXED
+__atomic_store_n
+__ATOMIC_RELEASE
+
+It is not easy to fix all in PMD, disabling PMD for older compilers.
+
+Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
+---
+ drivers/net/Makefile                     | 5 +++++
+ mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
+ mk/toolchain/icc/rte.toolchain-compat.mk | 5 +++++
+ 3 files changed, 15 insertions(+)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=0b9ce550c4f60a69da558da6044e1b394256b43c
+Original-Author: Ferruh Yigit <ferruh.yigit@intel.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+--- a/drivers/net/Makefile
++++ b/drivers/net/Makefile
+@@ -31,6 +31,11 @@
+ include $(RTE_SDK)/mk/rte.vars.mk
++# set in mk/toolchain/xxx/rte.toolchain-compat.mk
++ifeq ($(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD),d)
++        $(warning thunderx pmd is not supported by old compilers)
++endif
++
+ DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
+ DIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x
+ DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += bonding
+--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
++++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
+@@ -89,4 +89,9 @@
+       ifeq ($(shell test $(GCC_VERSION) -lt 42 && echo 1), 1)
+               MACHINE_CFLAGS := $(filter-out -march% -mtune% -msse%,$(MACHINE_CFLAGS))
+       endif
++
++      # Disable thunderx PMD for gcc < 4.7
++      ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
++              CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=d
++      endif
+ endif
+--- a/mk/toolchain/icc/rte.toolchain-compat.mk
++++ b/mk/toolchain/icc/rte.toolchain-compat.mk
+@@ -72,4 +72,9 @@
+               # remove march options
+               MACHINE_CFLAGS := $(patsubst -march=%,-xSSE3,$(MACHINE_CFLAGS))
+       endif
++
++      # Disable thunderx PMD for icc <= 14.0
++      ifeq ($(shell test $(ICC_MAJOR_VERSION) -le 14 && echo 1), 1)
++              CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=d
++      endif
+ endif
diff --git a/debian/patches/nicvf-0008-net-thunderx-fix-stats-access-out-of-bounds.patch b/debian/patches/nicvf-0008-net-thunderx-fix-stats-access-out-of-bounds.patch
new file mode 100644 (file)
index 0000000..cd26df5
--- /dev/null
@@ -0,0 +1,67 @@
+From 695cd416ce6c02d7a20108765573936998b2dbf0 Mon Sep 17 00:00:00 2001
+From: Marcin Wilk <marcin.wilk@caviumnetworks.com>
+Date: Tue, 11 Apr 2017 14:35:13 +0200
+Subject: [PATCH] net/thunderx: fix stats access out of bounds
+
+Trying to assign more queues to stats struct break only from one loop
+when the maximum size is reached. Outside loop iteration is continued.
+This leads to access an array out of bounds.
+
+Fixes: 21e3fb0050b9 ("net/thunderx: add final bits for secondary queue support")
+Cc: stable@dpdk.org
+
+Signed-off-by: Marcin Wilk <marcin.wilk@caviumnetworks.com>
+Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+---
+ drivers/net/thunderx/nicvf_ethdev.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=695cd416ce6c02d7a20108765573936998b2dbf0
+Original-Author: Marcin Wilk <marcin.wilk@caviumnetworks.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
+index b0b9c3b..36ff94f 100644
+--- a/drivers/net/thunderx/nicvf_ethdev.c
++++ b/drivers/net/thunderx/nicvf_ethdev.c
+@@ -258,7 +258,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+       /* Reading per RX ring stats */
+       for (qidx = rx_start; qidx <= rx_end; qidx++) {
+-              if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS)
++              if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
+                       break;
+               nicvf_hw_get_rx_qstats(nic, &rx_qstats, qidx);
+@@ -271,7 +271,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+       /* Reading per TX ring stats */
+       for (qidx = tx_start; qidx <= tx_end; qidx++) {
+-              if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS)
++              if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
+                       break;
+               nicvf_hw_get_tx_qstats(nic, &tx_qstats, qidx);
+@@ -290,7 +290,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+               /* Reading per RX ring stats */
+               for (qidx = rx_start; qidx <= rx_end; qidx++) {
+-                      if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS)
++                      if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
+                               break;
+                       nicvf_hw_get_rx_qstats(snic, &rx_qstats,
+@@ -303,7 +303,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+               nicvf_tx_range(dev, snic, &tx_start, &tx_end);
+               /* Reading per TX ring stats */
+               for (qidx = tx_start; qidx <= tx_end; qidx++) {
+-                      if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS)
++                      if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
+                               break;
+                       nicvf_hw_get_tx_qstats(snic, &tx_qstats,
+-- 
+2.7.4
+
diff --git a/debian/patches/nicvf-0009-config-set-cache-line-as-128B-for-generic-arm64.patch b/debian/patches/nicvf-0009-config-set-cache-line-as-128B-for-generic-arm64.patch
new file mode 100644 (file)
index 0000000..95e02d0
--- /dev/null
@@ -0,0 +1,65 @@
+From 852572d5db26d1d7d9021648740d9f2e0c4503c1 Mon Sep 17 00:00:00 2001
+From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Date: Wed, 26 Apr 2017 21:59:19 +0530
+Subject: [PATCH] config: set cache line as 128B for generic arm64
+
+armv8 implementations may have 64B or 128B cache line.
+Setting to the maximum available cache line size in generic config to
+address minimum DMA alignment across all arm64 implementations.
+
+Increasing the cacheline size has no negative impact to cache invalidation
+on systems with a smaller cache line.
+
+The need for the minimum DMA alignment has impact on functional aspects
+of the platform so default config should cater the functional aspects.
+
+There is an impact on memory usage with this scheme, but that's not too
+important for the single image arm64 distribution use case.
+
+The arm64 linux kernel followed the similar approach for single
+arm64 image use case.
+http://lxr.free-electrons.com/source/arch/arm64/include/asm/cache.h
+
+Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
+Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
+---
+ config/defconfig_arm64-armv8a-linuxapp-gcc | 5 +++++
+ config/defconfig_arm64-dpaa2-linuxapp-gcc  | 1 +
+ config/defconfig_arm64-xgene1-linuxapp-gcc | 1 +
+ 3 files changed, 7 insertions(+)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=852572d5db26d1d7d9021648740d9f2e0c4503c1
+Original-Author: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+--- a/config/defconfig_arm64-armv8a-linuxapp-gcc
++++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
+@@ -42,6 +42,11 @@
+ CONFIG_RTE_TOOLCHAIN="gcc"
+ CONFIG_RTE_TOOLCHAIN_GCC=y
++# Maximum available cache line size in arm64 implementations.
++# Setting to maximum available cache line size in generic config
++# to address minimum DMA alignment across all arm64 implementations.
++CONFIG_RTE_CACHE_LINE_SIZE=128
++
+ CONFIG_RTE_EAL_IGB_UIO=n
+ CONFIG_RTE_LIBRTE_FM10K_PMD=n
+--- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
++++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
+@@ -40,3 +40,4 @@
+ #
+ CONFIG_RTE_MAX_LCORE=8
+ CONFIG_RTE_MAX_NUMA_NODES=1
++CONFIG_RTE_CACHE_LINE_SIZE=64
+--- a/config/defconfig_arm64-xgene1-linuxapp-gcc
++++ b/config/defconfig_arm64-xgene1-linuxapp-gcc
+@@ -32,3 +32,4 @@
+ #include "defconfig_arm64-armv8a-linuxapp-gcc"
+ CONFIG_RTE_MACHINE="xgene1"
++CONFIG_RTE_CACHE_LINE_SIZE=64
diff --git a/debian/patches/nicvf-0010-net-thunderx-fix-deadlock-in-Rx-path.patch b/debian/patches/nicvf-0010-net-thunderx-fix-deadlock-in-Rx-path.patch
new file mode 100644 (file)
index 0000000..8773671
--- /dev/null
@@ -0,0 +1,58 @@
+From b31eb105463fa1844c19fde382dd6bd294329831 Mon Sep 17 00:00:00 2001
+From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Date: Tue, 2 May 2017 00:11:55 +0530
+Subject: [PATCH] net/thunderx: fix deadlock in Rx path
+
+RBDR buffers are refilled when SW consumes the buffers from CQ.
+This creates deadlock case when CQ buffers exhausted due to lack
+of RBDR buffers. Fix is to refill the RBDR when rx_free_thresh
+meet, irrespective of the number of CQ buffers consumed.
+
+Fixes: e2d7fc9f0a24 ("net/thunderx: add single and multi-segment Rx")
+Cc: stable@dpdk.org
+
+Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+---
+ drivers/net/thunderx/nicvf_rxtx.c | 18 ++++++++----------
+ 1 file changed, 8 insertions(+), 10 deletions(-)
+
+Origin: http://dpdk.org/browse/dpdk/commit/?id=b31eb105463fa1844c19fde382dd6bd294329831
+Original-Author: Jerin Jacob <jerin.jacob@caviumnetworks.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Last-Update: 2017-05-18
+
+--- a/drivers/net/thunderx/nicvf_rxtx.c
++++ b/drivers/net/thunderx/nicvf_rxtx.c
+@@ -469,11 +469,10 @@
+               rxq->head = cqe_head;
+               nicvf_addr_write(rxq->cq_door, to_process);
+               rxq->recv_buffers += to_process;
+-              if (rxq->recv_buffers > rxq->rx_free_thresh) {
+-                      rxq->recv_buffers -= nicvf_fill_rbdr(rxq,
+-                                              rxq->rx_free_thresh);
+-                      NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
+-              }
++      }
++      if (rxq->recv_buffers > rxq->rx_free_thresh) {
++              rxq->recv_buffers -= nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
++              NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
+       }
+       return to_process;
+@@ -563,11 +562,10 @@
+               rxq->head = cqe_head;
+               nicvf_addr_write(rxq->cq_door, to_process);
+               rxq->recv_buffers += buffers_consumed;
+-              if (rxq->recv_buffers > rxq->rx_free_thresh) {
+-                      rxq->recv_buffers -=
+-                              nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
+-                      NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
+-              }
++      }
++      if (rxq->recv_buffers > rxq->rx_free_thresh) {
++              rxq->recv_buffers -= nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
++              NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
+       }
+       return to_process;
index a8f4850..89f11d6 100644 (file)
@@ -2,3 +2,13 @@ fix-vhost-user-socket-permission.patch
 fix-power-default-config.patch
 dpdk-dev-v3-eal-sPAPR-IOMMU-support-in-pci-probing-for-vfio-pci-in-ppc64le.patch
 dpdk-dev-v4-i40e-implement-vector-PMD-for-altivec.patch
+nicvf-0001-net-thunderx-check-data-offset-alignment-requirement.patch
+nicvf-0002-net-thunderx-fix-32-bit-build.patch
+nicvf-0003-config-enable-thunderx-nicvf.patch
+nicvf-0004-net-thunderx-sync-mailbox-definitions-with-Linux-PF-.patch
+nicvf-0005-net-thunderx-wait-to-complete-during-link-update.patch
+nicvf-0006-mk-fix-lib-filtering-when-linking-app.patch
+nicvf-0007-net-thunderx-disable-PMD-for-old-compilers.patch
+nicvf-0008-net-thunderx-fix-stats-access-out-of-bounds.patch
+nicvf-0009-config-set-cache-line-as-128B-for-generic-arm64.patch
+nicvf-0010-net-thunderx-fix-deadlock-in-Rx-path.patch