@@ -917,19 +917,18 @@ static void print_npa_qsize(struct seq_file *m, struct rvu_pfvf *pfvf)
917917/* The 'qsize' entry dumps current Aura/Pool context Qsize
918918 * and each context's current enable/disable status in a bitmap.
919919 */
920- static int rvu_dbg_qsize_display (struct seq_file * filp , void * unsused ,
920+ static int rvu_dbg_qsize_display (struct seq_file * s , void * unsused ,
921921 int blktype )
922922{
923- void (* print_qsize )(struct seq_file * filp ,
923+ void (* print_qsize )(struct seq_file * s ,
924924 struct rvu_pfvf * pfvf ) = NULL ;
925- struct dentry * current_dir ;
926925 struct rvu_pfvf * pfvf ;
927926 struct rvu * rvu ;
928927 int qsize_id ;
929928 u16 pcifunc ;
930929 int blkaddr ;
931930
932- rvu = filp -> private ;
931+ rvu = s -> private ;
933932 switch (blktype ) {
934933 case BLKTYPE_NPA :
935934 qsize_id = rvu -> rvu_dbg .npa_qsize_id ;
@@ -945,32 +944,28 @@ static int rvu_dbg_qsize_display(struct seq_file *filp, void *unsused,
945944 return - EINVAL ;
946945 }
947946
948- if (blktype == BLKTYPE_NPA ) {
947+ if (blktype == BLKTYPE_NPA )
949948 blkaddr = BLKADDR_NPA ;
950- } else {
951- current_dir = filp -> file -> f_path .dentry -> d_parent ;
952- blkaddr = (!strcmp (current_dir -> d_name .name , "nix1" ) ?
953- BLKADDR_NIX1 : BLKADDR_NIX0 );
954- }
949+ else
950+ blkaddr = debugfs_get_aux_num (s -> file );
955951
956952 if (!rvu_dbg_is_valid_lf (rvu , blkaddr , qsize_id , & pcifunc ))
957953 return - EINVAL ;
958954
959955 pfvf = rvu_get_pfvf (rvu , pcifunc );
960- print_qsize (filp , pfvf );
956+ print_qsize (s , pfvf );
961957
962958 return 0 ;
963959}
964960
965- static ssize_t rvu_dbg_qsize_write (struct file * filp ,
961+ static ssize_t rvu_dbg_qsize_write (struct file * file ,
966962 const char __user * buffer , size_t count ,
967963 loff_t * ppos , int blktype )
968964{
969965 char * blk_string = (blktype == BLKTYPE_NPA ) ? "npa" : "nix" ;
970- struct seq_file * seqfile = filp -> private_data ;
966+ struct seq_file * seqfile = file -> private_data ;
971967 char * cmd_buf , * cmd_buf_tmp , * subtoken ;
972968 struct rvu * rvu = seqfile -> private ;
973- struct dentry * current_dir ;
974969 int blkaddr ;
975970 u16 pcifunc ;
976971 int ret , lf ;
@@ -996,13 +991,10 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
996991 goto qsize_write_done ;
997992 }
998993
999- if (blktype == BLKTYPE_NPA ) {
994+ if (blktype == BLKTYPE_NPA )
1000995 blkaddr = BLKADDR_NPA ;
1001- } else {
1002- current_dir = filp -> f_path .dentry -> d_parent ;
1003- blkaddr = (!strcmp (current_dir -> d_name .name , "nix1" ) ?
1004- BLKADDR_NIX1 : BLKADDR_NIX0 );
1005- }
996+ else
997+ blkaddr = debugfs_get_aux_num (file );
1006998
1007999 if (!rvu_dbg_is_valid_lf (rvu , blkaddr , lf , & pcifunc )) {
10081000 ret = - EINVAL ;
@@ -2704,8 +2696,8 @@ static void rvu_dbg_nix_init(struct rvu *rvu, int blkaddr)
27042696 & rvu_dbg_nix_ndc_tx_hits_miss_fops );
27052697 debugfs_create_file ("ndc_rx_hits_miss" , 0600 , rvu -> rvu_dbg .nix , nix_hw ,
27062698 & rvu_dbg_nix_ndc_rx_hits_miss_fops );
2707- debugfs_create_file ("qsize" , 0600 , rvu -> rvu_dbg .nix , rvu ,
2708- & rvu_dbg_nix_qsize_fops );
2699+ debugfs_create_file_aux_num ("qsize" , 0600 , rvu -> rvu_dbg .nix , rvu ,
2700+ blkaddr , & rvu_dbg_nix_qsize_fops );
27092701 debugfs_create_file ("ingress_policer_ctx" , 0600 , rvu -> rvu_dbg .nix , nix_hw ,
27102702 & rvu_dbg_nix_band_prof_ctx_fops );
27112703 debugfs_create_file ("ingress_policer_rsrc" , 0600 , rvu -> rvu_dbg .nix , nix_hw ,
@@ -2854,28 +2846,14 @@ static int cgx_print_stats(struct seq_file *s, int lmac_id)
28542846 return err ;
28552847}
28562848
2857- static int rvu_dbg_derive_lmacid (struct seq_file * filp , int * lmac_id )
2849+ static int rvu_dbg_derive_lmacid (struct seq_file * s )
28582850{
2859- struct dentry * current_dir ;
2860- char * buf ;
2861-
2862- current_dir = filp -> file -> f_path .dentry -> d_parent ;
2863- buf = strrchr (current_dir -> d_name .name , 'c' );
2864- if (!buf )
2865- return - EINVAL ;
2866-
2867- return kstrtoint (buf + 1 , 10 , lmac_id );
2851+ return debugfs_get_aux_num (s -> file );
28682852}
28692853
2870- static int rvu_dbg_cgx_stat_display (struct seq_file * filp , void * unused )
2854+ static int rvu_dbg_cgx_stat_display (struct seq_file * s , void * unused )
28712855{
2872- int lmac_id , err ;
2873-
2874- err = rvu_dbg_derive_lmacid (filp , & lmac_id );
2875- if (!err )
2876- return cgx_print_stats (filp , lmac_id );
2877-
2878- return err ;
2856+ return cgx_print_stats (s , rvu_dbg_derive_lmacid (s ));
28792857}
28802858
28812859RVU_DEBUG_SEQ_FOPS (cgx_stat , cgx_stat_display , NULL );
@@ -2933,15 +2911,9 @@ static int cgx_print_dmac_flt(struct seq_file *s, int lmac_id)
29332911 return 0 ;
29342912}
29352913
2936- static int rvu_dbg_cgx_dmac_flt_display (struct seq_file * filp , void * unused )
2914+ static int rvu_dbg_cgx_dmac_flt_display (struct seq_file * s , void * unused )
29372915{
2938- int err , lmac_id ;
2939-
2940- err = rvu_dbg_derive_lmacid (filp , & lmac_id );
2941- if (!err )
2942- return cgx_print_dmac_flt (filp , lmac_id );
2943-
2944- return err ;
2916+ return cgx_print_dmac_flt (s , rvu_dbg_derive_lmacid (s ));
29452917}
29462918
29472919RVU_DEBUG_SEQ_FOPS (cgx_dmac_flt , cgx_dmac_flt_display , NULL );
@@ -2980,10 +2952,10 @@ static void rvu_dbg_cgx_init(struct rvu *rvu)
29802952 rvu -> rvu_dbg .lmac =
29812953 debugfs_create_dir (dname , rvu -> rvu_dbg .cgx );
29822954
2983- debugfs_create_file ("stats" , 0600 , rvu -> rvu_dbg .lmac ,
2984- cgx , & rvu_dbg_cgx_stat_fops );
2985- debugfs_create_file ("mac_filter" , 0600 ,
2986- rvu -> rvu_dbg .lmac , cgx ,
2955+ debugfs_create_file_aux_num ("stats" , 0600 , rvu -> rvu_dbg .lmac ,
2956+ cgx , lmac_id , & rvu_dbg_cgx_stat_fops );
2957+ debugfs_create_file_aux_num ("mac_filter" , 0600 ,
2958+ rvu -> rvu_dbg .lmac , cgx , lmac_id ,
29872959 & rvu_dbg_cgx_dmac_flt_fops );
29882960 }
29892961 }
0 commit comments