On 15/10/2024 05:23, David Gibson wrote:To do that is a little bit complicated because we need to pass the iov array to tcp_fill_headers4()/tcp_fill_headers6() to be able to compute the checksum of the TCP part. In tcp_buf, the TCP header and TCP payload are in the same iovec but with tcp_vu they can be split on several iovecs. And if we provide the iovec , theoretically we should not provide the TAP, IP and TCP headers via the parameters as they are in the iovec, but for tcp_buf they have one iovec each, and with tcp_vu they are probably all in the same iovec (the first one). So, again, it can be complicated to extract headers to update them. In conclusion, I update the checksum only for VU and in the case of pcap because it is simpler (the same logic applies for udp_update_hdr4()/udp_update_hdr6()). I'm open to any suggestion that could do the checksum in udp_update_hdr4()/udp_update_hdr6() (I agree with you, it should be the place to do it) but I don't see an easy and nice way to implement it. Thanks, Laurent+/** + * tcp_vu_update_check() - Calculate TCP checksum + * @tapside: Address information for one side of the flow + * @iov: Pointer to the array of IO vectors + * @iov_used: Length of the array + */ +static void tcp_vu_update_check(const struct flowside *tapside, + struct iovec *iov, int iov_used)AFAICT this is only used for the pcap path. Rather than filling in the checksum at a different point from normal, I think it would be easier to just clear the no_tcp_csum flag when pcap is enabled. That would, AFAICT, remove the need for this function entirely.