Re: [PATCH 06/11] netronome: don't bother with debugfs_real_fops()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 02, 2025 at 10:22:05PM +0100, Al Viro wrote:
> Just turn nfp_tx_q_show() into a wrapper for helper that gets
> told whether it's tx or xdp via an explicit argument and have
> nfp_xdp_q_show() call the underlying helper instead.
> 
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> ---
>  .../net/ethernet/netronome/nfp/nfp_net_debugfs.c  | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c b/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
> index d8b735ccf899..d843d1e19715 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
> @@ -77,7 +77,7 @@ DEFINE_SHOW_ATTRIBUTE(nfp_rx_q);
>  static int nfp_tx_q_show(struct seq_file *file, void *data);
>  DEFINE_SHOW_ATTRIBUTE(nfp_tx_q);
I could be missing something, but I think this update now allows this
DEFINE_SHOW_ATTRIBUTE(nfp_tx_q) to move down to below the function
wrapper, and the 'nfp_tx_q_show' declaration here is not needed
anymore?

This is just a tiny nit though, I'm also fine if you want to leave it as is.
This looks like a nice cleanup to me, thanks!

Reviewed-by: Louis Peens <louis.peens@xxxxxxxxxxxx>

>  
> -static int nfp_tx_q_show(struct seq_file *file, void *data)
> +static int __nfp_tx_q_show(struct seq_file *file, void *data, bool is_xdp)
>  {
>  	struct nfp_net_r_vector *r_vec = file->private;
>  	struct nfp_net_tx_ring *tx_ring;
> @@ -86,10 +86,10 @@ static int nfp_tx_q_show(struct seq_file *file, void *data)
>  
>  	rtnl_lock();
>  
> -	if (debugfs_real_fops(file->file) == &nfp_tx_q_fops)
> -		tx_ring = r_vec->tx_ring;
> -	else
> +	if (is_xdp)
>  		tx_ring = r_vec->xdp_ring;
> +	else
> +		tx_ring = r_vec->tx_ring;
>  	if (!r_vec->nfp_net || !tx_ring)
>  		goto out;
>  	nn = r_vec->nfp_net;
> @@ -115,9 +115,14 @@ static int nfp_tx_q_show(struct seq_file *file, void *data)
>  	return 0;
>  }
>  
> +static int nfp_tx_q_show(struct seq_file *file, void *data)
> +{
> +	return __nfp_tx_q_show(file, data, false);
> +}
> +
>  static int nfp_xdp_q_show(struct seq_file *file, void *data)
>  {
> -	return nfp_tx_q_show(file, data);
> +	return __nfp_tx_q_show(file, data, true);
>  }
>  DEFINE_SHOW_ATTRIBUTE(nfp_xdp_q);
>  
> -- 
> 2.39.5
> 




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux