lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+FuTSd+uKF6yWOJb6bSjNt7NY7PFwZBeZUL0UzTR171=HNuZQ@mail.gmail.com>
Date:   Fri, 30 Oct 2020 12:09:04 -0400
From:   Willem de Bruijn <willemdebruijn.kernel@...il.com>
To:     Srujana Challa <schalla@...vell.com>
Cc:     Herbert Xu <herbert@...dor.apana.org.au>,
        David Miller <davem@...emloft.net>,
        Network Development <netdev@...r.kernel.org>,
        linux-crypto@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        sgoutham@...vell.com, gakula@...vell.com, sbhatta@...vell.com,
        schandran@...vell.com, pathreya@...vell.com
Subject: Re: [PATCH v8,net-next,03/12] octeontx2-af: add debugfs entries for
 CPT block

On Wed, Oct 28, 2020 at 10:22 PM Srujana Challa <schalla@...vell.com> wrote:
>
> Add entries to debugfs at /sys/kernel/debug/octeontx2/cpt.
>
> cpt_pc: dump cpt performance HW registers.
> Usage:
> cat /sys/kernel/debug/octeontx2/cpt/cpt_pc
>
> cpt_ae_sts: show cpt asymmetric engines current state
> Usage:
> cat /sys/kernel/debug/octeontx2/cpt/cpt_ae_sts
>
> cpt_se_sts: show cpt symmetric engines current state
> Usage:
> cat /sys/kernel/debug/octeontx2/cpt/cpt_se_sts
>
> cpt_engines_info: dump cpt engine control registers.
> Usage:
> cat /sys/kernel/debug/octeontx2/cpt/cpt_engines_info
>
> cpt_lfs_info: dump cpt lfs control registers.
> Usage:
> cat /sys/kernel/debug/octeontx2/cpt/cpt_lfs_info
>
> cpt_err_info: dump cpt error registers.
> Usage:
> cat /sys/kernel/debug/octeontx2/cpt/cpt_err_info
>
> Signed-off-by: Suheil Chandran <schandran@...vell.com>
> Signed-off-by: Srujana Challa <schalla@...vell.com>
> ---
>  .../net/ethernet/marvell/octeontx2/af/rvu.h   |   1 +
>  .../marvell/octeontx2/af/rvu_debugfs.c        | 304 ++++++++++++++++++
>  2 files changed, 305 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> index c37e106d7006..ba18171c87d6 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> @@ -50,6 +50,7 @@ struct rvu_debugfs {
>         struct dentry *npa;
>         struct dentry *nix;
>         struct dentry *npc;
> +       struct dentry *cpt;
>         struct dump_ctx npa_aura_ctx;
>         struct dump_ctx npa_pool_ctx;
>         struct dump_ctx nix_cq_ctx;
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> index 77adad4adb1b..24354bfb4e94 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> @@ -1676,6 +1676,309 @@ static void rvu_dbg_npc_init(struct rvu *rvu)
>         debugfs_remove_recursive(rvu->rvu_dbg.npc);
>  }
>
> +/* CPT debugfs APIs */
> +static int rvu_dbg_cpt_ae_sts_display(struct seq_file *filp, void *unused)
> +{
> +       struct rvu *rvu = filp->private;
> +       u64 busy_sts = 0, free_sts = 0;
> +       u32 e_min = 0, e_max = 0, e, i;
> +       u16 max_ses, max_ies, max_aes;
> +       int blkaddr;
> +       u64 reg;
> +
> +       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_CPT, 0);
> +       if (blkaddr < 0)
> +               return -ENODEV;
> +
> +       reg = rvu_read64(rvu, blkaddr, CPT_AF_CONSTANTS1);
> +       max_ses = reg & 0xffff;
> +       max_ies = (reg >> 16) & 0xffff;
> +       max_aes = (reg >> 32) & 0xffff;
> +
> +       e_min = max_ses + max_ies;
> +       e_max = max_ses + max_ies + max_aes;
> +
> +       for (e = e_min, i = 0; e < e_max; e++, i++) {
> +               reg = rvu_read64(rvu, blkaddr, CPT_AF_EXEX_STS(e));
> +               if (reg & 0x1)
> +                       busy_sts |= 1ULL << i;
> +
> +               if (reg & 0x2)
> +                       free_sts |= 1ULL << i;
> +       }
> +       seq_printf(filp, "FREE STS : 0x%016llx\n", free_sts);
> +       seq_printf(filp, "BUSY STS : 0x%016llx\n", busy_sts);
> +
> +       return 0;
> +}
> +
> +RVU_DEBUG_SEQ_FOPS(cpt_ae_sts, cpt_ae_sts_display, NULL);
> +
> +static int rvu_dbg_cpt_se_sts_display(struct seq_file *filp, void *unused)
> +{
> +       struct rvu *rvu = filp->private;
> +       u64 busy_sts = 0, free_sts = 0;
> +       u32 e_min = 0, e_max = 0, e;
> +       u16 max_ses;
> +       int blkaddr;
> +       u64 reg;
> +
> +       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_CPT, 0);
> +       if (blkaddr < 0)
> +               return -ENODEV;
> +
> +       reg = rvu_read64(rvu, blkaddr, CPT_AF_CONSTANTS1);
> +       max_ses = reg & 0xffff;
> +
> +       e_min = 0;
> +       e_max = max_ses;
> +
> +       for (e = e_min; e < e_max; e++) {
> +               reg = rvu_read64(rvu, blkaddr, CPT_AF_EXEX_STS(e));
> +               if (reg & 0x1)
> +                       busy_sts |= 1ULL << e;
> +
> +               if (reg & 0x2)
> +                       free_sts |= 1ULL << e;
> +       }
> +       seq_printf(filp, "FREE STS : 0x%016llx\n", free_sts);
> +       seq_printf(filp, "BUSY STS : 0x%016llx\n", busy_sts);
> +
> +       return 0;
> +}
> +
> +RVU_DEBUG_SEQ_FOPS(cpt_se_sts, cpt_se_sts_display, NULL);
> +
> +static int rvu_dbg_cpt_ie_sts_display(struct seq_file *filp, void *unused)
> +{
> +       struct rvu *rvu = filp->private;
> +       u64 busy_sts = 0, free_sts = 0;
> +       u32 e_min = 0, e_max = 0, e, i;
> +       u16 max_ses, max_ies;
> +       int blkaddr;
> +       u64 reg;
> +
> +       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_CPT, 0);
> +       if (blkaddr < 0)
> +               return -ENODEV;
> +
> +       reg = rvu_read64(rvu, blkaddr, CPT_AF_CONSTANTS1);
> +       max_ses = reg & 0xffff;
> +       max_ies = (reg >> 16) & 0xffff;
> +
> +       e_min = max_ses;
> +       e_max = max_ses + max_ies;
> +
> +       for (e = e_min, i = 0; e < e_max; e++, i++) {
> +               reg = rvu_read64(rvu, blkaddr, CPT_AF_EXEX_STS(e));
> +               if (reg & 0x1)
> +                       busy_sts |= 1ULL << i;
> +
> +               if (reg & 0x2)
> +                       free_sts |= 1ULL << i;
> +       }
> +       seq_printf(filp, "FREE STS : 0x%016llx\n", free_sts);
> +       seq_printf(filp, "BUSY STS : 0x%016llx\n", busy_sts);
> +
> +       return 0;
> +}

The above three are very similar. Could they use a single helper?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