DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <jerinj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH v3 06/13] common/cnxk: fix schedule weight update
Date: Fri, 14 Oct 2022 11:13:10 +0530	[thread overview]
Message-ID: <20221014054317.1151306-6-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20221014054317.1151306-1-ndabilpuram@marvell.com>

From: Satha Rao <skoteshwar@marvell.com>

Each TX schedule config mail box supports maximum 20 register updates.
This patch will send node weight updates in multiple mailbox when
TM created with more than 20 scheduler nodes.

Fixes: 464c9f919321 ("common/cnxk: support NIX TM dynamic update")
Cc: ndabilpuram@marvell.com

Signed-off-by: Satha Rao <skoteshwar@marvell.com>
---
 drivers/common/cnxk/roc_nix_queue.c  |  2 +-
 drivers/common/cnxk/roc_nix_tm_ops.c | 60 ++++++++++++++++++----------
 2 files changed, 41 insertions(+), 21 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c
index 368f1a52f7..7318f26b57 100644
--- a/drivers/common/cnxk/roc_nix_queue.c
+++ b/drivers/common/cnxk/roc_nix_queue.c
@@ -916,7 +916,7 @@ sqb_pool_populate(struct roc_nix *roc_nix, struct roc_nix_sq *sq)
 	nb_sqb_bufs += NIX_SQB_LIST_SPACE;
 	/* Clamp up the SQB count */
 	nb_sqb_bufs = PLT_MIN(roc_nix->max_sqb_count,
-			      PLT_MAX(NIX_DEF_SQB, nb_sqb_bufs));
+			      (uint16_t)PLT_MAX(NIX_DEF_SQB, nb_sqb_bufs));
 
 	sq->nb_sqb_bufs = nb_sqb_bufs;
 	sq->sqes_per_sqb_log2 = (uint16_t)plt_log2_u32(sqes_per_sqb);
diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c
index 7036495ad8..4bf7b1e104 100644
--- a/drivers/common/cnxk/roc_nix_tm_ops.c
+++ b/drivers/common/cnxk/roc_nix_tm_ops.c
@@ -891,19 +891,29 @@ roc_nix_tm_node_parent_update(struct roc_nix *roc_nix, uint32_t node_id,
 		TAILQ_FOREACH(sibling, list, node) {
 			if (sibling->parent != node->parent)
 				continue;
-			k += nix_tm_sw_xoff_prep(sibling, true, &req->reg[k],
-						 &req->regval[k]);
+			k += nix_tm_sw_xoff_prep(sibling, true, &req->reg[k], &req->regval[k]);
+			if (k >= MAX_REGS_PER_MBOX_MSG) {
+				req->num_regs = k;
+				rc = mbox_process(mbox);
+				if (rc)
+					return rc;
+				k = 0;
+				req = mbox_alloc_msg_nix_txschq_cfg(mbox);
+				req->lvl = node->hw_lvl;
+			}
+		}
+
+		if (k) {
+			req->num_regs = k;
+			rc = mbox_process(mbox);
+			if (rc)
+				return rc;
+			/* Update new weight for current node */
+			req = mbox_alloc_msg_nix_txschq_cfg(mbox);
 		}
-		req->num_regs = k;
-		rc = mbox_process(mbox);
-		if (rc)
-			return rc;
 
-		/* Update new weight for current node */
-		req = mbox_alloc_msg_nix_txschq_cfg(mbox);
 		req->lvl = node->hw_lvl;
-		req->num_regs =
-			nix_tm_sched_reg_prep(nix, node, req->reg, req->regval);
+		req->num_regs = nix_tm_sched_reg_prep(nix, node, req->reg, req->regval);
 		rc = mbox_process(mbox);
 		if (rc)
 			return rc;
@@ -916,19 +926,29 @@ roc_nix_tm_node_parent_update(struct roc_nix *roc_nix, uint32_t node_id,
 		TAILQ_FOREACH(sibling, list, node) {
 			if (sibling->parent != node->parent)
 				continue;
-			k += nix_tm_sw_xoff_prep(sibling, false, &req->reg[k],
-						 &req->regval[k]);
+			k += nix_tm_sw_xoff_prep(sibling, false, &req->reg[k], &req->regval[k]);
+			if (k >= MAX_REGS_PER_MBOX_MSG) {
+				req->num_regs = k;
+				rc = mbox_process(mbox);
+				if (rc)
+					return rc;
+				k = 0;
+				req = mbox_alloc_msg_nix_txschq_cfg(mbox);
+				req->lvl = node->hw_lvl;
+			}
+		}
+
+		if (k) {
+			req->num_regs = k;
+			rc = mbox_process(mbox);
+			if (rc)
+				return rc;
+			/* XON Parent node */
+			req = mbox_alloc_msg_nix_txschq_cfg(mbox);
 		}
-		req->num_regs = k;
-		rc = mbox_process(mbox);
-		if (rc)
-			return rc;
 
-		/* XON Parent node */
-		req = mbox_alloc_msg_nix_txschq_cfg(mbox);
 		req->lvl = node->parent->hw_lvl;
-		req->num_regs = nix_tm_sw_xoff_prep(node->parent, false,
-						    req->reg, req->regval);
+		req->num_regs = nix_tm_sw_xoff_prep(node->parent, false, req->reg, req->regval);
 		rc = mbox_process(mbox);
 		if (rc)
 			return rc;
-- 
2.25.1


  parent reply	other threads:[~2022-10-14  5:43 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 12:01 [PATCH 01/13] common/cnxk: set MTU size on SDP based on SoC type Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 02/13] common/cnxk: add devargs for soft expiry poll frequency Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 03/13] net/cnxk: fix later skip to include mbuf priv Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 04/13] net/cnxk: add use nixtx offset for cn10kb Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 05/13] common/cnxk: fix RQ mask config for cn10kb chip Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 06/13] common/cnxk: fix schedule weight update Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 07/13] common/cnxk: sync NIX HW info mbox structure with kernel Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 08/13] common/cnxk: revert VF root weight Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 09/13] common/cnxk: set hysteresis bit to one Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 10/13] net/cnxk: handle SA soft packet and byte expiry events Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 11/13] common/cnxk: sync mailbox for channel and bpid map Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 12/13] net/cnxk: remove unnecessary dptr update Nithin Dabilpuram
