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=JukwSq1J; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 717F35A0278 for ; Fri, 13 Sep 2024 06:32:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1726201936; bh=Mp/5eh5Mn6ppTk4tVFH+2lb/0hEWQhA6tgFN1PBnwEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JukwSq1JCzf6nQc0jKXehAC+e0eSnmsXcuNI4JqPA/tn0NskyaXezlcK0O+tMEeIY t3MUhhWloSvJhSWZX7WK/8oQZUkl6kfLHDajgeJG9CKKHI97UpZhvSujoEMKBUqF+v +Pn261/UAgrkyXAapjVKRNzt1FIttfHJn+RXNPMMqNBMM742TmZOQrjyCKW97Qdxm3 OSxqJT7KQQPimRjwx113Q0u15vB8Ra0bqTzvz8Uppym9JcnbpmciktDl/DDZRhu8nh d5VBBB/NpD0q6FxKwF+X2bVl09I+yYPzGPFLr6MrgCOrJdyvyZhtrdQ16VTmvciTvP FS2LTEe0nvJ3A== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4X4hH461wkz4xQX; Fri, 13 Sep 2024 14:32:16 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 09/10] tcp: Move deferred handling functions later in tcp.c Date: Fri, 13 Sep 2024 14:32:13 +1000 Message-ID: <20240913043214.1753014-10-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: 7QH5A6SN4FDSHIOXGORD33CL7WUKASVW X-Message-ID-Hash: 7QH5A6SN4FDSHIOXGORD33CL7WUKASVW 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: Future changes will want these functions to call things that are currently below them in the file, so move them later. Code motion only, no change to logic for now. Signed-off-by: David Gibson --- tcp.c | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tcp.c b/tcp.c index 4b478432..78f546db 100644 --- a/tcp.c +++ b/tcp.c @@ -853,35 +853,6 @@ static int tcp_opt_get(const char *opts, size_t len, uint8_t type_find, return -1; } -/** - * tcp_flow_defer() - Deferred per-flow handling (clean up closed connections) - * @conn: Connection to handle - * - * Return: true if the connection is ready to free, false otherwise - */ -bool tcp_flow_defer(const struct tcp_tap_conn *conn) -{ - if (conn->events != CLOSED) - return false; - - close(conn->sock); - if (conn->timer != -1) - close(conn->timer); - - return true; -} - -/** - * tcp_defer_handler() - Handler for TCP deferred tasks - * @c: Execution context - */ -/* cppcheck-suppress [constParameterPointer, unmatchedSuppression] */ -void tcp_defer_handler(struct ctx *c) -{ - tcp_flags_flush(c); - tcp_payload_flush(c); -} - /** * tcp_fill_header() - Fill the TCP header fields for a given TCP segment. * @@ -2272,6 +2243,35 @@ void tcp_sock_handler(const struct ctx *c, union epoll_ref ref, } } +/** + * tcp_flow_defer() - Deferred per-flow handling (clean up closed connections) + * @conn: Connection to handle + * + * Return: true if the connection is ready to free, false otherwise + */ +bool tcp_flow_defer(const struct tcp_tap_conn *conn) +{ + if (conn->events != CLOSED) + return false; + + close(conn->sock); + if (conn->timer != -1) + close(conn->timer); + + return true; +} + +/** + * tcp_defer_handler() - Handler for TCP deferred tasks + * @c: Execution context + */ +/* cppcheck-suppress [constParameterPointer, unmatchedSuppression] */ +void tcp_defer_handler(struct ctx *c) +{ + tcp_flags_flush(c); + tcp_payload_flush(c); +} + /** * tcp_sock_init_af() - Initialise listening socket for a given af and port * @c: Execution context -- 2.46.0