aboutgitcodebugslistschat
path: root/tcp_vu.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-11-22 17:43:36 +0100
committerStefano Brivio <sbrivio@redhat.com>2024-11-27 16:49:21 +0100
commit7e131e920c04054b9d005dac718ac54e5169fa71 (patch)
tree4a205e534aa6e9ecdb6feec58bbe1b7269ced147 /tcp_vu.c
parent676bf5488ec4bd4312dbae4be1a1bb2ed02bd2ba (diff)
downloadpasst-7e131e920c04054b9d005dac718ac54e5169fa71.tar
passt-7e131e920c04054b9d005dac718ac54e5169fa71.tar.gz
passt-7e131e920c04054b9d005dac718ac54e5169fa71.tar.bz2
passt-7e131e920c04054b9d005dac718ac54e5169fa71.tar.lz
passt-7e131e920c04054b9d005dac718ac54e5169fa71.tar.xz
passt-7e131e920c04054b9d005dac718ac54e5169fa71.tar.zst
passt-7e131e920c04054b9d005dac718ac54e5169fa71.zip
tcp: Move tcp_l2_buf_fill_headers() to tcp_buf.c
This function only has callers in tcp_buf.c. More importantly, it's inherently tied to the "buf" path, because it uses internal knowledge of how we lay out the various headers across our locally allocated buffers. Therefore, move it to tcp_buf.c. Slightly reformat the prototypes while we're at it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp_vu.c')
-rw-r--r--tcp_vu.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/tcp_vu.c b/tcp_vu.c
index 1bebb31..f27e175 100644
--- a/tcp_vu.c
+++ b/tcp_vu.c
@@ -98,7 +98,7 @@ int tcp_vu_send_flag(const struct ctx *c, struct tcp_tap_conn *conn, int flags)
struct vu_dev *vdev = c->vdev;
struct vu_virtq *vq = &vdev->vq[VHOST_USER_RX_QUEUE];
const struct flowside *tapside = TAPFLOW(conn);
- size_t l2len, l4len, optlen, hdrlen;
+ size_t optlen, hdrlen;
struct vu_virtq_element flags_elem[2];
struct tcp_payload_t *payload;
struct ipv6hdr *ip6h = NULL;
@@ -157,19 +157,15 @@ int tcp_vu_send_flag(const struct ctx *c, struct tcp_tap_conn *conn, int flags)
return ret;
}
+ flags_elem[0].in_sg[0].iov_len = hdrlen + optlen;
+
if (CONN_V4(conn)) {
- l4len = tcp_fill_headers4(conn, NULL, iph, payload, optlen,
- NULL, seq, true);
- l2len = sizeof(*iph);
+ tcp_fill_headers4(conn, NULL, iph, payload, optlen, NULL, seq,
+ true);
} else {
- l4len = tcp_fill_headers6(conn, NULL, ip6h, payload, optlen,
- seq, true);
- l2len = sizeof(*ip6h);
+ tcp_fill_headers6(conn, NULL, ip6h, payload, optlen, seq, true);
}
- l2len += l4len + sizeof(struct ethhdr);
- flags_elem[0].in_sg[0].iov_len = l2len +
- sizeof(struct virtio_net_hdr_mrg_rxbuf);
if (*c->pcap) {
tcp_vu_update_check(tapside, &flags_elem[0].in_sg[0], 1);
pcap_iov(&flags_elem[0].in_sg[0], 1,