From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97FC245C89; Tue, 5 Nov 2024 14:13:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D191402B3; Tue, 5 Nov 2024 14:13:00 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id ADBBB40151 for ; Tue, 5 Nov 2024 14:12:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730812379; 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=7YdOsmKSmkAs3fBdeQl3f0RyH+GUrHJxCXik4U8BoIY=; b=Yduq+n591rx2jf0ILwZSLqO3APDuJeeUkLsbariJdjHO68LgFpVcgh9RmqsuIq9TmfVDre SAB8HeqlbY2VnQg3WYVeLoJuYN0/yJqnsuBF2F4Iimqm7j0qilxP87Kvw+P/bKouSqQwsn l+MEqkmFZLMIu1+S0NPsgrh3LVcEIvo= 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-540-ErINCoD4NCS7YvZN7cIKQA-1; Tue, 05 Nov 2024 08:12:58 -0500 X-MC-Unique: ErINCoD4NCS7YvZN7cIKQA-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-539eeb63cc3so3500658e87.2 for ; Tue, 05 Nov 2024 05:12:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730812376; x=1731417176; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7YdOsmKSmkAs3fBdeQl3f0RyH+GUrHJxCXik4U8BoIY=; b=SToC4BgbXxdsxhJJmyPGv7vUskE6HtZeRtFhLBUNfy06on66cp3kWibdwUJIN+Fo8O LWHEE7PupnBdSnWP05spbJ+n8lR9eA8F9By9LWr9X/o270Kd8Hw4VTUEu+Xnz4VTxbZq lgLcIB0Ug3IVdmg4WeEeJnjh8ViXXiq3aPVrupUFLPVgpb6vxoyxGskClNA+NIHEuUcL Nr9bWUgjDM4Rk5ecC8TO7x53+UO7A1aOCTBRBhjmtz8oA22K4JWlX7Zrjcs+0UJMdoxs LdcdMJBiow5nT5gOxNTkAGtnzyFeuXM+HaC51ftn9NytbEM8q1QhF3WV1BR5HTIpmh75 4AYA== X-Forwarded-Encrypted: i=1; AJvYcCVASkeg85PZM+8tDNCd/RcaXsjB9xg/W1VomSy1Z58p6aKN9jS1ZpAPWAqEC9+mhYAhlWs=@dpdk.org X-Gm-Message-State: AOJu0YyPTP0rd6QTkgAMHkxH73EAPguu8rAHY7UOotssMiCkoCa6Ngi7 FbS3c7bv13eZ+IdVbBmff6Z6vmvYD1ts8jNJE0k5dYhRhZm5VPpXiR2LgXtpg8w19F6QPpEoMQy MQVTQxXZw2RFijE6SSBx6+VlGe2aMD1a92bIGdf3fQzOtmG3QkUOzeBu3sJsWAOfd5IPhl1gTVk SwIR3opM8+LU/6FeA= X-Received: by 2002:a05:6512:33c7:b0:539:fb7f:6288 with SMTP id 2adb3069b0e04-53b7ecfc5cbmr12812202e87.35.1730812376469; Tue, 05 Nov 2024 05:12:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IECicdZ6ZX0sg815HZODkJfewY8A3K4YqkMdvuDYKOHKOgN/8Ng6s+We1+TKYiywy2f2pvZ4PEoQXacW1mT+as= X-Received: by 2002:a05:6512:33c7:b0:539:fb7f:6288 with SMTP id 2adb3069b0e04-53b7ecfc5cbmr12812182e87.35.1730812376081; Tue, 05 Nov 2024 05:12:56 -0800 (PST) MIME-Version: 1.0 References: <20241105085912.4148208-1-david.marchand@redhat.com> <98CBD80474FA8B44BF855DF32C47DC35E9F877@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC35E9F879@smartserver.smartshare.dk> In-Reply-To: From: David Marchand Date: Tue, 5 Nov 2024 14:12:44 +0100 Message-ID: Subject: Re: [PATCH] net: fix IPv4 cksum simple function To: Bruce Richardson Cc: =?UTF-8?Q?Morten_Br=C3=B8rup?= , Andre Muezerie , dev@dpdk.org, Robin Jarry , Stephen Hemminger , Chengwen Feng , Thomas Monjalon X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Nov 5, 2024 at 12:08=E2=80=AFPM Bruce Richardson wrote: > > On Tue, Nov 05, 2024 at 11:49:52AM +0100, David Marchand wrote: > > On Tue, Nov 5, 2024 at 11:20=E2=80=AFAM Morten Br=C3=B8rup wrote: > > > > But there is still the question of packed structures with MSVC. > > > > Tyler proposal seemed to rely on the current __rte_packed conventio= nal > > > > position. > > > > https://patchwork.dpdk.org/project/dpdk/patch/1713225913-20792-2-gi= t- > > > > send-email-roretzla@linux.microsoft.com/ > > > > Note that I am not a fan of this push/pop stuff. > > > > > > > > Maybe Andre will find a better solution. > > > > > > If we cannot come up with a clean solution that looks like an attribu= te (like GCC), we should accept MSVC's style with push/pop and learn to liv= e with it. > > > > Well, there is probably not many solutions. > > OVS does the same as what you suggest. > > > > > > > > > > Perhaps something like: > > > > > > #ifdef RTE_TOOLCHAIN_MSVC > > > #define __RTE_PACKED(...) \ > > > __pragma(pack(push, 1)) \ > > > __VA_ARGS__ \ > > > __pragma(pack(pop)) > > > #else > > > #define __RTE_PACKED(...) __VA_ARGS__ __attribute__((__packed__)) > > > #endif > > > > > > This would also move the "packed" information to the top of the struc= t, making the code easier to read - i.e. easier to notice that the structur= e is packed when not hidden away at the end of the structure. > > > > __RTE_PACKED(struct __rte_aligned(2) rte_ipv4_hdr { > > ... > > }); > > > > Agreed, looks better. > > > Not convinced it looks better myself. Rather than packing the structure, > can we instead put aligned(2) on the 32-bit fields inside it? Marking a field won't have an effect, unless packing the structure: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html When used on a struct, or struct member, the aligned attribute can only increase the alignment; in order to decrease it, the packed attribute must be specified as well. When used as part of a typedef, the aligned attribute can both increase and decrease alignment, and specifying the packed attribute generates a warning. --=20 David Marchand