DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: make vectorized Tx threshold configurable
@ 2018-10-29 23:15 Yongseok Koh
  2018-10-30  7:49 ` [dpdk-dev] [PATCH v2 0/2] " Yongseok Koh
  2018-11-01 17:20 ` [dpdk-dev] [PATCH v3 0/2] " Yongseok Koh
  0 siblings, 2 replies; 10+ messages in thread
From: Yongseok Koh @ 2018-10-29 23:15 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: dev, Yongseok Koh

Add txqs_min_vec parameter to configure the maximum number of Tx queues to
enable vectorized Tx. And its default value is set according to the
architecture and device type.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 doc/guides/nics/mlx5.rst         | 16 +++++++++++++++-
 drivers/net/mlx5/mlx5.c          | 16 ++++++++++++++++
 drivers/net/mlx5/mlx5.h          |  1 +
 drivers/net/mlx5/mlx5_defs.h     |  2 ++
 drivers/net/mlx5/mlx5_rxtx_vec.c |  2 +-
 5 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 1dc32829ff..9ed015c377 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -338,6 +338,20 @@ Run-time configuration
 
         - Set to 8 by default.
 
+- ``txqs_min_vec`` parameter [int]
+
+  Enable vectorized Tx only when the number of TX queues is less than or
+  equal to this value. Effective only when ``tx_vec_en`` is enabled.
+
+  On ConnectX-5:
+
+        - Set to 8 by default on ARMv8.
+        - Set to 4 by default otherwise.
+
+  On Bluefield
+
+        - Set to 16 by default.
+
 - ``txq_mpw_en`` parameter [int]
 
   A nonzero value enables multi-packet send (MPS) for ConnectX-4 Lx and
@@ -383,7 +397,7 @@ Run-time configuration
 - ``tx_vec_en`` parameter [int]
 
   A nonzero value enables Tx vector on ConnectX-5 and Bluefield NICs if the number of
-  global Tx queues on the port is lesser than MLX5_VPMD_MIN_TXQS.
+  global Tx queues on the port is less than ``txqs_min_vec``.
 
   This option cannot be used with certain offloads such as ``DEV_TX_OFFLOAD_TCP_TSO,
   DEV_TX_OFFLOAD_VXLAN_TNL_TSO, DEV_TX_OFFLOAD_GRE_TNL_TSO, DEV_TX_OFFLOAD_VLAN_INSERT``.
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 6fa50ba1b1..544431e68e 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -75,6 +75,12 @@
  */
 #define MLX5_TXQS_MIN_INLINE "txqs_min_inline"
 
+/*
+ * Device parameter to configure the number of TX queues threshold for
+ * enabling vectorized Tx.
+ */
+#define MLX5_TXQS_MIN_VEC "txqs_min_vec"
+
 /* Device parameter to enable multi-packet send WQEs. */
 #define MLX5_TXQ_MPW_EN "txq_mpw_en"
 
@@ -496,6 +502,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
 		config->txq_inline = tmp;
 	} else if (strcmp(MLX5_TXQS_MIN_INLINE, key) == 0) {
 		config->txqs_inline = tmp;
+	} else if (strcmp(MLX5_TXQS_MIN_VEC, key) == 0) {
+		config->txqs_vec = tmp;
 	} else if (strcmp(MLX5_TXQ_MPW_EN, key) == 0) {
 		config->mps = !!tmp;
 	} else if (strcmp(MLX5_TXQ_MPW_HDR_DSEG_EN, key) == 0) {
@@ -543,6 +551,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs)
 		MLX5_RXQS_MIN_MPRQ,
 		MLX5_TXQ_INLINE,
 		MLX5_TXQS_MIN_INLINE,
+		MLX5_TXQS_MIN_VEC,
 		MLX5_TXQ_MPW_EN,
 		MLX5_TXQ_MPW_HDR_DSEG_EN,
 		MLX5_TXQ_MAX_INLINE_LEN,
@@ -1443,6 +1452,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	};
 	/* Device speicific configuration. */
 	switch (pci_dev->id.device_id) {
+	case PCI_DEVICE_ID_MELLANOX_CONNECTX5BF:
+		dev_config.txqs_vec = MLX5_VPMD_MIN_TXQS_BLUEFIELD;
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
@@ -1450,6 +1461,11 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		dev_config.vf = 1;
 		break;
 	default:
+#if defined(RTE_ARCH_ARM64)
+		dev_config.txqs_vec = MLX5_VPMD_MIN_TXQS_ARM64;
+#else
+		dev_config.txqs_vec = MLX5_VPMD_MIN_TXQS;
+#endif
 		break;
 	}
 	for (i = 0; i != n; ++i) {
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 24a3415c8d..0b4418b80b 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -140,6 +140,7 @@ struct mlx5_dev_config {
 	unsigned int ind_table_max_size; /* Maximum indirection table size. */
 	int txq_inline; /* Maximum packet size for inlining. */
 	int txqs_inline; /* Queue number threshold for inlining. */
+	int txqs_vec; /* Queue number threshold for vectorized Tx. */
 	int inline_max_packet_sz; /* Max packet size for inlining. */
 };
 
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index f2a1679511..12b78099e1 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -62,6 +62,8 @@
 
 /* Default minimum number of Tx queues for vectorized Tx. */
 #define MLX5_VPMD_MIN_TXQS 4
+#define MLX5_VPMD_MIN_TXQS_ARM64 8
+#define MLX5_VPMD_MIN_TXQS_BLUEFIELD 16
 
 /* Threshold of buffer replenishment for vectorized Rx. */
 #define MLX5_VPMD_RXQ_RPLNSH_THRESH(n) \
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
index 1453f4ff63..340292addf 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
@@ -277,7 +277,7 @@ mlx5_check_vec_tx_support(struct rte_eth_dev *dev)
 	uint64_t offloads = dev->data->dev_conf.txmode.offloads;
 
 	if (!priv->config.tx_vec_en ||
-	    priv->txqs_n > MLX5_VPMD_MIN_TXQS ||
+	    priv->txqs_n > (unsigned int)priv->config.txqs_vec ||
 	    priv->config.mps != MLX5_MPW_ENHANCED ||
 	    offloads & ~MLX5_VEC_TX_OFFLOAD_CAP)
 		return -ENOTSUP;
-- 
2.11.0

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

* [dpdk-dev] [PATCH v2 0/2] net/mlx5: make vectorized Tx threshold configurable
  2018-10-29 23:15 [dpdk-dev] [PATCH] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
@ 2018-10-30  7:49 ` Yongseok Koh
  2018-10-30  7:49   ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: move device spawn configuration to probing Yongseok Koh
  2018-10-30  7:49   ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
  2018-11-01 17:20 ` [dpdk-dev] [PATCH v3 0/2] " Yongseok Koh
  1 sibling, 2 replies; 10+ messages in thread
From: Yongseok Koh @ 2018-10-30  7:49 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: dev, Yongseok Koh

v2:
* add "net/mlx5: move device spawn configuration to probing"
* rename txqs_min_vec to txqs_max_vec

Yongseok Koh (2):
  net/mlx5: move device spawn configuration to probing
  net/mlx5: make vectorized Tx threshold configurable

 doc/guides/nics/mlx5.rst         | 16 ++++++++-
 drivers/net/mlx5/mlx5.c          | 70 ++++++++++++++++++++++++----------------
 drivers/net/mlx5/mlx5.h          |  1 +
 drivers/net/mlx5/mlx5_defs.h     |  6 ++--
 drivers/net/mlx5/mlx5_rxtx_vec.c |  2 +-
 5 files changed, 64 insertions(+), 31 deletions(-)

-- 
2.11.0

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

* [dpdk-dev] [PATCH v2 1/2] net/mlx5: move device spawn configuration to probing
  2018-10-30  7:49 ` [dpdk-dev] [PATCH v2 0/2] " Yongseok Koh
@ 2018-10-30  7:49   ` Yongseok Koh
  2018-11-01  8:03     ` Shahaf Shuler
  2018-10-30  7:49   ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
  1 sibling, 1 reply; 10+ messages in thread
From: Yongseok Koh @ 2018-10-30  7:49 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: dev, Yongseok Koh

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 54 ++++++++++++++++++++++++-------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ec6a482a9a..6fa50ba1b1 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -704,8 +704,8 @@ mlx5_uar_init_secondary(struct rte_eth_dev *dev)
  *   Backing DPDK device.
  * @param ibv_dev
  *   Verbs device.
- * @param vf
- *   If nonzero, enable VF-specific features.
+ * @param config
+ *   Device configuration parameters
  * @param[in] switch_info
  *   Switch properties of Ethernet device.
  *
@@ -719,7 +719,7 @@ mlx5_uar_init_secondary(struct rte_eth_dev *dev)
 static struct rte_eth_dev *
 mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	       struct ibv_device *ibv_dev,
-	       int vf,
+	       struct mlx5_dev_config config,
 	       const struct mlx5_switch_info *switch_info)
 {
 	struct ibv_context *ctx;
@@ -727,24 +727,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	struct ibv_port_attr port_attr;
 	struct ibv_pd *pd = NULL;
 	struct mlx5dv_context dv_attr = { .comp_mask = 0 };
-	struct mlx5_dev_config config = {
-		.vf = !!vf,
-		.cqe_pad = 0,
-		.mps = MLX5_ARG_UNSET,
-		.tx_vec_en = 1,
-		.rx_vec_en = 1,
-		.mpw_hdr_dseg = 0,
-		.txq_inline = MLX5_ARG_UNSET,
-		.txqs_inline = MLX5_ARG_UNSET,
-		.inline_max_packet_sz = MLX5_ARG_UNSET,
-		.vf_nl_en = 1,
-		.mprq = {
-			.enabled = 0,
-			.stride_num_n = MLX5_MPRQ_STRIDE_NUM_N,
-			.max_memcpy_len = MLX5_MPRQ_MEMCPY_DEFAULT_LEN,
-			.min_rxqs_num = MLX5_MPRQ_MIN_RXQS,
-		},
-	};
 	struct rte_eth_dev *eth_dev = NULL;
 	struct priv *priv = NULL;
 	int err = 0;
@@ -1176,7 +1158,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	eth_dev->dev_ops = &mlx5_dev_ops;
 	/* Register MAC address. */
 	claim_zero(mlx5_mac_addr_add(eth_dev, &mac, 0, 0));
-	if (vf && config.vf_nl_en)
+	if (config.vf && config.vf_nl_en)
 		mlx5_nl_mac_addr_sync(eth_dev);
 	priv->tcf_context = mlx5_flow_tcf_context_create();
 	if (!priv->tcf_context) {
@@ -1345,7 +1327,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 {
 	struct ibv_device **ibv_list;
 	unsigned int n = 0;
-	int vf;
+	struct mlx5_dev_config dev_config;
 	int ret;
 
 	assert(pci_drv == &mlx5_driver);
@@ -1443,21 +1425,39 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	 */
 	if (n)
 		qsort(list, n, sizeof(*list), mlx5_dev_spawn_data_cmp);
+	/* Default configuration. */
+	dev_config = (struct mlx5_dev_config){
+		.mps = MLX5_ARG_UNSET,
+		.tx_vec_en = 1,
+		.rx_vec_en = 1,
+		.txq_inline = MLX5_ARG_UNSET,
+		.txqs_inline = MLX5_ARG_UNSET,
+		.inline_max_packet_sz = MLX5_ARG_UNSET,
+		.vf_nl_en = 1,
+		.mprq = {
+			.enabled = 0, /* Disabled by default. */
+			.stride_num_n = MLX5_MPRQ_STRIDE_NUM_N,
+			.max_memcpy_len = MLX5_MPRQ_MEMCPY_DEFAULT_LEN,
+			.min_rxqs_num = MLX5_MPRQ_MIN_RXQS,
+		},
+	};
+	/* Device speicific configuration. */
 	switch (pci_dev->id.device_id) {
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF:
-		vf = 1;
+		dev_config.vf = 1;
 		break;
 	default:
-		vf = 0;
+		break;
 	}
 	for (i = 0; i != n; ++i) {
 		uint32_t restore;
 
-		list[i].eth_dev = mlx5_dev_spawn
-			(&pci_dev->device, list[i].ibv_dev, vf, &list[i].info);
+		list[i].eth_dev = mlx5_dev_spawn(&pci_dev->device,
+						 list[i].ibv_dev, dev_config,
+						 &list[i].info);
 		if (!list[i].eth_dev) {
 			if (rte_errno != EBUSY && rte_errno != EEXIST)
 				break;
-- 
2.11.0

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

* [dpdk-dev] [PATCH v2 2/2] net/mlx5: make vectorized Tx threshold configurable
  2018-10-30  7:49 ` [dpdk-dev] [PATCH v2 0/2] " Yongseok Koh
  2018-10-30  7:49   ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: move device spawn configuration to probing Yongseok Koh
@ 2018-10-30  7:49   ` Yongseok Koh
  2018-11-01  8:03     ` Shahaf Shuler
  1 sibling, 1 reply; 10+ messages in thread
From: Yongseok Koh @ 2018-10-30  7:49 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: dev, Yongseok Koh

Add txqs_max_vec parameter to configure the maximum number of Tx queues to
enable vectorized Tx. And its default value is set according to the
architecture and device type.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 doc/guides/nics/mlx5.rst         | 16 +++++++++++++++-
 drivers/net/mlx5/mlx5.c          | 16 ++++++++++++++++
 drivers/net/mlx5/mlx5.h          |  1 +
 drivers/net/mlx5/mlx5_defs.h     |  6 ++++--
 drivers/net/mlx5/mlx5_rxtx_vec.c |  2 +-
 5 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 1dc32829ff..7379cf39b0 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -338,6 +338,20 @@ Run-time configuration
 
         - Set to 8 by default.
 
+- ``txqs_max_vec`` parameter [int]
+
+  Enable vectorized Tx only when the number of TX queues is less than or
+  equal to this value. Effective only when ``tx_vec_en`` is enabled.
+
+  On ConnectX-5:
+
+        - Set to 8 by default on ARMv8.
+        - Set to 4 by default otherwise.
+
+  On Bluefield
+
+        - Set to 16 by default.
+
 - ``txq_mpw_en`` parameter [int]
 
   A nonzero value enables multi-packet send (MPS) for ConnectX-4 Lx and
@@ -383,7 +397,7 @@ Run-time configuration
 - ``tx_vec_en`` parameter [int]
 
   A nonzero value enables Tx vector on ConnectX-5 and Bluefield NICs if the number of
-  global Tx queues on the port is lesser than MLX5_VPMD_MIN_TXQS.
+  global Tx queues on the port is less than ``txqs_max_vec``.
 
   This option cannot be used with certain offloads such as ``DEV_TX_OFFLOAD_TCP_TSO,
   DEV_TX_OFFLOAD_VXLAN_TNL_TSO, DEV_TX_OFFLOAD_GRE_TNL_TSO, DEV_TX_OFFLOAD_VLAN_INSERT``.
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 6fa50ba1b1..d575469f9b 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -75,6 +75,12 @@
  */
 #define MLX5_TXQS_MIN_INLINE "txqs_min_inline"
 
+/*
+ * Device parameter to configure the number of TX queues threshold for
+ * enabling vectorized Tx.
+ */
+#define MLX5_TXQS_MAX_VEC "txqs_max_vec"
+
 /* Device parameter to enable multi-packet send WQEs. */
 #define MLX5_TXQ_MPW_EN "txq_mpw_en"
 
@@ -496,6 +502,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
 		config->txq_inline = tmp;
 	} else if (strcmp(MLX5_TXQS_MIN_INLINE, key) == 0) {
 		config->txqs_inline = tmp;
+	} else if (strcmp(MLX5_TXQS_MAX_VEC, key) == 0) {
+		config->txqs_vec = tmp;
 	} else if (strcmp(MLX5_TXQ_MPW_EN, key) == 0) {
 		config->mps = !!tmp;
 	} else if (strcmp(MLX5_TXQ_MPW_HDR_DSEG_EN, key) == 0) {
@@ -543,6 +551,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs)
 		MLX5_RXQS_MIN_MPRQ,
 		MLX5_TXQ_INLINE,
 		MLX5_TXQS_MIN_INLINE,
