From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202408 header.b=f5NWqrtH; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 1BFBC5A0275 for ; Fri, 13 Sep 2024 06:32:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1726201936; bh=CkSqOBlPPWWxOIwSq4KFnlzK4/MfeeuGDaQqdxsc1qQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f5NWqrtH5J0LR2CK+MPUDyzvWhRuzSwsqJ+Gk9MN10jTEkmkpHi5auuzaY3sQZJqg 7hcZWHZk+KcDU5mQ235dQc76AhveqZNWWFZA8IfVVsngE9E0T+wfhjbtcaMFpRufN6 5E9GhUSTuqjikfKEOvukTbHfyFfz1MvfSmu0tuNds/l+whse/6i+U2Q0sQGh/pajDc 4i+4I52IV54mdSVI7eIf4nKChdDVLbXqdruLqvYZnXAEO+E3Z7Q9XGgsCDKOe6ErG4 LrmkRtQiuYNB3HsRiytzFUBDP6LrgUCFKtfikdWreRQSeYalOlq84f7hSLqT7rNNjt 4xZ1Lr2sqYLkw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4X4hH45fnrz4xQN; Fri, 13 Sep 2024 14:32:16 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 04/10] tcp: Make tcp_update_seqack_wnd()s force_seq parameter explicitly boolean Date: Fri, 13 Sep 2024 14:32:08 +1000 Message-ID: <20240913043214.1753014-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240913043214.1753014-1-david@gibson.dropbear.id.au> References: <20240913043214.1753014-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: O343WMHK3KC7G7X2UDFV3V53IJJYAXSJ X-Message-ID-Hash: O343WMHK3KC7G7X2UDFV3V53IJJYAXSJ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This parameter is already treated as a boolean internally. Make it a 'bool' type for clarity. Signed-off-by: David Gibson --- tcp.c | 6 +++--- tcp_buf.c | 2 +- tcp_internal.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tcp.c b/tcp.c index 6733e7e3..ee894c5c 100644 --- a/tcp.c +++ b/tcp.c @@ -1020,7 +1020,7 @@ size_t tcp_l2_buf_fill_headers(const struct tcp_tap_conn *conn, * Return: 1 if sequence or window were updated, 0 otherwise */ int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn, - int force_seq, struct tcp_info *tinfo) + bool force_seq, struct tcp_info *tinfo) { uint32_t prev_wnd_to_tap = conn->wnd_to_tap << conn->ws_to_tap; uint32_t prev_ack_to_tap = conn->seq_ack_to_tap; @@ -1157,7 +1157,7 @@ int tcp_prepare_flags(const struct ctx *c, struct tcp_tap_conn *conn, if (!(conn->flags & LOCAL)) tcp_rtt_dst_check(conn, &tinfo); - if (!tcp_update_seqack_wnd(c, conn, flags, &tinfo) && !flags) + if (!tcp_update_seqack_wnd(c, conn, !!flags, &tinfo) && !flags) return 0; *optlen = 0; @@ -2240,7 +2240,7 @@ void tcp_sock_handler(const struct ctx *c, union epoll_ref ref, tcp_data_from_sock(c, conn); if (events & EPOLLOUT) - tcp_update_seqack_wnd(c, conn, 0, NULL); + tcp_update_seqack_wnd(c, conn, false, NULL); return; } diff --git a/tcp_buf.c b/tcp_buf.c index c886c92b..83f91a37 100644 --- a/tcp_buf.c +++ b/tcp_buf.c @@ -511,7 +511,7 @@ int tcp_buf_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn) last_len = sendlen - (send_bufs - 1) * mss; /* Likely, some new data was acked too. */ - tcp_update_seqack_wnd(c, conn, 0, NULL); + tcp_update_seqack_wnd(c, conn, false, NULL); /* Finally, queue to tap */ dlen = mss; diff --git a/tcp_internal.h b/tcp_internal.h index bd634be1..a450d850 100644 --- a/tcp_internal.h +++ b/tcp_internal.h @@ -93,7 +93,7 @@ size_t tcp_l2_buf_fill_headers(const struct tcp_tap_conn *conn, struct iovec *iov, size_t dlen, const uint16_t *check, uint32_t seq); int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn, - int force_seq, struct tcp_info *tinfo); + bool force_seq, struct tcp_info *tinfo); int tcp_prepare_flags(const struct ctx *c, struct tcp_tap_conn *conn, int flags, struct tcphdr *th, char *data, size_t *optlen); -- 2.46.0