All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] net/mlx5: cleanups
@ 2017-08-01 12:09 Nelio Laranjeiro
  2017-08-01 12:09 ` [PATCH 1/5] net/mlx5: remove flow drop useless if branches Nelio Laranjeiro
                   ` (14 more replies)
  0 siblings, 15 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-01 12:09 UTC (permalink / raw)
  To: Adrien Mazarguil, dev; +Cc: Shahaf Shuler

This Series make some cleanup in mlx5 PMD by removing useless code or non
working code.

This series apply on top of:
 [PATCH 0/5] net/mlx5: enable/disable vPMD and some cleanups
Specifically on patch: net/mlx5: cleanup Rx ring in free functions

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

Nelio Laranjeiro (5):
  net/mlx5: remove flow drop useless if branches
  net/mlx5: remove pdentic pragma
  net/mlx5: fix non working secondary process by removing it
  net/mlx5: remove multiple drop RSS queues
  net/mlx5: remove old MLNX_OFED 3.3 verification

 drivers/net/mlx5/Makefile            |   5 -
 drivers/net/mlx5/mlx5.c              |  40 +-------
 drivers/net/mlx5/mlx5.h              |  21 -----
 drivers/net/mlx5/mlx5_ethdev.c       | 173 +----------------------------------
 drivers/net/mlx5/mlx5_fdir.c         |   7 --
 drivers/net/mlx5/mlx5_flow.c         |  59 ++++--------
 drivers/net/mlx5/mlx5_mac.c          |   7 --
 drivers/net/mlx5/mlx5_mr.c           |   7 --
 drivers/net/mlx5/mlx5_rss.c          |   7 --
 drivers/net/mlx5/mlx5_rxmode.c       |   7 --
 drivers/net/mlx5/mlx5_rxq.c          |  48 ----------
 drivers/net/mlx5/mlx5_rxtx.c         |   7 --
 drivers/net/mlx5/mlx5_rxtx.h         |   9 --
 drivers/net/mlx5/mlx5_rxtx_vec_sse.c |   7 --
 drivers/net/mlx5/mlx5_stats.c        |   7 --
 drivers/net/mlx5/mlx5_trigger.c      |   7 --
 drivers/net/mlx5/mlx5_txq.c          |  48 ----------
 drivers/net/mlx5/mlx5_vlan.c         |   7 --
 18 files changed, 21 insertions(+), 452 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/5] net/mlx5: remove flow drop useless if branches
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
@ 2017-08-01 12:09 ` Nelio Laranjeiro
  2017-08-01 12:09 ` [PATCH 2/5] net/mlx5: remove pdentic pragma Nelio Laranjeiro
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-01 12:09 UTC (permalink / raw)
  To: Adrien Mazarguil, dev; +Cc: Shahaf Shuler

Those two if statements are useless as there is a verification on the drop
field of the flow to jump to the end of the function just above.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 86be929..d62ccff 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1279,10 +1279,6 @@ priv_flow_destroy(struct priv *priv,
 		claim_zero(ibv_destroy_qp(flow->qp));
 	if (flow->ind_table)
 		claim_zero(ibv_exp_destroy_rwq_ind_table(flow->ind_table));
-	if (flow->drop && flow->wq)
-		claim_zero(ibv_exp_destroy_wq(flow->wq));
-	if (flow->drop && flow->cq)
-		claim_zero(ibv_destroy_cq(flow->cq));
 	if (flow->mark) {
 		struct rte_flow *tmp;
 		struct rxq *rxq;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/5] net/mlx5: remove pdentic pragma
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
  2017-08-01 12:09 ` [PATCH 1/5] net/mlx5: remove flow drop useless if branches Nelio Laranjeiro
@ 2017-08-01 12:09 ` Nelio Laranjeiro
  2017-08-17 14:38   ` Ferruh Yigit
  2017-08-01 12:09 ` [PATCH 3/5] net/mlx5: fix non working secondary process by removing it Nelio Laranjeiro
                   ` (12 subsequent siblings)
  14 siblings, 1 reply; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-01 12:09 UTC (permalink / raw)
  To: Adrien Mazarguil, dev; +Cc: Shahaf Shuler

Those are useless since DPDK headers have been cleaned up.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.c              | 7 -------
 drivers/net/mlx5/mlx5.h              | 7 -------
 drivers/net/mlx5/mlx5_ethdev.c       | 7 -------
 drivers/net/mlx5/mlx5_fdir.c         | 7 -------
 drivers/net/mlx5/mlx5_mac.c          | 7 -------
 drivers/net/mlx5/mlx5_mr.c           | 7 -------
 drivers/net/mlx5/mlx5_rss.c          | 7 -------
 drivers/net/mlx5/mlx5_rxmode.c       | 7 -------
 drivers/net/mlx5/mlx5_rxq.c          | 7 -------
 drivers/net/mlx5/mlx5_rxtx.c         | 7 -------
 drivers/net/mlx5/mlx5_rxtx.h         | 7 -------
 drivers/net/mlx5/mlx5_rxtx_vec_sse.c | 7 -------
 drivers/net/mlx5/mlx5_stats.c        | 7 -------
 drivers/net/mlx5/mlx5_trigger.c      | 7 -------
 drivers/net/mlx5/mlx5_txq.c          | 7 -------
 drivers/net/mlx5/mlx5_vlan.c         | 7 -------
 16 files changed, 112 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b7e5046..bfcff70 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -50,19 +50,12 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 43c5384..31d0c49 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -50,10 +50,6 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
@@ -61,9 +57,6 @@
 #include <rte_interrupts.h>
 #include <rte_errno.h>
 #include <rte_flow.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index ad5b28a..36872b5 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -50,10 +50,6 @@
 #include <linux/version.h>
 #include <fcntl.h>
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_atomic.h>
 #include <rte_ethdev.h>
 #include <rte_mbuf.h>
@@ -61,9 +57,6 @@
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
 #include <rte_malloc.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_fdir.c b/drivers/net/mlx5/mlx5_fdir.c
index 34a7e69..ad256e4 100644
--- a/drivers/net/mlx5/mlx5_fdir.c
+++ b/drivers/net/mlx5/mlx5_fdir.c
@@ -47,19 +47,12 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 8489ea6..45d23e4 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -51,16 +51,9 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 2873351..9593830 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -41,14 +41,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mempool.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
index a2dd7d1..1249943 100644
--- a/drivers/net/mlx5/mlx5_rss.c
+++ b/drivers/net/mlx5/mlx5_rss.c
@@ -47,15 +47,8 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index a67e542..4a51e47 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -45,14 +45,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ethdev.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 68dce04..2ea7a35 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -50,19 +50,12 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
 #include <rte_debug.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 83101f6..59d9ce0 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -48,19 +48,12 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_mempool.h>
 #include <rte_prefetch.h>
 #include <rte_common.h>
 #include <rte_branch_prediction.h>
 #include <rte_ether.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 300d097..baf2b25 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -48,16 +48,9 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_mempool.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5.h"
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
index 3339ac1..290d6cf 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
@@ -49,16 +49,9 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_mempool.h>
 #include <rte_prefetch.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 703f48c..7b45c8c 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -34,16 +34,9 @@
 #include <linux/sockios.h>
 #include <linux/ethtool.h>
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ethdev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 595a9e0..3fa9401 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -31,17 +31,10 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 98aaa7c..45e9037 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -47,17 +47,10 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5_defs.h"
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index 1b0fa40..353ae49 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -36,15 +36,8 @@
 #include <assert.h>
 #include <stdint.h>
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ethdev.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5.h"
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 3/5] net/mlx5: fix non working secondary process by removing it
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
  2017-08-01 12:09 ` [PATCH 1/5] net/mlx5: remove flow drop useless if branches Nelio Laranjeiro
  2017-08-01 12:09 ` [PATCH 2/5] net/mlx5: remove pdentic pragma Nelio Laranjeiro
@ 2017-08-01 12:09 ` Nelio Laranjeiro
  2017-08-17 14:38   ` Ferruh Yigit
  2017-08-01 12:09 ` [PATCH 4/5] net/mlx5: remove multiple drop RSS queues Nelio Laranjeiro
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-01 12:09 UTC (permalink / raw)
  To: Adrien Mazarguil, dev; +Cc: Shahaf Shuler

Secondary process is a copy/paste of the mlx4 drivers, it was never
tested and it even segfault at the secondary process start in the
mlx5_pci_probe().

This makes more sense to wipe this non working feature to re-write a
working and functional version.

Fixes: a48deada651b ("mlx5: allow operation in secondary processes")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.c        |  33 +-------
 drivers/net/mlx5/mlx5.h        |   9 ---
 drivers/net/mlx5/mlx5_ethdev.c | 166 +----------------------------------------
 drivers/net/mlx5/mlx5_rxq.c    |  41 ----------
 drivers/net/mlx5/mlx5_rxtx.h   |   2 -
 drivers/net/mlx5/mlx5_txq.c    |  41 ----------
 6 files changed, 4 insertions(+), 288 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index bfcff70..bd66a7c 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -771,37 +771,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 			err = ENOMEM;
 			goto port_error;
 		}
-
-		/* Secondary processes have to use local storage for their
-		 * private data as well as a copy of eth_dev->data, but this
-		 * pointer must not be modified before burst functions are
-		 * actually called. */
-		if (mlx5_is_secondary()) {
-			struct mlx5_secondary_data *sd =
-				&mlx5_secondary_data[eth_dev->data->port_id];
-			sd->primary_priv = eth_dev->data->dev_private;
-			if (sd->primary_priv == NULL) {
-				ERROR("no private data for port %u",
-						eth_dev->data->port_id);
-				err = EINVAL;
-				goto port_error;
-			}
-			sd->shared_dev_data = eth_dev->data;
-			rte_spinlock_init(&sd->lock);
-			memcpy(sd->data.name, sd->shared_dev_data->name,
-				   sizeof(sd->data.name));
-			sd->data.dev_private = priv;
-			sd->data.rx_mbuf_alloc_failed = 0;
-			sd->data.mtu = ETHER_MTU;
-			sd->data.port_id = sd->shared_dev_data->port_id;
-			sd->data.mac_addrs = priv->mac;
-			eth_dev->tx_pkt_burst = mlx5_tx_burst_secondary_setup;
-			eth_dev->rx_pkt_burst = mlx5_rx_burst_secondary_setup;
-		} else {
-			eth_dev->data->dev_private = priv;
-			eth_dev->data->mac_addrs = priv->mac;
-		}
-
+		eth_dev->data->dev_private = priv;
+		eth_dev->data->mac_addrs = priv->mac;
 		eth_dev->device = &pci_dev->device;
 		rte_eth_copy_pci_info(eth_dev, pci_dev);
 		eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 31d0c49..2392be5 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -158,14 +158,6 @@ struct priv {
 	rte_spinlock_t lock; /* Lock for control functions. */
 };
 
