public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH trivial 1/3] tcp_vu: Remove redundant eh->h_proto assignments
Date: Fri, 20 Mar 2026 14:51:14 +0100	[thread overview]
Message-ID: <20260320135116.575416-2-lvivier@redhat.com> (raw)
In-Reply-To: <20260320135116.575416-1-lvivier@redhat.com>

tcp_fill_headers() unconditionally sets eh->h_proto based on whether
ip4h or ip6h is non-NULL.  The assignments in tcp_vu_send_flag() and
tcp_vu_prepare() are therefore redundant and can be removed.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 tcp_vu.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/tcp_vu.c b/tcp_vu.c
index fd734e857b3b..c616b1fec2bf 100644
--- a/tcp_vu.c
+++ b/tcp_vu.c
@@ -105,15 +105,11 @@ int tcp_vu_send_flag(const struct ctx *c, struct tcp_tap_conn *conn, int flags)
 	memcpy(eh->h_source, c->our_tap_mac, sizeof(eh->h_source));
 
 	if (CONN_V4(conn)) {
-		eh->h_proto = htons(ETH_P_IP);
-
 		ip4h = vu_ip(flags_elem[0].in_sg[0].iov_base);
 		*ip4h = (struct iphdr)L2_BUF_IP4_INIT(IPPROTO_TCP);
 
 		th = vu_payloadv4(flags_elem[0].in_sg[0].iov_base);
 	} else {
-		eh->h_proto = htons(ETH_P_IPV6);
-
 		ip6h = vu_ip(flags_elem[0].in_sg[0].iov_base);
 		*ip6h = (struct ipv6hdr)L2_BUF_IP6_INIT(IPPROTO_TCP);
 		th = vu_payloadv6(flags_elem[0].in_sg[0].iov_base);
@@ -307,14 +303,10 @@ static void tcp_vu_prepare(const struct ctx *c, struct tcp_tap_conn *conn,
 	/* initialize header */
 
 	if (!v6) {
-		eh->h_proto = htons(ETH_P_IP);
-
 		ip4h = vu_ip(base);
 		*ip4h = (struct iphdr)L2_BUF_IP4_INIT(IPPROTO_TCP);
 		th = vu_payloadv4(base);
 	} else {
-		eh->h_proto = htons(ETH_P_IPV6);
-
 		ip6h = vu_ip(base);
 		*ip6h = (struct ipv6hdr)L2_BUF_IP6_INIT(IPPROTO_TCP);
 
-- 
2.53.0


  reply	other threads:[~2026-03-20 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 13:51 [PATCH trivial 0/3] tcp_vu: Remove redundant header field assignments Laurent Vivier
2026-03-20 13:51 ` Laurent Vivier [this message]
2026-03-20 13:51 ` [PATCH trivial 2/3] tcp_vu: Remove redundant eh->h_source assignment in tcp_vu_send_flag() Laurent Vivier
2026-03-20 13:51 ` [PATCH trivial 3/3] tcp_vu: Remove redundant th->doff and th->ack " Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260320135116.575416-2-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).