public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Linu Cherian <lcherian@marvell.com>
To: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.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>, <kuba@kernel.org>,
	<pabeni@redhat.com>
Subject: Re: [PATCH v3 net-next 2/2] octeontx2-af: Knobs for NPC default rule counters
Date: Thu, 24 Oct 2024 15:19:15 +0530	[thread overview]
Message-ID: <20241024094915.GA954957@hyd1403.caveonetworks.com> (raw)
In-Reply-To: <CAH-L+nMRhE4c-Q43+LXFq_MNU7qzBdysTP=Smd3GXtbyJQoPBQ@mail.gmail.com>

Hi Kalesh,

On 2024-10-18 at 08:39:40, Kalesh Anakkur Purayil (kalesh-anakkur.purayil@broadcom.com) wrote:
> On Thu, Oct 17, 2024 at 2:14 PM Linu Cherian <lcherian@marvell.com> wrote:
> >
> > Add devlink knobs to enable/disable counters on NPC
> > default rule entries.
> >
> > Sample command to enable default rule counters:
> > devlink dev param set <dev> name npc_def_rule_cntr value true cmode runtime
> >
> > Sample command to read the counter:
> > cat /sys/kernel/debug/cn10k/npc/mcam_rules
> >
> > Signed-off-by: Linu Cherian <lcherian@marvell.com>
> > ---
> > Changelog from v2:
> > Moved out the refactoring into separate patch.
> >
> >  .../net/ethernet/marvell/octeontx2/af/rvu.h   |  2 +
> >  .../marvell/octeontx2/af/rvu_devlink.c        | 32 +++++++++++++
> >  .../ethernet/marvell/octeontx2/af/rvu_npc.c   | 45 +++++++++++++++++++
> >  3 files changed, 79 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> > index d92a5f47a476..e8c6a6fe9bd5 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> > @@ -525,6 +525,7 @@ struct rvu {
> >         struct mutex            alias_lock; /* Serialize bar2 alias access */
> >         int                     vfs; /* Number of VFs attached to RVU */
> >         u16                     vf_devid; /* VF devices id */
> > +       bool                    def_rule_cntr_en;
> >         int                     nix_blkaddr[MAX_NIX_BLKS];
> >
> >         /* Mbox */
> > @@ -989,6 +990,7 @@ void npc_set_mcam_action(struct rvu *rvu, struct npc_mcam *mcam,
> >  void npc_read_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
> >                          int blkaddr, u16 src, struct mcam_entry *entry,
> >                          u8 *intf, u8 *ena);
> > +int npc_config_cntr_default_entries(struct rvu *rvu, bool enable);
> >  bool is_cgx_config_permitted(struct rvu *rvu, u16 pcifunc);
> >  bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
> >  u32  rvu_cgx_get_fifolen(struct rvu *rvu);
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> > index 7498ab429963..9c26e19a860b 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> > @@ -1238,6 +1238,7 @@ enum rvu_af_dl_param_id {
> >         RVU_AF_DEVLINK_PARAM_ID_DWRR_MTU,
> >         RVU_AF_DEVLINK_PARAM_ID_NPC_MCAM_ZONE_PERCENT,
> >         RVU_AF_DEVLINK_PARAM_ID_NPC_EXACT_FEATURE_DISABLE,
> > +       RVU_AF_DEVLINK_PARAM_ID_NPC_DEF_RULE_CNTR_ENABLE,
> >         RVU_AF_DEVLINK_PARAM_ID_NIX_MAXLF,
> >  };
> >
> > @@ -1358,6 +1359,32 @@ static int rvu_af_dl_npc_mcam_high_zone_percent_validate(struct devlink *devlink
> >         return 0;
> >  }
> >
> > +static int rvu_af_dl_npc_def_rule_cntr_get(struct devlink *devlink, u32 id,
> > +                                          struct devlink_param_gset_ctx *ctx)
> > +{
> > +       struct rvu_devlink *rvu_dl = devlink_priv(devlink);
> > +       struct rvu *rvu = rvu_dl->rvu;
> > +
> > +       ctx->val.vbool = rvu->def_rule_cntr_en;
> > +
> > +       return 0;
> > +}
> > +
> > +static int rvu_af_dl_npc_def_rule_cntr_set(struct devlink *devlink, u32 id,
> > +                                          struct devlink_param_gset_ctx *ctx,
> > +                                          struct netlink_ext_ack *extack)
> > +{
> > +       struct rvu_devlink *rvu_dl = devlink_priv(devlink);
> > +       struct rvu *rvu = rvu_dl->rvu;
> > +       int err;
> > +
> > +       err = npc_config_cntr_default_entries(rvu, ctx->val.vbool);
> > +       if (!err)
> > +               rvu->def_rule_cntr_en = ctx->val.vbool;
> > +
> > +       return err;
> > +}
> > +
> >  static int rvu_af_dl_nix_maxlf_get(struct devlink *devlink, u32 id,
> >                                    struct devlink_param_gset_ctx *ctx)
> >  {
> > @@ -1444,6 +1471,11 @@ static const struct devlink_param rvu_af_dl_params[] = {
> >                              rvu_af_dl_npc_mcam_high_zone_percent_get,
> >                              rvu_af_dl_npc_mcam_high_zone_percent_set,
> >                              rvu_af_dl_npc_mcam_high_zone_percent_validate),
> > +       DEVLINK_PARAM_DRIVER(RVU_AF_DEVLINK_PARAM_ID_NPC_DEF_RULE_CNTR_ENABLE,
> > +                            "npc_def_rule_cntr", DEVLINK_PARAM_TYPE_BOOL,
> > +                            BIT(DEVLINK_PARAM_CMODE_RUNTIME),
> > +                            rvu_af_dl_npc_def_rule_cntr_get,
> > +                            rvu_af_dl_npc_def_rule_cntr_set, NULL),
> >         DEVLINK_PARAM_DRIVER(RVU_AF_DEVLINK_PARAM_ID_NIX_MAXLF,
> >                              "nix_maxlf", DEVLINK_PARAM_TYPE_U16,
> >                              BIT(DEVLINK_PARAM_CMODE_RUNTIME),
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > index c4ef1e83cc46..9e39c3149a4f 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > @@ -2691,6 +2691,51 @@ void npc_mcam_rsrcs_reserve(struct rvu *rvu, int blkaddr, int entry_idx)
> >         npc_mcam_set_bit(mcam, entry_idx);
> >  }
> >
> > +int npc_config_cntr_default_entries(struct rvu *rvu, bool enable)
> > +{
> > +       struct npc_install_flow_rsp rsp = { 0 };
> > +       struct npc_mcam *mcam = &rvu->hw->mcam;
> [Kalesh] Maintain RCT order for variable declarartion

Not seeing an issue on my vim editor. Could you please recheck if this
is mail client issue ?

Thanks
Linu Cherian.

  reply	other threads:[~2024-10-24  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17  8:42 [PATCH v3 net-next 0/2] Knobs for NPC default rule counters Linu Cherian
2024-10-17  8:42 ` [PATCH v3 net-next 1/2] octeontx2-af: Refactor few NPC mcam APIs Linu Cherian
2024-10-18 11:58   ` Simon Horman
2024-10-17  8:42 ` [PATCH v3 net-next 2/2] octeontx2-af: Knobs for NPC default rule counters Linu Cherian
2024-10-18  3:09   ` Kalesh Anakkur Purayil
2024-10-24  9:49     ` Linu Cherian [this message]
2024-10-18 12:01   ` Simon Horman
2024-10-24  9:50     ` 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=20241024094915.GA954957@hyd1403.caveonetworks.com \
    --to=lcherian@marvell.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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