On Wed, 2021-01-13 at 20:50 +0530, Srujana Challa wrote:
> Adds support to display block CPT1 stats at
> "/sys/kernel/debug/octeontx2/cpt1".
> 
> Signed-off-by: Mahipal Challa <mcha...@marvell.com>
> Signed-off-by: Srujana Challa <scha...@marvell.com>
> ---
>  .../marvell/octeontx2/af/rvu_debugfs.c        | 45 +++++++++++----
> ----
>  1 file changed, 26 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> index d27543c1a166..158876366dd3 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> @@ -1904,6 +1904,18 @@ static void rvu_dbg_npc_init(struct rvu *rvu)
>  }
>  
>  /* CPT debugfs APIs */
> +static int cpt_get_blkaddr(struct seq_file *filp)
> +{
> +     struct dentry *current_dir;
> +     int blkaddr;
> +
> +     current_dir = filp->file->f_path.dentry->d_parent;
> +     blkaddr = (!strcmp(current_dir->d_name.name, "cpt1") ?
> +                        BLKADDR_CPT1 : BLKADDR_CPT0);
> +

This is very fragile piece of code! it assumes static debugfs directory
structure and naming, why don't you store the CPT context in the
sqe_file private ? as you already have in rvu_dbg_nix_init  for nix_hw
type 


Reply via email to