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 F232E41D40; Wed, 22 Feb 2023 17:11:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30EAF430D2; Wed, 22 Feb 2023 17:10:04 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id D0A834307A for ; Wed, 22 Feb 2023 17:09:43 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id na9-20020a17090b4c0900b0023058bbd7b2so8741455pjb.0 for ; Wed, 22 Feb 2023 08:09:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SIqnAYH5CnL4aLL96hZvzGaDP7pcxQN9wVO8q+PZWgs=; b=jicfETHiE6Vb3XrTPagWQiM7yb5Ceejwy7hQ9O/zR3PfDOInkWoUWI63Bt7Ukj0rUQ 4sQmdJTUPsea/+K8+GcYq1ycs639jfzQeeWWS3bTAx4KHjZekGuHIy7UoGBheDI/shS4 +VBo1qNWEuF9e/WePMq4lSpDoKSHVGGvoFCoETU8zvZRiNc53IXwdzu0krkc5WbJc5hN iWNJ/9fI8x0bDHEjKSzg0UdEKMek1Rlh3jyOJfUTyhxq+Krq9VPuipYn6TEz2FW9WZ20 tasqh3UfMUPZbI2rdiQtTSg7cEopijU9uYaBRRG4DWlk4s5CNCLz7zEkWSfZWSHhkkQ0 ZXnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SIqnAYH5CnL4aLL96hZvzGaDP7pcxQN9wVO8q+PZWgs=; b=1jUho+VGcl8wAYsta7dOtUaW3jzM64LK+lBHnHv9F9VPq5KvL0iL3+2kHxpihXwRjd mCYaZE/akhR5LFh8bR+TAmWZgXrraT+rrABCp7m7OhL9/zj8sSj+nTXxGYKFdCUDGUF1 NRNOGFJW/GsckzOCUbgqgaVEleHRebGgjOw6TPBc4SWUjTyUNsxjQX14qxAILCTZCX7o gl5Tl0yfT2a7ziloGTBaB4VvkpNGvyeOXNsMVaY12dIl551IDO2VnUB+wsIcm5cfqroG HsWcLW6lR0B6RTUneID2iH9RAwKJVJSxpUzgB5n/O/GPdYkQ3haavHvm3Zpj6PPQ2zX4 fy6w== X-Gm-Message-State: AO0yUKVE4kXwt6SLEvpmxuW+cAUwwaW8o1tvFMM3msuQkCXjt9ddVl/J 1DAbUBoQFZAugbUYwgckYDN8LySfLgHIQPybX9w= X-Google-Smtp-Source: AK7set9kzEbj1qeUDwgnX4SOgil9bDLEYFXthhYJefIXL0krzDTGRNh7gt5ZfQuGeSSCJOQB5/5z3Q== X-Received: by 2002:a05:6a20:4b0f:b0:bf:e6c:758b with SMTP id fp15-20020a056a204b0f00b000bf0e6c758bmr1349180pzb.4.1677082182735; Wed, 22 Feb 2023 08:09:42 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id x24-20020a63db58000000b004fb71d96d78sm5063778pgi.2.2023.02.22.08.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 08:09:42 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin Subject: [PATCH v10 20/22] hash: move rte_thash_gfni stubs out of header file Date: Wed, 22 Feb 2023 08:08:00 -0800 Message-Id: <20230222160802.123611-21-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230222160802.123611-1-stephen@networkplumber.org> References: <20230207204151.1503491-1-stephen@networkplumber.org> <20230222160802.123611-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Having stubs in header file makes it harder to update RTE_LOG(). Also modify to only print warning once. Signed-off-by: Stephen Hemminger --- lib/hash/meson.build | 8 ++++++- lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++ lib/hash/rte_thash_gfni.h | 29 +++++------------------- lib/hash/version.map | 4 ++++ 4 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 lib/hash/rte_thash_gfni.c diff --git a/lib/hash/meson.build b/lib/hash/meson.build index 2f757d45f9bc..e56ee8572564 100644 --- a/lib/hash/meson.build +++ b/lib/hash/meson.build @@ -17,7 +17,13 @@ indirect_headers += files( 'rte_thash_x86_gfni.h', ) -sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c', 'rte_thash.c') +sources = files( + 'rte_cuckoo_hash.c', + 'rte_fbk_hash.c', + 'rte_thash.c', + 'rte_thash_gfni.c' +) + deps += ['net'] deps += ['ring'] deps += ['rcu'] diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c new file mode 100644 index 000000000000..eb334185725c --- /dev/null +++ b/lib/hash/rte_thash_gfni.c @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2021 Intel Corporation + */ + +#include + +#include +#include +#include + +#ifndef RTE_THASH_GFNI_DEFINED + +uint32_t +rte_thash_gfni(const uint64_t *mtrx __rte_unused, + const uint8_t *key __rte_unused, int len __rte_unused) +{ + static bool warned; + + if (!warned) { + warned = true; + RTE_LOG(ERR, HASH, + "%s is undefined under given arch\n", __func__); + } + + return 0; +} + +void +rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused, + int len __rte_unused, uint8_t *tuple[] __rte_unused, + uint32_t val[], uint32_t num) +{ + unsigned int i; + + static bool warned; + + if (!warned) { + warned = true; + RTE_LOG(ERR, HASH, + "%s is undefined under given arch\n", __func__); + } + + for (i = 0; i < num; i++) + val[i] = 0; +} + +#endif diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h index ef90faa302d1..6127f5533873 100644 --- a/lib/hash/rte_thash_gfni.h +++ b/lib/hash/rte_thash_gfni.h @@ -9,16 +9,12 @@ extern "C" { #endif -#include -#include - #ifdef RTE_ARCH_X86 - #include - #endif #ifndef RTE_THASH_GFNI_DEFINED +#include /** * Calculate Toeplitz hash. @@ -38,13 +34,8 @@ extern "C" { * Calculated Toeplitz hash value. */ __rte_experimental -static inline uint32_t -rte_thash_gfni(const uint64_t *mtrx __rte_unused, - const uint8_t *key __rte_unused, int len __rte_unused) -{ - RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__); - return 0; -} +uint32_t +rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len); /** * Bulk implementation for Toeplitz hash. @@ -67,17 +58,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused, * Number of tuples to hash. */ __rte_experimental -static inline void -rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused, - int len __rte_unused, uint8_t *tuple[] __rte_unused, - uint32_t val[], uint32_t num) -{ - unsigned int i; - - RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__); - for (i = 0; i < num; i++) - val[i] = 0; -} +void +rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[], + uint32_t val[], uint32_t num); #endif /* RTE_THASH_GFNI_DEFINED */ diff --git a/lib/hash/version.map b/lib/hash/version.map index bdcebd19c29b..f03b047b2eec 100644 --- a/lib/hash/version.map +++ b/lib/hash/version.map @@ -51,4 +51,8 @@ EXPERIMENTAL { rte_thash_complete_matrix; rte_thash_get_gfni_matrices; rte_thash_gfni_supported; + + # added in 22.07 + rte_thash_gfni; + rte_thash_gfni_bulk; }; -- 2.39.1