-/* Local storage for secondary process data. */
-struct mlx5_secondary_data {
-	struct rte_eth_dev_data data; /* Local device data. */
-	struct priv *primary_priv; /* Private structure from primary. */
-	struct rte_eth_dev_data *shared_dev_data; /* Shared device data. */
-	rte_spinlock_t lock; /* Port configuration lock. */
-} mlx5_secondary_data[RTE_MAX_ETHPORTS];
-
 /**
  * Lock private structure to protect it from concurrent access in the
  * control path.
@@ -221,7 +213,6 @@ void priv_dev_interrupt_handler_uninstall(struct priv *, struct rte_eth_dev *);
 void priv_dev_interrupt_handler_install(struct priv *, struct rte_eth_dev *);
 int mlx5_set_link_down(struct rte_eth_dev *dev);
 int mlx5_set_link_up(struct rte_eth_dev *dev);
-struct priv *mlx5_secondary_data_setup(struct priv *priv);
 void priv_select_tx_function(struct priv *);
 void priv_select_rx_function(struct priv *);
 
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 36872b5..0e0a99e 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -126,12 +126,7 @@ struct ethtool_link_settings {
 struct priv *
 mlx5_get_priv(struct rte_eth_dev *dev)
 {
-	struct mlx5_secondary_data *sd;
-
-	if (!mlx5_is_secondary())
-		return dev->data->dev_private;
-	sd = &mlx5_secondary_data[dev->data->port_id];
-	return sd->data.dev_private;
+	return dev->data->dev_private;
 }
 
 /**
@@ -143,7 +138,7 @@ mlx5_get_priv(struct rte_eth_dev *dev)
 inline int
 mlx5_is_secondary(void)
 {
-	return rte_eal_process_type() != RTE_PROC_PRIMARY;
+	return rte_eal_process_type() == RTE_PROC_SECONDARY;
 }
 
 /**
@@ -1336,163 +1331,6 @@ mlx5_set_link_up(struct rte_eth_dev *dev)
 }
 
 /**
- * Configure secondary process queues from a private data pointer (primary
- * or secondary) and update burst callbacks. Can take place only once.
- *
- * All queues must have been previously created by the primary process to
- * avoid undefined behavior.
- *
- * @param priv
- *   Private data pointer from either primary or secondary process.
- *
- * @return
- *   Private data pointer from secondary process, NULL in case of error.
- */
-struct priv *
-mlx5_secondary_data_setup(struct priv *priv)
-{
-	unsigned int port_id = 0;
-	struct mlx5_secondary_data *sd;
-	void **tx_queues;
-	void **rx_queues;
-	unsigned int nb_tx_queues;
-	unsigned int nb_rx_queues;
-	unsigned int i;
-
-	/* priv must be valid at this point. */
-	assert(priv != NULL);
-	/* priv->dev must also be valid but may point to local memory from
-	 * another process, possibly with the same address and must not
-	 * be dereferenced yet. */
-	assert(priv->dev != NULL);
-	/* Determine port ID by finding out where priv comes from. */
-	while (1) {
-		sd = &mlx5_secondary_data[port_id];
-		rte_spinlock_lock(&sd->lock);
-		/* Primary process? */
-		if (sd->primary_priv == priv)
-			break;
-		/* Secondary process? */
-		if (sd->data.dev_private == priv)
-			break;
-		rte_spinlock_unlock(&sd->lock);
-		if (++port_id == RTE_DIM(mlx5_secondary_data))
-			port_id = 0;
-	}
-	/* Switch to secondary private structure. If private data has already
-	 * been updated by another thread, there is nothing else to do. */
-	priv = sd->data.dev_private;
-	if (priv->dev->data == &sd->data)
-		goto end;
-	/* Sanity checks. Secondary private structure is supposed to point
-	 * to local eth_dev, itself still pointing to the shared device data
-	 * structure allocated by the primary process. */
-	assert(sd->shared_dev_data != &sd->data);
-	assert(sd->data.nb_tx_queues == 0);
-	assert(sd->data.tx_queues == NULL);
-	assert(sd->data.nb_rx_queues == 0);
-	assert(sd->data.rx_queues == NULL);
-	assert(priv != sd->primary_priv);
-	assert(priv->dev->data == sd->shared_dev_data);
-	assert(priv->txqs_n == 0);
-	assert(priv->txqs == NULL);
-	assert(priv->rxqs_n == 0);
-	assert(priv->rxqs == NULL);
-	nb_tx_queues = sd->shared_dev_data->nb_tx_queues;
-	nb_rx_queues = sd->shared_dev_data->nb_rx_queues;
-	/* Allocate local storage for queues. */
-	tx_queues = rte_zmalloc("secondary ethdev->tx_queues",
-				sizeof(sd->data.tx_queues[0]) * nb_tx_queues,
-				RTE_CACHE_LINE_SIZE);
-	rx_queues = rte_zmalloc("secondary ethdev->rx_queues",
-				sizeof(sd->data.rx_queues[0]) * nb_rx_queues,
-				RTE_CACHE_LINE_SIZE);
-	if (tx_queues == NULL || rx_queues == NULL)
-		goto error;
-	/* Lock to prevent control operations during setup. */
-	priv_lock(priv);
-	/* TX queues. */
-	for (i = 0; i != nb_tx_queues; ++i) {
-		struct txq *primary_txq = (*sd->primary_priv->txqs)[i];
-		struct txq_ctrl *primary_txq_ctrl;
-		struct txq_ctrl *txq_ctrl;
-
-		if (primary_txq == NULL)
-			continue;
-		primary_txq_ctrl = container_of(primary_txq,
-						struct txq_ctrl, txq);
-		txq_ctrl = rte_calloc_socket("TXQ", 1, sizeof(*txq_ctrl) +
-					     (1 << primary_txq->elts_n) *
-					     sizeof(struct rte_mbuf *), 0,
-					     primary_txq_ctrl->socket);
-		if (txq_ctrl != NULL) {
-			if (txq_ctrl_setup(priv->dev,
-					   txq_ctrl,
-					   1 << primary_txq->elts_n,
-					   primary_txq_ctrl->socket,
-					   NULL) == 0) {
-				txq_ctrl->txq.stats.idx =
-					primary_txq->stats.idx;
-				tx_queues[i] = &txq_ctrl->txq;
-				continue;
-			}
-			rte_free(txq_ctrl);
-		}
-		while (i) {
-			txq_ctrl = tx_queues[--i];
-			txq_cleanup(txq_ctrl);
-			rte_free(txq_ctrl);
-		}
-		goto error;
-	}
-	/* RX queues. */
-	for (i = 0; i != nb_rx_queues; ++i) {
-		struct rxq_ctrl *primary_rxq =
-			container_of((*sd->primary_priv->rxqs)[i],
-				     struct rxq_ctrl, rxq);
-
-		if (primary_rxq == NULL)
-			continue;
-		/* Not supported yet. */
-		rx_queues[i] = NULL;
-	}
-	/* Update everything. */
-	priv->txqs = (void *)tx_queues;
-	priv->txqs_n = nb_tx_queues;
-	priv->rxqs = (void *)rx_queues;
-	priv->rxqs_n = nb_rx_queues;
-	sd->data.rx_queues = rx_queues;
-	sd->data.tx_queues = tx_queues;
-	sd->data.nb_rx_queues = nb_rx_queues;
-	sd->data.nb_tx_queues = nb_tx_queues;
-	sd->data.dev_link = sd->shared_dev_data->dev_link;
-	sd->data.mtu = sd->shared_dev_data->mtu;
-	memcpy(sd->data.rx_queue_state, sd->shared_dev_data->rx_queue_state,
-	       sizeof(sd->data.rx_queue_state));
-	memcpy(sd->data.tx_queue_state, sd->shared_dev_data->tx_queue_state,
-	       sizeof(sd->data.tx_queue_state));
-	sd->data.dev_flags = sd->shared_dev_data->dev_flags;
-	/* Use local data from now on. */
-	rte_mb();
-	priv->dev->data = &sd->data;
-	rte_mb();
-	priv_select_tx_function(priv);
-	priv_select_rx_function(priv);
-	priv_unlock(priv);
-end:
-	/* More sanity checks. */
-	assert(priv->dev->data == &sd->data);
-	rte_spinlock_unlock(&sd->lock);
-	return priv;
-error:
-	priv_unlock(priv);
-	rte_free(tx_queues);
-	rte_free(rx_queues);
-	rte_spinlock_unlock(&sd->lock);
-	return NULL;
-}
-
-/**
  * Configure the TX function to use.
  *
  * @param priv
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 2ea7a35..b52de98 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1223,47 +1223,6 @@ mlx5_rx_queue_release(void *dpdk_rxq)
 }
 
 /**
- * DPDK callback for RX in secondary processes.
- *
- * This function configures all queues from primary process information
- * if necessary before reverting to the normal RX burst callback.
- *
- * @param dpdk_rxq
- *   Generic pointer to RX queue structure.
- * @param[out] pkts
- *   Array to store received packets.
- * @param pkts_n
- *   Maximum number of packets in array.
- *
- * @return
- *   Number of packets successfully received (<= pkts_n).
- */
-uint16_t
-mlx5_rx_burst_secondary_setup(void *dpdk_rxq, struct rte_mbuf **pkts,
-			      uint16_t pkts_n)
-{
-	struct rxq *rxq = dpdk_rxq;
-	struct rxq_ctrl *rxq_ctrl = container_of(rxq, struct rxq_ctrl, rxq);
-	struct priv *priv = mlx5_secondary_data_setup(rxq_ctrl->priv);
-	struct priv *primary_priv;
-	unsigned int index;
-
-	if (priv == NULL)
-		return 0;
-	primary_priv =
-		mlx5_secondary_data[priv->dev->data->port_id].primary_priv;
-	/* Look for queue index in both private structures. */
-	for (index = 0; index != priv->rxqs_n; ++index)
-		if (((*primary_priv->rxqs)[index] == rxq) ||
-		    ((*priv->rxqs)[index] == rxq))
-			break;
-	if (index == priv->rxqs_n)
-		return 0;
-	rxq = (*priv->rxqs)[index];
-	return priv->dev->rx_pkt_burst(rxq, pkts, pkts_n);
-}
-
-/**
  * Allocate queue vector and fill epoll fd list for Rx interrupts.
  *
  * @param priv
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index baf2b25..333e5af 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -305,7 +305,6 @@ int rxq_ctrl_setup(struct rte_eth_dev *, struct rxq_ctrl *, uint16_t,
 int mlx5_rx_queue_setup(struct rte_eth_dev *, uint16_t, uint16_t, unsigned int,
 			const struct rte_eth_rxconf *, struct rte_mempool *);
 void mlx5_rx_queue_release(void *);
-uint16_t mlx5_rx_burst_secondary_setup(void *, struct rte_mbuf **, uint16_t);
 int priv_rx_intr_vec_enable(struct priv *priv);
 void priv_rx_intr_vec_disable(struct priv *priv);
 #ifdef HAVE_UPDATE_CQ_CI
@@ -321,7 +320,6 @@ int txq_ctrl_setup(struct rte_eth_dev *, struct txq_ctrl *, uint16_t,
 int mlx5_tx_queue_setup(struct rte_eth_dev *, uint16_t, uint16_t, unsigned int,
 			const struct rte_eth_txconf *);
 void mlx5_tx_queue_release(void *);
-uint16_t mlx5_tx_burst_secondary_setup(void *, struct rte_mbuf **, uint16_t);
 
 /* mlx5_rxtx.c */
 
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 45e9037..4b0b532 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -526,44 +526,3 @@ mlx5_tx_queue_release(void *dpdk_txq)
 	rte_free(txq_ctrl);
 	priv_unlock(priv);
 }
-
-/**
- * DPDK callback for TX in secondary processes.
- *
- * This function configures all queues from primary process information
- * if necessary before reverting to the normal TX burst callback.
- *
- * @param dpdk_txq
- *   Generic pointer to TX queue structure.
- * @param[in] pkts
- *   Packets to transmit.
- * @param pkts_n
- *   Number of packets in array.
- *
- * @return
- *   Number of packets successfully transmitted (<= pkts_n).
- */
-uint16_t
-mlx5_tx_burst_secondary_setup(void *dpdk_txq, struct rte_mbuf **pkts,
-			      uint16_t pkts_n)
-{
-	struct txq *txq = dpdk_txq;
-	struct txq_ctrl *txq_ctrl = container_of(txq, struct txq_ctrl, txq);
-	struct priv *priv = mlx5_secondary_data_setup(txq_ctrl->priv);
-	struct priv *primary_priv;
-	unsigned int index;
-
-	if (priv == NULL)
-		return 0;
-	primary_priv =
-		mlx5_secondary_data[priv->dev->data->port_id].primary_priv;
-	/* Look for queue index in both private structures. */
-	for (index = 0; index != priv->txqs_n; ++index)
-		if (((*primary_priv->txqs)[index] == txq) ||
-		    ((*priv->txqs)[index] == txq))
-			break;
-	if (index == priv->txqs_n)
-		return 0;
-	txq = (*priv->txqs)[index];
-	return priv->dev->tx_pkt_burst(txq, pkts, pkts_n);
-}
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 4/5] net/mlx5: remove multiple drop RSS queues
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (2 preceding siblings ...)
  2017-08-01 12:09 ` [PATCH 3/5] net/mlx5: fix non working secondary process by removing it Nelio Laranjeiro
@ 2017-08-01 12:09 ` Nelio Laranjeiro
  2017-08-17 14:38   ` Ferruh Yigit
  2017-08-01 12:09 ` [PATCH 5/5] net/mlx5: remove old MLNX_OFED 3.3 verification Nelio Laranjeiro
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-01 12:09 UTC (permalink / raw)
  To: Adrien Mazarguil, dev; +Cc: Shahaf Shuler

