From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 4AFF05A027C for ; Tue, 6 Feb 2024 02:17:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707182260; bh=S19MqhJq/x6j2Nuv87KdOamS89XXzJYvp6YsYr1uoC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mSFQqqylNe0T+QYD53h2O0qMp0WXFjsweDBsVv1NezrcFgwazFN9jI8qnFUM1ssxP 7v+YhniSdiyTCsZZi3CJ+0xRorOWxfr3BYyFmxbAnq1B3SSjLMq2lb8lseiDA2Ym/H AlQCk+VnVOm4t5+Xu8KiNvKfBLk4d7oF8U6JgJG5h9jOv0tyLUypQct9UttgSDuNdQ lQaac0FQR8fApd5An0dSmV/6GjGcbch+p25lV5ZiHJsg9FWcuMQePTJALZJAvICmcc iaZELToQDEzTc4rybuMwfgUGR7bNhbp+QbAUqvfEJgJ4EDX1lkPtcuKhTXIiUyYi6G gr4UZcQc6aC8A== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TTQN40qbHz4wyq; Tue, 6 Feb 2024 12:17:40 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 10/22] tcp_splice: Don't use flow_trace() before setting flow type Date: Tue, 6 Feb 2024 12:17:22 +1100 Message-ID: <20240206011734.884138-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206011734.884138-1-david@gibson.dropbear.id.au> References: <20240206011734.884138-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: SPECVZT7GCGOQ3UJO6K6PNCYYHWRRVUU X-Message-ID-Hash: SPECVZT7GCGOQ3UJO6K6PNCYYHWRRVUU 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: In tcp_splice_conn_from_sock() we can call flow_trace() if there's an error setting TCP_QUICKACK. However, we do so before we've set the flow type in the flow entry. That means that flow_trace() will print nonsense when it tries to print the flow type. There's no reason the setsockopt() has to happen before initialising the flow entry, so just move it after. Signed-off-by: David Gibson --- tcp_splice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcp_splice.c b/tcp_splice.c index f0343eb5..180a9ea7 100644 --- a/tcp_splice.c +++ b/tcp_splice.c @@ -445,9 +445,6 @@ bool tcp_splice_conn_from_sock(const struct ctx *c, if (!inany_is_loopback(&aany)) return false; - if (setsockopt(s, SOL_TCP, TCP_QUICKACK, &((int){ 1 }), sizeof(int))) - flow_trace(conn, "failed to set TCP_QUICKACK on %i", s); - conn->f.type = FLOW_TCP_SPLICE; conn->flags = inany_v4(&aany) ? 0 : SPLICE_V6; conn->s[0] = s; @@ -455,6 +452,9 @@ bool tcp_splice_conn_from_sock(const struct ctx *c, conn->pipe[0][0] = conn->pipe[0][1] = -1; conn->pipe[1][0] = conn->pipe[1][1] = -1; + if (setsockopt(s, SOL_TCP, TCP_QUICKACK, &((int){ 1 }), sizeof(int))) + flow_trace(conn, "failed to set TCP_QUICKACK on %i", s); + if (tcp_splice_new(c, conn, ref.port, ref.pif)) conn_flag(c, conn, CLOSING); -- 2.43.0