[dpdk-dev] [PATCH] vhost: fix use after free issue

2016-10-18 Thread Yuanhan Liu
Fix the coverity USE_AFTER_FREE issue.

Fixes: a277c7159876 ("vhost: refactor code structure")
Coverity issue: 137884

Reported-by: John McNamara 
Signed-off-by: Yuanhan Liu 
---
 lib/librte_vhost/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 967cb65..aaa9c27 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -250,8 +250,8 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
vsocket->connfd = -1;
close(connfd);
*remove = 1;
-   free(conn);
vhost_destroy_device(conn->vid);
+   free(conn);

if (vsocket->reconnect)
vhost_user_create_client(vsocket);
-- 
1.9.0



[dpdk-dev] [PATCH v3] vhost: Only access header if offloading is supported in dequeue path

2016-10-18 Thread Yuanhan Liu
On Fri, Oct 14, 2016 at 10:07:07AM +0200, Maxime Coquelin wrote:
> If offloading features are not negotiated, parsing the virtio header
> is not needed.
> 
> Micro-benchmark with testpmd shows that the gain is +4% with indirect
> descriptors, +1% when using direct descriptors.
> 
> Signed-off-by: Maxime Coquelin 

Applied to dpdk-next-virtio.

Thanks.

--yliu


[dpdk-dev] [PATCH] drivers: make driver names consistent

2016-10-18 Thread Yuanhan Liu
On Tue, Oct 18, 2016 at 03:42:54PM +0200, Thomas Monjalon wrote:
> 2016-10-18 21:06, Yuanhan Liu:
> > On Tue, Oct 18, 2016 at 02:50:16PM +0200, Jan Blunck wrote:
> > > >From my understanding this is a massive API breakage. This forces all
> > > existing users of the virtual PMDs to change with zero benefit. Even
> > > if that isn't enough it also makes it impossible to switch between
> > > releases by recompiling.
> > > 
> > > Can we please revert these changes and work on some aliasing support
> > > for the PMDs to fix it long term?
> > 
> > +1. Aliasing is also something I would suggest before making such renames.
> 
> It is a brutal change, yes.
> It was announced in 16.07 release notes though.

Yes, but it still took me a while (by running git bisect) to figure out
what went wrong: I wasn't aware of such note, that I was thinking maybe
something is broken.

Later I also got quite few same complains. It may also took them a while
to know what's happened.

Anyway, my point is, for this kind of change, we should have added the
alias support firstly. If that's been done, then the announcement is not
needed at all?

--yliu
> 
> We can try to make this change more progressive by keeping old names
> as aliases for some time.
> Is there a volunteer to work on vdev names aliases,
> with the target of integrating them in RC2 or RC3?


[dpdk-dev] Project Governance and Linux Foundation

2016-10-18 Thread Jerin Jacob
On Tue, Oct 18, 2016 at 03:27:27PM +0200, Thomas Monjalon wrote:
> 2016-10-18 17:04, Jerin Jacob:
> > On Mon, Oct 17, 2016 at 05:23:42PM -0400, Dave Neary wrote:
> > > > I still hear concerns on this, and based on discussions with others who 
> > > > put their names to the post below, they do too. I think it's a 
> > > > perception that we need to address.
> > > 
> > > I would say that there is still a perception issue, for companies who
> > > look at the active developers, the owners of the project's resources
> > > (infra, domain name), and who have heard anecdotal evidence of issues in
> > > the past. I think the project has made a lot of progress since I have
> > > been following it, and I do not believe there are any major issues with
> > > the independence of the project. However, there are still concerned
> > > parties on this front, and the concerns can be easily addressed by a
> > > move to the LF.
> > 
> > +1
> 
> How can we solve issues if you don't give more details than
> "hear concerns" or "heard anecdotal evidence of issues"?

Honestly, I don't see any issue in the current DPDK project execution.
The concern was more towards the fact that multi-vendor infrastructure project
like DPDK owned and controlled by the single company.

We believe, Moving to LF will fix that issue/perception and it will
enable more users to use/consume/invest DPDK in their products.
Having said that, Does anyone see any issue in moving to LF?
If yes, Then we should enumerate the issues and discuss further.

Jerin



[dpdk-dev] [PATCH v4 32/32] net/qede: update driver version

2016-10-18 Thread Rasesh Mody
This patch updates the qede pmd version to 1.2.0.1.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/qede_ethdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index 5ab36a5..5eb3f52 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -43,7 +43,7 @@
 /* Driver versions */
 #define QEDE_PMD_VER_PREFIX"QEDE PMD"
 #define QEDE_PMD_VERSION_MAJOR 1
-#define QEDE_PMD_VERSION_MINOR 1
+#define QEDE_PMD_VERSION_MINOR 2
 #define QEDE_PMD_VERSION_REVISION   0
 #define QEDE_PMD_VERSION_PATCH 1

-- 
1.8.3.1



[dpdk-dev] [PATCH v4 31/32] doc: update qede pmd documentation

2016-10-18 Thread Rasesh Mody
Signed-off-by: Rasesh Mody 
Acked-by: John McNamara 
---
 doc/guides/nics/qede.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index 902e82b..b6f54fd 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -65,6 +65,8 @@ Non-supported Features

 - SR-IOV PF
 - Tunneling offloads
+- LRO/TSO
+- NPAR

 Supported QLogic Adapters
 -
@@ -239,7 +241,7 @@ SR-IOV: Prerequisites and Sample Application Notes

 This section provides instructions to configure SR-IOV with Linux OS.

-**Note**: librte_pmd_qede will be used to bind to SR-IOV VF device and Linux 
native kernel driver (QEDE) will function as SR-IOV PF driver.
+**Note**: librte_pmd_qede will be used to bind to SR-IOV VF device and Linux 
native kernel driver (QEDE) will function as SR-IOV PF driver. Requires PF 
driver to be 8.10.x.x or higher.

 #. Verify SR-IOV and ARI capability is enabled on the adapter using ``lspci``:

-- 
1.8.3.1



[dpdk-dev] [PATCH v4 30/32] net/qede: remove zlib dependency and enable PMD by default

2016-10-18 Thread Rasesh Mody
The QEDE PMD now uses unzipped firmware file eliminating the dependency
on zlib. Hence remove LDLIBS entry form the Makefile and enable qede
PMD by default.

Fixes: 6adac0bf30b3 ("qede: add missing external dependency and disable by 
default")

Signed-off-by: Rasesh Mody 
---
 config/common_base| 2 +-
 doc/guides/nics/qede.rst  | 5 +
 drivers/net/qede/Makefile | 2 --
 drivers/net/qede/base/ecore.h | 2 +-
 drivers/net/qede/qede_main.c  | 2 +-
 mk/rte.app.mk | 2 +-
 6 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/config/common_base b/config/common_base
index c7fd3db..750577d 100644
--- a/config/common_base
+++ b/config/common_base
@@ -317,7 +317,7 @@ CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n

 # QLogic 25G/40G/100G PMD
 #
-CONFIG_RTE_LIBRTE_QEDE_PMD=n
+CONFIG_RTE_LIBRTE_QEDE_PMD=y
 CONFIG_RTE_LIBRTE_QEDE_DEBUG_INIT=n
 CONFIG_RTE_LIBRTE_QEDE_DEBUG_INFO=n
 CONFIG_RTE_LIBRTE_QEDE_DEBUG_DRIVER=n
diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index 9d85d8d..902e82b 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -77,14 +77,11 @@ Prerequisites
 - Requires firmware version **8.10.x.** and management firmware
   version **8.10.x or higher**. Firmware may be available
   inbox in certain newer Linux distros under the standard directory
-  ``E.g. /lib/firmware/qed/qed_init_values_zipped-8.10.9.0.bin``
+  ``E.g. /lib/firmware/qed/qed_init_values-8.10.9.0.bin``

 - If the required firmware files are not available then visit
   `QLogic Driver Download Center `_.

-- This driver relies on external zlib library (-lz) for uncompressing
-  the firmware file.
-
 Performance note
 

diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 7965a83..39751e4 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -14,8 +14,6 @@ LIB = librte_pmd_qede.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lz
-
 EXPORT_MAP := rte_pmd_qede_version.map

 LIBABIVER := 1
diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 89e2bd0..907b35b 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -15,7 +15,7 @@
 #include 

 #define CONFIG_ECORE_BINARY_FW
-#define CONFIG_ECORE_ZIPPED_FW
+#undef CONFIG_ECORE_ZIPPED_FW

 #ifdef CONFIG_ECORE_ZIPPED_FW
 #include 
diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index 4f1e3b0..2d354e1 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -21,7 +21,7 @@ static uint8_t npar_tx_switching = 1;
 char fw_file[PATH_MAX];

 const char *QEDE_DEFAULT_FIRMWARE =
-   "/lib/firmware/qed/qed_init_values_zipped-8.10.9.0.bin";
+   "/lib/firmware/qed/qed_init_values-8.10.9.0.bin";

 static void
 qed_update_pf_params(struct ecore_dev *edev, struct ecore_pf_params *params)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 72c2fe7..2b95b75 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -121,7 +121,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD)  += 
-lrte_pmd_mpipe -lgxio
 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD)+= -lrte_pmd_nfp -lm
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)   += -lrte_pmd_null
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)   += -lrte_pmd_pcap -lpcap
-_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD)   += -lrte_pmd_qede -lz
+_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD)   += -lrte_pmd_qede
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)   += -lrte_pmd_ring
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2)   += -lrte_pmd_szedata2 -lsze2
 _LDLIBS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += -lrte_pmd_thunderx_nicvf -lm
-- 
1.8.3.1



[dpdk-dev] [PATCH v4 29/32] net/qede: add support for queue statistics

2016-10-18 Thread Rasesh Mody
This patch adds support for pulling per queue statistics.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/qede_ethdev.c | 98 +-
 drivers/net/qede/qede_ethdev.h |  3 ++
 drivers/net/qede/qede_rxtx.c   | 23 +-
 drivers/net/qede/qede_rxtx.h   |  4 +-
 4 files changed, 107 insertions(+), 21 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 394f89a..b91b478 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -160,6 +160,15 @@ static const struct rte_qede_xstats_name_off 
qede_xstats_strings[] = {
offsetof(struct ecore_eth_stats, tpa_coalesced_bytes)},
 };

+static const struct rte_qede_xstats_name_off qede_rxq_xstats_strings[] = {
+   {"rx_q_segments",
+   offsetof(struct qede_rx_queue, rx_segs)},
+   {"rx_q_hw_errors",
+   offsetof(struct qede_rx_queue, rx_hw_errors)},
+   {"rx_q_allocation_errors",
+   offsetof(struct qede_rx_queue, rx_alloc_errors)}
+};
+
 static void qede_interrupt_action(struct ecore_hwfn *p_hwfn)
 {
ecore_int_sp_dpc((osal_int_ptr_t)(p_hwfn));
@@ -828,6 +837,8 @@ qede_get_stats(struct rte_eth_dev *eth_dev, struct 
rte_eth_stats *eth_stats)
struct qede_dev *qdev = eth_dev->data->dev_private;
struct ecore_dev *edev = >edev;
struct ecore_eth_stats stats;
+   unsigned int i = 0, j = 0, qid;
+   struct qede_tx_queue *txq;

qdev->ops->get_vport_stats(edev, );

@@ -858,20 +869,73 @@ qede_get_stats(struct rte_eth_dev *eth_dev, struct 
rte_eth_stats *eth_stats)
stats.tx_mcast_bytes + stats.tx_bcast_bytes;

eth_stats->oerrors = stats.tx_err_drop_pkts;
+
+   /* Queue stats */
+   for (qid = 0; qid < QEDE_QUEUE_CNT(qdev); qid++) {
+   if (qdev->fp_array[qid].type & QEDE_FASTPATH_RX) {
+   eth_stats->q_ipackets[i] =
+   *(uint64_t *)(
+   ((char *)(qdev->fp_array[(qid)].rxq)) +
+   offsetof(struct qede_rx_queue,
+   rcv_pkts));
+   eth_stats->q_errors[i] =
+   *(uint64_t *)(
+   ((char *)(qdev->fp_array[(qid)].rxq)) +
+   offsetof(struct qede_rx_queue,
+   rx_hw_errors)) +
+   *(uint64_t *)(
+   ((char *)(qdev->fp_array[(qid)].rxq)) +
+   offsetof(struct qede_rx_queue,
+   rx_alloc_errors));
+   i++;
+   }
+
+   if (qdev->fp_array[qid].type & QEDE_FASTPATH_TX) {
+   txq = qdev->fp_array[(qid)].txqs[0];
+   eth_stats->q_opackets[j] =
+   *((uint64_t *)(uintptr_t)
+   (((uint64_t)(uintptr_t)(txq)) +
+offsetof(struct qede_tx_queue,
+ xmit_pkts)));
+   j++;
+   }
+   }
+}
+
+static unsigned
+qede_get_xstats_count(struct qede_dev *qdev) {
+   return RTE_DIM(qede_xstats_strings) +
+   (RTE_DIM(qede_rxq_xstats_strings) * QEDE_RSS_COUNT(qdev));
 }

 static int
 qede_get_xstats_names(__rte_unused struct rte_eth_dev *dev,
  struct rte_eth_xstat_name *xstats_names, unsigned limit)
 {
-   unsigned int i, stat_cnt = RTE_DIM(qede_xstats_strings);
+   struct qede_dev *qdev = dev->data->dev_private;
+   const unsigned int stat_cnt = qede_get_xstats_count(qdev);
+   unsigned int i, qid, stat_idx = 0;

-   if (xstats_names != NULL)
-   for (i = 0; i < stat_cnt; i++)
-   snprintf(xstats_names[i].name,
-   sizeof(xstats_names[i].name),
+   if (xstats_names != NULL) {
+   for (i = 0; i < RTE_DIM(qede_xstats_strings); i++) {
+   snprintf(xstats_names[stat_idx].name,
+   sizeof(xstats_names[stat_idx].name),
"%s",
qede_xstats_strings[i].name);
+   stat_idx++;
+   }
+
+   for (qid = 0; qid < QEDE_RSS_COUNT(qdev); qid++) {
+   for (i = 0; i < RTE_DIM(qede_rxq_xstats_strings); i++) {
+   snprintf(xstats_names[stat_idx].name,
+   sizeof(xstats_names[stat_idx].name),
+   "%.4s%d%s",
+   qede_rxq_xstats_strings[i].name, qid,
+   qede_rxq_xstats_strings[i].name + 4);
+   

[dpdk-dev] [PATCH v4 28/32] net/qede: fix status block index for VF queues

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

o Fix the fastpath status block index such that each queue pair shares
the same index value.

o Add ecore_vf_get_num_sbs() API that returns the number of status
blocks assigned by PF. Use that to decide how many VF queues can be
advertised. Additionally, restrict maximum number of VF queues to 16
for 100G VF case.

Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Harish Patil 
---
 drivers/net/qede/base/ecore_vf.c | 11 ++-
 drivers/net/qede/base/ecore_vf_api.h |  3 +++
 drivers/net/qede/qede_ethdev.h   |  1 +
 drivers/net/qede/qede_main.c | 13 -
 drivers/net/qede/qede_rxtx.c | 15 ++-
 5 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/drivers/net/qede/base/ecore_vf.c b/drivers/net/qede/base/ecore_vf.c
index 634e2bb..be8b1ec 100644
--- a/drivers/net/qede/base/ecore_vf.c
+++ b/drivers/net/qede/base/ecore_vf.c
@@ -336,7 +336,7 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct 
ecore_hwfn *p_hwfn)
/* Learn of the possibility of CMT */
if (IS_LEAD_HWFN(p_hwfn)) {
if (resp->pfdev_info.capabilities & PFVF_ACQUIRE_CAP_100G) {
-   DP_NOTICE(p_hwfn, false, "100g VF\n");
+   DP_INFO(p_hwfn, "100g VF\n");
p_hwfn->p_dev->num_hwfns = 2;
}
}
@@ -1382,6 +1382,15 @@ void ecore_vf_get_num_mac_filters(struct ecore_hwfn 
*p_hwfn,
*num_mac = p_vf->acquire_resp.resc.num_mac_filters;
 }

+void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
+ u32 *num_sbs)
+{
+   struct ecore_vf_iov *p_vf;
+
+   p_vf = p_hwfn->vf_iov_info;
+   *num_sbs = (u32)p_vf->acquire_resp.resc.num_sbs;
+}
+
 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac)
 {
struct ecore_bulletin_content *bulletin;
diff --git a/drivers/net/qede/base/ecore_vf_api.h 
b/drivers/net/qede/base/ecore_vf_api.h
index c73244f..571fd37 100644
--- a/drivers/net/qede/base/ecore_vf_api.h
+++ b/drivers/net/qede/base/ecore_vf_api.h
@@ -87,6 +87,9 @@ void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
  u32 *num_mac_filters);

+void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
+ u32 *num_sbs);
+
 /**
  * @brief Check if VF can set a MAC address
  *
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index c3b87e8..7b235b1 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -29,6 +29,7 @@
 #include "base/ecore_hsi_eth.h"
 #include "base/ecore_dev_api.h"
 #include "base/ecore_iov_api.h"
+#include "base/ecore_cxt.h"

 #include "qede_logs.h"
 #include "qede_if.h"
diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index 0483116..4f1e3b0 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -384,6 +384,7 @@ int
 qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info)
 {
struct qede_dev *qdev = (struct qede_dev *)edev;
+   uint8_t queues = 0;
int i;

memset(info, 0, sizeof(*info));
@@ -407,7 +408,17 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct 
qed_dev_eth_info *info)
rte_memcpy(>port_mac, >hwfns[0].hw_info.hw_mac_addr,
   ETHER_ADDR_LEN);
} else {
-   ecore_vf_get_num_rxqs(>hwfns[0], >num_queues);
+   ecore_vf_get_num_rxqs(ECORE_LEADING_HWFN(edev),
+ >num_queues);
+   if (edev->num_hwfns > 1) {
+   ecore_vf_get_num_rxqs(>hwfns[1], );
+   info->num_queues += queues;
+   /* Restrict 100G VF to advertise 16 queues till the
+* required support is available to go beyond 16.
+*/
+   info->num_queues = RTE_MIN(info->num_queues,
+  ECORE_MAX_VF_CHAINS_PER_PF);
+   }

ecore_vf_get_num_vlan_filters(>hwfns[0],
  (u8 *)>num_vlan_filters);
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 8f83497..bfcb16c 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -435,9 +435,22 @@ qede_alloc_mem_sb(struct qede_dev *qdev, struct 
ecore_sb_info *sb_info,

 int qede_alloc_fp_resc(struct qede_dev *qdev)
 {
+   struct ecore_dev *edev = >edev;
struct qede_fastpath *fp;
+   uint32_t num_sbs;
int rc, i;

+   if (IS_VF(edev))
+   ecore_vf_get_num_sbs(ECORE_LEADING_HWFN(edev), _sbs);
+   else
+   num_sbs = (ecore_cxt_get_proto_cid_count
+ (ECORE_LEADING_HWFN(edev), PROTOCOLID_ETH, NULL)) / 2;
+
+   if (num_sbs == 0) {
+ 

[dpdk-dev] [PATCH v4 27/32] net/qede: fix driver version string

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

This patch fixes the base driver version display.
The driver version notation is:


Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Harish Patil 
---
 drivers/net/qede/qede_ethdev.c | 43 +-
 drivers/net/qede/qede_ethdev.h | 17 -
 drivers/net/qede/qede_if.h |  3 +--
 drivers/net/qede/qede_main.c   |  4 ++--
 4 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 2763d63..394f89a 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -8,6 +8,7 @@

 #include "qede_ethdev.h"
 #include 
+#include 

 /* Globals */
 static const struct qed_eth_ops *qed_ops;
@@ -188,31 +189,28 @@ static void qede_print_adapter_info(struct qede_dev *qdev)
 {
struct ecore_dev *edev = >edev;
struct qed_dev_info *info = >dev_info.common;
-   static char ver_str[QED_DRV_VER_STR_SIZE];
+   static char drv_ver[QEDE_PMD_DRV_VER_STR_SIZE];
+   static char ver_str[QEDE_PMD_DRV_VER_STR_SIZE];

DP_INFO(edev, "*\n");
+   DP_INFO(edev, " DPDK version:%s\n", rte_version());
DP_INFO(edev, " Chip details : %s%d\n",
-   ECORE_IS_BB(edev) ? "BB" : "AH",
-   CHIP_REV_IS_A0(edev) ? 0 : 1);
-
-   sprintf(ver_str, "%s %s_%d.%d.%d.%d", QEDE_PMD_VER_PREFIX,
-   edev->ver_str, QEDE_PMD_VERSION_MAJOR, QEDE_PMD_VERSION_MINOR,
-   QEDE_PMD_VERSION_REVISION, QEDE_PMD_VERSION_PATCH);
-   strcpy(qdev->drv_ver, ver_str);
-   DP_INFO(edev, " Driver version : %s\n", ver_str);
-
-   sprintf(ver_str, "%d.%d.%d.%d", info->fw_major, info->fw_minor,
-   info->fw_rev, info->fw_eng);
+ ECORE_IS_BB(edev) ? "BB" : "AH",
+ CHIP_REV_IS_A0(edev) ? 0 : 1);
+   snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%d.%d.%d.%d",
+info->fw_major, info->fw_minor, info->fw_rev, info->fw_eng);
+   snprintf(drv_ver, QEDE_PMD_DRV_VER_STR_SIZE, "%s_%s",
+ver_str, QEDE_PMD_VERSION);
+   DP_INFO(edev, " Driver version : %s\n", drv_ver);
DP_INFO(edev, " Firmware version : %s\n", ver_str);

-   sprintf(ver_str, "%d.%d.%d.%d",
+   snprintf(ver_str, MCP_DRV_VER_STR_SIZE,
+"%d.%d.%d.%d",
(info->mfw_rev >> 24) & 0xff,
(info->mfw_rev >> 16) & 0xff,
(info->mfw_rev >> 8) & 0xff, (info->mfw_rev) & 0xff);
-   DP_INFO(edev, " Management firmware version : %s\n", ver_str);
-
+   DP_INFO(edev, " Management Firmware version : %s\n", ver_str);
DP_INFO(edev, " Firmware file : %s\n", fw_file);
-
DP_INFO(edev, "*\n");
 }

@@ -1362,11 +1360,12 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
/* Start the Slowpath-process */
memset(, 0, sizeof(struct qed_slowpath_params));
params.int_mode = ECORE_INT_MODE_MSIX;
-   params.drv_major = QEDE_MAJOR_VERSION;
-   params.drv_minor = QEDE_MINOR_VERSION;
-   params.drv_rev = QEDE_REVISION_VERSION;
-   params.drv_eng = QEDE_ENGINEERING_VERSION;
-   strncpy((char *)params.name, "qede LAN", QED_DRV_VER_STR_SIZE);
+   params.drv_major = QEDE_PMD_VERSION_MAJOR;
+   params.drv_minor = QEDE_PMD_VERSION_MINOR;
+   params.drv_rev = QEDE_PMD_VERSION_REVISION;
+   params.drv_eng = QEDE_PMD_VERSION_PATCH;
+   strncpy((char *)params.name, QEDE_PMD_VER_PREFIX,
+   QEDE_PMD_DRV_VER_STR_SIZE);

/* For CMT mode device do periodic polling for slowpath events.
 * This is required since uio device uses only one MSI-x
@@ -1403,7 +1402,7 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)

qede_alloc_etherdev(adapter, _info);

-   adapter->ops->common->set_id(edev, edev->name, QEDE_DRV_MODULE_VERSION);
+   adapter->ops->common->set_id(edev, edev->name, QEDE_PMD_VERSION);

if (!is_vf)
adapter->dev_info.num_mac_addrs =
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index 5838f33..c3b87e8 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -46,15 +46,14 @@
 #define QEDE_PMD_VERSION_REVISION   0
 #define QEDE_PMD_VERSION_PATCH 1

-#define QEDE_MAJOR_VERSION 8
-#define QEDE_MINOR_VERSION 7
-#define QEDE_REVISION_VERSION  9
-#define QEDE_ENGINEERING_VERSION   0
+#define QEDE_PMD_VERSION qede_stringify(QEDE_PMD_VERSION_MAJOR) "." \
+qede_stringify(QEDE_PMD_VERSION_MINOR) "." \
+qede_stringify(QEDE_PMD_VERSION_REVISION) "."  \
+qede_stringify(QEDE_PMD_VERSION_PATCH)
+
+#define QEDE_PMD_DRV_VER_STR_SIZE NAME_SIZE
+#define QEDE_PMD_VER_PREFIX "QEDE PMD"

[dpdk-dev] [PATCH v4 26/32] net/qede: skip slowpath polling for 100G VF device

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

There is no need to poll for slowpath events for VF
device since the ramrod responses are received over
PF-VF backchannel synchronously. So the fix is to
restrict the slowpath polling for PF device only.

Fixes: 2af14ca79c0a ("net/qede: support 100G")

Signed-off-by: Harish Patil 
---
 drivers/net/qede/qede_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index c93b7af..2763d63 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1372,7 +1372,7 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
 * This is required since uio device uses only one MSI-x
 * interrupt vector but we need one for each engine.
 */
-   if (edev->num_hwfns > 1) {
+   if (edev->num_hwfns > 1 && IS_PF(edev)) {
rc = rte_eal_alarm_set(timer_period * US_PER_S,
   qede_poll_sp_sb_cb,
   (void *)eth_dev);
-- 
1.8.3.1



[dpdk-dev] [PATCH v4 25/32] net/qede/base: add support to initiate PF FLR

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

Add support to send PF FLR request to the management firmware to
bringup the device in clean slate. This cleanup is necessary
in some corner cases where the device would be left in a bad
state from its previous operations. The driver will send PF FLR
request before slowpath initialization.

Signed-off-by: Harish Patil 
---
 doc/guides/nics/qede.rst  |  1 -
 drivers/net/qede/base/ecore_dev.c | 15 +++
 drivers/net/qede/base/ecore_mcp.c |  9 +
 drivers/net/qede/base/ecore_mcp.h | 11 +++
 4 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index c19f499..9d85d8d 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -65,7 +65,6 @@ Non-supported Features

 - SR-IOV PF
 - Tunneling offloads
-- Reload of the PMD after a non-graceful termination

 Supported QLogic Adapters
 -
diff --git a/drivers/net/qede/base/ecore_dev.c 
b/drivers/net/qede/base/ecore_dev.c
index b530173..6060f9e 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -2952,13 +2952,14 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void 
OSAL_IOMEM *p_regview,
void OSAL_IOMEM *p_doorbells,
struct ecore_hw_prepare_params *p_params)
 {
+   struct ecore_dev *p_dev = p_hwfn->p_dev;
enum _ecore_status_t rc = ECORE_SUCCESS;

/* Split PCI bars evenly between hwfns */
p_hwfn->regview = p_regview;
p_hwfn->doorbells = p_doorbells;

-   if (IS_VF(p_hwfn->p_dev))
+   if (IS_VF(p_dev))
return ecore_vf_hw_prepare(p_hwfn);

/* Validate that chip access is feasible */
@@ -2982,7 +2983,7 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void 
OSAL_IOMEM *p_regview,

/* First hwfn learns basic information, e.g., number of hwfns */
if (!p_hwfn->my_id) {
-   rc = ecore_get_dev_info(p_hwfn->p_dev);
+   rc = ecore_get_dev_info(p_dev);
if (rc != ECORE_SUCCESS)
goto err1;
}
@@ -2996,6 +2997,12 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void 
OSAL_IOMEM *p_regview,
goto err1;
}

+   if (p_hwfn == ECORE_LEADING_HWFN(p_dev) && !p_dev->recov_in_prog) {
+   rc = ecore_mcp_initiate_pf_flr(p_hwfn, p_hwfn->p_main_ptt);
+   if (rc != ECORE_SUCCESS)
+   DP_NOTICE(p_hwfn, false, "Failed to initiate PF FLR\n");
+   }
+
/* Read the device configuration information from the HW and SHMEM */
rc = ecore_get_hw_info(p_hwfn, p_hwfn->p_main_ptt,
   p_params->personality, p_params->drv_resc_alloc);
@@ -3011,7 +3018,7 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void 
OSAL_IOMEM *p_regview,
goto err2;
}
 #ifndef ASIC_ONLY
-   if (CHIP_REV_IS_FPGA(p_hwfn->p_dev)) {
+   if (CHIP_REV_IS_FPGA(p_dev)) {
DP_NOTICE(p_hwfn, false,
  "FPGA: workaround; Prevent DMAE parities\n");
ecore_wr(p_hwfn, p_hwfn->p_main_ptt, PCIE_REG_PRTY_MASK, 7);
@@ -3026,7 +3033,7 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void 
OSAL_IOMEM *p_regview,
return rc;
  err2:
if (IS_LEAD_HWFN(p_hwfn))
-   ecore_iov_free_hw_info(p_hwfn->p_dev);
+   ecore_iov_free_hw_info(p_dev);
ecore_mcp_free(p_hwfn);
  err1:
ecore_hw_hwfn_free(p_hwfn);
diff --git a/drivers/net/qede/base/ecore_mcp.c 
b/drivers/net/qede/base/ecore_mcp.c
index 500368e..2ff9715 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -2442,3 +2442,12 @@ enum _ecore_status_t ecore_mcp_get_resc_info(struct 
ecore_hwfn *p_hwfn,

return ECORE_SUCCESS;
 }
+
+enum _ecore_status_t ecore_mcp_initiate_pf_flr(struct ecore_hwfn *p_hwfn,
+  struct ecore_ptt *p_ptt)
+{
+   u32 mcp_resp, mcp_param;
+
+   return ecore_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_INITIATE_PF_FLR,
+0, _resp, _param);
+}
diff --git a/drivers/net/qede/base/ecore_mcp.h 
b/drivers/net/qede/base/ecore_mcp.h
index d3103ff..831890c 100644
--- a/drivers/net/qede/base/ecore_mcp.h
+++ b/drivers/net/qede/base/ecore_mcp.h
@@ -353,4 +353,15 @@ enum _ecore_status_t ecore_mcp_get_resc_info(struct 
ecore_hwfn *p_hwfn,
 struct resource_info *p_resc_info,
 u32 *p_mcp_resp, u32 *p_mcp_param);

+/**
+ * @brief - Initiates PF FLR
+ *
+ * @param p_hwfn
+ * @param p_ptt
+ *
+ * @param return ECORE_SUCCESS upon success.
+ */
+enum _ecore_status_t ecore_mcp_initiate_pf_flr(struct ecore_hwfn *p_hwfn,
+  struct ecore_ptt *p_ptt);
+
 #endif /* __ECORE_MCP_H__ */
-- 

[dpdk-dev] [PATCH v4 24/32] net/qede/base: change Rx Tx queue start APIs

2016-10-18 Thread Rasesh Mody
Changed q_{rx,tx}_start APIs to use common queue start parameters

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/ecore_l2.c | 131 +++
 drivers/net/qede/base/ecore_l2.h |  26 ++-
 drivers/net/qede/base/ecore_l2_api.h |  69 +-
 drivers/net/qede/base/ecore_sriov.c  |  28 +---
 drivers/net/qede/qede_eth_if.c   |  47 ++---
 drivers/net/qede/qede_eth_if.h   |  11 ++-
 drivers/net/qede/qede_rxtx.c |  27 +---
 7 files changed, 155 insertions(+), 184 deletions(-)

diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c
index 83a62e0..74f61b0 100644
--- a/drivers/net/qede/base/ecore_l2.c
+++ b/drivers/net/qede/base/ecore_l2.c
@@ -548,12 +548,7 @@ enum _ecore_status_t
 ecore_sp_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
  u16 opaque_fid,
  u32 cid,
- u16 rx_queue_id,
- u8 vf_rx_queue_id,
- u8 vport_id,
- u8 stats_id,
- u16 sb,
- u8 sb_index,
+ struct ecore_queue_start_common_params *p_params,
  u16 bd_max_bytes,
  dma_addr_t bd_chain_phys_addr,
  dma_addr_t cqe_pbl_addr,
@@ -568,22 +563,23 @@ ecore_sp_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
enum _ecore_status_t rc = ECORE_NOTIMPL;

/* Store information for the stop */
-   p_rx_cid = _hwfn->p_rx_cids[rx_queue_id];
+   p_rx_cid = _hwfn->p_rx_cids[p_params->queue_id];
p_rx_cid->cid = cid;
p_rx_cid->opaque_fid = opaque_fid;
-   p_rx_cid->vport_id = vport_id;
+   p_rx_cid->vport_id = p_params->vport_id;

-   rc = ecore_fw_vport(p_hwfn, vport_id, _vport_id);
+   rc = ecore_fw_vport(p_hwfn, p_params->vport_id, _vport_id);
if (rc != ECORE_SUCCESS)
return rc;

-   rc = ecore_fw_l2_queue(p_hwfn, rx_queue_id, _rx_q_id);
+   rc = ecore_fw_l2_queue(p_hwfn, p_params->queue_id, _rx_q_id);
if (rc != ECORE_SUCCESS)
return rc;

DP_VERBOSE(p_hwfn, ECORE_MSG_SP,
   "opaque_fid=0x%x, cid=0x%x, rx_qid=0x%x, vport_id=0x%x, 
sb_id=0x%x\n",
-  opaque_fid, cid, rx_queue_id, vport_id, sb);
+  opaque_fid, cid, p_params->queue_id,
+  p_params->vport_id, p_params->sb);

/* Get SPQ entry */
OSAL_MEMSET(_data, 0, sizeof(init_data));
@@ -599,10 +595,10 @@ ecore_sp_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,

p_ramrod = _ent->ramrod.rx_queue_start;

-   p_ramrod->sb_id = OSAL_CPU_TO_LE16(sb);
-   p_ramrod->sb_index = sb_index;
+   p_ramrod->sb_id = OSAL_CPU_TO_LE16(p_params->sb);
+   p_ramrod->sb_index = (u8)p_params->sb_idx;
p_ramrod->vport_id = abs_vport_id;
-   p_ramrod->stats_counter_id = stats_id;
+   p_ramrod->stats_counter_id = p_params->stats_id;
p_ramrod->rx_queue_id = OSAL_CPU_TO_LE16(abs_rx_q_id);
p_ramrod->complete_cqe_flg = 0;
p_ramrod->complete_event_flg = 1;
@@ -613,30 +609,27 @@ ecore_sp_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
p_ramrod->num_of_pbl_pages = OSAL_CPU_TO_LE16(cqe_pbl_size);
DMA_REGPAIR_LE(p_ramrod->cqe_pbl_addr, cqe_pbl_addr);

-   if (vf_rx_queue_id || b_use_zone_a_prod) {
-   p_ramrod->vf_rx_prod_index = vf_rx_queue_id;
+   if (p_params->vf_qid || b_use_zone_a_prod) {
+   p_ramrod->vf_rx_prod_index = (u8)p_params->vf_qid;
DP_VERBOSE(p_hwfn, ECORE_MSG_SP,
   "Queue%s is meant for VF rxq[%02x]\n",
   b_use_zone_a_prod ? " [legacy]" : "",
-  vf_rx_queue_id);
+  p_params->vf_qid);
p_ramrod->vf_rx_prod_use_zone_a = b_use_zone_a_prod;
}

return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL);
 }

