All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: tftp: Avoid sending extra ack on completion
@ 2021-02-03  8:07 Ramon Fried
  2021-02-03 18:43 ` Suneel Garapati
  0 siblings, 1 reply; 4+ messages in thread
From: Ramon Fried @ 2021-02-03  8:07 UTC (permalink / raw)
  To: u-boot

in tftpboot, if ack was already sent previously for this
packet, don't send again.

Fixes: cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440")

Reported-by: Suneel Garapati <suneelglinux@gmail.com>
Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
---
 net/tftp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/tftp.c b/net/tftp.c
index 03079ded34..1111834f71 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -678,7 +678,8 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		}
 
 		if (len < tftp_block_size) {
-			tftp_send();
+			if (tftp_cur_block != tftp_next_ack)
+				tftp_send();
 			tftp_complete();
 		}
 		break;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] net: tftp: Avoid sending extra ack on completion
  2021-02-03  8:07 [PATCH] net: tftp: Avoid sending extra ack on completion Ramon Fried
@ 2021-02-03 18:43 ` Suneel Garapati
  2021-02-03 19:25   ` Ramon Fried
  0 siblings, 1 reply; 4+ messages in thread
From: Suneel Garapati @ 2021-02-03 18:43 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 3, 2021 at 12:05 AM Ramon Fried <rfried.dev@gmail.com> wrote:
>
> in tftpboot, if ack was already sent previously for this
> packet, don't send again.
>
> Fixes: cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440")
>
> Reported-by: Suneel Garapati <suneelglinux@gmail.com>
> Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
> ---
>  net/tftp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/tftp.c b/net/tftp.c
> index 03079ded34..1111834f71 100644
> --- a/net/tftp.c
> +++ b/net/tftp.c
> @@ -678,7 +678,8 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
>                 }
>
>                 if (len < tftp_block_size) {
> -                       tftp_send();
> +                       if (tftp_cur_block != tftp_next_ack)
> +                               tftp_send();
In the 'if' block above this, next_ack is incremented by window size
already, so for size 1 this condition is always true.
And the extra ack is sent.

>                         tftp_complete();
>                 }
>                 break;
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] net: tftp: Avoid sending extra ack on completion
  2021-02-03 18:43 ` Suneel Garapati
@ 2021-02-03 19:25   ` Ramon Fried
  2021-02-03 20:56     ` Suneel Garapati
  0 siblings, 1 reply; 4+ messages in thread
From: Ramon Fried @ 2021-02-03 19:25 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 3, 2021 at 8:43 PM Suneel Garapati <suneelglinux@gmail.com> wrote:
>
> On Wed, Feb 3, 2021 at 12:05 AM Ramon Fried <rfried.dev@gmail.com> wrote:
> >
> > in tftpboot, if ack was already sent previously for this
> > packet, don't send again.
> >
> > Fixes: cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440")
> >
> > Reported-by: Suneel Garapati <suneelglinux@gmail.com>
> > Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
> > ---
> >  net/tftp.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/tftp.c b/net/tftp.c
> > index 03079ded34..1111834f71 100644
> > --- a/net/tftp.c
> > +++ b/net/tftp.c
> > @@ -678,7 +678,8 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
> >                 }
> >
> >                 if (len < tftp_block_size) {
> > -                       tftp_send();
> > +                       if (tftp_cur_block != tftp_next_ack)
> > +                               tftp_send();
> In the 'if' block above this, next_ack is incremented by window size
> already, so for size 1 this condition is always true.
> And the extra ack is sent.
>
> >                         tftp_complete();
> >                 }
> >                 break;
> > --
> > 2.17.1
> >
Yes, you're right, I'm not next to my setup, so I can't test it properly.
Anyhow, I'm sending V2 now, I think now it's good. Can you test ?
Thanks,
Ramon.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] net: tftp: Avoid sending extra ack on completion
  2021-02-03 19:25   ` Ramon Fried
@ 2021-02-03 20:56     ` Suneel Garapati
  0 siblings, 0 replies; 4+ messages in thread
From: Suneel Garapati @ 2021-02-03 20:56 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 3, 2021 at 11:26 AM Ramon Fried <rfried.dev@gmail.com> wrote:
>
> On Wed, Feb 3, 2021 at 8:43 PM Suneel Garapati <suneelglinux@gmail.com> wrote:
> >
> > On Wed, Feb 3, 2021 at 12:05 AM Ramon Fried <rfried.dev@gmail.com> wrote:
> > >
> > > in tftpboot, if ack was already sent previously for this
> > > packet, don't send again.
> > >
> > > Fixes: cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440")
> > >
> > > Reported-by: Suneel Garapati <suneelglinux@gmail.com>
> > > Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
> > > ---
> > >  net/tftp.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/net/tftp.c b/net/tftp.c
> > > index 03079ded34..1111834f71 100644
> > > --- a/net/tftp.c
> > > +++ b/net/tftp.c
> > > @@ -678,7 +678,8 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
> > >                 }
> > >
> > >                 if (len < tftp_block_size) {
> > > -                       tftp_send();
> > > +                       if (tftp_cur_block != tftp_next_ack)
> > > +                               tftp_send();
> > In the 'if' block above this, next_ack is incremented by window size
> > already, so for size 1 this condition is always true.
> > And the extra ack is sent.
> >
> > >                         tftp_complete();
> > >                 }
> > >                 break;
> > > --
> > > 2.17.1
> > >
> Yes, you're right, I'm not next to my setup, so I can't test it properly.
> Anyhow, I'm sending V2 now, I think now it's good. Can you test ?
> Thanks,
> Ramon.

Tested without issues for window size 1.

Thanks,
Suneel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-03 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03  8:07 [PATCH] net: tftp: Avoid sending extra ack on completion Ramon Fried
2021-02-03 18:43 ` Suneel Garapati
2021-02-03 19:25   ` Ramon Fried
2021-02-03 20:56     ` Suneel Garapati

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.