From patchwork Tue May 7 15:24:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Finn, Emma" X-Patchwork-Id: 1932545 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=CPvv6HDf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYhsm0Dv1z1ydW for ; Wed, 8 May 2024 01:24:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id ECB628136E; Tue, 7 May 2024 15:24:57 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id vD_J0ftFLtVn; Tue, 7 May 2024 15:24:56 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CDF6080EA6 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=CPvv6HDf Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id CDF6080EA6; Tue, 7 May 2024 15:24:56 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 912E9C007C; Tue, 7 May 2024 15:24:56 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2E631C0037 for ; Tue, 7 May 2024 15:24:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1E11160A65 for ; Tue, 7 May 2024 15:24:56 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id fMQW-9rDz4Mf for ; Tue, 7 May 2024 15:24:55 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.10; helo=mgamail.intel.com; envelope-from=emma.finn@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 3749760A45 Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3749760A45 Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=CPvv6HDf Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3749760A45 for ; Tue, 7 May 2024 15:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715095495; x=1746631495; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+uM64ayPX78HNu61bZViJKqpQosYvOimoGE0v+Y4/sE=; b=CPvv6HDf5ACymzPA38mAzd8GVl5u3ohXdZzMdWYYgAVKVwt33saGbjyO rKpUTXk0awsEoWj1tNg6xYl2bYlxxLAtye7JyVcVdkoMD0UQwQPQZePxK CQ52d4qCKJbIfgNrBH53q2Jx3FiV1/8w5LC2uG855F6Kw1V8JcSSZOKbI Pr4C+GXUK/8q/o+jTdANJoEhaNXoGTM6e9OtjF0meLCjBHdbJpp8ib9FV a9JW6hgQIGCjgTbMbOh2iGTI5lYk6QaYxKzocOOv8FvuSWD2PoKwLr0Ka 0lDaWyWTUJtRVvKPZUxIPr6I4BXP8ZlidajKflsyxHIC6DRTOFRix/aVq Q==; X-CSE-ConnectionGUID: jOdc9XvjSbqBUbhBlhPYWA== X-CSE-MsgGUID: M8RPWuawToGQflO4zlcIzA== X-IronPort-AV: E=McAfee;i="6600,9927,11066"; a="22292030" X-IronPort-AV: E=Sophos;i="6.08,142,1712646000"; d="scan'208";a="22292030" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2024 08:24:54 -0700 X-CSE-ConnectionGUID: S7HyDUMQTq2jdx1OTHEWCw== X-CSE-MsgGUID: Jzj+0lWcRvaZSQ2BJy5JLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,142,1712646000"; d="scan'208";a="33382187" Received: from silpixa00401121.ir.intel.com (HELO silpixa00401121.ger.corp.intel.com) ([10.237.222.135]) by orviesa004.jf.intel.com with ESMTP; 07 May 2024 08:24:53 -0700 From: Emma Finn To: ovs-dev@openvswitch.org Date: Tue, 7 May 2024 15:24:50 +0000 Message-Id: <20240507152450.3781323-1-emma.finn@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH] odp-execute: Fix AVX checksum calculation. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The AVX implementation for calcualting checksum was not handling carry-over addition correctly in some cases. This patch adds an additional shuffle to add 16-bit padding to the final part of the calculation to handle such cases. Fixes: 92eb03f7b03a ("odp-execute: Add ISA implementation of set_masked IPv4 action") Signed-off-by: Emma Finn Reported-by: Eelco Chaudron --- lib/odp-execute-avx512.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/odp-execute-avx512.c b/lib/odp-execute-avx512.c index 50c48bfd4..911fdd3ea 100644 --- a/lib/odp-execute-avx512.c +++ b/lib/odp-execute-avx512.c @@ -366,6 +366,8 @@ avx512_get_delta(__m256i old_header, __m256i new_header) 0xF, 0xF, 0xF, 0xF); v_delta = _mm256_permutexvar_epi32(v_swap32a, v_delta); + v_delta = _mm256_hadd_epi32(v_delta, v_zeros); + v_delta = _mm256_shuffle_epi8(v_delta, v_swap16a); v_delta = _mm256_hadd_epi32(v_delta, v_zeros); v_delta = _mm256_hadd_epi16(v_delta, v_zeros);