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 3637143BD7; Tue, 5 Mar 2024 04:08:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C5E6402B1; Tue, 5 Mar 2024 04:08:24 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 3A6744026B for ; Tue, 5 Mar 2024 04:08:22 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1dc49afb495so48870535ad.2 for ; Mon, 04 Mar 2024 19:08:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709608101; x=1710212901; 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=ke5jq1S/MGpNGu81Mj7et5h41lL4VSvx5eiSGvBh/uM=; b=aDumrXSejNjVJfLzyFNZF22zrSGT/BVwRUnBkz5BQ2stiZketpaS77bGA5sQXEvImZ BV4hxe1rRMGUwGp07ctklG2imW2HD+DXKIt/xlSOnDtik1z1btLJaZj/2zcs1Id0lWYN wsrOJRw5YFqZj5qd51/ohAkB5O5TiNshQkY21FTkDQkXTynPBEiou7p73o4ytT6wdE6Z jc8Jicl8EDEfp5M4W6VEsOYd5ig8FtNqgCf5waVozNQr06cwlXi5mNqrl0qn82UIINon aJCCBDZbJJRXDuqibzoDYD8kdG05pYpytgWNqEHOckqD0NVyvUf5ezXSm7N/uMJs0Dcw vsIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709608101; x=1710212901; 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=ke5jq1S/MGpNGu81Mj7et5h41lL4VSvx5eiSGvBh/uM=; b=RYLzmevUWf4lDvP+WdN6IBXua9rXfZLPdoxvyiMDi7ED042L54pzS43n4k9ZWd4OJs HOJYXTV1VBXof8Y2vsbXcROWG3xVigF7BCADwsIUya8LjAH3KD57yKJkzdVgf7cpHSFC K9NxJmgzI1JCZ9xtPwqH7jG1FtUdR5UUpXTJwPs3plZq7k5tT9+jMf+2jGJ9TLsUyRLK LFyO8AEjXmXfXRwruBFhP26AzVC5NToNq6p+EDbYTvaunO2ggqOhbWjPg2DKnjHCr6Wy 5Yp4Fk+WrD9Ddq2O2zEj9UKqal5CZ9s8K+QyX73+KdRWV9AQLraBPZqYOnNVhRxzVan6 BK0g== X-Gm-Message-State: AOJu0YwUzeJpWULdy9jL3IPFEQWUTMaqWGShHtSh37+u4VU+CrhXI6Jb OAMdlFbAGmBKJfH3CyXOYAjGmnar1F45+L+1gpCcJ1NaZ96M04FEfu2anFjAsHArtuTQcXwd4pn OgDJYow== X-Google-Smtp-Source: AGHT+IF9RtFgNaGW+owqJjINKEPtp+wJPGOfmXVKpYXJqiVrGv71vnbBnnh1nzf2i88Z0fJWSFP+oQ== X-Received: by 2002:a17:902:c402:b0:1db:28bd:2949 with SMTP id k2-20020a170902c40200b001db28bd2949mr741955plk.0.1709608101312; Mon, 04 Mar 2024 19:08:21 -0800 (PST) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id u11-20020a170903124b00b001dc01efaec2sm9252212plh.168.2024.03.04.19.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 19:08:20 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Tyler Retzlaff , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin Subject: [PATCH v2] hash: make GFNI stubs inline (again) Date: Mon, 4 Mar 2024 19:07:24 -0800 Message-ID: <20240305030819.276707-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240304184508.89956-1-stephen@networkplumber.org> References: <20240304184508.89956-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 Tyler found build issues with MSVC and the thash gfni stubs. The problem would be link errors from missing symbols. This version puts back the rte_thash_gfni function stubs as inlines, but instead of logging a message, they panic. This is intentional because any application should be checking with function rte_thash_gfni_supported() before calling the hashing functions here. Better to panic then return zero and put out log message which will be ignored... Fixes: 07d836e5929d ("hash: uninline GFNI stubs") Reported-by: Tyler Retzlaff Signed-off-by: Stephen Hemminger --- v2 - uses panic instead of logging. Please ignore the checkpatch nag about this. lib/hash/meson.build | 1 - lib/hash/rte_thash_gfni.c | 51 --------------------------------------- lib/hash/rte_thash_gfni.h | 34 ++++++++++++++++++-------- lib/hash/version.map | 2 -- 4 files changed, 24 insertions(+), 64 deletions(-) delete mode 100644 lib/hash/rte_thash_gfni.c diff --git a/lib/hash/meson.build b/lib/hash/meson.build index 277eb9fa9366..541b1d2790fa 100644 --- a/lib/hash/meson.build +++ b/lib/hash/meson.build @@ -22,7 +22,6 @@ sources = files( 'rte_hash_crc.c', 'rte_fbk_hash.c', 'rte_thash.c', - 'rte_thash_gfni.c', ) deps += ['net'] diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c deleted file mode 100644 index f1525f9838de..000000000000 --- a/lib/hash/rte_thash_gfni.c +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2021 Intel Corporation - */ - -#include - -#include -#include - -#ifndef RTE_THASH_GFNI_DEFINED - -RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO); -#define RTE_LOGTYPE_HASH hash_gfni_logtype -#define HASH_LOG(level, ...) \ - RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) - -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; - HASH_LOG(ERR, - "%s is undefined under given arch", __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; - HASH_LOG(ERR, - "%s is undefined under given arch", __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 eed55fc86c86..d1e7c02398c2 100644 --- a/lib/hash/rte_thash_gfni.h +++ b/lib/hash/rte_thash_gfni.h @@ -9,8 +9,6 @@ extern "C" { #endif -#include - #ifdef RTE_ARCH_X86 #include @@ -19,9 +17,10 @@ extern "C" { #ifndef RTE_THASH_GFNI_DEFINED +#include + /** * Calculate Toeplitz hash. - * Dummy implementation. * * @param m * Pointer to the matrices generated from the corresponding @@ -31,14 +30,21 @@ extern "C" { * @param len * Length of the data to be hashed. * @return - * Calculated Toeplitz hash value. + * Calculated hash value. */ -uint32_t -rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len); +static inline uint32_t +rte_thash_gfni(const uint64_t *mtrx __rte_unused, + const uint8_t *key __rte_unused, int len __rte_unused) +{ + /* + * This stub always panics because the application should be calling + * rte_thash_gfni_supported() to check if the arch supports this. + */ + rte_panic("%s is undefined under given arch\n", __func__); +} /** * Bulk implementation for Toeplitz hash. - * Dummy implementation. * * @param m * Pointer to the matrices generated from the corresponding @@ -53,9 +59,17 @@ rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len); * @param num * Number of tuples to hash. */ -void -rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[], - uint32_t val[], uint32_t num); +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[] __rte_unused, uint32_t num __rte_unused) +{ + /* + * This stub always panics because the application should be calling + * rte_thash_gfni_supported() to check if the arch supports this. + */ + rte_panic("%s is undefined under given arch\n", __func__); +} #endif /* RTE_THASH_GFNI_DEFINED */ diff --git a/lib/hash/version.map b/lib/hash/version.map index 6b2afebf6b46..6236b24722a2 100644 --- a/lib/hash/version.map +++ b/lib/hash/version.map @@ -41,8 +41,6 @@ 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.43.0