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 81110433FD; Tue, 5 Dec 2023 03:15:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD7BC42DFB; Tue, 5 Dec 2023 03:14:09 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id 300F342D76 for ; Tue, 5 Dec 2023 03:14:03 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6cddc148285so5469760b3a.2 for ; Mon, 04 Dec 2023 18:14:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1701742442; x=1702347242; darn=dpdk.org; 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=PWR1K6YSlC9gkEptbTI1aqv1RWOFNkD8axBDPil4M6U=; b=HaprV6llGkKT2u8ph7dhpo0lMOucaoo5Ys4T3wS2yxeftYXJiVkXyUgBzMXBTZPRB3 VVUiPRVkWwXaotke+0DUezV6Pr/HgO0vEKWzcC2ReRkUajw1pFR/kLe2SesOwqdGh7+i nvMOvJXoHI8YuJR4suufMWp0RvLNNobtkYH9ybAreBB9MLAJCT27yBhMwuBYTiJia7Vc UMyeg5zqa5zadL30v3GHPVyUNPMO4n5SPn2E/31hIO462xy0ndmSeHv06h1UF0y9WoCx rVSe4Z8ShcBMGbuzkheQT/UzkqQrA+nhDRAnb63iDMBw9YTDhJ4fhwmwtyozvgLeHMmI xjVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701742442; x=1702347242; 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=PWR1K6YSlC9gkEptbTI1aqv1RWOFNkD8axBDPil4M6U=; b=HnU9dgg6RsiWkjJh+d0aI9A8xRJaU2EV3c5hHqYXpL6OWKB4a3Sdm6UhaRDToXsUDN lLd3FX7uybtM1SwY56QSE0kmRcEA8DpBHDo9DZ0P42itW0G/A9jU8Qk0uvPkvucHTuHa 4teesDaU2mUcvQiIs0q3bCqjzLsvpQtM1ZWvMyQg/QCDF0OgNCvbhUak5MgE30yunejO glra34u/+OIg551nyvVRQjmvmHvUFYNApo5g2X+Hs+WyBDjLHFxR3kKm6PDUTlYvcI+h j93NigEQaBtu6AAj5tKVeoXZcSLINsOatmh45H/Iosl+UMopdm4hj3FOL9p0p05Fr9Y3 aF8w== X-Gm-Message-State: AOJu0YzVlTf/alwcVae+rHtcv3qJ3NREjiAY4OaCBrB1lUnLxsoNCQ+c 65h3nFBQWTzTdQx4zqh3sRM0bk7e7qyWALZ/I6Q= X-Google-Smtp-Source: AGHT+IGjMWZu8DM1eBdL/+WFDr6ER9xbv1NljcsDztgXUzIXg2/zlmfcESsV8cyUM5tncTcK6gVdxQ== X-Received: by 2002:a05:6a20:e595:b0:18f:97c:8a3b with SMTP id ng21-20020a056a20e59500b0018f097c8a3bmr5193525pzb.102.1701742442399; Mon, 04 Dec 2023 18:14:02 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id p26-20020a62b81a000000b0069346777241sm355958pfe.97.2023.12.04.18.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 18:14:02 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin Subject: [PATCH 16/18] hash: mover rte_thash_gfni stubs out of header file Date: Mon, 4 Dec 2023 18:09:54 -0800 Message-ID: <20231205021330.260017-17-stephen@networkplumber.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231205021330.260017-1-stephen@networkplumber.org> References: <20230329234049.11071-1-stephen@networkplumber.org> <20231205021330.260017-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 | 23 +++++-------------- lib/hash/version.map | 2 ++ 4 files changed, 61 insertions(+), 19 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 cd253459e7da..4e5388a1bf65 100644 --- a/lib/hash/rte_thash_gfni.h +++ b/lib/hash/rte_thash_gfni.h @@ -33,13 +33,8 @@ extern "C" { * @return * Calculated Toeplitz hash value. */ -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. @@ -58,17 +53,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused, * @param num * Number of tuples to hash. */ -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 b98b64a1638a..56a0cbd4b8a5 100644 --- a/lib/hash/version.map +++ b/lib/hash/version.map @@ -39,6 +39,8 @@ DPDK_24 { rte_thash_get_gfni_matrices; rte_thash_get_helper; rte_thash_get_key; + rte_thash_gfni; + rte_thash_gfni_bulk; rte_thash_gfni_supported; rte_thash_init_ctx; -- 2.42.0