Since MLNX_OFED 4.1 this code is no more useful.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/Makefile    |  5 ----
 drivers/net/mlx5/mlx5_flow.c | 55 ++++++++++++++------------------------------
 2 files changed, 17 insertions(+), 43 deletions(-)

diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 8736de5..14b739a 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -104,11 +104,6 @@ mlx5_autoconf.h.new: FORCE
 mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
 	$Q $(RM) -f -- '$@'
 	$Q sh -- '$<' '$@' \
-		HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP \
-		infiniband/verbs_exp.h \
-		enum IBV_EXP_FLOW_SPEC_ACTION_DROP \
-		$(AUTOCONF_OUTPUT)
-	$Q sh -- '$<' '$@' \
 		HAVE_VERBS_IBV_EXP_CQ_COMPRESSED_CQE \
 		infiniband/verbs_exp.h \
 		enum IBV_EXP_CQ_COMPRESSED_CQE \
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index d62ccff..7dd3ebb 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -52,13 +52,6 @@
 #include "mlx5.h"
 #include "mlx5_prm.h"
 
-/* Number of Work Queue necessary for the DROP queue. */
-#ifndef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
-#define MLX5_DROP_WQ_N 4
-#else
-#define MLX5_DROP_WQ_N 1
-#endif
-
 static int
 mlx5_flow_create_eth(const struct rte_flow_item *item,
 		     const void *default_mask,
@@ -290,7 +283,7 @@ struct mlx5_flow {
 struct rte_flow_drop {
 	struct ibv_exp_rwq_ind_table *ind_table; /**< Indirection table. */
 	struct ibv_qp *qp; /**< Verbs queue pair. */
-	struct ibv_exp_wq *wqs[MLX5_DROP_WQ_N]; /**< Verbs work queue. */
+	struct ibv_exp_wq *wq; /**< Verbs work queue. */
 	struct ibv_cq *cq; /**< Verbs completion queue. */
 };
 
@@ -580,10 +573,8 @@ priv_flow_validate(struct priv *priv,
 	}
 	if (action->mark && !flow->ibv_attr && !action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_tag);
-#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
 	if (!flow->ibv_attr && action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
-#endif
 	if (!action->queue && !action->drop) {
 		rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL, "no valid action");
@@ -1001,10 +992,8 @@ priv_flow_create_action_queue_drop(struct priv *priv,
 				   struct rte_flow_error *error)
 {
 	struct rte_flow *rte_flow;
-#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
 	struct ibv_exp_flow_spec_action_drop *drop;
 	unsigned int size = sizeof(struct ibv_exp_flow_spec_action_drop);
-#endif
 
 	assert(priv->pd);
 	assert(priv->ctx);
@@ -1015,7 +1004,6 @@ priv_flow_create_action_queue_drop(struct priv *priv,
 		return NULL;
 	}
 	rte_flow->drop = 1;
-#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
 	drop = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
 	*drop = (struct ibv_exp_flow_spec_action_drop){
 			.type = IBV_EXP_FLOW_SPEC_ACTION_DROP,
@@ -1023,7 +1011,6 @@ priv_flow_create_action_queue_drop(struct priv *priv,
 	};
 	++flow->ibv_attr->num_of_specs;
 	flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
-#endif
 	rte_flow->ibv_attr = flow->ibv_attr;
 	if (!priv->started)
 		return rte_flow;
@@ -1386,7 +1373,6 @@ static int
 priv_flow_create_drop_queue(struct priv *priv)
 {
 	struct rte_flow_drop *fdq = NULL;
-	unsigned int i;
 
 	assert(priv->pd);
 	assert(priv->ctx);
@@ -1403,25 +1389,23 @@ priv_flow_create_drop_queue(struct priv *priv)
 		WARN("cannot allocate CQ for drop queue");
 		goto error;
 	}
-	for (i = 0; i != MLX5_DROP_WQ_N; ++i) {
-		fdq->wqs[i] = ibv_exp_create_wq(priv->ctx,
-				&(struct ibv_exp_wq_init_attr){
-				.wq_type = IBV_EXP_WQT_RQ,
-				.max_recv_wr = 1,
-				.max_recv_sge = 1,
-				.pd = priv->pd,
-				.cq = fdq->cq,
-				});
-		if (!fdq->wqs[i]) {
-			WARN("cannot allocate WQ for drop queue");
-			goto error;
-		}
+	fdq->wq = ibv_exp_create_wq(priv->ctx,
+			&(struct ibv_exp_wq_init_attr){
+			.wq_type = IBV_EXP_WQT_RQ,
+			.max_recv_wr = 1,
+			.max_recv_sge = 1,
+			.pd = priv->pd,
+			.cq = fdq->cq,
+			});
+	if (!fdq->wq) {
+		WARN("cannot allocate WQ for drop queue");
+		goto error;
 	}
 	fdq->ind_table = ibv_exp_create_rwq_ind_table(priv->ctx,
 			&(struct ibv_exp_rwq_ind_table_init_attr){
 			.pd = priv->pd,
 			.log_ind_tbl_size = 0,
-			.ind_tbl = fdq->wqs,
+			.ind_tbl = &fdq->wq,
 			.comp_mask = 0,
 			});
 	if (!fdq->ind_table) {
@@ -1457,10 +1441,8 @@ priv_flow_create_drop_queue(struct priv *priv)
 		claim_zero(ibv_destroy_qp(fdq->qp));
 	if (fdq->ind_table)
 		claim_zero(ibv_exp_destroy_rwq_ind_table(fdq->ind_table));
-	for (i = 0; i != MLX5_DROP_WQ_N; ++i) {
-		if (fdq->wqs[i])
-			claim_zero(ibv_exp_destroy_wq(fdq->wqs[i]));
-	}
+	if (fdq->wq)
+		claim_zero(ibv_exp_destroy_wq(fdq->wq));
 	if (fdq->cq)
 		claim_zero(ibv_destroy_cq(fdq->cq));
 	if (fdq)
@@ -1479,7 +1461,6 @@ static void
 priv_flow_delete_drop_queue(struct priv *priv)
 {
 	struct rte_flow_drop *fdq = priv->flow_drop_queue;
-	unsigned int i;
 
 	if (!fdq)
 		return;
@@ -1487,10 +1468,8 @@ priv_flow_delete_drop_queue(struct priv *priv)
 		claim_zero(ibv_destroy_qp(fdq->qp));
 	if (fdq->ind_table)
 		claim_zero(ibv_exp_destroy_rwq_ind_table(fdq->ind_table));
-	for (i = 0; i != MLX5_DROP_WQ_N; ++i) {
-		if (fdq->wqs[i])
-			claim_zero(ibv_exp_destroy_wq(fdq->wqs[i]));
-	}
+	if (fdq->wq)
+		claim_zero(ibv_exp_destroy_wq(fdq->wq));
 	if (fdq->cq)
 		claim_zero(ibv_destroy_cq(fdq->cq));
 	rte_free(fdq);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 5/5] net/mlx5: remove old MLNX_OFED 3.3 verification
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (3 preceding siblings ...)
  2017-08-01 12:09 ` [PATCH 4/5] net/mlx5: remove multiple drop RSS queues Nelio Laranjeiro
@ 2017-08-01 12:09 ` Nelio Laranjeiro
  2017-08-17 14:38   ` Ferruh Yigit
  2017-08-02 15:36 ` [PATCH 0/5] net/mlx5: cleanups Nélio Laranjeiro
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-01 12:09 UTC (permalink / raw)
  To: Adrien Mazarguil, dev; +Cc: Shahaf Shuler

This version of MLNX_OFED is no more supported.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 2392be5..e89aba8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -63,11 +63,6 @@
 #include "mlx5_autoconf.h"
 #include "mlx5_defs.h"
 
-#if !defined(HAVE_VERBS_IBV_EXP_CQ_COMPRESSED_CQE) || \
-	!defined(HAVE_VERBS_MLX5_ETH_VLAN_INLINE_HEADER_SIZE)
-#error Mellanox OFED >= 3.3 is required, please refer to the documentation.
-#endif
-
 enum {
 	PCI_VENDOR_ID_MELLANOX = 0x15b3,
 };
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/5] net/mlx5: cleanups
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (4 preceding siblings ...)
  2017-08-01 12:09 ` [PATCH 5/5] net/mlx5: remove old MLNX_OFED 3.3 verification Nelio Laranjeiro
@ 2017-08-02 15:36 ` Nélio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 0/8] " Nelio Laranjeiro
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 25+ messages in thread
From: Nélio Laranjeiro @ 2017-08-02 15:36 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler, Thomas Monjalon

On Tue, Aug 01, 2017 at 02:09:26PM +0200, Nelio Laranjeiro wrote:
> This Series make some cleanup in mlx5 PMD by removing useless code or non
> working code.
> 
> This series apply on top of:
>  [PATCH 0/5] net/mlx5: enable/disable vPMD and some cleanups
> Specifically on patch: net/mlx5: cleanup Rx ring in free functions
> 
> http://dpdk.org/dev/patchwork/patch/27303/

Differed to the next release,

Thanks

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 5/5] net/mlx5: remove old MLNX_OFED 3.3 verification
  2017-08-01 12:09 ` [PATCH 5/5] net/mlx5: remove old MLNX_OFED 3.3 verification Nelio Laranjeiro
@ 2017-08-17 14:38   ` Ferruh Yigit
  2017-08-22  8:25     ` Nélio Laranjeiro
  0 siblings, 1 reply; 25+ messages in thread
From: Ferruh Yigit @ 2017-08-17 14:38 UTC (permalink / raw)
  To: Nelio Laranjeiro, Adrien Mazarguil, dev; +Cc: Shahaf Shuler

On 8/1/2017 1:09 PM, Nelio Laranjeiro wrote:
> This version of MLNX_OFED is no more supported.

Does it make sense to document minimum supported MLNX_OFED version?

> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Shahaf Shuler <shahafs@mellanox.com>

<...>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/5] net/mlx5: remove multiple drop RSS queues
  2017-08-01 12:09 ` [PATCH 4/5] net/mlx5: remove multiple drop RSS queues Nelio Laranjeiro
@ 2017-08-17 14:38   ` Ferruh Yigit
  2017-08-22  8:59     ` Nélio Laranjeiro
  0 siblings, 1 reply; 25+ messages in thread
From: Ferruh Yigit @ 2017-08-17 14:38 UTC (permalink / raw)
  To: Nelio Laranjeiro, Adrien Mazarguil, dev; +Cc: Shahaf Shuler

On 8/1/2017 1:09 PM, Nelio Laranjeiro wrote:
> Since MLNX_OFED 4.1 this code is no more useful.

Can you please elaborate what is changed with MLNX_OFED 4.1?

Also how one can know his MLNX_OFED version?

> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Shahaf Shuler <shahafs@mellanox.com>

<...>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 3/5] net/mlx5: fix non working secondary process by removing it
  2017-08-01 12:09 ` [PATCH 3/5] net/mlx5: fix non working secondary process by removing it Nelio Laranjeiro
@ 2017-08-17 14:38   ` Ferruh Yigit
  2017-08-22  9:08     ` Nélio Laranjeiro
  0 siblings, 1 reply; 25+ messages in thread
From: Ferruh Yigit @ 2017-08-17 14:38 UTC (permalink / raw)
  To: Nelio Laranjeiro, Adrien Mazarguil, dev; +Cc: Shahaf Shuler

On 8/1/2017 1:09 PM, Nelio Laranjeiro wrote:
> Secondary process is a copy/paste of the mlx4 drivers, it was never
> tested and it even segfault at the secondary process start in the
> mlx5_pci_probe().

Does this means multi process support for mlx5 broken with this patch?
If so features file and release notes should be updated if this won't be
fixed back in this release..

And what is special required for mlx5 secondary process support?

> 
> This makes more sense to wipe this non working feature to re-write a
> working and functional version.
> 
> Fixes: a48deada651b ("mlx5: allow operation in secondary processes")
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Shahaf Shuler <shahafs@mellanox.com>

<...>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/5] net/mlx5: remove pdentic pragma
  2017-08-01 12:09 ` [PATCH 2/5] net/mlx5: remove pdentic pragma Nelio Laranjeiro
@ 2017-08-17 14:38   ` Ferruh Yigit
  2017-08-22  9:10     ` Nélio Laranjeiro
  0 siblings, 1 reply; 25+ messages in thread
From: Ferruh Yigit @ 2017-08-17 14:38 UTC (permalink / raw)
  To: Nelio Laranjeiro, Adrien Mazarguil, dev; +Cc: Shahaf Shuler

On 8/1/2017 1:09 PM, Nelio Laranjeiro wrote:
> Those are useless since DPDK headers have been cleaned up.
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Shahaf Shuler <shahafs@mellanox.com>

<...>

>  
> -/* DPDK headers don't like -pedantic. */
> -#ifdef PEDANTIC
> -#pragma GCC diagnostic ignored "-Wpedantic"
> -#endif

Good to see that they are going, thanks. Is verbs.h one still required?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 5/5] net/mlx5: remove old MLNX_OFED 3.3 verification
  2017-08-17 14:38   ` Ferruh Yigit
@ 2017-08-22  8:25     ` Nélio Laranjeiro
  0 siblings, 0 replies; 25+ messages in thread
From: Nélio Laranjeiro @ 2017-08-22  8:25 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Adrien Mazarguil, dev, Shahaf Shuler

On Thu, Aug 17, 2017 at 03:38:05PM +0100, Ferruh Yigit wrote:
> On 8/1/2017 1:09 PM, Nelio Laranjeiro wrote:
> > This version of MLNX_OFED is no more supported.
> 
> Does it make sense to document minimum supported MLNX_OFED version?
> 
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > Acked-by: Shahaf Shuler <shahafs@mellanox.com>

Hi Ferruh,

This is already documented in the NIC guides, see section "20.5.
Prerequisites" [1].

Thanks,

[1] http://dpdk.org/doc/guides/nics/mlx5.html
-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/5] net/mlx5: remove multiple drop RSS queues
  2017-08-17 14:38   ` Ferruh Yigit
@ 2017-08-22  8:59     ` Nélio Laranjeiro
  0 siblings, 0 replies; 25+ messages in thread
From: Nélio Laranjeiro @ 2017-08-22  8:59 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Adrien Mazarguil, dev, Shahaf Shuler

On Thu, Aug 17, 2017 at 03:38:13PM +0100, Ferruh Yigit wrote:
> On 8/1/2017 1:09 PM, Nelio Laranjeiro wrote:
> > Since MLNX_OFED 4.1 this code is no more useful.
> 
> Can you please elaborate what is changed with MLNX_OFED 4.1?

Hardware drop queues are supported since this version, before that, the flow
drop was handled by software queues not polled.

> Also how one can know his MLNX_OFED version?

Currently the user has to download and install it to have a working PMD, the
NIC documentation provides the related information on where to get this
Mellanox OFED from their website.  So the user knows which version of MLNX
OFED is installed in his system.

> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > Acked-by: Shahaf Shuler <shahafs@mellanox.com>
> 
> <...>

Thanks,

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 3/5] net/mlx5: fix non working secondary process by removing it
  2017-08-17 14:38   ` Ferruh Yigit
@ 2017-08-22  9:08     ` Nélio Laranjeiro
  0 siblings, 0 replies; 25+ messages in thread
