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 605B445A98; Wed, 2 Oct 2024 09:42:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9A8C40268; Wed, 2 Oct 2024 09:42:39 +0200 (CEST) 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 422194003C for ; Wed, 2 Oct 2024 09:42:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727854957; 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=fdSTZSdDNn/DalgU+DpUCSO3pwZY85zZMw6CMkPLnk0=; b=BwyhAsdoGhtr58tPHy4dgeZZPYoRcFf1RLhy9j3ksT1O55t/pvVVhJp+miLg/oYyy8lkzU 14zLvJkIXsCnbQThHmMRLch5PF8Ck0z155S7agBzhuIzzfyjhpEpgYXScHXEoNcD08P7cv kas7TgS9vnI5+FtuJfOJKq2SdDFG1BI= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-486-eSHWTCgWMZO0DUgiQjVo4w-1; Wed, 02 Oct 2024 03:42:36 -0400 X-MC-Unique: eSHWTCgWMZO0DUgiQjVo4w-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2fad2ac8dfcso21240461fa.1 for ; Wed, 02 Oct 2024 00:42:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727854955; x=1728459755; 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=fdSTZSdDNn/DalgU+DpUCSO3pwZY85zZMw6CMkPLnk0=; b=vSQmVmAdvbmzCUiew8dLjzqszWnY+gRPFSLHFpHZ5ths/5PCvh8OicPEDqlL9tkP5O jeMAZsIh41tl18+qtAwV1xlVrD/fTJt7gwmFURPPJOMxl/s7AapvgjGdZwAl1PJG2/XJ qU0tgnPmgekQ6A7Q8WQhISCfdYrVJCM9qHxxxEFglh+p+JZseXMSkI4CXbNiOUNiQPTG OHmTxzNfBzrQiMgc0rPbnrQlOR7aS9XewqpVmd2k0Wj305F9q0HjYqEA0dDbR7mSjUxV la1TdEqgxfUklDB8tlB811I0C2PUWGsVR3m7O+o7HMN0ag8fxGcO4sSrVy429cyHLxKM QlpA== X-Gm-Message-State: AOJu0YwXMvUvOOo8guMH5X6dJMrWB7MvGkjwCaZnpvonaV4GkJpmFZfL HBVhzh8SQn85fVDuZFGmBfI5Xy5vEUEeoJVE2Dzfdb0VXrOhMWyJXXKjAnuScVWdTKJ0UcLJAzw 1cdQatx+/TjPGHq1GGthWL8oWTyVFfXQjwENKc15C6IDTG7ln+pWrSkN/UaXhb10Fco6GL3xjJ0 eQs4kqs2eUj1E4pd8= X-Received: by 2002:a2e:a99d:0:b0:2fa:c49b:d161 with SMTP id 38308e7fff4ca-2fae10246d9mr14374171fa.4.1727854954992; Wed, 02 Oct 2024 00:42:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqUZe9vkYf2yUjyzxRVEGFA3EtJkG44WwAR+JozUKmhkJCp8JXCYpdUVGwOpDgV1WLStLDNAYLvZCF8lSWS9g= X-Received: by 2002:a2e:a99d:0:b0:2fa:c49b:d161 with SMTP id 38308e7fff4ca-2fae10246d9mr14374031fa.4.1727854954573; Wed, 02 Oct 2024 00:42:34 -0700 (PDT) MIME-Version: 1.0 References: <20241001181150.43506-1-arkadiuszx.kusztal@intel.com> <20241001181150.43506-2-arkadiuszx.kusztal@intel.com> In-Reply-To: <20241001181150.43506-2-arkadiuszx.kusztal@intel.com> From: David Marchand Date: Wed, 2 Oct 2024 09:42:22 +0200 Message-ID: Subject: Re: [PATCH v2 1/3] net: add thread-safe crc api To: Arkadiusz Kusztal Cc: dev@dpdk.org, ferruh.yigit@amd.com, kai.ji@intel.com, brian.dooley@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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Oct 1, 2024 at 9:27=E2=80=AFPM Arkadiusz Kusztal wrote: > > The current net CRC API is not thread-safe, this patch > solves this by adding another, thread-safe API functions. > This API is also safe to use across multiple processes, > yet with limitations on max-simd-bitwidth, which will be checked only by > the process that created the CRC context; all other processes will use > the same CRC function when used with the same CRC context. > It is an undefined behavior when process binaries are compiled > with different SIMD capabilities when the same CRC context is used. > > Signed-off-by: Arkadiusz Kusztal I am lost... do you mean thread-safe ? or DPDK multi process safe? For now, I don't see why we need a new API (and especially why we should break the existing one..). > --- > lib/net/net_crc.h | 19 ++-- > lib/net/rte_net_crc.c | 309 +++++++++++++++-----------------------------= ------ > lib/net/rte_net_crc.h | 40 ++----- > lib/net/version.map | 18 ++- > 4 files changed, 124 insertions(+), 262 deletions(-) > > diff --git a/lib/net/net_crc.h b/lib/net/net_crc.h > index 7a74d5406c..d220200685 100644 > --- a/lib/net/net_crc.h > +++ b/lib/net/net_crc.h > @@ -5,40 +5,41 @@ > #ifndef _NET_CRC_H_ > #define _NET_CRC_H_ > > -/* > - * Different implementations of CRC > - */ > - > -/* SSE4.2 */ > +#include > > +__rte_internal > void > rte_net_crc_sse42_init(void); > > +__rte_internal > uint32_t > rte_crc16_ccitt_sse42_handler(const uint8_t *data, uint32_t data_len); > > +__rte_internal > uint32_t > rte_crc32_eth_sse42_handler(const uint8_t *data, uint32_t data_len); > > -/* AVX512 */ > - > +__rte_internal > void > rte_net_crc_avx512_init(void); > > +__rte_internal > uint32_t > rte_crc16_ccitt_avx512_handler(const uint8_t *data, uint32_t data_len); > > +__rte_internal > uint32_t > rte_crc32_eth_avx512_handler(const uint8_t *data, uint32_t data_len); > > -/* NEON */ > - > +__rte_internal > void > rte_net_crc_neon_init(void); > > +__rte_internal > uint32_t > rte_crc16_ccitt_neon_handler(const uint8_t *data, uint32_t data_len); > > +__rte_internal > uint32_t > rte_crc32_eth_neon_handler(const uint8_t *data, uint32_t data_len); Exporting internals but not using them out of the library makes no sense. --=20 David Marchand