-enum _ecore_status_t ecore_sp_eth_rx_queue_start(struct ecore_hwfn *p_hwfn,
-u16 opaque_fid,
-u8 rx_queue_id,
-u8 vport_id,
-u8 stats_id,
-u16 sb,
-u8 sb_index,
-u16 bd_max_bytes,
-dma_addr_t bd_chain_phys_addr,
-dma_addr_t cqe_pbl_addr,
-u16 cqe_pbl_size,
-void OSAL_IOMEM **pp_prod)
+enum _ecore_status_t
+ecore_sp_eth_rx_queue_start(struct 

[dpdk-dev] [PATCH v4 23/32] net/qede: add scatter gather support

2016-10-18 Thread Rasesh Mody
From: Sony Chacko 

Add scatter gather support to enable transmit and receive of larger
packets.

Signed-off-by: Sony Chacko 
---
 doc/guides/nics/features/qede.ini|   1 +
 doc/guides/nics/features/qede_vf.ini |   1 +
 doc/guides/nics/qede.rst |   4 +-
 drivers/net/qede/qede_ethdev.c   |  20 ++--
 drivers/net/qede/qede_rxtx.c | 217 ---
 drivers/net/qede/qede_rxtx.h |   3 -
 6 files changed, 191 insertions(+), 55 deletions(-)

diff --git a/doc/guides/nics/features/qede.ini 
b/doc/guides/nics/features/qede.ini
index 1d28a23..7d75030 100644
--- a/doc/guides/nics/features/qede.ini
+++ b/doc/guides/nics/features/qede.ini
@@ -9,6 +9,7 @@ Link status  = Y
 Link status event= Y
 MTU update   = Y
 Jumbo frame  = Y
+Scattered Rx = Y
 Promiscuous mode = Y
 Allmulticast mode= Y
 Unicast MAC filter   = Y
diff --git a/doc/guides/nics/features/qede_vf.ini 
b/doc/guides/nics/features/qede_vf.ini
index b4eba0c..acb1b99 100644
--- a/doc/guides/nics/features/qede_vf.ini
+++ b/doc/guides/nics/features/qede_vf.ini
@@ -9,6 +9,7 @@ Link status  = Y
 Link status event= Y
 MTU update   = Y
 Jumbo frame  = Y
+Scattered Rx = Y
 Promiscuous mode = Y
 Allmulticast mode= Y
 Unicast MAC filter   = Y
diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index e19c3db..c19f499 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -47,7 +47,7 @@ Supported Features
 - Promiscuous mode
 - Allmulti mode
 - Port hardware statistics
-- Jumbo frames (using single buffer)
+- Jumbo frames
 - VLAN offload - Filtering and stripping
 - Stateless checksum offloads (IPv4/TCP/UDP)
 - Multiple Rx/Tx queues
@@ -58,11 +58,11 @@ Supported Features
 - SR-IOV VF
 - MTU change
 - Multiprocess aware
+- Scatter-Gather

 Non-supported Features
 --

-- Scatter-Gather Rx/Tx frames
 - SR-IOV PF
 - Tunneling offloads
 - Reload of the PMD after a non-graceful termination
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 1c67eac..c93b7af 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -434,14 +434,14 @@ static int qede_vlan_filter_set(struct rte_eth_dev 
*eth_dev,
struct qede_vlan_entry *vlan;
int rc;

-   if (qdev->configured_vlans == dev_info->num_vlan_filters) {
-   DP_NOTICE(edev, false, "Reached max VLAN filter limit"
-" enabling accept_any_vlan\n");
-   qede_config_accept_any_vlan(qdev, true);
-   return 0;
-   }
-
if (on) {
+   if (qdev->configured_vlans == dev_info->num_vlan_filters) {
+   DP_INFO(edev, "Reached max VLAN filter limit"
+ " enabling accept_any_vlan\n");
+   qede_config_accept_any_vlan(qdev, true);
+   return 0;
+   }
+
SLIST_FOREACH(tmp, >vlan_list_head, list) {
if (tmp->vid == vlan_id) {
DP_ERR(edev, "VLAN %u already configured\n",
@@ -559,10 +559,8 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
}

/* Sanity checks and throw warnings */
-   if (rxmode->enable_scatter == 1) {
-   DP_ERR(edev, "RX scatter packets is not supported\n");
-   return -EINVAL;
-   }
+   if (rxmode->enable_scatter == 1)
+   eth_dev->data->scattered_rx = 1;

if (rxmode->enable_lro == 1) {
DP_INFO(edev, "LRO is not supported\n");
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index ab16c04..54cd849 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -135,8 +135,19 @@ qede_rx_queue_setup(struct rte_eth_dev *dev, uint16_t 
queue_idx,
data_size = (uint16_t)rte_pktmbuf_data_room_size(mp) -
RTE_PKTMBUF_HEADROOM;

+   if (pkt_len > data_size && !dev->data->scattered_rx) {
+   DP_ERR(edev, "MTU %u should not exceed dataroom %u\n",
+  pkt_len, data_size);
+   rte_free(rxq);
+   return -EINVAL;
+   }
+
+   if (dev->data->scattered_rx)
+   rxq->rx_buf_size = data_size;
+   else
+   rxq->rx_buf_size = pkt_len + QEDE_ETH_OVERHEAD;
+
qdev->mtu = pkt_len;
-   rxq->rx_buf_size = data_size;

DP_INFO(edev, "MTU = %u ; RX buffer = %u\n",
qdev->mtu, rxq->rx_buf_size);
@@ -804,6 +815,58 @@ static inline uint32_t qede_rx_cqe_to_pkt_type(uint16_t 
flags)
return RTE_PTYPE_L2_ETHER | p_type;
 }

+int qede_process_sg_pkts(void *p_rxq,  struct rte_mbuf *rx_mb,
+int num_frags, uint16_t pkt_len)
+{
+   struct qede_rx_queue *rxq = p_rxq;
+   struct 

[dpdk-dev] [PATCH v4 22/32] net/qede: fix RSS related issues

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

This patch contains few RSS related changes as follows:

o Fix inadvertent initializing of rss_params outside of the
  if block in qed_update_vport() which could cause FW exception.

o Fix disabling of RSS when hash function is 0.

o Rename qede_config_rss() to qede_check_vport_rss_enable()
  for better clarity.

o Avoid code duplication using a helper function
  qede_init_rss_caps().

Fixes: 4c98f2768eef ("net/qede: support RSS hash configuration")
Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Harish Patil 
---
 doc/guides/nics/qede.rst   |  2 +-
 drivers/net/qede/qede_eth_if.c |  2 +-
 drivers/net/qede/qede_ethdev.c | 77 +---
 drivers/net/qede/qede_ethdev.h | 23 ++-
 drivers/net/qede/qede_rxtx.c   | 88 +-
 5 files changed, 97 insertions(+), 95 deletions(-)

diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index 4ec75e4..e19c3db 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -51,7 +51,7 @@ Supported Features
 - VLAN offload - Filtering and stripping
 - Stateless checksum offloads (IPv4/TCP/UDP)
 - Multiple Rx/Tx queues
-- RSS (with user configurable table/key)
+- RSS (with RETA/hash table/key)
 - TSS
 - Multiple MAC address
 - Default pause flow control
diff --git a/drivers/net/qede/qede_eth_if.c b/drivers/net/qede/qede_eth_if.c
index bf41390..a19b22e 100644
--- a/drivers/net/qede/qede_eth_if.c
+++ b/drivers/net/qede/qede_eth_if.c
@@ -143,8 +143,8 @@ qed_update_vport(struct ecore_dev *edev, struct 
qed_update_vport_params *params)
   ECORE_RSS_IND_TABLE_SIZE * sizeof(uint16_t));
rte_memcpy(sp_rss_params.rss_key, params->rss_params.rss_key,
   ECORE_RSS_KEY_SIZE * sizeof(uint32_t));
+   sp_params.rss_params = _rss_params;
}
-   sp_params.rss_params = _rss_params;

for_each_hwfn(edev, i) {
struct ecore_hwfn *p_hwfn = >hwfns[i];
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 4afc905..1c67eac 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -537,7 +537,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
struct qede_dev *qdev = eth_dev->data->dev_private;
struct ecore_dev *edev = >edev;
struct rte_eth_rxmode *rxmode = _dev->data->dev_conf.rxmode;
-   int rc;
+   int rc, i, j;

PMD_INIT_FUNC_TRACE(edev);

@@ -558,10 +558,6 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
}
}

-   qdev->fp_num_tx = eth_dev->data->nb_tx_queues;
-   qdev->fp_num_rx = eth_dev->data->nb_rx_queues;
-   qdev->num_queues = qdev->fp_num_tx + qdev->fp_num_rx;
-
/* Sanity checks and throw warnings */
if (rxmode->enable_scatter == 1) {
DP_ERR(edev, "RX scatter packets is not supported\n");
@@ -580,8 +576,6 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
DP_INFO(edev, "IP/UDP/TCP checksum offload is always enabled "
  "in hw\n");

-   SLIST_INIT(>vlan_list_head);
-
/* Check for the port restart case */
if (qdev->state != QEDE_DEV_INIT) {
rc = qdev->ops->vport_stop(edev, 0);
@@ -590,6 +584,10 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
qede_dealloc_fp_resc(eth_dev);
}

+   qdev->fp_num_tx = eth_dev->data->nb_tx_queues;
+   qdev->fp_num_rx = eth_dev->data->nb_rx_queues;
+   qdev->num_queues = qdev->fp_num_tx + qdev->fp_num_rx;
+
/* Fastpath status block should be initialized before sending
 * VPORT-START in the case of VF. Anyway, do it for both VF/PF.
 */
@@ -604,6 +602,8 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
if (rc != 0)
return rc;

+   SLIST_INIT(>vlan_list_head);
+
/* Add primary mac for PF */
if (IS_PF(edev))
qede_mac_addr_set(eth_dev, >primary_mac);
@@ -615,6 +615,10 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)

qdev->state = QEDE_DEV_CONFIG;

+   DP_INFO(edev, "Allocated RSS=%d TSS=%d (with CoS=%d)\n",
+   (int)QEDE_RSS_COUNT(qdev), (int)QEDE_TSS_COUNT(qdev),
+   qdev->num_tc);
+
return 0;
 }

@@ -1037,42 +1041,51 @@ qede_dev_supported_ptypes_get(struct rte_eth_dev 
*eth_dev)
return NULL;
 }

-int qede_rss_hash_update(struct rte_eth_dev *eth_dev,
-struct rte_eth_rss_conf *rss_conf)
+void qede_init_rss_caps(uint8_t *rss_caps, uint64_t hf)
+{
+   *rss_caps = 0;
+   *rss_caps |= (hf & ETH_RSS_IPV4)  ? ECORE_RSS_IPV4 : 0;
+   *rss_caps |= (hf & ETH_RSS_IPV6)  ? ECORE_RSS_IPV6 : 0;
+   *rss_caps |= (hf & ETH_RSS_IPV6_EX)   ? ECORE_RSS_IPV6 : 0;
+   *rss_caps |= 

[dpdk-dev] [PATCH v4 21/32] net/qede: add enable/disable VLAN filtering

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

The device doesn't explicitly support enable/disable
of VLAN filtering. However, VLAN filtering takes effect
when a matching VLAN is configured. So in order to
support enable/disable of VLAN filtering, VLAN 0 is
added/removed respectively. A check is added to ensure that
the user removes all the configured VLANs before disabling
VLAN filtering.

Also VLAN offloads shall be enabled by default and
vlan_tci_outer is to set to 0 for Q-in-Q packets.

Fixes: 2ea6f76 ("qede: add core driver")

Signed-off-by: Harish Patil 
---
 drivers/net/qede/qede_ethdev.c | 35 ---
 drivers/net/qede/qede_ethdev.h |  4 
 drivers/net/qede/qede_rxtx.c   |  1 +
 3 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index b97e3be..4afc905 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -372,16 +372,40 @@ static void qede_vlan_offload_set(struct rte_eth_dev 
*eth_dev, int mask)
 {
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
+   struct rte_eth_rxmode *rxmode = _dev->data->dev_conf.rxmode;

if (mask & ETH_VLAN_STRIP_MASK) {
-   if (eth_dev->data->dev_conf.rxmode.hw_vlan_strip)
+   if (rxmode->hw_vlan_strip)
(void)qede_vlan_stripping(eth_dev, 1);
else
(void)qede_vlan_stripping(eth_dev, 0);
}

-   DP_INFO(edev, "vlan offload mask %d vlan-strip %d\n",
-   mask, eth_dev->data->dev_conf.rxmode.hw_vlan_strip);
+   if (mask & ETH_VLAN_FILTER_MASK) {
+   /* VLAN filtering kicks in when a VLAN is added */
+   if (rxmode->hw_vlan_filter) {
+   qede_vlan_filter_set(eth_dev, 0, 1);
+   } else {
+   if (qdev->configured_vlans > 1) { /* Excluding VLAN0 */
+   DP_NOTICE(edev, false,
+ " Please remove existing VLAN filters"
+ " before disabling VLAN filtering\n");
+   /* Signal app that VLAN filtering is still
+* enabled
+*/
+   rxmode->hw_vlan_filter = true;
+   } else {
+   qede_vlan_filter_set(eth_dev, 0, 0);
+   }
+   }
+   }
+
+   if (mask & ETH_VLAN_EXTEND_MASK)
+   DP_INFO(edev, "No offloads are supported with VLAN Q-in-Q"
+   " and classification is based on outer tag only\n");
+
+   DP_INFO(edev, "vlan offload mask %d vlan-strip %d vlan-filter %d\n",
+   mask, rxmode->hw_vlan_strip, rxmode->hw_vlan_filter);
 }

 static int qede_set_ucast_rx_vlan(struct qede_dev *qdev,
@@ -584,6 +608,11 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
if (IS_PF(edev))
qede_mac_addr_set(eth_dev, >primary_mac);

+   /* Enable VLAN offloads by default */
+   qede_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK  |
+  ETH_VLAN_FILTER_MASK |
+  ETH_VLAN_EXTEND_MASK);
+
qdev->state = QEDE_DEV_CONFIG;

return 0;
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index ed2d41c..526d3be 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -152,6 +152,10 @@ struct qede_dev {
char drv_ver[QED_DRV_VER_STR_SIZE];
 };

+/* Static functions */
+static int qede_vlan_filter_set(struct rte_eth_dev *eth_dev,
+   uint16_t vlan_id, int on);
+
 int qed_fill_eth_dev_info(struct ecore_dev *edev,
 struct qed_dev_eth_info *info);
 int qede_dev_set_link_state(struct rte_eth_dev *eth_dev, bool link_up);
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 6973d1c..9df0d133 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -945,6 +945,7 @@ qede_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
 */
rx_mb->vlan_tci = rte_le_to_cpu_16(fp_cqe->vlan_tag);
rx_mb->ol_flags |= PKT_RX_QINQ_PKT;
+   rx_mb->vlan_tci_outer = 0;
}

rx_pkts[rx_pkt] = rx_mb;
-- 
1.8.3.1



[dpdk-dev] [PATCH v4 20/32] net/qede: fixes for VLAN filters

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

 - fix to prevent duplicate VLAN filters

librte_ether does not keep track of VLAN filters
configured, so it becomes driver's responsibility to
keep track of it and prevent duplicate filter
programming. The fix is to use a singly linked
list for tracking the entries and there by prevent
duplicates.

 - fix num vlan filters

Fix num vlan filter when filling Ethernet device information.

Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Harish Patil 
---
 drivers/net/qede/qede_eth_if.h |  2 +-
 drivers/net/qede/qede_ethdev.c | 67 ++
 drivers/net/qede/qede_ethdev.h | 15 +-
 drivers/net/qede/qede_main.c   | 10 +--
 4 files changed, 71 insertions(+), 23 deletions(-)

diff --git a/drivers/net/qede/qede_eth_if.h b/drivers/net/qede/qede_eth_if.h
index 7840a37..5a7fdc9 100644
--- a/drivers/net/qede/qede_eth_if.h
+++ b/drivers/net/qede/qede_eth_if.h
@@ -46,7 +46,7 @@ struct qed_dev_eth_info {
uint8_t num_tc;

struct ether_addr port_mac;
-   uint8_t num_vlan_filters;
+   uint16_t num_vlan_filters;
uint32_t num_mac_addrs;
 };

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index f7cc313..b97e3be 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -406,10 +406,11 @@ static int qede_vlan_filter_set(struct rte_eth_dev 
*eth_dev,
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
struct qed_dev_eth_info *dev_info = >dev_info;
+   struct qede_vlan_entry *tmp = NULL;
+   struct qede_vlan_entry *vlan;
int rc;

-   if (vlan_id != 0 &&
-   qdev->configured_vlans == dev_info->num_vlan_filters) {
+   if (qdev->configured_vlans == dev_info->num_vlan_filters) {
DP_NOTICE(edev, false, "Reached max VLAN filter limit"
 " enabling accept_any_vlan\n");
qede_config_accept_any_vlan(qdev, true);
@@ -417,28 +418,66 @@ static int qede_vlan_filter_set(struct rte_eth_dev 
*eth_dev,
}

if (on) {
+   SLIST_FOREACH(tmp, >vlan_list_head, list) {
+   if (tmp->vid == vlan_id) {
+   DP_ERR(edev, "VLAN %u already configured\n",
+  vlan_id);
+   return -EEXIST;
+   }
+   }
+
+   vlan = rte_malloc(NULL, sizeof(struct qede_vlan_entry),
+ RTE_CACHE_LINE_SIZE);
+
+   if (!vlan) {
+   DP_ERR(edev, "Did not allocate memory for VLAN\n");
+   return -ENOMEM;
+   }
+
rc = qede_set_ucast_rx_vlan(qdev, QED_FILTER_XCAST_TYPE_ADD,
vlan_id);
-   if (rc)
+   if (rc) {
DP_ERR(edev, "Failed to add VLAN %u rc %d\n", vlan_id,
   rc);
-   else
-   if (vlan_id != 0)
-   qdev->configured_vlans++;
+   rte_free(vlan);
+   } else {
+   vlan->vid = vlan_id;
+   SLIST_INSERT_HEAD(>vlan_list_head, vlan, list);
+   qdev->configured_vlans++;
+   DP_INFO(edev, "VLAN %u added, configured_vlans %u\n",
+   vlan_id, qdev->configured_vlans);
+   }
} else {
+   SLIST_FOREACH(tmp, >vlan_list_head, list) {
+   if (tmp->vid == vlan_id)
+   break;
+   }
+
+   if (!tmp) {
+   if (qdev->configured_vlans == 0) {
+   DP_INFO(edev,
+   "No VLAN filters configured yet\n");
+   return 0;
+   }
+
+   DP_ERR(edev, "VLAN %u not configured\n", vlan_id);
+   return -EINVAL;
+   }
+
+   SLIST_REMOVE(>vlan_list_head, tmp, qede_vlan_entry, list);
+
rc = qede_set_ucast_rx_vlan(qdev, QED_FILTER_XCAST_TYPE_DEL,
vlan_id);
-   if (rc)
+   if (rc) {
DP_ERR(edev, "Failed to delete VLAN %u rc %d\n",
   vlan_id, rc);
-   else
-   if (vlan_id != 0)
-   qdev->configured_vlans--;
+   } else {
+   qdev->configured_vlans--;
+   DP_INFO(edev, "VLAN %u removed configured_vlans %u\n",
+   vlan_id, qdev->configured_vlans);
+   }
}

-   DP_INFO(edev, "vlan_id %u on 

[dpdk-dev] [PATCH v4 19/32] net/qede: remove unused/dead code

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/ecore_iov_api.h | 312 --
 drivers/net/qede/qede_eth_if.c|  10 --
 drivers/net/qede/qede_ethdev.c|   3 -
 drivers/net/qede/qede_ethdev.h|  12 --
 drivers/net/qede/qede_if.h|   9 -
 5 files changed, 346 deletions(-)

diff --git a/drivers/net/qede/base/ecore_iov_api.h 
b/drivers/net/qede/base/ecore_iov_api.h
index 14f3f47..bb8df82 100644
--- a/drivers/net/qede/base/ecore_iov_api.h
+++ b/drivers/net/qede/base/ecore_iov_api.h
@@ -680,318 +680,6 @@ int ecore_iov_get_vf_min_rate(struct ecore_hwfn *p_hwfn, 
int vfid);
  */
 enum _ecore_status_t ecore_iov_configure_min_tx_rate(struct ecore_dev *p_dev,
 int vfid, u32 rate);
-#else
-static OSAL_INLINE void ecore_iov_set_vfs_to_disable(struct ecore_hwfn *p_hwfn,
-u8 to_disable)
-{
-}
-
-static OSAL_INLINE void ecore_iov_set_vf_to_disable(struct ecore_hwfn *p_hwfn,
-   u16 rel_vf_id,
-   u8 to_disable)
-{
-}
-
-static OSAL_INLINE enum _ecore_status_t ecore_iov_init_hw_for_vf(struct
-ecore_hwfn
-* p_hwfn,
-struct
-ecore_ptt
-* p_ptt,
-u16 rel_vf_id,
-u16
-num_rx_queues)
-{
-   return ECORE_INVAL;
-}
-
-static OSAL_INLINE void ecore_iov_process_mbx_req(struct ecore_hwfn *p_hwfn,
- struct ecore_ptt *p_ptt,
- int vfid)
-{
-}
-
-static OSAL_INLINE enum _ecore_status_t ecore_iov_release_hw_for_vf(struct
-   ecore_hwfn
-   * p_hwfn,
-   struct
-   ecore_ptt
-   * p_ptt,
-   u16
-   rel_vf_id)
-{
-   return ECORE_SUCCESS;
-}
-
-#ifndef LINUX_REMOVE
-static OSAL_INLINE enum _ecore_status_t ecore_iov_set_vf_ctx(struct ecore_hwfn
-*p_hwfn, u16 vf_id,
-void *ctx)
-{
-   return ECORE_INVAL;
-}
-#endif
-static OSAL_INLINE enum _ecore_status_t ecore_iov_vf_flr_cleanup(struct
-ecore_hwfn
-* p_hwfn,
-struct
-ecore_ptt
-* p_ptt)
-{
-   return ECORE_INVAL;
-}
-
-static OSAL_INLINE enum _ecore_status_t ecore_iov_single_vf_flr_cleanup(
-   struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, u16 rel_vf_id)
-{
-   return ECORE_INVAL;
-}
-
-static OSAL_INLINE void ecore_iov_set_link(struct ecore_hwfn *p_hwfn, u16 vfid,
-  struct ecore_mcp_link_params *params,
-  struct ecore_mcp_link_state *link,
-  struct ecore_mcp_link_capabilities
-  *p_caps)
-{
-}
-
-static OSAL_INLINE void ecore_iov_get_link(struct ecore_hwfn *p_hwfn, u16 vfid,
-  struct ecore_mcp_link_params *params,
-  struct ecore_mcp_link_state *link,
-  struct ecore_mcp_link_capabilities
-  *p_caps)
-{
-}
-
-static OSAL_INLINE bool ecore_iov_is_vf_pending_flr(struct ecore_hwfn *p_hwfn,
-   u16 rel_vf_id)
-{
-   return false;
-}
-
-static OSAL_INLINE bool ecore_iov_is_valid_vfid(struct ecore_hwfn *p_hwfn,
-   int rel_vf_id,
-   bool b_enabled_only)
-{
-   

[dpdk-dev] [PATCH v4 18/32] net/qede: add missing 100G link speed capability

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

This patch fixes the missing 100G link speed advertisement
when the 100G support was initially added.

Fixes: 2af14ca79c0a ("net/qede: support 100G")

Signed-off-by: Harish Patil 
---
 doc/guides/nics/features/qede.ini| 1 +
 doc/guides/nics/features/qede_vf.ini | 1 +
 drivers/net/qede/qede_ethdev.c   | 3 ++-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/features/qede.ini 
b/doc/guides/nics/features/qede.ini
index 7690773..1d28a23 100644
--- a/doc/guides/nics/features/qede.ini
+++ b/doc/guides/nics/features/qede.ini
@@ -4,6 +4,7 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
 Link status  = Y
 Link status event= Y
 MTU update   = Y
diff --git a/doc/guides/nics/features/qede_vf.ini 
b/doc/guides/nics/features/qede_vf.ini
index aeb20d2..b4eba0c 100644
--- a/doc/guides/nics/features/qede_vf.ini
+++ b/doc/guides/nics/features/qede_vf.ini
@@ -4,6 +4,7 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
 Link status  = Y
 Link status event= Y
 MTU update   = Y
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index ec5e8a2..5da540a 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -599,7 +599,8 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
 DEV_TX_OFFLOAD_UDP_CKSUM |
 DEV_TX_OFFLOAD_TCP_CKSUM);

-   dev_info->speed_capa = ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G;
+   dev_info->speed_capa = ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G |
+  ETH_LINK_SPEED_100G;
 }

 /* return 0 means link status changed, -1 means not changed */
-- 
1.8.3.1



[dpdk-dev] [PATCH v4 17/32] net/qede/base: allow MTU change via vport-update

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

Add support to allow MTU change on a deactivated vport in
the qede/base driver and the core driver shall utilize the same.

Signed-off-by: Harish Patil 
---
 drivers/net/qede/base/ecore_l2.c | 5 +
 drivers/net/qede/base/ecore_l2_api.h | 4 
 drivers/net/qede/qede_eth_if.c   | 1 +
 drivers/net/qede/qede_eth_if.h   | 1 +
 drivers/net/qede/qede_rxtx.c | 2 ++
 5 files changed, 13 insertions(+)

diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c
index 5a38ad2..83a62e0 100644
--- a/drivers/net/qede/base/ecore_l2.c
+++ b/drivers/net/qede/base/ecore_l2.c
@@ -427,6 +427,11 @@ ecore_sp_vport_update(struct ecore_hwfn *p_hwfn,
ecore_sp_update_accept_mode(p_hwfn, p_ramrod, p_params->accept_flags);
ecore_sp_vport_update_sge_tpa(p_hwfn, p_ramrod,
  p_params->sge_tpa_params);
+   if (p_params->mtu) {
+   p_ramrod->common.update_mtu_flg = 1;
+   p_ramrod->common.mtu = OSAL_CPU_TO_LE16(p_params->mtu);
+   }
+
return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL);
 }

diff --git a/drivers/net/qede/base/ecore_l2_api.h 
b/drivers/net/qede/base/ecore_l2_api.h
index 09688eb..447d1fb 100644
--- a/drivers/net/qede/base/ecore_l2_api.h
+++ b/drivers/net/qede/base/ecore_l2_api.h
@@ -322,6 +322,10 @@ struct ecore_sp_vport_update_params {
struct ecore_rss_params *rss_params;
struct ecore_filter_accept_flags accept_flags;
struct ecore_sge_tpa_params *sge_tpa_params;
+   /* MTU change - notice this requires the vport to be disabled.
+* If non-zero, value would be used.
+*/
+   u16 mtu;
 };

 /**
diff --git a/drivers/net/qede/qede_eth_if.c b/drivers/net/qede/qede_eth_if.c
index e108af1..9855d0e 100644
--- a/drivers/net/qede/qede_eth_if.c
+++ b/drivers/net/qede/qede_eth_if.c
@@ -92,6 +92,7 @@ qed_update_vport(struct ecore_dev *edev, struct 
qed_update_vport_params *params)
sp_params.accept_any_vlan = params->accept_any_vlan;
sp_params.update_accept_any_vlan_flg =
params->update_accept_any_vlan_flg;
+   sp_params.mtu = params->mtu;

/* RSS - is a bit tricky, since upper-layer isn't familiar with hwfns.
 * We need to re-fix the rss values per engine for CMT.
diff --git a/drivers/net/qede/qede_eth_if.h b/drivers/net/qede/qede_eth_if.h
index 299a2aa..7840a37 100644
--- a/drivers/net/qede/qede_eth_if.h
+++ b/drivers/net/qede/qede_eth_if.h
@@ -75,6 +75,7 @@ struct qed_update_vport_params {
uint8_t accept_any_vlan;
uint8_t update_rss_flg;
struct qed_update_vport_rss_params rss_params;
+   uint16_t mtu;
 };

 struct qed_start_vport_params {
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index e3409a9..6973d1c 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -650,6 +650,8 @@ static int qede_start_queues(struct rte_eth_dev *eth_dev, 
bool clear_stats)

/* Prepare and send the vport enable */
memset(_update_params, 0, sizeof(vport_update_params));
+   /* Update MTU via vport update */
+   vport_update_params.mtu = qdev->mtu;
vport_update_params.vport_id = 0;
vport_update_params.update_vport_active_flg = 1;
vport_update_params.vport_active_flg = 1;
-- 
1.8.3.1



[dpdk-dev] [PATCH v4 16/32] net/qede: fix port (re)configuration issue

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

Some applications set port configuration params like promisc mode
before calling dev_start(). This config results in a firmware exception
since this operation internally translates to sending of VPORT-UPDATE
before VPORT-START ramrod which is considered illegal from firmware
standpoint. So the fix is to send VPORT-START ramrod sooner
in dev_configure() rather than deferring it to dev_start().
This requires a bit of reshuffling in the code to move sending of
VPORT-START from qede_start_queues() to qede_dev_configure()
and VPORT-STOP from qede_stop_queues() to qede_dev_stop().

This sequence change also exposes a flaw in the port restart
flows where the fastpath resource allocation routine qede_init_fp()
functionalities need to be split, so that appropriate action is taken
based on the current port state. Eg: Do not re-initialize the status
block in a port restart case. This change ensures port start/stop
can be paired.

A new port state QEDE_DEV_CONFIG is added to distinguish between
port started from scratch vs port requiring a reconfig (like MTU).
The function qede_config_rx_mode() is removed since the individual
port config will be replayed anyways on a restart.

Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Harish Patil 
---
 drivers/net/qede/qede_eth_if.c |  14 ++-
 drivers/net/qede/qede_eth_if.h |   2 +
 drivers/net/qede/qede_ethdev.c | 130 ---
 drivers/net/qede/qede_ethdev.h |  12 +--
 drivers/net/qede/qede_rxtx.c   | 232 +
 drivers/net/qede/qede_rxtx.h   |   7 +-
 6 files changed, 208 insertions(+), 189 deletions(-)

diff --git a/drivers/net/qede/qede_eth_if.c b/drivers/net/qede/qede_eth_if.c
index a00f05d..e108af1 100644
--- a/drivers/net/qede/qede_eth_if.c
+++ b/drivers/net/qede/qede_eth_if.c
@@ -40,8 +40,6 @@ qed_start_vport(struct ecore_dev *edev, struct 
qed_start_vport_params *p_params)
return rc;
}

-   ecore_hw_start_fastpath(p_hwfn);
-
DP_VERBOSE(edev, ECORE_MSG_SPQ,
   "Started V-PORT %d with MTU %d\n",
   p_params->vport_id, p_params->mtu);
@@ -295,6 +293,17 @@ static int qed_fastpath_stop(struct ecore_dev *edev)
return 0;
 }

+static void qed_fastpath_start(struct ecore_dev *edev)
+{
+   struct ecore_hwfn *p_hwfn;
+   int i;
+
+   for_each_hwfn(edev, i) {
+   p_hwfn = >hwfns[i];
+   ecore_hw_start_fastpath(p_hwfn);
+   }
+}
+
 static void
 qed_get_vport_stats(struct ecore_dev *edev, struct ecore_eth_stats *stats)
 {
@@ -444,6 +453,7 @@ static const struct qed_eth_ops qed_eth_ops_pass = {
INIT_STRUCT_FIELD(q_tx_stop, _stop_txq),
INIT_STRUCT_FIELD(eth_cqe_completion, _fp_cqe_completion),
INIT_STRUCT_FIELD(fastpath_stop, _fastpath_stop),
+   INIT_STRUCT_FIELD(fastpath_start, _fastpath_start),
INIT_STRUCT_FIELD(get_vport_stats, _get_vport_stats),
INIT_STRUCT_FIELD(filter_config, _configure_filter),
 };
diff --git a/drivers/net/qede/qede_eth_if.h b/drivers/net/qede/qede_eth_if.h
index 26968eb..299a2aa 100644
--- a/drivers/net/qede/qede_eth_if.h
+++ b/drivers/net/qede/qede_eth_if.h
@@ -158,6 +158,8 @@ struct qed_eth_ops {

int (*fastpath_stop)(struct ecore_dev *edev);

+   void (*fastpath_start)(struct ecore_dev *edev);
+
void (*get_vport_stats)(struct ecore_dev *edev,
struct ecore_eth_stats *stats);

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index e2141cb..ec5e8a2 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -348,52 +348,6 @@ static void qede_config_accept_any_vlan(struct qede_dev 
*qdev, bool action)
}
 }

-void qede_config_rx_mode(struct rte_eth_dev *eth_dev)
-{
-   struct qede_dev *qdev = eth_dev->data->dev_private;
-   struct ecore_dev *edev = >edev;
-   /* TODO: - QED_FILTER_TYPE_UCAST */
-   enum qed_filter_rx_mode_type accept_flags =
-   QED_FILTER_RX_MODE_TYPE_REGULAR;
-   struct qed_filter_params rx_mode;
-   int rc;
-
-   /* Configure the struct for the Rx mode */
-   memset(_mode, 0, sizeof(struct qed_filter_params));
-   rx_mode.type = QED_FILTER_TYPE_RX_MODE;
-
-   rc = qede_set_ucast_rx_mac(qdev, QED_FILTER_XCAST_TYPE_REPLACE,
-  eth_dev->data->mac_addrs[0].addr_bytes);
-   if (rte_eth_promiscuous_get(eth_dev->data->port_id) == 1) {
-   accept_flags = QED_FILTER_RX_MODE_TYPE_PROMISC;
-   } else {
-   rc = qede_set_ucast_rx_mac(qdev, QED_FILTER_XCAST_TYPE_ADD,
-  eth_dev->data->
-  mac_addrs[0].addr_bytes);
-   if (rc) {
-   DP_ERR(edev, "Unable to add filter\n");
-   

[dpdk-dev] [PATCH v4 15/32] net/qede: enable support for unequal number of Rx/Tx queues

2016-10-18 Thread Rasesh Mody
From: Sony Chacko 

Previous release of the qede PMD had a limitation that the
driver expects the number of tx and rx queues to be the same.
This patch fixes this issue by making appropriate changes in
control and data path.

Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Sony Chacko 
---
 doc/guides/nics/qede.rst   |   3 +-
 drivers/net/qede/qede_ethdev.c |  23 +--
 drivers/net/qede/qede_ethdev.h |  16 +-
 drivers/net/qede/qede_rxtx.c   | 376 -
 drivers/net/qede/qede_rxtx.h   |   7 +-
 5 files changed, 212 insertions(+), 213 deletions(-)

diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index d107a7d..4ec75e4 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -50,7 +50,7 @@ Supported Features
 - Jumbo frames (using single buffer)
 - VLAN offload - Filtering and stripping
 - Stateless checksum offloads (IPv4/TCP/UDP)
-- Multiple Rx/Tx queues (queue-pairs)
+- Multiple Rx/Tx queues
 - RSS (with user configurable table/key)
 - TSS
 - Multiple MAC address
@@ -63,7 +63,6 @@ Non-supported Features
 --

 - Scatter-Gather Rx/Tx frames
-- Unequal number of Rx/Tx queues
 - SR-IOV PF
 - Tunneling offloads
 - Reload of the PMD after a non-graceful termination
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 452139d..e2141cb 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -496,31 +496,26 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)

PMD_INIT_FUNC_TRACE(edev);

-   if (eth_dev->data->nb_rx_queues != eth_dev->data->nb_tx_queues) {
-   DP_NOTICE(edev, false,
- "Unequal number of rx/tx queues "
- "is not supported RX=%u TX=%u\n",
- eth_dev->data->nb_rx_queues,
- eth_dev->data->nb_tx_queues);
-   return -EINVAL;
-   }
-
/* Check requirements for 100G mode */
if (edev->num_hwfns > 1) {
-   if (eth_dev->data->nb_rx_queues < 2) {
+   if (eth_dev->data->nb_rx_queues < 2 ||
+   eth_dev->data->nb_tx_queues < 2) {
DP_NOTICE(edev, false,
- "100G mode requires minimum two queues\n");
+ "100G mode needs min. 2 RX/TX queues\n");
return -EINVAL;
}

-   if ((eth_dev->data->nb_rx_queues % 2) != 0) {
+   if ((eth_dev->data->nb_rx_queues % 2 != 0) ||
+   (eth_dev->data->nb_tx_queues % 2 != 0)) {
DP_NOTICE(edev, false,
- "100G mode requires even number of queues\n");
+ "100G mode needs even no. of RX/TX queues\n");
return -EINVAL;
}
}

-   qdev->num_rss = eth_dev->data->nb_rx_queues;
+   qdev->fp_num_tx = eth_dev->data->nb_tx_queues;
+   qdev->fp_num_rx = eth_dev->data->nb_rx_queues;
+   qdev->num_queues = qdev->fp_num_tx + qdev->fp_num_rx;

/* Initial state */
qdev->state = QEDE_CLOSE;
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index abb33af..1f62283 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -62,8 +62,8 @@
 #define QEDE_MAX_TSS_CNT(edev)  ((edev)->dev_info.num_queues * \
(edev)->dev_info.num_tc)

-#define QEDE_RSS_CNT(edev) ((edev)->num_rss)
-#define QEDE_TSS_CNT(edev) ((edev)->num_rss * (edev)->num_tc)
+#define QEDE_RSS_CNT(edev) ((edev)->fp_num_rx)
+#define QEDE_TSS_CNT(edev) ((edev)->fp_num_rx * (edev)->num_tc)

 #define QEDE_DUPLEX_FULL   1
 #define QEDE_DUPLEX_HALF   2
@@ -76,6 +76,12 @@

 #define QEDE_INIT_EDEV(adapter) (&((struct qede_dev *)adapter)->edev)

+#define QEDE_QUEUE_CNT(qdev) ((qdev)->num_queues)
+#define QEDE_RSS_COUNT(qdev) ((qdev)->num_queues - (qdev)->fp_num_tx)
+#define QEDE_TSS_COUNT(qdev) (((qdev)->num_queues - (qdev)->fp_num_rx) * \
+   (qdev)->num_tc)
+#define QEDE_TC_IDX(qdev, txqidx) ((txqidx) / QEDE_TSS_COUNT(qdev))
+
 #define QEDE_INIT(eth_dev) {   \
struct qede_dev *qdev = eth_dev->data->dev_private; \
struct ecore_dev *edev = >edev;   \
@@ -138,8 +144,10 @@ struct qede_dev {
struct qed_update_vport_rss_params rss_params;
uint32_t flags;
bool gro_disable;
-   struct qede_rx_queue **rx_queues;
-   struct qede_tx_queue **tx_queues;
+   uint16_t num_queues;
+   uint8_t fp_num_tx;
+   uint8_t fp_num_rx;
+
enum dev_state state;

/* Vlans */
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index b5a40fe..00584a9 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ 

[dpdk-dev] [PATCH v4 14/32] net/qede/base: add MFW crash dump support

2016-10-18 Thread Rasesh Mody
Add support for management firmware(MFW) crash dump collection.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/ecore.h |   3 +
 drivers/net/qede/base/ecore_dev.c |  22 ++---
 drivers/net/qede/base/ecore_dev_api.h |  29 ---
 drivers/net/qede/base/ecore_mcp.c | 151 ++
 drivers/net/qede/base/ecore_mcp.h |  45 ++
 drivers/net/qede/base/ecore_mcp_api.h |  10 +++
 drivers/net/qede/qede_main.c  |  17 ++--
 7 files changed, 249 insertions(+), 28 deletions(-)

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 874c3a3..89e2bd0 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -735,6 +735,9 @@ struct ecore_dev {

boolattn_clr_en;

+   /* Indicates whether allowing the MFW to collect a crash dump */
+   boolmdump_en;
+
/* Indicates if the reg_fifo is checked after any register access */
boolchk_reg_fifo;

diff --git a/drivers/net/qede/base/ecore_dev.c 
b/drivers/net/qede/base/ecore_dev.c
index 319edeb..b530173 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -1619,24 +1619,20 @@ static void ecore_reset_mb_shadow(struct ecore_hwfn 
*p_hwfn,
 }

 enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
-  struct ecore_tunn_start_params *p_tunn,
-  bool b_hw_start,
-  enum ecore_int_mode int_mode,
-  bool allow_npar_tx_switch,
-  const u8 *bin_fw_data)
+  struct ecore_hw_init_params *p_params)
 {
enum _ecore_status_t rc, mfw_rc;
u32 load_code, param;
int i, j;

-   if ((int_mode == ECORE_INT_MODE_MSI) && (p_dev->num_hwfns > 1)) {
+   if (p_params->int_mode == ECORE_INT_MODE_MSI && p_dev->num_hwfns > 1) {
DP_NOTICE(p_dev, false,
  "MSI mode is not supported for CMT devices\n");
return ECORE_INVAL;
}

if (IS_PF(p_dev)) {
-   rc = ecore_init_fw_data(p_dev, bin_fw_data);
+   rc = ecore_init_fw_data(p_dev, p_params->bin_fw_data);
if (rc != ECORE_SUCCESS)
return rc;
}
@@ -1733,9 +1729,11 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev 
*p_dev,
/* Fall into */
case FW_MSG_CODE_DRV_LOAD_FUNCTION:
rc = ecore_hw_init_pf(p_hwfn, p_hwfn->p_main_ptt,
- p_tunn, p_hwfn->hw_info.hw_mode,
- b_hw_start, int_mode,
- allow_npar_tx_switch);
+ p_params->p_tunn,
+ p_hwfn->hw_info.hw_mode,
+ p_params->b_hw_start,
+ p_params->int_mode,
+ p_params->allow_npar_tx_switch);
break;
default:
rc = ECORE_NOTIMPL;
@@ -1759,6 +1757,10 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev 
*p_dev,
return mfw_rc;
}

+   ecore_mcp_mdump_get_info(p_hwfn, p_hwfn->p_main_ptt);
+   ecore_mcp_mdump_set_values(p_hwfn, p_hwfn->p_main_ptt,
+  p_params->epoch);
+
/* send DCBX attention request command */
DP_VERBOSE(p_hwfn, ECORE_MSG_DCB,
   "sending phony dcbx set command to trigger DCBx 
attention handling\n");
diff --git a/drivers/net/qede/base/ecore_dev_api.h 
b/drivers/net/qede/base/ecore_dev_api.h
index 1a810b5..042c0af 100644
--- a/drivers/net/qede/base/ecore_dev_api.h
+++ b/drivers/net/qede/base/ecore_dev_api.h
@@ -57,26 +57,31 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev 
*p_dev);
  */
 void ecore_resc_setup(struct ecore_dev *p_dev);

+struct ecore_hw_init_params {
+   /* tunnelling parameters */
+   struct ecore_tunn_start_params *p_tunn;
+   bool b_hw_start;
+   /* interrupt mode [msix, inta, etc.] to use */
+   enum ecore_int_mode int_mode;
+/* npar tx switching to be used for vports configured for tx-switching */
+
+   bool allow_npar_tx_switch;
+   /* binary fw data pointer in binary fw file */
+   const u8 *bin_fw_data;
+   /* the OS Epoch time in seconds */
+   u32 epoch;
+};
+
 /**
  * @brief ecore_hw_init -
  *
  * @param p_dev
- * @param p_tunn - tunneling parameters
- * @param b_hw_start
- * @param int_mode - interrupt mode [msix, inta, etc.] to use.
- * @param allow_npar_tx_switch - npar tx switching 

[dpdk-dev] [PATCH v4 13/32] net/qede/base: comment enhancements

2016-10-18 Thread Rasesh Mody
Comment additions and modifications

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/ecore_dev_api.h  |   4 +-
 drivers/net/qede/base/ecore_gtt_reg_addr.h |  10 +
 drivers/net/qede/base/ecore_hsi_common.h   | 863 +++-
 drivers/net/qede/base/ecore_hsi_eth.h  | 877 ++---
 drivers/net/qede/base/ecore_hw_defs.h  |  33 +-
 drivers/net/qede/base/ecore_init_ops.h |   6 +-
 drivers/net/qede/base/ecore_mcp.h  |  31 +-
 drivers/net/qede/base/ecore_sp_api.h   |   5 +-
 drivers/net/qede/base/eth_common.h | 154 +++--
 drivers/net/qede/base/mcp_public.h |  99 +++-
 10 files changed, 1519 insertions(+), 563 deletions(-)

diff --git a/drivers/net/qede/base/ecore_dev_api.h 
b/drivers/net/qede/base/ecore_dev_api.h
index e6924bd..1a810b5 100644
--- a/drivers/net/qede/base/ecore_dev_api.h
+++ b/drivers/net/qede/base/ecore_dev_api.h
@@ -98,8 +98,8 @@ enum _ecore_status_t ecore_hw_stop(struct ecore_dev *p_dev);

 /**
  * @brief ecore_hw_stop_fastpath -should be called incase
- *slowpath is still required for the device, but
- *fastpath is not.
+ *slowpath is still required for the device,
+ *but fastpath is not.
  *
  * @param p_dev
  *
diff --git a/drivers/net/qede/base/ecore_gtt_reg_addr.h 
b/drivers/net/qede/base/ecore_gtt_reg_addr.h
index 0eba1aa..6395b7c 100644
--- a/drivers/net/qede/base/ecore_gtt_reg_addr.h
+++ b/drivers/net/qede/base/ecore_gtt_reg_addr.h
@@ -10,33 +10,43 @@
 #define GTT_REG_ADDR_H

 /* Win 2 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_IGU_CMD  
0x00f000UL

 /* Win 3 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_TSDM_RAM 
0x01UL

 /* Win 4 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_MSDM_RAM 
0x011000UL

 /* Win 5 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_MSDM_RAM_1024
0x012000UL

 /* Win 6 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_USDM_RAM 
0x013000UL

 /* Win 7 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_USDM_RAM_1024
0x014000UL

 /* Win 8 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_USDM_RAM_2048
0x015000UL

 /* Win 9 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_XSDM_RAM 
0x016000UL

 /* Win 10 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_YSDM_RAM 
0x017000UL

 /* Win 11 */
+/* Access:RW   DataWidth:0x20Chips: BB_A0 BB_B0 K2 */
 #define GTT_BAR0_MAP_REG_PSDM_RAM 
0x018000UL

 #endif
diff --git a/drivers/net/qede/base/ecore_hsi_common.h 
b/drivers/net/qede/base/ecore_hsi_common.h
index 3c4d7c0..179d410 100644
--- a/drivers/net/qede/base/ecore_hsi_common.h
+++ b/drivers/net/qede/base/ecore_hsi_common.h
@@ -13,6 +13,7 @@
 //
 #include "common_hsi.h"

+
 /*
  * opcodes for the event ring
  */
@@ -30,6 +31,7 @@ enum common_event_opcode {
MAX_COMMON_EVENT_OPCODE
 };

+
 /*
  * Common Ramrod Command IDs
  */
@@ -45,6 +47,7 @@ enum common_ramrod_cmd_id {
MAX_COMMON_RAMROD_CMD_ID
 };

+
 /*
  * The core storm context for the Ystorm
  */
@@ -65,8 +68,8 @@ struct pstorm_core_conn_st_ctx {
 struct xstorm_core_conn_st_ctx {
__le32 spq_base_lo /* SPQ Ring Base Address low dword */;
__le32 spq_base_hi /* SPQ Ring Base Address high dword */;
-   struct regpair consolid_base_addr /* Consolidation Ring Base Address */
- ;
+/* Consolidation Ring Base Address */
+   struct regpair consolid_base_addr;
__le16 spq_cons /* SPQ Ring Consumer */;
__le16 consolid_cons /* Consolidation Ring Consumer */;
__le32 reserved0[55] /* Pad to 15 cycles */;
@@ -76,210 +79,300 @@ struct xstorm_core_conn_ag_ctx {
u8 reserved0 /* cdu_validation */;
u8 core_state /* state */;
u8 flags0;
+/* exist_in_qm0 */
 #define XSTORM_CORE_CONN_AG_CTX_EXIST_IN_QM0_MASK 0x1
 #define XSTORM_CORE_CONN_AG_CTX_EXIST_IN_QM0_SHIFT0
+/* exist_in_qm1 */
 #define XSTORM_CORE_CONN_AG_CTX_RESERVED1_MASK0x1
 #define XSTORM_CORE_CONN_AG_CTX_RESERVED1_SHIFT   1
+/* exist_in_qm2 */
 #define XSTORM_CORE_CONN_AG_CTX_RESERVED2_MASK0x1
 #define XSTORM_CORE_CONN_AG_CTX_RESERVED2_SHIFT   2
+/* exist_in_qm3 */
 #define XSTORM_CORE_CONN_AG_CTX_EXIST_IN_QM3_MASK 0x1
 #define XSTORM_CORE_CONN_AG_CTX_EXIST_IN_QM3_SHIFT3

[dpdk-dev] [PATCH v4 12/32] net/qede/base: rename structure and defines

2016-10-18 Thread Rasesh Mody
Renamed following to match with HSI changes
 - PMM_* to ETH_*
 - pmm_* to eth_*

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/ecore_l2.c   |  90 ++---
 drivers/net/qede/base/ecore_mcp.c  |  12 +--
 drivers/net/qede/base/mcp_public.h | 158 +
 3 files changed, 140 insertions(+), 120 deletions(-)

diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c
index b1190e4..5a38ad2 100644
--- a/drivers/net/qede/base/ecore_l2.c
+++ b/drivers/net/qede/base/ecore_l2.c
@@ -1583,51 +1583,51 @@ static void __ecore_get_vport_port_stats(struct 
ecore_hwfn *p_hwfn,
  OFFSETOF(struct public_port, stats),
  sizeof(port_stats));

-   p_stats->rx_64_byte_packets += port_stats.pmm.r64;
-   p_stats->rx_65_to_127_byte_packets += port_stats.pmm.r127;
-   p_stats->rx_128_to_255_byte_packets += port_stats.pmm.r255;
-   p_stats->rx_256_to_511_byte_packets += port_stats.pmm.r511;
-   p_stats->rx_512_to_1023_byte_packets += port_stats.pmm.r1023;
-   p_stats->rx_1024_to_1518_byte_packets += port_stats.pmm.r1518;
-   p_stats->rx_1519_to_1522_byte_packets += port_stats.pmm.r1522;
-   p_stats->rx_1519_to_2047_byte_packets += port_stats.pmm.r2047;
-   p_stats->rx_2048_to_4095_byte_packets += port_stats.pmm.r4095;
-   p_stats->rx_4096_to_9216_byte_packets += port_stats.pmm.r9216;
-   p_stats->rx_9217_to_16383_byte_packets += port_stats.pmm.r16383;
-   p_stats->rx_crc_errors += port_stats.pmm.rfcs;
-   p_stats->rx_mac_crtl_frames += port_stats.pmm.rxcf;
-   p_stats->rx_pause_frames += port_stats.pmm.rxpf;
-   p_stats->rx_pfc_frames += port_stats.pmm.rxpp;
-   p_stats->rx_align_errors += port_stats.pmm.raln;
-   p_stats->rx_carrier_errors += port_stats.pmm.rfcr;
-   p_stats->rx_oversize_packets += port_stats.pmm.rovr;
-   p_stats->rx_jabbers += port_stats.pmm.rjbr;
-   p_stats->rx_undersize_packets += port_stats.pmm.rund;
-   p_stats->rx_fragments += port_stats.pmm.rfrg;
-   p_stats->tx_64_byte_packets += port_stats.pmm.t64;
-   p_stats->tx_65_to_127_byte_packets += port_stats.pmm.t127;
-   p_stats->tx_128_to_255_byte_packets += port_stats.pmm.t255;
-   p_stats->tx_256_to_511_byte_packets += port_stats.pmm.t511;
-   p_stats->tx_512_to_1023_byte_packets += port_stats.pmm.t1023;
-   p_stats->tx_1024_to_1518_byte_packets += port_stats.pmm.t1518;
-   p_stats->tx_1519_to_2047_byte_packets += port_stats.pmm.t2047;
-   p_stats->tx_2048_to_4095_byte_packets += port_stats.pmm.t4095;
-   p_stats->tx_4096_to_9216_byte_packets += port_stats.pmm.t9216;
-   p_stats->tx_9217_to_16383_byte_packets += port_stats.pmm.t16383;
-   p_stats->tx_pause_frames += port_stats.pmm.txpf;
-   p_stats->tx_pfc_frames += port_stats.pmm.txpp;
-   p_stats->tx_lpi_entry_count += port_stats.pmm.tlpiec;
-   p_stats->tx_total_collisions += port_stats.pmm.tncl;
-   p_stats->rx_mac_bytes += port_stats.pmm.rbyte;
-   p_stats->rx_mac_uc_packets += port_stats.pmm.rxuca;
-   p_stats->rx_mac_mc_packets += port_stats.pmm.rxmca;
-   p_stats->rx_mac_bc_packets += port_stats.pmm.rxbca;
-   p_stats->rx_mac_frames_ok += port_stats.pmm.rxpok;
-   p_stats->tx_mac_bytes += port_stats.pmm.tbyte;
-   p_stats->tx_mac_uc_packets += port_stats.pmm.txuca;
-   p_stats->tx_mac_mc_packets += port_stats.pmm.txmca;
-   p_stats->tx_mac_bc_packets += port_stats.pmm.txbca;
-   p_stats->tx_mac_ctrl_frames += port_stats.pmm.txcf;
+   p_stats->rx_64_byte_packets += port_stats.eth.r64;
+   p_stats->rx_65_to_127_byte_packets += port_stats.eth.r127;
+   p_stats->rx_128_to_255_byte_packets += port_stats.eth.r255;
+   p_stats->rx_256_to_511_byte_packets += port_stats.eth.r511;
+   p_stats->rx_512_to_1023_byte_packets += port_stats.eth.r1023;
+   p_stats->rx_1024_to_1518_byte_packets += port_stats.eth.r1518;
+   p_stats->rx_1519_to_1522_byte_packets += port_stats.eth.r1522;
+   p_stats->rx_1519_to_2047_byte_packets += port_stats.eth.r2047;
+   p_stats->rx_2048_to_4095_byte_packets += port_stats.eth.r4095;
+   p_stats->rx_4096_to_9216_byte_packets += port_stats.eth.r9216;
+   p_stats->rx_9217_to_16383_byte_packets += port_stats.eth.r16383;
+   p_stats->rx_crc_errors += port_stats.eth.rfcs;
+   p_stats->rx_mac_crtl_frames += port_stats.eth.rxcf;
+   p_stats->rx_pause_frames += port_stats.eth.rxpf;
+   p_stats->rx_pfc_frames += port_stats.eth.rxpp;
+   p_stats->rx_align_errors += port_stats.eth.raln;
+   p_stats->rx_carrier_errors += port_stats.eth.rfcr;
+   p_stats->rx_oversize_packets += port_stats.eth.rovr;
+   p_stats->rx_jabbers += port_stats.eth.rjbr;
+   p_stats->rx_undersize_packets += port_stats.eth.rund;
+   p_stats->rx_fragments += port_stats.eth.rfrg;
+   p_stats->tx_64_byte_packets += port_stats.eth.t64;
+   

[dpdk-dev] [PATCH v4 11/32] net/qede/base: update base driver

2016-10-18 Thread Rasesh Mody
This patch updates the base driver and incorporates necessary changes
required to bring in the new firmware 8.10.9.0.

In addition, it would allow driver to add new functionalities that might
be needed in future.

Signed-off-by: Rasesh Mody 
---
 doc/guides/nics/features/qede.ini   |2 +
 doc/guides/nics/features/qede_vf.ini|2 +
 doc/guides/nics/qede.rst|   15 +-
 drivers/net/qede/base/bcm_osal.h|6 +-
 drivers/net/qede/base/ecore.h   |  166 ++-
 drivers/net/qede/base/ecore_chain.h |   17 +-
 drivers/net/qede/base/ecore_cxt.c   |  319 +-
 drivers/net/qede/base/ecore_cxt.h   |   49 +-
 drivers/net/qede/base/ecore_cxt_api.h   |   15 -
 drivers/net/qede/base/ecore_dcbx.c  |  581 +-
 drivers/net/qede/base/ecore_dcbx.h  |   18 +-
 drivers/net/qede/base/ecore_dcbx_api.h  |  128 ++-
 drivers/net/qede/base/ecore_dev.c   | 1551 +++---
 drivers/net/qede/base/ecore_dev_api.h   |   92 +-
 drivers/net/qede/base/ecore_hsi_eth.h   |  120 +-
 drivers/net/qede/base/ecore_hw.c|  212 ++--
 drivers/net/qede/base/ecore_hw.h|   16 +-
 drivers/net/qede/base/ecore_init_fw_funcs.c |  324 --
 drivers/net/qede/base/ecore_init_fw_funcs.h |  102 +-
 drivers/net/qede/base/ecore_init_ops.c  |5 +-
 drivers/net/qede/base/ecore_int.c   |  271 ++---
 drivers/net/qede/base/ecore_int.h   |   19 +-
 drivers/net/qede/base/ecore_int_api.h   |   11 +
 drivers/net/qede/base/ecore_iov_api.h   |  104 +-
 drivers/net/qede/base/ecore_iro.h   |  222 ++--
 drivers/net/qede/base/ecore_iro_values.h|  108 +-
 drivers/net/qede/base/ecore_l2.c|  292 ++---
 drivers/net/qede/base/ecore_l2.h|   57 +-
 drivers/net/qede/base/ecore_l2_api.h|9 +-
 drivers/net/qede/base/ecore_mcp.c   |  350 +++---
 drivers/net/qede/base/ecore_mcp.h   |   29 +-
 drivers/net/qede/base/ecore_mcp_api.h   |   81 +-
 drivers/net/qede/base/ecore_proto_if.h  |   59 +
 drivers/net/qede/base/ecore_rt_defs.h   |  639 +--
 drivers/net/qede/base/ecore_sp_commands.c   |   85 +-
 drivers/net/qede/base/ecore_sp_commands.h   |   30 +
 drivers/net/qede/base/ecore_spq.c   |  167 +--
 drivers/net/qede/base/ecore_spq.h   |5 +-
 drivers/net/qede/base/ecore_sriov.c | 1596 +--
 drivers/net/qede/base/ecore_sriov.h |  149 +--
 drivers/net/qede/base/ecore_vf.c|  736 ++--
 drivers/net/qede/base/ecore_vf.h|  224 +---
 drivers/net/qede/base/ecore_vf_api.h|   93 +-
 drivers/net/qede/base/ecore_vfpf_if.h   |  162 ++-
 drivers/net/qede/base/eth_common.h  |  203 ++--
 drivers/net/qede/base/mcp_public.h  |  408 +--
 drivers/net/qede/base/nvm_cfg.h |  606 +-
 drivers/net/qede/qede_eth_if.c  |1 +
 drivers/net/qede/qede_main.c|   20 +-
 drivers/net/qede/qede_rxtx.h|4 +
 50 files changed, 6906 insertions(+), 3574 deletions(-)

diff --git a/doc/guides/nics/features/qede.ini 
b/doc/guides/nics/features/qede.ini
index 0df93a6..7690773 100644
--- a/doc/guides/nics/features/qede.ini
+++ b/doc/guides/nics/features/qede.ini
@@ -19,6 +19,8 @@ VLAN filter  = Y
 Flow control = Y
 CRC offload  = Y
 VLAN offload = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
 Packet type parsing  = Y
 Basic stats  = Y
 Extended stats   = Y
diff --git a/doc/guides/nics/features/qede_vf.ini 
b/doc/guides/nics/features/qede_vf.ini
index f925659..aeb20d2 100644
--- a/doc/guides/nics/features/qede_vf.ini
+++ b/doc/guides/nics/features/qede_vf.ini
@@ -20,6 +20,8 @@ VLAN filter  = Y
 Flow control = Y
 CRC offload  = Y
 VLAN offload = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
 Packet type parsing  = Y
 Basic stats  = Y
 Extended stats   = Y
diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index 3af755e..d107a7d 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -32,7 +32,7 @@ QEDE Poll Mode Driver
 ==

 The QEDE poll mode driver library (**librte_pmd_qede**) implements support
-for **QLogic FastLinQ QL4 25G/40G CNA** family of adapters as well
+for **QLogic FastLinQ QL4 25G/40G/100G CNA** family of adapters as well
 as their virtual functions (VF) in SR-IOV context. It is supported on
 several standard Linux distros like RHEL7.x, SLES12.x and Ubuntu.
 It is compile-tested under FreeBSD OS.
@@ -55,14 +55,15 @@ Supported Features
 - TSS
 - Multiple MAC address
 - Default pause flow control
-- SR-IOV VF for 25G/40G modes
+- SR-IOV VF
+- MTU change
+- Multiprocess aware

 Non-supported Features
 --

 - Scatter-Gather Rx/Tx frames
 - Unequal number of Rx/Tx queues
-- MTU 

[dpdk-dev] [PATCH v4 10/32] net/qede: add NIC selftest and query sensor info support

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

This patch adds API support for NIC selftests (BIST) and APIs to retrieve
GPIO info, sensor data like temperature, MBA versions, ECC events etc.

Signed-off-by: Harish Patil 
---
 drivers/net/qede/base/ecore_mcp.c | 314 ++
 drivers/net/qede/base/ecore_mcp_api.h | 155 +
 drivers/net/qede/base/mcp_public.h| 100 +++
 3 files changed, 569 insertions(+)

diff --git a/drivers/net/qede/base/ecore_mcp.c 
b/drivers/net/qede/base/ecore_mcp.c
index 12e1ec1..5baa5a7 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -2021,3 +2021,317 @@ enum _ecore_status_t ecore_mcp_gpio_write(struct 
ecore_hwfn *p_hwfn,

return ECORE_SUCCESS;
 }
+
+enum _ecore_status_t ecore_mcp_gpio_info(struct ecore_hwfn *p_hwfn,
+struct ecore_ptt *p_ptt,
+u16 gpio, u32 *gpio_direction,
+u32 *gpio_ctrl)
+{
+   u32 drv_mb_param = 0, rsp, val = 0;
+   enum _ecore_status_t rc = ECORE_SUCCESS;
+
+   drv_mb_param = gpio << DRV_MB_PARAM_GPIO_NUMBER_SHIFT;
+
+   rc = ecore_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_GPIO_INFO,
+  drv_mb_param, , );
+   if (rc != ECORE_SUCCESS)
+   return rc;
+
+   *gpio_direction = (val & DRV_MB_PARAM_GPIO_DIRECTION_MASK) >>
+  DRV_MB_PARAM_GPIO_DIRECTION_SHIFT;
+   *gpio_ctrl = (val & DRV_MB_PARAM_GPIO_CTRL_MASK) >>
+ DRV_MB_PARAM_GPIO_CTRL_SHIFT;
+
+   if ((rsp & FW_MSG_CODE_MASK) != FW_MSG_CODE_GPIO_OK)
+   return ECORE_UNKNOWN_ERROR;
+
+   return ECORE_SUCCESS;
+}
+
+enum _ecore_status_t ecore_mcp_bist_register_test(struct ecore_hwfn *p_hwfn,
+ struct ecore_ptt *p_ptt)
+{
+   u32 drv_mb_param = 0, rsp, param;
+   enum _ecore_status_t rc = ECORE_SUCCESS;
+
+   drv_mb_param = (DRV_MB_PARAM_BIST_REGISTER_TEST <<
+   DRV_MB_PARAM_BIST_TEST_INDEX_SHIFT);
+
+   rc = ecore_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_BIST_TEST,
+  drv_mb_param, , );
+
+   if (rc != ECORE_SUCCESS)
+   return rc;
+
+   if (((rsp & FW_MSG_CODE_MASK) != FW_MSG_CODE_OK) ||
+   (param != DRV_MB_PARAM_BIST_RC_PASSED))
+   rc = ECORE_UNKNOWN_ERROR;
+
+   return rc;
+}
+
+enum _ecore_status_t ecore_mcp_bist_clock_test(struct ecore_hwfn *p_hwfn,
+  struct ecore_ptt *p_ptt)
+{
+   u32 drv_mb_param = 0, rsp, param;
+   enum _ecore_status_t rc = ECORE_SUCCESS;
+
+   drv_mb_param = (DRV_MB_PARAM_BIST_CLOCK_TEST <<
+   DRV_MB_PARAM_BIST_TEST_INDEX_SHIFT);
+
+   rc = ecore_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_BIST_TEST,
+  drv_mb_param, , );
+
+   if (rc != ECORE_SUCCESS)
+   return rc;
+
+   if (((rsp & FW_MSG_CODE_MASK) != FW_MSG_CODE_OK) ||
+   (param != DRV_MB_PARAM_BIST_RC_PASSED))
+   rc = ECORE_UNKNOWN_ERROR;
+
+   return rc;
+}
+
+enum _ecore_status_t ecore_mcp_bist_nvm_test_get_num_images(
+   struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, u32 *num_images)
+{
+   u32 drv_mb_param = 0, rsp;
+   enum _ecore_status_t rc = ECORE_SUCCESS;
+
+   drv_mb_param = (DRV_MB_PARAM_BIST_NVM_TEST_NUM_IMAGES <<
+   DRV_MB_PARAM_BIST_TEST_INDEX_SHIFT);
+
+   rc = ecore_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_BIST_TEST,
+  drv_mb_param, , num_images);
+
+   if (rc != ECORE_SUCCESS)
+   return rc;
+
+   if (((rsp & FW_MSG_CODE_MASK) != FW_MSG_CODE_OK))
+   rc = ECORE_UNKNOWN_ERROR;
+
+   return rc;
+}
+
+enum _ecore_status_t ecore_mcp_bist_nvm_test_get_image_att(
+   struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
+   struct bist_nvm_image_att *p_image_att, u32 image_index)
+{
+   struct ecore_mcp_nvm_params params;
+   enum _ecore_status_t rc;
+   u32 buf_size;
+
+   OSAL_MEMSET(, 0, sizeof(struct ecore_mcp_nvm_params));
+   params.nvm_common.offset = (DRV_MB_PARAM_BIST_NVM_TEST_IMAGE_BY_INDEX <<
+   DRV_MB_PARAM_BIST_TEST_INDEX_SHIFT);
+   params.nvm_common.offset |= (image_index <<
+   DRV_MB_PARAM_BIST_TEST_IMAGE_INDEX_SHIFT);
+
+   params.type = ECORE_MCP_NVM_RD;
+   params.nvm_rd.buf_size = _size;
+   params.nvm_common.cmd = DRV_MSG_CODE_BIST_TEST;
+   params.nvm_rd.buf = (u32 *)p_image_att;
+
+   rc = ecore_mcp_nvm_command(p_hwfn, p_ptt, );
+   if (rc != ECORE_SUCCESS)
+   return rc;
+
+   if (((params.nvm_common.resp & FW_MSG_CODE_MASK) != FW_MSG_CODE_OK) ||
+   (p_image_att->return_code != 1))
+   rc = ECORE_UNKNOWN_ERROR;
+
+ 

[dpdk-dev] [PATCH v4 09/32] net/qede: serialize access to MFW mbox

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

Add ecore_mcp_mb_lock() and ecore_mcp_mb_unlock() APIs to ensure
a single thread is accessing MFW mailbox.

Signed-off-by: Harish Patil 
---
 drivers/net/qede/base/ecore_mcp.c | 70 ++-
 drivers/net/qede/base/ecore_mcp.h |  4 +++
 2 files changed, 66 insertions(+), 8 deletions(-)

diff --git a/drivers/net/qede/base/ecore_mcp.c 
b/drivers/net/qede/base/ecore_mcp.c
index 24211a3..12e1ec1 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -202,6 +202,51 @@ err:
return ECORE_NOMEM;
 }

+/* Locks the MFW mailbox of a PF to ensure a single access.
+ * The lock is achieved in most cases by holding a spinlock, causing other
+ * threads to wait till a previous access is done.
+ * In some cases (currently when a [UN]LOAD_REQ commands are sent), the single
+ * access is achieved by setting a blocking flag, which will fail other
+ * competing contexts to send their mailboxes.
+ */
+static enum _ecore_status_t ecore_mcp_mb_lock(struct ecore_hwfn *p_hwfn,
+ u32 cmd)
+{
+   OSAL_SPIN_LOCK(_hwfn->mcp_info->lock);
+
+   /* The spinlock shouldn't be acquired when the mailbox command is
+* [UN]LOAD_REQ, since the engine is locked by the MFW, and a parallel
+* pending [UN]LOAD_REQ command of another PF together with a spinlock
+* (i.e. interrupts are disabled) - can lead to a deadlock.
+* It is assumed that for a single PF, no other mailbox commands can be
+* sent from another context while sending LOAD_REQ, and that any
+* parallel commands to UNLOAD_REQ can be cancelled.
+*/
+   if (cmd == DRV_MSG_CODE_LOAD_DONE || cmd == DRV_MSG_CODE_UNLOAD_DONE)
+   p_hwfn->mcp_info->block_mb_sending = false;
+
+   if (p_hwfn->mcp_info->block_mb_sending) {
+   DP_NOTICE(p_hwfn, false,
+ "Trying to send a MFW mailbox command [0x%x] in 
parallel to [UN]LOAD_REQ. Aborting.\n",
+ cmd);
+   OSAL_SPIN_UNLOCK(_hwfn->mcp_info->lock);
+   return ECORE_BUSY;
+   }
+
+   if (cmd == DRV_MSG_CODE_LOAD_REQ || cmd == DRV_MSG_CODE_UNLOAD_REQ) {
+   p_hwfn->mcp_info->block_mb_sending = true;
+   OSAL_SPIN_UNLOCK(_hwfn->mcp_info->lock);
+   }
+
+   return ECORE_SUCCESS;
+}
+
+static void ecore_mcp_mb_unlock(struct ecore_hwfn *p_hwfn, u32 cmd)
+{
+   if (cmd != DRV_MSG_CODE_LOAD_REQ && cmd != DRV_MSG_CODE_UNLOAD_REQ)
+   OSAL_SPIN_UNLOCK(_hwfn->mcp_info->lock);
+}
+
 enum _ecore_status_t ecore_mcp_reset(struct ecore_hwfn *p_hwfn,
 struct ecore_ptt *p_ptt)
 {
@@ -214,8 +259,12 @@ enum _ecore_status_t ecore_mcp_reset(struct ecore_hwfn 
*p_hwfn,
if (CHIP_REV_IS_EMUL(p_hwfn->p_dev))
delay = EMUL_MCP_RESP_ITER_US;
 #endif
-
-   OSAL_SPIN_LOCK(_hwfn->mcp_info->lock);
+   /* Ensure that only a single thread is accessing the mailbox at a
+* certain time.
+*/
+   rc = ecore_mcp_mb_lock(p_hwfn, DRV_MSG_CODE_MCP_RESET);
+   if (rc != ECORE_SUCCESS)
+   return rc;

/* Set drv command along with the updated sequence */
org_mcp_reset_seq = ecore_rd(p_hwfn, p_ptt, MISCS_REG_GENERIC_POR_0);
@@ -238,7 +287,7 @@ enum _ecore_status_t ecore_mcp_reset(struct ecore_hwfn 
*p_hwfn,
rc = ECORE_AGAIN;
}

-   OSAL_SPIN_UNLOCK(_hwfn->mcp_info->lock);
+   ecore_mcp_mb_unlock(p_hwfn, DRV_MSG_CODE_MCP_RESET);

return rc;
 }
@@ -327,14 +376,16 @@ ecore_mcp_cmd_and_union(struct ecore_hwfn *p_hwfn, struct 
ecore_ptt *p_ptt,
return ECORE_BUSY;
}

-   /* Acquiring a spinlock is needed to ensure that only a single thread
-* is accessing the mailbox at a certain time.
-*/
-   OSAL_SPIN_LOCK(_hwfn->mcp_info->lock);
-
union_data_addr = p_hwfn->mcp_info->drv_mb_addr +
  OFFSETOF(struct public_drv_mb, union_data);

+   /* Ensure that only a single thread is accessing the mailbox at a
+* certain time.
+*/
+   rc = ecore_mcp_mb_lock(p_hwfn, p_mb_params->cmd);
+   if (rc != ECORE_SUCCESS)
+   return rc;
+
if (p_mb_params->p_data_src != OSAL_NULL)
ecore_memcpy_to(p_hwfn, p_ptt, union_data_addr,
p_mb_params->p_data_src,
@@ -348,6 +399,9 @@ ecore_mcp_cmd_and_union(struct ecore_hwfn *p_hwfn, struct 
ecore_ptt *p_ptt,
ecore_memcpy_from(p_hwfn, p_ptt, p_mb_params->p_data_dst,
  union_data_addr,
  sizeof(*p_mb_params->p_data_dst));
+
+   ecore_mcp_mb_unlock(p_hwfn, p_mb_params->cmd);
+
return rc;
 }

diff --git a/drivers/net/qede/base/ecore_mcp.h 
b/drivers/net/qede/base/ecore_mcp.h
index 

[dpdk-dev] [PATCH v4 08/32] net/qede: change signature of MCP command API

2016-10-18 Thread Rasesh Mody
From: Harish Patil 

Change ecore_mcp_cmd_and_union() to accept pointer to a structure rather
than accepting multiple arguments. A new struct ecore_mcp_mb_params is
added for that purpose. Also make this function static. This change is
mostly keeping in mind the future requests which needs additional
arguments.

Signed-off-by: Harish Patil 
---
 drivers/net/qede/base/bcm_osal.h  |   2 +
 drivers/net/qede/base/ecore_mcp.c | 138 --
 drivers/net/qede/base/ecore_mcp.h |  31 +++--
 3 files changed, 98 insertions(+), 73 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index a535058..9d84ae2 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -9,6 +9,8 @@
 #ifndef __BCM_OSAL_H
 #define __BCM_OSAL_H

+#include 
+
 #include 
 #include 
 #include 
diff --git a/drivers/net/qede/base/ecore_mcp.c 
b/drivers/net/qede/base/ecore_mcp.c
index b29e630..24211a3 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -313,32 +313,10 @@ static enum _ecore_status_t ecore_do_mcp_cmd(struct 
ecore_hwfn *p_hwfn,
return rc;
 }

-enum _ecore_status_t ecore_mcp_cmd(struct ecore_hwfn *p_hwfn,
-  struct ecore_ptt *p_ptt, u32 cmd, u32 param,
-  u32 *o_mcp_resp, u32 *o_mcp_param)
-{
-#ifndef ASIC_ONLY
-   if (CHIP_REV_IS_EMUL(p_hwfn->p_dev)) {
-   if (cmd == DRV_MSG_CODE_UNLOAD_REQ) {
-   loaded--;
-   loaded_port[p_hwfn->port_id]--;
-   DP_VERBOSE(p_hwfn, ECORE_MSG_SP, "Unload cnt: 0x%x\n",
-  loaded);
-   }
-   return ECORE_SUCCESS;
-   }
-#endif

-   return ecore_mcp_cmd_and_union(p_hwfn, p_ptt, cmd, param, OSAL_NULL,
-  o_mcp_resp, o_mcp_param);
-}
-
-enum _ecore_status_t ecore_mcp_cmd_and_union(struct ecore_hwfn *p_hwfn,
-   struct ecore_ptt *p_ptt,
-u32 cmd, u32 param,
-union drv_union_data *p_union_data,
-u32 *o_mcp_resp,
-u32 *o_mcp_param)
+static enum _ecore_status_t
+ecore_mcp_cmd_and_union(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
+   struct ecore_mcp_mb_params *p_mb_params)
 {
u32 union_data_addr;
enum _ecore_status_t rc;
@@ -354,19 +332,54 @@ enum _ecore_status_t ecore_mcp_cmd_and_union(struct 
ecore_hwfn *p_hwfn,
 */
OSAL_SPIN_LOCK(_hwfn->mcp_info->lock);

-   if (p_union_data != OSAL_NULL) {
union_data_addr = p_hwfn->mcp_info->drv_mb_addr +
  OFFSETOF(struct public_drv_mb, union_data);
-   ecore_memcpy_to(p_hwfn, p_ptt, union_data_addr, p_union_data,
-   sizeof(*p_union_data));
-}

-   rc = ecore_do_mcp_cmd(p_hwfn, p_ptt, cmd, param, o_mcp_resp,
- o_mcp_param);
+   if (p_mb_params->p_data_src != OSAL_NULL)
+   ecore_memcpy_to(p_hwfn, p_ptt, union_data_addr,
+   p_mb_params->p_data_src,
+   sizeof(*p_mb_params->p_data_src));

-   OSAL_SPIN_UNLOCK(_hwfn->mcp_info->lock);
+   rc = ecore_do_mcp_cmd(p_hwfn, p_ptt, p_mb_params->cmd,
+ p_mb_params->param, _mb_params->mcp_resp,
+ _mb_params->mcp_param);

+   if (p_mb_params->p_data_dst != OSAL_NULL)
+   ecore_memcpy_from(p_hwfn, p_ptt, p_mb_params->p_data_dst,
+ union_data_addr,
+ sizeof(*p_mb_params->p_data_dst));
+   return rc;
+}
+
+enum _ecore_status_t ecore_mcp_cmd(struct ecore_hwfn *p_hwfn,
+  struct ecore_ptt *p_ptt, u32 cmd, u32 param,
+  u32 *o_mcp_resp, u32 *o_mcp_param)
+{
+   struct ecore_mcp_mb_params mb_params;
+   enum _ecore_status_t rc;
+
+#ifndef ASIC_ONLY
+   if (CHIP_REV_IS_EMUL(p_hwfn->p_dev)) {
+   if (cmd == DRV_MSG_CODE_UNLOAD_REQ) {
+   loaded--;
+   loaded_port[p_hwfn->port_id]--;
+   DP_VERBOSE(p_hwfn, ECORE_MSG_SP, "Unload cnt: 0x%x\n",
+  loaded);
+   }
+   return ECORE_SUCCESS;
+   }
+#endif
+   OSAL_MEM_ZERO(_params, sizeof(mb_params));
+   mb_params.cmd = cmd;
+   mb_params.param = param;
+   rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, _params);
+   if (rc != ECORE_SUCCESS)
return rc;
+
+   *o_mcp_resp = mb_params.mcp_resp;
+   *o_mcp_param = mb_params.mcp_param;
+
+   return ECORE_SUCCESS;
 }

 enum 

[dpdk-dev] [PATCH v4 07/32] net/qede: fix 32 bit compilation

2016-10-18 Thread Rasesh Mody
Fix 32 bit compilation for gcc version 4.3.4.

Fixes: ec94dbc57362 ("qede: add base driver")

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/Makefile | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index fe449aa..7965a83 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -48,9 +48,13 @@ endif
 endif

 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+ifeq ($(shell gcc -Wno-unused-but-set-variable -Werror -E - < /dev/null > 
/dev/null 2>&1; echo $$?),0)
 CFLAGS_BASE_DRIVER += -Wno-unused-but-set-variable
+endif
 CFLAGS_BASE_DRIVER += -Wno-missing-declarations
+ifeq ($(shell gcc -Wno-maybe-uninitialized -Werror -E - < /dev/null > 
/dev/null 2>&1; echo $$?),0)
 CFLAGS_BASE_DRIVER += -Wno-maybe-uninitialized
+endif
 CFLAGS_BASE_DRIVER += -Wno-strict-prototypes
 ifeq ($(shell test $(GCC_VERSION) -ge 60 && echo 1), 1)
 CFLAGS_BASE_DRIVER += -Wno-shift-negative-value
-- 
1.8.3.1



[dpdk-dev] [PATCH v4 06/32] net/qede/base: additional formatting/comment changes

2016-10-18 Thread Rasesh Mody
Change details:
 - adds new comments
 - modifies some of the existing comments
 - abstract code into macros
 - split long lines

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/ecore.h   |  3 +-
 drivers/net/qede/base/ecore_chain.h | 14 ++---
 drivers/net/qede/base/ecore_cxt.c   | 52 +--
 drivers/net/qede/base/ecore_cxt.h   |  3 +-
 drivers/net/qede/base/ecore_dcbx.c  |  6 ++-
 drivers/net/qede/base/ecore_dev.c   | 70 +
 drivers/net/qede/base/ecore_dev_api.h   | 33 
 drivers/net/qede/base/ecore_hsi_eth.h   |  8 +--
 drivers/net/qede/base/ecore_hw.c|  2 +-
 drivers/net/qede/base/ecore_hw.h| 31 +++
 drivers/net/qede/base/ecore_hw_defs.h   | 22 
 drivers/net/qede/base/ecore_init_fw_funcs.c |  3 ++
 drivers/net/qede/base/ecore_init_fw_funcs.h | 80 +++--
 drivers/net/qede/base/ecore_init_ops.h  |  8 ++-
 drivers/net/qede/base/ecore_int.c   |  9 ++--
 drivers/net/qede/base/ecore_iov_api.h   | 57 ++--
 drivers/net/qede/base/ecore_l2.c| 25 +
 drivers/net/qede/base/ecore_l2_api.h|  9 ++--
 drivers/net/qede/base/ecore_mcp.c   |  3 +-
 drivers/net/qede/base/ecore_sp_commands.c   | 12 ++---
 drivers/net/qede/base/ecore_spq.c   | 12 ++---
 drivers/net/qede/base/ecore_spq.h   | 21 +---
 drivers/net/qede/base/eth_common.h  | 15 --
 drivers/net/qede/base/nvm_cfg.h | 17 --
 24 files changed, 319 insertions(+), 196 deletions(-)

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index b9127de..9f456e3 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -94,7 +94,6 @@ static OSAL_INLINE u32 DB_ADDR(u32 cid, u32 DEMS)
return db_addr;
 }

-/* @DPDK: This is a backport from latest ecore for TSS fix */
 static OSAL_INLINE u32 DB_ADDR_VF(u32 cid, u32 DEMS)
 {
u32 db_addr = FIELD_VALUE(DB_LEGACY_ADDR_DEMS, DEMS) |
@@ -107,6 +106,7 @@ static OSAL_INLINE u32 DB_ADDR_VF(u32 cid, u32 DEMS)
((sizeof(type_name) + (u32)(1 << (p_hwfn->p_dev->cache_shift)) - 1) & \
 ~((1 << (p_hwfn->p_dev->cache_shift)) - 1))

+#ifndef LINUX_REMOVE
 #ifndef U64_HI
 #define U64_HI(val) ((u32)(((u64)(val))  >> 32))
 #endif
@@ -114,6 +114,7 @@ static OSAL_INLINE u32 DB_ADDR_VF(u32 cid, u32 DEMS)
 #ifndef U64_LO
 #define U64_LO(val) ((u32)(((u64)(val)) & 0x))
 #endif
+#endif

 #ifndef __EXTRACT__LINUX__
 enum DP_LEVEL {
diff --git a/drivers/net/qede/base/ecore_chain.h 
b/drivers/net/qede/base/ecore_chain.h
index bc18c41..56b7b4d 100644
--- a/drivers/net/qede/base/ecore_chain.h
+++ b/drivers/net/qede/base/ecore_chain.h
@@ -307,21 +307,23 @@ ecore_chain_advance_page(struct ecore_chain *p_chain, 
void **p_next_elem,
(((p)->u.chain32.idx & (p)->elem_per_page_mask) == (p)->usable_per_page)

 #define is_unusable_next_idx(p, idx)   \
-   p)->u.chain16.idx + 1) & (p)->elem_per_page_mask) == \
-   (p)->usable_per_page)
+   p)->u.chain16.idx + 1) &\
+   (p)->elem_per_page_mask) == (p)->usable_per_page)

 #define is_unusable_next_idx_u32(p, idx)   \