From: Nélio Laranjeiro @ 2017-08-22  9:08 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Adrien Mazarguil, dev, Shahaf Shuler

On Thu, Aug 17, 2017 at 03:38:22PM +0100, Ferruh Yigit wrote:
> On 8/1/2017 1:09 PM, Nelio Laranjeiro wrote:
> > Secondary process is a copy/paste of the mlx4 drivers, it was never
> > tested and it even segfault at the secondary process start in the
> > mlx5_pci_probe().
> 
> Does this means multi process support for mlx5 broken with this patch?
> If so features file and release notes should be updated if this won't be
> fixed back in this release..

No currently the secondary process in mlx5 is not working at all.  This is
only removing a non working code from the PMD.

> And what is special required for mlx5 secondary process support?

There is some work to make this secondary process work correctly, but as it
will be totally different, it does not make sense to keep a non working code
to replace it by a working one.

Concerning the release note and features, this new implementation is
expected in 17.11 same release as this patch.

> > This makes more sense to wipe this non working feature to re-write a
> > working and functional version.
> > 
> > Fixes: a48deada651b ("mlx5: allow operation in secondary processes")
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > Acked-by: Shahaf Shuler <shahafs@mellanox.com>
> 
> <...>

I'll update the feature documentation in a v2 to remove the "Multiprocess
aware" from the feature list in this patch.
It will be added back with the new implementation.

Thanks,

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/5] net/mlx5: remove pdentic pragma
  2017-08-17 14:38   ` Ferruh Yigit
@ 2017-08-22  9:10     ` Nélio Laranjeiro
  0 siblings, 0 replies; 25+ messages in thread
From: Nélio Laranjeiro @ 2017-08-22  9:10 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Adrien Mazarguil, dev, Shahaf Shuler

On Thu, Aug 17, 2017 at 03:38:33PM +0100, Ferruh Yigit wrote:
> On 8/1/2017 1:09 PM, Nelio Laranjeiro wrote:
> > Those are useless since DPDK headers have been cleaned up.
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > Acked-by: Shahaf Shuler <shahafs@mellanox.com>
> 
> <...>
> 
> >  
> > -/* DPDK headers don't like -pedantic. */
> > -#ifdef PEDANTIC
> > -#pragma GCC diagnostic ignored "-Wpedantic"
> > -#endif
> 
> Good to see that they are going, thanks. Is verbs.h one still required?

Yes it is, Adrien is pushing some patch to the OFED community to make it
also pedantic.

Thanks,

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH v2 0/8] net/mlx5: cleanups
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (5 preceding siblings ...)
  2017-08-02 15:36 ` [PATCH 0/5] net/mlx5: cleanups Nélio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  2017-08-23 10:07   ` Ferruh Yigit
  2017-08-23  8:15 ` [PATCH v2 1/8] net/mlx5: avoid reusing old queue's mbuf on reconfigure Nelio Laranjeiro
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

This Series make some cleanup in mlx5 PMD by removing useless code or non
working code.

Changes in v2:

 - update mlx5 feature list to remove the multi process awareness.

Nelio Laranjeiro (8):
  net/mlx5: avoid reusing old queue's mbuf on reconfigure
  net/mlx5: prepare vector Rx ring at setup time
  net/mlx5: cleanup Rx ring in free functions
  net/mlx5: remove flow drop useless if branches
  net/mlx5: remove pdentic pragma
  net/mlx5: fix non working secondary process by removing it
  net/mlx5: remove multiple drop RSS queues
  net/mlx5: remove old MLNX_OFED 3.3 verification

 doc/guides/nics/features/mlx5.ini    |   1 -
 drivers/net/mlx5/Makefile            |   5 -
 drivers/net/mlx5/mlx5.c              |  40 +-------
 drivers/net/mlx5/mlx5.h              |  21 -----
 drivers/net/mlx5/mlx5_ethdev.c       | 174 +----------------------------------
 drivers/net/mlx5/mlx5_fdir.c         |   7 --
 drivers/net/mlx5/mlx5_flow.c         |  59 ++++--------
 drivers/net/mlx5/mlx5_mac.c          |   7 --
 drivers/net/mlx5/mlx5_mr.c           |   7 --
 drivers/net/mlx5/mlx5_rss.c          |   7 --
 drivers/net/mlx5/mlx5_rxmode.c       |   7 --
 drivers/net/mlx5/mlx5_rxq.c          | 166 +++++++++++----------------------
 drivers/net/mlx5/mlx5_rxtx.c         |  13 ---
 drivers/net/mlx5/mlx5_rxtx.h         |  13 +--
 drivers/net/mlx5/mlx5_rxtx_vec_sse.c |  45 ---------
 drivers/net/mlx5/mlx5_stats.c        |   7 --
 drivers/net/mlx5/mlx5_trigger.c      |   7 --
 drivers/net/mlx5/mlx5_txq.c          |  48 ----------
 drivers/net/mlx5/mlx5_vlan.c         |   7 --
 19 files changed, 77 insertions(+), 564 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH v2 1/8] net/mlx5: avoid reusing old queue's mbuf on reconfigure
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (6 preceding siblings ...)
  2017-08-23  8:15 ` [PATCH v2 0/8] " Nelio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 2/8] net/mlx5: prepare vector Rx ring at setup time Nelio Laranjeiro
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

This patch prepare the merge of fake mbuf allocation needed by the vector
code with rxq_alloc_elts() where all mbuf of the queues should be
allocated.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 74387a7..550e648 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -666,16 +666,12 @@ rxq_trim_elts(struct rxq *rxq)
  *   Pointer to RX queue structure.
  * @param elts_n
  *   Number of elements to allocate.
- * @param[in] pool
- *   If not NULL, fetch buffers from this array instead of allocating them
- *   with rte_pktmbuf_alloc().
  *
  * @return
  *   0 on success, errno value on failure.
  */
 static int
-rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n,
-	       struct rte_mbuf *(*pool)[])
+rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n)
 {
 	const unsigned int sges_n = 1 << rxq_ctrl->rxq.sges_n;
 	unsigned int i;
@@ -687,12 +683,7 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n,
 		volatile struct mlx5_wqe_data_seg *scat =
 			&(*rxq_ctrl->rxq.wqes)[i];
 
-		buf = (pool != NULL) ? (*pool)[i] : NULL;
-		if (buf != NULL) {
-			rte_pktmbuf_reset(buf);
-			rte_pktmbuf_refcnt_update(buf, 1);
-		} else
-			buf = rte_pktmbuf_alloc(rxq_ctrl->rxq.mp);
+		buf = rte_pktmbuf_alloc(rxq_ctrl->rxq.mp);
 		if (buf == NULL) {
 			ERROR("%p: empty mbuf pool", (void *)rxq_ctrl);
 			ret = ENOMEM;
@@ -725,7 +716,6 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n,
 	assert(ret == 0);
 	return 0;
 error:
-	assert(pool == NULL);
 	elts_n = i;
 	for (i = 0; (i != elts_n); ++i) {
 		if ((*rxq_ctrl->rxq.elts)[i] != NULL)
@@ -1064,14 +1054,7 @@ rxq_ctrl_setup(struct rte_eth_dev *dev, struct rxq_ctrl *rxq_ctrl,
 		      (void *)dev, strerror(ret));
 		goto error;
 	}
-	/* Reuse buffers from original queue if possible. */
-	if (rxq_ctrl->rxq.elts_n) {
-		assert(1 << rxq_ctrl->rxq.elts_n == desc);
-		assert(rxq_ctrl->rxq.elts != tmpl.rxq.elts);
-		rxq_trim_elts(&rxq_ctrl->rxq);
-		ret = rxq_alloc_elts(&tmpl, desc, rxq_ctrl->rxq.elts);
-	} else
-		ret = rxq_alloc_elts(&tmpl, desc, NULL);
+	ret = rxq_alloc_elts(&tmpl, desc);
 	if (ret) {
 		ERROR("%p: RXQ allocation failed: %s",
 		      (void *)dev, strerror(ret));
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 2/8] net/mlx5: prepare vector Rx ring at setup time
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (7 preceding siblings ...)
  2017-08-23  8:15 ` [PATCH v2 1/8] net/mlx5: avoid reusing old queue's mbuf on reconfigure Nelio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 3/8] net/mlx5: cleanup Rx ring in free functions Nelio Laranjeiro
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

To use the vector, it needs to add to the PMD Rx mbuf ring four extra mbuf
to avoid memory corruption.  This additional mbuf are added on dev_start()
whereas all other mbuf are allocated on queue setup.

This patch brings this allocation back to the same place as other mbuf
allocation.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c       |  1 -
 drivers/net/mlx5/mlx5_rxq.c          | 43 ++++++++++++++++++++++++++++--------
 drivers/net/mlx5/mlx5_rxtx.c         |  6 -----
 drivers/net/mlx5/mlx5_rxtx.h         |  1 -
 drivers/net/mlx5/mlx5_rxtx_vec_sse.c | 38 -------------------------------
 5 files changed, 34 insertions(+), 55 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index b0eb3cd..014edc7 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1540,7 +1540,6 @@ void
 priv_select_rx_function(struct priv *priv)
 {
 	if (priv_check_vec_rx_support(priv) > 0) {
-		priv_prep_vec_rx_function(priv);
 		priv->dev->rx_pkt_burst = mlx5_rx_burst_vec;
 		DEBUG("selected RX vectorized function");
 	} else {
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 550e648..de54175 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -711,6 +711,27 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n)
 		};
 		(*rxq_ctrl->rxq.elts)[i] = buf;
 	}
+	if (rxq_check_vec_support(&rxq_ctrl->rxq) > 0) {
+		struct rxq *rxq = &rxq_ctrl->rxq;
+		struct rte_mbuf *mbuf_init = &rxq->fake_mbuf;
+
+		assert(rxq->elts_n == rxq->cqe_n);
+		/* Initialize default rearm_data for vPMD. */
+		mbuf_init->data_off = RTE_PKTMBUF_HEADROOM;
+		rte_mbuf_refcnt_set(mbuf_init, 1);
+		mbuf_init->nb_segs = 1;
+		mbuf_init->port = rxq->port_id;
+		/*
+		 * prevent compiler reordering:
+		 * rearm_data covers previous fields.
+		 */
+		rte_compiler_barrier();
+		rxq->mbuf_initializer = *(uint64_t *)&mbuf_init->rearm_data;
+		/* Padding with a fake mbuf for vectorized Rx. */
+		for (i = 0; i < MLX5_VPMD_DESCS_PER_LOOP; ++i)
+			(*rxq->elts)[elts_n + i] = &rxq->fake_mbuf;
+		rxq->trim_elts = 1;
+	}
 	DEBUG("%p: allocated and configured %u segments (max %u packets)",
 	      (void *)rxq_ctrl, elts_n, elts_n / (1 << rxq_ctrl->rxq.sges_n));
 	assert(ret == 0);
@@ -791,9 +812,11 @@ rxq_setup(struct rxq_ctrl *tmpl)
 	struct ibv_cq *ibcq = tmpl->cq;
 	struct ibv_mlx5_cq_info cq_info;
 	struct mlx5_rwq *rwq = container_of(tmpl->wq, struct mlx5_rwq, wq);
-	struct rte_mbuf *(*elts)[1 << tmpl->rxq.elts_n] =
+	const uint16_t desc_n =
+		(1 << tmpl->rxq.elts_n) + tmpl->priv->rx_vec_en *
+		MLX5_VPMD_DESCS_PER_LOOP;
+	struct rte_mbuf *(*elts)[desc_n] =
 		rte_calloc_socket("RXQ", 1, sizeof(*elts), 0, tmpl->socket);
-
 	if (ibv_mlx5_exp_get_cq_info(ibcq, &cq_info)) {
 		ERROR("Unable to query CQ info. check your OFED.");
 		return ENOTSUP;
@@ -863,7 +886,9 @@ rxq_ctrl_setup(struct rte_eth_dev *dev, struct rxq_ctrl *rxq_ctrl,
 	} attr;
 	unsigned int mb_len = rte_pktmbuf_data_room_size(mp);
 	unsigned int cqe_n = desc - 1;
-	struct rte_mbuf *(*elts)[desc] = NULL;
+	const uint16_t desc_n =
+		desc + priv->rx_vec_en * MLX5_VPMD_DESCS_PER_LOOP;
+	struct rte_mbuf *(*elts)[desc_n] = NULL;
 	int ret = 0;
 
 	(void)conf; /* Thresholds configuration (ignored). */
@@ -1114,7 +1139,8 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	struct priv *priv = dev->data->dev_private;
 	struct rxq *rxq = (*priv->rxqs)[idx];
 	struct rxq_ctrl *rxq_ctrl = container_of(rxq, struct rxq_ctrl, rxq);
-	const uint16_t desc_pad = MLX5_VPMD_DESCS_PER_LOOP; /* For vPMD. */
+	const uint16_t desc_n =
+		desc + priv->rx_vec_en * MLX5_VPMD_DESCS_PER_LOOP;
 	int ret;
 
 	if (mlx5_is_secondary())
@@ -1147,9 +1173,8 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 		/* Resize if rxq size is changed. */
 		if (rxq_ctrl->rxq.elts_n != log2above(desc)) {
 			rxq_ctrl = rte_realloc(rxq_ctrl,
-					       sizeof(*rxq_ctrl) +
-					       (desc + desc_pad) *
-						sizeof(struct rte_mbuf *),
+					       sizeof(*rxq_ctrl) + desc_n *
+					       sizeof(struct rte_mbuf *),
 					       RTE_CACHE_LINE_SIZE);
 			if (!rxq_ctrl) {
 				ERROR("%p: unable to reallocate queue index %u",
@@ -1160,8 +1185,8 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 		}
 	} else {
 		rxq_ctrl = rte_calloc_socket("RXQ", 1, sizeof(*rxq_ctrl) +
-					     (desc + desc_pad) *
-					      sizeof(struct rte_mbuf *),
+					     desc_n *
+					     sizeof(struct rte_mbuf *),
 					     0, socket);
 		if (rxq_ctrl == NULL) {
 			ERROR("%p: unable to allocate queue index %u",
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index b07bcd1..e9c4502 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -2028,9 +2028,3 @@ priv_check_vec_rx_support(struct priv *priv)
 	(void)priv;
 	return -ENOTSUP;
 }
-
-void __attribute__((weak))
-priv_prep_vec_rx_function(struct priv *priv)
-{
-	(void)priv;
-}
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 7de1d10..d85ea16 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -348,7 +348,6 @@ int priv_check_raw_vec_tx_support(struct priv *);
 int priv_check_vec_tx_support(struct priv *);
 int rxq_check_vec_support(struct rxq *);
 int priv_check_vec_rx_support(struct priv *);
-void priv_prep_vec_rx_function(struct priv *);
 uint16_t mlx5_tx_burst_raw_vec(void *, struct rte_mbuf **, uint16_t);
 uint16_t mlx5_tx_burst_vec(void *, struct rte_mbuf **, uint16_t);
 uint16_t mlx5_rx_burst_vec(void *, struct rte_mbuf **, uint16_t);
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
index 8560f74..67f63c6 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
@@ -1377,41 +1377,3 @@ priv_check_vec_rx_support(struct priv *priv)
 		return -ENOTSUP;
 	return 1;
 }
-
-/**
- * Prepare for vectorized RX.
- *
- * @param priv
- *   Pointer to private structure.
- */
-void
-priv_prep_vec_rx_function(struct priv *priv)
-{
-	uint16_t i;
-
-	for (i = 0; i < priv->rxqs_n; ++i) {
-		struct rxq *rxq = (*priv->rxqs)[i];
-		struct rte_mbuf *mbuf_init = &rxq->fake_mbuf;
-		const uint16_t desc = 1 << rxq->elts_n;
-		int j;
-
-		assert(rxq->elts_n == rxq->cqe_n);
-		/* Initialize default rearm_data for vPMD. */
-		mbuf_init->data_off = RTE_PKTMBUF_HEADROOM;
-		rte_mbuf_refcnt_set(mbuf_init, 1);
-		mbuf_init->nb_segs = 1;
-		mbuf_init->port = rxq->port_id;
-		/*
-		 * prevent compiler reordering:
-		 * rearm_data covers previous fields.
-		 */
-		rte_compiler_barrier();
-		rxq->mbuf_initializer =
-			*(uint64_t *)&mbuf_init->rearm_data;
-		/* Padding with a fake mbuf for vectorized Rx. */
-		for (j = 0; j < MLX5_VPMD_DESCS_PER_LOOP; ++j)
-			(*rxq->elts)[desc + j] = &rxq->fake_mbuf;
-		/* Mark that it need to be cleaned up for rxq_alloc_elts(). */
-		rxq->trim_elts = 1;
-	}
-}
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 3/8] net/mlx5: cleanup Rx ring in free functions
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (8 preceding siblings ...)
  2017-08-23  8:15 ` [PATCH v2 2/8] net/mlx5: prepare vector Rx ring at setup time Nelio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 4/8] net/mlx5: remove flow drop useless if branches Nelio Laranjeiro
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

Vector PMD returns buffers to the application without setting the pointers
in the Rx queue to null nor allocating them.  When the PMD cleanup the ring
it needs to take a special care to those pointers to not free the mbufs
before the application have used them nor if the application have already
freed them.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c  | 54 ++++++++++++++++----------------------------
 drivers/net/mlx5/mlx5_rxtx.h |  3 +--
 2 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index de54175..2119dfa 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -634,32 +634,6 @@ priv_rehash_flows(struct priv *priv)
 }
 
 /**
- * Unlike regular Rx function, vPMD Rx doesn't replace mbufs immediately when
- * receiving packets. Instead it replaces later in bulk. In rxq->elts[], entries
- * from rq_pi to rq_ci are owned by device but the rest is already delivered to
- * application. In order not to reuse those mbufs by rxq_alloc_elts(), this
- * function must be called to replace used mbufs.
- *
- * @param rxq
- *   Pointer to RX queue structure.
- */
-static void
-rxq_trim_elts(struct rxq *rxq)
-{
-	const uint16_t q_n = (1 << rxq->elts_n);
-	const uint16_t q_mask = q_n - 1;
-	uint16_t used = q_n - (rxq->rq_ci - rxq->rq_pi);
-	uint16_t i;
-
-	if (!rxq->trim_elts)
-		return;
-	for (i = 0; i < used; ++i)
-		(*rxq->elts)[(rxq->rq_ci + i) & q_mask] = NULL;
-	rxq->trim_elts = 0;
-	return;
-}
-
-/**
  * Allocate RX queue elements.
  *
  * @param rxq_ctrl
@@ -730,7 +704,6 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n)
 		/* Padding with a fake mbuf for vectorized Rx. */
 		for (i = 0; i < MLX5_VPMD_DESCS_PER_LOOP; ++i)
 			(*rxq->elts)[elts_n + i] = &rxq->fake_mbuf;
-		rxq->trim_elts = 1;
 	}
 	DEBUG("%p: allocated and configured %u segments (max %u packets)",
 	      (void *)rxq_ctrl, elts_n, elts_n / (1 << rxq_ctrl->rxq.sges_n));
