Re: [PATCH v7,net-next,03/13] octeontx2-af: add debugfs entries for CPT block

Jakub Kicinski
2020-10-14T23:55:13Z

On Mon, 12 Oct 2020 16:27:09 +0530 Srujana Challa wrote:
> +static ssize_t rvu_dbg_cpt_cmd_parser(struct file *filp,
> + const char __user *buffer, size_t count,
> + loff_t *ppos)
> +{
> + struct seq_file *s = filp->private_data;
> + struct rvu *rvu = s->private;
> + char *cmd_buf;
> + int ret = 0;
> +
> + if ((*ppos != 0) || !count)
> + return -EINVAL;
> +
> + cmd_buf = kzalloc(count + 1, GFP_KERNEL);
> + if (!cmd_buf)
> + return -ENOSPC;
> +
> + if (parse_cpt_cmd_buffer(cmd_buf, &count, buffer,
> + rvu->rvu_dbg.cpt_ctx.e_type) < 0)
> + ret = -EINVAL;
> +
> + kfree(cmd_buf);
> +
> + if (ret)
> + return -EINVAL;
> +
> + return count;
> +}

No command parsers in debugfs, please.

Expose read only files for objects you want to be able to dump.