As proposed in [1] here is are the fixes as a patch series that do the
premature end-of-loop check within the goto loop.
Jochen Henneberg (2):
net: stmmac: Premature loop termination check was ignored
net: stmmac: Premature loop termination check was ignored
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[1] https://lore.kernel.org/all/Y%2FdiTAg2iUopr%[email protected]/
--
2.39.2
The premature loop termination check makes sense only in case of the
jump to read_again where the count may have been updated. But
read_again did not include the check.
Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
Signed-off-by: Jochen Henneberg <[email protected]>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e4902a7bb61e..ea51c7c93101 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5221,10 +5221,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
len = 0;
}
+read_again:
if (count >= limit)
break;
-read_again:
buf1_len = 0;
buf2_len = 0;
entry = next_entry;
--
2.39.2
The premature loop termination check makes sense only in case of the
jump to read_again where the count may have been updated. But
read_again did not include the check.
Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Signed-off-by: Jochen Henneberg <[email protected]>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ea51c7c93101..4886668a54c5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5031,10 +5031,10 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
len = 0;
}
+read_again:
if (count >= limit)
break;
-read_again:
buf1_len = 0;
entry = next_entry;
buf = &rx_q->buf_pool[entry];
--
2.39.2
On Tue, Mar 14, 2023 at 01:37:58PM +0100, Jochen Henneberg wrote:
> The premature loop termination check makes sense only in case of the
> jump to read_again where the count may have been updated. But
> read_again did not include the check.
Your commit titles and messages seems identical in both patches, someone
may get confused, maybe you could change commit titles at least?
Or since those are very related one liner fixes, maybe combine them into
one?
Also a question, since you in generally goto backwards here, is it guarded from
an infinite loop (during some corner case scenario maybe)?
Other than that looks fine, thanks.
Reviewed-by: Piotr Raczynski <[email protected]>
>
> Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
> Signed-off-by: Jochen Henneberg <[email protected]>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e4902a7bb61e..ea51c7c93101 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -5221,10 +5221,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
> len = 0;
> }
>
> +read_again:
> if (count >= limit)
> break;
>
> -read_again:
> buf1_len = 0;
> buf2_len = 0;
> entry = next_entry;
> --
> 2.39.2
>
Piotr Raczynski <[email protected]> writes:
> On Tue, Mar 14, 2023 at 01:37:58PM +0100, Jochen Henneberg wrote:
>> The premature loop termination check makes sense only in case of the
>> jump to read_again where the count may have been updated. But
>> read_again did not include the check.
>
> Your commit titles and messages seems identical in both patches, someone
> may get confused, maybe you could change commit titles at least?
>
> Or since those are very related one liner fixes, maybe combine them into
> one?
I was told to split them into a series because the fixes apply to
different kernel versions.
>
> Also a question, since you in generally goto backwards here, is it guarded from
> an infinite loop (during some corner case scenario maybe)?
In theory I think this may happen, however, I would consider that to be
a different patch since it addresses a different issue.
>
> Other than that looks fine, thanks.
> Reviewed-by: Piotr Raczynski <[email protected]>
>
>>
>> Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
>> Signed-off-by: Jochen Henneberg <[email protected]>
>> ---
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index e4902a7bb61e..ea51c7c93101 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -5221,10 +5221,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
>> len = 0;
>> }
>>
>> +read_again:
>> if (count >= limit)
>> break;
>>
>> -read_again:
>> buf1_len = 0;
>> buf2_len = 0;
>> entry = next_entry;
>> --
>> 2.39.2
>>
--
Henneberg - Systemdesign
Jochen Henneberg
Loehnfeld 26
21423 Winsen (Luhe)
--
Fon: +49 172 160 14 69
Url: https://www.henneberg-systemdesign.com
On Tue, Mar 14, 2023 at 04:01:11PM +0100, Jochen Henneberg wrote:
>
> Piotr Raczynski <[email protected]> writes:
>
> > On Tue, Mar 14, 2023 at 01:37:58PM +0100, Jochen Henneberg wrote:
> >> The premature loop termination check makes sense only in case of the
> >> jump to read_again where the count may have been updated. But
> >> read_again did not include the check.
> >
> > Your commit titles and messages seems identical in both patches, someone
> > may get confused, maybe you could change commit titles at least?
> >
> > Or since those are very related one liner fixes, maybe combine them into
> > one?
>
> I was told to split them into a series because the fixes apply to
> different kernel versions.
>
Makes sense, thanks. However I'd still at least modify title to show
which patch fixes zc path or anything to distinguish them beside commit
sha.
> >
> > Also a question, since you in generally goto backwards here, is it guarded from
> > an infinite loop (during some corner case scenario maybe)?
>
> In theory I think this may happen, however, I would consider that to be
> a different patch since it addresses a different issue.
>
Right, it just caught my attention, probably just make sense to check
it.
> >
> > Other than that looks fine, thanks.
> > Reviewed-by: Piotr Raczynski <[email protected]>
> >
> >>
> >> Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
> >> Signed-off-by: Jochen Henneberg <[email protected]>
> >> ---
> >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> >> index e4902a7bb61e..ea51c7c93101 100644
> >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> >> @@ -5221,10 +5221,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
> >> len = 0;
> >> }
> >>
> >> +read_again:
> >> if (count >= limit)
> >> break;
> >>
> >> -read_again:
> >> buf1_len = 0;
> >> buf2_len = 0;
> >> entry = next_entry;
> >> --
> >> 2.39.2
> >>
>
>
> --
> Henneberg - Systemdesign
> Jochen Henneberg
> Loehnfeld 26
> 21423 Winsen (Luhe)
> --
> Fon: +49 172 160 14 69
> Url: https://www.henneberg-systemdesign.com
Piotr Raczynski <[email protected]> writes:
> On Tue, Mar 14, 2023 at 04:01:11PM +0100, Jochen Henneberg wrote:
>>
>> Piotr Raczynski <[email protected]> writes:
>>
>> > On Tue, Mar 14, 2023 at 01:37:58PM +0100, Jochen Henneberg wrote:
>> >> The premature loop termination check makes sense only in case of the
>> >> jump to read_again where the count may have been updated. But
>> >> read_again did not include the check.
>> >
>> > Your commit titles and messages seems identical in both patches, someone
>> > may get confused, maybe you could change commit titles at least?
>> >
>> > Or since those are very related one liner fixes, maybe combine them into
>> > one?
>>
>> I was told to split them into a series because the fixes apply to
>> different kernel versions.
>>
> Makes sense, thanks. However I'd still at least modify title to show
> which patch fixes zc path or anything to distinguish them beside commit
> sha.
Will do.
>> >
>> > Also a question, since you in generally goto backwards here, is it guarded from
>> > an infinite loop (during some corner case scenario maybe)?
>>
>> In theory I think this may happen, however, I would consider that to be
>> a different patch since it addresses a different issue.
>>
>
> Right, it just caught my attention, probably just make sense to check
> it.
I will take a look. Really, from code readability the driver is in a bad
shape, comments do not match code, bool and int are mixed for flags and
bool parameters are set with int values, DMA memory barriers are set
inconsistently and many more. This makes it hard to be sure what things
really do and follow code paths. I will try to check this issue and
provide a fix if necessary.
Btw., shall I copy your Reviewed-by and the reviewed-by from previous
patches into the new series or do you set the tag again on the V2
series?
>> >
>> > Other than that looks fine, thanks.
>> > Reviewed-by: Piotr Raczynski <[email protected]>
>> >
>> >>
>> >> Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
>> >> Signed-off-by: Jochen Henneberg <[email protected]>
>> >> ---
>> >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>> >> 1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> >> index e4902a7bb61e..ea51c7c93101 100644
>> >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> >> @@ -5221,10 +5221,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
>> >> len = 0;
>> >> }
>> >>
>> >> +read_again:
>> >> if (count >= limit)
>> >> break;
>> >>
>> >> -read_again:
>> >> buf1_len = 0;
>> >> buf2_len = 0;
>> >> entry = next_entry;
>> >> --
>> >> 2.39.2
>> >>
>>
>>
>> --
>> Henneberg - Systemdesign
>> Jochen Henneberg
>> Loehnfeld 26
>> 21423 Winsen (Luhe)
>> --
>> Fon: +49 172 160 14 69
>> Url: https://www.henneberg-systemdesign.com
--
Henneberg - Systemdesign
Jochen Henneberg
Loehnfeld 26
21423 Winsen (Luhe)
--
Fon: +49 172 160 14 69
Url: https://www.henneberg-systemdesign.com
As proposed in [1] here is are the fixes as a patch series that do the
premature end-of-loop check within the goto loop.
The commit messages now tell us which rx path has been fixed.
Jochen Henneberg (2):
net: stmmac: Premature loop termination check was ignored on rx
net: stmmac: Premature loop termination check was ignored on ZC rx
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[1] https://lore.kernel.org/all/Y%2FdiTAg2iUopr%[email protected]
--
2.39.2
The 03/16/2023 08:59, Jochen Henneberg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> As proposed in [1] here is are the fixes as a patch series that do the
> premature end-of-loop check within the goto loop.
>
> The commit messages now tell us which rx path has been fixed.
Reviewed-by: Horatiu Vultur <[email protected]>
>
> Jochen Henneberg (2):
> net: stmmac: Premature loop termination check was ignored on rx
> net: stmmac: Premature loop termination check was ignored on ZC rx
>
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> [1] https://lore.kernel.org/all/Y%2FdiTAg2iUopr%[email protected]
> --
> 2.39.2
>
--
/Horatiu
On Thu, Mar 16, 2023 at 08:59:38AM +0100, Jochen Henneberg wrote:
> As proposed in [1] here is are the fixes as a patch series that do the
> premature end-of-loop check within the goto loop.
>
> The commit messages now tell us which rx path has been fixed.
>
> Jochen Henneberg (2):
> net: stmmac: Premature loop termination check was ignored on rx
> net: stmmac: Premature loop termination check was ignored on ZC rx
Thanks for differentiating commit messages
>
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> [1] https://lore.kernel.org/all/Y%2FdiTAg2iUopr%[email protected]
> --
> 2.39.2
>