From patchwork Mon Mar 4 18:45:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 137954 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08BBE43B9B; Mon, 4 Mar 2024 19:45:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B06D840EA5; Mon, 4 Mar 2024 19:45:13 +0100 (CET) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mails.dpdk.org (Postfix) with ESMTP id 146674027D for ; Mon, 4 Mar 2024 19:45:11 +0100 (CET) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6e4560664b5so3962599b3a.1 for ; Mon, 04 Mar 2024 10:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709577911; x=1710182711; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pHFUd26dlhJj59GbDm0lA53W+w1Aw20HvuihCRNvKtA=; b=stSi5oMrAOiDfsc0Gj9djKtmafftxaPLR5sHKXAdrpp4UyZjFdZ8p+MRfFecS990Pv 0QRgz3y1DUs1oBy+dm8FTvKzTK9SRBbZmq+Fn4a2dzgOkJ1oIjrkEG0BLslidtJS+KFq GG5bfPOsYUKzgdAwp6MeluCjdopjzATCu9Y/ChSC2C4Jrjc279zeUHJDilKn6ABUcxhv A8R3gunsBiAbLz7BjPOFwb0SGiKSzD/ps7+5UA8JIN+TA7kBgLfx1UDYbhJKtzeF6uZm dasgeC4q6Udg+hv1v0ccq76pyKSXEDW00Kxts9vTp8rrDCmYjnHtCRbVGnJxIgLBpIZj NzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709577911; x=1710182711; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pHFUd26dlhJj59GbDm0lA53W+w1Aw20HvuihCRNvKtA=; b=CBKG7hBkwKzphbPVCDjO1SsMFTrTZMfZtcQnEA4DTeKg4hO+Kp6Q26s76kVfWAkvzP o4SplRUtv1+0v/cd0l1iRFfSCmE+61eyn+WgBCxM46sfnUmdSQm406UrdhdDkh/bjeYv jejnpATM9KjctE/XXWDhzalbSDnwz0oCtwfR2X4k6ZCBoSeUF8ZOn/g6iyVm/qsUaXKf XFZUsEbrTj7ncn9HQ30Ht6TQk7ms3SIFqp8k9uqHATwaSI0KpLt4LHYuTuZ8aoPZuatz 5Bbyh7icQvkzcz30dslQsg+PHC6sLNgHyCs6Z83n2X7n1in1uZZt74EeE5wICoCEH8GN TnlA== X-Gm-Message-State: AOJu0Ywjz2p5M5nGw513K4o11fYqseD9OEnfS3+u4Q03+uomQBF1+3KV GFHJ84dWIB2gMABARr1EzmpfIHtfOztbdNY1pDNrYeh5k136/yHpHEBMNEEhhYL3Iyi7HSP1hj+ ULw05iw== X-Google-Smtp-Source: AGHT+IFw58Z//CTu4T7GM/2ZuWCfmdvSb0Cigmzb89+Hd0NUlhM5GVZ4t9JrixHi60NsThPGW+pR9Q== X-Received: by 2002:a05:6a00:8914:b0:6e6:269d:1a29 with SMTP id hw20-20020a056a00891400b006e6269d1a29mr3226638pfb.8.1709577911076; Mon, 04 Mar 2024 10:45:11 -0800 (PST) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id z24-20020a656658000000b005cfbf96c733sm6765407pgv.30.2024.03.04.10.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 10:45:10 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Tyler Retzlaff , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin Subject: [PATCH] hash: make gfni stubs inline Date: Mon, 4 Mar 2024 10:45:08 -0800 Message-ID: <20240304184508.89956-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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 This reverts commit 07d836e5929d18ad6640ebae90dd2f81a2cafb71. Tyler found build issues with MSVC and the thash gfni stubs. The problem would be link errors from missing symbols. The purpose of the original commit was to allow local definition of RTE_LOGTYPE_HASH. Put the thash gfni back as inlines, but require that the header only be included inside rte_thash.h so that the log macros are defined. Reported-by: Tyler Retzlaff Signed-off-by: Stephen Hemminger Signed-off-by: Stephen Hemminger --- lib/hash/meson.build | 1 - lib/hash/rte_thash_gfni.h | 42 +++++++++++++++++++++++---------------- lib/hash/version.map | 2 -- 3 files changed, 25 insertions(+), 20 deletions(-) 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.h b/lib/hash/rte_thash_gfni.h index eed55fc86c86..fba68f7bc250 100644 --- a/lib/hash/rte_thash_gfni.h +++ b/lib/hash/rte_thash_gfni.h @@ -2,14 +2,13 @@ * Copyright(c) 2021 Intel Corporation */ -#ifndef _RTE_THASH_GFNI_H_ -#define _RTE_THASH_GFNI_H_ -#ifdef __cplusplus -extern "C" { -#endif - -#include +/* + * This header file is not supposed to included directly in application + */ +#ifndef _RTE_THASH_H +#error Do not include rte_thash_gfni.h directly +#else #ifdef RTE_ARCH_X86 @@ -33,8 +32,13 @@ extern "C" { * @return * Calculated Toeplitz 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) +{ + RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__); + return 0; +} /** * Bulk implementation for Toeplitz hash. @@ -53,14 +57,18 @@ 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[], uint32_t num) +{ + unsigned int i; -#endif /* RTE_THASH_GFNI_DEFINED */ - -#ifdef __cplusplus + RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__); + for (i = 0; i < num; i++) + val[i] = 0; } -#endif -#endif /* _RTE_THASH_GFNI_H_ */ +#endif /* !RTE_THASH_GFNI_DEFINED */ + +#endif /* !_RTE_HASH__H_ */ 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;