Re: [net-next Patch V4 3/4] octeontx2-pf: Refactor schedular queue alloc/free calls

From: Simon Horman
Date: Fri Feb 10 2023 - 10:07:21 EST


On Fri, Feb 10, 2023 at 04:40:50PM +0530, Hariprasad Kelam wrote:
> Multiple transmit scheduler queues can be configured at different
> levels to support traffic shaping and scheduling. But on txschq free
> requests, the transmit schedular config in hardware is not getting
> reset. This patch adds support to reset the stale config.
>
> The txschq alloc response handler updates the default txschq
> array which is used to configure the transmit packet path from
> SMQ to TL2 levels. However, for new features such as QoS offload
> that requires it's own txschq queues, this handler is still
> invoked and results in undefined behavior. The code now handles
> txschq response in the mbox caller function.
>
> Signed-off-by: Hariprasad Kelam <hkelam@xxxxxxxxxxx>
> Signed-off-by: Naveen Mamindlapalli <naveenm@xxxxxxxxxxx>
> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@xxxxxxxxxxx>
> ---
> .../ethernet/marvell/octeontx2/af/rvu_nix.c | 45 +++++++++++++++++++
> .../marvell/octeontx2/nic/otx2_common.c | 36 ++++++++-------
> .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 4 --
> .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 4 --
> 4 files changed, 64 insertions(+), 25 deletions(-)

...

> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> index 73c8d36b6e12..4cb3fab8baae 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> @@ -716,7 +716,8 @@ EXPORT_SYMBOL(otx2_smq_flush);
> int otx2_txsch_alloc(struct otx2_nic *pfvf)
> {
> struct nix_txsch_alloc_req *req;
> - int lvl;
> + struct nix_txsch_alloc_rsp *rsp;
> + int lvl, schq, rc;
>
> /* Get memory to put this msg */
> req = otx2_mbox_alloc_msg_nix_txsch_alloc(&pfvf->mbox);
> @@ -726,8 +727,24 @@ int otx2_txsch_alloc(struct otx2_nic *pfvf)
> /* Request one schq per level */
> for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++)
> req->schq[lvl] = 1;
> + rc = otx2_sync_mbox_msg(&pfvf->mbox);
> + if (rc)
> + return rc;
>
> - return otx2_sync_mbox_msg(&pfvf->mbox);
> + rsp = (struct nix_txsch_alloc_rsp *)
> + otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr);
> + if (IS_ERR(rsp))
> + return PTR_ERR(rsp);
> +
> + /* Setup transmit scheduler list */
> + for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++)
> + for (schq = 0; schq < rsp->schq[lvl]; schq++)
> + pfvf->hw.txschq_list[lvl][schq] =
> + rsp->schq_list[lvl][schq];
> +
> + pfvf->hw.txschq_link_cfg_lvl = rsp->link_cfg_lvl;

nit: extra whitespace before '='

> +
> + return 0;
> }