From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 12D025A0308 for ; Wed, 29 May 2024 12:19:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716977959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NS6oYHmgy6Iqu9z+BjfF4sW299n5xX2jOYrDIpSNZ6g=; b=PDgNsxv0yEwfHidmfvDk24KhTojTeefRBfwI5DYss8u/wGF14GuM4RECj8JBN8+mWlJc76 Mizx7XTZCCDBhEuKrdNNSPZPiTuR10o11REj+myMMiBAOR6qdz1gDt48qPs3j0btnYj8cc xsPSnVacgsHG0Q1GrMtzU+YcI1xDcqY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-134-8ImqHSDBOBC-_cCqWHg9Lg-1; Wed, 29 May 2024 06:19:18 -0400 X-MC-Unique: 8ImqHSDBOBC-_cCqWHg9Lg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DDFF081101D for ; Wed, 29 May 2024 10:19:17 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.192.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D3EB28E5; Wed, 29 May 2024 10:19:17 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v3 10/11] tcp: remove tap_hdr parameter Date: Wed, 29 May 2024 12:19:08 +0200 Message-ID: <20240529101909.1120078-11-lvivier@redhat.com> In-Reply-To: <20240529101909.1120078-1-lvivier@redhat.com> References: <20240529101909.1120078-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: PG3IC3TJTW3V3EUV6EEHDI47ZDO2Q3DO X-Message-ID-Hash: PG3IC3TJTW3V3EUV6EEHDI47ZDO2Q3DO X-MailFrom: lvivier@redhat.com 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: Laurent Vivier 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: As tap_hdr is not used with vhost-user, remove it from tcp_fill_headers4() and tcp_fill_headers6() Signed-off-by: Laurent Vivier --- tcp.c | 8 -------- tcp_buf.c | 18 ++++++++++++++---- tcp_internal.h | 2 -- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tcp.c b/tcp.c index 28909caa7055..0dcec66b3391 100644 --- a/tcp.c +++ b/tcp.c @@ -1017,7 +1017,6 @@ static void tcp_fill_header(struct tcphdr *th, * tcp_fill_headers4() - Fill 802.3, IPv4, TCP headers in pre-cooked buffers * @c: Execution context * @conn: Connection pointer - * @taph: tap backend specific header * @iph: Pointer to IPv4 header * @th: Pointer to TCP header * @dlen: TCP payload length @@ -1028,7 +1027,6 @@ static void tcp_fill_header(struct tcphdr *th, */ size_t tcp_fill_headers4(const struct ctx *c, const struct tcp_tap_conn *conn, - struct tap_hdr *taph, struct iphdr *iph, struct tcphdr *th, size_t dlen, const uint16_t *check, uint32_t seq) @@ -1051,8 +1049,6 @@ size_t tcp_fill_headers4(const struct ctx *c, tcp_update_check_tcp4(iph, th); - tap_hdr_update(taph, l3len + sizeof(struct ethhdr)); - return l4len; } @@ -1060,7 +1056,6 @@ size_t tcp_fill_headers4(const struct ctx *c, * tcp_fill_headers6() - Fill 802.3, IPv6, TCP headers in pre-cooked buffers * @c: Execution context * @conn: Connection pointer - * @taph: tap backend specific header * @ip6h: Pointer to IPv6 header * @th: Pointer to TCP header * @dlen: TCP payload length @@ -1071,7 +1066,6 @@ size_t tcp_fill_headers4(const struct ctx *c, */ size_t tcp_fill_headers6(const struct ctx *c, const struct tcp_tap_conn *conn, - struct tap_hdr *taph, struct ipv6hdr *ip6h, struct tcphdr *th, size_t dlen, uint32_t seq) { @@ -1096,8 +1090,6 @@ size_t tcp_fill_headers6(const struct ctx *c, tcp_update_check_tcp6(ip6h, th); - tap_hdr_update(taph, l4len + sizeof(*ip6h) + sizeof(struct ethhdr)); - return l4len; } diff --git a/tcp_buf.c b/tcp_buf.c index 8a783c6fd81a..0731d8c0356f 100644 --- a/tcp_buf.c +++ b/tcp_buf.c @@ -307,10 +307,12 @@ int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags) if (ret <= 0) return ret; - l4len = tcp_fill_headers4(c, conn, iov[TCP_IOV_TAP].iov_base, + l4len = tcp_fill_headers4(c, conn, iov[TCP_IOV_IP].iov_base, iov[TCP_IOV_PAYLOAD].iov_base, optlen, NULL, conn->seq_to_tap); + tap_hdr_update(iov[TCP_IOV_TAP].iov_base, + l4len + sizeof(struct iphdr) + sizeof(struct ethhdr)); } else { iov = tcp6_l2_flags_iov[tcp6_flags_used++]; @@ -321,10 +323,13 @@ int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags) if (ret <= 0) return ret; - l4len = tcp_fill_headers6(c, conn, iov[TCP_IOV_TAP].iov_base, + l4len = tcp_fill_headers6(c, conn, iov[TCP_IOV_IP].iov_base, iov[TCP_IOV_PAYLOAD].iov_base, optlen, conn->seq_to_tap); + tap_hdr_update(iov[TCP_IOV_TAP].iov_base, + l4len + sizeof(struct ipv6hdr) + + sizeof(struct ethhdr)); } iov[TCP_IOV_PAYLOAD].iov_len = l4len; @@ -390,10 +395,12 @@ void tcp_data_to_tap(const struct ctx *c, struct tcp_tap_conn *conn, tcp4_seq_update[tcp4_payload_used].len = dlen; iov = tcp4_l2_iov[tcp4_payload_used++]; - l4len = tcp_fill_headers4(c, conn, iov[TCP_IOV_TAP].iov_base, + l4len = tcp_fill_headers4(c, conn, iov[TCP_IOV_IP].iov_base, iov[TCP_IOV_PAYLOAD].iov_base, dlen, check, seq); + tap_hdr_update(iov[TCP_IOV_TAP].iov_base, + l4len + sizeof(struct iphdr) + sizeof(struct ethhdr)); iov[TCP_IOV_PAYLOAD].iov_len = l4len; if (tcp4_payload_used > TCP_FRAMES_MEM - 1) tcp_payload_flush(c); @@ -402,10 +409,13 @@ void tcp_data_to_tap(const struct ctx *c, struct tcp_tap_conn *conn, tcp6_seq_update[tcp6_payload_used].len = dlen; iov = tcp6_l2_iov[tcp6_payload_used++]; - l4len = tcp_fill_headers6(c, conn, iov[TCP_IOV_TAP].iov_base, + l4len = tcp_fill_headers6(c, conn, iov[TCP_IOV_IP].iov_base, iov[TCP_IOV_PAYLOAD].iov_base, dlen, seq); + tap_hdr_update(iov[TCP_IOV_TAP].iov_base, + l4len + sizeof(struct ipv6hdr) + + sizeof(struct ethhdr)); iov[TCP_IOV_PAYLOAD].iov_len = l4len; if (tcp6_payload_used > TCP_FRAMES_MEM - 1) tcp_payload_flush(c); diff --git a/tcp_internal.h b/tcp_internal.h index 6155c7c23afb..d296d2c38f6e 100644 --- a/tcp_internal.h +++ b/tcp_internal.h @@ -62,13 +62,11 @@ void tcp_rst_do(struct ctx *c, struct tcp_tap_conn *conn); size_t tcp_fill_headers4(const struct ctx *c, const struct tcp_tap_conn *conn, - struct tap_hdr *taph, struct iphdr *iph, struct tcphdr *th, size_t dlen, const uint16_t *check, uint32_t seq); size_t tcp_fill_headers6(const struct ctx *c, const struct tcp_tap_conn *conn, - struct tap_hdr *taph, struct ipv6hdr *ip6h, struct tcphdr *th, size_t dlen, uint32_t seq); int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn, -- 2.44.0