On Fri, Mar 20, 2026 at 02:51:14PM +0100, Laurent Vivier wrote:
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
Reviewed-by: David Gibson
--- 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
-- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson