On Mon, 11 Mar 2024 14:33:56 +0100 Laurent Vivier <lvivier(a)redhat.com> wrote:To be able to provide pointers to TCP headers and IP headers without worrying about alignment in the structure, split the structure into several arrays and point to each part of the frame using an iovec array. Using iovec also allows us to simply ignore the first entry when the vnet length header is not needed. And as the payload buffer contains only the TCP header and the TCP data we can increase the size of the TCP data to USHRT_MAX - sizeof(struct tcphdr). As a side effect, these changes improve performance by a factor of x1.5. Signed-off-by: Laurent Vivier <lvivier(a)redhat.com> --- tap.c | 104 ++++++++++++++ tap.h | 16 +++ tcp.c | 429 ++++++++++++++++++++++++---------------------------------- 3 files changed, 296 insertions(+), 253 deletions(-) diff --git a/tap.c b/tap.c index c7b9372668ec..afd01cffbed6 100644 --- a/tap.c +++ b/tap.c @@ -350,6 +350,30 @@ static size_t tap_send_frames_pasta(const struct ctx *c, return i; } +/** + * tap_send_iov_pasta() - Send out multiple prepared frames...to the pasta tap. That is, this should get the description of the existing tap_send_frames_pasta(), and, I guess, tap_send_frames_pasta() should now switch to writev(), as it's used to send one single message from multiple buffers, otherwise you'll get a lot of system calls for pasta? I'm still in the middle of reviewing here, but I thought I would comment on this right away because it looks quite fundamental. -- Stefano