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 C8FF9A0032 for ; Mon, 11 Jul 2022 15:25:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF0CC40695; Mon, 11 Jul 2022 15:25:16 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id A5C8F40695 for ; Mon, 11 Jul 2022 15:25:14 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id o19-20020a05600c511300b003a2de48b4bbso3640761wms.5 for ; Mon, 11 Jul 2022 06:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=BEolV0UUYPZyhJ6eItS6wcyowcKdkVxttFDEUbLL3bI=; b=FFQSGHD3axsFM7hWQbKJxclwrFd0L91O/lh1ReVLo9mtqrbLaY/AZDSdINlfXmSRyl 5ENwn2zXqMVLeBsHVqNtz4/bw59kv/NdF0TOK91UpqtuXcOq2i99N+lqQfmPgi8wmpBZ jlEcOpGK7jsEluIO8H+EgDSgjvV5okeudQe9potfC40OJn3cpeAdbtEOX3j3KE8m63Bj GU4W7Gavs0e/LMR7PyxiZLLBZ+j2xok9ghGTUebprOThKvA70B1aoljNglreyPyKidCr DzXCKaJJnPKucmocOlzsGT/a4KB1zXZ3CDn0yOUdtV1VtIUQ5NjPMGoqg6ky1LttY8te farQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=BEolV0UUYPZyhJ6eItS6wcyowcKdkVxttFDEUbLL3bI=; b=jllkg6TBLXpGHHiTfHl/T6jUlG2guLWSBiIDGtVhEp2IVBzuVI137UjR729avRYW4g IOTNJ2RL4WN6d7/kAODlovi+HHCbtmBc0R/FPw7A1LuzwAYpr/Wpu4BShb/m0rGUUUzI LTHBaQerdACOlmXuJ+UPbkPxKvzOdPAT+yVjae9RDz3r0FHgauQn2Bja94qCb66rx5dq gs63NGKngavTQIAP5bGlODS1xlelV3CW4iyU76kOrXm4JuhYM/NvUmMmgpVzdpKSJLce HAbaZTPfkdu7vTUt/bzMfJlwPOduvyR4TFtc6f+9e0GMzapI2fakGRngqycY0lYUQ6kM 4Ujg== X-Gm-Message-State: AJIora95oIMse+gPS4NABiLt3We3qomibtTv2JBDpdeFnEkALH6AHyyr gZ/hFvLrdjCwxt+I/UijyuO2gQ== X-Google-Smtp-Source: AGRyM1t0ZTPOhgAzyfHACvHZI6Z0Qwv27RsH10hY3COrUvghwmpWcxmtiGXTXszKCzuEyrrWGlkV/Q== X-Received: by 2002:a05:600c:3492:b0:3a1:70dd:9a14 with SMTP id a18-20020a05600c349200b003a170dd9a14mr15566094wmq.177.1657545914420; Mon, 11 Jul 2022 06:25:14 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id r1-20020a5d6941000000b00210bac248c8sm5871274wrw.11.2022.07.11.06.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:25:13 -0700 (PDT) Date: Mon, 11 Jul 2022 15:25:13 +0200 From: Olivier Matz To: Mattias =?iso-8859-1?Q?R=F6nnblom?= Cc: Emil Berg , bruce.richardson@intel.com, stephen@networkplumber.org, stable@dpdk.org, bugzilla@dpdk.org, dev@dpdk.org, onar.olsen@ericsson.com, Morten =?iso-8859-1?Q?Br=F8rup?= Subject: Re: [PATCH v3 2/2] net: have checksum routines accept unaligned data Message-ID: References: <20220711121132.34546-1-mattias.ronnblom@ericsson.com> <20220711121132.34546-2-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220711121132.34546-2-mattias.ronnblom@ericsson.com> X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Mon, Jul 11, 2022 at 02:11:32PM +0200, Mattias Rönnblom wrote: > __rte_raw_cksum() (used by rte_raw_cksum() among others) accessed its > data through an uint16_t pointer, which allowed the compiler to assume > the data was 16-bit aligned. This in turn would, with certain > architectures and compiler flag combinations, result in code with SIMD > load or store instructions with restrictions on data alignment. > > This patch keeps the old algorithm, but data is read using memcpy() > instead of direct pointer access, forcing the compiler to always > generate code that handles unaligned input. The __may_alias__ GCC > attribute is no longer needed. > > The data on which the Internet checksum functions operates are almost > always 16-bit aligned, but there are exceptions. In particular, the > PDCP protocol header may (literally) have an odd size. > > Performance impact seems to range from none to a very slight > regression. > > Bugzilla ID: 1035 > Cc: stable@dpdk.org Fixes: 6006818cfb26 ("net: new checksum functions") > --- > > v3: > * Use RTE_ALIGN_FLOOR() in the pointer arithmetic (Olivier Matz). > v2: > * Simplified the odd-length conditional (Morten Brørup). > > Reviewed-by: Morten Brørup > > Signed-off-by: Mattias Rönnblom Acked-by: Olivier Matz Thank you!