From 2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 27 Nov 2024 14:54:06 +1100 Subject: tcp: Pass TCP header and payload separately to tcp_update_check_tcp[46]() Currently these expects both the TCP header and payload in a single IOV, and goes to some trouble to locate the checksum field within it. In the current caller we've already know where the TCP header is, so we might as well just pass it in. This will need to work a bit differently for vhost-user, but that code already needs to locate the TCP header for other reasons, so again we can just pass it in. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- tcp_vu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tcp_vu.c') diff --git a/tcp_vu.c b/tcp_vu.c index bbae918..134650e 100644 --- a/tcp_vu.c +++ b/tcp_vu.c @@ -73,15 +73,19 @@ static void tcp_vu_update_check(const struct flowside *tapside, char *base = iov[0].iov_base; if (inany_v4(&tapside->oaddr)) { + struct tcphdr *th = vu_payloadv4(base); const struct iphdr *iph = vu_ip(base); + struct iov_tail payload = IOV_TAIL(iov, iov_cnt, + (char *)(th + 1) - base); - tcp_update_check_tcp4(iph, iov, iov_cnt, - (char *)vu_payloadv4(base) - base); + tcp_update_check_tcp4(iph, th, &payload); } else { + struct tcphdr *th = vu_payloadv6(base); const struct ipv6hdr *ip6h = vu_ip(base); + struct iov_tail payload = IOV_TAIL(iov, iov_cnt, + (char *)(th + 1) - base); - tcp_update_check_tcp6(ip6h, iov, iov_cnt, - (char *)vu_payloadv6(base) - base); + tcp_update_check_tcp6(ip6h, th, &payload); } } -- cgit v1.2.3