diff options
Diffstat (limited to 'tcp_vu.c')
-rw-r--r-- | tcp_vu.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -95,7 +95,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; @@ -151,19 +151,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, |