[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241104102822.GA1011185@hyd1403.caveonetworks.com>
Date: Mon, 4 Nov 2024 15:58:22 +0530
From: Linu Cherian <lcherian@...vell.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <davem@...emloft.net>, <sgoutham@...vell.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <gakula@...vell.com>,
<hkelam@...vell.com>, <sbhatta@...vell.com>, <jerinj@...vell.com>,
<edumazet@...gle.com>, <pabeni@...hat.comi>, <jiri@...nulli.us>,
<corbet@....net>, <linux-doc@...r.kernel.org>
Subject: Re: [PATCH v4 net-next 2/3] octeontx2-af: Knobs for NPC default rule
counters
Hi Jakub,
On 2024-11-04 at 01:23:10, Jakub Kicinski (kuba@...nel.org) wrote:
> 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
Ack. It doesnt have to be inited. Will remove.
>
> > + 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
Wanted to keep a best effort approach here, will make it clear in the documentation.
>
> > + }
> > + 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.
Will move this code under, if (enable && !rule->has_cntr) case.
Infact, all enablement happens only from devlink control, hence the
above if check is really not required and can be confusing.
>
> > + }
> > +
> > + if (!enable && rule->has_cntr) /* Free and unmap counter */ {
> > + __rvu_mcam_remove_counter_from_rule(rvu, rule->owner,
> > + rule);
> > + }
>
> unnecesary parenthesis
Ack.
Thanks,
Linu Cherian.
Powered by blists - more mailing lists