diff mbox series

[RESEND,v3,8/9] net/tcp: define a fallback value for rcv_wnd size

Message ID 20240814103145.1347645-9-mikhail.kshevetskiy@iopsys.eu
State Superseded
Delegated to: Ramon Fried
Headers show
Series net: tcp: improve tcp support | expand

Commit Message

Mikhail Kshevetskiy Aug. 14, 2024, 10:31 a.m. UTC
Some driver implements it's own network packet pool, so PKTBUFSRX is zero.
This results in zero-size TCP receive window, so data transfer doesn't
work. Avod it by setting a reasonable fallback value.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
 net/tcp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Simon Glass Aug. 17, 2024, 3:58 p.m. UTC | #1
On Wed, 14 Aug 2024 at 04:32, Mikhail Kshevetskiy
<mikhail.kshevetskiy@iopsys.eu> wrote:
>
> Some driver implements it's own network packet pool, so PKTBUFSRX is zero.
> This results in zero-size TCP receive window, so data transfer doesn't
> work. Avod it by setting a reasonable fallback value.
>
> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
> ---
>  net/tcp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>


>
> diff --git a/net/tcp.c b/net/tcp.c
> index 7014d5b4f43..f0889d72d44 100644
> --- a/net/tcp.c
> +++ b/net/tcp.c
> @@ -28,7 +28,11 @@
>  #define TCP_SEND_TIMEOUT       2000UL
>  #define TCP_RX_INACTIVE_TIMEOUT        30000UL
>  #define TCP_START_SEQ_INC      2153    /* just large prime number */
> -#define TCP_RCV_WND_SIZE       (PKTBUFSRX * TCP_MSS)
> +#if PKTBUFSRX != 0
> +  #define TCP_RCV_WND_SIZE     (PKTBUFSRX * TCP_MSS)
> +#else
> +  #define TCP_RCV_WND_SIZE     (4 * TCP_MSS)
> +#endif
>
>  #define TCP_PACKET_OK          0
>  #define TCP_PACKET_DROP                1
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/net/tcp.c b/net/tcp.c
index 7014d5b4f43..f0889d72d44 100644
--- a/net/tcp.c
+++ b/net/tcp.c
@@ -28,7 +28,11 @@ 
 #define TCP_SEND_TIMEOUT	2000UL
 #define TCP_RX_INACTIVE_TIMEOUT	30000UL
 #define TCP_START_SEQ_INC	2153	/* just large prime number */
-#define TCP_RCV_WND_SIZE	(PKTBUFSRX * TCP_MSS)
+#if PKTBUFSRX != 0
+  #define TCP_RCV_WND_SIZE	(PKTBUFSRX * TCP_MSS)
+#else
+  #define TCP_RCV_WND_SIZE	(4 * TCP_MSS)
+#endif
 
 #define TCP_PACKET_OK		0
 #define TCP_PACKET_DROP		1