[v3,08/11] net/octeon_ep: update queue size checks

Message ID 20230424122835.39493-9-sedara@marvell.com (mailing list archive)
State Not Applicable, archived
Delegated to: Jerin Jacob
Headers
Series extend octeon ep driver functionality |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Sathesh B Edara April 24, 2023, 12:28 p.m. UTC
  Updates the output queue size checks to ensure
that queue is larger than backpressure watermark.
Add setting of default queue sizes to the minimum
so that applications like testpmd can be started
without explicit queue size arguments.

Signed-off-by: Sathesh Edara <sedara@marvell.com>
---
 drivers/net/octeon_ep/otx_ep_common.h |  9 +++++++--
 drivers/net/octeon_ep/otx_ep_ethdev.c | 12 ++++++++++--
 drivers/net/octeon_ep/otx_ep_rxtx.h   |  4 ++--
 3 files changed, 19 insertions(+), 6 deletions(-)
  

Patch

diff --git a/drivers/net/octeon_ep/otx_ep_common.h b/drivers/net/octeon_ep/otx_ep_common.h
index 444136923f..3582f3087b 100644
--- a/drivers/net/octeon_ep/otx_ep_common.h
+++ b/drivers/net/octeon_ep/otx_ep_common.h
@@ -11,8 +11,13 @@ 
 #define OTX_EP_MAX_RINGS_PER_VF        (8)
 #define OTX_EP_CFG_IO_QUEUES        OTX_EP_MAX_RINGS_PER_VF
 #define OTX_EP_64BYTE_INSTR         (64)
-#define OTX_EP_MIN_IQ_DESCRIPTORS   (128)
-#define OTX_EP_MIN_OQ_DESCRIPTORS   (128)
+/*
+ * Backpressure for SDP is configured on Octeon, and the minimum queue sizes
+ * must be much larger than the backpressure watermark configured in the Octeon
+ * SDP driver.  IQ and OQ backpressure configurations are separate.
+ */
+#define OTX_EP_MIN_IQ_DESCRIPTORS   (2048)
+#define OTX_EP_MIN_OQ_DESCRIPTORS   (2048)
 #define OTX_EP_MAX_IQ_DESCRIPTORS   (8192)
 #define OTX_EP_MAX_OQ_DESCRIPTORS   (8192)
 #define OTX_EP_OQ_BUF_SIZE          (2048)
diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c
index 30a7a450fb..0f710b1ffa 100644
--- a/drivers/net/octeon_ep/otx_ep_ethdev.c
+++ b/drivers/net/octeon_ep/otx_ep_ethdev.c
@@ -48,6 +48,9 @@  otx_ep_dev_info_get(struct rte_eth_dev *eth_dev,
 	devinfo->rx_desc_lim = otx_ep_rx_desc_lim;
 	devinfo->tx_desc_lim = otx_ep_tx_desc_lim;
 
+	devinfo->default_rxportconf.ring_size = OTX_EP_MIN_OQ_DESCRIPTORS;
+	devinfo->default_txportconf.ring_size = OTX_EP_MIN_IQ_DESCRIPTORS;
+
 	return 0;
 }
 
@@ -274,8 +277,8 @@  otx_ep_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t q_no,
 		return -EINVAL;
 	}
 	if (num_rx_descs < (SDP_GBL_WMARK * 8)) {
-		otx_ep_err("Invalid rx desc number should at least be greater than 8xwmark  %u\n",
-			   num_rx_descs);
+		otx_ep_err("Invalid rx desc number(%u) should at least be greater than 8xwmark  %u\n",
+			   num_rx_descs, (SDP_GBL_WMARK * 8));
 		return -EINVAL;
 	}
 
@@ -357,6 +360,11 @@  otx_ep_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t q_no,
 			   num_tx_descs);
 		return -EINVAL;
 	}
+	if (num_tx_descs < (SDP_GBL_WMARK * 8)) {
+		otx_ep_err("Invalid tx desc number(%u) should at least be greater than 8*wmark(%u)\n",
+			   num_tx_descs, (SDP_GBL_WMARK * 8));
+		return -EINVAL;
+	}
 
 	retval = otx_ep_setup_iqs(otx_epvf, q_no, num_tx_descs, socket_id);
 
diff --git a/drivers/net/octeon_ep/otx_ep_rxtx.h b/drivers/net/octeon_ep/otx_ep_rxtx.h
index 1527d350b5..7012888100 100644
--- a/drivers/net/octeon_ep/otx_ep_rxtx.h
+++ b/drivers/net/octeon_ep/otx_ep_rxtx.h
@@ -7,8 +7,8 @@ 
 
 #include <rte_byteorder.h>
 
-#define OTX_EP_RXD_ALIGN 1
-#define OTX_EP_TXD_ALIGN 1
+#define OTX_EP_RXD_ALIGN 2
+#define OTX_EP_TXD_ALIGN 2
 
 #define OTX_EP_IQ_SEND_FAILED      (-1)
 #define OTX_EP_IQ_SEND_SUCCESS     (0)