+		MLX5_TXQS_MAX_VEC,
 		MLX5_TXQ_MPW_EN,
 		MLX5_TXQ_MPW_HDR_DSEG_EN,
 		MLX5_TXQ_MAX_INLINE_LEN,
@@ -1443,6 +1452,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	};
 	/* Device speicific configuration. */
 	switch (pci_dev->id.device_id) {
+	case PCI_DEVICE_ID_MELLANOX_CONNECTX5BF:
+		dev_config.txqs_vec = MLX5_VPMD_MAX_TXQS_BLUEFIELD;
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
@@ -1450,6 +1461,11 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		dev_config.vf = 1;
 		break;
 	default:
+#if defined(RTE_ARCH_ARM64)
+		dev_config.txqs_vec = MLX5_VPMD_MAX_TXQS_ARM64;
+#else
+		dev_config.txqs_vec = MLX5_VPMD_MAX_TXQS;
+#endif
 		break;
 	}
 	for (i = 0; i != n; ++i) {
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 24a3415c8d..0b4418b80b 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -140,6 +140,7 @@ struct mlx5_dev_config {
 	unsigned int ind_table_max_size; /* Maximum indirection table size. */
 	int txq_inline; /* Maximum packet size for inlining. */
 	int txqs_inline; /* Queue number threshold for inlining. */
+	int txqs_vec; /* Queue number threshold for vectorized Tx. */
 	int inline_max_packet_sz; /* Max packet size for inlining. */
 };
 
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index f2a1679511..221ca188bb 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -60,8 +60,10 @@
 /* Maximum Packet headers size (L2+L3+L4) for TSO. */
 #define MLX5_MAX_TSO_HEADER 192
 
-/* Default minimum number of Tx queues for vectorized Tx. */
-#define MLX5_VPMD_MIN_TXQS 4
+/* Default maximum number of Tx queues for vectorized Tx. */
+#define MLX5_VPMD_MAX_TXQS 4
+#define MLX5_VPMD_MAX_TXQS_ARM64 8
+#define MLX5_VPMD_MAX_TXQS_BLUEFIELD 16
 
 /* Threshold of buffer replenishment for vectorized Rx. */
 #define MLX5_VPMD_RXQ_RPLNSH_THRESH(n) \
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
index 1453f4ff63..340292addf 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
@@ -277,7 +277,7 @@ mlx5_check_vec_tx_support(struct rte_eth_dev *dev)
 	uint64_t offloads = dev->data->dev_conf.txmode.offloads;
 
 	if (!priv->config.tx_vec_en ||
-	    priv->txqs_n > MLX5_VPMD_MIN_TXQS ||
+	    priv->txqs_n > (unsigned int)priv->config.txqs_vec ||
 	    priv->config.mps != MLX5_MPW_ENHANCED ||
 	    offloads & ~MLX5_VEC_TX_OFFLOAD_CAP)
 		return -ENOTSUP;
-- 
2.11.0

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

* Re: [dpdk-dev] [PATCH v2 1/2] net/mlx5: move device spawn configuration to probing
  2018-10-30  7:49   ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: move device spawn configuration to probing Yongseok Koh
@ 2018-11-01  8:03     ` Shahaf Shuler
  0 siblings, 0 replies; 10+ messages in thread
From: Shahaf Shuler @ 2018-11-01  8:03 UTC (permalink / raw)
  To: Yongseok Koh; +Cc: dev

Hi Koh, 

Since I have comment on the other patch small nit. 

Tuesday, October 30, 2018 9:49 AM, Yongseok Koh:
> Subject: [PATCH v2 1/2] net/mlx5: move device spawn configuration to
> probing
> 

Probably you need to add log about the motivation for this change. 

> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5.c | 54 ++++++++++++++++++++++++-------------------
> ------
>  1 file changed, 27 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> ec6a482a9a..6fa50ba1b1 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -704,8 +704,8 @@ mlx5_uar_init_secondary(struct rte_eth_dev *dev)
>   *   Backing DPDK device.
>   * @param ibv_dev
>   *   Verbs device.
> - * @param vf
> - *   If nonzero, enable VF-specific features.
> + * @param config
> + *   Device configuration parameters

Missing period. 

>   * @param[in] switch_info
>   *   Switch properties of Ethernet device.
>   *
> @@ -719,7 +719,7 @@ mlx5_uar_init_secondary(struct rte_eth_dev *dev)
> static struct rte_eth_dev *  mlx5_dev_spawn(struct rte_device *dpdk_dev,
>  	       struct ibv_device *ibv_dev,
> -	       int vf,
> +	       struct mlx5_dev_config config,
>  	       const struct mlx5_switch_info *switch_info)  {
>  	struct ibv_context *ctx;
> @@ -727,24 +727,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
>  	struct ibv_port_attr port_attr;
>  	struct ibv_pd *pd = NULL;
>  	struct mlx5dv_context dv_attr = { .comp_mask = 0 };
> -	struct mlx5_dev_config config = {
> -		.vf = !!vf,
> -		.cqe_pad = 0,
> -		.mps = MLX5_ARG_UNSET,
> -		.tx_vec_en = 1,
> -		.rx_vec_en = 1,
> -		.mpw_hdr_dseg = 0,
> -		.txq_inline = MLX5_ARG_UNSET,
> -		.txqs_inline = MLX5_ARG_UNSET,
> -		.inline_max_packet_sz = MLX5_ARG_UNSET,
> -		.vf_nl_en = 1,
> -		.mprq = {
> -			.enabled = 0,
> -			.stride_num_n = MLX5_MPRQ_STRIDE_NUM_N,
> -			.max_memcpy_len =
> MLX5_MPRQ_MEMCPY_DEFAULT_LEN,
> -			.min_rxqs_num = MLX5_MPRQ_MIN_RXQS,
> -		},
> -	};
>  	struct rte_eth_dev *eth_dev = NULL;
>  	struct priv *priv = NULL;
>  	int err = 0;
> @@ -1176,7 +1158,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
>  	eth_dev->dev_ops = &mlx5_dev_ops;
>  	/* Register MAC address. */
>  	claim_zero(mlx5_mac_addr_add(eth_dev, &mac, 0, 0));
> -	if (vf && config.vf_nl_en)
> +	if (config.vf && config.vf_nl_en)
>  		mlx5_nl_mac_addr_sync(eth_dev);
>  	priv->tcf_context = mlx5_flow_tcf_context_create();
>  	if (!priv->tcf_context) {
> @@ -1345,7 +1327,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv
> __rte_unused,  {
>  	struct ibv_device **ibv_list;
>  	unsigned int n = 0;
> -	int vf;
> +	struct mlx5_dev_config dev_config;
>  	int ret;
> 
>  	assert(pci_drv == &mlx5_driver);
> @@ -1443,21 +1425,39 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv
> __rte_unused,
>  	 */
>  	if (n)
>  		qsort(list, n, sizeof(*list), mlx5_dev_spawn_data_cmp);
> +	/* Default configuration. */
> +	dev_config = (struct mlx5_dev_config){
> +		.mps = MLX5_ARG_UNSET,
> +		.tx_vec_en = 1,
> +		.rx_vec_en = 1,
> +		.txq_inline = MLX5_ARG_UNSET,
> +		.txqs_inline = MLX5_ARG_UNSET,
> +		.inline_max_packet_sz = MLX5_ARG_UNSET,
> +		.vf_nl_en = 1,
> +		.mprq = {
> +			.enabled = 0, /* Disabled by default. */
> +			.stride_num_n = MLX5_MPRQ_STRIDE_NUM_N,
> +			.max_memcpy_len =
> MLX5_MPRQ_MEMCPY_DEFAULT_LEN,
> +			.min_rxqs_num = MLX5_MPRQ_MIN_RXQS,
> +		},
> +	};
> +	/* Device speicific configuration. */
>  	switch (pci_dev->id.device_id) {
>  	case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:
>  	case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF:
>  	case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
>  	case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF:
> -		vf = 1;
> +		dev_config.vf = 1;
>  		break;
>  	default:
> -		vf = 0;
> +		break;
>  	}
>  	for (i = 0; i != n; ++i) {
>  		uint32_t restore;
> 
> -		list[i].eth_dev = mlx5_dev_spawn
> -			(&pci_dev->device, list[i].ibv_dev, vf, &list[i].info);
> +		list[i].eth_dev = mlx5_dev_spawn(&pci_dev->device,
> +						 list[i].ibv_dev, dev_config,
> +						 &list[i].info);
>  		if (!list[i].eth_dev) {
>  			if (rte_errno != EBUSY && rte_errno != EEXIST)
>  				break;
> --
> 2.11.0

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

* Re: [dpdk-dev] [PATCH v2 2/2] net/mlx5: make vectorized Tx threshold configurable
  2018-10-30  7:49   ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
@ 2018-11-01  8:03     ` Shahaf Shuler
  0 siblings, 0 replies; 10+ messages in thread
From: Shahaf Shuler @ 2018-11-01  8:03 UTC (permalink / raw)
  To: Yongseok Koh; +Cc: dev

Tuesday, October 30, 2018 9:49 AM, Yongseok Koh:
> Subject: [PATCH v2 2/2] net/mlx5: make vectorized Tx threshold configurable
> 
> Add txqs_max_vec parameter to configure the maximum number of Tx
> queues to enable vectorized Tx. And its default value is set according to the
> architecture and device type.
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> ---
>  doc/guides/nics/mlx5.rst         | 16 +++++++++++++++-
>  drivers/net/mlx5/mlx5.c          | 16 ++++++++++++++++
>  drivers/net/mlx5/mlx5.h          |  1 +
>  drivers/net/mlx5/mlx5_defs.h     |  6 ++++--
>  drivers/net/mlx5/mlx5_rxtx_vec.c |  2 +-
>  5 files changed, 37 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index
> 1dc32829ff..7379cf39b0 100644
> --- a/doc/guides/nics/mlx5.rst
> +++ b/doc/guides/nics/mlx5.rst
> @@ -338,6 +338,20 @@ Run-time configuration
> 
>          - Set to 8 by default.
> 
> +- ``txqs_max_vec`` parameter [int]
> +
> +  Enable vectorized Tx only when the number of TX queues is less than
> + or  equal to this value. Effective only when ``tx_vec_en`` is enabled.
> +
> +  On ConnectX-5:
> +
> +        - Set to 8 by default on ARMv8.
> +        - Set to 4 by default otherwise.
> +
> +  On Bluefield
> +
> +        - Set to 16 by default.
> +
>  - ``txq_mpw_en`` parameter [int]
> 
>    A nonzero value enables multi-packet send (MPS) for ConnectX-4 Lx and
> @@ -383,7 +397,7 @@ Run-time configuration
>  - ``tx_vec_en`` parameter [int]
> 
>    A nonzero value enables Tx vector on ConnectX-5 and Bluefield NICs if the
> number of
> -  global Tx queues on the port is lesser than MLX5_VPMD_MIN_TXQS.
> +  global Tx queues on the port is less than ``txqs_max_vec``.
> 
>    This option cannot be used with certain offloads such as
> ``DEV_TX_OFFLOAD_TCP_TSO,
>    DEV_TX_OFFLOAD_VXLAN_TNL_TSO, DEV_TX_OFFLOAD_GRE_TNL_TSO,
> DEV_TX_OFFLOAD_VLAN_INSERT``.
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> 6fa50ba1b1..d575469f9b 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -75,6 +75,12 @@
>   */
>  #define MLX5_TXQS_MIN_INLINE "txqs_min_inline"
> 
> +/*
> + * Device parameter to configure the number of TX queues threshold for
> + * enabling vectorized Tx.
> + */
> +#define MLX5_TXQS_MAX_VEC "txqs_max_vec"
> +
>  /* Device parameter to enable multi-packet send WQEs. */  #define
> MLX5_TXQ_MPW_EN "txq_mpw_en"
> 
> @@ -496,6 +502,8 @@ mlx5_args_check(const char *key, const char *val,
> void *opaque)
>  		config->txq_inline = tmp;
>  	} else if (strcmp(MLX5_TXQS_MIN_INLINE, key) == 0) {
>  		config->txqs_inline = tmp;
> +	} else if (strcmp(MLX5_TXQS_MAX_VEC, key) == 0) {
> +		config->txqs_vec = tmp;
>  	} else if (strcmp(MLX5_TXQ_MPW_EN, key) == 0) {
>  		config->mps = !!tmp;
>  	} else if (strcmp(MLX5_TXQ_MPW_HDR_DSEG_EN, key) == 0) { @@ -
> 543,6 +551,7 @@ mlx5_args(struct mlx5_dev_config *config, struct
> rte_devargs *devargs)
>  		MLX5_RXQS_MIN_MPRQ,
>  		MLX5_TXQ_INLINE,
>  		MLX5_TXQS_MIN_INLINE,
> +		MLX5_TXQS_MAX_VEC,
>  		MLX5_TXQ_MPW_EN,
>  		MLX5_TXQ_MPW_HDR_DSEG_EN,
>  		MLX5_TXQ_MAX_INLINE_LEN,
> @@ -1443,6 +1452,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv
> __rte_unused,
>  	};
>  	/* Device speicific configuration. */
>  	switch (pci_dev->id.device_id) {
> +	case PCI_DEVICE_ID_MELLANOX_CONNECTX5BF:
> +		dev_config.txqs_vec =
> MLX5_VPMD_MAX_TXQS_BLUEFIELD;

Missing break? 

>  	case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:
>  	case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF:
>  	case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:

What about all the VFs? They don't have a default value, will it lead the vec code not to be used for VFs at all?
I think VFs decision should be like the PF. If the Arch is ARMv8 then 8 otherwise 4. 
Pay attention PCI_DEVICE_ID_MELLANOX_CONNECTX5BFVF is missing, and its default value should be like above phrase, because the VF port is not on the SoC rather on the host side. 


> @@ -1450,6 +1461,11 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv
> __rte_unused,
>  		dev_config.vf = 1;
>  		break;
>  	default:
> +#if defined(RTE_ARCH_ARM64)
> +		dev_config.txqs_vec = MLX5_VPMD_MAX_TXQS_ARM64;
> #else
> +		dev_config.txqs_vec = MLX5_VPMD_MAX_TXQS; #endif
>  		break;
>  	}
>  	for (i = 0; i != n; ++i) {
> diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index
> 24a3415c8d..0b4418b80b 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -140,6 +140,7 @@ struct mlx5_dev_config {
>  	unsigned int ind_table_max_size; /* Maximum indirection table size.
> */
>  	int txq_inline; /* Maximum packet size for inlining. */
>  	int txqs_inline; /* Queue number threshold for inlining. */
> +	int txqs_vec; /* Queue number threshold for vectorized Tx. */
>  	int inline_max_packet_sz; /* Max packet size for inlining. */  };
> 
> diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
> index f2a1679511..221ca188bb 100644
> --- a/drivers/net/mlx5/mlx5_defs.h
> +++ b/drivers/net/mlx5/mlx5_defs.h
> @@ -60,8 +60,10 @@
>  /* Maximum Packet headers size (L2+L3+L4) for TSO. */  #define
> MLX5_MAX_TSO_HEADER 192
> 
> -/* Default minimum number of Tx queues for vectorized Tx. */ -#define
> MLX5_VPMD_MIN_TXQS 4
> +/* Default maximum number of Tx queues for vectorized Tx. */ #define
> +MLX5_VPMD_MAX_TXQS 4 #define MLX5_VPMD_MAX_TXQS_ARM64 8
> #define
> +MLX5_VPMD_MAX_TXQS_BLUEFIELD 16
> 
>  /* Threshold of buffer replenishment for vectorized Rx. */  #define
> MLX5_VPMD_RXQ_RPLNSH_THRESH(n) \ diff --git
> a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
> index 1453f4ff63..340292addf 100644
> --- a/drivers/net/mlx5/mlx5_rxtx_vec.c
> +++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
> @@ -277,7 +277,7 @@ mlx5_check_vec_tx_support(struct rte_eth_dev
> *dev)
>  	uint64_t offloads = dev->data->dev_conf.txmode.offloads;
> 
>  	if (!priv->config.tx_vec_en ||
> -	    priv->txqs_n > MLX5_VPMD_MIN_TXQS ||
> +	    priv->txqs_n > (unsigned int)priv->config.txqs_vec ||
>  	    priv->config.mps != MLX5_MPW_ENHANCED ||
>  	    offloads & ~MLX5_VEC_TX_OFFLOAD_CAP)
>  		return -ENOTSUP;
> --
> 2.11.0

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

* [dpdk-dev] [PATCH v3 0/2] net/mlx5: make vectorized Tx threshold configurable
  2018-10-29 23:15 [dpdk-dev] [PATCH] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
  2018-10-30  7:49 ` [dpdk-dev] [PATCH v2 0/2] " Yongseok Koh
@ 2018-11-01 17:20 ` Yongseok Koh
  2018-11-01 17:20   ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: move device spawn configuration to probing Yongseok Koh
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Yongseok Koh @ 2018-11-01 17:20 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: dev, Yongseok Koh

v3:
* retouch commit log
* fix logical error in switch-case
* Make MLX5_VPMD_MAX_TXQS architecture dependent by removing
  MLX5_VPMD_MAX_TXQS_ARM64

v2:
* add "net/mlx5: move device spawn configuration to probing"
* rename txqs_min_vec to txqs_max_vec

Yongseok Koh (2):
  net/mlx5: move device spawn configuration to probing
  net/mlx5: make vectorized Tx threshold configurable

 doc/guides/nics/mlx5.rst         | 16 ++++++++-
 drivers/net/mlx5/mlx5.c          | 70 ++++++++++++++++++++++++----------------
 drivers/net/mlx5/mlx5.h          |  1 +
 drivers/net/mlx5/mlx5_defs.h     |  9 ++++--
 drivers/net/mlx5/mlx5_rxtx_vec.c |  2 +-
 5 files changed, 67 insertions(+), 31 deletions(-)

-- 
2.11.0

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

* [dpdk-dev] [PATCH v3 1/2] net/mlx5: move device spawn configuration to probing
  2018-11-01 17:20 ` [dpdk-dev] [PATCH v3 0/2] " Yongseok Koh
@ 2018-11-01 17:20   ` Yongseok Koh
  2018-11-01 17:20   ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
  2018-11-04  6:48   ` [dpdk-dev] [PATCH v3 0/2] " Shahaf Shuler
  2 siblings, 0 replies; 10+ messages in thread
From: Yongseok Koh @ 2018-11-01 17:20 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: dev, Yongseok Koh

When a device is spawned, it does make more sense that the configuration
parameters are passed by callee. Furthermore, setting default value for
some configuration would need PCIe device ID which can be found in the
probe function.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 54 ++++++++++++++++++++++++-------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ec6a482a9a..629f03da99 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -704,8 +704,8 @@ mlx5_uar_init_secondary(struct rte_eth_dev *dev)
  *   Backing DPDK device.
  * @param ibv_dev
  *   Verbs device.
- * @param vf
- *   If nonzero, enable VF-specific features.
+ * @param config
+ *   Device configuration parameters.
  * @param[in] switch_info
  *   Switch properties of Ethernet device.
  *
@@ -719,7 +719,7 @@ mlx5_uar_init_secondary(struct rte_eth_dev *dev)
 static struct rte_eth_dev *
 mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	       struct ibv_device *ibv_dev,
-	       int vf,
+	       struct mlx5_dev_config config,
 	       const struct mlx5_switch_info *switch_info)
 {
 	struct ibv_context *ctx;
@@ -727,24 +727,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	struct ibv_port_attr port_attr;
 	struct ibv_pd *pd = NULL;
 	struct mlx5dv_context dv_attr = { .comp_mask = 0 };
-	struct mlx5_dev_config config = {
-		.vf = !!vf,
-		.cqe_pad = 0,
-		.mps = MLX5_ARG_UNSET,
-		.tx_vec_en = 1,
-		.rx_vec_en = 1,
-		.mpw_hdr_dseg = 0,
-		.txq_inline = MLX5_ARG_UNSET,
-		.txqs_inline = MLX5_ARG_UNSET,
-		.inline_max_packet_sz = MLX5_ARG_UNSET,
-		.vf_nl_en = 1,
-		.mprq = {
-			.enabled = 0,
-			.stride_num_n = MLX5_MPRQ_STRIDE_NUM_N,
-			.max_memcpy_len = MLX5_MPRQ_MEMCPY_DEFAULT_LEN,
-			.min_rxqs_num = MLX5_MPRQ_MIN_RXQS,
-		},
-	};
 	struct rte_eth_dev *eth_dev = NULL;
 	struct priv *priv = NULL;
 	int err = 0;
@@ -1176,7 +1158,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	eth_dev->dev_ops = &mlx5_dev_ops;
 	/* Register MAC address. */
 	claim_zero(mlx5_mac_addr_add(eth_dev, &mac, 0, 0));
-	if (vf && config.vf_nl_en)
+	if (config.vf && config.vf_nl_en)
 		mlx5_nl_mac_addr_sync(eth_dev);
 	priv->tcf_context = mlx5_flow_tcf_context_create();
 	if (!priv->tcf_context) {
@@ -1345,7 +1327,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 {
 	struct ibv_device **ibv_list;
 	unsigned int n = 0;
-	int vf;
+	struct mlx5_dev_config dev_config;
 	int ret;
 
 	assert(pci_drv == &mlx5_driver);
@@ -1443,21 +1425,39 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	 */
 	if (n)
 		qsort(list, n, sizeof(*list), mlx5_dev_spawn_data_cmp);
+	/* Default configuration. */
+	dev_config = (struct mlx5_dev_config){
+		.mps = MLX5_ARG_UNSET,
+		.tx_vec_en = 1,
+		.rx_vec_en = 1,
+		.txq_inline = MLX5_ARG_UNSET,
+		.txqs_inline = MLX5_ARG_UNSET,
+		.inline_max_packet_sz = MLX5_ARG_UNSET,
+		.vf_nl_en = 1,
+		.mprq = {
+			.enabled = 0, /* Disabled by default. */
+			.stride_num_n = MLX5_MPRQ_STRIDE_NUM_N,
+			.max_memcpy_len = MLX5_MPRQ_MEMCPY_DEFAULT_LEN,
+			.min_rxqs_num = MLX5_MPRQ_MIN_RXQS,
+		},
+	};
+	/* Device speicific configuration. */
 	switch (pci_dev->id.device_id) {
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF:
-		vf = 1;
+		dev_config.vf = 1;
 		break;
 	default:
-		vf = 0;
+		break;
 	}
 	for (i = 0; i != n; ++i) {
 		uint32_t restore;
 
-		list[i].eth_dev = mlx5_dev_spawn
-			(&pci_dev->device, list[i].ibv_dev, vf, &list[i].info);
+		list[i].eth_dev = mlx5_dev_spawn(&pci_dev->device,
+						 list[i].ibv_dev, dev_config,
+						 &list[i].info);
 		if (!list[i].eth_dev) {
 			if (rte_errno != EBUSY && rte_errno != EEXIST)
 				break;
-- 
2.11.0

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

* [dpdk-dev] [PATCH v3 2/2] net/mlx5: make vectorized Tx threshold configurable
  2018-11-01 17:20 ` [dpdk-dev] [PATCH v3 0/2] " Yongseok Koh
  2018-11-01 17:20   ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: move device spawn configuration to probing Yongseok Koh
@ 2018-11-01 17:20   ` Yongseok Koh
  2018-11-04  6:48   ` [dpdk-dev] [PATCH v3 0/2] " Shahaf Shuler
  2 siblings, 0 replies; 10+ messages in thread
From: Yongseok Koh @ 2018-11-01 17:20 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: dev, Yongseok Koh

Add txqs_max_vec parameter to configure the maximum number of Tx queues to
enable vectorized Tx. And its default value is set according to the
architecture and device type.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 doc/guides/nics/mlx5.rst         | 16 +++++++++++++++-
 drivers/net/mlx5/mlx5.c          | 16 ++++++++++++++++
 drivers/net/mlx5/mlx5.h          |  1 +
 drivers/net/mlx5/mlx5_defs.h     |  9 +++++++--
 drivers/net/mlx5/mlx5_rxtx_vec.c |  2 +-
 5 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 1dc32829ff..7379cf39b0 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -338,6 +338,20 @@ Run-time configuration
 
         - Set to 8 by default.
 
+- ``txqs_max_vec`` parameter [int]
+
+  Enable vectorized Tx only when the number of TX queues is less than or
+  equal to this value. Effective only when ``tx_vec_en`` is enabled.
+
+  On ConnectX-5:
+
+        - Set to 8 by default on ARMv8.
+        - Set to 4 by default otherwise.
+
+  On Bluefield
+
+        - Set to 16 by default.
+
 - ``txq_mpw_en`` parameter [int]
 
   A nonzero value enables multi-packet send (MPS) for ConnectX-4 Lx and
@@ -383,7 +397,7 @@ Run-time configuration
 - ``tx_vec_en`` parameter [int]
 
   A nonzero value enables Tx vector on ConnectX-5 and Bluefield NICs if the number of
-  global Tx queues on the port is lesser than MLX5_VPMD_MIN_TXQS.
+  global Tx queues on the port is less than ``txqs_max_vec``.
 
   This option cannot be used with certain offloads such as ``DEV_TX_OFFLOAD_TCP_TSO,
   DEV_TX_OFFLOAD_VXLAN_TNL_TSO, DEV_TX_OFFLOAD_GRE_TNL_TSO, DEV_TX_OFFLOAD_VLAN_INSERT``.
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 629f03da99..62ac54f933 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -75,6 +75,12 @@
  */
 #define MLX5_TXQS_MIN_INLINE "txqs_min_inline"
 
+/*
+ * Device parameter to configure the number of TX queues threshold for
+ * enabling vectorized Tx.
+ */
+#define MLX5_TXQS_MAX_VEC "txqs_max_vec"
+
 /* Device parameter to enable multi-packet send WQEs. */
 #define MLX5_TXQ_MPW_EN "txq_mpw_en"
 
@@ -496,6 +502,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
 		config->txq_inline = tmp;
 	} else if (strcmp(MLX5_TXQS_MIN_INLINE, key) == 0) {
 		config->txqs_inline = tmp;
+	} else if (strcmp(MLX5_TXQS_MAX_VEC, key) == 0) {
+		config->txqs_vec = tmp;
 	} else if (strcmp(MLX5_TXQ_MPW_EN, key) == 0) {
 		config->mps = !!tmp;
 	} else if (strcmp(MLX5_TXQ_MPW_HDR_DSEG_EN, key) == 0) {
@@ -543,6 +551,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs)
 		MLX5_RXQS_MIN_MPRQ,
 		MLX5_TXQ_INLINE,
 		MLX5_TXQS_MIN_INLINE,
