public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2] net: tftp: Avoid sending extra ack on completion
@ 2021-02-03 19:28 Ramon Fried
  2021-02-03 20:57 ` Suneel Garapati
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ramon Fried @ 2021-02-03 19:28 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>
---
v2: Fix it so it actually works :)

 net/tftp.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/tftp.c b/net/tftp.c
index 03079ded34..6b781ccf67 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -668,6 +668,12 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			break;
 		}
 
+		if (len < tftp_block_size) {
+			tftp_send();
+			tftp_complete();
+			break;
+		}
+
 		/*
 		 *	Acknowledge the block just received, which will prompt
 		 *	the remote for the next one.
@@ -676,11 +682,6 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			tftp_send();
 			tftp_next_ack += tftp_windowsize;
 		}
-
-		if (len < tftp_block_size) {
-			tftp_send();
-			tftp_complete();
-		}
 		break;
 
 	case TFTP_ERROR:
-- 
2.17.1

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

* [PATCH v2] net: tftp: Avoid sending extra ack on completion
  2021-02-03 19:28 [PATCH v2] net: tftp: Avoid sending extra ack on completion Ramon Fried
@ 2021-02-03 20:57 ` Suneel Garapati
  2021-02-17 10:27 ` Oliver Graute
  2021-02-18 16:12 ` Tom Rini
  2 siblings, 0 replies; 5+ messages in thread
From: Suneel Garapati @ 2021-02-03 20:57 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 3, 2021 at 11:26 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>
> ---
> v2: Fix it so it actually works :)
>
>  net/tftp.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/net/tftp.c b/net/tftp.c
> index 03079ded34..6b781ccf67 100644
> --- a/net/tftp.c
> +++ b/net/tftp.c
> @@ -668,6 +668,12 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
>                         break;
>                 }
>
> +               if (len < tftp_block_size) {
> +                       tftp_send();
> +                       tftp_complete();
> +                       break;
> +               }
> +
>                 /*
>                  *      Acknowledge the block just received, which will prompt
>                  *      the remote for the next one.
> @@ -676,11 +682,6 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
>                         tftp_send();
>                         tftp_next_ack += tftp_windowsize;
>                 }
> -
> -               if (len < tftp_block_size) {
> -                       tftp_send();
> -                       tftp_complete();
> -               }
>                 break;
>
>         case TFTP_ERROR:
> --
> 2.17.1
>
Tested-by: Suneel Garapati <suneelglinux@gmail.com>

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

* [PATCH v2] net: tftp: Avoid sending extra ack on completion
  2021-02-03 19:28 [PATCH v2] net: tftp: Avoid sending extra ack on completion Ramon Fried
  2021-02-03 20:57 ` Suneel Garapati
@ 2021-02-17 10:27 ` Oliver Graute
  2021-02-18  7:14   ` Ramon Fried
  2021-02-18 16:12 ` Tom Rini
  2 siblings, 1 reply; 5+ messages in thread
From: Oliver Graute @ 2021-02-17 10:27 UTC (permalink / raw)
  To: u-boot

On 03/02/21, Ramon Fried 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>

Tested-by: Oliver Graute <oliver.graute@kococonnector.com>

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

* [PATCH v2] net: tftp: Avoid sending extra ack on completion
  2021-02-17 10:27 ` Oliver Graute
@ 2021-02-18  7:14   ` Ramon Fried
  0 siblings, 0 replies; 5+ messages in thread
From: Ramon Fried @ 2021-02-18  7:14 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 17, 2021 at 12:29 PM Oliver Graute <oliver.graute@gmail.com> wrote:
>
> On 03/02/21, Ramon Fried 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>
>
> Tested-by: Oliver Graute <oliver.graute@kococonnector.com>

Tom, can you please merge this ?
This is an important bug fix that should be merged asap.

Thanks,
Ramon.

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

* [PATCH v2] net: tftp: Avoid sending extra ack on completion
  2021-02-03 19:28 [PATCH v2] net: tftp: Avoid sending extra ack on completion Ramon Fried
  2021-02-03 20:57 ` Suneel Garapati
  2021-02-17 10:27 ` Oliver Graute
@ 2021-02-18 16:12 ` Tom Rini
  2 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2021-02-18 16:12 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 03, 2021 at 09:28:59PM +0200, Ramon Fried 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>
> Tested-by: Suneel Garapati <suneelglinux@gmail.com>
> Tested-by: Oliver Graute <oliver.graute@kococonnector.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210218/15744abf/attachment.sig>

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

end of thread, other threads:[~2021-02-18 16:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-03 19:28 [PATCH v2] net: tftp: Avoid sending extra ack on completion Ramon Fried
2021-02-03 20:57 ` Suneel Garapati
2021-02-17 10:27 ` Oliver Graute
2021-02-18  7:14   ` Ramon Fried
2021-02-18 16:12 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox