From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id D65305A026D for ; Tue, 12 Mar 2024 23:56:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710284203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tM00F74EuGBSiBqc9Ou3U8wxiBD53HdKU/fpKkufkK8=; b=Y6KguSZhYPNybR/n/+zeknv04AOaJbM+GpsSPJdxxMEnyVORzpzsP0ZPaJsrsvxjQ80yG9 1flrl+1H4onxCcAzF+jj0BI+YgLs+O93SQqYy7ylTsW/I9GY2GZbGqEv2JGTQC5S422CJK dG1R3HSV5ybjV+fz8IA/7jn5AI9lS00= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-MjFknWUnOmC7uq5pTUmB7A-1; Tue, 12 Mar 2024 18:56:41 -0400 X-MC-Unique: MjFknWUnOmC7uq5pTUmB7A-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2d33fa7f791so4261591fa.1 for ; Tue, 12 Mar 2024 15:56:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710284199; x=1710888999; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tM00F74EuGBSiBqc9Ou3U8wxiBD53HdKU/fpKkufkK8=; b=PgSygTY2/BQCSSXHClkL1TFAUIFZSLQfEwrVHSYUpwuAadGsDNQmWqamUz4qPpA/PD BdF/cNxciuiY2syVeypcXaef4J1e2bNSqXzopuSZiirbfQsi723w6n0fRxSaKArs05Gs OBIreJiaMnItWFXcdhXoI44GDq4q2eRRQ3euuVZ3cHSZY2RkA0eFmiSHXD4qTgKbW/bz U/8OYJ8EKkSlvFXi2QyWkchoLX6PJSRycErK1xMcORzhHekn3DkEyFq5b5X0c0NIlx9J GIhNV89fm9XNUPHeQ6P646q4rVp87bq6Dvaht3Gdf0Lv7QBFQYRpYwFZQ7lcvPkQvEic EWpw== X-Gm-Message-State: AOJu0Yz5TyFT48fLFU/061NMLOvBtQySo1XMz1xNGkN1xwaI8ep0vc6n MrSRSrabyPjb0f18Jwnhjuj9TX9+c84bAlE7UjLQ5f0/ahMRfGAsBlNTe+IGMLJmZAugHXgPjkZ te8H+UT/xK4AJYflVWIrhKu/oGzywBfa8KVWN5J6CZdy4RdiZlkRxQLbbIKQpqmO+QL+UBd1iun w8z0I3WaW50/ftgQnaVeHaWeqbqRWy6ZEDKAs= X-Received: by 2002:a2e:80c9:0:b0:2d4:54a5:5b9a with SMTP id r9-20020a2e80c9000000b002d454a55b9amr2181051ljg.7.1710284199050; Tue, 12 Mar 2024 15:56:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE75fffmWPpegNO9cq+ymXL2BWp5YVO1X8hGrHz/O7GHLyqSQ4jey577zoAyYrQIQRAzUGUKA== X-Received: by 2002:a2e:80c9:0:b0:2d4:54a5:5b9a with SMTP id r9-20020a2e80c9000000b002d454a55b9amr2181040ljg.7.1710284198310; Tue, 12 Mar 2024 15:56:38 -0700 (PDT) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id ca8-20020aa7cd68000000b005671d898b32sm4479034edb.23.2024.03.12.15.56.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2024 15:56:37 -0700 (PDT) Date: Tue, 12 Mar 2024 23:56:03 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [RFC] tcp: Replace TCP buffer structure by an iovec array Message-ID: <20240312235603.5922b01a@elisabeth> In-Reply-To: <20240311133356.1405001-1-lvivier@redhat.com> References: <20240311133356.1405001-1-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.36; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: OAJOT3KXC4ZLYCRBDT6I7VYAYXWEW2YG X-Message-ID-Hash: OAJOT3KXC4ZLYCRBDT6I7VYAYXWEW2YG X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, 11 Mar 2024 14:33:56 +0100 Laurent Vivier 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 > --- > 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