From: Jakub Kicinski <kuba@kernel.org>
To: Linu Cherian <lcherian@marvell.com>
Cc: <davem@davemloft.net>, <sgoutham@marvell.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<gakula@marvell.com>, <hkelam@marvell.com>, <sbhatta@marvell.com>,
<jerinj@marvell.com>, <edumazet@google.com>, <pabeni@redhat.comi>,
<jiri@resnulli.us>, <corbet@lwn.net>, <linux-doc@vger.kernel.org>
Subject: Re: [PATCH v4 net-next 2/3] octeontx2-af: Knobs for NPC default rule counters
Date: Sun, 3 Nov 2024 11:53:10 -0800 [thread overview]
Message-ID: <20241103115310.61154a0d@kernel.org> (raw)
In-Reply-To: <20241029035739.1981839-3-lcherian@marvell.com>
On Tue, 29 Oct 2024 09:27:38 +0530 Linu Cherian wrote:
> + struct npc_install_flow_rsp rsp = { 0 };
@rsp is reused in the loop, either it doesn't have to be inited at all,
or it has to be inited before every use
> + struct npc_mcam *mcam = &rvu->hw->mcam;
> + struct rvu_npc_mcam_rule *rule;
> + int blkaddr;
> +
> + blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
> + if (blkaddr < 0)
> + return -EINVAL;
> +
> + mutex_lock(&mcam->lock);
> + list_for_each_entry(rule, &mcam->mcam_rules, list) {
> + if (!is_mcam_entry_enabled(rvu, mcam, blkaddr, rule->entry))
> + continue;
> + if (!rule->default_rule)
> + continue;
> + if (enable && !rule->has_cntr) { /* Alloc and map new counter */
> + __rvu_mcam_add_counter_to_rule(rvu, rule->owner,
> + rule, &rsp);
> + if (rsp.counter < 0) {
> + dev_err(rvu->dev, "%s: Err to allocate cntr for default rule (err=%d)\n",
> + __func__, rsp.counter);
> + break;
shouldn't you "unwind" in this case? We'll leave the counter enabled
for some rules and disabled for others
> + }
> + npc_map_mcam_entry_and_cntr(rvu, mcam, blkaddr,
> + rule->entry, rsp.counter);
> + }
> +
> + if (enable && rule->has_cntr) /* Reset counter before use */ {
> + rvu_write64(rvu, blkaddr,
> + NPC_AF_MATCH_STATX(rule->cntr), 0x0);
> + continue;
so setting to enabled while already enabled resets the value?
If so that's neither documented, nor.. usual.
> + }
> +
> + if (!enable && rule->has_cntr) /* Free and unmap counter */ {
> + __rvu_mcam_remove_counter_from_rule(rvu, rule->owner,
> + rule);
> + }
unnecesary parenthesis
> + }
--
pw-bot: cr
next prev parent reply other threads:[~2024-11-03 19:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 3:57 [PATCH v4 net-next 0/3] Knobs for NPC default rule counters Linu Cherian
2024-10-29 3:57 ` [PATCH v4 net-next 1/3] octeontx2-af: Refactor few NPC mcam APIs Linu Cherian
2024-10-29 3:57 ` [PATCH v4 net-next 2/3] octeontx2-af: Knobs for NPC default rule counters Linu Cherian
2024-11-02 14:54 ` Simon Horman
2024-11-03 19:53 ` Jakub Kicinski [this message]
2024-11-04 10:28 ` Linu Cherian
2024-10-29 3:57 ` [PATCH v4 net-next 3/3] devlink: Add documenation for OcteonTx2 AF Linu Cherian
2024-11-02 14:52 ` Simon Horman
2024-11-03 19:55 ` Jakub Kicinski
2024-11-04 10:33 ` Linu Cherian
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=20241103115310.61154a0d@kernel.org \
--to=kuba@kernel.org \
--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=jiri@resnulli.us \
--cc=lcherian@marvell.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.comi \
--cc=sbhatta@marvell.com \
--cc=sgoutham@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).