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 3BF25A034C for ; Thu, 30 Jun 2022 19:45:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3450D410D5; Thu, 30 Jun 2022 19:45:50 +0200 (CEST) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id C8BB240694 for ; Thu, 30 Jun 2022 19:45:48 +0200 (CEST) Received: by mail-pf1-f178.google.com with SMTP id a15so97033pfv.13 for ; Thu, 30 Jun 2022 10:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kL6fVdfFEjHSIzoa5iWdOXaHoyvBfoGH6znkBipphyg=; b=69yBjjmUyel1xoHIO4vvF43DoOyhbg+XHSBXlN5L9gRNgt/kGynDERuSEta7N7DEZA RKqnZVRrI1kKuJp4mpigpYCRYjSnatfxl4pWNJayczbzAE7uUTNVsWmJyW2Xvg2NUjqT JniJSDU7f/1tYGbVtkxGdi9hAttONSeCGa4AhOJPO3yIhUjPyNFc6YHXFhvrzNWa4C3c 6YNAqLX8nf4U3lTFLjsa8fQjFGgedt7LPsMyajRXP3Tj1EjOrfNhTMZWQvQzTg3t97O6 O70f7u3eF19x9h+7uZ/a7hYeK2tPTDYNYVz30UyLgfKSpwSYZxG1dntzMI7Mf2LtGj+m O+gw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=kL6fVdfFEjHSIzoa5iWdOXaHoyvBfoGH6znkBipphyg=; b=Cd4rTPz8n+4d8yf+8udr8+da5ztayWw1qQZ4sDSwCWEsXdzh+TwUc/sHq0q8NCY+So 9SLhdXvkAhQr+nEn1g2zVtg6CvpzcGVskRy65BAXmgbJJiVJqgq1sUMq4CDst9O67TiV Jbj3YCQKYvyrciEPn5w+X9yIt/5h4I162PeSLHAkRupSQLTaieO4aeZb6w4ujxec9Hnb kjIz0qhPTHvHah+2gsPkgpqcDHSkB1lZYrlwRVs3LNWl5MglKRXc8yYDp2kf0Hr1DW3q wbSzrnR0SCn2ioCC9WLCzwPdOIKuKie2Hh3VcAWfkhJtpBl16F4YObEYhUBmvhLCMIBx P9lQ== X-Gm-Message-State: AJIora+4Cn43W8+DdbxXJK4nijVHsuiFWVZeM/hkSQlT62af3XOlstzX LP/bsGq3D+l4o5pON8GkSv2hWw== X-Google-Smtp-Source: AGRyM1tM51jyW9s8kgC95N2mc1NzY1PIEhVhcTWRaV8T1QvLXTY9X469iio+MEx+70cxQP1OzEfDXg== X-Received: by 2002:a65:6044:0:b0:3fc:674:8f5a with SMTP id a4-20020a656044000000b003fc06748f5amr8542311pgp.436.1656611147838; Thu, 30 Jun 2022 10:45:47 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id p26-20020a056a0026da00b005251e2b53acsm13805591pfw.116.2022.06.30.10.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 10:45:47 -0700 (PDT) Date: Thu, 30 Jun 2022 10:45:45 -0700 From: Stephen Hemminger To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Cc: emil.berg@ericsson.com, bruce.richardson@intel.com, dev@dpdk.org, stable@dpdk.org, bugzilla@dpdk.org, hofors@lysator.liu.se, olivier.matz@6wind.com Subject: Re: [PATCH v4] net: fix checksum with unaligned buffer Message-ID: <20220630104545.55d4e870@hermes.local> In-Reply-To: <20220623123900.38283-1-mb@smartsharesystems.com> References: <98CBD80474FA8B44BF855DF32C47DC35D87139@smartserver.smartshare.dk> <20220623123900.38283-1-mb@smartsharesystems.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Thu, 23 Jun 2022 14:39:00 +0200 Morten Br=C3=B8rup wrote: > + /* if buffer is unaligned, keeping it byte order independent */ > + if (unlikely(unaligned)) { > + uint16_t first =3D 0; > + if (unlikely(len =3D=3D 0)) > + return 0; Why is length =3D=3D 0 unique to unaligned case? > + ((unsigned char *)&first)[1] =3D *(const unsigned char *)buf; Use a proper union instead of casting to avoid aliasing warnings. > + bsum +=3D first; > + buf =3D RTE_PTR_ADD(buf, 1); > + len--; > + } Many CPU's (such as x86) won't care about alignment and therefore the extra code to handle this is not worth doing. Perhaps DPDK needs a macro (like Linux kernel) for efficient unaligned acce= ss. In Linux kernel it is CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS