public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] tcp: remove useless assignment
@ 2023-11-28 16:54 Laurent Vivier
  2023-11-29  2:34 ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Vivier @ 2023-11-28 16:54 UTC (permalink / raw)
  To: passt-dev; +Cc: Laurent Vivier, sbrivio

In tcp_send_flag(), a4826ee04b76 has replaced:

    th->doff = sizeof(*th) / 4;
    th->doff += OPT_MSS_LEN / 4;
    th->doff += (1 + OPT_WS_LEN) / 4;

by

    optlen = OPT_MSS_LEN + 1 + OPT_WS_LEN;
    th->doff = (sizeof(*th) + optlen) / 4;

but forgot to remove the useless "th->doff += (1 + OPT_WS_LEN) / 4;"

Fixes: a4826ee04b76 ("tcp: Defer and coalesce all segments with no data (flags) to handler")
Cc: sbrivio@redhat.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 tcp.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tcp.c b/tcp.c
index 40e3dec1ca2d..bf5f315afcac 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1693,7 +1693,6 @@ static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
 		*(uint16_t *)data = htons(MIN(USHRT_MAX, mss));
 
 		data += OPT_MSS_LEN - 2;
-		th->doff += OPT_MSS_LEN / 4;
 
 		conn->ws_to_tap = MIN(MAX_WS, tinfo.tcpi_snd_wscale);
 
-- 
@@ -1693,7 +1693,6 @@ static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
 		*(uint16_t *)data = htons(MIN(USHRT_MAX, mss));
 
 		data += OPT_MSS_LEN - 2;
-		th->doff += OPT_MSS_LEN / 4;
 
 		conn->ws_to_tap = MIN(MAX_WS, tinfo.tcpi_snd_wscale);
 
-- 
2.42.0


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

* Re: [PATCH] tcp: remove useless assignment
  2023-11-28 16:54 [PATCH] tcp: remove useless assignment Laurent Vivier
@ 2023-11-29  2:34 ` David Gibson
  2023-12-04  9:54   ` Stefano Brivio
  0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2023-11-29  2:34 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: passt-dev, sbrivio

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

On Tue, Nov 28, 2023 at 05:54:23PM +0100, Laurent Vivier wrote:
> In tcp_send_flag(), a4826ee04b76 has replaced:
> 
>     th->doff = sizeof(*th) / 4;
>     th->doff += OPT_MSS_LEN / 4;
>     th->doff += (1 + OPT_WS_LEN) / 4;
> 
> by
> 
>     optlen = OPT_MSS_LEN + 1 + OPT_WS_LEN;
>     th->doff = (sizeof(*th) + optlen) / 4;
> 
> but forgot to remove the useless "th->doff += (1 + OPT_WS_LEN) / 4;"
> 
> Fixes: a4826ee04b76 ("tcp: Defer and coalesce all segments with no data (flags) to handler")
> Cc: sbrivio@redhat.com
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  tcp.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/tcp.c b/tcp.c
> index 40e3dec1ca2d..bf5f315afcac 100644
> --- a/tcp.c
> +++ b/tcp.c
> @@ -1693,7 +1693,6 @@ static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
>  		*(uint16_t *)data = htons(MIN(USHRT_MAX, mss));
>  
>  		data += OPT_MSS_LEN - 2;
> -		th->doff += OPT_MSS_LEN / 4;
>  
>  		conn->ws_to_tap = MIN(MAX_WS, tinfo.tcpi_snd_wscale);
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] tcp: remove useless assignment
  2023-11-29  2:34 ` David Gibson
@ 2023-12-04  9:54   ` Stefano Brivio
  0 siblings, 0 replies; 3+ messages in thread
From: Stefano Brivio @ 2023-12-04  9:54 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: David Gibson, passt-dev

On Wed, 29 Nov 2023 13:34:32 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Tue, Nov 28, 2023 at 05:54:23PM +0100, Laurent Vivier wrote:
> > In tcp_send_flag(), a4826ee04b76 has replaced:
> > 
> >     th->doff = sizeof(*th) / 4;
> >     th->doff += OPT_MSS_LEN / 4;
> >     th->doff += (1 + OPT_WS_LEN) / 4;
> > 
> > by
> > 
> >     optlen = OPT_MSS_LEN + 1 + OPT_WS_LEN;
> >     th->doff = (sizeof(*th) + optlen) / 4;
> > 
> > but forgot to remove the useless "th->doff += (1 + OPT_WS_LEN) / 4;"
> > 
> > Fixes: a4826ee04b76 ("tcp: Defer and coalesce all segments with no data (flags) to handler")
> > Cc: sbrivio@redhat.com
> > Signed-off-by: Laurent Vivier <lvivier@redhat.com>  
> 
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

Applied.

-- 
Stefano


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

end of thread, other threads:[~2023-12-04  9:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 16:54 [PATCH] tcp: remove useless assignment Laurent Vivier
2023-11-29  2:34 ` David Gibson
2023-12-04  9:54   ` Stefano Brivio

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).