Re: [PATCH net-next V2 12/13] selftests: drv-net: psp: Fix responder parsing
From: Cosmin Ratiu
Date: Tue Aug 11 2026 - 10:59:37 EST
On Tue, 2026-08-11 at 07:51 -0700, Jakub Kicinski wrote:
> On Tue, 11 Aug 2026 12:41:14 +0000 Cosmin Ratiu wrote:
> > > > I actually replaced n by off. Did you mean "don't replace n by
> > > > off"?
> > >
> > > Of course!
> > >
> > > > Because the two are identical after the recv error checking. I
> > > > don't
> > > > see the point of maintaining two variables when one suffices.
> > > > Either n
> > > > or off can describe the number of bytes in buf. off is static
> > > > and
> > > > persists across chunks, while n is temporary.
> > >
> > > The variables have semantic meaning, which makes it easier to
> > > follow
> > > the code.
> > >
> > > > So to clarify, do you want to keep both?
> > >
> > > Yes.
> >
> > I'm sorry, but the code is wrong.
> > cmd() matches on n (which never changes!) but __consume() only
> > decrements off. Strap a loop on top and the result is just
> > confusion
> > and a source of bugs (e.g. the one I'm trying to fix with this
> > patch).
> >
> > A single variable should be used to keep track of the length of
> > data
> > left to parse.
>
> and in your opinion that variable, which represents the amount of
> data
> left to parse is supposed to be called "off" ?
"off" is clearly not a great name, it focuses on the offset in the
buffer where data should be received. Perhaps it could be renamed to
"len"? And then perhaps I can rephrase this patch as "Fix psp_responder
parsing"?
Cosmin.