From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D98EB43BBA;
	Thu,  7 Mar 2024 12:05:50 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C7CD942EA7;
	Thu,  7 Mar 2024 12:05:50 +0100 (CET)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id 70B2C40272
 for <dev@dpdk.org>; Thu,  7 Mar 2024 12:05:48 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1709809548;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=/eWO3vqQS0KpJ1KTTUZaPLG0K3F44oHrc6yCvKbXHN8=;
 b=JYtcMOT6ZHbv7iEn56N59UsyVPBId68Szh260XBWRRn2pSPAEGCS/qddPPD6QA78qo0UCS
 yRkm3/mSmCDL/2BaHBFEXsVTZERMiYmOnxt2tIx3FFXidxABV6QTjckx0K6pr2IwMSrLLO
 ev6R+8liv3VamHqWMO1kK2KZezR9pTk=
Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com
 [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
 us-mta-600-rw1ZO1OnMmm6M-EZi7E-Zw-1; Thu, 07 Mar 2024 06:05:46 -0500
X-MC-Unique: rw1ZO1OnMmm6M-EZi7E-Zw-1
Received: by mail-lf1-f70.google.com with SMTP id
 2adb3069b0e04-5131aa087beso524019e87.2
 for <dev@dpdk.org>; Thu, 07 Mar 2024 03:05:46 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1709809545; x=1710414345;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=/eWO3vqQS0KpJ1KTTUZaPLG0K3F44oHrc6yCvKbXHN8=;
 b=ii2au8qbVHwMQNYyTfr6bk3qbC1rKh6/2jkftem/TYfsFlMaPkLX7wEJDnFGgeC6TR
 Wd8ni9mG8JE46T/WxB8ELqv9fIcaDl0wd6yvDGC2ov7ZcPW8K571PVbofL+CoW/YIvpl
 UlcJI/S4fomOQSI2ROuJvORCCiwUR9yZwzqD0YeO3ez7o1YI1Y2UmLspqPcR0f/Qxj5N
 /m5F2tE1Hza8FPDV+bWlcu/LEqhYDsXMteoUgfGKun6Cr2VC4UqAXzI/Vx+pegXMyKP9
 01ObUWsXxk/jvBcNZjLxys8a84j/2r/cwZCIMFfmvIgD1EA5536Xi/azuMCrwZkHvyyX
 8wEQ==
X-Gm-Message-State: AOJu0Yxw/iE53KK9X6qqzab3vlI5ha+vraMO1vOTWWFBvJhtF/tQl9dI
 kXw3ldVIFSK+F1Skg0MiLu0gaxmrGWJ5M9Ae3VV4aesVv7iklwsl8SCx76dnmsVNJiwEwH7F905
 Not55LWNmbhnZJwctoOl8yTBBLc72PChmfAMfRybFxK4D8P8mEBqHvga/khGOnD5B3i6n+QIK+K
 +ty2zCzpJa+q7ZyM4=
X-Received: by 2002:ac2:58e2:0:b0:513:1cfe:7cf7 with SMTP id
 v2-20020ac258e2000000b005131cfe7cf7mr1023819lfo.22.1709809545193; 
 Thu, 07 Mar 2024 03:05:45 -0800 (PST)
X-Google-Smtp-Source: AGHT+IHMnQ5uqoWyh4ZAqMnkE7jhTQvyM/IdvVuq3jDTvp70jCniD9X3BvtoxeYQvE27c8+e4uzq3VuPIphGF17T5rY=
X-Received: by 2002:ac2:58e2:0:b0:513:1cfe:7cf7 with SMTP id
 v2-20020ac258e2000000b005131cfe7cf7mr1023806lfo.22.1709809544829; Thu, 07 Mar
 2024 03:05:44 -0800 (PST)
MIME-Version: 1.0
References: <20240304184508.89956-1-stephen@networkplumber.org>
 <20240307013715.114013-1-stephen@networkplumber.org>
In-Reply-To: <20240307013715.114013-1-stephen@networkplumber.org>
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 7 Mar 2024 12:05:33 +0100
Message-ID: <CAJFAV8wsYRZFan_Qo_wqdRaRFT8wY-3m80TWgiwd2C=uyL_6tA@mail.gmail.com>
Subject: Re: [PATCH v3] hash: put GFNI stubs back
To: Stephen Hemminger <stephen@networkplumber.org>, 
 Tyler Retzlaff <roretzla@linux.microsoft.com>
Cc: dev@dpdk.org, Yipeng Wang <yipeng1.wang@intel.com>, 
 Sameh Gobriel <sameh.gobriel@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>, 
 Vladimir Medvedkin <vladimir.medvedkin@intel.com>
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Hello,

On Thu, Mar 7, 2024 at 2:37=E2=80=AFAM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Make the GFNI stub functions always built. This solves the conditional
> linking problem. If GFNI is available, they will never get used.
>
> Fixes: 07d836e5929d ("hash: uninline GFNI stubs")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v3 - fix typo in call to ___rte_thash_gfni_bulk
>
>  lib/hash/rte_thash_gfni.c |  9 +++------
>  lib/hash/rte_thash_gfni.h | 30 +++++++++++++++++++++++-------
>  lib/hash/version.map      |  9 +++++++--
>  3 files changed, 33 insertions(+), 15 deletions(-)
>
> diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
> index f1525f9838de..5ead51dd3426 100644
> --- a/lib/hash/rte_thash_gfni.c
> +++ b/lib/hash/rte_thash_gfni.c
> @@ -4,18 +4,17 @@
>
>  #include <stdbool.h>
>
> +#include <rte_compat.h>

This should be in the header since this is where the __rte_internal tag is =
used.
Moving this inclusion will fix the failing headers check for arches !=3D x8=
6:
http://mails.dpdk.org/archives/test-report/2024-March/603562.html


>  #include <rte_log.h>
>  #include <rte_thash_gfni.h>
>
> -#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,
> +___rte_thash_gfni(const uint64_t *mtrx __rte_unused,

Let's go with a s/___rte_thash_gfni/rte_thash_gfni_stub/g.


>         const uint8_t *key __rte_unused, int len __rte_unused)
>  {
>         static bool warned;
> @@ -30,7 +29,7 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,
>  }
>
>  void
> -rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
> +___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)
>  {
> @@ -47,5 +46,3 @@ rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
>         for (i =3D 0; i < num; i++)
>                 val[i] =3D 0;
>  }
> -
> -#endif
> diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h
> index eed55fc86c86..432d5b63a12e 100644
> --- a/lib/hash/rte_thash_gfni.h
> +++ b/lib/hash/rte_thash_gfni.h
> @@ -17,11 +17,22 @@ extern "C" {
>
>  #endif
>
> -#ifndef RTE_THASH_GFNI_DEFINED
> +/*
> + * @internal
> + * Stubs defined for only used when GFNI is not available

This reads strange, I'll reword when applying as:
* Stubs only used when GFNI is not available


> + */
> +__rte_internal
> +uint32_t
> +___rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
> +
> +__rte_internal
> +void
> +___rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
> +                      uint32_t val[], uint32_t num);
>
> +#ifndef RTE_THASH_GFNI_DEFINED
>  /**
>   * Calculate Toeplitz hash.
> - * Dummy implementation.
>   *
>   * @param m
>   *  Pointer to the matrices generated from the corresponding
> @@ -33,12 +44,14 @@ 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, const uint8_t *key, int len)
> +{
> +       return ___rte_thash_gfni(mtrx, key, len);
> +}
>
>  /**
>   * Bulk implementation for Toeplitz hash.
> - * Dummy implementation.
>   *
>   * @param m
>   *  Pointer to the matrices generated from the corresponding
> @@ -53,9 +66,12 @@ rte_thash_gfni(const uint64_t *mtrx, const uint8_t *ke=
y, int len);
>   * @param num
>   *  Number of tuples to hash.
>   */
> -void
> +static inline void
>  rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
> -       uint32_t val[], uint32_t num);
> +       uint32_t val[], uint32_t num)
> +{
> +       return ___rte_thash_gfni_bulk(mtrx, len, tuple, val, num);
> +}
>
>  #endif /* RTE_THASH_GFNI_DEFINED */
>
> diff --git a/lib/hash/version.map b/lib/hash/version.map
> index 6b2afebf6b46..942e2998578f 100644
> --- a/lib/hash/version.map
> +++ b/lib/hash/version.map
> @@ -41,10 +41,15 @@ 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;
>
>         local: *;
>  };
> +
> +INTERNAL {
> +       global:
> +
> +       ___rte_thash_gfni;
> +       ___rte_thash_gfni_bulk;
> +};
> --
> 2.43.0
>

The rest lgtm but I can't reproduce a link error in the first place.
I'll wait for Tyler to confirm this patch fixes the issue he hit.


--=20
David Marchand