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 78B765A05BD for ; Fri, 3 May 2024 03:11:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1714698697; bh=xCIPzS8C2HD2y9iVoM20RkFVdDsZeoWAP9YaUfHCYQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJ/xiAQ48h4ps+tCM8b7rSxYmjqA8fXT5XaX8fJI/YIKLVItA4bel54pqHR89rWhd YXB98RGRFC1uaQLmoPJP/27QUxp3qKfPTUdKFnXUJLvOrfNXZVAPlh/7lZtBwk+Of8 0slVp56LOKMhYpsunbqbWAxFEBIn8mYuKvE5JrQyX+uWeA5OEOM8Zgrck8nmGUe5c3 HjPqviSrmOy4xfnYzYjeepqvOI2kvmgHMPB9mBy1w9PtPGWTAjxUG/HDa74JvH2xrH 1ZyWPkIHpIp8GOu2FkIlQ2cUDOv80M3XeU+vtbMo4tHHS6j8Z5vUojauDrSlKN3sd8 Ls/UZyAHPRT5w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4VVt6x5jMCz4xM5; Fri, 3 May 2024 11:11:37 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v4 07/16] tcp_splice: Eliminate SPLICE_V6 flag Date: Fri, 3 May 2024 11:11:26 +1000 Message-ID: <20240503011135.2924437-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240503011135.2924437-1-david@gibson.dropbear.id.au> References: <20240503011135.2924437-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: AXMAY4MKCOLI244PCRN5S24EBX6NR5VO X-Message-ID-Hash: AXMAY4MKCOLI244PCRN5S24EBX6NR5VO 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: 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 | 11 +++++------ tcp_splice.c | 3 --- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tcp_conn.h b/tcp_conn.h index f55f144..dd31d10 100644 --- a/tcp_conn.h +++ b/tcp_conn.h @@ -129,12 +129,11 @@ struct tcp_splice_conn { #define FIN_SENT_1 BIT(7) uint8_t flags; -#define SPLICE_V6 BIT(0) -#define RCVLOWAT_SET_0 BIT(1) -#define RCVLOWAT_SET_1 BIT(2) -#define RCVLOWAT_ACT_0 BIT(3) -#define RCVLOWAT_ACT_1 BIT(4) -#define CLOSING BIT(5) +#define RCVLOWAT_SET_0 BIT(0) +#define RCVLOWAT_SET_1 BIT(1) +#define RCVLOWAT_ACT_0 BIT(2) +#define RCVLOWAT_ACT_1 BIT(3) +#define CLOSING BIT(4) uint32_t read[SIDES]; uint32_t written[SIDES]; diff --git a/tcp_splice.c b/tcp_splice.c index aa04a9b..00b88c5 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)) #define CONN(idx) (&FLOW(idx)->tcp_splice) @@ -459,7 +457,6 @@ bool tcp_splice_conn_from_sock(const struct ctx *c, in_port_t dstport, conn = FLOW_START(flow, FLOW_TCP_SPLICE, tcp_splice, 0); - 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.44.0