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 0D5CC5A0271 for ; Fri, 8 Mar 2024 17:49:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709916560; 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=1luBrc23qHBUF+rgGWawYk+1unysXqwRyFvzXbwKaIY=; b=Qnt2B4HlyXJVRlYqDcKQ9Wx3jkZFfCqws1nGJsHg53+abgAJVMHtbvXsDGlX2k94jqmByP +nW3p0ga6WJ91sIheBPnHq6Mc63aCVM91PMOE0SSuUE7lw2GNxB1Y5rFwI9K/lw63oSh73 ffW5ShTZi8ssIRPrL3NWebmOiXvadC4= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-360-fleuEEqLNJaG9Hs2CJoOrw-1; Fri, 08 Mar 2024 11:49:18 -0500 X-MC-Unique: fleuEEqLNJaG9Hs2CJoOrw-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-33e6d40893fso491239f8f.3 for ; Fri, 08 Mar 2024 08:49:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709916557; x=1710521357; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1luBrc23qHBUF+rgGWawYk+1unysXqwRyFvzXbwKaIY=; b=nh6YtRLKrP8GDonzf/Dws85+Kj0blhOgtGOXZunDUbtia+8PQ+JK85Ota8iGdmJJsO VY9Wb1rKn4F2g9qb4T2KOypAsCm2mkSRemfNv3DMMAGQVQY9a3rNhnoNZtOTpO+Tpa/U XJG1T63OtBBva5zYRmj25z2QwiBOfEGX5w//ZxwWzCVVJAgmorEwY/gkIO3L/uKpWy/g cSslzbUMobrJdrVMOOSNmQebiOWHC5VVd+3NLZQmET4KKrgNHcAv8KLN00UFRu3iw0Rv tQo73GkBmBrW7E8otnPD0WnjPWERBKS6Y6XjvN04A5fJIdbrwg5YisgxlX481zRg1GYF 5wKQ== X-Forwarded-Encrypted: i=1; AJvYcCUkHK+M5lXZCzIp91ieJRGp4tlDm4H2n7noKOQ6Nl7H1mx6s/jXbDkIJ1XxASfjhapF/IZVpoXK2vE6e89basFudwbL X-Gm-Message-State: AOJu0Yyv1lzn0v2T3gJ+gVFY/T8/HlwmBhvW+ibwmh5uJEYyTv8RnJjk uAw5f92V5UJyIeAMXKOdGv1oBiDjZNG0igBJBA8dIXBglLYg/NfyXg0LDs01v54mbTJN4J31jZ2 KZ/lx/NZhHTty/FVaUtvAMikxwFSppf5Wb8DnfdqnqPmdRQTaLA== X-Received: by 2002:adf:ee08:0:b0:33d:ca56:a61f with SMTP id y8-20020adfee08000000b0033dca56a61fmr15688597wrn.49.1709916557154; Fri, 08 Mar 2024 08:49:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IECpWWSkuiAHboZjNwIbYFZfmUJskzzYBZeOAuSz1DdxBEYhi8KJ1gR2pCDYDhTQXBN+8NqUw== X-Received: by 2002:adf:ee08:0:b0:33d:ca56:a61f with SMTP id y8-20020adfee08000000b0033dca56a61fmr15688583wrn.49.1709916556806; Fri, 08 Mar 2024 08:49:16 -0800 (PST) Received: from [192.168.100.30] ([82.142.8.70]) by smtp.gmail.com with ESMTPSA id by1-20020a056000098100b0033e22341942sm20839443wrb.78.2024.03.08.08.49.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Mar 2024 08:49:16 -0800 (PST) Message-ID: <360d4311-7d81-426e-8f63-9cb2930f7163@redhat.com> Date: Fri, 8 Mar 2024 17:49:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/4] Some improvements to the tap send path To: David Gibson References: <20240308065325.2181322-1-david@gibson.dropbear.id.au> <348a52c9-7c07-4150-b594-4743c7775be6@redhat.com> From: Laurent Vivier In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: H7EJ3DUGGJHCPQOVUPMAXPQ6XCTC6KDS X-Message-ID-Hash: H7EJ3DUGGJHCPQOVUPMAXPQ6XCTC6KDS X-MailFrom: lvivier@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: Stefano Brivio , 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 3/8/24 13:42, David Gibson wrote: ... >> >> The payload can be TCP + data or TCP + flags: >> >> struct tcp_l2_flags_t { >> struct tcphdr th; >> char opts[OPT_MSS_LEN + OPT_WS_LEN + 1]; >> }; >> >> struct tcp_l2_payload_t { >> struct tcphdr th; /* 20 bytes */ >> uint8_t data[MSS]; /* 65516 bytes */ >> #ifdef __AVX2__ >> } __attribute__ ((packed, aligned(32))); >> #else >> } __attribute__ ((packed, aligned(__alignof__(unsigned int)))); >> #endif > > Not sure if we'd be better off with this approach, or having both IP > and L4 headers together, and the L4 payload in another. The latter > would mean duplicating the TCP or UDP headers between the IPv4 and > IPv6 cases, but it allows the data buffers - which will be used > directly on the socket side. > The main idea behind using iovec is to separate tcphdr and iphdr structures, allowing for direct access to the pointers of tcphdr and iphdr without concerns about pointer alignment. Moreover, having tcphdr and TCP payload in the same vector can make sense when computing the TCP checksum, as the checksum includes tcphdr and the payload. Thanks, Laurent