+		MLX5_TXQS_MAX_VEC,
 		MLX5_TXQ_MPW_EN,
 		MLX5_TXQ_MPW_HDR_DSEG_EN,
 		MLX5_TXQ_MAX_INLINE_LEN,
@@ -1432,6 +1441,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		.rx_vec_en = 1,
 		.txq_inline = MLX5_ARG_UNSET,
 		.txqs_inline = MLX5_ARG_UNSET,
+		.txqs_vec = MLX5_ARG_UNSET,
 		.inline_max_packet_sz = MLX5_ARG_UNSET,
 		.vf_nl_en = 1,
 		.mprq = {
@@ -1443,6 +1453,9 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	};
 	/* Device speicific configuration. */
 	switch (pci_dev->id.device_id) {
+	case PCI_DEVICE_ID_MELLANOX_CONNECTX5BF:
+		dev_config.txqs_vec = MLX5_VPMD_MAX_TXQS_BLUEFIELD;
+		break;
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF:
 	case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
@@ -1452,6 +1465,9 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	default:
 		break;
 	}
+	/* Set architecture-dependent default value if unset. */
+	if (dev_config.txqs_vec == MLX5_ARG_UNSET)
+		dev_config.txqs_vec = MLX5_VPMD_MAX_TXQS;
 	for (i = 0; i != n; ++i) {
 		uint32_t restore;
 
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 74d11c0904..bc500b2bc3 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -140,6 +140,7 @@ struct mlx5_dev_config {
 	unsigned int ind_table_max_size; /* Maximum indirection table size. */
 	int txq_inline; /* Maximum packet size for inlining. */
 	int txqs_inline; /* Queue number threshold for inlining. */
+	int txqs_vec; /* Queue number threshold for vectorized Tx. */
 	int inline_max_packet_sz; /* Max packet size for inlining. */
 };
 
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index f2a1679511..bfe6655800 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -60,8 +60,13 @@
 /* Maximum Packet headers size (L2+L3+L4) for TSO. */
 #define MLX5_MAX_TSO_HEADER 192
 
-/* Default minimum number of Tx queues for vectorized Tx. */
-#define MLX5_VPMD_MIN_TXQS 4
+/* Default maximum number of Tx queues for vectorized Tx. */
+#if defined(RTE_ARCH_ARM64)
+#define MLX5_VPMD_MAX_TXQS 8
+#else
+#define MLX5_VPMD_MAX_TXQS 4
+#endif
+#define MLX5_VPMD_MAX_TXQS_BLUEFIELD 16
 
 /* Threshold of buffer replenishment for vectorized Rx. */
 #define MLX5_VPMD_RXQ_RPLNSH_THRESH(n) \
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
index 1453f4ff63..340292addf 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
@@ -277,7 +277,7 @@ mlx5_check_vec_tx_support(struct rte_eth_dev *dev)
 	uint64_t offloads = dev->data->dev_conf.txmode.offloads;
 
 	if (!priv->config.tx_vec_en ||
-	    priv->txqs_n > MLX5_VPMD_MIN_TXQS ||
+	    priv->txqs_n > (unsigned int)priv->config.txqs_vec ||
 	    priv->config.mps != MLX5_MPW_ENHANCED ||
 	    offloads & ~MLX5_VEC_TX_OFFLOAD_CAP)
 		return -ENOTSUP;
-- 
2.11.0

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

* Re: [dpdk-dev] [PATCH v3 0/2] net/mlx5: make vectorized Tx threshold configurable
  2018-11-01 17:20 ` [dpdk-dev] [PATCH v3 0/2] " Yongseok Koh
  2018-11-01 17:20   ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: move device spawn configuration to probing Yongseok Koh
  2018-11-01 17:20   ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
@ 2018-11-04  6:48   ` Shahaf Shuler
  2 siblings, 0 replies; 10+ messages in thread
From: Shahaf Shuler @ 2018-11-04  6:48 UTC (permalink / raw)
  To: Yongseok Koh; +Cc: dev

Thursday, November 1, 2018 7:21 PM, Yongseok Koh:
> Subject: [PATCH v3 0/2] net/mlx5: make vectorized Tx threshold configurable
> 

Series applied to next-net-mlx, thanks. 

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

end of thread, other threads:[~2018-11-04  6:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 23:15 [dpdk-dev] [PATCH] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
2018-10-30  7:49 ` [dpdk-dev] [PATCH v2 0/2] " Yongseok Koh
2018-10-30  7:49   ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: move device spawn configuration to probing Yongseok Koh
2018-11-01  8:03     ` Shahaf Shuler
2018-10-30  7:49   ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
2018-11-01  8:03     ` Shahaf Shuler
2018-11-01 17:20 ` [dpdk-dev] [PATCH v3 0/2] " Yongseok Koh
2018-11-01 17:20   ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: move device spawn configuration to probing Yongseok Koh
2018-11-01 17:20   ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: make vectorized Tx threshold configurable Yongseok Koh
2018-11-04  6:48   ` [dpdk-dev] [PATCH v3 0/2] " Shahaf Shuler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).