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.129.124]) by passt.top (Postfix) with ESMTP id C83905A0314 for ; Fri, 31 May 2024 16:23:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717165434; 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=iSbSYEfLocojRtbUTgH726DoN6FockcNBf2hsfKNpJ0=; b=iUTatK5riCnxlowmhmfsCW0SN9wfIpnCB3BUVvX8LbQLeIKEfWD5LDMLACAtmb+roHUhL9 75+mcBfjT2jdb2mOYGesq0AmZQfx4I5zrdG0hHOPbdDkso2Me34dWfJ+EPd8zNYtZPiDQv 9ru5WB0MvbHVfXz/NnXz5wqQY+3wXZo= 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-669-L11YQVMxNwu-UX3Z3OpGJw-1; Fri, 31 May 2024 10:23:53 -0400 X-MC-Unique: L11YQVMxNwu-UX3Z3OpGJw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 D2BB9185A780 for ; Fri, 31 May 2024 14:23:52 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.194.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 627B8200A381; Fri, 31 May 2024 14:23:51 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v4 09/10] tcp: remove tap_hdr parameter Date: Fri, 31 May 2024 16:23:43 +0200 Message-ID: <20240531142344.1420034-10-lvivier@redhat.com> In-Reply-To: <20240531142344.1420034-1-lvivier@redhat.com> References: <20240531142344.1420034-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 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: 4LFTUIEIEQR2SHJYJTCBHSDYCYJXXR3X X-Message-ID-Hash: 4LFTUIEIEQR2SHJYJTCBHSDYCYJXXR3X 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 48d8f7c6d696..433ab1fab30f 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 630e83e9a01a..cd4549c06035 100644 --- a/tcp_buf.c +++ b/tcp_buf.c @@ -298,10 +298,12 @@ int tcp_buf_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++]; @@ -312,10 +314,13 @@ int tcp_buf_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; @@ -373,10 +378,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); @@ -385,10 +392,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 e47b64a68afd..5c7a52b8293c 100644 --- a/tcp_internal.h +++ b/tcp_internal.h @@ -70,13 +70,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