2022-10-11 12:01 ` [PATCH 13/13] net/cnxk: remove duplicate mempool debug checks Nithin Dabilpuram
2022-10-12  6:53   ` Jerin Jacob
2022-10-13 11:41 ` [PATCH v2 01/13] common/cnxk: set MTU size on SDP based on SoC type Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 02/13] common/cnxk: add devargs for soft expiry poll frequency Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 03/13] net/cnxk: fix later skip to include mbuf priv Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 04/13] net/cnxk: use NIX Tx offset for cn10kb Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 05/13] common/cnxk: fix RQ mask config for cn10kb chip Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 06/13] common/cnxk: fix schedule weight update Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 07/13] common/cnxk: sync NIX HW info mbox structure with kernel Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 08/13] common/cnxk: set hysteresis bit to one Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 09/13] net/cnxk: handle SA soft packet and byte expiry events Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 10/13] common/cnxk: sync mailbox for channel and bpid map Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 11/13] net/cnxk: remove unnecessary dptr update Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 12/13] net/cnxk: remove duplicate mempool debug checks Nithin Dabilpuram
2022-10-13 11:41   ` [PATCH v2 13/13] net/cnxk: handle hard expiry events Nithin Dabilpuram
2022-10-14  5:43 ` [PATCH v3 01/13] common/cnxk: set MTU size on SDP based on SoC type Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 02/13] common/cnxk: add devargs for soft expiry poll frequency Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 03/13] net/cnxk: fix later skip to include mbuf priv Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 04/13] net/cnxk: use NIX Tx offset for cn10kb Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 05/13] common/cnxk: fix RQ mask config for cn10kb chip Nithin Dabilpuram
2022-10-14  5:43   ` Nithin Dabilpuram [this message]
2022-10-14  5:43   ` [PATCH v3 07/13] common/cnxk: sync NIX HW info mbox structure with kernel Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 08/13] common/cnxk: set hysteresis bit to one Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 09/13] net/cnxk: handle SA soft packet and byte expiry events Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 10/13] common/cnxk: sync mailbox for channel and bpid map Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 11/13] net/cnxk: remove unnecessary dptr update Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 12/13] net/cnxk: remove duplicate mempool debug checks Nithin Dabilpuram
2022-10-14  5:43   ` [PATCH v3 13/13] net/cnxk: handle hard expiry events Nithin Dabilpuram
2022-10-18 11:04     ` Jerin Jacob

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=20221014054317.1151306-6-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.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).