DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
	tomaszx.kulasek@intel.com, stable@dpdk.org,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH v3] net/bonding: fix dedicated queue setup failed
Date: Thu, 26 Dec 2024 09:26:18 +0800	[thread overview]
Message-ID: <20241226012618.13535-1-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20241011032412.3672788-3-chaoyong.he@corigine.com>

From: Long Wu <long.wu@corigine.com>

The bonding PMD hardcoded the value of dedicated hardware Rx/Tx
queue size as (128/512). This will cause the bonding port start
fail if some NIC requires more Rx/Tx descriptors than the hardcoded
number.

Therefore, use the minimum hardware queue size of the member port
to initialize dedicated hardware Rx/Tx queue. If obtaining the
minimum queue size failed, use the default queue size.

Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
Cc: tomaszx.kulasek@intel.com
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>

---
v3:
* Get the minimal supported queue size from PMD, rather than add an new
  API.
v2:
* Adjust some logs following the request of reviewer.
---
 drivers/net/bonding/rte_eth_bond_8023ad.h |  3 +++
 drivers/net/bonding/rte_eth_bond_pmd.c    | 25 ++++++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index 5432eafcfe..f827229671 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -35,6 +35,9 @@ extern "C" {
 #define MARKER_TLV_TYPE_INFO                0x01
 #define MARKER_TLV_TYPE_RESP                0x02
 
+#define SLOW_TX_QUEUE_HW_DEFAULT_SIZE       512
+#define SLOW_RX_QUEUE_HW_DEFAULT_SIZE       512
+
 typedef void (*rte_eth_bond_8023ad_ext_slowrx_fn)(uint16_t member_id,
 						  struct rte_mbuf *lacp_pkt);
 
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 91bf2c2345..9d72140b82 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1684,10 +1684,26 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
 	}
 
 	if (internals->mode4.dedicated_queues.enabled == 1) {
-		/* Configure slow Rx queue */
+		struct rte_eth_dev_info member_info = {};
+		uint16_t nb_rx_desc = SLOW_RX_QUEUE_HW_DEFAULT_SIZE;
+		uint16_t nb_tx_desc = SLOW_TX_QUEUE_HW_DEFAULT_SIZE;
+
+		errval = rte_eth_dev_info_get(member_eth_dev->data->port_id,
+				&member_info);
+		if (errval != 0) {
+			RTE_BOND_LOG(ERR,
+					"rte_eth_dev_info_get: port=%d, err (%d)",
+					member_eth_dev->data->port_id,
+					errval);
+			return errval;
+		}
 
+		if (member_info.rx_desc_lim.nb_min != 0)
+			nb_rx_desc = member_info.rx_desc_lim.nb_min;
+
+		/* Configure slow Rx queue */
 		errval = rte_eth_rx_queue_setup(member_eth_dev->data->port_id,
-				internals->mode4.dedicated_queues.rx_qid, 128,
+				internals->mode4.dedicated_queues.rx_qid, nb_rx_desc,
 				rte_eth_dev_socket_id(member_eth_dev->data->port_id),
 				NULL, port->slow_pool);
 		if (errval != 0) {
@@ -1699,8 +1715,11 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
 			return errval;
 		}
 
+		if (member_info.tx_desc_lim.nb_min != 0)
+			nb_tx_desc = member_info.tx_desc_lim.nb_min;
+
 		errval = rte_eth_tx_queue_setup(member_eth_dev->data->port_id,
-				internals->mode4.dedicated_queues.tx_qid, 512,
+				internals->mode4.dedicated_queues.tx_qid, nb_tx_desc,
 				rte_eth_dev_socket_id(member_eth_dev->data->port_id),
 				NULL);
 		if (errval != 0) {
-- 
2.43.5


      parent reply	other threads:[~2024-12-26  1:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24  2:03 [PATCH 0/2] add function to set dedicated queue size Chaoyong He
2024-06-24  2:03 ` [PATCH 1/2] net/bonding: standard the log message Chaoyong He
2024-10-10 18:10   ` Stephen Hemminger
2024-10-11  3:02     ` Chaoyong He
2024-06-24  2:03 ` [PATCH 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
2024-10-10 18:13   ` Stephen Hemminger
2024-10-11  3:00     ` Chaoyong He
2024-10-11  3:24 ` [PATCH v2 0/2] add function " Chaoyong He
2024-10-11  3:24   ` [PATCH v2 1/2] net/bonding: standard the log message Chaoyong He
2024-10-11  5:10     ` Stephen Hemminger
2024-10-29  1:51     ` lihuisong (C)
2024-10-11  3:24   ` [PATCH v2 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
2024-10-17 16:05     ` Thomas Monjalon
2024-10-29  1:49     ` lihuisong (C)
2024-12-03 18:39     ` Stephen Hemminger
2024-12-03 19:57     ` Stephen Hemminger
2024-12-04  6:21       ` Chaoyong He
2024-12-04 16:00         ` Stephen Hemminger
2024-12-05  2:53           ` Chaoyong He
2024-12-19  5:52             ` Chaoyong He
2024-12-25 21:22               ` Stephen Hemminger
2024-12-20  5:25     ` Stephen Hemminger
2024-12-26  1:26     ` Chaoyong He [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241226012618.13535-1-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=stable@dpdk.org \
    --cc=tomaszx.kulasek@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).