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 24236430C3; Mon, 21 Aug 2023 18:11:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 763CE4328D; Mon, 21 Aug 2023 18:10:15 +0200 (CEST) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id 415ED432A2 for ; Mon, 21 Aug 2023 18:10:10 +0200 (CEST) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1bdaeb0f29aso21102975ad.2 for ; Mon, 21 Aug 2023 09:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1692634209; x=1693239009; 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=dxfCJ8JCP4HHGFPNVjC7sgPW8L8L1EzHthHSsCbcwEw=; b=nQ0laaNd+e9g9UIBOB3zfW6cRULKzwZ6Capfs2gQPDUDdFTROCwigRnXXlDsiunh6P hAvvcbP9dFVODpMLOvs0U8KmjOPlvwhjvpmDhYctrzq4/84Uhn4ra7EYSyDmN6bORhOI Tl4GOnZwslLRSzIp6Watdxhu6bk1QUkTNA0QkxzcY5FVpTKko3aG9AfLEhD0a1Mp4YY7 JkA9Van1BGDsbIiywFVjvl+QlSjyvot6F7Tjzr6G+/vyoi1MEFd+P7whc0YhhdeTEVOw EVIh64OdSGwLQOoMPVC25fh+PSrLu4Y5dR9iI1BjglIjglj8Nv8w0ZRfLE3kzEIfSsZ4 zweQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692634209; x=1693239009; 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=dxfCJ8JCP4HHGFPNVjC7sgPW8L8L1EzHthHSsCbcwEw=; b=FSVu7nYvWhKygeQJVxoKLBgYR8QTvYJlVddtfSDrbbrTbnX2IRbkGY3u4IaxbxaoFm eG19NTVtvcEgyeL4BTEdPir33q3eNyyb82fDMiJ4oLcL3iy2V5O3cXUnf2HpSDndQa2J VCbyP9VIwzzH7ISSGgWdVQxYvvY5XtVLNPOIFvzL8hhDY2v9bH0uwA++Rvezbum/fVUk BX2RJZlR4yAjaQnXs9xURWvZmbddgiQnFQgyV15ZcEx79ZZVDOI/65QyDvOk5g6zZ/ct H2ADrnlLeu4gUzpX5Vidt4uJKEjbtMtIcd0eF1Eg7SNmqWVZFvJ+eAaTUH4aN7pTG6T6 06qw== X-Gm-Message-State: AOJu0YzXUqmfn0GBtmbEYIKimP5a98t3tDUXbwC2pQw4gw1mllOgSnPO 56thntSvB+RDbEuIiNpv5jEhqErQO+ZkVc5qF4BJLk1E X-Google-Smtp-Source: AGHT+IF2Pi7fRtC5apfOi0DhhXSigYmnpXda5Zx5lTt1LnRTNq638BdAg6uxo3yNkxG/xiV6vH+mng== X-Received: by 2002:a17:902:e884:b0:1bb:dc48:644a with SMTP id w4-20020a170902e88400b001bbdc48644amr5917281plg.49.1692634209250; Mon, 21 Aug 2023 09:10:09 -0700 (PDT) Received: from hermes.local (204-195-127-207.wavecable.com. [204.195.127.207]) by smtp.gmail.com with ESMTPSA id i1-20020a17090332c100b001bf2dcfe352sm7208159plr.234.2023.08.21.09.10.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 09:10:08 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin Subject: [PATCH v13 16/21] hash: move rte_thash_gfni stubs out of header file Date: Mon, 21 Aug 2023 09:09:16 -0700 Message-Id: <20230821160921.383832-17-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230821160921.383832-1-stephen@networkplumber.org> References: <20230329234049.11071-1-stephen@networkplumber.org> <20230821160921.383832-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 | 30 ++++++++----------------- lib/hash/version.map | 4 ++++ 4 files changed, 67 insertions(+), 22 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..4fc92984077e 100644 --- a/lib/hash/rte_thash_gfni.h +++ b/lib/hash/rte_thash_gfni.h @@ -9,13 +9,14 @@ extern "C" { #endif +#include + #include -#include +#include +#include #ifdef RTE_ARCH_X86 - #include - #endif #ifndef RTE_THASH_GFNI_DEFINED @@ -38,13 +39,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 +63,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 daaa9a8901db..8288c6e7967e 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.2