@@ -757,17 +730,28 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n)
 static void
 rxq_free_elts(struct rxq_ctrl *rxq_ctrl)
 {
-	unsigned int i;
+	struct rxq *rxq = &rxq_ctrl->rxq;
+	const uint16_t q_n = (1 << rxq->elts_n);
+	const uint16_t q_mask = q_n - 1;
+	uint16_t used = q_n - (rxq->rq_ci - rxq->rq_pi);
+	uint16_t i;
 
-	rxq_trim_elts(&rxq_ctrl->rxq);
 	DEBUG("%p: freeing WRs", (void *)rxq_ctrl);
-	if (rxq_ctrl->rxq.elts == NULL)
+	if (rxq->elts == NULL)
 		return;
-
-	for (i = 0; (i != (1u << rxq_ctrl->rxq.elts_n)); ++i) {
-		if ((*rxq_ctrl->rxq.elts)[i] != NULL)
-			rte_pktmbuf_free_seg((*rxq_ctrl->rxq.elts)[i]);
-		(*rxq_ctrl->rxq.elts)[i] = NULL;
+	/**
+	 * Some mbuf in the Ring belongs to the application.  They cannot be
+	 * freed.
+	 */
+	if (rxq_check_vec_support(rxq) > 0) {
+		for (i = 0; i < used; ++i)
+			(*rxq->elts)[(rxq->rq_ci + i) & q_mask] = NULL;
+		rxq->rq_pi = rxq->rq_ci;
+	}
+	for (i = 0; (i != (1u << rxq->elts_n)); ++i) {
+		if ((*rxq->elts)[i] != NULL)
+			rte_pktmbuf_free_seg((*rxq->elts)[i]);
+		(*rxq->elts)[i] = NULL;
 	}
 }
 
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index d85ea16..39b217b 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -116,8 +116,7 @@ struct rxq {
 	unsigned int rss_hash:1; /* RSS hash result is enabled. */
 	unsigned int mark:1; /* Marked flow available on the queue. */
 	unsigned int pending_err:1; /* CQE error needs to be handled. */
-	unsigned int trim_elts:1; /* Whether elts needs clean-up. */
-	unsigned int :6; /* Remaining bits. */
+	unsigned int :7; /* Remaining bits. */
 	volatile uint32_t *rq_db;
 	volatile uint32_t *cq_db;
 	uint16_t rq_ci;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 4/8] net/mlx5: remove flow drop useless if branches
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (9 preceding siblings ...)
  2017-08-23  8:15 ` [PATCH v2 3/8] net/mlx5: cleanup Rx ring in free functions Nelio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 5/8] net/mlx5: remove pdentic pragma Nelio Laranjeiro
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

Those two if statements are useless as there is a verification on the drop
field of the flow to jump to the end of the function just above.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 86be929..d62ccff 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1279,10 +1279,6 @@ priv_flow_destroy(struct priv *priv,
 		claim_zero(ibv_destroy_qp(flow->qp));
 	if (flow->ind_table)
 		claim_zero(ibv_exp_destroy_rwq_ind_table(flow->ind_table));
-	if (flow->drop && flow->wq)
-		claim_zero(ibv_exp_destroy_wq(flow->wq));
-	if (flow->drop && flow->cq)
-		claim_zero(ibv_destroy_cq(flow->cq));
 	if (flow->mark) {
 		struct rte_flow *tmp;
 		struct rxq *rxq;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 5/8] net/mlx5: remove pdentic pragma
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (10 preceding siblings ...)
  2017-08-23  8:15 ` [PATCH v2 4/8] net/mlx5: remove flow drop useless if branches Nelio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 6/8] net/mlx5: fix non working secondary process by removing it Nelio Laranjeiro
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

Those are useless since DPDK headers have been cleaned up.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.c              | 7 -------
 drivers/net/mlx5/mlx5.h              | 7 -------
 drivers/net/mlx5/mlx5_ethdev.c       | 7 -------
 drivers/net/mlx5/mlx5_fdir.c         | 7 -------
 drivers/net/mlx5/mlx5_mac.c          | 7 -------
 drivers/net/mlx5/mlx5_mr.c           | 7 -------
 drivers/net/mlx5/mlx5_rss.c          | 7 -------
 drivers/net/mlx5/mlx5_rxmode.c       | 7 -------
 drivers/net/mlx5/mlx5_rxq.c          | 7 -------
 drivers/net/mlx5/mlx5_rxtx.c         | 7 -------
 drivers/net/mlx5/mlx5_rxtx.h         | 7 -------
 drivers/net/mlx5/mlx5_rxtx_vec_sse.c | 7 -------
 drivers/net/mlx5/mlx5_stats.c        | 7 -------
 drivers/net/mlx5/mlx5_trigger.c      | 7 -------
 drivers/net/mlx5/mlx5_txq.c          | 7 -------
 drivers/net/mlx5/mlx5_vlan.c         | 7 -------
 16 files changed, 112 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b7e5046..bfcff70 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -50,19 +50,12 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 43c5384..31d0c49 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -50,10 +50,6 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
@@ -61,9 +57,6 @@
 #include <rte_interrupts.h>
 #include <rte_errno.h>
 #include <rte_flow.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 014edc7..8258d4a 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -50,10 +50,6 @@
 #include <linux/version.h>
 #include <fcntl.h>
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_atomic.h>
 #include <rte_ethdev.h>
 #include <rte_mbuf.h>
@@ -61,9 +57,6 @@
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
 #include <rte_malloc.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_fdir.c b/drivers/net/mlx5/mlx5_fdir.c
