From: Jacob Keller <jacob.e.keller@intel.com>
To: Hariprasad Kelam <hkelam@marvell.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <kuba@kernel.org>, <davem@davemloft.net>,
<willemdebruijn.kernel@gmail.com>, <andrew@lunn.ch>,
<sgoutham@marvell.com>, <lcherian@marvell.com>,
<gakula@marvell.com>, <jerinj@marvell.com>, <sbhatta@marvell.com>,
<naveenm@marvell.com>, <edumazet@google.com>, <pabeni@redhat.com>,
<jhs@mojatatu.com>, <xiyou.wangcong@gmail.com>,
<jiri@resnulli.us>, <maxtram95@gmail.com>, <corbet@lwn.net>
Subject: Re: [net-next Patch v7 5/6] octeontx2-pf: Add support for HTB offload
Date: Wed, 12 Apr 2023 16:14:21 -0700 [thread overview]
Message-ID: <a303351e-8b0f-f7ad-180f-cc2108c15b76@intel.com> (raw)
In-Reply-To: <20230410072910.5632-6-hkelam@marvell.com>
On 4/10/2023 12:29 AM, Hariprasad Kelam wrote:
> +static void __otx2_qos_txschq_cfg(struct otx2_nic *pfvf,
> + struct otx2_qos_node *node,
> + struct nix_txschq_config *cfg)
> +{
> + struct otx2_hw *hw = &pfvf->hw;
> + int num_regs = 0;
> + u64 maxrate;
> + u8 level;
> +
> + level = node->level;
> +
> + /* program txschq registers */
> + if (level == NIX_TXSCH_LVL_SMQ) {
> + cfg->reg[num_regs] = NIX_AF_SMQX_CFG(node->schq);
> + cfg->regval[num_regs] = ((u64)pfvf->tx_max_pktlen << 8) |
> + OTX2_MIN_MTU;
> + cfg->regval[num_regs] |= (0x20ULL << 51) | (0x80ULL << 39) |
> + (0x2ULL << 36);
> + num_regs++;
> +
> + /* configure parent txschq */
> + cfg->reg[num_regs] = NIX_AF_MDQX_PARENT(node->schq);
> + cfg->regval[num_regs] = node->parent->schq << 16;
> + num_regs++;
> +
> + /* configure prio/quantum */
> + if (node->qid == OTX2_QOS_QID_NONE) {
> + cfg->reg[num_regs] = NIX_AF_MDQX_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = node->prio << 24 |
> + mtu_to_dwrr_weight(pfvf,
> + pfvf->tx_max_pktlen);
> + num_regs++;
> + goto txschq_cfg_out;
> + }
> +
> + /* configure prio */
> + cfg->reg[num_regs] = NIX_AF_MDQX_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = (node->schq -
> + node->parent->prio_anchor) << 24;
> + num_regs++;
> +
> + /* configure PIR */
> + maxrate = (node->rate > node->ceil) ? node->rate : node->ceil;
> +
> + cfg->reg[num_regs] = NIX_AF_MDQX_PIR(node->schq);
> + cfg->regval[num_regs] =
> + otx2_get_txschq_rate_regval(pfvf, maxrate, 65536);
> + num_regs++;
> +
> + /* configure CIR */
> + if (!test_bit(QOS_CIR_PIR_SUPPORT, &pfvf->hw.cap_flag)) {
> + /* Don't configure CIR when both CIR+PIR not supported
> + * On 96xx, CIR + PIR + RED_ALGO=STALL causes deadlock
> + */
> + goto txschq_cfg_out;
> + }
> +
> + cfg->reg[num_regs] = NIX_AF_MDQX_CIR(node->schq);
> + cfg->regval[num_regs] =
> + otx2_get_txschq_rate_regval(pfvf, node->rate, 65536);
> + num_regs++;
> + } else if (level == NIX_TXSCH_LVL_TL4) {
> + /* configure parent txschq */
> + cfg->reg[num_regs] = NIX_AF_TL4X_PARENT(node->schq);
> + cfg->regval[num_regs] = node->parent->schq << 16;
> + num_regs++;
> +
> + /* return if not htb node */
> + if (node->qid == OTX2_QOS_QID_NONE) {
> + cfg->reg[num_regs] = NIX_AF_TL4X_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = node->prio << 24 |
> + mtu_to_dwrr_weight(pfvf,
> + pfvf->tx_max_pktlen);
> + num_regs++;
> + goto txschq_cfg_out;
> + }
> +
> + /* configure priority */
> + cfg->reg[num_regs] = NIX_AF_TL4X_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = (node->schq -
> + node->parent->prio_anchor) << 24;
> + num_regs++;
> +
> + /* configure PIR */
> + maxrate = (node->rate > node->ceil) ? node->rate : node->ceil;
> + cfg->reg[num_regs] = NIX_AF_TL4X_PIR(node->schq);
> + cfg->regval[num_regs] =
> + otx2_get_txschq_rate_regval(pfvf, maxrate, 65536);
> + num_regs++;
> +
> + /* configure CIR */
> + if (!test_bit(QOS_CIR_PIR_SUPPORT, &pfvf->hw.cap_flag)) {
> + /* Don't configure CIR when both CIR+PIR not supported
> + * On 96xx, CIR + PIR + RED_ALGO=STALL causes deadlock
> + */
> + goto txschq_cfg_out;
> + }
> +
> + cfg->reg[num_regs] = NIX_AF_TL4X_CIR(node->schq);
> + cfg->regval[num_regs] =
> + otx2_get_txschq_rate_regval(pfvf, node->rate, 65536);
> + num_regs++;
> + } else if (level == NIX_TXSCH_LVL_TL3) {
> + /* configure parent txschq */
> + cfg->reg[num_regs] = NIX_AF_TL3X_PARENT(node->schq);
> + cfg->regval[num_regs] = node->parent->schq << 16;
> + num_regs++;
> +
> + /* configure link cfg */
> + if (level == pfvf->qos.link_cfg_lvl) {
> + cfg->reg[num_regs] = NIX_AF_TL3_TL2X_LINKX_CFG(node->schq, hw->tx_link);
> + cfg->regval[num_regs] = BIT_ULL(13) | BIT_ULL(12);
> + num_regs++;
> + }
> +
> + /* return if not htb node */
> + if (node->qid == OTX2_QOS_QID_NONE) {
> + cfg->reg[num_regs] = NIX_AF_TL3X_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = node->prio << 24 |
> + mtu_to_dwrr_weight(pfvf,
> + pfvf->tx_max_pktlen);
> + num_regs++;
> + goto txschq_cfg_out;
> + }
> +
> + /* configure priority */
> + cfg->reg[num_regs] = NIX_AF_TL3X_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = (node->schq -
> + node->parent->prio_anchor) << 24;
> + num_regs++;
> +
> + /* configure PIR */
> + maxrate = (node->rate > node->ceil) ? node->rate : node->ceil;
> + cfg->reg[num_regs] = NIX_AF_TL3X_PIR(node->schq);
> + cfg->regval[num_regs] =
> + otx2_get_txschq_rate_regval(pfvf, maxrate, 65536);
> + num_regs++;
> +
> + /* configure CIR */
> + if (!test_bit(QOS_CIR_PIR_SUPPORT, &pfvf->hw.cap_flag)) {
> + /* Don't configure CIR when both CIR+PIR not supported
> + * On 96xx, CIR + PIR + RED_ALGO=STALL causes deadlock
> + */
> + goto txschq_cfg_out;
> + }
> +
> + cfg->reg[num_regs] = NIX_AF_TL3X_CIR(node->schq);
> + cfg->regval[num_regs] =
> + otx2_get_txschq_rate_regval(pfvf, node->rate, 65536);
> + num_regs++;
> + } else if (level == NIX_TXSCH_LVL_TL2) {
> + /* configure parent txschq */
> + cfg->reg[num_regs] = NIX_AF_TL2X_PARENT(node->schq);
> + cfg->regval[num_regs] = hw->tx_link << 16;
> + num_regs++;
> +
> + /* configure link cfg */
> + if (level == pfvf->qos.link_cfg_lvl) {
> + cfg->reg[num_regs] = NIX_AF_TL3_TL2X_LINKX_CFG(node->schq, hw->tx_link);
> + cfg->regval[num_regs] = BIT_ULL(13) | BIT_ULL(12);
> + num_regs++;
> + }
> +
> + /* return if not htb node */
> + if (node->qid == OTX2_QOS_QID_NONE) {
> + cfg->reg[num_regs] = NIX_AF_TL2X_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = node->prio << 24 |
> + mtu_to_dwrr_weight(pfvf,
> + pfvf->tx_max_pktlen);
> + num_regs++;
> + goto txschq_cfg_out;
> + }
> +
> + /* check if node is root */
> + if (node->qid == OTX2_QOS_QID_INNER && !node->parent) {
> + cfg->reg[num_regs] = NIX_AF_TL2X_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = TXSCH_TL1_DFLT_RR_PRIO << 24 |
> + mtu_to_dwrr_weight(pfvf,
> + pfvf->tx_max_pktlen);
> + num_regs++;
> + goto txschq_cfg_out;
> + }
> +
> + /* configure priority/quantum */
> + cfg->reg[num_regs] = NIX_AF_TL2X_SCHEDULE(node->schq);
> + cfg->regval[num_regs] = (node->schq -
> + node->parent->prio_anchor) << 24;
> + num_regs++;
> +
> + /* configure PIR */
> + maxrate = (node->rate > node->ceil) ? node->rate : node->ceil;
> + cfg->reg[num_regs] = NIX_AF_TL2X_PIR(node->schq);
> + cfg->regval[num_regs] =
> + otx2_get_txschq_rate_regval(pfvf, maxrate, 65536);
> + num_regs++;
> +
> + /* configure CIR */
> + if (!test_bit(QOS_CIR_PIR_SUPPORT, &pfvf->hw.cap_flag)) {
> + /* Don't configure CIR when both CIR+PIR not supported
> + * On 96xx, CIR + PIR + RED_ALGO=STALL causes deadlock
> + */
> + goto txschq_cfg_out;
> + }
> +
> + cfg->reg[num_regs] = NIX_AF_TL2X_CIR(node->schq);
> + cfg->regval[num_regs] =
> + otx2_get_txschq_rate_regval(pfvf, node->rate, 65536);
> + num_regs++;
> + }
> +
> +txschq_cfg_out:
> + cfg->num_regs = num_regs;
> +}
> +
That is a lot of code for one function.. Any chance it could be split
into some helpers?
This patch itself is also much larger than I was expecting. I guess most
of it is in the new file implementing the new HTB offload, but its hard
to digest in a single patch.
next prev parent reply other threads:[~2023-04-12 23:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-10 7:29 fRom db62b365277f354bad482ac77be8308f8ac326b4 Mon Sep 17 00:00:00 2001 Hariprasad Kelam
2023-04-10 7:29 ` [net-next Patch v7 1/6] sch_htb: Allow HTB priority parameter in offload mode Hariprasad Kelam
2023-04-12 23:06 ` Jacob Keller
2023-04-10 7:29 ` [net-next Patch v7 2/6] octeontx2-pf: Rename tot_tx_queues to non_qos_queues Hariprasad Kelam
2023-04-12 23:06 ` Jacob Keller
2023-04-10 7:29 ` [net-next Patch v7 3/6] octeontx2-pf: qos send queues management Hariprasad Kelam
2023-04-12 23:09 ` Jacob Keller
2023-04-10 7:29 ` [net-next Patch v7 4/6] octeontx2-pf: Refactor schedular queue alloc/free calls Hariprasad Kelam
2023-04-12 23:10 ` Jacob Keller
2023-04-10 7:29 ` [net-next Patch v7 5/6] octeontx2-pf: Add support for HTB offload Hariprasad Kelam
2023-04-12 23:14 ` Jacob Keller [this message]
2023-04-10 7:29 ` [net-next Patch v7 6/6] docs: octeontx2: Add Documentation for QOS Hariprasad Kelam
2023-04-12 23:16 ` Jacob Keller
2023-04-12 23:05 ` fRom db62b365277f354bad482ac77be8308f8ac326b4 Mon Sep 17 00:00:00 2001 Jacob Keller
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=a303351e-8b0f-f7ad-180f-cc2108c15b76@intel.com \
--to=jacob.e.keller@intel.com \
--cc=andrew@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=hkelam@marvell.com \
--cc=jerinj@marvell.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=lcherian@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxtram95@gmail.com \
--cc=naveenm@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
--cc=willemdebruijn.kernel@gmail.com \
--cc=xiyou.wangcong@gmail.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
all inboxes | Powered by JetHome®