From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id B40725A031D for ; Thu, 18 Jul 2024 07:27:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1721280418; bh=cNI32PInWoYRCYwMzMzgHLg2W8T48ArjC9XcQ8OSfuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/P/LjgNrnEJeBOgQjGDdRC6IeF/VI1vQt3ddNIuv1/qWLXO2d1QFL+QViEd6yH+8 1teQBwtlEXgF2v6Jvuk7VMhL2Xiycg/HxbXfqQm6883ZLWbZfwT5fQliMFGN3jIaSk pHIgrc28Wwggiw2bof2a4aJv4AMRkOy53BiXfsRpaloGaOL3YVUHzejgW2zB7BVPqY p8/i3C3ey6jPnYPCJaXK4udGqZliUi19bQErOZYe9e/CAoVGsuseTVh4ktMXKzEep0 q/NMXSF5Bu/eFlFF3kTAFrZ+OrBAp5iU2iM+K2F6RbdkqGPujksujZJe6xCjbDchGy ke1N6Gl8kc1sg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WPhBV62cxz4x1y; Thu, 18 Jul 2024 15:26:58 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v8 07/27] tcp_splice: Eliminate SPLICE_V6 flag Date: Thu, 18 Jul 2024 15:26:33 +1000 Message-ID: <20240718052653.3241585-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240718052653.3241585-1-david@gibson.dropbear.id.au> References: <20240718052653.3241585-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: EB3EOPGDVASZSZXNVMCXZ4P2NJLJKCJO X-Message-ID-Hash: EB3EOPGDVASZSZXNVMCXZ4P2NJLJKCJO 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: jmaloy@redhat.com, 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: Since we're now constructing socket addresses based on information in the flowside, we no longer need an explicit flag to tell if we're dealing with an IPv4 or IPv6 connection. Hence, drop the now unused SPLICE_V6 flag. As well as just simplifying the code, this allows for possible future extensions where we could splice an IPv4 connection to an IPv6 connection or vice versa. Signed-off-by: David Gibson --- tcp_conn.h | 7 +++---- tcp_splice.c | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tcp_conn.h b/tcp_conn.h index 4e7c57a4..6ae05115 100644 --- a/tcp_conn.h +++ b/tcp_conn.h @@ -125,10 +125,9 @@ struct tcp_splice_conn { #define FIN_SENT(sidei_) ((sidei_) ? BIT(7) : BIT(6)) uint8_t flags; -#define SPLICE_V6 BIT(0) -#define RCVLOWAT_SET(sidei_) ((sidei_) ? BIT(2) : BIT(1)) -#define RCVLOWAT_ACT(sidei_) ((sidei_) ? BIT(4) : BIT(3)) -#define CLOSING BIT(5) +#define RCVLOWAT_SET(sidei_) ((sidei_) ? BIT(1) : BIT(0)) +#define RCVLOWAT_ACT(sidei_) ((sidei_) ? BIT(3) : BIT(2)) +#define CLOSING BIT(4) bool in_epoll :1; }; diff --git a/tcp_splice.c b/tcp_splice.c index 608e7f27..c81daeeb 100644 --- a/tcp_splice.c +++ b/tcp_splice.c @@ -73,8 +73,6 @@ static int ns_sock_pool6 [TCP_SOCK_POOL_SIZE]; /* Pool of pre-opened pipes */ static int splice_pipe_pool [TCP_SPLICE_PIPE_POOL_SIZE][2]; -#define CONN_V6(x) ((x)->flags & SPLICE_V6) -#define CONN_V4(x) (!CONN_V6(x)) #define CONN_HAS(conn, set) (((conn)->events & (set)) == (set)) /* Display strings for connection events */ @@ -483,7 +481,6 @@ bool tcp_splice_conn_from_sock(const struct ctx *c, NULL, 0, &in6addr_loopback, dstport); conn = FLOW_SET_TYPE(flow, FLOW_TCP_SPLICE, tcp_splice); - conn->flags = af == AF_INET ? 0 : SPLICE_V6; conn->s[0] = s0; conn->s[1] = -1; conn->pipe[0][0] = conn->pipe[0][1] = -1; -- 2.45.2