RE: [EXT] Re: [PATCH net-next,2/3] octeontx2-af: Add support for CPT1 in debugfs
From: Srujana Challa <schalla@marvell.com>
Date: 2021-01-19 08:58:52
On Wed, 2021-01-13 at 20:50 +0530, Srujana Challa wrote:quoted
Adds support to display block CPT1 stats at "/sys/kernel/debug/octeontx2/cpt1". Signed-off-by: Mahipal Challa <redacted> Signed-off-by: Srujana Challa <schalla@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.cb/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
Okay, I will do the changes accordingly and submit next version. Thanks.