index 34a7e69..ad256e4 100644
--- a/drivers/net/mlx5/mlx5_fdir.c
+++ b/drivers/net/mlx5/mlx5_fdir.c
@@ -47,19 +47,12 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 8489ea6..45d23e4 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -51,16 +51,9 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 2873351..9593830 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -41,14 +41,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mempool.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
index a2dd7d1..1249943 100644
--- a/drivers/net/mlx5/mlx5_rss.c
+++ b/drivers/net/mlx5/mlx5_rss.c
@@ -47,15 +47,8 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index a67e542..4a51e47 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -45,14 +45,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ethdev.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 2119dfa..94fdd32 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -50,19 +50,12 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
 #include <rte_debug.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index e9c4502..fe9e7ea 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -48,19 +48,12 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_mempool.h>
 #include <rte_prefetch.h>
 #include <rte_common.h>
 #include <rte_branch_prediction.h>
 #include <rte_ether.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 39b217b..0226ff9 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -48,16 +48,9 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_mempool.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5.h"
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
index 67f63c6..37854a7 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
@@ -49,16 +49,9 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_mempool.h>
 #include <rte_prefetch.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 703f48c..7b45c8c 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -34,16 +34,9 @@
 #include <linux/sockios.h>
 #include <linux/ethtool.h>
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ethdev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 595a9e0..3fa9401 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -31,17 +31,10 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 98aaa7c..45e9037 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -47,17 +47,10 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5_defs.h"
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index 1b0fa40..353ae49 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -36,15 +36,8 @@
 #include <assert.h>
 #include <stdint.h>
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ethdev.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5.h"
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 6/8] net/mlx5: fix non working secondary process by removing it
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (11 preceding siblings ...)
  2017-08-23  8:15 ` [PATCH v2 5/8] net/mlx5: remove pdentic pragma Nelio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 7/8] net/mlx5: remove multiple drop RSS queues Nelio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 8/8] net/mlx5: remove old MLNX_OFED 3.3 verification Nelio Laranjeiro
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

Secondary process is a copy/paste of the mlx4 drivers, it was never
tested and it even segfault at the secondary process start in the
mlx5_pci_probe().

This makes more sense to wipe this non working feature to re-write a
working and functional version.

Fixes: a48deada651b ("mlx5: allow operation in secondary processes")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 doc/guides/nics/features/mlx5.ini |   1 -
 drivers/net/mlx5/mlx5.c           |  33 +-------
 drivers/net/mlx5/mlx5.h           |   9 ---
 drivers/net/mlx5/mlx5_ethdev.c    | 166 +-------------------------------------
 drivers/net/mlx5/mlx5_rxq.c       |  41 ----------
 drivers/net/mlx5/mlx5_rxtx.h      |   2 -
 drivers/net/mlx5/mlx5_txq.c       |  41 ----------
 7 files changed, 4 insertions(+), 289 deletions(-)

diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini
index 2913591..99a8d93 100644
--- a/doc/guides/nics/features/mlx5.ini
+++ b/doc/guides/nics/features/mlx5.ini
@@ -34,7 +34,6 @@ Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
-Multiprocess aware   = Y
 Other kdrv           = Y
 ARMv8                = Y
 Power8               = Y
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index bfcff70..bd66a7c 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -771,37 +771,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 			err = ENOMEM;
 			goto port_error;
 		}
-
-		/* Secondary processes have to use local storage for their
-		 * private data as well as a copy of eth_dev->data, but this
-		 * pointer must not be modified before burst functions are
-		 * actually called. */
-		if (mlx5_is_secondary()) {
-			struct mlx5_secondary_data *sd =
-				&mlx5_secondary_data[eth_dev->data->port_id];
-			sd->primary_priv = eth_dev->data->dev_private;
-			if (sd->primary_priv == NULL) {
-				ERROR("no private data for port %u",
-						eth_dev->data->port_id);
-				err = EINVAL;
-				goto port_error;
-			}
-			sd->shared_dev_data = eth_dev->data;
-			rte_spinlock_init(&sd->lock);
-			memcpy(sd->data.name, sd->shared_dev_data->name,
-				   sizeof(sd->data.name));
-			sd->data.dev_private = priv;
-			sd->data.rx_mbuf_alloc_failed = 0;
-			sd->data.mtu = ETHER_MTU;
-			sd->data.port_id = sd->shared_dev_data->port_id;
-			sd->data.mac_addrs = priv->mac;
-			eth_dev->tx_pkt_burst = mlx5_tx_burst_secondary_setup;
-			eth_dev->rx_pkt_burst = mlx5_rx_burst_secondary_setup;
-		} else {
-			eth_dev->data->dev_private = priv;
-			eth_dev->data->mac_addrs = priv->mac;
-		}
-
+		eth_dev->data->dev_private = priv;
+		eth_dev->data->mac_addrs = priv->mac;
 		eth_dev->device = &pci_dev->device;
 		rte_eth_copy_pci_info(eth_dev, pci_dev);
 		eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 31d0c49..2392be5 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -158,14 +158,6 @@ struct priv {
 	rte_spinlock_t lock; /* Lock for control functions. */
 };
 
-/* Local storage for secondary process data. */
-struct mlx5_secondary_data {
-	struct rte_eth_dev_data data; /* Local device data. */
-	struct priv *primary_priv; /* Private structure from primary. */
-	struct rte_eth_dev_data *shared_dev_data; /* Shared device data. */
-	rte_spinlock_t lock; /* Port configuration lock. */
-} mlx5_secondary_data[RTE_MAX_ETHPORTS];
-
 /**
  * Lock private structure to protect it from concurrent access in the
  * control path.
@@ -221,7 +213,6 @@ void priv_dev_interrupt_handler_uninstall(struct priv *, struct rte_eth_dev *);
 void priv_dev_interrupt_handler_install(struct priv *, struct rte_eth_dev *);
 int mlx5_set_link_down(struct rte_eth_dev *dev);
 int mlx5_set_link_up(struct rte_eth_dev *dev);
-struct priv *mlx5_secondary_data_setup(struct priv *priv);
 void priv_select_tx_function(struct priv *);
 void priv_select_rx_function(struct priv *);
 
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 8258d4a..57f6237 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -126,12 +126,7 @@ struct ethtool_link_settings {
 struct priv *
 mlx5_get_priv(struct rte_eth_dev *dev)
 {
-	struct mlx5_secondary_data *sd;
-
-	if (!mlx5_is_secondary())
-		return dev->data->dev_private;
-	sd = &mlx5_secondary_data[dev->data->port_id];
-	return sd->data.dev_private;
+	return dev->data->dev_private;
 }
 
 /**
@@ -143,7 +138,7 @@ mlx5_get_priv(struct rte_eth_dev *dev)
 inline int
 mlx5_is_secondary(void)
 {
-	return rte_eal_process_type() != RTE_PROC_PRIMARY;
+	return rte_eal_process_type() == RTE_PROC_SECONDARY;
 }
 
 /**
@@ -1336,163 +1331,6 @@ mlx5_set_link_up(struct rte_eth_dev *dev)
 }
 
 /**
- * Configure secondary process queues from a private data pointer (primary
- * or secondary) and update burst callbacks. Can take place only once.
- *
- * All queues must have been previously created by the primary process to
- * avoid undefined behavior.
- *
- * @param priv
- *   Private data pointer from either primary or secondary process.
- *
- * @return
- *   Private data pointer from secondary process, NULL in case of error.
- */
-struct priv *
-mlx5_secondary_data_setup(struct priv *priv)
-{
-	unsigned int port_id = 0;
-	struct mlx5_secondary_data *sd;
-	void **tx_queues;
-	void **rx_queues;
-	unsigned int nb_tx_queues;
-	unsigned int nb_rx_queues;
-	unsigned int i;
-
-	/* priv must be valid at this point. */
-	assert(priv != NULL);
-	/* priv->dev must also be valid but may point to local memory from
-	 * another process, possibly with the same address and must not
-	 * be dereferenced yet. */
-	assert(priv->dev != NULL);
-	/* Determine port ID by finding out where priv comes from. */
-	while (1) {
-		sd = &mlx5_secondary_data[port_id];
-		rte_spinlock_lock(&sd->lock);
-		/* Primary process? */
-		if (sd->primary_priv == priv)
-			break;
-		/* Secondary process? */
-		if (sd->data.dev_private == priv)
-			break;
-		rte_spinlock_unlock(&sd->lock);
-		if (++port_id == RTE_DIM(mlx5_secondary_data))
-			port_id = 0;
-	}
-	/* Switch to secondary private structure. If private data has already
-	 * been updated by another thread, there is nothing else to do. */
-	priv = sd->data.dev_private;
-	if (priv->dev->data == &sd->data)
-		goto end;
-	/* Sanity checks. Secondary private structure is supposed to point
-	 * to local eth_dev, itself still pointing to the shared device data
-	 * structure allocated by the primary process. */
-	assert(sd->shared_dev_data != &sd->data);
-	assert(sd->data.nb_tx_queues == 0);
-	assert(sd->data.tx_queues == NULL);
-	assert(sd->data.nb_rx_queues == 0);
-	assert(sd->data.rx_queues == NULL);
-	assert(priv != sd->primary_priv);
-	assert(priv->dev->data == sd->shared_dev_data);
-	assert(priv->txqs_n == 0);
-	assert(priv->txqs == NULL);
-	assert(priv->rxqs_n == 0);
-	assert(priv->rxqs == NULL);
-	nb_tx_queues = sd->shared_dev_data->nb_tx_queues;
-	nb_rx_queues = sd->shared_dev_data->nb_rx_queues;
-	/* Allocate local storage for queues. */
-	tx_queues = rte_zmalloc("secondary ethdev->tx_queues",
-				sizeof(sd->data.tx_queues[0]) * nb_tx_queues,
-				RTE_CACHE_LINE_SIZE);
-	rx_queues = rte_zmalloc("secondary ethdev->rx_queues",
-				sizeof(sd->data.rx_queues[0]) * nb_rx_queues,
-				RTE_CACHE_LINE_SIZE);
-	if (tx_queues == NULL || rx_queues == NULL)
-		goto error;
-	/* Lock to prevent control operations during setup. */
-	priv_lock(priv);
-	/* TX queues. */
-	for (i = 0; i != nb_tx_queues; ++i) {
-		struct txq *primary_txq = (*sd->primary_priv->txqs)[i];
-		struct txq_ctrl *primary_txq_ctrl;
-		struct txq_ctrl *txq_ctrl;
-
-		if (primary_txq == NULL)
-			continue;
-		primary_txq_ctrl = container_of(primary_txq,
-						struct txq_ctrl, txq);
-		txq_ctrl = rte_calloc_socket("TXQ", 1, sizeof(*txq_ctrl) +
-					     (1 << primary_txq->elts_n) *
-					     sizeof(struct rte_mbuf *), 0,
-					     primary_txq_ctrl->socket);
-		if (txq_ctrl != NULL) {
-			if (txq_ctrl_setup(priv->dev,
-					   txq_ctrl,
-					   1 << primary_txq->elts_n,
-					   primary_txq_ctrl->socket,
-					   NULL) == 0) {
-				txq_ctrl->txq.stats.idx =
-					primary_txq->stats.idx;
-				tx_queues[i] = &txq_ctrl->txq;
-				continue;
-			}
-			rte_free(txq_ctrl);
-		}
-		while (i) {
-			txq_ctrl = tx_queues[--i];
-			txq_cleanup(txq_ctrl);
-			rte_free(txq_ctrl);
-		}
-		goto error;
-	}
-	/* RX queues. */
-	for (i = 0; i != nb_rx_queues; ++i) {
-		struct rxq_ctrl *primary_rxq =
-			container_of((*sd->primary_priv->rxqs)[i],
-				     struct rxq_ctrl, rxq);
-
-		if (primary_rxq == NULL)
-			continue;
-		/* Not supported yet. */
-		rx_queues[i] = NULL;
-	}
-	/* Update everything. */
-	priv->txqs = (void *)tx_queues;
-	priv->txqs_n = nb_tx_queues;
-	priv->rxqs = (void *)rx_queues;
-	priv->rxqs_n = nb_rx_queues;
-	sd->data.rx_queues = rx_queues;
-	sd->data.tx_queues = tx_queues;
-	sd->data.nb_rx_queues = nb_rx_queues;
-	sd->data.nb_tx_queues = nb_tx_queues;
-	sd->data.dev_link = sd->shared_dev_data->dev_link;
-	sd->data.mtu = sd->shared_dev_data->mtu;
-	memcpy(sd->data.rx_queue_state, sd->shared_dev_data->rx_queue_state,
-	       sizeof(sd->data.rx_queue_state));
-	memcpy(sd->data.tx_queue_state, sd->shared_dev_data->tx_queue_state,
-	       sizeof(sd->data.tx_queue_state));
-	sd->data.dev_flags = sd->shared_dev_data->dev_flags;
-	/* Use local data from now on. */
-	rte_mb();
-	priv->dev->data = &sd->data;
-	rte_mb();
-	priv_select_tx_function(priv);
-	priv_select_rx_function(priv);
-	priv_unlock(priv);
-end:
-	/* More sanity checks. */
-	assert(priv->dev->data == &sd->data);
-	rte_spinlock_unlock(&sd->lock);
-	return priv;
-error:
-	priv_unlock(priv);
-	rte_free(tx_queues);
-	rte_free(rx_queues);
-	rte_spinlock_unlock(&sd->lock);
-	return NULL;
-}
-
-/**
  * Configure the TX function to use.
  *
  * @param priv
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 94fdd32..35c5cb4 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1223,47 +1223,6 @@ mlx5_rx_queue_release(void *dpdk_rxq)
 }
 
 /**
- * DPDK callback for RX in secondary processes.
- *
- * This function configures all queues from primary process information
- * if necessary before reverting to the normal RX burst callback.
- *
- * @param dpdk_rxq
- *   Generic pointer to RX queue structure.
- * @param[out] pkts
- *   Array to store received packets.
- * @param pkts_n
- *   Maximum number of packets in array.
- *
- * @return
- *   Number of packets successfully received (<= pkts_n).
- */
-uint16_t
-mlx5_rx_burst_secondary_setup(void *dpdk_rxq, struct rte_mbuf **pkts,
-			      uint16_t pkts_n)
-{
-	struct rxq *rxq = dpdk_rxq;
-	struct rxq_ctrl *rxq_ctrl = container_of(rxq, struct rxq_ctrl, rxq);
-	struct priv *priv = mlx5_secondary_data_setup(rxq_ctrl->priv);
-	struct priv *primary_priv;
-	unsigned int index;
-
-	if (priv == NULL)
-		return 0;
-	primary_priv =
-		mlx5_secondary_data[priv->dev->data->port_id].primary_priv;
-	/* Look for queue index in both private structures. */
-	for (index = 0; index != priv->rxqs_n; ++index)
-		if (((*primary_priv->rxqs)[index] == rxq) ||
-		    ((*priv->rxqs)[index] == rxq))
-			break;
-	if (index == priv->rxqs_n)
-		return 0;
-	rxq = (*priv->rxqs)[index];
-	return priv->dev->rx_pkt_burst(rxq, pkts, pkts_n);
-}
-
-/**
  * Allocate queue vector and fill epoll fd list for Rx interrupts.
  *
  * @param priv
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 0226ff9..b3b161d 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -302,7 +302,6 @@ void rxq_cleanup(struct rxq_ctrl *);
 int mlx5_rx_queue_setup(struct rte_eth_dev *, uint16_t, uint16_t, unsigned int,
 			const struct rte_eth_rxconf *, struct rte_mempool *);
 void mlx5_rx_queue_release(void *);
-uint16_t mlx5_rx_burst_secondary_setup(void *, struct rte_mbuf **, uint16_t);
 int priv_rx_intr_vec_enable(struct priv *priv);
 void priv_rx_intr_vec_disable(struct priv *priv);
 #ifdef HAVE_UPDATE_CQ_CI
@@ -318,7 +317,6 @@ int txq_ctrl_setup(struct rte_eth_dev *, struct txq_ctrl *, uint16_t,
 int mlx5_tx_queue_setup(struct rte_eth_dev *, uint16_t, uint16_t, unsigned int,
 			const struct rte_eth_txconf *);
 void mlx5_tx_queue_release(void *);
-uint16_t mlx5_tx_burst_secondary_setup(void *, struct rte_mbuf **, uint16_t);
 
 /* mlx5_rxtx.c */
 
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 45e9037..4b0b532 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -526,44 +526,3 @@ mlx5_tx_queue_release(void *dpdk_txq)
 	rte_free(txq_ctrl);
 	priv_unlock(priv);
 }
-
-/**
- * DPDK callback for TX in secondary processes.
- *
- * This function configures all queues from primary process information
- * if necessary before reverting to the normal TX burst callback.
- *
- * @param dpdk_txq
- *   Generic pointer to TX queue structure.
- * @param[in] pkts
- *   Packets to transmit.
- * @param pkts_n
- *   Number of packets in array.
- *
- * @return
- *   Number of packets successfully transmitted (<= pkts_n).
- */
-uint16_t
-mlx5_tx_burst_secondary_setup(void *dpdk_txq, struct rte_mbuf **pkts,
-			      uint16_t pkts_n)
-{
-	struct txq *txq = dpdk_txq;
-	struct txq_ctrl *txq_ctrl = container_of(txq, struct txq_ctrl, txq);
-	struct priv *priv = mlx5_secondary_data_setup(txq_ctrl->priv);
-	struct priv *primary_priv;
-	unsigned int index;
-
-	if (priv == NULL)
-		return 0;
-	primary_priv =
-		mlx5_secondary_data[priv->dev->data->port_id].primary_priv;
-	/* Look for queue index in both private structures. */
-	for (index = 0; index != priv->txqs_n; ++index)
-		if (((*primary_priv->txqs)[index] == txq) ||
-		    ((*priv->txqs)[index] == txq))
-			break;
-	if (index == priv->txqs_n)
-		return 0;
-	txq = (*priv->txqs)[index];
-	return priv->dev->tx_pkt_burst(txq, pkts, pkts_n);
-}
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 7/8] net/mlx5: remove multiple drop RSS queues
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (12 preceding siblings ...)
  2017-08-23  8:15 ` [PATCH v2 6/8] net/mlx5: fix non working secondary process by removing it Nelio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  2017-08-23  8:15 ` [PATCH v2 8/8] net/mlx5: remove old MLNX_OFED 3.3 verification Nelio Laranjeiro
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

Since MLNX_OFED 4.1 this code is no more useful.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/Makefile    |  5 ----
 drivers/net/mlx5/mlx5_flow.c | 55 ++++++++++++++------------------------------
 2 files changed, 17 insertions(+), 43 deletions(-)

diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 8736de5..14b739a 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -104,11 +104,6 @@ mlx5_autoconf.h.new: FORCE
 mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
 	$Q $(RM) -f -- '$@'
 	$Q sh -- '$<' '$@' \
-		HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP \
-		infiniband/verbs_exp.h \
-		enum IBV_EXP_FLOW_SPEC_ACTION_DROP \
-		$(AUTOCONF_OUTPUT)
-	$Q sh -- '$<' '$@' \
 		HAVE_VERBS_IBV_EXP_CQ_COMPRESSED_CQE \
 		infiniband/verbs_exp.h \
 		enum IBV_EXP_CQ_COMPRESSED_CQE \
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index d62ccff..7dd3ebb 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -52,13 +52,6 @@
 #include "mlx5.h"
 #include "mlx5_prm.h"
 
-/* Number of Work Queue necessary for the DROP queue. */
-#ifndef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
-#define MLX5_DROP_WQ_N 4
-#else
-#define MLX5_DROP_WQ_N 1
-#endif
-
 static int
 mlx5_flow_create_eth(const struct rte_flow_item *item,
 		     const void *default_mask,
@@ -290,7 +283,7 @@ struct mlx5_flow {
 struct rte_flow_drop {
 	struct ibv_exp_rwq_ind_table *ind_table; /**< Indirection table. */
 	struct ibv_qp *qp; /**< Verbs queue pair. */
-	struct ibv_exp_wq *wqs[MLX5_DROP_WQ_N]; /**< Verbs work queue. */
+	struct ibv_exp_wq *wq; /**< Verbs work queue. */
 	struct ibv_cq *cq; /**< Verbs completion queue. */
 };
 
@@ -580,10 +573,8 @@ priv_flow_validate(struct priv *priv,
 	}
 	if (action->mark && !flow->ibv_attr && !action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_tag);
-#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
 	if (!flow->ibv_attr && action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
-#endif
 	if (!action->queue && !action->drop) {
 		rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL, "no valid action");
@@ -1001,10 +992,8 @@ priv_flow_create_action_queue_drop(struct priv *priv,
 				   struct rte_flow_error *error)
 {
 	struct rte_flow *rte_flow;
-#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
 	struct ibv_exp_flow_spec_action_drop *drop;
 	unsigned int size = sizeof(struct ibv_exp_flow_spec_action_drop);
-#endif
 
 	assert(priv->pd);
 	assert(priv->ctx);
@@ -1015,7 +1004,6 @@ priv_flow_create_action_queue_drop(struct priv *priv,
 		return NULL;
 	}
 	rte_flow->drop = 1;
-#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
 	drop = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
 	*drop = (struct ibv_exp_flow_spec_action_drop){
 			.type = IBV_EXP_FLOW_SPEC_ACTION_DROP,
@@ -1023,7 +1011,6 @@ priv_flow_create_action_queue_drop(struct priv *priv,
 	};
 	++flow->ibv_attr->num_of_specs;
 	flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
-#endif
 	rte_flow->ibv_attr = flow->ibv_attr;
 	if (!priv->started)
 		return rte_flow;
@@ -1386,7 +1373,6 @@ static int
 priv_flow_create_drop_queue(struct priv *priv)
 {
 	struct rte_flow_drop *fdq = NULL;
-	unsigned int i;
 
 	assert(priv->pd);
 	assert(priv->ctx);
@@ -1403,25 +1389,23 @@ priv_flow_create_drop_queue(struct priv *priv)
 		WARN("cannot allocate CQ for drop queue");
 		goto error;
 	}
-	for (i = 0; i != MLX5_DROP_WQ_N; ++i) {
-		fdq->wqs[i] = ibv_exp_create_wq(priv->ctx,
-				&(struct ibv_exp_wq_init_attr){
-				.wq_type = IBV_EXP_WQT_RQ,
-				.max_recv_wr = 1,
-				.max_recv_sge = 1,
-				.pd = priv->pd,
-				.cq = fdq->cq,
-				});
-		if (!fdq->wqs[i]) {
-			WARN("cannot allocate WQ for drop queue");
-			goto error;
-		}
+	fdq->wq = ibv_exp_create_wq(priv->ctx,
+			&(struct ibv_exp_wq_init_attr){
+			.wq_type = IBV_EXP_WQT_RQ,
+			.max_recv_wr = 1,
+			.max_recv_sge = 1,
+			.pd = priv->pd,
+			.cq = fdq->cq,
+			});
+	if (!fdq->wq) {
+		WARN("cannot allocate WQ for drop queue");
+		goto error;
 	}
 	fdq->ind_table = ibv_exp_create_rwq_ind_table(priv->ctx,
 			&(struct ibv_exp_rwq_ind_table_init_attr){
 			.pd = priv->pd,
 			.log_ind_tbl_size = 0,
-			.ind_tbl = fdq->wqs,
+			.ind_tbl = &fdq->wq,
 			.comp_mask = 0,
 			});
 	if (!fdq->ind_table) {
@@ -1457,10 +1441,8 @@ priv_flow_create_drop_queue(struct priv *priv)
 		claim_zero(ibv_destroy_qp(fdq->qp));
 	if (fdq->ind_table)
 		claim_zero(ibv_exp_destroy_rwq_ind_table(fdq->ind_table));
-	for (i = 0; i != MLX5_DROP_WQ_N; ++i) {
-		if (fdq->wqs[i])
-			claim_zero(ibv_exp_destroy_wq(fdq->wqs[i]));
-	}
+	if (fdq->wq)
+		claim_zero(ibv_exp_destroy_wq(fdq->wq));
 	if (fdq->cq)
 		claim_zero(ibv_destroy_cq(fdq->cq));
 	if (fdq)
@@ -1479,7 +1461,6 @@ static void
 priv_flow_delete_drop_queue(struct priv *priv)
 {
 	struct rte_flow_drop *fdq = priv->flow_drop_queue;
-	unsigned int i;
 
 	if (!fdq)
 		return;
@@ -1487,10 +1468,8 @@ priv_flow_delete_drop_queue(struct priv *priv)
 		claim_zero(ibv_destroy_qp(fdq->qp));
 	if (fdq->ind_table)
 		claim_zero(ibv_exp_destroy_rwq_ind_table(fdq->ind_table));
-	for (i = 0; i != MLX5_DROP_WQ_N; ++i) {
-		if (fdq->wqs[i])
-			claim_zero(ibv_exp_destroy_wq(fdq->wqs[i]));
-	}
+	if (fdq->wq)
+		claim_zero(ibv_exp_destroy_wq(fdq->wq));
 	if (fdq->cq)
 		claim_zero(ibv_destroy_cq(fdq->cq));
 	rte_free(fdq);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 8/8] net/mlx5: remove old MLNX_OFED 3.3 verification
  2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (13 preceding siblings ...)
  2017-08-23  8:15 ` [PATCH v2 7/8] net/mlx5: remove multiple drop RSS queues Nelio Laranjeiro