-   p)->u.chain32.idx + 1) & (p)->elem_per_page_mask) \
-   == (p)->usable_per_page)
+   p)->u.chain32.idx + 1) &\
+   (p)->elem_per_page_mask) == (p)->usable_per_page)

 #define test_and_skip(p, idx)  \
do {\
if (is_chain_u16(p)) {  \
if (is_unusable_idx(p, idx))\
-   (p)->u.chain16.idx += (p)->elem_unusable; \
+   (p)->u.chain16.idx +=   \
+   (p)->elem_unusable; \
} else {\
if (is_unusable_idx_u32(p, idx))\
-   (p)->u.chain32.idx += (p)->elem_unusable; \
+   (p)->u.chain32.idx +=   \
+   (p)->elem_unusable; \
}   \
} while (0)

diff --git a/drivers/net/qede/base/ecore_cxt.c 
b/drivers/net/qede/base/ecore_cxt.c
index 415d1c8..22d0b25 100644
--- a/drivers/net/qede/base/ecore_cxt.c
+++ b/drivers/net/qede/base/ecore_cxt.c
@@ -378,7 +378,7 @@ static void ecore_ilt_cli_blk_fill(struct 
ecore_ilt_client_cfg *p_cli,
 {
u32 ilt_size = ILT_PAGE_IN_BYTES(p_cli->p_size.val);

-   /* verfiy called once for each block */
+   /* verify that it's called once for each block */
if (p_blk->total_size)
return;

@@ 

[dpdk-dev] [PATCH v4 05/32] net/qede/base: add attention formatting string

2016-10-18 Thread Rasesh Mody
In case of attention from a signal that's represented by multiple bits
in misc AEU, add the format string which is populated with proper index
and resulting prints will show string as a prefix.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/bcm_osal.c  | 21 +
 drivers/net/qede/base/bcm_osal.h  |  6 ++
 drivers/net/qede/base/ecore_int.c | 35 +--
 3 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 67270fd..d53dfee 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -65,6 +65,27 @@ inline bool qede_test_bit(u32 nr, unsigned long *addr)
return res;
 }

+static inline u32 qede_ffb(unsigned long word)
+{
+   unsigned long first_bit;
+
+   first_bit = __builtin_ffsl(word);
+   return first_bit ? (first_bit - 1) : OSAL_BITS_PER_UL;
+}
+
+inline u32 qede_find_first_bit(unsigned long *addr, u32 limit)
+{
+   u32 i;
+   u32 nwords = 0;
+   OSAL_BUILD_BUG_ON(!limit);
+   nwords = (limit - 1) / OSAL_BITS_PER_UL + 1;
+   for (i = 0; i < nwords; i++)
+   if (addr[i] != 0)
+   break;
+
+   return (i == nwords) ? limit : i * OSAL_BITS_PER_UL + qede_ffb(addr[i]);
+}
+
 static inline u32 qede_ffz(unsigned long word)
 {
unsigned long first_zero;
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 3e2aeb0..a535058 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -301,6 +301,10 @@ bool qede_test_bit(u32, unsigned long *);
 #define OSAL_TEST_BIT(bit, bitmap) \
qede_test_bit(bit, bitmap)

+u32 qede_find_first_bit(unsigned long *, u32);
+#define OSAL_FIND_FIRST_BIT(bitmap, length) \
+   qede_find_first_bit(bitmap, length)
+
 u32 qede_find_first_zero_bit(unsigned long *, u32);
 #define OSAL_FIND_FIRST_ZERO_BIT(bitmap, length) \
qede_find_first_zero_bit(bitmap, length)
@@ -377,6 +381,8 @@ u32 qede_osal_log2(u32);
 #define OSAL_ARRAY_SIZE(arr) RTE_DIM(arr)
 #define OSAL_SPRINTF(name, pattern, ...) \
sprintf(name, pattern, ##__VA_ARGS__)
+#define OSAL_SNPRINTF(buf, size, format, ...) \
+   snprintf(buf, size, format, ##__VA_ARGS__)
 #define OSAL_STRLEN(string) strlen(string)
 #define OSAL_STRCPY(dst, string) strcpy(dst, string)
 #define OSAL_STRNCPY(dst, string, len) strncpy(dst, string, len)
diff --git a/drivers/net/qede/base/ecore_int.c 
b/drivers/net/qede/base/ecore_int.c
index e4c002a..04c4947 100644
--- a/drivers/net/qede/base/ecore_int.c
+++ b/drivers/net/qede/base/ecore_int.c
@@ -783,7 +783,9 @@ static void ecore_int_deassertion_print_bit(struct 
ecore_hwfn *p_hwfn,
 static enum _ecore_status_t
 ecore_int_deassertion_aeu_bit(struct ecore_hwfn *p_hwfn,
  struct aeu_invert_reg_bit *p_aeu,
- u32 aeu_en_reg, u32 bitmask)
+ u32 aeu_en_reg,
+ const char *p_bit_name,
+ u32 bitmask)
 {
enum _ecore_status_t rc = ECORE_INVAL;
u32 val, mask;
@@ -795,12 +797,12 @@ ecore_int_deassertion_aeu_bit(struct ecore_hwfn *p_hwfn,
 #endif

DP_INFO(p_hwfn, "Deasserted attention `%s'[%08x]\n",
-   p_aeu->bit_name, bitmask);
+   p_bit_name, bitmask);

/* Call callback before clearing the interrupt status */
if (p_aeu->cb) {
DP_INFO(p_hwfn, "`%s (attention)': Calling Callback function\n",
-   p_aeu->bit_name);
+   p_bit_name);
rc = p_aeu->cb(p_hwfn);
}

@@ -812,7 +814,7 @@ ecore_int_deassertion_aeu_bit(struct ecore_hwfn *p_hwfn,
/* Reach assertion if attention is fatal */
if (rc != ECORE_SUCCESS) {
DP_NOTICE(p_hwfn, true, "`%s': Fatal attention\n",
- p_aeu->bit_name);
+ p_bit_name);

ecore_hw_err_notify(p_hwfn, ECORE_HW_ERR_HW_ATTN);
}
@@ -824,7 +826,7 @@ ecore_int_deassertion_aeu_bit(struct ecore_hwfn *p_hwfn,
val = ecore_rd(p_hwfn, p_hwfn->p_dpc_ptt, aeu_en_reg);
ecore_wr(p_hwfn, p_hwfn->p_dpc_ptt, aeu_en_reg, (val & mask));
DP_INFO(p_hwfn, "`%s' - Disabled future attentions\n",
-   p_aeu->bit_name);
+   p_bit_name);
}

if (p_aeu->flags & (ATTENTION_FW_DUMP | ATTENTION_PANIC_DUMP)) {
@@ -942,8 +944,8 @@ static enum _ecore_status_t ecore_int_deassertion(struct 
ecore_hwfn *p_hwfn,
 * previous assertion.
 */
for (j = 0, bit_idx = 0; bit_idx < 32; j++) {
+   unsigned long bitmask;
u8 bit, bit_len;
-   u32 bitmask;

  

[dpdk-dev] [PATCH v4 04/32] net/qede/base: add HSI changes and register defines

2016-10-18 Thread Rasesh Mody
 - add the hardware software interface(HSI) changes
 - add register definitions

These will be required for 8.10.9.0 FW upgrade.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/common_hsi.h   | 1202 +-
 drivers/net/qede/base/ecore_dev.c|2 -
 drivers/net/qede/base/ecore_hsi_common.h |  295 +++-
 drivers/net/qede/base/ecore_hw.c |4 +-
 drivers/net/qede/base/eth_common.h   |   27 -
 drivers/net/qede/base/reg_addr.h |   36 +
 6 files changed, 1330 insertions(+), 236 deletions(-)

diff --git a/drivers/net/qede/base/common_hsi.h 
b/drivers/net/qede/base/common_hsi.h
index 4574800..b431c78 100644
--- a/drivers/net/qede/base/common_hsi.h
+++ b/drivers/net/qede/base/common_hsi.h
@@ -8,12 +8,89 @@

 #ifndef __COMMON_HSI__
 #define __COMMON_HSI__
+//
+/* PROTOCOL COMMON FW CONSTANTS */
+//
+
+/* Temporarily here should be added to HSI automatically by resource allocation
+ * tool.
+ */
+#define T_TEST_AGG_INT_TEMP6
+#defineM_TEST_AGG_INT_TEMP8
+#defineU_TEST_AGG_INT_TEMP6
+#defineX_TEST_AGG_INT_TEMP14
+#defineY_TEST_AGG_INT_TEMP4
+#defineP_TEST_AGG_INT_TEMP4
+
+#define X_FINAL_CLEANUP_AGG_INT  1
+
+#define EVENT_RING_PAGE_SIZE_BYTES  4096
+
+#define NUM_OF_GLOBAL_QUEUES   128
+#define COMMON_QUEUE_ENTRY_MAX_BYTE_SIZE   64
+
+#define ISCSI_CDU_TASK_SEG_TYPE   0
+#define FCOE_CDU_TASK_SEG_TYPE0
+#define RDMA_CDU_TASK_SEG_TYPE1
+
+#define FW_ASSERT_GENERAL_ATTN_IDX32
+
+#define MAX_PINNED_CCFC32
+
+#define EAGLE_ENG1_WORKAROUND_NIG_FLOWCTRL_MODE3
+
+/* Queue Zone sizes in bytes */
+#define TSTORM_QZONE_SIZE8  /*tstorm_scsi_queue_zone*/
+#define MSTORM_QZONE_SIZE16  /*mstorm_eth_queue_zone. Used only for RX
+ *producer of VFs in backward compatibility
+ *mode.
+ */
+#define USTORM_QZONE_SIZE8  /*ustorm_eth_queue_zone*/
+#define XSTORM_QZONE_SIZE8  /*xstorm_eth_queue_zone*/
+#define YSTORM_QZONE_SIZE0
+#define PSTORM_QZONE_SIZE0
+
+/*Log of mstorm default VF zone size.*/
+#define MSTORM_VF_ZONE_DEFAULT_SIZE_LOG   7
+/*Maximum number of RX queues that can be allocated to VF by default*/
+#define ETH_MAX_NUM_RX_QUEUES_PER_VF_DEFAULT  16
+/*Maximum number of RX queues that can be allocated to VF with doubled VF zone
+ * size. Up to 96 VF supported in this mode
+ */
+#define ETH_MAX_NUM_RX_QUEUES_PER_VF_DOUBLE   48
+/*Maximum number of RX queues that can be allocated to VF with 4 VF zone size.
+ * Up to 48 VF supported in this mode
+ */
+#define ETH_MAX_NUM_RX_QUEUES_PER_VF_QUAD 112
+
+
+//
+/* CORE (LIGHT L2) FW CONSTANTS */
+//
+
+#define CORE_LL2_MAX_RAMROD_PER_CON8
+#define CORE_LL2_TX_BD_PAGE_SIZE_BYTES 4096
+#define CORE_LL2_RX_BD_PAGE_SIZE_BYTES 4096
+#define CORE_LL2_RX_CQE_PAGE_SIZE_BYTES4096
+#define CORE_LL2_RX_NUM_NEXT_PAGE_BDS  1
+
+#define CORE_LL2_TX_MAX_BDS_PER_PACKET 12
+
+#define CORE_SPQE_PAGE_SIZE_BYTES   4096
+
+#define MAX_NUM_LL2_RX_QUEUES  32
+#define MAX_NUM_LL2_TX_STATS_COUNTERS  32
+
+
+//
+/* Include firmware version number only- do not add constants here to avoid */
+/* redundunt compilations   */
+//

-#define CORE_SPQE_PAGE_SIZE_BYTES  4096

 #define FW_MAJOR_VERSION   8
-#define FW_MINOR_VERSION   7
-#define FW_REVISION_VERSION7
+#define FW_MINOR_VERSION   10
+#define FW_REVISION_VERSION9
 #define FW_ENGINEERING_VERSION 0

 /***/
@@ -21,70 +98,96 @@
 /***/

 /* PCI functions */
-#define MAX_NUM_PORTS_K2   (4)
-#define MAX_NUM_PORTS_BB   (2)
-#define MAX_NUM_PORTS  (MAX_NUM_PORTS_K2)
+#define MAX_NUM_PORTS_K2   (4)
+#define MAX_NUM_PORTS_BB   (2)
+#define MAX_NUM_PORTS  (MAX_NUM_PORTS_K2)

-#define MAX_NUM_PFS_K2 (16)
-#define MAX_NUM_PFS_BB (8)
-#define MAX_NUM_PFS(MAX_NUM_PFS_K2)
-#define MAX_NUM_OF_PFS_IN_CHIP (16) /* On both engines */
+#define MAX_NUM_PFS_K2 (16)
+#define MAX_NUM_PFS_BB (8)
+#define MAX_NUM_PFS(MAX_NUM_PFS_K2)
+#define MAX_NUM_OF_PFS_IN_CHIP (16) /* On both engines */

-#define MAX_NUM_VFS_K2 (192)
-#define MAX_NUM_VFS_BB (120)
-#define MAX_NUM_VFS

[dpdk-dev] [PATCH v4 03/32] net/qede: use FW CONFIG defines as needed

2016-10-18 Thread Rasesh Mody
Replaced CONFIG_QED_BINARY_FW with CONFIG_ECORE_BINARY_FW.
Use CONFIG_ECORE_BINARY_FW and CONFIG_ECORE_ZIPPED_FW defines as
required.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/bcm_osal.c |  2 ++
 drivers/net/qede/base/ecore.h| 20 +++-
 drivers/net/qede/qede_main.c | 20 +++-
 3 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 16029b5..67270fd 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -152,6 +152,7 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev 
*p_dev,
return mz->addr;
 }

+#ifdef CONFIG_ECORE_ZIPPED_FW
 u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len,
u8 *input_buf, u32 max_size, u8 *unzip_buf)
 {
@@ -182,6 +183,7 @@ u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 
input_len,

return p_hwfn->stream->total_out / 4;
 }
+#endif

 void
 qede_get_mcp_proto_stats(struct ecore_dev *edev,
diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index c83b22b..b9127de 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -9,6 +9,18 @@
 #ifndef __ECORE_H
 #define __ECORE_H

+/* @DPDK */
+#include 
+#include 
+#include 
+
+#define CONFIG_ECORE_BINARY_FW
+#define CONFIG_ECORE_ZIPPED_FW
+
+#ifdef CONFIG_ECORE_ZIPPED_FW
+#include 
+#endif
+
 #include "ecore_hsi_common.h"
 #include "ecore_hsi_debug_tools.h"
 #include "ecore_hsi_init_func.h"
@@ -423,9 +435,6 @@ struct storm_stats {
u32 len;
 };

-#define CONFIG_ECORE_BINARY_FW
-#define CONFIG_ECORE_ZIPPED_FW
-
 struct ecore_fw_data {
 #ifdef CONFIG_ECORE_BINARY_FW
struct fw_ver_info *fw_ver_info;
@@ -521,8 +530,8 @@ struct ecore_hwfn {
/* QM init */
struct ecore_qm_infoqm_info;

-   /* Buffer for unzipping firmware data */
 #ifdef CONFIG_ECORE_ZIPPED_FW
+   /* Buffer for unzipping firmware data */
void *unzip_buf;
 #endif

@@ -674,9 +683,10 @@ struct ecore_dev {
boolb_is_emul_full;
 #endif

+#ifdef CONFIG_ECORE_BINARY_FW /* @DPDK */
void*firmware;
-
u64 fw_len;
+#endif

 };

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index 73608c6..2e62371 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -6,10 +6,6 @@
  * See LICENSE.qede_pmd for copyright and licensing details.
  */

-#include 
-#include 
-#include 
-#include 
 #include 
 #include 

@@ -20,7 +16,6 @@ static uint8_t npar_tx_switching = 1;
 /* Alarm timeout. */
 #define QEDE_ALARM_TIMEOUT_US 10

-#define CONFIG_QED_BINARY_FW
 /* Global variable to hold absolute path of fw file */
 char fw_file[PATH_MAX];

@@ -83,6 +78,7 @@ static int qed_nic_setup(struct ecore_dev *edev)
return rc;
 }

+#ifdef CONFIG_ECORE_ZIPPED_FW
 static int qed_alloc_stream_mem(struct ecore_dev *edev)
 {
int i;
@@ -112,7 +108,9 @@ static void qed_free_stream_mem(struct ecore_dev *edev)
OSAL_FREE(p_hwfn->p_dev, p_hwfn->stream);
}
 }
+#endif

+#ifdef CONFIG_ECORE_BINARY_FW
 static int qed_load_firmware_data(struct ecore_dev *edev)
 {
int fd;
@@ -158,6 +156,7 @@ static int qed_load_firmware_data(struct ecore_dev *edev)

return 0;
 }
+#endif

 static void qed_handle_bulletin_change(struct ecore_hwfn *hwfn)
 {
@@ -222,7 +221,7 @@ static int qed_slowpath_start(struct ecore_dev *edev,
struct ecore_tunn_start_params tunn_info;
 #endif

-#ifdef CONFIG_QED_BINARY_FW
+#ifdef CONFIG_ECORE_BINARY_FW
if (IS_PF(edev)) {
rc = qed_load_firmware_data(edev);
if (rc) {
@@ -240,7 +239,7 @@ static int qed_slowpath_start(struct ecore_dev *edev,
/* set int_coalescing_mode */
edev->int_coalescing_mode = ECORE_COAL_MODE_ENABLE;

-   /* Should go with CONFIG_QED_BINARY_FW */
+#ifdef CONFIG_ECORE_ZIPPED_FW
if (IS_PF(edev)) {
/* Allocate stream for unzipping */
rc = qed_alloc_stream_mem(edev);
@@ -252,9 +251,10 @@ static int qed_slowpath_start(struct ecore_dev *edev,
}

qed_start_iov_task(edev);
+#endif

/* Start the slowpath */
-#ifdef CONFIG_QED_BINARY_FW
+#ifdef CONFIG_ECORE_BINARY_FW
if (IS_PF(edev))
data = edev->firmware;
 #endif
@@ -307,7 +307,7 @@ static int qed_slowpath_start(struct ecore_dev *edev,
 err2:
ecore_resc_free(edev);
 err:
-#ifdef CONFIG_QED_BINARY_FW
+#ifdef CONFIG_ECORE_BINARY_FW
if (IS_PF(edev)) {
if (edev->firmware)
rte_free(edev->firmware);
@@ -625,7 +625,9 @@ static int qed_slowpath_stop(struct ecore_dev *edev)
return -ENODEV;

if (IS_PF(edev)) {
+#ifdef CONFIG_ECORE_ZIPPED_FW
qed_free_stream_mem(edev);
+#endif

 #ifdef 

[dpdk-dev] [PATCH v4 02/32] net/qede/base: formatting changes

2016-10-18 Thread Rasesh Mody
Fixes white spaces and tabs.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/common_hsi.h  |  252 ++---
 drivers/net/qede/base/ecore.h   |  414 +++
 drivers/net/qede/base/ecore_chain.h |   20 +-
 drivers/net/qede/base/ecore_cxt.c   |   16 +-
 drivers/net/qede/base/ecore_cxt_api.h   |   10 +-
 drivers/net/qede/base/ecore_dcbx.c  |4 +-
 drivers/net/qede/base/ecore_dcbx_api.h  |   26 +-
 drivers/net/qede/base/ecore_dev.c   |  112 +-
 drivers/net/qede/base/ecore_dev_api.h   |   72 +-
 drivers/net/qede/base/ecore_gtt_reg_addr.h  |   20 +-
 drivers/net/qede/base/ecore_gtt_values.h|   20 +-
 drivers/net/qede/base/ecore_hsi_common.h|6 +-
 drivers/net/qede/base/ecore_hsi_eth.h   |8 +-
 drivers/net/qede/base/ecore_hw.c|   14 +-
 drivers/net/qede/base/ecore_hw.h|   28 +-
 drivers/net/qede/base/ecore_hw_defs.h   |6 +-
 drivers/net/qede/base/ecore_init_fw_funcs.c |   12 +-
 drivers/net/qede/base/ecore_init_fw_funcs.h |   68 +-
 drivers/net/qede/base/ecore_init_ops.c  |4 +-
 drivers/net/qede/base/ecore_int.c   |   14 +-
 drivers/net/qede/base/ecore_int.h   |4 +-
 drivers/net/qede/base/ecore_iov_api.h   |   46 +-
 drivers/net/qede/base/ecore_iro.h   |   12 +-
 drivers/net/qede/base/ecore_iro_values.h|   32 +-
 drivers/net/qede/base/ecore_l2.c|   18 +-
 drivers/net/qede/base/ecore_l2.h|4 +-
 drivers/net/qede/base/ecore_l2_api.h|   88 +-
 drivers/net/qede/base/ecore_mcp.c   |   28 +-
 drivers/net/qede/base/ecore_mcp.h   |6 +-
 drivers/net/qede/base/ecore_mcp_api.h   |   16 +-
 drivers/net/qede/base/ecore_proto_if.h  |4 +-
 drivers/net/qede/base/ecore_rt_defs.h   |  230 ++--
 drivers/net/qede/base/ecore_sp_api.h|   10 +-
 drivers/net/qede/base/ecore_sp_commands.c   |2 +-
 drivers/net/qede/base/ecore_sp_commands.h   |8 +-
 drivers/net/qede/base/ecore_spq.c   |   72 +-
 drivers/net/qede/base/ecore_spq.h   |  136 +--
 drivers/net/qede/base/ecore_sriov.c |  222 ++--
 drivers/net/qede/base/ecore_sriov.h |   98 +-
 drivers/net/qede/base/ecore_status.h|   18 +-
 drivers/net/qede/base/ecore_vf.c|   18 +-
 drivers/net/qede/base/ecore_vf.h|   34 +-
 drivers/net/qede/base/ecore_vf_api.h|4 +-
 drivers/net/qede/base/ecore_vfpf_if.h   |  270 ++---
 drivers/net/qede/base/eth_common.h  |   52 +-
 drivers/net/qede/base/mcp_public.h  |  194 ++--
 drivers/net/qede/base/nvm_cfg.h | 1562 +--
 47 files changed, 2157 insertions(+), 2157 deletions(-)

diff --git a/drivers/net/qede/base/common_hsi.h 
b/drivers/net/qede/base/common_hsi.h
index 295a41f..4574800 100644
--- a/drivers/net/qede/base/common_hsi.h
+++ b/drivers/net/qede/base/common_hsi.h
@@ -9,9 +9,9 @@
 #ifndef __COMMON_HSI__
 #define __COMMON_HSI__

-#define CORE_SPQE_PAGE_SIZE_BYTES   4096
+#define CORE_SPQE_PAGE_SIZE_BYTES  4096

-#define FW_MAJOR_VERSION   8
+#define FW_MAJOR_VERSION   8
 #define FW_MINOR_VERSION   7
 #define FW_REVISION_VERSION7
 #define FW_ENGINEERING_VERSION 0
@@ -21,68 +21,68 @@
 /***/

 /* PCI functions */
-#define MAX_NUM_PORTS_K2   (4)
-#define MAX_NUM_PORTS_BB   (2)
-#define MAX_NUM_PORTS  (MAX_NUM_PORTS_K2)
+#define MAX_NUM_PORTS_K2   (4)
+#define MAX_NUM_PORTS_BB   (2)
+#define MAX_NUM_PORTS  (MAX_NUM_PORTS_K2)

-#define MAX_NUM_PFS_K2 (16)
-#define MAX_NUM_PFS_BB (8)
-#define MAX_NUM_PFS(MAX_NUM_PFS_K2)
-#define MAX_NUM_OF_PFS_IN_CHIP (16) /* On both engines */
+#define MAX_NUM_PFS_K2 (16)
+#define MAX_NUM_PFS_BB (8)
+#define MAX_NUM_PFS(MAX_NUM_PFS_K2)
+#define MAX_NUM_OF_PFS_IN_CHIP (16) /* On both engines */

-#define MAX_NUM_VFS_K2 (192)
-#define MAX_NUM_VFS_BB (120)
-#define MAX_NUM_VFS(MAX_NUM_VFS_K2)
+#define MAX_NUM_VFS_K2 (192)
+#define MAX_NUM_VFS_BB (120)
+#define MAX_NUM_VFS(MAX_NUM_VFS_K2)

 #define MAX_NUM_FUNCTIONS_BB   (MAX_NUM_PFS_BB + MAX_NUM_VFS_BB)
-#define MAX_NUM_FUNCTIONS  (MAX_NUM_PFS + MAX_NUM_VFS)
+#define MAX_NUM_FUNCTIONS  (MAX_NUM_PFS + MAX_NUM_VFS)

 #define MAX_FUNCTION_NUMBER_BB (MAX_NUM_PFS + MAX_NUM_VFS_BB)
-#define MAX_FUNCTION_NUMBER(MAX_NUM_PFS + MAX_NUM_VFS)
+#define MAX_FUNCTION_NUMBER(MAX_NUM_PFS + MAX_NUM_VFS)

-#define MAX_NUM_VPORTS_K2  (208)
-#define MAX_NUM_VPORTS_BB  (160)
-#define MAX_NUM_VPORTS (MAX_NUM_VPORTS_K2)
+#define MAX_NUM_VPORTS_K2  (208)
+#define MAX_NUM_VPORTS_BB  (160)
+#define MAX_NUM_VPORTS (MAX_NUM_VPORTS_K2)

 #define MAX_NUM_L2_QUEUES_K2   (320)
 #define 

[dpdk-dev] [PATCH v4 01/32] net/qede/base: add new init files and rearrange the code

2016-10-18 Thread Rasesh Mody
Added ecore_hsi_debug_tools.h, ecore_hsi_init_func.h,
ecore_hsi_init_tool.h files. Rearranged code from ecore_hsi_common.h and
ecore_hsi_tools.h to the new files. Removed unused code.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/ecore.h |   17 +-
 drivers/net/qede/base/ecore_dev.c |   73 +-
 drivers/net/qede/base/ecore_hsi_common.h  |  226 --
 drivers/net/qede/base/ecore_hsi_debug_tools.h | 1025 +++
 drivers/net/qede/base/ecore_hsi_init_func.h   |  132 +++
 drivers/net/qede/base/ecore_hsi_init_tool.h   |  454 +++
 drivers/net/qede/base/ecore_hsi_tools.h   | 1081 -
 drivers/net/qede/base/ecore_init_fw_funcs.c   |   67 +-
 drivers/net/qede/base/ecore_init_ops.c|2 +-
 drivers/net/qede/base/ecore_int.c |  141 +---
 10 files changed, 1678 insertions(+), 1540 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_debug_tools.h
 create mode 100644 drivers/net/qede/base/ecore_hsi_init_func.h
 create mode 100644 drivers/net/qede/base/ecore_hsi_init_tool.h
 delete mode 100644 drivers/net/qede/base/ecore_hsi_tools.h

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index d682a78..db72f03 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -10,7 +10,9 @@
 #define __ECORE_H

 #include "ecore_hsi_common.h"
-#include "ecore_hsi_tools.h"
+#include "ecore_hsi_debug_tools.h"
+#include "ecore_hsi_init_func.h"
+#include "ecore_hsi_init_tool.h"
 #include "ecore_proto_if.h"
 #include "mcp_public.h"

@@ -556,14 +558,15 @@ struct ecore_dev {
 #define ECORE_DEV_TYPE_AH  (1 << 0)
 /* Translate type/revision combo into the proper conditions */
 #define ECORE_IS_BB(dev)   ((dev)->type == ECORE_DEV_TYPE_BB)
-#define ECORE_IS_BB_A0(dev)(ECORE_IS_BB(dev) && \
-CHIP_REV_IS_A0(dev))
-#define ECORE_IS_BB_B0(dev)(ECORE_IS_BB(dev) && \
-CHIP_REV_IS_B0(dev))
+#define ECORE_IS_BB_A0(dev)(ECORE_IS_BB(dev) && CHIP_REV_IS_A0(dev))
+#ifndef ASIC_ONLY
+#define ECORE_IS_BB_B0(dev)((ECORE_IS_BB(dev) && CHIP_REV_IS_B0(dev)) || \
+(CHIP_REV_IS_TEDIBEAR(dev)))
+#else
+#define ECORE_IS_BB_B0(dev)(ECORE_IS_BB(dev) && CHIP_REV_IS_B0(dev))
+#endif
 #define ECORE_IS_AH(dev)   ((dev)->type == ECORE_DEV_TYPE_AH)
 #define ECORE_IS_K2(dev)   ECORE_IS_AH(dev)
-#define ECORE_GET_TYPE(dev)(ECORE_IS_BB_A0(dev) ? CHIP_BB_A0 : \
-ECORE_IS_BB_B0(dev) ? CHIP_BB_B0 : CHIP_K2)

u16 vendor_id;
u16 device_id;
diff --git a/drivers/net/qede/base/ecore_dev.c 
b/drivers/net/qede/base/ecore_dev.c
index 0a68969..89faa35 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -281,13 +281,6 @@ static enum _ecore_status_t ecore_init_qm_info(struct 
ecore_hwfn *p_hwfn,
for (i = 0; i < num_ports; i++) {
p_qm_port = _info->qm_port_params[i];
p_qm_port->active = 1;
-   /* @@@TMP - was NUM_OF_PHYS_TCS; Changed until dcbx will
-* be in place
-*/
-   if (num_ports == 4)
-   p_qm_port->num_active_phys_tcs = 2;
-   else
-   p_qm_port->num_active_phys_tcs = 5;
p_qm_port->num_pbf_cmd_lines = PBF_MAX_CMD_LINES / num_ports;
p_qm_port->num_btb_blocks = BTB_MAX_BLOCKS / num_ports;
}
@@ -599,19 +592,15 @@ static void ecore_calc_hw_mode(struct ecore_hwfn *p_hwfn)
 {
int hw_mode = 0;

-   switch (ECORE_GET_TYPE(p_hwfn->p_dev)) {
-   case CHIP_BB_A0:
+   if (ECORE_IS_BB_A0(p_hwfn->p_dev)) {
hw_mode |= 1 << MODE_BB_A0;
-   break;
-   case CHIP_BB_B0:
+   } else if (ECORE_IS_BB_B0(p_hwfn->p_dev)) {
hw_mode |= 1 << MODE_BB_B0;
-   break;
-   case CHIP_K2:
+   } else if (ECORE_IS_AH(p_hwfn->p_dev)) {
hw_mode |= 1 << MODE_K2;
-   break;
-   default:
-   DP_NOTICE(p_hwfn, true, "Can't initialize chip ID %d\n",
- ECORE_GET_TYPE(p_hwfn->p_dev));
+   } else {
+   DP_NOTICE(p_hwfn, true, "Unknown chip type %#x\n",
+ p_hwfn->p_dev->type);
return;
}

@@ -690,37 +679,6 @@ static void ecore_hw_init_chip(struct ecore_hwfn *p_hwfn,
if (CHIP_REV_IS_EMUL(p_hwfn->p_dev) && ECORE_IS_AH(p_hwfn->p_dev))
ecore_wr(p_hwfn, p_ptt, MISCS_REG_RESET_PL_HV_2, 0x3ff);

-   /* initialize interrupt masks */
-   for (i = 0;
-i <
-attn_blocks[BLOCK_MISCS].chip_regs[ECORE_GET_TYPE(p_hwfn->p_dev)].
-num_of_int_regs; i++)
-   ecore_wr(p_hwfn, p_ptt,
-attn_blocks[BLOCK_MISCS].
-

[dpdk-dev] [PATCH v4 00/32] net/qede: update qede pmd to 1.2.0.1 and enable by default

2016-10-18 Thread Rasesh Mody
Hi,

This patch set includes changes to update the base driver, work with
newer FW 8.10.9.0, adds new features, includes enhancements and code
cleanup, provides bug fixes and updates documentation for the QEDE
poll mode driver.

It enables QEDE PMD in the dpdk config by default. The dependency on
external library libz has been addressed.

The patch set updates the QEDE PMD to 1.2.0.1.

Review comments received for v3 have been addressed.

Please apply to DPDK tree for v16.11 release.

Thanks!
Rasesh

Harish Patil (14):
  net/qede: change signature of MCP command API
  net/qede: serialize access to MFW mbox
  net/qede: add NIC selftest and query sensor info support
  net/qede: fix port (re)configuration issue
  net/qede/base: allow MTU change via vport-update
  net/qede: add missing 100G link speed capability
  net/qede: remove unused/dead code
  net/qede: fixes for VLAN filters
  net/qede: add enable/disable VLAN filtering
  net/qede: fix RSS related issues
  net/qede/base: add support to initiate PF FLR
  net/qede: skip slowpath polling for 100G VF device
  net/qede: fix driver version string
  net/qede: fix status block index for VF queues

Rasesh Mody (16):
  net/qede/base: add new init files and rearrange the code
  net/qede/base: formatting changes
  net/qede: use FW CONFIG defines as needed
  net/qede/base: add HSI changes and register defines
  net/qede/base: add attention formatting string
  net/qede/base: additional formatting/comment changes
  net/qede: fix 32 bit compilation
  net/qede/base: update base driver
  net/qede/base: rename structure and defines
  net/qede/base: comment enhancements
  net/qede/base: add MFW crash dump support
  net/qede/base: change Rx Tx queue start APIs
  net/qede: add support for queue statistics
  net/qede: remove zlib dependency and enable PMD by default
  doc: update qede pmd documentation
  net/qede: update driver version

Sony Chacko (2):
  net/qede: enable support for unequal number of Rx/Tx queues
  net/qede: add scatter gather support

 config/common_base|2 +-
 doc/guides/nics/features/qede.ini |4 +
 doc/guides/nics/features/qede_vf.ini  |4 +
 doc/guides/nics/qede.rst  |   32 +-
 drivers/net/qede/Makefile |6 +-
 drivers/net/qede/base/bcm_osal.c  |   23 +
 drivers/net/qede/base/bcm_osal.h  |   10 +
 drivers/net/qede/base/common_hsi.h|  956 ++-
 drivers/net/qede/base/ecore.h |  631 +++
 drivers/net/qede/base/ecore_chain.h   |   51 +-
 drivers/net/qede/base/ecore_cxt.c |  387 -
 drivers/net/qede/base/ecore_cxt.h |   52 +-
 drivers/net/qede/base/ecore_cxt_api.h |   25 +-
 drivers/net/qede/base/ecore_dcbx.c|  589 ++-
 drivers/net/qede/base/ecore_dcbx.h|   18 +-
 drivers/net/qede/base/ecore_dcbx_api.h|  154 +-
 drivers/net/qede/base/ecore_dev.c | 1813 +---
 drivers/net/qede/base/ecore_dev_api.h |  238 ++-
 drivers/net/qede/base/ecore_gtt_reg_addr.h|   30 +-
 drivers/net/qede/base/ecore_gtt_values.h  |   20 +-
 drivers/net/qede/base/ecore_hsi_common.h  | 1358 +--
 drivers/net/qede/base/ecore_hsi_debug_tools.h | 1025 
 drivers/net/qede/base/ecore_hsi_eth.h |  997 ---
 drivers/net/qede/base/ecore_hsi_init_func.h   |  132 ++
 drivers/net/qede/base/ecore_hsi_init_tool.h   |  454 +
 drivers/net/qede/base/ecore_hsi_tools.h   | 1081 
 drivers/net/qede/base/ecore_hw.c  |  222 ++-
 drivers/net/qede/base/ecore_hw.h  |   75 +-
 drivers/net/qede/base/ecore_hw_defs.h |   39 +-
 drivers/net/qede/base/ecore_init_fw_funcs.c   |  400 +++--
 drivers/net/qede/base/ecore_init_fw_funcs.h   |  250 ++-
 drivers/net/qede/base/ecore_init_ops.c|   11 +-
 drivers/net/qede/base/ecore_init_ops.h|   14 +-
 drivers/net/qede/base/ecore_int.c |  446 +++--
 drivers/net/qede/base/ecore_int.h |   23 +-
 drivers/net/qede/base/ecore_int_api.h |   11 +
 drivers/net/qede/base/ecore_iov_api.h |  519 ++
 drivers/net/qede/base/ecore_iro.h |  234 ++-
 drivers/net/qede/base/ecore_iro_values.h  |  140 +-
 drivers/net/qede/base/ecore_l2.c  |  531 +++---
 drivers/net/qede/base/ecore_l2.h  |   85 +-
 drivers/net/qede/base/ecore_l2_api.h  |  167 +-
 drivers/net/qede/base/ecore_mcp.c |  881 --
 drivers/net/qede/base/ecore_mcp.h |  141 +-
 drivers/net/qede/base/ecore_mcp_api.h |  220 ++-
 drivers/net/qede/base/ecore_proto_if.h|   63 +-
 drivers/net/qede/base/ecore_rt_defs.h |  869 +-
 drivers/net/qede/base/ecore_sp_api.h  |   15 +-
 drivers/net/qede/base/ecore_sp_commands.c |   99 +-
 drivers/net/qede/base/ecore_sp_commands.h |   38 +-
 

[dpdk-dev] [PATCH] drivers: make driver names consistent

2016-10-18 Thread Yuanhan Liu
On Tue, Oct 18, 2016 at 02:50:16PM +0200, Jan Blunck wrote:
> >From my understanding this is a massive API breakage. This forces all
> existing users of the virtual PMDs to change with zero benefit. Even
> if that isn't enough it also makes it impossible to switch between
> releases by recompiling.
> 
> Can we please revert these changes and work on some aliasing support
> for the PMDs to fix it long term?

+1. Aliasing is also something I would suggest before making such renames.

--yliu
> 
> Thanks,
> Jan
> 
> 
> On Fri, Sep 16, 2016 at 11:58 AM, Thomas Monjalon
>  wrote:
> > 2016-08-24 22:37, Mcnamara, John:
> >> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Pablo de Lara
> >> >
> >> > ...
> >> >
> >> > -$RTE_TARGET/app/testpmd -c '0xf' -n 4 --vdev 
> >> > 'eth_pcap0,rx_pcap=/path/to/ file_rx.pcap,tx_pcap=/path/to/file_tx.pcap' 
> >> > -- --port-topology=chained
> >> > +$RTE_TARGET/app/testpmd -c '0xf' -n 4 --vdev 
> >> > 'net_pcap0,rx_pcap=/path/to/ file_rx.pcap,tx_pcap=/path/to/file_tx.pcap' 
> >> > -- --port-topology=chained
> >>
> >>
> >> I know that this is an existing issue but there shouldn't be a space in
> >> "/path/to/ file". Perhaps you could fix that (in a number of places) as 
> >> part
> >> of this patch. You could probably leave out the "/path/to/" part 
> >> altogether as
> >> it may be clearer, see below.
> >>
> >> Also, could you wrap the long code lines in the sections that you change at
> >> 80 chars using "\" to keep them on the page in the PDF docs, like:
> >>
> >> $RTE_TARGET/app/testpmd -c '0xf' -n 4 \
> >> --vdev 
> >> 'net_pcap0,rx_pcap=/path/to/file_rx.pcap,tx_pcap=/path/to/file_tx.pcap' \
> >> -- --port-topology=chained
> >>
> >> Or without the path part:
> >>
> >> $RTE_TARGET/app/testpmd -c '0xf' -n 4 \
> >> --vdev 'net_pcap0,rx_pcap=file_rx.pcap,tx_pcap=file_tx.pcap' \
> >> -- --port-topology=chained
> >
> > Applied with above comments fixed and release notes updated, thanks.


[dpdk-dev] [PATCH] drivers: make driver names consistent

2016-10-18 Thread Thomas Monjalon
2016-10-18 22:18, Yuanhan Liu:
> On Tue, Oct 18, 2016 at 03:42:54PM +0200, Thomas Monjalon wrote:
> > 2016-10-18 21:06, Yuanhan Liu:
> > > On Tue, Oct 18, 2016 at 02:50:16PM +0200, Jan Blunck wrote:
> > > > >From my understanding this is a massive API breakage. This forces all
> > > > existing users of the virtual PMDs to change with zero benefit. Even
> > > > if that isn't enough it also makes it impossible to switch between
> > > > releases by recompiling.
> > > > 
> > > > Can we please revert these changes and work on some aliasing support
> > > > for the PMDs to fix it long term?
> > > 
> > > +1. Aliasing is also something I would suggest before making such renames.
> > 
> > It is a brutal change, yes.
> > It was announced in 16.07 release notes though.
> 
> Yes, but it still took me a while (by running git bisect) to figure out
> what went wrong: I wasn't aware of such note, that I was thinking maybe
> something is broken.
> 
> Later I also got quite few same complains. It may also took them a while
> to know what's happened.
> 
> Anyway, my point is, for this kind of change, we should have added the
> alias support firstly.

Yes.

> If that's been done, then the announcement is not
> needed at all?

The announcement would be needed to remove the aliases, later.


> > We can try to make this change more progressive by keeping old names
> > as aliases for some time.
> > Is there a volunteer to work on vdev names aliases,
> > with the target of integrating them in RC2 or RC3?




[dpdk-dev] [PATCH] drivers: make driver names consistent

2016-10-18 Thread Thomas Monjalon
2016-10-18 17:26, Jan Blunck:
> On Tue, Oct 18, 2016 at 3:42 PM, Thomas Monjalon
>  wrote:
> > 2016-10-18 21:06, Yuanhan Liu:
> >> On Tue, Oct 18, 2016 at 02:50:16PM +0200, Jan Blunck wrote:
> >> > >From my understanding this is a massive API breakage. This forces all
> >> > existing users of the virtual PMDs to change with zero benefit. Even
> >> > if that isn't enough it also makes it impossible to switch between
> >> > releases by recompiling.
> >> >
> >> > Can we please revert these changes and work on some aliasing support
> >> > for the PMDs to fix it long term?
> >>
> >> +1. Aliasing is also something I would suggest before making such renames.
> >
> > It is a brutal change, yes.
> > It was announced in 16.07 release notes though.
> >
> 
> "But the plans were on display ..." (HHGTTG)
> 
> > We can try to make this change more progressive by keeping old names
> > as aliases for some time.
> > Is there a volunteer to work on vdev names aliases,
> > with the target of integrating them in RC2 or RC3?
> >
> 
> I'll give it a try ...

Thanks Jan


[dpdk-dev] [dpdk-users] How to printout PMD logs to console

2016-10-18 Thread yingzhi
Hi All,


I'm doing app debug and would like to see device PMD logs, e.g.
dpdk/drivers/net/ixgbe/ixgbe_rxtx.c:1703
PMD_RX_LOG(...)


Currently I can only see RTE logs from console.


Any comments is appreciated
Thanks


[dpdk-dev] [PATCH 1/3] mbuf: embedding timestamp into the packet

2016-10-18 Thread Olivier Matz


On 10/13/2016 04:35 PM, Oleg Kuporosov wrote:
> The hard requirement of financial services industry is accurate
> timestamping aligned with the packet itself. This patch is to satisfy
> this requirement:
> 
> - include uint64_t timestamp field into rte_mbuf with minimal impact to
>   throughput/latency. Keep it just simple uint64_t in ns (more than 580
>   years) would be enough for immediate needs while using full
>   struct timespec with twice bigger size would have much stronger
>   performance impact as missed cacheline0.
> 
> - it is possible as there is 6-bytes gap in 1st cacheline (fast path)
>   and moving uint16_t vlan_tci_outer field to 2nd cacheline.
> 
> - such move will only impact for pretty rare usable VLAN RX stripping
>   mode for outer TCI (it used only for one NIC i40e from the whole set and
>   allows to keep minimal performance impact for RX/TX timestamps.

This argument is difficult to accept. One can say you are adding
a field for a pretty rare case used by only one NIC :)

Honestly, I'm not able to judge whether timestamp is more important than
vlan_tci_outer. As room is tight in the first cache line, your patch
submission is the occasion to raise the question: how to decide what
should be in the first part of the mbuf? There are also some other
candidates for moving: m->seqn is only used in librte_reorder and it
is not set in the RX part of a driver.

About the timestamp, it would be valuable to have other opinions,
not only about the placement of the field in the structure, but also
to check that this API is also usable for other NICs.

Have you measured the impact of having the timestamp in the second part
of the mbuf?

Changing the mbuf structure should happen as rarely as possible, and we
have to make sure we take the correct decisions. I think we will
discuss this at dpdk userland 2016.


Apart from that, I wonder if an ol_flag should be added to tell that
the timestamp field is valid in the mbuf.

Regards,
Olivier


[dpdk-dev] [PATCH 2/2] vhost: Add indirect desc support to the Rx no-mergeable path

2016-10-18 Thread Maxime Coquelin
Linux virtio-net kernel driver uses indirect descriptors when
mergeable buffers are not used.

This patch adds its support, fixing the use of indirect
descriptors with these guests.

Cc: Yuanhan Liu 
Cc: Ciara Loftus 
Signed-off-by: Maxime Coquelin 
---
 lib/librte_vhost/virtio_net.c | 30 +++---
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 0941186..8365894 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -186,8 +186,8 @@ copy_virtio_net_hdr(struct virtio_net *dev, uint64_t 
desc_addr,
 }

 static inline int __attribute__((always_inline))
-copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,
- struct rte_mbuf *m, uint16_t desc_idx)
+copy_mbuf_to_desc(struct virtio_net *dev, struct vring_desc *descs,
+ struct rte_mbuf *m, uint16_t desc_idx, uint32_t size)
 {
uint32_t desc_avail, desc_offset;
uint32_t mbuf_avail, mbuf_offset;
@@ -196,7 +196,7 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
uint64_t desc_addr;
struct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0, 0, 0, 0, 0, 0}, 0};

-   desc = >desc[desc_idx];
+   desc = [desc_idx];
desc_addr = gpa_to_vva(dev, desc->addr);
/*
 * Checking of 'desc_addr' placed outside of 'unlikely' macro to avoid
@@ -233,10 +233,10 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
/* Room in vring buffer is not enough */
return -1;
}
-   if (unlikely(desc->next >= vq->size))
+   if (unlikely(desc->next >= size))
return -1;

-   desc = >desc[desc->next];
+   desc = [desc->next];
desc_addr = gpa_to_vva(dev, desc->addr);
if (unlikely(!desc_addr))
return -1;
@@ -276,8 +276,9 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
struct vhost_virtqueue *vq;
uint16_t avail_idx, free_entries, start_idx;
uint16_t desc_indexes[MAX_PKT_BURST];
+   struct vring_desc *descs;
uint16_t used_idx;
-   uint32_t i;
+   uint32_t i, sz;

LOG_DEBUG(VHOST_DATA, "(%d) %s\n", dev->vid, __func__);
if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->virt_qp_nb))) {
@@ -319,7 +320,22 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
uint16_t desc_idx = desc_indexes[i];
int err;

-   err = copy_mbuf_to_desc(dev, vq, pkts[i], desc_idx);
+   if (vq->desc[desc_idx].flags & VRING_DESC_F_INDIRECT) {
+   descs = (struct vring_desc *)(uintptr_t)gpa_to_vva(dev,
+   vq->desc[desc_idx].addr);
+   if (unlikely(!descs)) {
+   count = i;
+   break;
+   }
+
+   desc_idx = 0;
+   sz = vq->desc[desc_idx].len / sizeof(*descs);
+   } else {
+   descs = vq->desc;
+   sz = vq->size;
+   }
+
+   err = copy_mbuf_to_desc(dev, descs, pkts[i], desc_idx, sz);
if (unlikely(err)) {
used_idx = (start_idx + i) & (vq->size - 1);
vq->used->ring[used_idx].len = dev->vhost_hlen;
-- 
2.7.4



[dpdk-dev] [PATCH 1/2] vhost: Add indirect desc support to Rx mergeable path

2016-10-18 Thread Maxime Coquelin
Windows virtio-net driver uses indirect descriptors with
mergeable buffers.

This patch adds its support, fixing the use of indirect
descriptors with these guests.

Cc: Yuanhan Liu 
Cc: Zhihong Wang 
Signed-off-by: Maxime Coquelin 
---
 lib/librte_vhost/virtio_net.c | 43 ---
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index b784dba..0941186 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -351,29 +351,41 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
 }

 static inline int __attribute__((always_inline))
-fill_vec_buf(struct vhost_virtqueue *vq, uint32_t avail_idx,
-uint32_t *vec_idx, struct buf_vector *buf_vec,
-uint16_t *desc_chain_head, uint16_t *desc_chain_len)
+fill_vec_buf(struct virtio_net *dev, struct vhost_virtqueue *vq,
+uint32_t avail_idx, uint32_t *vec_idx,
+struct buf_vector *buf_vec, uint16_t *desc_chain_head,
+uint16_t *desc_chain_len)
 {
uint16_t idx = vq->avail->ring[avail_idx & (vq->size - 1)];
uint32_t vec_id = *vec_idx;
uint32_t len= 0;
+   struct vring_desc *descs = vq->desc;

*desc_chain_head = idx;
+
+   if (vq->desc[idx].flags & VRING_DESC_F_INDIRECT) {
+   descs = (struct vring_desc *)(uintptr_t)
+   gpa_to_vva(dev, vq->desc[idx].addr);
+   if (unlikely(!descs))
+   return -1;
+
+   idx = 0;
+   }
+
while (1) {
if (unlikely(vec_id >= BUF_VECTOR_MAX || idx >= vq->size))
return -1;

-   len += vq->desc[idx].len;
-   buf_vec[vec_id].buf_addr = vq->desc[idx].addr;
-   buf_vec[vec_id].buf_len  = vq->desc[idx].len;
+   len += descs[idx].len;
+   buf_vec[vec_id].buf_addr = descs[idx].addr;
+   buf_vec[vec_id].buf_len  = descs[idx].len;
buf_vec[vec_id].desc_idx = idx;
vec_id++;

-   if ((vq->desc[idx].flags & VRING_DESC_F_NEXT) == 0)
+   if ((descs[idx].flags & VRING_DESC_F_NEXT) == 0)
break;

-   idx = vq->desc[idx].next;
+   idx = descs[idx].next;
}

*desc_chain_len = len;
@@ -386,9 +398,9 @@ fill_vec_buf(struct vhost_virtqueue *vq, uint32_t avail_idx,
  * Returns -1 on fail, 0 on success
  */
 static inline int
-reserve_avail_buf_mergeable(struct vhost_virtqueue *vq, uint32_t size,
-   struct buf_vector *buf_vec, uint16_t *num_buffers,
-   uint16_t avail_head)
+reserve_avail_buf_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq,
+   uint32_t size, struct buf_vector *buf_vec,
+   uint16_t *num_buffers, uint16_t avail_head)
 {
uint16_t cur_idx;
uint32_t vec_idx = 0;
@@ -404,8 +416,8 @@ reserve_avail_buf_mergeable(struct vhost_virtqueue *vq, 
uint32_t size,
if (unlikely(cur_idx == avail_head))
return -1;

-   if (unlikely(fill_vec_buf(vq, cur_idx, _idx, buf_vec,
- _idx, ) < 0))
+   if (unlikely(fill_vec_buf(dev, vq, cur_idx, _idx, buf_vec,
+   _idx, ) < 0))
return -1;
len = RTE_MIN(len, size);
update_shadow_used_ring(vq, head_idx, len);
@@ -546,8 +558,9 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t 
queue_id,
for (pkt_idx = 0; pkt_idx < count; pkt_idx++) {
uint32_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen;

-   if (unlikely(reserve_avail_buf_mergeable(vq, pkt_len, buf_vec,
-   _buffers, avail_head) < 0)) {
+   if (unlikely(reserve_avail_buf_mergeable(dev, vq,
+   pkt_len, buf_vec, _buffers,
+   avail_head) < 0)) {
LOG_DEBUG(VHOST_DATA,
"(%d) failed to get enough desc from vring\n",
dev->vid);
-- 
2.7.4



[dpdk-dev] [PATCH 0/2] vhost: Add support to indirect descriptors on Rx path

2016-10-18 Thread Maxime Coquelin
Indirect descriptor feature has been enabled in v16.11-rc1, but only TX path
was implemented.
However, some configurations expect it is supported for the Rx path:
 - Windows guests with and without mergeable buffers enabled
 - Linux guests with Kernel drivr with mergeable buffers disabled

This series add the support of indirect descs for the Rx path, and has been
tested with following configurations:
 - Windows guest with indirect ON, mergeeable ON/OFF
 - Linux guest with Kernel driver with indirect ON/OFF, mergeable ON/OFF
 - Linux guest with Virtio PMD with mergeable ON/OFF

The performance degradation measured with/without this series with Virtio PMD
is around 1% (which doesn't use indirect descs for the Rx path).

The series is based on top of "vhost: optimize mergeable Rx path" v7.

Maxime Coquelin (2):
  vhost: Add indirect desc support to Rx mergeable path
  vhost: Add indirect desc support to the Rx no-mergeable path

 lib/librte_vhost/virtio_net.c | 73 ++-
 1 file changed, 51 insertions(+), 22 deletions(-)

-- 
2.7.4



[dpdk-dev] [PATCH] drivers: make driver names consistent

2016-10-18 Thread Jan Blunck
On Tue, Oct 18, 2016 at 3:42 PM, Thomas Monjalon
 wrote:
> 2016-10-18 21:06, Yuanhan Liu:
>> On Tue, Oct 18, 2016 at 02:50:16PM +0200, Jan Blunck wrote:
>> > >From my understanding this is a massive API breakage. This forces all
>> > existing users of the virtual PMDs to change with zero benefit. Even
>> > if that isn't enough it also makes it impossible to switch between
>> > releases by recompiling.
>> >
>> > Can we please revert these changes and work on some aliasing support
>> > for the PMDs to fix it long term?
>>
>> +1. Aliasing is also something I would suggest before making such renames.
>
> It is a brutal change, yes.
> It was announced in 16.07 release notes though.
>

"But the plans were on display ..." (HHGTTG)

> We can try to make this change more progressive by keeping old names
> as aliases for some time.
> Is there a volunteer to work on vdev names aliases,
> with the target of integrating them in RC2 or RC3?
>

I'll give it a try ...


[dpdk-dev] [PATCH v2 2/2] drivers/i40e: fix the hash filter invalid calculation in X722

2016-10-18 Thread Ferruh Yigit
On 10/16/2016 2:40 AM, Jeff Guo wrote:
> As X722 extracts IPv4 header to Field Vector different with XL710/X710,
> need to corresponding to modify the fields of IPv4 header in input set
> to map different default Field Vector Table of different NICs.
> 
> Signed-off-by: Jeff Guo 
> 
> ---
> v2:
> fix compile error when x722 macro is not defined and simplify
> the code to avoid duplication.
> ---
>  drivers/net/i40e/i40e_ethdev.c | 73 
> ++
>  1 file changed, 60 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 920fd6d..7895c11 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -211,6 +211,16 @@
>  #define I40E_REG_INSET_L3_SRC_IP40x00018000ULL
>  /* Destination IPv4 address */
>  #define I40E_REG_INSET_L3_DST_IP40x0018ULL
> +#ifdef X722_SUPPORT

If agreed on removing #ifdef X722_SUPPORT, please apply this into this
patch too.

> +/* Source IPv4 address for X722 */
> +#define I40E_X722_REG_INSET_L3_SRC_IP4   0x0006ULL
> +/* Destination IPv4 address for X722 */
> +#define I40E_X722_REG_INSET_L3_DST_IP4   0x0600ULL
> +/* IPv4 Protocol */
> +#define I40E_X722_REG_INSET_L3_IP4_PROTO 0x0010ULL
> +/* IPv4 Time to Live */
> +#define I40E_X722_REG_INSET_L3_IP4_TTL   0x0010ULL
> +#endif
>  /* IPv4 Type of Service (TOS) */
>  #define I40E_REG_INSET_L3_IP4_TOS0x0040ULL
>  /* IPv4 Protocol */
> @@ -7581,7 +7591,7 @@ i40e_parse_input_set(uint64_t *inset,
>   * and vice versa
>   */
>  static uint64_t
> -i40e_translate_input_set_reg(uint64_t input)
> +i40e_translate_input_set_reg(enum i40e_mac_type type, uint64_t input)
>  {
>   uint64_t val = 0;
>   uint16_t i;
> @@ -7589,17 +7599,13 @@ i40e_translate_input_set_reg(uint64_t input)
>   static const struct {
>   uint64_t inset;
>   uint64_t inset_reg;
> - } inset_map[] = {
> + } inset_map_common[] = {
>   {I40E_INSET_DMAC, I40E_REG_INSET_L2_DMAC},
>   {I40E_INSET_SMAC, I40E_REG_INSET_L2_SMAC},
>   {I40E_INSET_VLAN_OUTER, I40E_REG_INSET_L2_OUTER_VLAN},
>   {I40E_INSET_VLAN_INNER, I40E_REG_INSET_L2_INNER_VLAN},
>   {I40E_INSET_LAST_ETHER_TYPE, I40E_REG_INSET_LAST_ETHER_TYPE},
> - {I40E_INSET_IPV4_SRC, I40E_REG_INSET_L3_SRC_IP4},
> - {I40E_INSET_IPV4_DST, I40E_REG_INSET_L3_DST_IP4},
>   {I40E_INSET_IPV4_TOS, I40E_REG_INSET_L3_IP4_TOS},
> - {I40E_INSET_IPV4_PROTO, I40E_REG_INSET_L3_IP4_PROTO},
> - {I40E_INSET_IPV4_TTL, I40E_REG_INSET_L3_IP4_TTL},
>   {I40E_INSET_IPV6_SRC, I40E_REG_INSET_L3_SRC_IP6},
>   {I40E_INSET_IPV6_DST, I40E_REG_INSET_L3_DST_IP6},
>   {I40E_INSET_IPV6_TC, I40E_REG_INSET_L3_IP6_TC},
> @@ -7627,16 +7633,56 @@ i40e_translate_input_set_reg(uint64_t input)
>   {I40E_INSET_FLEX_PAYLOAD_W7, I40E_REG_INSET_FLEX_PAYLOAD_WORD7},
>   {I40E_INSET_FLEX_PAYLOAD_W8, I40E_REG_INSET_FLEX_PAYLOAD_WORD8},
>   };
> +#ifdef X722_SUPPORT
> +
> +/* some different registers map in x722*/
> + static const struct {
> + uint64_t inset;
> + uint64_t inset_reg;
> + } inset_map_diff_x722[] = {

Can you please extract struct declaration, and re-use that to create
instances.

> + {I40E_INSET_IPV4_SRC, I40E_X722_REG_INSET_L3_SRC_IP4},
> + {I40E_INSET_IPV4_DST, I40E_X722_REG_INSET_L3_DST_IP4},
> + {I40E_INSET_IPV4_PROTO, I40E_X722_REG_INSET_L3_IP4_PROTO},
> + {I40E_INSET_IPV4_TTL, I40E_X722_REG_INSET_L3_IP4_TTL},
> + };
> +#endif
> +
> + static const struct {
> + uint64_t inset;
> + uint64_t inset_reg;
> + } inset_map_diff_not_x722[] = {
> + {I40E_INSET_IPV4_SRC, I40E_REG_INSET_L3_SRC_IP4},
> + {I40E_INSET_IPV4_DST, I40E_REG_INSET_L3_DST_IP4},
> + {I40E_INSET_IPV4_PROTO, I40E_REG_INSET_L3_IP4_PROTO},
> + {I40E_INSET_IPV4_TTL, I40E_REG_INSET_L3_IP4_TTL},
> + };
>  
>   if (input == 0)
>   return val;
>  
>   /* Translate input set to register aware inset */
> - for (i = 0; i < RTE_DIM(inset_map); i++) {
> - if (input & inset_map[i].inset)
> - val |= inset_map[i].inset_reg;
> +#ifdef X722_SUPPORT
> + if (type == I40E_MAC_X722) {
> + for (i = 0; i < RTE_DIM(inset_map_diff_x722); i++) {
> + if (input & inset_map_diff_x722[i].inset)
> + val |= inset_map_diff_x722[i].inset_reg;
> + }
> + } else {
> + for (i = 0; i < RTE_DIM(inset_map_diff_not_x722); i++) {
> + if (input & inset_map_diff_not_x722[i].inset)
> +

[dpdk-dev] [PATCH v2 1/2] drivers/i40e: fix X722 macro absence result in compile

2016-10-18 Thread Ferruh Yigit
On 10/17/2016 10:54 AM, Ananyev, Konstantin wrote:
> Hi Jeff,
> 
>>
>> hi, Konstantin
>> Thanks your constructive suggestion. I don't think your question is
>> silly and we also think about the code style simply and effective, but
>> may be i would interpret the reason why we do that.
>>
>> 1) Sure, user definitely can choose to define the macro or not when
>> building dpdk i40e PMD, but i don't think it is
>> necessary to invoke a ret_config option to let up layer user freedom use
>> it,  because only the older version i40e driver does not support X722,
>> the newer version i40e driver will always support X722, so the macro
>> will be default hard code in the makefile. and we will use mac.type to
>> distinguish the difference register configure in run time. So we may
>> consider the macro just like a flag that highlight the difference of the
>> shared code between X710 and X722, that would benify the X710/X722 pmd
>> development but hardly no use to exposure to the up layer user.
>>
>> 2)  i think the answer also could find from above. But i think if we
>> develop go to a certain stage in the future, mute the macro or use
>> script to remove them like the way from hw driver, for support all
>> device types maybe not a bad idea, right?
> 
> Sorry, but I still didn't get it.
> If i40e driver will always support X722 then why do we need that macro at all?
> Why just not to remove it completely then?
> Same about run-time vs build-time choice:
> If let say i40e_get_rss_key() has to behave in a different way, why not to 
> create
> i40e_get_rss_key_x722() and use it when hw mactype is x7222?
> Or at least inside i40e_get_rss_key() do something like:
> if (hw->mac.type == I40E_MAC_X722) {...} else {...}
> ?
> Why instead you have to pollute whole i40e code with all these #ifdef 
> x7222/#else ...?
> Obviously that looks pretty ugly and hard to maintain.

It is not possible to remove "#ifdef x7222" from shared code, but what
about removing it from DPDK piece of the code, and code as it is always
defined?

If this is OK, this patch is not more required.
And the removing #ifdef work can be done in another patch later.

> Konstantin




[dpdk-dev] [PATCH] Revert "bonding: use existing enslaved device queues"

2016-10-18 Thread Jan Blunck
On Tue, Oct 18, 2016 at 2:49 PM, Ilya Maximets  
wrote:
> On 18.10.2016 15:28, Jan Blunck wrote:
>> If the application already configured queues the PMD should not
>> silently claim ownership and reset them.
>>
>> What exactly is the problem when changing MTU? This works fine from
>> what I can tell.
>
> Following scenario leads to APP PANIC:
>
> 1. mempool_1 = rte_mempool_create()
> 2. rte_eth_rx_queue_setup(bond0, ..., mempool_1);
> 3. rte_eth_dev_start(bond0);
> 4. mempool_2 = rte_mempool_create();
> 5. rte_eth_dev_stop(bond0);
> 6. rte_eth_rx_queue_setup(bond0, ..., mempool_2);
> 7. rte_eth_dev_start(bond0);
> * RX queues still use 'mempool_1' because reconfiguration doesn't 
> affect them. *
> 8. rte_mempool_free(mempool_1);
> 9. On any rx operation we'll get PANIC because of using freed 
> 'mempool_1':
>  PANIC in rte_mempool_get_ops():
>  assert "(ops_index >= 0) && (ops_index < RTE_MEMPOOL_MAX_OPS_IDX)" 
> failed
>
> You may just start OVS 2.6 with DPDK bonding device and attempt to change MTU 
> via 'mtu_request'.
> Bug is easily reproducible.
>

I see. I'm not 100% that this is expected to work without leaking the
driver's queues though. The driver is allowed to do allocations in
its rx_queue_setup() function that are being freed via
rx_queue_release() later. But rx_queue_release() is only called if you
reconfigure the
device with 0 queues. From what I understand there is no other way to
reconfigure a device to use another mempool.

But ... even that wouldn't work with the bonding driver right now: the
bonding master only configures the slaves during startup. I can put
that on my todo list.

Coming back to your original problem: changing the MTU for the bond
does work through rte_eth_dev_set_mtu() for slaves supporting that. In
any other case you could (re-)configure rxmode.max_rx_pkt_len (and
jumbo_frame / enable_scatter accordingly). This does work without a
call to rte_eth_rx_queue_setup().

Hope this helps,
Jan

> Best regards, Ilya Maximets.
>
>>
>> On Wed, Sep 7, 2016 at 2:28 PM, Ilya Maximets  
>> wrote:
>>> This reverts commit 5b7bb2bda5519b7800f814df64d4e015282140e5.
>>>
>>> It is necessary to reconfigure all queues every time because configuration
>>> can be changed.
>>>
>>> For example, if we're reconfiguring bonding device with new memory pool,
>>> already configured queues will still use the old one. And if the old
>>> mempool be freed, application likely will panic in attempt to use
>>> freed mempool.
>>>
>>> This happens when we use the bonding device with OVS 2.6 while MTU
>>> reconfiguration:
>>>
>>> PANIC in rte_mempool_get_ops():
>>> assert "(ops_index >= 0) && (ops_index < RTE_MEMPOOL_MAX_OPS_IDX)" failed
>>>
>>> Cc: 
>>> Signed-off-by: Ilya Maximets 
>>> ---
>>>  drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++
>>>  1 file changed, 2 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
>>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>>> index b20a272..eb5b6d1 100644
>>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>>> @@ -1305,8 +1305,6 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>>> struct bond_rx_queue *bd_rx_q;
>>> struct bond_tx_queue *bd_tx_q;
>>>
>>> -   uint16_t old_nb_tx_queues = slave_eth_dev->data->nb_tx_queues;
>>> -   uint16_t old_nb_rx_queues = slave_eth_dev->data->nb_rx_queues;
>>> int errval;
>>> uint16_t q_id;
>>>
>>> @@ -1347,9 +1345,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>>> }
>>>
>>> /* Setup Rx Queues */
>>> -   /* Use existing queues, if any */
>>> -   for (q_id = old_nb_rx_queues;
>>> -q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
>>> +   for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
>>> bd_rx_q = (struct bond_rx_queue 
>>> *)bonded_eth_dev->data->rx_queues[q_id];
>>>
>>> errval = 
>>> rte_eth_rx_queue_setup(slave_eth_dev->data->port_id, q_id,
>>> @@ -1365,9 +1361,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>>> }
>>>
>>> /* Setup Tx Queues */
>>> -   /* Use existing queues, if any */
>>> -   for (q_id = old_nb_tx_queues;
>>> -q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
>>> +   for (q_id = 0; q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
>>> bd_tx_q = (struct bond_tx_queue 
>>> *)bonded_eth_dev->data->tx_queues[q_id];
>>>
>>> errval = 
>>> rte_eth_tx_queue_setup(slave_eth_dev->data->port_id, q_id,
>>> --
>>> 2.7.4
>>>
>>
>>
>>


[dpdk-dev] Project Governance and Linux Foundation

2016-10-18 Thread Jerin Jacob
On Mon, Oct 17, 2016 at 05:23:42PM -0400, Dave Neary wrote:
> Hi,
> 
> On 10/17/2016 07:52 AM, O'Driscoll, Tim wrote:
> >> -Original Message-
> >> I don't really understand what can be gained by moving to Linux
> >> Foundation, but I am almost sure that no individual expert will be able
> >> to take any leaderhip role as those roles will be fulfilled by Platinum,
> >> Gold or Silver members: right ?
> > 
> > No. If DPDK were to move to LF as an independent project, then as discussed 
> > at the Userspace event in Dublin last year, and as documented in the 
> > original post below, the intention would be not to make any significant 
> > changes to the technical governance.
> > 
> > If DPDK were to move to FD.io the situation would be the same. The FD.io 
> > Technical Community Charter 
> > (https://fd.io/governance/technical-community-charter) specifies how 
> > Project Technical Leaders and Committers are nominated and approved, but 
> > there's no requirement for people in those roles to come from Platinum, 
> > Gold or Silver FD.io members. Those decisions are based purely on technical 
> > merit.
> 
> I just want to second what Tim said - it's important for Red Hat, at
> least, that the technical governance of a project be kept separate from
> any membership of an organization managing the budget for the project.
> 
> The technical management of the project can also be discussed, but it is
> out of scope, IMHO, when talking about moving to fd.io or the Linux
> Foundation.
> 
> >> The current DPDK version can run on virtually all processors (Intel, IBM
> >> and ARM) and leverage all NICs: is there **really** anyone questionning
> >> openness of the community?
> > 
> > I still hear concerns on this, and based on discussions with others who put 
> > their names to the post below, they do too. I think it's a perception that 
> > we need to address.
> 
> I would say that there is still a perception issue, for companies who
> look at the active developers, the owners of the project's resources
> (infra, domain name), and who have heard anecdotal evidence of issues in
> the past. I think the project has made a lot of progress since I have
> been following it, and I do not believe there are any major issues with
> the independence of the project. However, there are still concerned
> parties on this front, and the concerns can be easily addressed by a
> move to the LF.

+1

> 
> Regards,
> Dave.
> 
> -- 
> Dave Neary - NFV/SDN Community Strategy
> Open Source and Standards, Red Hat - http://community.redhat.com
> Ph: +1-978-399-2182 / Cell: +1-978-799-3338


[dpdk-dev] [PATCH v6 1/6] ethdev: add Tx preparation

2016-10-18 Thread Olivier Matz
Hi Tomasz,

I think the principle of tx_prep() is good, it may for instance help to
remove the function virtio_tso_fix_cksum() from the virtio, and maybe
even change the mbuf TSO/cksum API.

I have some questions/comments below, I'm sorry it comes very late.

On 10/14/2016 05:05 PM, Tomasz Kulasek wrote:
> Added API for `rte_eth_tx_prep`
> 
> uint16_t rte_eth_tx_prep(uint8_t port_id, uint16_t queue_id,
>   struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
> 
> Added fields to the `struct rte_eth_desc_lim`:
> 
>   uint16_t nb_seg_max;
>   /**< Max number of segments per whole packet. */
> 
>   uint16_t nb_mtu_seg_max;
>   /**< Max number of segments per one MTU */

Not sure I understand the second one. Is this is case of TSO?

Is it a usual limitation in different network hardware?
Can this info be retrieved/used by the application?

> 
> Created `rte_pkt.h` header with common used functions:
> 
> int rte_validate_tx_offload(struct rte_mbuf *m)
>   to validate general requirements for tx offload in packet such a
>   flag completness. In current implementation this function is called
>   optionaly when RTE_LIBRTE_ETHDEV_DEBUG is enabled.
> 
> int rte_phdr_cksum_fix(struct rte_mbuf *m)
>   to fix pseudo header checksum for TSO and non-TSO tcp/udp packets
>   before hardware tx checksum offload.
>- for non-TSO tcp/udp packets full pseudo-header checksum is
>  counted and set.
>- for TSO the IP payload length is not included.

Why not in rte_net.h?


> [...]
>  
> @@ -2816,6 +2825,82 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
>   return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, 
> nb_pkts);
>  }
>  
> +/**
> + * Process a burst of output packets on a transmit queue of an Ethernet 
> device.
> + *
> + * The rte_eth_tx_prep() function is invoked to prepare output packets to be
> + * transmitted on the output queue *queue_id* of the Ethernet device 
> designated
> + * by its *port_id*.
> + * The *nb_pkts* parameter is the number of packets to be prepared which are
> + * supplied in the *tx_pkts* array of *rte_mbuf* structures, each of them
> + * allocated from a pool created with rte_pktmbuf_pool_create().
> + * For each packet to send, the rte_eth_tx_prep() function performs
> + * the following operations:
> + *
> + * - Check if packet meets devices requirements for tx offloads.

Do you mean hardware requirements?
Can the application be aware of these requirements? I mean capability
flags, or something in dev_infos?

Maybe the comment could be more precise?

> + * - Check limitations about number of segments.
> + *
> + * - Check additional requirements when debug is enabled.

What kind of additional requirements?

> + *
> + * - Update and/or reset required checksums when tx offload is set for 
> packet.
> + *

By reading this, I think it may not be clear for the user about what
should be set in the mbuf. In mbuf API, it is said:

 * TCP segmentation offload. To enable this offload feature for a
 * packet to be transmitted on hardware supporting TSO:
 *  - set the PKT_TX_TCP_SEG flag in mbuf->ol_flags (this flag implies
 *PKT_TX_TCP_CKSUM)
 *  - set the flag PKT_TX_IPV4 or PKT_TX_IPV6
 *  - if it's IPv4, set the PKT_TX_IP_CKSUM flag and write the IP checksum
 *to 0 in the packet
 *  - fill the mbuf offload information: l2_len, l3_len, l4_len, tso_segsz
 *  - calculate the pseudo header checksum without taking ip_len in account,
 *and set it in the TCP header. Refer to rte_ipv4_phdr_cksum() and
 *rte_ipv6_phdr_cksum() that can be used as helpers.


If I understand well, using tx_prep(), the user will have to do the
same except writing the IP checksum to 0, and without setting the
TCP pseudo header checksum, right?


> + * The rte_eth_tx_prep() function returns the number of packets ready to be
> + * sent. A return value equal to *nb_pkts* means that all packets are valid 
> and
> + * ready to be sent.
> + *
> + * @param port_id
> + *   The port identifier of the Ethernet device.
> + * @param queue_id
> + *   The index of the transmit queue through which output packets must be
> + *   sent.
> + *   The value must be in the range [0, nb_tx_queue - 1] previously supplied
> + *   to rte_eth_dev_configure().
> + * @param tx_pkts
> + *   The address of an array of *nb_pkts* pointers to *rte_mbuf* structures
> + *   which contain the output packets.
> + * @param nb_pkts
> + *   The maximum number of packets to process.
> + * @return
> + *   The number of packets correct and ready to be sent. The return value 
> can be
> + *   less than the value of the *tx_pkts* parameter when some packet doesn't
> + *   meet devices requirements with rte_errno set appropriately.
> + */

Can we add the constraint that invalid packets are left untouched?

I think most of the time there will be a software fallback in that
case, so it would be good to ensure that this function does not change
the flags or the 

[dpdk-dev] [PATCH v7 0/7] vhost: optimize mergeable Rx path

2016-10-18 Thread Maxime Coquelin
Hi Yuanhan,

On 10/14/2016 11:34 AM, Yuanhan Liu wrote:
> This is a new set of patches to optimize the mergeable Rx code path.
> No refactoring (rewrite) was made this time. It just applies some
> findings from Zhihong (kudos to him!) that could improve the mergeable
> Rx path on the old code.
>
> The two major factors that could improve the performance greatly are:
>
> - copy virtio header together with packet data. This could remove
>   the buubbles between the two copy to optimize the cache access.
>
>   This is implemented in patch 2 "vhost: optimize cache access"
>
> - shadow used ring update and update them at once
>
>   The basic idea is to update used ring in a local buffer and flush
>   them to the virtio used ring at once in the end. Again, this is
>   for optimizing the cache access.
>
>   This is implemented in patch 5 "vhost: shadow used ring update"
>
> The two optimizations could yield 40+% performance in micro testing
> and 20+% in PVP case testing with 64B packet size.
>
> Besides that, there are some tiny optimizations, such as prefetch
> avail ring (patch 6) and retrieve avail head once (patch 7).
>
> Note: the shadow used ring tech could also be applied to the non-mrg
> Rx path (and even the dequeu) path. I didn't do that for two reasons:
>
> - we already update used ring in batch in both path: it's not shadowed
>   first though.
>
> - it's a bit too late too make many changes at this stage: RC1 is out.
>
> Please help testing.

I tested the following use-cases without noticing any functional problems:
  - Windows Guests (mergeable ON & OFF, indirect disabled): ping other VM
  - Linux guests with Kernel driver (mergeable ON & OFF, indirect OFF): 
iperf between 2 VMs
  - Linux guest with Virtio PMD (mergeable ON & OFF): testpmd txonly on 
host, rxonly on guest.

Feel free to add my:
Tested-by: Maxime Coquelin 

Thanks,
Maxime


[dpdk-dev] [RFC] [PATCH v2] libeventdev: event driven programming model framework for DPDK

2016-10-18 Thread Jerin Jacob
On Mon, Oct 17, 2016 at 08:26:33PM +, Eads, Gage wrote:
> 
> 
> >  -Original Message-
> >  From: Jerin Jacob [mailto:jerin.jacob at caviumnetworks.com]
> >  Sent: Sunday, October 16, 2016 11:18 PM
> >  To: Eads, Gage 
> >  Cc: dev at dpdk.org; thomas.monjalon at 6wind.com; Richardson, Bruce
> >  ; Vangati, Narender
> >  ; hemant.agrawal at nxp.com
> >  Subject: Re: [dpdk-dev] [RFC] [PATCH v2] libeventdev: event driven
> >  programming model framework for DPDK
> >  
> >  On Fri, Oct 14, 2016 at 03:00:57PM +, Eads, Gage wrote:
> >  > Thanks Jerin, this looks good. I've put a few notes/questions inline.
> >  
> >  Thanks Gage.
> >  
> >  >
> >  > >  +
> >  > >  +/**
> >  > >  + * Get the device identifier for the named event device.
> >  > >  + *
> >  > >  + * @param name
> >  > >  + *   Event device name to select the event device identifier.
> >  > >  + *
> >  > >  + * @return
> >  > >  + *   Returns event device identifier on success.
> >  > >  + *   - <0: Failure to find named event device.
> >  > >  + */
> >  > >  +extern uint8_t
> >  > >  +rte_event_dev_get_dev_id(const char *name);
> >  >
> >  > This return type should be int8_t, or some signed type, to support the 
> > failure
> >  case.
> >  
> >  Makes sense. I will change to int to make consistent with
> >  rte_cryptodev_get_dev_id()
> >  
> >  >
> >  > >  +};
> >  > >  +
> >  > >  +/**
> >  > >  + * Schedule one or more events in the event dev.
> >  > >  + *
> >  > >  + * An event dev implementation may define this is a NOOP, for
> >  > > instance if  + * the event dev performs its scheduling in hardware.
> >  > >  + *
> >  > >  + * @param dev_id
> >  > >  + *   The identifier of the device.
> >  > >  + */
> >  > >  +extern void
> >  > >  +rte_event_schedule(uint8_t dev_id);
> >  >
> >  > One idea: Have the function return the number of scheduled packets (or 0 
> > for
> >  implementations that do scheduling in hardware). This could be a helpful
> >  diagnostic for the software scheduler.
> >  
> >  How about returning an implementation specific value ?
> >  Rather than defining certain function associated with returned value.
> >  Just to  make sure it works with all HW/SW implementations. Something like
> >  below,
> >  
> >  /**
> >   * Schedule one or more events in the event dev.
> >   *
> >   * An event dev implementation may define this is a NOOP, for instance if
> >   * the event dev performs its scheduling in hardware.
> >   *
> >   * @param dev_id
> >   *   The identifier of the device.
> >   * @return
> >   *   Implementation specific value from the event driver for diagnostic 
> > purpose
> >   */
> >  extern int
> >  rte_event_schedule(uint8_t dev_id);
> >  
> >  
> 
> That's fine by me.

OK. I will change it in v3

> 
> I also had a comment on the return value of rte_event_dev_info_get() in my 
> previous email: "I'm wondering if this return type should be int, so we can 
> return an error if the dev_id is invalid."
> 
> What do you think?

The void return was based on cryptodev_info_get().I think, it makes
sense to return "int". I will change it in v3.


> 
> Thanks,
> Gage
> 
> >  
> >  


[dpdk-dev] [opnfv-tech-discuss][apex][ovsnfv]Problem showed up with OVS/DPDK with Cisco VIC adapter

2016-10-18 Thread Thomas F Herbert
All:

This is not necessarily related to VPP but rather to OVS/DPDK.

In OPNFV we found the following problem when using UCS NIC.

The UCS fabric seems to set a VLAN tag on untagged packets.

Any thoughts from DPDK and VPP folks would be appreciated.

http://dpdk.org/doc/guides-16.07/nics/enic.html

https://jira.opnfv.org/browse/APEX-333

It is currently deploying DPDK 16.04 and OVS 2.5.90

I could not find a user accessible setting to do this that would work. 
The workaround for now we came up with is to set a flow in OVS to strip 
the tag.

https://gerrit.opnfv.org/gerrit/#/c/23315/

Another solution is to set the nic to strip the vlan in rte eth code or 
write a DPDK "app" to set the nic.

http://dpdk.org/doc/guides-16.07/nics/enic.html

--TFH


-- 
*Thomas F Herbert*
SDN Group
Office of Technology
*Red Hat*


[dpdk-dev] [PATCH] vhost: disable indirect descriptors feature

2016-10-18 Thread Yuanhan Liu
On Tue, Oct 18, 2016 at 10:13:54AM +0200, Maxime Coquelin wrote:
> >>Thanks to Zhihong series you reworked, the changes to be done for
> >>mergeable buffers case is greatly simplified.
> >>I'll send the series later today.
> >
> >Do you mean the v6 from Zhihong? Unluckily, it will not be merged. That
> >series has been simplified to not rewrite the enqueue from scratch. See
> >V7.
> No, I meant the v7.

Oh, glad to know that the rework helps here :)

--yliu
> 
> >
> >For this patch, I think you should also update (or remove?) the related
> >section in the release note.
> Yes, sure.
> 
> Thanks,
> Maxime


[dpdk-dev] [PATCH v2 12/12] virtio: add Tso support

2016-10-18 Thread Olivier Matz
Hi Stephen,

On 10/14/2016 01:33 AM, Stephen Hemminger wrote:
> On Thu, 13 Oct 2016 16:18:39 +0800
> Yuanhan Liu  wrote:
> 
>> On Mon, Oct 03, 2016 at 11:00:23AM +0200, Olivier Matz wrote:
>>> +/* When doing TSO, the IP length is not included in the pseudo header
>>> + * checksum of the packet given to the PMD, but for virtio it is
>>> + * expected.
>>> + */
>>> +static void
>>> +virtio_tso_fix_cksum(struct rte_mbuf *m)
>>> +{
>>> +   /* common case: header is not fragmented */
>>> +   if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len +
>>> +   m->l4_len)) {  
>> ...
>>> +   /* replace it in the packet */
>>> +   th->cksum = new_cksum;
>>> +   } else {  
>> ...
>>> +   /* replace it in the packet */
>>> +   *rte_pktmbuf_mtod_offset(m, uint8_t *,
>>> +   m->l2_len + m->l3_len + 16) = new_cksum.u8[0];
>>> +   *rte_pktmbuf_mtod_offset(m, uint8_t *,
>>> +   m->l2_len + m->l3_len + 17) = new_cksum.u8[1];
>>> +   }  
>>
>> The tcp header will always be in the mbuf, right? Otherwise, you can't
>> update the cksum field here. What's the point of introducing the "else
>> clause" then?
>>
>>  --yliu
> 
> You need to check the reference count before updating any data in mbuf.
> 

That's correct, I'll fix that.

Thanks for the comment,
Olivier


[dpdk-dev] [PATCH] Revert "bonding: use existing enslaved device queues"

2016-10-18 Thread Ilya Maximets
On 18.10.2016 15:28, Jan Blunck wrote:
> If the application already configured queues the PMD should not
> silently claim ownership and reset them.
> 
> What exactly is the problem when changing MTU? This works fine from
> what I can tell.

Following scenario leads to APP PANIC:

1. mempool_1 = rte_mempool_create()
2. rte_eth_rx_queue_setup(bond0, ..., mempool_1);
3. rte_eth_dev_start(bond0);
4. mempool_2 = rte_mempool_create();
5. rte_eth_dev_stop(bond0);
6. rte_eth_rx_queue_setup(bond0, ..., mempool_2);
7. rte_eth_dev_start(bond0);
* RX queues still use 'mempool_1' because reconfiguration doesn't 
affect them. *
8. rte_mempool_free(mempool_1);
9. On any rx operation we'll get PANIC because of using freed 
'mempool_1':
 PANIC in rte_mempool_get_ops():
 assert "(ops_index >= 0) && (ops_index < RTE_MEMPOOL_MAX_OPS_IDX)" 
failed

You may just start OVS 2.6 with DPDK bonding device and attempt to change MTU 
via 'mtu_request'.
Bug is easily reproducible.

Best regards, Ilya Maximets.

> 
> On Wed, Sep 7, 2016 at 2:28 PM, Ilya Maximets  
> wrote:
>> This reverts commit 5b7bb2bda5519b7800f814df64d4e015282140e5.
>>
>> It is necessary to reconfigure all queues every time because configuration
>> can be changed.
>>
>> For example, if we're reconfiguring bonding device with new memory pool,
>> already configured queues will still use the old one. And if the old
>> mempool be freed, application likely will panic in attempt to use
>> freed mempool.
>>
>> This happens when we use the bonding device with OVS 2.6 while MTU
>> reconfiguration:
>>
>> PANIC in rte_mempool_get_ops():
>> assert "(ops_index >= 0) && (ops_index < RTE_MEMPOOL_MAX_OPS_IDX)" failed
>>
>> Cc: 
>> Signed-off-by: Ilya Maximets 
>> ---
>>  drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++
>>  1 file changed, 2 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>> index b20a272..eb5b6d1 100644
>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>> @@ -1305,8 +1305,6 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>> struct bond_rx_queue *bd_rx_q;
>> struct bond_tx_queue *bd_tx_q;
>>
>> -   uint16_t old_nb_tx_queues = slave_eth_dev->data->nb_tx_queues;
>> -   uint16_t old_nb_rx_queues = slave_eth_dev->data->nb_rx_queues;
>> int errval;
>> uint16_t q_id;
>>
>> @@ -1347,9 +1345,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>> }
>>
>> /* Setup Rx Queues */
>> -   /* Use existing queues, if any */
>> -   for (q_id = old_nb_rx_queues;
>> -q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
>> +   for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
>> bd_rx_q = (struct bond_rx_queue 
>> *)bonded_eth_dev->data->rx_queues[q_id];
>>
>> errval = 
>> rte_eth_rx_queue_setup(slave_eth_dev->data->port_id, q_id,
>> @@ -1365,9 +1361,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>> }
>>
>> /* Setup Tx Queues */
>> -   /* Use existing queues, if any */
>> -   for (q_id = old_nb_tx_queues;
>> -q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
>> +   for (q_id = 0; q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
>> bd_tx_q = (struct bond_tx_queue 
>> *)bonded_eth_dev->data->tx_queues[q_id];
>>
>> errval = 
>> rte_eth_tx_queue_setup(slave_eth_dev->data->port_id, q_id,
>> --
>> 2.7.4
>>
> 
> 
> 


[dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization

2016-10-18 Thread Thomas Monjalon
2016-10-18 09:04, Neil Horman:
> On Mon, Oct 17, 2016 at 02:43:12PM +0100, Ferruh Yigit wrote:
> > I caught while running ABI validation script today, I think this patch
> > should increase LIBABIVER of:
> > - lib/librte_cryptodev
> > - lib/librte_eal
> > - lib/librte_ether
> > 
> It should, and it in fact should wait a release if it hadn't been documented 
> as
> a comming change.

It was announced in release 16.04:
http://dpdk.org/commit/c7970af

While bumping LIBABIVER, the deprecation notices must be removed,
and the API/ABI changes noted in the release notes, please.


[dpdk-dev] [PATCH] drivers: make driver names consistent

2016-10-18 Thread Thomas Monjalon
2016-10-18 21:06, Yuanhan Liu:
> On Tue, Oct 18, 2016 at 02:50:16PM +0200, Jan Blunck wrote:
> > >From my understanding this is a massive API breakage. This forces all
> > existing users of the virtual PMDs to change with zero benefit. Even
> > if that isn't enough it also makes it impossible to switch between
> > releases by recompiling.
> > 
> > Can we please revert these changes and work on some aliasing support
> > for the PMDs to fix it long term?
> 
> +1. Aliasing is also something I would suggest before making such renames.

It is a brutal change, yes.
It was announced in 16.07 release notes though.

We can try to make this change more progressive by keeping old names
as aliases for some time.
Is there a volunteer to work on vdev names aliases,
with the target of integrating them in RC2 or RC3?



[dpdk-dev] Project Governance and Linux Foundation

2016-10-18 Thread Thomas Monjalon
2016-10-18 17:04, Jerin Jacob:
> On Mon, Oct 17, 2016 at 05:23:42PM -0400, Dave Neary wrote:
> > > I still hear concerns on this, and based on discussions with others who 
> > > put their names to the post below, they do too. I think it's a perception 
> > > that we need to address.
> > 
> > I would say that there is still a perception issue, for companies who
> > look at the active developers, the owners of the project's resources
> > (infra, domain name), and who have heard anecdotal evidence of issues in
> > the past. I think the project has made a lot of progress since I have
> > been following it, and I do not believe there are any major issues with
> > the independence of the project. However, there are still concerned
> > parties on this front, and the concerns can be easily addressed by a
> > move to the LF.
> 
> +1

How can we solve issues if you don't give more details than
"hear concerns" or "heard anecdotal evidence of issues"?


[dpdk-dev] [dpdk-users] Project Governance and Linux Foundation

2016-10-18 Thread Thomas Monjalon
2016-10-17 14:40, O'Driscoll, Tim:
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > 2016-10-17 11:52, O'Driscoll, Tim:
> > > From: Hobywan Kenoby
> > > > The current DPDK version can run on virtually all processors (Intel,
> > > > IBM and ARM) and leverage all NICs: is there **really** anyone
> > > > questionning openness of the community?
> > >
> > > I still hear concerns on this, and based on discussions with others
> > > who put their names to the post below, they do too.
> > > I think it's a perception that we need to address.
> > 
> > It is simple to address this perception with fact checking.
> > The next releases will provide even more code for ARM and NPUs.
> > If someone submits some good code and is ignored, it is easy enough
> > to ping the mailing list and make it visible.
> > If someone sees any regression on his architecture, we care.
> > Please let's stop maintaining confusion on this topic.
> > 
> > DPDK *is* truly open.
> 
> Well, to be a little more specific, the concern I've heard on many occasions 
> is that 6WIND control the infrastructure for the project and so effectively 
> have a veto over what's accepted into DPDK. Your argument is that you've 
> never exercised that veto, which is true, but you still have the ability to 
> do so. That's not a characteristic of a truly open project. As stated in the 
> original post on this:
> 
> > - The infrastructure for a project like DPDK should not be owned and 
> > controlled by any single company.

Technically yes, we can improve that part, at the cost of more coordination
with more administrators, and without being sure that everybody will trust
this new organization.
I would like to highlight that this supposed veto cannot really be exercised
because feedbacks are open on the mailing list.

I'm worried that we are talking too much about a veto situation which
does not happen, and would mean ignoring some comments, whereas the real
issue is the lack of reviews.
Apart that, I still think such organization can be interesting for other
(legals and budget) reasons.

At this point, I must admit that moving the project infrastructure will have
at least one big benefit: stopping this kind of discussion.
And such discussion will probably never happen again because nobody will
take the risk of annoying the big vendors supporting the new organization.
One can wonder whether it is an improvement.


[dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter type and its use

2016-10-18 Thread E. Scott Daniels
The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t
and treated as a binary flag when it needs to be a uint16_t
and treated as a VLAN id.  The data sheet (sect 8.2.3.27.13) describes
the right most 16 bits as the VLAN id that is to be inserted; the
16.11  code is accepting only a 1 or 0 thus effectively only
allowing the VLAN id 1 to be inserted (0 disables the insertion
setting).

This patch changes the final parm name to represent the data that
is being accepted (vlan_id), changes the type to permit all valid
VLAN ids, and validates the parameter based on the range of 0 to
4095. Corresponding changes to prototype and documentation in the
.h file.

Fixes:  49e248223e9f71 ("net/ixgbe: add API for VF management")

Signed-off-by: E. Scott Daniels 
---
 drivers/net/ixgbe/ixgbe_ethdev.c  | 8 
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4ca5747..316af73 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4727,7 +4727,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, 
uint16_t vf, uint8_t on)
 }

 int
-rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t vlan_id)
 {
struct ixgbe_hw *hw;
uint32_t ctrl;
@@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t 
vf, uint8_t on)
if (vf >= dev_info.max_vfs)
return -EINVAL;

-   if (on > 1)
+   if (vlan_id > 4095)
return -EINVAL;

hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf));
-   if (on) {
-   ctrl = on;
+   if (vlan_id) {
+   ctrl = vlan_id;
ctrl |= IXGBE_VMVIR_VLANA_DEFAULT;
} else {
ctrl = 0;
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h 
b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index 2fdf530..c2fb826 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -99,16 +99,17 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, 
uint16_t vf, uint8_t on);
  *The port identifier of the Ethernet device.
  * @param vf
  *ID specifying VF.
- * @param on
- *1 - Enable VF's vlan insert.
- *0 - Disable VF's vlan insert
+ * @param vlan_id
+ *0 - Disable VF's vlan insert.
+ *n - Enable; n is inserted as the vlan id.
  *
  * @return
  *   - (0) if successful.
  *   - (-ENODEV) if *port* invalid.
  *   - (-EINVAL) if bad parameter.
  */
-int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+   uint16_t vlan_id);

 /**
  * Enable/Disable tx loopback
-- 
1.9.1



[dpdk-dev] [dpdk-users] Project Governance and Linux Foundation

2016-10-18 Thread Thomas Monjalon
2016-10-18 12:16, Liu Yuan:
> China Mobile would like to support moving the DPDK project to the Linux 
> Foundation.

OK, there can be some advantages to join the Linux Foundation.

> DPDK is a key technology / element in the NFV. As an end user, we can foresee 
> the importance of DPDK in the future. If the DPDK project could be governed 
> by Linux Foundation, it will promote more companies to join in and contribute 
> to DPDK project.

Same question as for ZTE,
Why joining the Linux Foundation would help you to contribute?
Is there an issue related to your patents?
How to help you, specifically?


[dpdk-dev] [PATCH] drivers: make driver names consistent

2016-10-18 Thread Jan Blunck
>From my understanding this is a massive API breakage. This forces all
existing users of the virtual PMDs to change with zero benefit. Even
if that isn't enough it also makes it impossible to switch between
releases by recompiling.

Can we please revert these changes and work on some aliasing support
for the PMDs to fix it long term?

Thanks,
Jan


On Fri, Sep 16, 2016 at 11:58 AM, Thomas Monjalon
 wrote:
> 2016-08-24 22:37, Mcnamara, John:
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Pablo de Lara
>> >
>> > ...
>> >
>> > -$RTE_TARGET/app/testpmd -c '0xf' -n 4 --vdev 
>> > 'eth_pcap0,rx_pcap=/path/to/ file_rx.pcap,tx_pcap=/path/to/file_tx.pcap' 
>> > -- --port-topology=chained
>> > +$RTE_TARGET/app/testpmd -c '0xf' -n 4 --vdev 
>> > 'net_pcap0,rx_pcap=/path/to/ file_rx.pcap,tx_pcap=/path/to/file_tx.pcap' 
>> > -- --port-topology=chained
>>
>>
>> I know that this is an existing issue but there shouldn't be a space in
>> "/path/to/ file". Perhaps you could fix that (in a number of places) as part
>> of this patch. You could probably leave out the "/path/to/" part altogether 
>> as
>> it may be clearer, see below.
>>
>> Also, could you wrap the long code lines in the sections that you change at
>> 80 chars using "\" to keep them on the page in the PDF docs, like:
>>
>> $RTE_TARGET/app/testpmd -c '0xf' -n 4 \
>> --vdev 
>> 'net_pcap0,rx_pcap=/path/to/file_rx.pcap,tx_pcap=/path/to/file_tx.pcap' \
>> -- --port-topology=chained
>>
>> Or without the path part:
>>
>> $RTE_TARGET/app/testpmd -c '0xf' -n 4 \
>> --vdev 'net_pcap0,rx_pcap=file_rx.pcap,tx_pcap=file_tx.pcap' \
>> -- --port-topology=chained
>
> Applied with above comments fixed and release notes updated, thanks.


[dpdk-dev] [PATCH v1] doc: announce API change for ethdev function

2016-10-18 Thread Bernard Iremonger
The _rte_eth_dev_call_process function will change to return "int"
and a fourth parameter "void* ret_param" will be added. This change
targets release 17.02.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/rel_notes/deprecation.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index d5c1490..1d274d8 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -49,3 +49,7 @@ Deprecation Notices
 * mempool: The functions for single/multi producer/consumer are deprecated
   and will be removed in 17.02.
   It is replaced by ``rte_mempool_generic_get/put`` functions.
+
+* librte_ether: an API change is planned for 17.02 for the function
+  ``_rte_eth_dev_callback_process``. In 17.02 the function will return an 
``int``
+  instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
-- 
2.10.1



[dpdk-dev] [PATCH v1] doc: announce API and ABI change for librte_ether

2016-10-18 Thread Bernard Iremonger
In 17.02 five rte_eth_dev_set_vf_*** functions will be removed
from librte_ether, renamed and moved to the ixgbe PMD.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/rel_notes/deprecation.rst | 36 
 1 file changed, 36 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 1d274d8..20e11ac 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -53,3 +53,39 @@ Deprecation Notices
 * librte_ether: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an 
``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
+
+* librte_ether: for 17.02 it is planned to deprecate the following five 
functions:
+
+  ``rte_eth_dev_set_vf_rxmode``
+
+  ``rte_eth_dev_set_vf_rx``
+
+  ``rte_eth_dev_set_vf_tx``
+
+  ``rte_eth_dev_set_vf_vlan_filter``
+
+  ``rte_eth_set_vf_rate_limit``
+
+  The following fields will be removed from ``struct eth_dev_ops``:
+
+  ``eth_set_vf_rx_mode_t``
+
+  ``eth_set_vf_rx_t``
+
+  ``eth_set_vf_tx_t``
+
+  ``eth_set_vf_vlan_filter_t``
+
+  ``eth_set_vf_rate_limit_t``
+
+  The functions will be renamed to the following, and moved to the ``ixgbe`` 
PMD.
+
+  ``rte_pmd_ixgbe_set_vf_rxmode``
+
+  ``rte_pmd_ixgbe_set_vf_rx``
+
+  ``rte_pmd_ixgbe_set_vf_tx``
+
+  ``rte_pmd_ixgbe_set_vf_vlan_filter``
+
+  ``rte_pmd_ixgbe_set_vf_rate_limit``
-- 
2.10.1



[dpdk-dev] [PATCH] Revert "bonding: use existing enslaved device queues"

2016-10-18 Thread Jan Blunck
If the application already configured queues the PMD should not
silently claim ownership and reset them.

What exactly is the problem when changing MTU? This works fine from
what I can tell.

Cheers,
Jan

On Wed, Sep 7, 2016 at 2:28 PM, Ilya Maximets  wrote:
> This reverts commit 5b7bb2bda5519b7800f814df64d4e015282140e5.
>
> It is necessary to reconfigure all queues every time because configuration
> can be changed.
>
> For example, if we're reconfiguring bonding device with new memory pool,
> already configured queues will still use the old one. And if the old
> mempool be freed, application likely will panic in attempt to use
> freed mempool.
>
> This happens when we use the bonding device with OVS 2.6 while MTU
> reconfiguration:
>
> PANIC in rte_mempool_get_ops():
> assert "(ops_index >= 0) && (ops_index < RTE_MEMPOOL_MAX_OPS_IDX)" failed
>
> Cc: 
> Signed-off-by: Ilya Maximets 
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
> b/drivers/net/bonding/rte_eth_bond_pmd.c
> index b20a272..eb5b6d1 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1305,8 +1305,6 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
> struct bond_rx_queue *bd_rx_q;
> struct bond_tx_queue *bd_tx_q;
>
> -   uint16_t old_nb_tx_queues = slave_eth_dev->data->nb_tx_queues;
> -   uint16_t old_nb_rx_queues = slave_eth_dev->data->nb_rx_queues;
> int errval;
> uint16_t q_id;
>
> @@ -1347,9 +1345,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
> }
>
> /* Setup Rx Queues */
> -   /* Use existing queues, if any */
> -   for (q_id = old_nb_rx_queues;
> -q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
> +   for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
> bd_rx_q = (struct bond_rx_queue 
> *)bonded_eth_dev->data->rx_queues[q_id];
>
> errval = rte_eth_rx_queue_setup(slave_eth_dev->data->port_id, 
> q_id,
> @@ -1365,9 +1361,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
> }
>
> /* Setup Tx Queues */
> -   /* Use existing queues, if any */
> -   for (q_id = old_nb_tx_queues;
> -q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
> +   for (q_id = 0; q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
> bd_tx_q = (struct bond_tx_queue 
> *)bonded_eth_dev->data->tx_queues[q_id];
>
> errval = rte_eth_tx_queue_setup(slave_eth_dev->data->port_id, 
> q_id,
> --
> 2.7.4
>


[dpdk-dev] [PATCH 2/2] examples/tep_term: Fix packet len for multi-seg mbuf

2016-10-18 Thread Michael Qiu
For multi-seg mbuf, ip->total_length should be pkt_len subtract
ether len.

Fixes: 4abe471ed6fc("examples/tep_term: implement VXLAN processing")

Signed-off-by: Michael Qiu 
---
 examples/tep_termination/vxlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c
index b57f867..9142c8d 100644
--- a/examples/tep_termination/vxlan.c
+++ b/examples/tep_termination/vxlan.c
@@ -218,7 +218,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id)
/* copy in IP header */
ip = rte_memcpy(ip, _ip_hdr[vport_id],
sizeof(struct ipv4_hdr));
-   ip->total_length = rte_cpu_to_be_16(m->data_len
+   ip->total_length = rte_cpu_to_be_16(m->pkt_len
- sizeof(struct ether_hdr));

/* outer IP checksum */
-- 
1.8.3.1



[dpdk-dev] [PATCH 1/2] examples/tep_term: Fix l4_len issue

2016-10-18 Thread Michael Qiu
l4_len is not fixed, althrough mostly it is a fixed value,
but when guest using iperf to do some tests, the l4_len
will have another 12 bytes optional fields.

Fixes: 2bb43bd4350a("examples/tep_term: add TSO offload configuration")

Signed-off-by: Michael Qiu 
---
 examples/tep_termination/vxlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c
index 5ee1f95..b57f867 100644
--- a/examples/tep_termination/vxlan.c
+++ b/examples/tep_termination/vxlan.c
@@ -147,7 +147,7 @@ process_inner_cksums(struct ether_hdr *eth_hdr, union 
tunnel_offload_info *info)
if (tso_segsz != 0) {
ol_flags |= PKT_TX_TCP_SEG;
info->tso_segsz = tso_segsz;
-   info->l4_len = sizeof(struct tcp_hdr);
+   info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
}

} else if (l4_proto == IPPROTO_SCTP) {
-- 
1.8.3.1



[dpdk-dev] [PATCH] openssl pmd: rename SW crypto device from libcrypto to openssl

2016-10-18 Thread Slawomir Mrozowicz
This patch replaces name "libcrypto" to "openssl" from file directories,
symbol prefixes and sub-names connected with old name.
Renamed poll mode driver files, test files, and documentations.
It is done to better name association with library because
the cryptography operations are using Openssl library crypto API.

Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")

Signed-off-by: Slawomir Mrozowicz 
---
 MAINTAINERS|6 +-
 app/test/test_cryptodev.c  |   56 +-
 app/test/test_cryptodev_aes_test_vectors.h |   62 +-
 app/test/test_cryptodev_blockcipher.c  |6 +-
 app/test/test_cryptodev_blockcipher.h  |2 +-
 app/test/test_cryptodev_des_test_vectors.h |   56 +-
 app/test/test_cryptodev_hash_test_vectors.h|   48 +-
 app/test/test_cryptodev_perf.c |   52 +-
 config/common_base |4 +-
 doc/guides/cryptodevs/index.rst|2 +-
 doc/guides/cryptodevs/libcrypto.rst|  117 ---
 doc/guides/cryptodevs/openssl.rst  |  117 +++
 doc/guides/rel_notes/release_16_11.rst |2 +-
 drivers/crypto/Makefile|2 +-
 drivers/crypto/libcrypto/Makefile  |   60 --
 drivers/crypto/libcrypto/rte_libcrypto_pmd.c   | 1062 
 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c   |  708 -
 .../crypto/libcrypto/rte_libcrypto_pmd_private.h   |  174 
 .../crypto/libcrypto/rte_pmd_libcrypto_version.map |3 -
 drivers/crypto/openssl/Makefile|   60 ++
 drivers/crypto/openssl/rte_openssl_pmd.c   | 1062 
 drivers/crypto/openssl/rte_openssl_pmd_ops.c   |  708 +
 drivers/crypto/openssl/rte_openssl_pmd_private.h   |  174 
 drivers/crypto/openssl/rte_pmd_openssl_version.map |3 +
 lib/librte_cryptodev/rte_cryptodev.h   |4 +-
 mk/rte.app.mk  |2 +-
 26 files changed, 2276 insertions(+), 2276 deletions(-)
 delete mode 100644 doc/guides/cryptodevs/libcrypto.rst
 create mode 100644 doc/guides/cryptodevs/openssl.rst
 delete mode 100644 drivers/crypto/libcrypto/Makefile
 delete mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd.c
 delete mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c
 delete mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_private.h
 delete mode 100644 drivers/crypto/libcrypto/rte_pmd_libcrypto_version.map
 create mode 100644 drivers/crypto/openssl/Makefile
 create mode 100644 drivers/crypto/openssl/rte_openssl_pmd.c
 create mode 100644 drivers/crypto/openssl/rte_openssl_pmd_ops.c
 create mode 100644 drivers/crypto/openssl/rte_openssl_pmd_private.h
 create mode 100644 drivers/crypto/openssl/rte_pmd_openssl_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 8f5fa82..af47e04 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -436,10 +436,10 @@ M: Pablo de Lara 
 F: drivers/crypto/zuc/
 F: doc/guides/cryptodevs/zuc.rst

-LibCrypto PMD
+OpenSSL PMD
 M: Declan Doherty 
-F: drivers/crypto/libcrypto/
-F: doc/guides/cryptodevs/libcrypto.rst
+F: drivers/crypto/openssl/
+F: doc/guides/cryptodevs/openssl.rst

 Null Crypto PMD
 M: Declan Doherty 
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 7d03899..079e54d 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -326,24 +326,24 @@ testsuite_setup(void)
}
}

-   /* Create 2 LIBCRYPTO devices if required */
-   if (gbl_cryptodev_type == RTE_CRYPTODEV_LIBCRYPTO_PMD) {
-#ifndef RTE_LIBRTE_PMD_LIBCRYPTO
-   RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO must be"
+   /* Create 2 OPENSSL devices if required */
+   if (gbl_cryptodev_type == RTE_CRYPTODEV_OPENSSL_PMD) {
+#ifndef RTE_LIBRTE_PMD_OPENSSL
+   RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be"
" enabled in config file to run this testsuite.\n");
return TEST_FAILED;
 #endif
nb_devs = rte_cryptodev_count_devtype(
-   RTE_CRYPTODEV_LIBCRYPTO_PMD);
+   RTE_CRYPTODEV_OPENSSL_PMD);
if (nb_devs < 2) {
for (i = nb_devs; i < 2; i++) {
ret = rte_eal_vdev_init(
-   RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD),
+   RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
NULL);

TEST_ASSERT(ret == 0, "Failed to create "
"instance %u of pmd : %s", i,
-   RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD));
+   RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));

[dpdk-dev] [PATCH] examples/ip_pipeline: fix freeBSD build error

2016-10-18 Thread Dumitrescu, Cristian


> -Original Message-
> From: Singh, Jasvinder
> Sent: Monday, October 17, 2016 4:49 PM
> To: dev at dpdk.org
> Cc: Dumitrescu, Cristian 
> Subject: [PATCH] examples/ip_pipeline: fix freeBSD build error
> 
> Error log:
>  CC init.o
>  examples/ip_pipeline/init.c:38:22: fatal error: linux/if.h: No such file or
> directory
>  #include 
>   ^
> Fixes: 3f2c9f3bb6c6 ("examples/ip_pipeline: add TAP port")
> 
> Signed-off-by: Jasvinder Singh 
> ---

Acked-by: Cristian Dumitrescu 



[dpdk-dev] [PATCH v6 0/6] add Tx preparation

2016-10-18 Thread Ananyev, Konstantin


> 
> As discussed in that thread:
> 
> http://dpdk.org/ml/archives/dev/2015-September/023603.html
> 
> Different NIC models depending on HW offload requested might impose different 
> requirements on packets to be TX-ed in terms of:
> 
>  - Max number of fragments per packet allowed
>  - Max number of fragments per TSO segments
>  - The way pseudo-header checksum should be pre-calculated
>  - L3/L4 header fields filling
>  - etc.
> 
> 
> MOTIVATION:
> ---
> 
> 1) Some work cannot (and didn't should) be done in rte_eth_tx_burst.
>However, this work is sometimes required, and now, it's an
>application issue.
> 
> 2) Different hardware may have different requirements for TX offloads,
>other subset can be supported and so on.
> 
> 3) Some parameters (e.g. number of segments in ixgbe driver) may hung
>device. These parameters may be vary for different devices.
> 
>For example i40e HW allows 8 fragments per packet, but that is after
>TSO segmentation. While ixgbe has a 38-fragment pre-TSO limit.
> 
> 4) Fields in packet may require different initialization (like e.g. will
>require pseudo-header checksum precalculation, sometimes in a
>different way depending on packet type, and so on). Now application
>needs to care about it.
> 
> 5) Using additional API (rte_eth_tx_prep) before rte_eth_tx_burst let to
>prepare packet burst in acceptable form for specific device.
> 
> 6) Some additional checks may be done in debug mode keeping tx_burst
>implementation clean.
> 
> 
> PROPOSAL:
> -
> 
> To help user to deal with all these varieties we propose to:
> 
> 1) Introduce rte_eth_tx_prep() function to do necessary preparations of
>packet burst to be safely transmitted on device for desired HW
>offloads (set/reset checksum field according to the hardware
>requirements) and check HW constraints (number of segments per
>packet, etc).
> 
>While the limitations and requirements may differ for devices, it
>requires to extend rte_eth_dev structure with new function pointer
>"tx_pkt_prep" which can be implemented in the driver to prepare and
>verify packets, in devices specific way, before burst, what should to
>prevent application to send malformed packets.
> 
> 2) Also new fields will be introduced in rte_eth_desc_lim:
>nb_seg_max and nb_mtu_seg_max, providing an information about max
>segments in TSO and non-TSO packets acceptable by device.
> 
>This information is useful for application to not create/limit
>malicious packet.
> 
> 
> APPLICATION (CASE OF USE):
> --
> 
> 1) Application should to initialize burst of packets to send, set
>required tx offload flags and required fields, like l2_len, l3_len,
>l4_len, and tso_segsz
> 
> 2) Application passes burst to the rte_eth_tx_prep to check conditions
>required to send packets through the NIC.
> 
> 3) The result of rte_eth_tx_prep can be used to send valid packets
>and/or restore invalid if function fails.
> 
> e.g.
> 
>   for (i = 0; i < nb_pkts; i++) {
> 
>   /* initialize or process packet */
> 
>   bufs[i]->tso_segsz = 800;
>   bufs[i]->ol_flags = PKT_TX_TCP_SEG | PKT_TX_IPV4
>   | PKT_TX_IP_CKSUM;
>   bufs[i]->l2_len = sizeof(struct ether_hdr);
>   bufs[i]->l3_len = sizeof(struct ipv4_hdr);
>   bufs[i]->l4_len = sizeof(struct tcp_hdr);
>   }
> 
>   /* Prepare burst of TX packets */
>   nb_prep = rte_eth_tx_prep(port, 0, bufs, nb_pkts);
> 
>   if (nb_prep < nb_pkts) {
>   printf("tx_prep failed\n");
> 
>   /* nb_prep indicates here first invalid packet. rte_eth_tx_prep
>* can be used on remaining packets to find another ones.
>*/
> 
>   }
> 
>   /* Send burst of TX packets */
>   nb_tx = rte_eth_tx_burst(port, 0, bufs, nb_prep);
> 
>   /* Free any unsent packets. */
> 
> 
> v5 changes:
>  - rebased csum engine modification
>  - added information to the csum engine about performance tests
>  - some performance improvements
> 
> v4 changes:
>  - tx_prep is now set to default behavior (NULL) for simple/vector path
>in fm10k, i40e and ixgbe drivers to increase performance, when
>Tx offloads are not intentionally available
> 
> v3 changes:
>  - reworked csum testpmd engine instead adding new one,
>  - fixed checksum initialization procedure to include also outer
>checksum offloads,
>  - some minor formattings and optimalizations
> 
> v2 changes:
>  - rte_eth_tx_prep() returns number of packets when device doesn't
>support tx_prep functionality,
>  - introduced CONFIG_RTE_ETHDEV_TX_PREP allowing to turn off tx_prep
> 
> 
> Tomasz Kulasek (6):
>   ethdev: add Tx preparation
>   e1000: add Tx preparation
>   fm10k: add Tx preparation
>   i40e: add Tx preparation
>   ixgbe: add Tx preparation
>   testpmd: use Tx preparation in 

[dpdk-dev] packet sojourn time on TX/RX queues

2016-10-18 Thread Ali Volkan Atli

Hello

I'm trying to implement CoDel algorithm on Intel's DPDK library, so I need to 
measure packet sojourn time (the time a packet stays in the queue before being 
sent) but I have trouble with measuring packet sojourn time on RX/TX queues 
because of DMA usage. When I call rte_eth_tx_burst() function, DPDK puts 
packets into DMA-region using ring buffer and I have no idea when packets sent 
really into network. Likewise, when I call rte_eth_rx_burst(), I don't have any 
idea when packets arrived because I'm pulling the packets from ring buffer 
handled by DMA, so I'm not sure totally but I think I have no chance to measure 
sojourn time for dma-like implementation. Could you please correct me if I'm 
wrong. Also any comments/suggestions would be greatly appreciated.

Thanks in advance..

?- Volkan


[dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue

2016-10-18 Thread Ananyev, Konstantin


> 
> In vPMD, when load Rx desc with _mm_loadu_si128,
> volatile point will be cast into non-volatile point.
> So GCC is allowed to reorder the load instructions,
> while Rx read's correctness is reply on these load
> instructions to follow a backward sequence strictly,
> so we add compile barrier to prevent compiler reorder.
> We already met this issue on i40e with GCC6 and we
> fixed this on ixgbe and fm10k also.
> 
> v2:
> - fix check-git-log.sh warning.
> - add more detail commit message.
> 
> Qi Zhang (3):
>   net/i40e: fix out of order Rx read issue
>   net/ixgbe: fix out of order Rx read issue
>   net/fm10k: fix out of ofder Rx read issue
> 
>  drivers/net/fm10k/fm10k_rxtx_vec.c | 3 +++
>  drivers/net/i40e/i40e_rxtx_vec.c   | 3 +++
>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 3 +++
>  3 files changed, 9 insertions(+)
> 
> --

Acked-by: Konstantin Ananyev 

> 2.7.4



[dpdk-dev] [dpdk-users] How to printout PMD logs to console

2016-10-18 Thread Kavanagh, Mark B
>
>Hi All,
>
>
>I'm doing app debug and would like to see device PMD logs, e.g.
>dpdk/drivers/net/ixgbe/ixgbe_rxtx.c:1703
>   PMD_RX_LOG(...)

Hi Yingzhi,

PMD_RX_LOG is defined in ixgbe_logs.h (see code snippet below). 

#ifdef RTE_LIBRTE_IXGBE_DEBUG_RX
#define PMD_RX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#else
#define PMD_RX_LOG(level, fmt, args...) do { } while(0)
#endif

As you can see, the logs are only printed if RTE_LIBRTE_IXGBE_DEBUG_RX is 
defined. Just recompile DPDK with 'CONFIG_RTE_LIBRTE_IXGBE_DEBUG_RX=y' to 
resolve your issue.

Thanks,
Mark

>
>
>Currently I can only see RTE logs from console.
>
>
>Any comments is appreciated
>Thanks


[dpdk-dev] [RFC v3] latencystats: added new library for latency stats

2016-10-18 Thread Pattan, Reshma
Hi,

The below latency stats RFC adds new field to second cache line of mbuf. This 
is not an ABI break.
But I would like to emphasize on this  point so you can have a look into the 
changes and provide comments.

Thanks,
Reshma

> -Original Message-
> From: Pattan, Reshma
> Sent: Monday, October 17, 2016 2:40 PM
> To: dev at dpdk.org
> Cc: Pattan, Reshma 
> Subject: [RFC v3] latencystats: added new library for latency stats
> 
> Library is designed to calculate latency stats and report them to the 
> application
> when queried. Library measures minimum, average, maximum latencies and
> jitter in nano seconds.
> Current implementation supports global latency stats, i.e. per application 
> stats.
> 
> Added new field to mbuf struct to mark the packet arrival time on Rx and use 
> the
> times tamp to measure the latency on Tx.
> 
> Modified dpdk-procinfo process to display the new stats.
> 
> APIs:
> 
> Added APIs to initialize and un initialize latency stats calculation.
> Added API to retrieve latency stats names and values.
> 
> Functionality:
> 
> *Library will register ethdev Rx/Tx callbacks for each active port, queue
> combinations.
> *Library will register latency stats names with new stats library, which is 
> under
> design for now.
> *Rx packets will be marked with time stamp on each sampling interval.
> *On Tx side, packets with time stamp will be considered for calculating the
> minimum, maximum, average latencies and jitter.
> *Average latency is calculated by summing all the latencies measured for each
> time stamped packet and dividing that by total time stamped packets.
> *Minimum and maximum latencies will be low and high latency values observed
> so far.
> *Jitter calculation is done based on inter packet delay variation.
> *Measured stats can be retrieved via get API of the libray (or) by calling 
> generic
> get API of the new stats library, in this case callback is provided to update 
> the
> stats  into new stats library.
> 
> Signed-off-by: Reshma Pattan 


[dpdk-dev] [PATCH v7 0/7] vhost: optimize mergeable Rx path

2016-10-18 Thread Jianbo Liu
On 14 October 2016 at 17:34, Yuanhan Liu  wrote:
> This is a new set of patches to optimize the mergeable Rx code path.
> No refactoring (rewrite) was made this time. It just applies some
> findings from Zhihong (kudos to him!) that could improve the mergeable
> Rx path on the old code.
..

> ---
> Yuanhan Liu (4):
>   vhost: simplify mergeable Rx vring reservation
>   vhost: use last avail idx for avail ring reservation
>   vhost: prefetch avail ring
>   vhost: retrieve avail head once
>
> Zhihong Wang (3):
>   vhost: remove useless volatile
>   vhost: optimize cache access
>   vhost: shadow used ring update
>
>  lib/librte_vhost/vhost.c  |  13 ++-
>  lib/librte_vhost/vhost.h  |   5 +-
>  lib/librte_vhost/vhost_user.c |  23 +++--
>  lib/librte_vhost/virtio_net.c | 193 
> +-
>  4 files changed, 149 insertions(+), 85 deletions(-)
>

Reviewed-by: Jianbo Liu 


[dpdk-dev] [PATCH] vhost: disable indirect descriptors feature

2016-10-18 Thread Maxime Coquelin


On 10/18/2016 10:12 AM, Yuanhan Liu wrote:
> On Tue, Oct 18, 2016 at 09:04:44AM +0200, Maxime Coquelin wrote:
>> Hi Yuanhan,
>>
>> On 10/17/2016 05:10 PM, Maxime Coquelin wrote:
>>> Commit 2304dd73d287 ("vhost: support indirect Tx descriptors")
>>> adds support for indirect descriptors for Tx, but not for Rx.
>>>
>>> The problem is that it does not work with windows guests, which
>>> uses indirect descriptors for the Rx, and also with Linux guests
>>> when using kernel driver with mergeable buffers feature disabled.
>>>
>>> While indirect descriptors support is also added to the Rx path,
>>> let's disable the feature.
>>>
>>> Reported-by: Zhihong Wang 
>>> Reported-by: Ciara Loftus 
>>> Cc: Yuanhan Liu 
>>> Signed-off-by: Maxime Coquelin 
>>> ---
>>> lib/librte_vhost/vhost.c | 3 +--
>>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
>>> index 469117a..f5f8f92 100644
>>> --- a/lib/librte_vhost/vhost.c
>>> +++ b/lib/librte_vhost/vhost.c
>>> @@ -65,8 +65,7 @@
>>> (1ULL << VIRTIO_NET_F_CSUM)| \
>>> (1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
>>> (1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
>>> -   (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
>>> -   (1ULL << VIRTIO_RING_F_INDIRECT_DESC))
>>> +   (1ULL << VIRTIO_NET_F_GUEST_TSO6))
>>>
>>> uint64_t VHOST_FEATURES = VHOST_SUPPORTED_FEATURES;
>>
>> I have implemented Indirect descs for the Rx path yesterday.
>> It deserves more testing, but early tests show it fix the issues found
>> with VIRTIO_RING_F_INDIRECT_DESC (both with and without mergeable
>> buffers).
>>
>>
>> Thanks to Zhihong series you reworked, the changes to be done for
>> mergeable buffers case is greatly simplified.
>> I'll send the series later today.
>
> Do you mean the v6 from Zhihong? Unluckily, it will not be merged. That
> series has been simplified to not rewrite the enqueue from scratch. See
> V7.
No, I meant the v7.

>
> For this patch, I think you should also update (or remove?) the related
> section in the release note.
Yes, sure.

Thanks,
Maxime


[dpdk-dev] [PATCH] vhost: disable indirect descriptors feature

2016-10-18 Thread Maxime Coquelin
Hi Yuanhan,

On 10/17/2016 05:10 PM, Maxime Coquelin wrote:
> Commit 2304dd73d287 ("vhost: support indirect Tx descriptors")
> adds support for indirect descriptors for Tx, but not for Rx.
>
> The problem is that it does not work with windows guests, which
> uses indirect descriptors for the Rx, and also with Linux guests
> when using kernel driver with mergeable buffers feature disabled.
>
> While indirect descriptors support is also added to the Rx path,
> let's disable the feature.
>
> Reported-by: Zhihong Wang 
> Reported-by: Ciara Loftus 
> Cc: Yuanhan Liu 
> Signed-off-by: Maxime Coquelin 
> ---
>  lib/librte_vhost/vhost.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
> index 469117a..f5f8f92 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -65,8 +65,7 @@
>   (1ULL << VIRTIO_NET_F_CSUM)| \
>   (1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
>   (1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
> - (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
> - (1ULL << VIRTIO_RING_F_INDIRECT_DESC))
> + (1ULL << VIRTIO_NET_F_GUEST_TSO6))
>
>  uint64_t VHOST_FEATURES = VHOST_SUPPORTED_FEATURES;

I have implemented Indirect descs for the Rx path yesterday.
It deserves more testing, but early tests show it fix the issues found
with VIRTIO_RING_F_INDIRECT_DESC (both with and without mergeable
buffers).


Thanks to Zhihong series you reworked, the changes to be done for
mergeable buffers case is greatly simplified.
I'll send the series later today.

Thanks,
Maxime


[dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization

2016-10-18 Thread Neil Horman
On Mon, Oct 17, 2016 at 02:43:12PM +0100, Ferruh Yigit wrote:
> On 10/5/2016 12:57 PM, Shreyansh Jain wrote:
> > Hi Thomas,
> > 
> > On Tuesday 04 October 2016 01:12 PM, Thomas Monjalon wrote:
> >> 2016-10-04 12:21, Shreyansh Jain:
> >>> Hi Thomas,
> >>>
> >>> On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
>  Applied, thanks everybody for the great (re)work!
> >>>
> >>> Thanks!
> >>>
> > [...]
> > [...]
> >>>
> >>> It can be merged with changes for:
> >>>   - drv_name
> >>>   - EAL_ before _REGISTER_ macros
> >>>   - eth_driver => rte_driver naming
> >>
> >> Good.
> >> Could you make it this week, please?
> >>
> > 
> > Certainly. At least some of those I can send within this week :)
> > 
> 
> 
> I caught while running ABI validation script today, I think this patch
> should increase LIBABIVER of:
> - lib/librte_cryptodev
> - lib/librte_eal
> - lib/librte_ether
> 
It should, and it in fact should wait a release if it hadn't been documented as
a comming change.
Neil

> Thanks,
> ferruh
> 


[dpdk-dev] [PATCH v2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV

2016-10-18 Thread Iremonger, Bernard
Hi Wenzhuo,



> > Subject: RE: [PATCH v2] net/ixgbe: support multiqueue mode VMDq DCB
> > with SRIOV
> >
> > Hi Wenzhuo,
> >
> > > > if (hw->mac.type != ixgbe_mac_82598EB) { @@ -3339,11 +3340,17
> > > @@
> > > > ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
> > > > if (dcb_config->vt_mode)
> > > > reg |= IXGBE_MTQC_VT_ENA;
> > > > IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);
> > > > -
> > > > -   /* Disable drop for all queues */
> > > > -   for (q = 0; q < 128; q++)
> > > > -   IXGBE_WRITE_REG(hw, IXGBE_QDE,
> > > > -   (IXGBE_QDE_WRITE | (q <<
> > > > IXGBE_QDE_IDX_SHIFT)));
> > > > +   if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
> > > > +   /* Disable drop for all queues in VMDQ mode*/
> > > > +   for (q = 0; q < 128; q++)
> > > > +   IXGBE_WRITE_REG(hw, IXGBE_QDE,
> > > > +   (IXGBE_QDE_WRITE | (q <<
> > > > IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
> > > > +   } else {
> > > > +   /* Enable drop for all queues in SRIOV mode */
> > > > +   for (q = 0; q < 128; q++)
> > > > +   IXGBE_WRITE_REG(hw, IXGBE_QDE,
> > > > +   (IXGBE_QDE_WRITE | (q <<
> > > > IXGBE_QDE_IDX_SHIFT)));
> > > > +   }
> > > I think it has nothing to do with mq mode. Do I miss something?
> >
> > Behavior is different when SRIOV is enabled.
> I don't understand why the behavior is different. To my opinion, the drop
> has nothing to do with the mode. We can enable or disable it.
> The old behavior is disabling it by default. Now you change it to disabling 
> it by
> default in NO-SRIOV mode, but enabling it in SRIOV mode.
> What I don't get is the reason.

Please refer to section 4.6.11.3.1 page 180 of the 
82599-10-gbe-controller-datasheet.pdf
The last paragraph on page 180 states:

"Queue Drop Enable (PFQDE) - In SR-IO the QDE bit should be set to 1b in the 
PFQDE register for all queues.
In VMDq mode, the QDE bit should be set to 0b for all queues."


> > > > /* Enable the Tx desc arbiter */
> > > > reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS); @@ -3378,7
> > > > +3385,7 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
> > > > vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS
> > > ?
> > > > 0x : 0x);
> > > >
> > > > /*Configure general DCB TX parameters*/
> > > > -   ixgbe_dcb_tx_hw_config(hw, dcb_config);
> > > > +   ixgbe_dcb_tx_hw_config(dev, dcb_config);
> > > >  }
> > > >
> > > >  static void
> > > > @@ -3661,7 +3668,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev
> > > *dev,
> > > > /*get DCB TX configuration parameters from 
> > > > rte_eth_conf*/
> > > > ixgbe_dcb_tx_config(dev, dcb_config);
> > > > /*Configure general DCB TX parameters*/
> > > > -   ixgbe_dcb_tx_hw_config(hw, dcb_config);
> > > > +   ixgbe_dcb_tx_hw_config(dev, dcb_config);
> > > > break;
> > > > default:
> > > > PMD_INIT_LOG(ERR, "Incorrect DCB TX mode
> > > configuration"); @@
> > > > -3810,9 +3817,6 @@ void ixgbe_configure_dcb(struct rte_eth_dev
> *dev)
> > > > (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB_RSS))
> > > > return;
> > > >
> > > > -   if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
> > > > -   return;
> > > I remember it's a limitation of implementation. The reason is the
> > > resource allocation. Why could we remove it now?
> >
> > ETH_DCB_NUM_QUEUES is 128,  nb_rx_queues may not be 128.
> I think it's a limitation to force the queue number to be
> ETH_DCB_NUM_QUEUES.
> Just to confirm it, have you try to set rx queue number to something
> different from 128, like 64, 32...

In my test scenario the nb_rx_queues is 1.

Regards,

Bernard


[dpdk-dev] [PATCH v5 0/2] app/testpmd: improve multiprocess support

2016-10-18 Thread Sergio Gonzalez Monroy
On 30/09/2016 15:00, Marcin Kerlin wrote:
> This patch ensure not overwrite device data in the multiprocess application.
>
> 1)Changes in the library introduces continuity in array rte_eth_dev_data[]
> shared between all processes. Secondary process adds new entries in free
> space instead of overwriting existing entries.
>
> 2)Changes in application testpmd allow secondary process to attach the
> mempool created by primary process rather than create new and in the case of
> quit or force quit to free devices data from shared array rte_eth_dev_data[].
>
> -
> How to reproduce the bug:
>
> 1) Run primary process:
> ./testpmd -c 0xf -n 4 --socket-mem='512,0' -w 03:00.1 -w 03:00.0
> --proc-type=primary --file-prefix=xz1 -- -i
>
> (gdb) print rte_eth_devices[0].data.name
> $52 = "3:0.1"
> (gdb) print rte_eth_devices[1].data.name
> $53 = "3:0.0"
>
> 2) Run secondary process:
> ./testpmd -c 0xf0 --socket-mem='512,0' -n 4 -v -b 03:00.1 -b 03:00.0
> --vdev 'eth_pcap0,rx_pcap=/var/log/device1.pcap, 
> tx_pcap=/var/log/device2.pcap'
> --proc-type=secondary --file-prefix=xz1 -- -i
>
> (gdb) print rte_eth_devices[0].data.name
> $52 = "eth_pcap0"
> (gdb) print rte_eth_devices[1].data.name
> $53 = "eth_pcap1"
>
> 3) Go back to the primary and re-check:
> (gdb) print rte_eth_devices[0].data.name
> $54 = "eth_pcap0"
> (gdb) print rte_eth_devices[1].data.name
> $55 = "eth_pcap1"
>
> It means that secondary process overwrite data of primary process.
>
> This patch fix it and now if we go back to the primary and re-check then
> everything is fine:
> (gdb) print rte_eth_devices[0].data.name
> $56 = "3:0.1"
> (gdb) print rte_eth_devices[1].data.name
> $57 = "3:0.0"
>
> So after this fix structure rte_eth_dev_data[] will keep all data one after
> the other instead of overwriting:
> (gdb) print rte_eth_dev_data[0].name
> $52 = "3:0.1"
> (gdb) print rte_eth_dev_data[1].name
> $53 = "3:0.0"
> (gdb) print rte_eth_dev_data[2].name
> $54 = "eth_pcap0"
> (gdb) print rte_eth_dev_data[3].name
> $55 = "eth_pcap1"
> and so on will be append in the next indexes
>
> If secondary process will be turned off then also will be deleted from array:
> (gdb) print rte_eth_dev_data[0].name
> $52 = "3:0.1"
> (gdb) print rte_eth_dev_data[1].name
> $53 = "3:0.0"
> (gdb) print rte_eth_dev_data[2].name
> $54 = ""
> (gdb) print rte_eth_dev_data[3].name
> $55 = ""
> this also allows re-use index 2 and 3 for next another process
> -
>
> Breaking ABI:
> Changes in the library librte_ether causes extending existing structure
> rte_eth_dev_data with a new field lock. The reason is that this structure
> is sharing between all the processes so it should be protected against
> attempting to write from two different processes.
>
> Tomasz Kulasek sent announce ABI change in librte_ether on 21 July 2016.
> I would like to join to this breaking ABI, if it is possible.
>
> v2:
> * fix syntax error in version script
> v3:
> * changed scope of function
> * improved description
> v4:
> * fix syntax error in version script
> v5:
> * fix header file
>
> Marcin Kerlin (2):
>librte_ether: add protection against overwrite device data
>app/testpmd: improve handling of multiprocess
>
>   app/test-pmd/testpmd.c | 37 +-
>   app/test-pmd/testpmd.h |  1 +
>   lib/librte_ether/rte_ethdev.c  | 90 
> +++---
>   lib/librte_ether/rte_ethdev.h  | 12 +
>   lib/librte_ether/rte_ether_version.map |  6 +++
>   5 files changed, 136 insertions(+), 10 deletions(-)
>

NACK series for 16.11

The patch would break the use case where primary and secondary share 
same PCI device.

Overall, I think Thomas has already mentioned it, we need further 
discussion on the use cases
and scope of DPDK multi-process.
This could be a good topic for the upcoming DPDK Userspace event.

Sergio


[dpdk-dev] [PATCH v2 3/3] net/fm10k: fix out of ofder Rx read issue

2016-10-18 Thread Qi Zhang
In vPMD, when load Rx desc with _mm_loadu_si128,
volatile point will be cast into non-volatile point.
So GCC is allowed to reorder the load instructions,
while Rx read's correctness is reply on these load
instructions to follow a backward sequence strictly,
so we add compile barrier to prevent compiler reorder.

Fixes: 7092be8437bd ("fm10k: add vector Rx")

Signed-off-by: Qi Zhang 
---

v2:
- fix check-git-log.sh warning.
- add more detail commit message.

 drivers/net/fm10k/fm10k_rxtx_vec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c 
b/drivers/net/fm10k/fm10k_rxtx_vec.c
index b724486..27f3e43 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -478,6 +478,7 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf 
**rx_pkts,
/* Read desc statuses backwards to avoid race condition */
/* A.1 load 4 pkts desc */
descs0[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
+   rte_compiler_barrier();

/* B.2 copy 2 mbuf point into rx_pkts  */
_mm_storeu_si128((__m128i *)_pkts[pos], mbp1);
@@ -486,8 +487,10 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf 
**rx_pkts,
mbp2 = _mm_loadu_si128((__m128i *)[pos+2]);

descs0[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
+   rte_compiler_barrier();
/* B.1 load 2 mbuf point */
descs0[1] = _mm_loadu_si128((__m128i *)(rxdp + 1));
+   rte_compiler_barrier();
descs0[0] = _mm_loadu_si128((__m128i *)(rxdp));

/* B.2 copy 2 mbuf point into rx_pkts  */
-- 
2.7.4



[dpdk-dev] [PATCH v2 2/3] net/ixgbe: fix out of order Rx read issue

2016-10-18 Thread Qi Zhang
In vPMD, when load Rx desc with _mm_loadu_si128,
volatile point will be cast into non-volatile point.
So GCC is allowed to reorder the load instructions,
while Rx read's correctness is reply on these load
instructions to follow a backward sequence strictly,
so we add compile barrier to prevent compiler reorder.

Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")

Signed-off-by: Qi Zhang 
---

v2:
- fix check-git-log.sh warning.
- add more detail commit message.

 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c 
b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index ad8a9ff..abbf284 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -343,6 +343,7 @@ _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 */
descs[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
+   rte_compiler_barrier();

/* B.2 copy 2 mbuf point into rx_pkts  */
_mm_storeu_si128((__m128i *)_pkts[pos], mbp1);
@@ -351,8 +352,10 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
mbp2 = _mm_loadu_si128((__m128i *)_ring[pos+2]);

descs[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
+   rte_compiler_barrier();
/* B.1 load 2 mbuf point */
descs[1] = _mm_loadu_si128((__m128i *)(rxdp + 1));
+   rte_compiler_barrier();
descs[0] = _mm_loadu_si128((__m128i *)(rxdp));

/* B.2 copy 2 mbuf point into rx_pkts  */
-- 
2.7.4



[dpdk-dev] [PATCH v2 1/3] net/i40e: fix out of order Rx read issue

2016-10-18 Thread Qi Zhang
In vPMD, when load Rx desc with _mm_loadu_si128,
volatile point will be cast into non-volatile point.
So GCC is allowed to reorder the load instructions,
while Rx read's correctness is reply on these load
instructions to follow a backward sequence strictly,
so we add compile barrier to prevent compiler reorder.

Fixes: 9ed94e5bb04e ("i40e: add vector Rx")

Signed-off-by: Qi Zhang 
---

v2:
- fix check-git-log.sh warning.
- add more detail commit message.

 drivers/net/i40e/i40e_rxtx_vec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c
index 0ee0241..ab63501 100644
--- a/drivers/net/i40e/i40e_rxtx_vec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec.c
@@ -305,6 +305,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
/* Read desc statuses backwards to avoid race condition */
/* A.1 load 4 pkts desc */
descs[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
+   rte_compiler_barrier();

/* B.2 copy 2 mbuf point into rx_pkts  */
_mm_storeu_si128((__m128i *)_pkts[pos], mbp1);
@@ -313,8 +314,10 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
mbp2 = _mm_loadu_si128((__m128i *)_ring[pos+2]);

descs[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
+   rte_compiler_barrier();
/* B.1 load 2 mbuf point */
descs[1] = _mm_loadu_si128((__m128i *)(rxdp + 1));
+   rte_compiler_barrier();
descs[0] = _mm_loadu_si128((__m128i *)(rxdp));

/* B.2 copy 2 mbuf point into rx_pkts  */
-- 
2.7.4



[dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue

2016-10-18 Thread Qi Zhang
In vPMD, when load Rx desc with _mm_loadu_si128, 
volatile point will be cast into non-volatile point.
So GCC is allowed to reorder the load instructions, 
while Rx read's correctness is reply on these load 
instructions to follow a backward sequence strictly, 
so we add compile barrier to prevent compiler reorder.
We already met this issue on i40e with GCC6 and we 
fixed this on ixgbe and fm10k also.

v2: 
- fix check-git-log.sh warning.
- add more detail commit message.

Qi Zhang (3):
  net/i40e: fix out of order Rx read issue
  net/ixgbe: fix out of order Rx read issue
  net/fm10k: fix out of ofder Rx read issue

 drivers/net/fm10k/fm10k_rxtx_vec.c | 3 +++
 drivers/net/i40e/i40e_rxtx_vec.c   | 3 +++
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 3 +++
 3 files changed, 9 insertions(+)

-- 
2.7.4



[dpdk-dev] [PATCH v2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV

2016-10-18 Thread Lu, Wenzhuo
Hi Bernard,


> -Original Message-
> From: Iremonger, Bernard
> Sent: Tuesday, October 18, 2016 12:27 AM
> To: Lu, Wenzhuo; dev at dpdk.org; Shah, Rahul R
> Subject: RE: [PATCH v2] net/ixgbe: support multiqueue mode VMDq DCB with
> SRIOV
> 
> Hi Wenzhuo,
> 
> > >   if (hw->mac.type != ixgbe_mac_82598EB) { @@ -3339,11 +3340,17
> > @@
> > > ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
> > >   if (dcb_config->vt_mode)
> > >   reg |= IXGBE_MTQC_VT_ENA;
> > >   IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);
> > > -
> > > - /* Disable drop for all queues */
> > > - for (q = 0; q < 128; q++)
> > > - IXGBE_WRITE_REG(hw, IXGBE_QDE,
> > > - (IXGBE_QDE_WRITE | (q <<
> > > IXGBE_QDE_IDX_SHIFT)));
> > > + if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
> > > + /* Disable drop for all queues in VMDQ mode*/
> > > + for (q = 0; q < 128; q++)
> > > + IXGBE_WRITE_REG(hw, IXGBE_QDE,
> > > + (IXGBE_QDE_WRITE | (q <<
> > > IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
> > > + } else {
> > > + /* Enable drop for all queues in SRIOV mode */
> > > + for (q = 0; q < 128; q++)
> > > + IXGBE_WRITE_REG(hw, IXGBE_QDE,
> > > + (IXGBE_QDE_WRITE | (q <<
> > > IXGBE_QDE_IDX_SHIFT)));
> > > + }
> > I think it has nothing to do with mq mode. Do I miss something?
> 
> Behavior is different when SRIOV is enabled.
I don't understand why the behavior is different. To my opinion, the drop has 
nothing to do with the mode. We can enable or disable it.
The old behavior is disabling it by default. Now you change it to disabling it 
by default in NO-SRIOV mode, but enabling it in SRIOV mode.
What I don't get is the reason.

> 
> >
> > >
> > >   /* Enable the Tx desc arbiter */
> > >   reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS); @@ -3378,7
> > > +3385,7 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
> > >   vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS
> > ?
> > > 0x : 0x);
> > >
> > >   /*Configure general DCB TX parameters*/
> > > - ixgbe_dcb_tx_hw_config(hw, dcb_config);
> > > + ixgbe_dcb_tx_hw_config(dev, dcb_config);
> > >  }
> > >
> > >  static void
> > > @@ -3661,7 +3668,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev
> > *dev,
> > >   /*get DCB TX configuration parameters from rte_eth_conf*/
> > >   ixgbe_dcb_tx_config(dev, dcb_config);
> > >   /*Configure general DCB TX parameters*/
> > > - ixgbe_dcb_tx_hw_config(hw, dcb_config);
> > > + ixgbe_dcb_tx_hw_config(dev, dcb_config);
> > >   break;
> > >   default:
> > >   PMD_INIT_LOG(ERR, "Incorrect DCB TX mode
> > configuration"); @@
> > > -3810,9 +3817,6 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev)
> > >   (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB_RSS))
> > >   return;
> > >
> > > - if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
> > > - return;
> > I remember it's a limitation of implementation. The reason is the
> > resource allocation. Why could we remove it now?
> 
> ETH_DCB_NUM_QUEUES is 128,  nb_rx_queues may not be 128.
I think it's a limitation to force the queue number to be ETH_DCB_NUM_QUEUES.
Just to confirm it, have you try to set rx queue number to something different 
from 128, like 64, 32...