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.129.124]) by passt.top (Postfix) with ESMTP id 11C965A027A for ; Sat, 17 Feb 2024 15:37:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708180674; 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=AoaH5fjVqFSoLAXCLyP4+rETLHpuCUh9JgthdBb7L+4=; b=TGro05gLUfj4kZtmZc2v8Fra5vQg5NPtoqf6JiNYUVvdaXvSBEKgsj8/7TmpY1oqMzDhoC lGpqsEcHEkrE58SNgIbmoSOAIyikPa2YJt9OhWMGNzswGy2JfDpmISp5nl1TuHH5w8iBOs CZSsAINjqwN23MNogF+RyPN7HK/hDPM= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-119-LvfVLu7rP7uBAS5RDHo5hA-1; Sat, 17 Feb 2024 09:37:53 -0500 X-MC-Unique: LvfVLu7rP7uBAS5RDHo5hA-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-51288102312so2786185e87.3 for ; Sat, 17 Feb 2024 06:37:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708180670; x=1708785470; 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=AoaH5fjVqFSoLAXCLyP4+rETLHpuCUh9JgthdBb7L+4=; b=Kzbz5fuxxPdWE5MAjbnRG1jbAwjvJrF8araScIuVuTuD+PoQP7kzJSkNziJqgUJiJr 0fVcxKATouy11usnnO+nh7u823yqZOurb5eoVYOraVH9GELcjSbwuqnyS4ZRJ/WJ29JM thGlqpNi1pijBvB3wC87JThnHu9krf4+vdEVqGwhpfHVTc1J2CRqY+2SoxL4hu3hsiTL Wz/0T7gfgDAqSUEo1fyf6c0jcUD5hSeP8wU8Z0R0FD7PhEiMCLnVd9KlcYSZj3BFCleU G+P/Bdhb/OrC+WASvdm29KYkzIWa65Qnx1JF44KJZVDWqPCjrEqz8k9cVzeBU2W56OSJ 5YVw== X-Gm-Message-State: AOJu0YwhKmenGLwk65HLx1Ew8YbrzdvjwEdsNKIIYPg1shp3d89ZGsWA 35Sw+SGmsxZE1MzZprTB+kgrgMFDR45CzEMtX9Xm/FSVthN5cfvalhP7c5S9YLFbBswj9rVB5Nf gGmW53v5C19R9/18e6YMdCMagouQLcmWTbmFhmKRmECKocxhsj7erGElExbzvhLvH+VxSkCAvPm JuwAloYK59v/xO4Iu0Ohy3gqr7lh7FRT56SUc= X-Received: by 2002:a05:6512:370a:b0:511:8b33:6c72 with SMTP id z10-20020a056512370a00b005118b336c72mr4415494lfr.47.1708180670607; Sat, 17 Feb 2024 06:37:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGowGOA+bD5Cbl/TJJ3HfRXt6fWsItArrN+AkYk9R9lreWwgTdMighrFT5yTyg3tgnsCRLUzA== X-Received: by 2002:a05:6512:370a:b0:511:8b33:6c72 with SMTP id z10-20020a056512370a00b005118b336c72mr4415486lfr.47.1708180670057; Sat, 17 Feb 2024 06:37:50 -0800 (PST) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id ss3-20020a170907c00300b00a3d32341280sm1019618ejc.181.2024.02.17.06.37.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Feb 2024 06:37:49 -0800 (PST) Date: Sat, 17 Feb 2024 15:37:07 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v2 6/8] checksum: use csum_ip4_header() in udp.c and tcp.c Message-ID: <20240217153707.77eb1cd5@elisabeth> In-Reply-To: References: <20240214085628.210783-1-lvivier@redhat.com> <20240214085628.210783-7-lvivier@redhat.com> <20240216100805.040826b3@elisabeth> <53d4a403-0d3f-4aa0-b980-27c2026a468b@redhat.com> <20240216155400.1d26ae17@elisabeth> <7a9915cf-f004-453a-b328-80d086c14a80@redhat.com> <20240216192440.6031e2d2@elisabeth> 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: 5ILPM4QNSXZYGHUIW5LHSOBSJPUGQEHX X-Message-ID-Hash: 5ILPM4QNSXZYGHUIW5LHSOBSJPUGQEHX 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 Sat, 17 Feb 2024 15:22:12 +0100 Laurent Vivier wrote: > On 2/16/24 19:24, Stefano Brivio wrote: > > On Fri, 16 Feb 2024 19:05:39 +0100 > > Laurent Vivier wrote: > > > > ... > >> I think I will send the v3 of my series without fixing that because I don't have enough > >> time this week. I will address the problem later. > > No problem! I will also try to spend a moment and see if there's some > > reasonable solution I can suggest. Thanks, > > > I can imagine 4 solutions: > > * to use inline functions (could it helps the compiler to manage the alignment problem?) I guess in practice yes, but it could be formally complicated for a compiler to make sure no instructions dereferencing those pointers will be emitted, plus this is on the packet path and if the compiler decides to *not* inline, we shouldn't force that. > * to use C macros I'm not sure exactly how, I have some vague idea of what you might mean, it could be quite awkward though. > * to use these new functions only with vhost-user as we know pointers will be aligned. This is quite unlikely to help: the problem is that 802.3 (Ethernet) frame headers are (without VLANs) 14 bytes. If you align the start of the frame, and we need those frames (and pointers to them) whenever we talk Layer-2, the rest can't be aligned to 4-bytes boundary. > * to include structure we want to address in a generic wrapperstructure that will > unalign it as it is done with the current structure. This sounds like the easiest and safest way to me. Note that pointers to 'taph' can be happily dereferenced, too. You can pass around pointers to that, instead of using 'iph'. I used (almost everywhere?) the start of the buffer, but 'taph' is fine as well. -- Stefano