common/cnxk: fix schedule weight update

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

Fixes: 464c9f9193 ("common/cnxk: support NIX TM dynamic update")
Cc: stable@dpdk.org

Signed-off-by: Satha Rao <skoteshwar@marvell.com>
This commit is contained in:
Satha Rao 2022-10-14 11:13:10 +05:30 committed by Jerin Jacob
parent 5781638519
commit 1669a84d57
2 changed files with 41 additions and 21 deletions

View File

@ -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);

View File

@ -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;