@ 2017-08-23  8:15 ` Nelio Laranjeiro
  14 siblings, 0 replies; 25+ messages in thread
From: Nelio Laranjeiro @ 2017-08-23  8:15 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Shahaf Shuler

This version of MLNX_OFED is no more supported.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 2392be5..e89aba8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -63,11 +63,6 @@
 #include "mlx5_autoconf.h"
 #include "mlx5_defs.h"
 
-#if !defined(HAVE_VERBS_IBV_EXP_CQ_COMPRESSED_CQE) || \
-	!defined(HAVE_VERBS_MLX5_ETH_VLAN_INLINE_HEADER_SIZE)
-#error Mellanox OFED >= 3.3 is required, please refer to the documentation.
-#endif
-
 enum {
 	PCI_VENDOR_ID_MELLANOX = 0x15b3,
 };
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 0/8] net/mlx5: cleanups
  2017-08-23  8:15 ` [PATCH v2 0/8] " Nelio Laranjeiro
@ 2017-08-23 10:07   ` Ferruh Yigit
  0 siblings, 0 replies; 25+ messages in thread
From: Ferruh Yigit @ 2017-08-23 10:07 UTC (permalink / raw)
  To: Nelio Laranjeiro, dev; +Cc: Shahaf Shuler

On 8/23/2017 9:15 AM, Nelio Laranjeiro wrote:
> This Series make some cleanup in mlx5 PMD by removing useless code or non
> working code.
> 
> Changes in v2:
> 
>  - update mlx5 feature list to remove the multi process awareness.
> 
> Nelio Laranjeiro (8):
>   net/mlx5: avoid reusing old queue's mbuf on reconfigure
>   net/mlx5: prepare vector Rx ring at setup time
>   net/mlx5: cleanup Rx ring in free functions
>   net/mlx5: remove flow drop useless if branches
>   net/mlx5: remove pdentic pragma
>   net/mlx5: fix non working secondary process by removing it
>   net/mlx5: remove multiple drop RSS queues
>   net/mlx5: remove old MLNX_OFED 3.3 verification

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2017-08-23 10:07 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-01 12:09 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
2017-08-01 12:09 ` [PATCH 1/5] net/mlx5: remove flow drop useless if branches Nelio Laranjeiro
2017-08-01 12:09 ` [PATCH 2/5] net/mlx5: remove pdentic pragma Nelio Laranjeiro
2017-08-17 14:38   ` Ferruh Yigit
2017-08-22  9:10     ` Nélio Laranjeiro
2017-08-01 12:09 ` [PATCH 3/5] net/mlx5: fix non working secondary process by removing it Nelio Laranjeiro
2017-08-17 14:38   ` Ferruh Yigit
2017-08-22  9:08     ` Nélio Laranjeiro
2017-08-01 12:09 ` [PATCH 4/5] net/mlx5: remove multiple drop RSS queues Nelio Laranjeiro
2017-08-17 14:38   ` Ferruh Yigit
2017-08-22  8:59     ` Nélio Laranjeiro
2017-08-01 12:09 ` [PATCH 5/5] net/mlx5: remove old MLNX_OFED 3.3 verification Nelio Laranjeiro
2017-08-17 14:38   ` Ferruh Yigit
2017-08-22  8:25     ` Nélio Laranjeiro
2017-08-02 15:36 ` [PATCH 0/5] net/mlx5: cleanups Nélio Laranjeiro
2017-08-23  8:15 ` [PATCH v2 0/8] " Nelio Laranjeiro
2017-08-23 10:07   ` Ferruh Yigit
2017-08-23  8:15 ` [PATCH v2 1/8] net/mlx5: avoid reusing old queue's mbuf on reconfigure Nelio Laranjeiro
2017-08-23  8:15 ` [PATCH v2 2/8] net/mlx5: prepare vector Rx ring at setup time Nelio Laranjeiro
2017-08-23  8:15 ` [PATCH v2 3/8] net/mlx5: cleanup Rx ring in free functions Nelio Laranjeiro
2017-08-23  8:15 ` [PATCH v2 4/8] net/mlx5: remove flow drop useless if branches Nelio Laranjeiro
2017-08-23  8:15 ` [PATCH v2 5/8] net/mlx5: remove pdentic pragma Nelio Laranjeiro
2017-08-23  8:15 ` [PATCH v2 6/8] net/mlx5: fix non working secondary process by removing it Nelio Laranjeiro
2017-08-23  8:15 ` [PATCH v2 7/8] net/mlx5: remove multiple drop RSS queues Nelio Laranjeiro
2017-08-23  8:15 ` [PATCH v2 8/8] net/mlx5: remove old MLNX_OFED 3.3 verification Nelio Laranjeiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.