From: Ratheesh Kannoth <rkannoth@marvell.com>
To: Heyang Tan <thy15333007817@163.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<sgoutham@marvell.com>, <gakula@marvell.com>,
<sbhatta@marvell.com>
Subject: Re: [PATCH v3] octeontx2-af: use seq_file for rsrc_alloc debugfs
Date: Wed, 9 Sep 2026 08:29:23 +0530 [thread overview]
Message-ID: <aqDLi-xfsssfP59e@rkannoth-OptiPlex-7090> (raw)
In-Reply-To: <20260909015437.1042-1-thy15333007817@163.com>
On 2026-09-09 at 07:24:37, Heyang Tan (thy15333007817@163.com) wrote:
> The rsrc_alloc debugfs reader writes rows directly to userspace without
> respecting the caller's read count. It also uses the current row length as
> the userspace stride, which can corrupt output when rows have different
> widths.
>
> Use seq_file to handle userspace buffer sizes, offsets, and partial reads.
>
> The LF list formatter is used both to determine the widest column and skip
> PF/VF rows with no resources, and to emit the final table. Let it measure
> the formatted length when no seq_file is supplied, and write directly to
> the seq_file during rendering. This preserves the pre-scan behavior while
> removing the temporary string buffers.
>
> Fixes: 23205e6d06d4 ("octeontx2-af: Dump current resource provisioning status")
> Assisted-by: LLM Codex
> Signed-off-by: Heyang Tan <thy15333007817@163.com>
>
> Changes in v3:
> - Format LF lists directly in the seq_file buffer and remove temporary buffers.
> - Measure, rather than emit, LF lists during width calculation and row scans.
> - Explain the two formatter modes in a code comment.
> - Preserve column alignment with seq_setwidth() and seq_pad().
> - Reorder local declarations in reverse Christmas tree order.
>
> Link: https://lore.kernel.org/netdev/20260906141129.1730-1-thy15333007817@163.com/
> ---
> .../marvell/octeontx2/af/rvu_debugfs.c | 114 +++++++++++-------
> 1 file changed, 69 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> index fcbf4ba0e10a..1f177851e76d 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> @@ -646,10 +646,29 @@ static ssize_t rvu_dbg_lmtst_map_table_display(struct file *filp,
>
> RVU_DEBUG_FOPS(lmtst_map_table, lmtst_map_table_display, NULL);
>
> -static void get_lf_str_list(const struct rvu_block *block, int pcifunc,
> - char *lfs)
> +static int get_num_digits(int number)
> {
> - int lf = 0, seq = 0, len = 0, prev_lf = block->lf.max;
> + int width = 1;
> +
> + while (number >= 10) {
> + number /= 10;
> + width++;
> + }
> +
> + return width;
> +}
Sorry for the confusion here! My previous comment was strictly a "nice-to-have"
suggestion and wasn't intended to trigger a larger scope expansion. Given that
this is a targeted bug fix, keeping the diff minimal and low-risk is the
priority. Your v2 patch addressed the core issue cleanly without unnecessary
churn. Could you please revert/repost the v2 version as v4 ? We can always handle any
extra cleanup in a separate follow-up to net-next if needed. Thanks for your help.
prev parent reply other threads:[~2026-09-09 3:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 1:54 Heyang Tan
2026-09-09 2:59 ` Ratheesh Kannoth [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aqDLi-xfsssfP59e@rkannoth-OptiPlex-7090 \
--to=rkannoth@marvell.com \
--cc=gakula@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
--cc=thy15333007817@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®