* mbuf performance optimization
@ 2022-12-03 17:13 3% Morten Brørup
0 siblings, 0 replies; 200+ results
From: Morten Brørup @ 2022-12-03 17:13 UTC (permalink / raw)
To: olivier.matz, Shijith Thotton, thomas, andrew.rybchenko,
honnappa.nagarahalli, bruce.richardson
Cc: dev
I have been playing around with the idea to make some changes to avoid using the mbuf's 2nd cache line in many common cases, which would reduce the cache pressure significantly, and thus improve performance. I would like to discuss if it is doable. (And let's just assume that ABI breakage is an acceptable tradeoff.)
Move 'tx_offload' to the 1st cache line
---------------------------------------
Under all circumstances:
We would need to move the 'tx_offload' field to the 1st cache line. This field is set by the application's packet forwarding pipeline stage, and read by the PMD TX function. In most cases, these two stages directly follow each other.
This also means that we must make room for it by moving a 64 bit field from the 1st to the 2nd cache line. It could be the 'next' or the 'pool' field, as discussed below.
The 'next' field - make it conditional
--------------------------------------
Optimization for (1) non-segmented packets:
We could avoid touching the 'next' field by making the 'next' field depend on something in the first cache line. E.g.:
- Use the 'ol_flags' field. Add a RTE_MBUF_F_MORE_SEGS flag, to be set/cleared when setting/clearing the 'next' field.
- Use the 'nb_segs' field. Set the 'nb_segs' field to a value >1 when setting the 'next' field, and set it to 1 when clearing the 'next' field.
The 'pool' field - use it less frequently
-----------------------------------------
Optimizations for (2) single-mempool TX queues and (3) single-mempool applications:
The 'pool' field seems to be only used by when a PMD frees a burst of mbufs that it has finished transmitting. Please correct me if I am wrong here.
We could introduce a sibling to RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE, with the only requirement that the mbufs come from the same mempool. When set, only the first mbuf in a burst gets its 'pool' field read, thus avoiding reading it in the remaining mbufs in the burst.
For single-mempool applications, we could introduce a global 'mbuf_pool' variable, to be used instead of the mbuf's 'pool' field, if set.
Med venlig hilsen / Kind regards,
-Morten Brørup
^ permalink raw reply [relevance 3%]
* Re: [PATCH v4 1/2] drivers: fix symbol exports when map is omitted
2022-12-02 11:09 4% ` [PATCH v4 1/2] " David Marchand
@ 2022-12-02 13:39 0% ` Aaron Conole
0 siblings, 0 replies; 200+ results
From: Aaron Conole @ 2022-12-02 13:39 UTC (permalink / raw)
To: David Marchand
Cc: dev, ferruh.yigit, stable, Luca Boccassi, Bruce Richardson,
Michael Santana, Thomas Monjalon, Abdullah Ömer Yamaç
David Marchand <david.marchand@redhat.com> writes:
> ld exports any global symbol by default if no version script is passed.
> As a consequence, the incriminated change let any public symbol leak
> out of the driver shared libraries.
>
> Hide again those symbols by providing a default map file which
> unexports any global symbol using a local: * catch-all statement.
>
> The checks are skipped for this default map file as it is intentionnally
> an empty map (see commit b67bdda86cd4 ("devtools: catch empty symbol
> maps")) and there is nothing else to check in this map.
>
> This change impacts the exported symbols, hence, bump the version in the
> ABI check to the v22.11.1 from the 22.11 LTS branch.
>
> Fixes: 7dde9c844a37 ("drivers: omit symbol map when unneeded")
> Cc: stable@dpdk.org
>
> Reported-by: Luca Boccassi <luca.boccassi@microsoft.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Tested-by: Ferruh Yigit <ferruh.yigit@amd.com>
> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Acked-by: Aaron Conole <aconole@redhat.com>
^ permalink raw reply [relevance 0%]
* [PATCH v4 1/2] drivers: fix symbol exports when map is omitted
2022-11-29 18:23 3% ` Ferruh Yigit
@ 2022-12-02 11:09 4% ` David Marchand
2022-12-02 13:39 0% ` Aaron Conole
1 sibling, 1 reply; 200+ results
From: David Marchand @ 2022-12-02 11:09 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, stable, Luca Boccassi, Bruce Richardson,
Aaron Conole, Michael Santana, Thomas Monjalon,
Abdullah Ömer Yamaç
ld exports any global symbol by default if no version script is passed.
As a consequence, the incriminated change let any public symbol leak
out of the driver shared libraries.
Hide again those symbols by providing a default map file which
unexports any global symbol using a local: * catch-all statement.
The checks are skipped for this default map file as it is intentionnally
an empty map (see commit b67bdda86cd4 ("devtools: catch empty symbol
maps")) and there is nothing else to check in this map.
This change impacts the exported symbols, hence, bump the version in the
ABI check to the v22.11.1 from the 22.11 LTS branch.
Fixes: 7dde9c844a37 ("drivers: omit symbol map when unneeded")
Cc: stable@dpdk.org
Reported-by: Luca Boccassi <luca.boccassi@microsoft.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Tested-by: Ferruh Yigit <ferruh.yigit@amd.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v3:
- updated ABI reference now that 22.11.1 is released,
Changes since v2:
- separated the Windows cleanup in next patch,
Changes since v1:
- excluded drivers/version.map from maps checked by default in
check-symbol-maps.sh,
---
.github/workflows/build.yml | 3 +-
.travis.yml | 3 +-
devtools/check-symbol-maps.sh | 2 +-
drivers/meson.build | 68 +++++++++++++++++++----------------
drivers/version.map | 3 ++
5 files changed, 45 insertions(+), 34 deletions(-)
create mode 100644 drivers/version.map
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9527ad1f8c..6bad94098e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -25,7 +25,8 @@ jobs:
MINGW: ${{ matrix.config.cross == 'mingw' }}
MINI: ${{ matrix.config.mini != '' }}
PPC64LE: ${{ matrix.config.cross == 'ppc64le' }}
- REF_GIT_TAG: v22.11
+ REF_GIT_REPO: https://dpdk.org/git/dpdk-stable
+ REF_GIT_TAG: v22.11.1
RISCV64: ${{ matrix.config.cross == 'riscv64' }}
RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }}
diff --git a/.travis.yml b/.travis.yml
index b99444620f..0936788dc7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -42,7 +42,8 @@ script: ./.ci/${TRAVIS_OS_NAME}-build.sh
env:
global:
- LIBABIGAIL_VERSION=libabigail-2.1
- - REF_GIT_TAG=v22.11
+ - REF_GIT_REPO=https://dpdk.org/git/dpdk-stable
+ - REF_GIT_TAG=v22.11.1
jobs:
include:
diff --git a/devtools/check-symbol-maps.sh b/devtools/check-symbol-maps.sh
index 0a6062de26..8c116bfa9c 100755
--- a/devtools/check-symbol-maps.sh
+++ b/devtools/check-symbol-maps.sh
@@ -8,7 +8,7 @@ cd $(dirname $0)/..
export LC_ALL=C
if [ $# = 0 ] ; then
- set -- $(find lib drivers -name '*.map')
+ set -- $(find lib drivers -name '*.map' -a ! -path drivers/version.map)
fi
ret=0
diff --git a/drivers/meson.build b/drivers/meson.build
index c4ff3ff1ba..5188302057 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -210,40 +210,46 @@ foreach subpath:subdirs
lk_deps = []
lk_args = []
- if fs.is_file(version_map)
- def_file = custom_target(lib_name + '_def',
- command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
- input: version_map,
- output: '@0@_exports.def'.format(lib_name))
-
- mingw_map = custom_target(lib_name + '_mingw',
- command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
- input: version_map,
- output: '@0@_mingw.map'.format(lib_name))
-
- lk_deps = [version_map, def_file, mingw_map]
- if is_windows
- if is_ms_linker
- lk_args = ['-Wl,/def:' + def_file.full_path()]
- if meson.version().version_compare('<0.54.0')
- lk_args += ['-Wl,/implib:drivers\\' + implib]
- endif
- else
- lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
+ if not fs.is_file(version_map)
+ version_map = '@0@/version.map'.format(meson.current_source_dir())
+ lk_deps += [version_map]
+ else
+ lk_deps += [version_map]
+ if not is_windows and developer_mode
+ # on unix systems check the output of the
+ # check-symbols.sh script, using it as a
+ # dependency of the .so build
+ lk_deps += custom_target(lib_name + '.sym_chk',
+ command: [check_symbols, version_map, '@INPUT@'],
+ capture: true,
+ input: static_lib,
+ output: lib_name + '.sym_chk')
+ endif
+ endif
+
+ def_file = custom_target(lib_name + '_def',
+ command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+ input: version_map,
+ output: '@0@_exports.def'.format(lib_name))
+
+ mingw_map = custom_target(lib_name + '_mingw',
+ command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+ input: version_map,
+ output: '@0@_mingw.map'.format(lib_name))
+
+ lk_deps += [def_file, mingw_map]
+
+ if is_windows
+ if is_ms_linker
+ lk_args = ['-Wl,/def:' + def_file.full_path()]
+ if meson.version().version_compare('<0.54.0')
+ lk_args += ['-Wl,/implib:drivers\\' + implib]
endif
else
- lk_args = ['-Wl,--version-script=' + version_map]
- if developer_mode
- # on unix systems check the output of the
- # check-symbols.sh script, using it as a
- # dependency of the .so build
- lk_deps += custom_target(lib_name + '.sym_chk',
- command: [check_symbols, version_map, '@INPUT@'],
- capture: true,
- input: static_lib,
- output: lib_name + '.sym_chk')
- endif
+ lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
endif
+ else
+ lk_args = ['-Wl,--version-script=' + version_map]
endif
shared_lib = shared_library(lib_name, sources,
diff --git a/drivers/version.map b/drivers/version.map
new file mode 100644
index 0000000000..78c3585d7c
--- /dev/null
+++ b/drivers/version.map
@@ -0,0 +1,3 @@
+DPDK_23 {
+ local: *;
+};
--
2.38.1
^ permalink raw reply [relevance 4%]
* DPDK 22.11.1 released
@ 2022-12-02 9:46 4% David Marchand
0 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-12-02 9:46 UTC (permalink / raw)
To: announce
Hi all,
Here is a new 22.11 release:
https://fast.dpdk.org/rel/dpdk-${stable_release}.tar.xz
The git tree is at:
https://dpdk.org/browse/dpdk-stable/?h=22.11
This LTS release contains one fix on the drivers ABI for the 22.11
release.
This 22.11.1 release should be used instead of the 22.11.0.
It will serve as the ABI reference for the 22.11 LTS branch and
later main releases (23.03 and 23.07).
--
David Marchand
---
VERSION | 2 +-
devtools/check-symbol-maps.sh | 2 +-
doc/guides/rel_notes/release_22_11.rst | 9 +++++++++
drivers/meson.build | 68 +++++++++++++++++++++++++++++++++++++-------------------------------
drivers/version.map | 3 +++
5 files changed, 51 insertions(+), 33 deletions(-)
David Marchand (2):
drivers: fix symbol exports when map is omitted
version: 22.11.1
^ permalink raw reply [relevance 4%]
* RE: help with pthread_t deprecation / api changes
2022-12-02 1:12 0% ` Tyler Retzlaff
@ 2022-12-02 8:03 0% ` Morten Brørup
0 siblings, 0 replies; 200+ results
From: Morten Brørup @ 2022-12-02 8:03 UTC (permalink / raw)
To: Tyler Retzlaff, dev, thomas, david.marchand, stephen, Bruce Richardson
+Bruce, FreeBSD EAL maintainer
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Friday, 2 December 2022 02.12
>
> On Wed, Nov 30, 2022 at 02:54:27PM -0800, Tyler Retzlaff wrote:
> > hi folks,
> >
> > i'd like to continue work moving to our platform abstracted
> rte_thread
> > but ran into a hiccup. for some recent and not so recent apis it
> appears
> > they managed to slip in without ever being __experimental.
> >
> > as a function of the dpdk project api/abi policy this means we can't
> > change or remove some of these functions without following the
> > deprecation process.
> >
> > the apis that are causing me immediate difficulty are
> > rte_thread_setname and rte_ctrl_thread_create.
>
> after looking in more detail at our current implementations of these
> functions i would like to backtrack a little and limit the scope of
> discussion to rte_thread_setname and rte_thread_getname.
>
> as eal functions they aren't doing a good job in abstracting the
> environment for applications, meaning an application would have to wrap
> their use in platform conditional checks.
<rant>
This is one of the consequences of a bloated EAL.
How is an application supposed to run on top of an EAL that isn't fully implemented by the underlying environments?
I have complained about this before, but am not afraid to repeat it:
I wish the EAL wasn't treated as some catch-all library where it is easy to throw in new features, which really belong in separate libraries!
</rant>
>
> current status.
>
> rte_thread_getname
> * freebsd, no implementation and it appears no possible support
> * linux, implementation conditional on __GLIBC_PREREQ(2, 12)
> * windows, can be implemented but isn't, noop success
> * fortunately is marked __rte_experimental
> * called in 1 place only from eal (logging)
>
> i would propose to present a consistent abstraction the best thing to
> do
> here is just remove rte_thread_getname. providing a version that
> requires an application to do conditional dances / compilation based on
> platform gains nothing.
My initial thought was that it should be provided for symmetry reasons.
However, thinking about it, it is probably only used for debugging, trace, and similar. It is probably not used in any meaningful way by applications. So I won't oppose to removing it.
Alternatively:
If some execution environment doesn't support thread names, it could return a string that makes it possible for a human to identify the thread, e.g. the tread id. Again, this is assuming that it is only used for debugging, trace, and similar.
>
> rte_thread_setname
> * freebsd, implemented, imposes no limit on name length, suppresses
> errors
> * linux, implementation conditional on __GLIBC_PREREQ(2, 12), imposes
> limit of 16 (including terminating NUL) on name length, may return
> an
> error
> * windows, can be implemented, no explicit limit on name length, may
> return errors
> * unfortunately not marked __rte_experimental
>
> i would propose to provide a replacement with the name
> rte_thread_set_name with more consistent behavior across the 3
> platforms.
>
> * returns errors for platforms that return errors, but the caller
> is free to ignore them.
> * explicit limit of 16 (including terminating NUL) on name length,
> names that are provided that exceed the limit are truncated without
> error.
The function should not silently modify the provided data (i.e. truncate the name). I would prefer doing both: Return ERANGE (like pthread_setname_np()), but use the truncated name anyway. Then the application can choose to ignore or deal with the return code.
^ permalink raw reply [relevance 0%]
* Re: help with pthread_t deprecation / api changes
2022-11-30 22:54 4% help with pthread_t deprecation / api changes Tyler Retzlaff
@ 2022-12-02 1:12 0% ` Tyler Retzlaff
2022-12-02 8:03 0% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Tyler Retzlaff @ 2022-12-02 1:12 UTC (permalink / raw)
To: dev, thomas, david.marchand, mb, stephen
On Wed, Nov 30, 2022 at 02:54:27PM -0800, Tyler Retzlaff wrote:
> hi folks,
>
> i'd like to continue work moving to our platform abstracted rte_thread
> but ran into a hiccup. for some recent and not so recent apis it appears
> they managed to slip in without ever being __experimental.
>
> as a function of the dpdk project api/abi policy this means we can't
> change or remove some of these functions without following the
> deprecation process.
>
> the apis that are causing me immediate difficulty are
> rte_thread_setname and rte_ctrl_thread_create.
after looking in more detail at our current implementations of these
functions i would like to backtrack a little and limit the scope of
discussion to rte_thread_setname and rte_thread_getname.
as eal functions they aren't doing a good job in abstracting the
environment for applications, meaning an application would have to wrap
their use in platform conditional checks.
current status.
rte_thread_getname
* freebsd, no implementation and it appears no possible support
* linux, implementation conditional on __GLIBC_PREREQ(2, 12)
* windows, can be implemented but isn't, noop success
* fortunately is marked __rte_experimental
* called in 1 place only from eal (logging)
i would propose to present a consistent abstraction the best thing to do
here is just remove rte_thread_getname. providing a version that
requires an application to do conditional dances / compilation based on
platform gains nothing.
rte_thread_setname
* freebsd, implemented, imposes no limit on name length, suppresses errors
* linux, implementation conditional on __GLIBC_PREREQ(2, 12), imposes
limit of 16 (including terminating NUL) on name length, may return an
error
* windows, can be implemented, no explicit limit on name length, may
return errors
* unfortunately not marked __rte_experimental
i would propose to provide a replacement with the name
rte_thread_set_name with more consistent behavior across the 3 platforms.
* returns errors for platforms that return errors, but the caller
is free to ignore them.
* explicit limit of 16 (including terminating NUL) on name length,
names that are provided that exceed the limit are truncated without
error.
your feedback would be appreciated.
thanks
> i think the least painful path forward to deprecating and removing these
> apis is probably just to introduce the replacements with new names.
>
> 1. introduce functions with the following names marked as
> __experimental.
>
> rte_control_thread_create(rte_thread_t *, ...)
> rte_thread_set_name(rte_thread_t, ...)
> rte_thread_get_name(rte_thread_t, ...)
>
> along with the new functions, new unit tests will be included.
>
> 2. update dpdk internal implementation to use the new functions.
>
> 3. immediately remove the following functions from the public headers
> and issue an api deprecation notice for the functions not marked
> experimental.
>
> rte_ctrl_thread_create(pthread_t *, ...)
> rte_thread_setname(pthread_t *, ...)
>
> 4. when the new functions have their __experimental marking removed
> issue an abi deprecation notice for the functions from (2).
>
> i'm open to feedback/suggestions of a better approach if anyone has one
> to offer.
>
> thanks!
^ permalink raw reply [relevance 0%]
* DPDK Release Status Meeting 2022-12-01
@ 2022-12-01 19:01 3% Mcnamara, John
0 siblings, 0 replies; 200+ results
From: Mcnamara, John @ 2022-12-01 19:01 UTC (permalink / raw)
To: dev; +Cc: thomas, david.marchand
[-- Attachment #1: Type: text/plain, Size: 2871 bytes --]
Release status meeting minutes 2022-12-01
=========================================
Agenda:
* Release Dates
* Subtrees
* Roadmaps
* LTS
* Defects
* Opens
Participants:
* ARM [No]
* Canonical [No]
* Debian/Microsoft
* Intel
* Marvell [No]
* Nvidia
* Red Hat
* Xilinx/AMD
Release Dates
-------------
The following are the proposed current dates for 23.03:
* V1: 25 December 2022
* RC1: 8 February 2023
* RC2: 1 March 2023
* RC3: 8 March 2023
* Release: 20 March 2023
Subtrees
--------
* next-net
* No update.
* next-net-intel
* No update.
* next-net-mlx
* No update.
* next-net-mvl
* No update.
* next-eventdev
* No update.
* next-virtio
* No update.
* next-crypto
* No update.
* main
* 22.11 released.
* We are looking for a new shared maintainer for next-net
* There is an ABI breakage issue
* Will be fixed in release 22.11.1 on stable.
* Call for roadmaps for 23.03
Proposed Schedule for 2023
--------------------------
See also http://core.dpdk.org/roadmap/#dates
23.03
* Proposal deadline (RFC/v1 patches): 25 December 2022
* API freeze (-rc1): 8 February 2023
* PMD features freeze (-rc2): 1 March 2023
* Builtin applications features freeze (-rc3): 8 March 2023
* Release: 20 March 2023
23.07
* Proposal deadline (RFC/v1 patches): 15 April 2023
* API freeze (-rc1): 31 May 2023
* PMD features freeze (-rc2): 21 June 2023
* Builtin applications features freeze (-rc3): 28 June 2023
* Release: 12 July 2023
23.11
* Proposal deadline (RFC/v1 patches): 12 August 2023
* API freeze (-rc1): 29 September 2023
* PMD features freeze (-rc2): 20 October 2023
* Builtin applications features freeze (-rc3): 27 October 2023
* Release: 15 November 2023
LTS
---
Next releases will be:
* 21.11.3
* Backport patches have been sent.
* Merging of 22.11 patches in progress.
* 20.11.7
* Backport patches have been sent.
* Merging of 22.11 patches in progress.
* 19.11.14
* Backport patches have been sent.
* Merging of 22.11 patches in progress.
* Distros
* v20.11 in Debian 11
* Ubuntu 22.04 contains 21.11
Defects
-------
* Bugzilla links, 'Bugs', added for hosted projects
* https://www.dpdk.org/hosted-projects/
DPDK Release Status Meetings
----------------------------
The DPDK Release Status Meeting is intended for DPDK Committers to discuss the
status of the master tree and sub-trees, and for project managers to track
progress or milestone dates.
The meeting occurs on every Thursday at 9:30 UTC over Jitsi on https://meet.jit.si/DPDK
You don't need an invite to join the meeting but if you want a calendar reminder just
send an email to "John McNamara john.mcnamara@intel.com" for the invite.
[-- Attachment #2: Type: text/html, Size: 15674 bytes --]
^ permalink raw reply [relevance 3%]
* Re: [PATCH] version: 23.03-rc0
2022-12-01 15:37 0% ` Thomas Monjalon
@ 2022-12-01 15:50 0% ` David Marchand
0 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-12-01 15:50 UTC (permalink / raw)
To: dev; +Cc: Thomas Monjalon
On Thu, Dec 1, 2022 at 4:37 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 28/11/2022 09:33, David Marchand:
> > Start a new release cycle with empty release notes.
> > Bump version and ABI minor.
> > libabigail 2.0 had some issues that have been fixed in 2.1, let's bump
> > to this version and enable ABI checks.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
Applied.
Here we go with a new release.
The proposed dates for the main milestones are:
Proposal deadline (RFC/v1 patches): 25 December 2022
API freeze (-rc1): 8 February 2023
PMD features freeze (-rc2): 1 March 2023
Builtin applications features freeze (-rc3): 8 March 2023
Release: 20 March 2023
Don't forget to send your roadmaps!
--
David Marchand
^ permalink raw reply [relevance 0%]
* Re: [PATCH] version: 23.03-rc0
2022-11-28 8:33 11% [PATCH] version: 23.03-rc0 David Marchand
@ 2022-12-01 15:37 0% ` Thomas Monjalon
2022-12-01 15:50 0% ` David Marchand
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2022-12-01 15:37 UTC (permalink / raw)
To: David Marchand; +Cc: dev, ci
28/11/2022 09:33, David Marchand:
> Start a new release cycle with empty release notes.
> Bump version and ABI minor.
> libabigail 2.0 had some issues that have been fixed in 2.1, let's bump
> to this version and enable ABI checks.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
^ permalink raw reply [relevance 0%]
* help with pthread_t deprecation / api changes
@ 2022-11-30 22:54 4% Tyler Retzlaff
2022-12-02 1:12 0% ` Tyler Retzlaff
0 siblings, 1 reply; 200+ results
From: Tyler Retzlaff @ 2022-11-30 22:54 UTC (permalink / raw)
To: dev; +Cc: thomas
hi folks,
i'd like to continue work moving to our platform abstracted rte_thread
but ran into a hiccup. for some recent and not so recent apis it appears
they managed to slip in without ever being __experimental.
as a function of the dpdk project api/abi policy this means we can't
change or remove some of these functions without following the
deprecation process.
the apis that are causing me immediate difficulty are
rte_thread_setname and rte_ctrl_thread_create.
i think the least painful path forward to deprecating and removing these
apis is probably just to introduce the replacements with new names.
1. introduce functions with the following names marked as
__experimental.
rte_control_thread_create(rte_thread_t *, ...)
rte_thread_set_name(rte_thread_t, ...)
rte_thread_get_name(rte_thread_t, ...)
along with the new functions, new unit tests will be included.
2. update dpdk internal implementation to use the new functions.
3. immediately remove the following functions from the public headers
and issue an api deprecation notice for the functions not marked
experimental.
rte_ctrl_thread_create(pthread_t *, ...)
rte_thread_setname(pthread_t *, ...)
4. when the new functions have their __experimental marking removed
issue an abi deprecation notice for the functions from (2).
i'm open to feedback/suggestions of a better approach if anyone has one
to offer.
thanks!
^ permalink raw reply [relevance 4%]
* Re: [PATCH] drivers: fix symbol exports when map is omitted
2022-11-30 8:27 0% ` David Marchand
@ 2022-11-30 9:19 0% ` Ferruh Yigit
0 siblings, 0 replies; 200+ results
From: Ferruh Yigit @ 2022-11-30 9:19 UTC (permalink / raw)
To: David Marchand, Thomas Monjalon
Cc: dev, stable, Luca Boccassi, Bruce Richardson,
Abdullah Ömer Yamaç
On 11/30/2022 8:27 AM, David Marchand wrote:
> On Wed, Nov 30, 2022 at 8:13 AM David Marchand
> <david.marchand@redhat.com> wrote:
>>> I assume this will cause warnings for ABI check scripts, how can we
>>> prevent the warnings?
>>
>> Indeed.
>>
>> Some options:
>> - add exhaustive suppression rules in devtools/libabigail.abignore,
>> - retag the v22.11 release with this fix, but we already announced it
>> and people started downloading the tarball,
>> - release a .1 version and compare ABI against it (either in the main
>> repo, or in the 22.11 stable branch, through for the ABI check in GHA,
>> it would be simpler to have the tag in the main repo..),
>
> (let's forget about my concern on GHA, we have the REF_GIT_REPO param,
> so we can point at the dpdk-stable repo, and go with a "normal"
> release in 22.11 stable branch)
>
OK to have v22.11.1 stable release with this fix.
^ permalink raw reply [relevance 0%]
* Re: [PATCH] drivers: fix symbol exports when map is omitted
2022-11-30 7:13 4% ` David Marchand
@ 2022-11-30 8:27 0% ` David Marchand
2022-11-30 9:19 0% ` Ferruh Yigit
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-11-30 8:27 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon
Cc: dev, stable, Luca Boccassi, Bruce Richardson,
Abdullah Ömer Yamaç
On Wed, Nov 30, 2022 at 8:13 AM David Marchand
<david.marchand@redhat.com> wrote:
> > I assume this will cause warnings for ABI check scripts, how can we
> > prevent the warnings?
>
> Indeed.
>
> Some options:
> - add exhaustive suppression rules in devtools/libabigail.abignore,
> - retag the v22.11 release with this fix, but we already announced it
> and people started downloading the tarball,
> - release a .1 version and compare ABI against it (either in the main
> repo, or in the 22.11 stable branch, through for the ABI check in GHA,
> it would be simpler to have the tag in the main repo..),
(let's forget about my concern on GHA, we have the REF_GIT_REPO param,
so we can point at the dpdk-stable repo, and go with a "normal"
release in 22.11 stable branch)
>
> Do you have other ideas?
>
--
David Marchand
^ permalink raw reply [relevance 0%]
* Re: [PATCH] drivers: fix symbol exports when map is omitted
2022-11-29 18:23 3% ` Ferruh Yigit
@ 2022-11-30 7:13 4% ` David Marchand
2022-11-30 8:27 0% ` David Marchand
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-11-30 7:13 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon
Cc: dev, stable, Luca Boccassi, Bruce Richardson,
Abdullah Ömer Yamaç
On Tue, Nov 29, 2022 at 7:23 PM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>
> On 11/29/2022 2:00 PM, David Marchand wrote:
> > ld exports any global symbol by default if no version script is passed.
> > As a consequence, the incriminated change let any public symbol leak
> > out of the driver shared libraries.
> >
> > Hide again those symbols by providing a default map file which
> > unexports any global symbol using a local: * catchall statement.
> >
>
> I assume this will cause warnings for ABI check scripts, how can we
> prevent the warnings?
Indeed.
Some options:
- add exhaustive suppression rules in devtools/libabigail.abignore,
- retag the v22.11 release with this fix, but we already announced it
and people started downloading the tarball,
- release a .1 version and compare ABI against it (either in the main
repo, or in the 22.11 stable branch, through for the ABI check in GHA,
it would be simpler to have the tag in the main repo..),
Do you have other ideas?
>
> > The check on symbols is skipped for this default map file as it is
> > intentionnally an empty map (see commit b67bdda86cd4 ("devtools: catch
> > empty symbol maps")) and there is nothing to check in it.
> >
>
> How it is skipped, './devtools/check-symbol-maps.sh' still complains
> about 'drivers/version.map' for me.
I had considered the call check-symbols.sh during build.
But it is true that if you call check-symbol-maps.sh alone, we will
get a warning.
I will exclude it in v2.
>
> > While at it, move Windows specific objects where needed for better
> > readability.
> >
>
> +1
>
> > Fixes: 7dde9c844a37 ("drivers: omit symbol map when unneeded")
> > Cc: stable@dpdk.org
> >
> > Reported-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
>
>
> Not tested on Windows, but for Linux:
> Tested-by: Ferruh Yigit <ferruh.yigit@amd.com>
UNH Windows tests look fine.
--
David Marchand
^ permalink raw reply [relevance 4%]
* Re: [PATCH] drivers: fix symbol exports when map is omitted
@ 2022-11-29 18:23 3% ` Ferruh Yigit
2022-11-30 7:13 4% ` David Marchand
2022-12-02 11:09 4% ` [PATCH v4 1/2] " David Marchand
1 sibling, 1 reply; 200+ results
From: Ferruh Yigit @ 2022-11-29 18:23 UTC (permalink / raw)
To: David Marchand, dev
Cc: stable, Luca Boccassi, Bruce Richardson, Abdullah Ömer Yamaç
On 11/29/2022 2:00 PM, David Marchand wrote:
> ld exports any global symbol by default if no version script is passed.
> As a consequence, the incriminated change let any public symbol leak
> out of the driver shared libraries.
>
> Hide again those symbols by providing a default map file which
> unexports any global symbol using a local: * catchall statement.
>
I assume this will cause warnings for ABI check scripts, how can we
prevent the warnings?
> The check on symbols is skipped for this default map file as it is
> intentionnally an empty map (see commit b67bdda86cd4 ("devtools: catch
> empty symbol maps")) and there is nothing to check in it.
>
How it is skipped, './devtools/check-symbol-maps.sh' still complains
about 'drivers/version.map' for me.
> While at it, move Windows specific objects where needed for better
> readability.
>
+1
> Fixes: 7dde9c844a37 ("drivers: omit symbol map when unneeded")
> Cc: stable@dpdk.org
>
> Reported-by: Luca Boccassi <luca.boccassi@microsoft.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Not tested on Windows, but for Linux:
Tested-by: Ferruh Yigit <ferruh.yigit@amd.com>
^ permalink raw reply [relevance 3%]
* [PATCH] version: 23.03-rc0
@ 2022-11-28 8:33 11% David Marchand
2022-12-01 15:37 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-11-28 8:33 UTC (permalink / raw)
To: dev; +Cc: thomas, ci
Start a new release cycle with empty release notes.
Bump version and ABI minor.
libabigail 2.0 had some issues that have been fixed in 2.1, let's bump
to this version and enable ABI checks.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
For CI guys: it is time to enable ABI checks again.
---
.github/workflows/build.yml | 6 +-
.travis.yml | 23 ++++-
ABI_VERSION | 2 +-
VERSION | 2 +-
doc/guides/rel_notes/index.rst | 1 +
doc/guides/rel_notes/release_23_03.rst | 138 +++++++++++++++++++++++++
6 files changed, 165 insertions(+), 7 deletions(-)
create mode 100644 doc/guides/rel_notes/release_23_03.rst
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 82d83f4030..9527ad1f8c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -21,11 +21,11 @@ jobs:
BUILD_DOCS: ${{ contains(matrix.config.checks, 'doc') }}
CC: ccache ${{ matrix.config.compiler }}
DEF_LIB: ${{ matrix.config.library }}
- LIBABIGAIL_VERSION: libabigail-1.8
+ LIBABIGAIL_VERSION: libabigail-2.1
MINGW: ${{ matrix.config.cross == 'mingw' }}
MINI: ${{ matrix.config.mini != '' }}
PPC64LE: ${{ matrix.config.cross == 'ppc64le' }}
- REF_GIT_TAG: none
+ REF_GIT_TAG: v22.11
RISCV64: ${{ matrix.config.cross == 'riscv64' }}
RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }}
@@ -38,7 +38,7 @@ jobs:
mini: mini
- os: ubuntu-20.04
compiler: gcc
- checks: doc+tests
+ checks: abi+doc+tests
- os: ubuntu-20.04
compiler: clang
checks: asan+doc+tests
diff --git a/.travis.yml b/.travis.yml
index 4bb5bf629e..b99444620f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,8 +41,8 @@ script: ./.ci/${TRAVIS_OS_NAME}-build.sh
env:
global:
- - LIBABIGAIL_VERSION=libabigail-1.8
- - REF_GIT_TAG=none
+ - LIBABIGAIL_VERSION=libabigail-2.1
+ - REF_GIT_TAG=v22.11
jobs:
include:
@@ -61,6 +61,14 @@ jobs:
packages:
- *required_packages
- *doc_packages
+ - env: DEF_LIB="shared" ABI_CHECKS=true
+ arch: amd64
+ compiler: gcc
+ addons:
+ apt:
+ packages:
+ - *required_packages
+ - *libabigail_build_packages
# x86_64 clang jobs
- env: DEF_LIB="static"
arch: amd64
@@ -137,6 +145,17 @@ jobs:
packages:
- *required_packages
- *doc_packages
+ - env: DEF_LIB="shared" ABI_CHECKS=true
+ dist: focal
+ arch: arm64-graviton2
+ virt: vm
+ group: edge
+ compiler: gcc
+ addons:
+ apt:
+ packages:
+ - *required_packages
+ - *libabigail_build_packages
# aarch64 clang jobs
- env: DEF_LIB="static"
dist: focal
diff --git a/ABI_VERSION b/ABI_VERSION
index 919c868b57..a12b18e437 100644
--- a/ABI_VERSION
+++ b/ABI_VERSION
@@ -1 +1 @@
-23.0
+23.1
diff --git a/VERSION b/VERSION
index 7af24b7ddb..61240e02c2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-22.11.0
+23.03.0-rc0
diff --git a/doc/guides/rel_notes/index.rst b/doc/guides/rel_notes/index.rst
index f6782b91db..57475a8158 100644
--- a/doc/guides/rel_notes/index.rst
+++ b/doc/guides/rel_notes/index.rst
@@ -8,6 +8,7 @@ Release Notes
:maxdepth: 1
:numbered:
+ release_23_03
release_22_11
release_22_07
release_22_03
diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
new file mode 100644
index 0000000000..b8c5b68d6c
--- /dev/null
+++ b/doc/guides/rel_notes/release_23_03.rst
@@ -0,0 +1,138 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright 2022 The DPDK contributors
+
+.. include:: <isonum.txt>
+
+DPDK Release 23.03
+==================
+
+.. **Read this first.**
+
+ The text in the sections below explains how to update the release notes.
+
+ Use proper spelling, capitalization and punctuation in all sections.
+
+ Variable and config names should be quoted as fixed width text:
+ ``LIKE_THIS``.
+
+ Build the docs and view the output file to ensure the changes are correct::
+
+ ninja -C build doc
+ xdg-open build/doc/guides/html/rel_notes/release_23_03.html
+
+
+New Features
+------------
+
+.. This section should contain new features added in this release.
+ Sample format:
+
+ * **Add a title in the past tense with a full stop.**
+
+ Add a short 1-2 sentence description in the past tense.
+ The description should be enough to allow someone scanning
+ the release notes to understand the new feature.
+
+ If the feature adds a lot of sub-features you can use a bullet list
+ like this:
+
+ * Added feature foo to do something.
+ * Enhanced feature bar to do something else.
+
+ Refer to the previous release notes for examples.
+
+ Suggested order in release notes items:
+ * Core libs (EAL, mempool, ring, mbuf, buses)
+ * Device abstraction libs and PMDs (ordered alphabetically by vendor name)
+ - ethdev (lib, PMDs)
+ - cryptodev (lib, PMDs)
+ - eventdev (lib, PMDs)
+ - etc
+ * Other libs
+ * Apps, Examples, Tools (if significant)
+
+ This section is a comment. Do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =======================================================
+
+
+Removed Items
+-------------
+
+.. This section should contain removed items in this release. Sample format:
+
+ * Add a short 1-2 sentence description of the removed item
+ in the past tense.
+
+ This section is a comment. Do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =======================================================
+
+
+API Changes
+-----------
+
+.. This section should contain API changes. Sample format:
+
+ * sample: Add a short 1-2 sentence description of the API change
+ which was announced in the previous releases and made in this release.
+ Start with a scope label like "ethdev:".
+ Use fixed width quotes for ``function_names`` or ``struct_names``.
+ Use the past tense.
+
+ This section is a comment. Do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =======================================================
+
+
+ABI Changes
+-----------
+
+.. This section should contain ABI changes. Sample format:
+
+ * sample: Add a short 1-2 sentence description of the ABI change
+ which was announced in the previous releases and made in this release.
+ Start with a scope label like "ethdev:".
+ Use fixed width quotes for ``function_names`` or ``struct_names``.
+ Use the past tense.
+
+ This section is a comment. Do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =======================================================
+
+* No ABI change that would break compatibility with 22.11.
+
+
+Known Issues
+------------
+
+.. This section should contain new known issues in this release. Sample format:
+
+ * **Add title in present tense with full stop.**
+
+ Add a short 1-2 sentence description of the known issue
+ in the present tense. Add information on any known workarounds.
+
+ This section is a comment. Do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =======================================================
+
+
+Tested Platforms
+----------------
+
+.. This section should contain a list of platforms that were tested
+ with this release.
+
+ The format is:
+
+ * <vendor> platform with <vendor> <type of devices> combinations
+
+ * List of CPU
+ * List of OS
+ * List of devices
+ * Other relevant details...
+
+ This section is a comment. Do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =======================================================
--
2.38.1
^ permalink raw reply [relevance 11%]
* DPDK 22.11 released
@ 2022-11-27 22:22 4% Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2022-11-27 22:22 UTC (permalink / raw)
To: announce
A new major release is available:
https://fast.dpdk.org/rel/dpdk-22.11.tar.xz
It was a comfortable release cycle:
1387 commits from 193 authors
1902 files changed, 137224 insertions(+), 61256 deletions(-)
The branch 22.11 should be supported for at least two years, maybe more,
making it recommended for system integration and deployment.
The new major ABI version is 23.
The next releases 23.03 and 23.07 will be ABI-compatible with 22.11.
Below are some new features:
- LoongArch build
- Intel uncore frequency control
- mempool optimizations
- new mbuf layout for IOVA-as-VA build
- multiple mbuf pools per Rx queue
- Rx buffer split based on protocol
- hardware congestion management
- hairpin memory configuration
- proactive NIC error handling
- Rx/Tx descriptor dump
- flow API extensions
- GVE (Google Virtual Ethernet)
- IDPF (Intel Infrastructure DataPath Function)
- UADK supporting HiSilicon crypto
- MACsec processing offload
- ShangMi crypto algorithms
- baseband FFT operations
- eventdev Tx queue start/stop
- eventdev crypto vectorization
- NitroSketch membership
- DTS introduction in DPDK repository
More details in the release notes:
https://doc.dpdk.org/guides/rel_notes/release_22_11.html
There are 74 new contributors (including authors, reviewers and testers).
Welcome to Abdullah Sevincer, Abhishek Maheshwari, Alan Liu,
Aleksandr Miloshenko, Alex Vesker, Alexander Chernavin, Allen Hubbe,
Amit Prakash Shukla, Anatolii Gerasymenko, Arkadiusz Kubalewski,
Arshdeep Kaur, Benjamin Le Berre, Bhagyada Modali, David MacDougal,
Dawid Zielinski, Dexia Li, Dukai Yuan, Erez Shitrit, Fei Qin, Frank Du,
Gal Shalom, Grzegorz Siwik, Hamdan Igbaria, Hamza Khan, Henning Schild,
Huang Wei, Huzaifa Rahman, James Hershaw, Jeremy Spewock, Jin Ling,
Joey Xing, Jun Qiu, Kaiwen Deng, Karen Sornek, Ke Xu, Kevin O'Sullivan,
Lei Cai, Lei Ji, Leszek Zygo, Long Wu, Lukasz Czapnik, Lukasz Kupczak,
Mah Yock Gen, Mandal Purna Chandra, Mao YingMing, Marcin Szycik,
Michael Savisko, Min Zhou, Mingjin Ye, Mingshan Zhang, Mário Kuka,
Piotr Gardocki, Qingmin Liu, R Mohamed Shah, Roman Storozhenko,
Sathesh Edara, Sergey Temerkhanov, Shiqi Liu, Stephen Coleman,
Steven Zou, Sunil Uttarwar, Sunyang Wu, Sylvia Grundwürmer,
Tadhg Kearney, Taekyung Kim, Taripin Samuel, Tomasz Jonak,
Tomasz Zawadzki, Tsotne Chakhvadze, Usman Tanveer, Wiktor Pilarczyk,
Yaqi Tang, Yi Li and Zhangfei Gao.
Below is the number of commits per employer (with authors count):
456 Intel (65)
227 Marvell (29)
179 NVIDIA (28)
83 Corigine (6)
81 Red Hat (5)
60 Huawei (6)
58 AMD (5)
55 Microsoft (4)
53 OKTET Labs (2)
19 NXP (5)
14 Ericsson (1)
13 6WIND (2)
...
A big thank to all courageous people who took on the non rewarding task
of reviewing other's job.
Based on Reviewed-by and Acked-by tags, the top non-PMD reviewers are:
53 Akhil Goyal <gakhil@marvell.com>
45 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
36 Morten Brørup <mb@smartsharesystems.com>
34 Niklas Söderlund <niklas.soderlund@corigine.com>
34 Bruce Richardson <bruce.richardson@intel.com>
33 David Marchand <david.marchand@redhat.com>
31 Ori Kam <orika@nvidia.com>
25 Maxime Coquelin <maxime.coquelin@redhat.com>
21 Jerin Jacob <jerinj@marvell.com>
20 Chengwen Feng <fengchengwen@huawei.com>
The next version will be 23.03 in March.
The new features for 23.03 can be submitted during the next 4 weeks:
http://core.dpdk.org/roadmap#dates
Please share your roadmap.
Thanks everyone
^ permalink raw reply [relevance 4%]
* [PATCH v1] doc: update release notes for 22.11
@ 2022-11-24 16:56 3% John McNamara
0 siblings, 0 replies; 200+ results
From: John McNamara @ 2022-11-24 16:56 UTC (permalink / raw)
To: dev; +Cc: thomas, John McNamara
Fix grammar, spelling and formatting of DPDK 22.11 release notes.
Signed-off-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_22_11.rst | 92 +++++++++++++-------------
1 file changed, 46 insertions(+), 46 deletions(-)
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index f427deab31..99e1b06d08 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -58,34 +58,34 @@ New Features
* **Added initial LoongArch architecture support.**
Added EAL implementation for LoongArch architecture.
- The initial devices the porting was tested on included Loongson 3A5000,
+ The initial port was tested on Loongson 3A5000,
Loongson 3C5000 and Loongson 3C5000L.
In theory this implementation should work with any target based on
``LoongArch`` ISA.
* **Added support for multiple mbuf pools per ethdev Rx queue.**
- The capability allows application to provide many mempools
- of different size, and PMD and/or NIC to choose a memory pool
- based on the packet's length and/or Rx buffers availability.
+ Added a capability which allows an application to provide many mempools
+ of different size, and PMDs and/or NICs to choose a memory pool
+ based on the packet's length and/or Rx buffer availability.
* **Added support for congestion management in ethdev.**
Added new API functions ``rte_eth_cman_config_init()``,
- ``rte_eth_cman_config_get()``, ``rte_eth_cman_config_set()``,
- ``rte_eth_cman_info_get()`` to support congestion management.
+ ``rte_eth_cman_config_get()``, ``rte_eth_cman_config_set()``
+ and ``rte_eth_cman_info_get()`` to support congestion management.
* **Added protocol header based buffer split.**
* Added ``rte_eth_buffer_split_get_supported_hdr_ptypes()`` to get supported
header protocols to split at.
- * Supported protocol-based buffer split using added ``proto_hdr``
- in structure ``rte_eth_rxseg_split``.
+ * Added support for protocol-based buffer split using new ``proto_hdr``
+ field in structure ``rte_eth_rxseg_split``.
* **Added proactive error handling mode for ethdev.**
Added proactive error handling mode for ethdev,
- and three events were introduced: ``RTE_ETH_EVENT_ERR_RECOVERING``
+ and introduced three new events: ``RTE_ETH_EVENT_ERR_RECOVERING``
to report that the port is recovering from an error,
``RTE_ETH_EVENT_RECOVER_SUCCESS`` and ``RTE_ETH_EVENT_RECOVER_FAILED``.
@@ -118,32 +118,32 @@ New Features
Added connection tracking action number hint to ``rte_flow_configure``
and ``rte_flow_info_get``.
- PMD can prepare the connection tracking resources according to the hint.
+ The PMD can prepare the connection tracking resources according to the hint.
* **Added support for queue-based async query in flow API.**
- Added new function ``rte_flow_async_action_handle_query()``,
+ Added new function ``rte_flow_async_action_handle_query()``
to query the action asynchronously.
* **Extended metering and marking support in the flow API.**
- * Added METER_COLOR item to match color marker set by a meter.
+ * Added ``METER_COLOR`` item to match color marker set by a meter.
* Added ability to set color marker via modify field flow API.
- * Added meter API to get a pointer to profile/policy by their ID.
- * Added METER_MARK action for metering with lockless profile/policy access.
+ * Added meter API to get a pointer to the profile/policy by their ID.
+ * Added ``METER_MARK`` action for metering with lockless profile/policy access.
* **Added flow offload action to route packets to kernel.**
- Added new flow action which allows application to re-route packets
+ Added new flow action which allows an application to re-route packets
directly to the kernel without software involvement.
* **Updated AF_XDP driver.**
- * Made compatible with libbpf v0.8.0 (when used with libxdp).
+ * Updated AF_XDP driver to make it compatible with libbpf v0.8.0 (when used with libxdp).
* **Updated AMD Pensando ionic driver.**
- * Updated to reflect that Pensando has been acquired by AMD.
+ * Updated ionic driver to reflect that Pensando has been acquired by AMD.
* Enhanced data path to provide substantial performance improvements.
* Added support for mbuf fast free.
* Added support for advertising packet types.
@@ -151,7 +151,7 @@ New Features
* Added Q-in-CMB feature controlled by device option ``ionic_cmb``.
* Added optimized handlers for non-scattered Rx and Tx.
-* **Added GVE net PMD**
+* **Added GVE net PMD.**
* Added the new ``gve`` net driver for Google Virtual Ethernet devices.
* See the :doc:`../nics/gve` NIC guide for more details on this new driver.
@@ -172,25 +172,25 @@ New Features
* **Updated Marvell cnxk driver.**
- * Added support for flow action REPRESENTED_PORT.
+ * Added support for flow action ``REPRESENTED_PORT``.
* Added support for congestion management.
* **Added Microsoft mana driver.**
- Disabled by default because of missing dependency.
+ The driver has been disabled by default because of a, currently, missing dependency.
* **Updated Netronome nfp driver.**
Added flow API support:
- * Added the support of flower firmware.
+ * Added support for the flower firmware.
* Added the flower service infrastructure.
* Added the control message interactive channels between PMD and firmware.
- * Added the support of representor port.
+ * Added support for a representor port.
* **Updated NVIDIA mlx5 driver.**
- * Added full support for queue-based async HW steering.
+ * Added full support for queue-based async hardware steering.
- Support of FDB.
- Support of control flow and isolate mode.
@@ -202,7 +202,7 @@ New Features
* **Updated NXP dpaa2 driver.**
- * Added support for flow action REPRESENTED_PORT.
+ * Added support for flow action ``REPRESENTED_PORT``.
* **Updated Wangxun ngbe driver.**
@@ -216,8 +216,8 @@ New Features
* **Added non-blocking notify API to vhost library.**
Added ``rte_vhost_vring_call_nonblock`` API to notify the guest that
- used descriptors have been added to the vring in non-blocking way.
- User should check the return value of this API and try again if needed.
+ used descriptors have been added to the vring in n aon-blocking way.
+ The user should check the return value of this API and try again if needed.
* **Added support for MACsec in rte_security.**
@@ -237,7 +237,7 @@ New Features
* **Updated Marvell cnxk crypto driver.**
- * Added AES-CCM support in lookaside protocol (IPsec) for CN9K & CN10K.
+ * Added AES-CCM support in lookaside protocol (IPsec) for CN9K and CN10K.
* Added AES & DES DOCSIS algorithm support in lookaside crypto for CN9K.
* **Updated aesni_mb crypto driver.**
@@ -259,7 +259,7 @@ New Features
* **Added bbdev operation for FFT processing.**
Added a new operation type in bbdev for FFT processing with new functions
- ``rte_bbdev_enqueue_fft_ops``, ``rte_bbdev_dequeue_fft_ops``,
+ ``rte_bbdev_enqueue_fft_ops`` and ``rte_bbdev_dequeue_fft_ops``,
and related structures.
* **Added Intel ACC200 bbdev driver.**
@@ -285,13 +285,13 @@ New Features
* **Added event crypto adapter vectorization support.**
- Added support to aggregate crypto operations processed by event crypto adapter
- into single event containing ``rte_event_vector``
+ Added support for aggregating crypto operations processed by event crypto adapter
+ into a single event containing ``rte_event_vector``
whose event type is ``RTE_EVENT_TYPE_CRYPTODEV_VECTOR``.
* **Added NitroSketch in membership library.**
- Added a new data structure called sketch into membership library,
+ Added a new data structure called sketch into the membership library,
to profile the traffic efficiently.
NitroSketch provides high-fidelity approximate measurements
and appears as a promising alternative to traditional approaches
@@ -320,7 +320,7 @@ New Features
Added support for asymmetric crypto algorithms.
See the :doc:`../sample_app_ug/fips_validation` for more details.
-* **Rewritten pmdinfo script.**
+* **Rewrote pmdinfo script.**
The ``dpdk-pmdinfo.py`` script was rewritten to produce valid JSON only.
PCI-IDs parsing has been removed.
@@ -347,16 +347,16 @@ Removed Items
* mem: Removed not implemented and deprecated ``rte_malloc_set_limit``.
* ethdev: removed ``RTE_FLOW_ITEM_TYPE_PF``;
- use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
+ use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT`` instead.
* ethdev: removed ``RTE_FLOW_ITEM_TYPE_VF``;
- use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
+ use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT`` instead.
* ethdev: removed ``RTE_FLOW_ITEM_TYPE_PHY_PORT``;
- use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
+ use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT`` instead.
* ethdev: removed ``RTE_FLOW_ACTION_TYPE_PHY_PORT``;
- use ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT``.
+ use ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT`` instead.
* ethdev: removed ``OF_SET_MPLS_TTL``, ``OF_DEC_MPLS_TTL``,
``OF_SET_NW_TTL``, ``OF_COPY_TTL_OUT`` and ``OF_COPY_TTL_IN``
@@ -382,30 +382,30 @@ API Changes
Also, make sure to start the actual text at the margin.
=======================================================
-* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+* eal: ``RTE_FUNC_PTR_OR_*`` macros have been marked deprecated and will be removed
in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
to update their code.
-* eal: Updated ``rte_eal_remote_launch`` so it returns -EPIPE in case of
+* eal: Updated ``rte_eal_remote_launch`` so it returns ``-EPIPE`` in case of
a read or write error on the pipe, instead of calling ``rte_panic``.
-* eal: Updated return types for rte_{bsf,fls} inline functions
+* eal: Updated return types for ``rte_{bsf,fls}`` inline functions
to be consistently ``uint32_t``.
-* mempool: Deprecated helper macro ``MEMPOOL_HEADER_SIZE()`` is removed.
+* mempool: Deprecated helper macro ``MEMPOOL_HEADER_SIZE()`` has been removed.
The replacement macro ``RTE_MEMPOOL_HEADER_SIZE()`` is internal only.
* mempool: Deprecated macro to register mempool driver
- ``MEMPOOL_REGISTER_OPS()`` is removed. Use replacement macro
+ ``MEMPOOL_REGISTER_OPS()`` has been removed. Use replacement macro
``RTE_MEMPOOL_REGISTER_OPS()`` instead.
* mempool: Deprecated macros ``MEMPOOL_PG_NUM_DEFAULT`` and
- ``MEMPOOL_PG_SHIFT_MAX`` are removed. These macros are not used and
+ ``MEMPOOL_PG_SHIFT_MAX`` have been removed. These macros are not used and
not required any more.
* mbuf: Removed deprecated ``PKT_*`` flags.
Use corresponding flags with ``RTE_MBUF_F_`` prefix instead.
- Application can use ``devtools/cocci/prefix_mbuf_offload_flags.cocci``
+ Applications can use ``devtools/cocci/prefix_mbuf_offload_flags.cocci``
to replace all occurrences of old mbuf flags in C code.
* bus: Changed the device numa node to -1 when NUMA information is unavailable.
@@ -502,7 +502,7 @@ API Changes
from experimental to stable.
* ethdev: Banned the use of attributes ``ingress``/``egress`` in "transfer"
- flows, as the final step of deprecation process that had been started
+ flows, as the final step of the deprecation process that had been started
in DPDK 21.11. See items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT``.
* vhost: Promoted ``rte_vhost_vring_stats_get()``,
@@ -523,7 +523,7 @@ API Changes
The API ``rte_security_session_create`` was updated to take only one mempool
which has enough space to hold session and driver private data.
-* security: MACsec support is added which resulted in updates
+* security: MACsec support has been added which resulted in updates
to structures ``rte_security_macsec_xform``, ``rte_security_macsec_stats``
and security capability structure ``rte_security_capability``
to accommodate MACsec capabilities.
@@ -605,7 +605,7 @@ ABI Changes
to ``rte_event_queue_conf`` structure.
* eventdev: The field ``*u64s`` in the structure ``rte_event_vector`` is replaced
- with ``u64s`` as the field is supposed to hold array of uint64_t values.
+ with ``u64s`` as the field is supposed to hold an array of ``uint64_t`` values.
* eventdev: The structure ``rte_event_vector`` was updated to include a new bit
field ``elem_offset:12``. The bits are taken from the bitfield ``rsvd:15``.
--
2.31.1
^ permalink raw reply [relevance 3%]
* RE: Regarding User Data in DPDK ACL Library.
2022-11-22 13:38 0% ` Konstantin Ananyev
@ 2022-11-22 15:53 0% ` Honnappa Nagarahalli
0 siblings, 0 replies; 200+ results
From: Honnappa Nagarahalli @ 2022-11-22 15:53 UTC (permalink / raw)
To: Konstantin Ananyev, Stephen Hemminger, venkatesh bs; +Cc: users, dev, nd, nd
<snip>
> > >
> > > > > > On Thu, 17 Nov 2022 19:28:12 +0530 venkatesh bs
> > > > > > <venki.bsv@gmail.com> wrote:
> > > > > >
> > > > > > > Hi DPDK Team,
> > > > > > >
> > > > > > > After the ACL match for highest priority DPDK Classification
> > > > > > > API returns User Data Which is as mentioned below in the document.
> > > > > > >
> > > > > > > 53. Packet Classification and Access Control — Data Plane
> > > > > > > Development Kit
> > > > > > > 22.11.0-rc2 documentation (dpdk.org)
> > > > > > >
> > > > > > >
> > > > > > > - *userdata*: A user-defined value. For each category, a successful
> > > > > > > match returns the userdata field of the highest priority
> > > > > > > matched
> > > rule.
> > > > > When
> > > > > > > no rules match, returned value is zero
> > > > > > >
> > > > > > > I Wonder Why User Data Support does not returns 64 bit
> > > > > > > values,
> > > > >
> > > > > As I remember if first version of ACL code it was something
> > > > > about space savings to improve performance...
> > > > > Now I think it is more just a historical reason.
> > > > > It would be good to change userdata to 64bit, but I presume it
> > > > > will be ABI breakage.
> > > > Agree. We should support 64b and even 128b (since architectures
> > > > support 128b atomic operations). This reduces required memory
> > > > barriers
> > > required if the data size <= the size of atomic operations.
> > >
> > > Hmm... sorry, didn’t get you here.
> > > I do understand the user intention to save pointer to arbitrary
> > > memory location as user-data (64-bit).
> > > But how does the size of atomic mem-ops relate?
> > > Konstantin
> > What I meant is, if your data fits within 64b or 128b, having another
> indirection requires:
> >
> > 1) one additional memory operation to store the data (the first one
> > being the store to the index)
> > 2) on the control plane, we would need a release barrier between
> > 'store data' and 'store index' (not a significant issue). On the data plane, we
> could use relaxed ordering between 'load index' and 'load data', so we do not
> need a barrier here.
> >
> > So, looks like there is no barrier over-head on the data plane, but overhead of
> one additional memory operation.
>
> ACL doesn't provide ability to dynamically update the rules or associated user-
> data.
> Whole ACL table has to be rebuild.
Ok, then the ordering does not matter, all the loads on the data plane should be relaxed and not atomic (searching through the code does not show any).
> Konstantin
>
>
^ permalink raw reply [relevance 0%]
* RE: Regarding User Data in DPDK ACL Library.
2022-11-21 16:56 0% ` Honnappa Nagarahalli
@ 2022-11-22 13:38 0% ` Konstantin Ananyev
2022-11-22 15:53 0% ` Honnappa Nagarahalli
0 siblings, 1 reply; 200+ results
From: Konstantin Ananyev @ 2022-11-22 13:38 UTC (permalink / raw)
To: Honnappa Nagarahalli, Stephen Hemminger, venkatesh bs; +Cc: users, dev, nd, nd
> -----Original Message-----
> From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Sent: Monday, November 21, 2022 4:57 PM
> To: Konstantin Ananyev <konstantin.ananyev@huawei.com>; Stephen Hemminger <stephen@networkplumber.org>; venkatesh bs
> <venki.bsv@gmail.com>
> Cc: users@dpdk.org; dev@dpdk.org; nd <nd@arm.com>; nd <nd@arm.com>
> Subject: RE: Regarding User Data in DPDK ACL Library.
>
> <snip>
> >
> > > > > On Thu, 17 Nov 2022 19:28:12 +0530 venkatesh bs
> > > > > <venki.bsv@gmail.com> wrote:
> > > > >
> > > > > > Hi DPDK Team,
> > > > > >
> > > > > > After the ACL match for highest priority DPDK Classification API
> > > > > > returns User Data Which is as mentioned below in the document.
> > > > > >
> > > > > > 53. Packet Classification and Access Control — Data Plane
> > > > > > Development Kit
> > > > > > 22.11.0-rc2 documentation (dpdk.org)
> > > > > >
> > > > > >
> > > > > > - *userdata*: A user-defined value. For each category, a successful
> > > > > > match returns the userdata field of the highest priority matched
> > rule.
> > > > When
> > > > > > no rules match, returned value is zero
> > > > > >
> > > > > > I Wonder Why User Data Support does not returns 64 bit values,
> > > >
> > > > As I remember if first version of ACL code it was something about
> > > > space savings to improve performance...
> > > > Now I think it is more just a historical reason.
> > > > It would be good to change userdata to 64bit, but I presume it will
> > > > be ABI breakage.
> > > Agree. We should support 64b and even 128b (since architectures
> > > support 128b atomic operations). This reduces required memory barriers
> > required if the data size <= the size of atomic operations.
> >
> > Hmm... sorry, didn’t get you here.
> > I do understand the user intention to save pointer to arbitrary memory
> > location as user-data (64-bit).
> > But how does the size of atomic mem-ops relate?
> > Konstantin
> What I meant is, if your data fits within 64b or 128b, having another indirection requires:
>
> 1) one additional memory operation to store the data (the first one being the store to the index)
> 2) on the control plane, we would need a release barrier between 'store data' and 'store index' (not a significant issue). On the data
> plane, we could use relaxed ordering between 'load index' and 'load data', so we do not need a barrier here.
>
> So, looks like there is no barrier over-head on the data plane, but overhead of one additional memory operation.
ACL doesn't provide ability to dynamically update the rules or associated user-data.
Whole ACL table has to be rebuild.
Konstantin
^ permalink raw reply [relevance 0%]
* [PATCH] net/nfp: update descriptors logic
@ 2022-11-22 13:09 3% Niklas Söderlund
0 siblings, 0 replies; 200+ results
From: Niklas Söderlund @ 2022-11-22 13:09 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Jin Liu, Chaoyong He, Niklas Söderlund
From: Jin Liu <jin.liu@corigine.com>
The minimum value of TX/RX descriptors for NFP3800 card is not same
with NFP4000 card, the minimum value of NFP4000 card is 256 while
NFP3800 card is 512, add the minimum descriptor macro for NFP3800
card.
Modify the logic of get descriptor value, assign the value of descriptor
for the corresponding network card according to its type.
In TX stage, firmware with NFD3 use one descriptor per packet while
firmware with NFDk use two descriptors. In order to be consistent
with the kernel driver, the number of descriptor of firmware with
NFDk should be divided by 2.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_common.c | 86 ++++++++++++++++++++++++++++++++++--
drivers/net/nfp/nfp_common.h | 6 +++
drivers/net/nfp/nfp_rxtx.c | 51 ++++++++++++++-------
drivers/net/nfp/nfp_rxtx.h | 3 ++
4 files changed, 127 insertions(+), 19 deletions(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 71711bfa228e..4defd6d93871 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -697,13 +697,91 @@ nfp_net_stats_reset(struct rte_eth_dev *dev)
return 0;
}
+int
+nfp_net_rx_desc_limits(struct nfp_net_hw *hw,
+ uint16_t *min_rx_desc,
+ uint16_t *max_rx_desc)
+{
+ *max_rx_desc = NFP_NET_MAX_RX_DESC;
+
+ switch (hw->device_id) {
+ case PCI_DEVICE_ID_NFP3800_PF_NIC:
+ case PCI_DEVICE_ID_NFP3800_VF_NIC:
+ *min_rx_desc = NFP3800_NET_MIN_RX_DESC;
+ return 0;
+ case PCI_DEVICE_ID_NFP4000_PF_NIC:
+ case PCI_DEVICE_ID_NFP6000_PF_NIC:
+ case PCI_DEVICE_ID_NFP6000_VF_NIC:
+ *min_rx_desc = NFP_NET_MIN_RX_DESC;
+ return 0;
+ default:
+ PMD_DRV_LOG(ERR, "Unknown NFP device id.");
+ return -EINVAL;
+ }
+}
+
+int
+nfp_net_tx_desc_limits(struct nfp_net_hw *hw,
+ uint16_t *min_tx_desc,
+ uint16_t *max_tx_desc)
+{
+ uint16_t tx_dpp;
+
+ switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
+ case NFP_NET_CFG_VERSION_DP_NFD3:
+ tx_dpp = NFD3_TX_DESC_PER_SIMPLE_PKT;
+ break;
+ case NFP_NET_CFG_VERSION_DP_NFDK:
+ if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) {
+ PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer, found: %d",
+ NFD_CFG_MAJOR_VERSION_of(hw->ver));
+ return -EINVAL;
+ }
+ tx_dpp = NFDK_TX_DESC_PER_SIMPLE_PKT;
+ break;
+ default:
+ PMD_DRV_LOG(ERR, "The version of firmware is not correct.");
+ return -EINVAL;
+ }
+
+ *max_tx_desc = NFP_NET_MAX_TX_DESC / tx_dpp;
+
+ switch (hw->device_id) {
+ case PCI_DEVICE_ID_NFP3800_PF_NIC:
+ case PCI_DEVICE_ID_NFP3800_VF_NIC:
+ *min_tx_desc = NFP3800_NET_MIN_TX_DESC / tx_dpp;
+ return 0;
+ case PCI_DEVICE_ID_NFP4000_PF_NIC:
+ case PCI_DEVICE_ID_NFP6000_PF_NIC:
+ case PCI_DEVICE_ID_NFP6000_VF_NIC:
+ *min_tx_desc = NFP_NET_MIN_TX_DESC / tx_dpp;
+ return 0;
+ default:
+ PMD_DRV_LOG(ERR, "Unknown NFP device id.");
+ return -EINVAL;
+ }
+}
+
int
nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
+ int ret;
+ uint16_t min_rx_desc;
+ uint16_t max_rx_desc;
+ uint16_t min_tx_desc;
+ uint16_t max_tx_desc;
struct nfp_net_hw *hw;
hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ ret = nfp_net_rx_desc_limits(hw, &min_rx_desc, &max_rx_desc);
+ if (ret != 0)
+ return ret;
+
+ ret = nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc);
+ if (ret != 0)
+ return ret;
+
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU;
@@ -764,14 +842,14 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
};
dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
- .nb_max = NFP_NET_MAX_RX_DESC,
- .nb_min = NFP_NET_MIN_RX_DESC,
+ .nb_max = max_rx_desc,
+ .nb_min = min_rx_desc,
.nb_align = NFP_ALIGN_RING_DESC,
};
dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
- .nb_max = NFP_NET_MAX_TX_DESC,
- .nb_min = NFP_NET_MIN_TX_DESC,
+ .nb_max = max_tx_desc,
+ .nb_min = min_tx_desc,
.nb_align = NFP_ALIGN_RING_DESC,
.nb_seg_max = NFP_TX_MAX_SEG,
.nb_mtu_seg_max = NFP_TX_MAX_MTU_SEG,
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 36c19b47e4d5..a871e437e4d2 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -447,6 +447,12 @@ void nfp_net_close_rx_queue(struct rte_eth_dev *dev);
void nfp_net_stop_tx_queue(struct rte_eth_dev *dev);
void nfp_net_close_tx_queue(struct rte_eth_dev *dev);
int nfp_net_set_vxlan_port(struct nfp_net_hw *hw, size_t idx, uint16_t port);
+int nfp_net_rx_desc_limits(struct nfp_net_hw *hw,
+ uint16_t *min_rx_desc,
+ uint16_t *max_rx_desc);
+int nfp_net_tx_desc_limits(struct nfp_net_hw *hw,
+ uint16_t *min_tx_desc,
+ uint16_t *max_tx_desc);
#define NFP_NET_DEV_PRIVATE_TO_HW(adapter)\
(&((struct nfp_net_adapter *)adapter)->hw)
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 01cffdfde0b4..0de7312e217d 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -439,6 +439,9 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mp)
{
+ int ret;
+ uint16_t min_rx_desc;
+ uint16_t max_rx_desc;
const struct rte_memzone *tz;
struct nfp_net_rxq *rxq;
struct nfp_net_hw *hw;
@@ -448,11 +451,14 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
+ ret = nfp_net_rx_desc_limits(hw, &min_rx_desc, &max_rx_desc);
+ if (ret != 0)
+ return ret;
+
/* Validating number of descriptors */
rx_desc_sz = nb_desc * sizeof(struct nfp_net_rx_desc);
if (rx_desc_sz % NFP_ALIGN_RING_DESC != 0 ||
- nb_desc > NFP_NET_MAX_RX_DESC ||
- nb_desc < NFP_NET_MIN_RX_DESC) {
+ nb_desc > max_rx_desc || nb_desc < min_rx_desc) {
PMD_DRV_LOG(ERR, "Wrong nb_desc value");
return -EINVAL;
}
@@ -502,7 +508,7 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev,
*/
tz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx,
sizeof(struct nfp_net_rx_desc) *
- NFP_NET_MAX_RX_DESC, NFP_MEMZONE_ALIGN,
+ max_rx_desc, NFP_MEMZONE_ALIGN,
socket_id);
if (tz == NULL) {
@@ -628,6 +634,9 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
uint16_t nb_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf)
{
+ int ret;
+ uint16_t min_tx_desc;
+ uint16_t max_tx_desc;
const struct rte_memzone *tz;
struct nfp_net_txq *txq;
uint16_t tx_free_thresh;
@@ -638,11 +647,14 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
PMD_INIT_FUNC_TRACE();
+ ret = nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc);
+ if (ret != 0)
+ return ret;
+
/* Validating number of descriptors */
tx_desc_sz = nb_desc * sizeof(struct nfp_net_nfd3_tx_desc);
- if (tx_desc_sz % NFP_ALIGN_RING_DESC != 0 ||
- nb_desc > NFP_NET_MAX_TX_DESC ||
- nb_desc < NFP_NET_MIN_TX_DESC) {
+ if ((NFD3_TX_DESC_PER_SIMPLE_PKT * tx_desc_sz) % NFP_ALIGN_RING_DESC != 0 ||
+ nb_desc > max_tx_desc || nb_desc < min_tx_desc) {
PMD_DRV_LOG(ERR, "Wrong nb_desc value");
return -EINVAL;
}
@@ -688,7 +700,8 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
*/
tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx,
sizeof(struct nfp_net_nfd3_tx_desc) *
- NFP_NET_MAX_TX_DESC, NFP_MEMZONE_ALIGN,
+ NFD3_TX_DESC_PER_SIMPLE_PKT *
+ max_tx_desc, NFP_MEMZONE_ALIGN,
socket_id);
if (tz == NULL) {
PMD_DRV_LOG(ERR, "Error allocating tx dma");
@@ -697,7 +710,7 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
return -ENOMEM;
}
- txq->tx_count = nb_desc;
+ txq->tx_count = nb_desc * NFD3_TX_DESC_PER_SIMPLE_PKT;
txq->tx_free_thresh = tx_free_thresh;
txq->tx_pthresh = tx_conf->tx_thresh.pthresh;
txq->tx_hthresh = tx_conf->tx_thresh.hthresh;
@@ -716,7 +729,7 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
/* mbuf pointers array for referencing mbufs linked to TX descriptors */
txq->txbufs = rte_zmalloc_socket("txq->txbufs",
- sizeof(*txq->txbufs) * nb_desc,
+ sizeof(*txq->txbufs) * txq->tx_count,
RTE_CACHE_LINE_SIZE, socket_id);
if (txq->txbufs == NULL) {
nfp_net_tx_queue_release(dev, queue_idx);
@@ -735,7 +748,7 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
* of descriptors in log2 format
*/
nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(queue_idx), txq->dma);
- nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(queue_idx), rte_log2_u32(nb_desc));
+ nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(queue_idx), rte_log2_u32(txq->tx_count));
return 0;
}
@@ -760,7 +773,8 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
PMD_TX_LOG(DEBUG, "working for queue %u at pos %d and %u packets",
txq->qidx, txq->wr_p, nb_pkts);
- if ((nfp_net_nfd3_free_tx_desc(txq) < nb_pkts) || (nfp_net_nfd3_txq_full(txq)))
+ if (nfp_net_nfd3_free_tx_desc(txq) < NFD3_TX_DESC_PER_SIMPLE_PKT * nb_pkts ||
+ nfp_net_nfd3_txq_full(txq))
nfp_net_tx_free_bufs(txq);
free_descs = (uint16_t)nfp_net_nfd3_free_tx_desc(txq);
@@ -879,6 +893,9 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
unsigned int socket_id,
const struct rte_eth_txconf *tx_conf)
{
+ int ret;
+ uint16_t min_tx_desc;
+ uint16_t max_tx_desc;
const struct rte_memzone *tz;
struct nfp_net_txq *txq;
uint16_t tx_free_thresh;
@@ -889,11 +906,15 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
+ ret = nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc);
+ if (ret != 0)
+ return ret;
+
/* Validating number of descriptors */
tx_desc_sz = nb_desc * sizeof(struct nfp_net_nfdk_tx_desc);
- if (((NFDK_TX_DESC_PER_SIMPLE_PKT * tx_desc_sz) % NFP_ALIGN_RING_DESC) != 0 ||
- ((NFDK_TX_DESC_PER_SIMPLE_PKT * nb_desc) % NFDK_TX_DESC_BLOCK_CNT) != 0 ||
- nb_desc > NFP_NET_MAX_TX_DESC || nb_desc < NFP_NET_MIN_TX_DESC) {
+ if ((NFDK_TX_DESC_PER_SIMPLE_PKT * tx_desc_sz) % NFP_ALIGN_RING_DESC != 0 ||
+ (NFDK_TX_DESC_PER_SIMPLE_PKT * nb_desc) % NFDK_TX_DESC_BLOCK_CNT != 0 ||
+ nb_desc > max_tx_desc || nb_desc < min_tx_desc) {
PMD_DRV_LOG(ERR, "Wrong nb_desc value");
return -EINVAL;
}
@@ -938,7 +959,7 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx,
sizeof(struct nfp_net_nfdk_tx_desc) *
NFDK_TX_DESC_PER_SIMPLE_PKT *
- NFP_NET_MAX_TX_DESC, NFP_MEMZONE_ALIGN,
+ max_tx_desc, NFP_MEMZONE_ALIGN,
socket_id);
if (tz == NULL) {
PMD_DRV_LOG(ERR, "Error allocating tx dma");
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index ced05fde908d..4f0de5e93227 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -31,9 +31,11 @@
*/
#define NFP_NET_MAX_TX_DESC (32 * 1024)
#define NFP_NET_MIN_TX_DESC 256
+#define NFP3800_NET_MIN_TX_DESC 512
#define NFP_NET_MAX_RX_DESC (32 * 1024)
#define NFP_NET_MIN_RX_DESC 256
+#define NFP3800_NET_MIN_RX_DESC 512
/* Descriptor alignment */
#define NFP_ALIGN_RING_DESC 128
@@ -57,6 +59,7 @@
#define NFDK_DESC_TX_DMA_LEN_HEAD 0x0fff
#define NFDK_DESC_TX_TYPE_HEAD 0xf000
#define NFDK_DESC_TX_DMA_LEN 0x3fff
+#define NFD3_TX_DESC_PER_SIMPLE_PKT 1
#define NFDK_TX_DESC_PER_SIMPLE_PKT 2
#define NFDK_DESC_TX_TYPE_TSO 2
#define NFDK_DESC_TX_TYPE_SIMPLE 8
--
2.38.1
^ permalink raw reply [relevance 3%]
* RE: Regarding User Data in DPDK ACL Library.
2022-11-21 14:15 0% ` Konstantin Ananyev
@ 2022-11-21 16:56 0% ` Honnappa Nagarahalli
2022-11-22 13:38 0% ` Konstantin Ananyev
0 siblings, 1 reply; 200+ results
From: Honnappa Nagarahalli @ 2022-11-21 16:56 UTC (permalink / raw)
To: Konstantin Ananyev, Stephen Hemminger, venkatesh bs; +Cc: users, dev, nd, nd
<snip>
>
> > > > On Thu, 17 Nov 2022 19:28:12 +0530 venkatesh bs
> > > > <venki.bsv@gmail.com> wrote:
> > > >
> > > > > Hi DPDK Team,
> > > > >
> > > > > After the ACL match for highest priority DPDK Classification API
> > > > > returns User Data Which is as mentioned below in the document.
> > > > >
> > > > > 53. Packet Classification and Access Control — Data Plane
> > > > > Development Kit
> > > > > 22.11.0-rc2 documentation (dpdk.org)
> > > > >
> > > > >
> > > > > - *userdata*: A user-defined value. For each category, a successful
> > > > > match returns the userdata field of the highest priority matched
> rule.
> > > When
> > > > > no rules match, returned value is zero
> > > > >
> > > > > I Wonder Why User Data Support does not returns 64 bit values,
> > >
> > > As I remember if first version of ACL code it was something about
> > > space savings to improve performance...
> > > Now I think it is more just a historical reason.
> > > It would be good to change userdata to 64bit, but I presume it will
> > > be ABI breakage.
> > Agree. We should support 64b and even 128b (since architectures
> > support 128b atomic operations). This reduces required memory barriers
> required if the data size <= the size of atomic operations.
>
> Hmm... sorry, didn’t get you here.
> I do understand the user intention to save pointer to arbitrary memory
> location as user-data (64-bit).
> But how does the size of atomic mem-ops relate?
> Konstantin
What I meant is, if your data fits within 64b or 128b, having another indirection requires:
1) one additional memory operation to store the data (the first one being the store to the index)
2) on the control plane, we would need a release barrier between 'store data' and 'store index' (not a significant issue). On the data plane, we could use relaxed ordering between 'load index' and 'load data', so we do not need a barrier here.
So, looks like there is no barrier over-head on the data plane, but overhead of one additional memory operation.
^ permalink raw reply [relevance 0%]
* RE: Regarding User Data in DPDK ACL Library.
2022-11-21 5:40 0% ` Honnappa Nagarahalli
@ 2022-11-21 14:15 0% ` Konstantin Ananyev
2022-11-21 16:56 0% ` Honnappa Nagarahalli
0 siblings, 1 reply; 200+ results
From: Konstantin Ananyev @ 2022-11-21 14:15 UTC (permalink / raw)
To: Honnappa Nagarahalli, Stephen Hemminger, venkatesh bs; +Cc: users, dev, nd, nd
> > > On Thu, 17 Nov 2022 19:28:12 +0530
> > > venkatesh bs <venki.bsv@gmail.com> wrote:
> > >
> > > > Hi DPDK Team,
> > > >
> > > > After the ACL match for highest priority DPDK Classification API
> > > > returns User Data Which is as mentioned below in the document.
> > > >
> > > > 53. Packet Classification and Access Control — Data Plane
> > > > Development Kit
> > > > 22.11.0-rc2 documentation (dpdk.org)
> > > >
> > > >
> > > > - *userdata*: A user-defined value. For each category, a successful
> > > > match returns the userdata field of the highest priority matched rule.
> > When
> > > > no rules match, returned value is zero
> > > >
> > > > I Wonder Why User Data Support does not returns 64 bit values,
> >
> > As I remember if first version of ACL code it was something about space
> > savings to improve performance...
> > Now I think it is more just a historical reason.
> > It would be good to change userdata to 64bit, but I presume it will be ABI
> > breakage.
> Agree. We should support 64b and even 128b (since architectures support 128b atomic operations). This reduces required memory
> barriers required if the data size <= the size of atomic operations.
Hmm... sorry, didn’t get you here.
I do understand the user intention to save pointer to arbitrary memory location as user-data (64-bit).
But how does the size of atomic mem-ops relate?
Konstantin
^ permalink raw reply [relevance 0%]
* RE: Regarding User Data in DPDK ACL Library.
2022-11-18 10:30 3% ` Konstantin Ananyev
2022-11-19 13:13 0% ` venkatesh bs
@ 2022-11-21 5:40 0% ` Honnappa Nagarahalli
2022-11-21 14:15 0% ` Konstantin Ananyev
1 sibling, 1 reply; 200+ results
From: Honnappa Nagarahalli @ 2022-11-21 5:40 UTC (permalink / raw)
To: Konstantin Ananyev, Stephen Hemminger, venkatesh bs; +Cc: users, dev, nd, nd
<snip>
>
>
> > On Thu, 17 Nov 2022 19:28:12 +0530
> > venkatesh bs <venki.bsv@gmail.com> wrote:
> >
> > > Hi DPDK Team,
> > >
> > > After the ACL match for highest priority DPDK Classification API
> > > returns User Data Which is as mentioned below in the document.
> > >
> > > 53. Packet Classification and Access Control — Data Plane
> > > Development Kit
> > > 22.11.0-rc2 documentation (dpdk.org)
> > >
> > >
> > > - *userdata*: A user-defined value. For each category, a successful
> > > match returns the userdata field of the highest priority matched rule.
> When
> > > no rules match, returned value is zero
> > >
> > > I Wonder Why User Data Support does not returns 64 bit values,
>
> As I remember if first version of ACL code it was something about space
> savings to improve performance...
> Now I think it is more just a historical reason.
> It would be good to change userdata to 64bit, but I presume it will be ABI
> breakage.
Agree. We should support 64b and even 128b (since architectures support 128b atomic operations). This reduces required memory barriers required if the data size <= the size of atomic operations.
>
> > Always its
> > > possible that User Data in Application Can be 64bit long, But since
> > > 64 bit User data can't be returned by DPDK ACL Library, Application
> > > should have the conversion algorithm from 64 to 32 bit during Rule
> > > add and vice versa after classification.
> > >
> > > I Wonder if anyone would have faced this issue, Please suggest any
> > > suggestions if somewhere am wrong in understanding/Possible Solution
> > > if someone has already gone through this issue.
> > >
> > > Thanks In Advance.
> > > Regards,
> > > Venkatesh B Siddappa.
> >
> > It looks like all users of this API use the userdata to be the index
> > into a table of application specific rules.
>
> Yes, that's the most common way.
> Another one would be always (build/search) acl rules with two categories:
> rule for both categories will be identical, while data different (low/ho 32bits),
> but that's a bit too awkward from my perspective.
>
>
>
^ permalink raw reply [relevance 0%]
* Re: Regarding User Data in DPDK ACL Library.
2022-11-18 10:30 3% ` Konstantin Ananyev
@ 2022-11-19 13:13 0% ` venkatesh bs
2022-11-21 5:40 0% ` Honnappa Nagarahalli
1 sibling, 0 replies; 200+ results
From: venkatesh bs @ 2022-11-19 13:13 UTC (permalink / raw)
To: Konstantin Ananyev; +Cc: Stephen Hemminger, users, dev
[-- Attachment #1: Type: text/plain, Size: 2276 bytes --]
Hi konstantin, @stephen@networkplumber.org <stephen@networkplumber.org>
Thanks for the reply and your suggestions. I will try to see what can best
fit into my application.
Thanks & Regards,
Venkatesh.
On Fri, Nov 18, 2022 at 4:01 PM Konstantin Ananyev <
konstantin.ananyev@huawei.com> wrote:
>
>
> > On Thu, 17 Nov 2022 19:28:12 +0530
> > venkatesh bs <venki.bsv@gmail.com> wrote:
> >
> > > Hi DPDK Team,
> > >
> > > After the ACL match for highest priority DPDK Classification API
> returns
> > > User Data Which is as mentioned below in the document.
> > >
> > > 53. Packet Classification and Access Control — Data Plane Development
> Kit
> > > 22.11.0-rc2 documentation (dpdk.org)
> > >
> > >
> > > - *userdata*: A user-defined value. For each category, a successful
> > > match returns the userdata field of the highest priority matched
> rule. When
> > > no rules match, returned value is zero
> > >
> > > I Wonder Why User Data Support does not returns 64 bit values,
>
> As I remember if first version of ACL code it was something about space
> savings
> to improve performance...
> Now I think it is more just a historical reason.
> It would be good to change userdata to 64bit, but I presume it will be ABI
> breakage.
>
> > Always its
> > > possible that User Data in Application Can be 64bit long, But since 64
> bit
> > > User data can't be returned by DPDK ACL Library, Application should
> have
> > > the conversion algorithm from 64 to 32 bit during Rule add and vice
> versa
> > > after classification.
> > >
> > > I Wonder if anyone would have faced this issue, Please suggest any
> > > suggestions if somewhere am wrong in understanding/Possible Solution if
> > > someone has already gone through this issue.
> > >
> > > Thanks In Advance.
> > > Regards,
> > > Venkatesh B Siddappa.
> >
> > It looks like all users of this API use the userdata to be the index
> > into a table of application specific rules.
>
> Yes, that's the most common way.
> Another one would be always (build/search) acl rules with two categories:
> rule for both categories will be identical, while data different (low/ho
> 32bits),
> but that's a bit too awkward from my perspective.
>
>
>
>
>
[-- Attachment #2: Type: text/html, Size: 3115 bytes --]
^ permalink raw reply [relevance 0%]
* RE: Regarding User Data in DPDK ACL Library.
@ 2022-11-18 10:30 3% ` Konstantin Ananyev
2022-11-19 13:13 0% ` venkatesh bs
2022-11-21 5:40 0% ` Honnappa Nagarahalli
0 siblings, 2 replies; 200+ results
From: Konstantin Ananyev @ 2022-11-18 10:30 UTC (permalink / raw)
To: Stephen Hemminger, venkatesh bs; +Cc: users, dev
> On Thu, 17 Nov 2022 19:28:12 +0530
> venkatesh bs <venki.bsv@gmail.com> wrote:
>
> > Hi DPDK Team,
> >
> > After the ACL match for highest priority DPDK Classification API returns
> > User Data Which is as mentioned below in the document.
> >
> > 53. Packet Classification and Access Control — Data Plane Development Kit
> > 22.11.0-rc2 documentation (dpdk.org)
> >
> >
> > - *userdata*: A user-defined value. For each category, a successful
> > match returns the userdata field of the highest priority matched rule. When
> > no rules match, returned value is zero
> >
> > I Wonder Why User Data Support does not returns 64 bit values,
As I remember if first version of ACL code it was something about space savings
to improve performance...
Now I think it is more just a historical reason.
It would be good to change userdata to 64bit, but I presume it will be ABI breakage.
> Always its
> > possible that User Data in Application Can be 64bit long, But since 64 bit
> > User data can't be returned by DPDK ACL Library, Application should have
> > the conversion algorithm from 64 to 32 bit during Rule add and vice versa
> > after classification.
> >
> > I Wonder if anyone would have faced this issue, Please suggest any
> > suggestions if somewhere am wrong in understanding/Possible Solution if
> > someone has already gone through this issue.
> >
> > Thanks In Advance.
> > Regards,
> > Venkatesh B Siddappa.
>
> It looks like all users of this API use the userdata to be the index
> into a table of application specific rules.
Yes, that's the most common way.
Another one would be always (build/search) acl rules with two categories:
rule for both categories will be identical, while data different (low/ho 32bits),
but that's a bit too awkward from my perspective.
^ permalink raw reply [relevance 3%]
* Re: [PATCH] doc: fix typos 'depreciated' instead of 'deprecated'
@ 2022-11-15 16:13 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2022-11-15 16:13 UTC (permalink / raw)
To: Stephen Coleman; +Cc: dev, Ray Kinsella
19/04/2022 17:44, Ray Kinsella:
>
> Stephen Coleman <omegacoleman@gmail.com> writes:
>
> > From 1871ee6f7b98ef89b7c4893d90b5ea264660c201 Mon Sep 17 00:00:00 2001
> > From: youcai <omegacoleman@gmail.com>
> > Date: Tue, 19 Apr 2022 14:38:36 +0800
> > Subject: [PATCH] doc: fix typos 'depreciated' instead of 'deprecated'
> > Cc: Ray Kinsella <mdr@ashroe.eu>
> >
> > Same issue was fixed in ABI policy in ec5c0f8, but more of this
> > misuse persist in comments and docs. 'depreciated' means diminish
> > in value over a period of time. It should not appear here.
> >
> > Signed-off-by: youcai <omegacoleman@gmail.com>
> > ---
> > doc/guides/contributing/abi_policy.rst | 2 +-
> > doc/guides/contributing/abi_versioning.rst | 2 +-
> > lib/kni/rte_kni.h | 4 ++--
> > 3 files changed, 4 insertions(+), 4 deletions(-)
> >
> Acked-by: Ray Kinsella <mdr@ashroe.eu>
Applied, sorry for the delay, the patch was corrupted.
^ permalink raw reply [relevance 0%]
* RE: [RFC] mempool: zero-copy cache put bulk
2022-11-09 22:45 0% ` Honnappa Nagarahalli
@ 2022-11-10 10:15 0% ` Morten Brørup
0 siblings, 0 replies; 200+ results
From: Morten Brørup @ 2022-11-10 10:15 UTC (permalink / raw)
To: Honnappa Nagarahalli, dev, olivier.matz, andrew.rybchenko,
Kamalakshitha Aligeri, Bruce Richardson
Cc: nd, nd
> From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com]
> Sent: Wednesday, 9 November 2022 23.46
> >
> > +To: Bruce also showed interest in this topic, and might have more
> insights.
> >
> > > From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com]
> > > Sent: Wednesday, 9 November 2022 18.58
> > >
> > > <snip>
> > >
> > > >
> > > > > From: Honnappa Nagarahalli
> [mailto:Honnappa.Nagarahalli@arm.com]
> > > > > Sent: Sunday, 6 November 2022 00.11
> > > > >
> > > > > + Akshitha, she is working on similar patch
> > > > >
> > > > > Few comments inline
> > > > >
> > > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > Sent: Saturday, November 5, 2022 8:40 AM
> > > > > >
> > > > > > Zero-copy access to the mempool cache is beneficial for PMD
> > > > > performance,
> > > > > > and must be provided by the mempool library to fix [Bug 1052]
> > > > > > without
> > > > > a
> > > > > > performance regression.
> > > > > >
> > > > > > [Bug 1052]: https://bugs.dpdk.org/show_bug.cgi?id=1052
> > > > > >
> > > > > >
> > > > > > This RFC offers a conceptual zero-copy put function, where
> the
> > > > > application
> > > > > > promises to store some objects, and in return gets an address
> > > where
> > > > > to store
> > > > > > them.
> > > > > >
> > > > > > I would like some early feedback.
> > > > > >
> > > > > > Notes:
> > > > > > * Allowing the 'cache' parameter to be NULL, and getting it
> from
> > > the
> > > > > > mempool instead, was inspired by rte_mempool_cache_flush().
> > > > > I am not sure why the 'cache' parameter is required for this
> API.
> > > This
> > > > > API should take the mem pool as the parameter.
> > > > >
> > > > > We have based our API on 'rte_mempool_do_generic_put' and
> removed
> > > > the
> > > > > 'cache' parameter.
> > > >
> > > > I thoroughly considered omitting the 'cache' parameter, but
> included
> > > it for
> > > > two reasons:
> > > >
> > > > 1. The function is a "mempool cache" function (i.e. primarily
> > > > working
> > > on the
> > > > mempool cache), not a "mempool" function.
> > > >
> > > > So it is appropriate to have a pointer directly to the structure
> it
> > > is working on.
> > > > Following this through, I also made 'cache' the first parameter
> and
> > > 'mp' the
> > > > second, like in rte_mempool_cache_flush().
> > > I am wondering if the PMD should be aware of the cache or not. For
> ex:
> > > in the case of pipeline mode, the RX and TX side of the PMD are
> > > running on different cores.
> >
> > In that example, the PMD can store two cache pointers, one for each
> of the
> > RX and TX side.
> I did not understand this. If RX core and TX core have their own per-
> core caches the logic would not work. For ex: the RX core cache would
> not get filled.
>
> In the case of pipeline mode, there will not be a per-core cache. The
> buffers would be allocated and freed from a global ring or a global
> lockless stack.
Aha... Now I understand what you mean: You are referring to use cases where the mempool is configured to *not* have a mempool cache.
For a mempool without a mempool cache, the proposed "mempool cache" zero-copy functions can obviously not be used.
We need "mempool" zero-copy functions for the mempools that have no mempool cache.
However, those functions depend on the mempool's underlying backing store.
E.g. zero-copy access to a ring has certain requirements [1].
[1]: http://doc.dpdk.org/guides/prog_guide/ring_lib.html#ring-peek-zero-copy-api
For a stack, I think it is possible to locklessly zero-copy pop objects. But it is impossible to locklessly zero-copy push elements to a stack; another thread can race to pop some objects from the stack before the pushing thread has finished writing them into the stack.
Furthermore, the ring zero-copy get function cannot return a consecutive array of objects when wrapping, and PMD functions using vector instructions usually rely on handling chunks of e.g. 8 objects.
Just for a second, let me theorize into the absurd: Even worse, if a mempool's underlying backing store does not use an array of pointers as its internal storage structure, it is impossible to use a pointer to an array of pointers for zero-copy transactions. E.g. if the backing store uses a list or a tree structure for its storage, a pointer to somewhere in the list or tree structure is not an array of objects pointers.
Anyway, we could consider designing a generic API for zero-copy mempool get/put; but it should be compatible with all underlying backing stores - or return failure, so the PMD can fall back to the standard functions, if the mempool is in a state where zero-copy access to a contiguous burst cannot be provided. E.g. zero-copy get from a ring can return failure when zero-copy access to the ring is temporarily unavailable due to being at a point where it would wrap.
Here is a conceptual proposal for such an API.
/* Mempool zero-copy transaction state. Opaque outside the mempool API. */
struct rte_mempool_zc_transaction_state {
char opaque[RTE_CACHE_LINE_SIZE];
};
/** Start zero-copy get/put bulk transaction.
*
* @param[in] mp
* Pointer to the mempool.
* @param[out] obj_table_ptr
* Where to store the pointer to
* the zero-copy array of objects in the mempool.
* @param[in] n
* Number of objects in the transaction.
* @param[in] cache
* Pointer to the mempool cache. May be NULL if unknown.
* @param[out] transaction
* Where to store the opaque transaction information.
* Used internally by the mempool library.
* @return
* - 1: Transaction completed;
* '_finish' must not be called.
* - 0: Transaction started;
* '_finish' must be called to complete the transaction.
* - <0: Error; failure code.
*/
static __rte_always_inline int
rte_mempool_get/put_zc_bulk_start(
struct rte_mempool *mp,
void ***obj_table_ptr,
unsigned int n,
struct rte_mempool_cache *cache,
rte_mempool_zc_transaction_state *transaction);
/** Finish zero-copy get/put bulk transaction.
*
* @param[in] mp
* Pointer to mempool.
* @param[in] obj_table_ptr
* Pointer to the zero-copy array of objects in the mempool,
* returned by the 'start' function.
* @param[in] n
* Number of objects in the transaction.
* Must be the same as for the 'start' function.
* @param[in] transaction
* Opaque transaction information,
* returned by the 'start' function.
* Used internally by the mempool library.
*/
static __rte_always_inline void
rte_mempool_get/put_zc_bulk_finish(
struct rte_mempool *mp,
void **obj_table,
unsigned int n,
rte_mempool_zc_transaction_state *transaction);
Note that these are *bulk* functions, so 'n' has to remain the same for a 'finish' call as it was for the 'start' call of a transaction.
And then the underlying backing stores would need to provide callbacks that implement these functions, if they offer zero-copy functionality.
The mempool implementation of these could start by checking for a mempool cache, and use the "mempool cache" zero-copy if present.
Some internal state information (from the mempool library or the underlying mempool backing store) may need to be carried over from the 'start' to the 'finish' function, so I have added a transaction state parameter. The transaction state must be held by the application for thread safety reasons. Think of this like the 'flags' parameter to the Linux kernel's spin_lock_irqsave/irqrestore() functions.
We could omit the 'obj_table' and 'n' parameters from the 'finish' functions and store them in the transaction state if needed; but we might possibly achieve higher performance by passing them as parameters instead.
>
> >
> > And if the PMD is unaware of the cache pointer, it can look it up at
> runtime
> > using rte_lcore_id(), like it does in the current Intel PMDs.
> >
> > > However, since the rte_mempool_cache_flush API is provided, may be
> > > that decision is already done? Interestingly,
> rte_mempool_cache_flush
> > > is called by just a single PMD.
> >
> > I intentionally aligned this RFC with rte_mempool_cache_flush() to
> maintain
> > consistency.
> >
> > However, the API is not set in stone. It should always be acceptable
> to
> > consider improved alternatives.
> >
> > >
> > > So, the question is, should we allow zero-copy only for per-core
> cache
> > > or for other cases as well.
> >
> > I suppose that the mempool library was designed to have a mempool
> > associated with exactly one mempool cache per core. (Alternatively,
> the
> > mempool can be configured with no mempool caches at all.)
> >
> > We should probably stay loyal to that design concept, and only allow
> zero-
> > copy for per-core cache.
> >
> > If you can come up with an example of the opposite, I would like to
> explore
> > that option too... I can't think of a good example myself, and
> perhaps I'm
> > overlooking a relevant use case.
> The use case I am talking about is the pipeline mode as I mentioned
> above. Let me know if you agree.
I see what you mean, and I don't object. :-)
However, I still think the "mempool cache" zero-copy functions could be useful.
They would be needed for the generic "mempool" zero-copy functions anyway.
And the "mempool cache" zero-copy functions are much simpler to design, implement and use than the "mempool" zero-copy functions, so it is a good first step.
>
> >
> > >
> > > >
> > > > 2. In most cases, the function only accesses the mempool
> structure
> > > > in
> > > order to
> > > > get the cache pointer. Skipping this step improves performance.
> > > >
> > > > And since the cache is created along with the mempool itself (and
> > > thus never
> > > > changes for a mempool), it would be safe for the PMD to store the
> > > 'cache'
> > > > pointer along with the 'mp' pointer in the PMD's queue structure.
> > > Agreed
> > >
> > > >
> > > > E.g. in the i40e PMD the i40e_rx_queue structure could include a
> > > "struct
> > > > rte_mempool_cache *cache" field, which could be used
> > > > i40e_rxq_rearm()
> > > [1]
> > > > instead of "cache = rte_mempool_default_cache(rxq->mp,
> > > rte_lcore_id())".
> > > >
> > > > [1] https://elixir.bootlin.com/dpdk/v22.11-
> > > > rc2/source/drivers/net/i40e/i40e_rxtx_vec_avx512.c#L31
> > > >
> > > > > This new API, on success, returns the pointer to memory where
> the
> > > > > objects are copied. On failure it returns NULL and the caller
> has
> > > to
> > > > > call 'rte_mempool_ops_enqueue_bulk'. Alternatively, the new API
> > > could
> > > > > do this as well and PMD does not need to do anything if it gets
> a
> > > NULL
> > > > > pointer.
> > > >
> > > > Yes, we agree about these two details:
> > > >
> > > > 1. The function should return a pointer, not an integer.
> > > > It would be a waste to use a another CPU register to convey a
> > > success/error
> > > > integer value, when the success/failure information is just as
> > > > easily
> > > conveyed
> > > > by the pointer return value (non-NULL/NULL), and rte_errno for
> > > various error
> > > > values in the unlikely cases.
> > > >
> > > > 2. The function should leave it up to the PMD what to do if
> direct
> > > access to
> > > > the cache is unavailable.
> > > Just wondering about the advantage of this. I do not think PMD's
> have
> > > much of a choice other than calling 'rte_mempool_ops_enqueue_bulk'
> >
> > I agree, but that was not my point. Let me try to rephrase:
> >
> > The PMD is more likely to know how to efficiently build the array of
> mbufs to
> > pass to rte_mempool_ops_enqueue_bulk() than the mempool library -
> many
> > PMDs already implement a variety of vector instruction variants to do
> exactly
> > that. So we should not try to be clever and add a fallback path -
> this job
> > belongs in the PMD.
> >
> > The PMD might not even have the array of mbufs lined up when calling
> > rte_mempool_cache_put_bulk_promise(). The PMD could have an array of
> > internal structures, where the mbuf pointer is an element in that
> structure.
> Agree, you are correct. We should leave it to PMD to handle the failure
> case.
>
> >
> > >
> > > >
> > > > >
> > > > > We should think about providing similar API on the RX side to
> > > > > keep
> > > it
> > > > > symmetric.
> > > >
> > > > I sent an RFC for that too:
> > > >
> > http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D87488@
> > > > smartserver.smartshare.dk/T/#u
> > > >
> > > >
> > > > >
> > > > > > * Asserting that the 'mp' parameter is not NULL is not done
> by
> > > other
> > > > > > functions, so I omitted it here too.
> > > > > >
> > > > > > NB: Please ignore formatting. Also, this code has not even
> been
> > > > > compile
> > > > > > tested.
> > > > > We are little bit ahead, tested the changes with i40e PF PMD,
> > > > > wrote unit test cases, going through internal review, will send
> > > > > out RFC
> > > on
> > > > > Monday
> > > >
> > > > Sounds good. Looking forward to review.
> > > >
> > > > >
> > > > > >
> > > > > > /**
> > > > > > * Promise to put objects in a mempool via zero-copy access
> to a
> > > > > user-owned
> > > > > > mempool cache.
> > > > > > *
> > > > > > * @param cache
> > > > > > * A pointer to the mempool cache.
> > > > > > * @param mp
> > > > > > * A pointer to the mempool.
> > > > > > * @param n
> > > > > > * The number of objects to be put in the mempool cache.
> > > > > > * @return
> > > > > > * The pointer to where to put the objects in the mempool
> > > cache.
> > > > > > * NULL on error
> > > > > > * with rte_errno set appropriately.
> > > > > > */
> > > > > > static __rte_always_inline void *
> > > > > > rte_mempool_cache_put_bulk_promise(struct rte_mempool_cache
> > > > *cache,
> > > > > > struct rte_mempool *mp,
> > > > > > unsigned int n)
> > > > > > {
> > > > > > void **cache_objs;
> > > > > >
> > > > > > if (cache == NULL)
> > > > > > cache = rte_mempool_default_cache(mp,
> rte_lcore_id());
> > > Any reason we need this? If we are expecting the PMD to store the
> > > pointer to cache and a NULL is passed, it would mean it is a
> mempool
> > > with no per-core cache?
> > > We could also leave the NULL check to the PMD.
> >
> > Personally, I would strongly prefer requiring the cache pointer to be
> valid,
> > and use RTE_ASSERT() here, instead of allowing a NULL pointer as a
> special
> > case to look it up inside the function. I consider this special NULL
> case useless
> > bloat, which does not belong in a fast path library function.
> >
> > But I copied this approach from rte_mempool_cache_flush().
> The API definition does not bind it to do this check. We might be able
> to delete the check in rte_mempool_cache_flush.
>
> >
> > We could expose an "unsafe" function where is not allowed to pass
> NULL
> > pointers, and a "safe" function (fixing the cache pointer if NULL)
> for
> > consistency.
> >
> > If the rte_mempool_cache_flush() function is popular, we could also
> expose
> > an "unsafe" variant where passing NULL pointers are disallowed.
> >
> > I wonder if there are any examples of such safe/unsafe variants in
> DPDK? It
> > would be nice with a common naming convention for such function
> variants.
> >
> > >
> > > > > > if (cache == NULL) {
> > > > > > rte_errno = EINVAL;
> > > > > > return NULL;
> > > > > > }
> > > > > >
> > > > > > rte_mempool_trace_cache_put_bulk_promise(cache, mp, n);
> > > > > >
> > > > > > /* The request itself is too big for the cache */
> > > > > > if (unlikely(n > cache->flushthresh)) {
> > > > > > rte_errno = EINVAL;
> > > > > > return NULL;
> > > > > > }
> > > > > >
> > > > > > /*
> > > > > > * The cache follows the following algorithm:
> > > > > > * 1. If the objects cannot be added to the cache
> without
> > > > > crossing
> > > > > > * the flush threshold, flush the cache to the
> backend.
> > > > > > * 2. Add the objects to the cache.
> > > > > > */
> > > > > >
> > > > > > if (cache->len + n <= cache->flushthresh) {
> > > > > > cache_objs = &cache->objs[cache->len];
> > > > > > cache->len += n;
> > > > > > } else {
> > > > > > cache_objs = &cache->objs[0];
> > > > > > rte_mempool_ops_enqueue_bulk(mp, cache_objs, cache-
> >len);
> > > > > > cache->len = n;
> > > > > > }
> > > > > >
> > > > > > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_bulk, 1);
> > > > > > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, n);
> > > These are new stats. Do these break ABI compatibility (though these
> > > are under DEBUG flag)?
> >
> > They are not mempool cache stats, they are only kept in the cache
> structure
> > to provide alternative (i.e. faster) update access to some (i.e. the
> most often
> > updated) of the existing mempool stats. The patch is [1], and part of
> a series
> > currently being discussed if should go into 22.11-rc3 or not [2].
> >
> > [1]:
> > https://patchwork.dpdk.org/project/dpdk/patch/20221109181852.109856-
> 3-
> > mb@smartsharesystems.com/
> > [2]:
> > http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D874A6
> > @smartserver.smartshare.dk/T/#m41bf4e8bd886db49f11c8dbd63741b35327
> > 7082f
> >
> > >
> > > > > >
> > > > > > return cache_objs;
> > > > > > }
> > > > > >
> > > > > >
> > > > > > Med venlig hilsen / Kind regards, -Morten Brørup
> > > > > >
> > > > >
> > >
>
^ permalink raw reply [relevance 0%]
* RE: [RFC] mempool: zero-copy cache put bulk
2022-11-09 20:36 0% ` Morten Brørup
@ 2022-11-09 22:45 0% ` Honnappa Nagarahalli
2022-11-10 10:15 0% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Honnappa Nagarahalli @ 2022-11-09 22:45 UTC (permalink / raw)
To: Morten Brørup, dev, olivier.matz, andrew.rybchenko,
Kamalakshitha Aligeri, Bruce Richardson
Cc: nd, nd
<snip>
>
> +To: Bruce also showed interest in this topic, and might have more insights.
>
> > From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com]
> > Sent: Wednesday, 9 November 2022 18.58
> >
> > <snip>
> >
> > >
> > > > From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com]
> > > > Sent: Sunday, 6 November 2022 00.11
> > > >
> > > > + Akshitha, she is working on similar patch
> > > >
> > > > Few comments inline
> > > >
> > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > Sent: Saturday, November 5, 2022 8:40 AM
> > > > >
> > > > > Zero-copy access to the mempool cache is beneficial for PMD
> > > > performance,
> > > > > and must be provided by the mempool library to fix [Bug 1052]
> > > > > without
> > > > a
> > > > > performance regression.
> > > > >
> > > > > [Bug 1052]: https://bugs.dpdk.org/show_bug.cgi?id=1052
> > > > >
> > > > >
> > > > > This RFC offers a conceptual zero-copy put function, where the
> > > > application
> > > > > promises to store some objects, and in return gets an address
> > where
> > > > to store
> > > > > them.
> > > > >
> > > > > I would like some early feedback.
> > > > >
> > > > > Notes:
> > > > > * Allowing the 'cache' parameter to be NULL, and getting it from
> > the
> > > > > mempool instead, was inspired by rte_mempool_cache_flush().
> > > > I am not sure why the 'cache' parameter is required for this API.
> > This
> > > > API should take the mem pool as the parameter.
> > > >
> > > > We have based our API on 'rte_mempool_do_generic_put' and removed
> > > the
> > > > 'cache' parameter.
> > >
> > > I thoroughly considered omitting the 'cache' parameter, but included
> > it for
> > > two reasons:
> > >
> > > 1. The function is a "mempool cache" function (i.e. primarily
> > > working
> > on the
> > > mempool cache), not a "mempool" function.
> > >
> > > So it is appropriate to have a pointer directly to the structure it
> > is working on.
> > > Following this through, I also made 'cache' the first parameter and
> > 'mp' the
> > > second, like in rte_mempool_cache_flush().
> > I am wondering if the PMD should be aware of the cache or not. For ex:
> > in the case of pipeline mode, the RX and TX side of the PMD are
> > running on different cores.
>
> In that example, the PMD can store two cache pointers, one for each of the
> RX and TX side.
I did not understand this. If RX core and TX core have their own per-core caches the logic would not work. For ex: the RX core cache would not get filled.
In the case of pipeline mode, there will not be a per-core cache. The buffers would be allocated and freed from a global ring or a global lockless stack.
>
> And if the PMD is unaware of the cache pointer, it can look it up at runtime
> using rte_lcore_id(), like it does in the current Intel PMDs.
>
> > However, since the rte_mempool_cache_flush API is provided, may be
> > that decision is already done? Interestingly, rte_mempool_cache_flush
> > is called by just a single PMD.
>
> I intentionally aligned this RFC with rte_mempool_cache_flush() to maintain
> consistency.
>
> However, the API is not set in stone. It should always be acceptable to
> consider improved alternatives.
>
> >
> > So, the question is, should we allow zero-copy only for per-core cache
> > or for other cases as well.
>
> I suppose that the mempool library was designed to have a mempool
> associated with exactly one mempool cache per core. (Alternatively, the
> mempool can be configured with no mempool caches at all.)
>
> We should probably stay loyal to that design concept, and only allow zero-
> copy for per-core cache.
>
> If you can come up with an example of the opposite, I would like to explore
> that option too... I can't think of a good example myself, and perhaps I'm
> overlooking a relevant use case.
The use case I am talking about is the pipeline mode as I mentioned above. Let me know if you agree.
>
> >
> > >
> > > 2. In most cases, the function only accesses the mempool structure
> > > in
> > order to
> > > get the cache pointer. Skipping this step improves performance.
> > >
> > > And since the cache is created along with the mempool itself (and
> > thus never
> > > changes for a mempool), it would be safe for the PMD to store the
> > 'cache'
> > > pointer along with the 'mp' pointer in the PMD's queue structure.
> > Agreed
> >
> > >
> > > E.g. in the i40e PMD the i40e_rx_queue structure could include a
> > "struct
> > > rte_mempool_cache *cache" field, which could be used
> > > i40e_rxq_rearm()
> > [1]
> > > instead of "cache = rte_mempool_default_cache(rxq->mp,
> > rte_lcore_id())".
> > >
> > > [1] https://elixir.bootlin.com/dpdk/v22.11-
> > > rc2/source/drivers/net/i40e/i40e_rxtx_vec_avx512.c#L31
> > >
> > > > This new API, on success, returns the pointer to memory where the
> > > > objects are copied. On failure it returns NULL and the caller has
> > to
> > > > call 'rte_mempool_ops_enqueue_bulk'. Alternatively, the new API
> > could
> > > > do this as well and PMD does not need to do anything if it gets a
> > NULL
> > > > pointer.
> > >
> > > Yes, we agree about these two details:
> > >
> > > 1. The function should return a pointer, not an integer.
> > > It would be a waste to use a another CPU register to convey a
> > success/error
> > > integer value, when the success/failure information is just as
> > > easily
> > conveyed
> > > by the pointer return value (non-NULL/NULL), and rte_errno for
> > various error
> > > values in the unlikely cases.
> > >
> > > 2. The function should leave it up to the PMD what to do if direct
> > access to
> > > the cache is unavailable.
> > Just wondering about the advantage of this. I do not think PMD's have
> > much of a choice other than calling 'rte_mempool_ops_enqueue_bulk'
>
> I agree, but that was not my point. Let me try to rephrase:
>
> The PMD is more likely to know how to efficiently build the array of mbufs to
> pass to rte_mempool_ops_enqueue_bulk() than the mempool library - many
> PMDs already implement a variety of vector instruction variants to do exactly
> that. So we should not try to be clever and add a fallback path - this job
> belongs in the PMD.
>
> The PMD might not even have the array of mbufs lined up when calling
> rte_mempool_cache_put_bulk_promise(). The PMD could have an array of
> internal structures, where the mbuf pointer is an element in that structure.
Agree, you are correct. We should leave it to PMD to handle the failure case.
>
> >
> > >
> > > >
> > > > We should think about providing similar API on the RX side to
> > > > keep
> > it
> > > > symmetric.
> > >
> > > I sent an RFC for that too:
> > >
> http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D87488@
> > > smartserver.smartshare.dk/T/#u
> > >
> > >
> > > >
> > > > > * Asserting that the 'mp' parameter is not NULL is not done by
> > other
> > > > > functions, so I omitted it here too.
> > > > >
> > > > > NB: Please ignore formatting. Also, this code has not even been
> > > > compile
> > > > > tested.
> > > > We are little bit ahead, tested the changes with i40e PF PMD,
> > > > wrote unit test cases, going through internal review, will send
> > > > out RFC
> > on
> > > > Monday
> > >
> > > Sounds good. Looking forward to review.
> > >
> > > >
> > > > >
> > > > > /**
> > > > > * Promise to put objects in a mempool via zero-copy access to a
> > > > user-owned
> > > > > mempool cache.
> > > > > *
> > > > > * @param cache
> > > > > * A pointer to the mempool cache.
> > > > > * @param mp
> > > > > * A pointer to the mempool.
> > > > > * @param n
> > > > > * The number of objects to be put in the mempool cache.
> > > > > * @return
> > > > > * The pointer to where to put the objects in the mempool
> > cache.
> > > > > * NULL on error
> > > > > * with rte_errno set appropriately.
> > > > > */
> > > > > static __rte_always_inline void *
> > > > > rte_mempool_cache_put_bulk_promise(struct rte_mempool_cache
> > > *cache,
> > > > > struct rte_mempool *mp,
> > > > > unsigned int n)
> > > > > {
> > > > > void **cache_objs;
> > > > >
> > > > > if (cache == NULL)
> > > > > cache = rte_mempool_default_cache(mp, rte_lcore_id());
> > Any reason we need this? If we are expecting the PMD to store the
> > pointer to cache and a NULL is passed, it would mean it is a mempool
> > with no per-core cache?
> > We could also leave the NULL check to the PMD.
>
> Personally, I would strongly prefer requiring the cache pointer to be valid,
> and use RTE_ASSERT() here, instead of allowing a NULL pointer as a special
> case to look it up inside the function. I consider this special NULL case useless
> bloat, which does not belong in a fast path library function.
>
> But I copied this approach from rte_mempool_cache_flush().
The API definition does not bind it to do this check. We might be able to delete the check in rte_mempool_cache_flush.
>
> We could expose an "unsafe" function where is not allowed to pass NULL
> pointers, and a "safe" function (fixing the cache pointer if NULL) for
> consistency.
>
> If the rte_mempool_cache_flush() function is popular, we could also expose
> an "unsafe" variant where passing NULL pointers are disallowed.
>
> I wonder if there are any examples of such safe/unsafe variants in DPDK? It
> would be nice with a common naming convention for such function variants.
>
> >
> > > > > if (cache == NULL) {
> > > > > rte_errno = EINVAL;
> > > > > return NULL;
> > > > > }
> > > > >
> > > > > rte_mempool_trace_cache_put_bulk_promise(cache, mp, n);
> > > > >
> > > > > /* The request itself is too big for the cache */
> > > > > if (unlikely(n > cache->flushthresh)) {
> > > > > rte_errno = EINVAL;
> > > > > return NULL;
> > > > > }
> > > > >
> > > > > /*
> > > > > * The cache follows the following algorithm:
> > > > > * 1. If the objects cannot be added to the cache without
> > > > crossing
> > > > > * the flush threshold, flush the cache to the backend.
> > > > > * 2. Add the objects to the cache.
> > > > > */
> > > > >
> > > > > if (cache->len + n <= cache->flushthresh) {
> > > > > cache_objs = &cache->objs[cache->len];
> > > > > cache->len += n;
> > > > > } else {
> > > > > cache_objs = &cache->objs[0];
> > > > > rte_mempool_ops_enqueue_bulk(mp, cache_objs, cache->len);
> > > > > cache->len = n;
> > > > > }
> > > > >
> > > > > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_bulk, 1);
> > > > > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, n);
> > These are new stats. Do these break ABI compatibility (though these
> > are under DEBUG flag)?
>
> They are not mempool cache stats, they are only kept in the cache structure
> to provide alternative (i.e. faster) update access to some (i.e. the most often
> updated) of the existing mempool stats. The patch is [1], and part of a series
> currently being discussed if should go into 22.11-rc3 or not [2].
>
> [1]:
> https://patchwork.dpdk.org/project/dpdk/patch/20221109181852.109856-3-
> mb@smartsharesystems.com/
> [2]:
> http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D874A6
> @smartserver.smartshare.dk/T/#m41bf4e8bd886db49f11c8dbd63741b35327
> 7082f
>
> >
> > > > >
> > > > > return cache_objs;
> > > > > }
> > > > >
> > > > >
> > > > > Med venlig hilsen / Kind regards, -Morten Brørup
> > > > >
> > > >
> >
^ permalink raw reply [relevance 0%]
* RE: [RFC] mempool: zero-copy cache put bulk
2022-11-09 17:57 3% ` Honnappa Nagarahalli
@ 2022-11-09 20:36 0% ` Morten Brørup
2022-11-09 22:45 0% ` Honnappa Nagarahalli
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-11-09 20:36 UTC (permalink / raw)
To: Honnappa Nagarahalli, dev, olivier.matz, andrew.rybchenko,
Kamalakshitha Aligeri, Bruce Richardson
Cc: nd
+To: Bruce also showed interest in this topic, and might have more insights.
> From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com]
> Sent: Wednesday, 9 November 2022 18.58
>
> <snip>
>
> >
> > > From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com]
> > > Sent: Sunday, 6 November 2022 00.11
> > >
> > > + Akshitha, she is working on similar patch
> > >
> > > Few comments inline
> > >
> > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > Sent: Saturday, November 5, 2022 8:40 AM
> > > >
> > > > Zero-copy access to the mempool cache is beneficial for PMD
> > > performance,
> > > > and must be provided by the mempool library to fix [Bug 1052]
> > > > without
> > > a
> > > > performance regression.
> > > >
> > > > [Bug 1052]: https://bugs.dpdk.org/show_bug.cgi?id=1052
> > > >
> > > >
> > > > This RFC offers a conceptual zero-copy put function, where the
> > > application
> > > > promises to store some objects, and in return gets an address
> where
> > > to store
> > > > them.
> > > >
> > > > I would like some early feedback.
> > > >
> > > > Notes:
> > > > * Allowing the 'cache' parameter to be NULL, and getting it from
> the
> > > > mempool instead, was inspired by rte_mempool_cache_flush().
> > > I am not sure why the 'cache' parameter is required for this API.
> This
> > > API should take the mem pool as the parameter.
> > >
> > > We have based our API on 'rte_mempool_do_generic_put' and removed
> > the
> > > 'cache' parameter.
> >
> > I thoroughly considered omitting the 'cache' parameter, but included
> it for
> > two reasons:
> >
> > 1. The function is a "mempool cache" function (i.e. primarily working
> on the
> > mempool cache), not a "mempool" function.
> >
> > So it is appropriate to have a pointer directly to the structure it
> is working on.
> > Following this through, I also made 'cache' the first parameter and
> 'mp' the
> > second, like in rte_mempool_cache_flush().
> I am wondering if the PMD should be aware of the cache or not. For ex:
> in the case of pipeline mode, the RX and TX side of the PMD are running
> on different cores.
In that example, the PMD can store two cache pointers, one for each of the RX and TX side.
And if the PMD is unaware of the cache pointer, it can look it up at runtime using rte_lcore_id(), like it does in the current Intel PMDs.
> However, since the rte_mempool_cache_flush API is provided, may be that
> decision is already done? Interestingly, rte_mempool_cache_flush is
> called by just a single PMD.
I intentionally aligned this RFC with rte_mempool_cache_flush() to maintain consistency.
However, the API is not set in stone. It should always be acceptable to consider improved alternatives.
>
> So, the question is, should we allow zero-copy only for per-core cache
> or for other cases as well.
I suppose that the mempool library was designed to have a mempool associated with exactly one mempool cache per core. (Alternatively, the mempool can be configured with no mempool caches at all.)
We should probably stay loyal to that design concept, and only allow zero-copy for per-core cache.
If you can come up with an example of the opposite, I would like to explore that option too... I can't think of a good example myself, and perhaps I'm overlooking a relevant use case.
>
> >
> > 2. In most cases, the function only accesses the mempool structure in
> order to
> > get the cache pointer. Skipping this step improves performance.
> >
> > And since the cache is created along with the mempool itself (and
> thus never
> > changes for a mempool), it would be safe for the PMD to store the
> 'cache'
> > pointer along with the 'mp' pointer in the PMD's queue structure.
> Agreed
>
> >
> > E.g. in the i40e PMD the i40e_rx_queue structure could include a
> "struct
> > rte_mempool_cache *cache" field, which could be used i40e_rxq_rearm()
> [1]
> > instead of "cache = rte_mempool_default_cache(rxq->mp,
> rte_lcore_id())".
> >
> > [1] https://elixir.bootlin.com/dpdk/v22.11-
> > rc2/source/drivers/net/i40e/i40e_rxtx_vec_avx512.c#L31
> >
> > > This new API, on success, returns the pointer to memory where the
> > > objects are copied. On failure it returns NULL and the caller has
> to
> > > call 'rte_mempool_ops_enqueue_bulk'. Alternatively, the new API
> could
> > > do this as well and PMD does not need to do anything if it gets a
> NULL
> > > pointer.
> >
> > Yes, we agree about these two details:
> >
> > 1. The function should return a pointer, not an integer.
> > It would be a waste to use a another CPU register to convey a
> success/error
> > integer value, when the success/failure information is just as easily
> conveyed
> > by the pointer return value (non-NULL/NULL), and rte_errno for
> various error
> > values in the unlikely cases.
> >
> > 2. The function should leave it up to the PMD what to do if direct
> access to
> > the cache is unavailable.
> Just wondering about the advantage of this. I do not think PMD's have
> much of a choice other than calling 'rte_mempool_ops_enqueue_bulk'
I agree, but that was not my point. Let me try to rephrase:
The PMD is more likely to know how to efficiently build the array of mbufs to pass to rte_mempool_ops_enqueue_bulk() than the mempool library - many PMDs already implement a variety of vector instruction variants to do exactly that. So we should not try to be clever and add a fallback path - this job belongs in the PMD.
The PMD might not even have the array of mbufs lined up when calling rte_mempool_cache_put_bulk_promise(). The PMD could have an array of internal structures, where the mbuf pointer is an element in that structure.
>
> >
> > >
> > > We should think about providing similar API on the RX side to keep
> it
> > > symmetric.
> >
> > I sent an RFC for that too:
> > http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D87488@
> > smartserver.smartshare.dk/T/#u
> >
> >
> > >
> > > > * Asserting that the 'mp' parameter is not NULL is not done by
> other
> > > > functions, so I omitted it here too.
> > > >
> > > > NB: Please ignore formatting. Also, this code has not even been
> > > compile
> > > > tested.
> > > We are little bit ahead, tested the changes with i40e PF PMD, wrote
> > > unit test cases, going through internal review, will send out RFC
> on
> > > Monday
> >
> > Sounds good. Looking forward to review.
> >
> > >
> > > >
> > > > /**
> > > > * Promise to put objects in a mempool via zero-copy access to a
> > > user-owned
> > > > mempool cache.
> > > > *
> > > > * @param cache
> > > > * A pointer to the mempool cache.
> > > > * @param mp
> > > > * A pointer to the mempool.
> > > > * @param n
> > > > * The number of objects to be put in the mempool cache.
> > > > * @return
> > > > * The pointer to where to put the objects in the mempool
> cache.
> > > > * NULL on error
> > > > * with rte_errno set appropriately.
> > > > */
> > > > static __rte_always_inline void *
> > > > rte_mempool_cache_put_bulk_promise(struct rte_mempool_cache
> > *cache,
> > > > struct rte_mempool *mp,
> > > > unsigned int n)
> > > > {
> > > > void **cache_objs;
> > > >
> > > > if (cache == NULL)
> > > > cache = rte_mempool_default_cache(mp, rte_lcore_id());
> Any reason we need this? If we are expecting the PMD to store the
> pointer to cache and a NULL is passed, it would mean it is a mempool
> with no per-core cache?
> We could also leave the NULL check to the PMD.
Personally, I would strongly prefer requiring the cache pointer to be valid, and use RTE_ASSERT() here, instead of allowing a NULL pointer as a special case to look it up inside the function. I consider this special NULL case useless bloat, which does not belong in a fast path library function.
But I copied this approach from rte_mempool_cache_flush().
We could expose an "unsafe" function where is not allowed to pass NULL pointers, and a "safe" function (fixing the cache pointer if NULL) for consistency.
If the rte_mempool_cache_flush() function is popular, we could also expose an "unsafe" variant where passing NULL pointers are disallowed.
I wonder if there are any examples of such safe/unsafe variants in DPDK? It would be nice with a common naming convention for such function variants.
>
> > > > if (cache == NULL) {
> > > > rte_errno = EINVAL;
> > > > return NULL;
> > > > }
> > > >
> > > > rte_mempool_trace_cache_put_bulk_promise(cache, mp, n);
> > > >
> > > > /* The request itself is too big for the cache */
> > > > if (unlikely(n > cache->flushthresh)) {
> > > > rte_errno = EINVAL;
> > > > return NULL;
> > > > }
> > > >
> > > > /*
> > > > * The cache follows the following algorithm:
> > > > * 1. If the objects cannot be added to the cache without
> > > crossing
> > > > * the flush threshold, flush the cache to the backend.
> > > > * 2. Add the objects to the cache.
> > > > */
> > > >
> > > > if (cache->len + n <= cache->flushthresh) {
> > > > cache_objs = &cache->objs[cache->len];
> > > > cache->len += n;
> > > > } else {
> > > > cache_objs = &cache->objs[0];
> > > > rte_mempool_ops_enqueue_bulk(mp, cache_objs, cache->len);
> > > > cache->len = n;
> > > > }
> > > >
> > > > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_bulk, 1);
> > > > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, n);
> These are new stats. Do these break ABI compatibility (though these are
> under DEBUG flag)?
They are not mempool cache stats, they are only kept in the cache structure to provide alternative (i.e. faster) update access to some (i.e. the most often updated) of the existing mempool stats. The patch is [1], and part of a series currently being discussed if should go into 22.11-rc3 or not [2].
[1]: https://patchwork.dpdk.org/project/dpdk/patch/20221109181852.109856-3-mb@smartsharesystems.com/
[2]: http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D874A6@smartserver.smartshare.dk/T/#m41bf4e8bd886db49f11c8dbd63741b353277082f
>
> > > >
> > > > return cache_objs;
> > > > }
> > > >
> > > >
> > > > Med venlig hilsen / Kind regards,
> > > > -Morten Brørup
> > > >
> > >
>
^ permalink raw reply [relevance 0%]
* RE: [RFC] mempool: zero-copy cache put bulk
@ 2022-11-09 17:57 3% ` Honnappa Nagarahalli
2022-11-09 20:36 0% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Honnappa Nagarahalli @ 2022-11-09 17:57 UTC (permalink / raw)
To: Morten Brørup, dev, olivier.matz, andrew.rybchenko,
Kamalakshitha Aligeri
Cc: nd, nd
<snip>
>
> > From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com]
> > Sent: Sunday, 6 November 2022 00.11
> >
> > + Akshitha, she is working on similar patch
> >
> > Few comments inline
> >
> > > From: Morten Brørup <mb@smartsharesystems.com>
> > > Sent: Saturday, November 5, 2022 8:40 AM
> > >
> > > Zero-copy access to the mempool cache is beneficial for PMD
> > performance,
> > > and must be provided by the mempool library to fix [Bug 1052]
> > > without
> > a
> > > performance regression.
> > >
> > > [Bug 1052]: https://bugs.dpdk.org/show_bug.cgi?id=1052
> > >
> > >
> > > This RFC offers a conceptual zero-copy put function, where the
> > application
> > > promises to store some objects, and in return gets an address where
> > to store
> > > them.
> > >
> > > I would like some early feedback.
> > >
> > > Notes:
> > > * Allowing the 'cache' parameter to be NULL, and getting it from the
> > > mempool instead, was inspired by rte_mempool_cache_flush().
> > I am not sure why the 'cache' parameter is required for this API. This
> > API should take the mem pool as the parameter.
> >
> > We have based our API on 'rte_mempool_do_generic_put' and removed
> the
> > 'cache' parameter.
>
> I thoroughly considered omitting the 'cache' parameter, but included it for
> two reasons:
>
> 1. The function is a "mempool cache" function (i.e. primarily working on the
> mempool cache), not a "mempool" function.
>
> So it is appropriate to have a pointer directly to the structure it is working on.
> Following this through, I also made 'cache' the first parameter and 'mp' the
> second, like in rte_mempool_cache_flush().
I am wondering if the PMD should be aware of the cache or not. For ex: in the case of pipeline mode, the RX and TX side of the PMD are running on different cores.
However, since the rte_mempool_cache_flush API is provided, may be that decision is already done? Interestingly, rte_mempool_cache_flush is called by just a single PMD.
So, the question is, should we allow zero-copy only for per-core cache or for other cases as well.
>
> 2. In most cases, the function only accesses the mempool structure in order to
> get the cache pointer. Skipping this step improves performance.
>
> And since the cache is created along with the mempool itself (and thus never
> changes for a mempool), it would be safe for the PMD to store the 'cache'
> pointer along with the 'mp' pointer in the PMD's queue structure.
Agreed
>
> E.g. in the i40e PMD the i40e_rx_queue structure could include a "struct
> rte_mempool_cache *cache" field, which could be used i40e_rxq_rearm() [1]
> instead of "cache = rte_mempool_default_cache(rxq->mp, rte_lcore_id())".
>
> [1] https://elixir.bootlin.com/dpdk/v22.11-
> rc2/source/drivers/net/i40e/i40e_rxtx_vec_avx512.c#L31
>
> > This new API, on success, returns the pointer to memory where the
> > objects are copied. On failure it returns NULL and the caller has to
> > call 'rte_mempool_ops_enqueue_bulk'. Alternatively, the new API could
> > do this as well and PMD does not need to do anything if it gets a NULL
> > pointer.
>
> Yes, we agree about these two details:
>
> 1. The function should return a pointer, not an integer.
> It would be a waste to use a another CPU register to convey a success/error
> integer value, when the success/failure information is just as easily conveyed
> by the pointer return value (non-NULL/NULL), and rte_errno for various error
> values in the unlikely cases.
>
> 2. The function should leave it up to the PMD what to do if direct access to
> the cache is unavailable.
Just wondering about the advantage of this. I do not think PMD's have much of a choice other than calling 'rte_mempool_ops_enqueue_bulk'
>
> >
> > We should think about providing similar API on the RX side to keep it
> > symmetric.
>
> I sent an RFC for that too:
> http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D87488@
> smartserver.smartshare.dk/T/#u
>
>
> >
> > > * Asserting that the 'mp' parameter is not NULL is not done by other
> > > functions, so I omitted it here too.
> > >
> > > NB: Please ignore formatting. Also, this code has not even been
> > compile
> > > tested.
> > We are little bit ahead, tested the changes with i40e PF PMD, wrote
> > unit test cases, going through internal review, will send out RFC on
> > Monday
>
> Sounds good. Looking forward to review.
>
> >
> > >
> > > /**
> > > * Promise to put objects in a mempool via zero-copy access to a
> > user-owned
> > > mempool cache.
> > > *
> > > * @param cache
> > > * A pointer to the mempool cache.
> > > * @param mp
> > > * A pointer to the mempool.
> > > * @param n
> > > * The number of objects to be put in the mempool cache.
> > > * @return
> > > * The pointer to where to put the objects in the mempool cache.
> > > * NULL on error
> > > * with rte_errno set appropriately.
> > > */
> > > static __rte_always_inline void *
> > > rte_mempool_cache_put_bulk_promise(struct rte_mempool_cache
> *cache,
> > > struct rte_mempool *mp,
> > > unsigned int n)
> > > {
> > > void **cache_objs;
> > >
> > > if (cache == NULL)
> > > cache = rte_mempool_default_cache(mp, rte_lcore_id());
Any reason we need this? If we are expecting the PMD to store the pointer to cache and a NULL is passed, it would mean it is a mempool with no per-core cache?
We could also leave the NULL check to the PMD.
> > > if (cache == NULL) {
> > > rte_errno = EINVAL;
> > > return NULL;
> > > }
> > >
> > > rte_mempool_trace_cache_put_bulk_promise(cache, mp, n);
> > >
> > > /* The request itself is too big for the cache */
> > > if (unlikely(n > cache->flushthresh)) {
> > > rte_errno = EINVAL;
> > > return NULL;
> > > }
> > >
> > > /*
> > > * The cache follows the following algorithm:
> > > * 1. If the objects cannot be added to the cache without
> > crossing
> > > * the flush threshold, flush the cache to the backend.
> > > * 2. Add the objects to the cache.
> > > */
> > >
> > > if (cache->len + n <= cache->flushthresh) {
> > > cache_objs = &cache->objs[cache->len];
> > > cache->len += n;
> > > } else {
> > > cache_objs = &cache->objs[0];
> > > rte_mempool_ops_enqueue_bulk(mp, cache_objs, cache->len);
> > > cache->len = n;
> > > }
> > >
> > > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_bulk, 1);
> > > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, n);
These are new stats. Do these break ABI compatibility (though these are under DEBUG flag)?
> > >
> > > return cache_objs;
> > > }
> > >
> > >
> > > Med venlig hilsen / Kind regards,
> > > -Morten Brørup
> > >
> >
^ permalink raw reply [relevance 3%]
* RE: FW: [PATCH v4 3/3] mempool: use cache for frequently updated stats
2022-11-09 10:19 4% ` Konstantin Ananyev
@ 2022-11-09 11:42 0% ` Morten Brørup
0 siblings, 0 replies; 200+ results
From: Morten Brørup @ 2022-11-09 11:42 UTC (permalink / raw)
To: Konstantin Ananyev, Mattias Rönnblom, Bruce Richardson,
Thomas Monjalon
Cc: andrew.rybchenko, olivier.matz, david.marchand, dev, hofors,
stephen, jerinj
> From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> Sent: Wednesday, 9 November 2022 11.20
>
> > On 2022-11-09 06:03, Morten Brørup wrote:
> > >> From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> > >> Sent: Tuesday, 8 November 2022 18.38
> > >>>
> > >>> On Tue, Nov 08, 2022 at 04:51:11PM +0100, Thomas Monjalon wrote:
> > >>>> 08/11/2022 15:30, Morten Brørup:
> > >>>>>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > >>>>>> 08/11/2022 12:25, Morten Brørup:
> > >>>>>>> From: Morten Brørup
> > >>>>>>>> From: Konstantin Ananyev
> > >> [mailto:konstantin.ananyev@huawei.com]
> > >>>>>>>> Sent: Tuesday, 8 November 2022 10.20
> > >>>>>>>>> +#ifdef RTE_LIBRTE_MEMPOOL_STATS
> > >>>>>>>>> +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n)
> > >> (cache)-
> > >>>>>>> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-
> 313273af-454445555731-27a859e7ec13035a&q=1&e=a120e28e-
> > caa7-4783-9686-5868c871553d&u=http%3A%2F%2Fstats.name%2F += n
> > >>>>>>>>
> > >>>>>>>> As Andrew already pointed, it needs to be: ((cache)-
> > >>> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-
> 454445555731-27a859e7ec13035a&q=1&e=a120e28e-caa7-
> > 4783-9686-5868c871553d&u=http%3A%2F%2Fstats.name%2F +=
> > >>>>>> (n))
> > >>>>>>>> Apart from that, LGTM.
> > >>>>>>>> Series-Acked-by: Konstantin Ananyev
> > >> <konstantin.ananyev@huawei.com>
> > >>>>>>>
> > >>>>>>> @Thomas, this series should be ready to apply... it now has
> > >> been:
> > >>>>>>> Reviewed-by: (mempool maintainer) Andrew Rybchenko
> > >>>>>> <andrew.rybchenko@oktetlabs.ru>
> > >>>>>>> Reviewed-By: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > >>>>>>> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > >>>>>>
> > >>>>>> Being acked does not mean it is good to apply in -rc3.
> > >>>>>
> > >>>>> I understand that the RFC/v1 of this series was formally too
> late
> > >> to make it in 22.11, so I will not complain loudly if you choose
> to
> > >>> omit it for 22.11.
> > >>>>>
> > >>>>> With two independent reviews, including from a mempool
> > >> maintainer, I still have some hope. Also considering the risk
> > >> assessment
> > >>> below. ;-)
> > >>>>>
> > >>>>>> Please tell what is the benefit for 22.11 (before/after and
> > >> condition).
> > >>>>>
> > >>>>> Short version: With this series, mempool statistics can be used
> > >> in production. Without it, the performance cost
> > >>> (mempool_perf_autotest: -74 %) is prohibitive!
> > >>>>>
> > >>>>> Long version:
> > >>>>>
> > >>>>> The patch series provides significantly higher performance for
> > >> mempool statistics, which are readable through
> > >>> rte_mempool_dump(FILE *f, struct rte_mempool *mp).
> > >>>>>
> > >>>>> Without this series, you have to set RTE_LIBRTE_MEMPOOL_DEBUG
> at
> > >> build time to get mempool statistics.
> > >>> RTE_LIBRTE_MEMPOOL_DEBUG also enables protective cookies before
> and
> > >> after each mempool object, which are all verified on
> > >>> get/put from the mempool. According to mempool_perf_autotest, the
> > >> performance cost of mempool statistics (by setting
> > >>> RTE_LIBRTE_MEMPOOL_DEBUG) is a 74 % decrease in rate_persec for
> > >> mempools with cache (i.e. mbuf pools). Prohibitive for use in
> > >>> production!
> > >>>>>
> > >>>>> With this series, the performance cost of mempool statistics
> (by
> > >> setting RTE_LIBRTE_MEMPOOL_STATS) in
> > >>> mempool_perf_autotest is only 6.7 %, so mempool statistics can be
> > >> used in production.
> > >>>>>
> > >>>>>> Note there is a real risk doing such change that late.
> > >>>>>
> > >>>>> Risk assessment:
> > >>>>>
> > >>>>> The patch series has zero effect unless either
> > >> RTE_LIBRTE_MEMPOOL_DEBUG or RTE_LIBRTE_MEMPOOL_STATS are set when
> > >>> building. They are not set in the default build.
> > >>>>
> > >>>> If theses build flags are not set, there is no risk and no
> benefit.
> > >>>> But if they are set, there is a risk of regression,
> > >>>> for the benefit of an increased performance of a debug feature.
> > >>>> I would say it is better to avoid any functional regression in a
> > >> debug feature
> > >>>> at this stage.
> > >>>> Any other opinion?
> > >>>>
> > >>> While I agree that we should avoid any functional regression, I
> > >> wonder how
> > >>> widely used the debug feature is, and how big the risk of a
> > >> regression is?
> > >>> Even if there is one, having a regression in a debug feature is a
> lot
> > >> less
> > >>> serious than having one in something which goes into production.
> > >>>
> > >>
> > >> Unless it introduces an ABI breakage (as I understand it doesn't),
> I'll
> > >> wait till 23.03.
> > >> Just in case.
> > >
> > > If built (both before and after this series) without
> RTE_LIBRTE_MEMPOOL_DEBUG (and without RTE_LIBRTE_MEMPOOL_STATS,
> > which is introduced by the series), there is no ABI breakage.
> > >
> > > If built (both before and after this series) with
> RTE_LIBRTE_MEMPOOL_DEBUG (and without RTE_LIBRTE_MEMPOOL_STATS), the
> > ABI differs between before and after this series: The stats array
> disappears from struct rte_mempool, and the output from
> > rte_mempool_dump() does not include the statistics.
> > >
>
> Can we probably always enable RTE_LIBRTE_MEMPOOL_STATS when
> RTE_LIBRTE_MEMPOOL_DEBUG is on?
That would fix the rte_mempool_dump() API breakage, yes.
But since it's only a partial fix, I don't think we should do it.
>
> > > If built (both before and after this series) with
> RTE_LIBRTE_MEMPOOL_DEBUG (and with RTE_LIBRTE_MEMPOOL_STATS), the ABI
> > also differs between before and after this series: The size of the
> stats array in struct rte_mempool grows by one element.
>
> Ah yes, missed that one.
> So the question is then - does it count as formal ABI breakage or not?
Yes, this is a key question!
However, performance improvements are not accepted as LTS patches, so not including it in -rc3 will make it useless until 23.11. (At least for users deploying only LTS releases.)
> If yes, then probably better to go ahead with these changes for 22.11
> (it sounds too prohibitive to wait for an year here).
> Or at least take in the part that introduce the ABI breakage.
Without the 3rd patch in the series, the performance is not fully optimized. (Remember: Only relevant when built with RTE_LIBRTE_MEMPOOL_STATS.)
> If not, probably not bit deal to wait till 23.03.
>
> > >> BTW, as a side thought - if the impact is really that small now,
> would
> > >> it make sense to make
> > >> it run-time option, instead of compile-time one?
> > >
> > > The mempool get/put functions are very lean when built without
> STATS or DEBUG. With a runtime option, the resulting code would
> > be slightly longer, and only one additional conditional would be hit
> in the common case (i.e. when the objects don't miss the mempool
> > cache). So with stats disabled (at runtime), it would only add a very
> small performance cost. However, checking the value of the
> > enabled/disabled variable can cause a CPU cache miss, which has a
> performance cost. And the enabled/disabled variable should
> > definitely be global - if it is per mempool, it will cause many CPU
> cache misses (because the common case doesn't touch the mempool
> > structure, only the mempool cache structure).
> > >
>
> Yes, either a global one, or put it into both structs:
> rte_mempool_cache and rte_mempool.
That is doable. There is room for it in rte_mempool_cache, and it can be a flag in rte_mempool.
>
> > It's not totally obvious that a conditional is better than just
> always
> > performing these simple arithmetic operations, even if you don't know
> if
> > you need the result (i.e., if stats is enabled or not), especially
> since
> > they operate on a cache line that is very likely already owned by the
> > core running the core (since the 'len' fields is frequently used).
>
> Yep, that's another option - always update the cache part.
Yes, always updating the rte_mempool_cache stats to avoid the conditional in the likely code path seems like a viable concept.
(And for now, we can ignore that 64 bit stats are somewhat more costly on 32 bit architectures if tearing must be avoided. I say that we can ignore it for now, because this kind of tearing is ignored for 64 bit stats everywhere in DPDK, so it should be ignorable here too.)
>
> > > Also, checking the runtime option should have unlikely(), so the
> performance cost of the stats (when enabled at runtime) is also
> > higher than with a build time option. (Yes, dynamic branch prediction
> will alleviate most of this, but it will consume entries in the
> > branch predictor table - these are inlined functions. Just like we
> always try to avoid cache misses in DPDK, we should also try to
> > conserve branch predictor table entries. I hate the argument that
> branch prediction fixes conditionals, especially if they are weird or
> > could have been avoided.)
> > >
> > > In the cost/benefit analysis, we need to consider that these
> statistics are not fill/emptiness level status or similar, but only
> debug
> > counters (number of get/put transactions and objects), so we need to
> ask ourselves this question: How many users are interested in
> > these statistics for production and are unable to build their
> application with RTE_LIBRTE_MEMPOOL_STATS?
>
> Obviously, I don't have such stats.
> From my perspective - I am ok to spend few extra cycles to avoid
> building separate binary.
> Again, I guess that with global switch the impact will be negligible.
> But anyway, it will require even more changes and another ABI breakage
> (as stats should always be included),
> so it definitely out of scope for this release.
Agree. This series can be tweaked further, as the discussion clearly shows.
However, time is about to run out on. If we want to include it 22.11, we should take it into -rc3 without any of the discussed modifications (except fixing the macro to satisfy checkpatch).
Furthermore, the discussed modifications - various ways of handling a runtime option - will introduce some performance degradation with the default build configuration. Regardless how small we think the performance degradation is, I would hesitate to introduce a performance degradation in -rc3.
The current patch series has zero performance effect with the default build configuration.
>
> > > For example, we (SmartShare Systems) are only interested in them
> for application profiling purposes... trying to improve the
> > performance by striving for a higher number of objects per burst in
> every pipeline stage.
> > >
> > >> Konstantin
^ permalink raw reply [relevance 0%]
* RE: FW: [PATCH v4 3/3] mempool: use cache for frequently updated stats
2022-11-09 8:21 0% ` Mattias Rönnblom
@ 2022-11-09 10:19 4% ` Konstantin Ananyev
2022-11-09 11:42 0% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Konstantin Ananyev @ 2022-11-09 10:19 UTC (permalink / raw)
To: Mattias Rönnblom, Morten Brørup, Bruce Richardson,
Thomas Monjalon
Cc: andrew.rybchenko, olivier.matz, david.marchand, dev, hofors,
stephen, jerinj
> On 2022-11-09 06:03, Morten Brørup wrote:
> >> From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> >> Sent: Tuesday, 8 November 2022 18.38
> >>>
> >>> On Tue, Nov 08, 2022 at 04:51:11PM +0100, Thomas Monjalon wrote:
> >>>> 08/11/2022 15:30, Morten Brørup:
> >>>>>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> >>>>>> 08/11/2022 12:25, Morten Brørup:
> >>>>>>> From: Morten Brørup
> >>>>>>>> From: Konstantin Ananyev
> >> [mailto:konstantin.ananyev@huawei.com]
> >>>>>>>> Sent: Tuesday, 8 November 2022 10.20
> >>>>>>>>> +#ifdef RTE_LIBRTE_MEMPOOL_STATS
> >>>>>>>>> +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n)
> >> (cache)-
> >>>>>>> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-27a859e7ec13035a&q=1&e=a120e28e-
> caa7-4783-9686-5868c871553d&u=http%3A%2F%2Fstats.name%2F += n
> >>>>>>>>
> >>>>>>>> As Andrew already pointed, it needs to be: ((cache)-
> >>> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-27a859e7ec13035a&q=1&e=a120e28e-caa7-
> 4783-9686-5868c871553d&u=http%3A%2F%2Fstats.name%2F +=
> >>>>>> (n))
> >>>>>>>> Apart from that, LGTM.
> >>>>>>>> Series-Acked-by: Konstantin Ananyev
> >> <konstantin.ananyev@huawei.com>
> >>>>>>>
> >>>>>>> @Thomas, this series should be ready to apply... it now has
> >> been:
> >>>>>>> Reviewed-by: (mempool maintainer) Andrew Rybchenko
> >>>>>> <andrew.rybchenko@oktetlabs.ru>
> >>>>>>> Reviewed-By: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> >>>>>>> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> >>>>>>
> >>>>>> Being acked does not mean it is good to apply in -rc3.
> >>>>>
> >>>>> I understand that the RFC/v1 of this series was formally too late
> >> to make it in 22.11, so I will not complain loudly if you choose to
> >>> omit it for 22.11.
> >>>>>
> >>>>> With two independent reviews, including from a mempool
> >> maintainer, I still have some hope. Also considering the risk
> >> assessment
> >>> below. ;-)
> >>>>>
> >>>>>> Please tell what is the benefit for 22.11 (before/after and
> >> condition).
> >>>>>
> >>>>> Short version: With this series, mempool statistics can be used
> >> in production. Without it, the performance cost
> >>> (mempool_perf_autotest: -74 %) is prohibitive!
> >>>>>
> >>>>> Long version:
> >>>>>
> >>>>> The patch series provides significantly higher performance for
> >> mempool statistics, which are readable through
> >>> rte_mempool_dump(FILE *f, struct rte_mempool *mp).
> >>>>>
> >>>>> Without this series, you have to set RTE_LIBRTE_MEMPOOL_DEBUG at
> >> build time to get mempool statistics.
> >>> RTE_LIBRTE_MEMPOOL_DEBUG also enables protective cookies before and
> >> after each mempool object, which are all verified on
> >>> get/put from the mempool. According to mempool_perf_autotest, the
> >> performance cost of mempool statistics (by setting
> >>> RTE_LIBRTE_MEMPOOL_DEBUG) is a 74 % decrease in rate_persec for
> >> mempools with cache (i.e. mbuf pools). Prohibitive for use in
> >>> production!
> >>>>>
> >>>>> With this series, the performance cost of mempool statistics (by
> >> setting RTE_LIBRTE_MEMPOOL_STATS) in
> >>> mempool_perf_autotest is only 6.7 %, so mempool statistics can be
> >> used in production.
> >>>>>
> >>>>>> Note there is a real risk doing such change that late.
> >>>>>
> >>>>> Risk assessment:
> >>>>>
> >>>>> The patch series has zero effect unless either
> >> RTE_LIBRTE_MEMPOOL_DEBUG or RTE_LIBRTE_MEMPOOL_STATS are set when
> >>> building. They are not set in the default build.
> >>>>
> >>>> If theses build flags are not set, there is no risk and no benefit.
> >>>> But if they are set, there is a risk of regression,
> >>>> for the benefit of an increased performance of a debug feature.
> >>>> I would say it is better to avoid any functional regression in a
> >> debug feature
> >>>> at this stage.
> >>>> Any other opinion?
> >>>>
> >>> While I agree that we should avoid any functional regression, I
> >> wonder how
> >>> widely used the debug feature is, and how big the risk of a
> >> regression is?
> >>> Even if there is one, having a regression in a debug feature is a lot
> >> less
> >>> serious than having one in something which goes into production.
> >>>
> >>
> >> Unless it introduces an ABI breakage (as I understand it doesn't), I'll
> >> wait till 23.03.
> >> Just in case.
> >
> > If built (both before and after this series) without RTE_LIBRTE_MEMPOOL_DEBUG (and without RTE_LIBRTE_MEMPOOL_STATS,
> which is introduced by the series), there is no ABI breakage.
> >
> > If built (both before and after this series) with RTE_LIBRTE_MEMPOOL_DEBUG (and without RTE_LIBRTE_MEMPOOL_STATS), the
> ABI differs between before and after this series: The stats array disappears from struct rte_mempool, and the output from
> rte_mempool_dump() does not include the statistics.
> >
Can we probably always enable RTE_LIBRTE_MEMPOOL_STATS when RTE_LIBRTE_MEMPOOL_DEBUG is on?
> > If built (both before and after this series) with RTE_LIBRTE_MEMPOOL_DEBUG (and with RTE_LIBRTE_MEMPOOL_STATS), the ABI
> also differs between before and after this series: The size of the stats array in struct rte_mempool grows by one element.
Ah yes, missed that one.
So the question is then - does it count as formal ABI breakage or not?
If yes, then probably better to go ahead with these changes for 22.11
(it sounds too prohibitive to wait for an year here).
Or at least take in the part that introduce the ABI breakage.
If not, probably not bit deal to wait till 23.03.
> >> BTW, as a side thought - if the impact is really that small now, would
> >> it make sense to make
> >> it run-time option, instead of compile-time one?
> >
> > The mempool get/put functions are very lean when built without STATS or DEBUG. With a runtime option, the resulting code would
> be slightly longer, and only one additional conditional would be hit in the common case (i.e. when the objects don't miss the mempool
> cache). So with stats disabled (at runtime), it would only add a very small performance cost. However, checking the value of the
> enabled/disabled variable can cause a CPU cache miss, which has a performance cost. And the enabled/disabled variable should
> definitely be global - if it is per mempool, it will cause many CPU cache misses (because the common case doesn't touch the mempool
> structure, only the mempool cache structure).
> >
Yes, either a global one, or put it into both structs: rte_mempool_cache and rte_mempool.
> It's not totally obvious that a conditional is better than just always
> performing these simple arithmetic operations, even if you don't know if
> you need the result (i.e., if stats is enabled or not), especially since
> they operate on a cache line that is very likely already owned by the
> core running the core (since the 'len' fields is frequently used).
Yep, that's another option - always update the cache part.
> > Also, checking the runtime option should have unlikely(), so the performance cost of the stats (when enabled at runtime) is also
> higher than with a build time option. (Yes, dynamic branch prediction will alleviate most of this, but it will consume entries in the
> branch predictor table - these are inlined functions. Just like we always try to avoid cache misses in DPDK, we should also try to
> conserve branch predictor table entries. I hate the argument that branch prediction fixes conditionals, especially if they are weird or
> could have been avoided.)
> >
> > In the cost/benefit analysis, we need to consider that these statistics are not fill/emptiness level status or similar, but only debug
> counters (number of get/put transactions and objects), so we need to ask ourselves this question: How many users are interested in
> these statistics for production and are unable to build their application with RTE_LIBRTE_MEMPOOL_STATS?
Obviously, I don't have such stats.
From my perspective - I am ok to spend few extra cycles to avoid building separate binary.
Again, I guess that with global switch the impact will be negligible.
But anyway, it will require even more changes and another ABI breakage (as stats should always be included),
so it definitely out of scope for this release.
> > For example, we (SmartShare Systems) are only interested in them for application profiling purposes... trying to improve the
> performance by striving for a higher number of objects per burst in every pipeline stage.
> >
> >> Konstantin
^ permalink raw reply [relevance 4%]
* Re: FW: [PATCH v4 3/3] mempool: use cache for frequently updated stats
2022-11-09 5:03 4% ` Morten Brørup
@ 2022-11-09 8:21 0% ` Mattias Rönnblom
2022-11-09 10:19 4% ` Konstantin Ananyev
0 siblings, 1 reply; 200+ results
From: Mattias Rönnblom @ 2022-11-09 8:21 UTC (permalink / raw)
To: Morten Brørup, Konstantin Ananyev, Bruce Richardson,
Thomas Monjalon
Cc: andrew.rybchenko, olivier.matz, david.marchand, dev, hofors,
stephen, jerinj
On 2022-11-09 06:03, Morten Brørup wrote:
>> From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
>> Sent: Tuesday, 8 November 2022 18.38
>>>
>>> On Tue, Nov 08, 2022 at 04:51:11PM +0100, Thomas Monjalon wrote:
>>>> 08/11/2022 15:30, Morten Brørup:
>>>>>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
>>>>>> 08/11/2022 12:25, Morten Brørup:
>>>>>>> From: Morten Brørup
>>>>>>>> From: Konstantin Ananyev
>> [mailto:konstantin.ananyev@huawei.com]
>>>>>>>> Sent: Tuesday, 8 November 2022 10.20
>>>>>>>>> +#ifdef RTE_LIBRTE_MEMPOOL_STATS
>>>>>>>>> +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n)
>> (cache)-
>>>>>>> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-27a859e7ec13035a&q=1&e=a120e28e-caa7-4783-9686-5868c871553d&u=http%3A%2F%2Fstats.name%2F += n
>>>>>>>>
>>>>>>>> As Andrew already pointed, it needs to be: ((cache)-
>>> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-27a859e7ec13035a&q=1&e=a120e28e-caa7-4783-9686-5868c871553d&u=http%3A%2F%2Fstats.name%2F +=
>>>>>> (n))
>>>>>>>> Apart from that, LGTM.
>>>>>>>> Series-Acked-by: Konstantin Ananyev
>> <konstantin.ananyev@huawei.com>
>>>>>>>
>>>>>>> @Thomas, this series should be ready to apply... it now has
>> been:
>>>>>>> Reviewed-by: (mempool maintainer) Andrew Rybchenko
>>>>>> <andrew.rybchenko@oktetlabs.ru>
>>>>>>> Reviewed-By: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
>>>>>>> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
>>>>>>
>>>>>> Being acked does not mean it is good to apply in -rc3.
>>>>>
>>>>> I understand that the RFC/v1 of this series was formally too late
>> to make it in 22.11, so I will not complain loudly if you choose to
>>> omit it for 22.11.
>>>>>
>>>>> With two independent reviews, including from a mempool
>> maintainer, I still have some hope. Also considering the risk
>> assessment
>>> below. ;-)
>>>>>
>>>>>> Please tell what is the benefit for 22.11 (before/after and
>> condition).
>>>>>
>>>>> Short version: With this series, mempool statistics can be used
>> in production. Without it, the performance cost
>>> (mempool_perf_autotest: -74 %) is prohibitive!
>>>>>
>>>>> Long version:
>>>>>
>>>>> The patch series provides significantly higher performance for
>> mempool statistics, which are readable through
>>> rte_mempool_dump(FILE *f, struct rte_mempool *mp).
>>>>>
>>>>> Without this series, you have to set RTE_LIBRTE_MEMPOOL_DEBUG at
>> build time to get mempool statistics.
>>> RTE_LIBRTE_MEMPOOL_DEBUG also enables protective cookies before and
>> after each mempool object, which are all verified on
>>> get/put from the mempool. According to mempool_perf_autotest, the
>> performance cost of mempool statistics (by setting
>>> RTE_LIBRTE_MEMPOOL_DEBUG) is a 74 % decrease in rate_persec for
>> mempools with cache (i.e. mbuf pools). Prohibitive for use in
>>> production!
>>>>>
>>>>> With this series, the performance cost of mempool statistics (by
>> setting RTE_LIBRTE_MEMPOOL_STATS) in
>>> mempool_perf_autotest is only 6.7 %, so mempool statistics can be
>> used in production.
>>>>>
>>>>>> Note there is a real risk doing such change that late.
>>>>>
>>>>> Risk assessment:
>>>>>
>>>>> The patch series has zero effect unless either
>> RTE_LIBRTE_MEMPOOL_DEBUG or RTE_LIBRTE_MEMPOOL_STATS are set when
>>> building. They are not set in the default build.
>>>>
>>>> If theses build flags are not set, there is no risk and no benefit.
>>>> But if they are set, there is a risk of regression,
>>>> for the benefit of an increased performance of a debug feature.
>>>> I would say it is better to avoid any functional regression in a
>> debug feature
>>>> at this stage.
>>>> Any other opinion?
>>>>
>>> While I agree that we should avoid any functional regression, I
>> wonder how
>>> widely used the debug feature is, and how big the risk of a
>> regression is?
>>> Even if there is one, having a regression in a debug feature is a lot
>> less
>>> serious than having one in something which goes into production.
>>>
>>
>> Unless it introduces an ABI breakage (as I understand it doesn't), I'll
>> wait till 23.03.
>> Just in case.
>
> If built (both before and after this series) without RTE_LIBRTE_MEMPOOL_DEBUG (and without RTE_LIBRTE_MEMPOOL_STATS, which is introduced by the series), there is no ABI breakage.
>
> If built (both before and after this series) with RTE_LIBRTE_MEMPOOL_DEBUG (and without RTE_LIBRTE_MEMPOOL_STATS), the ABI differs between before and after this series: The stats array disappears from struct rte_mempool, and the output from rte_mempool_dump() does not include the statistics.
>
> If built (both before and after this series) with RTE_LIBRTE_MEMPOOL_DEBUG (and with RTE_LIBRTE_MEMPOOL_STATS), the ABI also differs between before and after this series: The size of the stats array in struct rte_mempool grows by one element.
>
>> BTW, as a side thought - if the impact is really that small now, would
>> it make sense to make
>> it run-time option, instead of compile-time one?
>
> The mempool get/put functions are very lean when built without STATS or DEBUG. With a runtime option, the resulting code would be slightly longer, and only one additional conditional would be hit in the common case (i.e. when the objects don't miss the mempool cache). So with stats disabled (at runtime), it would only add a very small performance cost. However, checking the value of the enabled/disabled variable can cause a CPU cache miss, which has a performance cost. And the enabled/disabled variable should definitely be global - if it is per mempool, it will cause many CPU cache misses (because the common case doesn't touch the mempool structure, only the mempool cache structure).
>
It's not totally obvious that a conditional is better than just always
performing these simple arithmetic operations, even if you don't know if
you need the result (i.e., if stats is enabled or not), especially since
they operate on a cache line that is very likely already owned by the
core running the core (since the 'len' fields is frequently used).
> Also, checking the runtime option should have unlikely(), so the performance cost of the stats (when enabled at runtime) is also higher than with a build time option. (Yes, dynamic branch prediction will alleviate most of this, but it will consume entries in the branch predictor table - these are inlined functions. Just like we always try to avoid cache misses in DPDK, we should also try to conserve branch predictor table entries. I hate the argument that branch prediction fixes conditionals, especially if they are weird or could have been avoided.)
>
> In the cost/benefit analysis, we need to consider that these statistics are not fill/emptiness level status or similar, but only debug counters (number of get/put transactions and objects), so we need to ask ourselves this question: How many users are interested in these statistics for production and are unable to build their application with RTE_LIBRTE_MEMPOOL_STATS?
>
> For example, we (SmartShare Systems) are only interested in them for application profiling purposes... trying to improve the performance by striving for a higher number of objects per burst in every pipeline stage.
>
>> Konstantin
^ permalink raw reply [relevance 0%]
* RE: FW: [PATCH v4 3/3] mempool: use cache for frequently updated stats
2022-11-08 17:38 3% ` Konstantin Ananyev
@ 2022-11-09 5:03 4% ` Morten Brørup
2022-11-09 8:21 0% ` Mattias Rönnblom
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-11-09 5:03 UTC (permalink / raw)
To: Konstantin Ananyev, Bruce Richardson, Thomas Monjalon
Cc: andrew.rybchenko, olivier.matz, david.marchand, dev, hofors,
mattias.ronnblom, stephen, jerinj
> From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> Sent: Tuesday, 8 November 2022 18.38
> >
> > On Tue, Nov 08, 2022 at 04:51:11PM +0100, Thomas Monjalon wrote:
> > > 08/11/2022 15:30, Morten Brørup:
> > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > 08/11/2022 12:25, Morten Brørup:
> > > > > > From: Morten Brørup
> > > > > > > From: Konstantin Ananyev
> [mailto:konstantin.ananyev@huawei.com]
> > > > > > > Sent: Tuesday, 8 November 2022 10.20
> > > > > > > > +#ifdef RTE_LIBRTE_MEMPOOL_STATS
> > > > > > > > +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n)
> (cache)-
> > > > > >stats.name += n
> > > > > > >
> > > > > > > As Andrew already pointed, it needs to be: ((cache)-
> >stats.name +=
> > > > > (n))
> > > > > > > Apart from that, LGTM.
> > > > > > > Series-Acked-by: Konstantin Ananyev
> <konstantin.ananyev@huawei.com>
> > > > > >
> > > > > > @Thomas, this series should be ready to apply... it now has
> been:
> > > > > > Reviewed-by: (mempool maintainer) Andrew Rybchenko
> > > > > <andrew.rybchenko@oktetlabs.ru>
> > > > > > Reviewed-By: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > > > > Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > > > >
> > > > > Being acked does not mean it is good to apply in -rc3.
> > > >
> > > > I understand that the RFC/v1 of this series was formally too late
> to make it in 22.11, so I will not complain loudly if you choose to
> > omit it for 22.11.
> > > >
> > > > With two independent reviews, including from a mempool
> maintainer, I still have some hope. Also considering the risk
> assessment
> > below. ;-)
> > > >
> > > > > Please tell what is the benefit for 22.11 (before/after and
> condition).
> > > >
> > > > Short version: With this series, mempool statistics can be used
> in production. Without it, the performance cost
> > (mempool_perf_autotest: -74 %) is prohibitive!
> > > >
> > > > Long version:
> > > >
> > > > The patch series provides significantly higher performance for
> mempool statistics, which are readable through
> > rte_mempool_dump(FILE *f, struct rte_mempool *mp).
> > > >
> > > > Without this series, you have to set RTE_LIBRTE_MEMPOOL_DEBUG at
> build time to get mempool statistics.
> > RTE_LIBRTE_MEMPOOL_DEBUG also enables protective cookies before and
> after each mempool object, which are all verified on
> > get/put from the mempool. According to mempool_perf_autotest, the
> performance cost of mempool statistics (by setting
> > RTE_LIBRTE_MEMPOOL_DEBUG) is a 74 % decrease in rate_persec for
> mempools with cache (i.e. mbuf pools). Prohibitive for use in
> > production!
> > > >
> > > > With this series, the performance cost of mempool statistics (by
> setting RTE_LIBRTE_MEMPOOL_STATS) in
> > mempool_perf_autotest is only 6.7 %, so mempool statistics can be
> used in production.
> > > >
> > > > > Note there is a real risk doing such change that late.
> > > >
> > > > Risk assessment:
> > > >
> > > > The patch series has zero effect unless either
> RTE_LIBRTE_MEMPOOL_DEBUG or RTE_LIBRTE_MEMPOOL_STATS are set when
> > building. They are not set in the default build.
> > >
> > > If theses build flags are not set, there is no risk and no benefit.
> > > But if they are set, there is a risk of regression,
> > > for the benefit of an increased performance of a debug feature.
> > > I would say it is better to avoid any functional regression in a
> debug feature
> > > at this stage.
> > > Any other opinion?
> > >
> > While I agree that we should avoid any functional regression, I
> wonder how
> > widely used the debug feature is, and how big the risk of a
> regression is?
> > Even if there is one, having a regression in a debug feature is a lot
> less
> > serious than having one in something which goes into production.
> >
>
> Unless it introduces an ABI breakage (as I understand it doesn't), I'll
> wait till 23.03.
> Just in case.
If built (both before and after this series) without RTE_LIBRTE_MEMPOOL_DEBUG (and without RTE_LIBRTE_MEMPOOL_STATS, which is introduced by the series), there is no ABI breakage.
If built (both before and after this series) with RTE_LIBRTE_MEMPOOL_DEBUG (and without RTE_LIBRTE_MEMPOOL_STATS), the ABI differs between before and after this series: The stats array disappears from struct rte_mempool, and the output from rte_mempool_dump() does not include the statistics.
If built (both before and after this series) with RTE_LIBRTE_MEMPOOL_DEBUG (and with RTE_LIBRTE_MEMPOOL_STATS), the ABI also differs between before and after this series: The size of the stats array in struct rte_mempool grows by one element.
> BTW, as a side thought - if the impact is really that small now, would
> it make sense to make
> it run-time option, instead of compile-time one?
The mempool get/put functions are very lean when built without STATS or DEBUG. With a runtime option, the resulting code would be slightly longer, and only one additional conditional would be hit in the common case (i.e. when the objects don't miss the mempool cache). So with stats disabled (at runtime), it would only add a very small performance cost. However, checking the value of the enabled/disabled variable can cause a CPU cache miss, which has a performance cost. And the enabled/disabled variable should definitely be global - if it is per mempool, it will cause many CPU cache misses (because the common case doesn't touch the mempool structure, only the mempool cache structure).
Also, checking the runtime option should have unlikely(), so the performance cost of the stats (when enabled at runtime) is also higher than with a build time option. (Yes, dynamic branch prediction will alleviate most of this, but it will consume entries in the branch predictor table - these are inlined functions. Just like we always try to avoid cache misses in DPDK, we should also try to conserve branch predictor table entries. I hate the argument that branch prediction fixes conditionals, especially if they are weird or could have been avoided.)
In the cost/benefit analysis, we need to consider that these statistics are not fill/emptiness level status or similar, but only debug counters (number of get/put transactions and objects), so we need to ask ourselves this question: How many users are interested in these statistics for production and are unable to build their application with RTE_LIBRTE_MEMPOOL_STATS?
For example, we (SmartShare Systems) are only interested in them for application profiling purposes... trying to improve the performance by striving for a higher number of objects per burst in every pipeline stage.
> Konstantin
^ permalink raw reply [relevance 4%]
* RE: FW: [PATCH v4 3/3] mempool: use cache for frequently updated stats
@ 2022-11-08 17:38 3% ` Konstantin Ananyev
2022-11-09 5:03 4% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Konstantin Ananyev @ 2022-11-08 17:38 UTC (permalink / raw)
To: Bruce Richardson, Thomas Monjalon
Cc: Morten Brørup, andrew.rybchenko, olivier.matz,
david.marchand, dev, hofors, mattias.ronnblom, stephen, jerinj
>
> On Tue, Nov 08, 2022 at 04:51:11PM +0100, Thomas Monjalon wrote:
> > 08/11/2022 15:30, Morten Brørup:
> > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > 08/11/2022 12:25, Morten Brørup:
> > > > > From: Morten Brørup
> > > > > > From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> > > > > > Sent: Tuesday, 8 November 2022 10.20
> > > > > > > +#ifdef RTE_LIBRTE_MEMPOOL_STATS
> > > > > > > +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n) (cache)-
> > > > >stats.name += n
> > > > > >
> > > > > > As Andrew already pointed, it needs to be: ((cache)->stats.name +=
> > > > (n))
> > > > > > Apart from that, LGTM.
> > > > > > Series-Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > > > >
> > > > > @Thomas, this series should be ready to apply... it now has been:
> > > > > Reviewed-by: (mempool maintainer) Andrew Rybchenko
> > > > <andrew.rybchenko@oktetlabs.ru>
> > > > > Reviewed-By: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > > > Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > > >
> > > > Being acked does not mean it is good to apply in -rc3.
> > >
> > > I understand that the RFC/v1 of this series was formally too late to make it in 22.11, so I will not complain loudly if you choose to
> omit it for 22.11.
> > >
> > > With two independent reviews, including from a mempool maintainer, I still have some hope. Also considering the risk assessment
> below. ;-)
> > >
> > > > Please tell what is the benefit for 22.11 (before/after and condition).
> > >
> > > Short version: With this series, mempool statistics can be used in production. Without it, the performance cost
> (mempool_perf_autotest: -74 %) is prohibitive!
> > >
> > > Long version:
> > >
> > > The patch series provides significantly higher performance for mempool statistics, which are readable through
> rte_mempool_dump(FILE *f, struct rte_mempool *mp).
> > >
> > > Without this series, you have to set RTE_LIBRTE_MEMPOOL_DEBUG at build time to get mempool statistics.
> RTE_LIBRTE_MEMPOOL_DEBUG also enables protective cookies before and after each mempool object, which are all verified on
> get/put from the mempool. According to mempool_perf_autotest, the performance cost of mempool statistics (by setting
> RTE_LIBRTE_MEMPOOL_DEBUG) is a 74 % decrease in rate_persec for mempools with cache (i.e. mbuf pools). Prohibitive for use in
> production!
> > >
> > > With this series, the performance cost of mempool statistics (by setting RTE_LIBRTE_MEMPOOL_STATS) in
> mempool_perf_autotest is only 6.7 %, so mempool statistics can be used in production.
> > >
> > > > Note there is a real risk doing such change that late.
> > >
> > > Risk assessment:
> > >
> > > The patch series has zero effect unless either RTE_LIBRTE_MEMPOOL_DEBUG or RTE_LIBRTE_MEMPOOL_STATS are set when
> building. They are not set in the default build.
> >
> > If theses build flags are not set, there is no risk and no benefit.
> > But if they are set, there is a risk of regression,
> > for the benefit of an increased performance of a debug feature.
> > I would say it is better to avoid any functional regression in a debug feature
> > at this stage.
> > Any other opinion?
> >
> While I agree that we should avoid any functional regression, I wonder how
> widely used the debug feature is, and how big the risk of a regression is?
> Even if there is one, having a regression in a debug feature is a lot less
> serious than having one in something which goes into production.
>
Unless it introduces an ABI breakage (as I understand it doesn't), I'll wait till 23.03.
Just in case.
BTW, as a side thought - if the impact is really that small now, would it make sense to make
it run-time option, instead of compile-time one?
Konstantin
^ permalink raw reply [relevance 3%]
* [PATCH 2/2] devtools: stop depending on libabigail xml format
2022-11-03 15:47 9% [PATCH 0/2] ABI check updates David Marchand
2022-11-03 15:47 21% ` [PATCH 1/2] devtools: unify configuration for ABI check David Marchand
@ 2022-11-03 15:47 41% ` David Marchand
1 sibling, 0 replies; 200+ results
From: David Marchand @ 2022-11-03 15:47 UTC (permalink / raw)
To: dev; +Cc: thomas, ci, Aaron Conole, Michael Santana, Bruce Richardson
A ABI reference depends on:
- DPDK build options,
- toolchain compiler and versions,
- libabigail version.
The reason for the latter point is that, when the ABI reference was
generated, ABI xml files were dumped in a format depending on the
libabigail version.
Those xml files were then later used to compare against modified
code.
There are a few disadvantages with this method:
- since the xml files are dependent on the libabigail version, when
updating CI environments, a change in the libabigail package requires
regenerating the ABI references,
- comparing xml files with abidiff is not well tested, as we (DPDK)
uncovered bugs in libabigail that were not hit with comparing .so,
Switch to comparing .so directly, remove this dependence and update GHA
script.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
.ci/linux-build.sh | 4 ----
.github/workflows/build.yml | 2 +-
MAINTAINERS | 1 -
devtools/check-abi.sh | 15 ++++++++-------
devtools/gen-abi.sh | 26 --------------------------
devtools/test-meson-builds.sh | 5 -----
6 files changed, 9 insertions(+), 44 deletions(-)
delete mode 100755 devtools/gen-abi.sh
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index baec65a914..ce91b0af04 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -143,8 +143,6 @@ fi
if [ "$ABI_CHECKS" = "true" ]; then
if [ "$(cat libabigail/VERSION 2>/dev/null)" != "$LIBABIGAIL_VERSION" ]; then
rm -rf libabigail
- # if we change libabigail, invalidate existing abi cache
- rm -rf reference
fi
if [ ! -d libabigail ]; then
@@ -166,7 +164,6 @@ if [ "$ABI_CHECKS" = "true" ]; then
meson $OPTS -Dexamples= $refsrcdir $refsrcdir/build
ninja -C $refsrcdir/build
DESTDIR=$(pwd)/reference ninja -C $refsrcdir/build install
- devtools/gen-abi.sh reference
find reference/usr/local -name '*.a' -delete
rm -rf reference/usr/local/bin
rm -rf reference/usr/local/share
@@ -174,7 +171,6 @@ if [ "$ABI_CHECKS" = "true" ]; then
fi
DESTDIR=$(pwd)/install ninja -C build install
- devtools/gen-abi.sh install
devtools/check-abi.sh reference install ${ABI_CHECKS_WARN_ONLY:-}
fi
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a595c12354..b23f8805cb 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -71,7 +71,7 @@ jobs:
echo -n '::set-output name=libabigail::'
echo 'libabigail-${{ matrix.config.os }}'
echo -n '::set-output name=abi::'
- echo 'abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.LIBABIGAIL_VERSION }}-${{ env.REF_GIT_TAG }}'
+ echo 'abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.REF_GIT_TAG }}'
- name: Retrieve ccache cache
uses: actions/cache@v2
with:
diff --git a/MAINTAINERS b/MAINTAINERS
index 1c9922123e..9bafec37e7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -90,7 +90,6 @@ F: devtools/check-spdx-tag.sh
F: devtools/check-symbol-change.sh
F: devtools/check-symbol-maps.sh
F: devtools/checkpatches.sh
-F: devtools/gen-abi.sh
F: devtools/get-maintainer.sh
F: devtools/git-log-fixes.sh
F: devtools/load-devel-config
diff --git a/devtools/check-abi.sh b/devtools/check-abi.sh
index b1bf633f2a..078de43629 100755
--- a/devtools/check-abi.sh
+++ b/devtools/check-abi.sh
@@ -35,21 +35,22 @@ else
fi
error=
-for dump in $(find $refdir -name "*.dump"); do
- name=$(basename $dump)
- if grep -q "; SKIP_LIBRARY=${name%.dump}\>" $(dirname $0)/libabigail.abignore; then
+for lib in $(find $refdir -name "*.so.*" -a ! -type l); do
+ name=$(basename $lib)
+ if grep -q "; SKIP_LIBRARY=${name%.so.*}\>" $(dirname $0)/libabigail.abignore; then
echo "Skipped $name" >&2
continue
fi
- dump2=$(find $newdir -name $name)
- if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
+ # Look for a library with the same major ABI version
+ lib2=$(find $newdir -name "${name%.*}.*" -a ! -type l)
+ if [ -z "$lib2" ] || [ ! -e "$lib2" ]; then
echo "Error: cannot find $name in $newdir" >&2
error=1
continue
fi
- abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
+ abidiff $ABIDIFF_OPTIONS $lib $lib2 || {
abiret=$?
- echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
+ echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $lib $lib2'" >&2
error=1
echo
if [ $(($abiret & 3)) -ne 0 ]; then
diff --git a/devtools/gen-abi.sh b/devtools/gen-abi.sh
deleted file mode 100755
index f15a3b9aaf..0000000000
--- a/devtools/gen-abi.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh -e
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright (c) 2019 Red Hat, Inc.
-
-if [ $# != 1 ]; then
- echo "Usage: $0 installdir" >&2
- exit 1
-fi
-
-installdir=$1
-if [ ! -d $installdir ]; then
- echo "Error: install directory '$installdir' does not exist." >&2
- exit 1
-fi
-
-dumpdir=$installdir/dump
-rm -rf $dumpdir
-mkdir -p $dumpdir
-for f in $(find $installdir -name "*.so.*"); do
- if test -L $f; then
- continue
- fi
-
- libname=$(basename $f)
- abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 3a308bc9af..971650e621 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -188,7 +188,6 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
-Dexamples= $*
compile $abirefdir/build
install_target $abirefdir/build $abirefdir/$targetdir
- $srcdir/devtools/gen-abi.sh $abirefdir/$targetdir
# save disk space by removing static libs and apps
find $abirefdir/$targetdir/usr/local -name '*.a' -delete
@@ -199,10 +198,6 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
install_target $builds_dir/$targetdir \
$(readlink -f $builds_dir/$targetdir/install)
echo "Checking ABI compatibility of $targetdir" >&$verbose
- echo $srcdir/devtools/gen-abi.sh \
- $(readlink -f $builds_dir/$targetdir/install) >&$veryverbose
- $srcdir/devtools/gen-abi.sh \
- $(readlink -f $builds_dir/$targetdir/install) >&$veryverbose
echo $srcdir/devtools/check-abi.sh $abirefdir/$targetdir \
$(readlink -f $builds_dir/$targetdir/install) >&$veryverbose
$srcdir/devtools/check-abi.sh $abirefdir/$targetdir \
--
2.38.1
^ permalink raw reply [relevance 41%]
* [PATCH 1/2] devtools: unify configuration for ABI check
2022-11-03 15:47 9% [PATCH 0/2] ABI check updates David Marchand
@ 2022-11-03 15:47 21% ` David Marchand
2022-11-03 15:47 41% ` [PATCH 2/2] devtools: stop depending on libabigail xml format David Marchand
1 sibling, 0 replies; 200+ results
From: David Marchand @ 2022-11-03 15:47 UTC (permalink / raw)
To: dev; +Cc: thomas, ci
We have been skipping removed libraries in the ABI check by updating the
check-abi.sh script itself.
See, for example, commit 33584c19ddc2 ("raw/dpaa2_qdma: remove driver").
Having two places for exception is a bit confusing, and those exceptions
are best placed in a single configuration file out of the check script.
Besides, a next patch will switch the check from comparing ABI xml files
to directly comparing .so files. In this mode, libabigail does not
support the soname_regexp syntax used for the mlx glue libraries.
Let's handle these special cases in libabigail.abignore using comments.
Taking the raw/dpaa2_qdma driver as an example, it would be possible to
skip it by adding:
; SKIP_LIBRARY=librte_net_mlx4_glue
+; SKIP_LIBRARY=librte_raw_dpaa2_qdma
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
devtools/check-abi.sh | 4 ++++
devtools/libabigail.abignore | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/devtools/check-abi.sh b/devtools/check-abi.sh
index c583eae2fd..b1bf633f2a 100755
--- a/devtools/check-abi.sh
+++ b/devtools/check-abi.sh
@@ -37,6 +37,10 @@ fi
error=
for dump in $(find $refdir -name "*.dump"); do
name=$(basename $dump)
+ if grep -q "; SKIP_LIBRARY=${name%.dump}\>" $(dirname $0)/libabigail.abignore; then
+ echo "Skipped $name" >&2
+ continue
+ fi
dump2=$(find $newdir -name $name)
if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
echo "Error: cannot find $name in $newdir" >&2
diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
index 7a93de3ba1..3ff51509de 100644
--- a/devtools/libabigail.abignore
+++ b/devtools/libabigail.abignore
@@ -16,9 +16,15 @@
[suppress_variable]
name_regexp = _pmd_info$
-; Ignore changes on soname for mlx glue internal drivers
-[suppress_file]
- soname_regexp = ^librte_.*mlx.*glue\.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Special rules to skip libraries ;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;
+; This is not a libabigail rule (see check-abi.sh).
+; This is used for driver removal and other special cases like mlx glue libs.
+;
+; SKIP_LIBRARY=librte_common_mlx5_glue
+; SKIP_LIBRARY=librte_net_mlx4_glue
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Experimental APIs exceptions ;
--
2.38.1
^ permalink raw reply [relevance 21%]
* [PATCH 0/2] ABI check updates
@ 2022-11-03 15:47 9% David Marchand
2022-11-03 15:47 21% ` [PATCH 1/2] devtools: unify configuration for ABI check David Marchand
2022-11-03 15:47 41% ` [PATCH 2/2] devtools: stop depending on libabigail xml format David Marchand
0 siblings, 2 replies; 200+ results
From: David Marchand @ 2022-11-03 15:47 UTC (permalink / raw)
To: dev; +Cc: thomas, ci
This series moves ABI exceptions in a single configuration file and
simplifies the ABI check so that no artefact depending on libabigail
version is stored in the CI.
--
David Marchand
David Marchand (2):
devtools: unify configuration for ABI check
devtools: stop depending on libabigail xml format
.ci/linux-build.sh | 4 ----
.github/workflows/build.yml | 2 +-
MAINTAINERS | 1 -
devtools/check-abi.sh | 17 +++++++++++------
devtools/gen-abi.sh | 26 --------------------------
devtools/libabigail.abignore | 12 +++++++++---
devtools/test-meson-builds.sh | 5 -----
7 files changed, 21 insertions(+), 46 deletions(-)
delete mode 100755 devtools/gen-abi.sh
--
2.38.1
^ permalink raw reply [relevance 9%]
* Re: [PATCH v2 3/3] mempool: use cache for frequently updated statistics
2022-11-02 9:29 4% ` Morten Brørup
@ 2022-11-02 17:55 0% ` Mattias Rönnblom
0 siblings, 0 replies; 200+ results
From: Mattias Rönnblom @ 2022-11-02 17:55 UTC (permalink / raw)
To: Morten Brørup, olivier.matz, andrew.rybchenko, stephen,
jerinj, bruce.richardson, thomas
Cc: dev
On 2022-11-02 10:29, Morten Brørup wrote:
>> From: Mattias Rönnblom [mailto:hofors@lysator.liu.se]
>> Sent: Wednesday, 2 November 2022 09.01
>>
>> On 2022-10-31 12:26, Morten Brørup wrote:
>
> [...]
>
>>> +++ b/lib/mempool/rte_mempool.h
>>> @@ -86,6 +86,21 @@ struct rte_mempool_cache {
>>> uint32_t size; /**< Size of the cache */
>>> uint32_t flushthresh; /**< Threshold before we flush excess
>> elements */
>>> uint32_t len; /**< Current cache count */
>>> + uint32_t unused0;
>>> +#ifdef RTE_LIBRTE_MEMPOOL_STATS
>>> + /*
>>> + * Alternative location for the most frequently updated mempool
>> statistics (per-lcore),
>>> + * providing faster update access when using a mempool cache.
>>> + */
>>> + struct {
>>> + uint64_t put_bulk; /**< Number of puts. */
>>> + uint64_t put_objs; /**< Number of objects
>> successfully put. */
>>> + uint64_t get_success_bulk; /**< Successful allocation
>> number. */
>>> + uint64_t get_success_objs; /**< Objects successfully
>> allocated. */
>>> + } stats; /**< Statistics */
>>> +#else
>>> + uint64_t unused1[4];
>>
>> Are a particular DPDK version supposed to be ABI compatible with
>> itself,
>> with different configuration options? E.g., with and without
>> RTE_LIBRTE_MEMPOOL_STATS. Is that why you have those 4 unused
>> uint64_ts?
>
> Valid point: There was no ABI compatibility between with and without RTE_LIBRTE_MEMPOOL_STATS before this patch, so there is no need to add partial ABI compatibility here.
>
> The #else part of this structure should be removed.
>
> Does anyone disagree?
>
>>> +#endif
>
I have no opinion on that matter, but I have another question: if you
remove 'unused1', should you also remove the unused0 field?
^ permalink raw reply [relevance 0%]
* RE: [EXT] Re: [PATCH] cryptodev: add missing algorithm strings
2022-11-02 12:13 4% ` David Marchand
@ 2022-11-02 12:31 0% ` Akhil Goyal
0 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-11-02 12:31 UTC (permalink / raw)
To: David Marchand
Cc: Kevin Traynor, Volodymyr Fialko, dev, Ravi Kumar, Ali Alnubani,
Jerin Jacob Kollanukkaran, Anoob Joseph, Thomas Monjalon
> Subject: Re: [EXT] Re: [PATCH] cryptodev: add missing algorithm strings
>
> On Wed, Nov 2, 2022 at 11:58 AM Akhil Goyal <gakhil@marvell.com> wrote:
> > > This is being flagged as an ABI break for 21.11.3 [1]. I don't see it
> > > mentioned in the commit message or discussed, is it ok for main branch?
> >
> > Ok, we can keep it to main only.
> > But it will be an issue on 21.11.
> >
> > >
> > > Thanks to Ali for reporting. I will revert on 21.11 branch.
> > >
> > > [1]
> > > 1 Changed variable:
> > >
> > > [C] 'const char* rte_crypto_auth_algorithm_strings[]' was changed at
> > > rte_crypto_sym.h:372:1:
> > > size of symbol changed from 168 to 232
>
> My two cents.
>
> We have a algo "string to num" helper (rte_cryptodev_get_auth_algo_enum).
>
> This code is not performance sensitive, is it?
> If we add the, opposite, "num to string" helper, we can hide the
> rte_crypto_auth_algorithm_strings symbol from the public ABI and avoid
> this kind of issues in the future.
>
> And looking at lib/crypto map, there are other arrays (*_strings
> symbols) that are subject to similar "extending" issues.
>
> We are late in the release for adding new API though such helpers
> would be really simple.
> Hiding such symbols is something to consider before entering ABI freeze.
>
Agreed, but it is quite late for this cycle.
We can plan these helper APIs for next release cycle and remove these symbols in 23.11.
^ permalink raw reply [relevance 0%]
* Re: [EXT] Re: [PATCH] cryptodev: add missing algorithm strings
2022-11-02 10:58 0% ` [EXT] " Akhil Goyal
@ 2022-11-02 12:13 4% ` David Marchand
2022-11-02 12:31 0% ` Akhil Goyal
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-11-02 12:13 UTC (permalink / raw)
To: Akhil Goyal
Cc: Kevin Traynor, Volodymyr Fialko, dev, Ravi Kumar, Ali Alnubani,
Jerin Jacob Kollanukkaran, Anoob Joseph, Thomas Monjalon
On Wed, Nov 2, 2022 at 11:58 AM Akhil Goyal <gakhil@marvell.com> wrote:
> > This is being flagged as an ABI break for 21.11.3 [1]. I don't see it
> > mentioned in the commit message or discussed, is it ok for main branch?
>
> Ok, we can keep it to main only.
> But it will be an issue on 21.11.
>
> >
> > Thanks to Ali for reporting. I will revert on 21.11 branch.
> >
> > [1]
> > 1 Changed variable:
> >
> > [C] 'const char* rte_crypto_auth_algorithm_strings[]' was changed at
> > rte_crypto_sym.h:372:1:
> > size of symbol changed from 168 to 232
My two cents.
We have a algo "string to num" helper (rte_cryptodev_get_auth_algo_enum).
This code is not performance sensitive, is it?
If we add the, opposite, "num to string" helper, we can hide the
rte_crypto_auth_algorithm_strings symbol from the public ABI and avoid
this kind of issues in the future.
And looking at lib/crypto map, there are other arrays (*_strings
symbols) that are subject to similar "extending" issues.
We are late in the release for adding new API though such helpers
would be really simple.
Hiding such symbols is something to consider before entering ABI freeze.
--
David Marchand
^ permalink raw reply [relevance 4%]
* RE: [EXT] Re: [PATCH] cryptodev: add missing algorithm strings
2022-11-02 10:50 4% ` Kevin Traynor
@ 2022-11-02 10:58 0% ` Akhil Goyal
2022-11-02 12:13 4% ` David Marchand
0 siblings, 1 reply; 200+ results
From: Akhil Goyal @ 2022-11-02 10:58 UTC (permalink / raw)
To: Kevin Traynor, Volodymyr Fialko, dev, Fan Zhang, Ravi Kumar,
Ali Alnubani
Cc: Jerin Jacob Kollanukkaran, Anoob Joseph
> On 15/09/2022 09:26, Volodymyr Fialko wrote:
> > SHA3 family algorithms were missing in the array of algorithm strings.
> >
> > Fixes: 1df800f89518 ("crypto/ccp: support SHA3 family")
> >
> > Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
> > ---
> > lib/cryptodev/rte_cryptodev.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
> > index 42f3221052..35661f5347 100644
> > --- a/lib/cryptodev/rte_cryptodev.c
> > +++ b/lib/cryptodev/rte_cryptodev.c
> > @@ -130,6 +130,15 @@ rte_crypto_auth_algorithm_strings[] = {
> > [RTE_CRYPTO_AUTH_SHA512] = "sha2-512",
> > [RTE_CRYPTO_AUTH_SHA512_HMAC] = "sha2-512-hmac",
> >
> > + [RTE_CRYPTO_AUTH_SHA3_224] = "sha3-224",
> > + [RTE_CRYPTO_AUTH_SHA3_224_HMAC] = "sha3-224-hmac",
> > + [RTE_CRYPTO_AUTH_SHA3_256] = "sha3-256",
> > + [RTE_CRYPTO_AUTH_SHA3_256_HMAC] = "sha3-256-hmac",
> > + [RTE_CRYPTO_AUTH_SHA3_384] = "sha3-384",
> > + [RTE_CRYPTO_AUTH_SHA3_384_HMAC] = "sha3-384-hmac",
> > + [RTE_CRYPTO_AUTH_SHA3_512] = "sha3-512",
> > + [RTE_CRYPTO_AUTH_SHA3_512_HMAC] = "sha3-512-hmac",
> > +
> > [RTE_CRYPTO_AUTH_KASUMI_F9] = "kasumi-f9",
> > [RTE_CRYPTO_AUTH_SNOW3G_UIA2] = "snow3g-uia2",
> > [RTE_CRYPTO_AUTH_ZUC_EIA3] = "zuc-eia3"
>
> This is being flagged as an ABI break for 21.11.3 [1]. I don't see it
> mentioned in the commit message or discussed, is it ok for main branch?
Ok, we can keep it to main only.
But it will be an issue on 21.11.
>
> Thanks to Ali for reporting. I will revert on 21.11 branch.
>
> [1]
> 1 Changed variable:
>
> [C] 'const char* rte_crypto_auth_algorithm_strings[]' was changed at
> rte_crypto_sym.h:372:1:
> size of symbol changed from 168 to 232
>
> Error: ABI issue reported for 'abidiff --suppr
> dpdk/devtools/libabigail.abignore --no-added-syms --headers-dir1
> /opt/dpdklab/abi_references/v21.11/armgigabyteref/include --headers-dir2
> build_install/include
> /opt/dpdklab/abi_references/v21.11/armgigabyteref/dump/librte_cryptodev.du
> mp
> build_install/dump/librte_cryptodev.dump'
^ permalink raw reply [relevance 0%]
* Re: [PATCH] cryptodev: add missing algorithm strings
@ 2022-11-02 10:50 4% ` Kevin Traynor
2022-11-02 10:58 0% ` [EXT] " Akhil Goyal
0 siblings, 1 reply; 200+ results
From: Kevin Traynor @ 2022-11-02 10:50 UTC (permalink / raw)
To: Volodymyr Fialko, dev, Akhil Goyal, Fan Zhang, Ravi Kumar, Ali Alnubani
Cc: jerinj, anoobj
On 15/09/2022 09:26, Volodymyr Fialko wrote:
> SHA3 family algorithms were missing in the array of algorithm strings.
>
> Fixes: 1df800f89518 ("crypto/ccp: support SHA3 family")
>
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
> ---
> lib/cryptodev/rte_cryptodev.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
> index 42f3221052..35661f5347 100644
> --- a/lib/cryptodev/rte_cryptodev.c
> +++ b/lib/cryptodev/rte_cryptodev.c
> @@ -130,6 +130,15 @@ rte_crypto_auth_algorithm_strings[] = {
> [RTE_CRYPTO_AUTH_SHA512] = "sha2-512",
> [RTE_CRYPTO_AUTH_SHA512_HMAC] = "sha2-512-hmac",
>
> + [RTE_CRYPTO_AUTH_SHA3_224] = "sha3-224",
> + [RTE_CRYPTO_AUTH_SHA3_224_HMAC] = "sha3-224-hmac",
> + [RTE_CRYPTO_AUTH_SHA3_256] = "sha3-256",
> + [RTE_CRYPTO_AUTH_SHA3_256_HMAC] = "sha3-256-hmac",
> + [RTE_CRYPTO_AUTH_SHA3_384] = "sha3-384",
> + [RTE_CRYPTO_AUTH_SHA3_384_HMAC] = "sha3-384-hmac",
> + [RTE_CRYPTO_AUTH_SHA3_512] = "sha3-512",
> + [RTE_CRYPTO_AUTH_SHA3_512_HMAC] = "sha3-512-hmac",
> +
> [RTE_CRYPTO_AUTH_KASUMI_F9] = "kasumi-f9",
> [RTE_CRYPTO_AUTH_SNOW3G_UIA2] = "snow3g-uia2",
> [RTE_CRYPTO_AUTH_ZUC_EIA3] = "zuc-eia3"
This is being flagged as an ABI break for 21.11.3 [1]. I don't see it
mentioned in the commit message or discussed, is it ok for main branch?
Thanks to Ali for reporting. I will revert on 21.11 branch.
[1]
1 Changed variable:
[C] 'const char* rte_crypto_auth_algorithm_strings[]' was changed at
rte_crypto_sym.h:372:1:
size of symbol changed from 168 to 232
Error: ABI issue reported for 'abidiff --suppr
dpdk/devtools/libabigail.abignore --no-added-syms --headers-dir1
/opt/dpdklab/abi_references/v21.11/armgigabyteref/include --headers-dir2
build_install/include
/opt/dpdklab/abi_references/v21.11/armgigabyteref/dump/librte_cryptodev.dump
build_install/dump/librte_cryptodev.dump'
^ permalink raw reply [relevance 4%]
* RE: [PATCH v2 3/3] mempool: use cache for frequently updated statistics
2022-11-02 8:01 3% ` Mattias Rönnblom
@ 2022-11-02 9:29 4% ` Morten Brørup
2022-11-02 17:55 0% ` Mattias Rönnblom
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-11-02 9:29 UTC (permalink / raw)
To: Mattias Rönnblom, olivier.matz, andrew.rybchenko, stephen,
jerinj, bruce.richardson, thomas
Cc: dev
> From: Mattias Rönnblom [mailto:hofors@lysator.liu.se]
> Sent: Wednesday, 2 November 2022 09.01
>
> On 2022-10-31 12:26, Morten Brørup wrote:
[...]
> > +++ b/lib/mempool/rte_mempool.h
> > @@ -86,6 +86,21 @@ struct rte_mempool_cache {
> > uint32_t size; /**< Size of the cache */
> > uint32_t flushthresh; /**< Threshold before we flush excess
> elements */
> > uint32_t len; /**< Current cache count */
> > + uint32_t unused0;
> > +#ifdef RTE_LIBRTE_MEMPOOL_STATS
> > + /*
> > + * Alternative location for the most frequently updated mempool
> statistics (per-lcore),
> > + * providing faster update access when using a mempool cache.
> > + */
> > + struct {
> > + uint64_t put_bulk; /**< Number of puts. */
> > + uint64_t put_objs; /**< Number of objects
> successfully put. */
> > + uint64_t get_success_bulk; /**< Successful allocation
> number. */
> > + uint64_t get_success_objs; /**< Objects successfully
> allocated. */
> > + } stats; /**< Statistics */
> > +#else
> > + uint64_t unused1[4];
>
> Are a particular DPDK version supposed to be ABI compatible with
> itself,
> with different configuration options? E.g., with and without
> RTE_LIBRTE_MEMPOOL_STATS. Is that why you have those 4 unused
> uint64_ts?
Valid point: There was no ABI compatibility between with and without RTE_LIBRTE_MEMPOOL_STATS before this patch, so there is no need to add partial ABI compatibility here.
The #else part of this structure should be removed.
Does anyone disagree?
> > +#endif
^ permalink raw reply [relevance 4%]
* Re: [PATCH v2 3/3] mempool: use cache for frequently updated statistics
@ 2022-11-02 8:01 3% ` Mattias Rönnblom
2022-11-02 9:29 4% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Mattias Rönnblom @ 2022-11-02 8:01 UTC (permalink / raw)
To: Morten Brørup, olivier.matz, andrew.rybchenko, stephen,
jerinj, bruce.richardson
Cc: thomas, dev
On 2022-10-31 12:26, Morten Brørup wrote:
> When built with statistics enabled (RTE_LIBRTE_MEMPOOL_STATS defined), the
> performance of mempools with caches is improved as follows.
>
> When accessing objects in the mempool, either the put_bulk and put_objs or
> the get_success_bulk and get_success_objs statistics counters are likely
> to be incremented.
>
> By adding an alternative set of these counters to the mempool cache
> structure, accesing the dedicated statistics structure is avoided in the
> likely cases where these counters are incremented.
>
> The trick here is that the cache line holding the mempool cache structure
> is accessed anyway, in order to access the 'len' or 'flushthresh' fields.
> Updating some statistics counters in the same cache line has lower
> performance cost than accessing the statistics counters in the dedicated
> statistics structure, which resides in another cache line.
>
> mempool_perf_autotest with this patch shows the follwing change in
> rate_persec.
>
> Compared to only spliting statistics from debug:
> +1.5 % and +14.4 %, respectively without and with cache.
>
> Compared to not enabling mempool stats:
> -4.4 % and -9.9 %, respectively without and with cache.
>
> v2:
> * Move the statistics counters into a stats structure.
>
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> ---
> lib/mempool/rte_mempool.c | 9 +++++
> lib/mempool/rte_mempool.h | 73 ++++++++++++++++++++++++++++++++-------
> 2 files changed, 69 insertions(+), 13 deletions(-)
>
> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
> index e6208125e0..a18e39af04 100644
> --- a/lib/mempool/rte_mempool.c
> +++ b/lib/mempool/rte_mempool.c
> @@ -1286,6 +1286,15 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
> sum.get_success_blks += mp->stats[lcore_id].get_success_blks;
> sum.get_fail_blks += mp->stats[lcore_id].get_fail_blks;
> }
> + if (mp->cache_size != 0) {
> + /* Add the statistics stored in the mempool caches. */
> + for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
> + sum.put_bulk += mp->local_cache[lcore_id].stats.put_bulk;
> + sum.put_objs += mp->local_cache[lcore_id].stats.put_objs;
> + sum.get_success_bulk += mp->local_cache[lcore_id].stats.get_success_bulk;
> + sum.get_success_objs += mp->local_cache[lcore_id].stats.get_success_objs;
> + }
> + }
> fprintf(f, " stats:\n");
> fprintf(f, " put_bulk=%"PRIu64"\n", sum.put_bulk);
> fprintf(f, " put_objs=%"PRIu64"\n", sum.put_objs);
> diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
> index 16e7e62e3c..5806e75609 100644
> --- a/lib/mempool/rte_mempool.h
> +++ b/lib/mempool/rte_mempool.h
> @@ -86,6 +86,21 @@ struct rte_mempool_cache {
> uint32_t size; /**< Size of the cache */
> uint32_t flushthresh; /**< Threshold before we flush excess elements */
> uint32_t len; /**< Current cache count */
> + uint32_t unused0;
> +#ifdef RTE_LIBRTE_MEMPOOL_STATS
> + /*
> + * Alternative location for the most frequently updated mempool statistics (per-lcore),
> + * providing faster update access when using a mempool cache.
> + */
> + struct {
> + uint64_t put_bulk; /**< Number of puts. */
> + uint64_t put_objs; /**< Number of objects successfully put. */
> + uint64_t get_success_bulk; /**< Successful allocation number. */
> + uint64_t get_success_objs; /**< Objects successfully allocated. */
> + } stats; /**< Statistics */
> +#else
> + uint64_t unused1[4];
Are a particular DPDK version supposed to be ABI compatible with itself,
with different configuration options? E.g., with and without
RTE_LIBRTE_MEMPOOL_STATS. Is that why you have those 4 unused uint64_ts?
> +#endif
> /**
> * Cache objects
> *
> @@ -296,14 +311,14 @@ struct rte_mempool {
> | RTE_MEMPOOL_F_NO_IOVA_CONTIG \
> )
> /**
> - * @internal When debug is enabled, store some statistics.
> + * @internal When stats is enabled, store some statistics.
> *
> * @param mp
> * Pointer to the memory pool.
> * @param name
> * Name of the statistics field to increment in the memory pool.
> * @param n
> - * Number to add to the object-oriented statistics.
> + * Number to add to the statistics.
> */
> #ifdef RTE_LIBRTE_MEMPOOL_STATS
> #define RTE_MEMPOOL_STAT_ADD(mp, name, n) do { \
> @@ -312,6 +327,23 @@ struct rte_mempool {
> #else
> #define RTE_MEMPOOL_STAT_ADD(mp, name, n) do {} while (0)
> #endif
> +/**
> + * @internal When stats is enabled, store some statistics.
> + *
> + * @param cache
> + * Pointer to the memory pool cache.
> + * @param name
> + * Name of the statistics field to increment in the memory pool cache.
> + * @param n
> + * Number to add to the statistics.
> + */
> +#ifdef RTE_LIBRTE_MEMPOOL_STATS
> +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n) do { \
> + (cache)->stats.name += n; \
> + } while (0)
> +#else
> +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n) do {} while (0)
Somewhat unrelated comment: maybe <rte_common.h> should have a RTE_NOP
macro.
> +#endif
>
> /**
> * @internal Calculate the size of the mempool header.
> @@ -1327,13 +1359,17 @@ rte_mempool_do_generic_put(struct rte_mempool *mp, void * const *obj_table,
> {
> void **cache_objs;
>
> + /* No cache provided */
> + if (unlikely(cache == NULL))
> + goto driver_enqueue;
> +
> /* increment stat now, adding in mempool always success */
> - RTE_MEMPOOL_STAT_ADD(mp, put_bulk, 1);
> - RTE_MEMPOOL_STAT_ADD(mp, put_objs, n);
> + RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_bulk, 1);
> + RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, n);
>
> - /* No cache provided or the request itself is too big for the cache */
> - if (unlikely(cache == NULL || n > cache->flushthresh))
> - goto driver_enqueue;
> + /* The request itself is too big for the cache */
> + if (unlikely(n > cache->flushthresh))
> + goto driver_enqueue_stats_incremented;
>
> /*
> * The cache follows the following algorithm:
> @@ -1358,6 +1394,12 @@ rte_mempool_do_generic_put(struct rte_mempool *mp, void * const *obj_table,
>
> driver_enqueue:
>
> + /* increment stat now, adding in mempool always success */
> + RTE_MEMPOOL_STAT_ADD(mp, put_bulk, 1);
> + RTE_MEMPOOL_STAT_ADD(mp, put_objs, n);
> +
> +driver_enqueue_stats_incremented:
> +
> /* push objects to the backend */
> rte_mempool_ops_enqueue_bulk(mp, obj_table, n);
> }
> @@ -1464,8 +1506,8 @@ rte_mempool_do_generic_get(struct rte_mempool *mp, void **obj_table,
> if (remaining == 0) {
> /* The entire request is satisfied from the cache. */
>
> - RTE_MEMPOOL_STAT_ADD(mp, get_success_bulk, 1);
> - RTE_MEMPOOL_STAT_ADD(mp, get_success_objs, n);
> + RTE_MEMPOOL_CACHE_STAT_ADD(cache, get_success_bulk, 1);
> + RTE_MEMPOOL_CACHE_STAT_ADD(cache, get_success_objs, n);
>
> return 0;
> }
> @@ -1494,8 +1536,8 @@ rte_mempool_do_generic_get(struct rte_mempool *mp, void **obj_table,
>
> cache->len = cache->size;
>
> - RTE_MEMPOOL_STAT_ADD(mp, get_success_bulk, 1);
> - RTE_MEMPOOL_STAT_ADD(mp, get_success_objs, n);
> + RTE_MEMPOOL_CACHE_STAT_ADD(cache, get_success_bulk, 1);
> + RTE_MEMPOOL_CACHE_STAT_ADD(cache, get_success_objs, n);
>
> return 0;
>
> @@ -1517,8 +1559,13 @@ rte_mempool_do_generic_get(struct rte_mempool *mp, void **obj_table,
> RTE_MEMPOOL_STAT_ADD(mp, get_fail_bulk, 1);
> RTE_MEMPOOL_STAT_ADD(mp, get_fail_objs, n);
> } else {
> - RTE_MEMPOOL_STAT_ADD(mp, get_success_bulk, 1);
> - RTE_MEMPOOL_STAT_ADD(mp, get_success_objs, n);
> + if (likely(cache != NULL)) {
> + RTE_MEMPOOL_CACHE_STAT_ADD(cache, get_success_bulk, 1);
> + RTE_MEMPOOL_CACHE_STAT_ADD(cache, get_success_objs, n);
> + } else {
> + RTE_MEMPOOL_STAT_ADD(mp, get_success_bulk, 1);
> + RTE_MEMPOOL_STAT_ADD(mp, get_success_objs, n);
> + }
> }
>
> return ret;
^ permalink raw reply [relevance 3%]
* Re: release candidate 22.11-rc1
2022-10-11 1:50 4% release candidate 22.11-rc1 Thomas Monjalon
2022-10-13 5:28 0% ` Jiang, YuX
2022-10-24 13:12 0% ` David Marchand
@ 2022-10-27 21:00 0% ` Thinh Tran
2 siblings, 0 replies; 200+ results
From: Thinh Tran @ 2022-10-27 21:00 UTC (permalink / raw)
To: Thomas Monjalon, dpdk-dev
Hello,
IBM - Power Systems
DPDK 22.11.0-rc1
* Basic PF on Mellanox: No new issues or regressions were seen.
* Performance: not tested.
* OS: RHEL 8.5 kernel: 4.18.0-348.el8.ppc64le
with gcc version 8.5.0 20210514 (Red Hat 8.5.0-10)
RHEL 9.0 kernel: 5.14.0-70.13.1.el9_0.ppc64le
with gcc version 11.2.1 20220127 (Red Hat 11.2.1-9)
Systems tested:
- IBM Power9 PowerNV 9006-22P
NICs:
- Mellanox Technologies MT28800 Family [ConnectX-5 Ex]
- firmware version: 16.34.1002
- MLNX_OFED_LINUX-5.7-1.0.2.1 (OFED-5.7-1.0.2)
- LPARs on IBM Power10 CHRP IBM,9105-22A
NICs:
- Mellanox Technologies MT28800 Family [ConnectX-5 Ex]
- firmware version: 16.34.1002
- MLNX_OFED_LINUX-5.7-1.0.2.1 (OFED-5.7-1.0.2)
Regards,
Thinh Tran
On 10/10/2022 8:50 PM, Thomas Monjalon wrote:
> A new DPDK release candidate is ready for testing:
> https://git.dpdk.org/dpdk/tag/?id=v22.11-rc1
>
> There are 737 new patches in this snapshot,
> including many API/ABI compatibility breakages.
> This release won't be ABI-compatible with previous ones.
>
> Release notes:
> https://doc.dpdk.org/guides/rel_notes/release_22_11.html
>
> Highlights of 22.11-rc1:
> - LoongArch build
> - Intel uncore frequency control
> - multiple mbuf pools per Rx queue
> - Rx buffer split based on protocol
> - hardware congestion management
> - hairpin memory configuration
> - Rx/Tx descriptor dump
> - flow API extensions
> - MACsec processing offload
> - ShangMi crypto algorithms
> - baseband FFT operations
> - eventdev Tx queue start/stop
> - eventdev crypto vectorization
> - NitroSketch membership
>
> Some work is in progress to optimize the mempool cache.
> Some patches are part of -rc1, and more could be merged in -rc2.
> Please measure the performance of this release candidate,
> and check these mempool patches:
> https://patches.dpdk.org/project/dpdk/list/?series=25063
>
> Please test and report issues on bugs.dpdk.org.
>
> DPDK 22.11-rc2 is expected in two weeks.
>
> Thank you everyone
>
>
^ permalink raw reply [relevance 0%]
* Re: [PATCH] mempool: cache align mempool cache objects
2022-10-27 12:11 0% ` Morten Brørup
@ 2022-10-27 15:20 0% ` Olivier Matz
0 siblings, 0 replies; 200+ results
From: Olivier Matz @ 2022-10-27 15:20 UTC (permalink / raw)
To: Morten Brørup
Cc: andrew.rybchenko, jerinj, thomas, bruce.richardson, dev
On Thu, Oct 27, 2022 at 02:11:29PM +0200, Morten Brørup wrote:
> > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > Sent: Thursday, 27 October 2022 13.43
> >
> > On Thu, Oct 27, 2022 at 11:22:07AM +0200, Morten Brørup wrote:
> > > > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > > > Sent: Thursday, 27 October 2022 10.35
> > > >
> > > > Hi Morten,
> > > >
> > > > On Wed, Oct 26, 2022 at 04:44:36PM +0200, Morten Brørup wrote:
> > > > > Add __rte_cache_aligned to the objs array.
> > > > >
> > > > > It makes no difference in the general case, but if get/put
> > operations
> > > > are
> > > > > always 32 objects, it will reduce the number of memory (or last
> > level
> > > > > cache) accesses from five to four 64 B cache lines for every
> > get/put
> > > > > operation.
> > > > >
> > > > > For readability reasons, an example using 16 objects follows:
> > > > >
> > > > > Currently, with 16 objects (128B), we access to 3
> > > > > cache lines:
> > > > >
> > > > > ┌────────┐
> > > > > │len │
> > > > > cache │********│---
> > > > > line0 │********│ ^
> > > > > │********│ |
> > > > > ├────────┤ | 16 objects
> > > > > │********│ | 128B
> > > > > cache │********│ |
> > > > > line1 │********│ |
> > > > > │********│ |
> > > > > ├────────┤ |
> > > > > │********│_v_
> > > > > cache │ │
> > > > > line2 │ │
> > > > > │ │
> > > > > └────────┘
> > > > >
> > > > > With the alignment, it is also 3 cache lines:
> > > > >
> > > > > ┌────────┐
> > > > > │len │
> > > > > cache │ │
> > > > > line0 │ │
> > > > > │ │
> > > > > ├────────┤---
> > > > > │********│ ^
> > > > > cache │********│ |
> > > > > line1 │********│ |
> > > > > │********│ |
> > > > > ├────────┤ | 16 objects
> > > > > │********│ | 128B
> > > > > cache │********│ |
> > > > > line2 │********│ |
> > > > > │********│ v
> > > > > └────────┘---
> > > > >
> > > > > However, accessing the objects at the bottom of the mempool cache
> > is
> > > > a
> > > > > special case, where cache line0 is also used for objects.
> > > > >
> > > > > Consider the next burst (and any following bursts):
> > > > >
> > > > > Current:
> > > > > ┌────────┐
> > > > > │len │
> > > > > cache │ │
> > > > > line0 │ │
> > > > > │ │
> > > > > ├────────┤
> > > > > │ │
> > > > > cache │ │
> > > > > line1 │ │
> > > > > │ │
> > > > > ├────────┤
> > > > > │ │
> > > > > cache │********│---
> > > > > line2 │********│ ^
> > > > > │********│ |
> > > > > ├────────┤ | 16 objects
> > > > > │********│ | 128B
> > > > > cache │********│ |
> > > > > line3 │********│ |
> > > > > │********│ |
> > > > > ├────────┤ |
> > > > > │********│_v_
> > > > > cache │ │
> > > > > line4 │ │
> > > > > │ │
> > > > > └────────┘
> > > > > 4 cache lines touched, incl. line0 for len.
> > > > >
> > > > > With the proposed alignment:
> > > > > ┌────────┐
> > > > > │len │
> > > > > cache │ │
> > > > > line0 │ │
> > > > > │ │
> > > > > ├────────┤
> > > > > │ │
> > > > > cache │ │
> > > > > line1 │ │
> > > > > │ │
> > > > > ├────────┤
> > > > > │ │
> > > > > cache │ │
> > > > > line2 │ │
> > > > > │ │
> > > > > ├────────┤
> > > > > │********│---
> > > > > cache │********│ ^
> > > > > line3 │********│ |
> > > > > │********│ | 16 objects
> > > > > ├────────┤ | 128B
> > > > > │********│ |
> > > > > cache │********│ |
> > > > > line4 │********│ |
> > > > > │********│_v_
> > > > > └────────┘
> > > > > Only 3 cache lines touched, incl. line0 for len.
> > > >
> > > > I understand your logic, but are we sure that having an application
> > > > that
> > > > works with bulks of 32 means that the cache will stay aligned to 32
> > > > elements for the whole life of the application?
> > > >
> > > > In an application, the alignment of the cache can change if you
> > have
> > > > any of:
> > > > - software queues (reassembly for instance)
> > > > - packet duplication (bridge, multicast)
> > > > - locally generated packets (keepalive, control protocol)
> > > > - pipeline to other cores
> > > >
> > > > Even with testpmd, which work by bulk of 32, I can see that the
> > size
> > > > of the cache filling is not aligned to 32. Right after starting the
> > > > application, we already have this:
> > > >
> > > > internal cache infos:
> > > > cache_size=250
> > > > cache_count[0]=231
> > > >
> > > > This is probably related to the hw rx rings size, number of queues,
> > > > number of ports.
> > > >
> > > > The "250" default value for cache size in testpmd is questionable,
> > but
> > > > with --mbcache=256, the behavior is similar.
> > > >
> > > > Also, when we transmit to a NIC, the mbufs are not returned
> > immediatly
> > > > to the pool, they may stay in the hw tx ring during some time,
> > which is
> > > > a driver decision.
> > > >
> > > > After processing traffic on cores 8 and 24 with this testpmd, I
> > get:
> > > > cache_count[0]=231
> > > > cache_count[8]=123
> > > > cache_count[24]=122
> > > >
> > > > In my opinion, it is not realistic to think that the mempool cache
> > will
> > > > remain aligned to cachelines. In these conditions, it looks better
> > to
> > > > keep the structure packed to avoid wasting memory.
> > >
> > > I agree that is a special use case to only access the mempool cache
> > in
> > > bursts of 32 objects, so the accesses are always cache line
> > > aligned. (Generalized, the burst size must not be 32; a burst size
> > > that is a multiple of RTE_CACHE_LINE_SIZE/sizeof(void*), i.e. a burst
> > > size of 8 on a 64-bit architecture, will do.)
> >
> > Is there a real situation where it happens to always have read/write
> > accesses per bulks of 32? From what I see in my quick test, it is not
> > the case, even with testpmd.
> >
> > > Adding a hole of 52 byte per mempool cache is nothing, considering
> > > that the mempool cache already uses 8 KB (RTE_MEMPOOL_CACHE_MAX_SIZE
> > *
> > > 2 * sizeof(void*) = 1024 * 8 byte) for the objects.
> > >
> > > Also - assuming that memory allocations are cache line aligned - the
> > > 52 byte of unused memory cannot be used regardless if they are before
> > > or after the objects. Instead of having 52 B unused after the
> > objects,
> > > we might as well have a hole of 52 B unused before the objects. In
> > > other words: There is really no downside to this.
> >
> > Correct, the memory waste argument to nack the patch is invalid.
> >
> > > Jerin also presented a separate argument for moving the objects to
> > > another cache line than the len field: The risk for "load-after-store
> > > stall" when loading the len field after storing objects in cache
> > line0
> > > [1].
> > >
> > > [1]: http://inbox.dpdk.org/dev/CALBAE1P4zFYdLwoQukn5Q-V-
> > nTvc_UBWmWjhaV2uVBXQRytSSA@mail.gmail.com/
> >
> > I'll be prudent on this justification without numbers. The case where
> > we
> > access to the objects of the first cache line (among several KB) is
> > maybe not that frequent.
> >
> > > A new idea just popped into my head: The hot debug statistics
> > > counters (put_bulk, put_objs, get_success_bulk, get_success_objs)
> > > could be moved to this free space, reducing the need to touch another
> > > cache line for debug counters. I haven’t thought this idea through
> > > yet; it might conflict with Jerin's comment.
> >
> > Yes, but since the stats are only enabled when RTE_LIBRTE_MEMPOOL_DEBUG
> > is set, it won't have any impact on non-debug builds.
>
> Correct, but I do expect that it would reduce the performance cost of using RTE_LIBRTE_MEMPOOL_DEBUG. I'll provide such a patch shortly.
>
> >
> >
> > Honnestly, I find it hard to convince myself that it is a real
> > optimization. I don't see any reason why it would be slower though. So
> > since we already broke the mempool cache struct ABI in a previous
> > commit, and since it won't consume more memory, I'm ok to include that
> > patch.
>
> I don't know if there are any such applications now, and you are probably right that there are not. But this patch opens a road towards it.
>
> Acked-by ?
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Thanks Morten
>
> > It would be great to have numbers to put some weight in the
> > balance.
>
> Yes, it would also be great if drivers didn't copy-paste code from the mempool library, so the performance effect of modifications in the mempool library would be reflected in such tests.
>
> >
> >
> >
> >
> > >
> > > >
> > > > Olivier
> > > >
> > > >
> > > > >
> > > > > Credits go to Olivier Matz for the nice ASCII graphics.
> > > > >
> > > > > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > > > > ---
> > > > > lib/mempool/rte_mempool.h | 6 ++++--
> > > > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/lib/mempool/rte_mempool.h
> > b/lib/mempool/rte_mempool.h
> > > > > index 1f5707f46a..3725a72951 100644
> > > > > --- a/lib/mempool/rte_mempool.h
> > > > > +++ b/lib/mempool/rte_mempool.h
> > > > > @@ -86,11 +86,13 @@ struct rte_mempool_cache {
> > > > > uint32_t size; /**< Size of the cache */
> > > > > uint32_t flushthresh; /**< Threshold before we flush excess
> > > > elements */
> > > > > uint32_t len; /**< Current cache count */
> > > > > - /*
> > > > > + /**
> > > > > + * Cache objects
> > > > > + *
> > > > > * Cache is allocated to this size to allow it to overflow
> > in
> > > > certain
> > > > > * cases to avoid needless emptying of cache.
> > > > > */
> > > > > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache
> > objects */
> > > > > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]
> > __rte_cache_aligned;
> > > > > } __rte_cache_aligned;
> > > > >
> > > > > /**
> > > > > --
> > > > > 2.17.1
> > > > >
> > >
>
^ permalink raw reply [relevance 0%]
* RE: [PATCH] mempool: cache align mempool cache objects
2022-10-27 11:42 3% ` Olivier Matz
@ 2022-10-27 12:11 0% ` Morten Brørup
2022-10-27 15:20 0% ` Olivier Matz
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-10-27 12:11 UTC (permalink / raw)
To: Olivier Matz; +Cc: andrew.rybchenko, jerinj, thomas, bruce.richardson, dev
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Thursday, 27 October 2022 13.43
>
> On Thu, Oct 27, 2022 at 11:22:07AM +0200, Morten Brørup wrote:
> > > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > > Sent: Thursday, 27 October 2022 10.35
> > >
> > > Hi Morten,
> > >
> > > On Wed, Oct 26, 2022 at 04:44:36PM +0200, Morten Brørup wrote:
> > > > Add __rte_cache_aligned to the objs array.
> > > >
> > > > It makes no difference in the general case, but if get/put
> operations
> > > are
> > > > always 32 objects, it will reduce the number of memory (or last
> level
> > > > cache) accesses from five to four 64 B cache lines for every
> get/put
> > > > operation.
> > > >
> > > > For readability reasons, an example using 16 objects follows:
> > > >
> > > > Currently, with 16 objects (128B), we access to 3
> > > > cache lines:
> > > >
> > > > ┌────────┐
> > > > │len │
> > > > cache │********│---
> > > > line0 │********│ ^
> > > > │********│ |
> > > > ├────────┤ | 16 objects
> > > > │********│ | 128B
> > > > cache │********│ |
> > > > line1 │********│ |
> > > > │********│ |
> > > > ├────────┤ |
> > > > │********│_v_
> > > > cache │ │
> > > > line2 │ │
> > > > │ │
> > > > └────────┘
> > > >
> > > > With the alignment, it is also 3 cache lines:
> > > >
> > > > ┌────────┐
> > > > │len │
> > > > cache │ │
> > > > line0 │ │
> > > > │ │
> > > > ├────────┤---
> > > > │********│ ^
> > > > cache │********│ |
> > > > line1 │********│ |
> > > > │********│ |
> > > > ├────────┤ | 16 objects
> > > > │********│ | 128B
> > > > cache │********│ |
> > > > line2 │********│ |
> > > > │********│ v
> > > > └────────┘---
> > > >
> > > > However, accessing the objects at the bottom of the mempool cache
> is
> > > a
> > > > special case, where cache line0 is also used for objects.
> > > >
> > > > Consider the next burst (and any following bursts):
> > > >
> > > > Current:
> > > > ┌────────┐
> > > > │len │
> > > > cache │ │
> > > > line0 │ │
> > > > │ │
> > > > ├────────┤
> > > > │ │
> > > > cache │ │
> > > > line1 │ │
> > > > │ │
> > > > ├────────┤
> > > > │ │
> > > > cache │********│---
> > > > line2 │********│ ^
> > > > │********│ |
> > > > ├────────┤ | 16 objects
> > > > │********│ | 128B
> > > > cache │********│ |
> > > > line3 │********│ |
> > > > │********│ |
> > > > ├────────┤ |
> > > > │********│_v_
> > > > cache │ │
> > > > line4 │ │
> > > > │ │
> > > > └────────┘
> > > > 4 cache lines touched, incl. line0 for len.
> > > >
> > > > With the proposed alignment:
> > > > ┌────────┐
> > > > │len │
> > > > cache │ │
> > > > line0 │ │
> > > > │ │
> > > > ├────────┤
> > > > │ │
> > > > cache │ │
> > > > line1 │ │
> > > > │ │
> > > > ├────────┤
> > > > │ │
> > > > cache │ │
> > > > line2 │ │
> > > > │ │
> > > > ├────────┤
> > > > │********│---
> > > > cache │********│ ^
> > > > line3 │********│ |
> > > > │********│ | 16 objects
> > > > ├────────┤ | 128B
> > > > │********│ |
> > > > cache │********│ |
> > > > line4 │********│ |
> > > > │********│_v_
> > > > └────────┘
> > > > Only 3 cache lines touched, incl. line0 for len.
> > >
> > > I understand your logic, but are we sure that having an application
> > > that
> > > works with bulks of 32 means that the cache will stay aligned to 32
> > > elements for the whole life of the application?
> > >
> > > In an application, the alignment of the cache can change if you
> have
> > > any of:
> > > - software queues (reassembly for instance)
> > > - packet duplication (bridge, multicast)
> > > - locally generated packets (keepalive, control protocol)
> > > - pipeline to other cores
> > >
> > > Even with testpmd, which work by bulk of 32, I can see that the
> size
> > > of the cache filling is not aligned to 32. Right after starting the
> > > application, we already have this:
> > >
> > > internal cache infos:
> > > cache_size=250
> > > cache_count[0]=231
> > >
> > > This is probably related to the hw rx rings size, number of queues,
> > > number of ports.
> > >
> > > The "250" default value for cache size in testpmd is questionable,
> but
> > > with --mbcache=256, the behavior is similar.
> > >
> > > Also, when we transmit to a NIC, the mbufs are not returned
> immediatly
> > > to the pool, they may stay in the hw tx ring during some time,
> which is
> > > a driver decision.
> > >
> > > After processing traffic on cores 8 and 24 with this testpmd, I
> get:
> > > cache_count[0]=231
> > > cache_count[8]=123
> > > cache_count[24]=122
> > >
> > > In my opinion, it is not realistic to think that the mempool cache
> will
> > > remain aligned to cachelines. In these conditions, it looks better
> to
> > > keep the structure packed to avoid wasting memory.
> >
> > I agree that is a special use case to only access the mempool cache
> in
> > bursts of 32 objects, so the accesses are always cache line
> > aligned. (Generalized, the burst size must not be 32; a burst size
> > that is a multiple of RTE_CACHE_LINE_SIZE/sizeof(void*), i.e. a burst
> > size of 8 on a 64-bit architecture, will do.)
>
> Is there a real situation where it happens to always have read/write
> accesses per bulks of 32? From what I see in my quick test, it is not
> the case, even with testpmd.
>
> > Adding a hole of 52 byte per mempool cache is nothing, considering
> > that the mempool cache already uses 8 KB (RTE_MEMPOOL_CACHE_MAX_SIZE
> *
> > 2 * sizeof(void*) = 1024 * 8 byte) for the objects.
> >
> > Also - assuming that memory allocations are cache line aligned - the
> > 52 byte of unused memory cannot be used regardless if they are before
> > or after the objects. Instead of having 52 B unused after the
> objects,
> > we might as well have a hole of 52 B unused before the objects. In
> > other words: There is really no downside to this.
>
> Correct, the memory waste argument to nack the patch is invalid.
>
> > Jerin also presented a separate argument for moving the objects to
> > another cache line than the len field: The risk for "load-after-store
> > stall" when loading the len field after storing objects in cache
> line0
> > [1].
> >
> > [1]: http://inbox.dpdk.org/dev/CALBAE1P4zFYdLwoQukn5Q-V-
> nTvc_UBWmWjhaV2uVBXQRytSSA@mail.gmail.com/
>
> I'll be prudent on this justification without numbers. The case where
> we
> access to the objects of the first cache line (among several KB) is
> maybe not that frequent.
>
> > A new idea just popped into my head: The hot debug statistics
> > counters (put_bulk, put_objs, get_success_bulk, get_success_objs)
> > could be moved to this free space, reducing the need to touch another
> > cache line for debug counters. I haven’t thought this idea through
> > yet; it might conflict with Jerin's comment.
>
> Yes, but since the stats are only enabled when RTE_LIBRTE_MEMPOOL_DEBUG
> is set, it won't have any impact on non-debug builds.
Correct, but I do expect that it would reduce the performance cost of using RTE_LIBRTE_MEMPOOL_DEBUG. I'll provide such a patch shortly.
>
>
> Honnestly, I find it hard to convince myself that it is a real
> optimization. I don't see any reason why it would be slower though. So
> since we already broke the mempool cache struct ABI in a previous
> commit, and since it won't consume more memory, I'm ok to include that
> patch.
I don't know if there are any such applications now, and you are probably right that there are not. But this patch opens a road towards it.
Acked-by ?
> It would be great to have numbers to put some weight in the
> balance.
Yes, it would also be great if drivers didn't copy-paste code from the mempool library, so the performance effect of modifications in the mempool library would be reflected in such tests.
>
>
>
>
> >
> > >
> > > Olivier
> > >
> > >
> > > >
> > > > Credits go to Olivier Matz for the nice ASCII graphics.
> > > >
> > > > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > > > ---
> > > > lib/mempool/rte_mempool.h | 6 ++++--
> > > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/lib/mempool/rte_mempool.h
> b/lib/mempool/rte_mempool.h
> > > > index 1f5707f46a..3725a72951 100644
> > > > --- a/lib/mempool/rte_mempool.h
> > > > +++ b/lib/mempool/rte_mempool.h
> > > > @@ -86,11 +86,13 @@ struct rte_mempool_cache {
> > > > uint32_t size; /**< Size of the cache */
> > > > uint32_t flushthresh; /**< Threshold before we flush excess
> > > elements */
> > > > uint32_t len; /**< Current cache count */
> > > > - /*
> > > > + /**
> > > > + * Cache objects
> > > > + *
> > > > * Cache is allocated to this size to allow it to overflow
> in
> > > certain
> > > > * cases to avoid needless emptying of cache.
> > > > */
> > > > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache
> objects */
> > > > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]
> __rte_cache_aligned;
> > > > } __rte_cache_aligned;
> > > >
> > > > /**
> > > > --
> > > > 2.17.1
> > > >
> >
^ permalink raw reply [relevance 0%]
* Re: [PATCH] mempool: cache align mempool cache objects
@ 2022-10-27 11:42 3% ` Olivier Matz
2022-10-27 12:11 0% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Olivier Matz @ 2022-10-27 11:42 UTC (permalink / raw)
To: Morten Brørup
Cc: andrew.rybchenko, jerinj, thomas, bruce.richardson, dev
On Thu, Oct 27, 2022 at 11:22:07AM +0200, Morten Brørup wrote:
> > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > Sent: Thursday, 27 October 2022 10.35
> >
> > Hi Morten,
> >
> > On Wed, Oct 26, 2022 at 04:44:36PM +0200, Morten Brørup wrote:
> > > Add __rte_cache_aligned to the objs array.
> > >
> > > It makes no difference in the general case, but if get/put operations
> > are
> > > always 32 objects, it will reduce the number of memory (or last level
> > > cache) accesses from five to four 64 B cache lines for every get/put
> > > operation.
> > >
> > > For readability reasons, an example using 16 objects follows:
> > >
> > > Currently, with 16 objects (128B), we access to 3
> > > cache lines:
> > >
> > > ┌────────┐
> > > │len │
> > > cache │********│---
> > > line0 │********│ ^
> > > │********│ |
> > > ├────────┤ | 16 objects
> > > │********│ | 128B
> > > cache │********│ |
> > > line1 │********│ |
> > > │********│ |
> > > ├────────┤ |
> > > │********│_v_
> > > cache │ │
> > > line2 │ │
> > > │ │
> > > └────────┘
> > >
> > > With the alignment, it is also 3 cache lines:
> > >
> > > ┌────────┐
> > > │len │
> > > cache │ │
> > > line0 │ │
> > > │ │
> > > ├────────┤---
> > > │********│ ^
> > > cache │********│ |
> > > line1 │********│ |
> > > │********│ |
> > > ├────────┤ | 16 objects
> > > │********│ | 128B
> > > cache │********│ |
> > > line2 │********│ |
> > > │********│ v
> > > └────────┘---
> > >
> > > However, accessing the objects at the bottom of the mempool cache is
> > a
> > > special case, where cache line0 is also used for objects.
> > >
> > > Consider the next burst (and any following bursts):
> > >
> > > Current:
> > > ┌────────┐
> > > │len │
> > > cache │ │
> > > line0 │ │
> > > │ │
> > > ├────────┤
> > > │ │
> > > cache │ │
> > > line1 │ │
> > > │ │
> > > ├────────┤
> > > │ │
> > > cache │********│---
> > > line2 │********│ ^
> > > │********│ |
> > > ├────────┤ | 16 objects
> > > │********│ | 128B
> > > cache │********│ |
> > > line3 │********│ |
> > > │********│ |
> > > ├────────┤ |
> > > │********│_v_
> > > cache │ │
> > > line4 │ │
> > > │ │
> > > └────────┘
> > > 4 cache lines touched, incl. line0 for len.
> > >
> > > With the proposed alignment:
> > > ┌────────┐
> > > │len │
> > > cache │ │
> > > line0 │ │
> > > │ │
> > > ├────────┤
> > > │ │
> > > cache │ │
> > > line1 │ │
> > > │ │
> > > ├────────┤
> > > │ │
> > > cache │ │
> > > line2 │ │
> > > │ │
> > > ├────────┤
> > > │********│---
> > > cache │********│ ^
> > > line3 │********│ |
> > > │********│ | 16 objects
> > > ├────────┤ | 128B
> > > │********│ |
> > > cache │********│ |
> > > line4 │********│ |
> > > │********│_v_
> > > └────────┘
> > > Only 3 cache lines touched, incl. line0 for len.
> >
> > I understand your logic, but are we sure that having an application
> > that
> > works with bulks of 32 means that the cache will stay aligned to 32
> > elements for the whole life of the application?
> >
> > In an application, the alignment of the cache can change if you have
> > any of:
> > - software queues (reassembly for instance)
> > - packet duplication (bridge, multicast)
> > - locally generated packets (keepalive, control protocol)
> > - pipeline to other cores
> >
> > Even with testpmd, which work by bulk of 32, I can see that the size
> > of the cache filling is not aligned to 32. Right after starting the
> > application, we already have this:
> >
> > internal cache infos:
> > cache_size=250
> > cache_count[0]=231
> >
> > This is probably related to the hw rx rings size, number of queues,
> > number of ports.
> >
> > The "250" default value for cache size in testpmd is questionable, but
> > with --mbcache=256, the behavior is similar.
> >
> > Also, when we transmit to a NIC, the mbufs are not returned immediatly
> > to the pool, they may stay in the hw tx ring during some time, which is
> > a driver decision.
> >
> > After processing traffic on cores 8 and 24 with this testpmd, I get:
> > cache_count[0]=231
> > cache_count[8]=123
> > cache_count[24]=122
> >
> > In my opinion, it is not realistic to think that the mempool cache will
> > remain aligned to cachelines. In these conditions, it looks better to
> > keep the structure packed to avoid wasting memory.
>
> I agree that is a special use case to only access the mempool cache in
> bursts of 32 objects, so the accesses are always cache line
> aligned. (Generalized, the burst size must not be 32; a burst size
> that is a multiple of RTE_CACHE_LINE_SIZE/sizeof(void*), i.e. a burst
> size of 8 on a 64-bit architecture, will do.)
Is there a real situation where it happens to always have read/write
accesses per bulks of 32? From what I see in my quick test, it is not
the case, even with testpmd.
> Adding a hole of 52 byte per mempool cache is nothing, considering
> that the mempool cache already uses 8 KB (RTE_MEMPOOL_CACHE_MAX_SIZE *
> 2 * sizeof(void*) = 1024 * 8 byte) for the objects.
>
> Also - assuming that memory allocations are cache line aligned - the
> 52 byte of unused memory cannot be used regardless if they are before
> or after the objects. Instead of having 52 B unused after the objects,
> we might as well have a hole of 52 B unused before the objects. In
> other words: There is really no downside to this.
Correct, the memory waste argument to nack the patch is invalid.
> Jerin also presented a separate argument for moving the objects to
> another cache line than the len field: The risk for "load-after-store
> stall" when loading the len field after storing objects in cache line0
> [1].
>
> [1]: http://inbox.dpdk.org/dev/CALBAE1P4zFYdLwoQukn5Q-V-nTvc_UBWmWjhaV2uVBXQRytSSA@mail.gmail.com/
I'll be prudent on this justification without numbers. The case where we
access to the objects of the first cache line (among several KB) is
maybe not that frequent.
> A new idea just popped into my head: The hot debug statistics
> counters (put_bulk, put_objs, get_success_bulk, get_success_objs)
> could be moved to this free space, reducing the need to touch another
> cache line for debug counters. I haven’t thought this idea through
> yet; it might conflict with Jerin's comment.
Yes, but since the stats are only enabled when RTE_LIBRTE_MEMPOOL_DEBUG
is set, it won't have any impact on non-debug builds.
Honnestly, I find it hard to convince myself that it is a real
optimization. I don't see any reason why it would be slower though. So
since we already broke the mempool cache struct ABI in a previous
commit, and since it won't consume more memory, I'm ok to include that
patch. It would be great to have numbers to put some weight in the
balance.
>
> >
> > Olivier
> >
> >
> > >
> > > Credits go to Olivier Matz for the nice ASCII graphics.
> > >
> > > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > > ---
> > > lib/mempool/rte_mempool.h | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
> > > index 1f5707f46a..3725a72951 100644
> > > --- a/lib/mempool/rte_mempool.h
> > > +++ b/lib/mempool/rte_mempool.h
> > > @@ -86,11 +86,13 @@ struct rte_mempool_cache {
> > > uint32_t size; /**< Size of the cache */
> > > uint32_t flushthresh; /**< Threshold before we flush excess
> > elements */
> > > uint32_t len; /**< Current cache count */
> > > - /*
> > > + /**
> > > + * Cache objects
> > > + *
> > > * Cache is allocated to this size to allow it to overflow in
> > certain
> > > * cases to avoid needless emptying of cache.
> > > */
> > > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache objects */
> > > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2] __rte_cache_aligned;
> > > } __rte_cache_aligned;
> > >
> > > /**
> > > --
> > > 2.17.1
> > >
>
^ permalink raw reply [relevance 3%]
* Re: [PATCH] ci: combine static and shared linking build tests
2022-10-20 15:34 0% ` Aaron Conole
@ 2022-10-27 11:21 0% ` David Marchand
0 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-10-27 11:21 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Bruce Richardson, Aaron Conole, Michael Santana
On Thu, Oct 20, 2022 at 5:34 PM Aaron Conole <aconole@redhat.com> wrote:
> > Save some cpu time and disk by testing linking against static and shared
> > library in single environments.
> >
> > The .ci/linux-build.sh is modified so it reconfigures an existing build
> > directory: an empty DEF_LIB= means that static and shared builds are
> > to be tested.
> >
> > ABI checks, documentation generation and unit tests are disabled for
> > static builds as they would be redundant with the check against
> > dynamically linked binaries, if any.
> >
> > Note:
> > - --cross-file is an option that can be passed to meson only when
> > creating a build environment,
> > - for some other reason, --buildtype and other non -D options are only
> > accepted when setting up a build directory with meson. When
> > reconfiguring, only their -D$option forms are accepted,
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Aaron Conole <aconole@redhat.com>
Applied, thanks.
--
David Marchand
^ permalink raw reply [relevance 0%]
* RE: [PATCH] vhost: promote per-queue stats API to stable
2022-10-10 15:37 4% [PATCH] vhost: promote per-queue stats API to stable Maxime Coquelin
2022-10-17 13:22 0% ` David Marchand
2022-10-24 8:53 0% ` Xia, Chenbo
@ 2022-10-26 9:31 0% ` Xia, Chenbo
2 siblings, 0 replies; 200+ results
From: Xia, Chenbo @ 2022-10-26 9:31 UTC (permalink / raw)
To: Maxime Coquelin, dev, david.marchand
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Monday, October 10, 2022 11:38 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>;
> david.marchand@redhat.com
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH] vhost: promote per-queue stats API to stable
>
> This patch promotes the per-queue stats API to stable.
> The API has been used by the Vhost PMD since v22.07, and
> David Marchand posted a patch to make use of it in next
> OVS release[0].
>
> [0]:
> http://patchwork.ozlabs.org/project/openvswitch/patch/20221007111613.16955
> 24-4-david.marchand@redhat.com/
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> doc/guides/rel_notes/release_22_11.rst | 4 ++++
> lib/vhost/rte_vhost.h | 3 ---
> lib/vhost/version.map | 6 +++---
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_22_11.rst
> b/doc/guides/rel_notes/release_22_11.rst
> index 37bd392f34..d5d3eeae24 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -443,6 +443,10 @@ API Changes
>
> * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
>
> +* vhost: Promoted ``rte_vhost_vring_stats_get()``,
> + ``rte_vhost_vring_stats_get_names()`` and
> ``rte_vhost_vring_stats_reset()``
> + from experimental to stable.
> +
>
> ABI Changes
> -----------
> diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
> index bb7d86a432..59c98a0afb 100644
> --- a/lib/vhost/rte_vhost.h
> +++ b/lib/vhost/rte_vhost.h
> @@ -1075,7 +1075,6 @@ rte_vhost_slave_config_change(int vid, bool
> need_reply);
> * - Failure if lower than 0. The device ID or queue ID is invalid or
> + statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id,
> struct rte_vhost_stat_name *name, unsigned int size);
> @@ -1103,7 +1102,6 @@ rte_vhost_vring_stats_get_names(int vid, uint16_t
> queue_id,
> * - Failure if lower than 0. The device ID or queue ID is invalid, or
> * statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_get(int vid, uint16_t queue_id,
> struct rte_vhost_stat *stats, unsigned int n);
> @@ -1120,7 +1118,6 @@ rte_vhost_vring_stats_get(int vid, uint16_t queue_id,
> * - Failure if lower than 0. The device ID or queue ID is invalid, or
> * statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_reset(int vid, uint16_t queue_id);
>
> diff --git a/lib/vhost/version.map b/lib/vhost/version.map
> index 7a00b65740..8c5e8aa8d3 100644
> --- a/lib/vhost/version.map
> +++ b/lib/vhost/version.map
> @@ -57,6 +57,9 @@ DPDK_23 {
> rte_vhost_set_vring_base;
> rte_vhost_va_from_guest_pa;
> rte_vhost_vring_call;
> + rte_vhost_vring_stats_get;
> + rte_vhost_vring_stats_get_names;
> + rte_vhost_vring_stats_reset;
>
> local: *;
> };
> @@ -88,9 +91,6 @@ EXPERIMENTAL {
>
> # added in 22.07
> rte_vhost_async_get_inflight_thread_unsafe;
> - rte_vhost_vring_stats_get_names;
> - rte_vhost_vring_stats_get;
> - rte_vhost_vring_stats_reset;
> rte_vhost_async_try_dequeue_burst;
> rte_vhost_driver_get_vdpa_dev_type;
> rte_vhost_clear_queue;
> --
> 2.37.3
Applied to next-virtio/main, thanks
^ permalink raw reply [relevance 0%]
* Re: release candidate 22.11-rc1
2022-10-11 1:50 4% release candidate 22.11-rc1 Thomas Monjalon
2022-10-13 5:28 0% ` Jiang, YuX
@ 2022-10-24 13:12 0% ` David Marchand
2022-10-27 21:00 0% ` Thinh Tran
2 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-10-24 13:12 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, YangHang Liu, Maxime Coquelin
Hello,
On Tue, Oct 11, 2022 at 3:50 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> A new DPDK release candidate is ready for testing:
> https://git.dpdk.org/dpdk/tag/?id=v22.11-rc1
>
> There are 737 new patches in this snapshot,
> including many API/ABI compatibility breakages.
> This release won't be ABI-compatible with previous ones.
>
> Release notes:
> https://doc.dpdk.org/guides/rel_notes/release_22_11.html
>
> Highlights of 22.11-rc1:
> - LoongArch build
> - Intel uncore frequency control
> - multiple mbuf pools per Rx queue
> - Rx buffer split based on protocol
> - hardware congestion management
> - hairpin memory configuration
> - Rx/Tx descriptor dump
> - flow API extensions
> - MACsec processing offload
> - ShangMi crypto algorithms
> - baseband FFT operations
> - eventdev Tx queue start/stop
> - eventdev crypto vectorization
> - NitroSketch membership
>
> Some work is in progress to optimize the mempool cache.
> Some patches are part of -rc1, and more could be merged in -rc2.
> Please measure the performance of this release candidate,
> and check these mempool patches:
> https://patches.dpdk.org/project/dpdk/list/?series=25063
>
> Please test and report issues on bugs.dpdk.org.
>
> DPDK 22.11-rc2 is expected in two weeks.
>
> Thank you everyone
>
>
Red Hat QE ran its non regression test suites and found no issue.
See below for details:
Test scenario:
Guest with device assignment(PF) throughput testing(1G hugepage size): PASS
Guest with device assignment(PF) throughput testing(2M hugepage size) : PASS
Guest with device assignment(VF) throughput testing: PASS
PVP (host dpdk testpmd as vswitch) 1Q: throughput testing: PASS
PVP vhost-user 2Q throughput testing: PASS
PVP vhost-user 1Q - cross numa node throughput testing: PASS
Guest with vhost-user 2 queues throughput testing: PASS
vhost-user reconnect with dpdk-client, qemu-server: qemu reconnect: PASS
vhost-user reconnect with dpdk-client, qemu-server: ovs reconnect: PASS
PVP 1Q live migration testing: PASS
PVP 1Q cross numa node live migration testing: PASS
Guest with ovs+dpdk+vhost-user 1Q live migration testing: PASS
Guest with ovs+dpdk+vhost-user 1Q live migration testing (2M): PASS
Guest with ovs+dpdk+vhost-user 2Q live migration testing: PASS
Guest with ovs+dpdk+vhost-user 4Q live migration testing: PASS
Host PF + DPDK testing: PASS
Host VF + DPDK testing: PASS
Test version:
kernel 5.14
qemu 7.1
dpdk: git://dpdk.org/dpdk
# git log -1
commit a74b1b25136a592c275afbfa6b70771469750aee
Author: Thomas Monjalon <thomas@monjalon.net>
Date: Tue Oct 11 02:39:28 2022 +0200
version: 22.11-rc1
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
NICs: X540-AT2 NIC(ixgbe, 10G)
--
David Marchand
^ permalink raw reply [relevance 0%]
* RE: [PATCH] vhost: promote per-queue stats API to stable
2022-10-10 15:37 4% [PATCH] vhost: promote per-queue stats API to stable Maxime Coquelin
2022-10-17 13:22 0% ` David Marchand
@ 2022-10-24 8:53 0% ` Xia, Chenbo
2022-10-26 9:31 0% ` Xia, Chenbo
2 siblings, 0 replies; 200+ results
From: Xia, Chenbo @ 2022-10-24 8:53 UTC (permalink / raw)
To: Maxime Coquelin, dev; +Cc: david.marchand
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Monday, October 10, 2022 11:38 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>;
> david.marchand@redhat.com
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH] vhost: promote per-queue stats API to stable
>
> This patch promotes the per-queue stats API to stable.
> The API has been used by the Vhost PMD since v22.07, and
> David Marchand posted a patch to make use of it in next
> OVS release[0].
>
> [0]:
> http://patchwork.ozlabs.org/project/openvswitch/patch/20221007111613.16955
> 24-4-david.marchand@redhat.com/
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> doc/guides/rel_notes/release_22_11.rst | 4 ++++
> lib/vhost/rte_vhost.h | 3 ---
> lib/vhost/version.map | 6 +++---
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_22_11.rst
> b/doc/guides/rel_notes/release_22_11.rst
> index 37bd392f34..d5d3eeae24 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -443,6 +443,10 @@ API Changes
>
> * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
>
> +* vhost: Promoted ``rte_vhost_vring_stats_get()``,
> + ``rte_vhost_vring_stats_get_names()`` and
> ``rte_vhost_vring_stats_reset()``
> + from experimental to stable.
> +
>
> ABI Changes
> -----------
> diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
> index bb7d86a432..59c98a0afb 100644
> --- a/lib/vhost/rte_vhost.h
> +++ b/lib/vhost/rte_vhost.h
> @@ -1075,7 +1075,6 @@ rte_vhost_slave_config_change(int vid, bool
> need_reply);
> * - Failure if lower than 0. The device ID or queue ID is invalid or
> + statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id,
> struct rte_vhost_stat_name *name, unsigned int size);
> @@ -1103,7 +1102,6 @@ rte_vhost_vring_stats_get_names(int vid, uint16_t
> queue_id,
> * - Failure if lower than 0. The device ID or queue ID is invalid, or
> * statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_get(int vid, uint16_t queue_id,
> struct rte_vhost_stat *stats, unsigned int n);
> @@ -1120,7 +1118,6 @@ rte_vhost_vring_stats_get(int vid, uint16_t queue_id,
> * - Failure if lower than 0. The device ID or queue ID is invalid, or
> * statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_reset(int vid, uint16_t queue_id);
>
> diff --git a/lib/vhost/version.map b/lib/vhost/version.map
> index 7a00b65740..8c5e8aa8d3 100644
> --- a/lib/vhost/version.map
> +++ b/lib/vhost/version.map
> @@ -57,6 +57,9 @@ DPDK_23 {
> rte_vhost_set_vring_base;
> rte_vhost_va_from_guest_pa;
> rte_vhost_vring_call;
> + rte_vhost_vring_stats_get;
> + rte_vhost_vring_stats_get_names;
> + rte_vhost_vring_stats_reset;
>
> local: *;
> };
> @@ -88,9 +91,6 @@ EXPERIMENTAL {
>
> # added in 22.07
> rte_vhost_async_get_inflight_thread_unsafe;
> - rte_vhost_vring_stats_get_names;
> - rte_vhost_vring_stats_get;
> - rte_vhost_vring_stats_reset;
> rte_vhost_async_try_dequeue_burst;
> rte_vhost_driver_get_vdpa_dev_type;
> rte_vhost_clear_queue;
> --
> 2.37.3
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
^ permalink raw reply [relevance 0%]
* RE: [PATCH v6 3/8] net/gve: add support for device initialization
2022-10-20 14:42 3% ` Ferruh Yigit
@ 2022-10-24 2:10 0% ` Guo, Junfeng
0 siblings, 0 replies; 200+ results
From: Guo, Junfeng @ 2022-10-24 2:10 UTC (permalink / raw)
To: Ferruh Yigit, Zhang, Qi Z, Wu, Jingjing, Xing, Beilei
Cc: dev, Li, Xiaoyun, awogbemila, Richardson, Bruce, hemant.agrawal,
stephen, Xia, Chenbo, Zhang, Helin, Wang, Haiyue
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Thursday, October 20, 2022 22:42
> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>;
> awogbemila@google.com; Richardson, Bruce
> <bruce.richardson@intel.com>; hemant.agrawal@nxp.com;
> stephen@networkplumber.org; Xia, Chenbo <chenbo.xia@intel.com>;
> Zhang, Helin <helin.zhang@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>
> Subject: Re: [PATCH v6 3/8] net/gve: add support for device initialization
>
> On 10/20/2022 11:36 AM, Junfeng Guo wrote:
>
> >
> > Support device init and add following devops skeleton:
> > - dev_configure
> > - dev_start
> > - dev_stop
> > - dev_close
> >
> > Note that build system (including doc) is also added in this patch.
> >
> > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> > Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
>
> <...>
>
> > index 1c3daf141d..715013fa35 100644
> > --- a/doc/guides/rel_notes/release_22_11.rst
> > +++ b/doc/guides/rel_notes/release_22_11.rst
> > @@ -140,6 +140,11 @@ New Features
> >
> > * Made compatible with libbpf v0.8.0 (when used with libxdp).
> >
> > +* **Added GVE net PMD**
> > +
> > + * Added the new ``gve`` net driver for Google Virtual Ethernet devices.
> > + * See the :doc:`../nics/gve` NIC guide for more details on this new
> driver.
> > +
>
> Can you please move it one more down, just above 'Intel', to sort it
> alphabetically based on Vendor name, in this case 'G' I guess.
> We are almost there :)
Sure, thanks for reminding this!
>
> <...>
>
> > +static int
> > +gve_dev_init(struct rte_eth_dev *eth_dev)
> > +{
> > + struct gve_priv *priv = eth_dev->data->dev_private;
> > + int max_tx_queues, max_rx_queues;
> > + struct rte_pci_device *pci_dev;
> > + struct gve_registers *reg_bar;
> > + rte_be32_t *db_bar;
> > + int err;
> > +
> > + eth_dev->dev_ops = &gve_eth_dev_ops;
> > +
> > + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> > + return 0;
> > +
> > + pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
> > +
> > + reg_bar = pci_dev->mem_resource[GVE_REG_BAR].addr;
> > + if (!reg_bar) {
> > + PMD_DRV_LOG(ERR, "Failed to map pci bar!");
> > + return -ENOMEM;
> > + }
> > +
> > + db_bar = pci_dev->mem_resource[GVE_DB_BAR].addr;
> > + if (!db_bar) {
> > + PMD_DRV_LOG(ERR, "Failed to map doorbell bar!");
> > + return -ENOMEM;
> > + }
> > +
> > + gve_write_version(®_bar->driver_version);
> > + /* Get max queues to alloc etherdev */
> > + max_tx_queues = ioread32be(®_bar->max_tx_queues);
> > + max_rx_queues = ioread32be(®_bar->max_rx_queues);
> > +
> > + priv->reg_bar0 = reg_bar;
> > + priv->db_bar2 = db_bar;
> > + priv->pci_dev = pci_dev;
> > + priv->state_flags = 0x0;
> > +
> > + priv->max_nb_txq = max_tx_queues;
> > + priv->max_nb_rxq = max_rx_queues;
> > +
> > + err = gve_init_priv(priv, false);
> > + if (err)
> > + return err;
> > +
> > + eth_dev->data->mac_addrs = rte_zmalloc("gve_mac", sizeof(struct
> rte_ether_addr), 0);
> > + if (!eth_dev->data->mac_addrs) {
> > + PMD_DRV_LOG(ERR, "Failed to allocate memory to store mac
> address");
> > + return -ENOMEM;
> > + }
> > + rte_ether_addr_copy(&priv->dev_addr, eth_dev->data-
> >mac_addrs);
> > +
>
> What is the value in 'priv->dev_addr'?
> Even allocating memory for 'eth_dev->data->mac_addrs' removed or not,
> as
> we discussed, independent from it, need to set a valid value to
> 'priv->dev_addr'.
Again, thanks for the explanation!
Will update this and re-validate for this.
The addr value could be like " 42:01:0A:00:08:03".
Thanks!
>
> <...>
>
> > diff --git a/drivers/net/gve/version.map b/drivers/net/gve/version.map
> > new file mode 100644
> > index 0000000000..c2e0723b4c
> > --- /dev/null
> > +++ b/drivers/net/gve/version.map
> > @@ -0,0 +1,3 @@
> > +DPDK_22 {
>
> DPDK_23
>
> In case it is not clear, since this comment skipped in previous a few
> versions, the ABI version should be 'DPDK_23', so the content of this
> file should be;
>
> DPDK_23 {
> local: *;
> };
Sure, will update this in the coming version. Thanks a lot!
^ permalink raw reply [relevance 0%]
* Re: [PATCH] eventdev: fix event vector documentation typo
@ 2022-10-21 9:42 8% ` Jerin Jacob
0 siblings, 0 replies; 200+ results
From: Jerin Jacob @ 2022-10-21 9:42 UTC (permalink / raw)
To: Mattias Rönnblom; +Cc: Jerin Jacob, dev, pbhagavatula, stable
On Fri, Oct 21, 2022 at 1:48 PM Mattias Rönnblom
<mattias.ronnblom@ericsson.com> wrote:
>
> The Eventdev guide had got the type of the rte_event_vector struct's
> u64s union field wrong.
>
> Fixes: 1cc44d409271 ("eventdev: introduce event vector capability")
> Cc: pbhagavatula@marvell.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Thanks, Squashed this change as
doc: fix eventdev doc updates
Fixed release notes for changes made in eventdev library.
Also updated the eventdev guide had got the type of the
rte_event_vector struct's u64s union field wrong.
Fixes: 5fa63911e43b ("eventdev: replace padding type in event vector")
Fixes: 0fbb55efa542 ("eventdev: add element offset to event vector")
Fixes: d986276f9b72 ("eventdev: add prefix to public symbol")
Fixes: 1cc44d409271 ("eventdev: introduce event vector capability")
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
diff --git a/doc/guides/prog_guide/eventdev.rst
b/doc/guides/prog_guide/eventdev.rst
index 8c13c5832c..2c83176846 100644
--- a/doc/guides/prog_guide/eventdev.rst
+++ b/doc/guides/prog_guide/eventdev.rst
@@ -85,7 +85,7 @@ flexibility in what the actual vector is.
* ``struct rte_mbuf *mbufs[0]`` - An array of mbufs.
* ``void *ptrs[0]`` - An array of pointers.
-* ``uint64_t *u64s[0]`` - An array of uint64_t elements.
+* ``uint64_t u64s[0]`` - An array of uint64_t elements.
The size of the event vector is related to the total number of elements it is
configured to hold, this is achieved by making `rte_event_vector` a variable
diff --git a/doc/guides/rel_notes/release_22_11.rst
b/doc/guides/rel_notes/release_22_11.rst
index 1c3daf141d..0d45043271 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -478,6 +478,9 @@ API Changes
* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+* eventdev: The function pointer definition ``eventdev_stop_flush_t`` is
+ renamed to ``rte_eventdev_stop_flush_t`` to avoid conflicts with application
+ symbols.
ABI Changes
-----------
@@ -520,6 +523,14 @@ ABI Changes
* eventdev: Added ``weight`` and ``affinity`` fields
to ``rte_event_queue_conf`` structure.
+* eventdev: The field ``*u64s`` in the structure ``rte_event_vector``
is replaced
+ with ``u64s`` as the field is supposed to hold array of uint64_t values.
+
+* eventdev: The structure ``rte_event_vector`` was updated to include a new bit
+ field ``elem_offset:12`` the bits are taken from the bitfield ``rsvd:15``.
+ The element offset defines the offset into the vector array at
+ which valid elements start.
+
> ---
> doc/guides/prog_guide/eventdev.rst | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/doc/guides/prog_guide/eventdev.rst b/doc/guides/prog_guide/eventdev.rst
> index 8c13c5832c..2c83176846 100644
> --- a/doc/guides/prog_guide/eventdev.rst
> +++ b/doc/guides/prog_guide/eventdev.rst
> @@ -85,7 +85,7 @@ flexibility in what the actual vector is.
>
> * ``struct rte_mbuf *mbufs[0]`` - An array of mbufs.
> * ``void *ptrs[0]`` - An array of pointers.
> -* ``uint64_t *u64s[0]`` - An array of uint64_t elements.
> +* ``uint64_t u64s[0]`` - An array of uint64_t elements.
>
> The size of the event vector is related to the total number of elements it is
> configured to hold, this is achieved by making `rte_event_vector` a variable
> --
> 2.34.1
>
^ permalink raw reply [relevance 8%]
* Re: [PATCH] ci: combine static and shared linking build tests
2022-10-17 14:07 3% [PATCH] ci: combine static and shared linking build tests David Marchand
2022-10-20 11:44 0% ` David Marchand
@ 2022-10-20 15:34 0% ` Aaron Conole
2022-10-27 11:21 0% ` David Marchand
1 sibling, 1 reply; 200+ results
From: Aaron Conole @ 2022-10-20 15:34 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Michael Santana
David Marchand <david.marchand@redhat.com> writes:
> Save some cpu time and disk by testing linking against static and shared
> library in single environments.
>
> The .ci/linux-build.sh is modified so it reconfigures an existing build
> directory: an empty DEF_LIB= means that static and shared builds are
> to be tested.
>
> ABI checks, documentation generation and unit tests are disabled for
> static builds as they would be redundant with the check against
> dynamically linked binaries, if any.
>
> Note:
> - --cross-file is an option that can be passed to meson only when
> creating a build environment,
> - for some other reason, --buildtype and other non -D options are only
> accepted when setting up a build directory with meson. When
> reconfiguring, only their -D$option forms are accepted,
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Probably also saves overall time because we would need fewer runners. I
think this is a good change.
Acked-by: Aaron Conole <aconole@redhat.com>
^ permalink raw reply [relevance 0%]
* Re: [PATCH v6 3/8] net/gve: add support for device initialization
@ 2022-10-20 14:42 3% ` Ferruh Yigit
2022-10-24 2:10 0% ` Guo, Junfeng
0 siblings, 1 reply; 200+ results
From: Ferruh Yigit @ 2022-10-20 14:42 UTC (permalink / raw)
To: Junfeng Guo, qi.z.zhang, jingjing.wu, beilei.xing
Cc: dev, xiaoyun.li, awogbemila, bruce.richardson, hemant.agrawal,
stephen, chenbo.xia, helin.zhang, Haiyue Wang
On 10/20/2022 11:36 AM, Junfeng Guo wrote:
>
> Support device init and add following devops skeleton:
> - dev_configure
> - dev_start
> - dev_stop
> - dev_close
>
> Note that build system (including doc) is also added in this patch.
>
> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
<...>
> index 1c3daf141d..715013fa35 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -140,6 +140,11 @@ New Features
>
> * Made compatible with libbpf v0.8.0 (when used with libxdp).
>
> +* **Added GVE net PMD**
> +
> + * Added the new ``gve`` net driver for Google Virtual Ethernet devices.
> + * See the :doc:`../nics/gve` NIC guide for more details on this new driver.
> +
Can you please move it one more down, just above 'Intel', to sort it
alphabetically based on Vendor name, in this case 'G' I guess.
We are almost there :)
<...>
> +static int
> +gve_dev_init(struct rte_eth_dev *eth_dev)
> +{
> + struct gve_priv *priv = eth_dev->data->dev_private;
> + int max_tx_queues, max_rx_queues;
> + struct rte_pci_device *pci_dev;
> + struct gve_registers *reg_bar;
> + rte_be32_t *db_bar;
> + int err;
> +
> + eth_dev->dev_ops = &gve_eth_dev_ops;
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return 0;
> +
> + pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
> +
> + reg_bar = pci_dev->mem_resource[GVE_REG_BAR].addr;
> + if (!reg_bar) {
> + PMD_DRV_LOG(ERR, "Failed to map pci bar!");
> + return -ENOMEM;
> + }
> +
> + db_bar = pci_dev->mem_resource[GVE_DB_BAR].addr;
> + if (!db_bar) {
> + PMD_DRV_LOG(ERR, "Failed to map doorbell bar!");
> + return -ENOMEM;
> + }
> +
> + gve_write_version(®_bar->driver_version);
> + /* Get max queues to alloc etherdev */
> + max_tx_queues = ioread32be(®_bar->max_tx_queues);
> + max_rx_queues = ioread32be(®_bar->max_rx_queues);
> +
> + priv->reg_bar0 = reg_bar;
> + priv->db_bar2 = db_bar;
> + priv->pci_dev = pci_dev;
> + priv->state_flags = 0x0;
> +
> + priv->max_nb_txq = max_tx_queues;
> + priv->max_nb_rxq = max_rx_queues;
> +
> + err = gve_init_priv(priv, false);
> + if (err)
> + return err;
> +
> + eth_dev->data->mac_addrs = rte_zmalloc("gve_mac", sizeof(struct rte_ether_addr), 0);
> + if (!eth_dev->data->mac_addrs) {
> + PMD_DRV_LOG(ERR, "Failed to allocate memory to store mac address");
> + return -ENOMEM;
> + }
> + rte_ether_addr_copy(&priv->dev_addr, eth_dev->data->mac_addrs);
> +
What is the value in 'priv->dev_addr'?
Even allocating memory for 'eth_dev->data->mac_addrs' removed or not, as
we discussed, independent from it, need to set a valid value to
'priv->dev_addr'.
<...>
> diff --git a/drivers/net/gve/version.map b/drivers/net/gve/version.map
> new file mode 100644
> index 0000000000..c2e0723b4c
> --- /dev/null
> +++ b/drivers/net/gve/version.map
> @@ -0,0 +1,3 @@
> +DPDK_22 {
DPDK_23
In case it is not clear, since this comment skipped in previous a few
versions, the ABI version should be 'DPDK_23', so the content of this
file should be;
DPDK_23 {
local: *;
};
^ permalink raw reply [relevance 3%]
* Re: [PATCH] ci: combine static and shared linking build tests
2022-10-17 14:07 3% [PATCH] ci: combine static and shared linking build tests David Marchand
@ 2022-10-20 11:44 0% ` David Marchand
2022-10-20 15:34 0% ` Aaron Conole
1 sibling, 0 replies; 200+ results
From: David Marchand @ 2022-10-20 11:44 UTC (permalink / raw)
To: dev; +Cc: Aaron Conole, Michael Santana
On Mon, Oct 17, 2022 at 4:08 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> Save some cpu time and disk by testing linking against static and shared
> library in single environments.
Some additional info.
Before, 2h27 of cpu:
https://github.com/ovsrobot/dpdk/actions/runs/3265097067/usage
After, 2h07 of cpu:
https://github.com/ovsrobot/dpdk/actions/runs/3265960025/usage
The gain in cpu time (and global duration of the tests) is smaller
than what I saw.
Quite likely, it is dependent on what is being done on the runners.
>
> The .ci/linux-build.sh is modified so it reconfigures an existing build
> directory: an empty DEF_LIB= means that static and shared builds are
> to be tested.
>
> ABI checks, documentation generation and unit tests are disabled for
> static builds as they would be redundant with the check against
> dynamically linked binaries, if any.
>
> Note:
> - --cross-file is an option that can be passed to meson only when
> creating a build environment,
> - for some other reason, --buildtype and other non -D options are only
> accepted when setting up a build directory with meson. When
> reconfiguring, only their -D$option forms are accepted,
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [relevance 0%]
* RE: release candidate 22.11-rc1
2022-10-13 5:28 0% ` Jiang, YuX
@ 2022-10-20 5:24 0% ` Jiang, YuX
0 siblings, 0 replies; 200+ results
From: Jiang, YuX @ 2022-10-20 5:24 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: Devlin, Michelle, Mcnamara, John, Chen, Zhaoyan, Peng, Yuan
> -----Original Message-----
> From: Jiang, YuX
> Sent: Thursday, October 13, 2022 1:28 PM
> To: Thomas Monjalon <thomas@monjalon.net>; dev <dev@dpdk.org>
> Cc: Devlin, Michelle <michelle.devlin@intel.com>; Mcnamara, John
> <john.mcnamara@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>;
> Peng, Yuan <yuan.peng@intel.com>
> Subject: RE: release candidate 22.11-rc1
>
> > -----Original Message-----
> > From: Thomas Monjalon <thomas@monjalon.net>
> > Sent: Tuesday, October 11, 2022 9:50 AM
> > To: announce@dpdk.org
> > Subject: release candidate 22.11-rc1
> >
> > A new DPDK release candidate is ready for testing:
> > https://git.dpdk.org/dpdk/tag/?id=v22.11-rc1
> >
> > There are 737 new patches in this snapshot, including many API/ABI
> > compatibility breakages.
> > This release won't be ABI-compatible with previous ones.
> >
> > Release notes:
> > https://doc.dpdk.org/guides/rel_notes/release_22_11.html
> >
> > Highlights of 22.11-rc1:
> > - LoongArch build
> > - Intel uncore frequency control
> > - multiple mbuf pools per Rx queue
> > - Rx buffer split based on protocol
> > - hardware congestion management
> > - hairpin memory configuration
> > - Rx/Tx descriptor dump
> > - flow API extensions
> > - MACsec processing offload
> > - ShangMi crypto algorithms
> > - baseband FFT operations
> > - eventdev Tx queue start/stop
> > - eventdev crypto vectorization
> > - NitroSketch membership
> >
> > Some work is in progress to optimize the mempool cache.
> > Some patches are part of -rc1, and more could be merged in -rc2.
> > Please measure the performance of this release candidate, and check
> > these mempool patches:
> > https://patches.dpdk.org/project/dpdk/list/?series=25063
> >
> > Please test and report issues on bugs.dpdk.org.
> >
> > DPDK 22.11-rc2 is expected in two weeks.
> >
> > Thank you everyone
> >
> Update the test status for Intel part. Till now dpdk22.11-rc1 test execution rate
> is 60%. Two critical issues are found.
> 1, [22.11-rc1]iavf macfwd performance drop 40%, Intel dev is under
> investigating.
> 2, dpdk_vm_power_manger failed to start and coredumps:
> Fix patch:
> https://patches.dpdk.org/project/dpdk/patch/20221012123637.51640-1-
> markus.theil@tu-ilmenau.de/. but not verify yet.
> # Basic Intel(R) NIC testing
> * Build or compile:
> *Build: cover the build test combination with latest GCC/Clang version and the
> popular OS revision such as Ubuntu20.04.5, Ubuntu22.04.1, Fedora36, RHEL8.6
> etc.
> - All test passed.
> *Compile: cover the CFLAGES(O0/O1/O2/O3) with popular OS such as
> Ubuntu22.04.1 and RHEL8.6.
> - All test passed.
> * PF/VF(i40e, ixgbe): test scenarios including PF/VF-
> RTE_FLOW/TSO/Jumboframe/checksum offload/VLAN/VXLAN, etc.
> - Execution rate is 80%.
> - New bug: https://bugs.dpdk.org/show_bug.cgi?id=1101 [dpdk-
> 22.11.0rc1][meson test] driver-tests/eventdev_selftest_sw test failed
> Bad commit is a2833ecc5ea4adcbc3b77e7aeac2a6fd945da6a0
> mempool: fix get objects from mempool with cache
> * PF/VF(ice): test scenarios including Switch features/Package
> Management/Flow Director/Advanced Tx/Advanced RSS/ACL/DCF/Flexible
> Descriptor, etc.
> - Execution rate is 80%. Find 5 new issues, Intel dev is under
> investigating.
> * Intel NIC single core/NIC performance: test scenarios including PF/VF single
> core performance test, RFC2544 Zero packet loss performance test, etc.
> - Execution rate is 80%. Find one critical issue: [22.11-rc1]iavf macfwd
> performance drop 40%, Intel dev is under investigating.
> * Power and IPsec:
> * Power: test scenarios including bi-direction/Telemetry/Empty Poll
> Lib/Priority Base Frequency, etc.
> - Under testing. One critical issue is found: dpdk_vm_power_manger
> failed to start and coredumps.
> * IPsec: test scenarios including ipsec/ipsec-gw/ipsec library basic test -
> QAT&SW/FIB library, etc.
> - Execution rate is 40%. Find one issue, Intel dev is under investigating.
> # Basic cryptodev and virtio testing
> * Virtio: both function and performance test are covered. Such as
> PVP/Virtio_loopback/virtio-user loopback/virtio-net VM2VM perf
> testing/VMAWARE ESXI 7.0u3, etc.
> - Execution rate is 80%. No new issue is found.
> - Known issue's fix patch:
> http://patches.dpdk.org/project/dpdk/patch/20221011030803.16746-3-
> cheng1.jiang@intel.com/.
> * Cryptodev:
> *Function test: test scenarios including Cryptodev API testing/CompressDev
> ISA-L/QAT/ZLIB PMD Testing/FIPS, etc.
> - Under testing. Find one bug about FIPS tests are failing, Intel dev is
> under investigating.
> *Performance test: test scenarios including Throughput Performance
> /Cryptodev Latency, etc.
> - Under testing.
>
> Best regards,
> Yu Jiang
Update the test status for Intel part. Till now dpdk22.11-rc1 test is almost finished. Two critical issues are found.
1, [22.11-rc1]iavf macfwd performance drop 40%, Intel dev revert this bad patch.
2, dpdk_vm_power_manger failed to start and coredumps:
Fix patch: https://patches.dpdk.org/project/dpdk/patch/20221012123637.51640-1-markus.theil@tu-ilmenau.de/.
# Basic Intel(R) NIC testing
* Build or compile:
*Build: cover the build test combination with latest GCC/Clang version and the popular OS revision such as Ubuntu20.04.5, Ubuntu22.04.1, Fedora36, RHEL8.6 etc.
- All test passed.
*Compile: cover the CFLAGES(O0/O1/O2/O3) with popular OS such as Ubuntu22.04.1 and RHEL8.6.
- All test passed.
* Meson test: find 3 bugs
- https://bugs.dpdk.org/show_bug.cgi?id=1101 [dpdk-22.11.0rc1][meson test] driver-tests/eventdev_selftest_sw test failed
- fixed by https://patches.dpdk.org/project/dpdk/patch/20221014203710.6172-1-olivier.matz@6wind.com/
- https://bugs.dpdk.org/show_bug.cgi?id=1105 dpdk-22.11] unit_tests_loopback: pmd_perf_autotest failed -> On going
- https://bugs.dpdk.org/show_bug.cgi?id=1107 [22.11-rc1][meson test] seqlock_autotest test failed -> On going
* PF/VF(i40e, ixgbe): test scenarios including PF/VF-RTE_FLOW/TSO/Jumboframe/checksum offload/VLAN/VXLAN, etc.
- All test done. Find 3+ bugs, Intel Dev is under investigating.
- Asan bug: asan error detected memory leaks when quit testpmd
- Can be fixed by https://patches.dpdk.org/project/dpdk/patch/20221019123743.1282969-1-kevin.laatz@intel.com/
* PF/VF(ice): test scenarios including Switch features/Package Management/Flow Director/Advanced Tx/Advanced RSS/ACL/DCF/Flexible Descriptor, etc.
- All test done. Find 3+ new issues, Intel dev are under investigating.
* Intel NIC single core/NIC performance: test scenarios including PF/VF single core performance test, RFC2544 Zero packet loss performance test, etc.
- All test done. Issue about [22.11-rc1]iavf macfwd performance drop 40%, Dev revert the bad patch to fix.
* Power and IPsec:
* Power: test scenarios including bi-direction/Telemetry/Empty Poll Lib/Priority Base Frequency, etc.
- All test done.
* IPsec: test scenarios including ipsec/ipsec-gw/ipsec library basic test - QAT&SW/FIB library, etc.
- All test done. Find 2 new bugs.
- Bug https://bugs.dpdk.org/show_bug.cgi?id=1106 ipsec-secgw inline test fail
- Can be fixed by https://patches.dpdk.org/project/dpdk/patch/20220930124055.2682935-1-radu.nicolau@intel.com/
# Basic cryptodev and virtio testing
* Virtio: both function and performance test are covered. Such as PVP/Virtio_loopback/virtio-user loopback/virtio-net VM2VM perf testing/VMAWARE ESXI 7.0u3, etc.
- All test done. No new issue is found.
- Known issue's fix patch: http://patches.dpdk.org/project/dpdk/patch/20221011030803.16746-3-cheng1.jiang@intel.com/.
* Cryptodev:
*Function test: test scenarios including Cryptodev API testing/CompressDev ISA-L/QAT/ZLIB PMD Testing/FIPS, etc.
- All test done. Find one bug about FIPS tests are failing, Intel dev are under investigating.
*Performance test: test scenarios including Throughput Performance /Cryptodev Latency, etc.
- All test done. No performance drop.
Best regards,
Yu Jiang
^ permalink raw reply [relevance 0%]
* Re: [PATCH v2] eventdev: increase xstats ID width to 64 bits
2022-10-13 11:35 2% ` [PATCH v2] " pbhagavatula
@ 2022-10-19 13:24 0% ` Jerin Jacob
0 siblings, 0 replies; 200+ results
From: Jerin Jacob @ 2022-10-19 13:24 UTC (permalink / raw)
To: pbhagavatula
Cc: mb, jerinj, thomas, Shijith Thotton, Timothy McDaniel,
Mattias Rönnblom, Liang Ma, Peter Mccarthy,
Harry van Haaren, dev
On Thu, Oct 13, 2022 at 5:05 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Increase xstats ID width from 32 to 64 bits. This also
> fixes the xstats ID datatype discrepancy between reset and
> rest of the xstats family.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> Reviewed-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-eventdev/for-main. Thanks
> ---
> v2 Changes:
> - Fix compilation on 32 bit platforms. (Mattias)
>
> doc/guides/rel_notes/release_22_11.rst | 5 ++
> drivers/event/cnxk/cnxk_eventdev.h | 6 +-
> drivers/event/cnxk/cnxk_eventdev_stats.c | 6 +-
> drivers/event/dlb2/dlb2_priv.h | 8 +-
> drivers/event/dlb2/dlb2_xstats.c | 18 ++--
> drivers/event/dsw/dsw_evdev.h | 6 +-
> drivers/event/dsw/dsw_xstats.c | 32 +++----
> drivers/event/opdl/opdl_evdev.h | 8 +-
> drivers/event/opdl/opdl_evdev_xstats.c | 8 +-
> drivers/event/opdl/opdl_test.c | 4 +-
> drivers/event/sw/sw_evdev.h | 8 +-
> drivers/event/sw/sw_evdev_selftest.c | 101 +++++++++++------------
> drivers/event/sw/sw_evdev_xstats.c | 18 ++--
> lib/eventdev/eventdev_pmd.h | 8 +-
> lib/eventdev/rte_eventdev.c | 12 +--
> lib/eventdev/rte_eventdev.h | 8 +-
> 16 files changed, 128 insertions(+), 128 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 2da8bc9661..6b76ad5566 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -454,6 +454,11 @@ API Changes
>
> * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
>
> +* eventdev: The datatype of the ID parameter in the functions
> + ``rte_event_dev_xstats_names_get``, ``rte_event_dev_xstats_get``,
> + ``rte_event_dev_xstats_by_name_get`` and ``rte_event_dev_xstats_reset``
> + is changed to ``uint64_t`` from ``unsigned int`` and ``uint32_t``.
> +
>
> ABI Changes
> -----------
> diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
> index f68c2aee23..738e335ea4 100644
> --- a/drivers/event/cnxk/cnxk_eventdev.h
> +++ b/drivers/event/cnxk/cnxk_eventdev.h
> @@ -271,14 +271,14 @@ int cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
> int cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, const unsigned int ids[],
> + uint8_t queue_port_id, const uint64_t ids[],
> uint64_t values[], unsigned int n);
> int cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> - int16_t queue_port_id, const uint32_t ids[],
> + int16_t queue_port_id, const uint64_t ids[],
> uint32_t n);
>
> /* CN9K */
> diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c b/drivers/event/cnxk/cnxk_eventdev_stats.c
> index a3b548f462..715ca9cd8f 100644
> --- a/drivers/event/cnxk/cnxk_eventdev_stats.c
> +++ b/drivers/event/cnxk/cnxk_eventdev_stats.c
> @@ -103,7 +103,7 @@ static struct cnxk_sso_xstats_name sso_hwgrp_xstats[] = {
> int
> cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> struct roc_sso_hwgrp_stats hwgrp_stats;
> @@ -170,7 +170,7 @@ cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
> int
> cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> - int16_t queue_port_id, const uint32_t ids[], uint32_t n)
> + int16_t queue_port_id, const uint64_t ids[], uint32_t n)
> {
> struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> struct roc_sso_hwgrp_stats hwgrp_stats;
> @@ -235,7 +235,7 @@ cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> struct rte_event_dev_xstats_name xstats_names_copy[CNXK_SSO_NUM_XSTATS];
> struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
> index 9ef5bcb901..52f0ab9935 100644
> --- a/drivers/event/dlb2/dlb2_priv.h
> +++ b/drivers/event/dlb2/dlb2_priv.h
> @@ -688,20 +688,20 @@ void dlb2_xstats_uninit(struct dlb2_eventdev *dlb2);
>
> int dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
>
> int dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstat_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
>
> uint64_t dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
>
> int dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> int test_dlb2_eventdev(void);
> diff --git a/drivers/event/dlb2/dlb2_xstats.c b/drivers/event/dlb2/dlb2_xstats.c
> index d4c8d99034..ff15271dda 100644
> --- a/drivers/event/dlb2/dlb2_xstats.c
> +++ b/drivers/event/dlb2/dlb2_xstats.c
> @@ -666,7 +666,7 @@ int
> dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> const struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> unsigned int i;
> @@ -717,7 +717,7 @@ dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
> static int
> dlb2_xstats_update(struct dlb2_eventdev *dlb2,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, const unsigned int ids[],
> + uint8_t queue_port_id, const uint64_t ids[],
> uint64_t values[], unsigned int n, const uint32_t reset)
> {
> unsigned int i;
> @@ -791,7 +791,7 @@ dlb2_xstats_update(struct dlb2_eventdev *dlb2,
> int
> dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> const uint32_t reset = 0;
> @@ -802,7 +802,7 @@ dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
>
> uint64_t
> dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id)
> + const char *name, uint64_t *id)
> {
> struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> unsigned int i;
> @@ -876,7 +876,7 @@ dlb2_xstats_reset_range(struct dlb2_eventdev *dlb2, uint32_t start,
>
> static int
> dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> const uint32_t reset = 1;
>
> @@ -898,7 +898,7 @@ dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
>
> static int
> dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> const uint32_t reset = 1;
> int offset = dlb2->xstats_offset_for_port[port_id];
> @@ -917,14 +917,14 @@ dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
> }
>
> static int
> -dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint32_t ids[],
> +dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint64_t ids[],
> uint32_t nb_ids)
> {
> uint32_t i;
>
> if (ids) {
> for (i = 0; i < nb_ids; i++) {
> - uint32_t id = ids[i];
> + uint64_t id = ids[i];
>
> if (id >= dlb2->xstats_count_mode_dev)
> return -EINVAL;
> @@ -942,7 +942,7 @@ int
> dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids)
> {
> struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
> index df7dcc5577..6416a8a898 100644
> --- a/drivers/event/dsw/dsw_evdev.h
> +++ b/drivers/event/dsw/dsw_evdev.h
> @@ -283,12 +283,12 @@ int dsw_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
> int dsw_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
> uint64_t dsw_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
>
> static inline struct dsw_evdev *
> dsw_pmd_priv(const struct rte_eventdev *eventdev)
> diff --git a/drivers/event/dsw/dsw_xstats.c b/drivers/event/dsw/dsw_xstats.c
> index 4f7d4e3ff9..2a83a28b41 100644
> --- a/drivers/event/dsw/dsw_xstats.c
> +++ b/drivers/event/dsw/dsw_xstats.c
> @@ -15,8 +15,8 @@
> */
> #define DSW_XSTATS_ID_PARAM_BITS (8)
> #define DSW_XSTATS_ID_STAT_BITS \
> - (sizeof(unsigned int)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
> -#define DSW_XSTATS_ID_STAT_MASK ((1 << DSW_XSTATS_ID_STAT_BITS) - 1)
> + (sizeof(uint64_t)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
> +#define DSW_XSTATS_ID_STAT_MASK ((UINT64_C(1) << DSW_XSTATS_ID_STAT_BITS) - 1)
>
> #define DSW_XSTATS_ID_GET_PARAM(id) \
> ((id)>>DSW_XSTATS_ID_STAT_BITS)
> @@ -25,7 +25,7 @@
> ((id) & DSW_XSTATS_ID_STAT_MASK)
>
> #define DSW_XSTATS_ID_CREATE(id, param_value) \
> - (((param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
> + ((((uint64_t)param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
>
> typedef
> uint64_t (*dsw_xstats_dev_get_value_fn)(struct dsw_evdev *dsw);
> @@ -169,7 +169,7 @@ static struct dsw_xstats_port dsw_port_xstats[] = {
> typedef
> void (*dsw_xstats_foreach_fn)(const char *xstats_name,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, unsigned int xstats_id,
> + uint8_t queue_port_id, uint64_t xstats_id,
> void *data);
>
> static void
> @@ -193,7 +193,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t port_id,
> stat_idx < RTE_DIM(dsw_port_xstats);) {
> struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
> char xstats_name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
> - unsigned int xstats_id;
> + uint64_t xstats_id;
>
> if (xstat->per_queue) {
> xstats_id = DSW_XSTATS_ID_CREATE(stat_idx, queue_id);
> @@ -219,7 +219,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t port_id,
>
> struct store_ctx {
> struct rte_event_dev_xstats_name *names;
> - unsigned int *ids;
> + uint64_t *ids;
> unsigned int count;
> unsigned int capacity;
> };
> @@ -227,7 +227,7 @@ struct store_ctx {
> static void
> dsw_xstats_store_stat(const char *xstats_name,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, unsigned int xstats_id,
> + uint8_t queue_port_id, uint64_t xstats_id,
> void *data)
> {
> struct store_ctx *ctx = data;
> @@ -248,7 +248,7 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int capacity)
> + uint64_t *ids, unsigned int capacity)
> {
> struct dsw_evdev *dsw = dsw_pmd_priv(dev);
>
> @@ -276,13 +276,13 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
>
> static int
> dsw_xstats_dev_get(const struct rte_eventdev *dev,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct dsw_evdev *dsw = dsw_pmd_priv(dev);
> unsigned int i;
>
> for (i = 0; i < n; i++) {
> - unsigned int id = ids[i];
> + uint64_t id = ids[i];
> struct dsw_xstat_dev *xstat = &dsw_dev_xstats[id];
> values[i] = xstat->get_value_fn(dsw);
> }
> @@ -291,13 +291,13 @@ dsw_xstats_dev_get(const struct rte_eventdev *dev,
>
> static int
> dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct dsw_evdev *dsw = dsw_pmd_priv(dev);
> unsigned int i;
>
> for (i = 0; i < n; i++) {
> - unsigned int id = ids[i];
> + uint64_t id = ids[i];
> unsigned int stat_idx = DSW_XSTATS_ID_GET_STAT(id);
> struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
> uint8_t queue_id = 0;
> @@ -313,7 +313,7 @@ dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
> int
> dsw_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> switch (mode) {
> case RTE_EVENT_DEV_XSTATS_DEVICE:
> @@ -332,14 +332,14 @@ dsw_xstats_get(const struct rte_eventdev *dev,
> struct find_ctx {
> const struct rte_eventdev *dev;
> const char *name;
> - unsigned int *id;
> + uint64_t *id;
> uint64_t value;
> };
>
> static void
> dsw_xstats_find_stat(const char *xstats_name,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, unsigned int xstats_id,
> + uint8_t queue_port_id, uint64_t xstats_id,
> void *data)
> {
> struct find_ctx *ctx = data;
> @@ -354,7 +354,7 @@ dsw_xstats_find_stat(const char *xstats_name,
>
> uint64_t
> dsw_xstats_get_by_name(const struct rte_eventdev *dev, const char *name,
> - unsigned int *id)
> + uint64_t *id)
> {
> struct dsw_evdev *dsw = dsw_pmd_priv(dev);
> uint16_t port_id;
> diff --git a/drivers/event/opdl/opdl_evdev.h b/drivers/event/opdl/opdl_evdev.h
> index 2dca0a8a98..1ca166b37c 100644
> --- a/drivers/event/opdl/opdl_evdev.h
> +++ b/drivers/event/opdl/opdl_evdev.h
> @@ -289,16 +289,16 @@ int opdl_xstats_uninit(struct rte_eventdev *dev);
> int opdl_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
> int opdl_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
> uint64_t opdl_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
> int opdl_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> int opdl_add_event_handlers(struct rte_eventdev *dev);
> diff --git a/drivers/event/opdl/opdl_evdev_xstats.c b/drivers/event/opdl/opdl_evdev_xstats.c
> index 27b3d88023..b382f6619d 100644
> --- a/drivers/event/opdl/opdl_evdev_xstats.c
> +++ b/drivers/event/opdl/opdl_evdev_xstats.c
> @@ -65,7 +65,7 @@ opdl_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> struct opdl_evdev *device = opdl_pmd_priv(dev);
>
> @@ -99,7 +99,7 @@ int
> opdl_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> - const unsigned int ids[],
> + const uint64_t ids[],
> uint64_t values[], unsigned int n)
> {
> struct opdl_evdev *device = opdl_pmd_priv(dev);
> @@ -133,7 +133,7 @@ opdl_xstats_get(const struct rte_eventdev *dev,
>
> uint64_t
> opdl_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id)
> + const char *name, uint64_t *id)
> {
> struct opdl_evdev *device = opdl_pmd_priv(dev);
>
> @@ -161,7 +161,7 @@ opdl_xstats_get_by_name(const struct rte_eventdev *dev,
> int
> opdl_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> - int16_t queue_port_id, const uint32_t ids[],
> + int16_t queue_port_id, const uint64_t ids[],
> uint32_t nb_ids)
> {
> struct opdl_evdev *device = opdl_pmd_priv(dev);
> diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
> index 3cbe2139ee..b69c4769dc 100644
> --- a/drivers/event/opdl/opdl_test.c
> +++ b/drivers/event/opdl/opdl_test.c
> @@ -471,7 +471,7 @@ atomic_basic(struct test *t)
> return 0;
> }
> static __rte_always_inline int
> -check_qid_stats(uint32_t id[], int index)
> +check_qid_stats(uint64_t id[], int index)
> {
>
> if (index == 0) {
> @@ -509,7 +509,7 @@ check_statistics(void)
> 0);
> if (num_stats > 0) {
>
> - uint32_t id[num_stats];
> + uint64_t id[num_stats];
> struct rte_event_dev_xstats_name names[num_stats];
> uint64_t values[num_stats];
>
> diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
> index 8542b7d34d..c7b943a72b 100644
> --- a/drivers/event/sw/sw_evdev.h
> +++ b/drivers/event/sw/sw_evdev.h
> @@ -301,16 +301,16 @@ int sw_xstats_uninit(struct sw_evdev *dev);
> int sw_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
> int sw_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
> uint64_t sw_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
> int sw_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> int test_sw_eventdev(void);
> diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
> index ed7ae6a685..62d66744f2 100644
> --- a/drivers/event/sw/sw_evdev_selftest.c
> +++ b/drivers/event/sw/sw_evdev_selftest.c
> @@ -92,7 +92,7 @@ xstats_print(void)
> {
> const uint32_t XSTATS_MAX = 1024;
> uint32_t i;
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> uint64_t values[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> @@ -310,15 +310,14 @@ static inline int
> test_event_dev_stats_get(int dev_id, struct test_event_dev_stats *stats)
> {
> static uint32_t i;
> - static uint32_t total_ids[3]; /* rx, tx and drop */
> - static uint32_t port_rx_pkts_ids[MAX_PORTS];
> - static uint32_t port_rx_dropped_ids[MAX_PORTS];
> - static uint32_t port_inflight_ids[MAX_PORTS];
> - static uint32_t port_tx_pkts_ids[MAX_PORTS];
> - static uint32_t qid_rx_pkts_ids[MAX_QIDS];
> - static uint32_t qid_rx_dropped_ids[MAX_QIDS];
> - static uint32_t qid_tx_pkts_ids[MAX_QIDS];
> -
> + static uint64_t total_ids[3]; /* rx, tx and drop */
> + static uint64_t port_rx_pkts_ids[MAX_PORTS];
> + static uint64_t port_rx_dropped_ids[MAX_PORTS];
> + static uint64_t port_inflight_ids[MAX_PORTS];
> + static uint64_t port_tx_pkts_ids[MAX_PORTS];
> + static uint64_t qid_rx_pkts_ids[MAX_QIDS];
> + static uint64_t qid_rx_dropped_ids[MAX_QIDS];
> + static uint64_t qid_tx_pkts_ids[MAX_QIDS];
>
> stats->rx_pkts = rte_event_dev_xstats_by_name_get(dev_id,
> "dev_rx", &total_ids[0]);
> @@ -863,7 +862,7 @@ xstats_tests(struct test *t)
> const uint32_t XSTATS_MAX = 1024;
>
> uint32_t i;
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> uint64_t values[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> @@ -963,11 +962,10 @@ xstats_tests(struct test *t)
> static const uint64_t expected[] = {3, 3, 0, 1, 0, 0, 4, 1};
> for (i = 0; (signed int)i < ret; i++) {
> if (expected[i] != values[i]) {
> - printf(
> - "%d Error xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], expected[i]);
> + printf("%d Error xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], expected[i]);
> goto fail;
> }
> }
> @@ -982,11 +980,10 @@ xstats_tests(struct test *t)
> 0, ids, values, num_stats);
> for (i = 0; (signed int)i < ret; i++) {
> if (expected_zero[i] != values[i]) {
> - printf(
> - "%d Error, xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], expected_zero[i]);
> + printf("%d Error, xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], expected_zero[i]);
> goto fail;
> }
> }
> @@ -1058,11 +1055,10 @@ xstats_tests(struct test *t)
> 0, ids, values, num_stats);
> for (i = 0; (signed int)i < ret; i++) {
> if (port_expected_zero[i] != values[i]) {
> - printf(
> - "%d, Error, xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], port_expected_zero[i]);
> + printf("%d, Error, xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], port_expected_zero[i]);
> goto fail;
> }
> }
> @@ -1095,11 +1091,10 @@ xstats_tests(struct test *t)
> };
> for (i = 0; (signed int)i < ret; i++) {
> if (queue_expected[i] != values[i]) {
> - printf(
> - "%d, Error, xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], queue_expected[i]);
> + printf("%d, Error, xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], queue_expected[i]);
> goto fail;
> }
> }
> @@ -1129,11 +1124,10 @@ xstats_tests(struct test *t)
> int fails = 0;
> for (i = 0; (signed int)i < ret; i++) {
> if (queue_expected_zero[i] != values[i]) {
> - printf(
> - "%d, Error, xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], queue_expected_zero[i]);
> + printf("%d, Error, xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], queue_expected_zero[i]);
> fails++;
> }
> }
> @@ -1160,7 +1154,7 @@ xstats_id_abuse_tests(struct test *t)
> const uint32_t XSTATS_MAX = 1024;
> const uint32_t link_port = 2;
>
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> /* Create instance with 4 ports */
> @@ -1379,7 +1373,7 @@ xstats_brute_force(struct test *t)
> {
> uint32_t i;
> const uint32_t XSTATS_MAX = 1024;
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> uint64_t values[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> @@ -1454,7 +1448,7 @@ xstats_id_reset_tests(struct test *t)
> #define XSTATS_MAX 1024
> int ret;
> uint32_t i;
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> uint64_t values[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> @@ -1510,13 +1504,14 @@ xstats_id_reset_tests(struct test *t)
> };
> uint64_t dev_expected[] = {NPKTS, NPKTS, 0, 1, 0, 0, 4, 1};
> for (i = 0; (int)i < ret; i++) {
> - unsigned int id;
> + uint64_t id;
> uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
> dev_names[i],
> &id);
> if (id != i) {
> - printf("%d: %s id incorrect, expected %d got %d\n",
> - __LINE__, dev_names[i], i, id);
> + printf("%d: %s id incorrect, expected %d got %" PRIu64
> + "\n",
> + __LINE__, dev_names[i], i, id);
> goto fail;
> }
> if (val != dev_expected[i]) {
> @@ -1631,20 +1626,20 @@ xstats_id_reset_tests(struct test *t)
>
> int failed = 0;
> for (i = 0; (int)i < ret; i++) {
> - unsigned int id;
> + uint64_t id;
> uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
> port_names[i],
> &id);
> if (id != i + PORT_OFF) {
> - printf("%d: %s id incorrect, expected %d got %d\n",
> - __LINE__, port_names[i], i+PORT_OFF,
> - id);
> + printf("%d: %s id incorrect, expected %d got %" PRIu64
> + "\n",
> + __LINE__, port_names[i], i + PORT_OFF, id);
> failed = 1;
> }
> if (val != port_expected[i]) {
> - printf("%d: %s value incorrect, expected %"PRIu64
> - " got %d\n", __LINE__, port_names[i],
> - port_expected[i], id);
> + printf("%d: %s value incorrect, expected %" PRIu64
> + " got %" PRIu64 "\n",
> + __LINE__, port_names[i], port_expected[i], id);
> failed = 1;
> }
> /* reset to zero */
> @@ -1746,14 +1741,14 @@ xstats_id_reset_tests(struct test *t)
>
> failed = 0;
> for (i = 0; (int)i < ret; i++) {
> - unsigned int id;
> + uint64_t id;
> uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
> queue_names[i],
> &id);
> if (id != i + QUEUE_OFF) {
> - printf("%d: %s id incorrect, expected %d got %d\n",
> - __LINE__, queue_names[i], i+QUEUE_OFF,
> - id);
> + printf("%d: %s id incorrect, expected %d got %" PRIu64
> + "\n",
> + __LINE__, queue_names[i], i + QUEUE_OFF, id);
> failed = 1;
> }
> if (val != queue_expected[i]) {
> diff --git a/drivers/event/sw/sw_evdev_xstats.c b/drivers/event/sw/sw_evdev_xstats.c
> index c2647d7da2..fbac8f3ab5 100644
> --- a/drivers/event/sw/sw_evdev_xstats.c
> +++ b/drivers/event/sw/sw_evdev_xstats.c
> @@ -393,7 +393,7 @@ int
> sw_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> const struct sw_evdev *sw = sw_pmd_priv_const(dev);
> unsigned int i;
> @@ -444,7 +444,7 @@ sw_xstats_get_names(const struct rte_eventdev *dev,
>
> static int
> sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, const unsigned int ids[],
> + uint8_t queue_port_id, const uint64_t ids[],
> uint64_t values[], unsigned int n, const uint32_t reset,
> const uint32_t ret_if_n_lt_nstats)
> {
> @@ -509,7 +509,7 @@ sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
> int
> sw_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct sw_evdev *sw = sw_pmd_priv(dev);
> const uint32_t reset = 0;
> @@ -520,7 +520,7 @@ sw_xstats_get(const struct rte_eventdev *dev,
>
> uint64_t
> sw_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id)
> + const char *name, uint64_t *id)
> {
> const struct sw_evdev *sw = sw_pmd_priv_const(dev);
> unsigned int i;
> @@ -556,7 +556,7 @@ sw_xstats_reset_range(struct sw_evdev *sw, uint32_t start, uint32_t num)
>
> static int
> sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> const uint32_t reset = 1;
> const uint32_t ret_n_lt_stats = 0;
> @@ -577,7 +577,7 @@ sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
>
> static int
> sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> const uint32_t reset = 1;
> const uint32_t ret_n_lt_stats = 0;
> @@ -597,12 +597,12 @@ sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
> }
>
> static int
> -sw_xstats_reset_dev(struct sw_evdev *sw, const uint32_t ids[], uint32_t nb_ids)
> +sw_xstats_reset_dev(struct sw_evdev *sw, const uint64_t ids[], uint32_t nb_ids)
> {
> uint32_t i;
> if (ids) {
> for (i = 0; i < nb_ids; i++) {
> - uint32_t id = ids[i];
> + uint64_t id = ids[i];
> if (id >= sw->xstats_count_mode_dev)
> return -EINVAL;
> sw_xstats_reset_range(sw, id, 1);
> @@ -619,7 +619,7 @@ int
> sw_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids)
> {
> struct sw_evdev *sw = sw_pmd_priv(dev);
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index e49ff23db5..aebab26852 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -529,7 +529,7 @@ typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
> */
> typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
>
> /**
> * Resets the statistic values in xstats for the device, based on mode.
> @@ -537,7 +537,7 @@ typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
> typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> /**
> @@ -564,7 +564,7 @@ typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
> typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
>
> /**
> * Get value of one stats and optionally return its id
> @@ -582,7 +582,7 @@ typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
> * if id pointer is non-NULL
> */
> typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
>
>
> /**
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 845f8dbb6e..b0414206d9 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -1161,7 +1161,7 @@ int
> rte_event_dev_xstats_names_get(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
> const int cnt_expected_entries = xstats_get_count(dev_id, mode,
> @@ -1183,7 +1183,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
> /* retrieve eventdev extended statistics */
> int
> rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, const unsigned int ids[],
> + uint8_t queue_port_id, const uint64_t ids[],
> uint64_t values[], unsigned int n)
> {
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
> @@ -1198,11 +1198,11 @@ rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode,
>
> uint64_t
> rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
> - unsigned int *id)
> + uint64_t *id)
> {
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0);
> const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> - unsigned int temp = -1;
> + uint64_t temp = -1;
>
> if (id != NULL)
> *id = (unsigned int)-1;
> @@ -1217,7 +1217,7 @@ rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
>
> int rte_event_dev_xstats_reset(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode, int16_t queue_port_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
> struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> @@ -1658,7 +1658,7 @@ eventdev_build_telemetry_data(int dev_id,
> struct rte_tel_data *d)
> {
> struct rte_event_dev_xstats_name *xstat_names;
> - unsigned int *ids;
> + uint64_t *ids;
> uint64_t *values;
> int i, ret, num_xstats;
>
> diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
> index 60e9043ac4..82e8976e57 100644
> --- a/lib/eventdev/rte_eventdev.h
> +++ b/lib/eventdev/rte_eventdev.h
> @@ -1784,7 +1784,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids,
> + uint64_t *ids,
> unsigned int size);
>
> /**
> @@ -1817,7 +1817,7 @@ int
> rte_event_dev_xstats_get(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> - const unsigned int ids[],
> + const uint64_t ids[],
> uint64_t values[], unsigned int n);
>
> /**
> @@ -1838,7 +1838,7 @@ rte_event_dev_xstats_get(uint8_t dev_id,
> */
> uint64_t
> rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
> - unsigned int *id);
> + uint64_t *id);
>
> /**
> * Reset the values of the xstats of the selected component in the device.
> @@ -1864,7 +1864,7 @@ int
> rte_event_dev_xstats_reset(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> /**
> --
> 2.25.1
>
^ permalink raw reply [relevance 0%]
* Re: [PATCH] eventdev: update release notes
2022-10-13 9:15 10% [PATCH] eventdev: update release notes pbhagavatula
@ 2022-10-19 13:00 0% ` Jerin Jacob
0 siblings, 0 replies; 200+ results
From: Jerin Jacob @ 2022-10-19 13:00 UTC (permalink / raw)
To: pbhagavatula; +Cc: jerinj, dev
On Thu, Oct 13, 2022 at 2:48 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Update release notes for changes made in eventdev library.
>
> Fixes: 5fa63911e43b ("eventdev: replace padding type in event vector")
> Fixes: 0fbb55efa542 ("eventdev: add element offset to event vector")
> Fixes: d986276f9b72 ("eventdev: add prefix to public symbol")
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Updated the git commit as follows and applied to
dpdk-next-net-eventdev/for-main. Thanks
doc: fix release note to include evendev changes
Update release notes for changes made in eventdev library.
Fixes: 5fa63911e43b ("eventdev: replace padding type in event vector")
Fixes: 0fbb55efa542 ("eventdev: add element offset to event vector")
Fixes: d986276f9b72 ("eventdev: add prefix to public symbol")
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
> ---
> doc/guides/rel_notes/release_22_11.rst | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 2da8bc9661..800dcf2b53 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -454,6 +454,9 @@ API Changes
>
> * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
>
> +* eventdev: The function pointer definition ``eventdev_stop_flush_t`` is
> + renamed to ``rte_eventdev_stop_flush_t`` to avoid conflicts with application
> + symbols.
>
> ABI Changes
> -----------
> @@ -496,6 +499,13 @@ ABI Changes
> * eventdev: Added ``weight`` and ``affinity`` fields
> to ``rte_event_queue_conf`` structure.
>
> +* eventdev: The field ``*u64s`` in the structure ``rte_event_vector`` is replaced
> + with ``u64s`` as the field is supposed to hold array of uint64_t values.
> +
> +* eventdev: The structure ``rte_event_vector`` was updated to include a new bit
> + field ``elem_offset:12`` the bits are taken from the bitfield ``rsvd:15``.
> + The element offset defines the offset into the vector array at
> + which valid elements start.
>
> Known Issues
> ------------
> --
> 2.25.1
>
^ permalink raw reply [relevance 0%]
* Re: [PATCH v2 03/24] net/nfp: add the flow APIs of nfp PMD
2022-10-19 11:30 0% ` Chaoyong He
@ 2022-10-19 11:38 0% ` Ferruh Yigit
0 siblings, 0 replies; 200+ results
From: Ferruh Yigit @ 2022-10-19 11:38 UTC (permalink / raw)
To: Chaoyong He; +Cc: oss-drivers, Niklas Soderlund, dev
On 10/19/2022 12:30 PM, Chaoyong He wrote:
>> On 10/19/2022 4:00 AM, Chaoyong He wrote:
>>>> On 10/10/2022 7:08 AM, Chaoyong He wrote:
>>>>> Add the flow validate/create/query/destroy/flush API of nfp PMD.
>>>>>
>>>>> The flow create API construct a control cmsg and send it to
>>>>> firmware, then add this flow to the hash table.
>>>>>
>>>>> The flow query API get flow stats from the flow_priv structure.
>>>>> Note there exist an rte_spin_lock to prevent the update and query
>>>>> action occur at the same time.
>>>>>
>>>>> The flow destroy API construct a control cmsg and send it to
>>>>> firmware, then adelete this flow from the hash table.
>>>>>
>>>>> The flow flush API just iterate the flows in hash table and call the
>>>>> flow destroy API.
>>>>>
>>>>> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
>>>>> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
>>>>
>>>> <...>
>>>>
>>>>> +static void
>>>>> +nfp_flow_stats_get(struct rte_eth_dev *dev,
>>>>> + struct rte_flow *nfp_flow,
>>>>> + void *data)
>>>>> +{
>>>>> + uint32_t ctx_id;
>>>>> + struct rte_flow *flow;
>>>>> + struct nfp_flow_priv *priv;
>>>>> + struct nfp_fl_stats *stats;
>>>>> + struct rte_flow_query_count *query;
>>>>> +
>>>>> + priv = nfp_flow_dev_to_priv(dev);
>>>>> + flow = nfp_flow_table_search(priv, nfp_flow);
>>>>> + if (flow == NULL) {
>>>>> + PMD_DRV_LOG(ERR, "Can not find statistics for this flow.");
>>>>> + return;
>>>>> + }
>>>>> +
>>>>> + query = (struct rte_flow_query_count *)data;
>>>>> + ctx_id = rte_be_to_cpu_32(nfp_flow->payload.meta->host_ctx_id);
>>>>> + stats = &priv->stats[ctx_id];
>>>>> +
>>>>> + rte_spinlock_lock(&priv->stats_lock);
>>>>> + if (stats->pkts && stats->bytes) {
>>>>
>>>> Is it guaranteed that 'query' ("void *data") is zeroed out when it is
>>>> provided by application?
>>>>
>>
>> Let me clarify this comment,
>>
>> When "stats->pkts == 0", not taken this branch and 'query' fields are not
>> updated. How caller can know if 'query' has random values or assigned values,
>> won't it be good to memset query.
>>
>
> Okay, I understand it now. I'll revise like what you said in the next version patch, thanks.
>
>>>>> + query->hits = stats->pkts;
>>>>> + query->bytes = stats->bytes;
>>>>> + query->hits_set = 1;
>>>>> + query->bytes_set = 1;
>>>>> + stats->pkts = 0;
>>>>> + stats->bytes = 0;
>>>>
>>>> need to check 'reset' field of action to decide reset or not.
>>>>
>>
>> And this one also seems not answered, to there is an attribute of action to
>> request resetting stats, above code ignores it.
>>
>
> How about like this:
> ```
> if (stats->pkts != 0 && stats->bytes != 0) {
> query->hits = stats->pkts;
> query->bytes = stats->bytes;
> query->hits_set = 1;
> query->bytes_set = 1;
> if (query->reset != 0) {
> rte_spinlock_lock(&priv->stats_lock);
> stats->pkts = 0;
> stats->bytes = 0;
> rte_spinlock_unlock(&priv->stats_lock);
> }
ack
> } else {
> memset(query, 0, sizeof(*query));
> }
memset can go outside of the if block for simplicity, but both are OK,
up to you.
> ```
>
> And I'm not quite sure if I should add a check about the `reserved` field like this:
> ```
> query = (struct rte_flow_query_count *)data;
> if (query->reserved != 0) {
> PMD_DRV_LOG(ERR, "The reserved field should always be 0!");
> return;
> }
> ```
I don't think it is required to check reserved fields.
>
>>>> <...>
>>>>
>>>>> @@ -75,6 +101,7 @@ struct nfp_fl_stats {
>>>>>
>>>>> struct nfp_flow_priv {
>>>>> uint32_t hash_seed; /**< Hash seed for hash tables in this
>>>>> structure. */
>>>>> + uint64_t flower_version; /**< Flow version, always increase.
>>>>> + */
>>>>
>>>> Is this version to keep unique value per flow configuration? If so as
>>>> far as I can see '.validate' is updating this value, is this expected?
>>>>
>>>> Also who suppose to use this value?
>>>
>>> Yes, it is expected.
>>>
>>> This value is part of the nfp_flow_meta, and which is part of the flow
>>> offloaded to the firmware.
>>> And the content of the flow offloaded to the firmware is the ABI of
>>> the firmware, so it's can't easily change.
>>
>> I am not sure we are on same page. This variable is increased when a flow
>> rule is added or validated by application, how this is part of ABI?
>>
>> Also whenever application validates a flow this 'flower_version' value is
>> increased. Application is just validating the flow, not adding a flow so nothing
>> changes in the HW config.
>> And this increase in the 'flower_version' variable may cause driver/hw think
>> that config is changed?
>
> Okay, I will revise to make sure the '.validate' won't change this value anymore, thanks.
ack
^ permalink raw reply [relevance 0%]
* RE: [PATCH v2 03/24] net/nfp: add the flow APIs of nfp PMD
2022-10-19 11:11 3% ` Ferruh Yigit
@ 2022-10-19 11:30 0% ` Chaoyong He
2022-10-19 11:38 0% ` Ferruh Yigit
0 siblings, 1 reply; 200+ results
From: Chaoyong He @ 2022-10-19 11:30 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: oss-drivers, Niklas Soderlund, dev
> On 10/19/2022 4:00 AM, Chaoyong He wrote:
> >> On 10/10/2022 7:08 AM, Chaoyong He wrote:
> >>> Add the flow validate/create/query/destroy/flush API of nfp PMD.
> >>>
> >>> The flow create API construct a control cmsg and send it to
> >>> firmware, then add this flow to the hash table.
> >>>
> >>> The flow query API get flow stats from the flow_priv structure.
> >>> Note there exist an rte_spin_lock to prevent the update and query
> >>> action occur at the same time.
> >>>
> >>> The flow destroy API construct a control cmsg and send it to
> >>> firmware, then adelete this flow from the hash table.
> >>>
> >>> The flow flush API just iterate the flows in hash table and call the
> >>> flow destroy API.
> >>>
> >>> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> >>> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> >>
> >> <...>
> >>
> >>> +static void
> >>> +nfp_flow_stats_get(struct rte_eth_dev *dev,
> >>> + struct rte_flow *nfp_flow,
> >>> + void *data)
> >>> +{
> >>> + uint32_t ctx_id;
> >>> + struct rte_flow *flow;
> >>> + struct nfp_flow_priv *priv;
> >>> + struct nfp_fl_stats *stats;
> >>> + struct rte_flow_query_count *query;
> >>> +
> >>> + priv = nfp_flow_dev_to_priv(dev);
> >>> + flow = nfp_flow_table_search(priv, nfp_flow);
> >>> + if (flow == NULL) {
> >>> + PMD_DRV_LOG(ERR, "Can not find statistics for this flow.");
> >>> + return;
> >>> + }
> >>> +
> >>> + query = (struct rte_flow_query_count *)data;
> >>> + ctx_id = rte_be_to_cpu_32(nfp_flow->payload.meta->host_ctx_id);
> >>> + stats = &priv->stats[ctx_id];
> >>> +
> >>> + rte_spinlock_lock(&priv->stats_lock);
> >>> + if (stats->pkts && stats->bytes) {
> >>
> >> Is it guaranteed that 'query' ("void *data") is zeroed out when it is
> >> provided by application?
> >>
>
> Let me clarify this comment,
>
> When "stats->pkts == 0", not taken this branch and 'query' fields are not
> updated. How caller can know if 'query' has random values or assigned values,
> won't it be good to memset query.
>
Okay, I understand it now. I'll revise like what you said in the next version patch, thanks.
> >>> + query->hits = stats->pkts;
> >>> + query->bytes = stats->bytes;
> >>> + query->hits_set = 1;
> >>> + query->bytes_set = 1;
> >>> + stats->pkts = 0;
> >>> + stats->bytes = 0;
> >>
> >> need to check 'reset' field of action to decide reset or not.
> >>
>
> And this one also seems not answered, to there is an attribute of action to
> request resetting stats, above code ignores it.
>
How about like this:
```
if (stats->pkts != 0 && stats->bytes != 0) {
query->hits = stats->pkts;
query->bytes = stats->bytes;
query->hits_set = 1;
query->bytes_set = 1;
if (query->reset != 0) {
rte_spinlock_lock(&priv->stats_lock);
stats->pkts = 0;
stats->bytes = 0;
rte_spinlock_unlock(&priv->stats_lock);
}
} else {
memset(query, 0, sizeof(*query));
}
```
And I'm not quite sure if I should add a check about the `reserved` field like this:
```
query = (struct rte_flow_query_count *)data;
if (query->reserved != 0) {
PMD_DRV_LOG(ERR, "The reserved field should always be 0!");
return;
}
```
> >> <...>
> >>
> >>> @@ -75,6 +101,7 @@ struct nfp_fl_stats {
> >>>
> >>> struct nfp_flow_priv {
> >>> uint32_t hash_seed; /**< Hash seed for hash tables in this
> >>> structure. */
> >>> + uint64_t flower_version; /**< Flow version, always increase.
> >>> + */
> >>
> >> Is this version to keep unique value per flow configuration? If so as
> >> far as I can see '.validate' is updating this value, is this expected?
> >>
> >> Also who suppose to use this value?
> >
> > Yes, it is expected.
> >
> > This value is part of the nfp_flow_meta, and which is part of the flow
> > offloaded to the firmware.
> > And the content of the flow offloaded to the firmware is the ABI of
> > the firmware, so it's can't easily change.
>
> I am not sure we are on same page. This variable is increased when a flow
> rule is added or validated by application, how this is part of ABI?
>
> Also whenever application validates a flow this 'flower_version' value is
> increased. Application is just validating the flow, not adding a flow so nothing
> changes in the HW config.
> And this increase in the 'flower_version' variable may cause driver/hw think
> that config is changed?
Okay, I will revise to make sure the '.validate' won't change this value anymore, thanks.
^ permalink raw reply [relevance 0%]
* Re: [PATCH v2 03/24] net/nfp: add the flow APIs of nfp PMD
2022-10-19 3:00 3% ` Chaoyong He
@ 2022-10-19 11:11 3% ` Ferruh Yigit
2022-10-19 11:30 0% ` Chaoyong He
0 siblings, 1 reply; 200+ results
From: Ferruh Yigit @ 2022-10-19 11:11 UTC (permalink / raw)
To: Chaoyong He; +Cc: oss-drivers, Niklas Soderlund, dev
On 10/19/2022 4:00 AM, Chaoyong He wrote:
>> On 10/10/2022 7:08 AM, Chaoyong He wrote:
>>> Add the flow validate/create/query/destroy/flush API of nfp PMD.
>>>
>>> The flow create API construct a control cmsg and send it to firmware,
>>> then add this flow to the hash table.
>>>
>>> The flow query API get flow stats from the flow_priv structure.
>>> Note there exist an rte_spin_lock to prevent the update and query
>>> action occur at the same time.
>>>
>>> The flow destroy API construct a control cmsg and send it to firmware,
>>> then adelete this flow from the hash table.
>>>
>>> The flow flush API just iterate the flows in hash table and call the
>>> flow destroy API.
>>>
>>> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
>>> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
>>
>> <...>
>>
>>> +static void
>>> +nfp_flow_stats_get(struct rte_eth_dev *dev,
>>> + struct rte_flow *nfp_flow,
>>> + void *data)
>>> +{
>>> + uint32_t ctx_id;
>>> + struct rte_flow *flow;
>>> + struct nfp_flow_priv *priv;
>>> + struct nfp_fl_stats *stats;
>>> + struct rte_flow_query_count *query;
>>> +
>>> + priv = nfp_flow_dev_to_priv(dev);
>>> + flow = nfp_flow_table_search(priv, nfp_flow);
>>> + if (flow == NULL) {
>>> + PMD_DRV_LOG(ERR, "Can not find statistics for this flow.");
>>> + return;
>>> + }
>>> +
>>> + query = (struct rte_flow_query_count *)data;
>>> + ctx_id = rte_be_to_cpu_32(nfp_flow->payload.meta->host_ctx_id);
>>> + stats = &priv->stats[ctx_id];
>>> +
>>> + rte_spinlock_lock(&priv->stats_lock);
>>> + if (stats->pkts && stats->bytes) {
>>
>> Is it guaranteed that 'query' ("void *data") is zeroed out when it is provided
>> by application?
>>
Let me clarify this comment,
When "stats->pkts == 0", not taken this branch and 'query' fields are
not updated. How caller can know if 'query' has random values or
assigned values, won't it be good to memset query.
>>> + query->hits = stats->pkts;
>>> + query->bytes = stats->bytes;
>>> + query->hits_set = 1;
>>> + query->bytes_set = 1;
>>> + stats->pkts = 0;
>>> + stats->bytes = 0;
>>
>> need to check 'reset' field of action to decide reset or not.
>>
And this one also seems not answered, to there is an attribute of action
to request resetting stats, above code ignores it.
>> <...>
>>
>>> @@ -75,6 +101,7 @@ struct nfp_fl_stats {
>>>
>>> struct nfp_flow_priv {
>>> uint32_t hash_seed; /**< Hash seed for hash tables in this
>>> structure. */
>>> + uint64_t flower_version; /**< Flow version, always increase. */
>>
>> Is this version to keep unique value per flow configuration? If so as far as I
>> can see '.validate' is updating this value, is this expected?
>>
>> Also who suppose to use this value?
>
> Yes, it is expected.
>
> This value is part of the nfp_flow_meta, and which is part of the flow offloaded
> to the firmware.
> And the content of the flow offloaded to the firmware is the ABI of the firmware,
> so it's can't easily change.
I am not sure we are on same page. This variable is increased when a
flow rule is added or validated by application, how this is part of ABI?
Also whenever application validates a flow this 'flower_version' value
is increased. Application is just validating the flow, not adding a flow
so nothing changes in the HW config.
And this increase in the 'flower_version' variable may cause driver/hw
think that config is changed?
^ permalink raw reply [relevance 3%]
* RE: [PATCH v2 03/24] net/nfp: add the flow APIs of nfp PMD
@ 2022-10-19 3:00 3% ` Chaoyong He
2022-10-19 11:11 3% ` Ferruh Yigit
0 siblings, 1 reply; 200+ results
From: Chaoyong He @ 2022-10-19 3:00 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: oss-drivers, Niklas Soderlund, dev
> On 10/10/2022 7:08 AM, Chaoyong He wrote:
> > Add the flow validate/create/query/destroy/flush API of nfp PMD.
> >
> > The flow create API construct a control cmsg and send it to firmware,
> > then add this flow to the hash table.
> >
> > The flow query API get flow stats from the flow_priv structure.
> > Note there exist an rte_spin_lock to prevent the update and query
> > action occur at the same time.
> >
> > The flow destroy API construct a control cmsg and send it to firmware,
> > then adelete this flow from the hash table.
> >
> > The flow flush API just iterate the flows in hash table and call the
> > flow destroy API.
> >
> > Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> > Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
>
> <...>
>
> > +static void
> > +nfp_flow_stats_get(struct rte_eth_dev *dev,
> > + struct rte_flow *nfp_flow,
> > + void *data)
> > +{
> > + uint32_t ctx_id;
> > + struct rte_flow *flow;
> > + struct nfp_flow_priv *priv;
> > + struct nfp_fl_stats *stats;
> > + struct rte_flow_query_count *query;
> > +
> > + priv = nfp_flow_dev_to_priv(dev);
> > + flow = nfp_flow_table_search(priv, nfp_flow);
> > + if (flow == NULL) {
> > + PMD_DRV_LOG(ERR, "Can not find statistics for this flow.");
> > + return;
> > + }
> > +
> > + query = (struct rte_flow_query_count *)data;
> > + ctx_id = rte_be_to_cpu_32(nfp_flow->payload.meta->host_ctx_id);
> > + stats = &priv->stats[ctx_id];
> > +
> > + rte_spinlock_lock(&priv->stats_lock);
> > + if (stats->pkts && stats->bytes) {
>
> Is it guaranteed that 'query' ("void *data") is zeroed out when it is provided
> by application?
>
> > + query->hits = stats->pkts;
> > + query->bytes = stats->bytes;
> > + query->hits_set = 1;
> > + query->bytes_set = 1;
> > + stats->pkts = 0;
> > + stats->bytes = 0;
>
> need to check 'reset' field of action to decide reset or not.
>
> <...>
>
> > @@ -75,6 +101,7 @@ struct nfp_fl_stats {
> >
> > struct nfp_flow_priv {
> > uint32_t hash_seed; /**< Hash seed for hash tables in this
> > structure. */
> > + uint64_t flower_version; /**< Flow version, always increase. */
>
> Is this version to keep unique value per flow configuration? If so as far as I
> can see '.validate' is updating this value, is this expected?
>
> Also who suppose to use this value?
Yes, it is expected.
This value is part of the nfp_flow_meta, and which is part of the flow offloaded
to the firmware.
And the content of the flow offloaded to the firmware is the ABI of the firmware,
so it's can't easily change.
^ permalink raw reply [relevance 3%]
* Re: [PATCH v6 3/4] mempool: fix cache flushing algorithm
2022-10-15 6:57 0% ` Morten Brørup
@ 2022-10-18 16:32 0% ` Jerin Jacob
0 siblings, 0 replies; 200+ results
From: Jerin Jacob @ 2022-10-18 16:32 UTC (permalink / raw)
To: Morten Brørup; +Cc: Olivier Matz, Andrew Rybchenko, dev, Bruce Richardson
On Sat, Oct 15, 2022 at 12:27 PM Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > Sent: Friday, 14 October 2022 21.51
> >
> > On Fri, Oct 14, 2022 at 05:57:39PM +0200, Morten Brørup wrote:
> > > > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > > > Sent: Friday, 14 October 2022 16.01
> > > >
> > > > Hi Morten, Andrew,
> > > >
> > > > On Sun, Oct 09, 2022 at 05:08:39PM +0200, Morten Brørup wrote:
> > > > > > From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> > > > > > Sent: Sunday, 9 October 2022 16.52
> > > > > >
> > > > > > On 10/9/22 17:31, Morten Brørup wrote:
> > > > > > >> From: Andrew Rybchenko
> > [mailto:andrew.rybchenko@oktetlabs.ru]
> > > > > > >> Sent: Sunday, 9 October 2022 15.38
> > > > > > >>
> > > > > > >> From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > >>
> > > > >
> > > > > [...]
> > > >
> > > > I finally took a couple of hours to carefully review the mempool-
> > > > related
> > > > series (including the ones that have already been pushed).
> > > >
> > > > The new behavior looks better to me in all situations I can think
> > > > about.
> > >
> > > Extreme care is required when touching a core library like the
> > mempool.
> > >
> > > Thank you, Olivier.
> > >
> > > >
> > > > >
> > > > > > >> --- a/lib/mempool/rte_mempool.h
> > > > > > >> +++ b/lib/mempool/rte_mempool.h
> > > > > > >> @@ -90,7 +90,7 @@ struct rte_mempool_cache {
> > > > > > >> * Cache is allocated to this size to allow it to
> > overflow
> > > > in
> > > > > > >> certain
> > > > > > >> * cases to avoid needless emptying of cache.
> > > > > > >> */
> > > > > > >> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**<
> > Cache
> > > > objects */
> > > > > > >> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**<
> > Cache
> > > > objects */
> > > > > > >> } __rte_cache_aligned;
> > > > > > >
> > > > > > > How much are we allowed to break the ABI here?
> > > > > > >
> > > > > > > This patch reduces the size of the structure by removing a
> > now
> > > > unused
> > > > > > part at the end, which should be harmless.
> > > >
> > > > It is an ABI breakage: an existing application will use the new
> > 22.11
> > > > function to create the mempool (with a smaller cache), but will use
> > the
> > > > old inlined get/put that can exceed MAX_SIZE x 2 will remain.
> > > >
> > > > But this is a nice memory consumption improvement, in my opinion we
> > > > should accept it for 22.11 with an entry in the release note.
> > > >
> > > >
> > > > > > >
> > > > > > > If we may also move the position of the objs array, I would
> > add
> > > > > > __rte_cache_aligned to the objs array. It makes no difference
> > in
> > > > the
> > > > > > general case, but if get/put operations are always 32 objects,
> > it
> > > > will
> > > > > > reduce the number of memory (or last level cache) accesses from
> > > > five to
> > > > > > four 64 B cache lines for every get/put operation.
> > > >
> > > > Will it really be the case? Since cache->len has to be accessed
> > too,
> > > > I don't think it would make a difference.
> > >
> > > Yes, the first cache line, containing cache->len, will be accessed
> > always. I forgot to count that; so the improvement by aligning cache-
> > >objs will be five cache line accesses instead of six.
> > >
> > > Let me try to explain the scenario in other words:
> > >
> > > In an application where a mempool cache is only accessed in bursts of
> > 32 objects (256 B), it matters if those 256 B accesses in the mempool
> > cache start at a cache line aligned address or not. If cache line
> > aligned, accessing those 256 B in the mempool cache will only touch 4
> > cache lines; if not, 5 cache lines will be touched. (For architectures
> > with 128 B cache line, it will be 2 instead of 3 touched cache lines
> > per mempool cache get/put operation in applications using only bursts
> > of 32 objects.)
> > >
> > > If we cache line align cache->objs, those bursts of 32 objects (256
> > B) will be cache line aligned: Any address at cache->objs[N * 32
> > objects] is cache line aligned if objs->objs[0] is cache line aligned.
> > >
> > > Currently, the cache->objs directly follows cache->len, which makes
> > cache->objs[0] cache line unaligned.
> > >
> > > If we decide to break the mempool cache ABI, we might as well include
> > my suggested cache line alignment performance improvement. It doesn't
> > degrade performance for mempool caches not only accessed in bursts of
> > 32 objects.
> >
> > I don't follow you. Currently, with 16 objects (128B), we access to 3
> > cache lines:
> >
> > ┌────────┐
> > │len │
> > cache │********│---
> > line0 │********│ ^
> > │********│ |
> > ├────────┤ | 16 objects
> > │********│ | 128B
> > cache │********│ |
> > line1 │********│ |
> > │********│ |
> > ├────────┤ |
> > │********│_v_
> > cache │ │
> > line2 │ │
> > │ │
> > └────────┘
> >
> > With the alignment, it is also 3 cache lines:
> >
> > ┌────────┐
> > │len │
> > cache │ │
> > line0 │ │
> > │ │
> > ├────────┤---
> > │********│ ^
> > cache │********│ |
> > line1 │********│ |
> > │********│ |
> > ├────────┤ | 16 objects
> > │********│ | 128B
> > cache │********│ |
> > line2 │********│ |
> > │********│ v
> > └────────┘---
> >
> >
> > Am I missing something?
>
> Accessing the objects at the bottom of the mempool cache is a special case, where cache line0 is also used for objects.
>
> Consider the next burst (and any following bursts):
>
> Current:
> ┌────────┐
> │len │
> cache │ │
> line0 │ │
> │ │
> ├────────┤
> │ │
> cache │ │
> line1 │ │
> │ │
> ├────────┤
> │ │
> cache │********│---
> line2 │********│ ^
> │********│ |
> ├────────┤ | 16 objects
> │********│ | 128B
> cache │********│ |
> line3 │********│ |
> │********│ |
> ├────────┤ |
> │********│_v_
> cache │ │
> line4 │ │
> │ │
> └────────┘
> 4 cache lines touched, incl. line0 for len.
>
> With the proposed alignment:
> ┌────────┐
> │len │
> cache │ │
> line0 │ │
> │ │
> ├────────┤
> │ │
> cache │ │
> line1 │ │
> │ │
> ├────────┤
> │ │
> cache │ │
> line2 │ │
> │ │
> ├────────┤
> │********│---
> cache │********│ ^
> line3 │********│ |
> │********│ | 16 objects
> ├────────┤ | 128B
> │********│ |
> cache │********│ |
> line4 │********│ |
> │********│_v_
> └────────┘
> Only 3 cache lines touched, incl. line0 for len.
When tested with testpmd,l3fwd there was less than 1% regression. It
could be noise.
But making the cacheline alignment is fixing that.
In addition to @Morten Brørup point, I think, there is a factor
"load" stall on cache->len read, What I meant by that is:
In the case of (len and objs) are in the same cache line. Assume objs
are written as stores operation and not read anything on cacheline
VS a few stores done for objects and on subsequent len read via
enqueue operation may stall based where those obj reached in
the cache hierarchy and cache policy(write-back vs write-through)
If we are seeing no regression with cachealinged with various platform
testing then I think it make sense to make cache aligned.
>
>
> >
> > >
> > > >
> > > >
> > > > > > >
> > > > > > > uint32_t len; /**< Current cache count */
> > > > > > > - /*
> > > > > > > - * Cache is allocated to this size to allow it to overflow
> > > > in
> > > > > > certain
> > > > > > > - * cases to avoid needless emptying of cache.
> > > > > > > - */
> > > > > > > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache
> > > > objects */
> > > > > > > + /**
> > > > > > > + * Cache objects
> > > > > > > + *
> > > > > > > + * Cache is allocated to this size to allow it to overflow
> > > > in
> > > > > > certain
> > > > > > > + * cases to avoid needless emptying of cache.
> > > > > > > + */
> > > > > > > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]
> > > > __rte_cache_aligned;
> > > > > > > } __rte_cache_aligned;
> > > > > >
> > > > > > I think aligning objs on cacheline should be a separate patch.
> > > > >
> > > > > Good point. I'll let you do it. :-)
> > > > >
> > > > > PS: Thank you for following up on this patch series, Andrew!
> > > >
> > > > Many thanks for this rework.
> > > >
> > > > Acked-by: Olivier Matz <olivier.matz@6wind.com>
> > >
> > > Perhaps Reviewed-by would be appropriate?
> >
> > I was thinking that "Acked-by" was commonly used by maintainers, and
> > "Reviewed-by" for reviews by community members. After reading the
> > documentation again, it's not that clear now in my mind :)
> >
> > Thanks,
> > Olivier
>
^ permalink raw reply [relevance 0%]
* [PATCH] ci: combine static and shared linking build tests
@ 2022-10-17 14:07 3% David Marchand
2022-10-20 11:44 0% ` David Marchand
2022-10-20 15:34 0% ` Aaron Conole
0 siblings, 2 replies; 200+ results
From: David Marchand @ 2022-10-17 14:07 UTC (permalink / raw)
To: dev; +Cc: Aaron Conole, Michael Santana
Save some cpu time and disk by testing linking against static and shared
library in single environments.
The .ci/linux-build.sh is modified so it reconfigures an existing build
directory: an empty DEF_LIB= means that static and shared builds are
to be tested.
ABI checks, documentation generation and unit tests are disabled for
static builds as they would be redundant with the check against
dynamically linked binaries, if any.
Note:
- --cross-file is an option that can be passed to meson only when
creating a build environment,
- for some other reason, --buildtype and other non -D options are only
accepted when setting up a build directory with meson. When
reconfiguring, only their -D$option forms are accepted,
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
.ci/linux-build.sh | 25 ++++++++++++++++++-------
.github/workflows/build.yml | 28 ----------------------------
2 files changed, 18 insertions(+), 35 deletions(-)
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 14148fef4a..baec65a914 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -1,5 +1,11 @@
#!/bin/sh -xe
+if [ -z "${DEF_LIB:-}" ]; then
+ DEF_LIB=static ABI_CHECKS= BUILD_DOCS= RUN_TESTS= $0
+ DEF_LIB=shared $0
+ exit
+fi
+
# Builds are run as root in containers, no need for sudo
[ "$(id -u)" != '0' ] || alias sudo=
@@ -78,10 +84,6 @@ if [ "$RISCV64" = "true" ]; then
cross_file=config/riscv/riscv64_linux_gcc
fi
-if [ -n "$cross_file" ]; then
- OPTS="$OPTS --cross-file $cross_file"
-fi
-
if [ "$BUILD_DOCS" = "true" ]; then
OPTS="$OPTS -Denable_docs=true"
fi
@@ -101,8 +103,8 @@ else
fi
OPTS="$OPTS -Dplatform=generic"
-OPTS="$OPTS --default-library=$DEF_LIB"
-OPTS="$OPTS --buildtype=debugoptimized"
+OPTS="$OPTS -Ddefault_library=$DEF_LIB"
+OPTS="$OPTS -Dbuildtype=debugoptimized"
OPTS="$OPTS -Dcheck_includes=true"
if [ "$MINI" = "true" ]; then
OPTS="$OPTS -Denable_drivers=net/null"
@@ -118,7 +120,16 @@ if [ "$ASAN" = "true" ]; then
fi
fi
-meson build --werror $OPTS
+OPTS="$OPTS -Dwerror=true"
+
+if [ -d build ]; then
+ meson configure build $OPTS
+else
+ if [ -n "$cross_file" ]; then
+ OPTS="$OPTS --cross-file $cross_file"
+ fi
+ meson setup build $OPTS
+fi
ninja -C build
if [ -z "$cross_file" ]; then
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b32758ff6f..82d83f4030 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -35,21 +35,12 @@ jobs:
config:
- os: ubuntu-20.04
compiler: gcc
- library: static
- - os: ubuntu-20.04
- compiler: gcc
- library: shared
mini: mini
- os: ubuntu-20.04
compiler: gcc
- library: shared
checks: doc+tests
- os: ubuntu-20.04
compiler: clang
- library: static
- - os: ubuntu-20.04
- compiler: clang
- library: shared
checks: asan+doc+tests
- os: ubuntu-20.04
compiler: gcc
@@ -61,23 +52,12 @@ jobs:
cross: mingw
- os: ubuntu-20.04
compiler: gcc
- library: static
- cross: aarch64
- - os: ubuntu-20.04
- compiler: gcc
- library: shared
cross: aarch64
- os: ubuntu-20.04
compiler: gcc
- library: static
cross: ppc64le
- os: ubuntu-20.04
compiler: gcc
- library: shared
- cross: ppc64le
- - os: ubuntu-20.04
- compiler: gcc
- library: shared
cross: riscv64
steps:
@@ -218,16 +198,8 @@ jobs:
config:
- image: fedora:35
compiler: gcc
- library: static
- - image: fedora:35
- compiler: gcc
- library: shared
- - image: fedora:35
- compiler: clang
- library: static
- image: fedora:35
compiler: clang
- library: shared
steps:
- name: Checkout sources
--
2.37.3
^ permalink raw reply [relevance 3%]
* Re: [PATCH] vhost: promote per-queue stats API to stable
2022-10-10 15:37 4% [PATCH] vhost: promote per-queue stats API to stable Maxime Coquelin
@ 2022-10-17 13:22 0% ` David Marchand
2022-10-24 8:53 0% ` Xia, Chenbo
2022-10-26 9:31 0% ` Xia, Chenbo
2 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-10-17 13:22 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: dev, chenbo.xia
On Mon, Oct 10, 2022 at 5:37 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> This patch promotes the per-queue stats API to stable.
> The API has been used by the Vhost PMD since v22.07, and
> David Marchand posted a patch to make use of it in next
> OVS release[0].
>
> [0]: http://patchwork.ozlabs.org/project/openvswitch/patch/20221007111613.1695524-4-david.marchand@redhat.com/
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> doc/guides/rel_notes/release_22_11.rst | 4 ++++
> lib/vhost/rte_vhost.h | 3 ---
> lib/vhost/version.map | 6 +++---
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 37bd392f34..d5d3eeae24 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -443,6 +443,10 @@ API Changes
>
> * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
>
Nit: in the RN, vhost library updates go earlier.
> +* vhost: Promoted ``rte_vhost_vring_stats_get()``,
> + ``rte_vhost_vring_stats_get_names()`` and ``rte_vhost_vring_stats_reset()``
> + from experimental to stable.
> +
>
> ABI Changes
> -----------
> diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
> index bb7d86a432..59c98a0afb 100644
> --- a/lib/vhost/rte_vhost.h
> +++ b/lib/vhost/rte_vhost.h
> @@ -1075,7 +1075,6 @@ rte_vhost_slave_config_change(int vid, bool need_reply);
> * - Failure if lower than 0. The device ID or queue ID is invalid or
> + statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id,
> struct rte_vhost_stat_name *name, unsigned int size);
> @@ -1103,7 +1102,6 @@ rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id,
> * - Failure if lower than 0. The device ID or queue ID is invalid, or
> * statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_get(int vid, uint16_t queue_id,
> struct rte_vhost_stat *stats, unsigned int n);
> @@ -1120,7 +1118,6 @@ rte_vhost_vring_stats_get(int vid, uint16_t queue_id,
> * - Failure if lower than 0. The device ID or queue ID is invalid, or
> * statistics collection is not enabled.
> */
> -__rte_experimental
> int
> rte_vhost_vring_stats_reset(int vid, uint16_t queue_id);
>
> diff --git a/lib/vhost/version.map b/lib/vhost/version.map
> index 7a00b65740..8c5e8aa8d3 100644
> --- a/lib/vhost/version.map
> +++ b/lib/vhost/version.map
> @@ -57,6 +57,9 @@ DPDK_23 {
> rte_vhost_set_vring_base;
> rte_vhost_va_from_guest_pa;
> rte_vhost_vring_call;
> + rte_vhost_vring_stats_get;
> + rte_vhost_vring_stats_get_names;
> + rte_vhost_vring_stats_reset;
>
> local: *;
> };
> @@ -88,9 +91,6 @@ EXPERIMENTAL {
>
> # added in 22.07
> rte_vhost_async_get_inflight_thread_unsafe;
> - rte_vhost_vring_stats_get_names;
> - rte_vhost_vring_stats_get;
> - rte_vhost_vring_stats_reset;
> rte_vhost_async_try_dequeue_burst;
> rte_vhost_driver_get_vdpa_dev_type;
> rte_vhost_clear_queue;
> --
> 2.37.3
>
Acked-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [relevance 0%]
* RE: [PATCH v6 3/4] mempool: fix cache flushing algorithm
2022-10-14 19:50 0% ` Olivier Matz
@ 2022-10-15 6:57 0% ` Morten Brørup
2022-10-18 16:32 0% ` Jerin Jacob
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-10-15 6:57 UTC (permalink / raw)
To: Olivier Matz; +Cc: Andrew Rybchenko, dev, Bruce Richardson
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Friday, 14 October 2022 21.51
>
> On Fri, Oct 14, 2022 at 05:57:39PM +0200, Morten Brørup wrote:
> > > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > > Sent: Friday, 14 October 2022 16.01
> > >
> > > Hi Morten, Andrew,
> > >
> > > On Sun, Oct 09, 2022 at 05:08:39PM +0200, Morten Brørup wrote:
> > > > > From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> > > > > Sent: Sunday, 9 October 2022 16.52
> > > > >
> > > > > On 10/9/22 17:31, Morten Brørup wrote:
> > > > > >> From: Andrew Rybchenko
> [mailto:andrew.rybchenko@oktetlabs.ru]
> > > > > >> Sent: Sunday, 9 October 2022 15.38
> > > > > >>
> > > > > >> From: Morten Brørup <mb@smartsharesystems.com>
> > > > > >>
> > > >
> > > > [...]
> > >
> > > I finally took a couple of hours to carefully review the mempool-
> > > related
> > > series (including the ones that have already been pushed).
> > >
> > > The new behavior looks better to me in all situations I can think
> > > about.
> >
> > Extreme care is required when touching a core library like the
> mempool.
> >
> > Thank you, Olivier.
> >
> > >
> > > >
> > > > > >> --- a/lib/mempool/rte_mempool.h
> > > > > >> +++ b/lib/mempool/rte_mempool.h
> > > > > >> @@ -90,7 +90,7 @@ struct rte_mempool_cache {
> > > > > >> * Cache is allocated to this size to allow it to
> overflow
> > > in
> > > > > >> certain
> > > > > >> * cases to avoid needless emptying of cache.
> > > > > >> */
> > > > > >> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**<
> Cache
> > > objects */
> > > > > >> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**<
> Cache
> > > objects */
> > > > > >> } __rte_cache_aligned;
> > > > > >
> > > > > > How much are we allowed to break the ABI here?
> > > > > >
> > > > > > This patch reduces the size of the structure by removing a
> now
> > > unused
> > > > > part at the end, which should be harmless.
> > >
> > > It is an ABI breakage: an existing application will use the new
> 22.11
> > > function to create the mempool (with a smaller cache), but will use
> the
> > > old inlined get/put that can exceed MAX_SIZE x 2 will remain.
> > >
> > > But this is a nice memory consumption improvement, in my opinion we
> > > should accept it for 22.11 with an entry in the release note.
> > >
> > >
> > > > > >
> > > > > > If we may also move the position of the objs array, I would
> add
> > > > > __rte_cache_aligned to the objs array. It makes no difference
> in
> > > the
> > > > > general case, but if get/put operations are always 32 objects,
> it
> > > will
> > > > > reduce the number of memory (or last level cache) accesses from
> > > five to
> > > > > four 64 B cache lines for every get/put operation.
> > >
> > > Will it really be the case? Since cache->len has to be accessed
> too,
> > > I don't think it would make a difference.
> >
> > Yes, the first cache line, containing cache->len, will be accessed
> always. I forgot to count that; so the improvement by aligning cache-
> >objs will be five cache line accesses instead of six.
> >
> > Let me try to explain the scenario in other words:
> >
> > In an application where a mempool cache is only accessed in bursts of
> 32 objects (256 B), it matters if those 256 B accesses in the mempool
> cache start at a cache line aligned address or not. If cache line
> aligned, accessing those 256 B in the mempool cache will only touch 4
> cache lines; if not, 5 cache lines will be touched. (For architectures
> with 128 B cache line, it will be 2 instead of 3 touched cache lines
> per mempool cache get/put operation in applications using only bursts
> of 32 objects.)
> >
> > If we cache line align cache->objs, those bursts of 32 objects (256
> B) will be cache line aligned: Any address at cache->objs[N * 32
> objects] is cache line aligned if objs->objs[0] is cache line aligned.
> >
> > Currently, the cache->objs directly follows cache->len, which makes
> cache->objs[0] cache line unaligned.
> >
> > If we decide to break the mempool cache ABI, we might as well include
> my suggested cache line alignment performance improvement. It doesn't
> degrade performance for mempool caches not only accessed in bursts of
> 32 objects.
>
> I don't follow you. Currently, with 16 objects (128B), we access to 3
> cache lines:
>
> ┌────────┐
> │len │
> cache │********│---
> line0 │********│ ^
> │********│ |
> ├────────┤ | 16 objects
> │********│ | 128B
> cache │********│ |
> line1 │********│ |
> │********│ |
> ├────────┤ |
> │********│_v_
> cache │ │
> line2 │ │
> │ │
> └────────┘
>
> With the alignment, it is also 3 cache lines:
>
> ┌────────┐
> │len │
> cache │ │
> line0 │ │
> │ │
> ├────────┤---
> │********│ ^
> cache │********│ |
> line1 │********│ |
> │********│ |
> ├────────┤ | 16 objects
> │********│ | 128B
> cache │********│ |
> line2 │********│ |
> │********│ v
> └────────┘---
>
>
> Am I missing something?
Accessing the objects at the bottom of the mempool cache is a special case, where cache line0 is also used for objects.
Consider the next burst (and any following bursts):
Current:
┌────────┐
│len │
cache │ │
line0 │ │
│ │
├────────┤
│ │
cache │ │
line1 │ │
│ │
├────────┤
│ │
cache │********│---
line2 │********│ ^
│********│ |
├────────┤ | 16 objects
│********│ | 128B
cache │********│ |
line3 │********│ |
│********│ |
├────────┤ |
│********│_v_
cache │ │
line4 │ │
│ │
└────────┘
4 cache lines touched, incl. line0 for len.
With the proposed alignment:
┌────────┐
│len │
cache │ │
line0 │ │
│ │
├────────┤
│ │
cache │ │
line1 │ │
│ │
├────────┤
│ │
cache │ │
line2 │ │
│ │
├────────┤
│********│---
cache │********│ ^
line3 │********│ |
│********│ | 16 objects
├────────┤ | 128B
│********│ |
cache │********│ |
line4 │********│ |
│********│_v_
└────────┘
Only 3 cache lines touched, incl. line0 for len.
>
> >
> > >
> > >
> > > > > >
> > > > > > uint32_t len; /**< Current cache count */
> > > > > > - /*
> > > > > > - * Cache is allocated to this size to allow it to overflow
> > > in
> > > > > certain
> > > > > > - * cases to avoid needless emptying of cache.
> > > > > > - */
> > > > > > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache
> > > objects */
> > > > > > + /**
> > > > > > + * Cache objects
> > > > > > + *
> > > > > > + * Cache is allocated to this size to allow it to overflow
> > > in
> > > > > certain
> > > > > > + * cases to avoid needless emptying of cache.
> > > > > > + */
> > > > > > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]
> > > __rte_cache_aligned;
> > > > > > } __rte_cache_aligned;
> > > > >
> > > > > I think aligning objs on cacheline should be a separate patch.
> > > >
> > > > Good point. I'll let you do it. :-)
> > > >
> > > > PS: Thank you for following up on this patch series, Andrew!
> > >
> > > Many thanks for this rework.
> > >
> > > Acked-by: Olivier Matz <olivier.matz@6wind.com>
> >
> > Perhaps Reviewed-by would be appropriate?
>
> I was thinking that "Acked-by" was commonly used by maintainers, and
> "Reviewed-by" for reviews by community members. After reading the
> documentation again, it's not that clear now in my mind :)
>
> Thanks,
> Olivier
^ permalink raw reply [relevance 0%]
* Re: [PATCH v6 3/4] mempool: fix cache flushing algorithm
2022-10-14 15:57 3% ` Morten Brørup
@ 2022-10-14 19:50 0% ` Olivier Matz
2022-10-15 6:57 0% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Olivier Matz @ 2022-10-14 19:50 UTC (permalink / raw)
To: Morten Brørup; +Cc: Andrew Rybchenko, dev, Bruce Richardson
On Fri, Oct 14, 2022 at 05:57:39PM +0200, Morten Brørup wrote:
> > From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > Sent: Friday, 14 October 2022 16.01
> >
> > Hi Morten, Andrew,
> >
> > On Sun, Oct 09, 2022 at 05:08:39PM +0200, Morten Brørup wrote:
> > > > From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> > > > Sent: Sunday, 9 October 2022 16.52
> > > >
> > > > On 10/9/22 17:31, Morten Brørup wrote:
> > > > >> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> > > > >> Sent: Sunday, 9 October 2022 15.38
> > > > >>
> > > > >> From: Morten Brørup <mb@smartsharesystems.com>
> > > > >>
> > >
> > > [...]
> >
> > I finally took a couple of hours to carefully review the mempool-
> > related
> > series (including the ones that have already been pushed).
> >
> > The new behavior looks better to me in all situations I can think
> > about.
>
> Extreme care is required when touching a core library like the mempool.
>
> Thank you, Olivier.
>
> >
> > >
> > > > >> --- a/lib/mempool/rte_mempool.h
> > > > >> +++ b/lib/mempool/rte_mempool.h
> > > > >> @@ -90,7 +90,7 @@ struct rte_mempool_cache {
> > > > >> * Cache is allocated to this size to allow it to overflow
> > in
> > > > >> certain
> > > > >> * cases to avoid needless emptying of cache.
> > > > >> */
> > > > >> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache
> > objects */
> > > > >> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache
> > objects */
> > > > >> } __rte_cache_aligned;
> > > > >
> > > > > How much are we allowed to break the ABI here?
> > > > >
> > > > > This patch reduces the size of the structure by removing a now
> > unused
> > > > part at the end, which should be harmless.
> >
> > It is an ABI breakage: an existing application will use the new 22.11
> > function to create the mempool (with a smaller cache), but will use the
> > old inlined get/put that can exceed MAX_SIZE x 2 will remain.
> >
> > But this is a nice memory consumption improvement, in my opinion we
> > should accept it for 22.11 with an entry in the release note.
> >
> >
> > > > >
> > > > > If we may also move the position of the objs array, I would add
> > > > __rte_cache_aligned to the objs array. It makes no difference in
> > the
> > > > general case, but if get/put operations are always 32 objects, it
> > will
> > > > reduce the number of memory (or last level cache) accesses from
> > five to
> > > > four 64 B cache lines for every get/put operation.
> >
> > Will it really be the case? Since cache->len has to be accessed too,
> > I don't think it would make a difference.
>
> Yes, the first cache line, containing cache->len, will be accessed always. I forgot to count that; so the improvement by aligning cache->objs will be five cache line accesses instead of six.
>
> Let me try to explain the scenario in other words:
>
> In an application where a mempool cache is only accessed in bursts of 32 objects (256 B), it matters if those 256 B accesses in the mempool cache start at a cache line aligned address or not. If cache line aligned, accessing those 256 B in the mempool cache will only touch 4 cache lines; if not, 5 cache lines will be touched. (For architectures with 128 B cache line, it will be 2 instead of 3 touched cache lines per mempool cache get/put operation in applications using only bursts of 32 objects.)
>
> If we cache line align cache->objs, those bursts of 32 objects (256 B) will be cache line aligned: Any address at cache->objs[N * 32 objects] is cache line aligned if objs->objs[0] is cache line aligned.
>
> Currently, the cache->objs directly follows cache->len, which makes cache->objs[0] cache line unaligned.
>
> If we decide to break the mempool cache ABI, we might as well include my suggested cache line alignment performance improvement. It doesn't degrade performance for mempool caches not only accessed in bursts of 32 objects.
I don't follow you. Currently, with 16 objects (128B), we access to 3
cache lines:
┌────────┐
│len │
cache │********│---
line0 │********│ ^
│********│ |
├────────┤ | 16 objects
│********│ | 128B
cache │********│ |
line1 │********│ |
│********│ |
├────────┤ |
│********│_v_
cache │ │
line2 │ │
│ │
└────────┘
With the alignment, it is also 3 cache lines:
┌────────┐
│len │
cache │ │
line0 │ │
│ │
├────────┤---
│********│ ^
cache │********│ |
line1 │********│ |
│********│ |
├────────┤ | 16 objects
│********│ | 128B
cache │********│ |
line2 │********│ |
│********│ v
└────────┘---
Am I missing something?
>
> >
> >
> > > > >
> > > > > uint32_t len; /**< Current cache count */
> > > > > - /*
> > > > > - * Cache is allocated to this size to allow it to overflow
> > in
> > > > certain
> > > > > - * cases to avoid needless emptying of cache.
> > > > > - */
> > > > > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache
> > objects */
> > > > > + /**
> > > > > + * Cache objects
> > > > > + *
> > > > > + * Cache is allocated to this size to allow it to overflow
> > in
> > > > certain
> > > > > + * cases to avoid needless emptying of cache.
> > > > > + */
> > > > > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]
> > __rte_cache_aligned;
> > > > > } __rte_cache_aligned;
> > > >
> > > > I think aligning objs on cacheline should be a separate patch.
> > >
> > > Good point. I'll let you do it. :-)
> > >
> > > PS: Thank you for following up on this patch series, Andrew!
> >
> > Many thanks for this rework.
> >
> > Acked-by: Olivier Matz <olivier.matz@6wind.com>
>
> Perhaps Reviewed-by would be appropriate?
I was thinking that "Acked-by" was commonly used by maintainers, and
"Reviewed-by" for reviews by community members. After reading the
documentation again, it's not that clear now in my mind :)
Thanks,
Olivier
^ permalink raw reply [relevance 0%]
* RE: [PATCH v6 3/4] mempool: fix cache flushing algorithm
2022-10-14 14:01 3% ` Olivier Matz
@ 2022-10-14 15:57 3% ` Morten Brørup
2022-10-14 19:50 0% ` Olivier Matz
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-10-14 15:57 UTC (permalink / raw)
To: Olivier Matz; +Cc: Andrew Rybchenko, dev, Bruce Richardson
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Friday, 14 October 2022 16.01
>
> Hi Morten, Andrew,
>
> On Sun, Oct 09, 2022 at 05:08:39PM +0200, Morten Brørup wrote:
> > > From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> > > Sent: Sunday, 9 October 2022 16.52
> > >
> > > On 10/9/22 17:31, Morten Brørup wrote:
> > > >> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> > > >> Sent: Sunday, 9 October 2022 15.38
> > > >>
> > > >> From: Morten Brørup <mb@smartsharesystems.com>
> > > >>
> >
> > [...]
>
> I finally took a couple of hours to carefully review the mempool-
> related
> series (including the ones that have already been pushed).
>
> The new behavior looks better to me in all situations I can think
> about.
Extreme care is required when touching a core library like the mempool.
Thank you, Olivier.
>
> >
> > > >> --- a/lib/mempool/rte_mempool.h
> > > >> +++ b/lib/mempool/rte_mempool.h
> > > >> @@ -90,7 +90,7 @@ struct rte_mempool_cache {
> > > >> * Cache is allocated to this size to allow it to overflow
> in
> > > >> certain
> > > >> * cases to avoid needless emptying of cache.
> > > >> */
> > > >> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache
> objects */
> > > >> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache
> objects */
> > > >> } __rte_cache_aligned;
> > > >
> > > > How much are we allowed to break the ABI here?
> > > >
> > > > This patch reduces the size of the structure by removing a now
> unused
> > > part at the end, which should be harmless.
>
> It is an ABI breakage: an existing application will use the new 22.11
> function to create the mempool (with a smaller cache), but will use the
> old inlined get/put that can exceed MAX_SIZE x 2 will remain.
>
> But this is a nice memory consumption improvement, in my opinion we
> should accept it for 22.11 with an entry in the release note.
>
>
> > > >
> > > > If we may also move the position of the objs array, I would add
> > > __rte_cache_aligned to the objs array. It makes no difference in
> the
> > > general case, but if get/put operations are always 32 objects, it
> will
> > > reduce the number of memory (or last level cache) accesses from
> five to
> > > four 64 B cache lines for every get/put operation.
>
> Will it really be the case? Since cache->len has to be accessed too,
> I don't think it would make a difference.
Yes, the first cache line, containing cache->len, will be accessed always. I forgot to count that; so the improvement by aligning cache->objs will be five cache line accesses instead of six.
Let me try to explain the scenario in other words:
In an application where a mempool cache is only accessed in bursts of 32 objects (256 B), it matters if those 256 B accesses in the mempool cache start at a cache line aligned address or not. If cache line aligned, accessing those 256 B in the mempool cache will only touch 4 cache lines; if not, 5 cache lines will be touched. (For architectures with 128 B cache line, it will be 2 instead of 3 touched cache lines per mempool cache get/put operation in applications using only bursts of 32 objects.)
If we cache line align cache->objs, those bursts of 32 objects (256 B) will be cache line aligned: Any address at cache->objs[N * 32 objects] is cache line aligned if objs->objs[0] is cache line aligned.
Currently, the cache->objs directly follows cache->len, which makes cache->objs[0] cache line unaligned.
If we decide to break the mempool cache ABI, we might as well include my suggested cache line alignment performance improvement. It doesn't degrade performance for mempool caches not only accessed in bursts of 32 objects.
>
>
> > > >
> > > > uint32_t len; /**< Current cache count */
> > > > - /*
> > > > - * Cache is allocated to this size to allow it to overflow
> in
> > > certain
> > > > - * cases to avoid needless emptying of cache.
> > > > - */
> > > > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache
> objects */
> > > > + /**
> > > > + * Cache objects
> > > > + *
> > > > + * Cache is allocated to this size to allow it to overflow
> in
> > > certain
> > > > + * cases to avoid needless emptying of cache.
> > > > + */
> > > > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]
> __rte_cache_aligned;
> > > > } __rte_cache_aligned;
> > >
> > > I think aligning objs on cacheline should be a separate patch.
> >
> > Good point. I'll let you do it. :-)
> >
> > PS: Thank you for following up on this patch series, Andrew!
>
> Many thanks for this rework.
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Perhaps Reviewed-by would be appropriate?
^ permalink raw reply [relevance 3%]
* Re: [PATCH v6 3/4] mempool: fix cache flushing algorithm
2022-10-09 15:08 0% ` Morten Brørup
@ 2022-10-14 14:01 3% ` Olivier Matz
2022-10-14 15:57 3% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Olivier Matz @ 2022-10-14 14:01 UTC (permalink / raw)
To: Morten Brørup; +Cc: Andrew Rybchenko, dev, Bruce Richardson
Hi Morten, Andrew,
On Sun, Oct 09, 2022 at 05:08:39PM +0200, Morten Brørup wrote:
> > From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> > Sent: Sunday, 9 October 2022 16.52
> >
> > On 10/9/22 17:31, Morten Brørup wrote:
> > >> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> > >> Sent: Sunday, 9 October 2022 15.38
> > >>
> > >> From: Morten Brørup <mb@smartsharesystems.com>
> > >>
>
> [...]
I finally took a couple of hours to carefully review the mempool-related
series (including the ones that have already been pushed).
The new behavior looks better to me in all situations I can think about.
>
> > >> --- a/lib/mempool/rte_mempool.h
> > >> +++ b/lib/mempool/rte_mempool.h
> > >> @@ -90,7 +90,7 @@ struct rte_mempool_cache {
> > >> * Cache is allocated to this size to allow it to overflow in
> > >> certain
> > >> * cases to avoid needless emptying of cache.
> > >> */
> > >> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache objects */
> > >> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache objects */
> > >> } __rte_cache_aligned;
> > >
> > > How much are we allowed to break the ABI here?
> > >
> > > This patch reduces the size of the structure by removing a now unused
> > part at the end, which should be harmless.
It is an ABI breakage: an existing application will use the new 22.11
function to create the mempool (with a smaller cache), but will use the
old inlined get/put that can exceed MAX_SIZE x 2 will remain.
But this is a nice memory consumption improvement, in my opinion we
should accept it for 22.11 with an entry in the release note.
> > >
> > > If we may also move the position of the objs array, I would add
> > __rte_cache_aligned to the objs array. It makes no difference in the
> > general case, but if get/put operations are always 32 objects, it will
> > reduce the number of memory (or last level cache) accesses from five to
> > four 64 B cache lines for every get/put operation.
Will it really be the case? Since cache->len has to be accessed too,
I don't think it would make a difference.
> > >
> > > uint32_t len; /**< Current cache count */
> > > - /*
> > > - * Cache is allocated to this size to allow it to overflow in
> > certain
> > > - * cases to avoid needless emptying of cache.
> > > - */
> > > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache objects */
> > > + /**
> > > + * Cache objects
> > > + *
> > > + * Cache is allocated to this size to allow it to overflow in
> > certain
> > > + * cases to avoid needless emptying of cache.
> > > + */
> > > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2] __rte_cache_aligned;
> > > } __rte_cache_aligned;
> >
> > I think aligning objs on cacheline should be a separate patch.
>
> Good point. I'll let you do it. :-)
>
> PS: Thank you for following up on this patch series, Andrew!
Many thanks for this rework.
Acked-by: Olivier Matz <olivier.matz@6wind.com>
^ permalink raw reply [relevance 3%]
* [PATCH v2] eventdev: increase xstats ID width to 64 bits
2022-10-13 9:23 2% [PATCH] eventdev: increase xstats ID width to 64 bits pbhagavatula
2022-10-13 10:16 0% ` Mattias Rönnblom
@ 2022-10-13 11:35 2% ` pbhagavatula
2022-10-19 13:24 0% ` Jerin Jacob
1 sibling, 1 reply; 200+ results
From: pbhagavatula @ 2022-10-13 11:35 UTC (permalink / raw)
To: mb, jerinj, thomas, Pavan Nikhilesh, Shijith Thotton,
Timothy McDaniel, Mattias Rönnblom, Liang Ma,
Peter Mccarthy, Harry van Haaren
Cc: dev
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
Increase xstats ID width from 32 to 64 bits. This also
fixes the xstats ID datatype discrepancy between reset and
rest of the xstats family.
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
v2 Changes:
- Fix compilation on 32 bit platforms. (Mattias)
doc/guides/rel_notes/release_22_11.rst | 5 ++
drivers/event/cnxk/cnxk_eventdev.h | 6 +-
drivers/event/cnxk/cnxk_eventdev_stats.c | 6 +-
drivers/event/dlb2/dlb2_priv.h | 8 +-
drivers/event/dlb2/dlb2_xstats.c | 18 ++--
drivers/event/dsw/dsw_evdev.h | 6 +-
drivers/event/dsw/dsw_xstats.c | 32 +++----
drivers/event/opdl/opdl_evdev.h | 8 +-
drivers/event/opdl/opdl_evdev_xstats.c | 8 +-
drivers/event/opdl/opdl_test.c | 4 +-
drivers/event/sw/sw_evdev.h | 8 +-
drivers/event/sw/sw_evdev_selftest.c | 101 +++++++++++------------
drivers/event/sw/sw_evdev_xstats.c | 18 ++--
lib/eventdev/eventdev_pmd.h | 8 +-
lib/eventdev/rte_eventdev.c | 12 +--
lib/eventdev/rte_eventdev.h | 8 +-
16 files changed, 128 insertions(+), 128 deletions(-)
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2da8bc9661..6b76ad5566 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -454,6 +454,11 @@ API Changes
* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+* eventdev: The datatype of the ID parameter in the functions
+ ``rte_event_dev_xstats_names_get``, ``rte_event_dev_xstats_get``,
+ ``rte_event_dev_xstats_by_name_get`` and ``rte_event_dev_xstats_reset``
+ is changed to ``uint64_t`` from ``unsigned int`` and ``uint32_t``.
+
ABI Changes
-----------
diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
index f68c2aee23..738e335ea4 100644
--- a/drivers/event/cnxk/cnxk_eventdev.h
+++ b/drivers/event/cnxk/cnxk_eventdev.h
@@ -271,14 +271,14 @@ int cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
int cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, const unsigned int ids[],
+ uint8_t queue_port_id, const uint64_t ids[],
uint64_t values[], unsigned int n);
int cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
- int16_t queue_port_id, const uint32_t ids[],
+ int16_t queue_port_id, const uint64_t ids[],
uint32_t n);
/* CN9K */
diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c b/drivers/event/cnxk/cnxk_eventdev_stats.c
index a3b548f462..715ca9cd8f 100644
--- a/drivers/event/cnxk/cnxk_eventdev_stats.c
+++ b/drivers/event/cnxk/cnxk_eventdev_stats.c
@@ -103,7 +103,7 @@ static struct cnxk_sso_xstats_name sso_hwgrp_xstats[] = {
int
cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
struct roc_sso_hwgrp_stats hwgrp_stats;
@@ -170,7 +170,7 @@ cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
int
cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
- int16_t queue_port_id, const uint32_t ids[], uint32_t n)
+ int16_t queue_port_id, const uint64_t ids[], uint32_t n)
{
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
struct roc_sso_hwgrp_stats hwgrp_stats;
@@ -235,7 +235,7 @@ cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
struct rte_event_dev_xstats_name xstats_names_copy[CNXK_SSO_NUM_XSTATS];
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
index 9ef5bcb901..52f0ab9935 100644
--- a/drivers/event/dlb2/dlb2_priv.h
+++ b/drivers/event/dlb2/dlb2_priv.h
@@ -688,20 +688,20 @@ void dlb2_xstats_uninit(struct dlb2_eventdev *dlb2);
int dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
int dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstat_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
uint64_t dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
int dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
int test_dlb2_eventdev(void);
diff --git a/drivers/event/dlb2/dlb2_xstats.c b/drivers/event/dlb2/dlb2_xstats.c
index d4c8d99034..ff15271dda 100644
--- a/drivers/event/dlb2/dlb2_xstats.c
+++ b/drivers/event/dlb2/dlb2_xstats.c
@@ -666,7 +666,7 @@ int
dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
const struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
unsigned int i;
@@ -717,7 +717,7 @@ dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
static int
dlb2_xstats_update(struct dlb2_eventdev *dlb2,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, const unsigned int ids[],
+ uint8_t queue_port_id, const uint64_t ids[],
uint64_t values[], unsigned int n, const uint32_t reset)
{
unsigned int i;
@@ -791,7 +791,7 @@ dlb2_xstats_update(struct dlb2_eventdev *dlb2,
int
dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
const uint32_t reset = 0;
@@ -802,7 +802,7 @@ dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
uint64_t
dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id)
+ const char *name, uint64_t *id)
{
struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
unsigned int i;
@@ -876,7 +876,7 @@ dlb2_xstats_reset_range(struct dlb2_eventdev *dlb2, uint32_t start,
static int
dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
const uint32_t reset = 1;
@@ -898,7 +898,7 @@ dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
static int
dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
const uint32_t reset = 1;
int offset = dlb2->xstats_offset_for_port[port_id];
@@ -917,14 +917,14 @@ dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
}
static int
-dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint32_t ids[],
+dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint64_t ids[],
uint32_t nb_ids)
{
uint32_t i;
if (ids) {
for (i = 0; i < nb_ids; i++) {
- uint32_t id = ids[i];
+ uint64_t id = ids[i];
if (id >= dlb2->xstats_count_mode_dev)
return -EINVAL;
@@ -942,7 +942,7 @@ int
dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids)
{
struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
index df7dcc5577..6416a8a898 100644
--- a/drivers/event/dsw/dsw_evdev.h
+++ b/drivers/event/dsw/dsw_evdev.h
@@ -283,12 +283,12 @@ int dsw_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
int dsw_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
uint64_t dsw_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
static inline struct dsw_evdev *
dsw_pmd_priv(const struct rte_eventdev *eventdev)
diff --git a/drivers/event/dsw/dsw_xstats.c b/drivers/event/dsw/dsw_xstats.c
index 4f7d4e3ff9..2a83a28b41 100644
--- a/drivers/event/dsw/dsw_xstats.c
+++ b/drivers/event/dsw/dsw_xstats.c
@@ -15,8 +15,8 @@
*/
#define DSW_XSTATS_ID_PARAM_BITS (8)
#define DSW_XSTATS_ID_STAT_BITS \
- (sizeof(unsigned int)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
-#define DSW_XSTATS_ID_STAT_MASK ((1 << DSW_XSTATS_ID_STAT_BITS) - 1)
+ (sizeof(uint64_t)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
+#define DSW_XSTATS_ID_STAT_MASK ((UINT64_C(1) << DSW_XSTATS_ID_STAT_BITS) - 1)
#define DSW_XSTATS_ID_GET_PARAM(id) \
((id)>>DSW_XSTATS_ID_STAT_BITS)
@@ -25,7 +25,7 @@
((id) & DSW_XSTATS_ID_STAT_MASK)
#define DSW_XSTATS_ID_CREATE(id, param_value) \
- (((param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
+ ((((uint64_t)param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
typedef
uint64_t (*dsw_xstats_dev_get_value_fn)(struct dsw_evdev *dsw);
@@ -169,7 +169,7 @@ static struct dsw_xstats_port dsw_port_xstats[] = {
typedef
void (*dsw_xstats_foreach_fn)(const char *xstats_name,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, unsigned int xstats_id,
+ uint8_t queue_port_id, uint64_t xstats_id,
void *data);
static void
@@ -193,7 +193,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t port_id,
stat_idx < RTE_DIM(dsw_port_xstats);) {
struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
char xstats_name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
- unsigned int xstats_id;
+ uint64_t xstats_id;
if (xstat->per_queue) {
xstats_id = DSW_XSTATS_ID_CREATE(stat_idx, queue_id);
@@ -219,7 +219,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t port_id,
struct store_ctx {
struct rte_event_dev_xstats_name *names;
- unsigned int *ids;
+ uint64_t *ids;
unsigned int count;
unsigned int capacity;
};
@@ -227,7 +227,7 @@ struct store_ctx {
static void
dsw_xstats_store_stat(const char *xstats_name,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, unsigned int xstats_id,
+ uint8_t queue_port_id, uint64_t xstats_id,
void *data)
{
struct store_ctx *ctx = data;
@@ -248,7 +248,7 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int capacity)
+ uint64_t *ids, unsigned int capacity)
{
struct dsw_evdev *dsw = dsw_pmd_priv(dev);
@@ -276,13 +276,13 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
static int
dsw_xstats_dev_get(const struct rte_eventdev *dev,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct dsw_evdev *dsw = dsw_pmd_priv(dev);
unsigned int i;
for (i = 0; i < n; i++) {
- unsigned int id = ids[i];
+ uint64_t id = ids[i];
struct dsw_xstat_dev *xstat = &dsw_dev_xstats[id];
values[i] = xstat->get_value_fn(dsw);
}
@@ -291,13 +291,13 @@ dsw_xstats_dev_get(const struct rte_eventdev *dev,
static int
dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct dsw_evdev *dsw = dsw_pmd_priv(dev);
unsigned int i;
for (i = 0; i < n; i++) {
- unsigned int id = ids[i];
+ uint64_t id = ids[i];
unsigned int stat_idx = DSW_XSTATS_ID_GET_STAT(id);
struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
uint8_t queue_id = 0;
@@ -313,7 +313,7 @@ dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
int
dsw_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
switch (mode) {
case RTE_EVENT_DEV_XSTATS_DEVICE:
@@ -332,14 +332,14 @@ dsw_xstats_get(const struct rte_eventdev *dev,
struct find_ctx {
const struct rte_eventdev *dev;
const char *name;
- unsigned int *id;
+ uint64_t *id;
uint64_t value;
};
static void
dsw_xstats_find_stat(const char *xstats_name,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, unsigned int xstats_id,
+ uint8_t queue_port_id, uint64_t xstats_id,
void *data)
{
struct find_ctx *ctx = data;
@@ -354,7 +354,7 @@ dsw_xstats_find_stat(const char *xstats_name,
uint64_t
dsw_xstats_get_by_name(const struct rte_eventdev *dev, const char *name,
- unsigned int *id)
+ uint64_t *id)
{
struct dsw_evdev *dsw = dsw_pmd_priv(dev);
uint16_t port_id;
diff --git a/drivers/event/opdl/opdl_evdev.h b/drivers/event/opdl/opdl_evdev.h
index 2dca0a8a98..1ca166b37c 100644
--- a/drivers/event/opdl/opdl_evdev.h
+++ b/drivers/event/opdl/opdl_evdev.h
@@ -289,16 +289,16 @@ int opdl_xstats_uninit(struct rte_eventdev *dev);
int opdl_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
int opdl_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
uint64_t opdl_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
int opdl_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
int opdl_add_event_handlers(struct rte_eventdev *dev);
diff --git a/drivers/event/opdl/opdl_evdev_xstats.c b/drivers/event/opdl/opdl_evdev_xstats.c
index 27b3d88023..b382f6619d 100644
--- a/drivers/event/opdl/opdl_evdev_xstats.c
+++ b/drivers/event/opdl/opdl_evdev_xstats.c
@@ -65,7 +65,7 @@ opdl_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
struct opdl_evdev *device = opdl_pmd_priv(dev);
@@ -99,7 +99,7 @@ int
opdl_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
- const unsigned int ids[],
+ const uint64_t ids[],
uint64_t values[], unsigned int n)
{
struct opdl_evdev *device = opdl_pmd_priv(dev);
@@ -133,7 +133,7 @@ opdl_xstats_get(const struct rte_eventdev *dev,
uint64_t
opdl_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id)
+ const char *name, uint64_t *id)
{
struct opdl_evdev *device = opdl_pmd_priv(dev);
@@ -161,7 +161,7 @@ opdl_xstats_get_by_name(const struct rte_eventdev *dev,
int
opdl_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
- int16_t queue_port_id, const uint32_t ids[],
+ int16_t queue_port_id, const uint64_t ids[],
uint32_t nb_ids)
{
struct opdl_evdev *device = opdl_pmd_priv(dev);
diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 3cbe2139ee..b69c4769dc 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -471,7 +471,7 @@ atomic_basic(struct test *t)
return 0;
}
static __rte_always_inline int
-check_qid_stats(uint32_t id[], int index)
+check_qid_stats(uint64_t id[], int index)
{
if (index == 0) {
@@ -509,7 +509,7 @@ check_statistics(void)
0);
if (num_stats > 0) {
- uint32_t id[num_stats];
+ uint64_t id[num_stats];
struct rte_event_dev_xstats_name names[num_stats];
uint64_t values[num_stats];
diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
index 8542b7d34d..c7b943a72b 100644
--- a/drivers/event/sw/sw_evdev.h
+++ b/drivers/event/sw/sw_evdev.h
@@ -301,16 +301,16 @@ int sw_xstats_uninit(struct sw_evdev *dev);
int sw_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
int sw_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
uint64_t sw_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
int sw_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
int test_sw_eventdev(void);
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index ed7ae6a685..62d66744f2 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -92,7 +92,7 @@ xstats_print(void)
{
const uint32_t XSTATS_MAX = 1024;
uint32_t i;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
uint64_t values[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
@@ -310,15 +310,14 @@ static inline int
test_event_dev_stats_get(int dev_id, struct test_event_dev_stats *stats)
{
static uint32_t i;
- static uint32_t total_ids[3]; /* rx, tx and drop */
- static uint32_t port_rx_pkts_ids[MAX_PORTS];
- static uint32_t port_rx_dropped_ids[MAX_PORTS];
- static uint32_t port_inflight_ids[MAX_PORTS];
- static uint32_t port_tx_pkts_ids[MAX_PORTS];
- static uint32_t qid_rx_pkts_ids[MAX_QIDS];
- static uint32_t qid_rx_dropped_ids[MAX_QIDS];
- static uint32_t qid_tx_pkts_ids[MAX_QIDS];
-
+ static uint64_t total_ids[3]; /* rx, tx and drop */
+ static uint64_t port_rx_pkts_ids[MAX_PORTS];
+ static uint64_t port_rx_dropped_ids[MAX_PORTS];
+ static uint64_t port_inflight_ids[MAX_PORTS];
+ static uint64_t port_tx_pkts_ids[MAX_PORTS];
+ static uint64_t qid_rx_pkts_ids[MAX_QIDS];
+ static uint64_t qid_rx_dropped_ids[MAX_QIDS];
+ static uint64_t qid_tx_pkts_ids[MAX_QIDS];
stats->rx_pkts = rte_event_dev_xstats_by_name_get(dev_id,
"dev_rx", &total_ids[0]);
@@ -863,7 +862,7 @@ xstats_tests(struct test *t)
const uint32_t XSTATS_MAX = 1024;
uint32_t i;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
uint64_t values[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
@@ -963,11 +962,10 @@ xstats_tests(struct test *t)
static const uint64_t expected[] = {3, 3, 0, 1, 0, 0, 4, 1};
for (i = 0; (signed int)i < ret; i++) {
if (expected[i] != values[i]) {
- printf(
- "%d Error xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], expected[i]);
+ printf("%d Error xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], expected[i]);
goto fail;
}
}
@@ -982,11 +980,10 @@ xstats_tests(struct test *t)
0, ids, values, num_stats);
for (i = 0; (signed int)i < ret; i++) {
if (expected_zero[i] != values[i]) {
- printf(
- "%d Error, xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], expected_zero[i]);
+ printf("%d Error, xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], expected_zero[i]);
goto fail;
}
}
@@ -1058,11 +1055,10 @@ xstats_tests(struct test *t)
0, ids, values, num_stats);
for (i = 0; (signed int)i < ret; i++) {
if (port_expected_zero[i] != values[i]) {
- printf(
- "%d, Error, xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], port_expected_zero[i]);
+ printf("%d, Error, xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], port_expected_zero[i]);
goto fail;
}
}
@@ -1095,11 +1091,10 @@ xstats_tests(struct test *t)
};
for (i = 0; (signed int)i < ret; i++) {
if (queue_expected[i] != values[i]) {
- printf(
- "%d, Error, xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], queue_expected[i]);
+ printf("%d, Error, xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], queue_expected[i]);
goto fail;
}
}
@@ -1129,11 +1124,10 @@ xstats_tests(struct test *t)
int fails = 0;
for (i = 0; (signed int)i < ret; i++) {
if (queue_expected_zero[i] != values[i]) {
- printf(
- "%d, Error, xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], queue_expected_zero[i]);
+ printf("%d, Error, xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], queue_expected_zero[i]);
fails++;
}
}
@@ -1160,7 +1154,7 @@ xstats_id_abuse_tests(struct test *t)
const uint32_t XSTATS_MAX = 1024;
const uint32_t link_port = 2;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
/* Create instance with 4 ports */
@@ -1379,7 +1373,7 @@ xstats_brute_force(struct test *t)
{
uint32_t i;
const uint32_t XSTATS_MAX = 1024;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
uint64_t values[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
@@ -1454,7 +1448,7 @@ xstats_id_reset_tests(struct test *t)
#define XSTATS_MAX 1024
int ret;
uint32_t i;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
uint64_t values[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
@@ -1510,13 +1504,14 @@ xstats_id_reset_tests(struct test *t)
};
uint64_t dev_expected[] = {NPKTS, NPKTS, 0, 1, 0, 0, 4, 1};
for (i = 0; (int)i < ret; i++) {
- unsigned int id;
+ uint64_t id;
uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
dev_names[i],
&id);
if (id != i) {
- printf("%d: %s id incorrect, expected %d got %d\n",
- __LINE__, dev_names[i], i, id);
+ printf("%d: %s id incorrect, expected %d got %" PRIu64
+ "\n",
+ __LINE__, dev_names[i], i, id);
goto fail;
}
if (val != dev_expected[i]) {
@@ -1631,20 +1626,20 @@ xstats_id_reset_tests(struct test *t)
int failed = 0;
for (i = 0; (int)i < ret; i++) {
- unsigned int id;
+ uint64_t id;
uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
port_names[i],
&id);
if (id != i + PORT_OFF) {
- printf("%d: %s id incorrect, expected %d got %d\n",
- __LINE__, port_names[i], i+PORT_OFF,
- id);
+ printf("%d: %s id incorrect, expected %d got %" PRIu64
+ "\n",
+ __LINE__, port_names[i], i + PORT_OFF, id);
failed = 1;
}
if (val != port_expected[i]) {
- printf("%d: %s value incorrect, expected %"PRIu64
- " got %d\n", __LINE__, port_names[i],
- port_expected[i], id);
+ printf("%d: %s value incorrect, expected %" PRIu64
+ " got %" PRIu64 "\n",
+ __LINE__, port_names[i], port_expected[i], id);
failed = 1;
}
/* reset to zero */
@@ -1746,14 +1741,14 @@ xstats_id_reset_tests(struct test *t)
failed = 0;
for (i = 0; (int)i < ret; i++) {
- unsigned int id;
+ uint64_t id;
uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
queue_names[i],
&id);
if (id != i + QUEUE_OFF) {
- printf("%d: %s id incorrect, expected %d got %d\n",
- __LINE__, queue_names[i], i+QUEUE_OFF,
- id);
+ printf("%d: %s id incorrect, expected %d got %" PRIu64
+ "\n",
+ __LINE__, queue_names[i], i + QUEUE_OFF, id);
failed = 1;
}
if (val != queue_expected[i]) {
diff --git a/drivers/event/sw/sw_evdev_xstats.c b/drivers/event/sw/sw_evdev_xstats.c
index c2647d7da2..fbac8f3ab5 100644
--- a/drivers/event/sw/sw_evdev_xstats.c
+++ b/drivers/event/sw/sw_evdev_xstats.c
@@ -393,7 +393,7 @@ int
sw_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
const struct sw_evdev *sw = sw_pmd_priv_const(dev);
unsigned int i;
@@ -444,7 +444,7 @@ sw_xstats_get_names(const struct rte_eventdev *dev,
static int
sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, const unsigned int ids[],
+ uint8_t queue_port_id, const uint64_t ids[],
uint64_t values[], unsigned int n, const uint32_t reset,
const uint32_t ret_if_n_lt_nstats)
{
@@ -509,7 +509,7 @@ sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
int
sw_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct sw_evdev *sw = sw_pmd_priv(dev);
const uint32_t reset = 0;
@@ -520,7 +520,7 @@ sw_xstats_get(const struct rte_eventdev *dev,
uint64_t
sw_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id)
+ const char *name, uint64_t *id)
{
const struct sw_evdev *sw = sw_pmd_priv_const(dev);
unsigned int i;
@@ -556,7 +556,7 @@ sw_xstats_reset_range(struct sw_evdev *sw, uint32_t start, uint32_t num)
static int
sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
const uint32_t reset = 1;
const uint32_t ret_n_lt_stats = 0;
@@ -577,7 +577,7 @@ sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
static int
sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
const uint32_t reset = 1;
const uint32_t ret_n_lt_stats = 0;
@@ -597,12 +597,12 @@ sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
}
static int
-sw_xstats_reset_dev(struct sw_evdev *sw, const uint32_t ids[], uint32_t nb_ids)
+sw_xstats_reset_dev(struct sw_evdev *sw, const uint64_t ids[], uint32_t nb_ids)
{
uint32_t i;
if (ids) {
for (i = 0; i < nb_ids; i++) {
- uint32_t id = ids[i];
+ uint64_t id = ids[i];
if (id >= sw->xstats_count_mode_dev)
return -EINVAL;
sw_xstats_reset_range(sw, id, 1);
@@ -619,7 +619,7 @@ int
sw_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids)
{
struct sw_evdev *sw = sw_pmd_priv(dev);
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index e49ff23db5..aebab26852 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -529,7 +529,7 @@ typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
*/
typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
/**
* Resets the statistic values in xstats for the device, based on mode.
@@ -537,7 +537,7 @@ typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
/**
@@ -564,7 +564,7 @@ typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
/**
* Get value of one stats and optionally return its id
@@ -582,7 +582,7 @@ typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
* if id pointer is non-NULL
*/
typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
/**
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 845f8dbb6e..b0414206d9 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -1161,7 +1161,7 @@ int
rte_event_dev_xstats_names_get(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
const int cnt_expected_entries = xstats_get_count(dev_id, mode,
@@ -1183,7 +1183,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
/* retrieve eventdev extended statistics */
int
rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, const unsigned int ids[],
+ uint8_t queue_port_id, const uint64_t ids[],
uint64_t values[], unsigned int n)
{
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
@@ -1198,11 +1198,11 @@ rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode,
uint64_t
rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
- unsigned int *id)
+ uint64_t *id)
{
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0);
const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
- unsigned int temp = -1;
+ uint64_t temp = -1;
if (id != NULL)
*id = (unsigned int)-1;
@@ -1217,7 +1217,7 @@ rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
int rte_event_dev_xstats_reset(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode, int16_t queue_port_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
struct rte_eventdev *dev = &rte_eventdevs[dev_id];
@@ -1658,7 +1658,7 @@ eventdev_build_telemetry_data(int dev_id,
struct rte_tel_data *d)
{
struct rte_event_dev_xstats_name *xstat_names;
- unsigned int *ids;
+ uint64_t *ids;
uint64_t *values;
int i, ret, num_xstats;
diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
index 60e9043ac4..82e8976e57 100644
--- a/lib/eventdev/rte_eventdev.h
+++ b/lib/eventdev/rte_eventdev.h
@@ -1784,7 +1784,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids,
+ uint64_t *ids,
unsigned int size);
/**
@@ -1817,7 +1817,7 @@ int
rte_event_dev_xstats_get(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
- const unsigned int ids[],
+ const uint64_t ids[],
uint64_t values[], unsigned int n);
/**
@@ -1838,7 +1838,7 @@ rte_event_dev_xstats_get(uint8_t dev_id,
*/
uint64_t
rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
- unsigned int *id);
+ uint64_t *id);
/**
* Reset the values of the xstats of the selected component in the device.
@@ -1864,7 +1864,7 @@ int
rte_event_dev_xstats_reset(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
/**
--
2.25.1
^ permalink raw reply [relevance 2%]
* Re: [PATCH] eventdev: increase xstats ID width to 64 bits
2022-10-13 9:23 2% [PATCH] eventdev: increase xstats ID width to 64 bits pbhagavatula
@ 2022-10-13 10:16 0% ` Mattias Rönnblom
2022-10-13 11:35 2% ` [PATCH v2] " pbhagavatula
1 sibling, 0 replies; 200+ results
From: Mattias Rönnblom @ 2022-10-13 10:16 UTC (permalink / raw)
To: pbhagavatula, mb, jerinj, thomas, Shijith Thotton,
Timothy McDaniel, Liang Ma, Peter Mccarthy, Harry van Haaren
Cc: dev
On 2022-10-13 11:23, pbhagavatula@marvell.com wrote:
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Increase xstats ID width to 64bits from 32 bits, this also
"Increase xstats ID width from 32 to 64 bits. This /../"
Not that "unsigned int" is always 32, but anyways, I guess that's true
for all platforms DPDK supports.
> fixes the xstats ID datatype discrepancy between reset and
> rest of the xstats family.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
> doc/guides/rel_notes/release_22_11.rst | 5 ++
> drivers/event/cnxk/cnxk_eventdev.h | 6 +-
> drivers/event/cnxk/cnxk_eventdev_stats.c | 6 +-
> drivers/event/dlb2/dlb2_priv.h | 8 +-
> drivers/event/dlb2/dlb2_xstats.c | 18 ++--
> drivers/event/dsw/dsw_evdev.h | 6 +-
> drivers/event/dsw/dsw_xstats.c | 32 +++----
> drivers/event/opdl/opdl_evdev.h | 8 +-
> drivers/event/opdl/opdl_evdev_xstats.c | 8 +-
> drivers/event/opdl/opdl_test.c | 4 +-
> drivers/event/sw/sw_evdev.h | 8 +-
> drivers/event/sw/sw_evdev_selftest.c | 101 +++++++++++------------
> drivers/event/sw/sw_evdev_xstats.c | 18 ++--
> lib/eventdev/eventdev_pmd.h | 8 +-
> lib/eventdev/rte_eventdev.c | 12 +--
> lib/eventdev/rte_eventdev.h | 8 +-
> 16 files changed, 128 insertions(+), 128 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 2da8bc9661..6b76ad5566 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -454,6 +454,11 @@ API Changes
>
> * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
>
> +* eventdev: The datatype of the ID parameter in the functions
> + ``rte_event_dev_xstats_names_get``, ``rte_event_dev_xstats_get``,
> + ``rte_event_dev_xstats_by_name_get`` and ``rte_event_dev_xstats_reset``
> + is changed to ``uint64_t`` from ``unsigned int`` and ``uint32_t``.
> +
>
> ABI Changes
> -----------
> diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
> index f68c2aee23..738e335ea4 100644
> --- a/drivers/event/cnxk/cnxk_eventdev.h
> +++ b/drivers/event/cnxk/cnxk_eventdev.h
> @@ -271,14 +271,14 @@ int cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
> int cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, const unsigned int ids[],
> + uint8_t queue_port_id, const uint64_t ids[],
> uint64_t values[], unsigned int n);
> int cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> - int16_t queue_port_id, const uint32_t ids[],
> + int16_t queue_port_id, const uint64_t ids[],
> uint32_t n);
>
> /* CN9K */
> diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c b/drivers/event/cnxk/cnxk_eventdev_stats.c
> index a3b548f462..715ca9cd8f 100644
> --- a/drivers/event/cnxk/cnxk_eventdev_stats.c
> +++ b/drivers/event/cnxk/cnxk_eventdev_stats.c
> @@ -103,7 +103,7 @@ static struct cnxk_sso_xstats_name sso_hwgrp_xstats[] = {
> int
> cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> struct roc_sso_hwgrp_stats hwgrp_stats;
> @@ -170,7 +170,7 @@ cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
> int
> cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> - int16_t queue_port_id, const uint32_t ids[], uint32_t n)
> + int16_t queue_port_id, const uint64_t ids[], uint32_t n)
> {
> struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> struct roc_sso_hwgrp_stats hwgrp_stats;
> @@ -235,7 +235,7 @@ cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> struct rte_event_dev_xstats_name xstats_names_copy[CNXK_SSO_NUM_XSTATS];
> struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
> index 9ef5bcb901..52f0ab9935 100644
> --- a/drivers/event/dlb2/dlb2_priv.h
> +++ b/drivers/event/dlb2/dlb2_priv.h
> @@ -688,20 +688,20 @@ void dlb2_xstats_uninit(struct dlb2_eventdev *dlb2);
>
> int dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
>
> int dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstat_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
>
> uint64_t dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
>
> int dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> int test_dlb2_eventdev(void);
> diff --git a/drivers/event/dlb2/dlb2_xstats.c b/drivers/event/dlb2/dlb2_xstats.c
> index d4c8d99034..ff15271dda 100644
> --- a/drivers/event/dlb2/dlb2_xstats.c
> +++ b/drivers/event/dlb2/dlb2_xstats.c
> @@ -666,7 +666,7 @@ int
> dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> const struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> unsigned int i;
> @@ -717,7 +717,7 @@ dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
> static int
> dlb2_xstats_update(struct dlb2_eventdev *dlb2,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, const unsigned int ids[],
> + uint8_t queue_port_id, const uint64_t ids[],
> uint64_t values[], unsigned int n, const uint32_t reset)
> {
> unsigned int i;
> @@ -791,7 +791,7 @@ dlb2_xstats_update(struct dlb2_eventdev *dlb2,
> int
> dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> const uint32_t reset = 0;
> @@ -802,7 +802,7 @@ dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
>
> uint64_t
> dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id)
> + const char *name, uint64_t *id)
> {
> struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> unsigned int i;
> @@ -876,7 +876,7 @@ dlb2_xstats_reset_range(struct dlb2_eventdev *dlb2, uint32_t start,
>
> static int
> dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> const uint32_t reset = 1;
>
> @@ -898,7 +898,7 @@ dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
>
> static int
> dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> const uint32_t reset = 1;
> int offset = dlb2->xstats_offset_for_port[port_id];
> @@ -917,14 +917,14 @@ dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
> }
>
> static int
> -dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint32_t ids[],
> +dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint64_t ids[],
> uint32_t nb_ids)
> {
> uint32_t i;
>
> if (ids) {
> for (i = 0; i < nb_ids; i++) {
> - uint32_t id = ids[i];
> + uint64_t id = ids[i];
>
> if (id >= dlb2->xstats_count_mode_dev)
> return -EINVAL;
> @@ -942,7 +942,7 @@ int
> dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids)
> {
> struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
> index df7dcc5577..6416a8a898 100644
> --- a/drivers/event/dsw/dsw_evdev.h
> +++ b/drivers/event/dsw/dsw_evdev.h
> @@ -283,12 +283,12 @@ int dsw_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
> int dsw_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
> uint64_t dsw_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
>
> static inline struct dsw_evdev *
> dsw_pmd_priv(const struct rte_eventdev *eventdev)
> diff --git a/drivers/event/dsw/dsw_xstats.c b/drivers/event/dsw/dsw_xstats.c
> index 4f7d4e3ff9..2409de6adc 100644
> --- a/drivers/event/dsw/dsw_xstats.c
> +++ b/drivers/event/dsw/dsw_xstats.c
> @@ -15,8 +15,8 @@
> */
> #define DSW_XSTATS_ID_PARAM_BITS (8)
> #define DSW_XSTATS_ID_STAT_BITS \
> - (sizeof(unsigned int)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
> -#define DSW_XSTATS_ID_STAT_MASK ((1 << DSW_XSTATS_ID_STAT_BITS) - 1)
> + (sizeof(uint64_t)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
> +#define DSW_XSTATS_ID_STAT_MASK ((1UL << DSW_XSTATS_ID_STAT_BITS) - 1)
Use UINT64_C(1) instead.
>
> #define DSW_XSTATS_ID_GET_PARAM(id) \
> ((id)>>DSW_XSTATS_ID_STAT_BITS)
> @@ -25,7 +25,7 @@
> ((id) & DSW_XSTATS_ID_STAT_MASK)
>
> #define DSW_XSTATS_ID_CREATE(id, param_value) \
> - (((param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
> + ((((uint64_t)param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
>
> typedef
> uint64_t (*dsw_xstats_dev_get_value_fn)(struct dsw_evdev *dsw);
> @@ -169,7 +169,7 @@ static struct dsw_xstats_port dsw_port_xstats[] = {
> typedef
> void (*dsw_xstats_foreach_fn)(const char *xstats_name,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, unsigned int xstats_id,
> + uint8_t queue_port_id, uint64_t xstats_id,
> void *data);
>
> static void
> @@ -193,7 +193,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t port_id,
> stat_idx < RTE_DIM(dsw_port_xstats);) {
> struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
> char xstats_name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
> - unsigned int xstats_id;
> + uint64_t xstats_id;
>
> if (xstat->per_queue) {
> xstats_id = DSW_XSTATS_ID_CREATE(stat_idx, queue_id);
> @@ -219,7 +219,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t port_id,
>
> struct store_ctx {
> struct rte_event_dev_xstats_name *names;
> - unsigned int *ids;
> + uint64_t *ids;
> unsigned int count;
> unsigned int capacity;
> };
> @@ -227,7 +227,7 @@ struct store_ctx {
> static void
> dsw_xstats_store_stat(const char *xstats_name,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, unsigned int xstats_id,
> + uint8_t queue_port_id, uint64_t xstats_id,
> void *data)
> {
> struct store_ctx *ctx = data;
> @@ -248,7 +248,7 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int capacity)
> + uint64_t *ids, unsigned int capacity)
> {
> struct dsw_evdev *dsw = dsw_pmd_priv(dev);
>
> @@ -276,13 +276,13 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
>
> static int
> dsw_xstats_dev_get(const struct rte_eventdev *dev,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct dsw_evdev *dsw = dsw_pmd_priv(dev);
> unsigned int i;
>
> for (i = 0; i < n; i++) {
> - unsigned int id = ids[i];
> + uint64_t id = ids[i];
> struct dsw_xstat_dev *xstat = &dsw_dev_xstats[id];
> values[i] = xstat->get_value_fn(dsw);
> }
> @@ -291,13 +291,13 @@ dsw_xstats_dev_get(const struct rte_eventdev *dev,
>
> static int
> dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct dsw_evdev *dsw = dsw_pmd_priv(dev);
> unsigned int i;
>
> for (i = 0; i < n; i++) {
> - unsigned int id = ids[i];
> + uint64_t id = ids[i];
> unsigned int stat_idx = DSW_XSTATS_ID_GET_STAT(id);
> struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
> uint8_t queue_id = 0;
> @@ -313,7 +313,7 @@ dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
> int
> dsw_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> switch (mode) {
> case RTE_EVENT_DEV_XSTATS_DEVICE:
> @@ -332,14 +332,14 @@ dsw_xstats_get(const struct rte_eventdev *dev,
> struct find_ctx {
> const struct rte_eventdev *dev;
> const char *name;
> - unsigned int *id;
> + uint64_t *id;
> uint64_t value;
> };
>
> static void
> dsw_xstats_find_stat(const char *xstats_name,
> enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, unsigned int xstats_id,
> + uint8_t queue_port_id, uint64_t xstats_id,
> void *data)
> {
> struct find_ctx *ctx = data;
> @@ -354,7 +354,7 @@ dsw_xstats_find_stat(const char *xstats_name,
>
> uint64_t
> dsw_xstats_get_by_name(const struct rte_eventdev *dev, const char *name,
> - unsigned int *id)
> + uint64_t *id)
> {
> struct dsw_evdev *dsw = dsw_pmd_priv(dev);
> uint16_t port_id;
> diff --git a/drivers/event/opdl/opdl_evdev.h b/drivers/event/opdl/opdl_evdev.h
> index 2dca0a8a98..1ca166b37c 100644
> --- a/drivers/event/opdl/opdl_evdev.h
> +++ b/drivers/event/opdl/opdl_evdev.h
> @@ -289,16 +289,16 @@ int opdl_xstats_uninit(struct rte_eventdev *dev);
> int opdl_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
> int opdl_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
> uint64_t opdl_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
> int opdl_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> int opdl_add_event_handlers(struct rte_eventdev *dev);
> diff --git a/drivers/event/opdl/opdl_evdev_xstats.c b/drivers/event/opdl/opdl_evdev_xstats.c
> index 27b3d88023..b382f6619d 100644
> --- a/drivers/event/opdl/opdl_evdev_xstats.c
> +++ b/drivers/event/opdl/opdl_evdev_xstats.c
> @@ -65,7 +65,7 @@ opdl_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> struct opdl_evdev *device = opdl_pmd_priv(dev);
>
> @@ -99,7 +99,7 @@ int
> opdl_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> - const unsigned int ids[],
> + const uint64_t ids[],
> uint64_t values[], unsigned int n)
> {
> struct opdl_evdev *device = opdl_pmd_priv(dev);
> @@ -133,7 +133,7 @@ opdl_xstats_get(const struct rte_eventdev *dev,
>
> uint64_t
> opdl_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id)
> + const char *name, uint64_t *id)
> {
> struct opdl_evdev *device = opdl_pmd_priv(dev);
>
> @@ -161,7 +161,7 @@ opdl_xstats_get_by_name(const struct rte_eventdev *dev,
> int
> opdl_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> - int16_t queue_port_id, const uint32_t ids[],
> + int16_t queue_port_id, const uint64_t ids[],
> uint32_t nb_ids)
> {
> struct opdl_evdev *device = opdl_pmd_priv(dev);
> diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
> index 3cbe2139ee..b69c4769dc 100644
> --- a/drivers/event/opdl/opdl_test.c
> +++ b/drivers/event/opdl/opdl_test.c
> @@ -471,7 +471,7 @@ atomic_basic(struct test *t)
> return 0;
> }
> static __rte_always_inline int
> -check_qid_stats(uint32_t id[], int index)
> +check_qid_stats(uint64_t id[], int index)
> {
>
> if (index == 0) {
> @@ -509,7 +509,7 @@ check_statistics(void)
> 0);
> if (num_stats > 0) {
>
> - uint32_t id[num_stats];
> + uint64_t id[num_stats];
> struct rte_event_dev_xstats_name names[num_stats];
> uint64_t values[num_stats];
>
> diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
> index 8542b7d34d..c7b943a72b 100644
> --- a/drivers/event/sw/sw_evdev.h
> +++ b/drivers/event/sw/sw_evdev.h
> @@ -301,16 +301,16 @@ int sw_xstats_uninit(struct sw_evdev *dev);
> int sw_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
> int sw_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
> uint64_t sw_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
> int sw_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> int test_sw_eventdev(void);
> diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
> index ed7ae6a685..62d66744f2 100644
> --- a/drivers/event/sw/sw_evdev_selftest.c
> +++ b/drivers/event/sw/sw_evdev_selftest.c
> @@ -92,7 +92,7 @@ xstats_print(void)
> {
> const uint32_t XSTATS_MAX = 1024;
> uint32_t i;
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> uint64_t values[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> @@ -310,15 +310,14 @@ static inline int
> test_event_dev_stats_get(int dev_id, struct test_event_dev_stats *stats)
> {
> static uint32_t i;
> - static uint32_t total_ids[3]; /* rx, tx and drop */
> - static uint32_t port_rx_pkts_ids[MAX_PORTS];
> - static uint32_t port_rx_dropped_ids[MAX_PORTS];
> - static uint32_t port_inflight_ids[MAX_PORTS];
> - static uint32_t port_tx_pkts_ids[MAX_PORTS];
> - static uint32_t qid_rx_pkts_ids[MAX_QIDS];
> - static uint32_t qid_rx_dropped_ids[MAX_QIDS];
> - static uint32_t qid_tx_pkts_ids[MAX_QIDS];
> -
> + static uint64_t total_ids[3]; /* rx, tx and drop */
> + static uint64_t port_rx_pkts_ids[MAX_PORTS];
> + static uint64_t port_rx_dropped_ids[MAX_PORTS];
> + static uint64_t port_inflight_ids[MAX_PORTS];
> + static uint64_t port_tx_pkts_ids[MAX_PORTS];
> + static uint64_t qid_rx_pkts_ids[MAX_QIDS];
> + static uint64_t qid_rx_dropped_ids[MAX_QIDS];
> + static uint64_t qid_tx_pkts_ids[MAX_QIDS];
>
> stats->rx_pkts = rte_event_dev_xstats_by_name_get(dev_id,
> "dev_rx", &total_ids[0]);
> @@ -863,7 +862,7 @@ xstats_tests(struct test *t)
> const uint32_t XSTATS_MAX = 1024;
>
> uint32_t i;
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> uint64_t values[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> @@ -963,11 +962,10 @@ xstats_tests(struct test *t)
> static const uint64_t expected[] = {3, 3, 0, 1, 0, 0, 4, 1};
> for (i = 0; (signed int)i < ret; i++) {
> if (expected[i] != values[i]) {
> - printf(
> - "%d Error xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], expected[i]);
> + printf("%d Error xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], expected[i]);
> goto fail;
> }
> }
> @@ -982,11 +980,10 @@ xstats_tests(struct test *t)
> 0, ids, values, num_stats);
> for (i = 0; (signed int)i < ret; i++) {
> if (expected_zero[i] != values[i]) {
> - printf(
> - "%d Error, xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], expected_zero[i]);
> + printf("%d Error, xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], expected_zero[i]);
> goto fail;
> }
> }
> @@ -1058,11 +1055,10 @@ xstats_tests(struct test *t)
> 0, ids, values, num_stats);
> for (i = 0; (signed int)i < ret; i++) {
> if (port_expected_zero[i] != values[i]) {
> - printf(
> - "%d, Error, xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], port_expected_zero[i]);
> + printf("%d, Error, xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], port_expected_zero[i]);
> goto fail;
> }
> }
> @@ -1095,11 +1091,10 @@ xstats_tests(struct test *t)
> };
> for (i = 0; (signed int)i < ret; i++) {
> if (queue_expected[i] != values[i]) {
> - printf(
> - "%d, Error, xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], queue_expected[i]);
> + printf("%d, Error, xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], queue_expected[i]);
> goto fail;
> }
> }
> @@ -1129,11 +1124,10 @@ xstats_tests(struct test *t)
> int fails = 0;
> for (i = 0; (signed int)i < ret; i++) {
> if (queue_expected_zero[i] != values[i]) {
> - printf(
> - "%d, Error, xstat %d (id %d) %s : %"PRIu64
> - ", expect %"PRIu64"\n",
> - __LINE__, i, ids[i], xstats_names[i].name,
> - values[i], queue_expected_zero[i]);
> + printf("%d, Error, xstat %d (id %" PRIu64
> + ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> + __LINE__, i, ids[i], xstats_names[i].name,
> + values[i], queue_expected_zero[i]);
> fails++;
> }
> }
> @@ -1160,7 +1154,7 @@ xstats_id_abuse_tests(struct test *t)
> const uint32_t XSTATS_MAX = 1024;
> const uint32_t link_port = 2;
>
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> /* Create instance with 4 ports */
> @@ -1379,7 +1373,7 @@ xstats_brute_force(struct test *t)
> {
> uint32_t i;
> const uint32_t XSTATS_MAX = 1024;
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> uint64_t values[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> @@ -1454,7 +1448,7 @@ xstats_id_reset_tests(struct test *t)
> #define XSTATS_MAX 1024
> int ret;
> uint32_t i;
> - uint32_t ids[XSTATS_MAX];
> + uint64_t ids[XSTATS_MAX];
> uint64_t values[XSTATS_MAX];
> struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>
> @@ -1510,13 +1504,14 @@ xstats_id_reset_tests(struct test *t)
> };
> uint64_t dev_expected[] = {NPKTS, NPKTS, 0, 1, 0, 0, 4, 1};
> for (i = 0; (int)i < ret; i++) {
> - unsigned int id;
> + uint64_t id;
> uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
> dev_names[i],
> &id);
> if (id != i) {
> - printf("%d: %s id incorrect, expected %d got %d\n",
> - __LINE__, dev_names[i], i, id);
> + printf("%d: %s id incorrect, expected %d got %" PRIu64
> + "\n",
> + __LINE__, dev_names[i], i, id);
> goto fail;
> }
> if (val != dev_expected[i]) {
> @@ -1631,20 +1626,20 @@ xstats_id_reset_tests(struct test *t)
>
> int failed = 0;
> for (i = 0; (int)i < ret; i++) {
> - unsigned int id;
> + uint64_t id;
> uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
> port_names[i],
> &id);
> if (id != i + PORT_OFF) {
> - printf("%d: %s id incorrect, expected %d got %d\n",
> - __LINE__, port_names[i], i+PORT_OFF,
> - id);
> + printf("%d: %s id incorrect, expected %d got %" PRIu64
> + "\n",
> + __LINE__, port_names[i], i + PORT_OFF, id);
> failed = 1;
> }
> if (val != port_expected[i]) {
> - printf("%d: %s value incorrect, expected %"PRIu64
> - " got %d\n", __LINE__, port_names[i],
> - port_expected[i], id);
> + printf("%d: %s value incorrect, expected %" PRIu64
> + " got %" PRIu64 "\n",
> + __LINE__, port_names[i], port_expected[i], id);
> failed = 1;
> }
> /* reset to zero */
> @@ -1746,14 +1741,14 @@ xstats_id_reset_tests(struct test *t)
>
> failed = 0;
> for (i = 0; (int)i < ret; i++) {
> - unsigned int id;
> + uint64_t id;
> uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
> queue_names[i],
> &id);
> if (id != i + QUEUE_OFF) {
> - printf("%d: %s id incorrect, expected %d got %d\n",
> - __LINE__, queue_names[i], i+QUEUE_OFF,
> - id);
> + printf("%d: %s id incorrect, expected %d got %" PRIu64
> + "\n",
> + __LINE__, queue_names[i], i + QUEUE_OFF, id);
> failed = 1;
> }
> if (val != queue_expected[i]) {
> diff --git a/drivers/event/sw/sw_evdev_xstats.c b/drivers/event/sw/sw_evdev_xstats.c
> index c2647d7da2..fbac8f3ab5 100644
> --- a/drivers/event/sw/sw_evdev_xstats.c
> +++ b/drivers/event/sw/sw_evdev_xstats.c
> @@ -393,7 +393,7 @@ int
> sw_xstats_get_names(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> const struct sw_evdev *sw = sw_pmd_priv_const(dev);
> unsigned int i;
> @@ -444,7 +444,7 @@ sw_xstats_get_names(const struct rte_eventdev *dev,
>
> static int
> sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, const unsigned int ids[],
> + uint8_t queue_port_id, const uint64_t ids[],
> uint64_t values[], unsigned int n, const uint32_t reset,
> const uint32_t ret_if_n_lt_nstats)
> {
> @@ -509,7 +509,7 @@ sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
> int
> sw_xstats_get(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n)
> + const uint64_t ids[], uint64_t values[], unsigned int n)
> {
> struct sw_evdev *sw = sw_pmd_priv(dev);
> const uint32_t reset = 0;
> @@ -520,7 +520,7 @@ sw_xstats_get(const struct rte_eventdev *dev,
>
> uint64_t
> sw_xstats_get_by_name(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id)
> + const char *name, uint64_t *id)
> {
> const struct sw_evdev *sw = sw_pmd_priv_const(dev);
> unsigned int i;
> @@ -556,7 +556,7 @@ sw_xstats_reset_range(struct sw_evdev *sw, uint32_t start, uint32_t num)
>
> static int
> sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> const uint32_t reset = 1;
> const uint32_t ret_n_lt_stats = 0;
> @@ -577,7 +577,7 @@ sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
>
> static int
> sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> const uint32_t reset = 1;
> const uint32_t ret_n_lt_stats = 0;
> @@ -597,12 +597,12 @@ sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
> }
>
> static int
> -sw_xstats_reset_dev(struct sw_evdev *sw, const uint32_t ids[], uint32_t nb_ids)
> +sw_xstats_reset_dev(struct sw_evdev *sw, const uint64_t ids[], uint32_t nb_ids)
> {
> uint32_t i;
> if (ids) {
> for (i = 0; i < nb_ids; i++) {
> - uint32_t id = ids[i];
> + uint64_t id = ids[i];
> if (id >= sw->xstats_count_mode_dev)
> return -EINVAL;
> sw_xstats_reset_range(sw, id, 1);
> @@ -619,7 +619,7 @@ int
> sw_xstats_reset(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids)
> {
> struct sw_evdev *sw = sw_pmd_priv(dev);
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index e49ff23db5..aebab26852 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -529,7 +529,7 @@ typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
> */
> typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> - const unsigned int ids[], uint64_t values[], unsigned int n);
> + const uint64_t ids[], uint64_t values[], unsigned int n);
>
> /**
> * Resets the statistic values in xstats for the device, based on mode.
> @@ -537,7 +537,7 @@ typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
> typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> /**
> @@ -564,7 +564,7 @@ typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
> typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size);
> + uint64_t *ids, unsigned int size);
>
> /**
> * Get value of one stats and optionally return its id
> @@ -582,7 +582,7 @@ typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
> * if id pointer is non-NULL
> */
> typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
> - const char *name, unsigned int *id);
> + const char *name, uint64_t *id);
>
>
> /**
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 845f8dbb6e..b0414206d9 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -1161,7 +1161,7 @@ int
> rte_event_dev_xstats_names_get(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids, unsigned int size)
> + uint64_t *ids, unsigned int size)
> {
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
> const int cnt_expected_entries = xstats_get_count(dev_id, mode,
> @@ -1183,7 +1183,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
> /* retrieve eventdev extended statistics */
> int
> rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode,
> - uint8_t queue_port_id, const unsigned int ids[],
> + uint8_t queue_port_id, const uint64_t ids[],
> uint64_t values[], unsigned int n)
> {
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
> @@ -1198,11 +1198,11 @@ rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode,
>
> uint64_t
> rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
> - unsigned int *id)
> + uint64_t *id)
> {
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0);
> const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> - unsigned int temp = -1;
> + uint64_t temp = -1;
>
> if (id != NULL)
> *id = (unsigned int)-1;
> @@ -1217,7 +1217,7 @@ rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
>
> int rte_event_dev_xstats_reset(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode, int16_t queue_port_id,
> - const uint32_t ids[], uint32_t nb_ids)
> + const uint64_t ids[], uint32_t nb_ids)
> {
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
> struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> @@ -1658,7 +1658,7 @@ eventdev_build_telemetry_data(int dev_id,
> struct rte_tel_data *d)
> {
> struct rte_event_dev_xstats_name *xstat_names;
> - unsigned int *ids;
> + uint64_t *ids;
> uint64_t *values;
> int i, ret, num_xstats;
>
> diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
> index 60e9043ac4..82e8976e57 100644
> --- a/lib/eventdev/rte_eventdev.h
> +++ b/lib/eventdev/rte_eventdev.h
> @@ -1784,7 +1784,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> struct rte_event_dev_xstats_name *xstats_names,
> - unsigned int *ids,
> + uint64_t *ids,
> unsigned int size);
>
> /**
> @@ -1817,7 +1817,7 @@ int
> rte_event_dev_xstats_get(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode,
> uint8_t queue_port_id,
> - const unsigned int ids[],
> + const uint64_t ids[],
> uint64_t values[], unsigned int n);
>
> /**
> @@ -1838,7 +1838,7 @@ rte_event_dev_xstats_get(uint8_t dev_id,
> */
> uint64_t
> rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
> - unsigned int *id);
> + uint64_t *id);
>
> /**
> * Reset the values of the xstats of the selected component in the device.
> @@ -1864,7 +1864,7 @@ int
> rte_event_dev_xstats_reset(uint8_t dev_id,
> enum rte_event_dev_xstats_mode mode,
> int16_t queue_port_id,
> - const uint32_t ids[],
> + const uint64_t ids[],
> uint32_t nb_ids);
>
> /**
With the minor fixes:
Reviewed-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
^ permalink raw reply [relevance 0%]
* [PATCH] eventdev: increase xstats ID width to 64 bits
@ 2022-10-13 9:23 2% pbhagavatula
2022-10-13 10:16 0% ` Mattias Rönnblom
2022-10-13 11:35 2% ` [PATCH v2] " pbhagavatula
0 siblings, 2 replies; 200+ results
From: pbhagavatula @ 2022-10-13 9:23 UTC (permalink / raw)
To: mb, jerinj, thomas, Pavan Nikhilesh, Shijith Thotton,
Timothy McDaniel, Mattias Ronnblom, Liang Ma, Peter Mccarthy,
Harry van Haaren
Cc: dev
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
Increase xstats ID width to 64bits from 32 bits, this also
fixes the xstats ID datatype discrepancy between reset and
rest of the xstats family.
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
doc/guides/rel_notes/release_22_11.rst | 5 ++
drivers/event/cnxk/cnxk_eventdev.h | 6 +-
drivers/event/cnxk/cnxk_eventdev_stats.c | 6 +-
drivers/event/dlb2/dlb2_priv.h | 8 +-
drivers/event/dlb2/dlb2_xstats.c | 18 ++--
drivers/event/dsw/dsw_evdev.h | 6 +-
drivers/event/dsw/dsw_xstats.c | 32 +++----
drivers/event/opdl/opdl_evdev.h | 8 +-
drivers/event/opdl/opdl_evdev_xstats.c | 8 +-
drivers/event/opdl/opdl_test.c | 4 +-
drivers/event/sw/sw_evdev.h | 8 +-
drivers/event/sw/sw_evdev_selftest.c | 101 +++++++++++------------
drivers/event/sw/sw_evdev_xstats.c | 18 ++--
lib/eventdev/eventdev_pmd.h | 8 +-
lib/eventdev/rte_eventdev.c | 12 +--
lib/eventdev/rte_eventdev.h | 8 +-
16 files changed, 128 insertions(+), 128 deletions(-)
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2da8bc9661..6b76ad5566 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -454,6 +454,11 @@ API Changes
* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+* eventdev: The datatype of the ID parameter in the functions
+ ``rte_event_dev_xstats_names_get``, ``rte_event_dev_xstats_get``,
+ ``rte_event_dev_xstats_by_name_get`` and ``rte_event_dev_xstats_reset``
+ is changed to ``uint64_t`` from ``unsigned int`` and ``uint32_t``.
+
ABI Changes
-----------
diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
index f68c2aee23..738e335ea4 100644
--- a/drivers/event/cnxk/cnxk_eventdev.h
+++ b/drivers/event/cnxk/cnxk_eventdev.h
@@ -271,14 +271,14 @@ int cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
int cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, const unsigned int ids[],
+ uint8_t queue_port_id, const uint64_t ids[],
uint64_t values[], unsigned int n);
int cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
- int16_t queue_port_id, const uint32_t ids[],
+ int16_t queue_port_id, const uint64_t ids[],
uint32_t n);
/* CN9K */
diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c b/drivers/event/cnxk/cnxk_eventdev_stats.c
index a3b548f462..715ca9cd8f 100644
--- a/drivers/event/cnxk/cnxk_eventdev_stats.c
+++ b/drivers/event/cnxk/cnxk_eventdev_stats.c
@@ -103,7 +103,7 @@ static struct cnxk_sso_xstats_name sso_hwgrp_xstats[] = {
int
cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
struct roc_sso_hwgrp_stats hwgrp_stats;
@@ -170,7 +170,7 @@ cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
int
cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
- int16_t queue_port_id, const uint32_t ids[], uint32_t n)
+ int16_t queue_port_id, const uint64_t ids[], uint32_t n)
{
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
struct roc_sso_hwgrp_stats hwgrp_stats;
@@ -235,7 +235,7 @@ cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
struct rte_event_dev_xstats_name xstats_names_copy[CNXK_SSO_NUM_XSTATS];
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
index 9ef5bcb901..52f0ab9935 100644
--- a/drivers/event/dlb2/dlb2_priv.h
+++ b/drivers/event/dlb2/dlb2_priv.h
@@ -688,20 +688,20 @@ void dlb2_xstats_uninit(struct dlb2_eventdev *dlb2);
int dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
int dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstat_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
uint64_t dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
int dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
int test_dlb2_eventdev(void);
diff --git a/drivers/event/dlb2/dlb2_xstats.c b/drivers/event/dlb2/dlb2_xstats.c
index d4c8d99034..ff15271dda 100644
--- a/drivers/event/dlb2/dlb2_xstats.c
+++ b/drivers/event/dlb2/dlb2_xstats.c
@@ -666,7 +666,7 @@ int
dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
const struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
unsigned int i;
@@ -717,7 +717,7 @@ dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
static int
dlb2_xstats_update(struct dlb2_eventdev *dlb2,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, const unsigned int ids[],
+ uint8_t queue_port_id, const uint64_t ids[],
uint64_t values[], unsigned int n, const uint32_t reset)
{
unsigned int i;
@@ -791,7 +791,7 @@ dlb2_xstats_update(struct dlb2_eventdev *dlb2,
int
dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
const uint32_t reset = 0;
@@ -802,7 +802,7 @@ dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
uint64_t
dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id)
+ const char *name, uint64_t *id)
{
struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
unsigned int i;
@@ -876,7 +876,7 @@ dlb2_xstats_reset_range(struct dlb2_eventdev *dlb2, uint32_t start,
static int
dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
const uint32_t reset = 1;
@@ -898,7 +898,7 @@ dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
static int
dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
const uint32_t reset = 1;
int offset = dlb2->xstats_offset_for_port[port_id];
@@ -917,14 +917,14 @@ dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
}
static int
-dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint32_t ids[],
+dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint64_t ids[],
uint32_t nb_ids)
{
uint32_t i;
if (ids) {
for (i = 0; i < nb_ids; i++) {
- uint32_t id = ids[i];
+ uint64_t id = ids[i];
if (id >= dlb2->xstats_count_mode_dev)
return -EINVAL;
@@ -942,7 +942,7 @@ int
dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids)
{
struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
index df7dcc5577..6416a8a898 100644
--- a/drivers/event/dsw/dsw_evdev.h
+++ b/drivers/event/dsw/dsw_evdev.h
@@ -283,12 +283,12 @@ int dsw_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
int dsw_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
uint64_t dsw_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
static inline struct dsw_evdev *
dsw_pmd_priv(const struct rte_eventdev *eventdev)
diff --git a/drivers/event/dsw/dsw_xstats.c b/drivers/event/dsw/dsw_xstats.c
index 4f7d4e3ff9..2409de6adc 100644
--- a/drivers/event/dsw/dsw_xstats.c
+++ b/drivers/event/dsw/dsw_xstats.c
@@ -15,8 +15,8 @@
*/
#define DSW_XSTATS_ID_PARAM_BITS (8)
#define DSW_XSTATS_ID_STAT_BITS \
- (sizeof(unsigned int)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
-#define DSW_XSTATS_ID_STAT_MASK ((1 << DSW_XSTATS_ID_STAT_BITS) - 1)
+ (sizeof(uint64_t)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
+#define DSW_XSTATS_ID_STAT_MASK ((1UL << DSW_XSTATS_ID_STAT_BITS) - 1)
#define DSW_XSTATS_ID_GET_PARAM(id) \
((id)>>DSW_XSTATS_ID_STAT_BITS)
@@ -25,7 +25,7 @@
((id) & DSW_XSTATS_ID_STAT_MASK)
#define DSW_XSTATS_ID_CREATE(id, param_value) \
- (((param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
+ ((((uint64_t)param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
typedef
uint64_t (*dsw_xstats_dev_get_value_fn)(struct dsw_evdev *dsw);
@@ -169,7 +169,7 @@ static struct dsw_xstats_port dsw_port_xstats[] = {
typedef
void (*dsw_xstats_foreach_fn)(const char *xstats_name,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, unsigned int xstats_id,
+ uint8_t queue_port_id, uint64_t xstats_id,
void *data);
static void
@@ -193,7 +193,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t port_id,
stat_idx < RTE_DIM(dsw_port_xstats);) {
struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
char xstats_name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
- unsigned int xstats_id;
+ uint64_t xstats_id;
if (xstat->per_queue) {
xstats_id = DSW_XSTATS_ID_CREATE(stat_idx, queue_id);
@@ -219,7 +219,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t port_id,
struct store_ctx {
struct rte_event_dev_xstats_name *names;
- unsigned int *ids;
+ uint64_t *ids;
unsigned int count;
unsigned int capacity;
};
@@ -227,7 +227,7 @@ struct store_ctx {
static void
dsw_xstats_store_stat(const char *xstats_name,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, unsigned int xstats_id,
+ uint8_t queue_port_id, uint64_t xstats_id,
void *data)
{
struct store_ctx *ctx = data;
@@ -248,7 +248,7 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int capacity)
+ uint64_t *ids, unsigned int capacity)
{
struct dsw_evdev *dsw = dsw_pmd_priv(dev);
@@ -276,13 +276,13 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
static int
dsw_xstats_dev_get(const struct rte_eventdev *dev,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct dsw_evdev *dsw = dsw_pmd_priv(dev);
unsigned int i;
for (i = 0; i < n; i++) {
- unsigned int id = ids[i];
+ uint64_t id = ids[i];
struct dsw_xstat_dev *xstat = &dsw_dev_xstats[id];
values[i] = xstat->get_value_fn(dsw);
}
@@ -291,13 +291,13 @@ dsw_xstats_dev_get(const struct rte_eventdev *dev,
static int
dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct dsw_evdev *dsw = dsw_pmd_priv(dev);
unsigned int i;
for (i = 0; i < n; i++) {
- unsigned int id = ids[i];
+ uint64_t id = ids[i];
unsigned int stat_idx = DSW_XSTATS_ID_GET_STAT(id);
struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
uint8_t queue_id = 0;
@@ -313,7 +313,7 @@ dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
int
dsw_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
switch (mode) {
case RTE_EVENT_DEV_XSTATS_DEVICE:
@@ -332,14 +332,14 @@ dsw_xstats_get(const struct rte_eventdev *dev,
struct find_ctx {
const struct rte_eventdev *dev;
const char *name;
- unsigned int *id;
+ uint64_t *id;
uint64_t value;
};
static void
dsw_xstats_find_stat(const char *xstats_name,
enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, unsigned int xstats_id,
+ uint8_t queue_port_id, uint64_t xstats_id,
void *data)
{
struct find_ctx *ctx = data;
@@ -354,7 +354,7 @@ dsw_xstats_find_stat(const char *xstats_name,
uint64_t
dsw_xstats_get_by_name(const struct rte_eventdev *dev, const char *name,
- unsigned int *id)
+ uint64_t *id)
{
struct dsw_evdev *dsw = dsw_pmd_priv(dev);
uint16_t port_id;
diff --git a/drivers/event/opdl/opdl_evdev.h b/drivers/event/opdl/opdl_evdev.h
index 2dca0a8a98..1ca166b37c 100644
--- a/drivers/event/opdl/opdl_evdev.h
+++ b/drivers/event/opdl/opdl_evdev.h
@@ -289,16 +289,16 @@ int opdl_xstats_uninit(struct rte_eventdev *dev);
int opdl_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
int opdl_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
uint64_t opdl_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
int opdl_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
int opdl_add_event_handlers(struct rte_eventdev *dev);
diff --git a/drivers/event/opdl/opdl_evdev_xstats.c b/drivers/event/opdl/opdl_evdev_xstats.c
index 27b3d88023..b382f6619d 100644
--- a/drivers/event/opdl/opdl_evdev_xstats.c
+++ b/drivers/event/opdl/opdl_evdev_xstats.c
@@ -65,7 +65,7 @@ opdl_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
struct opdl_evdev *device = opdl_pmd_priv(dev);
@@ -99,7 +99,7 @@ int
opdl_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
- const unsigned int ids[],
+ const uint64_t ids[],
uint64_t values[], unsigned int n)
{
struct opdl_evdev *device = opdl_pmd_priv(dev);
@@ -133,7 +133,7 @@ opdl_xstats_get(const struct rte_eventdev *dev,
uint64_t
opdl_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id)
+ const char *name, uint64_t *id)
{
struct opdl_evdev *device = opdl_pmd_priv(dev);
@@ -161,7 +161,7 @@ opdl_xstats_get_by_name(const struct rte_eventdev *dev,
int
opdl_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
- int16_t queue_port_id, const uint32_t ids[],
+ int16_t queue_port_id, const uint64_t ids[],
uint32_t nb_ids)
{
struct opdl_evdev *device = opdl_pmd_priv(dev);
diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 3cbe2139ee..b69c4769dc 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -471,7 +471,7 @@ atomic_basic(struct test *t)
return 0;
}
static __rte_always_inline int
-check_qid_stats(uint32_t id[], int index)
+check_qid_stats(uint64_t id[], int index)
{
if (index == 0) {
@@ -509,7 +509,7 @@ check_statistics(void)
0);
if (num_stats > 0) {
- uint32_t id[num_stats];
+ uint64_t id[num_stats];
struct rte_event_dev_xstats_name names[num_stats];
uint64_t values[num_stats];
diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
index 8542b7d34d..c7b943a72b 100644
--- a/drivers/event/sw/sw_evdev.h
+++ b/drivers/event/sw/sw_evdev.h
@@ -301,16 +301,16 @@ int sw_xstats_uninit(struct sw_evdev *dev);
int sw_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
int sw_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
uint64_t sw_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
int sw_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
int test_sw_eventdev(void);
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index ed7ae6a685..62d66744f2 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -92,7 +92,7 @@ xstats_print(void)
{
const uint32_t XSTATS_MAX = 1024;
uint32_t i;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
uint64_t values[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
@@ -310,15 +310,14 @@ static inline int
test_event_dev_stats_get(int dev_id, struct test_event_dev_stats *stats)
{
static uint32_t i;
- static uint32_t total_ids[3]; /* rx, tx and drop */
- static uint32_t port_rx_pkts_ids[MAX_PORTS];
- static uint32_t port_rx_dropped_ids[MAX_PORTS];
- static uint32_t port_inflight_ids[MAX_PORTS];
- static uint32_t port_tx_pkts_ids[MAX_PORTS];
- static uint32_t qid_rx_pkts_ids[MAX_QIDS];
- static uint32_t qid_rx_dropped_ids[MAX_QIDS];
- static uint32_t qid_tx_pkts_ids[MAX_QIDS];
-
+ static uint64_t total_ids[3]; /* rx, tx and drop */
+ static uint64_t port_rx_pkts_ids[MAX_PORTS];
+ static uint64_t port_rx_dropped_ids[MAX_PORTS];
+ static uint64_t port_inflight_ids[MAX_PORTS];
+ static uint64_t port_tx_pkts_ids[MAX_PORTS];
+ static uint64_t qid_rx_pkts_ids[MAX_QIDS];
+ static uint64_t qid_rx_dropped_ids[MAX_QIDS];
+ static uint64_t qid_tx_pkts_ids[MAX_QIDS];
stats->rx_pkts = rte_event_dev_xstats_by_name_get(dev_id,
"dev_rx", &total_ids[0]);
@@ -863,7 +862,7 @@ xstats_tests(struct test *t)
const uint32_t XSTATS_MAX = 1024;
uint32_t i;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
uint64_t values[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
@@ -963,11 +962,10 @@ xstats_tests(struct test *t)
static const uint64_t expected[] = {3, 3, 0, 1, 0, 0, 4, 1};
for (i = 0; (signed int)i < ret; i++) {
if (expected[i] != values[i]) {
- printf(
- "%d Error xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], expected[i]);
+ printf("%d Error xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], expected[i]);
goto fail;
}
}
@@ -982,11 +980,10 @@ xstats_tests(struct test *t)
0, ids, values, num_stats);
for (i = 0; (signed int)i < ret; i++) {
if (expected_zero[i] != values[i]) {
- printf(
- "%d Error, xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], expected_zero[i]);
+ printf("%d Error, xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], expected_zero[i]);
goto fail;
}
}
@@ -1058,11 +1055,10 @@ xstats_tests(struct test *t)
0, ids, values, num_stats);
for (i = 0; (signed int)i < ret; i++) {
if (port_expected_zero[i] != values[i]) {
- printf(
- "%d, Error, xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], port_expected_zero[i]);
+ printf("%d, Error, xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], port_expected_zero[i]);
goto fail;
}
}
@@ -1095,11 +1091,10 @@ xstats_tests(struct test *t)
};
for (i = 0; (signed int)i < ret; i++) {
if (queue_expected[i] != values[i]) {
- printf(
- "%d, Error, xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], queue_expected[i]);
+ printf("%d, Error, xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], queue_expected[i]);
goto fail;
}
}
@@ -1129,11 +1124,10 @@ xstats_tests(struct test *t)
int fails = 0;
for (i = 0; (signed int)i < ret; i++) {
if (queue_expected_zero[i] != values[i]) {
- printf(
- "%d, Error, xstat %d (id %d) %s : %"PRIu64
- ", expect %"PRIu64"\n",
- __LINE__, i, ids[i], xstats_names[i].name,
- values[i], queue_expected_zero[i]);
+ printf("%d, Error, xstat %d (id %" PRIu64
+ ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
+ __LINE__, i, ids[i], xstats_names[i].name,
+ values[i], queue_expected_zero[i]);
fails++;
}
}
@@ -1160,7 +1154,7 @@ xstats_id_abuse_tests(struct test *t)
const uint32_t XSTATS_MAX = 1024;
const uint32_t link_port = 2;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
/* Create instance with 4 ports */
@@ -1379,7 +1373,7 @@ xstats_brute_force(struct test *t)
{
uint32_t i;
const uint32_t XSTATS_MAX = 1024;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
uint64_t values[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
@@ -1454,7 +1448,7 @@ xstats_id_reset_tests(struct test *t)
#define XSTATS_MAX 1024
int ret;
uint32_t i;
- uint32_t ids[XSTATS_MAX];
+ uint64_t ids[XSTATS_MAX];
uint64_t values[XSTATS_MAX];
struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
@@ -1510,13 +1504,14 @@ xstats_id_reset_tests(struct test *t)
};
uint64_t dev_expected[] = {NPKTS, NPKTS, 0, 1, 0, 0, 4, 1};
for (i = 0; (int)i < ret; i++) {
- unsigned int id;
+ uint64_t id;
uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
dev_names[i],
&id);
if (id != i) {
- printf("%d: %s id incorrect, expected %d got %d\n",
- __LINE__, dev_names[i], i, id);
+ printf("%d: %s id incorrect, expected %d got %" PRIu64
+ "\n",
+ __LINE__, dev_names[i], i, id);
goto fail;
}
if (val != dev_expected[i]) {
@@ -1631,20 +1626,20 @@ xstats_id_reset_tests(struct test *t)
int failed = 0;
for (i = 0; (int)i < ret; i++) {
- unsigned int id;
+ uint64_t id;
uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
port_names[i],
&id);
if (id != i + PORT_OFF) {
- printf("%d: %s id incorrect, expected %d got %d\n",
- __LINE__, port_names[i], i+PORT_OFF,
- id);
+ printf("%d: %s id incorrect, expected %d got %" PRIu64
+ "\n",
+ __LINE__, port_names[i], i + PORT_OFF, id);
failed = 1;
}
if (val != port_expected[i]) {
- printf("%d: %s value incorrect, expected %"PRIu64
- " got %d\n", __LINE__, port_names[i],
- port_expected[i], id);
+ printf("%d: %s value incorrect, expected %" PRIu64
+ " got %" PRIu64 "\n",
+ __LINE__, port_names[i], port_expected[i], id);
failed = 1;
}
/* reset to zero */
@@ -1746,14 +1741,14 @@ xstats_id_reset_tests(struct test *t)
failed = 0;
for (i = 0; (int)i < ret; i++) {
- unsigned int id;
+ uint64_t id;
uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
queue_names[i],
&id);
if (id != i + QUEUE_OFF) {
- printf("%d: %s id incorrect, expected %d got %d\n",
- __LINE__, queue_names[i], i+QUEUE_OFF,
- id);
+ printf("%d: %s id incorrect, expected %d got %" PRIu64
+ "\n",
+ __LINE__, queue_names[i], i + QUEUE_OFF, id);
failed = 1;
}
if (val != queue_expected[i]) {
diff --git a/drivers/event/sw/sw_evdev_xstats.c b/drivers/event/sw/sw_evdev_xstats.c
index c2647d7da2..fbac8f3ab5 100644
--- a/drivers/event/sw/sw_evdev_xstats.c
+++ b/drivers/event/sw/sw_evdev_xstats.c
@@ -393,7 +393,7 @@ int
sw_xstats_get_names(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
const struct sw_evdev *sw = sw_pmd_priv_const(dev);
unsigned int i;
@@ -444,7 +444,7 @@ sw_xstats_get_names(const struct rte_eventdev *dev,
static int
sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, const unsigned int ids[],
+ uint8_t queue_port_id, const uint64_t ids[],
uint64_t values[], unsigned int n, const uint32_t reset,
const uint32_t ret_if_n_lt_nstats)
{
@@ -509,7 +509,7 @@ sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
int
sw_xstats_get(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n)
+ const uint64_t ids[], uint64_t values[], unsigned int n)
{
struct sw_evdev *sw = sw_pmd_priv(dev);
const uint32_t reset = 0;
@@ -520,7 +520,7 @@ sw_xstats_get(const struct rte_eventdev *dev,
uint64_t
sw_xstats_get_by_name(const struct rte_eventdev *dev,
- const char *name, unsigned int *id)
+ const char *name, uint64_t *id)
{
const struct sw_evdev *sw = sw_pmd_priv_const(dev);
unsigned int i;
@@ -556,7 +556,7 @@ sw_xstats_reset_range(struct sw_evdev *sw, uint32_t start, uint32_t num)
static int
sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
const uint32_t reset = 1;
const uint32_t ret_n_lt_stats = 0;
@@ -577,7 +577,7 @@ sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
static int
sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
const uint32_t reset = 1;
const uint32_t ret_n_lt_stats = 0;
@@ -597,12 +597,12 @@ sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
}
static int
-sw_xstats_reset_dev(struct sw_evdev *sw, const uint32_t ids[], uint32_t nb_ids)
+sw_xstats_reset_dev(struct sw_evdev *sw, const uint64_t ids[], uint32_t nb_ids)
{
uint32_t i;
if (ids) {
for (i = 0; i < nb_ids; i++) {
- uint32_t id = ids[i];
+ uint64_t id = ids[i];
if (id >= sw->xstats_count_mode_dev)
return -EINVAL;
sw_xstats_reset_range(sw, id, 1);
@@ -619,7 +619,7 @@ int
sw_xstats_reset(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids)
{
struct sw_evdev *sw = sw_pmd_priv(dev);
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index e49ff23db5..aebab26852 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -529,7 +529,7 @@ typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
*/
typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
- const unsigned int ids[], uint64_t values[], unsigned int n);
+ const uint64_t ids[], uint64_t values[], unsigned int n);
/**
* Resets the statistic values in xstats for the device, based on mode.
@@ -537,7 +537,7 @@ typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
/**
@@ -564,7 +564,7 @@ typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size);
+ uint64_t *ids, unsigned int size);
/**
* Get value of one stats and optionally return its id
@@ -582,7 +582,7 @@ typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
* if id pointer is non-NULL
*/
typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
- const char *name, unsigned int *id);
+ const char *name, uint64_t *id);
/**
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 845f8dbb6e..b0414206d9 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -1161,7 +1161,7 @@ int
rte_event_dev_xstats_names_get(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids, unsigned int size)
+ uint64_t *ids, unsigned int size)
{
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
const int cnt_expected_entries = xstats_get_count(dev_id, mode,
@@ -1183,7 +1183,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
/* retrieve eventdev extended statistics */
int
rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode,
- uint8_t queue_port_id, const unsigned int ids[],
+ uint8_t queue_port_id, const uint64_t ids[],
uint64_t values[], unsigned int n)
{
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
@@ -1198,11 +1198,11 @@ rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode,
uint64_t
rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
- unsigned int *id)
+ uint64_t *id)
{
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0);
const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
- unsigned int temp = -1;
+ uint64_t temp = -1;
if (id != NULL)
*id = (unsigned int)-1;
@@ -1217,7 +1217,7 @@ rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
int rte_event_dev_xstats_reset(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode, int16_t queue_port_id,
- const uint32_t ids[], uint32_t nb_ids)
+ const uint64_t ids[], uint32_t nb_ids)
{
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
struct rte_eventdev *dev = &rte_eventdevs[dev_id];
@@ -1658,7 +1658,7 @@ eventdev_build_telemetry_data(int dev_id,
struct rte_tel_data *d)
{
struct rte_event_dev_xstats_name *xstat_names;
- unsigned int *ids;
+ uint64_t *ids;
uint64_t *values;
int i, ret, num_xstats;
diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
index 60e9043ac4..82e8976e57 100644
--- a/lib/eventdev/rte_eventdev.h
+++ b/lib/eventdev/rte_eventdev.h
@@ -1784,7 +1784,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
struct rte_event_dev_xstats_name *xstats_names,
- unsigned int *ids,
+ uint64_t *ids,
unsigned int size);
/**
@@ -1817,7 +1817,7 @@ int
rte_event_dev_xstats_get(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode,
uint8_t queue_port_id,
- const unsigned int ids[],
+ const uint64_t ids[],
uint64_t values[], unsigned int n);
/**
@@ -1838,7 +1838,7 @@ rte_event_dev_xstats_get(uint8_t dev_id,
*/
uint64_t
rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
- unsigned int *id);
+ uint64_t *id);
/**
* Reset the values of the xstats of the selected component in the device.
@@ -1864,7 +1864,7 @@ int
rte_event_dev_xstats_reset(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode,
int16_t queue_port_id,
- const uint32_t ids[],
+ const uint64_t ids[],
uint32_t nb_ids);
/**
--
2.25.1
^ permalink raw reply [relevance 2%]
* [PATCH] eventdev: update release notes
@ 2022-10-13 9:15 10% pbhagavatula
2022-10-19 13:00 0% ` Jerin Jacob
0 siblings, 1 reply; 200+ results
From: pbhagavatula @ 2022-10-13 9:15 UTC (permalink / raw)
To: jerinj; +Cc: dev, Pavan Nikhilesh
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
Update release notes for changes made in eventdev library.
Fixes: 5fa63911e43b ("eventdev: replace padding type in event vector")
Fixes: 0fbb55efa542 ("eventdev: add element offset to event vector")
Fixes: d986276f9b72 ("eventdev: add prefix to public symbol")
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
doc/guides/rel_notes/release_22_11.rst | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2da8bc9661..800dcf2b53 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -454,6 +454,9 @@ API Changes
* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+* eventdev: The function pointer definition ``eventdev_stop_flush_t`` is
+ renamed to ``rte_eventdev_stop_flush_t`` to avoid conflicts with application
+ symbols.
ABI Changes
-----------
@@ -496,6 +499,13 @@ ABI Changes
* eventdev: Added ``weight`` and ``affinity`` fields
to ``rte_event_queue_conf`` structure.
+* eventdev: The field ``*u64s`` in the structure ``rte_event_vector`` is replaced
+ with ``u64s`` as the field is supposed to hold array of uint64_t values.
+
+* eventdev: The structure ``rte_event_vector`` was updated to include a new bit
+ field ``elem_offset:12`` the bits are taken from the bitfield ``rsvd:15``.
+ The element offset defines the offset into the vector array at
+ which valid elements start.
Known Issues
------------
--
2.25.1
^ permalink raw reply [relevance 10%]
* RE: xstats id type
2022-10-13 7:12 3% ` Pavan Nikhilesh Bhagavatula
2022-10-13 8:26 0% ` Thomas Monjalon
@ 2022-10-13 8:59 0% ` Van Haaren, Harry
1 sibling, 0 replies; 200+ results
From: Van Haaren, Harry @ 2022-10-13 8:59 UTC (permalink / raw)
To: Pavan Nikhilesh Bhagavatula, Morten Brørup, Thomas Monjalon,
Jerin Jacob, Sachin Saxena, Hemant Agrawal, Ori Kam, Liron Himi
Cc: Jerin Jacob Kollanukkaran, dev, Li, WeiyuanX, Ferruh Yigit,
Andrew Rybchenko, david.marchand
> -----Original Message-----
> From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
> Sent: Thursday, October 13, 2022 8:13 AM
> To: Morten Brørup <mb@smartsharesystems.com>; Thomas Monjalon
> <thomas@monjalon.net>; Jerin Jacob <jerinjacobk@gmail.com>; Sachin Saxena
> <sachin.saxena@oss.nxp.com>; Hemant Agrawal <hemant.agrawal@nxp.com>; Ori
> Kam <orika@nvidia.com>; Liron Himi <lironh@marvell.com>
> Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>; dev@dpdk.org; Li, WeiyuanX <weiyuanx.li@intel.com>;
> Ferruh Yigit <ferruh.yigit@amd.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; david.marchand@redhat.com
> Subject: RE: xstats id type
>
>
>
> > -----Original Message-----
> > From: Morten Brørup <mb@smartsharesystems.com>
> > Sent: Thursday, October 13, 2022 12:22 PM
> > To: Thomas Monjalon <thomas@monjalon.net>; Jerin Jacob
> > <jerinjacobk@gmail.com>; Sachin Saxena <sachin.saxena@oss.nxp.com>;
> > Hemant Agrawal <hemant.agrawal@nxp.com>; Ori Kam
> > <orika@nvidia.com>; Liron Himi <lironh@marvell.com>
> > Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; Jerin Jacob
> > Kollanukkaran <jerinj@marvell.com>; dev@dpdk.org; Li, WeiyuanX
> > <weiyuanx.li@intel.com>; Ferruh Yigit <ferruh.yigit@amd.com>; Andrew
> > Rybchenko <andrew.rybchenko@oktetlabs.ru>;
> > david.marchand@redhat.com
> > Subject: [EXT] xstats id type
> >
> > External Email
> >
> > ----------------------------------------------------------------------
> > +TO: rawdev maintainers, regexdev maintainers
> >
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > Sent: Wednesday, 12 October 2022 22.44
> > >
> > > 12/10/2022 18:47, Jerin Jacob:
> > > > On Wed, Oct 12, 2022 at 9:58 PM Thomas Monjalon
> > <thomas@monjalon.net>
> > > wrote:
> > > > >
> > > > > 12/10/2022 18:16, Jerin Jacob:
> > > > > > On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup
> > > <mb@smartsharesystems.com> wrote:
> > > > > > >
> > > > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > > > > Sent: Wednesday, 12 October 2022 17.13
> > > > > > > >
> > > > > > > > 12/10/2022 14:14, Van Haaren, Harry:
> > > > > > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > > > > > From: Van Haaren, Harry
> > > [mailto:harry.van.haaren@intel.com]
> > > > > > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hi Jerin (eventdev maintainer),
> > > > > > > > > > > >
> > > > > > > > > > > > + harry.van.haaren@intel.com as the changes in
> > > > > > > > drivers/event/sw.
> > > > > > > > > > >
> > > > > > > > > > > Thanks Jerin.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > > > While looking into bug #1101 [1], I noticed a mix
> > > of unsigned
> > > > > > > > int
> > > > > > > > > > > and uint32_t in
> > > > > > > > > > > > the test code, which will fail on 64-bit big endian
> > > CPUs.
> > > > > > > > > > >
> > > > > > > > > > > Aha; that we can fix. I am curious why this isn't found
> > > in
> > > > > > > > CI/reported
> > > > > > > > > > > before.
> > > > > > > > > >
> > > > > > > > > > We probably don't test any 64-bit *big endian*
> > > architectures. Just
> > > > > > > > a guess.
> > > > > > > > >
> > > > > > > > > Seems so yes.
> > > > > > > > >
> > > > > > > > > > > > > Specifically, rte_event_dev_xstats_reset() is
> > > called with the
> > > > > > > > "ids"
> > > > > > > > > > > parameter
> > > > > > > > > > > > pointing to an unsigned int [2], but that parameter
> > > is a
> > > > > > > > pointer to
> > > > > > > > > > > an uint32_t.
> > > > > > > > > > > > >
> > > > > > > > > > > > > I think the type of the ids array parameter to
> > > > > > > > > > > rte_event_dev_xstats_reset() should
> > > > > > > > > > > > be changed to unsigned int array, like in the other
> > > > > > > > > > > rte_event_dev_xxx() functions.
> > > > > > > > > > >
> > > > > > > > > > > In this case, we have the option to change the type of
> > > a variable
> > > > > > > > in a
> > > > > > > > > > > test-case, or change API and cause API/ABI breakage.
> > > > > > > > > >
> > > > > > > > > > Well.. yes, but I would phrase that last option: Change
> > > the
> > > > > > > > API/ABI, so related
> > > > > > > > > > functions consistently use the same type for the same
> > > variable,
> > > > > > > > instead of randomly
> > > > > > > > > > mixing uint64_t, uint32_t and unsigned int, depending on
> > > function.
> > > > > > > > >
> > > > > > > > > Aah ok; I see your point now; there is inconsistent usage
> > > of
> > > > > > > > uint32_t/unsigned int
> > > > > > > > > between the Eventdev APIs itself. Agree this is sub-
> > > optimal, and
> > > > > > > > would have been
> > > > > > > > > nice to have spotted before the Eventdev API was
> > > stabilized.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > Unfortunately, these functions are not marked
> > > experimental, so
> > > > > > > > breaking API/ABI is
> > > > > > > > > > hard to do. :-(
> > > > > > > > >
> > > > > > > > > Agreed again.
> > > > > > > >
> > > > > > > > 22.11 is a breaking release,
> > > > > > > > and changing type in the API is not much impactful,
> > > > > > > > so that's something you can change now,
> > > > > > > > or be quiet forever :)
> > > > > > >
> > > > > > > Question:
> > > > > > > 1. Only change the "xstats id" type in the one eventdev
> > > function, which deviates from other eventdev functions, or
> > > > > > > 2. Change the "xstats id" type for all xstats functions across
> > > all device types, for consistency across device types?
> > > > > > >
> > > > > > > If 2, then what would be a good type?
> > > > > >
> > > > > > +1 for second option and the type as uint32_t
> > > > > >
> > > > > > >
> > > > > > > Ethdev uses uint64_t for xstats id, and (speaking without
> > > knowledge about its internals) that seems like overkill to me. Arrays
> > > of these are being used, so size does matter.
> > > > >
> > > > > uint64_t is not overkill if you consider having stats per queue
> > > with a predictable scheme.
> > > > > That's an improvement I would like to work on,
> > > >
> > > > You mean to use a bitmask hence uint64_t.
> > > > Currently it is mapped as arrays so 2^64 stats may not be needed.
> > > >
> > > > No strong opinion, I was just curious to understand "stats per queue
> > > > with a predictable scheme" and how uint64_t helps with that.
> > >
> > > Yes I mean some bits are used for the queue number.
> > > Something like in slide 11 of this presentation:
> > > https://urldefense.proofpoint.com/v2/url?u=http-
> > 3A__fast.dpdk.org_events_slides_DPDK-2D2019-2D09-2DEthernet-
> > 5FStatistics.pdf&d=DwIFAw&c=nKjWec2b6R0mOyPaz7xtfQ&r=1cjuAHrGh74
> > 5jHNmj2fD85sUMIJ2IPIDsIJzo6FN6Z0&m=ApdcbroZzSNlcY1t4c8iv9HZk6YSJOA
> > Hpg93zuyIEEWa6xkViBTdoCA3iir_FCtW&s=wEMA0lnyrTmxmmDINhzOagGvV
> > Z3TcIrzfK5NbJHafdM&e=
> >
> > With this presentation in mind, I strongly agree with Thomas that uint64_t is
> > the best choice of type for xstats id.
> >
> > A quick search shows that both eventdev and rawdev use "unsigned int",
> > except rte_event_dev_xstats_reset() and rte_rawdev_xstats_reset(), which
> > both use uint32_t. And regexdev uses uint16_t. Other device APIs don't have
> > xstats.
>
> Harry,
> Are you working on a patch for this change? If not I will do it.
Please go ahead - I won't find time in the short term. Thanks Pavan.
> Thomas,
> Are you ok to break the ABI without deprication notice i.e. make ID as u64 for
> eventdev?
>
> Thanks,
> Pavan.
^ permalink raw reply [relevance 0%]
* RE: [EXT] Re: xstats id type
2022-10-13 8:26 0% ` Thomas Monjalon
@ 2022-10-13 8:33 0% ` Pavan Nikhilesh Bhagavatula
0 siblings, 0 replies; 200+ results
From: Pavan Nikhilesh Bhagavatula @ 2022-10-13 8:33 UTC (permalink / raw)
To: Thomas Monjalon, Morten Brørup, Jerin Jacob, Sachin Saxena,
Hemant Agrawal, Ori Kam, Liron Himi
Cc: Van Haaren, Harry, Jerin Jacob Kollanukkaran, dev, Li, WeiyuanX,
Ferruh Yigit, Andrew Rybchenko, david.marchand, techboard
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Thursday, October 13, 2022 1:57 PM
> To: Morten Brørup <mb@smartsharesystems.com>; Jerin Jacob
> <jerinjacobk@gmail.com>; Sachin Saxena <sachin.saxena@oss.nxp.com>;
> Hemant Agrawal <hemant.agrawal@nxp.com>; Ori Kam
> <orika@nvidia.com>; Liron Himi <lironh@marvell.com>; Pavan Nikhilesh
> Bhagavatula <pbhagavatula@marvell.com>
> Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; Jerin Jacob
> Kollanukkaran <jerinj@marvell.com>; dev@dpdk.org; Li, WeiyuanX
> <weiyuanx.li@intel.com>; Ferruh Yigit <ferruh.yigit@amd.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>;
> david.marchand@redhat.com; techboard@dpdk.org
> Subject: [EXT] Re: xstats id type
>
> External Email
>
> ----------------------------------------------------------------------
> 13/10/2022 09:12, Pavan Nikhilesh Bhagavatula:
> > From: Morten Brørup <mb@smartsharesystems.com>
> > > +TO: rawdev maintainers, regexdev maintainers
> > >
> > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > Sent: Wednesday, 12 October 2022 22.44
> > > >
> > > > 12/10/2022 18:47, Jerin Jacob:
> > > > > On Wed, Oct 12, 2022 at 9:58 PM Thomas Monjalon
> > > <thomas@monjalon.net>
> > > > wrote:
> > > > > >
> > > > > > 12/10/2022 18:16, Jerin Jacob:
> > > > > > > On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup
> > > > <mb@smartsharesystems.com> wrote:
> > > > > > > >
> > > > > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > > > > > Sent: Wednesday, 12 October 2022 17.13
> > > > > > > > >
> > > > > > > > > 12/10/2022 14:14, Van Haaren, Harry:
> > > > > > > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > > > > > > From: Van Haaren, Harry
> > > > [mailto:harry.van.haaren@intel.com]
> > > > > > > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > > > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi Jerin (eventdev maintainer),
> > > > > > > > > > > > >
> > > > > > > > > > > > > + harry.van.haaren@intel.com as the changes in
> > > > > > > > > drivers/event/sw.
> > > > > > > > > > > >
> > > > > > > > > > > > Thanks Jerin.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > > > While looking into bug #1101 [1], I noticed a mix
> > > > of unsigned
> > > > > > > > > int
> > > > > > > > > > > > and uint32_t in
> > > > > > > > > > > > > the test code, which will fail on 64-bit big endian
> > > > CPUs.
> > > > > > > > > > > >
> > > > > > > > > > > > Aha; that we can fix. I am curious why this isn't found
> > > > in
> > > > > > > > > CI/reported
> > > > > > > > > > > > before.
> > > > > > > > > > >
> > > > > > > > > > > We probably don't test any 64-bit *big endian*
> > > > architectures. Just
> > > > > > > > > a guess.
> > > > > > > > > >
> > > > > > > > > > Seems so yes.
> > > > > > > > > >
> > > > > > > > > > > > > > Specifically, rte_event_dev_xstats_reset() is
> > > > called with the
> > > > > > > > > "ids"
> > > > > > > > > > > > parameter
> > > > > > > > > > > > > pointing to an unsigned int [2], but that parameter
> > > > is a
> > > > > > > > > pointer to
> > > > > > > > > > > > an uint32_t.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I think the type of the ids array parameter to
> > > > > > > > > > > > rte_event_dev_xstats_reset() should
> > > > > > > > > > > > > be changed to unsigned int array, like in the other
> > > > > > > > > > > > rte_event_dev_xxx() functions.
> > > > > > > > > > > >
> > > > > > > > > > > > In this case, we have the option to change the type of
> > > > a variable
> > > > > > > > > in a
> > > > > > > > > > > > test-case, or change API and cause API/ABI breakage.
> > > > > > > > > > >
> > > > > > > > > > > Well.. yes, but I would phrase that last option: Change
> > > > the
> > > > > > > > > API/ABI, so related
> > > > > > > > > > > functions consistently use the same type for the same
> > > > variable,
> > > > > > > > > instead of randomly
> > > > > > > > > > > mixing uint64_t, uint32_t and unsigned int, depending on
> > > > function.
> > > > > > > > > >
> > > > > > > > > > Aah ok; I see your point now; there is inconsistent usage
> > > > of
> > > > > > > > > uint32_t/unsigned int
> > > > > > > > > > between the Eventdev APIs itself. Agree this is sub-
> > > > optimal, and
> > > > > > > > > would have been
> > > > > > > > > > nice to have spotted before the Eventdev API was
> > > > stabilized.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > Unfortunately, these functions are not marked
> > > > experimental, so
> > > > > > > > > breaking API/ABI is
> > > > > > > > > > > hard to do. :-(
> > > > > > > > > >
> > > > > > > > > > Agreed again.
> > > > > > > > >
> > > > > > > > > 22.11 is a breaking release,
> > > > > > > > > and changing type in the API is not much impactful,
> > > > > > > > > so that's something you can change now,
> > > > > > > > > or be quiet forever :)
> > > > > > > >
> > > > > > > > Question:
> > > > > > > > 1. Only change the "xstats id" type in the one eventdev
> > > > function, which deviates from other eventdev functions, or
> > > > > > > > 2. Change the "xstats id" type for all xstats functions across
> > > > all device types, for consistency across device types?
> > > > > > > >
> > > > > > > > If 2, then what would be a good type?
> > > > > > >
> > > > > > > +1 for second option and the type as uint32_t
> > > > > > >
> > > > > > > >
> > > > > > > > Ethdev uses uint64_t for xstats id, and (speaking without
> > > > knowledge about its internals) that seems like overkill to me. Arrays
> > > > of these are being used, so size does matter.
> > > > > >
> > > > > > uint64_t is not overkill if you consider having stats per queue
> > > > with a predictable scheme.
> > > > > > That's an improvement I would like to work on,
> > > > >
> > > > > You mean to use a bitmask hence uint64_t.
> > > > > Currently it is mapped as arrays so 2^64 stats may not be needed.
> > > > >
> > > > > No strong opinion, I was just curious to understand "stats per queue
> > > > > with a predictable scheme" and how uint64_t helps with that.
> > > >
> > > > Yes I mean some bits are used for the queue number.
> > > > Something like in slide 11 of this presentation:
> > > > https://urldefense.proofpoint.com/v2/url?u=http-
> > > 3A__fast.dpdk.org_events_slides_DPDK-2D2019-2D09-2DEthernet-
> > >
> 5FStatistics.pdf&d=DwIFAw&c=nKjWec2b6R0mOyPaz7xtfQ&r=1cjuAHrGh74
> > >
> 5jHNmj2fD85sUMIJ2IPIDsIJzo6FN6Z0&m=ApdcbroZzSNlcY1t4c8iv9HZk6YSJOA
> > >
> Hpg93zuyIEEWa6xkViBTdoCA3iir_FCtW&s=wEMA0lnyrTmxmmDINhzOagGvV
> > > Z3TcIrzfK5NbJHafdM&e=
> > >
> > > With this presentation in mind, I strongly agree with Thomas that uint64_t
> is
> > > the best choice of type for xstats id.
> > >
> > > A quick search shows that both eventdev and rawdev use "unsigned int",
> > > except rte_event_dev_xstats_reset() and rte_rawdev_xstats_reset(),
> which
> > > both use uint32_t. And regexdev uses uint16_t. Other device APIs don't
> have
> > > xstats.
> >
> > Harry,
> > Are you working on a patch for this change? If not I will do it.
> >
> > Thomas,
> > Are you ok to break the ABI without deprication notice i.e. make ID as u64
> for eventdev?
>
> Yes, it is only increasing size of function parameters, right?
Yes
> The only problematic part is that the application must pass
> a pointer of the right size, meaning some application code change.
Most likely they'll get a -Wincompatible-pointer-types not the end of the world.
>
> It would be an exception in the process,
> so I am Cc'ing the techboard for more opinions.
>
^ permalink raw reply [relevance 0%]
* Re: xstats id type
2022-10-13 7:12 3% ` Pavan Nikhilesh Bhagavatula
@ 2022-10-13 8:26 0% ` Thomas Monjalon
2022-10-13 8:33 0% ` [EXT] " Pavan Nikhilesh Bhagavatula
2022-10-13 8:59 0% ` Van Haaren, Harry
1 sibling, 1 reply; 200+ results
From: Thomas Monjalon @ 2022-10-13 8:26 UTC (permalink / raw)
To: Morten Brørup, Jerin Jacob, Sachin Saxena, Hemant Agrawal,
Ori Kam, Liron Himi, Pavan Nikhilesh Bhagavatula
Cc: Van Haaren, Harry, Jerin Jacob Kollanukkaran, dev, Li, WeiyuanX,
Ferruh Yigit, Andrew Rybchenko, david.marchand, techboard
13/10/2022 09:12, Pavan Nikhilesh Bhagavatula:
> From: Morten Brørup <mb@smartsharesystems.com>
> > +TO: rawdev maintainers, regexdev maintainers
> >
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > Sent: Wednesday, 12 October 2022 22.44
> > >
> > > 12/10/2022 18:47, Jerin Jacob:
> > > > On Wed, Oct 12, 2022 at 9:58 PM Thomas Monjalon
> > <thomas@monjalon.net>
> > > wrote:
> > > > >
> > > > > 12/10/2022 18:16, Jerin Jacob:
> > > > > > On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup
> > > <mb@smartsharesystems.com> wrote:
> > > > > > >
> > > > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > > > > Sent: Wednesday, 12 October 2022 17.13
> > > > > > > >
> > > > > > > > 12/10/2022 14:14, Van Haaren, Harry:
> > > > > > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > > > > > From: Van Haaren, Harry
> > > [mailto:harry.van.haaren@intel.com]
> > > > > > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hi Jerin (eventdev maintainer),
> > > > > > > > > > > >
> > > > > > > > > > > > + harry.van.haaren@intel.com as the changes in
> > > > > > > > drivers/event/sw.
> > > > > > > > > > >
> > > > > > > > > > > Thanks Jerin.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > > > While looking into bug #1101 [1], I noticed a mix
> > > of unsigned
> > > > > > > > int
> > > > > > > > > > > and uint32_t in
> > > > > > > > > > > > the test code, which will fail on 64-bit big endian
> > > CPUs.
> > > > > > > > > > >
> > > > > > > > > > > Aha; that we can fix. I am curious why this isn't found
> > > in
> > > > > > > > CI/reported
> > > > > > > > > > > before.
> > > > > > > > > >
> > > > > > > > > > We probably don't test any 64-bit *big endian*
> > > architectures. Just
> > > > > > > > a guess.
> > > > > > > > >
> > > > > > > > > Seems so yes.
> > > > > > > > >
> > > > > > > > > > > > > Specifically, rte_event_dev_xstats_reset() is
> > > called with the
> > > > > > > > "ids"
> > > > > > > > > > > parameter
> > > > > > > > > > > > pointing to an unsigned int [2], but that parameter
> > > is a
> > > > > > > > pointer to
> > > > > > > > > > > an uint32_t.
> > > > > > > > > > > > >
> > > > > > > > > > > > > I think the type of the ids array parameter to
> > > > > > > > > > > rte_event_dev_xstats_reset() should
> > > > > > > > > > > > be changed to unsigned int array, like in the other
> > > > > > > > > > > rte_event_dev_xxx() functions.
> > > > > > > > > > >
> > > > > > > > > > > In this case, we have the option to change the type of
> > > a variable
> > > > > > > > in a
> > > > > > > > > > > test-case, or change API and cause API/ABI breakage.
> > > > > > > > > >
> > > > > > > > > > Well.. yes, but I would phrase that last option: Change
> > > the
> > > > > > > > API/ABI, so related
> > > > > > > > > > functions consistently use the same type for the same
> > > variable,
> > > > > > > > instead of randomly
> > > > > > > > > > mixing uint64_t, uint32_t and unsigned int, depending on
> > > function.
> > > > > > > > >
> > > > > > > > > Aah ok; I see your point now; there is inconsistent usage
> > > of
> > > > > > > > uint32_t/unsigned int
> > > > > > > > > between the Eventdev APIs itself. Agree this is sub-
> > > optimal, and
> > > > > > > > would have been
> > > > > > > > > nice to have spotted before the Eventdev API was
> > > stabilized.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > Unfortunately, these functions are not marked
> > > experimental, so
> > > > > > > > breaking API/ABI is
> > > > > > > > > > hard to do. :-(
> > > > > > > > >
> > > > > > > > > Agreed again.
> > > > > > > >
> > > > > > > > 22.11 is a breaking release,
> > > > > > > > and changing type in the API is not much impactful,
> > > > > > > > so that's something you can change now,
> > > > > > > > or be quiet forever :)
> > > > > > >
> > > > > > > Question:
> > > > > > > 1. Only change the "xstats id" type in the one eventdev
> > > function, which deviates from other eventdev functions, or
> > > > > > > 2. Change the "xstats id" type for all xstats functions across
> > > all device types, for consistency across device types?
> > > > > > >
> > > > > > > If 2, then what would be a good type?
> > > > > >
> > > > > > +1 for second option and the type as uint32_t
> > > > > >
> > > > > > >
> > > > > > > Ethdev uses uint64_t for xstats id, and (speaking without
> > > knowledge about its internals) that seems like overkill to me. Arrays
> > > of these are being used, so size does matter.
> > > > >
> > > > > uint64_t is not overkill if you consider having stats per queue
> > > with a predictable scheme.
> > > > > That's an improvement I would like to work on,
> > > >
> > > > You mean to use a bitmask hence uint64_t.
> > > > Currently it is mapped as arrays so 2^64 stats may not be needed.
> > > >
> > > > No strong opinion, I was just curious to understand "stats per queue
> > > > with a predictable scheme" and how uint64_t helps with that.
> > >
> > > Yes I mean some bits are used for the queue number.
> > > Something like in slide 11 of this presentation:
> > > https://urldefense.proofpoint.com/v2/url?u=http-
> > 3A__fast.dpdk.org_events_slides_DPDK-2D2019-2D09-2DEthernet-
> > 5FStatistics.pdf&d=DwIFAw&c=nKjWec2b6R0mOyPaz7xtfQ&r=1cjuAHrGh74
> > 5jHNmj2fD85sUMIJ2IPIDsIJzo6FN6Z0&m=ApdcbroZzSNlcY1t4c8iv9HZk6YSJOA
> > Hpg93zuyIEEWa6xkViBTdoCA3iir_FCtW&s=wEMA0lnyrTmxmmDINhzOagGvV
> > Z3TcIrzfK5NbJHafdM&e=
> >
> > With this presentation in mind, I strongly agree with Thomas that uint64_t is
> > the best choice of type for xstats id.
> >
> > A quick search shows that both eventdev and rawdev use "unsigned int",
> > except rte_event_dev_xstats_reset() and rte_rawdev_xstats_reset(), which
> > both use uint32_t. And regexdev uses uint16_t. Other device APIs don't have
> > xstats.
>
> Harry,
> Are you working on a patch for this change? If not I will do it.
>
> Thomas,
> Are you ok to break the ABI without deprication notice i.e. make ID as u64 for eventdev?
Yes, it is only increasing size of function parameters, right?
The only problematic part is that the application must pass
a pointer of the right size, meaning some application code change.
It would be an exception in the process,
so I am Cc'ing the techboard for more opinions.
^ permalink raw reply [relevance 0%]
* RE: xstats id type
2022-10-13 6:51 0% ` xstats " Morten Brørup
@ 2022-10-13 7:12 3% ` Pavan Nikhilesh Bhagavatula
2022-10-13 8:26 0% ` Thomas Monjalon
2022-10-13 8:59 0% ` Van Haaren, Harry
0 siblings, 2 replies; 200+ results
From: Pavan Nikhilesh Bhagavatula @ 2022-10-13 7:12 UTC (permalink / raw)
To: Morten Brørup, Thomas Monjalon, Jerin Jacob, Sachin Saxena,
Hemant Agrawal, Ori Kam, Liron Himi
Cc: Van Haaren, Harry, Jerin Jacob Kollanukkaran, dev, Li, WeiyuanX,
Ferruh Yigit, Andrew Rybchenko, david.marchand
> -----Original Message-----
> From: Morten Brørup <mb@smartsharesystems.com>
> Sent: Thursday, October 13, 2022 12:22 PM
> To: Thomas Monjalon <thomas@monjalon.net>; Jerin Jacob
> <jerinjacobk@gmail.com>; Sachin Saxena <sachin.saxena@oss.nxp.com>;
> Hemant Agrawal <hemant.agrawal@nxp.com>; Ori Kam
> <orika@nvidia.com>; Liron Himi <lironh@marvell.com>
> Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; Jerin Jacob
> Kollanukkaran <jerinj@marvell.com>; dev@dpdk.org; Li, WeiyuanX
> <weiyuanx.li@intel.com>; Ferruh Yigit <ferruh.yigit@amd.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>;
> david.marchand@redhat.com
> Subject: [EXT] xstats id type
>
> External Email
>
> ----------------------------------------------------------------------
> +TO: rawdev maintainers, regexdev maintainers
>
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > Sent: Wednesday, 12 October 2022 22.44
> >
> > 12/10/2022 18:47, Jerin Jacob:
> > > On Wed, Oct 12, 2022 at 9:58 PM Thomas Monjalon
> <thomas@monjalon.net>
> > wrote:
> > > >
> > > > 12/10/2022 18:16, Jerin Jacob:
> > > > > On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup
> > <mb@smartsharesystems.com> wrote:
> > > > > >
> > > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > > > Sent: Wednesday, 12 October 2022 17.13
> > > > > > >
> > > > > > > 12/10/2022 14:14, Van Haaren, Harry:
> > > > > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > > > > From: Van Haaren, Harry
> > [mailto:harry.van.haaren@intel.com]
> > > > > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > Hi Jerin (eventdev maintainer),
> > > > > > > > > > >
> > > > > > > > > > > + harry.van.haaren@intel.com as the changes in
> > > > > > > drivers/event/sw.
> > > > > > > > > >
> > > > > > > > > > Thanks Jerin.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > > While looking into bug #1101 [1], I noticed a mix
> > of unsigned
> > > > > > > int
> > > > > > > > > > and uint32_t in
> > > > > > > > > > > the test code, which will fail on 64-bit big endian
> > CPUs.
> > > > > > > > > >
> > > > > > > > > > Aha; that we can fix. I am curious why this isn't found
> > in
> > > > > > > CI/reported
> > > > > > > > > > before.
> > > > > > > > >
> > > > > > > > > We probably don't test any 64-bit *big endian*
> > architectures. Just
> > > > > > > a guess.
> > > > > > > >
> > > > > > > > Seems so yes.
> > > > > > > >
> > > > > > > > > > > > Specifically, rte_event_dev_xstats_reset() is
> > called with the
> > > > > > > "ids"
> > > > > > > > > > parameter
> > > > > > > > > > > pointing to an unsigned int [2], but that parameter
> > is a
> > > > > > > pointer to
> > > > > > > > > > an uint32_t.
> > > > > > > > > > > >
> > > > > > > > > > > > I think the type of the ids array parameter to
> > > > > > > > > > rte_event_dev_xstats_reset() should
> > > > > > > > > > > be changed to unsigned int array, like in the other
> > > > > > > > > > rte_event_dev_xxx() functions.
> > > > > > > > > >
> > > > > > > > > > In this case, we have the option to change the type of
> > a variable
> > > > > > > in a
> > > > > > > > > > test-case, or change API and cause API/ABI breakage.
> > > > > > > > >
> > > > > > > > > Well.. yes, but I would phrase that last option: Change
> > the
> > > > > > > API/ABI, so related
> > > > > > > > > functions consistently use the same type for the same
> > variable,
> > > > > > > instead of randomly
> > > > > > > > > mixing uint64_t, uint32_t and unsigned int, depending on
> > function.
> > > > > > > >
> > > > > > > > Aah ok; I see your point now; there is inconsistent usage
> > of
> > > > > > > uint32_t/unsigned int
> > > > > > > > between the Eventdev APIs itself. Agree this is sub-
> > optimal, and
> > > > > > > would have been
> > > > > > > > nice to have spotted before the Eventdev API was
> > stabilized.
> > > > > > > >
> > > > > > > >
> > > > > > > > > Unfortunately, these functions are not marked
> > experimental, so
> > > > > > > breaking API/ABI is
> > > > > > > > > hard to do. :-(
> > > > > > > >
> > > > > > > > Agreed again.
> > > > > > >
> > > > > > > 22.11 is a breaking release,
> > > > > > > and changing type in the API is not much impactful,
> > > > > > > so that's something you can change now,
> > > > > > > or be quiet forever :)
> > > > > >
> > > > > > Question:
> > > > > > 1. Only change the "xstats id" type in the one eventdev
> > function, which deviates from other eventdev functions, or
> > > > > > 2. Change the "xstats id" type for all xstats functions across
> > all device types, for consistency across device types?
> > > > > >
> > > > > > If 2, then what would be a good type?
> > > > >
> > > > > +1 for second option and the type as uint32_t
> > > > >
> > > > > >
> > > > > > Ethdev uses uint64_t for xstats id, and (speaking without
> > knowledge about its internals) that seems like overkill to me. Arrays
> > of these are being used, so size does matter.
> > > >
> > > > uint64_t is not overkill if you consider having stats per queue
> > with a predictable scheme.
> > > > That's an improvement I would like to work on,
> > >
> > > You mean to use a bitmask hence uint64_t.
> > > Currently it is mapped as arrays so 2^64 stats may not be needed.
> > >
> > > No strong opinion, I was just curious to understand "stats per queue
> > > with a predictable scheme" and how uint64_t helps with that.
> >
> > Yes I mean some bits are used for the queue number.
> > Something like in slide 11 of this presentation:
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__fast.dpdk.org_events_slides_DPDK-2D2019-2D09-2DEthernet-
> 5FStatistics.pdf&d=DwIFAw&c=nKjWec2b6R0mOyPaz7xtfQ&r=1cjuAHrGh74
> 5jHNmj2fD85sUMIJ2IPIDsIJzo6FN6Z0&m=ApdcbroZzSNlcY1t4c8iv9HZk6YSJOA
> Hpg93zuyIEEWa6xkViBTdoCA3iir_FCtW&s=wEMA0lnyrTmxmmDINhzOagGvV
> Z3TcIrzfK5NbJHafdM&e=
>
> With this presentation in mind, I strongly agree with Thomas that uint64_t is
> the best choice of type for xstats id.
>
> A quick search shows that both eventdev and rawdev use "unsigned int",
> except rte_event_dev_xstats_reset() and rte_rawdev_xstats_reset(), which
> both use uint32_t. And regexdev uses uint16_t. Other device APIs don't have
> xstats.
Harry,
Are you working on a patch for this change? If not I will do it.
Thomas,
Are you ok to break the ABI without deprication notice i.e. make ID as u64 for eventdev?
Thanks,
Pavan.
^ permalink raw reply [relevance 3%]
* xstats id type
2022-10-12 20:44 0% ` Thomas Monjalon
@ 2022-10-13 6:51 0% ` Morten Brørup
2022-10-13 7:12 3% ` Pavan Nikhilesh Bhagavatula
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-10-13 6:51 UTC (permalink / raw)
To: Thomas Monjalon, Jerin Jacob, Sachin Saxena, Hemant Agrawal,
Ori Kam, Liron Himi
Cc: Van Haaren, Harry, Jerin Jacob, dev, Li, WeiyuanX, Ferruh Yigit,
Andrew Rybchenko, david.marchand
+TO: rawdev maintainers, regexdev maintainers
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, 12 October 2022 22.44
>
> 12/10/2022 18:47, Jerin Jacob:
> > On Wed, Oct 12, 2022 at 9:58 PM Thomas Monjalon <thomas@monjalon.net>
> wrote:
> > >
> > > 12/10/2022 18:16, Jerin Jacob:
> > > > On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup
> <mb@smartsharesystems.com> wrote:
> > > > >
> > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > > Sent: Wednesday, 12 October 2022 17.13
> > > > > >
> > > > > > 12/10/2022 14:14, Van Haaren, Harry:
> > > > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > > > From: Van Haaren, Harry
> [mailto:harry.van.haaren@intel.com]
> > > > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > > > > > >
> > > > > > > > > > > Hi Jerin (eventdev maintainer),
> > > > > > > > > >
> > > > > > > > > > + harry.van.haaren@intel.com as the changes in
> > > > > > drivers/event/sw.
> > > > > > > > >
> > > > > > > > > Thanks Jerin.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > > While looking into bug #1101 [1], I noticed a mix
> of unsigned
> > > > > > int
> > > > > > > > > and uint32_t in
> > > > > > > > > > the test code, which will fail on 64-bit big endian
> CPUs.
> > > > > > > > >
> > > > > > > > > Aha; that we can fix. I am curious why this isn't found
> in
> > > > > > CI/reported
> > > > > > > > > before.
> > > > > > > >
> > > > > > > > We probably don't test any 64-bit *big endian*
> architectures. Just
> > > > > > a guess.
> > > > > > >
> > > > > > > Seems so yes.
> > > > > > >
> > > > > > > > > > > Specifically, rte_event_dev_xstats_reset() is
> called with the
> > > > > > "ids"
> > > > > > > > > parameter
> > > > > > > > > > pointing to an unsigned int [2], but that parameter
> is a
> > > > > > pointer to
> > > > > > > > > an uint32_t.
> > > > > > > > > > >
> > > > > > > > > > > I think the type of the ids array parameter to
> > > > > > > > > rte_event_dev_xstats_reset() should
> > > > > > > > > > be changed to unsigned int array, like in the other
> > > > > > > > > rte_event_dev_xxx() functions.
> > > > > > > > >
> > > > > > > > > In this case, we have the option to change the type of
> a variable
> > > > > > in a
> > > > > > > > > test-case, or change API and cause API/ABI breakage.
> > > > > > > >
> > > > > > > > Well.. yes, but I would phrase that last option: Change
> the
> > > > > > API/ABI, so related
> > > > > > > > functions consistently use the same type for the same
> variable,
> > > > > > instead of randomly
> > > > > > > > mixing uint64_t, uint32_t and unsigned int, depending on
> function.
> > > > > > >
> > > > > > > Aah ok; I see your point now; there is inconsistent usage
> of
> > > > > > uint32_t/unsigned int
> > > > > > > between the Eventdev APIs itself. Agree this is sub-
> optimal, and
> > > > > > would have been
> > > > > > > nice to have spotted before the Eventdev API was
> stabilized.
> > > > > > >
> > > > > > >
> > > > > > > > Unfortunately, these functions are not marked
> experimental, so
> > > > > > breaking API/ABI is
> > > > > > > > hard to do. :-(
> > > > > > >
> > > > > > > Agreed again.
> > > > > >
> > > > > > 22.11 is a breaking release,
> > > > > > and changing type in the API is not much impactful,
> > > > > > so that's something you can change now,
> > > > > > or be quiet forever :)
> > > > >
> > > > > Question:
> > > > > 1. Only change the "xstats id" type in the one eventdev
> function, which deviates from other eventdev functions, or
> > > > > 2. Change the "xstats id" type for all xstats functions across
> all device types, for consistency across device types?
> > > > >
> > > > > If 2, then what would be a good type?
> > > >
> > > > +1 for second option and the type as uint32_t
> > > >
> > > > >
> > > > > Ethdev uses uint64_t for xstats id, and (speaking without
> knowledge about its internals) that seems like overkill to me. Arrays
> of these are being used, so size does matter.
> > >
> > > uint64_t is not overkill if you consider having stats per queue
> with a predictable scheme.
> > > That's an improvement I would like to work on,
> >
> > You mean to use a bitmask hence uint64_t.
> > Currently it is mapped as arrays so 2^64 stats may not be needed.
> >
> > No strong opinion, I was just curious to understand "stats per queue
> > with a predictable scheme" and how uint64_t helps with that.
>
> Yes I mean some bits are used for the queue number.
> Something like in slide 11 of this presentation:
> http://fast.dpdk.org/events/slides/DPDK-2019-09-Ethernet_Statistics.pdf
With this presentation in mind, I strongly agree with Thomas that uint64_t is the best choice of type for xstats id.
A quick search shows that both eventdev and rawdev use "unsigned int", except rte_event_dev_xstats_reset() and rte_rawdev_xstats_reset(), which both use uint32_t. And regexdev uses uint16_t. Other device APIs don't have xstats.
^ permalink raw reply [relevance 0%]
* RE: release candidate 22.11-rc1
2022-10-11 1:50 4% release candidate 22.11-rc1 Thomas Monjalon
@ 2022-10-13 5:28 0% ` Jiang, YuX
2022-10-20 5:24 0% ` Jiang, YuX
2022-10-24 13:12 0% ` David Marchand
2022-10-27 21:00 0% ` Thinh Tran
2 siblings, 1 reply; 200+ results
From: Jiang, YuX @ 2022-10-13 5:28 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: Devlin, Michelle, Mcnamara, John, Chen, Zhaoyan, Peng, Yuan
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, October 11, 2022 9:50 AM
> To: announce@dpdk.org
> Subject: release candidate 22.11-rc1
>
> A new DPDK release candidate is ready for testing:
> https://git.dpdk.org/dpdk/tag/?id=v22.11-rc1
>
> There are 737 new patches in this snapshot, including many API/ABI
> compatibility breakages.
> This release won't be ABI-compatible with previous ones.
>
> Release notes:
> https://doc.dpdk.org/guides/rel_notes/release_22_11.html
>
> Highlights of 22.11-rc1:
> - LoongArch build
> - Intel uncore frequency control
> - multiple mbuf pools per Rx queue
> - Rx buffer split based on protocol
> - hardware congestion management
> - hairpin memory configuration
> - Rx/Tx descriptor dump
> - flow API extensions
> - MACsec processing offload
> - ShangMi crypto algorithms
> - baseband FFT operations
> - eventdev Tx queue start/stop
> - eventdev crypto vectorization
> - NitroSketch membership
>
> Some work is in progress to optimize the mempool cache.
> Some patches are part of -rc1, and more could be merged in -rc2.
> Please measure the performance of this release candidate, and check these
> mempool patches:
> https://patches.dpdk.org/project/dpdk/list/?series=25063
>
> Please test and report issues on bugs.dpdk.org.
>
> DPDK 22.11-rc2 is expected in two weeks.
>
> Thank you everyone
>
Update the test status for Intel part. Till now dpdk22.11-rc1 test execution rate is 60%. Two critical issues are found.
1, [22.11-rc1]iavf macfwd performance drop 40%, Intel dev is under investigating.
2, dpdk_vm_power_manger failed to start and coredumps:
Fix patch: https://patches.dpdk.org/project/dpdk/patch/20221012123637.51640-1-markus.theil@tu-ilmenau.de/. but not verify yet.
# Basic Intel(R) NIC testing
* Build or compile:
*Build: cover the build test combination with latest GCC/Clang version and the popular OS revision such as Ubuntu20.04.5, Ubuntu22.04.1, Fedora36, RHEL8.6 etc.
- All test passed.
*Compile: cover the CFLAGES(O0/O1/O2/O3) with popular OS such as Ubuntu22.04.1 and RHEL8.6.
- All test passed.
* PF/VF(i40e, ixgbe): test scenarios including PF/VF-RTE_FLOW/TSO/Jumboframe/checksum offload/VLAN/VXLAN, etc.
- Execution rate is 80%.
- New bug: https://bugs.dpdk.org/show_bug.cgi?id=1101 [dpdk-22.11.0rc1][meson test] driver-tests/eventdev_selftest_sw test failed
Bad commit is a2833ecc5ea4adcbc3b77e7aeac2a6fd945da6a0 mempool: fix get objects from mempool with cache
* PF/VF(ice): test scenarios including Switch features/Package Management/Flow Director/Advanced Tx/Advanced RSS/ACL/DCF/Flexible Descriptor, etc.
- Execution rate is 80%. Find 5 new issues, Intel dev is under investigating.
* Intel NIC single core/NIC performance: test scenarios including PF/VF single core performance test, RFC2544 Zero packet loss performance test, etc.
- Execution rate is 80%. Find one critical issue: [22.11-rc1]iavf macfwd performance drop 40%, Intel dev is under investigating.
* Power and IPsec:
* Power: test scenarios including bi-direction/Telemetry/Empty Poll Lib/Priority Base Frequency, etc.
- Under testing. One critical issue is found: dpdk_vm_power_manger failed to start and coredumps.
* IPsec: test scenarios including ipsec/ipsec-gw/ipsec library basic test - QAT&SW/FIB library, etc.
- Execution rate is 40%. Find one issue, Intel dev is under investigating.
# Basic cryptodev and virtio testing
* Virtio: both function and performance test are covered. Such as PVP/Virtio_loopback/virtio-user loopback/virtio-net VM2VM perf testing/VMAWARE ESXI 7.0u3, etc.
- Execution rate is 80%. No new issue is found.
- Known issue's fix patch: http://patches.dpdk.org/project/dpdk/patch/20221011030803.16746-3-cheng1.jiang@intel.com/.
* Cryptodev:
*Function test: test scenarios including Cryptodev API testing/CompressDev ISA-L/QAT/ZLIB PMD Testing/FIPS, etc.
- Under testing. Find one bug about FIPS tests are failing, Intel dev is under investigating.
*Performance test: test scenarios including Throughput Performance /Cryptodev Latency, etc.
- Under testing.
Best regards,
Yu Jiang
^ permalink raw reply [relevance 0%]
* Re: rte_event_dev_xstats_reset id type
2022-10-12 16:47 0% ` Jerin Jacob
@ 2022-10-12 20:44 0% ` Thomas Monjalon
2022-10-13 6:51 0% ` xstats " Morten Brørup
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2022-10-12 20:44 UTC (permalink / raw)
To: Jerin Jacob
Cc: Morten Brørup, Van Haaren, Harry, Jerin Jacob, dev, Li,
WeiyuanX, Ferruh Yigit, Andrew Rybchenko, david.marchand
12/10/2022 18:47, Jerin Jacob:
> On Wed, Oct 12, 2022 at 9:58 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 12/10/2022 18:16, Jerin Jacob:
> > > On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup <mb@smartsharesystems.com> wrote:
> > > >
> > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > Sent: Wednesday, 12 October 2022 17.13
> > > > >
> > > > > 12/10/2022 14:14, Van Haaren, Harry:
> > > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > > From: Van Haaren, Harry [mailto:harry.van.haaren@intel.com]
> > > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > > > > >
> > > > > > > > > > Hi Jerin (eventdev maintainer),
> > > > > > > > >
> > > > > > > > > + harry.van.haaren@intel.com as the changes in
> > > > > drivers/event/sw.
> > > > > > > >
> > > > > > > > Thanks Jerin.
> > > > > > > >
> > > > > > > >
> > > > > > > > > > While looking into bug #1101 [1], I noticed a mix of unsigned
> > > > > int
> > > > > > > > and uint32_t in
> > > > > > > > > the test code, which will fail on 64-bit big endian CPUs.
> > > > > > > >
> > > > > > > > Aha; that we can fix. I am curious why this isn't found in
> > > > > CI/reported
> > > > > > > > before.
> > > > > > >
> > > > > > > We probably don't test any 64-bit *big endian* architectures. Just
> > > > > a guess.
> > > > > >
> > > > > > Seems so yes.
> > > > > >
> > > > > > > > > > Specifically, rte_event_dev_xstats_reset() is called with the
> > > > > "ids"
> > > > > > > > parameter
> > > > > > > > > pointing to an unsigned int [2], but that parameter is a
> > > > > pointer to
> > > > > > > > an uint32_t.
> > > > > > > > > >
> > > > > > > > > > I think the type of the ids array parameter to
> > > > > > > > rte_event_dev_xstats_reset() should
> > > > > > > > > be changed to unsigned int array, like in the other
> > > > > > > > rte_event_dev_xxx() functions.
> > > > > > > >
> > > > > > > > In this case, we have the option to change the type of a variable
> > > > > in a
> > > > > > > > test-case, or change API and cause API/ABI breakage.
> > > > > > >
> > > > > > > Well.. yes, but I would phrase that last option: Change the
> > > > > API/ABI, so related
> > > > > > > functions consistently use the same type for the same variable,
> > > > > instead of randomly
> > > > > > > mixing uint64_t, uint32_t and unsigned int, depending on function.
> > > > > >
> > > > > > Aah ok; I see your point now; there is inconsistent usage of
> > > > > uint32_t/unsigned int
> > > > > > between the Eventdev APIs itself. Agree this is sub-optimal, and
> > > > > would have been
> > > > > > nice to have spotted before the Eventdev API was stabilized.
> > > > > >
> > > > > >
> > > > > > > Unfortunately, these functions are not marked experimental, so
> > > > > breaking API/ABI is
> > > > > > > hard to do. :-(
> > > > > >
> > > > > > Agreed again.
> > > > >
> > > > > 22.11 is a breaking release,
> > > > > and changing type in the API is not much impactful,
> > > > > so that's something you can change now,
> > > > > or be quiet forever :)
> > > >
> > > > Question:
> > > > 1. Only change the "xstats id" type in the one eventdev function, which deviates from other eventdev functions, or
> > > > 2. Change the "xstats id" type for all xstats functions across all device types, for consistency across device types?
> > > >
> > > > If 2, then what would be a good type?
> > >
> > > +1 for second option and the type as uint32_t
> > >
> > > >
> > > > Ethdev uses uint64_t for xstats id, and (speaking without knowledge about its internals) that seems like overkill to me. Arrays of these are being used, so size does matter.
> >
> > uint64_t is not overkill if you consider having stats per queue with a predictable scheme.
> > That's an improvement I would like to work on,
>
> You mean to use a bitmask hence uint64_t.
> Currently it is mapped as arrays so 2^64 stats may not be needed.
>
> No strong opinion, I was just curious to understand "stats per queue
> with a predictable scheme" and how uint64_t helps with that.
Yes I mean some bits are used for the queue number.
Something like in slide 11 of this presentation:
http://fast.dpdk.org/events/slides/DPDK-2019-09-Ethernet_Statistics.pdf
^ permalink raw reply [relevance 0%]
* Re: rte_event_dev_xstats_reset id type
2022-10-12 16:28 0% ` Thomas Monjalon
@ 2022-10-12 16:47 0% ` Jerin Jacob
2022-10-12 20:44 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Jerin Jacob @ 2022-10-12 16:47 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Morten Brørup, Van Haaren, Harry, Jerin Jacob, dev, Li,
WeiyuanX, Ferruh Yigit, Andrew Rybchenko, david.marchand
On Wed, Oct 12, 2022 at 9:58 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 12/10/2022 18:16, Jerin Jacob:
> > On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup <mb@smartsharesystems.com> wrote:
> > >
> > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > Sent: Wednesday, 12 October 2022 17.13
> > > >
> > > > 12/10/2022 14:14, Van Haaren, Harry:
> > > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > > From: Van Haaren, Harry [mailto:harry.van.haaren@intel.com]
> > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > > > >
> > > > > > > > > Hi Jerin (eventdev maintainer),
> > > > > > > >
> > > > > > > > + harry.van.haaren@intel.com as the changes in
> > > > drivers/event/sw.
> > > > > > >
> > > > > > > Thanks Jerin.
> > > > > > >
> > > > > > >
> > > > > > > > > While looking into bug #1101 [1], I noticed a mix of unsigned
> > > > int
> > > > > > > and uint32_t in
> > > > > > > > the test code, which will fail on 64-bit big endian CPUs.
> > > > > > >
> > > > > > > Aha; that we can fix. I am curious why this isn't found in
> > > > CI/reported
> > > > > > > before.
> > > > > >
> > > > > > We probably don't test any 64-bit *big endian* architectures. Just
> > > > a guess.
> > > > >
> > > > > Seems so yes.
> > > > >
> > > > > > > > > Specifically, rte_event_dev_xstats_reset() is called with the
> > > > "ids"
> > > > > > > parameter
> > > > > > > > pointing to an unsigned int [2], but that parameter is a
> > > > pointer to
> > > > > > > an uint32_t.
> > > > > > > > >
> > > > > > > > > I think the type of the ids array parameter to
> > > > > > > rte_event_dev_xstats_reset() should
> > > > > > > > be changed to unsigned int array, like in the other
> > > > > > > rte_event_dev_xxx() functions.
> > > > > > >
> > > > > > > In this case, we have the option to change the type of a variable
> > > > in a
> > > > > > > test-case, or change API and cause API/ABI breakage.
> > > > > >
> > > > > > Well.. yes, but I would phrase that last option: Change the
> > > > API/ABI, so related
> > > > > > functions consistently use the same type for the same variable,
> > > > instead of randomly
> > > > > > mixing uint64_t, uint32_t and unsigned int, depending on function.
> > > > >
> > > > > Aah ok; I see your point now; there is inconsistent usage of
> > > > uint32_t/unsigned int
> > > > > between the Eventdev APIs itself. Agree this is sub-optimal, and
> > > > would have been
> > > > > nice to have spotted before the Eventdev API was stabilized.
> > > > >
> > > > >
> > > > > > Unfortunately, these functions are not marked experimental, so
> > > > breaking API/ABI is
> > > > > > hard to do. :-(
> > > > >
> > > > > Agreed again.
> > > >
> > > > 22.11 is a breaking release,
> > > > and changing type in the API is not much impactful,
> > > > so that's something you can change now,
> > > > or be quiet forever :)
> > >
> > > Question:
> > > 1. Only change the "xstats id" type in the one eventdev function, which deviates from other eventdev functions, or
> > > 2. Change the "xstats id" type for all xstats functions across all device types, for consistency across device types?
> > >
> > > If 2, then what would be a good type?
> >
> > +1 for second option and the type as uint32_t
> >
> > >
> > > Ethdev uses uint64_t for xstats id, and (speaking without knowledge about its internals) that seems like overkill to me. Arrays of these are being used, so size does matter.
>
> uint64_t is not overkill if you consider having stats per queue with a predictable scheme.
> That's an improvement I would like to work on,
You mean to use a bitmask hence uint64_t.
Currently it is mapped as arrays so 2^64 stats may not be needed.
No strong opinion, I was just curious to understand "stats per queue
with a predictable scheme" and how uint64_t helps with that.
> so I would like to keep uint64_t please.
>
>
^ permalink raw reply [relevance 0%]
* [PATCH 2/2] ci: update to new API for step outputs in GHA
2022-10-12 16:29 6% ` [PATCH 1/2] ci: bump versions of actions in GHA David Marchand
@ 2022-10-12 16:29 14% ` David Marchand
1 sibling, 0 replies; 200+ results
From: David Marchand @ 2022-10-12 16:29 UTC (permalink / raw)
To: dev; +Cc: Aaron Conole, Michael Santana
GitHub actions deprecated use of set-output, replaced with
GITHUB_OUTPUT.
Note: we still have some warnings, as of today, because of
actions/cache@v3 which did not migrate yet.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
.github/workflows/build.yml | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 187fdef306..b32758ff6f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -86,12 +86,9 @@ jobs:
- name: Generate cache keys
id: get_ref_keys
run: |
- echo -n '::set-output name=ccache::'
- echo 'ccache-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-'$(date -u +%Y-w%W)
- echo -n '::set-output name=libabigail::'
- echo 'libabigail-${{ matrix.config.os }}'
- echo -n '::set-output name=abi::'
- echo 'abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.LIBABIGAIL_VERSION }}-${{ env.REF_GIT_TAG }}'
+ echo 'ccache=ccache-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-'$(date -u +%Y-w%W) >> $GITHUB_OUTPUT
+ echo 'libabigail=libabigail-${{ matrix.config.os }}' >> $GITHUB_OUTPUT
+ echo 'abi=abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.LIBABIGAIL_VERSION }}-${{ env.REF_GIT_TAG }}' >> $GITHUB_OUTPUT
- name: Retrieve ccache cache
uses: actions/cache@v3
with:
@@ -177,8 +174,7 @@ jobs:
- name: Generate various keys
id: get_keys
run: |
- echo -n '::set-output name=image::'
- echo 'image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d)
+ echo 'image=image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d) >> $GITHUB_OUTPUT
- name: Retrieve image cache
id: image_cache
uses: actions/cache@v3
@@ -239,12 +235,9 @@ jobs:
- name: Generate various keys
id: get_keys
run: |
- echo -n '::set-output name=ccache::'
- echo 'ccache-${{ matrix.config.image }}-${{ matrix.config.compiler }}-'$(date -u +%Y-w%W)
- echo -n '::set-output name=image::'
- echo 'image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d)
- echo -n '::set-output name=logs::'
- echo 'meson-logs-${{ join(matrix.config.*, '-') }}' | tr -d ':'
+ echo 'ccache=ccache-${{ matrix.config.image }}-${{ matrix.config.compiler }}-'$(date -u +%Y-w%W) >> $GITHUB_OUTPUT
+ echo 'image=image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d) >> $GITHUB_OUTPUT
+ echo 'logs=meson-logs-${{ join(matrix.config.*, '-') }}' | tr -d ':' >> $GITHUB_OUTPUT
- name: Retrieve image cache
id: image_cache
uses: actions/cache@v3
--
2.37.3
^ permalink raw reply [relevance 14%]
* [PATCH 1/2] ci: bump versions of actions in GHA
@ 2022-10-12 16:29 6% ` David Marchand
2022-10-12 16:29 14% ` [PATCH 2/2] ci: update to new API for step outputs " David Marchand
1 sibling, 0 replies; 200+ results
From: David Marchand @ 2022-10-12 16:29 UTC (permalink / raw)
To: dev; +Cc: Aaron Conole, Michael Santana
GitHub started deprecating GHA actions based on Node 12 [1].
For now, only warnings are raised, but we might as well switch to v3
versions of the common actions, now.
1: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
.github/workflows/build.yml | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index bf17d2b278..187fdef306 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -82,7 +82,7 @@ jobs:
steps:
- name: Checkout sources
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Generate cache keys
id: get_ref_keys
run: |
@@ -93,7 +93,7 @@ jobs:
echo -n '::set-output name=abi::'
echo 'abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.LIBABIGAIL_VERSION }}-${{ env.REF_GIT_TAG }}'
- name: Retrieve ccache cache
- uses: actions/cache@v2
+ uses: actions/cache@v3
with:
path: ~/.ccache
key: ${{ steps.get_ref_keys.outputs.ccache }}-${{ github.ref }}
@@ -101,13 +101,13 @@ jobs:
${{ steps.get_ref_keys.outputs.ccache }}-refs/heads/main
- name: Retrieve libabigail cache
id: libabigail-cache
- uses: actions/cache@v2
+ uses: actions/cache@v3
if: env.ABI_CHECKS == 'true'
with:
path: libabigail
key: ${{ steps.get_ref_keys.outputs.libabigail }}
- name: Retrieve ABI reference cache
- uses: actions/cache@v2
+ uses: actions/cache@v3
if: env.ABI_CHECKS == 'true'
with:
path: reference
@@ -154,7 +154,7 @@ jobs:
run: .ci/linux-build.sh
- name: Upload logs on failure
if: failure()
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
name: meson-logs-${{ join(matrix.config.*, '-') }}
path: |
@@ -181,7 +181,7 @@ jobs:
echo 'image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d)
- name: Retrieve image cache
id: image_cache
- uses: actions/cache@v2
+ uses: actions/cache@v3
with:
path: ~/.image
key: ${{ steps.get_keys.outputs.image }}
@@ -235,7 +235,7 @@ jobs:
steps:
- name: Checkout sources
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Generate various keys
id: get_keys
run: |
@@ -247,7 +247,7 @@ jobs:
echo 'meson-logs-${{ join(matrix.config.*, '-') }}' | tr -d ':'
- name: Retrieve image cache
id: image_cache
- uses: actions/cache@v2
+ uses: actions/cache@v3
with:
path: ~/.image
key: ${{ steps.get_keys.outputs.image }}
@@ -257,7 +257,7 @@ jobs:
echo 'Image ${{ matrix.config.image }} is not cached.'
false
- name: Retrieve ccache cache
- uses: actions/cache@v2
+ uses: actions/cache@v3
with:
path: ~/.ccache
key: ${{ steps.get_keys.outputs.ccache }}-${{ github.ref }}
@@ -294,7 +294,7 @@ jobs:
run: docker kill dpdk
- name: Upload logs on failure
if: failure()
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
name: ${{ steps.get_keys.outputs.logs }}
path: |
--
2.37.3
^ permalink raw reply [relevance 6%]
* Re: rte_event_dev_xstats_reset id type
2022-10-12 16:16 0% ` Jerin Jacob
@ 2022-10-12 16:28 0% ` Thomas Monjalon
2022-10-12 16:47 0% ` Jerin Jacob
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2022-10-12 16:28 UTC (permalink / raw)
To: Morten Brørup, Jerin Jacob
Cc: Van Haaren, Harry, Jerin Jacob, dev, Li, WeiyuanX, Ferruh Yigit,
Andrew Rybchenko, david.marchand
12/10/2022 18:16, Jerin Jacob:
> On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup <mb@smartsharesystems.com> wrote:
> >
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > Sent: Wednesday, 12 October 2022 17.13
> > >
> > > 12/10/2022 14:14, Van Haaren, Harry:
> > > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > > From: Van Haaren, Harry [mailto:harry.van.haaren@intel.com]
> > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > > >
> > > > > > > > Hi Jerin (eventdev maintainer),
> > > > > > >
> > > > > > > + harry.van.haaren@intel.com as the changes in
> > > drivers/event/sw.
> > > > > >
> > > > > > Thanks Jerin.
> > > > > >
> > > > > >
> > > > > > > > While looking into bug #1101 [1], I noticed a mix of unsigned
> > > int
> > > > > > and uint32_t in
> > > > > > > the test code, which will fail on 64-bit big endian CPUs.
> > > > > >
> > > > > > Aha; that we can fix. I am curious why this isn't found in
> > > CI/reported
> > > > > > before.
> > > > >
> > > > > We probably don't test any 64-bit *big endian* architectures. Just
> > > a guess.
> > > >
> > > > Seems so yes.
> > > >
> > > > > > > > Specifically, rte_event_dev_xstats_reset() is called with the
> > > "ids"
> > > > > > parameter
> > > > > > > pointing to an unsigned int [2], but that parameter is a
> > > pointer to
> > > > > > an uint32_t.
> > > > > > > >
> > > > > > > > I think the type of the ids array parameter to
> > > > > > rte_event_dev_xstats_reset() should
> > > > > > > be changed to unsigned int array, like in the other
> > > > > > rte_event_dev_xxx() functions.
> > > > > >
> > > > > > In this case, we have the option to change the type of a variable
> > > in a
> > > > > > test-case, or change API and cause API/ABI breakage.
> > > > >
> > > > > Well.. yes, but I would phrase that last option: Change the
> > > API/ABI, so related
> > > > > functions consistently use the same type for the same variable,
> > > instead of randomly
> > > > > mixing uint64_t, uint32_t and unsigned int, depending on function.
> > > >
> > > > Aah ok; I see your point now; there is inconsistent usage of
> > > uint32_t/unsigned int
> > > > between the Eventdev APIs itself. Agree this is sub-optimal, and
> > > would have been
> > > > nice to have spotted before the Eventdev API was stabilized.
> > > >
> > > >
> > > > > Unfortunately, these functions are not marked experimental, so
> > > breaking API/ABI is
> > > > > hard to do. :-(
> > > >
> > > > Agreed again.
> > >
> > > 22.11 is a breaking release,
> > > and changing type in the API is not much impactful,
> > > so that's something you can change now,
> > > or be quiet forever :)
> >
> > Question:
> > 1. Only change the "xstats id" type in the one eventdev function, which deviates from other eventdev functions, or
> > 2. Change the "xstats id" type for all xstats functions across all device types, for consistency across device types?
> >
> > If 2, then what would be a good type?
>
> +1 for second option and the type as uint32_t
>
> >
> > Ethdev uses uint64_t for xstats id, and (speaking without knowledge about its internals) that seems like overkill to me. Arrays of these are being used, so size does matter.
uint64_t is not overkill if you consider having stats per queue with a predictable scheme.
That's an improvement I would like to work on,
so I would like to keep uint64_t please.
^ permalink raw reply [relevance 0%]
* Re: rte_event_dev_xstats_reset id type
2022-10-12 15:35 0% ` Morten Brørup
@ 2022-10-12 16:16 0% ` Jerin Jacob
2022-10-12 16:28 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Jerin Jacob @ 2022-10-12 16:16 UTC (permalink / raw)
To: Morten Brørup
Cc: Thomas Monjalon, Van Haaren, Harry, Jerin Jacob, dev, Li,
WeiyuanX, Ferruh Yigit, Andrew Rybchenko, david.marchand
On Wed, Oct 12, 2022 at 9:05 PM Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > Sent: Wednesday, 12 October 2022 17.13
> >
> > 12/10/2022 14:14, Van Haaren, Harry:
> > > From: Morten Brørup <mb@smartsharesystems.com>
> > > > From: Van Haaren, Harry [mailto:harry.van.haaren@intel.com]
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > > >
> > > > > > > Hi Jerin (eventdev maintainer),
> > > > > >
> > > > > > + harry.van.haaren@intel.com as the changes in
> > drivers/event/sw.
> > > > >
> > > > > Thanks Jerin.
> > > > >
> > > > >
> > > > > > > While looking into bug #1101 [1], I noticed a mix of unsigned
> > int
> > > > > and uint32_t in
> > > > > > the test code, which will fail on 64-bit big endian CPUs.
> > > > >
> > > > > Aha; that we can fix. I am curious why this isn't found in
> > CI/reported
> > > > > before.
> > > >
> > > > We probably don't test any 64-bit *big endian* architectures. Just
> > a guess.
> > >
> > > Seems so yes.
> > >
> > > > > > > Specifically, rte_event_dev_xstats_reset() is called with the
> > "ids"
> > > > > parameter
> > > > > > pointing to an unsigned int [2], but that parameter is a
> > pointer to
> > > > > an uint32_t.
> > > > > > >
> > > > > > > I think the type of the ids array parameter to
> > > > > rte_event_dev_xstats_reset() should
> > > > > > be changed to unsigned int array, like in the other
> > > > > rte_event_dev_xxx() functions.
> > > > >
> > > > > In this case, we have the option to change the type of a variable
> > in a
> > > > > test-case, or change API and cause API/ABI breakage.
> > > >
> > > > Well.. yes, but I would phrase that last option: Change the
> > API/ABI, so related
> > > > functions consistently use the same type for the same variable,
> > instead of randomly
> > > > mixing uint64_t, uint32_t and unsigned int, depending on function.
> > >
> > > Aah ok; I see your point now; there is inconsistent usage of
> > uint32_t/unsigned int
> > > between the Eventdev APIs itself. Agree this is sub-optimal, and
> > would have been
> > > nice to have spotted before the Eventdev API was stabilized.
> > >
> > >
> > > > Unfortunately, these functions are not marked experimental, so
> > breaking API/ABI is
> > > > hard to do. :-(
> > >
> > > Agreed again.
> >
> > 22.11 is a breaking release,
> > and changing type in the API is not much impactful,
> > so that's something you can change now,
> > or be quiet forever :)
>
> Question:
> 1. Only change the "xstats id" type in the one eventdev function, which deviates from other eventdev functions, or
> 2. Change the "xstats id" type for all xstats functions across all device types, for consistency across device types?
>
> If 2, then what would be a good type?
+1 for second option and the type as uint32_t
>
> Ethdev uses uint64_t for xstats id, and (speaking without knowledge about its internals) that seems like overkill to me. Arrays of these are being used, so size does matter.
>
^ permalink raw reply [relevance 0%]
* RE: rte_event_dev_xstats_reset id type
2022-10-12 15:13 0% ` Thomas Monjalon
@ 2022-10-12 15:35 0% ` Morten Brørup
2022-10-12 16:16 0% ` Jerin Jacob
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-10-12 15:35 UTC (permalink / raw)
To: Thomas Monjalon, Jerin Jacob, Van Haaren, Harry
Cc: Jerin Jacob, dev, Li, WeiyuanX, Ferruh Yigit, Andrew Rybchenko,
david.marchand
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, 12 October 2022 17.13
>
> 12/10/2022 14:14, Van Haaren, Harry:
> > From: Morten Brørup <mb@smartsharesystems.com>
> > > From: Van Haaren, Harry [mailto:harry.van.haaren@intel.com]
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > > >
> > > > > > Hi Jerin (eventdev maintainer),
> > > > >
> > > > > + harry.van.haaren@intel.com as the changes in
> drivers/event/sw.
> > > >
> > > > Thanks Jerin.
> > > >
> > > >
> > > > > > While looking into bug #1101 [1], I noticed a mix of unsigned
> int
> > > > and uint32_t in
> > > > > the test code, which will fail on 64-bit big endian CPUs.
> > > >
> > > > Aha; that we can fix. I am curious why this isn't found in
> CI/reported
> > > > before.
> > >
> > > We probably don't test any 64-bit *big endian* architectures. Just
> a guess.
> >
> > Seems so yes.
> >
> > > > > > Specifically, rte_event_dev_xstats_reset() is called with the
> "ids"
> > > > parameter
> > > > > pointing to an unsigned int [2], but that parameter is a
> pointer to
> > > > an uint32_t.
> > > > > >
> > > > > > I think the type of the ids array parameter to
> > > > rte_event_dev_xstats_reset() should
> > > > > be changed to unsigned int array, like in the other
> > > > rte_event_dev_xxx() functions.
> > > >
> > > > In this case, we have the option to change the type of a variable
> in a
> > > > test-case, or change API and cause API/ABI breakage.
> > >
> > > Well.. yes, but I would phrase that last option: Change the
> API/ABI, so related
> > > functions consistently use the same type for the same variable,
> instead of randomly
> > > mixing uint64_t, uint32_t and unsigned int, depending on function.
> >
> > Aah ok; I see your point now; there is inconsistent usage of
> uint32_t/unsigned int
> > between the Eventdev APIs itself. Agree this is sub-optimal, and
> would have been
> > nice to have spotted before the Eventdev API was stabilized.
> >
> >
> > > Unfortunately, these functions are not marked experimental, so
> breaking API/ABI is
> > > hard to do. :-(
> >
> > Agreed again.
>
> 22.11 is a breaking release,
> and changing type in the API is not much impactful,
> so that's something you can change now,
> or be quiet forever :)
Question:
1. Only change the "xstats id" type in the one eventdev function, which deviates from other eventdev functions, or
2. Change the "xstats id" type for all xstats functions across all device types, for consistency across device types?
If 2, then what would be a good type?
Ethdev uses uint64_t for xstats id, and (speaking without knowledge about its internals) that seems like overkill to me. Arrays of these are being used, so size does matter.
^ permalink raw reply [relevance 0%]
* Re: [PATCH] net/bonding: fix socket_id type
@ 2022-10-12 15:15 3% ` Ferruh Yigit
0 siblings, 0 replies; 200+ results
From: Ferruh Yigit @ 2022-10-12 15:15 UTC (permalink / raw)
To: Markus Theil, dev, David Marchand
Cc: Chas Williams, Min Hu, Thorben Roemer, Bruce Richardson, Thomas Monjalon
On 10/12/2022 3:20 PM, Markus Theil wrote:
> On 10/12/22 14:23, Ferruh Yigit wrote:
>> On 10/12/2022 12:45 PM, Markus Theil wrote:
>>> From: Thorben Roemer <thorben.roemer@secunet.com>
>>>
>>> DPDK uses int or u32 in most other places for
>>> socket IDs. Fix compilation warnings by also
>>> using int in the bonding code.
>>>
>>
>> Hi Markus,
>>
>> 'rte_eth_bond_create()' is part of API, so changing it impacts the users.
>>
>> Since 'rte_socket_id()' returns 'int', it is reasonable to make
>> 'socket_id' parameter type 'int', but I am not sure if it worth the
>> trouble it may cause in user end.
>>
>> Maybe we can announce the change in this release and update the API in
>> v23.11?
>>
> Hi Ferruh,
>
> I've searched in the whole DPDK for the usage of socket IDs. Nearly
> every integral type pops up when doing this. We should postpone this
> patch. Maybe announce a cleanup + API change for the next release and
> fix this treewide (I can try to do this after 22.11 is out and you agree
> with the cleanup).
>
I agree to cleanup.
But unfortunately some of it is user interfacing and only can be done in
ABI breaking releases, next one is 23.11.
The process is:
Send a patch to update deprecation notice
('doc/guides/rel_notes/deprecation.rst') explaining what will be done
and why, with a target date.
This patch needs to get three ack to be accepted.
When it is accepted, this is the way to communicate with users about the
oncoming change.
In target release, for this case it is likely 23.11, do the batch
cleanup and remove the deprecation note.
Deprecation notice patch can trigger discussion and clarifies how to
proceed.
>>
>> Can you please list the mentioned compile warning?
> The warning only happens when we compile our code, which uses DPDK with
> Wconversion enabled. Our code stores socket ids as int. Therefore the
> compiler notices the int to u8 conversion and warns us.
Got it, so there is nothing to fix in the upstream dpdk code.
>>
>>> Signed-off-by: Thorben Roemer <thorben.roemer@secunet.com>
>>> ---
>>> drivers/net/bonding/rte_eth_bond.h | 2 +-
>>> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
>>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/bonding/rte_eth_bond.h
>>> b/drivers/net/bonding/rte_eth_bond.h
>>> index 874aa91a5f..3ce2b29052 100644
>>> --- a/drivers/net/bonding/rte_eth_bond.h
>>> +++ b/drivers/net/bonding/rte_eth_bond.h
>>> @@ -99,7 +99,7 @@ extern "C" {
>>> * Port Id of created rte_eth_dev on success, negative value
>>> otherwise
>>> */
>>> int
>>> -rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
>>> +rte_eth_bond_create(const char *name, uint8_t mode, int socket_id);
>>> /**
>>> * Free a bonded rte_eth_dev device
>>> diff --git a/drivers/net/bonding/rte_eth_bond_api.c
>>> b/drivers/net/bonding/rte_eth_bond_api.c
>>> index b44dd219cb..3c6e236382 100644
>>> --- a/drivers/net/bonding/rte_eth_bond_api.c
>>> +++ b/drivers/net/bonding/rte_eth_bond_api.c
>>> @@ -148,7 +148,7 @@ deactivate_slave(struct rte_eth_dev *eth_dev,
>>> uint16_t port_id)
>>> }
>>> int
>>> -rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
>>> +rte_eth_bond_create(const char *name, uint8_t mode, int socket_id)
>>> {
>>> struct bond_dev_private *internals;
>>> struct rte_eth_dev *bond_dev;
>>
^ permalink raw reply [relevance 3%]
* Re: rte_event_dev_xstats_reset id type
2022-10-12 12:14 0% ` Van Haaren, Harry
@ 2022-10-12 15:13 0% ` Thomas Monjalon
2022-10-12 15:35 0% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2022-10-12 15:13 UTC (permalink / raw)
To: Morten Brørup, Jerin Jacob, Van Haaren, Harry
Cc: Jerin Jacob, dev, Li, WeiyuanX, Ferruh Yigit, Andrew Rybchenko,
david.marchand
12/10/2022 14:14, Van Haaren, Harry:
> From: Morten Brørup <mb@smartsharesystems.com>
> > From: Van Haaren, Harry [mailto:harry.van.haaren@intel.com]
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup wrote:
> > > > >
> > > > > Hi Jerin (eventdev maintainer),
> > > >
> > > > + harry.van.haaren@intel.com as the changes in drivers/event/sw.
> > >
> > > Thanks Jerin.
> > >
> > >
> > > > > While looking into bug #1101 [1], I noticed a mix of unsigned int
> > > and uint32_t in
> > > > the test code, which will fail on 64-bit big endian CPUs.
> > >
> > > Aha; that we can fix. I am curious why this isn't found in CI/reported
> > > before.
> >
> > We probably don't test any 64-bit *big endian* architectures. Just a guess.
>
> Seems so yes.
>
> > > > > Specifically, rte_event_dev_xstats_reset() is called with the "ids"
> > > parameter
> > > > pointing to an unsigned int [2], but that parameter is a pointer to
> > > an uint32_t.
> > > > >
> > > > > I think the type of the ids array parameter to
> > > rte_event_dev_xstats_reset() should
> > > > be changed to unsigned int array, like in the other
> > > rte_event_dev_xxx() functions.
> > >
> > > In this case, we have the option to change the type of a variable in a
> > > test-case, or change API and cause API/ABI breakage.
> >
> > Well.. yes, but I would phrase that last option: Change the API/ABI, so related
> > functions consistently use the same type for the same variable, instead of randomly
> > mixing uint64_t, uint32_t and unsigned int, depending on function.
>
> Aah ok; I see your point now; there is inconsistent usage of uint32_t/unsigned int
> between the Eventdev APIs itself. Agree this is sub-optimal, and would have been
> nice to have spotted before the Eventdev API was stabilized.
>
>
> > Unfortunately, these functions are not marked experimental, so breaking API/ABI is
> > hard to do. :-(
>
> Agreed again.
22.11 is a breaking release,
and changing type in the API is not much impactful,
so that's something you can change now,
or be quiet forever :)
^ permalink raw reply [relevance 0%]
* RE: rte_event_dev_xstats_reset id type
2022-10-12 10:41 4% ` Morten Brørup
@ 2022-10-12 12:14 0% ` Van Haaren, Harry
2022-10-12 15:13 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Van Haaren, Harry @ 2022-10-12 12:14 UTC (permalink / raw)
To: Morten Brørup, Jerin Jacob
Cc: Jerin Jacob, dev, Li, WeiyuanX, Thomas Monjalon, Ferruh Yigit,
Andrew Rybchenko
> -----Original Message-----
> From: Morten Brørup <mb@smartsharesystems.com>
> Sent: Wednesday, October 12, 2022 11:41 AM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>; Jerin Jacob
> <jerinjacobk@gmail.com>
> Cc: Jerin Jacob <jerinj@marvell.com>; dev@dpdk.org; Li, WeiyuanX
> <weiyuanx.li@intel.com>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit
> <ferruh.yigit@amd.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Subject: RE: rte_event_dev_xstats_reset id type
>
> > From: Van Haaren, Harry [mailto:harry.van.haaren@intel.com]
> > Sent: Wednesday, 12 October 2022 12.30
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Wednesday, October 12, 2022 10:45 AM
> > >
> > > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup
> > <mb@smartsharesystems.com>
> > > wrote:
> > > >
> > > > Hi Jerin (eventdev maintainer),
> > >
> > > + harry.van.haaren@intel.com as the changes in drivers/event/sw.
> >
> > Thanks Jerin.
> >
> >
> > > > While looking into bug #1101 [1], I noticed a mix of unsigned int
> > and uint32_t in
> > > the test code, which will fail on 64-bit big endian CPUs.
> >
> > Aha; that we can fix. I am curious why this isn't found in CI/reported
> > before.
>
> We probably don't test any 64-bit *big endian* architectures. Just a guess.
Seems so yes.
> > > > Specifically, rte_event_dev_xstats_reset() is called with the "ids"
> > parameter
> > > pointing to an unsigned int [2], but that parameter is a pointer to
> > an uint32_t.
> > > >
> > > > I think the type of the ids array parameter to
> > rte_event_dev_xstats_reset() should
> > > be changed to unsigned int array, like in the other
> > rte_event_dev_xxx() functions.
> >
> > In this case, we have the option to change the type of a variable in a
> > test-case, or change API and cause API/ABI breakage.
>
> Well.. yes, but I would phrase that last option: Change the API/ABI, so related
> functions consistently use the same type for the same variable, instead of randomly
> mixing uint64_t, uint32_t and unsigned int, depending on function.
Aah ok; I see your point now; there is inconsistent usage of uint32_t/unsigned int
between the Eventdev APIs itself. Agree this is sub-optimal, and would have been
nice to have spotted before the Eventdev API was stabilized.
> Unfortunately, these functions are not marked experimental, so breaking API/ABI is
> hard to do. :-(
Agreed again.
> > Lets change the unit test code from "unsigned int" to uint32_t, and
> > that will fix the issue?
> >
> > From a quick review in the test code, there are 3x occurrences of
> > "unsigned int id" being used.
> > I will send a patch to change them later today.
>
> A simple change to uint32_t would be incorrect.
>
> rte_event_dev_xstats_by_name_get() uses unsigned int, not uint32_t.
>
> Only rte_event_dev_xstats_reset() uses uint32_t.
Agreed, the fix needs to be aware of which func to call, will handle that in the patch.
Patch on the way to fix event/sw/selftest code.
> > > > Or even better, use the same type for an "xstats id" across all
> > device types. For
> > > ethdev devices, they are uint64_t, but I don't know why. (They are
> > passed around as
> > > arrays, so they could be 32 bit. I guess that they were originally
> > not used in arrays, so
> > > unsigned int seemed the logical choice.)
> > > >
> > > >
> > > > [1]: https://bugs.dpdk.org/show_bug.cgi?id=1101
> > > > [2]:
> > https://git.dpdk.org/dpdk/tree/drivers/event/sw/sw_evdev_selftest.c#n17
> > 66
> > > >
> > > >
> > > > Med venlig hilsen / Kind regards,
> > > > -Morten Brørup
^ permalink raw reply [relevance 0%]
* RE: rte_event_dev_xstats_reset id type
2022-10-12 10:29 3% ` Van Haaren, Harry
@ 2022-10-12 10:41 4% ` Morten Brørup
2022-10-12 12:14 0% ` Van Haaren, Harry
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-10-12 10:41 UTC (permalink / raw)
To: Van Haaren, Harry, Jerin Jacob
Cc: Jerin Jacob, dev, Li, WeiyuanX, Thomas Monjalon, Ferruh Yigit,
Andrew Rybchenko
> From: Van Haaren, Harry [mailto:harry.van.haaren@intel.com]
> Sent: Wednesday, 12 October 2022 12.30
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Wednesday, October 12, 2022 10:45 AM
> >
> > On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup
> <mb@smartsharesystems.com>
> > wrote:
> > >
> > > Hi Jerin (eventdev maintainer),
> >
> > + harry.van.haaren@intel.com as the changes in drivers/event/sw.
>
> Thanks Jerin.
>
>
> > > While looking into bug #1101 [1], I noticed a mix of unsigned int
> and uint32_t in
> > the test code, which will fail on 64-bit big endian CPUs.
>
> Aha; that we can fix. I am curious why this isn't found in CI/reported
> before.
We probably don't test any 64-bit *big endian* architectures. Just a guess.
>
>
> > > Specifically, rte_event_dev_xstats_reset() is called with the "ids"
> parameter
> > pointing to an unsigned int [2], but that parameter is a pointer to
> an uint32_t.
> > >
> > > I think the type of the ids array parameter to
> rte_event_dev_xstats_reset() should
> > be changed to unsigned int array, like in the other
> rte_event_dev_xxx() functions.
>
> In this case, we have the option to change the type of a variable in a
> test-case, or change API and cause API/ABI breakage.
Well.. yes, but I would phrase that last option: Change the API/ABI, so related functions consistently use the same type for the same variable, instead of randomly mixing uint64_t, uint32_t and unsigned int, depending on function.
Unfortunately, these functions are not marked experimental, so breaking API/ABI is hard to do. :-(
> Lets change the unit test code from "unsigned int" to uint32_t, and
> that will fix the issue?
>
> From a quick review in the test code, there are 3x occurrences of
> "unsigned int id" being used.
> I will send a patch to change them later today.
A simple change to uint32_t would be incorrect.
rte_event_dev_xstats_by_name_get() uses unsigned int, not uint32_t.
Only rte_event_dev_xstats_reset() uses uint32_t.
>
>
> > > Or even better, use the same type for an "xstats id" across all
> device types. For
> > ethdev devices, they are uint64_t, but I don't know why. (They are
> passed around as
> > arrays, so they could be 32 bit. I guess that they were originally
> not used in arrays, so
> > unsigned int seemed the logical choice.)
> > >
> > >
> > > [1]: https://bugs.dpdk.org/show_bug.cgi?id=1101
> > > [2]:
> https://git.dpdk.org/dpdk/tree/drivers/event/sw/sw_evdev_selftest.c#n17
> 66
> > >
> > >
> > > Med venlig hilsen / Kind regards,
> > > -Morten Brørup
^ permalink raw reply [relevance 4%]
* RE: rte_event_dev_xstats_reset id type
@ 2022-10-12 10:29 3% ` Van Haaren, Harry
2022-10-12 10:41 4% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Van Haaren, Harry @ 2022-10-12 10:29 UTC (permalink / raw)
To: Jerin Jacob, Morten Brørup
Cc: Jerin Jacob, dev, Li, WeiyuanX, Thomas Monjalon, Ferruh Yigit,
Andrew Rybchenko
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Wednesday, October 12, 2022 10:45 AM
> To: Morten Brørup <mb@smartsharesystems.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>
> Cc: Jerin Jacob <jerinj@marvell.com>; dev@dpdk.org; Li, WeiyuanX
> <weiyuanx.li@intel.com>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit
> <ferruh.yigit@amd.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Subject: Re: rte_event_dev_xstats_reset id type
>
> On Wed, Oct 12, 2022 at 1:40 PM Morten Brørup <mb@smartsharesystems.com>
> wrote:
> >
> > Hi Jerin (eventdev maintainer),
>
> + harry.van.haaren@intel.com as the changes in drivers/event/sw.
Thanks Jerin.
> > While looking into bug #1101 [1], I noticed a mix of unsigned int and uint32_t in
> the test code, which will fail on 64-bit big endian CPUs.
Aha; that we can fix. I am curious why this isn't found in CI/reported before.
> > Specifically, rte_event_dev_xstats_reset() is called with the "ids" parameter
> pointing to an unsigned int [2], but that parameter is a pointer to an uint32_t.
> >
> > I think the type of the ids array parameter to rte_event_dev_xstats_reset() should
> be changed to unsigned int array, like in the other rte_event_dev_xxx() functions.
In this case, we have the option to change the type of a variable in a test-case, or change API and cause API/ABI breakage.
Lets change the unit test code from "unsigned int" to uint32_t, and that will fix the issue?
From a quick review in the test code, there are 3x occurrences of "unsigned int id" being used.
I will send a patch to change them later today.
> > Or even better, use the same type for an "xstats id" across all device types. For
> ethdev devices, they are uint64_t, but I don't know why. (They are passed around as
> arrays, so they could be 32 bit. I guess that they were originally not used in arrays, so
> unsigned int seemed the logical choice.)
> >
> >
> > [1]: https://bugs.dpdk.org/show_bug.cgi?id=1101
> > [2]: https://git.dpdk.org/dpdk/tree/drivers/event/sw/sw_evdev_selftest.c#n1766
> >
> >
> > Med venlig hilsen / Kind regards,
> > -Morten Brørup
^ permalink raw reply [relevance 3%]
* Re: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
2022-10-12 9:49 0% ` Jerin Jacob
@ 2022-10-12 9:56 0% ` David Marchand
0 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-10-12 9:56 UTC (permalink / raw)
To: Jerin Jacob
Cc: Andrew Rybchenko, Jerin Jacob Kollanukkaran, Ankur Dwivedi, dev,
Thomas Monjalon, Ferruh Yigit, Ray Kinsella
On Wed, Oct 12, 2022 at 11:50 AM Jerin Jacob <jerinjacobk@gmail.com> wrote:
> On Thu, Oct 6, 2022 at 1:27 PM David Marchand <david.marchand@redhat.com> wrote:
> > On Thu, Oct 6, 2022 at 9:50 AM Andrew Rybchenko
> > <andrew.rybchenko@oktetlabs.ru> wrote:
> > > >>>>> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index
> > > >>>>> 3def7bfd24..e3d603cc9a 100644
> > > >>>>> --- a/lib/ethdev/version.map
> > > >>>>> +++ b/lib/ethdev/version.map
> > > >>>>> @@ -288,6 +288,150 @@ EXPERIMENTAL {
> > > >>>>>
> > > >>>>> # added in 22.11
> > > >>>>> rte_flow_async_action_handle_query;
> > > >>>>> + __rte_eth_trace_add_first_rx_callback;
> > > >>>>
> > > >>>> Why is it in EXPERIMENTAL section, but not INTERNAL?
> > > >>> [Ankur] Because the functions for which trace is added are not internal
> > > >> functions.
> > > >>
> > > >> Sorry, but I don't understand. I agree that tracing of public inline functions
> > > >> must be part of ABI, but why everything else should be a part of ABI?
> > > > [Ankur] I see that there are some already existing trace functions added in EXPERIMENTAL in version.map like __rte_ethdev_trace_configure, __rte_ethdev_trace_rxq_setup. So not sure will it be internal or experimental.
> > > >
> > > > But you are right the trace function will not be called as a public api. Should I make the newly added trace as internal then?
> > >
> > > @David, do I understand correctly that trace points in
> > > EXPERIMENTAL is a mistake in majority of cases?
> >
> > The trace point global variables (__rte_trace_foo) are only exposed
> > for inline helpers that might call their associated trace point helper
> > (rte_trace_foo()).
> > An application is not supposed to directly manipulate them.
> > Any tp manipulation should be through the rte_trace_point_* API.
> >
> > Jerin, do you see any other uses for them?
>
> No. Expect the following ones, which can be used by application directly.
>
> __rte_eal_trace_generic_float;
> __rte_eal_trace_generic_func;
> __rte_eal_trace_generic_i16;
> __rte_eal_trace_generic_i32;
> __rte_eal_trace_generic_i64;
> __rte_eal_trace_generic_i8;
> __rte_eal_trace_generic_int;
> __rte_eal_trace_generic_long;
> __rte_eal_trace_generic_ptr;
> __rte_eal_trace_generic_str;
> __rte_eal_trace_generic_u16;
> __rte_eal_trace_generic_u32;
> __rte_eal_trace_generic_u64;
> __rte_eal_trace_generic_u8;
Indeed, that's something I discussed offlist after with Andrew but
forgot to put back on the mailing list.
As long as the trace point is called from a helper in a header exposed
to applications, we can't mark the trace point variable internal.
--
David Marchand
^ permalink raw reply [relevance 0%]
* Re: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
2022-10-06 7:57 0% ` David Marchand
@ 2022-10-12 9:49 0% ` Jerin Jacob
2022-10-12 9:56 0% ` David Marchand
0 siblings, 1 reply; 200+ results
From: Jerin Jacob @ 2022-10-12 9:49 UTC (permalink / raw)
To: David Marchand
Cc: Andrew Rybchenko, Jerin Jacob Kollanukkaran, Ankur Dwivedi, dev,
Thomas Monjalon, Ferruh Yigit, Ray Kinsella
On Thu, Oct 6, 2022 at 1:27 PM David Marchand <david.marchand@redhat.com> wrote:
>
> On Thu, Oct 6, 2022 at 9:50 AM Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru> wrote:
> > >>>>> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index
> > >>>>> 3def7bfd24..e3d603cc9a 100644
> > >>>>> --- a/lib/ethdev/version.map
> > >>>>> +++ b/lib/ethdev/version.map
> > >>>>> @@ -288,6 +288,150 @@ EXPERIMENTAL {
> > >>>>>
> > >>>>> # added in 22.11
> > >>>>> rte_flow_async_action_handle_query;
> > >>>>> + __rte_eth_trace_add_first_rx_callback;
> > >>>>
> > >>>> Why is it in EXPERIMENTAL section, but not INTERNAL?
> > >>> [Ankur] Because the functions for which trace is added are not internal
> > >> functions.
> > >>
> > >> Sorry, but I don't understand. I agree that tracing of public inline functions
> > >> must be part of ABI, but why everything else should be a part of ABI?
> > > [Ankur] I see that there are some already existing trace functions added in EXPERIMENTAL in version.map like __rte_ethdev_trace_configure, __rte_ethdev_trace_rxq_setup. So not sure will it be internal or experimental.
> > >
> > > But you are right the trace function will not be called as a public api. Should I make the newly added trace as internal then?
> >
> > @David, do I understand correctly that trace points in
> > EXPERIMENTAL is a mistake in majority of cases?
>
> The trace point global variables (__rte_trace_foo) are only exposed
> for inline helpers that might call their associated trace point helper
> (rte_trace_foo()).
> An application is not supposed to directly manipulate them.
> Any tp manipulation should be through the rte_trace_point_* API.
>
> Jerin, do you see any other uses for them?
No. Expect the following ones, which can be used by application directly.
__rte_eal_trace_generic_float;
__rte_eal_trace_generic_func;
__rte_eal_trace_generic_i16;
__rte_eal_trace_generic_i32;
__rte_eal_trace_generic_i64;
__rte_eal_trace_generic_i8;
__rte_eal_trace_generic_int;
__rte_eal_trace_generic_long;
__rte_eal_trace_generic_ptr;
__rte_eal_trace_generic_str;
__rte_eal_trace_generic_u16;
__rte_eal_trace_generic_u32;
__rte_eal_trace_generic_u64;
__rte_eal_trace_generic_u8;
>
> If not, I agree we can mark all those INTERNAL.
> I can send a cleanup post rc1.
Thanks
>
>
> --
> David Marchand
>
^ permalink raw reply [relevance 0%]
* Re: [PATCH v5 01/10] memarea: introduce memarea library
2022-10-10 23:33 0% ` fengchengwen
@ 2022-10-11 15:35 0% ` Mattias Rönnblom
0 siblings, 0 replies; 200+ results
From: Mattias Rönnblom @ 2022-10-11 15:35 UTC (permalink / raw)
To: fengchengwen, datshan, david.marchand, mb, anatoly.burakov,
dmitry.kozliuk, jerinjacobk
Cc: thomas, dev
On 2022-10-11 01:33, fengchengwen wrote:
> On 2022/10/11 0:53, Mattias Rönnblom wrote:
>> On 2022-10-08 09:53, fengchengwen wrote:
>>> Hi Mattias, Thanks for your review, most will fix in v6.
>>>
>>> On 2022/10/7 4:15, Mattias Rönnblom wrote:
>>>> On 2022-10-05 06:09, datshan wrote:
>>>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>>>
>>>>> The memarea library is an allocator of variable-size object which
>>>>> based
>>>>> on a memory region.
>>>>>
>>>>> This patch provides create/destroy API.
>>>>>
>>>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>>>> ---
>>>>> MAINTAINERS | 5 +
>>>>> doc/api/doxy-api-index.md | 3 +-
>>>>> doc/api/doxy-api.conf.in | 1 +
>>>>> doc/guides/prog_guide/index.rst | 1 +
>>>>> doc/guides/prog_guide/memarea_lib.rst | 39 ++++++
>>>>> doc/guides/rel_notes/release_22_11.rst | 6 +
>>>>> lib/eal/common/eal_common_log.c | 1 +
>>>>> lib/eal/include/rte_log.h | 1 +
>>>>> lib/memarea/memarea_private.h | 30 +++++
>>>>> lib/memarea/meson.build | 16 +++
>>>>> lib/memarea/rte_memarea.c | 157
>>>>> +++++++++++++++++++++++++
>>>>> lib/memarea/rte_memarea.h | 145
>>>>> +++++++++++++++++++++++
>>>>> lib/memarea/version.map | 12 ++
>>>>> lib/meson.build | 1 +
>>>>> 14 files changed, 417 insertions(+), 1 deletion(-)
>>>>> create mode 100644 doc/guides/prog_guide/memarea_lib.rst
>>>>> create mode 100644 lib/memarea/memarea_private.h
>>>>> create mode 100644 lib/memarea/meson.build
>>>>> create mode 100644 lib/memarea/rte_memarea.c
>>>>> create mode 100644 lib/memarea/rte_memarea.h
>>>>> create mode 100644 lib/memarea/version.map
>>>>>
>>>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>>>> index a55b379d73..b9c638221d 100644
>>>>> --- a/MAINTAINERS
>>>>> +++ b/MAINTAINERS
>>>>> @@ -1550,6 +1550,11 @@ F: app/test/test_lpm*
>>>>> F: app/test/test_func_reentrancy.c
>>>>> F: app/test/test_xmmt_ops.h
>>>>> +Memarea - EXPERIMENTAL
>>>>> +M: Chengwen Feng <fengchengwen@huawei.com>
>>>>> +F: lib/memarea
>>>>> +F: doc/guides/prog_guide/memarea_lib.rst
>>>>> +
>>>>> Membership - EXPERIMENTAL
>>>>> M: Yipeng Wang <yipeng1.wang@intel.com>
>>>>> M: Sameh Gobriel <sameh.gobriel@intel.com>
>>>>> diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
>>>>> index de488c7abf..24456604f8 100644
>>>>> --- a/doc/api/doxy-api-index.md
>>>>> +++ b/doc/api/doxy-api-index.md
>>>>> @@ -62,7 +62,8 @@ The public API headers are grouped by topics:
>>>>> [memzone](@ref rte_memzone.h),
>>>>> [mempool](@ref rte_mempool.h),
>>>>> [malloc](@ref rte_malloc.h),
>>>>> - [memcpy](@ref rte_memcpy.h)
>>>>> + [memcpy](@ref rte_memcpy.h),
>>>>> + [memarea](@ref rte_memarea.h)
>>>>> - **timers**:
>>>>> [cycles](@ref rte_cycles.h),
>>>>> diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
>>>>> index f0886c3bd1..8334ebcbd6 100644
>>>>> --- a/doc/api/doxy-api.conf.in
>>>>> +++ b/doc/api/doxy-api.conf.in
>>>>> @@ -53,6 +53,7 @@ INPUT =
>>>>> @TOPDIR@/doc/api/doxy-api-index.md \
>>>>> @TOPDIR@/lib/latencystats \
>>>>> @TOPDIR@/lib/lpm \
>>>>> @TOPDIR@/lib/mbuf \
>>>>> + @TOPDIR@/lib/memarea \
>>>>> @TOPDIR@/lib/member \
>>>>> @TOPDIR@/lib/mempool \
>>>>> @TOPDIR@/lib/meter \
>>>>> diff --git a/doc/guides/prog_guide/index.rst
>>>>> b/doc/guides/prog_guide/index.rst
>>>>> index 8564883018..e9015d65e3 100644
>>>>> --- a/doc/guides/prog_guide/index.rst
>>>>> +++ b/doc/guides/prog_guide/index.rst
>>>>> @@ -37,6 +37,7 @@ Programmer's Guide
>>>>> hash_lib
>>>>> toeplitz_hash_lib
>>>>> efd_lib
>>>>> + memarea_lib
>>>>> member_lib
>>>>> lpm_lib
>>>>> lpm6_lib
>>>>> diff --git a/doc/guides/prog_guide/memarea_lib.rst
>>>>> b/doc/guides/prog_guide/memarea_lib.rst
>>>>> new file mode 100644
>>>>> index 0000000000..b96dad15f6
>>>>> --- /dev/null
>>>>> +++ b/doc/guides/prog_guide/memarea_lib.rst
>>>>> @@ -0,0 +1,39 @@
>>>>> +.. SPDX-License-Identifier: BSD-3-Clause
>>>>> + Copyright(c) 2022 HiSilicon Limited
>>>>> +
>>>>> +Memarea Library
>>>>> +===============
>>>>> +
>>>>> +Introduction
>>>>> +------------
>>>>> +
>>>>> +The memarea library provides an allocator of variable-size
>>>>> objects, it is
>>>>> +oriented towards the application layer, which could provides
>>>>> 'region-based
>>>>> +memory management' function [1].
>>>>> +
>>>>> +The main features are as follows:
>>>>> +
>>>>> +* The default aligement size is ``RTE_CACHE_LINE_SIZE``.
>>>>> +
>>>>> +* The memory region can be initialized from the following memory
>>>>> sources:
>>>>> + a) RTE memory: e.g. invoke ``rte_malloc_socket`` to obtain. b)
>>>>> System API:
>>>>> + e.g. invoke posix_memalign to obtain. c) User provided address:
>>>>> it can be from
>>>>> + extendedd memory as long as it is available. d) User provided
>>>>> memarea: it can
>>>>> + be from another memarea.
>>>>> +
>>>>> +* It provides refcnt feature which could be useful in multi-reader
>>>>> scenario.
>>>>> +
>>>>> +* It supports MT-safe as long as it's specified at creation time.
>>>>> +
>>>>> +Library API Overview
>>>>> +--------------------
>>>>> +
>>>>> +The ``rte_memarea_create()`` function is used to create a memarea,
>>>>> the function
>>>>> +returns the pointer to the created memarea or ``NULL`` if the
>>>>> creation failed.
>>>>> +
>>>>> +The ``rte_memarea_destroy()`` function is used to destroy a memarea.
>>>>> +
>>>>> +Reference
>>>>> +---------
>>>>> +
>>>>> +[1] https://en.wikipedia.org/wiki/Region-based_memory_management
>>>>> diff --git a/doc/guides/rel_notes/release_22_11.rst
>>>>> b/doc/guides/rel_notes/release_22_11.rst
>>>>> index 5d8ef669b8..4c1f760b98 100644
>>>>> --- a/doc/guides/rel_notes/release_22_11.rst
>>>>> +++ b/doc/guides/rel_notes/release_22_11.rst
>>>>> @@ -55,6 +55,12 @@ New Features
>>>>> Also, make sure to start the actual text at the margin.
>>>>> =======================================================
>>>>> +* **Added memarea library.**
>>>>> +
>>>>> + The memarea library is an allocator of variable-size objects, it
>>>>> is oriented
>>>>> + towards the application layer, which could provides
>>>>> 'region-based memory
>>>>> + management' function.
>>>>> +
>>>>> * **Added configuration for asynchronous flow connection
>>>>> tracking.**
>>>>> Added connection tracking action number hint to
>>>>> ``rte_flow_configure``
>>>>> diff --git a/lib/eal/common/eal_common_log.c
>>>>> b/lib/eal/common/eal_common_log.c
>>>>> index bd7b188ceb..3d62af59c6 100644
>>>>> --- a/lib/eal/common/eal_common_log.c
>>>>> +++ b/lib/eal/common/eal_common_log.c
>>>>> @@ -369,6 +369,7 @@ static const struct logtype logtype_strings[] = {
>>>>> {RTE_LOGTYPE_EFD, "lib.efd"},
>>>>> {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"},
>>>>> {RTE_LOGTYPE_GSO, "lib.gso"},
>>>>> + {RTE_LOGTYPE_MEMAREA, "lib.memarea"},
>>>>> {RTE_LOGTYPE_USER1, "user1"},
>>>>> {RTE_LOGTYPE_USER2, "user2"},
>>>>> {RTE_LOGTYPE_USER3, "user3"},
>>>>> diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
>>>>> index 25ce42cdfc..708f3a39dd 100644
>>>>> --- a/lib/eal/include/rte_log.h
>>>>> +++ b/lib/eal/include/rte_log.h
>>>>> @@ -48,6 +48,7 @@ extern "C" {
>>>>> #define RTE_LOGTYPE_EFD 18 /**< Log related to EFD. */
>>>>> #define RTE_LOGTYPE_EVENTDEV 19 /**< Log related to eventdev. */
>>>>> #define RTE_LOGTYPE_GSO 20 /**< Log related to GSO. */
>>>>> +#define RTE_LOGTYPE_MEMAREA 21 /**< Log related to memarea. */
>>>>> /* these log types can be used in an application */
>>>>> #define RTE_LOGTYPE_USER1 24 /**< User-defined log type 1. */
>>>>> diff --git a/lib/memarea/memarea_private.h
>>>>> b/lib/memarea/memarea_private.h
>>>>> new file mode 100644
>>>>> index 0000000000..c76392d3e6
>>>>> --- /dev/null
>>>>> +++ b/lib/memarea/memarea_private.h
>>>>> @@ -0,0 +1,30 @@
>>>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>>>> + * Copyright(c) 2022 HiSilicon Limited
>>>>> + */
>>>>> +
>>>>> +#ifndef MEMAREA_PRIVATE_H
>>>>> +#define MEMAREA_PRIVATE_H
>>>>> +
>>>>> +#include <rte_memarea.h>
>>>>> +
>>>>> +#define MEMAREA_FREE_ELEM_COOKIE 0xFFFFFFFF
>>>>> +
>>>>> +struct memarea_elem {
>>>>> + size_t size;
>>>>> + uint32_t cookie;
>>>>> + int32_t refcnt; /* Non-zero indicates that it has been
>>>>> allocated */
>>>>> + TAILQ_ENTRY(memarea_elem) elem_node;
>>>>> + TAILQ_ENTRY(memarea_elem) free_node;
>>>>> +} __rte_cache_aligned;
>>>>> +
>>>>
>>>> Why is the elem type cache line aligned? Need the elem data start be
>>>> cache line aligned?
>>>
>>> Yes, the elem data align at cache-line default.
>>>
>>>>
>>>>> +TAILQ_HEAD(memarea_elem_list, memarea_elem);
>>>>> +
>>>>> +struct rte_memarea {
>>>>> + struct rte_memarea_param init;
>>>>> + rte_spinlock_t lock;
>>>>> + void *area_addr;
>>>>> + struct memarea_elem_list elem_list;
>>>>> + struct memarea_elem_list free_list;
>>>>> +} __rte_cache_aligned;
>>>>> +
>>>>> +#endif /* MEMAREA_PRIVATE_H */
>>>>> diff --git a/lib/memarea/meson.build b/lib/memarea/meson.build
>>>>> new file mode 100644
>>>>> index 0000000000..0a74fb4cd1
>>>>> --- /dev/null
>>>>> +++ b/lib/memarea/meson.build
>>>>> @@ -0,0 +1,16 @@
>>>>> +# SPDX-License-Identifier: BSD-3-Clause
>>>>> +# Copyright(c) 2022 HiSilicon Limited
>>>>> +
>>>>> +if is_windows
>>>>> + build = false
>>>>> + reason = 'not supported on Windows'
>>>>> + subdir_done()
>>>>> +endif
>>>>> +
>>>>> +sources = files(
>>>>> + 'rte_memarea.c',
>>>>> +)
>>>>> +headers = files(
>>>>> + 'rte_memarea.h',
>>>>> +)
>>>>> +deps += []
>>>>> diff --git a/lib/memarea/rte_memarea.c b/lib/memarea/rte_memarea.c
>>>>> new file mode 100644
>>>>> index 0000000000..868da7661d
>>>>> --- /dev/null
>>>>> +++ b/lib/memarea/rte_memarea.c
>>>>> @@ -0,0 +1,157 @@
>>>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>>>> + * Copyright(c) 2022 HiSilicon Limited
>>>>> + */
>>>>> +
>>>>> +#include <stdio.h>
>>>>> +#include <stdlib.h>
>>>>> +
>>>>> +#include <rte_common.h>
>>>>> +#include <rte_log.h>
>>>>> +#include <rte_malloc.h>
>>>>> +#include <rte_spinlock.h>
>>>>> +
>>>>> +#include "rte_memarea.h"
>>>>> +#include "memarea_private.h"
>>>>> +
>>>>> +static int
>>>>> +memarea_check_param(const struct rte_memarea_param *init)
>>>>> +{
>>>>> + size_t len;
>>>>> +
>>>>> + if (init == NULL) {
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea init param is NULL!\n");
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + len = strnlen(init->name, RTE_MEMAREA_NAMESIZE);
>>>>> + if (len == 0 || len >= RTE_MEMAREA_NAMESIZE) {
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea name size %zu invalid!\n",
>>>>> len);
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + if (init->source != RTE_MEMAREA_SOURCE_RTE_MEMORY &&
>>>>> + init->source != RTE_MEMAREA_SOURCE_SYSTEM_API &&
>>>>> + init->source != RTE_MEMAREA_SOURCE_USER_ADDR &&
>>>>> + init->source != RTE_MEMAREA_SOURCE_USER_MEMAREA) {
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s source: %d not
>>>>> supported!\n",
>>>>> + init->name, init->source);
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + if (init->total_sz <= sizeof(struct memarea_elem)) {
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s total-size: %zu too
>>>>> small!\n",
>>>>> + init->name, init->total_sz);
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR &&
>>>>> init->user_addr == NULL) {
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided addr is
>>>>> NULL!\n", init->name);
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR &&
>>>>> + ((uintptr_t)init->user_addr & (RTE_CACHE_LINE_SIZE - 1))) {
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided addr
>>>>> should align: %d!\n",
>>>>> + init->name, RTE_CACHE_LINE_SIZE);
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_MEMAREA &&
>>>>> init->user_memarea == NULL) {
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided memarea
>>>>> is NULL!\n", init->name);
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + if (init->alg != RTE_MEMAREA_ALG_DEFAULT) {
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s alg: %d not supported!\n",
>>>>> + init->name, init->alg);
>>>>> + return -EINVAL;
>>>>> + }
>>>>> +
>>>>> + return 0;
>>>>> +}
>>>>> +
>>>>> +static void *
>>>>> +memarea_alloc_from_system_api(size_t size)
>>>>> +{
>>>>> + void *ptr = NULL;
>>>>> + int ret;
>>>>> +
>>>>> + ret = posix_memalign(&ptr, RTE_CACHE_LINE_SIZE, size);
>>>>> + if (ret)
>>>>> + return NULL;
>>>>> + return ptr;
>>>>> +}
>>>>> +
>>>>> +static void *
>>>>> +memarea_alloc_area(const struct rte_memarea_param *init)
>>>>> +{
>>>>> + void *ptr = NULL;
>>>>> +
>>>>> + if (init->source == RTE_MEMAREA_SOURCE_RTE_MEMORY)
>>>>
>>>> Delete MEMORY. Of course it's memory. What else? If you want to make
>>>> it clear it's from the RTE heap, it should spell out HEAP. Or MALLOC.
>>>
>>> HEAP seem better.
>>>
>>>>
>>>>> + ptr = rte_malloc_socket(NULL, init->total_sz,
>>>>> RTE_CACHE_LINE_SIZE,
>>>>> + init->numa_socket);
>>>>> + else if (init->source == RTE_MEMAREA_SOURCE_SYSTEM_API)
>>>>> + ptr = memarea_alloc_from_system_api(init->total_sz);
>>>>
>>>> "SYSTEM_API" doesn't strike me as a good name.
>>>>
>>>> RTE_MEMAREA_SOURCE_LIBC
>>>
>>> LIBC seem better.
>>>
>>>> RTE_MEMAREA_SOURCE_STD_HEAP
>>>> or at least remove API so it'll be
>>>> RTE_MEMAREA_SOURCE_SYSTEM
>>>>
>>>>> + else if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR)
>>>>
>>>> I would delete "ADDR".
>>>
>>> +1
>>>
>>>>
>>>>> + ptr = init->user_addr;
>>>>> +
>>>>> + if (ptr == NULL)
>>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s alloc memory area
>>>>> fail!\n", init->name);
>>>>> +
>>>>> + return ptr;
>>>>> +}
>>>>> +
>>>>> +struct rte_memarea *
>>>>> +rte_memarea_create(const struct rte_memarea_param *init)
>>>>> +{
>>>>> + struct memarea_elem *elem;
>>>>> + struct rte_memarea *ma;
>>>>> + void *addr;
>>>>> + int ret;
>>>>> +
>>>>> + ret = memarea_check_param(init);
>>>>> + if (ret)
>>>>> + return NULL;
>>>>> +
>>>>> + addr = memarea_alloc_area(init);
>>>>> + if (addr == NULL)
>>>>> + return NULL;
>>>>> +
>>>>> + ma = rte_zmalloc(NULL, sizeof(struct rte_memarea),
>>>>> RTE_CACHE_LINE_SIZE);
>>>>> + if (ma == NULL) {
>>>>> + RTE_LOG(ERR, MEMAREA, "malloc memarea: %s management obj
>>>>> fail!\n", init->name);
>>>>> + return NULL;
>>>>> + }
>>>>> +
>>>>> + ma->init = *init;
>>>>> + rte_spinlock_init(&ma->lock);
>>>>> + TAILQ_INIT(&ma->elem_list);
>>>>> + TAILQ_INIT(&ma->free_list);
>>>>> + ma->area_addr = addr;
>>>>> + elem = addr;
>>>>> + elem->size = init->total_sz - sizeof(struct memarea_elem);
>>>>> + elem->cookie = MEMAREA_FREE_ELEM_COOKIE;
>>>>> + elem->refcnt = 0;
>>>>> + TAILQ_INSERT_TAIL(&ma->elem_list, elem, elem_node);
>>>>> + TAILQ_INSERT_TAIL(&ma->free_list, elem, free_node);
>>>>> +
>>>>> + return ma;
>>>>> +}
>>>>> +
>>>>> +static void
>>>>> +memarea_free_area(struct rte_memarea *ma)
>>>>> +{
>>>>> + if (ma->init.source == RTE_MEMAREA_SOURCE_RTE_MEMORY)
>>>>> + rte_free(ma->area_addr);
>>>>> + else if (ma->init.source == RTE_MEMAREA_SOURCE_SYSTEM_API)
>>>>> + free(ma->area_addr);
>>>>> +}
>>>>> +
>>>>> +void
>>>>> +rte_memarea_destroy(struct rte_memarea *ma)
>>>>> +{
>>>>> + if (ma == NULL)
>>>>> + return;
>>>>> + memarea_free_area(ma);
>>>>> + rte_free(ma);
>>>>> +}
>>>>> diff --git a/lib/memarea/rte_memarea.h b/lib/memarea/rte_memarea.h
>>>>> new file mode 100644
>>>>> index 0000000000..543cda4cac
>>>>> --- /dev/null
>>>>> +++ b/lib/memarea/rte_memarea.h
>>>>> @@ -0,0 +1,145 @@
>>>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>>>> + * Copyright(c) 2022 HiSilicon Limited
>>>>> + */
>>>>> +
>>>>> +#ifndef RTE_MEMAREA_H
>>>>> +#define RTE_MEMAREA_H
>>>>> +
>>>>> +/**
>>>>> + * @file
>>>>> + * RTE Memarea.
>>>>> + *
>>>>> + * The memarea is an allocator of variable-size object which based
>>>>> on a memory
>>>>> + * region. It has the following features:
>>>>> + *
>>>>> + * - The default alignment size is RTE_CACHE_LINE_SIZE.
>>>>
>>>> This can be read as two things: the object size is aligned, or the
>>>> start address is aligned.
>>>
>>> It means the start address align, will define more clear in v6.
>>>
>>>>
>>>>> + * - The memory region can be initialized from the following
>>>>> memory sources:
>>>>> + * 1. RTE memory: e.g. invoke rte_malloc_socket to obtain.
>>>>
>>>> Remove "to obtain", or add "memory" after "obtain". Do you really
>>>> mean "e.g.", and not "i.e."?
>>>
>>> will fix in v6.
>>>
>>>>
>>>>> + * 2. System API: e.g. invoke posix_memalign to obtain.
>>>>> + * 3. User provided address: it can be from extended memory as
>>>>> long as it is
>>>>> + * available. The address must be aligned to
>>>>> RTE_CACHE_LINE_SIZE.
>>>>
>>>> What is extended memory?
>>>
>>> Like rte_extmen
>>>
>>>>
>>>>> + * 4) User provided memarea: it can be from another memarea. So
>>>>> we can build
>>>>> + * the following memory management structure:
>>>>> + * \code{.unparsed}
>>>>> + * -------------
>>>>> + * | memarea-1 |
>>>>> + * -------------
>>>>> + * |
>>>>> + * v
>>>>> + * -------------------------------
>>>>> + * | | |
>>>>> + * v v v
>>>>> + * ------------- ------------- ----------
>>>>> + * | memarea-2 | | memarea-3 | | object |
>>>>> + * ------------- ------------- ----------
>>>>> + * \endcode
>>>>> + * As shown above, the memarea-2/3 both create from
>>>>> memarea-1's memory.
>>>>> + * - It provides refcnt feature which could be useful in
>>>>> multi-reader scenario.
>>>>> + * - It supports MT-safe as long as it's specified at creation
>>>>> time. If not
>>>>> + * specified, all the functions of the memarea API are
>>>>> lock-free, and assume
>>>>> + * to not be invoked in parallel on different logical cores to
>>>>> work on the
>>>>> + * same memarea.
>>>>> + */
>>>>> +
>>>>> +#include <stdbool.h>
>>>>> +#include <stdint.h>
>>>>> +#include <stdio.h>
>>>>> +
>>>>> +#include <rte_compat.h>
>>>>> +
>>>>> +#ifdef __cplusplus
>>>>> +extern "C" {
>>>>> +#endif
>>>>> +
>>>>> +#define RTE_MEMAREA_NAMESIZE 64
>>>>> +
>>>>> +/**
>>>>> + * Memarea memory source.
>>>>> + */
>>>>> +enum rte_memarea_source {
>>>>> + /** Memory source comes from rte memory. */
>>>>> + RTE_MEMAREA_SOURCE_RTE_MEMORY,
>>>>> + /** Memory source comes from system API. */
>>>>> + RTE_MEMAREA_SOURCE_SYSTEM_API,
>>>>> + /** Memory source comes from user-provided address. */
>>>>> + RTE_MEMAREA_SOURCE_USER_ADDR,
>>>>> + /** Memory source comes from user-provided memarea. */
>>>>> + RTE_MEMAREA_SOURCE_USER_MEMAREA,
>>>>> +};
>>>>> +
>>>>> +/**
>>>>> + * Memarea memory management algorithm.
>>>>> + */
>>>>> +enum rte_memarea_alg {
>>>>> + /* The default management algorithm is a variant of the next fit
>>>>> + * algorithm. It uses a free-list to apply for memory and uses an
>>>>> + * element-list in ascending order of address to support merging
>>>>> + * upon free.
>>>>> + */
>>>>> + RTE_MEMAREA_ALG_DEFAULT,
>>>>> +};
>>
>> Do you need to expose the algorithm/management scheme option in the
>> public API, if there is only one implementation to choose from?
>
>
> Yes, we plan to support SLAB algorithm in future by adding a new alg.
>
>
>>
>> You can always have a rte_memarea_create_alg(/../) in the future, or
>> just change the signature between ABI-breaking releases.
>
>
> I don't think add a new API is a good idea.
>
> You can see that, we put all init parameter in one struct in this
> design, and could extend function by adding new field .
>
>
>>
>>
>> Also, shouldn't the default algorithm have name? Rather than just
>> DEFAULT. RTE_MEMAREA_ALG_NEXTFIT maybe.
>
>
> Yes, will fix in next version.
>
>
>>
>>>>> +
>>>>> +struct rte_memarea;
>>>>> +
>>>>> +struct rte_memarea_param {
>>>>
>>>> Does this struct need to be public?
>>>
>>> Yes, the rte_memarea_param contains create parameters for create
>>> memarea which need be public.
>>>
>>
>> Why isn't the public API just a bunch of create-function parameters?
>> Or, alternatively, you have an assortment of create functions, for
>> different combinations of parameters. Then you don't have to think
>> about having reserved bits or other kind of ABI-related issues due to
>> the struct being public.
>
>
> These are two API design styles,and I prefer the one create-function
> API style just it seem simple (by inner usage voice).
>
>
My reaction when I saw the test code, was that it was needlessly
complicated to create a memarea. Intuitions vary, I suppose.
Anyway, the style you prefer is represented elsewhere in DPDK already,
so I'm good with this.
>>
>>> And rte_memarea which pointer implementation struction which just a
>>> declare here.
>>>
>>>>
>>>>> + char name[RTE_MEMAREA_NAMESIZE]; /**< Name of memarea. */
>>>>> + enum rte_memarea_source source; /**< Memory source of
>>>>> memarea. */
>>>>> + enum rte_memarea_alg alg; /**< Memory management
>>>>> algorithm. */
>>>>> + size_t total_sz; /**< total size (bytes) of
>>>>> memarea. */
>>>>> + /** Indicates whether the memarea API should be MT-safe. */
>>>>> + uint32_t mt_safe : 1;
>>>>
>>>> Why not bool?
>>>
>>> Use bit field other than bool will provides more reserved field.
>>>
>>>>
>>>>> + union {
>>>>> + /** Numa socket from which to apply for memarea's memory,
>>>>> this
>>>>> + * field is valid only when the source is set to be
>>>>> + * RTE_MEMAREA_SOURCE_RTE_MEMORY.
>>>>> + */
>>>>> + int numa_socket;
>>>>> + /** User provided address, this field is valid only when the
>>>>> + * source is set to be RTE_MEMAREA_SOURCE_USER_ADDR.
>>>>> + * Note: the provided address must align at least
>>>>> + * RTE_CACHE_LINE_SIZE.
>>>>> + */
>>>>> + void *user_addr;
>>>>> + /** User provided memarea, this field is valid only when the
>>>>> + * source is set to be RTE_MEMAREA_SOURCE_USER_MEMAREA.
>>>>> + */
>>>>> + struct rte_memarea *user_memarea;
>>>>> + };
>>>>> +};
>>>>> +
>>>>> +/**
>>>>> + * @warning
>>>>> + * @b EXPERIMENTAL: this API may change without prior notice.
>>>>> + *
>>>>> + * Create memarea.
>>>>> + *
>>>>> + * Create one new memarea.
>>>>> + *
>>>>> + * @param init
>>>>> + * The init parameter of memarea.
>>>>> + *
>>>>> + * @return
>>>>> + * Non-NULL on success. Otherwise NULL is returned.
>>>>> + */
>>>>> +__rte_experimental
>>>>> +struct rte_memarea *rte_memarea_create(const struct
>>>>> rte_memarea_param *init);
>>>>> +
>>>>> +/**
>>>>> + * @warning
>>>>> + * @b EXPERIMENTAL: this API may change without prior notice.
>>>>> + *
>>>>> + * Destroy memarea.
>>>>> + *
>>>>> + * Destroy the memarea.
>>>>> + *
>>>>> + * @param ma
>>>>> + * The pointer of memarea.
>>>>> + */
>>>>> +__rte_experimental
>>>>> +void rte_memarea_destroy(struct rte_memarea *ma);
>>>>> +
>>>>> +#ifdef __cplusplus
>>>>> +}
>>>>> +#endif
>>>>> +
>>>>> +#endif /* RTE_MEMAREA_H */
>>>>> diff --git a/lib/memarea/version.map b/lib/memarea/version.map
>>>>> new file mode 100644
>>>>> index 0000000000..f36a04d7cf
>>>>> --- /dev/null
>>>>> +++ b/lib/memarea/version.map
>>>>> @@ -0,0 +1,12 @@
>>>>> +EXPERIMENTAL {
>>>>> + global:
>>>>> +
>>>>> + rte_memarea_create;
>>>>> + rte_memarea_destroy;
>>>>> +
>>>>> + local: *;
>>>>> +};
>>>>> +
>>>>> +INTERNAL {
>>>>> + local: *;
>>>>> +};
>>>>> diff --git a/lib/meson.build b/lib/meson.build
>>>>> index c648f7d800..521a25d6c0 100644
>>>>> --- a/lib/meson.build
>>>>> +++ b/lib/meson.build
>>>>> @@ -42,6 +42,7 @@ libraries = [
>>>>> 'kni',
>>>>> 'latencystats',
>>>>> 'lpm',
>>>>> + 'memarea',
>>>>> 'member',
>>>>> 'pcapng',
>>>>> 'power',
>>>>
>>>> .
>>
^ permalink raw reply [relevance 0%]
* release candidate 22.11-rc1
@ 2022-10-11 1:50 4% Thomas Monjalon
2022-10-13 5:28 0% ` Jiang, YuX
` (2 more replies)
0 siblings, 3 replies; 200+ results
From: Thomas Monjalon @ 2022-10-11 1:50 UTC (permalink / raw)
To: announce
A new DPDK release candidate is ready for testing:
https://git.dpdk.org/dpdk/tag/?id=v22.11-rc1
There are 737 new patches in this snapshot,
including many API/ABI compatibility breakages.
This release won't be ABI-compatible with previous ones.
Release notes:
https://doc.dpdk.org/guides/rel_notes/release_22_11.html
Highlights of 22.11-rc1:
- LoongArch build
- Intel uncore frequency control
- multiple mbuf pools per Rx queue
- Rx buffer split based on protocol
- hardware congestion management
- hairpin memory configuration
- Rx/Tx descriptor dump
- flow API extensions
- MACsec processing offload
- ShangMi crypto algorithms
- baseband FFT operations
- eventdev Tx queue start/stop
- eventdev crypto vectorization
- NitroSketch membership
Some work is in progress to optimize the mempool cache.
Some patches are part of -rc1, and more could be merged in -rc2.
Please measure the performance of this release candidate,
and check these mempool patches:
https://patches.dpdk.org/project/dpdk/list/?series=25063
Please test and report issues on bugs.dpdk.org.
DPDK 22.11-rc2 is expected in two weeks.
Thank you everyone
^ permalink raw reply [relevance 4%]
* Re: [PATCH 1/1] devtools: eol abi as a separate function
@ 2022-10-11 0:36 4% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2022-10-11 0:36 UTC (permalink / raw)
To: Ray Kinsella; +Cc: dev, bruce.richardson, david.marchand, ferruh.yigit
08/08/2022 12:58, Ray Kinsella:
> Developer tools associated with abi are maintained with as part of
> developer tooling, eal abi headers are maintained with eal, abi build
> scripts are maintained with the build system and abi policy and version
> documents along with rest of the documentation.
>
> Major change is that individual components maintainers become
> responsible for ensuring correctness of their map file(s).
>
> Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Applied, thanks for the help on this difficult topic.
^ permalink raw reply [relevance 4%]
* Re: [PATCH v5 01/10] memarea: introduce memarea library
2022-10-10 16:53 4% ` Mattias Rönnblom
@ 2022-10-10 23:33 0% ` fengchengwen
2022-10-11 15:35 0% ` Mattias Rönnblom
0 siblings, 1 reply; 200+ results
From: fengchengwen @ 2022-10-10 23:33 UTC (permalink / raw)
To: Mattias Rönnblom, datshan, david.marchand, mb,
anatoly.burakov, dmitry.kozliuk, jerinjacobk
Cc: thomas, dev
On 2022/10/11 0:53, Mattias Rönnblom wrote:
> On 2022-10-08 09:53, fengchengwen wrote:
>> Hi Mattias, Thanks for your review, most will fix in v6.
>>
>> On 2022/10/7 4:15, Mattias Rönnblom wrote:
>>> On 2022-10-05 06:09, datshan wrote:
>>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>>
>>>> The memarea library is an allocator of variable-size object which
>>>> based
>>>> on a memory region.
>>>>
>>>> This patch provides create/destroy API.
>>>>
>>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>>> ---
>>>> MAINTAINERS | 5 +
>>>> doc/api/doxy-api-index.md | 3 +-
>>>> doc/api/doxy-api.conf.in | 1 +
>>>> doc/guides/prog_guide/index.rst | 1 +
>>>> doc/guides/prog_guide/memarea_lib.rst | 39 ++++++
>>>> doc/guides/rel_notes/release_22_11.rst | 6 +
>>>> lib/eal/common/eal_common_log.c | 1 +
>>>> lib/eal/include/rte_log.h | 1 +
>>>> lib/memarea/memarea_private.h | 30 +++++
>>>> lib/memarea/meson.build | 16 +++
>>>> lib/memarea/rte_memarea.c | 157
>>>> +++++++++++++++++++++++++
>>>> lib/memarea/rte_memarea.h | 145
>>>> +++++++++++++++++++++++
>>>> lib/memarea/version.map | 12 ++
>>>> lib/meson.build | 1 +
>>>> 14 files changed, 417 insertions(+), 1 deletion(-)
>>>> create mode 100644 doc/guides/prog_guide/memarea_lib.rst
>>>> create mode 100644 lib/memarea/memarea_private.h
>>>> create mode 100644 lib/memarea/meson.build
>>>> create mode 100644 lib/memarea/rte_memarea.c
>>>> create mode 100644 lib/memarea/rte_memarea.h
>>>> create mode 100644 lib/memarea/version.map
>>>>
>>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>>> index a55b379d73..b9c638221d 100644
>>>> --- a/MAINTAINERS
>>>> +++ b/MAINTAINERS
>>>> @@ -1550,6 +1550,11 @@ F: app/test/test_lpm*
>>>> F: app/test/test_func_reentrancy.c
>>>> F: app/test/test_xmmt_ops.h
>>>> +Memarea - EXPERIMENTAL
>>>> +M: Chengwen Feng <fengchengwen@huawei.com>
>>>> +F: lib/memarea
>>>> +F: doc/guides/prog_guide/memarea_lib.rst
>>>> +
>>>> Membership - EXPERIMENTAL
>>>> M: Yipeng Wang <yipeng1.wang@intel.com>
>>>> M: Sameh Gobriel <sameh.gobriel@intel.com>
>>>> diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
>>>> index de488c7abf..24456604f8 100644
>>>> --- a/doc/api/doxy-api-index.md
>>>> +++ b/doc/api/doxy-api-index.md
>>>> @@ -62,7 +62,8 @@ The public API headers are grouped by topics:
>>>> [memzone](@ref rte_memzone.h),
>>>> [mempool](@ref rte_mempool.h),
>>>> [malloc](@ref rte_malloc.h),
>>>> - [memcpy](@ref rte_memcpy.h)
>>>> + [memcpy](@ref rte_memcpy.h),
>>>> + [memarea](@ref rte_memarea.h)
>>>> - **timers**:
>>>> [cycles](@ref rte_cycles.h),
>>>> diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
>>>> index f0886c3bd1..8334ebcbd6 100644
>>>> --- a/doc/api/doxy-api.conf.in
>>>> +++ b/doc/api/doxy-api.conf.in
>>>> @@ -53,6 +53,7 @@ INPUT =
>>>> @TOPDIR@/doc/api/doxy-api-index.md \
>>>> @TOPDIR@/lib/latencystats \
>>>> @TOPDIR@/lib/lpm \
>>>> @TOPDIR@/lib/mbuf \
>>>> + @TOPDIR@/lib/memarea \
>>>> @TOPDIR@/lib/member \
>>>> @TOPDIR@/lib/mempool \
>>>> @TOPDIR@/lib/meter \
>>>> diff --git a/doc/guides/prog_guide/index.rst
>>>> b/doc/guides/prog_guide/index.rst
>>>> index 8564883018..e9015d65e3 100644
>>>> --- a/doc/guides/prog_guide/index.rst
>>>> +++ b/doc/guides/prog_guide/index.rst
>>>> @@ -37,6 +37,7 @@ Programmer's Guide
>>>> hash_lib
>>>> toeplitz_hash_lib
>>>> efd_lib
>>>> + memarea_lib
>>>> member_lib
>>>> lpm_lib
>>>> lpm6_lib
>>>> diff --git a/doc/guides/prog_guide/memarea_lib.rst
>>>> b/doc/guides/prog_guide/memarea_lib.rst
>>>> new file mode 100644
>>>> index 0000000000..b96dad15f6
>>>> --- /dev/null
>>>> +++ b/doc/guides/prog_guide/memarea_lib.rst
>>>> @@ -0,0 +1,39 @@
>>>> +.. SPDX-License-Identifier: BSD-3-Clause
>>>> + Copyright(c) 2022 HiSilicon Limited
>>>> +
>>>> +Memarea Library
>>>> +===============
>>>> +
>>>> +Introduction
>>>> +------------
>>>> +
>>>> +The memarea library provides an allocator of variable-size
>>>> objects, it is
>>>> +oriented towards the application layer, which could provides
>>>> 'region-based
>>>> +memory management' function [1].
>>>> +
>>>> +The main features are as follows:
>>>> +
>>>> +* The default aligement size is ``RTE_CACHE_LINE_SIZE``.
>>>> +
>>>> +* The memory region can be initialized from the following memory
>>>> sources:
>>>> + a) RTE memory: e.g. invoke ``rte_malloc_socket`` to obtain. b)
>>>> System API:
>>>> + e.g. invoke posix_memalign to obtain. c) User provided address:
>>>> it can be from
>>>> + extendedd memory as long as it is available. d) User provided
>>>> memarea: it can
>>>> + be from another memarea.
>>>> +
>>>> +* It provides refcnt feature which could be useful in multi-reader
>>>> scenario.
>>>> +
>>>> +* It supports MT-safe as long as it's specified at creation time.
>>>> +
>>>> +Library API Overview
>>>> +--------------------
>>>> +
>>>> +The ``rte_memarea_create()`` function is used to create a memarea,
>>>> the function
>>>> +returns the pointer to the created memarea or ``NULL`` if the
>>>> creation failed.
>>>> +
>>>> +The ``rte_memarea_destroy()`` function is used to destroy a memarea.
>>>> +
>>>> +Reference
>>>> +---------
>>>> +
>>>> +[1] https://en.wikipedia.org/wiki/Region-based_memory_management
>>>> diff --git a/doc/guides/rel_notes/release_22_11.rst
>>>> b/doc/guides/rel_notes/release_22_11.rst
>>>> index 5d8ef669b8..4c1f760b98 100644
>>>> --- a/doc/guides/rel_notes/release_22_11.rst
>>>> +++ b/doc/guides/rel_notes/release_22_11.rst
>>>> @@ -55,6 +55,12 @@ New Features
>>>> Also, make sure to start the actual text at the margin.
>>>> =======================================================
>>>> +* **Added memarea library.**
>>>> +
>>>> + The memarea library is an allocator of variable-size objects, it
>>>> is oriented
>>>> + towards the application layer, which could provides
>>>> 'region-based memory
>>>> + management' function.
>>>> +
>>>> * **Added configuration for asynchronous flow connection
>>>> tracking.**
>>>> Added connection tracking action number hint to
>>>> ``rte_flow_configure``
>>>> diff --git a/lib/eal/common/eal_common_log.c
>>>> b/lib/eal/common/eal_common_log.c
>>>> index bd7b188ceb..3d62af59c6 100644
>>>> --- a/lib/eal/common/eal_common_log.c
>>>> +++ b/lib/eal/common/eal_common_log.c
>>>> @@ -369,6 +369,7 @@ static const struct logtype logtype_strings[] = {
>>>> {RTE_LOGTYPE_EFD, "lib.efd"},
>>>> {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"},
>>>> {RTE_LOGTYPE_GSO, "lib.gso"},
>>>> + {RTE_LOGTYPE_MEMAREA, "lib.memarea"},
>>>> {RTE_LOGTYPE_USER1, "user1"},
>>>> {RTE_LOGTYPE_USER2, "user2"},
>>>> {RTE_LOGTYPE_USER3, "user3"},
>>>> diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
>>>> index 25ce42cdfc..708f3a39dd 100644
>>>> --- a/lib/eal/include/rte_log.h
>>>> +++ b/lib/eal/include/rte_log.h
>>>> @@ -48,6 +48,7 @@ extern "C" {
>>>> #define RTE_LOGTYPE_EFD 18 /**< Log related to EFD. */
>>>> #define RTE_LOGTYPE_EVENTDEV 19 /**< Log related to eventdev. */
>>>> #define RTE_LOGTYPE_GSO 20 /**< Log related to GSO. */
>>>> +#define RTE_LOGTYPE_MEMAREA 21 /**< Log related to memarea. */
>>>> /* these log types can be used in an application */
>>>> #define RTE_LOGTYPE_USER1 24 /**< User-defined log type 1. */
>>>> diff --git a/lib/memarea/memarea_private.h
>>>> b/lib/memarea/memarea_private.h
>>>> new file mode 100644
>>>> index 0000000000..c76392d3e6
>>>> --- /dev/null
>>>> +++ b/lib/memarea/memarea_private.h
>>>> @@ -0,0 +1,30 @@
>>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>>> + * Copyright(c) 2022 HiSilicon Limited
>>>> + */
>>>> +
>>>> +#ifndef MEMAREA_PRIVATE_H
>>>> +#define MEMAREA_PRIVATE_H
>>>> +
>>>> +#include <rte_memarea.h>
>>>> +
>>>> +#define MEMAREA_FREE_ELEM_COOKIE 0xFFFFFFFF
>>>> +
>>>> +struct memarea_elem {
>>>> + size_t size;
>>>> + uint32_t cookie;
>>>> + int32_t refcnt; /* Non-zero indicates that it has been
>>>> allocated */
>>>> + TAILQ_ENTRY(memarea_elem) elem_node;
>>>> + TAILQ_ENTRY(memarea_elem) free_node;
>>>> +} __rte_cache_aligned;
>>>> +
>>>
>>> Why is the elem type cache line aligned? Need the elem data start be
>>> cache line aligned?
>>
>> Yes, the elem data align at cache-line default.
>>
>>>
>>>> +TAILQ_HEAD(memarea_elem_list, memarea_elem);
>>>> +
>>>> +struct rte_memarea {
>>>> + struct rte_memarea_param init;
>>>> + rte_spinlock_t lock;
>>>> + void *area_addr;
>>>> + struct memarea_elem_list elem_list;
>>>> + struct memarea_elem_list free_list;
>>>> +} __rte_cache_aligned;
>>>> +
>>>> +#endif /* MEMAREA_PRIVATE_H */
>>>> diff --git a/lib/memarea/meson.build b/lib/memarea/meson.build
>>>> new file mode 100644
>>>> index 0000000000..0a74fb4cd1
>>>> --- /dev/null
>>>> +++ b/lib/memarea/meson.build
>>>> @@ -0,0 +1,16 @@
>>>> +# SPDX-License-Identifier: BSD-3-Clause
>>>> +# Copyright(c) 2022 HiSilicon Limited
>>>> +
>>>> +if is_windows
>>>> + build = false
>>>> + reason = 'not supported on Windows'
>>>> + subdir_done()
>>>> +endif
>>>> +
>>>> +sources = files(
>>>> + 'rte_memarea.c',
>>>> +)
>>>> +headers = files(
>>>> + 'rte_memarea.h',
>>>> +)
>>>> +deps += []
>>>> diff --git a/lib/memarea/rte_memarea.c b/lib/memarea/rte_memarea.c
>>>> new file mode 100644
>>>> index 0000000000..868da7661d
>>>> --- /dev/null
>>>> +++ b/lib/memarea/rte_memarea.c
>>>> @@ -0,0 +1,157 @@
>>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>>> + * Copyright(c) 2022 HiSilicon Limited
>>>> + */
>>>> +
>>>> +#include <stdio.h>
>>>> +#include <stdlib.h>
>>>> +
>>>> +#include <rte_common.h>
>>>> +#include <rte_log.h>
>>>> +#include <rte_malloc.h>
>>>> +#include <rte_spinlock.h>
>>>> +
>>>> +#include "rte_memarea.h"
>>>> +#include "memarea_private.h"
>>>> +
>>>> +static int
>>>> +memarea_check_param(const struct rte_memarea_param *init)
>>>> +{
>>>> + size_t len;
>>>> +
>>>> + if (init == NULL) {
>>>> + RTE_LOG(ERR, MEMAREA, "memarea init param is NULL!\n");
>>>> + return -EINVAL;
>>>> + }
>>>> +
>>>> + len = strnlen(init->name, RTE_MEMAREA_NAMESIZE);
>>>> + if (len == 0 || len >= RTE_MEMAREA_NAMESIZE) {
>>>> + RTE_LOG(ERR, MEMAREA, "memarea name size %zu invalid!\n",
>>>> len);
>>>> + return -EINVAL;
>>>> + }
>>>> +
>>>> + if (init->source != RTE_MEMAREA_SOURCE_RTE_MEMORY &&
>>>> + init->source != RTE_MEMAREA_SOURCE_SYSTEM_API &&
>>>> + init->source != RTE_MEMAREA_SOURCE_USER_ADDR &&
>>>> + init->source != RTE_MEMAREA_SOURCE_USER_MEMAREA) {
>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s source: %d not
>>>> supported!\n",
>>>> + init->name, init->source);
>>>> + return -EINVAL;
>>>> + }
>>>> +
>>>> + if (init->total_sz <= sizeof(struct memarea_elem)) {
>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s total-size: %zu too
>>>> small!\n",
>>>> + init->name, init->total_sz);
>>>> + return -EINVAL;
>>>> + }
>>>> +
>>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR &&
>>>> init->user_addr == NULL) {
>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided addr is
>>>> NULL!\n", init->name);
>>>> + return -EINVAL;
>>>> + }
>>>> +
>>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR &&
>>>> + ((uintptr_t)init->user_addr & (RTE_CACHE_LINE_SIZE - 1))) {
>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided addr
>>>> should align: %d!\n",
>>>> + init->name, RTE_CACHE_LINE_SIZE);
>>>> + return -EINVAL;
>>>> + }
>>>> +
>>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_MEMAREA &&
>>>> init->user_memarea == NULL) {
>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided memarea
>>>> is NULL!\n", init->name);
>>>> + return -EINVAL;
>>>> + }
>>>> +
>>>> + if (init->alg != RTE_MEMAREA_ALG_DEFAULT) {
>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s alg: %d not supported!\n",
>>>> + init->name, init->alg);
>>>> + return -EINVAL;
>>>> + }
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static void *
>>>> +memarea_alloc_from_system_api(size_t size)
>>>> +{
>>>> + void *ptr = NULL;
>>>> + int ret;
>>>> +
>>>> + ret = posix_memalign(&ptr, RTE_CACHE_LINE_SIZE, size);
>>>> + if (ret)
>>>> + return NULL;
>>>> + return ptr;
>>>> +}
>>>> +
>>>> +static void *
>>>> +memarea_alloc_area(const struct rte_memarea_param *init)
>>>> +{
>>>> + void *ptr = NULL;
>>>> +
>>>> + if (init->source == RTE_MEMAREA_SOURCE_RTE_MEMORY)
>>>
>>> Delete MEMORY. Of course it's memory. What else? If you want to make
>>> it clear it's from the RTE heap, it should spell out HEAP. Or MALLOC.
>>
>> HEAP seem better.
>>
>>>
>>>> + ptr = rte_malloc_socket(NULL, init->total_sz,
>>>> RTE_CACHE_LINE_SIZE,
>>>> + init->numa_socket);
>>>> + else if (init->source == RTE_MEMAREA_SOURCE_SYSTEM_API)
>>>> + ptr = memarea_alloc_from_system_api(init->total_sz);
>>>
>>> "SYSTEM_API" doesn't strike me as a good name.
>>>
>>> RTE_MEMAREA_SOURCE_LIBC
>>
>> LIBC seem better.
>>
>>> RTE_MEMAREA_SOURCE_STD_HEAP
>>> or at least remove API so it'll be
>>> RTE_MEMAREA_SOURCE_SYSTEM
>>>
>>>> + else if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR)
>>>
>>> I would delete "ADDR".
>>
>> +1
>>
>>>
>>>> + ptr = init->user_addr;
>>>> +
>>>> + if (ptr == NULL)
>>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s alloc memory area
>>>> fail!\n", init->name);
>>>> +
>>>> + return ptr;
>>>> +}
>>>> +
>>>> +struct rte_memarea *
>>>> +rte_memarea_create(const struct rte_memarea_param *init)
>>>> +{
>>>> + struct memarea_elem *elem;
>>>> + struct rte_memarea *ma;
>>>> + void *addr;
>>>> + int ret;
>>>> +
>>>> + ret = memarea_check_param(init);
>>>> + if (ret)
>>>> + return NULL;
>>>> +
>>>> + addr = memarea_alloc_area(init);
>>>> + if (addr == NULL)
>>>> + return NULL;
>>>> +
>>>> + ma = rte_zmalloc(NULL, sizeof(struct rte_memarea),
>>>> RTE_CACHE_LINE_SIZE);
>>>> + if (ma == NULL) {
>>>> + RTE_LOG(ERR, MEMAREA, "malloc memarea: %s management obj
>>>> fail!\n", init->name);
>>>> + return NULL;
>>>> + }
>>>> +
>>>> + ma->init = *init;
>>>> + rte_spinlock_init(&ma->lock);
>>>> + TAILQ_INIT(&ma->elem_list);
>>>> + TAILQ_INIT(&ma->free_list);
>>>> + ma->area_addr = addr;
>>>> + elem = addr;
>>>> + elem->size = init->total_sz - sizeof(struct memarea_elem);
>>>> + elem->cookie = MEMAREA_FREE_ELEM_COOKIE;
>>>> + elem->refcnt = 0;
>>>> + TAILQ_INSERT_TAIL(&ma->elem_list, elem, elem_node);
>>>> + TAILQ_INSERT_TAIL(&ma->free_list, elem, free_node);
>>>> +
>>>> + return ma;
>>>> +}
>>>> +
>>>> +static void
>>>> +memarea_free_area(struct rte_memarea *ma)
>>>> +{
>>>> + if (ma->init.source == RTE_MEMAREA_SOURCE_RTE_MEMORY)
>>>> + rte_free(ma->area_addr);
>>>> + else if (ma->init.source == RTE_MEMAREA_SOURCE_SYSTEM_API)
>>>> + free(ma->area_addr);
>>>> +}
>>>> +
>>>> +void
>>>> +rte_memarea_destroy(struct rte_memarea *ma)
>>>> +{
>>>> + if (ma == NULL)
>>>> + return;
>>>> + memarea_free_area(ma);
>>>> + rte_free(ma);
>>>> +}
>>>> diff --git a/lib/memarea/rte_memarea.h b/lib/memarea/rte_memarea.h
>>>> new file mode 100644
>>>> index 0000000000..543cda4cac
>>>> --- /dev/null
>>>> +++ b/lib/memarea/rte_memarea.h
>>>> @@ -0,0 +1,145 @@
>>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>>> + * Copyright(c) 2022 HiSilicon Limited
>>>> + */
>>>> +
>>>> +#ifndef RTE_MEMAREA_H
>>>> +#define RTE_MEMAREA_H
>>>> +
>>>> +/**
>>>> + * @file
>>>> + * RTE Memarea.
>>>> + *
>>>> + * The memarea is an allocator of variable-size object which based
>>>> on a memory
>>>> + * region. It has the following features:
>>>> + *
>>>> + * - The default alignment size is RTE_CACHE_LINE_SIZE.
>>>
>>> This can be read as two things: the object size is aligned, or the
>>> start address is aligned.
>>
>> It means the start address align, will define more clear in v6.
>>
>>>
>>>> + * - The memory region can be initialized from the following
>>>> memory sources:
>>>> + * 1. RTE memory: e.g. invoke rte_malloc_socket to obtain.
>>>
>>> Remove "to obtain", or add "memory" after "obtain". Do you really
>>> mean "e.g.", and not "i.e."?
>>
>> will fix in v6.
>>
>>>
>>>> + * 2. System API: e.g. invoke posix_memalign to obtain.
>>>> + * 3. User provided address: it can be from extended memory as
>>>> long as it is
>>>> + * available. The address must be aligned to
>>>> RTE_CACHE_LINE_SIZE.
>>>
>>> What is extended memory?
>>
>> Like rte_extmen
>>
>>>
>>>> + * 4) User provided memarea: it can be from another memarea. So
>>>> we can build
>>>> + * the following memory management structure:
>>>> + * \code{.unparsed}
>>>> + * -------------
>>>> + * | memarea-1 |
>>>> + * -------------
>>>> + * |
>>>> + * v
>>>> + * -------------------------------
>>>> + * | | |
>>>> + * v v v
>>>> + * ------------- ------------- ----------
>>>> + * | memarea-2 | | memarea-3 | | object |
>>>> + * ------------- ------------- ----------
>>>> + * \endcode
>>>> + * As shown above, the memarea-2/3 both create from
>>>> memarea-1's memory.
>>>> + * - It provides refcnt feature which could be useful in
>>>> multi-reader scenario.
>>>> + * - It supports MT-safe as long as it's specified at creation
>>>> time. If not
>>>> + * specified, all the functions of the memarea API are
>>>> lock-free, and assume
>>>> + * to not be invoked in parallel on different logical cores to
>>>> work on the
>>>> + * same memarea.
>>>> + */
>>>> +
>>>> +#include <stdbool.h>
>>>> +#include <stdint.h>
>>>> +#include <stdio.h>
>>>> +
>>>> +#include <rte_compat.h>
>>>> +
>>>> +#ifdef __cplusplus
>>>> +extern "C" {
>>>> +#endif
>>>> +
>>>> +#define RTE_MEMAREA_NAMESIZE 64
>>>> +
>>>> +/**
>>>> + * Memarea memory source.
>>>> + */
>>>> +enum rte_memarea_source {
>>>> + /** Memory source comes from rte memory. */
>>>> + RTE_MEMAREA_SOURCE_RTE_MEMORY,
>>>> + /** Memory source comes from system API. */
>>>> + RTE_MEMAREA_SOURCE_SYSTEM_API,
>>>> + /** Memory source comes from user-provided address. */
>>>> + RTE_MEMAREA_SOURCE_USER_ADDR,
>>>> + /** Memory source comes from user-provided memarea. */
>>>> + RTE_MEMAREA_SOURCE_USER_MEMAREA,
>>>> +};
>>>> +
>>>> +/**
>>>> + * Memarea memory management algorithm.
>>>> + */
>>>> +enum rte_memarea_alg {
>>>> + /* The default management algorithm is a variant of the next fit
>>>> + * algorithm. It uses a free-list to apply for memory and uses an
>>>> + * element-list in ascending order of address to support merging
>>>> + * upon free.
>>>> + */
>>>> + RTE_MEMAREA_ALG_DEFAULT,
>>>> +};
>
> Do you need to expose the algorithm/management scheme option in the
> public API, if there is only one implementation to choose from?
Yes, we plan to support SLAB algorithm in future by adding a new alg.
>
> You can always have a rte_memarea_create_alg(/../) in the future, or
> just change the signature between ABI-breaking releases.
I don't think add a new API is a good idea.
You can see that, we put all init parameter in one struct in this
design, and could extend function by adding new field .
>
>
> Also, shouldn't the default algorithm have name? Rather than just
> DEFAULT. RTE_MEMAREA_ALG_NEXTFIT maybe.
Yes, will fix in next version.
>
>>>> +
>>>> +struct rte_memarea;
>>>> +
>>>> +struct rte_memarea_param {
>>>
>>> Does this struct need to be public?
>>
>> Yes, the rte_memarea_param contains create parameters for create
>> memarea which need be public.
>>
>
> Why isn't the public API just a bunch of create-function parameters?
> Or, alternatively, you have an assortment of create functions, for
> different combinations of parameters. Then you don't have to think
> about having reserved bits or other kind of ABI-related issues due to
> the struct being public.
These are two API design styles,and I prefer the one create-function API
style just it seem simple (by inner usage voice).
>
>> And rte_memarea which pointer implementation struction which just a
>> declare here.
>>
>>>
>>>> + char name[RTE_MEMAREA_NAMESIZE]; /**< Name of memarea. */
>>>> + enum rte_memarea_source source; /**< Memory source of
>>>> memarea. */
>>>> + enum rte_memarea_alg alg; /**< Memory management
>>>> algorithm. */
>>>> + size_t total_sz; /**< total size (bytes) of
>>>> memarea. */
>>>> + /** Indicates whether the memarea API should be MT-safe. */
>>>> + uint32_t mt_safe : 1;
>>>
>>> Why not bool?
>>
>> Use bit field other than bool will provides more reserved field.
>>
>>>
>>>> + union {
>>>> + /** Numa socket from which to apply for memarea's memory,
>>>> this
>>>> + * field is valid only when the source is set to be
>>>> + * RTE_MEMAREA_SOURCE_RTE_MEMORY.
>>>> + */
>>>> + int numa_socket;
>>>> + /** User provided address, this field is valid only when the
>>>> + * source is set to be RTE_MEMAREA_SOURCE_USER_ADDR.
>>>> + * Note: the provided address must align at least
>>>> + * RTE_CACHE_LINE_SIZE.
>>>> + */
>>>> + void *user_addr;
>>>> + /** User provided memarea, this field is valid only when the
>>>> + * source is set to be RTE_MEMAREA_SOURCE_USER_MEMAREA.
>>>> + */
>>>> + struct rte_memarea *user_memarea;
>>>> + };
>>>> +};
>>>> +
>>>> +/**
>>>> + * @warning
>>>> + * @b EXPERIMENTAL: this API may change without prior notice.
>>>> + *
>>>> + * Create memarea.
>>>> + *
>>>> + * Create one new memarea.
>>>> + *
>>>> + * @param init
>>>> + * The init parameter of memarea.
>>>> + *
>>>> + * @return
>>>> + * Non-NULL on success. Otherwise NULL is returned.
>>>> + */
>>>> +__rte_experimental
>>>> +struct rte_memarea *rte_memarea_create(const struct
>>>> rte_memarea_param *init);
>>>> +
>>>> +/**
>>>> + * @warning
>>>> + * @b EXPERIMENTAL: this API may change without prior notice.
>>>> + *
>>>> + * Destroy memarea.
>>>> + *
>>>> + * Destroy the memarea.
>>>> + *
>>>> + * @param ma
>>>> + * The pointer of memarea.
>>>> + */
>>>> +__rte_experimental
>>>> +void rte_memarea_destroy(struct rte_memarea *ma);
>>>> +
>>>> +#ifdef __cplusplus
>>>> +}
>>>> +#endif
>>>> +
>>>> +#endif /* RTE_MEMAREA_H */
>>>> diff --git a/lib/memarea/version.map b/lib/memarea/version.map
>>>> new file mode 100644
>>>> index 0000000000..f36a04d7cf
>>>> --- /dev/null
>>>> +++ b/lib/memarea/version.map
>>>> @@ -0,0 +1,12 @@
>>>> +EXPERIMENTAL {
>>>> + global:
>>>> +
>>>> + rte_memarea_create;
>>>> + rte_memarea_destroy;
>>>> +
>>>> + local: *;
>>>> +};
>>>> +
>>>> +INTERNAL {
>>>> + local: *;
>>>> +};
>>>> diff --git a/lib/meson.build b/lib/meson.build
>>>> index c648f7d800..521a25d6c0 100644
>>>> --- a/lib/meson.build
>>>> +++ b/lib/meson.build
>>>> @@ -42,6 +42,7 @@ libraries = [
>>>> 'kni',
>>>> 'latencystats',
>>>> 'lpm',
>>>> + 'memarea',
>>>> 'member',
>>>> 'pcapng',
>>>> 'power',
>>>
>>> .
>
^ permalink raw reply [relevance 0%]
* Re: [PATCH v5 01/10] memarea: introduce memarea library
@ 2022-10-10 16:53 4% ` Mattias Rönnblom
2022-10-10 23:33 0% ` fengchengwen
0 siblings, 1 reply; 200+ results
From: Mattias Rönnblom @ 2022-10-10 16:53 UTC (permalink / raw)
To: fengchengwen, datshan, david.marchand, mb, anatoly.burakov,
dmitry.kozliuk, jerinjacobk
Cc: thomas, dev
On 2022-10-08 09:53, fengchengwen wrote:
> Hi Mattias, Thanks for your review, most will fix in v6.
>
> On 2022/10/7 4:15, Mattias Rönnblom wrote:
>> On 2022-10-05 06:09, datshan wrote:
>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>
>>> The memarea library is an allocator of variable-size object which based
>>> on a memory region.
>>>
>>> This patch provides create/destroy API.
>>>
>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>> ---
>>> MAINTAINERS | 5 +
>>> doc/api/doxy-api-index.md | 3 +-
>>> doc/api/doxy-api.conf.in | 1 +
>>> doc/guides/prog_guide/index.rst | 1 +
>>> doc/guides/prog_guide/memarea_lib.rst | 39 ++++++
>>> doc/guides/rel_notes/release_22_11.rst | 6 +
>>> lib/eal/common/eal_common_log.c | 1 +
>>> lib/eal/include/rte_log.h | 1 +
>>> lib/memarea/memarea_private.h | 30 +++++
>>> lib/memarea/meson.build | 16 +++
>>> lib/memarea/rte_memarea.c | 157 +++++++++++++++++++++++++
>>> lib/memarea/rte_memarea.h | 145 +++++++++++++++++++++++
>>> lib/memarea/version.map | 12 ++
>>> lib/meson.build | 1 +
>>> 14 files changed, 417 insertions(+), 1 deletion(-)
>>> create mode 100644 doc/guides/prog_guide/memarea_lib.rst
>>> create mode 100644 lib/memarea/memarea_private.h
>>> create mode 100644 lib/memarea/meson.build
>>> create mode 100644 lib/memarea/rte_memarea.c
>>> create mode 100644 lib/memarea/rte_memarea.h
>>> create mode 100644 lib/memarea/version.map
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index a55b379d73..b9c638221d 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -1550,6 +1550,11 @@ F: app/test/test_lpm*
>>> F: app/test/test_func_reentrancy.c
>>> F: app/test/test_xmmt_ops.h
>>> +Memarea - EXPERIMENTAL
>>> +M: Chengwen Feng <fengchengwen@huawei.com>
>>> +F: lib/memarea
>>> +F: doc/guides/prog_guide/memarea_lib.rst
>>> +
>>> Membership - EXPERIMENTAL
>>> M: Yipeng Wang <yipeng1.wang@intel.com>
>>> M: Sameh Gobriel <sameh.gobriel@intel.com>
>>> diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
>>> index de488c7abf..24456604f8 100644
>>> --- a/doc/api/doxy-api-index.md
>>> +++ b/doc/api/doxy-api-index.md
>>> @@ -62,7 +62,8 @@ The public API headers are grouped by topics:
>>> [memzone](@ref rte_memzone.h),
>>> [mempool](@ref rte_mempool.h),
>>> [malloc](@ref rte_malloc.h),
>>> - [memcpy](@ref rte_memcpy.h)
>>> + [memcpy](@ref rte_memcpy.h),
>>> + [memarea](@ref rte_memarea.h)
>>> - **timers**:
>>> [cycles](@ref rte_cycles.h),
>>> diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
>>> index f0886c3bd1..8334ebcbd6 100644
>>> --- a/doc/api/doxy-api.conf.in
>>> +++ b/doc/api/doxy-api.conf.in
>>> @@ -53,6 +53,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \
>>> @TOPDIR@/lib/latencystats \
>>> @TOPDIR@/lib/lpm \
>>> @TOPDIR@/lib/mbuf \
>>> + @TOPDIR@/lib/memarea \
>>> @TOPDIR@/lib/member \
>>> @TOPDIR@/lib/mempool \
>>> @TOPDIR@/lib/meter \
>>> diff --git a/doc/guides/prog_guide/index.rst b/doc/guides/prog_guide/index.rst
>>> index 8564883018..e9015d65e3 100644
>>> --- a/doc/guides/prog_guide/index.rst
>>> +++ b/doc/guides/prog_guide/index.rst
>>> @@ -37,6 +37,7 @@ Programmer's Guide
>>> hash_lib
>>> toeplitz_hash_lib
>>> efd_lib
>>> + memarea_lib
>>> member_lib
>>> lpm_lib
>>> lpm6_lib
>>> diff --git a/doc/guides/prog_guide/memarea_lib.rst b/doc/guides/prog_guide/memarea_lib.rst
>>> new file mode 100644
>>> index 0000000000..b96dad15f6
>>> --- /dev/null
>>> +++ b/doc/guides/prog_guide/memarea_lib.rst
>>> @@ -0,0 +1,39 @@
>>> +.. SPDX-License-Identifier: BSD-3-Clause
>>> + Copyright(c) 2022 HiSilicon Limited
>>> +
>>> +Memarea Library
>>> +===============
>>> +
>>> +Introduction
>>> +------------
>>> +
>>> +The memarea library provides an allocator of variable-size objects, it is
>>> +oriented towards the application layer, which could provides 'region-based
>>> +memory management' function [1].
>>> +
>>> +The main features are as follows:
>>> +
>>> +* The default aligement size is ``RTE_CACHE_LINE_SIZE``.
>>> +
>>> +* The memory region can be initialized from the following memory sources:
>>> + a) RTE memory: e.g. invoke ``rte_malloc_socket`` to obtain. b) System API:
>>> + e.g. invoke posix_memalign to obtain. c) User provided address: it can be from
>>> + extendedd memory as long as it is available. d) User provided memarea: it can
>>> + be from another memarea.
>>> +
>>> +* It provides refcnt feature which could be useful in multi-reader scenario.
>>> +
>>> +* It supports MT-safe as long as it's specified at creation time.
>>> +
>>> +Library API Overview
>>> +--------------------
>>> +
>>> +The ``rte_memarea_create()`` function is used to create a memarea, the function
>>> +returns the pointer to the created memarea or ``NULL`` if the creation failed.
>>> +
>>> +The ``rte_memarea_destroy()`` function is used to destroy a memarea.
>>> +
>>> +Reference
>>> +---------
>>> +
>>> +[1] https://en.wikipedia.org/wiki/Region-based_memory_management
>>> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
>>> index 5d8ef669b8..4c1f760b98 100644
>>> --- a/doc/guides/rel_notes/release_22_11.rst
>>> +++ b/doc/guides/rel_notes/release_22_11.rst
>>> @@ -55,6 +55,12 @@ New Features
>>> Also, make sure to start the actual text at the margin.
>>> =======================================================
>>> +* **Added memarea library.**
>>> +
>>> + The memarea library is an allocator of variable-size objects, it is oriented
>>> + towards the application layer, which could provides 'region-based memory
>>> + management' function.
>>> +
>>> * **Added configuration for asynchronous flow connection tracking.**
>>> Added connection tracking action number hint to ``rte_flow_configure``
>>> diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
>>> index bd7b188ceb..3d62af59c6 100644
>>> --- a/lib/eal/common/eal_common_log.c
>>> +++ b/lib/eal/common/eal_common_log.c
>>> @@ -369,6 +369,7 @@ static const struct logtype logtype_strings[] = {
>>> {RTE_LOGTYPE_EFD, "lib.efd"},
>>> {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"},
>>> {RTE_LOGTYPE_GSO, "lib.gso"},
>>> + {RTE_LOGTYPE_MEMAREA, "lib.memarea"},
>>> {RTE_LOGTYPE_USER1, "user1"},
>>> {RTE_LOGTYPE_USER2, "user2"},
>>> {RTE_LOGTYPE_USER3, "user3"},
>>> diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
>>> index 25ce42cdfc..708f3a39dd 100644
>>> --- a/lib/eal/include/rte_log.h
>>> +++ b/lib/eal/include/rte_log.h
>>> @@ -48,6 +48,7 @@ extern "C" {
>>> #define RTE_LOGTYPE_EFD 18 /**< Log related to EFD. */
>>> #define RTE_LOGTYPE_EVENTDEV 19 /**< Log related to eventdev. */
>>> #define RTE_LOGTYPE_GSO 20 /**< Log related to GSO. */
>>> +#define RTE_LOGTYPE_MEMAREA 21 /**< Log related to memarea. */
>>> /* these log types can be used in an application */
>>> #define RTE_LOGTYPE_USER1 24 /**< User-defined log type 1. */
>>> diff --git a/lib/memarea/memarea_private.h b/lib/memarea/memarea_private.h
>>> new file mode 100644
>>> index 0000000000..c76392d3e6
>>> --- /dev/null
>>> +++ b/lib/memarea/memarea_private.h
>>> @@ -0,0 +1,30 @@
>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>> + * Copyright(c) 2022 HiSilicon Limited
>>> + */
>>> +
>>> +#ifndef MEMAREA_PRIVATE_H
>>> +#define MEMAREA_PRIVATE_H
>>> +
>>> +#include <rte_memarea.h>
>>> +
>>> +#define MEMAREA_FREE_ELEM_COOKIE 0xFFFFFFFF
>>> +
>>> +struct memarea_elem {
>>> + size_t size;
>>> + uint32_t cookie;
>>> + int32_t refcnt; /* Non-zero indicates that it has been allocated */
>>> + TAILQ_ENTRY(memarea_elem) elem_node;
>>> + TAILQ_ENTRY(memarea_elem) free_node;
>>> +} __rte_cache_aligned;
>>> +
>>
>> Why is the elem type cache line aligned? Need the elem data start be cache line aligned?
>
> Yes, the elem data align at cache-line default.
>
>>
>>> +TAILQ_HEAD(memarea_elem_list, memarea_elem);
>>> +
>>> +struct rte_memarea {
>>> + struct rte_memarea_param init;
>>> + rte_spinlock_t lock;
>>> + void *area_addr;
>>> + struct memarea_elem_list elem_list;
>>> + struct memarea_elem_list free_list;
>>> +} __rte_cache_aligned;
>>> +
>>> +#endif /* MEMAREA_PRIVATE_H */
>>> diff --git a/lib/memarea/meson.build b/lib/memarea/meson.build
>>> new file mode 100644
>>> index 0000000000..0a74fb4cd1
>>> --- /dev/null
>>> +++ b/lib/memarea/meson.build
>>> @@ -0,0 +1,16 @@
>>> +# SPDX-License-Identifier: BSD-3-Clause
>>> +# Copyright(c) 2022 HiSilicon Limited
>>> +
>>> +if is_windows
>>> + build = false
>>> + reason = 'not supported on Windows'
>>> + subdir_done()
>>> +endif
>>> +
>>> +sources = files(
>>> + 'rte_memarea.c',
>>> +)
>>> +headers = files(
>>> + 'rte_memarea.h',
>>> +)
>>> +deps += []
>>> diff --git a/lib/memarea/rte_memarea.c b/lib/memarea/rte_memarea.c
>>> new file mode 100644
>>> index 0000000000..868da7661d
>>> --- /dev/null
>>> +++ b/lib/memarea/rte_memarea.c
>>> @@ -0,0 +1,157 @@
>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>> + * Copyright(c) 2022 HiSilicon Limited
>>> + */
>>> +
>>> +#include <stdio.h>
>>> +#include <stdlib.h>
>>> +
>>> +#include <rte_common.h>
>>> +#include <rte_log.h>
>>> +#include <rte_malloc.h>
>>> +#include <rte_spinlock.h>
>>> +
>>> +#include "rte_memarea.h"
>>> +#include "memarea_private.h"
>>> +
>>> +static int
>>> +memarea_check_param(const struct rte_memarea_param *init)
>>> +{
>>> + size_t len;
>>> +
>>> + if (init == NULL) {
>>> + RTE_LOG(ERR, MEMAREA, "memarea init param is NULL!\n");
>>> + return -EINVAL;
>>> + }
>>> +
>>> + len = strnlen(init->name, RTE_MEMAREA_NAMESIZE);
>>> + if (len == 0 || len >= RTE_MEMAREA_NAMESIZE) {
>>> + RTE_LOG(ERR, MEMAREA, "memarea name size %zu invalid!\n", len);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + if (init->source != RTE_MEMAREA_SOURCE_RTE_MEMORY &&
>>> + init->source != RTE_MEMAREA_SOURCE_SYSTEM_API &&
>>> + init->source != RTE_MEMAREA_SOURCE_USER_ADDR &&
>>> + init->source != RTE_MEMAREA_SOURCE_USER_MEMAREA) {
>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s source: %d not supported!\n",
>>> + init->name, init->source);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + if (init->total_sz <= sizeof(struct memarea_elem)) {
>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s total-size: %zu too small!\n",
>>> + init->name, init->total_sz);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR && init->user_addr == NULL) {
>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided addr is NULL!\n", init->name);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR &&
>>> + ((uintptr_t)init->user_addr & (RTE_CACHE_LINE_SIZE - 1))) {
>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided addr should align: %d!\n",
>>> + init->name, RTE_CACHE_LINE_SIZE);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + if (init->source == RTE_MEMAREA_SOURCE_USER_MEMAREA && init->user_memarea == NULL) {
>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s user provided memarea is NULL!\n", init->name);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + if (init->alg != RTE_MEMAREA_ALG_DEFAULT) {
>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s alg: %d not supported!\n",
>>> + init->name, init->alg);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +static void *
>>> +memarea_alloc_from_system_api(size_t size)
>>> +{
>>> + void *ptr = NULL;
>>> + int ret;
>>> +
>>> + ret = posix_memalign(&ptr, RTE_CACHE_LINE_SIZE, size);
>>> + if (ret)
>>> + return NULL;
>>> + return ptr;
>>> +}
>>> +
>>> +static void *
>>> +memarea_alloc_area(const struct rte_memarea_param *init)
>>> +{
>>> + void *ptr = NULL;
>>> +
>>> + if (init->source == RTE_MEMAREA_SOURCE_RTE_MEMORY)
>>
>> Delete MEMORY. Of course it's memory. What else? If you want to make it clear it's from the RTE heap, it should spell out HEAP. Or MALLOC.
>
> HEAP seem better.
>
>>
>>> + ptr = rte_malloc_socket(NULL, init->total_sz, RTE_CACHE_LINE_SIZE,
>>> + init->numa_socket);
>>> + else if (init->source == RTE_MEMAREA_SOURCE_SYSTEM_API)
>>> + ptr = memarea_alloc_from_system_api(init->total_sz);
>>
>> "SYSTEM_API" doesn't strike me as a good name.
>>
>> RTE_MEMAREA_SOURCE_LIBC
>
> LIBC seem better.
>
>> RTE_MEMAREA_SOURCE_STD_HEAP
>> or at least remove API so it'll be
>> RTE_MEMAREA_SOURCE_SYSTEM
>>
>>> + else if (init->source == RTE_MEMAREA_SOURCE_USER_ADDR)
>>
>> I would delete "ADDR".
>
> +1
>
>>
>>> + ptr = init->user_addr;
>>> +
>>> + if (ptr == NULL)
>>> + RTE_LOG(ERR, MEMAREA, "memarea: %s alloc memory area fail!\n", init->name);
>>> +
>>> + return ptr;
>>> +}
>>> +
>>> +struct rte_memarea *
>>> +rte_memarea_create(const struct rte_memarea_param *init)
>>> +{
>>> + struct memarea_elem *elem;
>>> + struct rte_memarea *ma;
>>> + void *addr;
>>> + int ret;
>>> +
>>> + ret = memarea_check_param(init);
>>> + if (ret)
>>> + return NULL;
>>> +
>>> + addr = memarea_alloc_area(init);
>>> + if (addr == NULL)
>>> + return NULL;
>>> +
>>> + ma = rte_zmalloc(NULL, sizeof(struct rte_memarea), RTE_CACHE_LINE_SIZE);
>>> + if (ma == NULL) {
>>> + RTE_LOG(ERR, MEMAREA, "malloc memarea: %s management obj fail!\n", init->name);
>>> + return NULL;
>>> + }
>>> +
>>> + ma->init = *init;
>>> + rte_spinlock_init(&ma->lock);
>>> + TAILQ_INIT(&ma->elem_list);
>>> + TAILQ_INIT(&ma->free_list);
>>> + ma->area_addr = addr;
>>> + elem = addr;
>>> + elem->size = init->total_sz - sizeof(struct memarea_elem);
>>> + elem->cookie = MEMAREA_FREE_ELEM_COOKIE;
>>> + elem->refcnt = 0;
>>> + TAILQ_INSERT_TAIL(&ma->elem_list, elem, elem_node);
>>> + TAILQ_INSERT_TAIL(&ma->free_list, elem, free_node);
>>> +
>>> + return ma;
>>> +}
>>> +
>>> +static void
>>> +memarea_free_area(struct rte_memarea *ma)
>>> +{
>>> + if (ma->init.source == RTE_MEMAREA_SOURCE_RTE_MEMORY)
>>> + rte_free(ma->area_addr);
>>> + else if (ma->init.source == RTE_MEMAREA_SOURCE_SYSTEM_API)
>>> + free(ma->area_addr);
>>> +}
>>> +
>>> +void
>>> +rte_memarea_destroy(struct rte_memarea *ma)
>>> +{
>>> + if (ma == NULL)
>>> + return;
>>> + memarea_free_area(ma);
>>> + rte_free(ma);
>>> +}
>>> diff --git a/lib/memarea/rte_memarea.h b/lib/memarea/rte_memarea.h
>>> new file mode 100644
>>> index 0000000000..543cda4cac
>>> --- /dev/null
>>> +++ b/lib/memarea/rte_memarea.h
>>> @@ -0,0 +1,145 @@
>>> +/* SPDX-License-Identifier: BSD-3-Clause
>>> + * Copyright(c) 2022 HiSilicon Limited
>>> + */
>>> +
>>> +#ifndef RTE_MEMAREA_H
>>> +#define RTE_MEMAREA_H
>>> +
>>> +/**
>>> + * @file
>>> + * RTE Memarea.
>>> + *
>>> + * The memarea is an allocator of variable-size object which based on a memory
>>> + * region. It has the following features:
>>> + *
>>> + * - The default alignment size is RTE_CACHE_LINE_SIZE.
>>
>> This can be read as two things: the object size is aligned, or the start address is aligned.
>
> It means the start address align, will define more clear in v6.
>
>>
>>> + * - The memory region can be initialized from the following memory sources:
>>> + * 1. RTE memory: e.g. invoke rte_malloc_socket to obtain.
>>
>> Remove "to obtain", or add "memory" after "obtain". Do you really mean "e.g.", and not "i.e."?
>
> will fix in v6.
>
>>
>>> + * 2. System API: e.g. invoke posix_memalign to obtain.
>>> + * 3. User provided address: it can be from extended memory as long as it is
>>> + * available. The address must be aligned to RTE_CACHE_LINE_SIZE.
>>
>> What is extended memory?
>
> Like rte_extmen
>
>>
>>> + * 4) User provided memarea: it can be from another memarea. So we can build
>>> + * the following memory management structure:
>>> + * \code{.unparsed}
>>> + * -------------
>>> + * | memarea-1 |
>>> + * -------------
>>> + * |
>>> + * v
>>> + * -------------------------------
>>> + * | | |
>>> + * v v v
>>> + * ------------- ------------- ----------
>>> + * | memarea-2 | | memarea-3 | | object |
>>> + * ------------- ------------- ----------
>>> + * \endcode
>>> + * As shown above, the memarea-2/3 both create from memarea-1's memory.
>>> + * - It provides refcnt feature which could be useful in multi-reader scenario.
>>> + * - It supports MT-safe as long as it's specified at creation time. If not
>>> + * specified, all the functions of the memarea API are lock-free, and assume
>>> + * to not be invoked in parallel on different logical cores to work on the
>>> + * same memarea.
>>> + */
>>> +
>>> +#include <stdbool.h>
>>> +#include <stdint.h>
>>> +#include <stdio.h>
>>> +
>>> +#include <rte_compat.h>
>>> +
>>> +#ifdef __cplusplus
>>> +extern "C" {
>>> +#endif
>>> +
>>> +#define RTE_MEMAREA_NAMESIZE 64
>>> +
>>> +/**
>>> + * Memarea memory source.
>>> + */
>>> +enum rte_memarea_source {
>>> + /** Memory source comes from rte memory. */
>>> + RTE_MEMAREA_SOURCE_RTE_MEMORY,
>>> + /** Memory source comes from system API. */
>>> + RTE_MEMAREA_SOURCE_SYSTEM_API,
>>> + /** Memory source comes from user-provided address. */
>>> + RTE_MEMAREA_SOURCE_USER_ADDR,
>>> + /** Memory source comes from user-provided memarea. */
>>> + RTE_MEMAREA_SOURCE_USER_MEMAREA,
>>> +};
>>> +
>>> +/**
>>> + * Memarea memory management algorithm.
>>> + */
>>> +enum rte_memarea_alg {
>>> + /* The default management algorithm is a variant of the next fit
>>> + * algorithm. It uses a free-list to apply for memory and uses an
>>> + * element-list in ascending order of address to support merging
>>> + * upon free.
>>> + */
>>> + RTE_MEMAREA_ALG_DEFAULT,
>>> +};
Do you need to expose the algorithm/management scheme option in the
public API, if there is only one implementation to choose from?
You can always have a rte_memarea_create_alg(/../) in the future, or
just change the signature between ABI-breaking releases.
Also, shouldn't the default algorithm have name? Rather than just
DEFAULT. RTE_MEMAREA_ALG_NEXTFIT maybe.
>>> +
>>> +struct rte_memarea;
>>> +
>>> +struct rte_memarea_param {
>>
>> Does this struct need to be public?
>
> Yes, the rte_memarea_param contains create parameters for create memarea which need be public.
>
Why isn't the public API just a bunch of create-function parameters? Or,
alternatively, you have an assortment of create functions, for different
combinations of parameters. Then you don't have to think about having
reserved bits or other kind of ABI-related issues due to the struct
being public.
> And rte_memarea which pointer implementation struction which just a declare here.
>
>>
>>> + char name[RTE_MEMAREA_NAMESIZE]; /**< Name of memarea. */
>>> + enum rte_memarea_source source; /**< Memory source of memarea. */
>>> + enum rte_memarea_alg alg; /**< Memory management algorithm. */
>>> + size_t total_sz; /**< total size (bytes) of memarea. */
>>> + /** Indicates whether the memarea API should be MT-safe. */
>>> + uint32_t mt_safe : 1;
>>
>> Why not bool?
>
> Use bit field other than bool will provides more reserved field.
>
>>
>>> + union {
>>> + /** Numa socket from which to apply for memarea's memory, this
>>> + * field is valid only when the source is set to be
>>> + * RTE_MEMAREA_SOURCE_RTE_MEMORY.
>>> + */
>>> + int numa_socket;
>>> + /** User provided address, this field is valid only when the
>>> + * source is set to be RTE_MEMAREA_SOURCE_USER_ADDR.
>>> + * Note: the provided address must align at least
>>> + * RTE_CACHE_LINE_SIZE.
>>> + */
>>> + void *user_addr;
>>> + /** User provided memarea, this field is valid only when the
>>> + * source is set to be RTE_MEMAREA_SOURCE_USER_MEMAREA.
>>> + */
>>> + struct rte_memarea *user_memarea;
>>> + };
>>> +};
>>> +
>>> +/**
>>> + * @warning
>>> + * @b EXPERIMENTAL: this API may change without prior notice.
>>> + *
>>> + * Create memarea.
>>> + *
>>> + * Create one new memarea.
>>> + *
>>> + * @param init
>>> + * The init parameter of memarea.
>>> + *
>>> + * @return
>>> + * Non-NULL on success. Otherwise NULL is returned.
>>> + */
>>> +__rte_experimental
>>> +struct rte_memarea *rte_memarea_create(const struct rte_memarea_param *init);
>>> +
>>> +/**
>>> + * @warning
>>> + * @b EXPERIMENTAL: this API may change without prior notice.
>>> + *
>>> + * Destroy memarea.
>>> + *
>>> + * Destroy the memarea.
>>> + *
>>> + * @param ma
>>> + * The pointer of memarea.
>>> + */
>>> +__rte_experimental
>>> +void rte_memarea_destroy(struct rte_memarea *ma);
>>> +
>>> +#ifdef __cplusplus
>>> +}
>>> +#endif
>>> +
>>> +#endif /* RTE_MEMAREA_H */
>>> diff --git a/lib/memarea/version.map b/lib/memarea/version.map
>>> new file mode 100644
>>> index 0000000000..f36a04d7cf
>>> --- /dev/null
>>> +++ b/lib/memarea/version.map
>>> @@ -0,0 +1,12 @@
>>> +EXPERIMENTAL {
>>> + global:
>>> +
>>> + rte_memarea_create;
>>> + rte_memarea_destroy;
>>> +
>>> + local: *;
>>> +};
>>> +
>>> +INTERNAL {
>>> + local: *;
>>> +};
>>> diff --git a/lib/meson.build b/lib/meson.build
>>> index c648f7d800..521a25d6c0 100644
>>> --- a/lib/meson.build
>>> +++ b/lib/meson.build
>>> @@ -42,6 +42,7 @@ libraries = [
>>> 'kni',
>>> 'latencystats',
>>> 'lpm',
>>> + 'memarea',
>>> 'member',
>>> 'pcapng',
>>> 'power',
>>
>> .
^ permalink raw reply [relevance 4%]
* [PATCH] vhost: promote per-queue stats API to stable
@ 2022-10-10 15:37 4% Maxime Coquelin
2022-10-17 13:22 0% ` David Marchand
` (2 more replies)
0 siblings, 3 replies; 200+ results
From: Maxime Coquelin @ 2022-10-10 15:37 UTC (permalink / raw)
To: dev, chenbo.xia, david.marchand; +Cc: Maxime Coquelin
This patch promotes the per-queue stats API to stable.
The API has been used by the Vhost PMD since v22.07, and
David Marchand posted a patch to make use of it in next
OVS release[0].
[0]: http://patchwork.ozlabs.org/project/openvswitch/patch/20221007111613.1695524-4-david.marchand@redhat.com/
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
doc/guides/rel_notes/release_22_11.rst | 4 ++++
lib/vhost/rte_vhost.h | 3 ---
lib/vhost/version.map | 6 +++---
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 37bd392f34..d5d3eeae24 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -443,6 +443,10 @@ API Changes
* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+* vhost: Promoted ``rte_vhost_vring_stats_get()``,
+ ``rte_vhost_vring_stats_get_names()`` and ``rte_vhost_vring_stats_reset()``
+ from experimental to stable.
+
ABI Changes
-----------
diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index bb7d86a432..59c98a0afb 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -1075,7 +1075,6 @@ rte_vhost_slave_config_change(int vid, bool need_reply);
* - Failure if lower than 0. The device ID or queue ID is invalid or
+ statistics collection is not enabled.
*/
-__rte_experimental
int
rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id,
struct rte_vhost_stat_name *name, unsigned int size);
@@ -1103,7 +1102,6 @@ rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id,
* - Failure if lower than 0. The device ID or queue ID is invalid, or
* statistics collection is not enabled.
*/
-__rte_experimental
int
rte_vhost_vring_stats_get(int vid, uint16_t queue_id,
struct rte_vhost_stat *stats, unsigned int n);
@@ -1120,7 +1118,6 @@ rte_vhost_vring_stats_get(int vid, uint16_t queue_id,
* - Failure if lower than 0. The device ID or queue ID is invalid, or
* statistics collection is not enabled.
*/
-__rte_experimental
int
rte_vhost_vring_stats_reset(int vid, uint16_t queue_id);
diff --git a/lib/vhost/version.map b/lib/vhost/version.map
index 7a00b65740..8c5e8aa8d3 100644
--- a/lib/vhost/version.map
+++ b/lib/vhost/version.map
@@ -57,6 +57,9 @@ DPDK_23 {
rte_vhost_set_vring_base;
rte_vhost_va_from_guest_pa;
rte_vhost_vring_call;
+ rte_vhost_vring_stats_get;
+ rte_vhost_vring_stats_get_names;
+ rte_vhost_vring_stats_reset;
local: *;
};
@@ -88,9 +91,6 @@ EXPERIMENTAL {
# added in 22.07
rte_vhost_async_get_inflight_thread_unsafe;
- rte_vhost_vring_stats_get_names;
- rte_vhost_vring_stats_get;
- rte_vhost_vring_stats_reset;
rte_vhost_async_try_dequeue_burst;
rte_vhost_driver_get_vdpa_dev_type;
rte_vhost_clear_queue;
--
2.37.3
^ permalink raw reply [relevance 4%]
* [PATCH v3 2/3] kni: add deprecation warning at runtime
@ 2022-10-10 10:44 4% ` Bruce Richardson
0 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2022-10-10 10:44 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson
When KNI is being used at runtime, output a warning message about its
deprecated status. This is part of the deprecation process for KNI
agreed by the DPDK technical board.[1]
[1] http://mails.dpdk.org/archives/dev/2022-June/243596.html
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
doc/guides/rel_notes/deprecation.rst | 6 ++----
lib/kni/rte_kni.c | 2 ++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 7c74725968..41e81be6ae 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -37,10 +37,8 @@ Deprecation Notices
applications - other technologies such as virtio-user are recommended instead.
Following the DPDK technical board
`decision <https://mails.dpdk.org/archives/dev/2021-January/197077.html>`_
- and `refinement <http://mails.dpdk.org/archives/dev/2022-June/243596.html>`_:
-
- * Some deprecation warnings will be added in DPDK 22.11.
- * The KNI kernel module, library and PMD will be removed from the DPDK 23.11.
+ and `refinement <http://mails.dpdk.org/archives/dev/2022-June/243596.html>`_,
+ the KNI kernel module, library and PMD will be removed from the DPDK 23.11 release.
* lib: will fix extending some enum/define breaking the ABI. There are multiple
samples in DPDK that enum/define terminated with a ``.*MAX.*`` value which is
diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c
index 7971c56bb4..eb7c10ff19 100644
--- a/lib/kni/rte_kni.c
+++ b/lib/kni/rte_kni.c
@@ -96,6 +96,8 @@ static volatile int kni_fd = -1;
int
rte_kni_init(unsigned int max_kni_ifaces __rte_unused)
{
+ RTE_LOG(WARNING, KNI, "WARNING: KNI is deprecated and will be removed in DPDK 23.11\n");
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
if (rte_eal_iova_mode() != RTE_IOVA_PA) {
RTE_LOG(ERR, KNI, "KNI requires IOVA as PA\n");
--
2.34.1
^ permalink raw reply [relevance 4%]
* Re: [PATCH v11 1/5] ethdev: support get port error handling mode
@ 2022-10-10 8:38 3% ` Andrew Rybchenko
0 siblings, 0 replies; 200+ results
From: Andrew Rybchenko @ 2022-10-10 8:38 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit, ferruh.yigit
Cc: dev, kalesh-anakkur.purayil, somnath.kotur, ajit.khaparde, mdr,
Stephen Hemminger
On 10/9/22 12:10, Chengwen Feng wrote:
> This patch support gets port's error handling mode by
> rte_eth_dev_info_get() API.
Just: "Add error handling mode to device info."
>
> Currently, the defined modes include:
> 1) NONE: it means no error handling modes are supported by this port.
> 2) PASSIVE: passive error handling, after the PMD detect that a reset
> is required, the PMD reports RTE_ETH_EVENT_INTR_RESET event, and
> application invoke rte_eth_dev_reset() to recover the port.
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
With review notes applied (may be except usage of reserved
fields):
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index e8d1e1c658..3443bf20e1 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -1629,6 +1629,22 @@ enum rte_eth_representor_type {
> RTE_ETH_REPRESENTOR_PF, /**< representor of Physical Function. */
> };
>
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this enumeration may change without prior notice.
> + *
> + * Ethernet device error handling mode.
> + */
> +enum rte_eth_err_handle_mode {
> + /** No error handling modes are supported. */
> + RTE_ETH_ERROR_HANDLE_MODE_NONE,
> + /** Passive error handling, after the PMD detect that a reset is
> + * required, the PMD reports @see RTE_ETH_EVENT_INTR_RESET event, and
> + * application invoke @see rte_eth_dev_reset to recover the port.
> + */
> + RTE_ETH_ERROR_HANDLE_MODE_PASSIVE,
> +};
> +
> /**
> * A structure used to retrieve the contextual information of
> * an Ethernet device, such as the controlling driver of the
> @@ -1689,8 +1705,12 @@ struct rte_eth_dev_info {
> * embedded managed interconnect/switch.
> */
> struct rte_eth_switch_info switch_info;
> + /** Supported error handling mode. @see enum rte_eth_err_handle_mode */
> + uint8_t err_handle_mode;
IMHO, it must be
enum rte_eth_err_handle_mode err_handle_mode;
Yes, it takes a bit more space, but it is a control path and
code clearness is more important here than few extra bytes.
>
> - uint64_t reserved_64s[2]; /**< Reserved for future fields */
> + uint8_t reserved_8; /**< Reserved for future fields */
> + uint16_t reserved_16s[3]; /**< Reserved for future fields */
> + uint64_t reserved_64; /**< Reserved for future fields */
As far as I know it is done as per Stephen review notes, but
I'm not really sure why it is a right way in ABI breaking
release. I'd not touch it and just add a new field.
> void *reserved_ptrs[2]; /**< Reserved for future fields */
> };
>
^ permalink raw reply [relevance 3%]
* RE: [PATCH v6 3/4] mempool: fix cache flushing algorithm
2022-10-09 14:51 0% ` Andrew Rybchenko
@ 2022-10-09 15:08 0% ` Morten Brørup
2022-10-14 14:01 3% ` Olivier Matz
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-10-09 15:08 UTC (permalink / raw)
To: Andrew Rybchenko, Olivier Matz; +Cc: dev, Bruce Richardson
> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> Sent: Sunday, 9 October 2022 16.52
>
> On 10/9/22 17:31, Morten Brørup wrote:
> >> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> >> Sent: Sunday, 9 October 2022 15.38
> >>
> >> From: Morten Brørup <mb@smartsharesystems.com>
> >>
[...]
> >> --- a/lib/mempool/rte_mempool.h
> >> +++ b/lib/mempool/rte_mempool.h
> >> @@ -90,7 +90,7 @@ struct rte_mempool_cache {
> >> * Cache is allocated to this size to allow it to overflow in
> >> certain
> >> * cases to avoid needless emptying of cache.
> >> */
> >> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache objects */
> >> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache objects */
> >> } __rte_cache_aligned;
> >
> > How much are we allowed to break the ABI here?
> >
> > This patch reduces the size of the structure by removing a now unused
> part at the end, which should be harmless.
> >
> > If we may also move the position of the objs array, I would add
> __rte_cache_aligned to the objs array. It makes no difference in the
> general case, but if get/put operations are always 32 objects, it will
> reduce the number of memory (or last level cache) accesses from five to
> four 64 B cache lines for every get/put operation.
> >
> > uint32_t len; /**< Current cache count */
> > - /*
> > - * Cache is allocated to this size to allow it to overflow in
> certain
> > - * cases to avoid needless emptying of cache.
> > - */
> > - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache objects */
> > + /**
> > + * Cache objects
> > + *
> > + * Cache is allocated to this size to allow it to overflow in
> certain
> > + * cases to avoid needless emptying of cache.
> > + */
> > + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2] __rte_cache_aligned;
> > } __rte_cache_aligned;
>
> I think aligning objs on cacheline should be a separate patch.
Good point. I'll let you do it. :-)
PS: Thank you for following up on this patch series, Andrew!
-Morten
^ permalink raw reply [relevance 0%]
* Re: [PATCH v6 3/4] mempool: fix cache flushing algorithm
2022-10-09 14:31 3% ` Morten Brørup
@ 2022-10-09 14:51 0% ` Andrew Rybchenko
2022-10-09 15:08 0% ` Morten Brørup
0 siblings, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-10-09 14:51 UTC (permalink / raw)
To: Morten Brørup, Olivier Matz; +Cc: dev, Bruce Richardson
On 10/9/22 17:31, Morten Brørup wrote:
>> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
>> Sent: Sunday, 9 October 2022 15.38
>>
>> From: Morten Brørup <mb@smartsharesystems.com>
>>
>> Fix the rte_mempool_do_generic_put() caching flushing algorithm to
>> keep hot objects in cache instead of cold ones.
>>
>> The algorithm was:
>> 1. Add the objects to the cache.
>> 2. Anything greater than the cache size (if it crosses the cache flush
>> threshold) is flushed to the backend.
>>
>> Please note that the description in the source code said that it kept
>> "cache min value" objects after flushing, but the function actually
>> kept
>> the cache full after flushing, which the above description reflects.
>>
>> Now, the algorithm is:
>> 1. If the objects cannot be added to the cache without crossing the
>> flush threshold, flush some cached objects to the backend to
>> free up required space.
>> 2. Add the objects to the cache.
>>
>> The most recent (hot) objects were flushed, leaving the oldest (cold)
>> objects in the mempool cache. The bug degraded performance, because
>> flushing prevented immediate reuse of the (hot) objects already in
>> the CPU cache. Now, the existing (cold) objects in the mempool cache
>> are flushed before the new (hot) objects are added the to the mempool
>> cache.
>>
>> Since nearby code is touched anyway fix flush threshold comparison
>> to do flushing if the threshold is really exceed, not just reached.
>> I.e. it must be "len > flushthresh", not "len >= flushthresh".
>> Consider a flush multiplier of 1 instead of 1.5; the cache would be
>> flushed already when reaching size objects, not when exceeding size
>> objects. In other words, the cache would not be able to hold "size"
>> objects, which is clearly a bug. The bug could degraded performance
>> due to premature flushing.
>>
>> Since we never exceed flush threshold now, cache size in the mempool
>> may be decreased from RTE_MEMPOOL_CACHE_MAX_SIZE * 3 to
>> RTE_MEMPOOL_CACHE_MAX_SIZE * 2. In fact it could be
>> CALC_CACHE_FLUSHTHRESH(RTE_MEMPOOL_CACHE_MAX_SIZE), but flush
>> threshold multiplier is internal.
>>
>> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
>> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> ---
>
> [...]
>
>> --- a/lib/mempool/rte_mempool.h
>> +++ b/lib/mempool/rte_mempool.h
>> @@ -90,7 +90,7 @@ struct rte_mempool_cache {
>> * Cache is allocated to this size to allow it to overflow in
>> certain
>> * cases to avoid needless emptying of cache.
>> */
>> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache objects */
>> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache objects */
>> } __rte_cache_aligned;
>
> How much are we allowed to break the ABI here?
>
> This patch reduces the size of the structure by removing a now unused part at the end, which should be harmless.
>
> If we may also move the position of the objs array, I would add __rte_cache_aligned to the objs array. It makes no difference in the general case, but if get/put operations are always 32 objects, it will reduce the number of memory (or last level cache) accesses from five to four 64 B cache lines for every get/put operation.
>
> uint32_t len; /**< Current cache count */
> - /*
> - * Cache is allocated to this size to allow it to overflow in certain
> - * cases to avoid needless emptying of cache.
> - */
> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache objects */
> + /**
> + * Cache objects
> + *
> + * Cache is allocated to this size to allow it to overflow in certain
> + * cases to avoid needless emptying of cache.
> + */
> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2] __rte_cache_aligned;
> } __rte_cache_aligned;
I think aligning objs on cacheline should be a separate patch.
>
> With or without the above suggested optimization...
>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
>
^ permalink raw reply [relevance 0%]
* RE: [PATCH v6 3/4] mempool: fix cache flushing algorithm
@ 2022-10-09 14:31 3% ` Morten Brørup
2022-10-09 14:51 0% ` Andrew Rybchenko
0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-10-09 14:31 UTC (permalink / raw)
To: Andrew Rybchenko, Olivier Matz; +Cc: dev, Bruce Richardson
> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> Sent: Sunday, 9 October 2022 15.38
>
> From: Morten Brørup <mb@smartsharesystems.com>
>
> Fix the rte_mempool_do_generic_put() caching flushing algorithm to
> keep hot objects in cache instead of cold ones.
>
> The algorithm was:
> 1. Add the objects to the cache.
> 2. Anything greater than the cache size (if it crosses the cache flush
> threshold) is flushed to the backend.
>
> Please note that the description in the source code said that it kept
> "cache min value" objects after flushing, but the function actually
> kept
> the cache full after flushing, which the above description reflects.
>
> Now, the algorithm is:
> 1. If the objects cannot be added to the cache without crossing the
> flush threshold, flush some cached objects to the backend to
> free up required space.
> 2. Add the objects to the cache.
>
> The most recent (hot) objects were flushed, leaving the oldest (cold)
> objects in the mempool cache. The bug degraded performance, because
> flushing prevented immediate reuse of the (hot) objects already in
> the CPU cache. Now, the existing (cold) objects in the mempool cache
> are flushed before the new (hot) objects are added the to the mempool
> cache.
>
> Since nearby code is touched anyway fix flush threshold comparison
> to do flushing if the threshold is really exceed, not just reached.
> I.e. it must be "len > flushthresh", not "len >= flushthresh".
> Consider a flush multiplier of 1 instead of 1.5; the cache would be
> flushed already when reaching size objects, not when exceeding size
> objects. In other words, the cache would not be able to hold "size"
> objects, which is clearly a bug. The bug could degraded performance
> due to premature flushing.
>
> Since we never exceed flush threshold now, cache size in the mempool
> may be decreased from RTE_MEMPOOL_CACHE_MAX_SIZE * 3 to
> RTE_MEMPOOL_CACHE_MAX_SIZE * 2. In fact it could be
> CALC_CACHE_FLUSHTHRESH(RTE_MEMPOOL_CACHE_MAX_SIZE), but flush
> threshold multiplier is internal.
>
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
[...]
> --- a/lib/mempool/rte_mempool.h
> +++ b/lib/mempool/rte_mempool.h
> @@ -90,7 +90,7 @@ struct rte_mempool_cache {
> * Cache is allocated to this size to allow it to overflow in
> certain
> * cases to avoid needless emptying of cache.
> */
> - void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache objects */
> + void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2]; /**< Cache objects */
> } __rte_cache_aligned;
How much are we allowed to break the ABI here?
This patch reduces the size of the structure by removing a now unused part at the end, which should be harmless.
If we may also move the position of the objs array, I would add __rte_cache_aligned to the objs array. It makes no difference in the general case, but if get/put operations are always 32 objects, it will reduce the number of memory (or last level cache) accesses from five to four 64 B cache lines for every get/put operation.
uint32_t len; /**< Current cache count */
- /*
- * Cache is allocated to this size to allow it to overflow in certain
- * cases to avoid needless emptying of cache.
- */
- void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 3]; /**< Cache objects */
+ /**
+ * Cache objects
+ *
+ * Cache is allocated to this size to allow it to overflow in certain
+ * cases to avoid needless emptying of cache.
+ */
+ void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2] __rte_cache_aligned;
} __rte_cache_aligned;
With or without the above suggested optimization...
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [relevance 3%]
* [PATCH v6 0/4] mempool: fix mempool cache flushing algorithm
@ 2022-10-09 13:37 4% ` Andrew Rybchenko
1 sibling, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-10-09 13:37 UTC (permalink / raw)
To: Olivier Matz; +Cc: dev, Morten Brørup, Bruce Richardson
v6 changes (Andrew Rybchenko):
- Fix spelling
v5 changes (Andrew Rybchenko):
- Factor out cosmetic fixes into separate patches to make all
patches smaller and easier to review
- Remove extra check as per review notes
- Factor out entire cache flushing into a separate patch.
It is nice from logical changes separation point of view,
easier to bisect and revert.
v4 changes:
- Updated patch title to reflect that the scope of the patch is only
mempool cache flushing.
- Do not replace rte_memcpy() with alternative copying method. This was
a pure optimization, not a fix.
- Elaborate even more on the bugs fixed by the modifications.
- Added 4th bullet item to the patch description, regarding
rte_mempool_ops_enqueue_bulk() with RTE_LIBRTE_MEMPOOL_DEBUG.
v3 changes:
- Actually remove my modifications of the rte_mempool_cache structure.
v2 changes:
- Not adding the new objects to the mempool cache before flushing it
also allows the memory allocated for the mempool cache to be reduced
from 3 x to 2 x RTE_MEMPOOL_CACHE_MAX_SIZE.
However, such this change would break the ABI, so it was removed in v2.
- The mempool cache should be cache line aligned for the benefit of the
copying method, which on some CPU architectures performs worse on data
crossing a cache boundary.
However, such this change would break the ABI, so it was removed in v2;
and yet another alternative copying method replaced the rte_memcpy().
Andrew Rybchenko (3):
mempool: check driver enqueue result in one place
mempool: avoid usage of term ring on put
mempool: flush cache completely on overflow
Morten Brørup (1):
mempool: fix cache flushing algorithm
lib/mempool/rte_mempool.c | 5 ++++
lib/mempool/rte_mempool.h | 55 ++++++++++++++++++++-------------------
2 files changed, 33 insertions(+), 27 deletions(-)
--
2.30.2
^ permalink raw reply [relevance 4%]
* [PATCH v5 0/4] mempool: fix mempool cache flushing algorithm
@ 2022-10-09 13:25 4% Andrew Rybchenko
0 siblings, 0 replies; 200+ results
From: Andrew Rybchenko @ 2022-10-09 13:25 UTC (permalink / raw)
To: Olivier Matz; +Cc: dev, Morten Brørup, Bruce Richardson
v5 changes (Andrew Rybchenko):
- Factor out cosmetic fixes into separate patches to make all
patches smaller and easier to review
- Remove extra check as per review notes
- Factor out entire cache flushing into a separate patch.
It is nice from logical changes separation point of view,
easier to bisect and revert.
v4 changes:
- Updated patch title to reflect that the scope of the patch is only
mempool cache flushing.
- Do not replace rte_memcpy() with alternative copying method. This was
a pure optimization, not a fix.
- Elaborate even more on the bugs fixed by the modifications.
- Added 4th bullet item to the patch description, regarding
rte_mempool_ops_enqueue_bulk() with RTE_LIBRTE_MEMPOOL_DEBUG.
v3 changes:
- Actually remove my modifications of the rte_mempool_cache structure.
v2 changes:
- Not adding the new objects to the mempool cache before flushing it
also allows the memory allocated for the mempool cache to be reduced
from 3 x to 2 x RTE_MEMPOOL_CACHE_MAX_SIZE.
However, such this change would break the ABI, so it was removed in v2.
- The mempool cache should be cache line aligned for the benefit of the
copying method, which on some CPU architectures performs worse on data
crossing a cache boundary.
However, such this change would break the ABI, so it was removed in v2;
and yet another alternative copying method replaced the rte_memcpy().
Andrew Rybchenko (3):
mempool: check driver enqueue result in one place
mempool: avoid usage of term ring on put
mempool: flush cache completely on overflow
Morten Brørup (1):
mempool: fix cache flushing algorithm
lib/mempool/rte_mempool.c | 5 ++++
lib/mempool/rte_mempool.h | 55 ++++++++++++++++++++-------------------
2 files changed, 33 insertions(+), 27 deletions(-)
--
2.30.2
^ permalink raw reply [relevance 4%]
* [PATCH v5 5/7] lib: move mbuf next pointer to first cache line
@ 2022-10-07 21:02 5% ` Shijith Thotton
0 siblings, 0 replies; 200+ results
From: Shijith Thotton @ 2022-10-07 21:02 UTC (permalink / raw)
To: dev
Cc: Shijith Thotton, Honnappa.Nagarahalli, bruce.richardson, jerinj,
mb, olivier.matz, stephen, thomas
Swapped position of mbuf next pointer and second dynamic field (dynfield2)
if the build is configured to disable IOVA as PA. This is to move the
mbuf next pointer to first cache line.
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
doc/guides/rel_notes/release_22_11.rst | 3 +++
lib/mbuf/rte_mbuf_core.h | 19 ++++++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 7431dda461..ab69db8d70 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -385,6 +385,9 @@ ABI Changes
* eventdev: Added ``weight`` and ``affinity`` fields
to ``rte_event_queue_conf`` structure.
+* mbuf: Replaced ``buf_iova`` field with ``next`` field and added a new field
+ ``dynfield2`` at its place in second cacheline if ``RTE_IOVA_AS_PA`` is 0.
+
Known Issues
------------
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index dc6c54015e..37d3fcc3b8 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -479,10 +479,11 @@ struct rte_mbuf {
rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
#else
/**
- * Reserved for dynamic field in builds where physical address
- * field is undefined.
+ * Next segment of scattered packet.
+ * This field is valid when physical address field is undefined.
+ * Otherwise next pointer in the second cache line will be used.
*/
- uint64_t dynfield2;
+ struct rte_mbuf *next;
#endif
/* next 8 bytes are initialised on RX descriptor rearm */
@@ -599,11 +600,19 @@ struct rte_mbuf {
/* second cache line - fields only used in slow path or on TX */
RTE_MARKER cacheline1 __rte_cache_min_aligned;
+#if RTE_IOVA_AS_PA
/**
- * Next segment of scattered packet. Must be NULL in the last segment or
- * in case of non-segmented packet.
+ * Next segment of scattered packet. Must be NULL in the last
+ * segment or in case of non-segmented packet.
*/
struct rte_mbuf *next;
+#else
+ /**
+ * Reserved for dynamic field when the next pointer is in first
+ * cache line (i.e. RTE_IOVA_AS_PA is 0).
+ */
+ uint64_t dynfield2;
+#endif
/* fields to support TX offloads */
RTE_STD_C11
--
2.25.1
^ permalink raw reply [relevance 5%]
* [PATCH v4 5/7] lib: move mbuf next pointer to first cache line
@ 2022-10-07 19:30 5% ` Shijith Thotton
1 sibling, 0 replies; 200+ results
From: Shijith Thotton @ 2022-10-07 19:30 UTC (permalink / raw)
To: dev
Cc: Shijith Thotton, Honnappa.Nagarahalli, bruce.richardson, jerinj,
mb, olivier.matz, stephen, thomas, ferruh.yigit, pbhagavatula
Swapped position of mbuf next pointer and second dynamic field (dynfield2)
if the build is configured to disable IOVA as PA. This is to move the
mbuf next pointer to first cache line.
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
doc/guides/rel_notes/release_22_11.rst | 3 +++
lib/mbuf/rte_mbuf_core.h | 19 ++++++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 0b4740abd1..006d1f5988 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -269,6 +269,9 @@ ABI Changes
* eventdev: Added ``weight`` and ``affinity`` fields
to ``rte_event_queue_conf`` structure.
+* mbuf: Replaced ``buf_iova`` field with ``next`` field and added a new field
+ ``dynfield2`` at its place in second cacheline if ``RTE_IOVA_AS_PA`` is 0.
+
Known Issues
------------
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index dc6c54015e..37d3fcc3b8 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -479,10 +479,11 @@ struct rte_mbuf {
rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
#else
/**
- * Reserved for dynamic field in builds where physical address
- * field is undefined.
+ * Next segment of scattered packet.
+ * This field is valid when physical address field is undefined.
+ * Otherwise next pointer in the second cache line will be used.
*/
- uint64_t dynfield2;
+ struct rte_mbuf *next;
#endif
/* next 8 bytes are initialised on RX descriptor rearm */
@@ -599,11 +600,19 @@ struct rte_mbuf {
/* second cache line - fields only used in slow path or on TX */
RTE_MARKER cacheline1 __rte_cache_min_aligned;
+#if RTE_IOVA_AS_PA
/**
- * Next segment of scattered packet. Must be NULL in the last segment or
- * in case of non-segmented packet.
+ * Next segment of scattered packet. Must be NULL in the last
+ * segment or in case of non-segmented packet.
*/
struct rte_mbuf *next;
+#else
+ /**
+ * Reserved for dynamic field when the next pointer is in first
+ * cache line (i.e. RTE_IOVA_AS_PA is 0).
+ */
+ uint64_t dynfield2;
+#endif
/* fields to support TX offloads */
RTE_STD_C11
--
2.25.1
^ permalink raw reply [relevance 5%]
* [PATCH v2 2/3] kni: add deprecation warning at runtime
@ 2022-10-07 15:01 4% ` Bruce Richardson
0 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2022-10-07 15:01 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson
When KNI is being used at runtime, output a warning message about its
deprecated status. This is part of the deprecation process for KNI
agreed by the DPDK technical board.[1]
[1] http://mails.dpdk.org/archives/dev/2022-June/243596.html
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 6 ++----
lib/kni/rte_kni.c | 2 ++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 7c74725968..41e81be6ae 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -37,10 +37,8 @@ Deprecation Notices
applications - other technologies such as virtio-user are recommended instead.
Following the DPDK technical board
`decision <https://mails.dpdk.org/archives/dev/2021-January/197077.html>`_
- and `refinement <http://mails.dpdk.org/archives/dev/2022-June/243596.html>`_:
-
- * Some deprecation warnings will be added in DPDK 22.11.
- * The KNI kernel module, library and PMD will be removed from the DPDK 23.11.
+ and `refinement <http://mails.dpdk.org/archives/dev/2022-June/243596.html>`_,
+ the KNI kernel module, library and PMD will be removed from the DPDK 23.11 release.
* lib: will fix extending some enum/define breaking the ABI. There are multiple
samples in DPDK that enum/define terminated with a ``.*MAX.*`` value which is
diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c
index 7971c56bb4..eb7c10ff19 100644
--- a/lib/kni/rte_kni.c
+++ b/lib/kni/rte_kni.c
@@ -96,6 +96,8 @@ static volatile int kni_fd = -1;
int
rte_kni_init(unsigned int max_kni_ifaces __rte_unused)
{
+ RTE_LOG(WARNING, KNI, "WARNING: KNI is deprecated and will be removed in DPDK 23.11\n");
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
if (rte_eal_iova_mode() != RTE_IOVA_PA) {
RTE_LOG(ERR, KNI, "KNI requires IOVA as PA\n");
--
2.34.1
^ permalink raw reply [relevance 4%]
* Re: [PATCH v5 1/3] ethdev: support mulitiple mbuf pools per Rx queue
@ 2022-10-07 14:13 3% ` Andrew Rybchenko
0 siblings, 0 replies; 200+ results
From: Andrew Rybchenko @ 2022-10-07 14:13 UTC (permalink / raw)
To: Stephen Hemminger, Hanumanth Pothula
Cc: Thomas Monjalon, Ferruh Yigit, dev, xuan.ding, wenxuanx.wu,
xiaoyun.li, yuanx.wang, mdr, yuying.zhang, qi.z.zhang,
viacheslavo, jerinj, ndabilpuram
On 10/6/22 20:29, Stephen Hemminger wrote:
> On Thu, 6 Oct 2022 22:31:24 +0530
> Hanumanth Pothula <hpothula@marvell.com> wrote:
>
>> + /**
>> + * Points to an array of mempools.
>> + *
>> + * Valid only when RTE_ETH_RX_OFFLOAD_MUL_MEMPOOL flag is set in
>> + * Rx offloads.
>> + *
>> + * This provides support for multiple mbuf pools per Rx queue.
>> + *
>> + * This is often useful for saving the memory where the application can
>> + * create a different pools to steer the specific size of the packet, thus
>> + * enabling effective use of memory.
>> + *
>> + * Note that on Rx scatter enable, a packet may be delivered using a chain
>> + * of mbufs obtained from single mempool or multiple mempools based on
>> + * the NIC implementation.
>> + */
>> + struct rte_mempool **rx_mempools;
>> + uint16_t rx_npool; /** < number of mempools */
>> +
>> uint64_t reserved_64s[2]; /**< Reserved for future fields */
>> void *reserved_ptrs[2]; /**< Reserved for future fields */
>
> Better and safer to just take up some of those existing reserved fields.
>
I don't understand why. We're braking ABI anyway.
^ permalink raw reply [relevance 3%]
* Re: [EXT] [PATCH v4] ethdev: support congestion management
2022-10-07 6:09 0% ` [EXT] " Sunil Kumar Kori
@ 2022-10-07 10:07 0% ` Andrew Rybchenko
0 siblings, 0 replies; 200+ results
From: Andrew Rybchenko @ 2022-10-07 10:07 UTC (permalink / raw)
To: Sunil Kumar Kori, Ferruh Yigit, Thomas Monjalon, Ray Kinsella
Cc: dev, Jerin Jacob Kollanukkaran
On 10/7/22 09:09, Sunil Kumar Kori wrote:
>> -----Original Message-----
>> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> Sent: Tuesday, October 4, 2022 2:33 PM
>> To: Ferruh Yigit <ferruh.yigit@amd.com>; Thomas Monjalon
>> <thomas@monjalon.net>; Ray Kinsella <mdr@ashroe.eu>
>> Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Sunil
>> Kumar Kori <skori@marvell.com>
>> Subject: [EXT] [PATCH v4] ethdev: support congestion management
>>
>> External Email
>>
>> ----------------------------------------------------------------------
>> From: Jerin Jacob <jerinj@marvell.com>
>>
>> NIC HW controllers often come with congestion management support on
>> various HW objects such as Rx queue depth or mempool queue depth.
>>
>> Also, it can support various modes of operation such as RED (Random early
>> discard), WRED etc on those HW objects.
>>
>> Add a framework to express such modes(enum rte_cman_mode) and
>> introduce (enum rte_eth_cman_obj) to enumerate the different objects
>> where the modes can operate on.
>>
>> Add RTE_CMAN_RED mode of operation and
>> RTE_ETH_CMAN_OBJ_RX_QUEUE,
>> RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL objects.
>>
>> Introduce reserved fields in configuration structure backed by
>> rte_eth_cman_config_init() to add new configuration parameters without
>> ABI breakage.
>>
>> Add rte_eth_cman_info_get() API to get the information such as supported
>> modes and objects.
>>
>> Add rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs to
>> configure congestion management on those object with associated mode.
>>
>> Finally, add rte_eth_cman_config_get() API to retrieve the applied
>> configuration.
>>
>> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
>> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
>> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> ---
>> v3..v4: Andrew Rybchenko
>> - rebase
>> - remove eth_check_err() and use eth_err() instead
>> - minor fixes in description to avoid "This patch" and "Added".
>> - correct position in release notes
>> v2..v3:
>> - Rename rte_cman.c to rte_ethdev_cman.c
>> - Move lib/eal/include/rte_cman.h to lib/ethdev/rte_cman.h
>> - Fix review comments (Andrew Rybchenko)
>> - Add release notes
>>
>> v1..v2:
>> - Fix review comments (Akhil Goyal)
>>
>> rfc..v1:
>> - Added RED specification
>> (https://urldefense.proofpoint.com/v2/url?u=http-
>> 3A__www.aciri.org_floyd_papers_red_red.html&d=DwIDAg&c=nKjWec2b6R
>> 0mOyPaz7xtfQ&r=dXeXaAMkP5COgn1zxHMyaF1_d9IIuq6vHQO6NrIPjaE&m=
>> cfAKlvyly-
>> kCcVREQz1PWXyTolJrljsQUlj1VPUP5Y3GmvOpjvj66NNuJgv8sAYy&s=Ku1odzug
>> BjIDA-mJnbb5p6GViFoSxYlzqBr4RshwYtg&e= ) link
>> - Fixed doxygen comment issue (Min Hu)
>>
>> doc/guides/nics/features.rst | 12 ++
>> doc/guides/nics/features/default.ini | 1 +
>> doc/guides/rel_notes/release_22_11.rst | 6 +
>> lib/ethdev/ethdev_driver.h | 25 ++++
>> lib/ethdev/ethdev_private.h | 3 +
>> lib/ethdev/meson.build | 2 +
>> lib/ethdev/rte_cman.h | 55 +++++++++
>> lib/ethdev/rte_ethdev.c | 2 +-
>> lib/ethdev/rte_ethdev.h | 164 +++++++++++++++++++++++++
>> lib/ethdev/rte_ethdev_cman.c | 101 +++++++++++++++
>> lib/ethdev/version.map | 4 +
>> 11 files changed, 374 insertions(+), 1 deletion(-) create mode 100644
>> lib/ethdev/rte_cman.h create mode 100644 lib/ethdev/rte_ethdev_cman.c
>>
>
>
> [snip]
>
>> 2.30.2
>
> Acked-by: Sunil Kumar Kori <skori@marvell.com>
>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [relevance 0%]
* RE: [EXT] [PATCH v4] ethdev: support congestion management
2022-10-04 9:02 2% [PATCH v4] ethdev: support congestion management Andrew Rybchenko
2022-10-06 8:36 0% ` Andrew Rybchenko
@ 2022-10-07 6:09 0% ` Sunil Kumar Kori
2022-10-07 10:07 0% ` Andrew Rybchenko
1 sibling, 1 reply; 200+ results
From: Sunil Kumar Kori @ 2022-10-07 6:09 UTC (permalink / raw)
To: Andrew Rybchenko, Ferruh Yigit, Thomas Monjalon, Ray Kinsella
Cc: dev, Jerin Jacob Kollanukkaran
> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Sent: Tuesday, October 4, 2022 2:33 PM
> To: Ferruh Yigit <ferruh.yigit@amd.com>; Thomas Monjalon
> <thomas@monjalon.net>; Ray Kinsella <mdr@ashroe.eu>
> Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Sunil
> Kumar Kori <skori@marvell.com>
> Subject: [EXT] [PATCH v4] ethdev: support congestion management
>
> External Email
>
> ----------------------------------------------------------------------
> From: Jerin Jacob <jerinj@marvell.com>
>
> NIC HW controllers often come with congestion management support on
> various HW objects such as Rx queue depth or mempool queue depth.
>
> Also, it can support various modes of operation such as RED (Random early
> discard), WRED etc on those HW objects.
>
> Add a framework to express such modes(enum rte_cman_mode) and
> introduce (enum rte_eth_cman_obj) to enumerate the different objects
> where the modes can operate on.
>
> Add RTE_CMAN_RED mode of operation and
> RTE_ETH_CMAN_OBJ_RX_QUEUE,
> RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL objects.
>
> Introduce reserved fields in configuration structure backed by
> rte_eth_cman_config_init() to add new configuration parameters without
> ABI breakage.
>
> Add rte_eth_cman_info_get() API to get the information such as supported
> modes and objects.
>
> Add rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs to
> configure congestion management on those object with associated mode.
>
> Finally, add rte_eth_cman_config_get() API to retrieve the applied
> configuration.
>
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
> v3..v4: Andrew Rybchenko
> - rebase
> - remove eth_check_err() and use eth_err() instead
> - minor fixes in description to avoid "This patch" and "Added".
> - correct position in release notes
> v2..v3:
> - Rename rte_cman.c to rte_ethdev_cman.c
> - Move lib/eal/include/rte_cman.h to lib/ethdev/rte_cman.h
> - Fix review comments (Andrew Rybchenko)
> - Add release notes
>
> v1..v2:
> - Fix review comments (Akhil Goyal)
>
> rfc..v1:
> - Added RED specification
> (https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__www.aciri.org_floyd_papers_red_red.html&d=DwIDAg&c=nKjWec2b6R
> 0mOyPaz7xtfQ&r=dXeXaAMkP5COgn1zxHMyaF1_d9IIuq6vHQO6NrIPjaE&m=
> cfAKlvyly-
> kCcVREQz1PWXyTolJrljsQUlj1VPUP5Y3GmvOpjvj66NNuJgv8sAYy&s=Ku1odzug
> BjIDA-mJnbb5p6GViFoSxYlzqBr4RshwYtg&e= ) link
> - Fixed doxygen comment issue (Min Hu)
>
> doc/guides/nics/features.rst | 12 ++
> doc/guides/nics/features/default.ini | 1 +
> doc/guides/rel_notes/release_22_11.rst | 6 +
> lib/ethdev/ethdev_driver.h | 25 ++++
> lib/ethdev/ethdev_private.h | 3 +
> lib/ethdev/meson.build | 2 +
> lib/ethdev/rte_cman.h | 55 +++++++++
> lib/ethdev/rte_ethdev.c | 2 +-
> lib/ethdev/rte_ethdev.h | 164 +++++++++++++++++++++++++
> lib/ethdev/rte_ethdev_cman.c | 101 +++++++++++++++
> lib/ethdev/version.map | 4 +
> 11 files changed, 374 insertions(+), 1 deletion(-) create mode 100644
> lib/ethdev/rte_cman.h create mode 100644 lib/ethdev/rte_ethdev_cman.c
>
[snip]
> 2.30.2
Acked-by: Sunil Kumar Kori <skori@marvell.com>
^ permalink raw reply [relevance 0%]
* Re: [EXT] Re: [PATCH v4] ethdev: support congestion management
2022-10-06 8:36 0% ` Andrew Rybchenko
@ 2022-10-07 1:56 0% ` Jerin Jacob Kollanukkaran
0 siblings, 0 replies; 200+ results
From: Jerin Jacob Kollanukkaran @ 2022-10-07 1:56 UTC (permalink / raw)
To: Andrew Rybchenko, Ferruh Yigit, Thomas Monjalon, Ray Kinsella
Cc: dev, Sunil Kumar Kori
[-- Attachment #1: Type: text/plain, Size: 21792 bytes --]
Thanks Andrew. Changes are fine with me
________________________________
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Sent: Thursday, October 6, 2022 2:06 PM
To: Ferruh Yigit <ferruh.yigit@amd.com>; Thomas Monjalon <thomas@monjalon.net>; Ray Kinsella <mdr@ashroe.eu>
Cc: dev@dpdk.org <dev@dpdk.org>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Sunil Kumar Kori <skori@marvell.com>
Subject: [EXT] Re: [PATCH v4] ethdev: support congestion management
External Email
----------------------------------------------------------------------
@Jerin, could you confirm if my minor changes are OK for you
and, if so, I'll proceed with applying the patch.
On 10/4/22 12:02, Andrew Rybchenko wrote:
> From: Jerin Jacob <jerinj@marvell.com>
>
> NIC HW controllers often come with congestion management support on
> various HW objects such as Rx queue depth or mempool queue depth.
>
> Also, it can support various modes of operation such as RED
> (Random early discard), WRED etc on those HW objects.
>
> Add a framework to express such modes(enum rte_cman_mode) and
> introduce (enum rte_eth_cman_obj) to enumerate the different
> objects where the modes can operate on.
>
> Add RTE_CMAN_RED mode of operation and RTE_ETH_CMAN_OBJ_RX_QUEUE,
> RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL objects.
>
> Introduce reserved fields in configuration structure
> backed by rte_eth_cman_config_init() to add new configuration
> parameters without ABI breakage.
>
> Add rte_eth_cman_info_get() API to get the information such as
> supported modes and objects.
>
> Add rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs
> to configure congestion management on those object with associated mode.
>
> Finally, add rte_eth_cman_config_get() API to retrieve the
> applied configuration.
>
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
> v3..v4: Andrew Rybchenko
> - rebase
> - remove eth_check_err() and use eth_err() instead
> - minor fixes in description to avoid "This patch" and "Added".
> - correct position in release notes
> v2..v3:
> - Rename rte_cman.c to rte_ethdev_cman.c
> - Move lib/eal/include/rte_cman.h to lib/ethdev/rte_cman.h
> - Fix review comments (Andrew Rybchenko)
> - Add release notes
>
> v1..v2:
> - Fix review comments (Akhil Goyal)
>
> rfc..v1:
> - Added RED specification (https://urldefense.proofpoint.com/v2/url?u=http-3A__www.aciri.org_floyd_papers_red_red.html&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=1DGob4H4rxz6H8uITozGOCa0s5f4wCNtTa4UUKvcsvI&m=kISGqWlRwNHLBHvKCTkVQBoHyBW79qMFQEJNcoDZXb8X4GKLwHVeeE_D3Lh082fx&s=HZKFgpOQ0CtqvK-_Zc-QZn87gBY4UrscDXgFihsXjvQ&e= ) link
> - Fixed doxygen comment issue (Min Hu)
>
> doc/guides/nics/features.rst | 12 ++
> doc/guides/nics/features/default.ini | 1 +
> doc/guides/rel_notes/release_22_11.rst | 6 +
> lib/ethdev/ethdev_driver.h | 25 ++++
> lib/ethdev/ethdev_private.h | 3 +
> lib/ethdev/meson.build | 2 +
> lib/ethdev/rte_cman.h | 55 +++++++++
> lib/ethdev/rte_ethdev.c | 2 +-
> lib/ethdev/rte_ethdev.h | 164 +++++++++++++++++++++++++
> lib/ethdev/rte_ethdev_cman.c | 101 +++++++++++++++
> lib/ethdev/version.map | 4 +
> 11 files changed, 374 insertions(+), 1 deletion(-)
> create mode 100644 lib/ethdev/rte_cman.h
> create mode 100644 lib/ethdev/rte_ethdev_cman.c
>
> diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
> index b4a8e9881c..70ca46e651 100644
> --- a/doc/guides/nics/features.rst
> +++ b/doc/guides/nics/features.rst
> @@ -727,6 +727,18 @@ Supports configuring per-queue stat counter mapping.
> ``rte_eth_dev_set_tx_queue_stats_mapping()``.
>
>
> +.. _nic_features_congestion_management:
> +
> +Congestion management
> +---------------------
> +
> +Supports congestion management.
> +
> +* **[implements] eth_dev_ops**: ``cman_info_get``, ``cman_config_set``, ``cman_config_get``.
> +* **[related] API**: ``rte_eth_cman_info_get()``, ``rte_eth_cman_config_init()``,
> + ``rte_eth_cman_config_set()``, ``rte_eth_cman_config_get()``.
> +
> +
> .. _nic_features_fw_version:
>
> FW version
> diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
> index f7192cb0da..a9c0008ebd 100644
> --- a/doc/guides/nics/features/default.ini
> +++ b/doc/guides/nics/features/default.ini
> @@ -60,6 +60,7 @@ Tx descriptor status =
> Basic stats =
> Extended stats =
> Stats per queue =
> +Congestion management =
> FW version =
> EEPROM dump =
> Module EEPROM dump =
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 44f9a30c6a..0ffa004a9e 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -78,6 +78,12 @@ New Features
> Added new rte_flow action which allows application to re-route packets
> directly to the kernel without software involvement.
>
> +* **Added support for congestion management for ethdev.**
> +
> + Added new APIs ``rte_eth_cman_config_init()``, ``rte_eth_cman_config_get()``,
> + ``rte_eth_cman_config_set()``, ``rte_eth_cman_info_get()``
> + to support congestion management.
> +
> * **Updated Intel iavf driver.**
>
> * Added flow subscription support.
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 8cd8eb8685..e1e2d10a35 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -1094,6 +1094,22 @@ typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
> uint16_t *rx_queue_id,
> uint8_t *avail_thresh);
>
> +/** @internal Get congestion management information. */
> +typedef int (*eth_cman_info_get_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_info *info);
> +
> +/** @internal Init congestion management structure with default values. */
> +typedef int (*eth_cman_config_init_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_config *config);
> +
> +/** @internal Configure congestion management on a port. */
> +typedef int (*eth_cman_config_set_t)(struct rte_eth_dev *dev,
> + const struct rte_eth_cman_config *config);
> +
> +/** @internal Retrieve congestion management configuration of a port. */
> +typedef int (*eth_cman_config_get_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_config *config);
> +
> /**
> * @internal A structure containing the functions exported by an Ethernet driver.
> */
> @@ -1309,6 +1325,15 @@ struct eth_dev_ops {
> eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
> /** Query Rx queue available descriptors threshold event */
> eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
> +
> + /** Get congestion management information */
> + eth_cman_info_get_t cman_info_get;
> + /** Initialize congestion management structure with default values */
> + eth_cman_config_init_t cman_config_init;
> + /** Configure congestion management */
> + eth_cman_config_set_t cman_config_set;
> + /** Retrieve congestion management configuration */
> + eth_cman_config_get_t cman_config_get;
> };
>
> /**
> diff --git a/lib/ethdev/ethdev_private.h b/lib/ethdev/ethdev_private.h
> index cc9879907c..acb4b335c8 100644
> --- a/lib/ethdev/ethdev_private.h
> +++ b/lib/ethdev/ethdev_private.h
> @@ -37,6 +37,9 @@ struct rte_eth_dev_callback {
>
> extern rte_spinlock_t eth_dev_cb_lock;
>
> +/* Convert all error to -EIO if device is removed. */
> +int eth_err(uint16_t port_id, int ret);
> +
> /*
> * Convert rte_eth_dev pointer to port ID.
> * NULL will be translated to RTE_MAX_ETHPORTS.
> diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
> index 47bb2625b0..39250b5da1 100644
> --- a/lib/ethdev/meson.build
> +++ b/lib/ethdev/meson.build
> @@ -8,6 +8,7 @@ sources = files(
> 'ethdev_trace_points.c',
> 'rte_class_eth.c',
> 'rte_ethdev.c',
> + 'rte_ethdev_cman.c',
> 'rte_flow.c',
> 'rte_mtr.c',
> 'rte_tm.c',
> @@ -19,6 +20,7 @@ sources = files(
> )
>
> headers = files(
> + 'rte_cman.h',
> 'rte_ethdev.h',
> 'rte_ethdev_trace.h',
> 'rte_ethdev_trace_fp.h',
> diff --git a/lib/ethdev/rte_cman.h b/lib/ethdev/rte_cman.h
> new file mode 100644
> index 0000000000..297db8e095
> --- /dev/null
> +++ b/lib/ethdev/rte_cman.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2022 Marvell International Ltd.
> + */
> +
> +#ifndef RTE_CMAN_H
> +#define RTE_CMAN_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_bitops.h>
> +
> +/**
> + * @file
> + * Congestion management related parameters for DPDK.
> + */
> +
> +/** Congestion management modes */
> +enum rte_cman_mode {
> + /**
> + * Congestion based on Random Early Detection.
> + *
> + * https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikipedia.org_wiki_Random-5Fearly-5Fdetection&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=1DGob4H4rxz6H8uITozGOCa0s5f4wCNtTa4UUKvcsvI&m=kISGqWlRwNHLBHvKCTkVQBoHyBW79qMFQEJNcoDZXb8X4GKLwHVeeE_D3Lh082fx&s=iyRkqzJBjwu2oS-YMRhtxJOpsK8JWJG5gEH_1DC5pwM&e=
> + * https://urldefense.proofpoint.com/v2/url?u=http-3A__www.aciri.org_floyd_papers_red_red.html&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=1DGob4H4rxz6H8uITozGOCa0s5f4wCNtTa4UUKvcsvI&m=kISGqWlRwNHLBHvKCTkVQBoHyBW79qMFQEJNcoDZXb8X4GKLwHVeeE_D3Lh082fx&s=HZKFgpOQ0CtqvK-_Zc-QZn87gBY4UrscDXgFihsXjvQ&e=
> + * @see struct rte_cman_red_params
> + */
> + RTE_CMAN_RED = RTE_BIT32(0),
> +};
> +
> +/**
> + * RED based congestion management configuration parameters.
> + */
> +struct rte_cman_red_params {
> + /**
> + * Minimum threshold (min_th) value
> + *
> + * Value expressed as percentage. Value must be in 0 to 100(inclusive).
> + */
> + uint8_t min_th;
> + /**
> + * Maximum threshold (max_th) value
> + *
> + * Value expressed as percentage. Value must be in 0 to 100(inclusive).
> + */
> + uint8_t max_th;
> + /** Inverse of packet marking probability maximum value (maxp = 1 / maxp_inv) */
> + uint16_t maxp_inv;
> +};
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* RTE_CMAN_H */
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 0c2c1088c0..e4eb17221b 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -642,7 +642,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
> return -ENODEV;
> }
>
> -static int
> +int
> eth_err(uint16_t port_id, int ret)
> {
> if (ret == 0)
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index a21f58b9cd..8df1cdfad0 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -160,6 +160,7 @@ extern "C" {
> #define RTE_ETHDEV_DEBUG_TX
> #endif
>
> +#include <rte_cman.h>
> #include <rte_compat.h>
> #include <rte_log.h>
> #include <rte_interrupts.h>
> @@ -5314,6 +5315,169 @@ typedef struct {
> __rte_experimental
> int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file);
>
> +/* Congestion management */
> +
> +/** Enumerate list of ethdev congestion management objects */
> +enum rte_eth_cman_obj {
> + /** Congestion management based on Rx queue depth */
> + RTE_ETH_CMAN_OBJ_RX_QUEUE = RTE_BIT32(0),
> + /**
> + * Congestion management based on mempool depth associated with Rx queue
> + * @see rte_eth_rx_queue_setup()
> + */
> + RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL = RTE_BIT32(1),
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
> + *
> + * A structure used to retrieve information of ethdev congestion management.
> + */
> +struct rte_eth_cman_info {
> + /**
> + * Set of supported congestion management modes
> + * @see enum rte_cman_mode
> + */
> + uint64_t modes_supported;
> + /**
> + * Set of supported congestion management objects
> + * @see enum rte_eth_cman_obj
> + */
> + uint64_t objs_supported;
> + /**
> + * Reserved for future fields. Always returned as 0 when
> + * rte_eth_cman_info_get() is invoked
> + */
> + uint8_t rsvd[8];
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
> + *
> + * A structure used to configure the ethdev congestion management.
> + */
> +struct rte_eth_cman_config {
> + /** Congestion management object */
> + enum rte_eth_cman_obj obj;
> + /** Congestion management mode */
> + enum rte_cman_mode mode;
> + union {
> + /**
> + * Rx queue to configure congestion management.
> + *
> + * Valid when object is RTE_ETH_CMAN_OBJ_RX_QUEUE or
> + * RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL.
> + */
> + uint16_t rx_queue;
> + /**
> + * Reserved for future fields.
> + * It must be set to 0 when rte_eth_cman_config_set() is invoked
> + * and will be returned as 0 when rte_eth_cman_config_get() is
> + * invoked.
> + */
> + uint8_t rsvd_obj_params[4];
> + } obj_param;
> + union {
> + /**
> + * RED configuration parameters.
> + *
> + * Valid when mode is RTE_CMAN_RED.
> + */
> + struct rte_cman_red_params red;
> + /**
> + * Reserved for future fields.
> + * It must be set to 0 when rte_eth_cman_config_set() is invoked
> + * and will be returned as 0 when rte_eth_cman_config_get() is
> + * invoked.
> + */
> + uint8_t rsvd_mode_params[4];
> + } mode_param;
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Retrieve the information for ethdev congestion management
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param info
> + * A pointer to a structure of type *rte_eth_cman_info* to be filled with
> + * the information about congestion management.
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_info_get does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info);
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Initialize the ethdev congestion management configuration structure with default values.
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param config
> + * A pointer to a structure of type *rte_eth_cman_config* to be initialized
> + * with default value.
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_config_init does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config);
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Configure ethdev congestion management
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param config
> + * A pointer to a structure of type *rte_eth_cman_config* to be configured.
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_config_set does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config);
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Retrieve the applied ethdev congestion management parameters for the given port.
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param config
> + * A pointer to a structure of type *rte_eth_cman_config* to retrieve
> + * congestion management parameters for the given object.
> + * Application must fill all parameters except mode_param parameter in
> + * struct rte_eth_cman_config.
> + *
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_config_get does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config);
> +
> #include <rte_ethdev_core.h>
>
> /**
> diff --git a/lib/ethdev/rte_ethdev_cman.c b/lib/ethdev/rte_ethdev_cman.c
> new file mode 100644
> index 0000000000..4a1bdd7bd0
> --- /dev/null
> +++ b/lib/ethdev/rte_ethdev_cman.c
> @@ -0,0 +1,101 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2022 Marvell International Ltd.
> + */
> +
> +#include <stdint.h>
> +
> +#include <rte_errno.h>
> +#include "rte_ethdev.h"
> +#include "ethdev_driver.h"
> +#include "ethdev_private.h"
> +
> +/* Get congestion management information for a port */
> +int
> +rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (info == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management info is NULL\n");
> + return -EINVAL;
> + }
> +
> + if (dev->dev_ops->cman_info_get == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
> + return -ENOTSUP;
> + }
> +
> + memset(info, 0, sizeof(struct rte_eth_cman_info));
> + return eth_err(port_id, (*dev->dev_ops->cman_info_get)(dev, info));
> +}
> +
> +/* Initialize congestion management structure with default values */
> +int
> +rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + if (dev->dev_ops->cman_config_init == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
> + return -ENOTSUP;
> + }
> +
> + memset(config, 0, sizeof(struct rte_eth_cman_config));
> + return eth_err(port_id, (*dev->dev_ops->cman_config_init)(dev, config));
> +}
> +
> +/* Configure congestion management on a port */
> +int
> +rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + if (dev->dev_ops->cman_config_set == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
> + return -ENOTSUP;
> + }
> +
> + return eth_err(port_id, (*dev->dev_ops->cman_config_set)(dev, config));
> +}
> +
> +/* Retrieve congestion management configuration of a port */
> +int
> +rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + if (dev->dev_ops->cman_config_get == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
> + return -ENOTSUP;
> + }
> +
> + memset(config, 0, sizeof(struct rte_eth_cman_config));
> + return eth_err(port_id, (*dev->dev_ops->cman_config_get)(dev, config));
> +}
> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
> index 3651ceb234..857d21be1c 100644
> --- a/lib/ethdev/version.map
> +++ b/lib/ethdev/version.map
> @@ -287,6 +287,10 @@ EXPERIMENTAL {
> rte_mtr_meter_vlan_table_update;
>
> # added in 22.11
> + rte_eth_cman_config_get;
> + rte_eth_cman_config_init;
> + rte_eth_cman_config_set;
> + rte_eth_cman_info_get;
> rte_flow_async_action_handle_query;
> rte_mtr_meter_policy_get;
> rte_mtr_meter_profile_get;
[-- Attachment #2: Type: text/html, Size: 36170 bytes --]
^ permalink raw reply [relevance 0%]
* DPDK Deprecation Notice Review Meeting 2022-09-30
@ 2022-10-06 15:14 4% Mcnamara, John
0 siblings, 0 replies; 200+ results
From: Mcnamara, John @ 2022-10-06 15:14 UTC (permalink / raw)
To: dev; +Cc: thomas, david.marchand, orika
[-- Attachment #1: Type: text/plain, Size: 12272 bytes --]
DPDK Deprecation Notice Review Meeting 2022-09-30
=================================================
DPDK Community member met and reviewed the status of the DPDK
deprecation notices prior to the RC1 deadline. The source document
is https://git.dpdk.org/dpdk/tree/doc/guides/rel_notes/deprecation.rst
copied below.
Key messages:
* We should do periodic community reviews of the deprecation notices
and in particular at the start of the yy.11 cycle.
* We could group long standing deprecations notices at the start of
the doc in a section that is separate from the notices that are
specific to the current yy.11.
* Notes to the notices are inline below and prefixed with ">".
Deprecation Notices
-------------------
* kvargs: The function ``rte_kvargs_process`` will get a new parameter
for returning key match count. It will ease handling of no-match case.
> Won't make it into this release.
* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
to update their code.
> This is still relevant to current and future releases.
* eal: The function ``rte_eal_remote_launch`` will return new error codes
after read or write error on the pipe, instead of calling ``rte_panic``.
> partially done may need other rte_panic removed
* rte_atomicNN_xxx: These APIs do not take memory order parameter. This does
not allow for writing optimized code for all the CPU architectures supported
in DPDK. DPDK has adopted the atomic operations from
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html. These
operations must be used for patches that need to be merged in 20.08 onwards.
This change will not introduce any performance degradation.
> This is still relevant to current and future releases.
* rte_smp_*mb: These APIs provide full barrier functionality. However, many
use cases do not require full barriers. To support such use cases, DPDK has
adopted atomic operations from
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html. These
operations and a new wrapper ``rte_atomic_thread_fence`` instead of
``__atomic_thread_fence`` must be used for patches that need to be merged in
20.08 onwards. This change will not introduce any performance degradation.
> This is still relevant to current and future releases.
* bus: The ``dev->device.numa_node`` field is set by each bus driver for
every device it manages to indicate on which NUMA node this device lies.
When this information is unknown, the assigned value is not consistent
across the bus drivers.
In DPDK 22.11, the default value will be set to -1 by all bus drivers
when the NUMA information is unavailable.
> This is in progress.
* kni: The KNI kernel module and library are not recommended for use by new
applications - other technologies such as virtio-user are recommended instead.
Following the DPDK technical board
`decision <https://mails.dpdk.org/archives/dev/2021-January/197077.html>`_
and `refinement <http://mails.dpdk.org/archives/dev/2022-June/243596.html>`_:
* Some deprecation warnings will be added in DPDK 22.11.
* The KNI example application will be removed from DPDK 22.11.
* The KNI kernel module, library and PMD will be removed from the DPDK 23.11.
> We should add a compilation and/or dmesg deprecation warning @ferruh
* lib: will fix extending some enum/define breaking the ABI. There are multiple
samples in DPDK that enum/define terminated with a ``.*MAX.*`` value which is
used by iterators, and arrays holding these values are sized with this
``.*MAX.*`` value. So extending this enum/define increases the ``.*MAX.*``
value which increases the size of the array and depending on how/where the
array is used this may break the ABI.
``RTE_ETH_FLOW_MAX`` is one sample of the mentioned case, adding a new flow
type will break the ABI because of ``flex_mask[RTE_ETH_FLOW_MAX]`` array
usage in following public struct hierarchy:
``rte_eth_fdir_flex_conf -> rte_eth_fdir_conf -> rte_eth_conf (in the middle)``.
Need to identify this kind of usages and fix in 20.11, otherwise this blocks
us extending existing enum/define.
One solution can be using a fixed size array instead of ``.*MAX.*`` value.
> We need some documentation, in the contributors guide or the programmers guide
on how to deal with this. There is general agreement that having a MAX value
in an enum is a bad idea for ABI but developers like using this as a sentinal
or array size value so some people have been using "reserved" padding values
in enums to workaround this restrictions. The community should agree, and
document, what is acceptable.
* ethdev: The function ``rte_eth_set_queue_rate_limit`` takes ``rate`` in Mbps.
The queue rate is limited to 64 Gbps because declared as ``uint16_t``.
The ``rate`` parameter will be modified to ``uint32_t`` in DPDK 22.11
so that it can work for more than 64 Gbps.
> Patch submitted need ack from Intel and NXT.
> https://patches.dpdk.org/project/dpdk/patch/1664344318-3594-1-git-send-email-skoteshwar@marvell.com/
* ethdev: Since no single PMD supports ``RTE_ETH_RX_OFFLOAD_HEADER_SPLIT``
offload and the ``split_hdr_size`` field in structure ``rte_eth_rxmode``
to enable per-port header split, they will be removed in DPDK 22.11.
The per-queue Rx packet split offload ``RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``
can still be used, and it is configured by ``rte_eth_rxseg_split``.
> Acked and will be merge
> https://patches.dpdk.org/project/dpdk/patch/20220812031313.87385-1-xuan.ding@intel.com/
* ethdev: Announce moving from dedicated modify function for each field,
to using the general ``rte_flow_modify_field`` action.
> This is still relevant to current and future releases.
* ethdev: The flow API matching pattern structures, ``struct rte_flow_item_*``,
should start with relevant protocol header.
Some matching pattern structures implements this by duplicating protocol header
fields in the struct. To clarify the intention and to be sure protocol header
is intact, will replace those fields with relevant protocol header struct.
In v21.02 both individual protocol header fields and the protocol header struct
will be added as union, target is switch usage to the protocol header by time.
In v21.11 LTS, protocol header fields will be cleaned and only protocol header
struct will remain.
> Some work still ongoing, may need to go into RC2 but should be in RC1
> Best effort for RC1, and then list any missing structs in the docs.
* ethdev: Queue specific stats fields will be removed from ``struct rte_eth_stats``.
Mentioned fields are: ``q_ipackets``, ``q_opackets``, ``q_ibytes``, ``q_obytes``,
``q_errors``.
Instead queue stats will be received via xstats API. Current method support
will be limited to maximum 256 queues.
Also compile time flag ``RTE_ETHDEV_QUEUE_STAT_CNTRS`` will be removed.
> This deprecation notice will stay.
* ethdev: Items and actions ``PF``, ``VF``, ``PHY_PORT``, ``PORT_ID`` are
deprecated as hard-to-use / ambiguous and will be removed in DPDK 22.11.
> Some have been removed as part of a patch series. The deprecation notice will
need to change to reflect.
* ethdev: The use of attributes ``ingress`` / ``egress`` in "transfer" flows
is deprecated as ambiguous with respect to the embedded switch. The use of
these attributes will become invalid starting from DPDK 22.11.
> There is a patch in progress for this.
* ethdev: Actions ``OF_SET_MPLS_TTL``, ``OF_DEC_MPLS_TTL``, ``OF_SET_NW_TTL``,
``OF_COPY_TTL_OUT``, ``OF_COPY_TTL_IN`` are deprecated as not supported by
any PMD, so they will be removed in DPDK 22.11.
> Patch has been submitted
* ethdev: Actions ``OF_DEC_NW_TTL``, ``SET_IPV4_SRC``, ``SET_IPV4_DST``,
``SET_IPV6_SRC``, ``SET_IPV6_DST``, ``SET_TP_SRC``, ``SET_TP_DST``,
``DEC_TTL``, ``SET_TTL``, ``SET_MAC_SRC``, ``SET_MAC_DST``, ``INC_TCP_SEQ``,
``DEC_TCP_SEQ``, ``INC_TCP_ACK``, ``DEC_TCP_ACK``, ``SET_IPV4_DSCP``,
``SET_IPV6_DSCP``, ``SET_TAG``, ``SET_META`` are marked as legacy and
superseded by the generic MODIFY_FIELD action.
The legacy actions should be deprecated in 22.07, once MODIFY_FIELD
alternative is implemented.
The legacy actions should be removed in DPDK 22.11.
> Should be grouped with ??? notice above, and the specific drivers named.
> There was a proposal to have an earlier removal date, at the very start
> of the xx.11 period so that code is changed/tested in time for RC1.
* ethdev: The enum ``rte_eth_event_ipsec_subtype`` will be extended to add
new subtype values ``RTE_ETH_EVENT_IPSEC_SA_PKT_EXPIRY``,
``RTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRY`` and
``RTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRY`` in DPDK 22.11.
> Merged
* bbdev: ``RTE_BBDEV_OP_TYPE_COUNT`` terminating the ``rte_bbdev_op_type``
enum will be deprecated and instead use fixed array size when required
to allow for future enum extension.
Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22111>`__.
New members will be added in ``rte_bbdev_driver_info`` to expose
PMD queue topology inspired by
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22076>`__.
New member will be added in ``rte_bbdev_driver_info`` to expose
the device status as per
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=23367>`__.
This should be updated in DPDK 22.11.
> This involves several patches, some will be merged
* cryptodev: Hide structures ``rte_cryptodev_sym_session`` and
``rte_cryptodev_asym_session`` to remove unnecessary indirection between
session and the private data of session. An opaque pointer can be exposed
directly to application which can be attached to the ``rte_crypto_op``.
> Patches submitted. One issue with security below.
* cryptodev: The function ``rte_cryptodev_cb_fn`` will be updated
to have another parameter ``qp_id`` to return the queue pair ID
which got error interrupt to the application,
so that application can reset that particular queue pair.
> Will be removed without any objections(? note unclear)
* security: Hide structure ``rte_security_session`` and expose an opaque
pointer for the private data to the application which can be attached
to the packet while enqueuing.
> Kontantin has a comment (should be merged in RC2)
* eventdev: The function ``rte_event_crypto_adapter_queue_pair_add`` will
accept configuration of type ``rte_event_crypto_adapter_queue_conf`` instead
of ``rte_event``, similar to ``rte_event_eth_rx_adapter_queue_add`` signature.
Event will be one of the configuration fields,
together with additional vector parameters.
> Patches ready. Comment required from Abhinandan
* eventdev: The function pointer declaration ``eventdev_stop_flush_t``
will be renamed to ``rte_eventdev_stop_flush_t`` in DPDK 22.11.
> Patch available and will be merged today
* eventdev: The element ``*u64s`` in the structure ``rte_event_vector``
is deprecated and will be replaced with ``u64s`` in DPDK 22.11.
> Patch available and will be merged today
* eventdev: The structure ``rte_event_vector`` will be modified to include
``elem_offset:12`` bits taken from ``rsvd:15``. The ``elem_offset`` defines
the offset into the vector array from which valid elements are present.
The difference between ``rte_event_vector::nb_elem`` and
``rte_event_vector::elem_offset`` gives the number of valid elements left
to process from the ``rte_event_vector::elem_offset``.
> Patch is merged. Should remove deprecation docs.
* metrics: The function ``rte_metrics_init`` will have a non-void return
in order to notify errors instead of calling ``rte_exit``.
> Patch submitted by Bruce
* raw/dpaa2_cmdif: The ``dpaa2_cmdif`` rawdev driver will be deprecated
in DPDK 22.11, as it is no longer in use, no active user known.
> Drop from deprecations.
[-- Attachment #2: Type: text/html, Size: 35323 bytes --]
^ permalink raw reply [relevance 4%]
* Re: [PATCH v4] ethdev: support congestion management
2022-10-04 9:02 2% [PATCH v4] ethdev: support congestion management Andrew Rybchenko
@ 2022-10-06 8:36 0% ` Andrew Rybchenko
2022-10-07 1:56 0% ` [EXT] " Jerin Jacob Kollanukkaran
2022-10-07 6:09 0% ` [EXT] " Sunil Kumar Kori
1 sibling, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-10-06 8:36 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon, Ray Kinsella
Cc: dev, Jerin Jacob, Sunil Kumar Kori
@Jerin, could you confirm if my minor changes are OK for you
and, if so, I'll proceed with applying the patch.
On 10/4/22 12:02, Andrew Rybchenko wrote:
> From: Jerin Jacob <jerinj@marvell.com>
>
> NIC HW controllers often come with congestion management support on
> various HW objects such as Rx queue depth or mempool queue depth.
>
> Also, it can support various modes of operation such as RED
> (Random early discard), WRED etc on those HW objects.
>
> Add a framework to express such modes(enum rte_cman_mode) and
> introduce (enum rte_eth_cman_obj) to enumerate the different
> objects where the modes can operate on.
>
> Add RTE_CMAN_RED mode of operation and RTE_ETH_CMAN_OBJ_RX_QUEUE,
> RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL objects.
>
> Introduce reserved fields in configuration structure
> backed by rte_eth_cman_config_init() to add new configuration
> parameters without ABI breakage.
>
> Add rte_eth_cman_info_get() API to get the information such as
> supported modes and objects.
>
> Add rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs
> to configure congestion management on those object with associated mode.
>
> Finally, add rte_eth_cman_config_get() API to retrieve the
> applied configuration.
>
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
> v3..v4: Andrew Rybchenko
> - rebase
> - remove eth_check_err() and use eth_err() instead
> - minor fixes in description to avoid "This patch" and "Added".
> - correct position in release notes
> v2..v3:
> - Rename rte_cman.c to rte_ethdev_cman.c
> - Move lib/eal/include/rte_cman.h to lib/ethdev/rte_cman.h
> - Fix review comments (Andrew Rybchenko)
> - Add release notes
>
> v1..v2:
> - Fix review comments (Akhil Goyal)
>
> rfc..v1:
> - Added RED specification (http://www.aciri.org/floyd/papers/red/red.html) link
> - Fixed doxygen comment issue (Min Hu)
>
> doc/guides/nics/features.rst | 12 ++
> doc/guides/nics/features/default.ini | 1 +
> doc/guides/rel_notes/release_22_11.rst | 6 +
> lib/ethdev/ethdev_driver.h | 25 ++++
> lib/ethdev/ethdev_private.h | 3 +
> lib/ethdev/meson.build | 2 +
> lib/ethdev/rte_cman.h | 55 +++++++++
> lib/ethdev/rte_ethdev.c | 2 +-
> lib/ethdev/rte_ethdev.h | 164 +++++++++++++++++++++++++
> lib/ethdev/rte_ethdev_cman.c | 101 +++++++++++++++
> lib/ethdev/version.map | 4 +
> 11 files changed, 374 insertions(+), 1 deletion(-)
> create mode 100644 lib/ethdev/rte_cman.h
> create mode 100644 lib/ethdev/rte_ethdev_cman.c
>
> diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
> index b4a8e9881c..70ca46e651 100644
> --- a/doc/guides/nics/features.rst
> +++ b/doc/guides/nics/features.rst
> @@ -727,6 +727,18 @@ Supports configuring per-queue stat counter mapping.
> ``rte_eth_dev_set_tx_queue_stats_mapping()``.
>
>
> +.. _nic_features_congestion_management:
> +
> +Congestion management
> +---------------------
> +
> +Supports congestion management.
> +
> +* **[implements] eth_dev_ops**: ``cman_info_get``, ``cman_config_set``, ``cman_config_get``.
> +* **[related] API**: ``rte_eth_cman_info_get()``, ``rte_eth_cman_config_init()``,
> + ``rte_eth_cman_config_set()``, ``rte_eth_cman_config_get()``.
> +
> +
> .. _nic_features_fw_version:
>
> FW version
> diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
> index f7192cb0da..a9c0008ebd 100644
> --- a/doc/guides/nics/features/default.ini
> +++ b/doc/guides/nics/features/default.ini
> @@ -60,6 +60,7 @@ Tx descriptor status =
> Basic stats =
> Extended stats =
> Stats per queue =
> +Congestion management =
> FW version =
> EEPROM dump =
> Module EEPROM dump =
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 44f9a30c6a..0ffa004a9e 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -78,6 +78,12 @@ New Features
> Added new rte_flow action which allows application to re-route packets
> directly to the kernel without software involvement.
>
> +* **Added support for congestion management for ethdev.**
> +
> + Added new APIs ``rte_eth_cman_config_init()``, ``rte_eth_cman_config_get()``,
> + ``rte_eth_cman_config_set()``, ``rte_eth_cman_info_get()``
> + to support congestion management.
> +
> * **Updated Intel iavf driver.**
>
> * Added flow subscription support.
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 8cd8eb8685..e1e2d10a35 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -1094,6 +1094,22 @@ typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
> uint16_t *rx_queue_id,
> uint8_t *avail_thresh);
>
> +/** @internal Get congestion management information. */
> +typedef int (*eth_cman_info_get_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_info *info);
> +
> +/** @internal Init congestion management structure with default values. */
> +typedef int (*eth_cman_config_init_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_config *config);
> +
> +/** @internal Configure congestion management on a port. */
> +typedef int (*eth_cman_config_set_t)(struct rte_eth_dev *dev,
> + const struct rte_eth_cman_config *config);
> +
> +/** @internal Retrieve congestion management configuration of a port. */
> +typedef int (*eth_cman_config_get_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_config *config);
> +
> /**
> * @internal A structure containing the functions exported by an Ethernet driver.
> */
> @@ -1309,6 +1325,15 @@ struct eth_dev_ops {
> eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
> /** Query Rx queue available descriptors threshold event */
> eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
> +
> + /** Get congestion management information */
> + eth_cman_info_get_t cman_info_get;
> + /** Initialize congestion management structure with default values */
> + eth_cman_config_init_t cman_config_init;
> + /** Configure congestion management */
> + eth_cman_config_set_t cman_config_set;
> + /** Retrieve congestion management configuration */
> + eth_cman_config_get_t cman_config_get;
> };
>
> /**
> diff --git a/lib/ethdev/ethdev_private.h b/lib/ethdev/ethdev_private.h
> index cc9879907c..acb4b335c8 100644
> --- a/lib/ethdev/ethdev_private.h
> +++ b/lib/ethdev/ethdev_private.h
> @@ -37,6 +37,9 @@ struct rte_eth_dev_callback {
>
> extern rte_spinlock_t eth_dev_cb_lock;
>
> +/* Convert all error to -EIO if device is removed. */
> +int eth_err(uint16_t port_id, int ret);
> +
> /*
> * Convert rte_eth_dev pointer to port ID.
> * NULL will be translated to RTE_MAX_ETHPORTS.
> diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
> index 47bb2625b0..39250b5da1 100644
> --- a/lib/ethdev/meson.build
> +++ b/lib/ethdev/meson.build
> @@ -8,6 +8,7 @@ sources = files(
> 'ethdev_trace_points.c',
> 'rte_class_eth.c',
> 'rte_ethdev.c',
> + 'rte_ethdev_cman.c',
> 'rte_flow.c',
> 'rte_mtr.c',
> 'rte_tm.c',
> @@ -19,6 +20,7 @@ sources = files(
> )
>
> headers = files(
> + 'rte_cman.h',
> 'rte_ethdev.h',
> 'rte_ethdev_trace.h',
> 'rte_ethdev_trace_fp.h',
> diff --git a/lib/ethdev/rte_cman.h b/lib/ethdev/rte_cman.h
> new file mode 100644
> index 0000000000..297db8e095
> --- /dev/null
> +++ b/lib/ethdev/rte_cman.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2022 Marvell International Ltd.
> + */
> +
> +#ifndef RTE_CMAN_H
> +#define RTE_CMAN_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_bitops.h>
> +
> +/**
> + * @file
> + * Congestion management related parameters for DPDK.
> + */
> +
> +/** Congestion management modes */
> +enum rte_cman_mode {
> + /**
> + * Congestion based on Random Early Detection.
> + *
> + * https://en.wikipedia.org/wiki/Random_early_detection
> + * http://www.aciri.org/floyd/papers/red/red.html
> + * @see struct rte_cman_red_params
> + */
> + RTE_CMAN_RED = RTE_BIT32(0),
> +};
> +
> +/**
> + * RED based congestion management configuration parameters.
> + */
> +struct rte_cman_red_params {
> + /**
> + * Minimum threshold (min_th) value
> + *
> + * Value expressed as percentage. Value must be in 0 to 100(inclusive).
> + */
> + uint8_t min_th;
> + /**
> + * Maximum threshold (max_th) value
> + *
> + * Value expressed as percentage. Value must be in 0 to 100(inclusive).
> + */
> + uint8_t max_th;
> + /** Inverse of packet marking probability maximum value (maxp = 1 / maxp_inv) */
> + uint16_t maxp_inv;
> +};
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* RTE_CMAN_H */
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 0c2c1088c0..e4eb17221b 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -642,7 +642,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
> return -ENODEV;
> }
>
> -static int
> +int
> eth_err(uint16_t port_id, int ret)
> {
> if (ret == 0)
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index a21f58b9cd..8df1cdfad0 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -160,6 +160,7 @@ extern "C" {
> #define RTE_ETHDEV_DEBUG_TX
> #endif
>
> +#include <rte_cman.h>
> #include <rte_compat.h>
> #include <rte_log.h>
> #include <rte_interrupts.h>
> @@ -5314,6 +5315,169 @@ typedef struct {
> __rte_experimental
> int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file);
>
> +/* Congestion management */
> +
> +/** Enumerate list of ethdev congestion management objects */
> +enum rte_eth_cman_obj {
> + /** Congestion management based on Rx queue depth */
> + RTE_ETH_CMAN_OBJ_RX_QUEUE = RTE_BIT32(0),
> + /**
> + * Congestion management based on mempool depth associated with Rx queue
> + * @see rte_eth_rx_queue_setup()
> + */
> + RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL = RTE_BIT32(1),
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
> + *
> + * A structure used to retrieve information of ethdev congestion management.
> + */
> +struct rte_eth_cman_info {
> + /**
> + * Set of supported congestion management modes
> + * @see enum rte_cman_mode
> + */
> + uint64_t modes_supported;
> + /**
> + * Set of supported congestion management objects
> + * @see enum rte_eth_cman_obj
> + */
> + uint64_t objs_supported;
> + /**
> + * Reserved for future fields. Always returned as 0 when
> + * rte_eth_cman_info_get() is invoked
> + */
> + uint8_t rsvd[8];
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
> + *
> + * A structure used to configure the ethdev congestion management.
> + */
> +struct rte_eth_cman_config {
> + /** Congestion management object */
> + enum rte_eth_cman_obj obj;
> + /** Congestion management mode */
> + enum rte_cman_mode mode;
> + union {
> + /**
> + * Rx queue to configure congestion management.
> + *
> + * Valid when object is RTE_ETH_CMAN_OBJ_RX_QUEUE or
> + * RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL.
> + */
> + uint16_t rx_queue;
> + /**
> + * Reserved for future fields.
> + * It must be set to 0 when rte_eth_cman_config_set() is invoked
> + * and will be returned as 0 when rte_eth_cman_config_get() is
> + * invoked.
> + */
> + uint8_t rsvd_obj_params[4];
> + } obj_param;
> + union {
> + /**
> + * RED configuration parameters.
> + *
> + * Valid when mode is RTE_CMAN_RED.
> + */
> + struct rte_cman_red_params red;
> + /**
> + * Reserved for future fields.
> + * It must be set to 0 when rte_eth_cman_config_set() is invoked
> + * and will be returned as 0 when rte_eth_cman_config_get() is
> + * invoked.
> + */
> + uint8_t rsvd_mode_params[4];
> + } mode_param;
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Retrieve the information for ethdev congestion management
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param info
> + * A pointer to a structure of type *rte_eth_cman_info* to be filled with
> + * the information about congestion management.
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_info_get does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info);
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Initialize the ethdev congestion management configuration structure with default values.
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param config
> + * A pointer to a structure of type *rte_eth_cman_config* to be initialized
> + * with default value.
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_config_init does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config);
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Configure ethdev congestion management
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param config
> + * A pointer to a structure of type *rte_eth_cman_config* to be configured.
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_config_set does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config);
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Retrieve the applied ethdev congestion management parameters for the given port.
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param config
> + * A pointer to a structure of type *rte_eth_cman_config* to retrieve
> + * congestion management parameters for the given object.
> + * Application must fill all parameters except mode_param parameter in
> + * struct rte_eth_cman_config.
> + *
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_config_get does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config);
> +
> #include <rte_ethdev_core.h>
>
> /**
> diff --git a/lib/ethdev/rte_ethdev_cman.c b/lib/ethdev/rte_ethdev_cman.c
> new file mode 100644
> index 0000000000..4a1bdd7bd0
> --- /dev/null
> +++ b/lib/ethdev/rte_ethdev_cman.c
> @@ -0,0 +1,101 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2022 Marvell International Ltd.
> + */
> +
> +#include <stdint.h>
> +
> +#include <rte_errno.h>
> +#include "rte_ethdev.h"
> +#include "ethdev_driver.h"
> +#include "ethdev_private.h"
> +
> +/* Get congestion management information for a port */
> +int
> +rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (info == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management info is NULL\n");
> + return -EINVAL;
> + }
> +
> + if (dev->dev_ops->cman_info_get == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
> + return -ENOTSUP;
> + }
> +
> + memset(info, 0, sizeof(struct rte_eth_cman_info));
> + return eth_err(port_id, (*dev->dev_ops->cman_info_get)(dev, info));
> +}
> +
> +/* Initialize congestion management structure with default values */
> +int
> +rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + if (dev->dev_ops->cman_config_init == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
> + return -ENOTSUP;
> + }
> +
> + memset(config, 0, sizeof(struct rte_eth_cman_config));
> + return eth_err(port_id, (*dev->dev_ops->cman_config_init)(dev, config));
> +}
> +
> +/* Configure congestion management on a port */
> +int
> +rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + if (dev->dev_ops->cman_config_set == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
> + return -ENOTSUP;
> + }
> +
> + return eth_err(port_id, (*dev->dev_ops->cman_config_set)(dev, config));
> +}
> +
> +/* Retrieve congestion management configuration of a port */
> +int
> +rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + if (dev->dev_ops->cman_config_get == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
> + return -ENOTSUP;
> + }
> +
> + memset(config, 0, sizeof(struct rte_eth_cman_config));
> + return eth_err(port_id, (*dev->dev_ops->cman_config_get)(dev, config));
> +}
> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
> index 3651ceb234..857d21be1c 100644
> --- a/lib/ethdev/version.map
> +++ b/lib/ethdev/version.map
> @@ -287,6 +287,10 @@ EXPERIMENTAL {
> rte_mtr_meter_vlan_table_update;
>
> # added in 22.11
> + rte_eth_cman_config_get;
> + rte_eth_cman_config_init;
> + rte_eth_cman_config_set;
> + rte_eth_cman_info_get;
> rte_flow_async_action_handle_query;
> rte_mtr_meter_policy_get;
> rte_mtr_meter_profile_get;
^ permalink raw reply [relevance 0%]
* Re: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
2022-10-06 7:50 0% ` Andrew Rybchenko
@ 2022-10-06 7:57 0% ` David Marchand
2022-10-12 9:49 0% ` Jerin Jacob
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-10-06 7:57 UTC (permalink / raw)
To: Andrew Rybchenko, Jerin Jacob Kollanukkaran
Cc: Ankur Dwivedi, dev, Thomas Monjalon, Ferruh Yigit, Ray Kinsella
On Thu, Oct 6, 2022 at 9:50 AM Andrew Rybchenko
<andrew.rybchenko@oktetlabs.ru> wrote:
> >>>>> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index
> >>>>> 3def7bfd24..e3d603cc9a 100644
> >>>>> --- a/lib/ethdev/version.map
> >>>>> +++ b/lib/ethdev/version.map
> >>>>> @@ -288,6 +288,150 @@ EXPERIMENTAL {
> >>>>>
> >>>>> # added in 22.11
> >>>>> rte_flow_async_action_handle_query;
> >>>>> + __rte_eth_trace_add_first_rx_callback;
> >>>>
> >>>> Why is it in EXPERIMENTAL section, but not INTERNAL?
> >>> [Ankur] Because the functions for which trace is added are not internal
> >> functions.
> >>
> >> Sorry, but I don't understand. I agree that tracing of public inline functions
> >> must be part of ABI, but why everything else should be a part of ABI?
> > [Ankur] I see that there are some already existing trace functions added in EXPERIMENTAL in version.map like __rte_ethdev_trace_configure, __rte_ethdev_trace_rxq_setup. So not sure will it be internal or experimental.
> >
> > But you are right the trace function will not be called as a public api. Should I make the newly added trace as internal then?
>
> @David, do I understand correctly that trace points in
> EXPERIMENTAL is a mistake in majority of cases?
The trace point global variables (__rte_trace_foo) are only exposed
for inline helpers that might call their associated trace point helper
(rte_trace_foo()).
An application is not supposed to directly manipulate them.
Any tp manipulation should be through the rte_trace_point_* API.
Jerin, do you see any other uses for them?
If not, I agree we can mark all those INTERNAL.
I can send a cleanup post rc1.
--
David Marchand
^ permalink raw reply [relevance 0%]
* Re: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
2022-10-06 7:43 0% ` Ankur Dwivedi
@ 2022-10-06 7:50 0% ` Andrew Rybchenko
2022-10-06 7:57 0% ` David Marchand
0 siblings, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-10-06 7:50 UTC (permalink / raw)
To: Ankur Dwivedi, dev, david.marchand
Cc: Thomas Monjalon, Ferruh Yigit, Jerin Jacob Kollanukkaran
@David, see small question below.
@Thomas, @Ferruh, @Jerin see question below as well.
On 10/6/22 10:43, Ankur Dwivedi wrote:
>
>
>> -----Original Message-----
>> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> Sent: Thursday, October 6, 2022 12:58 PM
>> To: Ankur Dwivedi <adwivedi@marvell.com>; dev@dpdk.org
>> Cc: thomas@monjalon.net; mdr@ashroe.eu; orika@nvidia.com;
>> ferruh.yigit@xilinx.com; chas3@att.com; humin29@huawei.com;
>> linville@tuxdriver.com; ciara.loftus@intel.com; qi.z.zhang@intel.com;
>> mw@semihalf.com; mk@semihalf.com; shaibran@amazon.com;
>> evgenys@amazon.com; igorch@amazon.com; chandu@amd.com; Igor
>> Russkikh <irusskikh@marvell.com>; shepard.siegel@atomicrules.com;
>> ed.czeck@atomicrules.com; john.miller@atomicrules.com;
>> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Jerin Jacob
>> Kollanukkaran <jerinj@marvell.com>; Maciej Czekaj [C]
>> <mczekaj@marvell.com>; Shijith Thotton <sthotton@marvell.com>;
>> Srisivasubramanian Srinivasan <srinivasan@marvell.com>; Harman Kalra
>> <hkalra@marvell.com>; rahul.lakkireddy@chelsio.com; johndale@cisco.com;
>> hyonkim@cisco.com; liudongdong3@huawei.com;
>> yisen.zhuang@huawei.com; xuanziyang2@huawei.com;
>> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
>> simei.su@intel.com; wenjun1.wu@intel.com; qiming.yang@intel.com;
>> Yuying.Zhang@intel.com; beilei.xing@intel.com; xiao.w.wang@intel.com;
>> jingjing.wu@intel.com; junfeng.guo@intel.com; rosen.xu@intel.com; Nithin
>> Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda
>> <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha
>> Koteswara Rao Kottidi <skoteshwar@marvell.com>; Liron Himi
>> <lironh@marvell.com>; zr@semihalf.com; Radha Chintakuntla
>> <radhac@marvell.com>; Veerasenareddy Burru <vburru@marvell.com>;
>> Sathesh B Edara <sedara@marvell.com>; matan@nvidia.com;
>> viacheslavo@nvidia.com; sthemmin@microsoft.com; longli@microsoft.com;
>> spinler@cesnet.cz; chaoyong.he@corigine.com;
>> niklas.soderlund@corigine.com; hemant.agrawal@nxp.com;
>> sachin.saxena@oss.nxp.com; g.singh@nxp.com; apeksha.gupta@nxp.com;
>> sachin.saxena@nxp.com; aboyer@pensando.io; Rasesh Mody
>> <rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>; Devendra
>> Singh Rawat <dsinghrawat@marvell.com>; jiawenwu@trustnetic.com;
>> jianwang@trustnetic.com; jbehrens@vmware.com;
>> maxime.coquelin@redhat.com; chenbo.xia@intel.com;
>> steven.webster@windriver.com; matt.peters@windriver.com;
>> bruce.richardson@intel.com; mtetsuyah@gmail.com; grive@u256.net;
>> jasvinder.singh@intel.com; cristian.dumitrescu@intel.com;
>> jgrajcia@cisco.com
>> Subject: Re: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
>>
>> On 10/6/22 10:24, Ankur Dwivedi wrote:
>>> Hi Andrew,
>>>
>>>> -----Original Message-----
>>>> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>>>> Sent: Thursday, October 6, 2022 12:40 PM
>>>> To: Ankur Dwivedi <adwivedi@marvell.com>; dev@dpdk.org
>>>> Cc: thomas@monjalon.net; mdr@ashroe.eu; orika@nvidia.com;
>>>> ferruh.yigit@xilinx.com; chas3@att.com; humin29@huawei.com;
>>>> linville@tuxdriver.com; ciara.loftus@intel.com; qi.z.zhang@intel.com;
>>>> mw@semihalf.com; mk@semihalf.com; shaibran@amazon.com;
>>>> evgenys@amazon.com; igorch@amazon.com; chandu@amd.com; Igor
>> Russkikh
>>>> <irusskikh@marvell.com>; shepard.siegel@atomicrules.com;
>>>> ed.czeck@atomicrules.com; john.miller@atomicrules.com;
>>>> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Jerin
>> Jacob
>>>> Kollanukkaran <jerinj@marvell.com>; Maciej Czekaj [C]
>>>> <mczekaj@marvell.com>; Shijith Thotton <sthotton@marvell.com>;
>>>> Srisivasubramanian Srinivasan <srinivasan@marvell.com>; Harman Kalra
>>>> <hkalra@marvell.com>; rahul.lakkireddy@chelsio.com;
>>>> johndale@cisco.com; hyonkim@cisco.com; liudongdong3@huawei.com;
>>>> yisen.zhuang@huawei.com; xuanziyang2@huawei.com;
>>>> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
>>>> simei.su@intel.com; wenjun1.wu@intel.com; qiming.yang@intel.com;
>>>> Yuying.Zhang@intel.com; beilei.xing@intel.com; xiao.w.wang@intel.com;
>>>> jingjing.wu@intel.com; junfeng.guo@intel.com; rosen.xu@intel.com;
>>>> Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
>>>> Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori
>>>> <skori@marvell.com>; Satha Koteswara Rao Kottidi
>>>> <skoteshwar@marvell.com>; Liron Himi <lironh@marvell.com>;
>>>> zr@semihalf.com; Radha Chintakuntla <radhac@marvell.com>;
>>>> Veerasenareddy Burru <vburru@marvell.com>; Sathesh B Edara
>>>> <sedara@marvell.com>; matan@nvidia.com; viacheslavo@nvidia.com;
>>>> sthemmin@microsoft.com; longli@microsoft.com; spinler@cesnet.cz;
>>>> chaoyong.he@corigine.com; niklas.soderlund@corigine.com;
>>>> hemant.agrawal@nxp.com; sachin.saxena@oss.nxp.com;
>> g.singh@nxp.com;
>>>> apeksha.gupta@nxp.com; sachin.saxena@nxp.com; aboyer@pensando.io;
>>>> Rasesh Mody <rmody@marvell.com>; Shahed Shaikh
>>>> <shshaikh@marvell.com>; Devendra Singh Rawat
>>>> <dsinghrawat@marvell.com>; jiawenwu@trustnetic.com;
>>>> jianwang@trustnetic.com; jbehrens@vmware.com;
>>>> maxime.coquelin@redhat.com; chenbo.xia@intel.com;
>>>> steven.webster@windriver.com; matt.peters@windriver.com;
>>>> bruce.richardson@intel.com; mtetsuyah@gmail.com; grive@u256.net;
>>>> jasvinder.singh@intel.com; cristian.dumitrescu@intel.com;
>>>> jgrajcia@cisco.com
>>>> Subject: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
>>>>
>>>> External Email
>>>>
>>>> ---------------------------------------------------------------------
>>>> - On 9/29/22 13:29, Ankur Dwivedi wrote:
>>>>> Add trace points for ethdev functions.
>>>>>
>>>>> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
>>>>
>>>> [snip]
>>>>
>>>>> @@ -5867,6 +6010,7 @@ rte_eth_rx_metadata_negotiate(uint16_t
>>>>> port_id,
>>>> uint64_t *features)
>>>>> {
>>>>> struct rte_eth_dev *dev;
>>>>>
>>>>> + rte_eth_trace_rx_metadata_negotiate(port_id, features);
>>>>
>>>> features are in/out, so it would be interesting to values, not just
>>>> pointer and both values: input and output.
>>> [Ankur] Will add a emit line to display the uint64_t input value of features.
>>
>> What about output?
> [Ankur] The output is not captured because it calls a callback in the return:
>
> return eth_err(port_id, (*dev->dev_ops->rx_metadata_negotiate)(dev, features));
>
> I do not wanted to modify the existing code/logic for trace.
OK, I see the reason now. I'd like to hear opinion of other
ethdev maintainers (@Thomas and @Ferruh) and @Jerin. Thoughts?
It is just one example from many-many cases.
The question is how pedantic should we be with added tracing?
>>
>>>>
>>>>> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>>>> dev = &rte_eth_devices[port_id];
>>>>>
>>>>
>>>> [snip]
>>>>
>>>>> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index
>>>>> 3def7bfd24..e3d603cc9a 100644
>>>>> --- a/lib/ethdev/version.map
>>>>> +++ b/lib/ethdev/version.map
>>>>> @@ -288,6 +288,150 @@ EXPERIMENTAL {
>>>>>
>>>>> # added in 22.11
>>>>> rte_flow_async_action_handle_query;
>>>>> + __rte_eth_trace_add_first_rx_callback;
>>>>
>>>> Why is it in EXPERIMENTAL section, but not INTERNAL?
>>> [Ankur] Because the functions for which trace is added are not internal
>> functions.
>>
>> Sorry, but I don't understand. I agree that tracing of public inline functions
>> must be part of ABI, but why everything else should be a part of ABI?
> [Ankur] I see that there are some already existing trace functions added in EXPERIMENTAL in version.map like __rte_ethdev_trace_configure, __rte_ethdev_trace_rxq_setup. So not sure will it be internal or experimental.
>
> But you are right the trace function will not be called as a public api. Should I make the newly added trace as internal then?
@David, do I understand correctly that trace points in
EXPERIMENTAL is a mistake in majority of cases?
>>
>>>>
>>>> [snip]
>>>>
>>>>> INTERNAL
>
^ permalink raw reply [relevance 0%]
* RE: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
2022-10-06 7:27 4% ` Andrew Rybchenko
@ 2022-10-06 7:43 0% ` Ankur Dwivedi
2022-10-06 7:50 0% ` Andrew Rybchenko
0 siblings, 1 reply; 200+ results
From: Ankur Dwivedi @ 2022-10-06 7:43 UTC (permalink / raw)
To: Andrew Rybchenko, dev
Cc: thomas, mdr, orika, ferruh.yigit, chas3, humin29, linville,
ciara.loftus, qi.z.zhang, mw, mk, shaibran, evgenys, igorch,
chandu, Igor Russkikh, shepard.siegel, ed.czeck, john.miller,
ajit.khaparde, somnath.kotur, Jerin Jacob Kollanukkaran,
Maciej Czekaj [C],
Shijith Thotton, Srisivasubramanian Srinivasan, Harman Kalra,
rahul.lakkireddy, johndale, hyonkim, liudongdong3, yisen.zhuang,
xuanziyang2, cloud.wangxiaoyun, zhouguoyang, simei.su,
wenjun1.wu, qiming.yang, Yuying.Zhang, beilei.xing, xiao.w.wang,
jingjing.wu, junfeng.guo, rosen.xu, Nithin Kumar Dabilpuram,
Kiran Kumar Kokkilagadda, Sunil Kumar Kori,
Satha Koteswara Rao Kottidi, Liron Himi, zr, Radha Chintakuntla,
Veerasenareddy Burru, Sathesh B Edara, matan, viacheslavo,
sthemmin, longli, spinler, chaoyong.he, niklas.soderlund,
hemant.agrawal, sachin.saxena, g.singh, apeksha.gupta,
sachin.saxena, aboyer, Rasesh Mody, Shahed Shaikh,
Devendra Singh Rawat, jiawenwu, jianwang, jbehrens,
maxime.coquelin, chenbo.xia, steven.webster, matt.peters,
bruce.richardson, mtetsuyah, grive, jasvinder.singh,
cristian.dumitrescu, jgrajcia
>-----Original Message-----
>From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>Sent: Thursday, October 6, 2022 12:58 PM
>To: Ankur Dwivedi <adwivedi@marvell.com>; dev@dpdk.org
>Cc: thomas@monjalon.net; mdr@ashroe.eu; orika@nvidia.com;
>ferruh.yigit@xilinx.com; chas3@att.com; humin29@huawei.com;
>linville@tuxdriver.com; ciara.loftus@intel.com; qi.z.zhang@intel.com;
>mw@semihalf.com; mk@semihalf.com; shaibran@amazon.com;
>evgenys@amazon.com; igorch@amazon.com; chandu@amd.com; Igor
>Russkikh <irusskikh@marvell.com>; shepard.siegel@atomicrules.com;
>ed.czeck@atomicrules.com; john.miller@atomicrules.com;
>ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Jerin Jacob
>Kollanukkaran <jerinj@marvell.com>; Maciej Czekaj [C]
><mczekaj@marvell.com>; Shijith Thotton <sthotton@marvell.com>;
>Srisivasubramanian Srinivasan <srinivasan@marvell.com>; Harman Kalra
><hkalra@marvell.com>; rahul.lakkireddy@chelsio.com; johndale@cisco.com;
>hyonkim@cisco.com; liudongdong3@huawei.com;
>yisen.zhuang@huawei.com; xuanziyang2@huawei.com;
>cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
>simei.su@intel.com; wenjun1.wu@intel.com; qiming.yang@intel.com;
>Yuying.Zhang@intel.com; beilei.xing@intel.com; xiao.w.wang@intel.com;
>jingjing.wu@intel.com; junfeng.guo@intel.com; rosen.xu@intel.com; Nithin
>Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda
><kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha
>Koteswara Rao Kottidi <skoteshwar@marvell.com>; Liron Himi
><lironh@marvell.com>; zr@semihalf.com; Radha Chintakuntla
><radhac@marvell.com>; Veerasenareddy Burru <vburru@marvell.com>;
>Sathesh B Edara <sedara@marvell.com>; matan@nvidia.com;
>viacheslavo@nvidia.com; sthemmin@microsoft.com; longli@microsoft.com;
>spinler@cesnet.cz; chaoyong.he@corigine.com;
>niklas.soderlund@corigine.com; hemant.agrawal@nxp.com;
>sachin.saxena@oss.nxp.com; g.singh@nxp.com; apeksha.gupta@nxp.com;
>sachin.saxena@nxp.com; aboyer@pensando.io; Rasesh Mody
><rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>; Devendra
>Singh Rawat <dsinghrawat@marvell.com>; jiawenwu@trustnetic.com;
>jianwang@trustnetic.com; jbehrens@vmware.com;
>maxime.coquelin@redhat.com; chenbo.xia@intel.com;
>steven.webster@windriver.com; matt.peters@windriver.com;
>bruce.richardson@intel.com; mtetsuyah@gmail.com; grive@u256.net;
>jasvinder.singh@intel.com; cristian.dumitrescu@intel.com;
>jgrajcia@cisco.com
>Subject: Re: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
>
>On 10/6/22 10:24, Ankur Dwivedi wrote:
>> Hi Andrew,
>>
>>> -----Original Message-----
>>> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>>> Sent: Thursday, October 6, 2022 12:40 PM
>>> To: Ankur Dwivedi <adwivedi@marvell.com>; dev@dpdk.org
>>> Cc: thomas@monjalon.net; mdr@ashroe.eu; orika@nvidia.com;
>>> ferruh.yigit@xilinx.com; chas3@att.com; humin29@huawei.com;
>>> linville@tuxdriver.com; ciara.loftus@intel.com; qi.z.zhang@intel.com;
>>> mw@semihalf.com; mk@semihalf.com; shaibran@amazon.com;
>>> evgenys@amazon.com; igorch@amazon.com; chandu@amd.com; Igor
>Russkikh
>>> <irusskikh@marvell.com>; shepard.siegel@atomicrules.com;
>>> ed.czeck@atomicrules.com; john.miller@atomicrules.com;
>>> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Jerin
>Jacob
>>> Kollanukkaran <jerinj@marvell.com>; Maciej Czekaj [C]
>>> <mczekaj@marvell.com>; Shijith Thotton <sthotton@marvell.com>;
>>> Srisivasubramanian Srinivasan <srinivasan@marvell.com>; Harman Kalra
>>> <hkalra@marvell.com>; rahul.lakkireddy@chelsio.com;
>>> johndale@cisco.com; hyonkim@cisco.com; liudongdong3@huawei.com;
>>> yisen.zhuang@huawei.com; xuanziyang2@huawei.com;
>>> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
>>> simei.su@intel.com; wenjun1.wu@intel.com; qiming.yang@intel.com;
>>> Yuying.Zhang@intel.com; beilei.xing@intel.com; xiao.w.wang@intel.com;
>>> jingjing.wu@intel.com; junfeng.guo@intel.com; rosen.xu@intel.com;
>>> Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
>>> Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori
>>> <skori@marvell.com>; Satha Koteswara Rao Kottidi
>>> <skoteshwar@marvell.com>; Liron Himi <lironh@marvell.com>;
>>> zr@semihalf.com; Radha Chintakuntla <radhac@marvell.com>;
>>> Veerasenareddy Burru <vburru@marvell.com>; Sathesh B Edara
>>> <sedara@marvell.com>; matan@nvidia.com; viacheslavo@nvidia.com;
>>> sthemmin@microsoft.com; longli@microsoft.com; spinler@cesnet.cz;
>>> chaoyong.he@corigine.com; niklas.soderlund@corigine.com;
>>> hemant.agrawal@nxp.com; sachin.saxena@oss.nxp.com;
>g.singh@nxp.com;
>>> apeksha.gupta@nxp.com; sachin.saxena@nxp.com; aboyer@pensando.io;
>>> Rasesh Mody <rmody@marvell.com>; Shahed Shaikh
>>> <shshaikh@marvell.com>; Devendra Singh Rawat
>>> <dsinghrawat@marvell.com>; jiawenwu@trustnetic.com;
>>> jianwang@trustnetic.com; jbehrens@vmware.com;
>>> maxime.coquelin@redhat.com; chenbo.xia@intel.com;
>>> steven.webster@windriver.com; matt.peters@windriver.com;
>>> bruce.richardson@intel.com; mtetsuyah@gmail.com; grive@u256.net;
>>> jasvinder.singh@intel.com; cristian.dumitrescu@intel.com;
>>> jgrajcia@cisco.com
>>> Subject: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
>>>
>>> External Email
>>>
>>> ---------------------------------------------------------------------
>>> - On 9/29/22 13:29, Ankur Dwivedi wrote:
>>>> Add trace points for ethdev functions.
>>>>
>>>> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
>>>
>>> [snip]
>>>
>>>> @@ -5867,6 +6010,7 @@ rte_eth_rx_metadata_negotiate(uint16_t
>>>> port_id,
>>> uint64_t *features)
>>>> {
>>>> struct rte_eth_dev *dev;
>>>>
>>>> + rte_eth_trace_rx_metadata_negotiate(port_id, features);
>>>
>>> features are in/out, so it would be interesting to values, not just
>>> pointer and both values: input and output.
>> [Ankur] Will add a emit line to display the uint64_t input value of features.
>
>What about output?
[Ankur] The output is not captured because it calls a callback in the return:
return eth_err(port_id, (*dev->dev_ops->rx_metadata_negotiate)(dev, features));
I do not wanted to modify the existing code/logic for trace.
>
>>>
>>>> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>>> dev = &rte_eth_devices[port_id];
>>>>
>>>
>>> [snip]
>>>
>>>> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index
>>>> 3def7bfd24..e3d603cc9a 100644
>>>> --- a/lib/ethdev/version.map
>>>> +++ b/lib/ethdev/version.map
>>>> @@ -288,6 +288,150 @@ EXPERIMENTAL {
>>>>
>>>> # added in 22.11
>>>> rte_flow_async_action_handle_query;
>>>> + __rte_eth_trace_add_first_rx_callback;
>>>
>>> Why is it in EXPERIMENTAL section, but not INTERNAL?
>> [Ankur] Because the functions for which trace is added are not internal
>functions.
>
>Sorry, but I don't understand. I agree that tracing of public inline functions
>must be part of ABI, but why everything else should be a part of ABI?
[Ankur] I see that there are some already existing trace functions added in EXPERIMENTAL in version.map like __rte_ethdev_trace_configure, __rte_ethdev_trace_rxq_setup. So not sure will it be internal or experimental.
But you are right the trace function will not be called as a public api. Should I make the newly added trace as internal then?
>
>>>
>>> [snip]
>>>
>>>> INTERNAL
^ permalink raw reply [relevance 0%]
* Re: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
@ 2022-10-06 7:27 4% ` Andrew Rybchenko
2022-10-06 7:43 0% ` Ankur Dwivedi
0 siblings, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-10-06 7:27 UTC (permalink / raw)
To: Ankur Dwivedi, dev
Cc: thomas, mdr, orika, ferruh.yigit, chas3, humin29, linville,
ciara.loftus, qi.z.zhang, mw, mk, shaibran, evgenys, igorch,
chandu, Igor Russkikh, shepard.siegel, ed.czeck, john.miller,
ajit.khaparde, somnath.kotur, Jerin Jacob Kollanukkaran,
Maciej Czekaj [C],
Shijith Thotton, Srisivasubramanian Srinivasan, Harman Kalra,
rahul.lakkireddy, johndale, hyonkim, liudongdong3, yisen.zhuang,
xuanziyang2, cloud.wangxiaoyun, zhouguoyang, simei.su,
wenjun1.wu, qiming.yang, Yuying.Zhang, beilei.xing, xiao.w.wang,
jingjing.wu, junfeng.guo, rosen.xu, Nithin Kumar Dabilpuram,
Kiran Kumar Kokkilagadda, Sunil Kumar Kori,
Satha Koteswara Rao Kottidi, Liron Himi, zr, Radha Chintakuntla,
Veerasenareddy Burru, Sathesh B Edara, matan, viacheslavo,
sthemmin, longli, spinler, chaoyong.he, niklas.soderlund,
hemant.agrawal, sachin.saxena, g.singh, apeksha.gupta,
sachin.saxena, aboyer, Rasesh Mody, Shahed Shaikh,
Devendra Singh Rawat, jiawenwu, jianwang, jbehrens,
maxime.coquelin, chenbo.xia, steven.webster, matt.peters,
bruce.richardson, mtetsuyah, grive, jasvinder.singh,
cristian.dumitrescu, jgrajcia
On 10/6/22 10:24, Ankur Dwivedi wrote:
> Hi Andrew,
>
>> -----Original Message-----
>> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> Sent: Thursday, October 6, 2022 12:40 PM
>> To: Ankur Dwivedi <adwivedi@marvell.com>; dev@dpdk.org
>> Cc: thomas@monjalon.net; mdr@ashroe.eu; orika@nvidia.com;
>> ferruh.yigit@xilinx.com; chas3@att.com; humin29@huawei.com;
>> linville@tuxdriver.com; ciara.loftus@intel.com; qi.z.zhang@intel.com;
>> mw@semihalf.com; mk@semihalf.com; shaibran@amazon.com;
>> evgenys@amazon.com; igorch@amazon.com; chandu@amd.com; Igor
>> Russkikh <irusskikh@marvell.com>; shepard.siegel@atomicrules.com;
>> ed.czeck@atomicrules.com; john.miller@atomicrules.com;
>> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Jerin Jacob
>> Kollanukkaran <jerinj@marvell.com>; Maciej Czekaj [C]
>> <mczekaj@marvell.com>; Shijith Thotton <sthotton@marvell.com>;
>> Srisivasubramanian Srinivasan <srinivasan@marvell.com>; Harman Kalra
>> <hkalra@marvell.com>; rahul.lakkireddy@chelsio.com; johndale@cisco.com;
>> hyonkim@cisco.com; liudongdong3@huawei.com;
>> yisen.zhuang@huawei.com; xuanziyang2@huawei.com;
>> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
>> simei.su@intel.com; wenjun1.wu@intel.com; qiming.yang@intel.com;
>> Yuying.Zhang@intel.com; beilei.xing@intel.com; xiao.w.wang@intel.com;
>> jingjing.wu@intel.com; junfeng.guo@intel.com; rosen.xu@intel.com; Nithin
>> Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda
>> <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha
>> Koteswara Rao Kottidi <skoteshwar@marvell.com>; Liron Himi
>> <lironh@marvell.com>; zr@semihalf.com; Radha Chintakuntla
>> <radhac@marvell.com>; Veerasenareddy Burru <vburru@marvell.com>;
>> Sathesh B Edara <sedara@marvell.com>; matan@nvidia.com;
>> viacheslavo@nvidia.com; sthemmin@microsoft.com; longli@microsoft.com;
>> spinler@cesnet.cz; chaoyong.he@corigine.com;
>> niklas.soderlund@corigine.com; hemant.agrawal@nxp.com;
>> sachin.saxena@oss.nxp.com; g.singh@nxp.com; apeksha.gupta@nxp.com;
>> sachin.saxena@nxp.com; aboyer@pensando.io; Rasesh Mody
>> <rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>; Devendra
>> Singh Rawat <dsinghrawat@marvell.com>; jiawenwu@trustnetic.com;
>> jianwang@trustnetic.com; jbehrens@vmware.com;
>> maxime.coquelin@redhat.com; chenbo.xia@intel.com;
>> steven.webster@windriver.com; matt.peters@windriver.com;
>> bruce.richardson@intel.com; mtetsuyah@gmail.com; grive@u256.net;
>> jasvinder.singh@intel.com; cristian.dumitrescu@intel.com;
>> jgrajcia@cisco.com
>> Subject: [EXT] Re: [PATCH v2 1/4] ethdev: add trace points
>>
>> External Email
>>
>> ----------------------------------------------------------------------
>> On 9/29/22 13:29, Ankur Dwivedi wrote:
>>> Add trace points for ethdev functions.
>>>
>>> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
>>
>> [snip]
>>
>>> @@ -5867,6 +6010,7 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id,
>> uint64_t *features)
>>> {
>>> struct rte_eth_dev *dev;
>>>
>>> + rte_eth_trace_rx_metadata_negotiate(port_id, features);
>>
>> features are in/out, so it would be interesting to values, not just pointer and
>> both values: input and output.
> [Ankur] Will add a emit line to display the uint64_t input value of features.
What about output?
>>
>>> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>> dev = &rte_eth_devices[port_id];
>>>
>>
>> [snip]
>>
>>> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index
>>> 3def7bfd24..e3d603cc9a 100644
>>> --- a/lib/ethdev/version.map
>>> +++ b/lib/ethdev/version.map
>>> @@ -288,6 +288,150 @@ EXPERIMENTAL {
>>>
>>> # added in 22.11
>>> rte_flow_async_action_handle_query;
>>> + __rte_eth_trace_add_first_rx_callback;
>>
>> Why is it in EXPERIMENTAL section, but not INTERNAL?
> [Ankur] Because the functions for which trace is added are not internal functions.
Sorry, but I don't understand. I agree that tracing of
public inline functions must be part of ABI, but why
everything else should be a part of ABI?
>>
>> [snip]
>>
>>> INTERNAL
^ permalink raw reply [relevance 4%]
* [PATCH 2/2] kni: add deprecation warning at runtime
@ 2022-10-05 14:34 4% ` Bruce Richardson
2 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2022-10-05 14:34 UTC (permalink / raw)
To: dev; +Cc: techboard, Bruce Richardson
When KNI is being used at runtime, output a warning message about its
deprecated status. This is part of the deprecation process for KNI
agreed by the DPDK technical board.[1]
[1] http://mails.dpdk.org/archives/dev/2022-June/243596.html
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 6 ++----
lib/kni/rte_kni.c | 2 ++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 6c2fc15c77..8d99ce5f2f 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -44,10 +44,8 @@ Deprecation Notices
applications - other technologies such as virtio-user are recommended instead.
Following the DPDK technical board
`decision <https://mails.dpdk.org/archives/dev/2021-January/197077.html>`_
- and `refinement <http://mails.dpdk.org/archives/dev/2022-June/243596.html>`_:
-
- * Some deprecation warnings will be added in DPDK 22.11.
- * The KNI kernel module, library and PMD will be removed from the DPDK 23.11.
+ and `refinement <http://mails.dpdk.org/archives/dev/2022-June/243596.html>`_,
+ the KNI kernel module, library and PMD will be removed from the DPDK 23.11 release.
* lib: will fix extending some enum/define breaking the ABI. There are multiple
samples in DPDK that enum/define terminated with a ``.*MAX.*`` value which is
diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c
index 7971c56bb4..eb7c10ff19 100644
--- a/lib/kni/rte_kni.c
+++ b/lib/kni/rte_kni.c
@@ -96,6 +96,8 @@ static volatile int kni_fd = -1;
int
rte_kni_init(unsigned int max_kni_ifaces __rte_unused)
{
+ RTE_LOG(WARNING, KNI, "WARNING: KNI is deprecated and will be removed in DPDK 23.11\n");
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
if (rte_eal_iova_mode() != RTE_IOVA_PA) {
RTE_LOG(ERR, KNI, "KNI requires IOVA as PA\n");
--
2.34.1
^ permalink raw reply [relevance 4%]
* Re: [PATCH v2] drivers/bus: set device NUMA node to unknown by default
2022-10-05 9:04 0% ` Olivier Matz
@ 2022-10-05 9:32 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2022-10-05 9:32 UTC (permalink / raw)
To: David Marchand, Olivier Matz
Cc: dev, Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
Sachin Saxena, Stephen Hemminger, Long Li, Ferruh Yigit,
Andrew Rybchenko
05/10/2022 11:04, Olivier Matz:
> Hi David,
>
> On Wed, Oct 05, 2022 at 10:52:49AM +0200, David Marchand wrote:
> > On Tue, Oct 4, 2022 at 4:59 PM Olivier Matz <olivier.matz@6wind.com> wrote:
> > >
> > > The dev->device.numa_node field is set by each bus driver for
> > > every device it manages to indicate on which NUMA node this device lies.
> > >
> > > When this information is unknown, the assigned value is not consistent
> > > across the bus drivers.
> > >
> > > Set the default value to SOCKET_ID_ANY (-1) by all bus drivers
> > > when the NUMA information is unavailable. This change impacts
> > > rte_eth_dev_socket_id() in the same manner.
> > >
> > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > > ---
> > >
> > > v2
> > > * use SOCKET_ID_ANY instead of -1 in drivers/dma/idxd (David)
> > > * document the behavior change of rte_eth_dev_socket_id()
> > > * fix few examples where rte_eth_dev_socket_id() was expected to
> > > return 0 on unknown socket
> >
> > Cc: ethdev maintainers.
> >
> > [snip]
> >
> > > diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> > > index 53fe21453c..d52f823694 100644
> > > --- a/doc/guides/rel_notes/release_22_11.rst
> > > +++ b/doc/guides/rel_notes/release_22_11.rst
> > > @@ -317,6 +317,12 @@ ABI Changes
> > > * eventdev: Added ``weight`` and ``affinity`` fields
> > > to ``rte_event_queue_conf`` structure.
> > >
> > > +* bus: Changed the device numa node to -1 when NUMA information is unavailable.
> > > + The ``dev->device.numa_node`` field is set by each bus driver for
> > > + every device it manages to indicate on which NUMA node this device lies.
> > > + When this information is unknown, the assigned value was not consistent
> > > + across the bus drivers. This similarly impacts ``rte_eth_dev_socket_id()``.
> > > +
> > >
> > > Known Issues
> > > ------------
> >
> > [snip]
> >
> > > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> > > index a21f58b9cd..dd8d25d6d4 100644
> > > --- a/lib/ethdev/rte_ethdev.h
> > > +++ b/lib/ethdev/rte_ethdev.h
> > > @@ -2445,8 +2445,8 @@ int rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port);
> > > * The port identifier of the Ethernet device
> > > * @return
> > > * The NUMA socket ID to which the Ethernet device is connected or
> > > - * a default of zero if the socket could not be determined.
> > > - * -1 is returned is the port_id value is out of range.
> > > + * a default of -1 (SOCKET_ID_ANY) if the socket could not be determined.
> > > + * -1 is also returned if the port_id is invalid.
> > > */
> > > int rte_eth_dev_socket_id(uint16_t port_id);
> >
> > It would be better to distinguish the two cases, using rte_errno.
> > Something like:
> >
> > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> > index 2821770e2d..1baf302804 100644
> > --- a/lib/ethdev/rte_ethdev.c
> > +++ b/lib/ethdev/rte_ethdev.c
> > @@ -562,8 +562,16 @@ rte_eth_dev_owner_get(const uint16_t port_id,
> > struct rte_eth_dev_owner *owner)
> > int
> > rte_eth_dev_socket_id(uint16_t port_id)
> > {
> > - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
> > - return rte_eth_devices[port_id].data->numa_node;
> > + int socket_id = SOCKET_ID_ANY;
> > +
> > + if (!rte_eth_dev_is_valid_port(port_id))
> > + rte_errno = EINVAL;
> > + } else {
> > + socket_id = rte_eth_devices[port_id].data->numa_node;
> > + if (socket_id == SOCKET_ID_ANY)
> > + rte_errno = 0;
> > + }
> > + return socket_id;
> > }
> >
> > void *
> > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> > index dd8d25d6d4..03456b2dbb 100644
> > --- a/lib/ethdev/rte_ethdev.h
> > +++ b/lib/ethdev/rte_ethdev.h
> > @@ -2444,9 +2444,11 @@ int rte_eth_hairpin_unbind(uint16_t tx_port,
> > uint16_t rx_port);
> > * @param port_id
> > * The port identifier of the Ethernet device
> > * @return
> > - * The NUMA socket ID to which the Ethernet device is connected or
> > - * a default of -1 (SOCKET_ID_ANY) if the socket could not be determined.
> > - * -1 is also returned if the port_id is invalid.
> > + * - The NUMA socket ID which the Ethernet device is connected to.
> > + * - -1 (which translates to SOCKET_ID_ANY) if the socket could not be
> > + * determined. rte_errno is then set to:
> > + * - EINVAL is the port_id is invalid,
> > + * - 0 is the socket could not be determined,
> > */
> > int rte_eth_dev_socket_id(uint16_t port_id);
> >
> > WDYT?
>
> As discussed off-list, it is indeed better.
+1
Note that the decision to take in case of EINVAL
requires some work for each call to rte_eth_dev_socket_id().
I suppose we can leave it as a future exercise.
^ permalink raw reply [relevance 0%]
* Re: [PATCH v2] drivers/bus: set device NUMA node to unknown by default
2022-10-05 8:52 0% ` David Marchand
@ 2022-10-05 9:04 0% ` Olivier Matz
2022-10-05 9:32 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Olivier Matz @ 2022-10-05 9:04 UTC (permalink / raw)
To: David Marchand
Cc: dev, Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
Sachin Saxena, Stephen Hemminger, Long Li, Ferruh Yigit,
Andrew Rybchenko, Thomas Monjalon
Hi David,
On Wed, Oct 05, 2022 at 10:52:49AM +0200, David Marchand wrote:
> On Tue, Oct 4, 2022 at 4:59 PM Olivier Matz <olivier.matz@6wind.com> wrote:
> >
> > The dev->device.numa_node field is set by each bus driver for
> > every device it manages to indicate on which NUMA node this device lies.
> >
> > When this information is unknown, the assigned value is not consistent
> > across the bus drivers.
> >
> > Set the default value to SOCKET_ID_ANY (-1) by all bus drivers
> > when the NUMA information is unavailable. This change impacts
> > rte_eth_dev_socket_id() in the same manner.
> >
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > ---
> >
> > v2
> > * use SOCKET_ID_ANY instead of -1 in drivers/dma/idxd (David)
> > * document the behavior change of rte_eth_dev_socket_id()
> > * fix few examples where rte_eth_dev_socket_id() was expected to
> > return 0 on unknown socket
>
> Cc: ethdev maintainers.
>
> [snip]
>
> > diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> > index 53fe21453c..d52f823694 100644
> > --- a/doc/guides/rel_notes/release_22_11.rst
> > +++ b/doc/guides/rel_notes/release_22_11.rst
> > @@ -317,6 +317,12 @@ ABI Changes
> > * eventdev: Added ``weight`` and ``affinity`` fields
> > to ``rte_event_queue_conf`` structure.
> >
> > +* bus: Changed the device numa node to -1 when NUMA information is unavailable.
> > + The ``dev->device.numa_node`` field is set by each bus driver for
> > + every device it manages to indicate on which NUMA node this device lies.
> > + When this information is unknown, the assigned value was not consistent
> > + across the bus drivers. This similarly impacts ``rte_eth_dev_socket_id()``.
> > +
> >
> > Known Issues
> > ------------
>
> [snip]
>
> > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> > index a21f58b9cd..dd8d25d6d4 100644
> > --- a/lib/ethdev/rte_ethdev.h
> > +++ b/lib/ethdev/rte_ethdev.h
> > @@ -2445,8 +2445,8 @@ int rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port);
> > * The port identifier of the Ethernet device
> > * @return
> > * The NUMA socket ID to which the Ethernet device is connected or
> > - * a default of zero if the socket could not be determined.
> > - * -1 is returned is the port_id value is out of range.
> > + * a default of -1 (SOCKET_ID_ANY) if the socket could not be determined.
> > + * -1 is also returned if the port_id is invalid.
> > */
> > int rte_eth_dev_socket_id(uint16_t port_id);
>
> It would be better to distinguish the two cases, using rte_errno.
> Something like:
>
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 2821770e2d..1baf302804 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -562,8 +562,16 @@ rte_eth_dev_owner_get(const uint16_t port_id,
> struct rte_eth_dev_owner *owner)
> int
> rte_eth_dev_socket_id(uint16_t port_id)
> {
> - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
> - return rte_eth_devices[port_id].data->numa_node;
> + int socket_id = SOCKET_ID_ANY;
> +
> + if (!rte_eth_dev_is_valid_port(port_id))
> + rte_errno = EINVAL;
> + } else {
> + socket_id = rte_eth_devices[port_id].data->numa_node;
> + if (socket_id == SOCKET_ID_ANY)
> + rte_errno = 0;
> + }
> + return socket_id;
> }
>
> void *
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index dd8d25d6d4..03456b2dbb 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -2444,9 +2444,11 @@ int rte_eth_hairpin_unbind(uint16_t tx_port,
> uint16_t rx_port);
> * @param port_id
> * The port identifier of the Ethernet device
> * @return
> - * The NUMA socket ID to which the Ethernet device is connected or
> - * a default of -1 (SOCKET_ID_ANY) if the socket could not be determined.
> - * -1 is also returned if the port_id is invalid.
> + * - The NUMA socket ID which the Ethernet device is connected to.
> + * - -1 (which translates to SOCKET_ID_ANY) if the socket could not be
> + * determined. rte_errno is then set to:
> + * - EINVAL is the port_id is invalid,
> + * - 0 is the socket could not be determined,
> */
> int rte_eth_dev_socket_id(uint16_t port_id);
>
> WDYT?
As discussed off-list, it is indeed better.
Thanks for the review
Olivier
^ permalink raw reply [relevance 0%]
* Re: [PATCH v2] drivers/bus: set device NUMA node to unknown by default
2022-10-04 14:58 3% ` [PATCH v2] " Olivier Matz
@ 2022-10-05 8:52 0% ` David Marchand
2022-10-05 9:04 0% ` Olivier Matz
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-10-05 8:52 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
Sachin Saxena, Stephen Hemminger, Long Li, Ferruh Yigit,
Andrew Rybchenko, Thomas Monjalon
On Tue, Oct 4, 2022 at 4:59 PM Olivier Matz <olivier.matz@6wind.com> wrote:
>
> The dev->device.numa_node field is set by each bus driver for
> every device it manages to indicate on which NUMA node this device lies.
>
> When this information is unknown, the assigned value is not consistent
> across the bus drivers.
>
> Set the default value to SOCKET_ID_ANY (-1) by all bus drivers
> when the NUMA information is unavailable. This change impacts
> rte_eth_dev_socket_id() in the same manner.
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---
>
> v2
> * use SOCKET_ID_ANY instead of -1 in drivers/dma/idxd (David)
> * document the behavior change of rte_eth_dev_socket_id()
> * fix few examples where rte_eth_dev_socket_id() was expected to
> return 0 on unknown socket
Cc: ethdev maintainers.
[snip]
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 53fe21453c..d52f823694 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -317,6 +317,12 @@ ABI Changes
> * eventdev: Added ``weight`` and ``affinity`` fields
> to ``rte_event_queue_conf`` structure.
>
> +* bus: Changed the device numa node to -1 when NUMA information is unavailable.
> + The ``dev->device.numa_node`` field is set by each bus driver for
> + every device it manages to indicate on which NUMA node this device lies.
> + When this information is unknown, the assigned value was not consistent
> + across the bus drivers. This similarly impacts ``rte_eth_dev_socket_id()``.
> +
>
> Known Issues
> ------------
[snip]
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index a21f58b9cd..dd8d25d6d4 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -2445,8 +2445,8 @@ int rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port);
> * The port identifier of the Ethernet device
> * @return
> * The NUMA socket ID to which the Ethernet device is connected or
> - * a default of zero if the socket could not be determined.
> - * -1 is returned is the port_id value is out of range.
> + * a default of -1 (SOCKET_ID_ANY) if the socket could not be determined.
> + * -1 is also returned if the port_id is invalid.
> */
> int rte_eth_dev_socket_id(uint16_t port_id);
It would be better to distinguish the two cases, using rte_errno.
Something like:
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 2821770e2d..1baf302804 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -562,8 +562,16 @@ rte_eth_dev_owner_get(const uint16_t port_id,
struct rte_eth_dev_owner *owner)
int
rte_eth_dev_socket_id(uint16_t port_id)
{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
- return rte_eth_devices[port_id].data->numa_node;
+ int socket_id = SOCKET_ID_ANY;
+
+ if (!rte_eth_dev_is_valid_port(port_id))
+ rte_errno = EINVAL;
+ } else {
+ socket_id = rte_eth_devices[port_id].data->numa_node;
+ if (socket_id == SOCKET_ID_ANY)
+ rte_errno = 0;
+ }
+ return socket_id;
}
void *
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index dd8d25d6d4..03456b2dbb 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -2444,9 +2444,11 @@ int rte_eth_hairpin_unbind(uint16_t tx_port,
uint16_t rx_port);
* @param port_id
* The port identifier of the Ethernet device
* @return
- * The NUMA socket ID to which the Ethernet device is connected or
- * a default of -1 (SOCKET_ID_ANY) if the socket could not be determined.
- * -1 is also returned if the port_id is invalid.
+ * - The NUMA socket ID which the Ethernet device is connected to.
+ * - -1 (which translates to SOCKET_ID_ANY) if the socket could not be
+ * determined. rte_errno is then set to:
+ * - EINVAL is the port_id is invalid,
+ * - 0 is the socket could not be determined,
*/
int rte_eth_dev_socket_id(uint16_t port_id);
WDYT?
--
David Marchand
^ permalink raw reply [relevance 0%]
* RE: [PATCH v4] mempool: fix mempool cache flushing algorithm
@ 2022-10-04 20:01 0% ` Morten Brørup
0 siblings, 0 replies; 200+ results
From: Morten Brørup @ 2022-10-04 20:01 UTC (permalink / raw)
To: andrew.rybchenko; +Cc: bruce.richardson, jerinjacobk, dev, olivier.matz
> From: Morten Brørup [mailto:mb@smartsharesystems.com]
> Sent: Wednesday, 2 February 2022 11.34
>
> This patch fixes the rte_mempool_do_generic_put() caching algorithm,
> which was fundamentally wrong, causing multiple performance issues when
> flushing.
>
> Although the bugs do have serious performance implications when
> flushing, the function did not fail when flushing (or otherwise).
> Backporting could be considered optional.
>
> The algorithm was:
> 1. Add the objects to the cache
> 2. Anything greater than the cache size (if it crosses the cache flush
> threshold) is flushed to the ring.
>
> Please note that the description in the source code said that it kept
> "cache min value" objects after flushing, but the function actually
> kept
> the cache full after flushing, which the above description reflects.
>
> Now, the algorithm is:
> 1. If the objects cannot be added to the cache without crossing the
> flush threshold, flush the cache to the ring.
> 2. Add the objects to the cache.
>
> This patch fixes these bugs:
>
> 1. The cache was still full after flushing.
> In the opposite direction, i.e. when getting objects from the cache,
> the
> cache is refilled to full level when it crosses the low watermark
> (which
> happens to be zero).
> Similarly, the cache should be flushed to empty level when it crosses
> the high watermark (which happens to be 1.5 x the size of the cache).
> The existing flushing behaviour was suboptimal for real applications,
> because crossing the low or high watermark typically happens when the
> application is in a state where the number of put/get events are out of
> balance, e.g. when absorbing a burst of packets into a QoS queue
> (getting more mbufs from the mempool), or when a burst of packets is
> trickling out from the QoS queue (putting the mbufs back into the
> mempool).
> Now, the mempool cache is completely flushed when crossing the flush
> threshold, so only the newly put (hot) objects remain in the mempool
> cache afterwards.
>
> This bug degraded performance caused by too frequent flushing.
>
> Consider this application scenario:
>
> Either, an lcore thread in the application is in a state of balance,
> where it uses the mempool cache within its flush/refill boundaries; in
> this situation, the flush method is less important, and this fix is
> irrelevant.
>
> Or, an lcore thread in the application is out of balance (either
> permanently or temporarily), and mostly gets or puts objects from/to
> the
> mempool. If it mostly puts objects, not flushing all of the objects
> will
> cause more frequent flushing. This is the scenario addressed by this
> fix. E.g.:
>
> Cache size=256, flushthresh=384 (1.5x size), initial len=256;
> application burst len=32.
>
> If there are "size" objects in the cache after flushing, the cache is
> flushed at every 4th burst.
>
> If the cache is flushed completely, the cache is only flushed at every
> 16th burst.
>
> As you can see, this bug caused the cache to be flushed 4x too
> frequently in this example.
>
> And when/if the application thread breaks its pattern of continuously
> putting objects, and suddenly starts to get objects instead, it will
> either get objects already in the cache, or the get() function will
> refill the cache.
>
> The concept of not flushing the cache completely was probably based on
> an assumption that it is more likely for an application's lcore thread
> to get() after flushing than to put() after flushing.
> I strongly disagree with this assumption! If an application thread is
> continuously putting so much that it overflows the cache, it is much
> more likely to keep putting than it is to start getting. If in doubt,
> consider how CPU branch predictors work: When the application has done
> something many times consecutively, the branch predictor will expect
> the
> application to do the same again, rather than suddenly do something
> else.
>
> Also, if you consider the description of the algorithm in the source
> code, and agree that "cache min value" cannot mean "cache size", the
> function did not behave as intended. This in itself is a bug.
>
> 2. The flush threshold comparison was off by one.
> It must be "len > flushthresh", not "len >= flushthresh".
> Consider a flush multiplier of 1 instead of 1.5; the cache would be
> flushed already when reaching size objecs, not when exceeding size
> objects. In other words, the cache would not be able to hold "size"
> objects, which is clearly a bug.
> Now, flushing is triggered when the flush threshold is exceeded, not
> when reached.
>
> This bug degraded performance due to premature flushing. In my example
> above, this bug caused flushing every 3rd burst instead of every 4th.
>
> 3. The most recent (hot) objects were flushed, leaving the oldest
> (cold)
> objects in the mempool cache.
> This bug degraded performance, because flushing prevented immediate
> reuse of the (hot) objects already in the CPU cache.
> Now, the existing (cold) objects in the mempool cache are flushed
> before
> the new (hot) objects are added the to the mempool cache.
>
> 4. With RTE_LIBRTE_MEMPOOL_DEBUG defined, the return value of
> rte_mempool_ops_enqueue_bulk() was not checked when flushing the cache.
> Now, it is checked in both locations where used; and obviously still
> only if RTE_LIBRTE_MEMPOOL_DEBUG is defined.
>
> v2 changes:
>
> - Not adding the new objects to the mempool cache before flushing it
> also allows the memory allocated for the mempool cache to be reduced
> from 3 x to 2 x RTE_MEMPOOL_CACHE_MAX_SIZE.
> However, such this change would break the ABI, so it was removed in v2.
>
> - The mempool cache should be cache line aligned for the benefit of the
> copying method, which on some CPU architectures performs worse on data
> crossing a cache boundary.
> However, such this change would break the ABI, so it was removed in v2;
> and yet another alternative copying method replaced the rte_memcpy().
>
> v3 changes:
>
> - Actually remove my modifications of the rte_mempool_cache structure.
>
> v4 changes:
>
> - Updated patch title to reflect that the scope of the patch is only
> mempool cache flushing.
>
> - Do not replace rte_memcpy() with alternative copying method. This was
> a pure optimization, not a fix.
>
> - Elaborate even more on the bugs fixed by the modifications.
>
> - Added 4th bullet item to the patch description, regarding
> rte_mempool_ops_enqueue_bulk() with RTE_LIBRTE_MEMPOOL_DEBUG.
>
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> ---
> lib/mempool/rte_mempool.h | 34 ++++++++++++++++++++++------------
> 1 file changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
> index 1e7a3c1527..e7e09e48fc 100644
> --- a/lib/mempool/rte_mempool.h
> +++ b/lib/mempool/rte_mempool.h
> @@ -1344,31 +1344,41 @@ rte_mempool_do_generic_put(struct rte_mempool
> *mp, void * const *obj_table,
> if (unlikely(cache == NULL || n > RTE_MEMPOOL_CACHE_MAX_SIZE))
> goto ring_enqueue;
>
> - cache_objs = &cache->objs[cache->len];
> + /* If the request itself is too big for the cache */
> + if (unlikely(n > cache->flushthresh))
> + goto ring_enqueue;
>
> /*
> * The cache follows the following algorithm
> - * 1. Add the objects to the cache
> - * 2. Anything greater than the cache min value (if it crosses
> the
> - * cache flush threshold) is flushed to the ring.
> + * 1. If the objects cannot be added to the cache without
> + * crossing the flush threshold, flush the cache to the ring.
> + * 2. Add the objects to the cache.
> */
>
> - /* Add elements back into the cache */
> - rte_memcpy(&cache_objs[0], obj_table, sizeof(void *) * n);
> + if (cache->len + n <= cache->flushthresh) {
> + cache_objs = &cache->objs[cache->len];
>
> - cache->len += n;
> + cache->len += n;
> + } else {
> + cache_objs = &cache->objs[0];
>
> - if (cache->len >= cache->flushthresh) {
> - rte_mempool_ops_enqueue_bulk(mp, &cache->objs[cache->size],
> - cache->len - cache->size);
> - cache->len = cache->size;
> +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
> + if (rte_mempool_ops_enqueue_bulk(mp, cache_objs, cache-
> >len) < 0)
> + rte_panic("cannot put objects in mempool\n");
> +#else
> + rte_mempool_ops_enqueue_bulk(mp, cache_objs, cache->len);
> +#endif
> + cache->len = n;
> }
>
> + /* Add the objects to the cache. */
> + rte_memcpy(cache_objs, obj_table, sizeof(void *) * n);
> +
> return;
>
> ring_enqueue:
>
> - /* push remaining objects in ring */
> + /* Put the objects into the ring */
> #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
> if (rte_mempool_ops_enqueue_bulk(mp, obj_table, n) < 0)
> rte_panic("cannot put objects in mempool\n");
> --
> 2.17.1
Andrew, would you please also take a look at this patch and share your opinion.
I guess that the most controversial change in the patch is that it leaves the mempool cache nearly empty after flushing it.
Without the patch, the mempool cache is left full (at 100% size) after flushing. (Flushing is triggered by crossing the flush threshold, which is 50% above the cache size. This is not changed by the patch.)
As described with the patch, I consider this behavior incorrect: In periods where an application is sending more from its QoS queues that goes into the QoS queues, the mempool_put() function is called more often than the mempool_get() function, so there will naturally be consecutive cache flushing.
Many applications use QoS queues or similar traffic shapers, so mempool cache flushing is not as infrequent and exotic as some might think! (And flushing a burst of packets from the mempool cache to the underlying mempool is considered costly.)
Without the patch, consecutive cache flushing will be processed as many small flushes, because only the 50% objects above the cache size (the objects between the cache size and the cache threshold) are flushed each time.
With the patch, the flushes will be fewer and larger, because the full 150% cache size (every object in the cache up to the cache threshold) will be flushed each time.
PS: Bruce and I discussed this patch back in April, but didn't reach a conclusion. You might find some insights in that mail thread.
^ permalink raw reply [relevance 0%]
* [PATCH v8 1/6] cryptodev: rework session framework
@ 2022-10-04 17:37 1% ` Akhil Goyal
0 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-10-04 17:37 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, lironh, royzhang1980,
sunilprakashrao.uttarwar, kai.ji, rnagadheeraj, jianjay.zhou,
radu.nicolau, Akhil Goyal, Ruifeng Wang, David Coyle,
Kevin O'Sullivan
As per current design, rte_cryptodev_sym_session_create() and
rte_cryptodev_sym_session_init() use separate mempool objects
for a single session.
And structure rte_cryptodev_sym_session is not directly used
by the application, it may cause ABI breakage if the structure
is modified in future.
To address these two issues, the rte_cryptodev_sym_session_create
will take one mempool object that the session and session private
data are virtually/physically contiguous, and initializes both
fields. The API rte_cryptodev_sym_session_init is removed.
rte_cryptodev_sym_session_create will now return an opaque session
pointer which will be used by the app and other APIs.
In data path, opaque session pointer is attached to rte_crypto_op
and the PMD can call an internal library API to get the session
private data pointer based on the driver id.
Note: currently single session may be used by different device
drivers, given it is initialized by them. After the change the
session created by one device driver cannot be used or
reinitialized by another driver.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Ruifeng Wang <Ruifeng.Wang@arm.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test-crypto-perf/cperf_ops.c | 21 +-
app/test-crypto-perf/cperf_test_latency.c | 6 +-
.../cperf_test_pmd_cyclecount.c | 5 +-
app/test-crypto-perf/cperf_test_throughput.c | 6 +-
app/test-crypto-perf/cperf_test_verify.c | 6 +-
app/test-crypto-perf/main.c | 29 +-
app/test-eventdev/test_perf_common.c | 35 +-
app/test-eventdev/test_perf_common.h | 1 -
app/test/test_cryptodev.c | 303 +++++-------------
app/test/test_cryptodev_blockcipher.c | 16 +-
app/test/test_event_crypto_adapter.c | 35 +-
app/test/test_ipsec.c | 42 +--
drivers/crypto/armv8/armv8_pmd_private.h | 2 -
drivers/crypto/armv8/rte_armv8_pmd.c | 21 +-
drivers/crypto/armv8/rte_armv8_pmd_ops.c | 35 +-
drivers/crypto/bcmfs/bcmfs_sym_session.c | 38 +--
drivers/crypto/bcmfs/bcmfs_sym_session.h | 3 +-
drivers/crypto/caam_jr/caam_jr.c | 28 +-
drivers/crypto/ccp/ccp_crypto.c | 58 +---
drivers/crypto/ccp/ccp_pmd_ops.c | 32 +-
drivers/crypto/ccp/ccp_pmd_private.h | 2 -
drivers/crypto/ccp/rte_ccp_pmd.c | 29 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 36 +--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 31 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 55 +---
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 14 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 31 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 3 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 37 +--
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 4 +-
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 34 +-
drivers/crypto/ipsec_mb/ipsec_mb_private.h | 41 ++-
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 48 +--
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 36 +--
drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 4 -
drivers/crypto/ipsec_mb/pmd_kasumi.c | 10 +-
drivers/crypto/ipsec_mb/pmd_snow3g.c | 9 +-
drivers/crypto/ipsec_mb/pmd_zuc.c | 4 -
drivers/crypto/mlx5/mlx5_crypto.c | 26 +-
drivers/crypto/mvsam/rte_mrvl_pmd.c | 8 +-
drivers/crypto/mvsam/rte_mrvl_pmd_ops.c | 21 +-
drivers/crypto/nitrox/nitrox_sym.c | 39 +--
drivers/crypto/null/null_crypto_pmd.c | 19 +-
drivers/crypto/null/null_crypto_pmd_ops.c | 33 +-
drivers/crypto/null/null_crypto_pmd_private.h | 2 -
.../crypto/octeontx/otx_cryptodev_hw_access.h | 1 -
drivers/crypto/octeontx/otx_cryptodev_ops.c | 67 +---
drivers/crypto/openssl/openssl_pmd_private.h | 2 -
drivers/crypto/openssl/rte_openssl_pmd.c | 24 +-
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 29 +-
drivers/crypto/qat/qat_sym.c | 10 +-
drivers/crypto/qat/qat_sym.h | 4 +-
drivers/crypto/qat/qat_sym_session.c | 40 +--
drivers/crypto/qat/qat_sym_session.h | 6 +-
drivers/crypto/scheduler/scheduler_pmd_ops.c | 38 +--
drivers/crypto/virtio/virtio_cryptodev.c | 40 +--
drivers/crypto/virtio/virtio_rxtx.c | 3 +-
examples/fips_validation/fips_dev_self_test.c | 30 +-
examples/fips_validation/main.c | 35 +-
examples/ipsec-secgw/ipsec-secgw.c | 10 +-
examples/ipsec-secgw/ipsec.c | 7 +-
examples/l2fwd-crypto/main.c | 54 +---
examples/vhost_crypto/main.c | 16 +-
lib/cryptodev/cryptodev_pmd.h | 28 +-
lib/cryptodev/cryptodev_trace_points.c | 6 -
lib/cryptodev/rte_cryptodev.c | 278 ++++++----------
lib/cryptodev/rte_cryptodev.h | 123 ++-----
lib/cryptodev/rte_cryptodev_trace.h | 36 +--
lib/cryptodev/version.map | 6 -
lib/pipeline/rte_table_action.c | 10 +-
lib/vhost/rte_vhost_crypto.h | 3 -
lib/vhost/vhost_crypto.c | 28 +-
72 files changed, 556 insertions(+), 1676 deletions(-)
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index d746d51082..c6f5735bb0 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -912,7 +912,6 @@ cperf_create_session(struct rte_mempool *sess_mp,
&sess_conf, sess_mp, priv_mp);
}
#endif
- sess = rte_cryptodev_sym_session_create(sess_mp);
/*
* cipher only
*/
@@ -937,8 +936,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
cipher_xform.cipher.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &cipher_xform,
+ sess_mp);
/*
* auth only
*/
@@ -965,8 +964,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
auth_xform.auth.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &auth_xform,
+ sess_mp);
/*
* cipher and auth
*/
@@ -1024,13 +1023,13 @@ cperf_create_session(struct rte_mempool *sess_mp,
if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
cipher_xform.next = &auth_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &cipher_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &cipher_xform, sess_mp);
} else { /* auth then cipher */
auth_xform.next = &cipher_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &auth_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &auth_xform, sess_mp);
}
} else { /* options->op_type == CPERF_AEAD */
aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -1050,8 +1049,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
options->aead_aad_sz;
/* Create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &aead_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &aead_xform,
+ sess_mp);
}
return sess;
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index 6f972cea49..afd8cb209b 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -44,10 +44,8 @@ static void
cperf_latency_test_free(struct cperf_latency_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 3f2da13d3a..edd2730b73 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -74,10 +74,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
(struct rte_security_session *)ctx->sess);
} else
#endif
- {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index fba66bbde9..fa13915dc3 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -52,10 +52,8 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
(struct rte_security_session *)ctx->sess);
}
#endif
- else {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ else
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index b691595675..c1465db243 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -39,10 +39,8 @@ static void
cperf_verify_test_free(struct cperf_verify_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 27acd619bc..3469b836e1 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -97,35 +97,14 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
char mp_name[RTE_MEMPOOL_NAMESIZE];
struct rte_mempool *sess_mp;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- sess_mp = rte_mempool_create(mp_name,
- nb_sessions,
- session_priv_size,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (sess_mp == NULL) {
- printf("Cannot create pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- session_pool_socket[socket_id].priv_mp = sess_mp;
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
- nb_sessions, 0, 0, 0, socket_id);
+ nb_sessions, session_priv_size, 0, 0,
+ socket_id);
if (sess_mp == NULL) {
printf("Cannot create pool \"%s\" on socket %d\n",
@@ -136,6 +115,7 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
printf("Allocated pool \"%s\" on socket %d\n",
mp_name, socket_id);
session_pool_socket[socket_id].sess_mp = sess_mp;
+ session_pool_socket[socket_id].priv_mp = sess_mp;
}
return 0;
@@ -323,12 +303,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
return ret;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
if (opts->op_type == CPERF_ASYM_MODEX) {
qp_conf.mp_session = NULL;
- qp_conf.mp_session_private = NULL;
}
ret = rte_cryptodev_configure(cdev_id, &conf);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index 8472a87b99..cd3c1d7ef1 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -863,18 +863,13 @@ cryptodev_sym_sess_create(struct prod_data *p, struct test_perf *t)
cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
cipher_xform.next = NULL;
- sess = rte_cryptodev_sym_session_create(t->ca_sess_pool);
+ sess = rte_cryptodev_sym_session_create(p->ca.cdev_id, &cipher_xform,
+ t->ca_sess_pool);
if (sess == NULL) {
evt_err("Failed to create sym session");
return NULL;
}
- if (rte_cryptodev_sym_session_init(p->ca.cdev_id, sess, &cipher_xform,
- t->ca_sess_priv_pool)) {
- evt_err("Failed to init session");
- return NULL;
- }
-
return sess;
}
@@ -1381,15 +1376,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
goto err;
}
- t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
- "ca_sess_pool", nb_sessions, 0, 0,
- sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
- if (t->ca_sess_pool == NULL) {
- evt_err("Failed to create sym session pool");
- ret = -ENOMEM;
- goto err;
- }
-
max_session_size = 0;
for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
unsigned int session_size;
@@ -1400,12 +1386,11 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
max_session_size = session_size;
}
- max_session_size += sizeof(union rte_event_crypto_metadata);
- t->ca_sess_priv_pool = rte_mempool_create(
- "ca_sess_priv_pool", nb_sessions, max_session_size, 0, 0, NULL,
- NULL, NULL, NULL, SOCKET_ID_ANY, 0);
- if (t->ca_sess_priv_pool == NULL) {
- evt_err("failed to create sym session private pool");
+ t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
+ "ca_sess_pool", nb_sessions, max_session_size, 0,
+ sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
+ if (t->ca_sess_pool == NULL) {
+ evt_err("Failed to create sym session pool");
ret = -ENOMEM;
goto err;
}
@@ -1445,7 +1430,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
qp_conf.nb_descriptors = NB_CRYPTODEV_DESCRIPTORS;
qp_conf.mp_session = t->ca_sess_pool;
- qp_conf.mp_session_private = t->ca_sess_priv_pool;
for (qp_id = 0; qp_id < conf.nb_queue_pairs; qp_id++) {
ret = rte_cryptodev_queue_pair_setup(
@@ -1466,7 +1450,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
return ret;
@@ -1491,8 +1474,7 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
for (flow_id = 0; flow_id < t->nb_flows; flow_id++) {
sess = p->ca.crypto_sess[flow_id];
cdev_id = p->ca.cdev_id;
- rte_cryptodev_sym_session_clear(cdev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(cdev_id, sess);
}
rte_event_crypto_adapter_queue_pair_del(
@@ -1508,7 +1490,6 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
}
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index 8cbd06fe42..d06d52cdf8 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -70,7 +70,6 @@ struct test_perf {
RTE_EVENT_TIMER_ADAPTER_NUM_MAX] __rte_cache_aligned;
struct rte_mempool *ca_op_pool;
struct rte_mempool *ca_sess_pool;
- struct rte_mempool *ca_sess_priv_pool;
struct rte_mempool *ca_asym_sess_pool;
} __rte_cache_aligned;
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 0c39b16b71..ae2b102ecb 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -13,6 +13,7 @@
#include <rte_pause.h>
#include <rte_bus_vdev.h>
#include <rte_ether.h>
+#include <rte_errno.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
@@ -644,23 +645,17 @@ testsuite_setup(void)
}
ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
- "test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+ "test_sess_mp", MAX_NB_SESSIONS, session_size, 0, 0,
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
-
ts_params->session_priv_mpool = rte_mempool_create(
- "test_sess_mp_priv",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
+ "test_sess_mp_priv", MAX_NB_SESSIONS, session_size,
+ 0, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
+
TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
"session mempool allocation failed");
-
-
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
&ts_params->conf),
"Failed to configure cryptodev %u with %u qps",
@@ -668,7 +663,6 @@ testsuite_setup(void)
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -697,15 +691,11 @@ testsuite_teardown(void)
rte_mempool_avail_count(ts_params->op_mpool));
}
- /* Free session mempools */
- if (ts_params->session_priv_mpool != NULL) {
- rte_mempool_free(ts_params->session_priv_mpool);
- ts_params->session_priv_mpool = NULL;
- }
-
if (ts_params->session_mpool != NULL) {
rte_mempool_free(ts_params->session_mpool);
ts_params->session_mpool = NULL;
+ rte_mempool_free(ts_params->session_priv_mpool);
+ ts_params->session_priv_mpool = NULL;
}
res = rte_cryptodev_close(ts_params->valid_devs[0]);
@@ -1392,7 +1382,6 @@ dev_configure_and_start(uint64_t ff_disable)
ts_params->conf.ff_disable = ff_disable;
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
&ts_params->conf),
@@ -1452,10 +1441,8 @@ ut_teardown(void)
#endif
{
if (ut_params->sess) {
- rte_cryptodev_sym_session_clear(
- ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
- rte_cryptodev_sym_session_free(ut_params->sess);
ut_params->sess = NULL;
}
}
@@ -1610,7 +1597,6 @@ test_queue_pair_descriptor_setup(void)
*/
qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -2155,8 +2141,6 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
-
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2200,19 +2184,13 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
ut_params->auth_xform.auth.key.data = hmac_sha1_key;
ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
+ rte_errno = 0;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- /* Create crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ if (rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -2441,7 +2419,6 @@ create_wireless_algo_hash_session(uint8_t dev_id,
enum rte_crypto_auth_algorithm algo)
{
uint8_t hash_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2461,16 +2438,11 @@ create_wireless_algo_hash_session(uint8_t dev_id,
ut_params->auth_xform.auth.digest_length = auth_len;
ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
ut_params->auth_xform.auth.iv.length = iv_len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2483,7 +2455,6 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
uint8_t iv_len)
{
uint8_t cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2503,16 +2474,12 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session */
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2590,7 +2557,6 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
{
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2625,17 +2591,12 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2649,7 +2610,6 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
{
const uint8_t key_len = tdata->key.len;
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2689,16 +2649,11 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2724,7 +2679,6 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
uint8_t cipher_iv_len)
{
uint8_t auth_cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2755,26 +2709,19 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
if (cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
ut_params->auth_xform.next = NULL;
ut_params->cipher_xform.next = &ut_params->auth_xform;
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
} else
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -8205,7 +8152,6 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
uint8_t iv_len)
{
uint8_t aead_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -8227,15 +8173,12 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->aead_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->aead_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -8679,7 +8622,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
/* Create security session */
ut_params->sec_session = rte_security_session_create(ctx,
&sess_conf, ts_params->session_mpool,
- ts_params->session_priv_mpool);
+ NULL);
if (!ut_params->sec_session) {
printf("TestCase %s()-%d line %d failed %s: ",
@@ -12029,7 +11972,6 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
const struct HMAC_MD5_vector *test_case)
{
uint8_t key[64];
- int status;
memcpy(key, test_case->key.data, test_case->key.len);
@@ -12044,16 +11986,11 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
ut_params->auth_xform.auth.key.data = key;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- if (ut_params->sess == NULL)
- return TEST_FAILED;
-
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -12261,12 +12198,9 @@ test_multi_session(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
-
struct rte_cryptodev_info dev_info;
struct rte_cryptodev_sym_session **sessions;
-
uint16_t i;
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12293,20 +12227,15 @@ test_multi_session(void)
/* Create multiple crypto sessions*/
for (i = 0; i < MAX_NB_SESSIONS; i++) {
-
sessions[i] = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
+
TEST_ASSERT_NOT_NULL(sessions[i],
"Session creation failed at session number %u",
i);
-
- status = rte_cryptodev_sym_session_init(
- ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
/* Attempt to send a request on each session */
TEST_ASSERT_SUCCESS( test_AES_CBC_HMAC_SHA512_decrypt_perform(
sessions[i],
@@ -12336,18 +12265,9 @@ test_multi_session(void)
}
}
- sessions[i] = NULL;
- /* Next session create should fail */
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NULL(sessions[i],
- "Session creation succeeded unexpectedly!");
-
for (i = 0; i < MAX_NB_SESSIONS; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12398,7 +12318,6 @@ test_multi_session_random_usage(void)
},
};
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12420,11 +12339,6 @@ test_multi_session_random_usage(void)
* MAX_NB_SESSIONS) + 1, 0);
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- sessions[i] = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(sessions[i],
- "Session creation failed at session number %u",
- i);
rte_memcpy(&ut_paramz[i].ut_params, &unittest_params,
sizeof(struct crypto_unittest_params));
@@ -12434,16 +12348,16 @@ test_multi_session_random_usage(void)
ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
/* Create multiple crypto sessions*/
- status = rte_cryptodev_sym_session_init(
+ sessions[i] = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0],
- sessions[i],
&ut_paramz[i].ut_params.auth_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(sessions[i],
+ "Session creation failed at session number %u",
+ i);
}
srand(time(NULL));
@@ -12481,9 +12395,8 @@ test_multi_session_random_usage(void)
}
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12501,7 +12414,6 @@ test_null_invalid_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int ret;
/* This test is for NULL PMD only */
if (gbl_driver_id != rte_cryptodev_driver_id_get(
@@ -12515,17 +12427,13 @@ test_null_invalid_operation(void)
ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
-
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.next = NULL;
@@ -12533,14 +12441,11 @@ test_null_invalid_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
return TEST_SUCCESS;
@@ -12554,7 +12459,6 @@ test_null_burst_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
unsigned i, burst_len = NULL_BURST_LENGTH;
@@ -12580,19 +12484,14 @@ test_null_burst_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
/* Create Crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0],
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
@@ -12703,7 +12602,6 @@ test_enq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12803,7 +12701,6 @@ test_deq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12990,7 +12887,6 @@ static int create_gmac_session(uint8_t dev_id,
enum rte_crypto_auth_operation auth_op)
{
uint8_t auth_key[tdata->key.len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -13009,15 +12905,13 @@ static int create_gmac_session(uint8_t dev_id,
ut_params->auth_xform.auth.iv.length = tdata->iv.len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -13646,7 +13540,6 @@ create_auth_session(struct crypto_unittest_params *ut_params,
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -13660,15 +13553,13 @@ create_auth_session(struct crypto_unittest_params *ut_params,
ut_params->auth_xform.auth.digest_length = reference->digest.len;
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -13681,7 +13572,6 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -13713,15 +13603,13 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
}
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -14179,7 +14067,6 @@ test_authenticated_encrypt_with_esn(
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
struct rte_cryptodev_info dev_info;
- int status;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -14230,19 +14117,12 @@ test_authenticated_encrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
-
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
"Failed to allocate input buffer in mempool");
@@ -14366,18 +14246,11 @@ test_authenticated_decrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- retval = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- if (retval == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(retval, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
@@ -15125,8 +14998,8 @@ test_scheduler_attach_worker_op(void)
ts_params->session_mpool =
rte_cryptodev_sym_session_pool_create(
"test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0,
- SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, session_size,
+ 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
}
@@ -15149,8 +15022,6 @@ test_scheduler_attach_worker_op(void)
}
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private =
- ts_params->session_priv_mpool;
ret = rte_cryptodev_scheduler_worker_attach(sched_id,
(uint8_t)i);
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index b5813b956f..4fcdd55660 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -68,7 +68,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
struct rte_mempool *sess_mpool,
- struct rte_mempool *sess_priv_mpool,
uint8_t dev_id,
char *test_msg)
{
@@ -514,11 +513,9 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
*/
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) &&
nb_iterates == 0) {
- sess = rte_cryptodev_sym_session_create(sess_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, sess,
- init_xform, sess_priv_mpool);
- if (status == -ENOTSUP) {
+ sess = rte_cryptodev_sym_session_create(dev_id, init_xform,
+ sess_mpool);
+ if (sess == NULL) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "UNSUPPORTED");
status = TEST_SKIPPED;
goto error_exit;
@@ -801,10 +798,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
error_exit:
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- if (sess) {
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
- }
+ if (sess)
+ rte_cryptodev_sym_session_free(dev_id, sess);
rte_free(cipher_xform);
rte_free(auth_xform);
}
@@ -829,7 +824,6 @@ blockcipher_test_case_run(const void *data)
p_testsuite_params->mbuf_pool,
p_testsuite_params->op_mpool,
p_testsuite_params->session_mpool,
- p_testsuite_params->session_priv_mpool,
p_testsuite_params->valid_devs[0],
test_msg);
return status;
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index bb617c1042..0a7f8f8505 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -157,7 +157,6 @@ struct event_crypto_adapter_test_params {
struct rte_mempool *op_mpool;
struct rte_mempool *asym_op_mpool;
struct rte_mempool *session_mpool;
- struct rte_mempool *session_priv_mpool;
struct rte_mempool *asym_sess_mpool;
struct rte_cryptodev_config *config;
uint8_t crypto_event_port_id;
@@ -307,15 +306,10 @@ test_op_forward_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
-
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
&cap);
TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
@@ -683,8 +677,8 @@ test_op_new_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
@@ -699,9 +693,6 @@ test_op_new_mode(uint8_t session_less)
RTE_CRYPTO_OP_WITH_SESSION,
&m_data, sizeof(m_data));
}
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
rte_crypto_op_attach_sym_session(op, sess);
} else {
@@ -994,22 +985,12 @@ configure_cryptodev(void)
params.session_mpool = rte_cryptodev_sym_session_pool_create(
"CRYPTO_ADAPTER_SESSION_MP",
- MAX_NB_SESSIONS, 0, 0,
+ MAX_NB_SESSIONS, session_size, 0,
sizeof(union rte_event_crypto_metadata),
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(params.session_mpool,
"session mempool allocation failed\n");
- params.session_priv_mpool = rte_mempool_create(
- "CRYPTO_AD_SESS_MP_PRIV",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
- TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
- "session mempool allocation failed\n");
-
rte_cryptodev_info_get(TEST_CDEV_ID, &info);
while ((capability = &info.capabilities[i++])->op !=
@@ -1048,7 +1029,6 @@ configure_cryptodev(void)
qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
qp_conf.mp_session = params.session_mpool;
- qp_conf.mp_session_private = params.session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -1418,11 +1398,6 @@ crypto_teardown(void)
rte_mempool_free(params.session_mpool);
params.session_mpool = NULL;
}
- if (params.session_priv_mpool != NULL) {
- rte_mempool_avail_count(params.session_priv_mpool);
- rte_mempool_free(params.session_priv_mpool);
- params.session_priv_mpool = NULL;
- }
/* Free asym session mempool */
if (params.asym_sess_mpool != NULL) {
diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index aa533483fd..04d231468b 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -370,20 +370,9 @@ testsuite_setup(void)
return TEST_FAILED;
}
- ts_params->qp_conf.mp_session_private = rte_mempool_create(
- "test_priv_sess_mp",
- MAX_NB_SESSIONS,
- sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
-
- TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session_private,
- "private session mempool allocation failed");
-
ts_params->qp_conf.mp_session =
rte_cryptodev_sym_session_pool_create("test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, sess_sz, 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session,
"session mempool allocation failed");
@@ -428,11 +417,6 @@ testsuite_teardown(void)
rte_mempool_free(ts_params->qp_conf.mp_session);
ts_params->qp_conf.mp_session = NULL;
}
-
- if (ts_params->qp_conf.mp_session_private != NULL) {
- rte_mempool_free(ts_params->qp_conf.mp_session_private);
- ts_params->qp_conf.mp_session_private = NULL;
- }
}
static int
@@ -647,8 +631,7 @@ create_dummy_sec_session(struct ipsec_unitest_params *ut,
static struct rte_security_session_conf conf;
ut->ss[j].security.ses = rte_security_session_create(&dummy_sec_ctx,
- &conf, qp->mp_session,
- qp->mp_session_private);
+ &conf, qp->mp_session, NULL);
if (ut->ss[j].security.ses == NULL)
return -ENOMEM;
@@ -662,25 +645,15 @@ static int
create_crypto_session(struct ipsec_unitest_params *ut,
struct rte_cryptodev_qp_conf *qp, uint8_t dev_id, uint32_t j)
{
- int32_t rc;
struct rte_cryptodev_sym_session *s;
- s = rte_cryptodev_sym_session_create(qp->mp_session);
+ s = rte_cryptodev_sym_session_create(dev_id, ut->crypto_xforms,
+ qp->mp_session);
if (s == NULL)
return -ENOMEM;
- /* initialize SA crypto session for device */
- rc = rte_cryptodev_sym_session_init(dev_id, s,
- ut->crypto_xforms, qp->mp_session_private);
- if (rc == 0) {
- ut->ss[j].crypto.ses = s;
- return 0;
- } else {
- /* failure, do cleanup */
- rte_cryptodev_sym_session_clear(dev_id, s);
- rte_cryptodev_sym_session_free(s);
- return rc;
- }
+ ut->ss[j].crypto.ses = s;
+ return 0;
}
static int
@@ -1196,8 +1169,7 @@ static void
destroy_crypto_session(struct ipsec_unitest_params *ut,
uint8_t crypto_dev, uint32_t j)
{
- rte_cryptodev_sym_session_clear(crypto_dev, ut->ss[j].crypto.ses);
- rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses);
+ rte_cryptodev_sym_session_free(crypto_dev, ut->ss[j].crypto.ses);
memset(&ut->ss[j], 0, sizeof(ut->ss[j]));
}
diff --git a/drivers/crypto/armv8/armv8_pmd_private.h b/drivers/crypto/armv8/armv8_pmd_private.h
index 75ddba79c1..41292d8851 100644
--- a/drivers/crypto/armv8/armv8_pmd_private.h
+++ b/drivers/crypto/armv8/armv8_pmd_private.h
@@ -106,8 +106,6 @@ struct armv8_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 5c060e71a3..824a2cc735 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -521,34 +521,23 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
/* get existing session */
if (likely(op->sym->session != NULL)) {
- sess = (struct armv8_crypto_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
} else {
/* provide internal session */
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct armv8_crypto_session *)_sess_private_data;
+ sess = (struct armv8_crypto_session *)_sess->driver_priv_data;
if (unlikely(armv8_crypto_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
}
if (unlikely(sess == NULL))
@@ -674,10 +663,6 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct armv8_crypto_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index c07ac0489e..c4964bc112 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -244,7 +244,6 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -265,10 +264,9 @@ armv8_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
/** Configure the session from a crypto xform chain */
static int
-armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
+armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -278,43 +276,22 @@ armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = sess->driver_priv_data;
ret = armv8_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
ARMV8_CRYPTO_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct armv8_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops armv8_crypto_pmd_ops = {
.dev_configure = armv8_crypto_pmd_config,
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index 675ed0ad55..d3334dc920 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -211,8 +211,7 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
} else if (likely(op->sym->session != NULL)) {
/* get existing session */
sess = (struct bcmfs_sym_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_bcmfs_driver_id);
+ op->sym->session->driver_priv_data;
}
if (sess == NULL)
@@ -222,10 +221,9 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
}
int
-bcmfs_sym_session_configure(struct rte_cryptodev *dev,
+bcmfs_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -235,45 +233,23 @@ bcmfs_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- BCMFS_DP_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
BCMFS_DP_LOG(ERR, "Failed configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
void
-bcmfs_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp;
-
- memset(sess_priv, 0, sizeof(struct bcmfs_sym_session));
- sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+bcmfs_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
unsigned int
bcmfs_sym_session_get_private_size(struct rte_cryptodev *dev __rte_unused)
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.h b/drivers/crypto/bcmfs/bcmfs_sym_session.h
index d40595b4bd..4a0a012ae7 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.h
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.h
@@ -93,8 +93,7 @@ bcmfs_process_crypto_op(struct rte_crypto_op *op,
int
bcmfs_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
void
bcmfs_sym_session_clear(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8c0b4909cf..59eaecfbd2 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1357,8 +1357,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
ses = (struct caam_jr_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_driver_id);
+ op->sym->session->driver_priv_data;
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
ses = (struct caam_jr_session *)
@@ -1692,54 +1691,39 @@ caam_jr_set_session_parameters(struct rte_cryptodev *dev,
}
static int
-caam_jr_sym_session_configure(struct rte_cryptodev *dev,
+caam_jr_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
PMD_INIT_FUNC_TRACE();
-
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CAAM_JR_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
+ sess_private_data = (void *)sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct caam_jr_session));
ret = caam_jr_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
CAAM_JR_ERR("failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
static void
-caam_jr_sym_session_clear(struct rte_cryptodev *dev,
+caam_jr_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
struct caam_jr_session *s = (struct caam_jr_session *)sess_priv;
PMD_INIT_FUNC_TRACE();
if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(struct caam_jr_session));
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4bab18323b..bd999abe61 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1585,9 +1585,7 @@ ccp_perform_hmac(struct rte_crypto_op *op,
void *append_ptr;
uint8_t *addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
addr = session->auth.pre_compute;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -1766,9 +1764,7 @@ ccp_perform_sha(struct rte_crypto_op *op,
void *append_ptr;
uint64_t auth_msg_bits;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1859,9 +1855,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr, dest_addr_t;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2005,9 +1999,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2079,9 +2071,7 @@ ccp_perform_aes_cmac(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
key_addr = rte_mem_virt2phy(session->auth.key_ccp);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -2242,9 +2232,7 @@ ccp_perform_aes(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
uint8_t *iv;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
function.raw = 0;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
@@ -2330,9 +2318,7 @@ ccp_perform_3des(struct rte_crypto_op *op,
uint8_t *iv;
phys_addr_t src_addr, dest_addr, key_addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
switch (session->cipher.um.des_mode) {
@@ -2440,9 +2426,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
phys_addr_t digest_dest_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
key_addr = session->cipher.key_phys;
@@ -2607,9 +2591,7 @@ ccp_crypto_cipher(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->cipher.algo) {
case CCP_CIPHER_ALGO_AES_CBC:
@@ -2645,9 +2627,7 @@ ccp_crypto_auth(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_SHA1:
@@ -2715,9 +2695,7 @@ ccp_crypto_aead(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_AES_GCM:
@@ -2780,9 +2758,8 @@ process_ops_to_enqueue(struct ccp_qp *qp,
b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
Q_DESC_SIZE);
for (i = b_idx; i < (nb_ops+b_idx); i++) {
- session = (struct ccp_session *)get_sym_session_private_data(
- op[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
result = ccp_crypto_cipher(op[i], cmd_q, b_info);
@@ -2858,9 +2835,7 @@ static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
int offset, digest_offset;
uint8_t digest_le[64];
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
if (session->cmd_id == CCP_CMD_COMBINED) {
digest_data = op->sym->aead.digest.data;
@@ -2934,9 +2909,8 @@ ccp_prepare_ops(struct ccp_qp *qp,
for (i = b_info->b_idx; i < min_ops; i++) {
op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
- session = (struct ccp_session *)get_sym_session_private_data(
- op_d[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op_d[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 1b600e81ad..e401793a76 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -727,7 +727,6 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
/* mempool for batch info */
qp->batch_mp = rte_mempool_create(
@@ -757,8 +756,7 @@ ccp_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
void *sess_private_data;
@@ -769,40 +767,22 @@ ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -ENOMEM;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CCP_LOG_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
+
internals = (struct ccp_private *)dev->data->dev_private;
ret = ccp_set_session_parameters(sess_private_data, xform, internals);
if (ret != 0) {
CCP_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
return 0;
}
static void
-ccp_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- rte_mempool_put(sess_mp, sess_priv);
- memset(sess_priv, 0, sizeof(struct ccp_session));
- set_sym_session_private_data(sess, index, NULL);
- }
-}
+ccp_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops ccp_ops = {
.dev_configure = ccp_pmd_config,
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 1c4118ee3c..6704e39ab8 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -78,8 +78,6 @@ struct ccp_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_mempool *batch_mp;
/**< Session Mempool for batch info */
struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 013f3be1e6..6a0bfff45f 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -56,33 +56,23 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
if (unlikely(op->sym->session == NULL))
return NULL;
- sess = (struct ccp_session *)
- get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ sess = (void *)op->sym->session->driver_priv_data;
} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- void *_sess;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess;
struct ccp_private *internals;
- if (rte_mempool_get(qp->sess_mp, &_sess))
- return NULL;
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+ if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- sess = (struct ccp_session *)_sess_private_data;
+ sess = (void *)_sess->driver_priv_data;
internals = (struct ccp_private *)qp->dev->data->dev_private;
if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
internals) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- ccp_cryptodev_driver_id,
- _sess_private_data);
+ op->sym->session = _sess;
}
return sess;
@@ -161,13 +151,10 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
for (i = 0; i < nb_dequeued; i++)
if (unlikely(ops[i]->sess_type ==
RTE_CRYPTO_OP_SESSIONLESS)) {
- struct ccp_session *sess = (struct ccp_session *)
- get_sym_session_private_data(
- ops[i]->sym->session,
- ccp_cryptodev_driver_id);
+ struct ccp_session *sess =
+ (void *)ops[i]->sym->session->driver_priv_data;
- rte_mempool_put(qp->sess_mp_priv,
- sess);
+ memset(sess, 0, sizeof(*sess));
rte_mempool_put(qp->sess_mp,
ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 7bbe8726e3..dee1f299d2 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -41,24 +41,23 @@ struct vec_request {
static inline struct cnxk_se_sess *
cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn10k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
- if (ret)
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform,
+ sess);
+ if (ret) {
+ rte_mempool_put(qp->sess_mp, (void *)sess);
goto sess_put;
+ }
- priv = get_sym_session_private_data(sess, driver_id);
-
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
return priv;
@@ -130,8 +129,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
return 0;
w7 = sec_sess->sa.inst.w7;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- sess = get_sym_session_private_data(
- sym_op->session, cn10k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret))
@@ -147,8 +145,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret)) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
return 0;
}
@@ -312,8 +309,9 @@ cn10k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn10k_cryptodev_driver_id);
+ priv = (void *)(
+ ((struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -350,8 +348,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn10k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
} else {
@@ -818,7 +815,6 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
{
const uint8_t uc_compcode = res->uc_compcode;
const uint8_t compcode = res->compcode;
- unsigned int sz;
cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
@@ -895,11 +891,7 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index b753c1cb4b..a44f111ba6 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -56,23 +56,20 @@ cn9k_cpt_sec_inst_fill(struct rte_crypto_op *op,
static inline struct cnxk_se_sess *
cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn9k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform, sess);
if (ret)
goto sess_put;
- priv = get_sym_session_private_data(sess, driver_id);
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
@@ -95,8 +92,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
sym_op = op->sym;
- sess = get_sym_session_private_data(
- sym_op->session, cn9k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
inst->w7.u64 = sess->cpt_inst_w7;
} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
@@ -110,8 +106,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
if (unlikely(ret)) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
}
inst->w7.u64 = sess->cpt_inst_w7;
@@ -349,8 +344,9 @@ cn9k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn9k_cryptodev_driver_id);
+ priv = (void *)((
+ (struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -387,8 +383,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn9k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
} else {
@@ -583,8 +578,6 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
struct cpt_inflight_req *infl_req,
struct cpt_cn9k_res_s *res)
{
- unsigned int sz;
-
if (likely(res->compcode == CPT_COMP_GOOD)) {
if (unlikely(res->uc_compcode)) {
if (res->uc_compcode == ROC_SE_ERR_GC_ICV_MISCOMPARE)
@@ -645,11 +638,7 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index cf91b92c2c..018d7fcee8 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -406,7 +406,6 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = conf->mp_session;
- qp->sess_mp_priv = conf->mp_session_private;
dev->data->queue_pairs[qp_id] = qp;
return 0;
@@ -620,25 +619,15 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)
}
int
-sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
enum cpt_dp_thread_type thr_type;
- struct cnxk_se_sess *sess_priv;
- void *priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
int ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- plt_dp_err("Could not allocate session private data");
- return -ENOMEM;
- }
-
- memset(priv, 0, sizeof(struct cnxk_se_sess));
-
- sess_priv = priv;
-
+ memset(sess_priv, 0, sizeof(struct cnxk_se_sess));
ret = cnxk_sess_fill(roc_cpt, xform, sess_priv);
if (ret)
goto priv_put;
@@ -684,61 +673,39 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
}
sess_priv->cpt_inst_w7 = cnxk_cpt_inst_w7_get(sess_priv, roc_cpt);
-
- set_sym_session_private_data(sess, driver_id, sess_priv);
-
return 0;
priv_put:
- rte_mempool_put(pool, priv);
-
return ret;
}
int
cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
struct cnxk_cpt_vf *vf = dev->data->dev_private;
struct roc_cpt *roc_cpt = &vf->cpt;
- uint8_t driver_id;
- driver_id = dev->driver_id;
-
- return sym_session_configure(roc_cpt, driver_id, xform, sess, pool);
+ return sym_session_configure(roc_cpt, xform, sess);
}
void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
- struct cnxk_se_sess *sess_priv;
- struct rte_mempool *pool;
-
- if (priv == NULL)
- return;
-
- sess_priv = priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
- memset(priv, 0, cnxk_cpt_sym_session_get_size(NULL));
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
+ memset(sess_priv, 0, cnxk_cpt_sym_session_get_size(NULL));
}
void
-cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
+cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
unsigned int
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index d9ed43b40b..baa2b69c52 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -85,8 +85,6 @@ struct cnxk_cpt_qp {
/**< Crypto adapter related info */
struct rte_mempool *sess_mp;
/**< Session mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session private data mempool */
};
int cnxk_cpt_dev_config(struct rte_cryptodev *dev,
@@ -111,18 +109,16 @@ unsigned int cnxk_cpt_sym_session_get_size(struct rte_cryptodev *dev);
int cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
-int sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+int sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
void cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess);
+ struct rte_cryptodev_sym_session *sess);
-void sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess);
+void sym_session_clear(struct rte_cryptodev_sym_session *sess);
unsigned int cnxk_ae_session_size_get(struct rte_cryptodev *dev __rte_unused);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 3b13578de0..fa1cdcf78b 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1379,8 +1379,7 @@ build_sec_fd(struct rte_crypto_op *op,
dpaa2_sec_session *sess;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -1678,8 +1677,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
struct rte_crypto_sym_op *sym_op;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -3754,51 +3752,36 @@ dpaa2_sec_security_session_destroy(void *dev __rte_unused,
}
#endif
static int
-dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA2_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa2_sec_set_session_parameters(xform, sess_private_data);
if (ret != 0) {
DPAA2_SEC_ERR("Failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa2_sec_session *s = (dpaa2_sec_session *)sess_priv;
if (sess_priv) {
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(dpaa2_sec_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index b3242791ac..fb74be6012 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -1012,8 +1012,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa2_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, cryptodev_driver_id);
+ sess = (void *)session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index c6bd785262..7a4c03a882 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -670,10 +670,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
struct qm_sg_entry sg[2];
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa_sec_session *)
@@ -1927,10 +1924,8 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ ses = (void *)
+ op->sym->session->driver_priv_data;
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
@@ -2676,31 +2671,19 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
static int
dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
PMD_INIT_FUNC_TRACE();
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa_sec_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
DPAA_SEC_ERR("failed to configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
ret = dpaa_sec_prep_cdb(sess_private_data);
if (ret) {
DPAA_SEC_ERR("Unable to prepare sec cdb");
@@ -2714,7 +2697,6 @@ static inline void
free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
{
struct dpaa_sec_dev_private *qi = dev->data->dev_private;
- struct rte_mempool *sess_mp = rte_mempool_from_obj((void *)s);
uint8_t i;
for (i = 0; i < MAX_DPAA_CORES; i++) {
@@ -2724,7 +2706,6 @@ free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
s->qp[i] = NULL;
}
free_session_data(s);
- rte_mempool_put(sess_mp, (void *)s);
}
/** Clear the memory of session so it doesn't leave key material behind */
@@ -2733,14 +2714,10 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
- if (sess_priv) {
- free_session_memory(dev, s);
- set_sym_session_private_data(sess, index, NULL);
- }
+ free_session_memory(dev, s);
}
#ifdef RTE_LIB_SECURITY
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index 29c5935739..35f93ceb48 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -1017,8 +1017,8 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)
+ session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 7e8396b4a3..90ce5bc965 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -264,7 +264,6 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
qp->pmd_type = internals->pmd_type;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
qp->ingress_queue = ipsec_mb_qp_create_processed_ops_ring(qp,
qp_conf->nb_descriptors, socket_id);
@@ -312,9 +311,8 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev)
int
ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess, struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
struct ipsec_mb_dev_private *internals = dev->data->dev_private;
struct ipsec_mb_internals *pmd_data =
&ipsec_mb_pmds[internals->pmd_type];
@@ -330,42 +328,22 @@ ipsec_mb_sym_session_configure(
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- IPSEC_MB_LOG(ERR, "Couldn't get object from session mempool");
- free_mb_mgr(mb_mgr);
- return -ENOMEM;
- }
-
- ret = (*pmd_data->session_configure)(mb_mgr, sess_private_data, xform);
+ ret = (*pmd_data->session_configure)(mb_mgr,
+ (void *)sess->driver_priv_data, xform);
if (ret != 0) {
IPSEC_MB_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
free_mb_mgr(mb_mgr);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
free_mb_mgr(mb_mgr);
return 0;
}
/** Clear the session memory */
void
-ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, ipsec_mb_sym_session_get_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+ipsec_mb_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 472b672f08..e4aea7700c 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -136,8 +136,6 @@ struct ipsec_mb_qp {
struct rte_ring *ingress_queue;
/**< Ring for placing operations ready for processing */
struct rte_mempool *sess_mp;
- /**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
/**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
@@ -399,8 +397,7 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev);
int ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
/** Clear the memory of session so it does not leave key material behind */
void
@@ -411,50 +408,50 @@ ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
static __rte_always_inline void *
ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
{
- void *sess = NULL;
+ struct rte_cryptodev_sym_session *sess = NULL;
uint32_t driver_id = ipsec_mb_get_driver_id(qp->pmd_type);
struct rte_crypto_sym_op *sym_op = op->sym;
uint8_t sess_type = op->sess_type;
void *_sess;
- void *_sess_private_data = NULL;
struct ipsec_mb_internals *pmd_data = &ipsec_mb_pmds[qp->pmd_type];
switch (sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
if (likely(sym_op->session != NULL))
- sess = get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
+ else
+ goto error_exit;
break;
case RTE_CRYPTO_OP_SESSIONLESS:
if (!qp->sess_mp ||
rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (!qp->sess_mp_priv ||
- rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
+ sess = _sess;
+ if (sess->sess_data_sz < pmd_data->session_priv_size) {
+ rte_mempool_put(qp->sess_mp, _sess);
+ goto error_exit;
+ }
- sess = _sess_private_data;
if (unlikely(pmd_data->session_configure(qp->mb_mgr,
- sess, sym_op->xform) != 0)) {
+ (void *)sess->driver_priv_data, sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
- sess = NULL;
+ goto error_exit;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sess->driver_id = driver_id;
+ sym_op->session = sess;
+
break;
default:
IPSEC_MB_LOG(ERR, "Unrecognized session type %u", sess_type);
}
- if (unlikely(sess == NULL))
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return (void *)sess->driver_priv_data;
- return sess;
+error_exit:
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return NULL;
}
#endif /* _IPSEC_MB_PRIVATE_H_ */
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
index 2c033c6f28..e4f274b608 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
@@ -241,10 +241,6 @@ handle_completed_gcm_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_gcm_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -455,44 +451,35 @@ static inline struct aesni_gcm_session *
aesni_gcm_get_session(struct ipsec_mb_qp *qp,
struct rte_crypto_op *op)
{
- struct aesni_gcm_session *sess = NULL;
- uint32_t driver_id =
- ipsec_mb_get_driver_id(IPSEC_MB_PMD_TYPE_AESNI_GCM);
+ struct rte_cryptodev_sym_session *sess = NULL;
struct rte_crypto_sym_op *sym_op = op->sym;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
- sess = (struct aesni_gcm_session *)
- get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
} else {
- void *_sess;
- void *_sess_private_data = NULL;
-
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
+ if (unlikely(sess->sess_data_sz <
+ sizeof(struct aesni_gcm_session))) {
+ rte_mempool_put(qp->sess_mp, sess);
return NULL;
-
- sess = (struct aesni_gcm_session *)_sess_private_data;
+ }
if (unlikely(aesni_gcm_session_configure(qp->mb_mgr,
- _sess_private_data, sym_op->xform) != 0)) {
- rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
+ (void *)sess->driver_priv_data,
+ sym_op->xform) != 0)) {
+ rte_mempool_put(qp->sess_mp, sess);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sym_op->session = sess;
}
if (unlikely(sess == NULL))
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return sess;
+ return (void *)sess->driver_priv_data;
}
static uint16_t
@@ -712,22 +699,15 @@ aesni_gmac_sgl_verify(struct aesni_gcm_session *s,
/** Process CPU crypto bulk operations */
static uint32_t
-aesni_gcm_process_bulk(struct rte_cryptodev *dev,
+aesni_gcm_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess,
__rte_unused union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
- struct aesni_gcm_session *s;
+ struct aesni_gcm_session *s = (void *)sess->driver_priv_data;
struct gcm_context_data gdata_ctx;
IMB_MGR *mb_mgr;
- s = (struct aesni_gcm_session *) get_sym_session_private_data(sess,
- dev->driver_id);
- if (unlikely(s == NULL)) {
- aesni_gcm_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 6d5d3ce8eb..f3565b04b5 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1710,8 +1710,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
{
struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data;
struct aesni_mb_session *sess = NULL;
- uint32_t driver_id = ipsec_mb_get_driver_id(
- IPSEC_MB_PMD_TYPE_AESNI_MB);
#ifdef AESNI_MB_DOCSIS_SEC_ENABLED
uint8_t is_docsis_sec = 0;
@@ -1725,15 +1723,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
sess = get_sec_session_private_data(op->sym->sec_session);
} else
#endif
- {
- sess = get_sym_session_private_data(op->sym->session,
- driver_id);
- }
-
- if (unlikely(sess == NULL)) {
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return op;
- }
+ sess = (void *)op->sym->session->driver_priv_data;
if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
switch (job->status) {
@@ -1771,10 +1761,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_mb_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -1962,16 +1948,6 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
return processed_jobs;
}
-
-static inline void
-ipsec_mb_fill_error_code(struct rte_crypto_sym_vec *vec, int32_t err)
-{
- uint32_t i;
-
- for (i = 0; i != vec->num; ++i)
- vec->status[i] = err;
-}
-
static inline int
check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl)
{
@@ -2028,7 +2004,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec,
}
static uint32_t
-aesni_mb_process_bulk(struct rte_cryptodev *dev,
+aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
struct rte_crypto_sym_vec *vec)
{
@@ -2037,15 +2013,9 @@ aesni_mb_process_bulk(struct rte_cryptodev *dev,
void *buf;
IMB_JOB *job;
IMB_MGR *mb_mgr;
- struct aesni_mb_session *s;
+ struct aesni_mb_session *s = (void *)sess->driver_priv_data;
uint8_t tmp_dgst[vec->num][DIGEST_LENGTH_MAX];
- s = get_sym_session_private_data(sess, dev->driver_id);
- if (s == NULL) {
- ipsec_mb_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
index d953d6e5f5..97e7cef233 100644
--- a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
+++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
@@ -290,10 +290,6 @@ handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct chacha20_poly1305_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index fba10b8cf4..b83e2d6715 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -231,11 +231,6 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct kasumi_session));
- memset(
- ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -287,8 +282,9 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct kasumi_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct kasumi_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
return processed_op;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index 9a85f46721..f052d6d847 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -362,10 +362,6 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct snow3g_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -417,8 +413,9 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct snow3g_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct snow3g_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c b/drivers/crypto/ipsec_mb/pmd_zuc.c
index e36c7092d6..92fd9d1808 100644
--- a/drivers/crypto/ipsec_mb/pmd_zuc.c
+++ b/drivers/crypto/ipsec_mb/pmd_zuc.c
@@ -239,10 +239,6 @@ process_ops(struct rte_crypto_op **ops, enum ipsec_mb_operation op_type,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sessions[i], 0, sizeof(struct zuc_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sessions[i]);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index dc8e291f50..e5063b515c 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -171,14 +171,13 @@ mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *session)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *sess_private_data;
+ struct mlx5_crypto_session *sess_private_data =
+ (void *)session->driver_priv_data;
struct rte_crypto_cipher_xform *cipher;
uint8_t encryption_order;
- int ret;
if (unlikely(xform->next != NULL)) {
DRV_LOG(ERR, "Xform next is not supported.");
@@ -189,17 +188,9 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
DRV_LOG(ERR, "Only AES-XTS algorithm is supported.");
return -ENOTSUP;
}
- ret = rte_mempool_get(mp, (void *)&sess_private_data);
- if (ret != 0) {
- DRV_LOG(ERR,
- "Failed to get session %p private data from mempool.",
- sess_private_data);
- return -ENOMEM;
- }
cipher = &xform->cipher;
sess_private_data->dek = mlx5_crypto_dek_prepare(priv, cipher);
if (sess_private_data->dek == NULL) {
- rte_mempool_put(mp, sess_private_data);
DRV_LOG(ERR, "Failed to prepare dek.");
return -ENOMEM;
}
@@ -239,8 +230,6 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
sess_private_data->dek_id =
rte_cpu_to_be_32(sess_private_data->dek->obj->id &
0xffffff);
- set_sym_session_private_data(session, dev->driver_id,
- sess_private_data);
DRV_LOG(DEBUG, "Session %p was configured.", sess_private_data);
return 0;
}
@@ -250,16 +239,13 @@ mlx5_crypto_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *spriv = get_sym_session_private_data(sess,
- dev->driver_id);
+ struct mlx5_crypto_session *spriv = (void *)sess->driver_priv_data;
if (unlikely(spriv == NULL)) {
DRV_LOG(ERR, "Failed to get session %p private data.", spriv);
return;
}
mlx5_crypto_dek_destroy(priv, spriv->dek);
- set_sym_session_private_data(sess, dev->driver_id, NULL);
- rte_mempool_put(rte_mempool_from_obj(spriv), spriv);
DRV_LOG(DEBUG, "Session %p was cleared.", spriv);
}
@@ -369,8 +355,8 @@ mlx5_crypto_wqe_set(struct mlx5_crypto_priv *priv,
struct rte_crypto_op *op,
struct mlx5_umr_wqe *umr)
{
- struct mlx5_crypto_session *sess = get_sym_session_private_data
- (op->sym->session, mlx5_crypto_driver_id);
+ struct mlx5_crypto_session *sess =
+ (void *)op->sym->session->driver_priv_data;
struct mlx5_wqe_cseg *cseg = &umr->ctr;
struct mlx5_wqe_mkey_cseg *mkc = &umr->mkc;
struct mlx5_wqe_dseg *klms = &umr->kseg[0];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index c35876c8b4..fdc9c14227 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -597,13 +597,7 @@ mrvl_request_prepare_crp(struct sam_cio_op_params *request,
return -EINVAL;
}
- sess = (struct mrvl_crypto_session *)get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
- if (unlikely(sess == NULL)) {
- MRVL_LOG(ERR, "Session was not created for this device!");
- return -EINVAL;
- }
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
request->sa = sess->sam_sess;
request->cookie = op;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index f828dc9db5..0066236561 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -736,8 +736,7 @@ mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
static int
mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
struct mrvl_crypto_session *mrvl_sess;
void *sess_private_data;
@@ -748,23 +747,15 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- CDEV_LOG_ERR("Couldn't get object from session mempool.");
- return -ENOMEM;
- }
-
+ sess_private_data = sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session));
ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
MRVL_LOG(ERR, "Failed to configure session parameters!");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
mrvl_sess = (struct mrvl_crypto_session *)sess_private_data;
if (sam_session_create(&mrvl_sess->sam_sess_params,
@@ -791,8 +782,7 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = sess->data;
/* Zero out the whole structure */
if (sess_priv) {
@@ -803,11 +793,6 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
sam_session_destroy(mrvl_sess->sam_sess) < 0) {
MRVL_LOG(ERR, "Error while destroying session!");
}
-
- memset(mrvl_sess, 0, sizeof(struct mrvl_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index cb5393d2f1..505024a810 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -530,24 +530,16 @@ configure_aead_ctx(struct rte_crypto_aead_xform *xform,
}
static int
-nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
+nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *mp_obj;
- struct nitrox_crypto_ctx *ctx;
+ struct nitrox_crypto_ctx *ctx = (void *)sess->driver_priv_data;
struct rte_crypto_cipher_xform *cipher_xform = NULL;
struct rte_crypto_auth_xform *auth_xform = NULL;
struct rte_crypto_aead_xform *aead_xform = NULL;
int ret = -EINVAL;
- if (rte_mempool_get(mempool, &mp_obj)) {
- NITROX_LOG(ERR, "Couldn't allocate context\n");
- return -ENOMEM;
- }
-
- ctx = mp_obj;
ctx->nitrox_chain = get_crypto_chain_order(xform);
switch (ctx->nitrox_chain) {
case NITROX_CHAIN_CIPHER_ONLY:
@@ -585,38 +577,23 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
goto err;
}
- ctx->iova = rte_mempool_virt2iova(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, ctx);
+ ctx->iova = sess->driver_priv_data_iova;
return 0;
err:
- rte_mempool_put(mempool, mp_obj);
return ret;
}
static void
-nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct nitrox_crypto_ctx *ctx = get_sym_session_private_data(sess,
- cdev->driver_id);
- struct rte_mempool *sess_mp;
-
- if (!ctx)
- return;
-
- memset(ctx, 0, sizeof(*ctx));
- sess_mp = rte_mempool_from_obj(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, NULL);
- rte_mempool_put(sess_mp, ctx);
-}
+nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct nitrox_crypto_ctx *
get_crypto_ctx(struct rte_crypto_op *op)
{
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(op->sym->session))
- return get_sym_session_private_data(op->sym->session,
- nitrox_sym_drv_id);
+ return (void *)op->sym->session->driver_priv_data;
}
return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index eab74ad45f..695eeaa1e8 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -58,7 +58,7 @@ process_op(const struct null_crypto_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(op->sym->session, 0,
sizeof(struct null_crypto_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
@@ -78,30 +78,21 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
sess = (struct null_crypto_session *)
- get_sym_session_private_data(
- sym_op->session, cryptodev_driver_id);
+ sym_op->session->driver_priv_data;
} else {
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct null_crypto_session *)_sess_private_data;
+ sess = (struct null_crypto_session *)_sess->driver_priv_data;
if (unlikely(null_crypto_set_session_parameters(sess,
sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+ sym_op->session = _sess;
}
return sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 90a675dfff..fb43d3f7b5 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -233,7 +233,6 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
@@ -256,8 +255,7 @@ null_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -267,43 +265,22 @@ null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- NULL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = null_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
NULL_LOG(ERR, "failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct null_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops pmd_ops = {
.dev_configure = null_crypto_pmd_config,
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index 89c4345b6f..ae34ce6671 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,8 +31,6 @@ struct null_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Mempool */
struct rte_cryptodev_stats qp_stats;
/**< Queue pair statistics */
} __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
index e48805fb09..4647d568de 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
+++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
@@ -49,7 +49,6 @@ struct cpt_instance {
uint32_t queue_id;
uintptr_t rsvd;
struct rte_mempool *sess_mp;
- struct rte_mempool *sess_mp_priv;
struct cpt_qp_meta_info meta_info;
uint8_t ca_enabled;
};
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 11840f5ecf..71856d5e86 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -171,7 +171,6 @@ otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
instance->queue_id = que_pair_id;
instance->sess_mp = qp_conf->mp_session;
- instance->sess_mp_priv = qp_conf->mp_session_private;
dev->data->queue_pairs[que_pair_id] = instance;
return 0;
@@ -243,25 +242,19 @@ sym_xform_verify(struct rte_crypto_sym_xform *xform)
}
static int
-sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+sym_session_configure(struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_crypto_sym_xform *temp_xform = xform;
struct cpt_sess_misc *misc;
vq_cmd_word3_t vq_cmd_w3;
- void *priv;
+ void *priv = (void *)sess->driver_priv_data;
int ret;
ret = sym_xform_verify(xform);
if (unlikely(ret))
return ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- CPT_LOG_ERR("Could not allocate session private data");
- return -ENOMEM;
- }
-
memset(priv, 0, sizeof(struct cpt_sess_misc) +
offsetof(struct cpt_ctx, mc_ctx));
@@ -301,9 +294,7 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
goto priv_put;
}
- set_sym_session_private_data(sess, driver_id, priv);
-
- misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
+ misc->ctx_dma_addr = sess->driver_priv_data_iova +
sizeof(struct cpt_sess_misc);
vq_cmd_w3.u64 = 0;
@@ -316,17 +307,14 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
return 0;
priv_put:
- if (priv)
- rte_mempool_put(pool, priv);
return -ENOTSUP;
}
static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
+ void *priv = (void *)sess->driver_priv_data;
struct cpt_sess_misc *misc;
- struct rte_mempool *pool;
struct cpt_ctx *ctx;
if (priv == NULL)
@@ -336,35 +324,26 @@ sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
ctx = SESS_PRIV(misc);
rte_free(ctx->auth_key);
-
- memset(priv, 0, cpt_get_session_size());
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
}
static int
-otx_cpt_session_cfg(struct rte_cryptodev *dev,
+otx_cpt_session_cfg(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_configure(dev->driver_id, xform, sess, pool);
+ return sym_session_configure(xform, sess);
}
static void
-otx_cpt_session_clear(struct rte_cryptodev *dev,
+otx_cpt_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
static unsigned int
@@ -528,10 +507,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance,
void *req;
uint64_t cpt_op;
- sess = (struct cpt_sess_misc *)
- get_sym_session_private_data(sym_op->session,
- otx_cryptodev_driver_id);
-
+ sess = (struct cpt_sess_misc *)sym_op->session->driver_priv_data;
cpt_op = sess->cpt_op;
if (likely(cpt_op & CPT_OP_CIPHER_MASK))
@@ -560,21 +536,18 @@ static __rte_always_inline void * __rte_hot
otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
struct rte_crypto_op *op)
{
- const int driver_id = otx_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
void *req;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(instance->sess_mp);
- if (sess == NULL) {
+ if (rte_mempool_get(instance->sess_mp, (void **)&sess) < 0) {
rte_errno = ENOMEM;
return NULL;
}
- ret = sym_session_configure(driver_id, sym_op->xform, sess,
- instance->sess_mp_priv);
+ ret = sym_session_configure(sym_op->xform, sess);
if (ret)
goto sess_put;
@@ -583,12 +556,10 @@ otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
/* Enqueue op with the tmp session set */
req = otx_cpt_enq_single_sym(instance, op);
if (unlikely(req == NULL))
- goto priv_put;
+ goto sess_put;
return req;
-priv_put:
- sym_session_clear(driver_id, sess);
sess_put:
rte_mempool_put(instance->sess_mp, sess);
return NULL;
@@ -873,13 +844,9 @@ static inline void
free_sym_session_data(const struct cpt_instance *instance,
struct rte_crypto_op *cop)
{
- void *sess_private_data_t = get_sym_session_private_data(
- cop->sym->session, otx_cryptodev_driver_id);
+ void *sess_private_data_t = (void *)cop->sym->session->driver_priv_data;
+
memset(sess_private_data_t, 0, cpt_get_session_size());
- memset(cop->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session));
- rte_mempool_put(instance->sess_mp_priv, sess_private_data_t);
rte_mempool_put(instance->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/openssl_pmd_private.h b/drivers/crypto/openssl/openssl_pmd_private.h
index c34fd9a546..ed6841e460 100644
--- a/drivers/crypto/openssl/openssl_pmd_private.h
+++ b/drivers/crypto/openssl/openssl_pmd_private.h
@@ -70,8 +70,6 @@ struct openssl_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 3c4ff1ac56..ff5e349ce8 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -887,10 +887,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
/* get existing session */
if (likely(op->sym->session != NULL))
- sess = (struct openssl_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = (void *)
+ op->sym->session->driver_priv_data;
} else {
if (likely(op->asym->session != NULL))
asym_sess = (struct openssl_asym_session *)
@@ -901,32 +899,26 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
return asym_sess;
}
} else {
+ struct rte_cryptodev_sym_session *_sess;
/* sessionless asymmetric not supported */
if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC)
return NULL;
/* provide internal session */
- void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- void *_sess_private_data = NULL;
+ rte_mempool_get(qp->sess_mp, (void **)&_sess);
if (_sess == NULL)
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct openssl_session *)_sess_private_data;
+ sess = (struct openssl_session *)_sess->driver_priv_data;
if (unlikely(openssl_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+
}
if (sess == NULL)
@@ -2900,10 +2892,6 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
openssl_reset_session(sess);
memset(sess, 0, sizeof(struct openssl_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index f7ddbf9c73..2a3662ee5a 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -764,7 +764,6 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -794,10 +793,9 @@ openssl_pmd_asym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
if (unlikely(sess == NULL)) {
@@ -805,24 +803,14 @@ openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- OPENSSL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = openssl_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
OPENSSL_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
@@ -1328,20 +1316,13 @@ openssl_pmd_asym_session_configure(struct rte_cryptodev *dev __rte_unused,
/** Clear the memory of session so it doesn't leave key material behind */
static void
-openssl_pmd_sym_session_clear(struct rte_cryptodev *dev,
+openssl_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
/* Zero out the whole structure */
- if (sess_priv) {
- openssl_reset_session(sess_priv);
- memset(sess_priv, 0, sizeof(struct openssl_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ openssl_reset_session(sess_priv);
}
static void openssl_reset_asym_session(struct openssl_asym_session *sess)
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index f3a99ae15c..2c58a0ec75 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -67,12 +67,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
return -EINVAL;
if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) {
- ctx = get_sym_session_private_data(op->sym->session,
- qat_sym_driver_id);
- if (unlikely(!ctx)) {
- QAT_DP_LOG(ERR, "No session for this device");
- return -EINVAL;
- }
+ ctx = (void *)op->sym->session->driver_priv_data;
if (sess != (uintptr_t)ctx) {
struct rte_cryptodev *cdev;
struct qat_cryptodev_private *internals;
@@ -391,8 +386,7 @@ qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
return -EINVAL;
- ctx = (struct qat_sym_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, qat_sym_driver_id);
+ ctx = (void *)session_ctx.crypto_sess->driver_priv_data;
dp_ctx->session = ctx;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 074612c11b..2853ac5b88 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -317,9 +317,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
#endif
{
sess = (struct qat_sym_session *)
- get_sym_session_private_data(
- rx_op->sym->session,
- qat_sym_driver_id);
+ rx_op->sym->session->driver_priv_data;
is_docsis_sec = 0;
}
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index bfc9836351..da50bcbef1 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -226,22 +226,13 @@ qat_is_auth_alg_supported(enum rte_crypto_auth_algorithm algo,
}
void
-qat_sym_session_clear(struct rte_cryptodev *dev,
+qat_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
- struct qat_sym_session *s = (struct qat_sym_session *)sess_priv;
+ struct qat_sym_session *s = (void *)sess->driver_priv_data;
- if (sess_priv) {
- if (s->bpi_ctx)
- bpi_cipher_ctx_free(s->bpi_ctx);
- memset(s, 0, qat_sym_session_get_private_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ if (s->bpi_ctx)
+ bpi_cipher_ctx_free(s->bpi_ctx);
}
static int
@@ -524,35 +515,24 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
if (ossl_legacy_provider_load())
return -EINVAL;
#endif
- ret = qat_sym_session_set_parameters(dev, xform, sess_private_data);
+ ret = qat_sym_session_set_parameters(dev, xform,
+ (void *)sess->driver_priv_data,
+ sess->driver_priv_data_iova);
if (ret != 0) {
QAT_LOG(ERR,
"Crypto QAT PMD: failed to configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ossl_legacy_provider_unload();
# endif
@@ -561,7 +541,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev,
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private)
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_paddr)
{
struct qat_sym_session *session = session_private;
struct qat_cryptodev_private *internals = dev->data->dev_private;
@@ -570,7 +551,6 @@ qat_sym_session_set_parameters(struct rte_cryptodev *dev,
int qat_cmd_id;
/* Verify the session physical address is known */
- rte_iova_t session_paddr = rte_mempool_virt2iova(session);
if (session_paddr == 0 || session_paddr == RTE_BAD_IOVA) {
QAT_LOG(ERR,
"Session physical address unknown. Bad memory pool.");
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index 01908abd9e..9e4aab06a6 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -123,12 +123,12 @@ struct qat_sym_session {
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private);
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_private_iova);
int
qat_sym_session_configure_aead(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 11b559e025..03df424140 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -470,44 +470,18 @@ scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
}
static int
-scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+ struct rte_crypto_sym_xform *xform __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
- int ret;
-
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- ret = rte_cryptodev_sym_session_init(worker->dev_id, sess,
- xform, mempool);
- if (ret < 0) {
- CR_SCHED_LOG(ERR, "unable to config sym session");
- return ret;
- }
- }
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
-
- /* Clear private data of workers */
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- rte_cryptodev_sym_session_clear(worker->dev_id, sess);
- }
-}
+scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops scheduler_pmd_ops = {
.dev_configure = scheduler_pmd_config,
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 21bd996064..d3b799b28d 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -40,8 +40,7 @@ static void virtio_crypto_sym_clear_session(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
/*
* The set of PCI devices this driver supports
@@ -952,12 +951,7 @@ virtio_crypto_sym_clear_session(
hw = dev->data->dev_private;
vq = hw->cvq;
- session = (struct virtio_crypto_session *)get_sym_session_private_data(
- sess, cryptodev_virtio_driver_id);
- if (session == NULL) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid session parameter");
- return;
- }
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
VIRTIO_CRYPTO_SESSION_LOG_INFO("vq->vq_desc_head_idx = %d, "
"vq = %p", vq->vq_desc_head_idx, vq);
@@ -1070,10 +1064,6 @@ virtio_crypto_sym_clear_session(
VIRTIO_CRYPTO_SESSION_LOG_INFO("Close session %"PRIu64" successfully ",
session->session_id);
- memset(session, 0, sizeof(struct virtio_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(session);
- set_sym_session_private_data(sess, cryptodev_virtio_driver_id, NULL);
- rte_mempool_put(sess_mp, session);
rte_free(malloc_virt_addr);
}
@@ -1292,11 +1282,9 @@ static int
virtio_crypto_check_sym_configure_session_paras(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sym_sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sym_sess)
{
- if (unlikely(xform == NULL) || unlikely(sym_sess == NULL) ||
- unlikely(mempool == NULL)) {
+ if (unlikely(xform == NULL) || unlikely(sym_sess == NULL)) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("NULL pointer");
return -1;
}
@@ -1311,12 +1299,9 @@ static int
virtio_crypto_sym_configure_session(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
- struct virtio_crypto_session crypto_sess;
- void *session_private = &crypto_sess;
struct virtio_crypto_session *session;
struct virtio_crypto_op_ctrl_req *ctrl_req;
enum virtio_crypto_cmd_id cmd_id;
@@ -1328,19 +1313,12 @@ virtio_crypto_sym_configure_session(
PMD_INIT_FUNC_TRACE();
ret = virtio_crypto_check_sym_configure_session_paras(dev, xform,
- sess, mempool);
+ sess);
if (ret < 0) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid parameters");
return ret;
}
-
- if (rte_mempool_get(mempool, &session_private)) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
- session = (struct virtio_crypto_session *)session_private;
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
memset(session, 0, sizeof(struct virtio_crypto_session));
ctrl_req = &session->ctrl;
ctrl_req->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
@@ -1402,10 +1380,6 @@ virtio_crypto_sym_configure_session(
"Unsupported operation chain order parameter");
goto error_out;
}
-
- set_sym_session_private_data(sess, dev->driver_id,
- session_private);
-
return 0;
error_out:
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index 08359b3a39..b7f492a7f2 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -207,8 +207,7 @@ virtqueue_crypto_sym_enqueue_xmit(
offsetof(struct virtio_crypto_op_cookie, iv);
struct rte_crypto_sym_op *sym_op = cop->sym;
struct virtio_crypto_session *session =
- (struct virtio_crypto_session *)get_sym_session_private_data(
- cop->sym->session, cryptodev_virtio_driver_id);
+ (void *)cop->sym->session->driver_priv_data;
struct virtio_crypto_op_data_req *op_data_req;
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c
index 19af134bbe..bce903e007 100644
--- a/examples/fips_validation/fips_dev_self_test.c
+++ b/examples/fips_validation/fips_dev_self_test.c
@@ -969,7 +969,6 @@ struct fips_dev_auto_test_env {
struct rte_mempool *mpool;
struct rte_mempool *op_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mbuf *mbuf;
struct rte_crypto_op *op;
};
@@ -1479,13 +1478,8 @@ run_single_test(uint8_t dev_id,
return ret;
}
- sess = rte_cryptodev_sym_session_create(env->sess_pool);
- if (!sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(dev_id,
- sess, &xform, env->sess_priv_pool);
- if (ret < 0) {
+ sess = rte_cryptodev_sym_session_create(dev_id, &xform, env->sess_pool);
+ if (!sess) {
RTE_LOG(ERR, PMD, "Error %i: Init session\n", ret);
return ret;
}
@@ -1508,8 +1502,7 @@ run_single_test(uint8_t dev_id,
1);
} while (n_deqd == 0);
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(dev_id, sess);
if (env->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
return -1;
@@ -1527,7 +1520,6 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
rte_mempool_free(env->mpool);
rte_mempool_free(env->op_pool);
rte_mempool_free(env->sess_pool);
- rte_mempool_free(env->sess_priv_pool);
rte_cryptodev_stop(dev_id);
}
@@ -1535,7 +1527,7 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
static int
fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
{
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
struct rte_cryptodev_config conf;
char name[128];
@@ -1579,25 +1571,13 @@ fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
snprintf(name, 128, "%s%u", "SELF_TEST_SESS_POOL", dev_id);
env->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- 128, 0, 0, 0, rte_cryptodev_socket_id(dev_id));
+ 128, sess_sz, 0, 0, rte_cryptodev_socket_id(dev_id));
if (!env->sess_pool) {
ret = -ENOMEM;
goto error_exit;
}
- memset(name, 0, 128);
- snprintf(name, 128, "%s%u", "SELF_TEST_SESS_PRIV_POOL", dev_id);
-
- env->sess_priv_pool = rte_mempool_create(name,
- 128, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_cryptodev_socket_id(dev_id), 0);
- if (!env->sess_priv_pool) {
- ret = -ENOMEM;
- goto error_exit;
- }
-
qp_conf.mp_session = env->sess_pool;
- qp_conf.mp_session_private = env->sess_priv_pool;
ret = rte_cryptodev_queue_pair_setup(dev_id, 0, &qp_conf,
rte_cryptodev_socket_id(dev_id));
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e6c0b6a3a1..e73e6b09c3 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -55,7 +55,6 @@ struct cryptodev_fips_validate_env {
uint16_t mbuf_data_room;
struct rte_mempool *mpool;
struct rte_mempool *sess_mpool;
- struct rte_mempool *sess_priv_mpool;
struct rte_mempool *op_pool;
struct rte_mbuf *mbuf;
uint8_t *digest;
@@ -70,7 +69,7 @@ static int
cryptodev_fips_validate_app_int(void)
{
struct rte_cryptodev_config conf = {rte_socket_id(), 1, 0};
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
struct rte_cryptodev_info dev_info;
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
env.dev_id);
@@ -110,16 +109,11 @@ cryptodev_fips_validate_app_int(void)
ret = -ENOMEM;
env.sess_mpool = rte_cryptodev_sym_session_pool_create(
- "FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+ "FIPS_SESS_MEMPOOL", 16, sess_sz, 0, 0,
+ rte_socket_id());
if (!env.sess_mpool)
goto error_exit;
- env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
- 16, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_socket_id(), 0);
- if (!env.sess_priv_mpool)
- goto error_exit;
-
env.op_pool = rte_crypto_op_pool_create(
"FIPS_OP_POOL",
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -134,7 +128,6 @@ cryptodev_fips_validate_app_int(void)
goto error_exit;
qp_conf.mp_session = env.sess_mpool;
- qp_conf.mp_session_private = env.sess_priv_mpool;
ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
rte_socket_id());
@@ -151,7 +144,6 @@ cryptodev_fips_validate_app_int(void)
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
return ret;
@@ -162,11 +154,9 @@ cryptodev_fips_validate_app_uninit(void)
{
rte_pktmbuf_free(env.mbuf);
rte_crypto_op_free(env.op);
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
}
@@ -1202,13 +1192,9 @@ fips_run_test(void)
if (ret < 0)
return ret;
- env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
- if (!env.sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(env.dev_id,
- env.sess, &xform, env.sess_priv_mpool);
- if (ret < 0) {
+ env.sess = rte_cryptodev_sym_session_create(env.dev_id, &xform,
+ env.sess_mpool);
+ if (!env.sess) {
RTE_LOG(ERR, USER1, "Error %i: Init session\n",
ret);
goto exit;
@@ -1237,9 +1223,10 @@ fips_run_test(void)
vec.status = env.op->status;
exit:
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
- env.sess = NULL;
+ if (env.sess) {
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
+ env.sess = NULL;
+ }
return ret;
}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a4ac4174ba..338fbe6236 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1693,8 +1693,6 @@ cryptodevs_init(uint16_t req_queue_num)
qp_conf.nb_descriptors = qp_desc_nb;
qp_conf.mp_session =
socket_ctx[dev_conf.socket_id].session_pool;
- qp_conf.mp_session_private =
- socket_ctx[dev_conf.socket_id].session_priv_pool;
for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
&qp_conf, dev_conf.socket_id))
@@ -2501,12 +2499,8 @@ one_session_free(struct rte_ipsec_session *ips)
if (ips->crypto.ses == NULL)
return 0;
- ret = rte_cryptodev_sym_session_clear(ips->crypto.dev_id,
- ips->crypto.ses);
- if (ret)
- return ret;
-
- ret = rte_cryptodev_sym_session_free(ips->crypto.ses);
+ ret = rte_cryptodev_sym_session_free(ips->crypto.dev_id,
+ ips->crypto.ses);
} else {
/* Session has not been created */
if (ips->security.ctx == NULL || ips->security.ses == NULL)
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 7b7bfff696..bb84dcec7e 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -174,11 +174,8 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[],
}
ips->crypto.dev_id = cdev_id;
- ips->crypto.ses = rte_cryptodev_sym_session_create(
- skt_ctx->session_pool);
- rte_cryptodev_sym_session_init(cdev_id,
- ips->crypto.ses, sa->xforms,
- skt_ctx->session_priv_pool);
+ ips->crypto.ses = rte_cryptodev_sym_session_create(cdev_id,
+ sa->xforms, skt_ctx->session_pool);
rte_cryptodev_info_get(cdev_id, &cdev_info);
}
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index bf4b862379..b555e63ff6 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -228,7 +228,6 @@ struct rte_mempool *l2fwd_pktmbuf_pool;
struct rte_mempool *l2fwd_crypto_op_pool;
static struct {
struct rte_mempool *sess_mp;
- struct rte_mempool *priv_mp;
} session_pool_socket[RTE_MAX_NUMA_NODES];
/* Per-port statistics struct */
@@ -675,7 +674,6 @@ static struct rte_cryptodev_sym_session *
initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
{
struct rte_crypto_sym_xform *first_xform;
- struct rte_cryptodev_sym_session *session;
int retval = rte_cryptodev_socket_id(cdev_id);
if (retval < 0)
@@ -697,17 +695,8 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
first_xform = &options->auth_xform;
}
- session = rte_cryptodev_sym_session_create(
+ return rte_cryptodev_sym_session_create(cdev_id, first_xform,
session_pool_socket[socket_id].sess_mp);
- if (session == NULL)
- return NULL;
-
- if (rte_cryptodev_sym_session_init(cdev_id, session,
- first_xform,
- session_pool_socket[socket_id].priv_mp) < 0)
- return NULL;
-
- return session;
}
/* >8 End of creation of session. */
@@ -2380,13 +2369,10 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
rte_cryptodev_info_get(cdev_id, &dev_info);
- /*
- * Two sessions objects are required for each session
- * (one for the header, one for the private data)
- */
if (!strcmp(dev_info.driver_name, "crypto_scheduler")) {
#ifdef RTE_CRYPTO_SCHEDULER
- uint32_t nb_workers =
+ /* scheduler session header + 1 session per worker */
+ uint32_t nb_workers = 1 +
rte_cryptodev_scheduler_workers_get(cdev_id,
NULL);
@@ -2395,41 +2381,15 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
} else
sessions_needed = enabled_cdev_count;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- char mp_name[RTE_MEMPOOL_NAMESIZE];
-
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- session_pool_socket[socket_id].priv_mp =
- rte_mempool_create(mp_name,
- sessions_needed,
- max_sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- printf("Cannot create pool on socket %d\n",
- socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
char mp_name[RTE_MEMPOOL_NAMESIZE];
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
session_pool_socket[socket_id].sess_mp =
- rte_cryptodev_sym_session_pool_create(
- mp_name,
- sessions_needed,
- 0, 0, 0, socket_id);
-
+ rte_cryptodev_sym_session_pool_create(
+ mp_name, sessions_needed, max_sess_sz,
+ 0, 0, socket_id);
if (session_pool_socket[socket_id].sess_mp == NULL) {
printf("Cannot create pool on socket %d\n",
socket_id);
@@ -2580,8 +2540,6 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
qp_conf.nb_descriptors = 2048;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 7d75623a5e..02987ebd76 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,7 +46,6 @@ struct vhost_crypto_info {
int vids[MAX_NB_SOCKETS];
uint32_t nb_vids;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *cop_pool;
uint8_t cid;
uint32_t qid;
@@ -304,7 +303,6 @@ new_device(int vid)
}
ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
- info->sess_priv_pool,
rte_lcore_to_socket_id(options.los[i].lcore_id));
if (ret) {
RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -458,7 +456,6 @@ free_resource(void)
rte_mempool_free(info->cop_pool);
rte_mempool_free(info->sess_pool);
- rte_mempool_free(info->sess_priv_pool);
for (j = 0; j < lo->nb_sockets; j++) {
rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -544,16 +541,12 @@ main(int argc, char *argv[])
snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- SESSION_MAP_ENTRIES, 0, 0, 0,
- rte_lcore_to_socket_id(lo->lcore_id));
-
- snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
- info->sess_priv_pool = rte_mempool_create(name,
SESSION_MAP_ENTRIES,
rte_cryptodev_sym_get_private_session_size(
- info->cid), 64, 0, NULL, NULL, NULL, NULL,
- rte_lcore_to_socket_id(lo->lcore_id), 0);
- if (!info->sess_priv_pool || !info->sess_pool) {
+ info->cid), 0, 0,
+ rte_lcore_to_socket_id(lo->lcore_id));
+
+ if (!info->sess_pool) {
RTE_LOG(ERR, USER1, "Failed to create mempool");
goto error_exit;
}
@@ -574,7 +567,6 @@ main(int argc, char *argv[])
qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
qp_conf.mp_session = info->sess_pool;
- qp_conf.mp_session_private = info->sess_priv_pool;
for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
ret = rte_cryptodev_queue_pair_setup(info->cid, j,
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 09ba952455..8aa4fe4648 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -302,7 +302,6 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
* @param dev Crypto device pointer
* @param xform Single or chain of crypto xforms
* @param session Pointer to cryptodev's private session structure
- * @param mp Mempool where the private session is allocated
*
* @return
* - Returns 0 if private session structure have been created successfully.
@@ -312,8 +311,8 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
*/
typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
+
/**
* Configure a Crypto asymmetric session on a device.
*
@@ -338,6 +337,7 @@ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev,
*/
typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
+
/**
* Clear asymmetric session private data.
*
@@ -638,28 +638,6 @@ __rte_internal
void *
rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op);
-static inline void *
-get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id) {
- if (unlikely(sess->nb_drivers <= driver_id))
- return NULL;
-
- return sess->sess_data[driver_id].data;
-}
-
-static inline void
-set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id, void *private_data)
-{
- if (unlikely(sess->nb_drivers <= driver_id)) {
- CDEV_LOG_ERR("Set private data for driver %u not allowed",
- driver_id);
- return;
- }
-
- sess->sess_data[driver_id].data = private_data;
-}
-
/**
* @internal
* Cryptodev asymmetric crypto session.
diff --git a/lib/cryptodev/cryptodev_trace_points.c b/lib/cryptodev/cryptodev_trace_points.c
index 9f0ed904ea..727114aa45 100644
--- a/lib/cryptodev/cryptodev_trace_points.c
+++ b/lib/cryptodev/cryptodev_trace_points.c
@@ -39,12 +39,6 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_free,
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_session_free,
lib.cryptodev.asym.free)
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_init,
- lib.cryptodev.sym.init)
-
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_clear,
- lib.cryptodev.sym.clear)
-
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_enqueue_burst,
lib.cryptodev.enq.burst)
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 9e76a1c72d..6acd5f4d91 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -203,12 +203,9 @@ const char *rte_crypto_asym_ke_strings[] = {
[RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY] = "pub_ec_key_verify"
};
-/**
- * The private data structure stored in the sym session mempool private data.
- */
struct rte_cryptodev_sym_session_pool_private_data {
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint16_t sess_data_sz;
+ /**< driver session data size */
uint16_t user_data_sz;
/**< session user data will be placed after sess_data */
};
@@ -1332,6 +1329,24 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
return ret;
}
+static uint8_t
+rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp,
+ uint32_t sess_priv_size)
+{
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (!mp)
+ return 0;
+
+ pool_priv = rte_mempool_get_priv(mp);
+
+ if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
+ pool_priv->sess_data_sz < sess_priv_size)
+ return 0;
+
+ return 1;
+}
+
int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
@@ -1355,17 +1370,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
- (!qp_conf->mp_session && qp_conf->mp_session_private)) {
- CDEV_LOG_ERR("Invalid mempools");
- return -EINVAL;
- }
-
if (qp_conf->mp_session) {
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
- uint32_t obj_size = qp_conf->mp_session->elt_size;
- uint32_t obj_priv_size = qp_conf->mp_session_private->elt_size;
- struct rte_cryptodev_sym_session s = {0};
pool_priv = rte_mempool_get_priv(qp_conf->mp_session);
if (!pool_priv || qp_conf->mp_session->private_data_size <
@@ -1374,13 +1380,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- s.nb_drivers = pool_priv->nb_drivers;
- s.user_data_sz = pool_priv->user_data_sz;
-
- if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
- obj_size) || (s.nb_drivers <= dev->driver_id) ||
- rte_cryptodev_sym_get_private_session_size(dev_id) >
- obj_priv_size) {
+ if (!rte_cryptodev_sym_is_valid_session_pool(qp_conf->mp_session,
+ rte_cryptodev_sym_get_private_session_size(dev_id))) {
CDEV_LOG_ERR("Invalid mempool");
return -EINVAL;
}
@@ -1862,54 +1863,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
rte_spinlock_unlock(&rte_cryptodev_cb_lock);
}
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mp)
-{
- struct rte_cryptodev *dev;
- uint32_t sess_priv_sz = rte_cryptodev_sym_get_private_session_size(
- dev_id);
- uint8_t index;
- int ret;
-
- if (!rte_cryptodev_is_valid_dev(dev_id)) {
- CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
- return -EINVAL;
- }
-
- dev = rte_cryptodev_pmd_get_dev(dev_id);
-
- if (sess == NULL || xforms == NULL || dev == NULL || mp == NULL)
- return -EINVAL;
-
- if (mp->elt_size < sess_priv_sz)
- return -EINVAL;
-
- index = dev->driver_id;
- if (index >= sess->nb_drivers)
- return -EINVAL;
-
- if (*dev->dev_ops->sym_session_configure == NULL)
- return -ENOTSUP;
-
- if (sess->sess_data[index].refcnt == 0) {
- ret = dev->dev_ops->sym_session_configure(dev, xforms,
- sess, mp);
- if (ret < 0) {
- CDEV_LOG_ERR(
- "dev_id %d failed to configure session details",
- dev_id);
- return ret;
- }
- }
-
- rte_cryptodev_trace_sym_session_init(dev_id, sess, xforms, mp);
- sess->sess_data[index].refcnt++;
- return 0;
-}
-
struct rte_mempool *
rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
@@ -1919,16 +1872,12 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
uint32_t obj_sz;
- obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
- if (obj_sz > elt_size)
- CDEV_LOG_INFO("elt_size %u is expanded to %u", elt_size,
- obj_sz);
- else
- obj_sz = elt_size;
+ obj_sz = sizeof(struct rte_cryptodev_sym_session) + elt_size + user_data_size;
+ obj_sz = RTE_ALIGN_CEIL(obj_sz, RTE_CACHE_LINE_SIZE);
mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
- (uint32_t)(sizeof(*pool_priv)),
- NULL, NULL, NULL, NULL,
+ (uint32_t)(sizeof(*pool_priv)), NULL, NULL,
+ NULL, NULL,
socket_id, 0);
if (mp == NULL) {
CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d",
@@ -1944,7 +1893,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
return NULL;
}
- pool_priv->nb_drivers = nb_drivers;
+ pool_priv->sess_data_sz = elt_size;
pool_priv->user_data_sz = user_data_size;
rte_cryptodev_trace_sym_session_pool_create(name, nb_elts,
@@ -2002,64 +1951,71 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
return mp;
}
-static unsigned int
-rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
-{
- return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
- sess->user_data_sz;
-}
-
-static uint8_t
-rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp)
-{
- struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
-
- if (!mp)
- return 0;
-
- pool_priv = rte_mempool_get_priv(mp);
-
- if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
- pool_priv->nb_drivers != nb_drivers ||
- mp->elt_size <
- rte_cryptodev_sym_get_header_session_size()
- + pool_priv->user_data_sz)
- return 0;
-
- return 1;
-}
-
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mp)
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp)
{
+ struct rte_cryptodev *dev;
struct rte_cryptodev_sym_session *sess;
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+ uint32_t sess_priv_sz;
+ int ret;
- if (!rte_cryptodev_sym_is_valid_session_pool(mp)) {
+ if (!rte_cryptodev_is_valid_dev(dev_id)) {
+ CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
+ if (xforms == NULL) {
+ CDEV_LOG_ERR("Invalid xform\n");
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
+ sess_priv_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
+ if (!rte_cryptodev_sym_is_valid_session_pool(mp, sess_priv_sz)) {
CDEV_LOG_ERR("Invalid mempool");
+ rte_errno = EINVAL;
return NULL;
}
- pool_priv = rte_mempool_get_priv(mp);
+ dev = rte_cryptodev_pmd_get_dev(dev_id);
/* Allocate a session structure from the session pool */
if (rte_mempool_get(mp, (void **)&sess)) {
CDEV_LOG_ERR("couldn't get object from session mempool");
+ rte_errno = ENOMEM;
return NULL;
}
- sess->nb_drivers = pool_priv->nb_drivers;
+ pool_priv = rte_mempool_get_priv(mp);
+ sess->driver_id = dev->driver_id;
+ sess->sess_data_sz = pool_priv->sess_data_sz;
sess->user_data_sz = pool_priv->user_data_sz;
- sess->opaque_data = 0;
+ sess->driver_priv_data_iova = rte_mempool_virt2iova(sess) +
+ offsetof(struct rte_cryptodev_sym_session, driver_priv_data);
- /* Clear device session pointer.
- * Include the flag indicating presence of user data
- */
- memset(sess->sess_data, 0,
- rte_cryptodev_sym_session_data_size(sess));
+ if (dev->dev_ops->sym_session_configure == NULL) {
+ rte_errno = ENOTSUP;
+ goto error_exit;
+ }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz + pool_priv->user_data_sz);
- rte_cryptodev_trace_sym_session_create(mp, sess);
- return sess;
+ ret = dev->dev_ops->sym_session_configure(dev, xforms, sess);
+ if (ret < 0) {
+ rte_errno = -ret;
+ goto error_exit;
+ }
+ sess->driver_id = dev->driver_id;
+
+ rte_cryptodev_trace_sym_session_create(dev_id, sess, xforms, mp);
+
+ return (void *)sess;
+error_exit:
+ rte_mempool_put(mp, (void *)sess);
+ return NULL;
}
int
@@ -2139,11 +2095,15 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
}
int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_cryptodev *dev;
- uint8_t driver_id;
+ struct rte_mempool *sess_mp;
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (sess == NULL)
+ return -EINVAL;
if (!rte_cryptodev_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
@@ -2155,41 +2115,28 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
if (dev == NULL || sess == NULL)
return -EINVAL;
- driver_id = dev->driver_id;
- if (sess->sess_data[driver_id].refcnt == 0)
- return 0;
- if (--sess->sess_data[driver_id].refcnt != 0)
- return -EBUSY;
+ sess_mp = rte_mempool_from_obj(sess);
+ if (!sess_mp)
+ return -EINVAL;
+ pool_priv = rte_mempool_get_priv(sess_mp);
+
+ if (sess->driver_id != dev->driver_id) {
+ CDEV_LOG_ERR("Session created by driver %u but freed by %u",
+ sess->driver_id, dev->driver_id);
+ return -EINVAL;
+ }
if (*dev->dev_ops->sym_session_clear == NULL)
return -ENOTSUP;
dev->dev_ops->sym_session_clear(dev, sess);
- rte_cryptodev_trace_sym_session_clear(dev_id, sess);
- return 0;
-}
-
-int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
-{
- uint8_t i;
- struct rte_mempool *sess_mp;
-
- if (sess == NULL)
- return -EINVAL;
-
- /* Check that all device private data has been freed */
- for (i = 0; i < sess->nb_drivers; i++) {
- if (sess->sess_data[i].refcnt != 0)
- return -EBUSY;
- }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz + pool_priv->user_data_sz);
/* Return session to mempool */
- sess_mp = rte_mempool_from_obj(sess);
rte_mempool_put(sess_mp, sess);
- rte_cryptodev_trace_sym_session_free(sess);
+ rte_cryptodev_trace_sym_session_free(dev_id, sess);
return 0;
}
@@ -2224,33 +2171,6 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
return 0;
}
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void)
-{
- /*
- * Header contains pointers to the private data of all registered
- * drivers and all necessary information to ensure safely clear
- * or free al session.
- */
- struct rte_cryptodev_sym_session s = {0};
-
- s.nb_drivers = nb_drivers;
-
- return (unsigned int)(sizeof(s) +
- rte_cryptodev_sym_session_data_size(&s));
-}
-
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess)
-{
- if (!sess)
- return 0;
- else
- return (unsigned int)(sizeof(*sess) +
- rte_cryptodev_sym_session_data_size(sess));
-}
-
unsigned int
rte_cryptodev_asym_get_header_session_size(void)
{
@@ -2303,9 +2223,8 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
int
rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess,
- void *data,
- uint16_t size)
+ struct rte_cryptodev_sym_session *sess, void *data,
+ uint16_t size)
{
if (sess == NULL)
return -EINVAL;
@@ -2313,7 +2232,7 @@ rte_cryptodev_sym_session_set_user_data(
if (sess->user_data_sz < size)
return -ENOMEM;
- rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
+ rte_memcpy(sess->driver_priv_data + sess->sess_data_sz, data, size);
rte_cryptodev_trace_sym_session_set_user_data(sess, data, size);
@@ -2321,15 +2240,14 @@ rte_cryptodev_sym_session_set_user_data(
}
void *
-rte_cryptodev_sym_session_get_user_data(
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_get_user_data(struct rte_cryptodev_sym_session *sess)
{
void *data = NULL;
if (sess == NULL || sess->user_data_sz == 0)
return NULL;
- data = (void *)(sess->sess_data + sess->nb_drivers);
+ data = (void *)(sess->driver_priv_data + sess->sess_data_sz);
rte_cryptodev_trace_sym_session_get_user_data(sess, data);
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56f459c6a0..0c65958f25 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -544,8 +544,6 @@ struct rte_cryptodev_qp_conf {
uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
struct rte_mempool *mp_session;
/**< The mempool for creating session in sessionless mode */
- struct rte_mempool *mp_session_private;
- /**< The mempool for creating sess private data in sessionless mode */
};
/**
@@ -909,17 +907,21 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id);
* has a fixed algo, key, op-type, digest_len etc.
*/
struct rte_cryptodev_sym_session {
+ RTE_MARKER cacheline0;
+ uint8_t driver_id;
uint64_t opaque_data;
/**< Can be used for external metadata */
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint32_t sess_data_sz;
+ /**< Pointer to the user data stored after sess data */
uint16_t user_data_sz;
- /**< session user data will be placed after sess_data */
- __extension__ struct {
- void *data;
- uint16_t refcnt;
- } sess_data[];
- /**< Driver specific session material, variable size */
+ /**< session user data will be placed after sess data */
+ rte_iova_t driver_priv_data_iova;
+ /**< session driver data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ /**< second cache line - start of the driver session data */
+ uint8_t driver_priv_data[0];
+ /**< Driver specific session data, variable size */
};
/**
@@ -954,6 +956,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
int socket_id);
+
/**
* Create an asymmetric session mempool.
*
@@ -980,17 +983,22 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t cache_size, uint16_t user_data_size, int socket_id);
/**
- * Create symmetric crypto session header (generic with no private data)
+ * Create symmetric crypto session and fill out private data for the device id,
+ * based on its device type.
+ *
+ * @param dev_id ID of device that we want the session to be used on
+ * @param xforms Symmetric crypto transform operations to apply on flow
+ * processed with this session
+ * @param mempool Mempool where the private data is allocated.
*
- * @param mempool Symmetric session mempool to allocate session
- * objects from
* @return
- * - On success return pointer to sym-session
- * - On failure returns NULL
+ * - On success return pointer to sym-session.
+ * - On failure returns NULL.
*/
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
-
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp);
/**
* Create and initialise an asymmetric crypto session structure.
* Calls the PMD to configure the private session data.
@@ -1015,19 +1023,20 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
void **session);
/**
- * Frees symmetric crypto session header, after checking that all
- * the device private data has been freed, returning it
- * to its original mempool.
+ * Frees session for the device id and returning it to its mempool.
+ * It is the application's responsibility to ensure that the session
+ * is not still in-flight operations using it.
*
+ * @param dev_id ID of device that uses the session.
* @param sess Session header to be freed.
*
* @return
* - 0 if successful.
- * - -EINVAL if session is NULL.
- * - -EBUSY if not all device private data has been freed.
+ * - -EINVAL if session is NULL or the mismatched device ids.
*/
int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess);
/**
* Clears and frees asymmetric crypto session header and private data,
@@ -1044,72 +1053,6 @@ __rte_experimental
int
rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess);
-/**
- * Fill out private data for the device id, based on its device type.
- *
- * @param dev_id ID of device that we want the session to be used on
- * @param sess Session where the private data will be attached to
- * @param xforms Symmetric crypto transform operations to apply on flow
- * processed with this session
- * @param mempool Mempool where the private data is allocated.
- *
- * @return
- * - On success, zero.
- * - -EINVAL if input parameters are invalid.
- * - -ENOTSUP if crypto device does not support the crypto transform or
- * does not support symmetric operations.
- * - -ENOMEM if the private session could not be allocated.
- */
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mempool);
-
-/**
- * Frees private data for the device id, based on its device type,
- * returning it to its mempool. It is the application's responsibility
- * to ensure that private session data is not cleared while there are
- * still in-flight operations using it.
- *
- * @param dev_id ID of device that uses the session.
- * @param sess Session containing the reference to the private data
- *
- * @return
- * - 0 if successful.
- * - -EINVAL if device is invalid or session is NULL.
- * - -ENOTSUP if crypto device does not support symmetric operations.
- */
-int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess);
-
-/**
- * Get the size of the header session, for all registered drivers excluding
- * the user data size.
- *
- * @return
- * Size of the symmetric header session.
- */
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void);
-
-/**
- * Get the size of the header session from created session.
- *
- * @param sess
- * The sym cryptodev session pointer
- *
- * @return
- * - If sess is not NULL, return the size of the header session including
- * the private data size defined within sess.
- * - If sess is NULL, return 0.
- */
-__rte_experimental
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess);
-
/**
* Get the size of the asymmetric session header.
*
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index 3d9b00145e..6ade0b72c4 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -56,7 +56,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u16(queue_pair_id);
rte_trace_point_emit_u32(conf->nb_descriptors);
rte_trace_point_emit_ptr(conf->mp_session);
- rte_trace_point_emit_ptr(conf->mp_session_private);
)
RTE_TRACE_POINT(
@@ -74,13 +73,16 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_create,
- RTE_TRACE_POINT_ARGS(void *mempool,
- struct rte_cryptodev_sym_session *sess),
- rte_trace_point_emit_ptr(mempool);
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess, void *xforms,
+ void *mempool),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
+ rte_trace_point_emit_u8(sess->driver_id);
rte_trace_point_emit_u16(sess->user_data_sz);
+ rte_trace_point_emit_ptr(xforms);
+ rte_trace_point_emit_ptr(mempool);
)
RTE_TRACE_POINT(
@@ -106,7 +108,8 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_free,
- RTE_TRACE_POINT_ARGS(struct rte_cryptodev_sym_session *sess),
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id, struct rte_cryptodev_sym_session *sess),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
)
@@ -117,27 +120,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_ptr(sess);
)
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_init,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, void *xforms,
- void *mempool),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
- rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
- rte_trace_point_emit_u16(sess->user_data_sz);
- rte_trace_point_emit_ptr(xforms);
- rte_trace_point_emit_ptr(mempool);
-)
-
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_clear,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id, void *sess),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
-)
-
RTE_TRACE_POINT(
rte_cryptodev_trace_callback_register,
RTE_TRACE_POINT_ARGS(uint8_t dev_id,
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 6d9b3e01a6..d9ccb10197 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -38,12 +38,9 @@ DPDK_23 {
rte_cryptodev_sym_capability_check_auth;
rte_cryptodev_sym_capability_check_cipher;
rte_cryptodev_sym_capability_get;
- rte_cryptodev_sym_get_header_session_size;
rte_cryptodev_sym_get_private_session_size;
- rte_cryptodev_sym_session_clear;
rte_cryptodev_sym_session_create;
rte_cryptodev_sym_session_free;
- rte_cryptodev_sym_session_init;
local: *;
};
@@ -60,7 +57,6 @@ EXPERIMENTAL {
rte_cryptodev_asym_xform_capability_check_modlen;
rte_cryptodev_asym_xform_capability_check_optype;
rte_cryptodev_sym_cpu_crypto_process;
- rte_cryptodev_sym_get_existing_header_session_size;
rte_cryptodev_sym_session_get_user_data;
rte_cryptodev_sym_session_pool_create;
rte_cryptodev_sym_session_set_user_data;
@@ -78,8 +74,6 @@ EXPERIMENTAL {
__rte_cryptodev_trace_asym_session_create;
__rte_cryptodev_trace_sym_session_free;
__rte_cryptodev_trace_asym_session_free;
- __rte_cryptodev_trace_sym_session_init;
- __rte_cryptodev_trace_sym_session_clear;
__rte_cryptodev_trace_dequeue_burst;
__rte_cryptodev_trace_enqueue_burst;
diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c
index b1310be565..cb792bbe0d 100644
--- a/lib/pipeline/rte_table_action.c
+++ b/lib/pipeline/rte_table_action.c
@@ -1898,17 +1898,11 @@ sym_crypto_apply(struct sym_crypto_data *data,
}
}
- session = rte_cryptodev_sym_session_create(cfg->mp_create);
+ session = rte_cryptodev_sym_session_create(cfg->cryptodev_id,
+ p->xform, cfg->mp_create);
if (!session)
return -ENOMEM;
- ret = rte_cryptodev_sym_session_init(cfg->cryptodev_id, session,
- p->xform, cfg->mp_init);
- if (ret < 0) {
- rte_cryptodev_sym_session_free(session);
- return ret;
- }
-
data->data_offset = (uint16_t)p->data_offset;
data->session = session;
diff --git a/lib/vhost/rte_vhost_crypto.h b/lib/vhost/rte_vhost_crypto.h
index b49e389579..2b01ecda08 100644
--- a/lib/vhost/rte_vhost_crypto.h
+++ b/lib/vhost/rte_vhost_crypto.h
@@ -54,8 +54,6 @@ rte_vhost_crypto_driver_start(const char *path);
* multiple Vhost-crypto devices.
* @param sess_pool
* The pointer to the created cryptodev session pool.
- * @param sess_priv_pool
- * The pointer to the created cryptodev session private data mempool.
* @param socket_id
* NUMA Socket ID to allocate resources on. *
* @return
@@ -65,7 +63,6 @@ rte_vhost_crypto_driver_start(const char *path);
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id);
/**
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 54946f46d9..7321da21b7 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -197,7 +197,6 @@ struct vhost_crypto {
struct rte_hash *session_map;
struct rte_mempool *mbuf_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *wb_pool;
/** DPDK cryptodev ID */
@@ -376,31 +375,21 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
return;
}
- session = rte_cryptodev_sym_session_create(vcrypto->sess_pool);
+ session = rte_cryptodev_sym_session_create(vcrypto->cid, &xform1,
+ vcrypto->sess_pool);
if (!session) {
VC_LOG_ERR("Failed to create session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
- if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
- vcrypto->sess_priv_pool) < 0) {
- VC_LOG_ERR("Failed to initialize session");
- sess_param->session_id = -VIRTIO_CRYPTO_ERR;
- return;
- }
-
/* insert hash to map */
if (rte_hash_add_key_data(vcrypto->session_map,
&vcrypto->last_session_id, session) < 0) {
VC_LOG_ERR("Failed to insert session to hash table");
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0)
- VC_LOG_ERR("Failed to clear session");
- else {
- if (rte_cryptodev_sym_session_free(session) < 0)
- VC_LOG_ERR("Failed to free session");
- }
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0)
+ VC_LOG_ERR("Failed to free session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
@@ -427,12 +416,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
return -VIRTIO_CRYPTO_INVSESS;
}
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
- VC_LOG_DBG("Failed to clear session");
- return -VIRTIO_CRYPTO_ERR;
- }
-
- if (rte_cryptodev_sym_session_free(session) < 0) {
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0) {
VC_LOG_DBG("Failed to free session");
return -VIRTIO_CRYPTO_ERR;
}
@@ -1393,7 +1377,6 @@ rte_vhost_crypto_driver_start(const char *path)
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id)
{
struct virtio_net *dev = get_device(vid);
@@ -1415,7 +1398,6 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
}
vcrypto->sess_pool = sess_pool;
- vcrypto->sess_priv_pool = sess_priv_pool;
vcrypto->cid = cryptodev_id;
vcrypto->cache_session_id = UINT64_MAX;
vcrypto->last_session_id = 1;
--
2.25.1
^ permalink raw reply [relevance 1%]
* [PATCH v12 6/7] bbdev: add queue related warning and status information
` (2 preceding siblings ...)
2022-10-04 17:16 5% ` [PATCH v12 3/7] bbdev: add device info on queue topology Nicolas Chautru
@ 2022-10-04 17:16 4% ` Nicolas Chautru
3 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-10-04 17:16 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
This allows to expose more information with regards to any
queue related failure and warning which cannot be supported
in existing API.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
app/test-bbdev/test_bbdev_perf.c | 2 ++
doc/guides/rel_notes/release_22_11.rst | 3 ++
lib/bbdev/rte_bbdev.c | 19 ++++++++++++
lib/bbdev/rte_bbdev.h | 43 ++++++++++++++++++++++++++
lib/bbdev/version.map | 1 +
5 files changed, 68 insertions(+)
diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index f5eeb735b2..75f1ca4f14 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -4361,6 +4361,8 @@ get_bbdev_queue_stats(uint16_t dev_id, uint16_t queue_id,
stats->dequeued_count = q_stats->dequeued_count;
stats->enqueue_err_count = q_stats->enqueue_err_count;
stats->dequeue_err_count = q_stats->dequeue_err_count;
+ stats->enqueue_warning_count = q_stats->enqueue_warning_count;
+ stats->dequeue_warning_count = q_stats->dequeue_warning_count;
stats->acc_offload_cycles = q_stats->acc_offload_cycles;
return 0;
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index edc50e5647..c55fb2a861 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -329,6 +329,9 @@ ABI Changes
* bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters
for queue topology, device status using ``rte_bbdev_device_status``.
+* bbdev: Structure ``rte_bbdev_queue_data`` was updated to add new parameter
+ for enqueue status using ``rte_bbdev_enqueue_status``.
+
Known Issues
------------
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 9d65ba8cd3..bdd7c2f00d 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -721,6 +721,8 @@ get_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats)
stats->dequeued_count += q_stats->dequeued_count;
stats->enqueue_err_count += q_stats->enqueue_err_count;
stats->dequeue_err_count += q_stats->dequeue_err_count;
+ stats->enqueue_warn_count += q_stats->enqueue_warn_count;
+ stats->dequeue_warn_count += q_stats->dequeue_warn_count;
}
rte_bbdev_log_debug("Got stats on %u", dev->data->dev_id);
}
@@ -1163,3 +1165,20 @@ rte_bbdev_device_status_str(enum rte_bbdev_device_status status)
rte_bbdev_log(ERR, "Invalid device status");
return NULL;
}
+
+const char *
+rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
+{
+ static const char * const enq_sta_string[] = {
+ "RTE_BBDEV_ENQ_STATUS_NONE",
+ "RTE_BBDEV_ENQ_STATUS_QUEUE_FULL",
+ "RTE_BBDEV_ENQ_STATUS_RING_FULL",
+ "RTE_BBDEV_ENQ_STATUS_INVALID_OP",
+ };
+
+ if (status < sizeof(enq_sta_string) / sizeof(char *))
+ return enq_sta_string[status];
+
+ rte_bbdev_log(ERR, "Invalid enqueue status");
+ return NULL;
+}
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 68f18fbb43..c2b0106067 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -35,6 +35,13 @@ extern "C" {
#define RTE_BBDEV_MAX_DEVS 128 /**< Max number of devices */
#endif
+/*
+ * Maximum size to be used to manage the enum rte_bbdev_enqueue_status
+ * including padding for future enum insertion.
+ * The enum values must be explicitly kept smaller or equal to this padded maximum size.
+ */
+#define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6
+
/** Flags indicate current state of BBDEV device */
enum rte_bbdev_state {
RTE_BBDEV_UNUSED,
@@ -223,6 +230,21 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
int
rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
+/**
+ * Flags indicate the reason why a previous enqueue may not have
+ * consumed all requested operations.
+ * In case of multiple reasons the latter supersedes a previous one.
+ * The related macro RTE_BBDEV_ENQ_STATUS_SIZE_MAX can be used as an absolute maximum for
+ * notably sizing array while allowing for future enumeration insertion.
+ */
+enum rte_bbdev_enqueue_status {
+ RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */
+ RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room in queue */
+ RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room in ring */
+ RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was rejected as invalid */
+ /* Note: RTE_BBDEV_ENQ_STATUS_SIZE_MAX must be larger or equal to maximum enum value */
+};
+
/**
* Flags indicate the status of the device
*/
@@ -246,6 +268,12 @@ struct rte_bbdev_stats {
uint64_t enqueue_err_count;
/** Total error count on operations dequeued */
uint64_t dequeue_err_count;
+ /** Total warning count on operations enqueued */
+ uint64_t enqueue_warn_count;
+ /** Total warning count on operations dequeued */
+ uint64_t dequeue_warn_count;
+ /** Total enqueue status count based on rte_bbdev_enqueue_status enum */
+ uint64_t enqueue_status_count[RTE_BBDEV_ENQ_STATUS_SIZE_MAX];
/** CPU cycles consumed by the (HW/SW) accelerator device to offload
* the enqueue request to its internal queues.
* - For a HW device this is the cycles consumed in MMIO write
@@ -386,6 +414,7 @@ struct rte_bbdev_queue_data {
void *queue_private; /**< Driver-specific per-queue data */
struct rte_bbdev_queue_conf conf; /**< Current configuration */
struct rte_bbdev_stats queue_stats; /**< Queue statistics */
+ enum rte_bbdev_enqueue_status enqueue_status; /**< Enqueue status when op is rejected */
bool started; /**< Queue state */
};
@@ -938,6 +967,20 @@ __rte_experimental
const char*
rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
+/**
+ * Convert queue status from enum to string.
+ *
+ * @param status
+ * Queue status as enum.
+ *
+ * @returns
+ * Queue status as string or NULL if op_type is invalid.
+ *
+ */
+__rte_experimental
+const char*
+rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map
index db178917e2..d0bb835255 100644
--- a/lib/bbdev/version.map
+++ b/lib/bbdev/version.map
@@ -47,6 +47,7 @@ EXPERIMENTAL {
rte_bbdev_dequeue_fft_ops;
rte_bbdev_device_status_str;
rte_bbdev_enqueue_fft_ops;
+ rte_bbdev_enqueue_status_str;
rte_bbdev_fft_op_alloc_bulk;
rte_bbdev_fft_op_free_bulk;
};
--
2.37.1
^ permalink raw reply [relevance 4%]
* [PATCH v12 3/7] bbdev: add device info on queue topology
2022-10-04 17:16 7% ` [PATCH v12 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
2022-10-04 17:16 4% ` [PATCH v12 2/7] bbdev: add device status info Nicolas Chautru
@ 2022-10-04 17:16 5% ` Nicolas Chautru
2022-10-04 17:16 4% ` [PATCH v12 6/7] bbdev: add queue related warning and status information Nicolas Chautru
3 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-10-04 17:16 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
Adding more options in the API to expose the number
of queues exposed and related priority.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
doc/guides/rel_notes/deprecation.rst | 3 ---
doc/guides/rel_notes/release_22_11.rst | 2 +-
lib/bbdev/rte_bbdev.h | 6 +++++-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 3bf5a4a7bd..b6485019d2 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -122,9 +122,6 @@ Deprecation Notices
* bbdev: Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22111>`__.
- New members will be added in ``rte_bbdev_driver_info`` to expose
- PMD queue topology inspired by
- this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22076>`__.
This should be updated in DPDK 22.11.
* cryptodev: Hide structures ``rte_cryptodev_sym_session`` and
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4a1a7bdc5e..0b4e28f416 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -322,7 +322,7 @@ ABI Changes
macro is added.
* bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters
- for device status using ``rte_bbdev_device_status``.
+ for queue topology, device status using ``rte_bbdev_device_status``.
Known Issues
------------
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 3c428c14e9..4228b4550f 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -289,6 +289,10 @@ struct rte_bbdev_driver_info {
/** Maximum number of queues supported by the device */
unsigned int max_num_queues;
+ /** Maximum number of queues supported per operation type */
+ unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX];
+ /** Priority level supported per operation type */
+ unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX];
/** Queue size limit (queue size must also be power of 2) */
uint32_t queue_size_lim;
/** Set if device off-loads operation to hardware */
@@ -851,7 +855,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
* Device status as enum.
*
* @returns
- * Operation type as string or NULL if op_type is invalid.
+ * Device status as string or NULL if invalid.
*
*/
__rte_experimental
--
2.37.1
^ permalink raw reply [relevance 5%]
* [PATCH v12 2/7] bbdev: add device status info
2022-10-04 17:16 7% ` [PATCH v12 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
@ 2022-10-04 17:16 4% ` Nicolas Chautru
2022-10-04 17:16 5% ` [PATCH v12 3/7] bbdev: add device info on queue topology Nicolas Chautru
2022-10-04 17:16 4% ` [PATCH v12 6/7] bbdev: add queue related warning and status information Nicolas Chautru
3 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-10-04 17:16 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
Added device status information, so that the PMD can
expose information related to the underlying accelerator device status.
Minor order change in structure to fit into padding hole.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Mingshan Zhang <mingshan.zhang@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
doc/guides/rel_notes/deprecation.rst | 3 --
doc/guides/rel_notes/release_22_11.rst | 3 ++
drivers/baseband/acc100/rte_acc100_pmd.c | 1 +
.../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 1 +
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 1 +
drivers/baseband/la12xx/bbdev_la12xx.c | 1 +
drivers/baseband/null/bbdev_null.c | 1 +
.../baseband/turbo_sw/bbdev_turbo_software.c | 1 +
lib/bbdev/rte_bbdev.c | 22 ++++++++++++
lib/bbdev/rte_bbdev.h | 35 +++++++++++++++++--
lib/bbdev/rte_bbdev_op.h | 2 +-
lib/bbdev/version.map | 7 ++++
12 files changed, 72 insertions(+), 6 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e35c86a25c..3bf5a4a7bd 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -125,9 +125,6 @@ Deprecation Notices
New members will be added in ``rte_bbdev_driver_info`` to expose
PMD queue topology inspired by
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22076>`__.
- New member will be added in ``rte_bbdev_driver_info`` to expose
- the device status as per
- this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=23367>`__.
This should be updated in DPDK 22.11.
* cryptodev: Hide structures ``rte_cryptodev_sym_session`` and
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index e9db53f372..4a1a7bdc5e 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -321,6 +321,9 @@ ABI Changes
and to allow for futureproof enum insertion a padded ``RTE_BBDEV_OP_TYPE_SIZE_MAX``
macro is added.
+* bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters
+ for device status using ``rte_bbdev_device_status``.
+
Known Issues
------------
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index e2d9409185..cdabc0f879 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -1061,6 +1061,7 @@ acc100_dev_info_get(struct rte_bbdev *dev,
/* Read and save the populated config from ACC100 registers */
fetch_acc100_config(dev);
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
/* This isn't ideal because it reports the maximum number of queues but
* does not provide info on how many can be uplink/downlink or different
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 51dd090c1b..3c36d09730 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -369,6 +369,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
dev_info->capabilities = bbdev_capabilities;
dev_info->cpu_flag_reqs = NULL;
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
/* Calculates number of queues assigned to device */
dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 036579e3ec..67b44992b2 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -645,6 +645,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
dev_info->capabilities = bbdev_capabilities;
dev_info->cpu_flag_reqs = NULL;
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
/* Calculates number of queues assigned to device */
dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 5d090c62a0..11a385ef56 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -101,6 +101,7 @@ la12xx_info_get(struct rte_bbdev *dev __rte_unused,
dev_info->capabilities = bbdev_capabilities;
dev_info->cpu_flag_reqs = NULL;
dev_info->min_alignment = 64;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
}
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 28a0cb5d4e..662663c0c8 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -83,6 +83,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
* here for code completeness.
*/
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
}
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index db96b973af..98489d218b 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -255,6 +255,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
dev_info->min_alignment = 64;
dev_info->harq_buffer_size = 0;
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
}
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 4da80472a8..38630a23f8 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -1133,3 +1133,25 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
rte_bbdev_log(ERR, "Invalid operation type");
return NULL;
}
+
+const char *
+rte_bbdev_device_status_str(enum rte_bbdev_device_status status)
+{
+ static const char * const dev_sta_string[] = {
+ "RTE_BBDEV_DEV_NOSTATUS",
+ "RTE_BBDEV_DEV_NOT_SUPPORTED",
+ "RTE_BBDEV_DEV_RESET",
+ "RTE_BBDEV_DEV_CONFIGURED",
+ "RTE_BBDEV_DEV_ACTIVE",
+ "RTE_BBDEV_DEV_FATAL_ERR",
+ "RTE_BBDEV_DEV_RESTART_REQ",
+ "RTE_BBDEV_DEV_RECONFIG_REQ",
+ "RTE_BBDEV_DEV_CORRECT_ERR",
+ };
+
+ if (status < sizeof(dev_sta_string) / sizeof(char *))
+ return dev_sta_string[status];
+
+ rte_bbdev_log(ERR, "Invalid device status");
+ return NULL;
+}
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index b88c88167e..3c428c14e9 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -223,6 +223,21 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
int
rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
+/**
+ * Flags indicate the status of the device
+ */
+enum rte_bbdev_device_status {
+ RTE_BBDEV_DEV_NOSTATUS, /**< Nothing being reported */
+ RTE_BBDEV_DEV_NOT_SUPPORTED, /**< Device status is not supported on the PMD */
+ RTE_BBDEV_DEV_RESET, /**< Device in reset and un-configured state */
+ RTE_BBDEV_DEV_CONFIGURED, /**< Device is configured and ready to use */
+ RTE_BBDEV_DEV_ACTIVE, /**< Device is configured and VF is being used */
+ RTE_BBDEV_DEV_FATAL_ERR, /**< Device has hit a fatal uncorrectable error */
+ RTE_BBDEV_DEV_RESTART_REQ, /**< Device requires application to restart */
+ RTE_BBDEV_DEV_RECONFIG_REQ, /**< Device requires application to reconfigure queues */
+ RTE_BBDEV_DEV_CORRECT_ERR, /**< Warning of a correctable error event happened */
+};
+
/** Device statistics. */
struct rte_bbdev_stats {
uint64_t enqueued_count; /**< Count of all operations enqueued */
@@ -284,10 +299,12 @@ struct rte_bbdev_driver_info {
uint8_t max_ul_queue_priority;
/** Set if device supports per-queue interrupts */
bool queue_intr_supported;
- /** Minimum alignment of buffers, in bytes */
- uint16_t min_alignment;
+ /** Device Status */
+ enum rte_bbdev_device_status device_status;
/** HARQ memory available in kB */
uint32_t harq_buffer_size;
+ /** Minimum alignment of buffers, in bytes */
+ uint16_t min_alignment;
/** Byte endianness (RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN) supported
* for input/output data
*/
@@ -827,6 +844,20 @@ int
rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
void *data);
+/**
+ * Convert device status from enum to string.
+ *
+ * @param status
+ * Device status as enum.
+ *
+ * @returns
+ * Operation type as string or NULL if op_type is invalid.
+ *
+ */
+__rte_experimental
+const char*
+rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index a6a6b8b31a..99a7552779 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -748,7 +748,7 @@ struct rte_bbdev_op_cap_ldpc_enc {
uint16_t num_buffers_dst;
};
-/** Different operation types supported by the device
+/** Different operation types supported by the device.
* The related macro RTE_BBDEV_OP_TYPE_SIZE_MAX can be used as an absolute maximum for
* notably sizing array while allowing for future enumeration insertion.
*/
diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map
index 25a0a22bd4..addea05f00 100644
--- a/lib/bbdev/version.map
+++ b/lib/bbdev/version.map
@@ -39,3 +39,10 @@ DPDK_23 {
local: *;
};
+
+EXPERIMENTAL {
+ global:
+
+ # added in 22.11
+ rte_bbdev_device_status_str;
+};
--
2.37.1
^ permalink raw reply [relevance 4%]
* [PATCH v12 1/7] bbdev: allow operation type enum for growth
@ 2022-10-04 17:16 7% ` Nicolas Chautru
2022-10-04 17:16 4% ` [PATCH v12 2/7] bbdev: add device status info Nicolas Chautru
` (2 subsequent siblings)
3 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-10-04 17:16 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
Updating the enum for rte_bbdev_op_type
to allow to keep ABI compatible for enum insertion
while adding padded maximum value for array need.
Removing RTE_BBDEV_OP_TYPE_COUNT and instead exposing
RTE_BBDEV_OP_TYPE_SIZE_MAX.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
app/test-bbdev/test_bbdev.c | 2 +-
app/test-bbdev/test_bbdev_perf.c | 4 ++--
doc/guides/rel_notes/deprecation.rst | 5 +----
doc/guides/rel_notes/release_22_11.rst | 3 +++
examples/bbdev_app/main.c | 2 +-
lib/bbdev/rte_bbdev.c | 8 +++++---
lib/bbdev/rte_bbdev_op.h | 14 ++++++++++++--
7 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c
index ac06d7320a..65805977ae 100644
--- a/app/test-bbdev/test_bbdev.c
+++ b/app/test-bbdev/test_bbdev.c
@@ -521,7 +521,7 @@ test_bbdev_op_pool(void)
rte_mempool_free(mp);
TEST_ASSERT((mp = rte_bbdev_op_pool_create("Test_INV",
- RTE_BBDEV_OP_TYPE_COUNT, size, cache_size, 0)) == NULL,
+ RTE_BBDEV_OP_TYPE_SIZE_MAX, size, cache_size, 0)) == NULL,
"Failed test for rte_bbdev_op_pool_create: "
"returned value is not NULL for invalid type");
diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 311e5d1a96..f5eeb735b2 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -2429,13 +2429,13 @@ run_test_case_on_device(test_case_function *test_case_func, uint8_t dev_id,
/* Find capabilities */
const struct rte_bbdev_op_cap *cap = info.drv.capabilities;
- for (i = 0; i < RTE_BBDEV_OP_TYPE_COUNT; i++) {
+ do {
if (cap->type == test_vector.op_type) {
capabilities = cap;
break;
}
cap++;
- }
+ } while (cap->type != RTE_BBDEV_OP_NONE);
TEST_ASSERT_NOT_NULL(capabilities,
"Couldn't find capabilities");
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a991fa14de..e35c86a25c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -120,10 +120,7 @@ Deprecation Notices
``RTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRY`` and
``RTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRY`` in DPDK 22.11.
-* bbdev: ``RTE_BBDEV_OP_TYPE_COUNT`` terminating the ``rte_bbdev_op_type``
- enum will be deprecated and instead use fixed array size when required
- to allow for future enum extension.
- Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per
+* bbdev: Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22111>`__.
New members will be added in ``rte_bbdev_driver_info`` to expose
PMD queue topology inspired by
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 53fe21453c..e9db53f372 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -317,6 +317,9 @@ ABI Changes
* eventdev: Added ``weight`` and ``affinity`` fields
to ``rte_event_queue_conf`` structure.
+* bbdev: enum ``rte_bbdev_op_type`` was affected to remove ``RTE_BBDEV_OP_TYPE_COUNT``
+ and to allow for futureproof enum insertion a padded ``RTE_BBDEV_OP_TYPE_SIZE_MAX``
+ macro is added.
Known Issues
------------
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index fc7e8b8174..7e16e16bf8 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -1041,7 +1041,7 @@ main(int argc, char **argv)
void *sigret;
struct app_config_params app_params = def_app_config;
struct rte_mempool *ethdev_mbuf_mempool, *bbdev_mbuf_mempool;
- struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_COUNT];
+ struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_SIZE_MAX];
struct lcore_conf lcore_conf[RTE_MAX_LCORE] = { {0} };
struct lcore_statistics lcore_stats[RTE_MAX_LCORE] = { {0} };
struct stats_lcore_params stats_lcore;
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index aaee7b7872..4da80472a8 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -23,6 +23,8 @@
#define DEV_NAME "BBDEV"
+/* Number of supported operation types */
+#define BBDEV_OP_TYPE_COUNT 5
/* BBDev library logging ID */
RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE);
@@ -890,10 +892,10 @@ rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
return NULL;
}
- if (type >= RTE_BBDEV_OP_TYPE_COUNT) {
+ if (type >= BBDEV_OP_TYPE_COUNT) {
rte_bbdev_log(ERR,
"Invalid op type (%u), should be less than %u",
- type, RTE_BBDEV_OP_TYPE_COUNT);
+ type, BBDEV_OP_TYPE_COUNT);
return NULL;
}
@@ -1125,7 +1127,7 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
"RTE_BBDEV_OP_LDPC_ENC",
};
- if (op_type < RTE_BBDEV_OP_TYPE_COUNT)
+ if (op_type < BBDEV_OP_TYPE_COUNT)
return op_types[op_type];
rte_bbdev_log(ERR, "Invalid operation type");
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index 6d561334e8..a6a6b8b31a 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -48,6 +48,13 @@ extern "C" {
/* LDPC: Maximum number of Code Blocks in Transport Block.*/
#define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
+/*
+ * Maximum size to be used to manage the enum rte_bbdev_op_type
+ * including padding for future enum insertion.
+ * The enum values must be explicitly kept smaller or equal to this padded maximum size.
+ */
+#define RTE_BBDEV_OP_TYPE_SIZE_MAX 8
+
/** Flags for turbo decoder operation and capability structure */
enum rte_bbdev_op_td_flag_bitmasks {
/** If sub block de-interleaving is to be performed. */
@@ -741,14 +748,17 @@ struct rte_bbdev_op_cap_ldpc_enc {
uint16_t num_buffers_dst;
};
-/** Different operation types supported by the device */
+/** Different operation types supported by the device
+ * The related macro RTE_BBDEV_OP_TYPE_SIZE_MAX can be used as an absolute maximum for
+ * notably sizing array while allowing for future enumeration insertion.
+ */
enum rte_bbdev_op_type {
RTE_BBDEV_OP_NONE, /**< Dummy operation that does nothing */
RTE_BBDEV_OP_TURBO_DEC, /**< Turbo decode */
RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */
RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */
RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */
- RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */
+ /* Note: RTE_BBDEV_OP_TYPE_SIZE_MAX must be larger or equal to maximum enum value */
};
/** Bit indexes of possible errors reported through status field */
--
2.37.1
^ permalink raw reply [relevance 7%]
* [PATCH v8 1/6] eal/loongarch: support LoongArch architecture
@ 2022-10-04 15:40 5% ` Min Zhou
0 siblings, 0 replies; 200+ results
From: Min Zhou @ 2022-10-04 15:40 UTC (permalink / raw)
To: thomas, david.marchand, bruce.richardson, anatoly.burakov,
qiming.yang, Yuying.Zhang, jgrajcia, konstantin.v.ananyev,
zhoumin
Cc: dev, maobibo
Add all necessary elements for DPDK to compile and run EAL on
LoongArch64 Soc.
This includes:
- EAL library implementation for LoongArch ISA.
- meson build structure for 'loongarch' architecture.
RTE_ARCH_LOONGARCH define is added for architecture identification.
- xmm_t structure operation stubs as there is no vector support in
the current version for LoongArch.
Compilation was tested on Debian and CentOS using loongarch64
cross-compile toolchain from x86 build hosts. Functions were tested
on Loongnix and Kylin which are two Linux distributions supported
LoongArch host based on Linux 4.19 maintained by Loongson
Corporation.
We also tested DPDK on LoongArch with some external applications,
including: Pktgen-DPDK, OVS, VPP.
The platform is currently marked as linux-only because there is no
other OS than Linux support LoongArch host currently.
The i40e PMD driver is disabled on LoongArch because of the absence
of vector support in the current version.
Similar to RISC-V, the compilation of following modules has been
disabled by this commit and will be re-enabled in later commits as
fixes are introduced:
net/ixgbe, net/memif, net/tap, example/l3fwd.
Signed-off-by: Min Zhou <zhoumin@loongson.cn>
---
MAINTAINERS | 6 ++
app/test/test_xmmt_ops.h | 12 +++
.../loongarch/loongarch_loongarch64_linux_gcc | 16 +++
config/loongarch/meson.build | 43 ++++++++
devtools/test-meson-builds.sh | 4 +
doc/guides/contributing/design.rst | 2 +-
.../cross_build_dpdk_for_loongarch.rst | 97 +++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
doc/guides/nics/features.rst | 8 ++
doc/guides/nics/features/default.ini | 1 +
doc/guides/rel_notes/release_22_11.rst | 7 ++
drivers/net/i40e/meson.build | 6 ++
drivers/net/ixgbe/meson.build | 6 ++
drivers/net/memif/meson.build | 6 ++
drivers/net/tap/meson.build | 6 ++
examples/l3fwd/meson.build | 6 ++
lib/eal/linux/eal_memory.c | 4 +
lib/eal/loongarch/include/meson.build | 18 ++++
lib/eal/loongarch/include/rte_atomic.h | 47 +++++++++
lib/eal/loongarch/include/rte_byteorder.h | 40 ++++++++
lib/eal/loongarch/include/rte_cpuflags.h | 39 ++++++++
lib/eal/loongarch/include/rte_cycles.h | 47 +++++++++
lib/eal/loongarch/include/rte_io.h | 18 ++++
lib/eal/loongarch/include/rte_memcpy.h | 61 ++++++++++++
lib/eal/loongarch/include/rte_pause.h | 24 +++++
.../loongarch/include/rte_power_intrinsics.h | 20 ++++
lib/eal/loongarch/include/rte_prefetch.h | 47 +++++++++
lib/eal/loongarch/include/rte_rwlock.h | 42 ++++++++
lib/eal/loongarch/include/rte_spinlock.h | 64 ++++++++++++
lib/eal/loongarch/include/rte_vect.h | 65 +++++++++++++
lib/eal/loongarch/meson.build | 11 +++
lib/eal/loongarch/rte_cpuflags.c | 93 ++++++++++++++++++
lib/eal/loongarch/rte_cycles.c | 45 +++++++++
lib/eal/loongarch/rte_hypervisor.c | 11 +++
lib/eal/loongarch/rte_power_intrinsics.c | 53 ++++++++++
meson.build | 2 +
36 files changed, 977 insertions(+), 1 deletion(-)
create mode 100644 config/loongarch/loongarch_loongarch64_linux_gcc
create mode 100644 config/loongarch/meson.build
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
create mode 100644 lib/eal/loongarch/include/meson.build
create mode 100644 lib/eal/loongarch/include/rte_atomic.h
create mode 100644 lib/eal/loongarch/include/rte_byteorder.h
create mode 100644 lib/eal/loongarch/include/rte_cpuflags.h
create mode 100644 lib/eal/loongarch/include/rte_cycles.h
create mode 100644 lib/eal/loongarch/include/rte_io.h
create mode 100644 lib/eal/loongarch/include/rte_memcpy.h
create mode 100644 lib/eal/loongarch/include/rte_pause.h
create mode 100644 lib/eal/loongarch/include/rte_power_intrinsics.h
create mode 100644 lib/eal/loongarch/include/rte_prefetch.h
create mode 100644 lib/eal/loongarch/include/rte_rwlock.h
create mode 100644 lib/eal/loongarch/include/rte_spinlock.h
create mode 100644 lib/eal/loongarch/include/rte_vect.h
create mode 100644 lib/eal/loongarch/meson.build
create mode 100644 lib/eal/loongarch/rte_cpuflags.c
create mode 100644 lib/eal/loongarch/rte_cycles.c
create mode 100644 lib/eal/loongarch/rte_hypervisor.c
create mode 100644 lib/eal/loongarch/rte_power_intrinsics.c
diff --git a/MAINTAINERS b/MAINTAINERS
index a55b379d73..5472fccf61 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -294,6 +294,12 @@ F: app/*/*_neon.*
F: examples/*/*_neon.*
F: examples/common/neon/
+LoongArch
+M: Min Zhou <zhoumin@loongson.cn>
+F: config/loongarch/
+F: doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
+F: lib/eal/loongarch/
+
IBM POWER (alpha)
M: David Christensen <drc@linux.vnet.ibm.com>
F: config/ppc/
diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
index 55f256599e..626aa9bcba 100644
--- a/app/test/test_xmmt_ops.h
+++ b/app/test/test_xmmt_ops.h
@@ -65,6 +65,18 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
return data;
}
+#elif defined(RTE_ARCH_LOONGARCH)
+
+#define vect_loadu_sil128(p) vect_load_128(p)
+
+/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
+static __rte_always_inline xmm_t
+vect_set_epi32(int i3, int i2, int i1, int i0)
+{
+ xmm_t data = (xmm_t){.u32 = {i0, i1, i2, i3}};
+
+ return data;
+}
#endif
#endif /* _TEST_XMMT_OPS_H_ */
diff --git a/config/loongarch/loongarch_loongarch64_linux_gcc b/config/loongarch/loongarch_loongarch64_linux_gcc
new file mode 100644
index 0000000000..c9330223ad
--- /dev/null
+++ b/config/loongarch/loongarch_loongarch64_linux_gcc
@@ -0,0 +1,16 @@
+[binaries]
+c = ['ccache', 'loongarch64-unknown-linux-gnu-gcc']
+cpp = ['ccache', 'loongarch64-unknown-linux-gnu-g++']
+ar = 'loongarch64-unknown-linux-gnu-gcc-ar'
+strip = 'loongarch64-unknown-linux-gnu-strip'
+pcap-config = ''
+
+[host_machine]
+system = 'linux'
+cpu_family = 'loongarch64'
+cpu = '3a5000'
+endian = 'little'
+
+[properties]
+implementor_id = 'generic'
+implementor_pn = 'default'
diff --git a/config/loongarch/meson.build b/config/loongarch/meson.build
new file mode 100644
index 0000000000..99dabef203
--- /dev/null
+++ b/config/loongarch/meson.build
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Loongson Technology Corporation Limited
+
+if not dpdk_conf.get('RTE_ARCH_64')
+ error('Only 64-bit compiles are supported for this platform type')
+endif
+dpdk_conf.set('RTE_ARCH', 'loongarch')
+dpdk_conf.set('RTE_ARCH_LOONGARCH', 1)
+dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
+
+machine_args_generic = [
+ ['default', ['-march=loongarch64']],
+]
+
+flags_generic = [
+ ['RTE_MACHINE', '"loongarch64"'],
+ ['RTE_MAX_LCORE', 64],
+ ['RTE_MAX_NUMA_NODES', 16],
+ ['RTE_CACHE_LINE_SIZE', 64]]
+
+impl_generic = ['Generic loongarch', flags_generic, machine_args_generic]
+
+machine = []
+machine_args = []
+
+machine = impl_generic
+impl_pn = 'default'
+
+message('Implementer : ' + machine[0])
+foreach flag: machine[1]
+ if flag.length() > 0
+ dpdk_conf.set(flag[0], flag[1])
+ endif
+endforeach
+
+foreach marg: machine[2]
+ if marg[0] == impl_pn
+ foreach f: marg[1]
+ machine_args += f
+ endforeach
+ endif
+endforeach
+message(machine_args)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 04a85fe987..e20a1c1df3 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -260,6 +260,10 @@ build build-x86-mingw $f skipABI -Dexamples=helloworld
f=$srcdir/config/arm/arm64_armv8_linux_gcc
build build-arm64-generic-gcc $f ABI $use_shared
+# generic LoongArch
+f=$srcdir/config/loongarch/loongarch_loongarch64_linux_gcc
+build build-loongarch64-generic-gcc $f ABI $use_shared
+
# IBM POWER
f=$srcdir/config/ppc/ppc64le-power8-linux-gcc
build build-ppc64-power8-gcc $f ABI $use_shared
diff --git a/doc/guides/contributing/design.rst b/doc/guides/contributing/design.rst
index 0383afe5c8..d24a7ff6a0 100644
--- a/doc/guides/contributing/design.rst
+++ b/doc/guides/contributing/design.rst
@@ -42,7 +42,7 @@ Per Architecture Sources
The following macro options can be used:
* ``RTE_ARCH`` is a string that contains the name of the architecture.
-* ``RTE_ARCH_I686``, ``RTE_ARCH_X86_64``, ``RTE_ARCH_X86_X32``, ``RTE_ARCH_PPC_64``, ``RTE_ARCH_RISCV``, ``RTE_ARCH_ARM``, ``RTE_ARCH_ARMv7`` or ``RTE_ARCH_ARM64`` are defined only if we are building for those architectures.
+* ``RTE_ARCH_I686``, ``RTE_ARCH_X86_64``, ``RTE_ARCH_X86_X32``, ``RTE_ARCH_PPC_64``, ``RTE_ARCH_RISCV``, ``RTE_ARCH_LOONGARCH``, ``RTE_ARCH_ARM``, ``RTE_ARCH_ARMv7`` or ``RTE_ARCH_ARM64`` are defined only if we are building for those architectures.
Per Execution Environment Sources
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
new file mode 100644
index 0000000000..979d075a90
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
@@ -0,0 +1,97 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2022 Loongson Technology Corporation Limited
+
+Cross compiling DPDK for LoongArch
+==================================
+
+This chapter describes how to cross compile DPDK for LoongArch from x86 build
+hosts.
+
+.. note::
+
+ Due to some of the code under review, the current Linux 5.19 cannot boot
+ on LoongArch system. There are still some Linux distributions that have
+ supported LoongArch host, such as Anolis OS, Kylin, Loongnix and UOS. These
+ distributions base on Linux kernel 4.19 supported by Loongson Corporation.
+ Because LoongArch is such a new platform with many fundamental pieces of
+ software still under development, it is currently recommended to cross
+ compile DPDK on x86 for LoongArch.
+
+
+Prerequisites
+-------------
+
+Ensure that you have all pre-requisites for building DPDK natively as those
+will be required also for cross-compilation.
+
+Linux kernel
+~~~~~~~~~~~~
+
+Make sure that LoongArch host is running Linux kernel 4.19 or newer supported
+by Loongson Corporation. The support for LoongArch in the current Linux 5.19
+is not complete because it still misses some patches to add for other
+subsystems.
+
+GNU toolchain
+-------------
+
+Obtain the cross toolchain
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The build process was tested using:
+
+* Latest `LoongArch GNU toolchain
+ <https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz>`_
+ on Debian 10.4 or CentOS 8.
+
+Alternatively the toolchain may be built straight from the source. There is a
+script to do that. But adding the whole script in this documentation is too
+much. If you want to generate your own cross toolchain, you can refer to this
+thread `Introduce support for LoongArch architecture
+<https://inbox.dpdk.org/dev/53b50799-cb29-7ee6-be89-4fe21566e127@loongson.cn/T/#m1da99578f85894a4ddcd8e39d8239869e6a501d1>`_.
+Before you start running the script, you may need to install some dependencies.
+For instance, if you want to run this script in a RHEL 8 system, you can use
+the following command to install these packages:
+
+.. code-block:: console
+
+ subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
+ dnf install bison diffutils file flex gcc gcc-c++ git gmp-devel libtool make python3 rsync texinfo wget xz zlib-devel ccache
+
+To download cross tools from github we can use the following command:
+
+.. code-block:: console
+
+ wget -P /tmp/ https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
+
+Unzip and add into the PATH
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+After downloading the cross-tools file, we need unzip and add those executable
+binaries into the PATH as follows:
+
+.. code-block:: console
+
+ tar -xvf /tmp/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz -C <cross_tool_install_dir> --strip-components 1
+ export PATH=$PATH:<cross_tool_install_dir>/bin
+
+
+Cross Compiling DPDK with GNU toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To cross-compile DPDK for generic LoongArch we can use the following command:
+
+.. code-block:: console
+
+ meson cross-build --cross-file config/loongarch/loongarch_loongarch64_linux_gcc
+ ninja -C cross-build
+
+Supported cross-compilation targets
+-----------------------------------
+
+Currently the following target is supported:
+
+* Generic LoongArch64 ISA: ``config/loongarch/loongarch_loongarch64_linux_gcc``
+
+To add a new target support, a corresponding cross-file has to be added to
+``config/loongarch`` directory.
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 747552c385..c3e67bf9ec 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -14,6 +14,7 @@ Getting Started Guide for Linux
sys_reqs
build_dpdk
cross_build_dpdk_for_arm64
+ cross_build_dpdk_for_loongarch
cross_build_dpdk_for_riscv
linux_drivers
build_sample_apps
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index b0bc4c79b0..c4ab65adf8 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -832,6 +832,14 @@ ARMv8
Support armv8a (64bit) architecture.
+.. _nic_features_loongarch64:
+
+LoongArch64
+-----------
+
+Support 64-bit LoongArch architecture.
+
+
.. _nic_features_power8:
Power8
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index f7192cb0da..cbc17c0434 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -71,6 +71,7 @@ Linux =
Windows =
ARMv7 =
ARMv8 =
+LoongArch64 =
Power8 =
rv64 =
x86-32 =
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 5d8ef669b8..dab08d58cf 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -55,6 +55,13 @@ New Features
Also, make sure to start the actual text at the margin.
=======================================================
+* **Added initial LoongArch architecture support.**
+
+ * Added EAL implementation for LoongArch architecture. The initial devices
+ the porting was tested on included Loongson 3A5000, Loongson 3C5000 and
+ Loongson 3C5000L. In theory this implementation should work with any target
+ based on ``LoongArch`` ISA.
+
* **Added configuration for asynchronous flow connection tracking.**
Added connection tracking action number hint to ``rte_flow_configure``
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index 84fd42754e..e00c1a9ef9 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -1,6 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
+if arch_subdir == 'loongarch'
+ build = false
+ reason = 'not supported on LoongArch'
+ subdir_done()
+endif
+
if arch_subdir == 'riscv'
build = false
reason = 'not supported on RISC-V'
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index a18908ef7c..80ab012448 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -1,6 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
+if arch_subdir == 'loongarch'
+ build = false
+ reason = 'not supported on LoongArch'
+ subdir_done()
+endif
+
cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
subdir('base')
diff --git a/drivers/net/memif/meson.build b/drivers/net/memif/meson.build
index 680bc8631c..30c0fbc798 100644
--- a/drivers/net/memif/meson.build
+++ b/drivers/net/memif/meson.build
@@ -1,6 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018-2019 Cisco Systems, Inc. All rights reserved.
+if arch_subdir == 'loongarch'
+ build = false
+ reason = 'not supported on LoongArch'
+ subdir_done()
+endif
+
if not is_linux
build = false
reason = 'only supported on Linux'
diff --git a/drivers/net/tap/meson.build b/drivers/net/tap/meson.build
index c09713a67b..f0d03069cd 100644
--- a/drivers/net/tap/meson.build
+++ b/drivers/net/tap/meson.build
@@ -1,6 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018 Luca Boccassi <bluca@debian.org>
+if arch_subdir == 'loongarch'
+ build = false
+ reason = 'not supported on LoongArch'
+ subdir_done()
+endif
+
if not is_linux
build = false
reason = 'only supported on Linux'
diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build
index b40244a941..d2f2d96099 100644
--- a/examples/l3fwd/meson.build
+++ b/examples/l3fwd/meson.build
@@ -6,6 +6,12 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
+if arch_subdir == 'loongarch'
+ build = false
+ reason = 'not supported on LoongArch'
+ subdir_done()
+endif
+
allow_experimental_apis = true
deps += ['acl', 'hash', 'lpm', 'fib', 'eventdev']
sources = files(
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index c890c42106..60fc8cc6ca 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -77,7 +77,11 @@ uint64_t eal_get_baseaddr(void)
* rte_mem_check_dma_mask for ensuring all memory is within supported
* range.
*/
+#if defined(RTE_ARCH_LOONGARCH)
+ return 0x7000000000ULL;
+#else
return 0x100000000ULL;
+#endif
}
/*
diff --git a/lib/eal/loongarch/include/meson.build b/lib/eal/loongarch/include/meson.build
new file mode 100644
index 0000000000..6e8d12601a
--- /dev/null
+++ b/lib/eal/loongarch/include/meson.build
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Loongson Technology Corporation Limited
+
+arch_headers = files(
+ 'rte_atomic.h',
+ 'rte_byteorder.h',
+ 'rte_cpuflags.h',
+ 'rte_cycles.h',
+ 'rte_io.h',
+ 'rte_memcpy.h',
+ 'rte_pause.h',
+ 'rte_power_intrinsics.h',
+ 'rte_prefetch.h',
+ 'rte_rwlock.h',
+ 'rte_spinlock.h',
+ 'rte_vect.h',
+)
+install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
diff --git a/lib/eal/loongarch/include/rte_atomic.h b/lib/eal/loongarch/include/rte_atomic.h
new file mode 100644
index 0000000000..3c8284517e
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_atomic.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_ATOMIC_LOONGARCH_H
+#define RTE_ATOMIC_LOONGARCH_H
+
+#ifndef RTE_FORCE_INTRINSICS
+# error Platform must be built with RTE_FORCE_INTRINSICS
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include "generic/rte_atomic.h"
+
+#define rte_mb() do { asm volatile("dbar 0":::"memory"); } while (0)
+
+#define rte_wmb() rte_mb()
+
+#define rte_rmb() rte_mb()
+
+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_mb()
+
+#define rte_smp_rmb() rte_mb()
+
+#define rte_io_mb() rte_mb()
+
+#define rte_io_wmb() rte_mb()
+
+#define rte_io_rmb() rte_mb()
+
+static __rte_always_inline void
+rte_atomic_thread_fence(int memorder)
+{
+ __atomic_thread_fence(memorder);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_ATOMIC_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_byteorder.h b/lib/eal/loongarch/include/rte_byteorder.h
new file mode 100644
index 0000000000..0da6097a4f
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_byteorder.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_BYTEORDER_LOONGARCH_H
+#define RTE_BYTEORDER_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_byteorder.h"
+
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+
+#define rte_cpu_to_le_16(x) (x)
+#define rte_cpu_to_le_32(x) (x)
+#define rte_cpu_to_le_64(x) (x)
+
+#define rte_cpu_to_be_16(x) rte_bswap16(x)
+#define rte_cpu_to_be_32(x) rte_bswap32(x)
+#define rte_cpu_to_be_64(x) rte_bswap64(x)
+
+#define rte_le_to_cpu_16(x) (x)
+#define rte_le_to_cpu_32(x) (x)
+#define rte_le_to_cpu_64(x) (x)
+
+#define rte_be_to_cpu_16(x) rte_bswap16(x)
+#define rte_be_to_cpu_32(x) rte_bswap32(x)
+#define rte_be_to_cpu_64(x) rte_bswap64(x)
+
+#else /* RTE_BIG_ENDIAN */
+#error "LoongArch not support big endian!"
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_BYTEORDER_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_cpuflags.h b/lib/eal/loongarch/include/rte_cpuflags.h
new file mode 100644
index 0000000000..1c80779262
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_cpuflags.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_CPUFLAGS_LOONGARCH_H
+#define RTE_CPUFLAGS_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Enumeration of all CPU features supported
+ */
+enum rte_cpu_flag_t {
+ RTE_CPUFLAG_CPUCFG = 0,
+ RTE_CPUFLAG_LAM,
+ RTE_CPUFLAG_UAL,
+ RTE_CPUFLAG_FPU,
+ RTE_CPUFLAG_LSX,
+ RTE_CPUFLAG_LASX,
+ RTE_CPUFLAG_CRC32,
+ RTE_CPUFLAG_COMPLEX,
+ RTE_CPUFLAG_CRYPTO,
+ RTE_CPUFLAG_LVZ,
+ RTE_CPUFLAG_LBT_X86,
+ RTE_CPUFLAG_LBT_ARM,
+ RTE_CPUFLAG_LBT_MIPS,
+ /* The last item */
+ RTE_CPUFLAG_NUMFLAGS /**< This should always be the last! */
+};
+
+#include "generic/rte_cpuflags.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_CPUFLAGS_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_cycles.h b/lib/eal/loongarch/include/rte_cycles.h
new file mode 100644
index 0000000000..f612d1ad10
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_cycles.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_CYCLES_LOONGARCH_H
+#define RTE_CYCLES_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_cycles.h"
+
+/**
+ * Read the time base register.
+ *
+ * @return
+ * The time base for this lcore.
+ */
+static inline uint64_t
+rte_rdtsc(void)
+{
+ uint64_t count;
+
+ __asm__ __volatile__ (
+ "rdtime.d %[cycles], $zero\n"
+ : [cycles] "=r" (count)
+ ::
+ );
+ return count;
+}
+
+static inline uint64_t
+rte_rdtsc_precise(void)
+{
+ rte_mb();
+ return rte_rdtsc();
+}
+
+static inline uint64_t
+rte_get_tsc_cycles(void) { return rte_rdtsc(); }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_CYCLES_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_io.h b/lib/eal/loongarch/include/rte_io.h
new file mode 100644
index 0000000000..40e40efa86
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_io.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_IO_LOONGARCH_H
+#define RTE_IO_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_io.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_IO_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_memcpy.h b/lib/eal/loongarch/include/rte_memcpy.h
new file mode 100644
index 0000000000..22578d40f4
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_memcpy.h
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_MEMCPY_LOONGARCH_H
+#define RTE_MEMCPY_LOONGARCH_H
+
+#include <stdint.h>
+#include <string.h>
+
+#include "rte_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_memcpy.h"
+
+static inline void
+rte_mov16(uint8_t *dst, const uint8_t *src)
+{
+ memcpy(dst, src, 16);
+}
+
+static inline void
+rte_mov32(uint8_t *dst, const uint8_t *src)
+{
+ memcpy(dst, src, 32);
+}
+
+static inline void
+rte_mov48(uint8_t *dst, const uint8_t *src)
+{
+ memcpy(dst, src, 48);
+}
+
+static inline void
+rte_mov64(uint8_t *dst, const uint8_t *src)
+{
+ memcpy(dst, src, 64);
+}
+
+static inline void
+rte_mov128(uint8_t *dst, const uint8_t *src)
+{
+ memcpy(dst, src, 128);
+}
+
+static inline void
+rte_mov256(uint8_t *dst, const uint8_t *src)
+{
+ memcpy(dst, src, 256);
+}
+
+#define rte_memcpy(d, s, n) memcpy((d), (s), (n))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_MEMCPY_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_pause.h b/lib/eal/loongarch/include/rte_pause.h
new file mode 100644
index 0000000000..4302e1b9be
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_pause.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_PAUSE_LOONGARCH_H
+#define RTE_PAUSE_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "rte_atomic.h"
+
+#include "generic/rte_pause.h"
+
+static inline void rte_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_PAUSE_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_power_intrinsics.h b/lib/eal/loongarch/include/rte_power_intrinsics.h
new file mode 100644
index 0000000000..d5dbd94567
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_power_intrinsics.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_POWER_INTRINSIC_LOONGARCH_H
+#define RTE_POWER_INTRINSIC_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+
+#include "generic/rte_power_intrinsics.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_POWER_INTRINSIC_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_prefetch.h b/lib/eal/loongarch/include/rte_prefetch.h
new file mode 100644
index 0000000000..ac18318fe4
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_prefetch.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_PREFETCH_LOONGARCH_H
+#define RTE_PREFETCH_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include "generic/rte_prefetch.h"
+
+static inline void rte_prefetch0(const volatile void *p)
+{
+ __builtin_prefetch((const void *)(uintptr_t)p, 0, 3);
+}
+
+static inline void rte_prefetch1(const volatile void *p)
+{
+ __builtin_prefetch((const void *)(uintptr_t)p, 0, 2);
+}
+
+static inline void rte_prefetch2(const volatile void *p)
+{
+ __builtin_prefetch((const void *)(uintptr_t)p, 0, 1);
+}
+
+static inline void rte_prefetch_non_temporal(const volatile void *p)
+{
+ /* non-temporal version not available, fallback to rte_prefetch0 */
+ rte_prefetch0(p);
+}
+
+__rte_experimental
+static inline void
+rte_cldemote(const volatile void *p)
+{
+ RTE_SET_USED(p);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_PREFETCH_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_rwlock.h b/lib/eal/loongarch/include/rte_rwlock.h
new file mode 100644
index 0000000000..aedc6f3349
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_rwlock.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_RWLOCK_LOONGARCH_H
+#define RTE_RWLOCK_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_rwlock.h"
+
+static inline void
+rte_rwlock_read_lock_tm(rte_rwlock_t *rwl)
+{
+ rte_rwlock_read_lock(rwl);
+}
+
+static inline void
+rte_rwlock_read_unlock_tm(rte_rwlock_t *rwl)
+{
+ rte_rwlock_read_unlock(rwl);
+}
+
+static inline void
+rte_rwlock_write_lock_tm(rte_rwlock_t *rwl)
+{
+ rte_rwlock_write_lock(rwl);
+}
+
+static inline void
+rte_rwlock_write_unlock_tm(rte_rwlock_t *rwl)
+{
+ rte_rwlock_write_unlock(rwl);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_RWLOCK_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_spinlock.h b/lib/eal/loongarch/include/rte_spinlock.h
new file mode 100644
index 0000000000..e8d34e9728
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_spinlock.h
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_SPINLOCK_LOONGARCH_H
+#define RTE_SPINLOCK_LOONGARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include "generic/rte_spinlock.h"
+
+#ifndef RTE_FORCE_INTRINSICS
+# error Platform must be built with RTE_FORCE_INTRINSICS
+#endif
+
+static inline int rte_tm_supported(void)
+{
+ return 0;
+}
+
+static inline void
+rte_spinlock_lock_tm(rte_spinlock_t *sl)
+{
+ rte_spinlock_lock(sl); /* fall-back */
+}
+
+static inline int
+rte_spinlock_trylock_tm(rte_spinlock_t *sl)
+{
+ return rte_spinlock_trylock(sl);
+}
+
+static inline void
+rte_spinlock_unlock_tm(rte_spinlock_t *sl)
+{
+ rte_spinlock_unlock(sl);
+}
+
+static inline void
+rte_spinlock_recursive_lock_tm(rte_spinlock_recursive_t *slr)
+{
+ rte_spinlock_recursive_lock(slr); /* fall-back */
+}
+
+static inline void
+rte_spinlock_recursive_unlock_tm(rte_spinlock_recursive_t *slr)
+{
+ rte_spinlock_recursive_unlock(slr);
+}
+
+static inline int
+rte_spinlock_recursive_trylock_tm(rte_spinlock_recursive_t *slr)
+{
+ return rte_spinlock_recursive_trylock(slr);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_SPINLOCK_LOONGARCH_H */
diff --git a/lib/eal/loongarch/include/rte_vect.h b/lib/eal/loongarch/include/rte_vect.h
new file mode 100644
index 0000000000..15465151e1
--- /dev/null
+++ b/lib/eal/loongarch/include/rte_vect.h
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#ifndef RTE_VECT_LOONGARCH_H
+#define RTE_VECT_LOONGARCH_H
+
+#include <stdint.h>
+#include "generic/rte_vect.h"
+#include "rte_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RTE_VECT_DEFAULT_SIMD_BITWIDTH RTE_VECT_SIMD_DISABLED
+
+typedef union xmm {
+ int8_t i8[16];
+ int16_t i16[8];
+ int32_t i32[4];
+ int64_t i64[2];
+ uint8_t u8[16];
+ uint16_t u16[8];
+ uint32_t u32[4];
+ uint64_t u64[2];
+ double pd[2];
+} __rte_aligned(16) xmm_t;
+
+#define XMM_SIZE (sizeof(xmm_t))
+#define XMM_MASK (XMM_SIZE - 1)
+
+typedef union rte_xmm {
+ xmm_t x;
+ uint8_t u8[XMM_SIZE / sizeof(uint8_t)];
+ uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+ uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+ uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+ double pd[XMM_SIZE / sizeof(double)];
+} __rte_aligned(16) rte_xmm_t;
+
+static inline xmm_t
+vect_load_128(void *p)
+{
+ xmm_t ret = *((xmm_t *)p);
+
+ return ret;
+}
+
+static inline xmm_t
+vect_and(xmm_t data, xmm_t mask)
+{
+ rte_xmm_t ret = {.x = data };
+ rte_xmm_t m = {.x = mask };
+ ret.u64[0] &= m.u64[0];
+ ret.u64[1] &= m.u64[1];
+
+ return ret.x;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_VECT_LOONGARCH_H */
diff --git a/lib/eal/loongarch/meson.build b/lib/eal/loongarch/meson.build
new file mode 100644
index 0000000000..4dcc27babb
--- /dev/null
+++ b/lib/eal/loongarch/meson.build
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Loongson Technology Corporation Limited
+
+subdir('include')
+
+sources += files(
+ 'rte_cpuflags.c',
+ 'rte_cycles.c',
+ 'rte_hypervisor.c',
+ 'rte_power_intrinsics.c',
+)
diff --git a/lib/eal/loongarch/rte_cpuflags.c b/lib/eal/loongarch/rte_cpuflags.c
new file mode 100644
index 0000000000..0a75ca58d4
--- /dev/null
+++ b/lib/eal/loongarch/rte_cpuflags.c
@@ -0,0 +1,93 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#include "rte_cpuflags.h"
+
+#include <elf.h>
+#include <fcntl.h>
+#include <assert.h>
+#include <unistd.h>
+#include <string.h>
+
+/* Symbolic values for the entries in the auxiliary table */
+#define AT_HWCAP 16
+
+/* software based registers */
+enum cpu_register_t {
+ REG_NONE = 0,
+ REG_HWCAP,
+ REG_MAX
+};
+
+typedef uint32_t hwcap_registers_t[REG_MAX];
+
+struct feature_entry {
+ uint32_t reg;
+ uint32_t bit;
+#define CPU_FLAG_NAME_MAX_LEN 64
+ char name[CPU_FLAG_NAME_MAX_LEN];
+};
+
+#define FEAT_DEF(name, reg, bit) \
+ [RTE_CPUFLAG_##name] = {reg, bit, #name},
+
+const struct feature_entry rte_cpu_feature_table[] = {
+ FEAT_DEF(CPUCFG, REG_HWCAP, 0)
+ FEAT_DEF(LAM, REG_HWCAP, 1)
+ FEAT_DEF(UAL, REG_HWCAP, 2)
+ FEAT_DEF(FPU, REG_HWCAP, 3)
+ FEAT_DEF(LSX, REG_HWCAP, 4)
+ FEAT_DEF(LASX, REG_HWCAP, 5)
+ FEAT_DEF(CRC32, REG_HWCAP, 6)
+ FEAT_DEF(COMPLEX, REG_HWCAP, 7)
+ FEAT_DEF(CRYPTO, REG_HWCAP, 8)
+ FEAT_DEF(LVZ, REG_HWCAP, 9)
+ FEAT_DEF(LBT_X86, REG_HWCAP, 10)
+ FEAT_DEF(LBT_ARM, REG_HWCAP, 11)
+ FEAT_DEF(LBT_MIPS, REG_HWCAP, 12)
+};
+
+/*
+ * Read AUXV software register and get cpu features for LoongArch
+ */
+static void
+rte_cpu_get_features(hwcap_registers_t out)
+{
+ out[REG_HWCAP] = rte_cpu_getauxval(AT_HWCAP);
+}
+
+/*
+ * Checks if a particular flag is available on current machine.
+ */
+int
+rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
+{
+ const struct feature_entry *feat;
+ hwcap_registers_t regs = {0};
+
+ if (feature >= RTE_CPUFLAG_NUMFLAGS)
+ return -ENOENT;
+
+ feat = &rte_cpu_feature_table[feature];
+ if (feat->reg == REG_NONE)
+ return -EFAULT;
+
+ rte_cpu_get_features(regs);
+ return (regs[feat->reg] >> feat->bit) & 1;
+}
+
+const char *
+rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)
+{
+ if (feature >= RTE_CPUFLAG_NUMFLAGS)
+ return NULL;
+ return rte_cpu_feature_table[feature].name;
+}
+
+void
+rte_cpu_get_intrinsics_support(struct rte_cpu_intrinsics *intrinsics)
+{
+ memset(intrinsics, 0, sizeof(*intrinsics));
+}
diff --git a/lib/eal/loongarch/rte_cycles.c b/lib/eal/loongarch/rte_cycles.c
new file mode 100644
index 0000000000..582601d335
--- /dev/null
+++ b/lib/eal/loongarch/rte_cycles.c
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#include "eal_private.h"
+
+#define LOONGARCH_CPUCFG4 0x4
+#define CPUCFG4_CCFREQ_MASK 0xFFFFFFFF
+#define CPUCFG4_CCFREQ_SHIFT 0
+
+#define LOONGARCH_CPUCFG5 0x5
+#define CPUCFG5_CCMUL_MASK 0xFFFF
+#define CPUCFG5_CCMUL_SHIFT 0
+
+#define CPUCFG5_CCDIV_MASK 0xFFFF0000
+#define CPUCFG5_CCDIV_SHIFT 16
+
+static __rte_noinline uint32_t
+read_cpucfg(int arg)
+{
+ int ret = 0;
+
+ __asm__ __volatile__ (
+ "cpucfg %[var], %[index]\n"
+ : [var]"=r"(ret)
+ : [index]"r"(arg)
+ :
+ );
+
+ return ret;
+}
+
+uint64_t
+get_tsc_freq_arch(void)
+{
+ uint32_t base_freq, mul_factor, div_factor;
+
+ base_freq = read_cpucfg(LOONGARCH_CPUCFG4);
+ mul_factor = (read_cpucfg(LOONGARCH_CPUCFG5) & CPUCFG5_CCMUL_MASK) >>
+ CPUCFG5_CCMUL_SHIFT;
+ div_factor = (read_cpucfg(LOONGARCH_CPUCFG5) & CPUCFG5_CCDIV_MASK) >>
+ CPUCFG5_CCDIV_SHIFT;
+
+ return base_freq * mul_factor / div_factor;
+}
diff --git a/lib/eal/loongarch/rte_hypervisor.c b/lib/eal/loongarch/rte_hypervisor.c
new file mode 100644
index 0000000000..d044906f71
--- /dev/null
+++ b/lib/eal/loongarch/rte_hypervisor.c
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#include "rte_hypervisor.h"
+
+enum rte_hypervisor
+rte_hypervisor_get(void)
+{
+ return RTE_HYPERVISOR_UNKNOWN;
+}
diff --git a/lib/eal/loongarch/rte_power_intrinsics.c b/lib/eal/loongarch/rte_power_intrinsics.c
new file mode 100644
index 0000000000..a8969c260e
--- /dev/null
+++ b/lib/eal/loongarch/rte_power_intrinsics.c
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Loongson Technology Corporation Limited
+ */
+
+#include <errno.h>
+
+#include "rte_power_intrinsics.h"
+
+/**
+ * This function is not supported on LOONGARCH.
+ */
+int
+rte_power_monitor(const struct rte_power_monitor_cond *pmc,
+ const uint64_t tsc_timestamp)
+{
+ RTE_SET_USED(pmc);
+ RTE_SET_USED(tsc_timestamp);
+
+ return -ENOTSUP;
+}
+
+/**
+ * This function is not supported on LOONGARCH.
+ */
+int
+rte_power_pause(const uint64_t tsc_timestamp)
+{
+ RTE_SET_USED(tsc_timestamp);
+
+ return -ENOTSUP;
+}
+
+/**
+ * This function is not supported on LOONGARCH.
+ */
+int
+rte_power_monitor_wakeup(const unsigned int lcore_id)
+{
+ RTE_SET_USED(lcore_id);
+
+ return -ENOTSUP;
+}
+
+int
+rte_power_monitor_multi(const struct rte_power_monitor_cond pmc[],
+ const uint32_t num, const uint64_t tsc_timestamp)
+{
+ RTE_SET_USED(pmc);
+ RTE_SET_USED(num);
+ RTE_SET_USED(tsc_timestamp);
+
+ return -ENOTSUP;
+}
diff --git a/meson.build b/meson.build
index 7d6643da3a..8b1b09ead5 100644
--- a/meson.build
+++ b/meson.build
@@ -52,6 +52,8 @@ if host_machine.cpu_family().startswith('x86')
arch_subdir = 'x86'
elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
arch_subdir = 'arm'
+elif host_machine.cpu_family().startswith('loongarch')
+ arch_subdir = 'loongarch'
elif host_machine.cpu_family().startswith('ppc')
arch_subdir = 'ppc'
elif host_machine.cpu_family().startswith('riscv')
--
2.32.1 (Apple Git-133)
^ permalink raw reply [relevance 5%]
* [PATCH v2] drivers/bus: set device NUMA node to unknown by default
@ 2022-10-04 14:58 3% ` Olivier Matz
2022-10-05 8:52 0% ` David Marchand
0 siblings, 1 reply; 200+ results
From: Olivier Matz @ 2022-10-04 14:58 UTC (permalink / raw)
To: dev
Cc: Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
Sachin Saxena, Stephen Hemminger, Long Li, david.marchand
The dev->device.numa_node field is set by each bus driver for
every device it manages to indicate on which NUMA node this device lies.
When this information is unknown, the assigned value is not consistent
across the bus drivers.
Set the default value to SOCKET_ID_ANY (-1) by all bus drivers
when the NUMA information is unavailable. This change impacts
rte_eth_dev_socket_id() in the same manner.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
v2
* use SOCKET_ID_ANY instead of -1 in drivers/dma/idxd (David)
* document the behavior change of rte_eth_dev_socket_id()
* fix few examples where rte_eth_dev_socket_id() was expected to
return 0 on unknown socket
doc/guides/rel_notes/deprecation.rst | 7 -------
doc/guides/rel_notes/release_22_11.rst | 6 ++++++
drivers/bus/auxiliary/auxiliary_common.c | 8 ++------
drivers/bus/auxiliary/linux/auxiliary.c | 13 +++++--------
drivers/bus/dpaa/dpaa_bus.c | 1 +
drivers/bus/fslmc/fslmc_bus.c | 1 +
drivers/bus/pci/bsd/pci.c | 2 +-
drivers/bus/pci/linux/pci.c | 16 ++++++----------
drivers/bus/pci/pci_common.c | 8 ++------
drivers/bus/pci/windows/pci.c | 1 -
drivers/bus/vmbus/linux/vmbus_bus.c | 1 -
drivers/bus/vmbus/vmbus_common.c | 8 ++------
drivers/dma/idxd/idxd_bus.c | 3 ++-
examples/distributor/main.c | 4 ++--
examples/flow_classify/flow_classify.c | 2 ++
examples/rxtx_callbacks/main.c | 2 +-
lib/ethdev/rte_ethdev.h | 4 ++--
17 files changed, 35 insertions(+), 52 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a991fa14de..2a1a6ff899 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -33,13 +33,6 @@ Deprecation Notices
``__atomic_thread_fence`` must be used for patches that need to be merged in
20.08 onwards. This change will not introduce any performance degradation.
-* bus: The ``dev->device.numa_node`` field is set by each bus driver for
- every device it manages to indicate on which NUMA node this device lies.
- When this information is unknown, the assigned value is not consistent
- across the bus drivers.
- In DPDK 22.11, the default value will be set to -1 by all bus drivers
- when the NUMA information is unavailable.
-
* kni: The KNI kernel module and library are not recommended for use by new
applications - other technologies such as virtio-user are recommended instead.
Following the DPDK technical board
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 53fe21453c..d52f823694 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -317,6 +317,12 @@ ABI Changes
* eventdev: Added ``weight`` and ``affinity`` fields
to ``rte_event_queue_conf`` structure.
+* bus: Changed the device numa node to -1 when NUMA information is unavailable.
+ The ``dev->device.numa_node`` field is set by each bus driver for
+ every device it manages to indicate on which NUMA node this device lies.
+ When this information is unknown, the assigned value was not consistent
+ across the bus drivers. This similarly impacts ``rte_eth_dev_socket_id()``.
+
Known Issues
------------
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 259ff152c4..6bb1fe7c96 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -105,12 +105,8 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv,
return -1;
}
- if (dev->device.numa_node < 0) {
- if (rte_socket_count() > 1)
- AUXILIARY_LOG(INFO, "Device %s is not NUMA-aware, defaulting socket to 0",
- dev->name);
- dev->device.numa_node = 0;
- }
+ if (dev->device.numa_node < 0 && rte_socket_count() > 1)
+ RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name);
iova_mode = rte_eal_iova_mode();
if ((drv->drv_flags & RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA) > 0 &&
diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index d4c564cd78..02fc9285dc 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -40,14 +40,11 @@ auxiliary_scan_one(const char *dirname, const char *name)
/* Get NUMA node, default to 0 if not present */
snprintf(filename, sizeof(filename), "%s/%s/numa_node",
dirname, name);
- if (access(filename, F_OK) != -1) {
- if (eal_parse_sysfs_value(filename, &tmp) == 0)
- dev->device.numa_node = tmp;
- else
- dev->device.numa_node = -1;
- } else {
- dev->device.numa_node = 0;
- }
+ if (access(filename, F_OK) == 0 &&
+ eal_parse_sysfs_value(filename, &tmp) == 0)
+ dev->device.numa_node = tmp;
+ else
+ dev->device.numa_node = SOCKET_ID_ANY;
auxiliary_on_scan(dev);
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 682427ba2c..447b222a76 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -179,6 +179,7 @@ dpaa_create_device_list(void)
}
dev->device.bus = &rte_dpaa_bus.bus;
+ dev->device.numa_node = SOCKET_ID_ANY;
/* Allocate interrupt handle instance */
dev->intr_handle =
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 8503004e3d..57bfb5111a 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -156,6 +156,7 @@ scan_one_fslmc_device(char *dev_name)
}
dev->device.bus = &rte_fslmc_bus.bus;
+ dev->device.numa_node = SOCKET_ID_ANY;
/* Allocate interrupt instance */
dev->intr_handle =
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 844d145fed..7459d15c7e 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -246,7 +246,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
dev->max_vfs = 0;
/* FreeBSD has no NUMA support (yet) */
- dev->device.numa_node = 0;
+ dev->device.numa_node = SOCKET_ID_ANY;
pci_common_set(dev);
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index c8703d52f3..ade17079fc 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -283,17 +283,13 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
}
/* get numa node, default to 0 if not present */
- snprintf(filename, sizeof(filename), "%s/numa_node",
- dirname);
+ snprintf(filename, sizeof(filename), "%s/numa_node", dirname);
- if (access(filename, F_OK) != -1) {
- if (eal_parse_sysfs_value(filename, &tmp) == 0)
- dev->device.numa_node = tmp;
- else
- dev->device.numa_node = -1;
- } else {
- dev->device.numa_node = 0;
- }
+ if (access(filename, F_OK) == 0 &&
+ eal_parse_sysfs_value(filename, &tmp) == 0)
+ dev->device.numa_node = tmp;
+ else
+ dev->device.numa_node = SOCKET_ID_ANY;
pci_common_set(dev);
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 5ea72bcf23..a59c5b4286 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -235,12 +235,8 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
return 1;
}
- if (dev->device.numa_node < 0) {
- if (rte_socket_count() > 1)
- RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware, defaulting socket to 0\n",
- dev->name);
- dev->device.numa_node = 0;
- }
+ if (dev->device.numa_node < 0 && rte_socket_count() > 1)
+ RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name);
already_probed = rte_dev_is_probed(&dev->device);
if (already_probed && !(dr->drv_flags & RTE_PCI_DRV_PROBE_AGAIN)) {
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 3f7a8b9432..5cf05ce1a0 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -249,7 +249,6 @@ get_device_resource_info(HDEVINFO dev_info,
DWORD error = GetLastError();
if (error == ERROR_NOT_FOUND) {
/* On older CPUs, NUMA is not bound to PCIe locality. */
- dev->device.numa_node = 0;
return ERROR_SUCCESS;
}
RTE_LOG_WIN32_ERR("SetupDiGetDevicePropertyW"
diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index f502783f7a..01d8111b85 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -293,7 +293,6 @@ vmbus_scan_one(const char *name)
goto error;
dev->device.numa_node = tmp;
} else {
- /* if no NUMA support, set default to 0 */
dev->device.numa_node = SOCKET_ID_ANY;
}
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 03b39c82b7..8d32d66504 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -111,12 +111,8 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr,
/* reference driver structure */
dev->driver = dr;
- if (dev->device.numa_node < 0) {
- if (rte_socket_count() > 1)
- VMBUS_LOG(INFO, "Device %s is not NUMA-aware, defaulting socket to 0",
- guid);
- dev->device.numa_node = 0;
- }
+ if (dev->device.numa_node < 0 && rte_socket_count() > 1)
+ VMBUS_LOG(INFO, "Device %s is not NUMA-aware", guid);
/* call the driver probe() function */
VMBUS_LOG(INFO, " probe driver: %s", dr->driver.name);
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 9b7b16c6e3..bbbfd3f648 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -12,6 +12,7 @@
#include <dev_driver.h>
#include <rte_devargs.h>
#include <rte_eal.h>
+#include <rte_memory.h>
#include <rte_log.h>
#include <rte_dmadev_pmd.h>
#include <rte_string_fns.h>
@@ -322,7 +323,7 @@ dsa_scan(void)
while ((wq = readdir(dev_dir)) != NULL) {
struct rte_dsa_device *dev;
- int numa_node = -1;
+ int numa_node = SOCKET_ID_ANY;
if (strncmp(wq->d_name, "wq", 2) != 0)
continue;
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 68f07cc7fb..d41c3bdb14 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -231,7 +231,7 @@ lcore_rx(struct lcore_params *p)
if ((enabled_port_mask & (1 << port)) == 0)
continue;
- if (rte_eth_dev_socket_id(port) > 0 &&
+ if (rte_eth_dev_socket_id(port) >= 0 &&
rte_eth_dev_socket_id(port) != socket_id)
printf("WARNING, port %u is on remote NUMA node to "
"RX thread.\n\tPerformance will not "
@@ -406,7 +406,7 @@ lcore_tx(struct rte_ring *in_r)
if ((enabled_port_mask & (1 << port)) == 0)
continue;
- if (rte_eth_dev_socket_id(port) > 0 &&
+ if (rte_eth_dev_socket_id(port) >= 0 &&
rte_eth_dev_socket_id(port) != socket_id)
printf("WARNING, port %u is on remote NUMA node to "
"TX thread.\n\tPerformance will not "
diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c
index 97708b7084..cdd51b2476 100644
--- a/examples/flow_classify/flow_classify.c
+++ b/examples/flow_classify/flow_classify.c
@@ -818,6 +818,8 @@ main(int argc, char *argv[])
printf("\nWARNING: Too many lcores enabled. Only 1 used.\n");
socket_id = rte_eth_dev_socket_id(0);
+ if (socket_id == SOCKET_ID_ANY)
+ socket_id = rte_lcore_to_socket_id(rte_get_next_lcore(-1, 0, 0));
/* Memory allocation. 8< */
size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct flow_classifier_acl));
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index edf0ab9b08..59eee49208 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -249,7 +249,7 @@ lcore_main(void)
uint16_t port;
RTE_ETH_FOREACH_DEV(port)
- if (rte_eth_dev_socket_id(port) > 0 &&
+ if (rte_eth_dev_socket_id(port) >= 0 &&
rte_eth_dev_socket_id(port) !=
(int)rte_socket_id())
printf("WARNING, port %u is on remote NUMA node to "
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index a21f58b9cd..dd8d25d6d4 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -2445,8 +2445,8 @@ int rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port);
* The port identifier of the Ethernet device
* @return
* The NUMA socket ID to which the Ethernet device is connected or
- * a default of zero if the socket could not be determined.
- * -1 is returned is the port_id value is out of range.
+ * a default of -1 (SOCKET_ID_ANY) if the socket could not be determined.
+ * -1 is also returned if the port_id is invalid.
*/
int rte_eth_dev_socket_id(uint16_t port_id);
--
2.30.2
^ permalink raw reply [relevance 3%]
* [PATCH v7 1/6] cryptodev: rework session framework
@ 2022-10-04 11:10 1% ` Akhil Goyal
1 sibling, 0 replies; 200+ results
From: Akhil Goyal @ 2022-10-04 11:10 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, lironh, royzhang1980,
sunilprakashrao.uttarwar, kai.ji, rnagadheeraj, jianjay.zhou,
radu.nicolau, Akhil Goyal, Ruifeng Wang, David Coyle,
Kevin O'Sullivan
As per current design, rte_cryptodev_sym_session_create() and
rte_cryptodev_sym_session_init() use separate mempool objects
for a single session.
And structure rte_cryptodev_sym_session is not directly used
by the application, it may cause ABI breakage if the structure
is modified in future.
To address these two issues, the rte_cryptodev_sym_session_create
will take one mempool object that the session and session private
data are virtually/physically contiguous, and initializes both
fields. The API rte_cryptodev_sym_session_init is removed.
rte_cryptodev_sym_session_create will now return an opaque session
pointer which will be used by the app and other APIs.
In data path, opaque session pointer is attached to rte_crypto_op
and the PMD can call an internal library API to get the session
private data pointer based on the driver id.
Note: currently single session may be used by different device
drivers, given it is initialized by them. After the change the
session created by one device driver cannot be used or
reinitialized by another driver.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Ruifeng Wang <Ruifeng.Wang@arm.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test-crypto-perf/cperf_ops.c | 21 +-
app/test-crypto-perf/cperf_test_latency.c | 6 +-
.../cperf_test_pmd_cyclecount.c | 5 +-
app/test-crypto-perf/cperf_test_throughput.c | 6 +-
app/test-crypto-perf/cperf_test_verify.c | 6 +-
app/test-crypto-perf/main.c | 29 +-
app/test-eventdev/test_perf_common.c | 35 +-
app/test-eventdev/test_perf_common.h | 1 -
app/test/test_cryptodev.c | 303 +++++-------------
app/test/test_cryptodev_blockcipher.c | 16 +-
app/test/test_event_crypto_adapter.c | 35 +-
app/test/test_ipsec.c | 42 +--
drivers/crypto/armv8/armv8_pmd_private.h | 2 -
drivers/crypto/armv8/rte_armv8_pmd.c | 21 +-
drivers/crypto/armv8/rte_armv8_pmd_ops.c | 35 +-
drivers/crypto/bcmfs/bcmfs_sym_session.c | 38 +--
drivers/crypto/bcmfs/bcmfs_sym_session.h | 3 +-
drivers/crypto/caam_jr/caam_jr.c | 28 +-
drivers/crypto/ccp/ccp_crypto.c | 58 +---
drivers/crypto/ccp/ccp_pmd_ops.c | 32 +-
drivers/crypto/ccp/ccp_pmd_private.h | 2 -
drivers/crypto/ccp/rte_ccp_pmd.c | 29 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 36 +--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 31 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 55 +---
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 14 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 31 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 3 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 37 +--
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 4 +-
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 34 +-
drivers/crypto/ipsec_mb/ipsec_mb_private.h | 41 ++-
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 48 +--
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 36 +--
drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 4 -
drivers/crypto/ipsec_mb/pmd_kasumi.c | 10 +-
drivers/crypto/ipsec_mb/pmd_snow3g.c | 9 +-
drivers/crypto/ipsec_mb/pmd_zuc.c | 4 -
drivers/crypto/mlx5/mlx5_crypto.c | 26 +-
drivers/crypto/mvsam/rte_mrvl_pmd.c | 8 +-
drivers/crypto/mvsam/rte_mrvl_pmd_ops.c | 21 +-
drivers/crypto/nitrox/nitrox_sym.c | 39 +--
drivers/crypto/null/null_crypto_pmd.c | 19 +-
drivers/crypto/null/null_crypto_pmd_ops.c | 33 +-
drivers/crypto/null/null_crypto_pmd_private.h | 2 -
.../crypto/octeontx/otx_cryptodev_hw_access.h | 1 -
drivers/crypto/octeontx/otx_cryptodev_ops.c | 67 +---
drivers/crypto/openssl/openssl_pmd_private.h | 2 -
drivers/crypto/openssl/rte_openssl_pmd.c | 24 +-
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 29 +-
drivers/crypto/qat/qat_sym.c | 10 +-
drivers/crypto/qat/qat_sym.h | 4 +-
drivers/crypto/qat/qat_sym_session.c | 40 +--
drivers/crypto/qat/qat_sym_session.h | 6 +-
drivers/crypto/scheduler/scheduler_pmd_ops.c | 38 +--
drivers/crypto/virtio/virtio_cryptodev.c | 40 +--
drivers/crypto/virtio/virtio_rxtx.c | 3 +-
examples/fips_validation/fips_dev_self_test.c | 30 +-
examples/fips_validation/main.c | 35 +-
examples/ipsec-secgw/ipsec-secgw.c | 10 +-
examples/ipsec-secgw/ipsec.c | 7 +-
examples/l2fwd-crypto/main.c | 54 +---
examples/vhost_crypto/main.c | 16 +-
lib/cryptodev/cryptodev_pmd.h | 28 +-
lib/cryptodev/cryptodev_trace_points.c | 6 -
lib/cryptodev/rte_cryptodev.c | 278 ++++++----------
lib/cryptodev/rte_cryptodev.h | 123 ++-----
lib/cryptodev/rte_cryptodev_trace.h | 36 +--
lib/cryptodev/version.map | 6 -
lib/pipeline/rte_table_action.c | 10 +-
lib/vhost/rte_vhost_crypto.h | 3 -
lib/vhost/vhost_crypto.c | 28 +-
72 files changed, 556 insertions(+), 1676 deletions(-)
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index d746d51082..c6f5735bb0 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -912,7 +912,6 @@ cperf_create_session(struct rte_mempool *sess_mp,
&sess_conf, sess_mp, priv_mp);
}
#endif
- sess = rte_cryptodev_sym_session_create(sess_mp);
/*
* cipher only
*/
@@ -937,8 +936,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
cipher_xform.cipher.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &cipher_xform,
+ sess_mp);
/*
* auth only
*/
@@ -965,8 +964,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
auth_xform.auth.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &auth_xform,
+ sess_mp);
/*
* cipher and auth
*/
@@ -1024,13 +1023,13 @@ cperf_create_session(struct rte_mempool *sess_mp,
if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
cipher_xform.next = &auth_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &cipher_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &cipher_xform, sess_mp);
} else { /* auth then cipher */
auth_xform.next = &cipher_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &auth_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &auth_xform, sess_mp);
}
} else { /* options->op_type == CPERF_AEAD */
aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -1050,8 +1049,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
options->aead_aad_sz;
/* Create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &aead_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &aead_xform,
+ sess_mp);
}
return sess;
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index 6f972cea49..afd8cb209b 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -44,10 +44,8 @@ static void
cperf_latency_test_free(struct cperf_latency_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 3f2da13d3a..edd2730b73 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -74,10 +74,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
(struct rte_security_session *)ctx->sess);
} else
#endif
- {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index fba66bbde9..fa13915dc3 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -52,10 +52,8 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
(struct rte_security_session *)ctx->sess);
}
#endif
- else {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ else
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index b691595675..c1465db243 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -39,10 +39,8 @@ static void
cperf_verify_test_free(struct cperf_verify_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 27acd619bc..3469b836e1 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -97,35 +97,14 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
char mp_name[RTE_MEMPOOL_NAMESIZE];
struct rte_mempool *sess_mp;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- sess_mp = rte_mempool_create(mp_name,
- nb_sessions,
- session_priv_size,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (sess_mp == NULL) {
- printf("Cannot create pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- session_pool_socket[socket_id].priv_mp = sess_mp;
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
- nb_sessions, 0, 0, 0, socket_id);
+ nb_sessions, session_priv_size, 0, 0,
+ socket_id);
if (sess_mp == NULL) {
printf("Cannot create pool \"%s\" on socket %d\n",
@@ -136,6 +115,7 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
printf("Allocated pool \"%s\" on socket %d\n",
mp_name, socket_id);
session_pool_socket[socket_id].sess_mp = sess_mp;
+ session_pool_socket[socket_id].priv_mp = sess_mp;
}
return 0;
@@ -323,12 +303,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
return ret;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
if (opts->op_type == CPERF_ASYM_MODEX) {
qp_conf.mp_session = NULL;
- qp_conf.mp_session_private = NULL;
}
ret = rte_cryptodev_configure(cdev_id, &conf);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index 8472a87b99..cd3c1d7ef1 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -863,18 +863,13 @@ cryptodev_sym_sess_create(struct prod_data *p, struct test_perf *t)
cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
cipher_xform.next = NULL;
- sess = rte_cryptodev_sym_session_create(t->ca_sess_pool);
+ sess = rte_cryptodev_sym_session_create(p->ca.cdev_id, &cipher_xform,
+ t->ca_sess_pool);
if (sess == NULL) {
evt_err("Failed to create sym session");
return NULL;
}
- if (rte_cryptodev_sym_session_init(p->ca.cdev_id, sess, &cipher_xform,
- t->ca_sess_priv_pool)) {
- evt_err("Failed to init session");
- return NULL;
- }
-
return sess;
}
@@ -1381,15 +1376,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
goto err;
}
- t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
- "ca_sess_pool", nb_sessions, 0, 0,
- sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
- if (t->ca_sess_pool == NULL) {
- evt_err("Failed to create sym session pool");
- ret = -ENOMEM;
- goto err;
- }
-
max_session_size = 0;
for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
unsigned int session_size;
@@ -1400,12 +1386,11 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
max_session_size = session_size;
}
- max_session_size += sizeof(union rte_event_crypto_metadata);
- t->ca_sess_priv_pool = rte_mempool_create(
- "ca_sess_priv_pool", nb_sessions, max_session_size, 0, 0, NULL,
- NULL, NULL, NULL, SOCKET_ID_ANY, 0);
- if (t->ca_sess_priv_pool == NULL) {
- evt_err("failed to create sym session private pool");
+ t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
+ "ca_sess_pool", nb_sessions, max_session_size, 0,
+ sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
+ if (t->ca_sess_pool == NULL) {
+ evt_err("Failed to create sym session pool");
ret = -ENOMEM;
goto err;
}
@@ -1445,7 +1430,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
qp_conf.nb_descriptors = NB_CRYPTODEV_DESCRIPTORS;
qp_conf.mp_session = t->ca_sess_pool;
- qp_conf.mp_session_private = t->ca_sess_priv_pool;
for (qp_id = 0; qp_id < conf.nb_queue_pairs; qp_id++) {
ret = rte_cryptodev_queue_pair_setup(
@@ -1466,7 +1450,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
return ret;
@@ -1491,8 +1474,7 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
for (flow_id = 0; flow_id < t->nb_flows; flow_id++) {
sess = p->ca.crypto_sess[flow_id];
cdev_id = p->ca.cdev_id;
- rte_cryptodev_sym_session_clear(cdev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(cdev_id, sess);
}
rte_event_crypto_adapter_queue_pair_del(
@@ -1508,7 +1490,6 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
}
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index 8cbd06fe42..d06d52cdf8 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -70,7 +70,6 @@ struct test_perf {
RTE_EVENT_TIMER_ADAPTER_NUM_MAX] __rte_cache_aligned;
struct rte_mempool *ca_op_pool;
struct rte_mempool *ca_sess_pool;
- struct rte_mempool *ca_sess_priv_pool;
struct rte_mempool *ca_asym_sess_pool;
} __rte_cache_aligned;
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 0c39b16b71..ae2b102ecb 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -13,6 +13,7 @@
#include <rte_pause.h>
#include <rte_bus_vdev.h>
#include <rte_ether.h>
+#include <rte_errno.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
@@ -644,23 +645,17 @@ testsuite_setup(void)
}
ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
- "test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+ "test_sess_mp", MAX_NB_SESSIONS, session_size, 0, 0,
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
-
ts_params->session_priv_mpool = rte_mempool_create(
- "test_sess_mp_priv",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
+ "test_sess_mp_priv", MAX_NB_SESSIONS, session_size,
+ 0, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
+
TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
"session mempool allocation failed");
-
-
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
&ts_params->conf),
"Failed to configure cryptodev %u with %u qps",
@@ -668,7 +663,6 @@ testsuite_setup(void)
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -697,15 +691,11 @@ testsuite_teardown(void)
rte_mempool_avail_count(ts_params->op_mpool));
}
- /* Free session mempools */
- if (ts_params->session_priv_mpool != NULL) {
- rte_mempool_free(ts_params->session_priv_mpool);
- ts_params->session_priv_mpool = NULL;
- }
-
if (ts_params->session_mpool != NULL) {
rte_mempool_free(ts_params->session_mpool);
ts_params->session_mpool = NULL;
+ rte_mempool_free(ts_params->session_priv_mpool);
+ ts_params->session_priv_mpool = NULL;
}
res = rte_cryptodev_close(ts_params->valid_devs[0]);
@@ -1392,7 +1382,6 @@ dev_configure_and_start(uint64_t ff_disable)
ts_params->conf.ff_disable = ff_disable;
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
&ts_params->conf),
@@ -1452,10 +1441,8 @@ ut_teardown(void)
#endif
{
if (ut_params->sess) {
- rte_cryptodev_sym_session_clear(
- ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
- rte_cryptodev_sym_session_free(ut_params->sess);
ut_params->sess = NULL;
}
}
@@ -1610,7 +1597,6 @@ test_queue_pair_descriptor_setup(void)
*/
qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -2155,8 +2141,6 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
-
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2200,19 +2184,13 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
ut_params->auth_xform.auth.key.data = hmac_sha1_key;
ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
+ rte_errno = 0;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- /* Create crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ if (rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -2441,7 +2419,6 @@ create_wireless_algo_hash_session(uint8_t dev_id,
enum rte_crypto_auth_algorithm algo)
{
uint8_t hash_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2461,16 +2438,11 @@ create_wireless_algo_hash_session(uint8_t dev_id,
ut_params->auth_xform.auth.digest_length = auth_len;
ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
ut_params->auth_xform.auth.iv.length = iv_len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2483,7 +2455,6 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
uint8_t iv_len)
{
uint8_t cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2503,16 +2474,12 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session */
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2590,7 +2557,6 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
{
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2625,17 +2591,12 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2649,7 +2610,6 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
{
const uint8_t key_len = tdata->key.len;
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2689,16 +2649,11 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2724,7 +2679,6 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
uint8_t cipher_iv_len)
{
uint8_t auth_cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2755,26 +2709,19 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
if (cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
ut_params->auth_xform.next = NULL;
ut_params->cipher_xform.next = &ut_params->auth_xform;
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
} else
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -8205,7 +8152,6 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
uint8_t iv_len)
{
uint8_t aead_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -8227,15 +8173,12 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->aead_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->aead_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -8679,7 +8622,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
/* Create security session */
ut_params->sec_session = rte_security_session_create(ctx,
&sess_conf, ts_params->session_mpool,
- ts_params->session_priv_mpool);
+ NULL);
if (!ut_params->sec_session) {
printf("TestCase %s()-%d line %d failed %s: ",
@@ -12029,7 +11972,6 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
const struct HMAC_MD5_vector *test_case)
{
uint8_t key[64];
- int status;
memcpy(key, test_case->key.data, test_case->key.len);
@@ -12044,16 +11986,11 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
ut_params->auth_xform.auth.key.data = key;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- if (ut_params->sess == NULL)
- return TEST_FAILED;
-
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -12261,12 +12198,9 @@ test_multi_session(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
-
struct rte_cryptodev_info dev_info;
struct rte_cryptodev_sym_session **sessions;
-
uint16_t i;
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12293,20 +12227,15 @@ test_multi_session(void)
/* Create multiple crypto sessions*/
for (i = 0; i < MAX_NB_SESSIONS; i++) {
-
sessions[i] = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
+
TEST_ASSERT_NOT_NULL(sessions[i],
"Session creation failed at session number %u",
i);
-
- status = rte_cryptodev_sym_session_init(
- ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
/* Attempt to send a request on each session */
TEST_ASSERT_SUCCESS( test_AES_CBC_HMAC_SHA512_decrypt_perform(
sessions[i],
@@ -12336,18 +12265,9 @@ test_multi_session(void)
}
}
- sessions[i] = NULL;
- /* Next session create should fail */
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NULL(sessions[i],
- "Session creation succeeded unexpectedly!");
-
for (i = 0; i < MAX_NB_SESSIONS; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12398,7 +12318,6 @@ test_multi_session_random_usage(void)
},
};
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12420,11 +12339,6 @@ test_multi_session_random_usage(void)
* MAX_NB_SESSIONS) + 1, 0);
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- sessions[i] = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(sessions[i],
- "Session creation failed at session number %u",
- i);
rte_memcpy(&ut_paramz[i].ut_params, &unittest_params,
sizeof(struct crypto_unittest_params));
@@ -12434,16 +12348,16 @@ test_multi_session_random_usage(void)
ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
/* Create multiple crypto sessions*/
- status = rte_cryptodev_sym_session_init(
+ sessions[i] = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0],
- sessions[i],
&ut_paramz[i].ut_params.auth_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(sessions[i],
+ "Session creation failed at session number %u",
+ i);
}
srand(time(NULL));
@@ -12481,9 +12395,8 @@ test_multi_session_random_usage(void)
}
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12501,7 +12414,6 @@ test_null_invalid_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int ret;
/* This test is for NULL PMD only */
if (gbl_driver_id != rte_cryptodev_driver_id_get(
@@ -12515,17 +12427,13 @@ test_null_invalid_operation(void)
ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
-
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.next = NULL;
@@ -12533,14 +12441,11 @@ test_null_invalid_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
return TEST_SUCCESS;
@@ -12554,7 +12459,6 @@ test_null_burst_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
unsigned i, burst_len = NULL_BURST_LENGTH;
@@ -12580,19 +12484,14 @@ test_null_burst_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
/* Create Crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0],
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
@@ -12703,7 +12602,6 @@ test_enq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12803,7 +12701,6 @@ test_deq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12990,7 +12887,6 @@ static int create_gmac_session(uint8_t dev_id,
enum rte_crypto_auth_operation auth_op)
{
uint8_t auth_key[tdata->key.len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -13009,15 +12905,13 @@ static int create_gmac_session(uint8_t dev_id,
ut_params->auth_xform.auth.iv.length = tdata->iv.len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -13646,7 +13540,6 @@ create_auth_session(struct crypto_unittest_params *ut_params,
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -13660,15 +13553,13 @@ create_auth_session(struct crypto_unittest_params *ut_params,
ut_params->auth_xform.auth.digest_length = reference->digest.len;
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -13681,7 +13572,6 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -13713,15 +13603,13 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
}
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -14179,7 +14067,6 @@ test_authenticated_encrypt_with_esn(
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
struct rte_cryptodev_info dev_info;
- int status;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -14230,19 +14117,12 @@ test_authenticated_encrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
-
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
"Failed to allocate input buffer in mempool");
@@ -14366,18 +14246,11 @@ test_authenticated_decrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- retval = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- if (retval == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(retval, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
@@ -15125,8 +14998,8 @@ test_scheduler_attach_worker_op(void)
ts_params->session_mpool =
rte_cryptodev_sym_session_pool_create(
"test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0,
- SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, session_size,
+ 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
}
@@ -15149,8 +15022,6 @@ test_scheduler_attach_worker_op(void)
}
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private =
- ts_params->session_priv_mpool;
ret = rte_cryptodev_scheduler_worker_attach(sched_id,
(uint8_t)i);
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index b5813b956f..4fcdd55660 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -68,7 +68,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
struct rte_mempool *sess_mpool,
- struct rte_mempool *sess_priv_mpool,
uint8_t dev_id,
char *test_msg)
{
@@ -514,11 +513,9 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
*/
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) &&
nb_iterates == 0) {
- sess = rte_cryptodev_sym_session_create(sess_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, sess,
- init_xform, sess_priv_mpool);
- if (status == -ENOTSUP) {
+ sess = rte_cryptodev_sym_session_create(dev_id, init_xform,
+ sess_mpool);
+ if (sess == NULL) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "UNSUPPORTED");
status = TEST_SKIPPED;
goto error_exit;
@@ -801,10 +798,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
error_exit:
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- if (sess) {
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
- }
+ if (sess)
+ rte_cryptodev_sym_session_free(dev_id, sess);
rte_free(cipher_xform);
rte_free(auth_xform);
}
@@ -829,7 +824,6 @@ blockcipher_test_case_run(const void *data)
p_testsuite_params->mbuf_pool,
p_testsuite_params->op_mpool,
p_testsuite_params->session_mpool,
- p_testsuite_params->session_priv_mpool,
p_testsuite_params->valid_devs[0],
test_msg);
return status;
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index bb617c1042..0a7f8f8505 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -157,7 +157,6 @@ struct event_crypto_adapter_test_params {
struct rte_mempool *op_mpool;
struct rte_mempool *asym_op_mpool;
struct rte_mempool *session_mpool;
- struct rte_mempool *session_priv_mpool;
struct rte_mempool *asym_sess_mpool;
struct rte_cryptodev_config *config;
uint8_t crypto_event_port_id;
@@ -307,15 +306,10 @@ test_op_forward_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
-
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
&cap);
TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
@@ -683,8 +677,8 @@ test_op_new_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
@@ -699,9 +693,6 @@ test_op_new_mode(uint8_t session_less)
RTE_CRYPTO_OP_WITH_SESSION,
&m_data, sizeof(m_data));
}
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
rte_crypto_op_attach_sym_session(op, sess);
} else {
@@ -994,22 +985,12 @@ configure_cryptodev(void)
params.session_mpool = rte_cryptodev_sym_session_pool_create(
"CRYPTO_ADAPTER_SESSION_MP",
- MAX_NB_SESSIONS, 0, 0,
+ MAX_NB_SESSIONS, session_size, 0,
sizeof(union rte_event_crypto_metadata),
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(params.session_mpool,
"session mempool allocation failed\n");
- params.session_priv_mpool = rte_mempool_create(
- "CRYPTO_AD_SESS_MP_PRIV",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
- TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
- "session mempool allocation failed\n");
-
rte_cryptodev_info_get(TEST_CDEV_ID, &info);
while ((capability = &info.capabilities[i++])->op !=
@@ -1048,7 +1029,6 @@ configure_cryptodev(void)
qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
qp_conf.mp_session = params.session_mpool;
- qp_conf.mp_session_private = params.session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -1418,11 +1398,6 @@ crypto_teardown(void)
rte_mempool_free(params.session_mpool);
params.session_mpool = NULL;
}
- if (params.session_priv_mpool != NULL) {
- rte_mempool_avail_count(params.session_priv_mpool);
- rte_mempool_free(params.session_priv_mpool);
- params.session_priv_mpool = NULL;
- }
/* Free asym session mempool */
if (params.asym_sess_mpool != NULL) {
diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index aa533483fd..04d231468b 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -370,20 +370,9 @@ testsuite_setup(void)
return TEST_FAILED;
}
- ts_params->qp_conf.mp_session_private = rte_mempool_create(
- "test_priv_sess_mp",
- MAX_NB_SESSIONS,
- sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
-
- TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session_private,
- "private session mempool allocation failed");
-
ts_params->qp_conf.mp_session =
rte_cryptodev_sym_session_pool_create("test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, sess_sz, 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session,
"session mempool allocation failed");
@@ -428,11 +417,6 @@ testsuite_teardown(void)
rte_mempool_free(ts_params->qp_conf.mp_session);
ts_params->qp_conf.mp_session = NULL;
}
-
- if (ts_params->qp_conf.mp_session_private != NULL) {
- rte_mempool_free(ts_params->qp_conf.mp_session_private);
- ts_params->qp_conf.mp_session_private = NULL;
- }
}
static int
@@ -647,8 +631,7 @@ create_dummy_sec_session(struct ipsec_unitest_params *ut,
static struct rte_security_session_conf conf;
ut->ss[j].security.ses = rte_security_session_create(&dummy_sec_ctx,
- &conf, qp->mp_session,
- qp->mp_session_private);
+ &conf, qp->mp_session, NULL);
if (ut->ss[j].security.ses == NULL)
return -ENOMEM;
@@ -662,25 +645,15 @@ static int
create_crypto_session(struct ipsec_unitest_params *ut,
struct rte_cryptodev_qp_conf *qp, uint8_t dev_id, uint32_t j)
{
- int32_t rc;
struct rte_cryptodev_sym_session *s;
- s = rte_cryptodev_sym_session_create(qp->mp_session);
+ s = rte_cryptodev_sym_session_create(dev_id, ut->crypto_xforms,
+ qp->mp_session);
if (s == NULL)
return -ENOMEM;
- /* initialize SA crypto session for device */
- rc = rte_cryptodev_sym_session_init(dev_id, s,
- ut->crypto_xforms, qp->mp_session_private);
- if (rc == 0) {
- ut->ss[j].crypto.ses = s;
- return 0;
- } else {
- /* failure, do cleanup */
- rte_cryptodev_sym_session_clear(dev_id, s);
- rte_cryptodev_sym_session_free(s);
- return rc;
- }
+ ut->ss[j].crypto.ses = s;
+ return 0;
}
static int
@@ -1196,8 +1169,7 @@ static void
destroy_crypto_session(struct ipsec_unitest_params *ut,
uint8_t crypto_dev, uint32_t j)
{
- rte_cryptodev_sym_session_clear(crypto_dev, ut->ss[j].crypto.ses);
- rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses);
+ rte_cryptodev_sym_session_free(crypto_dev, ut->ss[j].crypto.ses);
memset(&ut->ss[j], 0, sizeof(ut->ss[j]));
}
diff --git a/drivers/crypto/armv8/armv8_pmd_private.h b/drivers/crypto/armv8/armv8_pmd_private.h
index 75ddba79c1..41292d8851 100644
--- a/drivers/crypto/armv8/armv8_pmd_private.h
+++ b/drivers/crypto/armv8/armv8_pmd_private.h
@@ -106,8 +106,6 @@ struct armv8_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 5c060e71a3..824a2cc735 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -521,34 +521,23 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
/* get existing session */
if (likely(op->sym->session != NULL)) {
- sess = (struct armv8_crypto_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
} else {
/* provide internal session */
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct armv8_crypto_session *)_sess_private_data;
+ sess = (struct armv8_crypto_session *)_sess->driver_priv_data;
if (unlikely(armv8_crypto_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
}
if (unlikely(sess == NULL))
@@ -674,10 +663,6 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct armv8_crypto_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index c07ac0489e..c4964bc112 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -244,7 +244,6 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -265,10 +264,9 @@ armv8_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
/** Configure the session from a crypto xform chain */
static int
-armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
+armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -278,43 +276,22 @@ armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = sess->driver_priv_data;
ret = armv8_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
ARMV8_CRYPTO_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct armv8_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops armv8_crypto_pmd_ops = {
.dev_configure = armv8_crypto_pmd_config,
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index 675ed0ad55..d3334dc920 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -211,8 +211,7 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
} else if (likely(op->sym->session != NULL)) {
/* get existing session */
sess = (struct bcmfs_sym_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_bcmfs_driver_id);
+ op->sym->session->driver_priv_data;
}
if (sess == NULL)
@@ -222,10 +221,9 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
}
int
-bcmfs_sym_session_configure(struct rte_cryptodev *dev,
+bcmfs_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -235,45 +233,23 @@ bcmfs_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- BCMFS_DP_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
BCMFS_DP_LOG(ERR, "Failed configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
void
-bcmfs_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp;
-
- memset(sess_priv, 0, sizeof(struct bcmfs_sym_session));
- sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+bcmfs_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
unsigned int
bcmfs_sym_session_get_private_size(struct rte_cryptodev *dev __rte_unused)
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.h b/drivers/crypto/bcmfs/bcmfs_sym_session.h
index d40595b4bd..4a0a012ae7 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.h
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.h
@@ -93,8 +93,7 @@ bcmfs_process_crypto_op(struct rte_crypto_op *op,
int
bcmfs_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
void
bcmfs_sym_session_clear(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8c0b4909cf..59eaecfbd2 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1357,8 +1357,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
ses = (struct caam_jr_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_driver_id);
+ op->sym->session->driver_priv_data;
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
ses = (struct caam_jr_session *)
@@ -1692,54 +1691,39 @@ caam_jr_set_session_parameters(struct rte_cryptodev *dev,
}
static int
-caam_jr_sym_session_configure(struct rte_cryptodev *dev,
+caam_jr_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
PMD_INIT_FUNC_TRACE();
-
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CAAM_JR_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
+ sess_private_data = (void *)sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct caam_jr_session));
ret = caam_jr_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
CAAM_JR_ERR("failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
static void
-caam_jr_sym_session_clear(struct rte_cryptodev *dev,
+caam_jr_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
struct caam_jr_session *s = (struct caam_jr_session *)sess_priv;
PMD_INIT_FUNC_TRACE();
if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(struct caam_jr_session));
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4bab18323b..bd999abe61 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1585,9 +1585,7 @@ ccp_perform_hmac(struct rte_crypto_op *op,
void *append_ptr;
uint8_t *addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
addr = session->auth.pre_compute;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -1766,9 +1764,7 @@ ccp_perform_sha(struct rte_crypto_op *op,
void *append_ptr;
uint64_t auth_msg_bits;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1859,9 +1855,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr, dest_addr_t;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2005,9 +1999,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2079,9 +2071,7 @@ ccp_perform_aes_cmac(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
key_addr = rte_mem_virt2phy(session->auth.key_ccp);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -2242,9 +2232,7 @@ ccp_perform_aes(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
uint8_t *iv;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
function.raw = 0;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
@@ -2330,9 +2318,7 @@ ccp_perform_3des(struct rte_crypto_op *op,
uint8_t *iv;
phys_addr_t src_addr, dest_addr, key_addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
switch (session->cipher.um.des_mode) {
@@ -2440,9 +2426,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
phys_addr_t digest_dest_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
key_addr = session->cipher.key_phys;
@@ -2607,9 +2591,7 @@ ccp_crypto_cipher(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->cipher.algo) {
case CCP_CIPHER_ALGO_AES_CBC:
@@ -2645,9 +2627,7 @@ ccp_crypto_auth(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_SHA1:
@@ -2715,9 +2695,7 @@ ccp_crypto_aead(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_AES_GCM:
@@ -2780,9 +2758,8 @@ process_ops_to_enqueue(struct ccp_qp *qp,
b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
Q_DESC_SIZE);
for (i = b_idx; i < (nb_ops+b_idx); i++) {
- session = (struct ccp_session *)get_sym_session_private_data(
- op[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
result = ccp_crypto_cipher(op[i], cmd_q, b_info);
@@ -2858,9 +2835,7 @@ static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
int offset, digest_offset;
uint8_t digest_le[64];
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
if (session->cmd_id == CCP_CMD_COMBINED) {
digest_data = op->sym->aead.digest.data;
@@ -2934,9 +2909,8 @@ ccp_prepare_ops(struct ccp_qp *qp,
for (i = b_info->b_idx; i < min_ops; i++) {
op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
- session = (struct ccp_session *)get_sym_session_private_data(
- op_d[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op_d[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 1b600e81ad..e401793a76 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -727,7 +727,6 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
/* mempool for batch info */
qp->batch_mp = rte_mempool_create(
@@ -757,8 +756,7 @@ ccp_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
void *sess_private_data;
@@ -769,40 +767,22 @@ ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -ENOMEM;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CCP_LOG_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
+
internals = (struct ccp_private *)dev->data->dev_private;
ret = ccp_set_session_parameters(sess_private_data, xform, internals);
if (ret != 0) {
CCP_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
return 0;
}
static void
-ccp_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- rte_mempool_put(sess_mp, sess_priv);
- memset(sess_priv, 0, sizeof(struct ccp_session));
- set_sym_session_private_data(sess, index, NULL);
- }
-}
+ccp_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops ccp_ops = {
.dev_configure = ccp_pmd_config,
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 1c4118ee3c..6704e39ab8 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -78,8 +78,6 @@ struct ccp_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_mempool *batch_mp;
/**< Session Mempool for batch info */
struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 013f3be1e6..6a0bfff45f 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -56,33 +56,23 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
if (unlikely(op->sym->session == NULL))
return NULL;
- sess = (struct ccp_session *)
- get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ sess = (void *)op->sym->session->driver_priv_data;
} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- void *_sess;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess;
struct ccp_private *internals;
- if (rte_mempool_get(qp->sess_mp, &_sess))
- return NULL;
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+ if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- sess = (struct ccp_session *)_sess_private_data;
+ sess = (void *)_sess->driver_priv_data;
internals = (struct ccp_private *)qp->dev->data->dev_private;
if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
internals) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- ccp_cryptodev_driver_id,
- _sess_private_data);
+ op->sym->session = _sess;
}
return sess;
@@ -161,13 +151,10 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
for (i = 0; i < nb_dequeued; i++)
if (unlikely(ops[i]->sess_type ==
RTE_CRYPTO_OP_SESSIONLESS)) {
- struct ccp_session *sess = (struct ccp_session *)
- get_sym_session_private_data(
- ops[i]->sym->session,
- ccp_cryptodev_driver_id);
+ struct ccp_session *sess =
+ (void *)ops[i]->sym->session->driver_priv_data;
- rte_mempool_put(qp->sess_mp_priv,
- sess);
+ memset(sess, 0, sizeof(*sess));
rte_mempool_put(qp->sess_mp,
ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 7bbe8726e3..dee1f299d2 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -41,24 +41,23 @@ struct vec_request {
static inline struct cnxk_se_sess *
cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn10k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
- if (ret)
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform,
+ sess);
+ if (ret) {
+ rte_mempool_put(qp->sess_mp, (void *)sess);
goto sess_put;
+ }
- priv = get_sym_session_private_data(sess, driver_id);
-
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
return priv;
@@ -130,8 +129,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
return 0;
w7 = sec_sess->sa.inst.w7;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- sess = get_sym_session_private_data(
- sym_op->session, cn10k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret))
@@ -147,8 +145,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret)) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
return 0;
}
@@ -312,8 +309,9 @@ cn10k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn10k_cryptodev_driver_id);
+ priv = (void *)(
+ ((struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -350,8 +348,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn10k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
} else {
@@ -818,7 +815,6 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
{
const uint8_t uc_compcode = res->uc_compcode;
const uint8_t compcode = res->compcode;
- unsigned int sz;
cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
@@ -895,11 +891,7 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index b753c1cb4b..a44f111ba6 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -56,23 +56,20 @@ cn9k_cpt_sec_inst_fill(struct rte_crypto_op *op,
static inline struct cnxk_se_sess *
cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn9k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform, sess);
if (ret)
goto sess_put;
- priv = get_sym_session_private_data(sess, driver_id);
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
@@ -95,8 +92,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
sym_op = op->sym;
- sess = get_sym_session_private_data(
- sym_op->session, cn9k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
inst->w7.u64 = sess->cpt_inst_w7;
} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
@@ -110,8 +106,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
if (unlikely(ret)) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
}
inst->w7.u64 = sess->cpt_inst_w7;
@@ -349,8 +344,9 @@ cn9k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn9k_cryptodev_driver_id);
+ priv = (void *)((
+ (struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -387,8 +383,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn9k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
} else {
@@ -583,8 +578,6 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
struct cpt_inflight_req *infl_req,
struct cpt_cn9k_res_s *res)
{
- unsigned int sz;
-
if (likely(res->compcode == CPT_COMP_GOOD)) {
if (unlikely(res->uc_compcode)) {
if (res->uc_compcode == ROC_SE_ERR_GC_ICV_MISCOMPARE)
@@ -645,11 +638,7 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index cf91b92c2c..018d7fcee8 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -406,7 +406,6 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = conf->mp_session;
- qp->sess_mp_priv = conf->mp_session_private;
dev->data->queue_pairs[qp_id] = qp;
return 0;
@@ -620,25 +619,15 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)
}
int
-sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
enum cpt_dp_thread_type thr_type;
- struct cnxk_se_sess *sess_priv;
- void *priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
int ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- plt_dp_err("Could not allocate session private data");
- return -ENOMEM;
- }
-
- memset(priv, 0, sizeof(struct cnxk_se_sess));
-
- sess_priv = priv;
-
+ memset(sess_priv, 0, sizeof(struct cnxk_se_sess));
ret = cnxk_sess_fill(roc_cpt, xform, sess_priv);
if (ret)
goto priv_put;
@@ -684,61 +673,39 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
}
sess_priv->cpt_inst_w7 = cnxk_cpt_inst_w7_get(sess_priv, roc_cpt);
-
- set_sym_session_private_data(sess, driver_id, sess_priv);
-
return 0;
priv_put:
- rte_mempool_put(pool, priv);
-
return ret;
}
int
cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
struct cnxk_cpt_vf *vf = dev->data->dev_private;
struct roc_cpt *roc_cpt = &vf->cpt;
- uint8_t driver_id;
- driver_id = dev->driver_id;
-
- return sym_session_configure(roc_cpt, driver_id, xform, sess, pool);
+ return sym_session_configure(roc_cpt, xform, sess);
}
void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
- struct cnxk_se_sess *sess_priv;
- struct rte_mempool *pool;
-
- if (priv == NULL)
- return;
-
- sess_priv = priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
- memset(priv, 0, cnxk_cpt_sym_session_get_size(NULL));
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
+ memset(sess_priv, 0, cnxk_cpt_sym_session_get_size(NULL));
}
void
-cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
+cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
unsigned int
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index d9ed43b40b..baa2b69c52 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -85,8 +85,6 @@ struct cnxk_cpt_qp {
/**< Crypto adapter related info */
struct rte_mempool *sess_mp;
/**< Session mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session private data mempool */
};
int cnxk_cpt_dev_config(struct rte_cryptodev *dev,
@@ -111,18 +109,16 @@ unsigned int cnxk_cpt_sym_session_get_size(struct rte_cryptodev *dev);
int cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
-int sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+int sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
void cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess);
+ struct rte_cryptodev_sym_session *sess);
-void sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess);
+void sym_session_clear(struct rte_cryptodev_sym_session *sess);
unsigned int cnxk_ae_session_size_get(struct rte_cryptodev *dev __rte_unused);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 3b13578de0..fa1cdcf78b 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1379,8 +1379,7 @@ build_sec_fd(struct rte_crypto_op *op,
dpaa2_sec_session *sess;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -1678,8 +1677,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
struct rte_crypto_sym_op *sym_op;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -3754,51 +3752,36 @@ dpaa2_sec_security_session_destroy(void *dev __rte_unused,
}
#endif
static int
-dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA2_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa2_sec_set_session_parameters(xform, sess_private_data);
if (ret != 0) {
DPAA2_SEC_ERR("Failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa2_sec_session *s = (dpaa2_sec_session *)sess_priv;
if (sess_priv) {
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(dpaa2_sec_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index b3242791ac..fb74be6012 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -1012,8 +1012,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa2_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, cryptodev_driver_id);
+ sess = (void *)session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index c6bd785262..7a4c03a882 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -670,10 +670,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
struct qm_sg_entry sg[2];
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa_sec_session *)
@@ -1927,10 +1924,8 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ ses = (void *)
+ op->sym->session->driver_priv_data;
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
@@ -2676,31 +2671,19 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
static int
dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
PMD_INIT_FUNC_TRACE();
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa_sec_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
DPAA_SEC_ERR("failed to configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
ret = dpaa_sec_prep_cdb(sess_private_data);
if (ret) {
DPAA_SEC_ERR("Unable to prepare sec cdb");
@@ -2714,7 +2697,6 @@ static inline void
free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
{
struct dpaa_sec_dev_private *qi = dev->data->dev_private;
- struct rte_mempool *sess_mp = rte_mempool_from_obj((void *)s);
uint8_t i;
for (i = 0; i < MAX_DPAA_CORES; i++) {
@@ -2724,7 +2706,6 @@ free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
s->qp[i] = NULL;
}
free_session_data(s);
- rte_mempool_put(sess_mp, (void *)s);
}
/** Clear the memory of session so it doesn't leave key material behind */
@@ -2733,14 +2714,10 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
- if (sess_priv) {
- free_session_memory(dev, s);
- set_sym_session_private_data(sess, index, NULL);
- }
+ free_session_memory(dev, s);
}
#ifdef RTE_LIB_SECURITY
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index 29c5935739..35f93ceb48 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -1017,8 +1017,8 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)
+ session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 7e8396b4a3..90ce5bc965 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -264,7 +264,6 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
qp->pmd_type = internals->pmd_type;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
qp->ingress_queue = ipsec_mb_qp_create_processed_ops_ring(qp,
qp_conf->nb_descriptors, socket_id);
@@ -312,9 +311,8 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev)
int
ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess, struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
struct ipsec_mb_dev_private *internals = dev->data->dev_private;
struct ipsec_mb_internals *pmd_data =
&ipsec_mb_pmds[internals->pmd_type];
@@ -330,42 +328,22 @@ ipsec_mb_sym_session_configure(
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- IPSEC_MB_LOG(ERR, "Couldn't get object from session mempool");
- free_mb_mgr(mb_mgr);
- return -ENOMEM;
- }
-
- ret = (*pmd_data->session_configure)(mb_mgr, sess_private_data, xform);
+ ret = (*pmd_data->session_configure)(mb_mgr,
+ (void *)sess->driver_priv_data, xform);
if (ret != 0) {
IPSEC_MB_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
free_mb_mgr(mb_mgr);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
free_mb_mgr(mb_mgr);
return 0;
}
/** Clear the session memory */
void
-ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, ipsec_mb_sym_session_get_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+ipsec_mb_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 472b672f08..e4aea7700c 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -136,8 +136,6 @@ struct ipsec_mb_qp {
struct rte_ring *ingress_queue;
/**< Ring for placing operations ready for processing */
struct rte_mempool *sess_mp;
- /**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
/**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
@@ -399,8 +397,7 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev);
int ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
/** Clear the memory of session so it does not leave key material behind */
void
@@ -411,50 +408,50 @@ ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
static __rte_always_inline void *
ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
{
- void *sess = NULL;
+ struct rte_cryptodev_sym_session *sess = NULL;
uint32_t driver_id = ipsec_mb_get_driver_id(qp->pmd_type);
struct rte_crypto_sym_op *sym_op = op->sym;
uint8_t sess_type = op->sess_type;
void *_sess;
- void *_sess_private_data = NULL;
struct ipsec_mb_internals *pmd_data = &ipsec_mb_pmds[qp->pmd_type];
switch (sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
if (likely(sym_op->session != NULL))
- sess = get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
+ else
+ goto error_exit;
break;
case RTE_CRYPTO_OP_SESSIONLESS:
if (!qp->sess_mp ||
rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (!qp->sess_mp_priv ||
- rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
+ sess = _sess;
+ if (sess->sess_data_sz < pmd_data->session_priv_size) {
+ rte_mempool_put(qp->sess_mp, _sess);
+ goto error_exit;
+ }
- sess = _sess_private_data;
if (unlikely(pmd_data->session_configure(qp->mb_mgr,
- sess, sym_op->xform) != 0)) {
+ (void *)sess->driver_priv_data, sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
- sess = NULL;
+ goto error_exit;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sess->driver_id = driver_id;
+ sym_op->session = sess;
+
break;
default:
IPSEC_MB_LOG(ERR, "Unrecognized session type %u", sess_type);
}
- if (unlikely(sess == NULL))
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return (void *)sess->driver_priv_data;
- return sess;
+error_exit:
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return NULL;
}
#endif /* _IPSEC_MB_PRIVATE_H_ */
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
index 2c033c6f28..e4f274b608 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
@@ -241,10 +241,6 @@ handle_completed_gcm_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_gcm_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -455,44 +451,35 @@ static inline struct aesni_gcm_session *
aesni_gcm_get_session(struct ipsec_mb_qp *qp,
struct rte_crypto_op *op)
{
- struct aesni_gcm_session *sess = NULL;
- uint32_t driver_id =
- ipsec_mb_get_driver_id(IPSEC_MB_PMD_TYPE_AESNI_GCM);
+ struct rte_cryptodev_sym_session *sess = NULL;
struct rte_crypto_sym_op *sym_op = op->sym;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
- sess = (struct aesni_gcm_session *)
- get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
} else {
- void *_sess;
- void *_sess_private_data = NULL;
-
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
+ if (unlikely(sess->sess_data_sz <
+ sizeof(struct aesni_gcm_session))) {
+ rte_mempool_put(qp->sess_mp, sess);
return NULL;
-
- sess = (struct aesni_gcm_session *)_sess_private_data;
+ }
if (unlikely(aesni_gcm_session_configure(qp->mb_mgr,
- _sess_private_data, sym_op->xform) != 0)) {
- rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
+ (void *)sess->driver_priv_data,
+ sym_op->xform) != 0)) {
+ rte_mempool_put(qp->sess_mp, sess);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sym_op->session = sess;
}
if (unlikely(sess == NULL))
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return sess;
+ return (void *)sess->driver_priv_data;
}
static uint16_t
@@ -712,22 +699,15 @@ aesni_gmac_sgl_verify(struct aesni_gcm_session *s,
/** Process CPU crypto bulk operations */
static uint32_t
-aesni_gcm_process_bulk(struct rte_cryptodev *dev,
+aesni_gcm_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess,
__rte_unused union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
- struct aesni_gcm_session *s;
+ struct aesni_gcm_session *s = (void *)sess->driver_priv_data;
struct gcm_context_data gdata_ctx;
IMB_MGR *mb_mgr;
- s = (struct aesni_gcm_session *) get_sym_session_private_data(sess,
- dev->driver_id);
- if (unlikely(s == NULL)) {
- aesni_gcm_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 6d5d3ce8eb..f3565b04b5 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1710,8 +1710,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
{
struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data;
struct aesni_mb_session *sess = NULL;
- uint32_t driver_id = ipsec_mb_get_driver_id(
- IPSEC_MB_PMD_TYPE_AESNI_MB);
#ifdef AESNI_MB_DOCSIS_SEC_ENABLED
uint8_t is_docsis_sec = 0;
@@ -1725,15 +1723,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
sess = get_sec_session_private_data(op->sym->sec_session);
} else
#endif
- {
- sess = get_sym_session_private_data(op->sym->session,
- driver_id);
- }
-
- if (unlikely(sess == NULL)) {
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return op;
- }
+ sess = (void *)op->sym->session->driver_priv_data;
if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
switch (job->status) {
@@ -1771,10 +1761,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_mb_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -1962,16 +1948,6 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
return processed_jobs;
}
-
-static inline void
-ipsec_mb_fill_error_code(struct rte_crypto_sym_vec *vec, int32_t err)
-{
- uint32_t i;
-
- for (i = 0; i != vec->num; ++i)
- vec->status[i] = err;
-}
-
static inline int
check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl)
{
@@ -2028,7 +2004,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec,
}
static uint32_t
-aesni_mb_process_bulk(struct rte_cryptodev *dev,
+aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
struct rte_crypto_sym_vec *vec)
{
@@ -2037,15 +2013,9 @@ aesni_mb_process_bulk(struct rte_cryptodev *dev,
void *buf;
IMB_JOB *job;
IMB_MGR *mb_mgr;
- struct aesni_mb_session *s;
+ struct aesni_mb_session *s = (void *)sess->driver_priv_data;
uint8_t tmp_dgst[vec->num][DIGEST_LENGTH_MAX];
- s = get_sym_session_private_data(sess, dev->driver_id);
- if (s == NULL) {
- ipsec_mb_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
index d953d6e5f5..97e7cef233 100644
--- a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
+++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
@@ -290,10 +290,6 @@ handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct chacha20_poly1305_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index fba10b8cf4..b83e2d6715 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -231,11 +231,6 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct kasumi_session));
- memset(
- ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -287,8 +282,9 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct kasumi_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct kasumi_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
return processed_op;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index 9a85f46721..f052d6d847 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -362,10 +362,6 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct snow3g_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -417,8 +413,9 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct snow3g_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct snow3g_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c b/drivers/crypto/ipsec_mb/pmd_zuc.c
index e36c7092d6..92fd9d1808 100644
--- a/drivers/crypto/ipsec_mb/pmd_zuc.c
+++ b/drivers/crypto/ipsec_mb/pmd_zuc.c
@@ -239,10 +239,6 @@ process_ops(struct rte_crypto_op **ops, enum ipsec_mb_operation op_type,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sessions[i], 0, sizeof(struct zuc_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sessions[i]);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index dc8e291f50..e5063b515c 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -171,14 +171,13 @@ mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *session)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *sess_private_data;
+ struct mlx5_crypto_session *sess_private_data =
+ (void *)session->driver_priv_data;
struct rte_crypto_cipher_xform *cipher;
uint8_t encryption_order;
- int ret;
if (unlikely(xform->next != NULL)) {
DRV_LOG(ERR, "Xform next is not supported.");
@@ -189,17 +188,9 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
DRV_LOG(ERR, "Only AES-XTS algorithm is supported.");
return -ENOTSUP;
}
- ret = rte_mempool_get(mp, (void *)&sess_private_data);
- if (ret != 0) {
- DRV_LOG(ERR,
- "Failed to get session %p private data from mempool.",
- sess_private_data);
- return -ENOMEM;
- }
cipher = &xform->cipher;
sess_private_data->dek = mlx5_crypto_dek_prepare(priv, cipher);
if (sess_private_data->dek == NULL) {
- rte_mempool_put(mp, sess_private_data);
DRV_LOG(ERR, "Failed to prepare dek.");
return -ENOMEM;
}
@@ -239,8 +230,6 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
sess_private_data->dek_id =
rte_cpu_to_be_32(sess_private_data->dek->obj->id &
0xffffff);
- set_sym_session_private_data(session, dev->driver_id,
- sess_private_data);
DRV_LOG(DEBUG, "Session %p was configured.", sess_private_data);
return 0;
}
@@ -250,16 +239,13 @@ mlx5_crypto_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *spriv = get_sym_session_private_data(sess,
- dev->driver_id);
+ struct mlx5_crypto_session *spriv = (void *)sess->driver_priv_data;
if (unlikely(spriv == NULL)) {
DRV_LOG(ERR, "Failed to get session %p private data.", spriv);
return;
}
mlx5_crypto_dek_destroy(priv, spriv->dek);
- set_sym_session_private_data(sess, dev->driver_id, NULL);
- rte_mempool_put(rte_mempool_from_obj(spriv), spriv);
DRV_LOG(DEBUG, "Session %p was cleared.", spriv);
}
@@ -369,8 +355,8 @@ mlx5_crypto_wqe_set(struct mlx5_crypto_priv *priv,
struct rte_crypto_op *op,
struct mlx5_umr_wqe *umr)
{
- struct mlx5_crypto_session *sess = get_sym_session_private_data
- (op->sym->session, mlx5_crypto_driver_id);
+ struct mlx5_crypto_session *sess =
+ (void *)op->sym->session->driver_priv_data;
struct mlx5_wqe_cseg *cseg = &umr->ctr;
struct mlx5_wqe_mkey_cseg *mkc = &umr->mkc;
struct mlx5_wqe_dseg *klms = &umr->kseg[0];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index c35876c8b4..fdc9c14227 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -597,13 +597,7 @@ mrvl_request_prepare_crp(struct sam_cio_op_params *request,
return -EINVAL;
}
- sess = (struct mrvl_crypto_session *)get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
- if (unlikely(sess == NULL)) {
- MRVL_LOG(ERR, "Session was not created for this device!");
- return -EINVAL;
- }
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
request->sa = sess->sam_sess;
request->cookie = op;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index f828dc9db5..0066236561 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -736,8 +736,7 @@ mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
static int
mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
struct mrvl_crypto_session *mrvl_sess;
void *sess_private_data;
@@ -748,23 +747,15 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- CDEV_LOG_ERR("Couldn't get object from session mempool.");
- return -ENOMEM;
- }
-
+ sess_private_data = sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session));
ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
MRVL_LOG(ERR, "Failed to configure session parameters!");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
mrvl_sess = (struct mrvl_crypto_session *)sess_private_data;
if (sam_session_create(&mrvl_sess->sam_sess_params,
@@ -791,8 +782,7 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = sess->data;
/* Zero out the whole structure */
if (sess_priv) {
@@ -803,11 +793,6 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
sam_session_destroy(mrvl_sess->sam_sess) < 0) {
MRVL_LOG(ERR, "Error while destroying session!");
}
-
- memset(mrvl_sess, 0, sizeof(struct mrvl_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index cb5393d2f1..505024a810 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -530,24 +530,16 @@ configure_aead_ctx(struct rte_crypto_aead_xform *xform,
}
static int
-nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
+nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *mp_obj;
- struct nitrox_crypto_ctx *ctx;
+ struct nitrox_crypto_ctx *ctx = (void *)sess->driver_priv_data;
struct rte_crypto_cipher_xform *cipher_xform = NULL;
struct rte_crypto_auth_xform *auth_xform = NULL;
struct rte_crypto_aead_xform *aead_xform = NULL;
int ret = -EINVAL;
- if (rte_mempool_get(mempool, &mp_obj)) {
- NITROX_LOG(ERR, "Couldn't allocate context\n");
- return -ENOMEM;
- }
-
- ctx = mp_obj;
ctx->nitrox_chain = get_crypto_chain_order(xform);
switch (ctx->nitrox_chain) {
case NITROX_CHAIN_CIPHER_ONLY:
@@ -585,38 +577,23 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
goto err;
}
- ctx->iova = rte_mempool_virt2iova(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, ctx);
+ ctx->iova = sess->driver_priv_data_iova;
return 0;
err:
- rte_mempool_put(mempool, mp_obj);
return ret;
}
static void
-nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct nitrox_crypto_ctx *ctx = get_sym_session_private_data(sess,
- cdev->driver_id);
- struct rte_mempool *sess_mp;
-
- if (!ctx)
- return;
-
- memset(ctx, 0, sizeof(*ctx));
- sess_mp = rte_mempool_from_obj(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, NULL);
- rte_mempool_put(sess_mp, ctx);
-}
+nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct nitrox_crypto_ctx *
get_crypto_ctx(struct rte_crypto_op *op)
{
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(op->sym->session))
- return get_sym_session_private_data(op->sym->session,
- nitrox_sym_drv_id);
+ return (void *)op->sym->session->driver_priv_data;
}
return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index eab74ad45f..695eeaa1e8 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -58,7 +58,7 @@ process_op(const struct null_crypto_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(op->sym->session, 0,
sizeof(struct null_crypto_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
@@ -78,30 +78,21 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
sess = (struct null_crypto_session *)
- get_sym_session_private_data(
- sym_op->session, cryptodev_driver_id);
+ sym_op->session->driver_priv_data;
} else {
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct null_crypto_session *)_sess_private_data;
+ sess = (struct null_crypto_session *)_sess->driver_priv_data;
if (unlikely(null_crypto_set_session_parameters(sess,
sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+ sym_op->session = _sess;
}
return sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 90a675dfff..fb43d3f7b5 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -233,7 +233,6 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
@@ -256,8 +255,7 @@ null_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -267,43 +265,22 @@ null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- NULL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = null_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
NULL_LOG(ERR, "failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct null_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops pmd_ops = {
.dev_configure = null_crypto_pmd_config,
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index 89c4345b6f..ae34ce6671 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,8 +31,6 @@ struct null_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Mempool */
struct rte_cryptodev_stats qp_stats;
/**< Queue pair statistics */
} __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
index e48805fb09..4647d568de 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
+++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
@@ -49,7 +49,6 @@ struct cpt_instance {
uint32_t queue_id;
uintptr_t rsvd;
struct rte_mempool *sess_mp;
- struct rte_mempool *sess_mp_priv;
struct cpt_qp_meta_info meta_info;
uint8_t ca_enabled;
};
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 11840f5ecf..71856d5e86 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -171,7 +171,6 @@ otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
instance->queue_id = que_pair_id;
instance->sess_mp = qp_conf->mp_session;
- instance->sess_mp_priv = qp_conf->mp_session_private;
dev->data->queue_pairs[que_pair_id] = instance;
return 0;
@@ -243,25 +242,19 @@ sym_xform_verify(struct rte_crypto_sym_xform *xform)
}
static int
-sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+sym_session_configure(struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_crypto_sym_xform *temp_xform = xform;
struct cpt_sess_misc *misc;
vq_cmd_word3_t vq_cmd_w3;
- void *priv;
+ void *priv = (void *)sess->driver_priv_data;
int ret;
ret = sym_xform_verify(xform);
if (unlikely(ret))
return ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- CPT_LOG_ERR("Could not allocate session private data");
- return -ENOMEM;
- }
-
memset(priv, 0, sizeof(struct cpt_sess_misc) +
offsetof(struct cpt_ctx, mc_ctx));
@@ -301,9 +294,7 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
goto priv_put;
}
- set_sym_session_private_data(sess, driver_id, priv);
-
- misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
+ misc->ctx_dma_addr = sess->driver_priv_data_iova +
sizeof(struct cpt_sess_misc);
vq_cmd_w3.u64 = 0;
@@ -316,17 +307,14 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
return 0;
priv_put:
- if (priv)
- rte_mempool_put(pool, priv);
return -ENOTSUP;
}
static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
+ void *priv = (void *)sess->driver_priv_data;
struct cpt_sess_misc *misc;
- struct rte_mempool *pool;
struct cpt_ctx *ctx;
if (priv == NULL)
@@ -336,35 +324,26 @@ sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
ctx = SESS_PRIV(misc);
rte_free(ctx->auth_key);
-
- memset(priv, 0, cpt_get_session_size());
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
}
static int
-otx_cpt_session_cfg(struct rte_cryptodev *dev,
+otx_cpt_session_cfg(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_configure(dev->driver_id, xform, sess, pool);
+ return sym_session_configure(xform, sess);
}
static void
-otx_cpt_session_clear(struct rte_cryptodev *dev,
+otx_cpt_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
static unsigned int
@@ -528,10 +507,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance,
void *req;
uint64_t cpt_op;
- sess = (struct cpt_sess_misc *)
- get_sym_session_private_data(sym_op->session,
- otx_cryptodev_driver_id);
-
+ sess = (struct cpt_sess_misc *)sym_op->session->driver_priv_data;
cpt_op = sess->cpt_op;
if (likely(cpt_op & CPT_OP_CIPHER_MASK))
@@ -560,21 +536,18 @@ static __rte_always_inline void * __rte_hot
otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
struct rte_crypto_op *op)
{
- const int driver_id = otx_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
void *req;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(instance->sess_mp);
- if (sess == NULL) {
+ if (rte_mempool_get(instance->sess_mp, (void **)&sess) < 0) {
rte_errno = ENOMEM;
return NULL;
}
- ret = sym_session_configure(driver_id, sym_op->xform, sess,
- instance->sess_mp_priv);
+ ret = sym_session_configure(sym_op->xform, sess);
if (ret)
goto sess_put;
@@ -583,12 +556,10 @@ otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
/* Enqueue op with the tmp session set */
req = otx_cpt_enq_single_sym(instance, op);
if (unlikely(req == NULL))
- goto priv_put;
+ goto sess_put;
return req;
-priv_put:
- sym_session_clear(driver_id, sess);
sess_put:
rte_mempool_put(instance->sess_mp, sess);
return NULL;
@@ -873,13 +844,9 @@ static inline void
free_sym_session_data(const struct cpt_instance *instance,
struct rte_crypto_op *cop)
{
- void *sess_private_data_t = get_sym_session_private_data(
- cop->sym->session, otx_cryptodev_driver_id);
+ void *sess_private_data_t = (void *)cop->sym->session->driver_priv_data;
+
memset(sess_private_data_t, 0, cpt_get_session_size());
- memset(cop->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session));
- rte_mempool_put(instance->sess_mp_priv, sess_private_data_t);
rte_mempool_put(instance->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/openssl_pmd_private.h b/drivers/crypto/openssl/openssl_pmd_private.h
index c34fd9a546..ed6841e460 100644
--- a/drivers/crypto/openssl/openssl_pmd_private.h
+++ b/drivers/crypto/openssl/openssl_pmd_private.h
@@ -70,8 +70,6 @@ struct openssl_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 3c4ff1ac56..ff5e349ce8 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -887,10 +887,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
/* get existing session */
if (likely(op->sym->session != NULL))
- sess = (struct openssl_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = (void *)
+ op->sym->session->driver_priv_data;
} else {
if (likely(op->asym->session != NULL))
asym_sess = (struct openssl_asym_session *)
@@ -901,32 +899,26 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
return asym_sess;
}
} else {
+ struct rte_cryptodev_sym_session *_sess;
/* sessionless asymmetric not supported */
if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC)
return NULL;
/* provide internal session */
- void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- void *_sess_private_data = NULL;
+ rte_mempool_get(qp->sess_mp, (void **)&_sess);
if (_sess == NULL)
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct openssl_session *)_sess_private_data;
+ sess = (struct openssl_session *)_sess->driver_priv_data;
if (unlikely(openssl_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+
}
if (sess == NULL)
@@ -2900,10 +2892,6 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
openssl_reset_session(sess);
memset(sess, 0, sizeof(struct openssl_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index f7ddbf9c73..2a3662ee5a 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -764,7 +764,6 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -794,10 +793,9 @@ openssl_pmd_asym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
if (unlikely(sess == NULL)) {
@@ -805,24 +803,14 @@ openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- OPENSSL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = openssl_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
OPENSSL_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
@@ -1328,20 +1316,13 @@ openssl_pmd_asym_session_configure(struct rte_cryptodev *dev __rte_unused,
/** Clear the memory of session so it doesn't leave key material behind */
static void
-openssl_pmd_sym_session_clear(struct rte_cryptodev *dev,
+openssl_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
/* Zero out the whole structure */
- if (sess_priv) {
- openssl_reset_session(sess_priv);
- memset(sess_priv, 0, sizeof(struct openssl_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ openssl_reset_session(sess_priv);
}
static void openssl_reset_asym_session(struct openssl_asym_session *sess)
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index f3a99ae15c..2c58a0ec75 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -67,12 +67,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
return -EINVAL;
if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) {
- ctx = get_sym_session_private_data(op->sym->session,
- qat_sym_driver_id);
- if (unlikely(!ctx)) {
- QAT_DP_LOG(ERR, "No session for this device");
- return -EINVAL;
- }
+ ctx = (void *)op->sym->session->driver_priv_data;
if (sess != (uintptr_t)ctx) {
struct rte_cryptodev *cdev;
struct qat_cryptodev_private *internals;
@@ -391,8 +386,7 @@ qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
return -EINVAL;
- ctx = (struct qat_sym_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, qat_sym_driver_id);
+ ctx = (void *)session_ctx.crypto_sess->driver_priv_data;
dp_ctx->session = ctx;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 074612c11b..2853ac5b88 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -317,9 +317,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
#endif
{
sess = (struct qat_sym_session *)
- get_sym_session_private_data(
- rx_op->sym->session,
- qat_sym_driver_id);
+ rx_op->sym->session->driver_priv_data;
is_docsis_sec = 0;
}
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index bfc9836351..da50bcbef1 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -226,22 +226,13 @@ qat_is_auth_alg_supported(enum rte_crypto_auth_algorithm algo,
}
void
-qat_sym_session_clear(struct rte_cryptodev *dev,
+qat_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
- struct qat_sym_session *s = (struct qat_sym_session *)sess_priv;
+ struct qat_sym_session *s = (void *)sess->driver_priv_data;
- if (sess_priv) {
- if (s->bpi_ctx)
- bpi_cipher_ctx_free(s->bpi_ctx);
- memset(s, 0, qat_sym_session_get_private_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ if (s->bpi_ctx)
+ bpi_cipher_ctx_free(s->bpi_ctx);
}
static int
@@ -524,35 +515,24 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
if (ossl_legacy_provider_load())
return -EINVAL;
#endif
- ret = qat_sym_session_set_parameters(dev, xform, sess_private_data);
+ ret = qat_sym_session_set_parameters(dev, xform,
+ (void *)sess->driver_priv_data,
+ sess->driver_priv_data_iova);
if (ret != 0) {
QAT_LOG(ERR,
"Crypto QAT PMD: failed to configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ossl_legacy_provider_unload();
# endif
@@ -561,7 +541,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev,
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private)
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_paddr)
{
struct qat_sym_session *session = session_private;
struct qat_cryptodev_private *internals = dev->data->dev_private;
@@ -570,7 +551,6 @@ qat_sym_session_set_parameters(struct rte_cryptodev *dev,
int qat_cmd_id;
/* Verify the session physical address is known */
- rte_iova_t session_paddr = rte_mempool_virt2iova(session);
if (session_paddr == 0 || session_paddr == RTE_BAD_IOVA) {
QAT_LOG(ERR,
"Session physical address unknown. Bad memory pool.");
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index 01908abd9e..9e4aab06a6 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -123,12 +123,12 @@ struct qat_sym_session {
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private);
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_private_iova);
int
qat_sym_session_configure_aead(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 11b559e025..03df424140 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -470,44 +470,18 @@ scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
}
static int
-scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+ struct rte_crypto_sym_xform *xform __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
- int ret;
-
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- ret = rte_cryptodev_sym_session_init(worker->dev_id, sess,
- xform, mempool);
- if (ret < 0) {
- CR_SCHED_LOG(ERR, "unable to config sym session");
- return ret;
- }
- }
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
-
- /* Clear private data of workers */
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- rte_cryptodev_sym_session_clear(worker->dev_id, sess);
- }
-}
+scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops scheduler_pmd_ops = {
.dev_configure = scheduler_pmd_config,
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 21bd996064..d3b799b28d 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -40,8 +40,7 @@ static void virtio_crypto_sym_clear_session(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
/*
* The set of PCI devices this driver supports
@@ -952,12 +951,7 @@ virtio_crypto_sym_clear_session(
hw = dev->data->dev_private;
vq = hw->cvq;
- session = (struct virtio_crypto_session *)get_sym_session_private_data(
- sess, cryptodev_virtio_driver_id);
- if (session == NULL) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid session parameter");
- return;
- }
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
VIRTIO_CRYPTO_SESSION_LOG_INFO("vq->vq_desc_head_idx = %d, "
"vq = %p", vq->vq_desc_head_idx, vq);
@@ -1070,10 +1064,6 @@ virtio_crypto_sym_clear_session(
VIRTIO_CRYPTO_SESSION_LOG_INFO("Close session %"PRIu64" successfully ",
session->session_id);
- memset(session, 0, sizeof(struct virtio_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(session);
- set_sym_session_private_data(sess, cryptodev_virtio_driver_id, NULL);
- rte_mempool_put(sess_mp, session);
rte_free(malloc_virt_addr);
}
@@ -1292,11 +1282,9 @@ static int
virtio_crypto_check_sym_configure_session_paras(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sym_sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sym_sess)
{
- if (unlikely(xform == NULL) || unlikely(sym_sess == NULL) ||
- unlikely(mempool == NULL)) {
+ if (unlikely(xform == NULL) || unlikely(sym_sess == NULL)) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("NULL pointer");
return -1;
}
@@ -1311,12 +1299,9 @@ static int
virtio_crypto_sym_configure_session(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
- struct virtio_crypto_session crypto_sess;
- void *session_private = &crypto_sess;
struct virtio_crypto_session *session;
struct virtio_crypto_op_ctrl_req *ctrl_req;
enum virtio_crypto_cmd_id cmd_id;
@@ -1328,19 +1313,12 @@ virtio_crypto_sym_configure_session(
PMD_INIT_FUNC_TRACE();
ret = virtio_crypto_check_sym_configure_session_paras(dev, xform,
- sess, mempool);
+ sess);
if (ret < 0) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid parameters");
return ret;
}
-
- if (rte_mempool_get(mempool, &session_private)) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
- session = (struct virtio_crypto_session *)session_private;
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
memset(session, 0, sizeof(struct virtio_crypto_session));
ctrl_req = &session->ctrl;
ctrl_req->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
@@ -1402,10 +1380,6 @@ virtio_crypto_sym_configure_session(
"Unsupported operation chain order parameter");
goto error_out;
}
-
- set_sym_session_private_data(sess, dev->driver_id,
- session_private);
-
return 0;
error_out:
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index 08359b3a39..b7f492a7f2 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -207,8 +207,7 @@ virtqueue_crypto_sym_enqueue_xmit(
offsetof(struct virtio_crypto_op_cookie, iv);
struct rte_crypto_sym_op *sym_op = cop->sym;
struct virtio_crypto_session *session =
- (struct virtio_crypto_session *)get_sym_session_private_data(
- cop->sym->session, cryptodev_virtio_driver_id);
+ (void *)cop->sym->session->driver_priv_data;
struct virtio_crypto_op_data_req *op_data_req;
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c
index 19af134bbe..bce903e007 100644
--- a/examples/fips_validation/fips_dev_self_test.c
+++ b/examples/fips_validation/fips_dev_self_test.c
@@ -969,7 +969,6 @@ struct fips_dev_auto_test_env {
struct rte_mempool *mpool;
struct rte_mempool *op_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mbuf *mbuf;
struct rte_crypto_op *op;
};
@@ -1479,13 +1478,8 @@ run_single_test(uint8_t dev_id,
return ret;
}
- sess = rte_cryptodev_sym_session_create(env->sess_pool);
- if (!sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(dev_id,
- sess, &xform, env->sess_priv_pool);
- if (ret < 0) {
+ sess = rte_cryptodev_sym_session_create(dev_id, &xform, env->sess_pool);
+ if (!sess) {
RTE_LOG(ERR, PMD, "Error %i: Init session\n", ret);
return ret;
}
@@ -1508,8 +1502,7 @@ run_single_test(uint8_t dev_id,
1);
} while (n_deqd == 0);
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(dev_id, sess);
if (env->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
return -1;
@@ -1527,7 +1520,6 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
rte_mempool_free(env->mpool);
rte_mempool_free(env->op_pool);
rte_mempool_free(env->sess_pool);
- rte_mempool_free(env->sess_priv_pool);
rte_cryptodev_stop(dev_id);
}
@@ -1535,7 +1527,7 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
static int
fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
{
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
struct rte_cryptodev_config conf;
char name[128];
@@ -1579,25 +1571,13 @@ fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
snprintf(name, 128, "%s%u", "SELF_TEST_SESS_POOL", dev_id);
env->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- 128, 0, 0, 0, rte_cryptodev_socket_id(dev_id));
+ 128, sess_sz, 0, 0, rte_cryptodev_socket_id(dev_id));
if (!env->sess_pool) {
ret = -ENOMEM;
goto error_exit;
}
- memset(name, 0, 128);
- snprintf(name, 128, "%s%u", "SELF_TEST_SESS_PRIV_POOL", dev_id);
-
- env->sess_priv_pool = rte_mempool_create(name,
- 128, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_cryptodev_socket_id(dev_id), 0);
- if (!env->sess_priv_pool) {
- ret = -ENOMEM;
- goto error_exit;
- }
-
qp_conf.mp_session = env->sess_pool;
- qp_conf.mp_session_private = env->sess_priv_pool;
ret = rte_cryptodev_queue_pair_setup(dev_id, 0, &qp_conf,
rte_cryptodev_socket_id(dev_id));
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e6c0b6a3a1..e73e6b09c3 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -55,7 +55,6 @@ struct cryptodev_fips_validate_env {
uint16_t mbuf_data_room;
struct rte_mempool *mpool;
struct rte_mempool *sess_mpool;
- struct rte_mempool *sess_priv_mpool;
struct rte_mempool *op_pool;
struct rte_mbuf *mbuf;
uint8_t *digest;
@@ -70,7 +69,7 @@ static int
cryptodev_fips_validate_app_int(void)
{
struct rte_cryptodev_config conf = {rte_socket_id(), 1, 0};
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
struct rte_cryptodev_info dev_info;
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
env.dev_id);
@@ -110,16 +109,11 @@ cryptodev_fips_validate_app_int(void)
ret = -ENOMEM;
env.sess_mpool = rte_cryptodev_sym_session_pool_create(
- "FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+ "FIPS_SESS_MEMPOOL", 16, sess_sz, 0, 0,
+ rte_socket_id());
if (!env.sess_mpool)
goto error_exit;
- env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
- 16, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_socket_id(), 0);
- if (!env.sess_priv_mpool)
- goto error_exit;
-
env.op_pool = rte_crypto_op_pool_create(
"FIPS_OP_POOL",
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -134,7 +128,6 @@ cryptodev_fips_validate_app_int(void)
goto error_exit;
qp_conf.mp_session = env.sess_mpool;
- qp_conf.mp_session_private = env.sess_priv_mpool;
ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
rte_socket_id());
@@ -151,7 +144,6 @@ cryptodev_fips_validate_app_int(void)
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
return ret;
@@ -162,11 +154,9 @@ cryptodev_fips_validate_app_uninit(void)
{
rte_pktmbuf_free(env.mbuf);
rte_crypto_op_free(env.op);
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
}
@@ -1202,13 +1192,9 @@ fips_run_test(void)
if (ret < 0)
return ret;
- env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
- if (!env.sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(env.dev_id,
- env.sess, &xform, env.sess_priv_mpool);
- if (ret < 0) {
+ env.sess = rte_cryptodev_sym_session_create(env.dev_id, &xform,
+ env.sess_mpool);
+ if (!env.sess) {
RTE_LOG(ERR, USER1, "Error %i: Init session\n",
ret);
goto exit;
@@ -1237,9 +1223,10 @@ fips_run_test(void)
vec.status = env.op->status;
exit:
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
- env.sess = NULL;
+ if (env.sess) {
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
+ env.sess = NULL;
+ }
return ret;
}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a4ac4174ba..338fbe6236 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1693,8 +1693,6 @@ cryptodevs_init(uint16_t req_queue_num)
qp_conf.nb_descriptors = qp_desc_nb;
qp_conf.mp_session =
socket_ctx[dev_conf.socket_id].session_pool;
- qp_conf.mp_session_private =
- socket_ctx[dev_conf.socket_id].session_priv_pool;
for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
&qp_conf, dev_conf.socket_id))
@@ -2501,12 +2499,8 @@ one_session_free(struct rte_ipsec_session *ips)
if (ips->crypto.ses == NULL)
return 0;
- ret = rte_cryptodev_sym_session_clear(ips->crypto.dev_id,
- ips->crypto.ses);
- if (ret)
- return ret;
-
- ret = rte_cryptodev_sym_session_free(ips->crypto.ses);
+ ret = rte_cryptodev_sym_session_free(ips->crypto.dev_id,
+ ips->crypto.ses);
} else {
/* Session has not been created */
if (ips->security.ctx == NULL || ips->security.ses == NULL)
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 7b7bfff696..bb84dcec7e 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -174,11 +174,8 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[],
}
ips->crypto.dev_id = cdev_id;
- ips->crypto.ses = rte_cryptodev_sym_session_create(
- skt_ctx->session_pool);
- rte_cryptodev_sym_session_init(cdev_id,
- ips->crypto.ses, sa->xforms,
- skt_ctx->session_priv_pool);
+ ips->crypto.ses = rte_cryptodev_sym_session_create(cdev_id,
+ sa->xforms, skt_ctx->session_pool);
rte_cryptodev_info_get(cdev_id, &cdev_info);
}
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index bf4b862379..b555e63ff6 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -228,7 +228,6 @@ struct rte_mempool *l2fwd_pktmbuf_pool;
struct rte_mempool *l2fwd_crypto_op_pool;
static struct {
struct rte_mempool *sess_mp;
- struct rte_mempool *priv_mp;
} session_pool_socket[RTE_MAX_NUMA_NODES];
/* Per-port statistics struct */
@@ -675,7 +674,6 @@ static struct rte_cryptodev_sym_session *
initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
{
struct rte_crypto_sym_xform *first_xform;
- struct rte_cryptodev_sym_session *session;
int retval = rte_cryptodev_socket_id(cdev_id);
if (retval < 0)
@@ -697,17 +695,8 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
first_xform = &options->auth_xform;
}
- session = rte_cryptodev_sym_session_create(
+ return rte_cryptodev_sym_session_create(cdev_id, first_xform,
session_pool_socket[socket_id].sess_mp);
- if (session == NULL)
- return NULL;
-
- if (rte_cryptodev_sym_session_init(cdev_id, session,
- first_xform,
- session_pool_socket[socket_id].priv_mp) < 0)
- return NULL;
-
- return session;
}
/* >8 End of creation of session. */
@@ -2380,13 +2369,10 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
rte_cryptodev_info_get(cdev_id, &dev_info);
- /*
- * Two sessions objects are required for each session
- * (one for the header, one for the private data)
- */
if (!strcmp(dev_info.driver_name, "crypto_scheduler")) {
#ifdef RTE_CRYPTO_SCHEDULER
- uint32_t nb_workers =
+ /* scheduler session header + 1 session per worker */
+ uint32_t nb_workers = 1 +
rte_cryptodev_scheduler_workers_get(cdev_id,
NULL);
@@ -2395,41 +2381,15 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
} else
sessions_needed = enabled_cdev_count;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- char mp_name[RTE_MEMPOOL_NAMESIZE];
-
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- session_pool_socket[socket_id].priv_mp =
- rte_mempool_create(mp_name,
- sessions_needed,
- max_sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- printf("Cannot create pool on socket %d\n",
- socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
char mp_name[RTE_MEMPOOL_NAMESIZE];
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
session_pool_socket[socket_id].sess_mp =
- rte_cryptodev_sym_session_pool_create(
- mp_name,
- sessions_needed,
- 0, 0, 0, socket_id);
-
+ rte_cryptodev_sym_session_pool_create(
+ mp_name, sessions_needed, max_sess_sz,
+ 0, 0, socket_id);
if (session_pool_socket[socket_id].sess_mp == NULL) {
printf("Cannot create pool on socket %d\n",
socket_id);
@@ -2580,8 +2540,6 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
qp_conf.nb_descriptors = 2048;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 7d75623a5e..02987ebd76 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,7 +46,6 @@ struct vhost_crypto_info {
int vids[MAX_NB_SOCKETS];
uint32_t nb_vids;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *cop_pool;
uint8_t cid;
uint32_t qid;
@@ -304,7 +303,6 @@ new_device(int vid)
}
ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
- info->sess_priv_pool,
rte_lcore_to_socket_id(options.los[i].lcore_id));
if (ret) {
RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -458,7 +456,6 @@ free_resource(void)
rte_mempool_free(info->cop_pool);
rte_mempool_free(info->sess_pool);
- rte_mempool_free(info->sess_priv_pool);
for (j = 0; j < lo->nb_sockets; j++) {
rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -544,16 +541,12 @@ main(int argc, char *argv[])
snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- SESSION_MAP_ENTRIES, 0, 0, 0,
- rte_lcore_to_socket_id(lo->lcore_id));
-
- snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
- info->sess_priv_pool = rte_mempool_create(name,
SESSION_MAP_ENTRIES,
rte_cryptodev_sym_get_private_session_size(
- info->cid), 64, 0, NULL, NULL, NULL, NULL,
- rte_lcore_to_socket_id(lo->lcore_id), 0);
- if (!info->sess_priv_pool || !info->sess_pool) {
+ info->cid), 0, 0,
+ rte_lcore_to_socket_id(lo->lcore_id));
+
+ if (!info->sess_pool) {
RTE_LOG(ERR, USER1, "Failed to create mempool");
goto error_exit;
}
@@ -574,7 +567,6 @@ main(int argc, char *argv[])
qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
qp_conf.mp_session = info->sess_pool;
- qp_conf.mp_session_private = info->sess_priv_pool;
for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
ret = rte_cryptodev_queue_pair_setup(info->cid, j,
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 09ba952455..8aa4fe4648 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -302,7 +302,6 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
* @param dev Crypto device pointer
* @param xform Single or chain of crypto xforms
* @param session Pointer to cryptodev's private session structure
- * @param mp Mempool where the private session is allocated
*
* @return
* - Returns 0 if private session structure have been created successfully.
@@ -312,8 +311,8 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
*/
typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
+
/**
* Configure a Crypto asymmetric session on a device.
*
@@ -338,6 +337,7 @@ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev,
*/
typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
+
/**
* Clear asymmetric session private data.
*
@@ -638,28 +638,6 @@ __rte_internal
void *
rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op);
-static inline void *
-get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id) {
- if (unlikely(sess->nb_drivers <= driver_id))
- return NULL;
-
- return sess->sess_data[driver_id].data;
-}
-
-static inline void
-set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id, void *private_data)
-{
- if (unlikely(sess->nb_drivers <= driver_id)) {
- CDEV_LOG_ERR("Set private data for driver %u not allowed",
- driver_id);
- return;
- }
-
- sess->sess_data[driver_id].data = private_data;
-}
-
/**
* @internal
* Cryptodev asymmetric crypto session.
diff --git a/lib/cryptodev/cryptodev_trace_points.c b/lib/cryptodev/cryptodev_trace_points.c
index 9f0ed904ea..727114aa45 100644
--- a/lib/cryptodev/cryptodev_trace_points.c
+++ b/lib/cryptodev/cryptodev_trace_points.c
@@ -39,12 +39,6 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_free,
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_session_free,
lib.cryptodev.asym.free)
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_init,
- lib.cryptodev.sym.init)
-
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_clear,
- lib.cryptodev.sym.clear)
-
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_enqueue_burst,
lib.cryptodev.enq.burst)
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 9e76a1c72d..6acd5f4d91 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -203,12 +203,9 @@ const char *rte_crypto_asym_ke_strings[] = {
[RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY] = "pub_ec_key_verify"
};
-/**
- * The private data structure stored in the sym session mempool private data.
- */
struct rte_cryptodev_sym_session_pool_private_data {
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint16_t sess_data_sz;
+ /**< driver session data size */
uint16_t user_data_sz;
/**< session user data will be placed after sess_data */
};
@@ -1332,6 +1329,24 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
return ret;
}
+static uint8_t
+rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp,
+ uint32_t sess_priv_size)
+{
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (!mp)
+ return 0;
+
+ pool_priv = rte_mempool_get_priv(mp);
+
+ if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
+ pool_priv->sess_data_sz < sess_priv_size)
+ return 0;
+
+ return 1;
+}
+
int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
@@ -1355,17 +1370,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
- (!qp_conf->mp_session && qp_conf->mp_session_private)) {
- CDEV_LOG_ERR("Invalid mempools");
- return -EINVAL;
- }
-
if (qp_conf->mp_session) {
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
- uint32_t obj_size = qp_conf->mp_session->elt_size;
- uint32_t obj_priv_size = qp_conf->mp_session_private->elt_size;
- struct rte_cryptodev_sym_session s = {0};
pool_priv = rte_mempool_get_priv(qp_conf->mp_session);
if (!pool_priv || qp_conf->mp_session->private_data_size <
@@ -1374,13 +1380,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- s.nb_drivers = pool_priv->nb_drivers;
- s.user_data_sz = pool_priv->user_data_sz;
-
- if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
- obj_size) || (s.nb_drivers <= dev->driver_id) ||
- rte_cryptodev_sym_get_private_session_size(dev_id) >
- obj_priv_size) {
+ if (!rte_cryptodev_sym_is_valid_session_pool(qp_conf->mp_session,
+ rte_cryptodev_sym_get_private_session_size(dev_id))) {
CDEV_LOG_ERR("Invalid mempool");
return -EINVAL;
}
@@ -1862,54 +1863,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
rte_spinlock_unlock(&rte_cryptodev_cb_lock);
}
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mp)
-{
- struct rte_cryptodev *dev;
- uint32_t sess_priv_sz = rte_cryptodev_sym_get_private_session_size(
- dev_id);
- uint8_t index;
- int ret;
-
- if (!rte_cryptodev_is_valid_dev(dev_id)) {
- CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
- return -EINVAL;
- }
-
- dev = rte_cryptodev_pmd_get_dev(dev_id);
-
- if (sess == NULL || xforms == NULL || dev == NULL || mp == NULL)
- return -EINVAL;
-
- if (mp->elt_size < sess_priv_sz)
- return -EINVAL;
-
- index = dev->driver_id;
- if (index >= sess->nb_drivers)
- return -EINVAL;
-
- if (*dev->dev_ops->sym_session_configure == NULL)
- return -ENOTSUP;
-
- if (sess->sess_data[index].refcnt == 0) {
- ret = dev->dev_ops->sym_session_configure(dev, xforms,
- sess, mp);
- if (ret < 0) {
- CDEV_LOG_ERR(
- "dev_id %d failed to configure session details",
- dev_id);
- return ret;
- }
- }
-
- rte_cryptodev_trace_sym_session_init(dev_id, sess, xforms, mp);
- sess->sess_data[index].refcnt++;
- return 0;
-}
-
struct rte_mempool *
rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
@@ -1919,16 +1872,12 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
uint32_t obj_sz;
- obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
- if (obj_sz > elt_size)
- CDEV_LOG_INFO("elt_size %u is expanded to %u", elt_size,
- obj_sz);
- else
- obj_sz = elt_size;
+ obj_sz = sizeof(struct rte_cryptodev_sym_session) + elt_size + user_data_size;
+ obj_sz = RTE_ALIGN_CEIL(obj_sz, RTE_CACHE_LINE_SIZE);
mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
- (uint32_t)(sizeof(*pool_priv)),
- NULL, NULL, NULL, NULL,
+ (uint32_t)(sizeof(*pool_priv)), NULL, NULL,
+ NULL, NULL,
socket_id, 0);
if (mp == NULL) {
CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d",
@@ -1944,7 +1893,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
return NULL;
}
- pool_priv->nb_drivers = nb_drivers;
+ pool_priv->sess_data_sz = elt_size;
pool_priv->user_data_sz = user_data_size;
rte_cryptodev_trace_sym_session_pool_create(name, nb_elts,
@@ -2002,64 +1951,71 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
return mp;
}
-static unsigned int
-rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
-{
- return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
- sess->user_data_sz;
-}
-
-static uint8_t
-rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp)
-{
- struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
-
- if (!mp)
- return 0;
-
- pool_priv = rte_mempool_get_priv(mp);
-
- if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
- pool_priv->nb_drivers != nb_drivers ||
- mp->elt_size <
- rte_cryptodev_sym_get_header_session_size()
- + pool_priv->user_data_sz)
- return 0;
-
- return 1;
-}
-
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mp)
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp)
{
+ struct rte_cryptodev *dev;
struct rte_cryptodev_sym_session *sess;
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+ uint32_t sess_priv_sz;
+ int ret;
- if (!rte_cryptodev_sym_is_valid_session_pool(mp)) {
+ if (!rte_cryptodev_is_valid_dev(dev_id)) {
+ CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
+ if (xforms == NULL) {
+ CDEV_LOG_ERR("Invalid xform\n");
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
+ sess_priv_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
+ if (!rte_cryptodev_sym_is_valid_session_pool(mp, sess_priv_sz)) {
CDEV_LOG_ERR("Invalid mempool");
+ rte_errno = EINVAL;
return NULL;
}
- pool_priv = rte_mempool_get_priv(mp);
+ dev = rte_cryptodev_pmd_get_dev(dev_id);
/* Allocate a session structure from the session pool */
if (rte_mempool_get(mp, (void **)&sess)) {
CDEV_LOG_ERR("couldn't get object from session mempool");
+ rte_errno = ENOMEM;
return NULL;
}
- sess->nb_drivers = pool_priv->nb_drivers;
+ pool_priv = rte_mempool_get_priv(mp);
+ sess->driver_id = dev->driver_id;
+ sess->sess_data_sz = pool_priv->sess_data_sz;
sess->user_data_sz = pool_priv->user_data_sz;
- sess->opaque_data = 0;
+ sess->driver_priv_data_iova = rte_mempool_virt2iova(sess) +
+ offsetof(struct rte_cryptodev_sym_session, driver_priv_data);
- /* Clear device session pointer.
- * Include the flag indicating presence of user data
- */
- memset(sess->sess_data, 0,
- rte_cryptodev_sym_session_data_size(sess));
+ if (dev->dev_ops->sym_session_configure == NULL) {
+ rte_errno = ENOTSUP;
+ goto error_exit;
+ }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz + pool_priv->user_data_sz);
- rte_cryptodev_trace_sym_session_create(mp, sess);
- return sess;
+ ret = dev->dev_ops->sym_session_configure(dev, xforms, sess);
+ if (ret < 0) {
+ rte_errno = -ret;
+ goto error_exit;
+ }
+ sess->driver_id = dev->driver_id;
+
+ rte_cryptodev_trace_sym_session_create(dev_id, sess, xforms, mp);
+
+ return (void *)sess;
+error_exit:
+ rte_mempool_put(mp, (void *)sess);
+ return NULL;
}
int
@@ -2139,11 +2095,15 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
}
int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_cryptodev *dev;
- uint8_t driver_id;
+ struct rte_mempool *sess_mp;
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (sess == NULL)
+ return -EINVAL;
if (!rte_cryptodev_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
@@ -2155,41 +2115,28 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
if (dev == NULL || sess == NULL)
return -EINVAL;
- driver_id = dev->driver_id;
- if (sess->sess_data[driver_id].refcnt == 0)
- return 0;
- if (--sess->sess_data[driver_id].refcnt != 0)
- return -EBUSY;
+ sess_mp = rte_mempool_from_obj(sess);
+ if (!sess_mp)
+ return -EINVAL;
+ pool_priv = rte_mempool_get_priv(sess_mp);
+
+ if (sess->driver_id != dev->driver_id) {
+ CDEV_LOG_ERR("Session created by driver %u but freed by %u",
+ sess->driver_id, dev->driver_id);
+ return -EINVAL;
+ }
if (*dev->dev_ops->sym_session_clear == NULL)
return -ENOTSUP;
dev->dev_ops->sym_session_clear(dev, sess);
- rte_cryptodev_trace_sym_session_clear(dev_id, sess);
- return 0;
-}
-
-int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
-{
- uint8_t i;
- struct rte_mempool *sess_mp;
-
- if (sess == NULL)
- return -EINVAL;
-
- /* Check that all device private data has been freed */
- for (i = 0; i < sess->nb_drivers; i++) {
- if (sess->sess_data[i].refcnt != 0)
- return -EBUSY;
- }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz + pool_priv->user_data_sz);
/* Return session to mempool */
- sess_mp = rte_mempool_from_obj(sess);
rte_mempool_put(sess_mp, sess);
- rte_cryptodev_trace_sym_session_free(sess);
+ rte_cryptodev_trace_sym_session_free(dev_id, sess);
return 0;
}
@@ -2224,33 +2171,6 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
return 0;
}
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void)
-{
- /*
- * Header contains pointers to the private data of all registered
- * drivers and all necessary information to ensure safely clear
- * or free al session.
- */
- struct rte_cryptodev_sym_session s = {0};
-
- s.nb_drivers = nb_drivers;
-
- return (unsigned int)(sizeof(s) +
- rte_cryptodev_sym_session_data_size(&s));
-}
-
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess)
-{
- if (!sess)
- return 0;
- else
- return (unsigned int)(sizeof(*sess) +
- rte_cryptodev_sym_session_data_size(sess));
-}
-
unsigned int
rte_cryptodev_asym_get_header_session_size(void)
{
@@ -2303,9 +2223,8 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
int
rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess,
- void *data,
- uint16_t size)
+ struct rte_cryptodev_sym_session *sess, void *data,
+ uint16_t size)
{
if (sess == NULL)
return -EINVAL;
@@ -2313,7 +2232,7 @@ rte_cryptodev_sym_session_set_user_data(
if (sess->user_data_sz < size)
return -ENOMEM;
- rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
+ rte_memcpy(sess->driver_priv_data + sess->sess_data_sz, data, size);
rte_cryptodev_trace_sym_session_set_user_data(sess, data, size);
@@ -2321,15 +2240,14 @@ rte_cryptodev_sym_session_set_user_data(
}
void *
-rte_cryptodev_sym_session_get_user_data(
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_get_user_data(struct rte_cryptodev_sym_session *sess)
{
void *data = NULL;
if (sess == NULL || sess->user_data_sz == 0)
return NULL;
- data = (void *)(sess->sess_data + sess->nb_drivers);
+ data = (void *)(sess->driver_priv_data + sess->sess_data_sz);
rte_cryptodev_trace_sym_session_get_user_data(sess, data);
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56f459c6a0..0c65958f25 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -544,8 +544,6 @@ struct rte_cryptodev_qp_conf {
uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
struct rte_mempool *mp_session;
/**< The mempool for creating session in sessionless mode */
- struct rte_mempool *mp_session_private;
- /**< The mempool for creating sess private data in sessionless mode */
};
/**
@@ -909,17 +907,21 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id);
* has a fixed algo, key, op-type, digest_len etc.
*/
struct rte_cryptodev_sym_session {
+ RTE_MARKER cacheline0;
+ uint8_t driver_id;
uint64_t opaque_data;
/**< Can be used for external metadata */
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint32_t sess_data_sz;
+ /**< Pointer to the user data stored after sess data */
uint16_t user_data_sz;
- /**< session user data will be placed after sess_data */
- __extension__ struct {
- void *data;
- uint16_t refcnt;
- } sess_data[];
- /**< Driver specific session material, variable size */
+ /**< session user data will be placed after sess data */
+ rte_iova_t driver_priv_data_iova;
+ /**< session driver data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ /**< second cache line - start of the driver session data */
+ uint8_t driver_priv_data[0];
+ /**< Driver specific session data, variable size */
};
/**
@@ -954,6 +956,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
int socket_id);
+
/**
* Create an asymmetric session mempool.
*
@@ -980,17 +983,22 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t cache_size, uint16_t user_data_size, int socket_id);
/**
- * Create symmetric crypto session header (generic with no private data)
+ * Create symmetric crypto session and fill out private data for the device id,
+ * based on its device type.
+ *
+ * @param dev_id ID of device that we want the session to be used on
+ * @param xforms Symmetric crypto transform operations to apply on flow
+ * processed with this session
+ * @param mempool Mempool where the private data is allocated.
*
- * @param mempool Symmetric session mempool to allocate session
- * objects from
* @return
- * - On success return pointer to sym-session
- * - On failure returns NULL
+ * - On success return pointer to sym-session.
+ * - On failure returns NULL.
*/
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
-
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp);
/**
* Create and initialise an asymmetric crypto session structure.
* Calls the PMD to configure the private session data.
@@ -1015,19 +1023,20 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
void **session);
/**
- * Frees symmetric crypto session header, after checking that all
- * the device private data has been freed, returning it
- * to its original mempool.
+ * Frees session for the device id and returning it to its mempool.
+ * It is the application's responsibility to ensure that the session
+ * is not still in-flight operations using it.
*
+ * @param dev_id ID of device that uses the session.
* @param sess Session header to be freed.
*
* @return
* - 0 if successful.
- * - -EINVAL if session is NULL.
- * - -EBUSY if not all device private data has been freed.
+ * - -EINVAL if session is NULL or the mismatched device ids.
*/
int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess);
/**
* Clears and frees asymmetric crypto session header and private data,
@@ -1044,72 +1053,6 @@ __rte_experimental
int
rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess);
-/**
- * Fill out private data for the device id, based on its device type.
- *
- * @param dev_id ID of device that we want the session to be used on
- * @param sess Session where the private data will be attached to
- * @param xforms Symmetric crypto transform operations to apply on flow
- * processed with this session
- * @param mempool Mempool where the private data is allocated.
- *
- * @return
- * - On success, zero.
- * - -EINVAL if input parameters are invalid.
- * - -ENOTSUP if crypto device does not support the crypto transform or
- * does not support symmetric operations.
- * - -ENOMEM if the private session could not be allocated.
- */
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mempool);
-
-/**
- * Frees private data for the device id, based on its device type,
- * returning it to its mempool. It is the application's responsibility
- * to ensure that private session data is not cleared while there are
- * still in-flight operations using it.
- *
- * @param dev_id ID of device that uses the session.
- * @param sess Session containing the reference to the private data
- *
- * @return
- * - 0 if successful.
- * - -EINVAL if device is invalid or session is NULL.
- * - -ENOTSUP if crypto device does not support symmetric operations.
- */
-int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess);
-
-/**
- * Get the size of the header session, for all registered drivers excluding
- * the user data size.
- *
- * @return
- * Size of the symmetric header session.
- */
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void);
-
-/**
- * Get the size of the header session from created session.
- *
- * @param sess
- * The sym cryptodev session pointer
- *
- * @return
- * - If sess is not NULL, return the size of the header session including
- * the private data size defined within sess.
- * - If sess is NULL, return 0.
- */
-__rte_experimental
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess);
-
/**
* Get the size of the asymmetric session header.
*
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index 3d9b00145e..6ade0b72c4 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -56,7 +56,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u16(queue_pair_id);
rte_trace_point_emit_u32(conf->nb_descriptors);
rte_trace_point_emit_ptr(conf->mp_session);
- rte_trace_point_emit_ptr(conf->mp_session_private);
)
RTE_TRACE_POINT(
@@ -74,13 +73,16 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_create,
- RTE_TRACE_POINT_ARGS(void *mempool,
- struct rte_cryptodev_sym_session *sess),
- rte_trace_point_emit_ptr(mempool);
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess, void *xforms,
+ void *mempool),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
+ rte_trace_point_emit_u8(sess->driver_id);
rte_trace_point_emit_u16(sess->user_data_sz);
+ rte_trace_point_emit_ptr(xforms);
+ rte_trace_point_emit_ptr(mempool);
)
RTE_TRACE_POINT(
@@ -106,7 +108,8 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_free,
- RTE_TRACE_POINT_ARGS(struct rte_cryptodev_sym_session *sess),
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id, struct rte_cryptodev_sym_session *sess),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
)
@@ -117,27 +120,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_ptr(sess);
)
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_init,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, void *xforms,
- void *mempool),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
- rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
- rte_trace_point_emit_u16(sess->user_data_sz);
- rte_trace_point_emit_ptr(xforms);
- rte_trace_point_emit_ptr(mempool);
-)
-
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_clear,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id, void *sess),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
-)
-
RTE_TRACE_POINT(
rte_cryptodev_trace_callback_register,
RTE_TRACE_POINT_ARGS(uint8_t dev_id,
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 6d9b3e01a6..d9ccb10197 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -38,12 +38,9 @@ DPDK_23 {
rte_cryptodev_sym_capability_check_auth;
rte_cryptodev_sym_capability_check_cipher;
rte_cryptodev_sym_capability_get;
- rte_cryptodev_sym_get_header_session_size;
rte_cryptodev_sym_get_private_session_size;
- rte_cryptodev_sym_session_clear;
rte_cryptodev_sym_session_create;
rte_cryptodev_sym_session_free;
- rte_cryptodev_sym_session_init;
local: *;
};
@@ -60,7 +57,6 @@ EXPERIMENTAL {
rte_cryptodev_asym_xform_capability_check_modlen;
rte_cryptodev_asym_xform_capability_check_optype;
rte_cryptodev_sym_cpu_crypto_process;
- rte_cryptodev_sym_get_existing_header_session_size;
rte_cryptodev_sym_session_get_user_data;
rte_cryptodev_sym_session_pool_create;
rte_cryptodev_sym_session_set_user_data;
@@ -78,8 +74,6 @@ EXPERIMENTAL {
__rte_cryptodev_trace_asym_session_create;
__rte_cryptodev_trace_sym_session_free;
__rte_cryptodev_trace_asym_session_free;
- __rte_cryptodev_trace_sym_session_init;
- __rte_cryptodev_trace_sym_session_clear;
__rte_cryptodev_trace_dequeue_burst;
__rte_cryptodev_trace_enqueue_burst;
diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c
index b1310be565..cb792bbe0d 100644
--- a/lib/pipeline/rte_table_action.c
+++ b/lib/pipeline/rte_table_action.c
@@ -1898,17 +1898,11 @@ sym_crypto_apply(struct sym_crypto_data *data,
}
}
- session = rte_cryptodev_sym_session_create(cfg->mp_create);
+ session = rte_cryptodev_sym_session_create(cfg->cryptodev_id,
+ p->xform, cfg->mp_create);
if (!session)
return -ENOMEM;
- ret = rte_cryptodev_sym_session_init(cfg->cryptodev_id, session,
- p->xform, cfg->mp_init);
- if (ret < 0) {
- rte_cryptodev_sym_session_free(session);
- return ret;
- }
-
data->data_offset = (uint16_t)p->data_offset;
data->session = session;
diff --git a/lib/vhost/rte_vhost_crypto.h b/lib/vhost/rte_vhost_crypto.h
index b49e389579..2b01ecda08 100644
--- a/lib/vhost/rte_vhost_crypto.h
+++ b/lib/vhost/rte_vhost_crypto.h
@@ -54,8 +54,6 @@ rte_vhost_crypto_driver_start(const char *path);
* multiple Vhost-crypto devices.
* @param sess_pool
* The pointer to the created cryptodev session pool.
- * @param sess_priv_pool
- * The pointer to the created cryptodev session private data mempool.
* @param socket_id
* NUMA Socket ID to allocate resources on. *
* @return
@@ -65,7 +63,6 @@ rte_vhost_crypto_driver_start(const char *path);
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id);
/**
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 54946f46d9..7321da21b7 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -197,7 +197,6 @@ struct vhost_crypto {
struct rte_hash *session_map;
struct rte_mempool *mbuf_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *wb_pool;
/** DPDK cryptodev ID */
@@ -376,31 +375,21 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
return;
}
- session = rte_cryptodev_sym_session_create(vcrypto->sess_pool);
+ session = rte_cryptodev_sym_session_create(vcrypto->cid, &xform1,
+ vcrypto->sess_pool);
if (!session) {
VC_LOG_ERR("Failed to create session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
- if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
- vcrypto->sess_priv_pool) < 0) {
- VC_LOG_ERR("Failed to initialize session");
- sess_param->session_id = -VIRTIO_CRYPTO_ERR;
- return;
- }
-
/* insert hash to map */
if (rte_hash_add_key_data(vcrypto->session_map,
&vcrypto->last_session_id, session) < 0) {
VC_LOG_ERR("Failed to insert session to hash table");
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0)
- VC_LOG_ERR("Failed to clear session");
- else {
- if (rte_cryptodev_sym_session_free(session) < 0)
- VC_LOG_ERR("Failed to free session");
- }
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0)
+ VC_LOG_ERR("Failed to free session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
@@ -427,12 +416,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
return -VIRTIO_CRYPTO_INVSESS;
}
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
- VC_LOG_DBG("Failed to clear session");
- return -VIRTIO_CRYPTO_ERR;
- }
-
- if (rte_cryptodev_sym_session_free(session) < 0) {
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0) {
VC_LOG_DBG("Failed to free session");
return -VIRTIO_CRYPTO_ERR;
}
@@ -1393,7 +1377,6 @@ rte_vhost_crypto_driver_start(const char *path)
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id)
{
struct virtio_net *dev = get_device(vid);
@@ -1415,7 +1398,6 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
}
vcrypto->sess_pool = sess_pool;
- vcrypto->sess_priv_pool = sess_priv_pool;
vcrypto->cid = cryptodev_id;
vcrypto->cache_session_id = UINT64_MAX;
vcrypto->last_session_id = 1;
--
2.25.1
^ permalink raw reply [relevance 1%]
* Re: [PATCH v3 1/1] ethdev: support congestion management
2022-10-04 9:02 0% ` Andrew Rybchenko
@ 2022-10-04 9:04 0% ` Andrew Rybchenko
0 siblings, 0 replies; 200+ results
From: Andrew Rybchenko @ 2022-10-04 9:04 UTC (permalink / raw)
To: skori, Ferruh Yigit, Thomas Monjalon, Ray Kinsella; +Cc: dev, Jerin Jacob
On 10/4/22 12:02, Andrew Rybchenko wrote:
> On 9/29/22 12:35, skori@marvell.com wrote:
>> From: Jerin Jacob <jerinj@marvell.com>
>>
>> NIC HW controllers often come with congestion management support on
>> various HW objects such as Rx queue depth or mempool queue depth.
>>
>> Also, it can support various modes of operation such as RED
>> (Random early discard), WRED etc on those HW objects.
>>
>> This patch adds a framework to express such modes(enum rte_cman_mode)
>> and introduce (enum rte_eth_cman_obj) to enumerate the different
>> objects where the modes can operate on.
>>
>> This patch adds RTE_CMAN_RED mode of operation and
>
> This patch adds -> Add
>
>> RTE_ETH_CMAN_OBJ_RX_QUEUE, RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL object.
>>
>> Introduced reserved fields in configuration structure
>
> Introduce
>
>> backed by rte_eth_cman_config_init() to add new configuration
>> parameters without ABI breakage.
>>
>> Added rte_eth_cman_info_get() API to get the information such as
>
> Add
>
>> supported modes and objects.
>>
>> Added rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs
>
> Add
>
>> to configure congestion management on those object with associated mode.
>>
>> Finally, Added rte_eth_cman_config_get() API to retrieve the
>
> add
>
>> applied configuration.
>>
>> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
>> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
>
> I'll send v4 with few minor correction.
Done, but I'm sorry I forgot to specify --in-reply-to.
^ permalink raw reply [relevance 0%]
* [PATCH v4] ethdev: support congestion management
@ 2022-10-04 9:02 2% Andrew Rybchenko
2022-10-06 8:36 0% ` Andrew Rybchenko
2022-10-07 6:09 0% ` [EXT] " Sunil Kumar Kori
0 siblings, 2 replies; 200+ results
From: Andrew Rybchenko @ 2022-10-04 9:02 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon, Ray Kinsella
Cc: dev, Jerin Jacob, Sunil Kumar Kori
From: Jerin Jacob <jerinj@marvell.com>
NIC HW controllers often come with congestion management support on
various HW objects such as Rx queue depth or mempool queue depth.
Also, it can support various modes of operation such as RED
(Random early discard), WRED etc on those HW objects.
Add a framework to express such modes(enum rte_cman_mode) and
introduce (enum rte_eth_cman_obj) to enumerate the different
objects where the modes can operate on.
Add RTE_CMAN_RED mode of operation and RTE_ETH_CMAN_OBJ_RX_QUEUE,
RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL objects.
Introduce reserved fields in configuration structure
backed by rte_eth_cman_config_init() to add new configuration
parameters without ABI breakage.
Add rte_eth_cman_info_get() API to get the information such as
supported modes and objects.
Add rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs
to configure congestion management on those object with associated mode.
Finally, add rte_eth_cman_config_get() API to retrieve the
applied configuration.
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
v3..v4: Andrew Rybchenko
- rebase
- remove eth_check_err() and use eth_err() instead
- minor fixes in description to avoid "This patch" and "Added".
- correct position in release notes
v2..v3:
- Rename rte_cman.c to rte_ethdev_cman.c
- Move lib/eal/include/rte_cman.h to lib/ethdev/rte_cman.h
- Fix review comments (Andrew Rybchenko)
- Add release notes
v1..v2:
- Fix review comments (Akhil Goyal)
rfc..v1:
- Added RED specification (http://www.aciri.org/floyd/papers/red/red.html) link
- Fixed doxygen comment issue (Min Hu)
doc/guides/nics/features.rst | 12 ++
doc/guides/nics/features/default.ini | 1 +
doc/guides/rel_notes/release_22_11.rst | 6 +
lib/ethdev/ethdev_driver.h | 25 ++++
lib/ethdev/ethdev_private.h | 3 +
lib/ethdev/meson.build | 2 +
lib/ethdev/rte_cman.h | 55 +++++++++
lib/ethdev/rte_ethdev.c | 2 +-
lib/ethdev/rte_ethdev.h | 164 +++++++++++++++++++++++++
lib/ethdev/rte_ethdev_cman.c | 101 +++++++++++++++
lib/ethdev/version.map | 4 +
11 files changed, 374 insertions(+), 1 deletion(-)
create mode 100644 lib/ethdev/rte_cman.h
create mode 100644 lib/ethdev/rte_ethdev_cman.c
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index b4a8e9881c..70ca46e651 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -727,6 +727,18 @@ Supports configuring per-queue stat counter mapping.
``rte_eth_dev_set_tx_queue_stats_mapping()``.
+.. _nic_features_congestion_management:
+
+Congestion management
+---------------------
+
+Supports congestion management.
+
+* **[implements] eth_dev_ops**: ``cman_info_get``, ``cman_config_set``, ``cman_config_get``.
+* **[related] API**: ``rte_eth_cman_info_get()``, ``rte_eth_cman_config_init()``,
+ ``rte_eth_cman_config_set()``, ``rte_eth_cman_config_get()``.
+
+
.. _nic_features_fw_version:
FW version
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index f7192cb0da..a9c0008ebd 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -60,6 +60,7 @@ Tx descriptor status =
Basic stats =
Extended stats =
Stats per queue =
+Congestion management =
FW version =
EEPROM dump =
Module EEPROM dump =
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 44f9a30c6a..0ffa004a9e 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -78,6 +78,12 @@ New Features
Added new rte_flow action which allows application to re-route packets
directly to the kernel without software involvement.
+* **Added support for congestion management for ethdev.**
+
+ Added new APIs ``rte_eth_cman_config_init()``, ``rte_eth_cman_config_get()``,
+ ``rte_eth_cman_config_set()``, ``rte_eth_cman_info_get()``
+ to support congestion management.
+
* **Updated Intel iavf driver.**
* Added flow subscription support.
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 8cd8eb8685..e1e2d10a35 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -1094,6 +1094,22 @@ typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
uint16_t *rx_queue_id,
uint8_t *avail_thresh);
+/** @internal Get congestion management information. */
+typedef int (*eth_cman_info_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_cman_info *info);
+
+/** @internal Init congestion management structure with default values. */
+typedef int (*eth_cman_config_init_t)(struct rte_eth_dev *dev,
+ struct rte_eth_cman_config *config);
+
+/** @internal Configure congestion management on a port. */
+typedef int (*eth_cman_config_set_t)(struct rte_eth_dev *dev,
+ const struct rte_eth_cman_config *config);
+
+/** @internal Retrieve congestion management configuration of a port. */
+typedef int (*eth_cman_config_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_cman_config *config);
+
/**
* @internal A structure containing the functions exported by an Ethernet driver.
*/
@@ -1309,6 +1325,15 @@ struct eth_dev_ops {
eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
/** Query Rx queue available descriptors threshold event */
eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
+
+ /** Get congestion management information */
+ eth_cman_info_get_t cman_info_get;
+ /** Initialize congestion management structure with default values */
+ eth_cman_config_init_t cman_config_init;
+ /** Configure congestion management */
+ eth_cman_config_set_t cman_config_set;
+ /** Retrieve congestion management configuration */
+ eth_cman_config_get_t cman_config_get;
};
/**
diff --git a/lib/ethdev/ethdev_private.h b/lib/ethdev/ethdev_private.h
index cc9879907c..acb4b335c8 100644
--- a/lib/ethdev/ethdev_private.h
+++ b/lib/ethdev/ethdev_private.h
@@ -37,6 +37,9 @@ struct rte_eth_dev_callback {
extern rte_spinlock_t eth_dev_cb_lock;
+/* Convert all error to -EIO if device is removed. */
+int eth_err(uint16_t port_id, int ret);
+
/*
* Convert rte_eth_dev pointer to port ID.
* NULL will be translated to RTE_MAX_ETHPORTS.
diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
index 47bb2625b0..39250b5da1 100644
--- a/lib/ethdev/meson.build
+++ b/lib/ethdev/meson.build
@@ -8,6 +8,7 @@ sources = files(
'ethdev_trace_points.c',
'rte_class_eth.c',
'rte_ethdev.c',
+ 'rte_ethdev_cman.c',
'rte_flow.c',
'rte_mtr.c',
'rte_tm.c',
@@ -19,6 +20,7 @@ sources = files(
)
headers = files(
+ 'rte_cman.h',
'rte_ethdev.h',
'rte_ethdev_trace.h',
'rte_ethdev_trace_fp.h',
diff --git a/lib/ethdev/rte_cman.h b/lib/ethdev/rte_cman.h
new file mode 100644
index 0000000000..297db8e095
--- /dev/null
+++ b/lib/ethdev/rte_cman.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2022 Marvell International Ltd.
+ */
+
+#ifndef RTE_CMAN_H
+#define RTE_CMAN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bitops.h>
+
+/**
+ * @file
+ * Congestion management related parameters for DPDK.
+ */
+
+/** Congestion management modes */
+enum rte_cman_mode {
+ /**
+ * Congestion based on Random Early Detection.
+ *
+ * https://en.wikipedia.org/wiki/Random_early_detection
+ * http://www.aciri.org/floyd/papers/red/red.html
+ * @see struct rte_cman_red_params
+ */
+ RTE_CMAN_RED = RTE_BIT32(0),
+};
+
+/**
+ * RED based congestion management configuration parameters.
+ */
+struct rte_cman_red_params {
+ /**
+ * Minimum threshold (min_th) value
+ *
+ * Value expressed as percentage. Value must be in 0 to 100(inclusive).
+ */
+ uint8_t min_th;
+ /**
+ * Maximum threshold (max_th) value
+ *
+ * Value expressed as percentage. Value must be in 0 to 100(inclusive).
+ */
+ uint8_t max_th;
+ /** Inverse of packet marking probability maximum value (maxp = 1 / maxp_inv) */
+ uint16_t maxp_inv;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_CMAN_H */
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 0c2c1088c0..e4eb17221b 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -642,7 +642,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
return -ENODEV;
}
-static int
+int
eth_err(uint16_t port_id, int ret)
{
if (ret == 0)
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index a21f58b9cd..8df1cdfad0 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -160,6 +160,7 @@ extern "C" {
#define RTE_ETHDEV_DEBUG_TX
#endif
+#include <rte_cman.h>
#include <rte_compat.h>
#include <rte_log.h>
#include <rte_interrupts.h>
@@ -5314,6 +5315,169 @@ typedef struct {
__rte_experimental
int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file);
+/* Congestion management */
+
+/** Enumerate list of ethdev congestion management objects */
+enum rte_eth_cman_obj {
+ /** Congestion management based on Rx queue depth */
+ RTE_ETH_CMAN_OBJ_RX_QUEUE = RTE_BIT32(0),
+ /**
+ * Congestion management based on mempool depth associated with Rx queue
+ * @see rte_eth_rx_queue_setup()
+ */
+ RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL = RTE_BIT32(1),
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
+ *
+ * A structure used to retrieve information of ethdev congestion management.
+ */
+struct rte_eth_cman_info {
+ /**
+ * Set of supported congestion management modes
+ * @see enum rte_cman_mode
+ */
+ uint64_t modes_supported;
+ /**
+ * Set of supported congestion management objects
+ * @see enum rte_eth_cman_obj
+ */
+ uint64_t objs_supported;
+ /**
+ * Reserved for future fields. Always returned as 0 when
+ * rte_eth_cman_info_get() is invoked
+ */
+ uint8_t rsvd[8];
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
+ *
+ * A structure used to configure the ethdev congestion management.
+ */
+struct rte_eth_cman_config {
+ /** Congestion management object */
+ enum rte_eth_cman_obj obj;
+ /** Congestion management mode */
+ enum rte_cman_mode mode;
+ union {
+ /**
+ * Rx queue to configure congestion management.
+ *
+ * Valid when object is RTE_ETH_CMAN_OBJ_RX_QUEUE or
+ * RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL.
+ */
+ uint16_t rx_queue;
+ /**
+ * Reserved for future fields.
+ * It must be set to 0 when rte_eth_cman_config_set() is invoked
+ * and will be returned as 0 when rte_eth_cman_config_get() is
+ * invoked.
+ */
+ uint8_t rsvd_obj_params[4];
+ } obj_param;
+ union {
+ /**
+ * RED configuration parameters.
+ *
+ * Valid when mode is RTE_CMAN_RED.
+ */
+ struct rte_cman_red_params red;
+ /**
+ * Reserved for future fields.
+ * It must be set to 0 when rte_eth_cman_config_set() is invoked
+ * and will be returned as 0 when rte_eth_cman_config_get() is
+ * invoked.
+ */
+ uint8_t rsvd_mode_params[4];
+ } mode_param;
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Retrieve the information for ethdev congestion management
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param info
+ * A pointer to a structure of type *rte_eth_cman_info* to be filled with
+ * the information about congestion management.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if support for cman_info_get does not exist.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Initialize the ethdev congestion management configuration structure with default values.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param config
+ * A pointer to a structure of type *rte_eth_cman_config* to be initialized
+ * with default value.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if support for cman_config_init does not exist.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Configure ethdev congestion management
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param config
+ * A pointer to a structure of type *rte_eth_cman_config* to be configured.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if support for cman_config_set does not exist.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Retrieve the applied ethdev congestion management parameters for the given port.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param config
+ * A pointer to a structure of type *rte_eth_cman_config* to retrieve
+ * congestion management parameters for the given object.
+ * Application must fill all parameters except mode_param parameter in
+ * struct rte_eth_cman_config.
+ *
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if support for cman_config_get does not exist.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config);
+
#include <rte_ethdev_core.h>
/**
diff --git a/lib/ethdev/rte_ethdev_cman.c b/lib/ethdev/rte_ethdev_cman.c
new file mode 100644
index 0000000000..4a1bdd7bd0
--- /dev/null
+++ b/lib/ethdev/rte_ethdev_cman.c
@@ -0,0 +1,101 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2022 Marvell International Ltd.
+ */
+
+#include <stdint.h>
+
+#include <rte_errno.h>
+#include "rte_ethdev.h"
+#include "ethdev_driver.h"
+#include "ethdev_private.h"
+
+/* Get congestion management information for a port */
+int
+rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (info == NULL) {
+ RTE_ETHDEV_LOG(ERR, "congestion management info is NULL\n");
+ return -EINVAL;
+ }
+
+ if (dev->dev_ops->cman_info_get == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
+ return -ENOTSUP;
+ }
+
+ memset(info, 0, sizeof(struct rte_eth_cman_info));
+ return eth_err(port_id, (*dev->dev_ops->cman_info_get)(dev, info));
+}
+
+/* Initialize congestion management structure with default values */
+int
+rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (config == NULL) {
+ RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
+ return -EINVAL;
+ }
+
+ if (dev->dev_ops->cman_config_init == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
+ return -ENOTSUP;
+ }
+
+ memset(config, 0, sizeof(struct rte_eth_cman_config));
+ return eth_err(port_id, (*dev->dev_ops->cman_config_init)(dev, config));
+}
+
+/* Configure congestion management on a port */
+int
+rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (config == NULL) {
+ RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
+ return -EINVAL;
+ }
+
+ if (dev->dev_ops->cman_config_set == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
+ return -ENOTSUP;
+ }
+
+ return eth_err(port_id, (*dev->dev_ops->cman_config_set)(dev, config));
+}
+
+/* Retrieve congestion management configuration of a port */
+int
+rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (config == NULL) {
+ RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
+ return -EINVAL;
+ }
+
+ if (dev->dev_ops->cman_config_get == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
+ return -ENOTSUP;
+ }
+
+ memset(config, 0, sizeof(struct rte_eth_cman_config));
+ return eth_err(port_id, (*dev->dev_ops->cman_config_get)(dev, config));
+}
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 3651ceb234..857d21be1c 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -287,6 +287,10 @@ EXPERIMENTAL {
rte_mtr_meter_vlan_table_update;
# added in 22.11
+ rte_eth_cman_config_get;
+ rte_eth_cman_config_init;
+ rte_eth_cman_config_set;
+ rte_eth_cman_info_get;
rte_flow_async_action_handle_query;
rte_mtr_meter_policy_get;
rte_mtr_meter_profile_get;
--
2.30.2
^ permalink raw reply [relevance 2%]
* Re: [PATCH v3 1/1] ethdev: support congestion management
2022-09-29 9:35 2% ` [PATCH v3 " skori
@ 2022-10-04 9:02 0% ` Andrew Rybchenko
2022-10-04 9:04 0% ` Andrew Rybchenko
0 siblings, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-10-04 9:02 UTC (permalink / raw)
To: skori, Ferruh Yigit, Thomas Monjalon, Ray Kinsella; +Cc: dev, Jerin Jacob
On 9/29/22 12:35, skori@marvell.com wrote:
> From: Jerin Jacob <jerinj@marvell.com>
>
> NIC HW controllers often come with congestion management support on
> various HW objects such as Rx queue depth or mempool queue depth.
>
> Also, it can support various modes of operation such as RED
> (Random early discard), WRED etc on those HW objects.
>
> This patch adds a framework to express such modes(enum rte_cman_mode)
> and introduce (enum rte_eth_cman_obj) to enumerate the different
> objects where the modes can operate on.
>
> This patch adds RTE_CMAN_RED mode of operation and
This patch adds -> Add
> RTE_ETH_CMAN_OBJ_RX_QUEUE, RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL object.
>
> Introduced reserved fields in configuration structure
Introduce
> backed by rte_eth_cman_config_init() to add new configuration
> parameters without ABI breakage.
>
> Added rte_eth_cman_info_get() API to get the information such as
Add
> supported modes and objects.
>
> Added rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs
Add
> to configure congestion management on those object with associated mode.
>
> Finally, Added rte_eth_cman_config_get() API to retrieve the
add
> applied configuration.
>
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
I'll send v4 with few minor correction.
> ---
> v2..v3:
> - Rename rte_cman.c to rte_ethdev_cman.c
> - Move lib/eal/include/rte_cman.h to lib/ethdev/rte_cman.h
> - Fix review comments (Andrew Rybchenko)
> - Add release notes
>
> v1..v2:
> - Fix review comments (Akhil Goyal)
>
> rfc..v1:
> - Added RED specification (http://www.aciri.org/floyd/papers/red/red.html) link
> - Fixed doxygen comment issue (Min Hu)
>
> doc/guides/nics/features.rst | 12 ++
> doc/guides/nics/features/default.ini | 1 +
> doc/guides/rel_notes/release_22_11.rst | 6 +
> lib/ethdev/ethdev_driver.h | 25 ++++
> lib/ethdev/ethdev_private.c | 12 ++
> lib/ethdev/ethdev_private.h | 2 +
> lib/ethdev/meson.build | 2 +
> lib/ethdev/rte_cman.h | 55 +++++++++
> lib/ethdev/rte_ethdev.h | 164 +++++++++++++++++++++++++
> lib/ethdev/rte_ethdev_cman.c | 101 +++++++++++++++
> lib/ethdev/version.map | 6 +
> 11 files changed, 386 insertions(+)
> create mode 100644 lib/ethdev/rte_cman.h
> create mode 100644 lib/ethdev/rte_ethdev_cman.c
>
> diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
> index b4a8e9881c..70ca46e651 100644
> --- a/doc/guides/nics/features.rst
> +++ b/doc/guides/nics/features.rst
> @@ -727,6 +727,18 @@ Supports configuring per-queue stat counter mapping.
> ``rte_eth_dev_set_tx_queue_stats_mapping()``.
>
>
> +.. _nic_features_congestion_management:
> +
> +Congestion management
> +---------------------
> +
> +Supports congestion management.
> +
> +* **[implements] eth_dev_ops**: ``cman_info_get``, ``cman_config_set``, ``cman_config_get``.
> +* **[related] API**: ``rte_eth_cman_info_get()``, ``rte_eth_cman_config_init()``,
> + ``rte_eth_cman_config_set()``, ``rte_eth_cman_config_get()``.
> +
> +
> .. _nic_features_fw_version:
>
> FW version
> diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
> index f7192cb0da..a9c0008ebd 100644
> --- a/doc/guides/nics/features/default.ini
> +++ b/doc/guides/nics/features/default.ini
> @@ -60,6 +60,7 @@ Tx descriptor status =
> Basic stats =
> Extended stats =
> Stats per queue =
> +Congestion management =
> FW version =
> EEPROM dump =
> Module EEPROM dump =
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 0231959874..ea9908e578 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -81,6 +81,12 @@ New Features
> * Added AES-CCM support in lookaside protocol (IPsec) for CN9K & CN10K.
> * Added AES & DES DOCSIS algorithm support in lookaside crypto for CN9K.
>
> +* **Added support for congestion management for ethdev.**
> +
> + Added new APIs ``rte_eth_cman_config_init()``, ``rte_eth_cman_config_get()``,
> + ``rte_eth_cman_config_set()``, ``rte_eth_cman_info_get()``
> + to support congestion management.
> +
The position is a bit incorrect. It should go after ethdev
items.
> * **Added eventdev adapter instance get API.**
>
> * Added ``rte_event_eth_rx_adapter_instance_get`` to get Rx adapter
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 8cd8eb8685..e1e2d10a35 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -1094,6 +1094,22 @@ typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
> uint16_t *rx_queue_id,
> uint8_t *avail_thresh);
>
> +/** @internal Get congestion management information. */
> +typedef int (*eth_cman_info_get_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_info *info);
> +
> +/** @internal Init congestion management structure with default values. */
> +typedef int (*eth_cman_config_init_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_config *config);
> +
> +/** @internal Configure congestion management on a port. */
> +typedef int (*eth_cman_config_set_t)(struct rte_eth_dev *dev,
> + const struct rte_eth_cman_config *config);
> +
> +/** @internal Retrieve congestion management configuration of a port. */
> +typedef int (*eth_cman_config_get_t)(struct rte_eth_dev *dev,
> + struct rte_eth_cman_config *config);
> +
> /**
> * @internal A structure containing the functions exported by an Ethernet driver.
> */
> @@ -1309,6 +1325,15 @@ struct eth_dev_ops {
> eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
> /** Query Rx queue available descriptors threshold event */
> eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
> +
> + /** Get congestion management information */
> + eth_cman_info_get_t cman_info_get;
> + /** Initialize congestion management structure with default values */
> + eth_cman_config_init_t cman_config_init;
> + /** Configure congestion management */
> + eth_cman_config_set_t cman_config_set;
> + /** Retrieve congestion management configuration */
> + eth_cman_config_get_t cman_config_get;
> };
>
> /**
> diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c
> index 48090c879a..8787c3985e 100644
> --- a/lib/ethdev/ethdev_private.c
> +++ b/lib/ethdev/ethdev_private.c
> @@ -27,6 +27,18 @@ eth_dev_to_id(const struct rte_eth_dev *dev)
> return dev - rte_eth_devices;
> }
>
> +int32_t
> +eth_check_err(struct rte_eth_dev *dev, int ret)
> +{
> + if (ret == 0)
> + return 0;
> +
> + if (rte_eth_dev_is_removed(eth_dev_to_id(dev)))
> + return -EIO;
> +
> + return ret;
> +}
It still duplicates eth_err(). I realize the difference in the
first argument, but I think it is better to stick to eth_err().
Anyway eth_check_err() gets port_id by device and it is the
only usage of the device in the function.
[snip]
^ permalink raw reply [relevance 0%]
* Re: [PATCH v7 1/7] eal/loongarch: support LoongArch architecture
2022-10-03 17:15 4% ` David Marchand
@ 2022-10-04 8:49 0% ` zhoumin
0 siblings, 0 replies; 200+ results
From: zhoumin @ 2022-10-04 8:49 UTC (permalink / raw)
To: David Marchand
Cc: thomas, bruce.richardson, anatoly.burakov, qiming.yang,
Yuying.Zhang, jgrajcia, konstantin.v.ananyev, dev, maobibo
Hi, David,
Thanks a lot for your helpful reply.
On Tue, Oct 4, 2022 at 01:15, David Marchand wrote:
> On Fri, Sep 30, 2022 at 10:02 AM Min Zhou <zhoumin@loongson.cn> wrote:
>> Add all necessary elements for DPDK to compile and run EAL on
>> LoongArch64 Soc.
>>
>> This includes:
>>
>> - EAL library implementation for LoongArch ISA.
>> - meson build structure for 'loongarch' architecture.
>> RTE_ARCH_LOONGARCH define is added for architecture identification.
>> - xmm_t structure operation stubs as there is no vector support in
>> the current version for LoongArch.
>>
>> Compilation was tested on Debian and CentOS using loongarch64
>> cross-compile toolchain from x86 build hosts. Functions were tested
>> on Loongnix and Kylin which are two Linux distributions supported
>> LoongArch host based on Linux 4.19 maintained by Loongson
>> Corporation.
>>
>> We also tested DPDK on LoongArch with some external applications,
>> including: Pktgen-DPDK, OVS, VPP.
>>
>> The platform is currently marked as linux-only because there is no
>> other OS than Linux support LoongArch host currently.
>>
>> The i40e PMD driver is disabled on LoongArch because of the absence
>> of vector support in the current version.
>>
>> Similar to RISC-V, the compilation of following modules has been
>> disabled by this commit and will be re-enabled in later commits as
>> fixes are introduced:
>> net/ixgbe, net/memif, net/tap, example/l3fwd.
>>
>> Signed-off-by: Min Zhou <zhoumin@loongson.cn>
>> ---
>> MAINTAINERS | 6 ++
>> app/test/test_xmmt_ops.h | 12 +++
>> .../loongarch/loongarch_loongarch64_linux_gcc | 16 ++++
>> config/loongarch/meson.build | 43 +++++++++
> Please update devtools/test-meson-builds.sh in this patch.
>
> I tested the compilation of the series per patch (I caught one issue
> in net/bnxt which I posted a fix for), with this diff:
>
> @@ -260,6 +260,10 @@ build build-x86-mingw $f skipABI -Dexamples=helloworld
> f=$srcdir/config/arm/arm64_armv8_linux_gcc
> build build-arm64-generic-gcc $f ABI $use_shared
>
> +# generic LoongArch
> +f=$srcdir/config/loongarch/loongarch_loongarch64_linux_gcc
> +build build-loongarch64-generic-gcc $f ABI $use_shared
> +
> # IBM POWER
> f=$srcdir/config/ppc/ppc64le-power8-linux-gcc
> build build-ppc64-power8-gcc $f ABI $use_shared
OK, thanks. It's very helpful. I ever tried to add them, but I ran into
some problems during the test. I will add them into the v8 patchset.
>
>> doc/guides/contributing/design.rst | 2 +-
>> .../cross_build_dpdk_for_loongarch.rst | 87 +++++++++++++++++
>> doc/guides/linux_gsg/index.rst | 1 +
>> doc/guides/nics/features.rst | 8 ++
>> doc/guides/nics/features/default.ini | 1 +
>> doc/guides/rel_notes/release_22_11.rst | 7 ++
>> drivers/net/i40e/meson.build | 6 ++
>> drivers/net/ixgbe/meson.build | 6 ++
>> drivers/net/memif/meson.build | 6 ++
>> drivers/net/tap/meson.build | 6 ++
>> examples/l3fwd/meson.build | 6 ++
>> lib/eal/linux/eal_memory.c | 4 +
>> lib/eal/loongarch/include/meson.build | 18 ++++
>> lib/eal/loongarch/include/rte_atomic.h | 47 ++++++++++
>> lib/eal/loongarch/include/rte_byteorder.h | 40 ++++++++
>> lib/eal/loongarch/include/rte_cpuflags.h | 39 ++++++++
>> lib/eal/loongarch/include/rte_cycles.h | 47 ++++++++++
>> lib/eal/loongarch/include/rte_io.h | 18 ++++
>> lib/eal/loongarch/include/rte_memcpy.h | 61 ++++++++++++
>> lib/eal/loongarch/include/rte_pause.h | 24 +++++
>> .../loongarch/include/rte_power_intrinsics.h | 20 ++++
>> lib/eal/loongarch/include/rte_prefetch.h | 47 ++++++++++
>> lib/eal/loongarch/include/rte_rwlock.h | 42 +++++++++
>> lib/eal/loongarch/include/rte_spinlock.h | 64 +++++++++++++
>> lib/eal/loongarch/include/rte_vect.h | 65 +++++++++++++
>> lib/eal/loongarch/meson.build | 11 +++
>> lib/eal/loongarch/rte_cpuflags.c | 93 +++++++++++++++++++
>> lib/eal/loongarch/rte_cycles.c | 45 +++++++++
>> lib/eal/loongarch/rte_hypervisor.c | 11 +++
>> lib/eal/loongarch/rte_power_intrinsics.c | 53 +++++++++++
>> meson.build | 2 +
>> 35 files changed, 963 insertions(+), 1 deletion(-)
>> create mode 100644 config/loongarch/loongarch_loongarch64_linux_gcc
>> create mode 100644 config/loongarch/meson.build
>> create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
>> create mode 100644 lib/eal/loongarch/include/meson.build
>> create mode 100644 lib/eal/loongarch/include/rte_atomic.h
>> create mode 100644 lib/eal/loongarch/include/rte_byteorder.h
>> create mode 100644 lib/eal/loongarch/include/rte_cpuflags.h
>> create mode 100644 lib/eal/loongarch/include/rte_cycles.h
>> create mode 100644 lib/eal/loongarch/include/rte_io.h
>> create mode 100644 lib/eal/loongarch/include/rte_memcpy.h
>> create mode 100644 lib/eal/loongarch/include/rte_pause.h
>> create mode 100644 lib/eal/loongarch/include/rte_power_intrinsics.h
>> create mode 100644 lib/eal/loongarch/include/rte_prefetch.h
>> create mode 100644 lib/eal/loongarch/include/rte_rwlock.h
>> create mode 100644 lib/eal/loongarch/include/rte_spinlock.h
>> create mode 100644 lib/eal/loongarch/include/rte_vect.h
>> create mode 100644 lib/eal/loongarch/meson.build
>> create mode 100644 lib/eal/loongarch/rte_cpuflags.c
>> create mode 100644 lib/eal/loongarch/rte_cycles.c
>> create mode 100644 lib/eal/loongarch/rte_hypervisor.c
>> create mode 100644 lib/eal/loongarch/rte_power_intrinsics.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 51d77460ec..6c5fcef749 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -294,6 +294,12 @@ F: app/*/*_neon.*
>> F: examples/*/*_neon.*
>> F: examples/common/neon/
>>
>> +LoongArch
>> +M: Min Zhou <zhoumin@loongson.cn>
>> +F: config/loongarch/
>> +F: doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
>> +F: lib/eal/loongarch/
>> +
>> IBM POWER (alpha)
>> M: David Christensen <drc@linux.vnet.ibm.com>
>> F: config/ppc/
>> diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
>> index 55f256599e..626aa9bcba 100644
>> --- a/app/test/test_xmmt_ops.h
>> +++ b/app/test/test_xmmt_ops.h
>> @@ -65,6 +65,18 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
>> return data;
>> }
>>
>> +#elif defined(RTE_ARCH_LOONGARCH)
>> +
>> +#define vect_loadu_sil128(p) vect_load_128(p)
>> +
>> +/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
>> +static __rte_always_inline xmm_t
>> +vect_set_epi32(int i3, int i2, int i1, int i0)
>> +{
>> + xmm_t data = (xmm_t){.u32 = {i0, i1, i2, i3}};
>> +
>> + return data;
>> +}
>> #endif
>>
>> #endif /* _TEST_XMMT_OPS_H_ */
>> diff --git a/config/loongarch/loongarch_loongarch64_linux_gcc b/config/loongarch/loongarch_loongarch64_linux_gcc
>> new file mode 100644
>> index 0000000000..0c44ae96e6
>> --- /dev/null
>> +++ b/config/loongarch/loongarch_loongarch64_linux_gcc
>> @@ -0,0 +1,16 @@
>> +[binaries]
>> +c = 'loongarch64-unknown-linux-gnu-gcc'
>> +cpp = 'loongarch64-unknown-linux-gnu-cpp'
>> +ar = 'loongarch64-unknown-linux-gnu-gcc-ar'
>> +strip = 'loongarch64-unknown-linux-gnu-strip'
>> +pcap-config = ''
>> +
>> +[host_machine]
>> +system = 'linux'
>> +cpu_family = 'loongarch64'
>> +cpu = '3a5000'
>> +endian = 'little'
>> +
>> +[properties]
>> +implementor_id = 'generic'
>> +implementor_pn = 'default'
> Two things to fix here:
> - Please add ccache, see e3fd286ec471 ("build: add ccache for cross
> compilation")
> - the cpp meson variable should refer to a c++ compiler. See
> f75dd6d3b121 ("config: fix C++ cross compiler for Arm and PPC")
OK, thanks. I will add "ccache" into the build configuration file for
LoongArch and test it.
>
>> diff --git a/config/loongarch/meson.build b/config/loongarch/meson.build
>> new file mode 100644
>> index 0000000000..99dabef203
>> --- /dev/null
>> +++ b/config/loongarch/meson.build
>> @@ -0,0 +1,43 @@
>> +# SPDX-License-Identifier: BSD-3-Clause
>> +# Copyright(c) 2022 Loongson Technology Corporation Limited
>> +
>> +if not dpdk_conf.get('RTE_ARCH_64')
>> + error('Only 64-bit compiles are supported for this platform type')
>> +endif
>> +dpdk_conf.set('RTE_ARCH', 'loongarch')
>> +dpdk_conf.set('RTE_ARCH_LOONGARCH', 1)
>> +dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
>> +
>> +machine_args_generic = [
>> + ['default', ['-march=loongarch64']],
>> +]
>> +
>> +flags_generic = [
>> + ['RTE_MACHINE', '"loongarch64"'],
>> + ['RTE_MAX_LCORE', 64],
>> + ['RTE_MAX_NUMA_NODES', 16],
>> + ['RTE_CACHE_LINE_SIZE', 64]]
>> +
>> +impl_generic = ['Generic loongarch', flags_generic, machine_args_generic]
>> +
>> +machine = []
>> +machine_args = []
>> +
>> +machine = impl_generic
>> +impl_pn = 'default'
>> +
>> +message('Implementer : ' + machine[0])
>> +foreach flag: machine[1]
>> + if flag.length() > 0
>> + dpdk_conf.set(flag[0], flag[1])
>> + endif
>> +endforeach
>> +
>> +foreach marg: machine[2]
>> + if marg[0] == impl_pn
>> + foreach f: marg[1]
>> + machine_args += f
>> + endforeach
>> + endif
>> +endforeach
>> +message(machine_args)
>
> cpu_instruction_set is not supported, though I am not sure LoongArch needs it.
> Maybe something to add in the future but not blocking atm.
OK, thanks. I will check the "cpu_instruction_set" option for LoongArch.
Maybe it's better to add it at the initial commit.
>
>> diff --git a/doc/guides/contributing/design.rst b/doc/guides/contributing/design.rst
>> index 0383afe5c8..d24a7ff6a0 100644
>> --- a/doc/guides/contributing/design.rst
>> +++ b/doc/guides/contributing/design.rst
>> @@ -42,7 +42,7 @@ Per Architecture Sources
>> The following macro options can be used:
>>
>> * ``RTE_ARCH`` is a string that contains the name of the architecture.
>> -* ``RTE_ARCH_I686``, ``RTE_ARCH_X86_64``, ``RTE_ARCH_X86_X32``, ``RTE_ARCH_PPC_64``, ``RTE_ARCH_RISCV``, ``RTE_ARCH_ARM``, ``RTE_ARCH_ARMv7`` or ``RTE_ARCH_ARM64`` are defined only if we are building for those architectures.
>> +* ``RTE_ARCH_I686``, ``RTE_ARCH_X86_64``, ``RTE_ARCH_X86_X32``, ``RTE_ARCH_PPC_64``, ``RTE_ARCH_RISCV``, ``RTE_ARCH_LOONGARCH``, ``RTE_ARCH_ARM``, ``RTE_ARCH_ARMv7`` or ``RTE_ARCH_ARM64`` are defined only if we are building for those architectures.
>>
>> Per Execution Environment Sources
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
>> new file mode 100644
>> index 0000000000..3afc6d4933
>> --- /dev/null
>> +++ b/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
>> @@ -0,0 +1,87 @@
>> +.. SPDX-License-Identifier: BSD-3-Clause
>> + Copyright(c) 2022 Loongson Technology Corporation Limited
>> +
>> +Cross compiling DPDK for LoongArch
>> +==================================
>> +
>> +This chapter describes how to cross compile DPDK for LoongArch from x86 build
>> +hosts.
>> +
>> +.. note::
>> +
>> + Due to some of the code under review, the current Linux 5.19 cannot boot
>> + on LoongArch system. There are still some Linux distributions that have
>> + supported LoongArch host, such as Anolis OS, Kylin, Loongnix and UOS. These
>> + distributions base on Linux kernel 4.19 supported by Loongson Corporation.
>> + Because LoongArch is such a new platform with many fundamental pieces of
>> + software still under development, it is currently recommended to cross
>> + compile DPDK on x86 for LoongArch.
>> +
>> +
>> +Prerequisites
>> +-------------
>> +
>> +Ensure that you have all pre-requisites for building DPDK natively as those
>> +will be required also for cross-compilation.
>> +
>> +Linux kernel
>> +~~~~~~~~~~~~
>> +
>> +Make sure that LoongArch host is running Linux kernel 4.19 or newer supported
>> +by Loongson Corporation. The support for LoongArch in the current Linux 5.19
>> +is not complete because it still misses some patches to add for other
>> +subsystems.
>> +
>> +GNU toolchain
>> +-------------
>> +
>> +Obtain the cross toolchain
>> +~~~~~~~~~~~~~~~~~~~~~~~~~~
>> +
>> +The build process was tested using:
>> +
>> +* Latest `LoongArch GNU toolchain
>> + <https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz>`_
>> + on Debian 10.4 or CentOS 8.
>> +
>> +Alternatively the toolchain may be built straight from the source via CLFS, to
>> +do that follow the instructions on `CLFS for LoongArch64
>> +<https://github.com/sunhaiyong1978/CLFS-for-LoongArch>`_ github page.
>> +
>> +To download cross tools from github we can use the following command:
>> +
>> +.. code-block:: console
>> +
>> + wget -P /tmp/ https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
>> +
> Some people (like me ;-)) will want to generate their own cross toolchain.
> I tried your script, and I added some comments in the thread where you
> provided it.
>
> I think adding the whole script in the documentation is too much.
> I would lean to adding a link to this thread in the documentation instead.
> https://inbox.dpdk.org/dev/53b50799-cb29-7ee6-be89-4fe21566e127@loongson.cn/T/#m1da99578f85894a4ddcd8e39d8239869e6a501d1
>
> Opinion?
>
OK, thanks. I also think it's a better way to add the link of this
thread into the documentation and
give some appropriate instructions.
>> +Unzip and add into the PATH
>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> +
>> +After downloading the cross-tools file, we need unzip and add those executable
>> +binaries into the PATH as follows:
>> +
>> +.. code-block:: console
>> +
>> + tar -xvf /tmp/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz -C <cross_tool_install_dir> --strip-components 1
>> + export PATH=$PATH:<cross_tool_install_dir>/bin
>> +
>> +
>> +Cross Compiling DPDK with GNU toolchain using Meson
>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> +
>> +To cross-compile DPDK for generic LoongArch we can use the following command:
>> +
>> +.. code-block:: console
>> +
>> + meson cross-build --cross-file config/loongarch/loongarch_loongarch64_linux_gcc
>> + ninja -C cross-build
>> +
>> +Supported cross-compilation targets
>> +-----------------------------------
>> +
>> +Currently the following target is supported:
>> +
>> +* Generic LoongArch64 ISA: ``config/loongarch/loongarch_loongarch64_linux_gcc``
>> +
>> +To add a new target support, a corresponding cross-file has to be added to
>> +``config/loongarch`` directory.
>> diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
>> index 747552c385..c3e67bf9ec 100644
>> --- a/doc/guides/linux_gsg/index.rst
>> +++ b/doc/guides/linux_gsg/index.rst
>> @@ -14,6 +14,7 @@ Getting Started Guide for Linux
>> sys_reqs
>> build_dpdk
>> cross_build_dpdk_for_arm64
>> + cross_build_dpdk_for_loongarch
>> cross_build_dpdk_for_riscv
>> linux_drivers
>> build_sample_apps
>> diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
>> index b4a8e9881c..2472049095 100644
>> --- a/doc/guides/nics/features.rst
>> +++ b/doc/guides/nics/features.rst
>> @@ -832,6 +832,14 @@ ARMv8
>> Support armv8a (64bit) architecture.
>>
>>
>> +.. _nic_features_loongarch64:
> Hum, one comment.
> This is not related to your patch, so you can keep as you posted.
>
> Those anchors are unused, we should remove them all.
OK, thanks. I will remove the added items.
>
>> +
>> +LoongArch64
>> +-----------
>> +
>> +Support 64-bit LoongArch architecture.
>> +
>> +
>> .. _nic_features_power8:
>>
>> Power8
>> diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
>> index f7192cb0da..cbc17c0434 100644
>> --- a/doc/guides/nics/features/default.ini
>> +++ b/doc/guides/nics/features/default.ini
>> @@ -71,6 +71,7 @@ Linux =
>> Windows =
>> ARMv7 =
>> ARMv8 =
>> +LoongArch64 =
>> Power8 =
>> rv64 =
>> x86-32 =
>> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
>> index 0b4740abd1..ac1f9a924c 100644
>> --- a/doc/guides/rel_notes/release_22_11.rst
>> +++ b/doc/guides/rel_notes/release_22_11.rst
>> @@ -96,6 +96,13 @@ New Features
>> * Added ``rte_event_eth_tx_adapter_queue_stop`` to stop the Tx Adapter
>> from enqueueing any packets to the Tx queue.
>>
>> +* **Added initial LoongArch architecture support.**
>> +
>> + * Added EAL implementation for LoongArch architecture. The initial devices
>> + the porting was tested on included Loongson 3A5000, Loongson 3C5000 and
>> + Loongson 3C5000L. In theory this implementation should work with any target
>> + based on ``LoongArch`` ISA.
>> +
> This is a new feature in EAL.
> As described in the comments in the release notes, EAL features come
> first in the list.
>
OK, thanks. It's my fault. I will fix this problem in the v8 patchset.
>> Removed Items
>> -------------
>> diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
>> index 84fd42754e..16fd491b9a 100644
>> --- a/drivers/net/i40e/meson.build
>> +++ b/drivers/net/i40e/meson.build
>> @@ -7,6 +7,12 @@ if arch_subdir == 'riscv'
>> subdir_done()
>> endif
>>
>> +if arch_subdir == 'loongarch'
>> + build = false
>> + reason = 'not supported on LoongArch'
>> + subdir_done()
>> +endif
>> +
>> cflags += ['-DPF_DRIVER',
>> '-DVF_DRIVER',
>> '-DINTEGRATED_VF',
>> diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
>> index a18908ef7c..80ab012448 100644
>> --- a/drivers/net/ixgbe/meson.build
>> +++ b/drivers/net/ixgbe/meson.build
>> @@ -1,6 +1,12 @@
>> # SPDX-License-Identifier: BSD-3-Clause
>> # Copyright(c) 2017 Intel Corporation
>>
>> +if arch_subdir == 'loongarch'
>> + build = false
>> + reason = 'not supported on LoongArch'
>> + subdir_done()
>> +endif
>> +
>> cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
>>
>> subdir('base')
>> diff --git a/drivers/net/memif/meson.build b/drivers/net/memif/meson.build
>> index 680bc8631c..30c0fbc798 100644
>> --- a/drivers/net/memif/meson.build
>> +++ b/drivers/net/memif/meson.build
>> @@ -1,6 +1,12 @@
>> # SPDX-License-Identifier: BSD-3-Clause
>> # Copyright 2018-2019 Cisco Systems, Inc. All rights reserved.
>>
>> +if arch_subdir == 'loongarch'
>> + build = false
>> + reason = 'not supported on LoongArch'
>> + subdir_done()
>> +endif
>> +
>> if not is_linux
>> build = false
>> reason = 'only supported on Linux'
>> diff --git a/drivers/net/tap/meson.build b/drivers/net/tap/meson.build
>> index c09713a67b..f0d03069cd 100644
>> --- a/drivers/net/tap/meson.build
>> +++ b/drivers/net/tap/meson.build
>> @@ -1,6 +1,12 @@
>> # SPDX-License-Identifier: BSD-3-Clause
>> # Copyright 2018 Luca Boccassi <bluca@debian.org>
>>
>> +if arch_subdir == 'loongarch'
>> + build = false
>> + reason = 'not supported on LoongArch'
>> + subdir_done()
>> +endif
>> +
>> if not is_linux
>> build = false
>> reason = 'only supported on Linux'
>> diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build
>> index b40244a941..d2f2d96099 100644
>> --- a/examples/l3fwd/meson.build
>> +++ b/examples/l3fwd/meson.build
>> @@ -6,6 +6,12 @@
>> # To build this example as a standalone application with an already-installed
>> # DPDK instance, use 'make'
>>
>> +if arch_subdir == 'loongarch'
>> + build = false
>> + reason = 'not supported on LoongArch'
>> + subdir_done()
>> +endif
>> +
>> allow_experimental_apis = true
>> deps += ['acl', 'hash', 'lpm', 'fib', 'eventdev']
>> sources = files(
>> diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
>> index c890c42106..60fc8cc6ca 100644
>> --- a/lib/eal/linux/eal_memory.c
>> +++ b/lib/eal/linux/eal_memory.c
>> @@ -77,7 +77,11 @@ uint64_t eal_get_baseaddr(void)
>> * rte_mem_check_dma_mask for ensuring all memory is within supported
>> * range.
>> */
>> +#if defined(RTE_ARCH_LOONGARCH)
>> + return 0x7000000000ULL;
>> +#else
>> return 0x100000000ULL;
>> +#endif
>> }
>>
>> /*
>> diff --git a/lib/eal/loongarch/include/meson.build b/lib/eal/loongarch/include/meson.build
>> new file mode 100644
>> index 0000000000..6e8d12601a
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/meson.build
>> @@ -0,0 +1,18 @@
>> +# SPDX-License-Identifier: BSD-3-Clause
>> +# Copyright(c) 2022 Loongson Technology Corporation Limited
>> +
>> +arch_headers = files(
>> + 'rte_atomic.h',
>> + 'rte_byteorder.h',
>> + 'rte_cpuflags.h',
>> + 'rte_cycles.h',
>> + 'rte_io.h',
>> + 'rte_memcpy.h',
>> + 'rte_pause.h',
>> + 'rte_power_intrinsics.h',
>> + 'rte_prefetch.h',
>> + 'rte_rwlock.h',
>> + 'rte_spinlock.h',
>> + 'rte_vect.h',
>> +)
>> +install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
>> diff --git a/lib/eal/loongarch/include/rte_atomic.h b/lib/eal/loongarch/include/rte_atomic.h
>> new file mode 100644
>> index 0000000000..b0ddcab72e
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_atomic.h
>> @@ -0,0 +1,47 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_ATOMIC_LOONGARCH_H_
>> +#define _RTE_ATOMIC_LOONGARCH_H_
> No need for _.
> RTE_ATOMIC_LOONGARCH_H is enough.
>
> This comment applies to other headers.
OK, thanks. I will check all added headers and fix them in the v8 patchset.
>> +
>> +#ifndef RTE_FORCE_INTRINSICS
>> +# error Platform must be built with RTE_FORCE_INTRINSICS
>> +#endif
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include <rte_common.h>
>> +#include "generic/rte_atomic.h"
>> +
>> +#define rte_mb() do { asm volatile("dbar 0":::"memory"); } while (0)
>> +
>> +#define rte_wmb() rte_mb()
>> +
>> +#define rte_rmb() rte_mb()
>> +
>> +#define rte_smp_mb() rte_mb()
>> +
>> +#define rte_smp_wmb() rte_mb()
>> +
>> +#define rte_smp_rmb() rte_mb()
>> +
>> +#define rte_io_mb() rte_mb()
>> +
>> +#define rte_io_wmb() rte_mb()
>> +
>> +#define rte_io_rmb() rte_mb()
>> +
>> +static __rte_always_inline void
>> +rte_atomic_thread_fence(int memorder)
>> +{
>> + __atomic_thread_fence(memorder);
>> +}
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_ATOMIC_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_byteorder.h b/lib/eal/loongarch/include/rte_byteorder.h
>> new file mode 100644
>> index 0000000000..ba27998497
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_byteorder.h
>> @@ -0,0 +1,40 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_BYTEORDER_LOONGARCH_H_
>> +#define _RTE_BYTEORDER_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include "generic/rte_byteorder.h"
>> +
>> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
>> +
>> +#define rte_cpu_to_le_16(x) (x)
>> +#define rte_cpu_to_le_32(x) (x)
>> +#define rte_cpu_to_le_64(x) (x)
>> +
>> +#define rte_cpu_to_be_16(x) rte_bswap16(x)
>> +#define rte_cpu_to_be_32(x) rte_bswap32(x)
>> +#define rte_cpu_to_be_64(x) rte_bswap64(x)
>> +
>> +#define rte_le_to_cpu_16(x) (x)
>> +#define rte_le_to_cpu_32(x) (x)
>> +#define rte_le_to_cpu_64(x) (x)
>> +
>> +#define rte_be_to_cpu_16(x) rte_bswap16(x)
>> +#define rte_be_to_cpu_32(x) rte_bswap32(x)
>> +#define rte_be_to_cpu_64(x) rte_bswap64(x)
>> +
>> +#else /* RTE_BIG_ENDIAN */
>> +#error "LoongArch not support big endian!"
>> +#endif
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_BYTEORDER_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_cpuflags.h b/lib/eal/loongarch/include/rte_cpuflags.h
>> new file mode 100644
>> index 0000000000..d9121a00a8
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_cpuflags.h
>> @@ -0,0 +1,39 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_CPUFLAGS_LOONGARCH_H_
>> +#define _RTE_CPUFLAGS_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +/**
>> + * Enumeration of all CPU features supported
>> + */
>> +enum rte_cpu_flag_t {
>> + RTE_CPUFLAG_CPUCFG = 0,
>> + RTE_CPUFLAG_LAM,
>> + RTE_CPUFLAG_UAL,
>> + RTE_CPUFLAG_FPU,
>> + RTE_CPUFLAG_LSX,
>> + RTE_CPUFLAG_LASX,
>> + RTE_CPUFLAG_CRC32,
>> + RTE_CPUFLAG_COMPLEX,
>> + RTE_CPUFLAG_CRYPTO,
>> + RTE_CPUFLAG_LVZ,
>> + RTE_CPUFLAG_LBT_X86,
>> + RTE_CPUFLAG_LBT_ARM,
>> + RTE_CPUFLAG_LBT_MIPS,
>> + /* The last item */
>> + RTE_CPUFLAG_NUMFLAGS /**< This should always be the last! */
>> +};
>> +
>> +#include "generic/rte_cpuflags.h"
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_CPUFLAGS_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_cycles.h b/lib/eal/loongarch/include/rte_cycles.h
>> new file mode 100644
>> index 0000000000..0f1539be1b
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_cycles.h
>> @@ -0,0 +1,47 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_CYCLES_LOONGARCH_H_
>> +#define _RTE_CYCLES_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include "generic/rte_cycles.h"
>> +
>> +/**
>> + * Read the time base register.
>> + *
>> + * @return
>> + * The time base for this lcore.
>> + */
>> +static inline uint64_t
>> +rte_rdtsc(void)
>> +{
>> + uint64_t count;
>> +
>> + __asm__ __volatile__ (
>> + "rdtime.d %[cycles], $zero\n"
>> + : [cycles] "=r" (count)
>> + ::
>> + );
>> + return count;
>> +}
>> +
>> +static inline uint64_t
>> +rte_rdtsc_precise(void)
>> +{
>> + rte_mb();
>> + return rte_rdtsc();
>> +}
>> +
>> +static inline uint64_t
>> +rte_get_tsc_cycles(void) { return rte_rdtsc(); }
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_CYCLES_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_io.h b/lib/eal/loongarch/include/rte_io.h
>> new file mode 100644
>> index 0000000000..af152a727a
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_io.h
>> @@ -0,0 +1,18 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_IO_LOONGARCH_H_
>> +#define _RTE_IO_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include "generic/rte_io.h"
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_IO_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_memcpy.h b/lib/eal/loongarch/include/rte_memcpy.h
>> new file mode 100644
>> index 0000000000..e7b91e9ce4
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_memcpy.h
>> @@ -0,0 +1,61 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_MEMCPY_LOONGARCH_H_
>> +#define _RTE_MEMCPY_LOONGARCH_H_
>> +
>> +#include <stdint.h>
>> +#include <string.h>
>> +
>> +#include "rte_common.h"
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include "generic/rte_memcpy.h"
>> +
>> +static inline void
>> +rte_mov16(uint8_t *dst, const uint8_t *src)
>> +{
>> + memcpy(dst, src, 16);
>> +}
>> +
>> +static inline void
>> +rte_mov32(uint8_t *dst, const uint8_t *src)
>> +{
>> + memcpy(dst, src, 32);
>> +}
>> +
>> +static inline void
>> +rte_mov48(uint8_t *dst, const uint8_t *src)
>> +{
>> + memcpy(dst, src, 48);
>> +}
>> +
>> +static inline void
>> +rte_mov64(uint8_t *dst, const uint8_t *src)
>> +{
>> + memcpy(dst, src, 64);
>> +}
>> +
>> +static inline void
>> +rte_mov128(uint8_t *dst, const uint8_t *src)
>> +{
>> + memcpy(dst, src, 128);
>> +}
>> +
>> +static inline void
>> +rte_mov256(uint8_t *dst, const uint8_t *src)
>> +{
>> + memcpy(dst, src, 256);
>> +}
>> +
>> +#define rte_memcpy(d, s, n) memcpy((d), (s), (n))
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_MEMCPY_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_pause.h b/lib/eal/loongarch/include/rte_pause.h
>> new file mode 100644
>> index 0000000000..438de23128
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_pause.h
>> @@ -0,0 +1,24 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_PAUSE_LOONGARCH_H_
>> +#define _RTE_PAUSE_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include "rte_atomic.h"
>> +
>> +#include "generic/rte_pause.h"
>> +
>> +static inline void rte_pause(void)
>> +{
>> +}
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_PAUSE_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_power_intrinsics.h b/lib/eal/loongarch/include/rte_power_intrinsics.h
>> new file mode 100644
>> index 0000000000..b6a2c0d82e
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_power_intrinsics.h
>> @@ -0,0 +1,20 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_POWER_INTRINSIC_LOONGARCH_H_
>> +#define _RTE_POWER_INTRINSIC_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include <rte_common.h>
>> +
>> +#include "generic/rte_power_intrinsics.h"
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_POWER_INTRINSIC_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_prefetch.h b/lib/eal/loongarch/include/rte_prefetch.h
>> new file mode 100644
>> index 0000000000..0fd9262ea8
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_prefetch.h
>> @@ -0,0 +1,47 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_PREFETCH_LOONGARCH_H_
>> +#define _RTE_PREFETCH_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include <rte_common.h>
>> +#include "generic/rte_prefetch.h"
>> +
>> +static inline void rte_prefetch0(const volatile void *p)
>> +{
>> + __builtin_prefetch((const void *)(uintptr_t)p, 0, 3);
>> +}
>> +
>> +static inline void rte_prefetch1(const volatile void *p)
>> +{
>> + __builtin_prefetch((const void *)(uintptr_t)p, 0, 2);
>> +}
>> +
>> +static inline void rte_prefetch2(const volatile void *p)
>> +{
>> + __builtin_prefetch((const void *)(uintptr_t)p, 0, 1);
>> +}
>> +
>> +static inline void rte_prefetch_non_temporal(const volatile void *p)
>> +{
>> + /* non-temporal version not available, fallback to rte_prefetch0 */
>> + rte_prefetch0(p);
>> +}
>> +
>> +__rte_experimental
>> +static inline void
>> +rte_cldemote(const volatile void *p)
>> +{
>> + RTE_SET_USED(p);
>> +}
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_PREFETCH_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_rwlock.h b/lib/eal/loongarch/include/rte_rwlock.h
>> new file mode 100644
>> index 0000000000..aac6f60120
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_rwlock.h
>> @@ -0,0 +1,42 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_RWLOCK_LOONGARCH_H_
>> +#define _RTE_RWLOCK_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include "generic/rte_rwlock.h"
>> +
>> +static inline void
>> +rte_rwlock_read_lock_tm(rte_rwlock_t *rwl)
>> +{
>> + rte_rwlock_read_lock(rwl);
>> +}
>> +
>> +static inline void
>> +rte_rwlock_read_unlock_tm(rte_rwlock_t *rwl)
>> +{
>> + rte_rwlock_read_unlock(rwl);
>> +}
>> +
>> +static inline void
>> +rte_rwlock_write_lock_tm(rte_rwlock_t *rwl)
>> +{
>> + rte_rwlock_write_lock(rwl);
>> +}
>> +
>> +static inline void
>> +rte_rwlock_write_unlock_tm(rte_rwlock_t *rwl)
>> +{
>> + rte_rwlock_write_unlock(rwl);
>> +}
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_RWLOCK_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_spinlock.h b/lib/eal/loongarch/include/rte_spinlock.h
>> new file mode 100644
>> index 0000000000..dd07538c7f
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_spinlock.h
>> @@ -0,0 +1,64 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_SPINLOCK_LOONGARCH_H_
>> +#define _RTE_SPINLOCK_LOONGARCH_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include <rte_common.h>
>> +#include "generic/rte_spinlock.h"
>> +
>> +#ifndef RTE_FORCE_INTRINSICS
>> +# error Platform must be built with RTE_FORCE_INTRINSICS
>> +#endif
>> +
>> +static inline int rte_tm_supported(void)
>> +{
>> + return 0;
>> +}
>> +
>> +static inline void
>> +rte_spinlock_lock_tm(rte_spinlock_t *sl)
>> +{
>> + rte_spinlock_lock(sl); /* fall-back */
>> +}
>> +
>> +static inline int
>> +rte_spinlock_trylock_tm(rte_spinlock_t *sl)
>> +{
>> + return rte_spinlock_trylock(sl);
>> +}
>> +
>> +static inline void
>> +rte_spinlock_unlock_tm(rte_spinlock_t *sl)
>> +{
>> + rte_spinlock_unlock(sl);
>> +}
>> +
>> +static inline void
>> +rte_spinlock_recursive_lock_tm(rte_spinlock_recursive_t *slr)
>> +{
>> + rte_spinlock_recursive_lock(slr); /* fall-back */
>> +}
>> +
>> +static inline void
>> +rte_spinlock_recursive_unlock_tm(rte_spinlock_recursive_t *slr)
>> +{
>> + rte_spinlock_recursive_unlock(slr);
>> +}
>> +
>> +static inline int
>> +rte_spinlock_recursive_trylock_tm(rte_spinlock_recursive_t *slr)
>> +{
>> + return rte_spinlock_recursive_trylock(slr);
>> +}
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_SPINLOCK_LOONGARCH_H_ */
>> diff --git a/lib/eal/loongarch/include/rte_vect.h b/lib/eal/loongarch/include/rte_vect.h
>> new file mode 100644
>> index 0000000000..5951a2674c
>> --- /dev/null
>> +++ b/lib/eal/loongarch/include/rte_vect.h
>> @@ -0,0 +1,65 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#ifndef _RTE_VECT_LOONGARCH_H_
>> +#define _RTE_VECT_LOONGARCH_H_
>> +
>> +#include <stdint.h>
>> +#include "generic/rte_vect.h"
>> +#include "rte_common.h"
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#define RTE_VECT_DEFAULT_SIMD_BITWIDTH RTE_VECT_SIMD_DISABLED
>> +
>> +typedef union xmm {
>> + int8_t i8[16];
>> + int16_t i16[8];
>> + int32_t i32[4];
>> + int64_t i64[2];
>> + uint8_t u8[16];
>> + uint16_t u16[8];
>> + uint32_t u32[4];
>> + uint64_t u64[2];
>> + double pd[2];
>> +} __rte_aligned(16) xmm_t;
>> +
>> +#define XMM_SIZE (sizeof(xmm_t))
>> +#define XMM_MASK (XMM_SIZE - 1)
>> +
>> +typedef union rte_xmm {
>> + xmm_t x;
>> + uint8_t u8[XMM_SIZE / sizeof(uint8_t)];
>> + uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
>> + uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
>> + uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
>> + double pd[XMM_SIZE / sizeof(double)];
>> +} __rte_aligned(16) rte_xmm_t;
>> +
>> +static inline xmm_t
>> +vect_load_128(void *p)
>> +{
>> + xmm_t ret = *((xmm_t *)p);
>> +
>> + return ret;
>> +}
>> +
>> +static inline xmm_t
>> +vect_and(xmm_t data, xmm_t mask)
>> +{
>> + rte_xmm_t ret = {.x = data };
>> + rte_xmm_t m = {.x = mask };
>> + ret.u64[0] &= m.u64[0];
>> + ret.u64[1] &= m.u64[1];
>> +
>> + return ret.x;
>> +}
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif
>> diff --git a/lib/eal/loongarch/meson.build b/lib/eal/loongarch/meson.build
>> new file mode 100644
>> index 0000000000..4dcc27babb
>> --- /dev/null
>> +++ b/lib/eal/loongarch/meson.build
>> @@ -0,0 +1,11 @@
>> +# SPDX-License-Identifier: BSD-3-Clause
>> +# Copyright(c) 2022 Loongson Technology Corporation Limited
>> +
>> +subdir('include')
>> +
>> +sources += files(
>> + 'rte_cpuflags.c',
>> + 'rte_cycles.c',
>> + 'rte_hypervisor.c',
>> + 'rte_power_intrinsics.c',
>> +)
>> diff --git a/lib/eal/loongarch/rte_cpuflags.c b/lib/eal/loongarch/rte_cpuflags.c
>> new file mode 100644
>> index 0000000000..0a75ca58d4
>> --- /dev/null
>> +++ b/lib/eal/loongarch/rte_cpuflags.c
>> @@ -0,0 +1,93 @@
>> +/*
>> + * SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#include "rte_cpuflags.h"
>> +
>> +#include <elf.h>
>> +#include <fcntl.h>
>> +#include <assert.h>
>> +#include <unistd.h>
>> +#include <string.h>
>> +
>> +/* Symbolic values for the entries in the auxiliary table */
>> +#define AT_HWCAP 16
>> +
>> +/* software based registers */
>> +enum cpu_register_t {
>> + REG_NONE = 0,
>> + REG_HWCAP,
>> + REG_MAX
>> +};
>> +
>> +typedef uint32_t hwcap_registers_t[REG_MAX];
>> +
>> +struct feature_entry {
>> + uint32_t reg;
>> + uint32_t bit;
>> +#define CPU_FLAG_NAME_MAX_LEN 64
>> + char name[CPU_FLAG_NAME_MAX_LEN];
>> +};
>> +
>> +#define FEAT_DEF(name, reg, bit) \
>> + [RTE_CPUFLAG_##name] = {reg, bit, #name},
>> +
>> +const struct feature_entry rte_cpu_feature_table[] = {
>> + FEAT_DEF(CPUCFG, REG_HWCAP, 0)
>> + FEAT_DEF(LAM, REG_HWCAP, 1)
>> + FEAT_DEF(UAL, REG_HWCAP, 2)
>> + FEAT_DEF(FPU, REG_HWCAP, 3)
>> + FEAT_DEF(LSX, REG_HWCAP, 4)
>> + FEAT_DEF(LASX, REG_HWCAP, 5)
>> + FEAT_DEF(CRC32, REG_HWCAP, 6)
>> + FEAT_DEF(COMPLEX, REG_HWCAP, 7)
>> + FEAT_DEF(CRYPTO, REG_HWCAP, 8)
>> + FEAT_DEF(LVZ, REG_HWCAP, 9)
>> + FEAT_DEF(LBT_X86, REG_HWCAP, 10)
>> + FEAT_DEF(LBT_ARM, REG_HWCAP, 11)
>> + FEAT_DEF(LBT_MIPS, REG_HWCAP, 12)
>> +};
>> +
>> +/*
>> + * Read AUXV software register and get cpu features for LoongArch
>> + */
>> +static void
>> +rte_cpu_get_features(hwcap_registers_t out)
>> +{
>> + out[REG_HWCAP] = rte_cpu_getauxval(AT_HWCAP);
>> +}
>> +
>> +/*
>> + * Checks if a particular flag is available on current machine.
>> + */
>> +int
>> +rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
>> +{
>> + const struct feature_entry *feat;
>> + hwcap_registers_t regs = {0};
>> +
>> + if (feature >= RTE_CPUFLAG_NUMFLAGS)
>> + return -ENOENT;
>> +
>> + feat = &rte_cpu_feature_table[feature];
>> + if (feat->reg == REG_NONE)
>> + return -EFAULT;
>> +
>> + rte_cpu_get_features(regs);
>> + return (regs[feat->reg] >> feat->bit) & 1;
>> +}
>> +
>> +const char *
>> +rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)
>> +{
>> + if (feature >= RTE_CPUFLAG_NUMFLAGS)
>> + return NULL;
>> + return rte_cpu_feature_table[feature].name;
>> +}
>> +
>> +void
>> +rte_cpu_get_intrinsics_support(struct rte_cpu_intrinsics *intrinsics)
>> +{
>> + memset(intrinsics, 0, sizeof(*intrinsics));
>> +}
>> diff --git a/lib/eal/loongarch/rte_cycles.c b/lib/eal/loongarch/rte_cycles.c
>> new file mode 100644
>> index 0000000000..582601d335
>> --- /dev/null
>> +++ b/lib/eal/loongarch/rte_cycles.c
>> @@ -0,0 +1,45 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#include "eal_private.h"
>> +
>> +#define LOONGARCH_CPUCFG4 0x4
>> +#define CPUCFG4_CCFREQ_MASK 0xFFFFFFFF
>> +#define CPUCFG4_CCFREQ_SHIFT 0
>> +
>> +#define LOONGARCH_CPUCFG5 0x5
>> +#define CPUCFG5_CCMUL_MASK 0xFFFF
>> +#define CPUCFG5_CCMUL_SHIFT 0
>> +
>> +#define CPUCFG5_CCDIV_MASK 0xFFFF0000
>> +#define CPUCFG5_CCDIV_SHIFT 16
>> +
>> +static __rte_noinline uint32_t
>> +read_cpucfg(int arg)
>> +{
>> + int ret = 0;
>> +
>> + __asm__ __volatile__ (
>> + "cpucfg %[var], %[index]\n"
>> + : [var]"=r"(ret)
>> + : [index]"r"(arg)
>> + :
>> + );
>> +
>> + return ret;
>> +}
>> +
>> +uint64_t
>> +get_tsc_freq_arch(void)
>> +{
>> + uint32_t base_freq, mul_factor, div_factor;
>> +
>> + base_freq = read_cpucfg(LOONGARCH_CPUCFG4);
>> + mul_factor = (read_cpucfg(LOONGARCH_CPUCFG5) & CPUCFG5_CCMUL_MASK) >>
>> + CPUCFG5_CCMUL_SHIFT;
>> + div_factor = (read_cpucfg(LOONGARCH_CPUCFG5) & CPUCFG5_CCDIV_MASK) >>
>> + CPUCFG5_CCDIV_SHIFT;
>> +
>> + return base_freq * mul_factor / div_factor;
>> +}
>> diff --git a/lib/eal/loongarch/rte_hypervisor.c b/lib/eal/loongarch/rte_hypervisor.c
>> new file mode 100644
>> index 0000000000..d044906f71
>> --- /dev/null
>> +++ b/lib/eal/loongarch/rte_hypervisor.c
>> @@ -0,0 +1,11 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#include "rte_hypervisor.h"
>> +
>> +enum rte_hypervisor
>> +rte_hypervisor_get(void)
>> +{
>> + return RTE_HYPERVISOR_UNKNOWN;
>> +}
>> diff --git a/lib/eal/loongarch/rte_power_intrinsics.c b/lib/eal/loongarch/rte_power_intrinsics.c
>> new file mode 100644
>> index 0000000000..a8969c260e
>> --- /dev/null
>> +++ b/lib/eal/loongarch/rte_power_intrinsics.c
>> @@ -0,0 +1,53 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2022 Loongson Technology Corporation Limited
>> + */
>> +
>> +#include <errno.h>
>> +
>> +#include "rte_power_intrinsics.h"
>> +
>> +/**
>> + * This function is not supported on LOONGARCH.
>> + */
>> +int
>> +rte_power_monitor(const struct rte_power_monitor_cond *pmc,
>> + const uint64_t tsc_timestamp)
>> +{
>> + RTE_SET_USED(pmc);
>> + RTE_SET_USED(tsc_timestamp);
>> +
>> + return -ENOTSUP;
>> +}
>> +
>> +/**
>> + * This function is not supported on LOONGARCH.
>> + */
>> +int
>> +rte_power_pause(const uint64_t tsc_timestamp)
>> +{
>> + RTE_SET_USED(tsc_timestamp);
>> +
>> + return -ENOTSUP;
>> +}
>> +
>> +/**
>> + * This function is not supported on LOONGARCH.
>> + */
>> +int
>> +rte_power_monitor_wakeup(const unsigned int lcore_id)
>> +{
>> + RTE_SET_USED(lcore_id);
>> +
>> + return -ENOTSUP;
>> +}
>> +
>> +int
>> +rte_power_monitor_multi(const struct rte_power_monitor_cond pmc[],
>> + const uint32_t num, const uint64_t tsc_timestamp)
>> +{
>> + RTE_SET_USED(pmc);
>> + RTE_SET_USED(num);
>> + RTE_SET_USED(tsc_timestamp);
>> +
>> + return -ENOTSUP;
>> +}
>> diff --git a/meson.build b/meson.build
>> index 7d6643da3a..de718974d4 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -56,6 +56,8 @@ elif host_machine.cpu_family().startswith('ppc')
>> arch_subdir = 'ppc'
>> elif host_machine.cpu_family().startswith('riscv')
>> arch_subdir = 'riscv'
>> +elif host_machine.cpu_family().startswith('loongarch')
>> + arch_subdir = 'loongarch'
>> endif
> Please insert it earlier, between arm and ppc.
OK, thanks. I will fix them to keep the alphabetical order.
Thanks,
--
Min Zhou
^ permalink raw reply [relevance 0%]
* [PATCH v11 6/7] bbdev: add queue related warning and status information
` (2 preceding siblings ...)
2022-10-03 18:00 5% ` [PATCH v11 3/7] bbdev: add device info on queue topology Nicolas Chautru
@ 2022-10-03 18:00 4% ` Nicolas Chautru
3 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-10-03 18:00 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
This allows to expose more information with regards to any
queue related failure and warning which cannot be supported
in existing API.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
app/test-bbdev/test_bbdev_perf.c | 2 ++
doc/guides/rel_notes/release_22_11.rst | 3 ++
lib/bbdev/rte_bbdev.c | 19 ++++++++++++
lib/bbdev/rte_bbdev.h | 43 ++++++++++++++++++++++++++
lib/bbdev/version.map | 1 +
5 files changed, 68 insertions(+)
diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index f5eeb735b2..75f1ca4f14 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -4361,6 +4361,8 @@ get_bbdev_queue_stats(uint16_t dev_id, uint16_t queue_id,
stats->dequeued_count = q_stats->dequeued_count;
stats->enqueue_err_count = q_stats->enqueue_err_count;
stats->dequeue_err_count = q_stats->dequeue_err_count;
+ stats->enqueue_warning_count = q_stats->enqueue_warning_count;
+ stats->dequeue_warning_count = q_stats->dequeue_warning_count;
stats->acc_offload_cycles = q_stats->acc_offload_cycles;
return 0;
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index edc50e5647..c55fb2a861 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -329,6 +329,9 @@ ABI Changes
* bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters
for queue topology, device status using ``rte_bbdev_device_status``.
+* bbdev: Structure ``rte_bbdev_queue_data`` was updated to add new parameter
+ for enqueue status using ``rte_bbdev_enqueue_status``.
+
Known Issues
------------
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 9d65ba8cd3..bdd7c2f00d 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -721,6 +721,8 @@ get_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats)
stats->dequeued_count += q_stats->dequeued_count;
stats->enqueue_err_count += q_stats->enqueue_err_count;
stats->dequeue_err_count += q_stats->dequeue_err_count;
+ stats->enqueue_warn_count += q_stats->enqueue_warn_count;
+ stats->dequeue_warn_count += q_stats->dequeue_warn_count;
}
rte_bbdev_log_debug("Got stats on %u", dev->data->dev_id);
}
@@ -1163,3 +1165,20 @@ rte_bbdev_device_status_str(enum rte_bbdev_device_status status)
rte_bbdev_log(ERR, "Invalid device status");
return NULL;
}
+
+const char *
+rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
+{
+ static const char * const enq_sta_string[] = {
+ "RTE_BBDEV_ENQ_STATUS_NONE",
+ "RTE_BBDEV_ENQ_STATUS_QUEUE_FULL",
+ "RTE_BBDEV_ENQ_STATUS_RING_FULL",
+ "RTE_BBDEV_ENQ_STATUS_INVALID_OP",
+ };
+
+ if (status < sizeof(enq_sta_string) / sizeof(char *))
+ return enq_sta_string[status];
+
+ rte_bbdev_log(ERR, "Invalid enqueue status");
+ return NULL;
+}
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 2a9d9de79f..ed0d72d02a 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -35,6 +35,13 @@ extern "C" {
#define RTE_BBDEV_MAX_DEVS 128 /**< Max number of devices */
#endif
+/*
+ * Maximum size to be used to manage the enum rte_bbdev_enqueue_status
+ * including padding for future enum insertion.
+ * The enum values must be explicitly kept smaller or equal to this padded maximum size.
+ */
+#define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6
+
/** Flags indicate current state of BBDEV device */
enum rte_bbdev_state {
RTE_BBDEV_UNUSED,
@@ -223,6 +230,21 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
int
rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
+/**
+ * Flags indicate the reason why a previous enqueue may not have
+ * consumed all requested operations.
+ * In case of multiple reasons the latter supersedes a previous one.
+ * The related macro RTE_BBDEV_ENQ_STATUS_SIZE_MAX can be used as an absolute maximum for
+ * notably sizing array while allowing for future enumeration insertion.
+ */
+enum rte_bbdev_enqueue_status {
+ RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */
+ RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room in queue */
+ RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room in ring */
+ RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was rejected as invalid */
+ /* Note: RTE_BBDEV_ENQ_STATUS_SIZE_MAX must be larger or equal to maximum enum value */
+};
+
/**
* Flags indicate the status of the device
*/
@@ -246,6 +268,12 @@ struct rte_bbdev_stats {
uint64_t enqueue_err_count;
/** Total error count on operations dequeued */
uint64_t dequeue_err_count;
+ /** Total warning count on operations enqueued */
+ uint64_t enqueue_warn_count;
+ /** Total warning count on operations dequeued */
+ uint64_t dequeue_warn_count;
+ /** Total enqueue status count based on rte_bbdev_enqueue_status enum */
+ uint64_t enqueue_status_count[RTE_BBDEV_ENQ_STATUS_SIZE_MAX];
/** CPU cycles consumed by the (HW/SW) accelerator device to offload
* the enqueue request to its internal queues.
* - For a HW device this is the cycles consumed in MMIO write
@@ -386,6 +414,7 @@ struct rte_bbdev_queue_data {
void *queue_private; /**< Driver-specific per-queue data */
struct rte_bbdev_queue_conf conf; /**< Current configuration */
struct rte_bbdev_stats queue_stats; /**< Queue statistics */
+ enum rte_bbdev_enqueue_status enqueue_status; /**< Enqueue status when op is rejected */
bool started; /**< Queue state */
};
@@ -938,6 +967,20 @@ __rte_experimental
const char*
rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
+/**
+ * Convert queue status from enum to string.
+ *
+ * @param status
+ * Queue status as enum.
+ *
+ * @returns
+ * Queue status as string or NULL if op_type is invalid.
+ *
+ */
+__rte_experimental
+const char*
+rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map
index db178917e2..d0bb835255 100644
--- a/lib/bbdev/version.map
+++ b/lib/bbdev/version.map
@@ -47,6 +47,7 @@ EXPERIMENTAL {
rte_bbdev_dequeue_fft_ops;
rte_bbdev_device_status_str;
rte_bbdev_enqueue_fft_ops;
+ rte_bbdev_enqueue_status_str;
rte_bbdev_fft_op_alloc_bulk;
rte_bbdev_fft_op_free_bulk;
};
--
2.37.1
^ permalink raw reply [relevance 4%]
* [PATCH v11 3/7] bbdev: add device info on queue topology
2022-10-03 18:00 7% ` [PATCH v11 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
2022-10-03 18:00 4% ` [PATCH v11 2/7] bbdev: add device status info Nicolas Chautru
@ 2022-10-03 18:00 5% ` Nicolas Chautru
2022-10-03 18:00 4% ` [PATCH v11 6/7] bbdev: add queue related warning and status information Nicolas Chautru
3 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-10-03 18:00 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
Adding more options in the API to expose the number
of queues exposed and related priority.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
doc/guides/rel_notes/deprecation.rst | 3 ---
doc/guides/rel_notes/release_22_11.rst | 2 +-
lib/bbdev/rte_bbdev.h | 4 ++++
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 3bf5a4a7bd..b6485019d2 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -122,9 +122,6 @@ Deprecation Notices
* bbdev: Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22111>`__.
- New members will be added in ``rte_bbdev_driver_info`` to expose
- PMD queue topology inspired by
- this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22076>`__.
This should be updated in DPDK 22.11.
* cryptodev: Hide structures ``rte_cryptodev_sym_session`` and
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4a1a7bdc5e..0b4e28f416 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -322,7 +322,7 @@ ABI Changes
macro is added.
* bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters
- for device status using ``rte_bbdev_device_status``.
+ for queue topology, device status using ``rte_bbdev_device_status``.
Known Issues
------------
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 3c428c14e9..21d076cd36 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -289,6 +289,10 @@ struct rte_bbdev_driver_info {
/** Maximum number of queues supported by the device */
unsigned int max_num_queues;
+ /** Maximum number of queues supported per operation type */
+ unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX];
+ /** Priority level supported per operation type */
+ unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX];
/** Queue size limit (queue size must also be power of 2) */
uint32_t queue_size_lim;
/** Set if device off-loads operation to hardware */
--
2.37.1
^ permalink raw reply [relevance 5%]
* [PATCH v11 2/7] bbdev: add device status info
2022-10-03 18:00 7% ` [PATCH v11 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
@ 2022-10-03 18:00 4% ` Nicolas Chautru
2022-10-03 18:00 5% ` [PATCH v11 3/7] bbdev: add device info on queue topology Nicolas Chautru
2022-10-03 18:00 4% ` [PATCH v11 6/7] bbdev: add queue related warning and status information Nicolas Chautru
3 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-10-03 18:00 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
Added device status information, so that the PMD can
expose information related to the underlying accelerator device status.
Minor order change in structure to fit into padding hole.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Mingshan Zhang <mingshan.zhang@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
doc/guides/rel_notes/deprecation.rst | 3 --
doc/guides/rel_notes/release_22_11.rst | 3 ++
drivers/baseband/acc100/rte_acc100_pmd.c | 1 +
.../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 1 +
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 1 +
drivers/baseband/la12xx/bbdev_la12xx.c | 1 +
drivers/baseband/null/bbdev_null.c | 1 +
.../baseband/turbo_sw/bbdev_turbo_software.c | 1 +
lib/bbdev/rte_bbdev.c | 22 ++++++++++++
lib/bbdev/rte_bbdev.h | 35 +++++++++++++++++--
lib/bbdev/rte_bbdev_op.h | 2 +-
lib/bbdev/version.map | 7 ++++
12 files changed, 72 insertions(+), 6 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e35c86a25c..3bf5a4a7bd 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -125,9 +125,6 @@ Deprecation Notices
New members will be added in ``rte_bbdev_driver_info`` to expose
PMD queue topology inspired by
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22076>`__.
- New member will be added in ``rte_bbdev_driver_info`` to expose
- the device status as per
- this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=23367>`__.
This should be updated in DPDK 22.11.
* cryptodev: Hide structures ``rte_cryptodev_sym_session`` and
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index e9db53f372..4a1a7bdc5e 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -321,6 +321,9 @@ ABI Changes
and to allow for futureproof enum insertion a padded ``RTE_BBDEV_OP_TYPE_SIZE_MAX``
macro is added.
+* bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters
+ for device status using ``rte_bbdev_device_status``.
+
Known Issues
------------
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index e2d9409185..cdabc0f879 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -1061,6 +1061,7 @@ acc100_dev_info_get(struct rte_bbdev *dev,
/* Read and save the populated config from ACC100 registers */
fetch_acc100_config(dev);
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
/* This isn't ideal because it reports the maximum number of queues but
* does not provide info on how many can be uplink/downlink or different
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 51dd090c1b..3c36d09730 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -369,6 +369,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
dev_info->capabilities = bbdev_capabilities;
dev_info->cpu_flag_reqs = NULL;
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
/* Calculates number of queues assigned to device */
dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 036579e3ec..67b44992b2 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -645,6 +645,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
dev_info->capabilities = bbdev_capabilities;
dev_info->cpu_flag_reqs = NULL;
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
/* Calculates number of queues assigned to device */
dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 5d090c62a0..11a385ef56 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -101,6 +101,7 @@ la12xx_info_get(struct rte_bbdev *dev __rte_unused,
dev_info->capabilities = bbdev_capabilities;
dev_info->cpu_flag_reqs = NULL;
dev_info->min_alignment = 64;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
}
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 28a0cb5d4e..662663c0c8 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -83,6 +83,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
* here for code completeness.
*/
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
}
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index db96b973af..98489d218b 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -255,6 +255,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
dev_info->min_alignment = 64;
dev_info->harq_buffer_size = 0;
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+ dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
}
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 4da80472a8..38630a23f8 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -1133,3 +1133,25 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
rte_bbdev_log(ERR, "Invalid operation type");
return NULL;
}
+
+const char *
+rte_bbdev_device_status_str(enum rte_bbdev_device_status status)
+{
+ static const char * const dev_sta_string[] = {
+ "RTE_BBDEV_DEV_NOSTATUS",
+ "RTE_BBDEV_DEV_NOT_SUPPORTED",
+ "RTE_BBDEV_DEV_RESET",
+ "RTE_BBDEV_DEV_CONFIGURED",
+ "RTE_BBDEV_DEV_ACTIVE",
+ "RTE_BBDEV_DEV_FATAL_ERR",
+ "RTE_BBDEV_DEV_RESTART_REQ",
+ "RTE_BBDEV_DEV_RECONFIG_REQ",
+ "RTE_BBDEV_DEV_CORRECT_ERR",
+ };
+
+ if (status < sizeof(dev_sta_string) / sizeof(char *))
+ return dev_sta_string[status];
+
+ rte_bbdev_log(ERR, "Invalid device status");
+ return NULL;
+}
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index b88c88167e..3c428c14e9 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -223,6 +223,21 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
int
rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
+/**
+ * Flags indicate the status of the device
+ */
+enum rte_bbdev_device_status {
+ RTE_BBDEV_DEV_NOSTATUS, /**< Nothing being reported */
+ RTE_BBDEV_DEV_NOT_SUPPORTED, /**< Device status is not supported on the PMD */
+ RTE_BBDEV_DEV_RESET, /**< Device in reset and un-configured state */
+ RTE_BBDEV_DEV_CONFIGURED, /**< Device is configured and ready to use */
+ RTE_BBDEV_DEV_ACTIVE, /**< Device is configured and VF is being used */
+ RTE_BBDEV_DEV_FATAL_ERR, /**< Device has hit a fatal uncorrectable error */
+ RTE_BBDEV_DEV_RESTART_REQ, /**< Device requires application to restart */
+ RTE_BBDEV_DEV_RECONFIG_REQ, /**< Device requires application to reconfigure queues */
+ RTE_BBDEV_DEV_CORRECT_ERR, /**< Warning of a correctable error event happened */
+};
+
/** Device statistics. */
struct rte_bbdev_stats {
uint64_t enqueued_count; /**< Count of all operations enqueued */
@@ -284,10 +299,12 @@ struct rte_bbdev_driver_info {
uint8_t max_ul_queue_priority;
/** Set if device supports per-queue interrupts */
bool queue_intr_supported;
- /** Minimum alignment of buffers, in bytes */
- uint16_t min_alignment;
+ /** Device Status */
+ enum rte_bbdev_device_status device_status;
/** HARQ memory available in kB */
uint32_t harq_buffer_size;
+ /** Minimum alignment of buffers, in bytes */
+ uint16_t min_alignment;
/** Byte endianness (RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN) supported
* for input/output data
*/
@@ -827,6 +844,20 @@ int
rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
void *data);
+/**
+ * Convert device status from enum to string.
+ *
+ * @param status
+ * Device status as enum.
+ *
+ * @returns
+ * Operation type as string or NULL if op_type is invalid.
+ *
+ */
+__rte_experimental
+const char*
+rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index a6a6b8b31a..99a7552779 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -748,7 +748,7 @@ struct rte_bbdev_op_cap_ldpc_enc {
uint16_t num_buffers_dst;
};
-/** Different operation types supported by the device
+/** Different operation types supported by the device.
* The related macro RTE_BBDEV_OP_TYPE_SIZE_MAX can be used as an absolute maximum for
* notably sizing array while allowing for future enumeration insertion.
*/
diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map
index 25a0a22bd4..addea05f00 100644
--- a/lib/bbdev/version.map
+++ b/lib/bbdev/version.map
@@ -39,3 +39,10 @@ DPDK_23 {
local: *;
};
+
+EXPERIMENTAL {
+ global:
+
+ # added in 22.11
+ rte_bbdev_device_status_str;
+};
--
2.37.1
^ permalink raw reply [relevance 4%]
* [PATCH v11 1/7] bbdev: allow operation type enum for growth
@ 2022-10-03 18:00 7% ` Nicolas Chautru
2022-10-03 18:00 4% ` [PATCH v11 2/7] bbdev: add device status info Nicolas Chautru
` (2 subsequent siblings)
3 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-10-03 18:00 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
Updating the enum for rte_bbdev_op_type
to allow to keep ABI compatible for enum insertion
while adding padded maximum value for array need.
Removing RTE_BBDEV_OP_TYPE_COUNT and instead exposing
RTE_BBDEV_OP_TYPE_SIZE_MAX.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
app/test-bbdev/test_bbdev.c | 2 +-
app/test-bbdev/test_bbdev_perf.c | 4 ++--
doc/guides/rel_notes/deprecation.rst | 5 +----
doc/guides/rel_notes/release_22_11.rst | 3 +++
examples/bbdev_app/main.c | 2 +-
lib/bbdev/rte_bbdev.c | 8 +++++---
lib/bbdev/rte_bbdev_op.h | 14 ++++++++++++--
7 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c
index ac06d7320a..65805977ae 100644
--- a/app/test-bbdev/test_bbdev.c
+++ b/app/test-bbdev/test_bbdev.c
@@ -521,7 +521,7 @@ test_bbdev_op_pool(void)
rte_mempool_free(mp);
TEST_ASSERT((mp = rte_bbdev_op_pool_create("Test_INV",
- RTE_BBDEV_OP_TYPE_COUNT, size, cache_size, 0)) == NULL,
+ RTE_BBDEV_OP_TYPE_SIZE_MAX, size, cache_size, 0)) == NULL,
"Failed test for rte_bbdev_op_pool_create: "
"returned value is not NULL for invalid type");
diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 311e5d1a96..f5eeb735b2 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -2429,13 +2429,13 @@ run_test_case_on_device(test_case_function *test_case_func, uint8_t dev_id,
/* Find capabilities */
const struct rte_bbdev_op_cap *cap = info.drv.capabilities;
- for (i = 0; i < RTE_BBDEV_OP_TYPE_COUNT; i++) {
+ do {
if (cap->type == test_vector.op_type) {
capabilities = cap;
break;
}
cap++;
- }
+ } while (cap->type != RTE_BBDEV_OP_NONE);
TEST_ASSERT_NOT_NULL(capabilities,
"Couldn't find capabilities");
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a991fa14de..e35c86a25c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -120,10 +120,7 @@ Deprecation Notices
``RTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRY`` and
``RTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRY`` in DPDK 22.11.
-* bbdev: ``RTE_BBDEV_OP_TYPE_COUNT`` terminating the ``rte_bbdev_op_type``
- enum will be deprecated and instead use fixed array size when required
- to allow for future enum extension.
- Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per
+* bbdev: Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22111>`__.
New members will be added in ``rte_bbdev_driver_info`` to expose
PMD queue topology inspired by
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 53fe21453c..e9db53f372 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -317,6 +317,9 @@ ABI Changes
* eventdev: Added ``weight`` and ``affinity`` fields
to ``rte_event_queue_conf`` structure.
+* bbdev: enum ``rte_bbdev_op_type`` was affected to remove ``RTE_BBDEV_OP_TYPE_COUNT``
+ and to allow for futureproof enum insertion a padded ``RTE_BBDEV_OP_TYPE_SIZE_MAX``
+ macro is added.
Known Issues
------------
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index fc7e8b8174..7e16e16bf8 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -1041,7 +1041,7 @@ main(int argc, char **argv)
void *sigret;
struct app_config_params app_params = def_app_config;
struct rte_mempool *ethdev_mbuf_mempool, *bbdev_mbuf_mempool;
- struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_COUNT];
+ struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_SIZE_MAX];
struct lcore_conf lcore_conf[RTE_MAX_LCORE] = { {0} };
struct lcore_statistics lcore_stats[RTE_MAX_LCORE] = { {0} };
struct stats_lcore_params stats_lcore;
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index aaee7b7872..4da80472a8 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -23,6 +23,8 @@
#define DEV_NAME "BBDEV"
+/* Number of supported operation types */
+#define BBDEV_OP_TYPE_COUNT 5
/* BBDev library logging ID */
RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE);
@@ -890,10 +892,10 @@ rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
return NULL;
}
- if (type >= RTE_BBDEV_OP_TYPE_COUNT) {
+ if (type >= BBDEV_OP_TYPE_COUNT) {
rte_bbdev_log(ERR,
"Invalid op type (%u), should be less than %u",
- type, RTE_BBDEV_OP_TYPE_COUNT);
+ type, BBDEV_OP_TYPE_COUNT);
return NULL;
}
@@ -1125,7 +1127,7 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
"RTE_BBDEV_OP_LDPC_ENC",
};
- if (op_type < RTE_BBDEV_OP_TYPE_COUNT)
+ if (op_type < BBDEV_OP_TYPE_COUNT)
return op_types[op_type];
rte_bbdev_log(ERR, "Invalid operation type");
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index 6d561334e8..a6a6b8b31a 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -48,6 +48,13 @@ extern "C" {
/* LDPC: Maximum number of Code Blocks in Transport Block.*/
#define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
+/*
+ * Maximum size to be used to manage the enum rte_bbdev_op_type
+ * including padding for future enum insertion.
+ * The enum values must be explicitly kept smaller or equal to this padded maximum size.
+ */
+#define RTE_BBDEV_OP_TYPE_SIZE_MAX 8
+
/** Flags for turbo decoder operation and capability structure */
enum rte_bbdev_op_td_flag_bitmasks {
/** If sub block de-interleaving is to be performed. */
@@ -741,14 +748,17 @@ struct rte_bbdev_op_cap_ldpc_enc {
uint16_t num_buffers_dst;
};
-/** Different operation types supported by the device */
+/** Different operation types supported by the device
+ * The related macro RTE_BBDEV_OP_TYPE_SIZE_MAX can be used as an absolute maximum for
+ * notably sizing array while allowing for future enumeration insertion.
+ */
enum rte_bbdev_op_type {
RTE_BBDEV_OP_NONE, /**< Dummy operation that does nothing */
RTE_BBDEV_OP_TURBO_DEC, /**< Turbo decode */
RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */
RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */
RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */
- RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */
+ /* Note: RTE_BBDEV_OP_TYPE_SIZE_MAX must be larger or equal to maximum enum value */
};
/** Bit indexes of possible errors reported through status field */
--
2.37.1
^ permalink raw reply [relevance 7%]
* Re: [PATCH v10 6/7] bbdev: add queue related warning and status information
2022-10-03 16:39 3% ` Chautru, Nicolas
@ 2022-10-03 17:21 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2022-10-03 17:21 UTC (permalink / raw)
To: Chautru, Nicolas
Cc: dev, gakhil, maxime.coquelin, trix, mdr, Richardson, Bruce,
david.marchand, stephen, Zhang, Mingshan, hemant.agrawal
03/10/2022 18:39, Chautru, Nicolas:
> Hi Thomas,
>
> I will update all your comments below today, thanks.
Please do a self review of other patches (I reviewed only this one),
I suspect there are a lot of other details to improve in other places.
> The one where we need your confirmation is specifically this comment from your, I believe we discussed but good to make sure we are all aligned:
Yes let's be clear.
> > But the big question is why do we need this "MAX" value?
> > The guideline is to avoid using such MAX value for long term compatibility.
>
> This is not a _MAX enum but a _SIZE_MAX for array related to that enum. Note that the actual max value of the enum exists but is used a private macro.
> The distinction is that the application cannot make any assumptions on what is the maximum enum value (ie. we don't want enum with MAX value, that is not future proof has captured in doc).
> But the application can make some assumption on the sizing of array based on such an enum. The difference being the padding which allows for the enum growth without breaking ABI or application.
> The previous name was _PADDED_MAX to make it clear this not a max enum but a padded value. Then more recenrtly the consensus in the community was to change this to _SIZE_MAX to be arguably more explicit this is to be used for array size. The comments I believe also make it clear this is not a MAX enum.
>
> Does that make sense and do you agree this is best consensus so far to move forward?
It makes a lot of sense to me because this is what I proposed 2 or 3 years ago
to the techboard when we approached different general solutions.
But it has been said that it is not ideal for 2 reasons I think:
- there is a compatibility breakage when we reach the maximum
- there is no assumption on how the padding is filled
That's why the preferred way should be to avoid having any maximum value.
For instance, array allocation and iteration could be done in the API.
Anyway I'm fine with your solution for now.
^ permalink raw reply [relevance 0%]
* Re: [PATCH v7 1/7] eal/loongarch: support LoongArch architecture
@ 2022-10-03 17:15 4% ` David Marchand
2022-10-04 8:49 0% ` zhoumin
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-10-03 17:15 UTC (permalink / raw)
To: Min Zhou
Cc: thomas, bruce.richardson, anatoly.burakov, qiming.yang,
Yuying.Zhang, jgrajcia, konstantin.v.ananyev, dev, maobibo
On Fri, Sep 30, 2022 at 10:02 AM Min Zhou <zhoumin@loongson.cn> wrote:
>
> Add all necessary elements for DPDK to compile and run EAL on
> LoongArch64 Soc.
>
> This includes:
>
> - EAL library implementation for LoongArch ISA.
> - meson build structure for 'loongarch' architecture.
> RTE_ARCH_LOONGARCH define is added for architecture identification.
> - xmm_t structure operation stubs as there is no vector support in
> the current version for LoongArch.
>
> Compilation was tested on Debian and CentOS using loongarch64
> cross-compile toolchain from x86 build hosts. Functions were tested
> on Loongnix and Kylin which are two Linux distributions supported
> LoongArch host based on Linux 4.19 maintained by Loongson
> Corporation.
>
> We also tested DPDK on LoongArch with some external applications,
> including: Pktgen-DPDK, OVS, VPP.
>
> The platform is currently marked as linux-only because there is no
> other OS than Linux support LoongArch host currently.
>
> The i40e PMD driver is disabled on LoongArch because of the absence
> of vector support in the current version.
>
> Similar to RISC-V, the compilation of following modules has been
> disabled by this commit and will be re-enabled in later commits as
> fixes are introduced:
> net/ixgbe, net/memif, net/tap, example/l3fwd.
>
> Signed-off-by: Min Zhou <zhoumin@loongson.cn>
> ---
> MAINTAINERS | 6 ++
> app/test/test_xmmt_ops.h | 12 +++
> .../loongarch/loongarch_loongarch64_linux_gcc | 16 ++++
> config/loongarch/meson.build | 43 +++++++++
Please update devtools/test-meson-builds.sh in this patch.
I tested the compilation of the series per patch (I caught one issue
in net/bnxt which I posted a fix for), with this diff:
@@ -260,6 +260,10 @@ build build-x86-mingw $f skipABI -Dexamples=helloworld
f=$srcdir/config/arm/arm64_armv8_linux_gcc
build build-arm64-generic-gcc $f ABI $use_shared
+# generic LoongArch
+f=$srcdir/config/loongarch/loongarch_loongarch64_linux_gcc
+build build-loongarch64-generic-gcc $f ABI $use_shared
+
# IBM POWER
f=$srcdir/config/ppc/ppc64le-power8-linux-gcc
build build-ppc64-power8-gcc $f ABI $use_shared
> doc/guides/contributing/design.rst | 2 +-
> .../cross_build_dpdk_for_loongarch.rst | 87 +++++++++++++++++
> doc/guides/linux_gsg/index.rst | 1 +
> doc/guides/nics/features.rst | 8 ++
> doc/guides/nics/features/default.ini | 1 +
> doc/guides/rel_notes/release_22_11.rst | 7 ++
> drivers/net/i40e/meson.build | 6 ++
> drivers/net/ixgbe/meson.build | 6 ++
> drivers/net/memif/meson.build | 6 ++
> drivers/net/tap/meson.build | 6 ++
> examples/l3fwd/meson.build | 6 ++
> lib/eal/linux/eal_memory.c | 4 +
> lib/eal/loongarch/include/meson.build | 18 ++++
> lib/eal/loongarch/include/rte_atomic.h | 47 ++++++++++
> lib/eal/loongarch/include/rte_byteorder.h | 40 ++++++++
> lib/eal/loongarch/include/rte_cpuflags.h | 39 ++++++++
> lib/eal/loongarch/include/rte_cycles.h | 47 ++++++++++
> lib/eal/loongarch/include/rte_io.h | 18 ++++
> lib/eal/loongarch/include/rte_memcpy.h | 61 ++++++++++++
> lib/eal/loongarch/include/rte_pause.h | 24 +++++
> .../loongarch/include/rte_power_intrinsics.h | 20 ++++
> lib/eal/loongarch/include/rte_prefetch.h | 47 ++++++++++
> lib/eal/loongarch/include/rte_rwlock.h | 42 +++++++++
> lib/eal/loongarch/include/rte_spinlock.h | 64 +++++++++++++
> lib/eal/loongarch/include/rte_vect.h | 65 +++++++++++++
> lib/eal/loongarch/meson.build | 11 +++
> lib/eal/loongarch/rte_cpuflags.c | 93 +++++++++++++++++++
> lib/eal/loongarch/rte_cycles.c | 45 +++++++++
> lib/eal/loongarch/rte_hypervisor.c | 11 +++
> lib/eal/loongarch/rte_power_intrinsics.c | 53 +++++++++++
> meson.build | 2 +
> 35 files changed, 963 insertions(+), 1 deletion(-)
> create mode 100644 config/loongarch/loongarch_loongarch64_linux_gcc
> create mode 100644 config/loongarch/meson.build
> create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
> create mode 100644 lib/eal/loongarch/include/meson.build
> create mode 100644 lib/eal/loongarch/include/rte_atomic.h
> create mode 100644 lib/eal/loongarch/include/rte_byteorder.h
> create mode 100644 lib/eal/loongarch/include/rte_cpuflags.h
> create mode 100644 lib/eal/loongarch/include/rte_cycles.h
> create mode 100644 lib/eal/loongarch/include/rte_io.h
> create mode 100644 lib/eal/loongarch/include/rte_memcpy.h
> create mode 100644 lib/eal/loongarch/include/rte_pause.h
> create mode 100644 lib/eal/loongarch/include/rte_power_intrinsics.h
> create mode 100644 lib/eal/loongarch/include/rte_prefetch.h
> create mode 100644 lib/eal/loongarch/include/rte_rwlock.h
> create mode 100644 lib/eal/loongarch/include/rte_spinlock.h
> create mode 100644 lib/eal/loongarch/include/rte_vect.h
> create mode 100644 lib/eal/loongarch/meson.build
> create mode 100644 lib/eal/loongarch/rte_cpuflags.c
> create mode 100644 lib/eal/loongarch/rte_cycles.c
> create mode 100644 lib/eal/loongarch/rte_hypervisor.c
> create mode 100644 lib/eal/loongarch/rte_power_intrinsics.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 51d77460ec..6c5fcef749 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -294,6 +294,12 @@ F: app/*/*_neon.*
> F: examples/*/*_neon.*
> F: examples/common/neon/
>
> +LoongArch
> +M: Min Zhou <zhoumin@loongson.cn>
> +F: config/loongarch/
> +F: doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
> +F: lib/eal/loongarch/
> +
> IBM POWER (alpha)
> M: David Christensen <drc@linux.vnet.ibm.com>
> F: config/ppc/
> diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h
> index 55f256599e..626aa9bcba 100644
> --- a/app/test/test_xmmt_ops.h
> +++ b/app/test/test_xmmt_ops.h
> @@ -65,6 +65,18 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
> return data;
> }
>
> +#elif defined(RTE_ARCH_LOONGARCH)
> +
> +#define vect_loadu_sil128(p) vect_load_128(p)
> +
> +/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
> +static __rte_always_inline xmm_t
> +vect_set_epi32(int i3, int i2, int i1, int i0)
> +{
> + xmm_t data = (xmm_t){.u32 = {i0, i1, i2, i3}};
> +
> + return data;
> +}
> #endif
>
> #endif /* _TEST_XMMT_OPS_H_ */
> diff --git a/config/loongarch/loongarch_loongarch64_linux_gcc b/config/loongarch/loongarch_loongarch64_linux_gcc
> new file mode 100644
> index 0000000000..0c44ae96e6
> --- /dev/null
> +++ b/config/loongarch/loongarch_loongarch64_linux_gcc
> @@ -0,0 +1,16 @@
> +[binaries]
> +c = 'loongarch64-unknown-linux-gnu-gcc'
> +cpp = 'loongarch64-unknown-linux-gnu-cpp'
> +ar = 'loongarch64-unknown-linux-gnu-gcc-ar'
> +strip = 'loongarch64-unknown-linux-gnu-strip'
> +pcap-config = ''
> +
> +[host_machine]
> +system = 'linux'
> +cpu_family = 'loongarch64'
> +cpu = '3a5000'
> +endian = 'little'
> +
> +[properties]
> +implementor_id = 'generic'
> +implementor_pn = 'default'
Two things to fix here:
- Please add ccache, see e3fd286ec471 ("build: add ccache for cross
compilation")
- the cpp meson variable should refer to a c++ compiler. See
f75dd6d3b121 ("config: fix C++ cross compiler for Arm and PPC")
> diff --git a/config/loongarch/meson.build b/config/loongarch/meson.build
> new file mode 100644
> index 0000000000..99dabef203
> --- /dev/null
> +++ b/config/loongarch/meson.build
> @@ -0,0 +1,43 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2022 Loongson Technology Corporation Limited
> +
> +if not dpdk_conf.get('RTE_ARCH_64')
> + error('Only 64-bit compiles are supported for this platform type')
> +endif
> +dpdk_conf.set('RTE_ARCH', 'loongarch')
> +dpdk_conf.set('RTE_ARCH_LOONGARCH', 1)
> +dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
> +
> +machine_args_generic = [
> + ['default', ['-march=loongarch64']],
> +]
> +
> +flags_generic = [
> + ['RTE_MACHINE', '"loongarch64"'],
> + ['RTE_MAX_LCORE', 64],
> + ['RTE_MAX_NUMA_NODES', 16],
> + ['RTE_CACHE_LINE_SIZE', 64]]
> +
> +impl_generic = ['Generic loongarch', flags_generic, machine_args_generic]
> +
> +machine = []
> +machine_args = []
> +
> +machine = impl_generic
> +impl_pn = 'default'
> +
> +message('Implementer : ' + machine[0])
> +foreach flag: machine[1]
> + if flag.length() > 0
> + dpdk_conf.set(flag[0], flag[1])
> + endif
> +endforeach
> +
> +foreach marg: machine[2]
> + if marg[0] == impl_pn
> + foreach f: marg[1]
> + machine_args += f
> + endforeach
> + endif
> +endforeach
> +message(machine_args)
cpu_instruction_set is not supported, though I am not sure LoongArch needs it.
Maybe something to add in the future but not blocking atm.
> diff --git a/doc/guides/contributing/design.rst b/doc/guides/contributing/design.rst
> index 0383afe5c8..d24a7ff6a0 100644
> --- a/doc/guides/contributing/design.rst
> +++ b/doc/guides/contributing/design.rst
> @@ -42,7 +42,7 @@ Per Architecture Sources
> The following macro options can be used:
>
> * ``RTE_ARCH`` is a string that contains the name of the architecture.
> -* ``RTE_ARCH_I686``, ``RTE_ARCH_X86_64``, ``RTE_ARCH_X86_X32``, ``RTE_ARCH_PPC_64``, ``RTE_ARCH_RISCV``, ``RTE_ARCH_ARM``, ``RTE_ARCH_ARMv7`` or ``RTE_ARCH_ARM64`` are defined only if we are building for those architectures.
> +* ``RTE_ARCH_I686``, ``RTE_ARCH_X86_64``, ``RTE_ARCH_X86_X32``, ``RTE_ARCH_PPC_64``, ``RTE_ARCH_RISCV``, ``RTE_ARCH_LOONGARCH``, ``RTE_ARCH_ARM``, ``RTE_ARCH_ARMv7`` or ``RTE_ARCH_ARM64`` are defined only if we are building for those architectures.
>
> Per Execution Environment Sources
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
> new file mode 100644
> index 0000000000..3afc6d4933
> --- /dev/null
> +++ b/doc/guides/linux_gsg/cross_build_dpdk_for_loongarch.rst
> @@ -0,0 +1,87 @@
> +.. SPDX-License-Identifier: BSD-3-Clause
> + Copyright(c) 2022 Loongson Technology Corporation Limited
> +
> +Cross compiling DPDK for LoongArch
> +==================================
> +
> +This chapter describes how to cross compile DPDK for LoongArch from x86 build
> +hosts.
> +
> +.. note::
> +
> + Due to some of the code under review, the current Linux 5.19 cannot boot
> + on LoongArch system. There are still some Linux distributions that have
> + supported LoongArch host, such as Anolis OS, Kylin, Loongnix and UOS. These
> + distributions base on Linux kernel 4.19 supported by Loongson Corporation.
> + Because LoongArch is such a new platform with many fundamental pieces of
> + software still under development, it is currently recommended to cross
> + compile DPDK on x86 for LoongArch.
> +
> +
> +Prerequisites
> +-------------
> +
> +Ensure that you have all pre-requisites for building DPDK natively as those
> +will be required also for cross-compilation.
> +
> +Linux kernel
> +~~~~~~~~~~~~
> +
> +Make sure that LoongArch host is running Linux kernel 4.19 or newer supported
> +by Loongson Corporation. The support for LoongArch in the current Linux 5.19
> +is not complete because it still misses some patches to add for other
> +subsystems.
> +
> +GNU toolchain
> +-------------
> +
> +Obtain the cross toolchain
> +~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The build process was tested using:
> +
> +* Latest `LoongArch GNU toolchain
> + <https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz>`_
> + on Debian 10.4 or CentOS 8.
> +
> +Alternatively the toolchain may be built straight from the source via CLFS, to
> +do that follow the instructions on `CLFS for LoongArch64
> +<https://github.com/sunhaiyong1978/CLFS-for-LoongArch>`_ github page.
> +
> +To download cross tools from github we can use the following command:
> +
> +.. code-block:: console
> +
> + wget -P /tmp/ https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
> +
Some people (like me ;-)) will want to generate their own cross toolchain.
I tried your script, and I added some comments in the thread where you
provided it.
I think adding the whole script in the documentation is too much.
I would lean to adding a link to this thread in the documentation instead.
https://inbox.dpdk.org/dev/53b50799-cb29-7ee6-be89-4fe21566e127@loongson.cn/T/#m1da99578f85894a4ddcd8e39d8239869e6a501d1
Opinion?
> +Unzip and add into the PATH
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +After downloading the cross-tools file, we need unzip and add those executable
> +binaries into the PATH as follows:
> +
> +.. code-block:: console
> +
> + tar -xvf /tmp/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz -C <cross_tool_install_dir> --strip-components 1
> + export PATH=$PATH:<cross_tool_install_dir>/bin
> +
> +
> +Cross Compiling DPDK with GNU toolchain using Meson
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +To cross-compile DPDK for generic LoongArch we can use the following command:
> +
> +.. code-block:: console
> +
> + meson cross-build --cross-file config/loongarch/loongarch_loongarch64_linux_gcc
> + ninja -C cross-build
> +
> +Supported cross-compilation targets
> +-----------------------------------
> +
> +Currently the following target is supported:
> +
> +* Generic LoongArch64 ISA: ``config/loongarch/loongarch_loongarch64_linux_gcc``
> +
> +To add a new target support, a corresponding cross-file has to be added to
> +``config/loongarch`` directory.
> diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
> index 747552c385..c3e67bf9ec 100644
> --- a/doc/guides/linux_gsg/index.rst
> +++ b/doc/guides/linux_gsg/index.rst
> @@ -14,6 +14,7 @@ Getting Started Guide for Linux
> sys_reqs
> build_dpdk
> cross_build_dpdk_for_arm64
> + cross_build_dpdk_for_loongarch
> cross_build_dpdk_for_riscv
> linux_drivers
> build_sample_apps
> diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
> index b4a8e9881c..2472049095 100644
> --- a/doc/guides/nics/features.rst
> +++ b/doc/guides/nics/features.rst
> @@ -832,6 +832,14 @@ ARMv8
> Support armv8a (64bit) architecture.
>
>
> +.. _nic_features_loongarch64:
Hum, one comment.
This is not related to your patch, so you can keep as you posted.
Those anchors are unused, we should remove them all.
> +
> +LoongArch64
> +-----------
> +
> +Support 64-bit LoongArch architecture.
> +
> +
> .. _nic_features_power8:
>
> Power8
> diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
> index f7192cb0da..cbc17c0434 100644
> --- a/doc/guides/nics/features/default.ini
> +++ b/doc/guides/nics/features/default.ini
> @@ -71,6 +71,7 @@ Linux =
> Windows =
> ARMv7 =
> ARMv8 =
> +LoongArch64 =
> Power8 =
> rv64 =
> x86-32 =
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 0b4740abd1..ac1f9a924c 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -96,6 +96,13 @@ New Features
> * Added ``rte_event_eth_tx_adapter_queue_stop`` to stop the Tx Adapter
> from enqueueing any packets to the Tx queue.
>
> +* **Added initial LoongArch architecture support.**
> +
> + * Added EAL implementation for LoongArch architecture. The initial devices
> + the porting was tested on included Loongson 3A5000, Loongson 3C5000 and
> + Loongson 3C5000L. In theory this implementation should work with any target
> + based on ``LoongArch`` ISA.
> +
This is a new feature in EAL.
As described in the comments in the release notes, EAL features come
first in the list.
>
> Removed Items
> -------------
> diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
> index 84fd42754e..16fd491b9a 100644
> --- a/drivers/net/i40e/meson.build
> +++ b/drivers/net/i40e/meson.build
> @@ -7,6 +7,12 @@ if arch_subdir == 'riscv'
> subdir_done()
> endif
>
> +if arch_subdir == 'loongarch'
> + build = false
> + reason = 'not supported on LoongArch'
> + subdir_done()
> +endif
> +
> cflags += ['-DPF_DRIVER',
> '-DVF_DRIVER',
> '-DINTEGRATED_VF',
> diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
> index a18908ef7c..80ab012448 100644
> --- a/drivers/net/ixgbe/meson.build
> +++ b/drivers/net/ixgbe/meson.build
> @@ -1,6 +1,12 @@
> # SPDX-License-Identifier: BSD-3-Clause
> # Copyright(c) 2017 Intel Corporation
>
> +if arch_subdir == 'loongarch'
> + build = false
> + reason = 'not supported on LoongArch'
> + subdir_done()
> +endif
> +
> cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
>
> subdir('base')
> diff --git a/drivers/net/memif/meson.build b/drivers/net/memif/meson.build
> index 680bc8631c..30c0fbc798 100644
> --- a/drivers/net/memif/meson.build
> +++ b/drivers/net/memif/meson.build
> @@ -1,6 +1,12 @@
> # SPDX-License-Identifier: BSD-3-Clause
> # Copyright 2018-2019 Cisco Systems, Inc. All rights reserved.
>
> +if arch_subdir == 'loongarch'
> + build = false
> + reason = 'not supported on LoongArch'
> + subdir_done()
> +endif
> +
> if not is_linux
> build = false
> reason = 'only supported on Linux'
> diff --git a/drivers/net/tap/meson.build b/drivers/net/tap/meson.build
> index c09713a67b..f0d03069cd 100644
> --- a/drivers/net/tap/meson.build
> +++ b/drivers/net/tap/meson.build
> @@ -1,6 +1,12 @@
> # SPDX-License-Identifier: BSD-3-Clause
> # Copyright 2018 Luca Boccassi <bluca@debian.org>
>
> +if arch_subdir == 'loongarch'
> + build = false
> + reason = 'not supported on LoongArch'
> + subdir_done()
> +endif
> +
> if not is_linux
> build = false
> reason = 'only supported on Linux'
> diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build
> index b40244a941..d2f2d96099 100644
> --- a/examples/l3fwd/meson.build
> +++ b/examples/l3fwd/meson.build
> @@ -6,6 +6,12 @@
> # To build this example as a standalone application with an already-installed
> # DPDK instance, use 'make'
>
> +if arch_subdir == 'loongarch'
> + build = false
> + reason = 'not supported on LoongArch'
> + subdir_done()
> +endif
> +
> allow_experimental_apis = true
> deps += ['acl', 'hash', 'lpm', 'fib', 'eventdev']
> sources = files(
> diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
> index c890c42106..60fc8cc6ca 100644
> --- a/lib/eal/linux/eal_memory.c
> +++ b/lib/eal/linux/eal_memory.c
> @@ -77,7 +77,11 @@ uint64_t eal_get_baseaddr(void)
> * rte_mem_check_dma_mask for ensuring all memory is within supported
> * range.
> */
> +#if defined(RTE_ARCH_LOONGARCH)
> + return 0x7000000000ULL;
> +#else
> return 0x100000000ULL;
> +#endif
> }
>
> /*
> diff --git a/lib/eal/loongarch/include/meson.build b/lib/eal/loongarch/include/meson.build
> new file mode 100644
> index 0000000000..6e8d12601a
> --- /dev/null
> +++ b/lib/eal/loongarch/include/meson.build
> @@ -0,0 +1,18 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2022 Loongson Technology Corporation Limited
> +
> +arch_headers = files(
> + 'rte_atomic.h',
> + 'rte_byteorder.h',
> + 'rte_cpuflags.h',
> + 'rte_cycles.h',
> + 'rte_io.h',
> + 'rte_memcpy.h',
> + 'rte_pause.h',
> + 'rte_power_intrinsics.h',
> + 'rte_prefetch.h',
> + 'rte_rwlock.h',
> + 'rte_spinlock.h',
> + 'rte_vect.h',
> +)
> +install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
> diff --git a/lib/eal/loongarch/include/rte_atomic.h b/lib/eal/loongarch/include/rte_atomic.h
> new file mode 100644
> index 0000000000..b0ddcab72e
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_atomic.h
> @@ -0,0 +1,47 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_ATOMIC_LOONGARCH_H_
> +#define _RTE_ATOMIC_LOONGARCH_H_
No need for _.
RTE_ATOMIC_LOONGARCH_H is enough.
This comment applies to other headers.
> +
> +#ifndef RTE_FORCE_INTRINSICS
> +# error Platform must be built with RTE_FORCE_INTRINSICS
> +#endif
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +#include "generic/rte_atomic.h"
> +
> +#define rte_mb() do { asm volatile("dbar 0":::"memory"); } while (0)
> +
> +#define rte_wmb() rte_mb()
> +
> +#define rte_rmb() rte_mb()
> +
> +#define rte_smp_mb() rte_mb()
> +
> +#define rte_smp_wmb() rte_mb()
> +
> +#define rte_smp_rmb() rte_mb()
> +
> +#define rte_io_mb() rte_mb()
> +
> +#define rte_io_wmb() rte_mb()
> +
> +#define rte_io_rmb() rte_mb()
> +
> +static __rte_always_inline void
> +rte_atomic_thread_fence(int memorder)
> +{
> + __atomic_thread_fence(memorder);
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_ATOMIC_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_byteorder.h b/lib/eal/loongarch/include/rte_byteorder.h
> new file mode 100644
> index 0000000000..ba27998497
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_byteorder.h
> @@ -0,0 +1,40 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_BYTEORDER_LOONGARCH_H_
> +#define _RTE_BYTEORDER_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "generic/rte_byteorder.h"
> +
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> +
> +#define rte_cpu_to_le_16(x) (x)
> +#define rte_cpu_to_le_32(x) (x)
> +#define rte_cpu_to_le_64(x) (x)
> +
> +#define rte_cpu_to_be_16(x) rte_bswap16(x)
> +#define rte_cpu_to_be_32(x) rte_bswap32(x)
> +#define rte_cpu_to_be_64(x) rte_bswap64(x)
> +
> +#define rte_le_to_cpu_16(x) (x)
> +#define rte_le_to_cpu_32(x) (x)
> +#define rte_le_to_cpu_64(x) (x)
> +
> +#define rte_be_to_cpu_16(x) rte_bswap16(x)
> +#define rte_be_to_cpu_32(x) rte_bswap32(x)
> +#define rte_be_to_cpu_64(x) rte_bswap64(x)
> +
> +#else /* RTE_BIG_ENDIAN */
> +#error "LoongArch not support big endian!"
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_BYTEORDER_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_cpuflags.h b/lib/eal/loongarch/include/rte_cpuflags.h
> new file mode 100644
> index 0000000000..d9121a00a8
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_cpuflags.h
> @@ -0,0 +1,39 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_CPUFLAGS_LOONGARCH_H_
> +#define _RTE_CPUFLAGS_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * Enumeration of all CPU features supported
> + */
> +enum rte_cpu_flag_t {
> + RTE_CPUFLAG_CPUCFG = 0,
> + RTE_CPUFLAG_LAM,
> + RTE_CPUFLAG_UAL,
> + RTE_CPUFLAG_FPU,
> + RTE_CPUFLAG_LSX,
> + RTE_CPUFLAG_LASX,
> + RTE_CPUFLAG_CRC32,
> + RTE_CPUFLAG_COMPLEX,
> + RTE_CPUFLAG_CRYPTO,
> + RTE_CPUFLAG_LVZ,
> + RTE_CPUFLAG_LBT_X86,
> + RTE_CPUFLAG_LBT_ARM,
> + RTE_CPUFLAG_LBT_MIPS,
> + /* The last item */
> + RTE_CPUFLAG_NUMFLAGS /**< This should always be the last! */
> +};
> +
> +#include "generic/rte_cpuflags.h"
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_CPUFLAGS_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_cycles.h b/lib/eal/loongarch/include/rte_cycles.h
> new file mode 100644
> index 0000000000..0f1539be1b
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_cycles.h
> @@ -0,0 +1,47 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_CYCLES_LOONGARCH_H_
> +#define _RTE_CYCLES_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "generic/rte_cycles.h"
> +
> +/**
> + * Read the time base register.
> + *
> + * @return
> + * The time base for this lcore.
> + */
> +static inline uint64_t
> +rte_rdtsc(void)
> +{
> + uint64_t count;
> +
> + __asm__ __volatile__ (
> + "rdtime.d %[cycles], $zero\n"
> + : [cycles] "=r" (count)
> + ::
> + );
> + return count;
> +}
> +
> +static inline uint64_t
> +rte_rdtsc_precise(void)
> +{
> + rte_mb();
> + return rte_rdtsc();
> +}
> +
> +static inline uint64_t
> +rte_get_tsc_cycles(void) { return rte_rdtsc(); }
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_CYCLES_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_io.h b/lib/eal/loongarch/include/rte_io.h
> new file mode 100644
> index 0000000000..af152a727a
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_io.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_IO_LOONGARCH_H_
> +#define _RTE_IO_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "generic/rte_io.h"
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_IO_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_memcpy.h b/lib/eal/loongarch/include/rte_memcpy.h
> new file mode 100644
> index 0000000000..e7b91e9ce4
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_memcpy.h
> @@ -0,0 +1,61 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_MEMCPY_LOONGARCH_H_
> +#define _RTE_MEMCPY_LOONGARCH_H_
> +
> +#include <stdint.h>
> +#include <string.h>
> +
> +#include "rte_common.h"
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "generic/rte_memcpy.h"
> +
> +static inline void
> +rte_mov16(uint8_t *dst, const uint8_t *src)
> +{
> + memcpy(dst, src, 16);
> +}
> +
> +static inline void
> +rte_mov32(uint8_t *dst, const uint8_t *src)
> +{
> + memcpy(dst, src, 32);
> +}
> +
> +static inline void
> +rte_mov48(uint8_t *dst, const uint8_t *src)
> +{
> + memcpy(dst, src, 48);
> +}
> +
> +static inline void
> +rte_mov64(uint8_t *dst, const uint8_t *src)
> +{
> + memcpy(dst, src, 64);
> +}
> +
> +static inline void
> +rte_mov128(uint8_t *dst, const uint8_t *src)
> +{
> + memcpy(dst, src, 128);
> +}
> +
> +static inline void
> +rte_mov256(uint8_t *dst, const uint8_t *src)
> +{
> + memcpy(dst, src, 256);
> +}
> +
> +#define rte_memcpy(d, s, n) memcpy((d), (s), (n))
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_MEMCPY_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_pause.h b/lib/eal/loongarch/include/rte_pause.h
> new file mode 100644
> index 0000000000..438de23128
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_pause.h
> @@ -0,0 +1,24 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_PAUSE_LOONGARCH_H_
> +#define _RTE_PAUSE_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "rte_atomic.h"
> +
> +#include "generic/rte_pause.h"
> +
> +static inline void rte_pause(void)
> +{
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_PAUSE_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_power_intrinsics.h b/lib/eal/loongarch/include/rte_power_intrinsics.h
> new file mode 100644
> index 0000000000..b6a2c0d82e
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_power_intrinsics.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_POWER_INTRINSIC_LOONGARCH_H_
> +#define _RTE_POWER_INTRINSIC_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +
> +#include "generic/rte_power_intrinsics.h"
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_POWER_INTRINSIC_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_prefetch.h b/lib/eal/loongarch/include/rte_prefetch.h
> new file mode 100644
> index 0000000000..0fd9262ea8
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_prefetch.h
> @@ -0,0 +1,47 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_PREFETCH_LOONGARCH_H_
> +#define _RTE_PREFETCH_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +#include "generic/rte_prefetch.h"
> +
> +static inline void rte_prefetch0(const volatile void *p)
> +{
> + __builtin_prefetch((const void *)(uintptr_t)p, 0, 3);
> +}
> +
> +static inline void rte_prefetch1(const volatile void *p)
> +{
> + __builtin_prefetch((const void *)(uintptr_t)p, 0, 2);
> +}
> +
> +static inline void rte_prefetch2(const volatile void *p)
> +{
> + __builtin_prefetch((const void *)(uintptr_t)p, 0, 1);
> +}
> +
> +static inline void rte_prefetch_non_temporal(const volatile void *p)
> +{
> + /* non-temporal version not available, fallback to rte_prefetch0 */
> + rte_prefetch0(p);
> +}
> +
> +__rte_experimental
> +static inline void
> +rte_cldemote(const volatile void *p)
> +{
> + RTE_SET_USED(p);
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_PREFETCH_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_rwlock.h b/lib/eal/loongarch/include/rte_rwlock.h
> new file mode 100644
> index 0000000000..aac6f60120
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_rwlock.h
> @@ -0,0 +1,42 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_RWLOCK_LOONGARCH_H_
> +#define _RTE_RWLOCK_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "generic/rte_rwlock.h"
> +
> +static inline void
> +rte_rwlock_read_lock_tm(rte_rwlock_t *rwl)
> +{
> + rte_rwlock_read_lock(rwl);
> +}
> +
> +static inline void
> +rte_rwlock_read_unlock_tm(rte_rwlock_t *rwl)
> +{
> + rte_rwlock_read_unlock(rwl);
> +}
> +
> +static inline void
> +rte_rwlock_write_lock_tm(rte_rwlock_t *rwl)
> +{
> + rte_rwlock_write_lock(rwl);
> +}
> +
> +static inline void
> +rte_rwlock_write_unlock_tm(rte_rwlock_t *rwl)
> +{
> + rte_rwlock_write_unlock(rwl);
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_RWLOCK_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_spinlock.h b/lib/eal/loongarch/include/rte_spinlock.h
> new file mode 100644
> index 0000000000..dd07538c7f
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_spinlock.h
> @@ -0,0 +1,64 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_SPINLOCK_LOONGARCH_H_
> +#define _RTE_SPINLOCK_LOONGARCH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +#include "generic/rte_spinlock.h"
> +
> +#ifndef RTE_FORCE_INTRINSICS
> +# error Platform must be built with RTE_FORCE_INTRINSICS
> +#endif
> +
> +static inline int rte_tm_supported(void)
> +{
> + return 0;
> +}
> +
> +static inline void
> +rte_spinlock_lock_tm(rte_spinlock_t *sl)
> +{
> + rte_spinlock_lock(sl); /* fall-back */
> +}
> +
> +static inline int
> +rte_spinlock_trylock_tm(rte_spinlock_t *sl)
> +{
> + return rte_spinlock_trylock(sl);
> +}
> +
> +static inline void
> +rte_spinlock_unlock_tm(rte_spinlock_t *sl)
> +{
> + rte_spinlock_unlock(sl);
> +}
> +
> +static inline void
> +rte_spinlock_recursive_lock_tm(rte_spinlock_recursive_t *slr)
> +{
> + rte_spinlock_recursive_lock(slr); /* fall-back */
> +}
> +
> +static inline void
> +rte_spinlock_recursive_unlock_tm(rte_spinlock_recursive_t *slr)
> +{
> + rte_spinlock_recursive_unlock(slr);
> +}
> +
> +static inline int
> +rte_spinlock_recursive_trylock_tm(rte_spinlock_recursive_t *slr)
> +{
> + return rte_spinlock_recursive_trylock(slr);
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_SPINLOCK_LOONGARCH_H_ */
> diff --git a/lib/eal/loongarch/include/rte_vect.h b/lib/eal/loongarch/include/rte_vect.h
> new file mode 100644
> index 0000000000..5951a2674c
> --- /dev/null
> +++ b/lib/eal/loongarch/include/rte_vect.h
> @@ -0,0 +1,65 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef _RTE_VECT_LOONGARCH_H_
> +#define _RTE_VECT_LOONGARCH_H_
> +
> +#include <stdint.h>
> +#include "generic/rte_vect.h"
> +#include "rte_common.h"
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define RTE_VECT_DEFAULT_SIMD_BITWIDTH RTE_VECT_SIMD_DISABLED
> +
> +typedef union xmm {
> + int8_t i8[16];
> + int16_t i16[8];
> + int32_t i32[4];
> + int64_t i64[2];
> + uint8_t u8[16];
> + uint16_t u16[8];
> + uint32_t u32[4];
> + uint64_t u64[2];
> + double pd[2];
> +} __rte_aligned(16) xmm_t;
> +
> +#define XMM_SIZE (sizeof(xmm_t))
> +#define XMM_MASK (XMM_SIZE - 1)
> +
> +typedef union rte_xmm {
> + xmm_t x;
> + uint8_t u8[XMM_SIZE / sizeof(uint8_t)];
> + uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
> + uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
> + uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
> + double pd[XMM_SIZE / sizeof(double)];
> +} __rte_aligned(16) rte_xmm_t;
> +
> +static inline xmm_t
> +vect_load_128(void *p)
> +{
> + xmm_t ret = *((xmm_t *)p);
> +
> + return ret;
> +}
> +
> +static inline xmm_t
> +vect_and(xmm_t data, xmm_t mask)
> +{
> + rte_xmm_t ret = {.x = data };
> + rte_xmm_t m = {.x = mask };
> + ret.u64[0] &= m.u64[0];
> + ret.u64[1] &= m.u64[1];
> +
> + return ret.x;
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/lib/eal/loongarch/meson.build b/lib/eal/loongarch/meson.build
> new file mode 100644
> index 0000000000..4dcc27babb
> --- /dev/null
> +++ b/lib/eal/loongarch/meson.build
> @@ -0,0 +1,11 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2022 Loongson Technology Corporation Limited
> +
> +subdir('include')
> +
> +sources += files(
> + 'rte_cpuflags.c',
> + 'rte_cycles.c',
> + 'rte_hypervisor.c',
> + 'rte_power_intrinsics.c',
> +)
> diff --git a/lib/eal/loongarch/rte_cpuflags.c b/lib/eal/loongarch/rte_cpuflags.c
> new file mode 100644
> index 0000000000..0a75ca58d4
> --- /dev/null
> +++ b/lib/eal/loongarch/rte_cpuflags.c
> @@ -0,0 +1,93 @@
> +/*
> + * SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#include "rte_cpuflags.h"
> +
> +#include <elf.h>
> +#include <fcntl.h>
> +#include <assert.h>
> +#include <unistd.h>
> +#include <string.h>
> +
> +/* Symbolic values for the entries in the auxiliary table */
> +#define AT_HWCAP 16
> +
> +/* software based registers */
> +enum cpu_register_t {
> + REG_NONE = 0,
> + REG_HWCAP,
> + REG_MAX
> +};
> +
> +typedef uint32_t hwcap_registers_t[REG_MAX];
> +
> +struct feature_entry {
> + uint32_t reg;
> + uint32_t bit;
> +#define CPU_FLAG_NAME_MAX_LEN 64
> + char name[CPU_FLAG_NAME_MAX_LEN];
> +};
> +
> +#define FEAT_DEF(name, reg, bit) \
> + [RTE_CPUFLAG_##name] = {reg, bit, #name},
> +
> +const struct feature_entry rte_cpu_feature_table[] = {
> + FEAT_DEF(CPUCFG, REG_HWCAP, 0)
> + FEAT_DEF(LAM, REG_HWCAP, 1)
> + FEAT_DEF(UAL, REG_HWCAP, 2)
> + FEAT_DEF(FPU, REG_HWCAP, 3)
> + FEAT_DEF(LSX, REG_HWCAP, 4)
> + FEAT_DEF(LASX, REG_HWCAP, 5)
> + FEAT_DEF(CRC32, REG_HWCAP, 6)
> + FEAT_DEF(COMPLEX, REG_HWCAP, 7)
> + FEAT_DEF(CRYPTO, REG_HWCAP, 8)
> + FEAT_DEF(LVZ, REG_HWCAP, 9)
> + FEAT_DEF(LBT_X86, REG_HWCAP, 10)
> + FEAT_DEF(LBT_ARM, REG_HWCAP, 11)
> + FEAT_DEF(LBT_MIPS, REG_HWCAP, 12)
> +};
> +
> +/*
> + * Read AUXV software register and get cpu features for LoongArch
> + */
> +static void
> +rte_cpu_get_features(hwcap_registers_t out)
> +{
> + out[REG_HWCAP] = rte_cpu_getauxval(AT_HWCAP);
> +}
> +
> +/*
> + * Checks if a particular flag is available on current machine.
> + */
> +int
> +rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
> +{
> + const struct feature_entry *feat;
> + hwcap_registers_t regs = {0};
> +
> + if (feature >= RTE_CPUFLAG_NUMFLAGS)
> + return -ENOENT;
> +
> + feat = &rte_cpu_feature_table[feature];
> + if (feat->reg == REG_NONE)
> + return -EFAULT;
> +
> + rte_cpu_get_features(regs);
> + return (regs[feat->reg] >> feat->bit) & 1;
> +}
> +
> +const char *
> +rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)
> +{
> + if (feature >= RTE_CPUFLAG_NUMFLAGS)
> + return NULL;
> + return rte_cpu_feature_table[feature].name;
> +}
> +
> +void
> +rte_cpu_get_intrinsics_support(struct rte_cpu_intrinsics *intrinsics)
> +{
> + memset(intrinsics, 0, sizeof(*intrinsics));
> +}
> diff --git a/lib/eal/loongarch/rte_cycles.c b/lib/eal/loongarch/rte_cycles.c
> new file mode 100644
> index 0000000000..582601d335
> --- /dev/null
> +++ b/lib/eal/loongarch/rte_cycles.c
> @@ -0,0 +1,45 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#include "eal_private.h"
> +
> +#define LOONGARCH_CPUCFG4 0x4
> +#define CPUCFG4_CCFREQ_MASK 0xFFFFFFFF
> +#define CPUCFG4_CCFREQ_SHIFT 0
> +
> +#define LOONGARCH_CPUCFG5 0x5
> +#define CPUCFG5_CCMUL_MASK 0xFFFF
> +#define CPUCFG5_CCMUL_SHIFT 0
> +
> +#define CPUCFG5_CCDIV_MASK 0xFFFF0000
> +#define CPUCFG5_CCDIV_SHIFT 16
> +
> +static __rte_noinline uint32_t
> +read_cpucfg(int arg)
> +{
> + int ret = 0;
> +
> + __asm__ __volatile__ (
> + "cpucfg %[var], %[index]\n"
> + : [var]"=r"(ret)
> + : [index]"r"(arg)
> + :
> + );
> +
> + return ret;
> +}
> +
> +uint64_t
> +get_tsc_freq_arch(void)
> +{
> + uint32_t base_freq, mul_factor, div_factor;
> +
> + base_freq = read_cpucfg(LOONGARCH_CPUCFG4);
> + mul_factor = (read_cpucfg(LOONGARCH_CPUCFG5) & CPUCFG5_CCMUL_MASK) >>
> + CPUCFG5_CCMUL_SHIFT;
> + div_factor = (read_cpucfg(LOONGARCH_CPUCFG5) & CPUCFG5_CCDIV_MASK) >>
> + CPUCFG5_CCDIV_SHIFT;
> +
> + return base_freq * mul_factor / div_factor;
> +}
> diff --git a/lib/eal/loongarch/rte_hypervisor.c b/lib/eal/loongarch/rte_hypervisor.c
> new file mode 100644
> index 0000000000..d044906f71
> --- /dev/null
> +++ b/lib/eal/loongarch/rte_hypervisor.c
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#include "rte_hypervisor.h"
> +
> +enum rte_hypervisor
> +rte_hypervisor_get(void)
> +{
> + return RTE_HYPERVISOR_UNKNOWN;
> +}
> diff --git a/lib/eal/loongarch/rte_power_intrinsics.c b/lib/eal/loongarch/rte_power_intrinsics.c
> new file mode 100644
> index 0000000000..a8969c260e
> --- /dev/null
> +++ b/lib/eal/loongarch/rte_power_intrinsics.c
> @@ -0,0 +1,53 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2022 Loongson Technology Corporation Limited
> + */
> +
> +#include <errno.h>
> +
> +#include "rte_power_intrinsics.h"
> +
> +/**
> + * This function is not supported on LOONGARCH.
> + */
> +int
> +rte_power_monitor(const struct rte_power_monitor_cond *pmc,
> + const uint64_t tsc_timestamp)
> +{
> + RTE_SET_USED(pmc);
> + RTE_SET_USED(tsc_timestamp);
> +
> + return -ENOTSUP;
> +}
> +
> +/**
> + * This function is not supported on LOONGARCH.
> + */
> +int
> +rte_power_pause(const uint64_t tsc_timestamp)
> +{
> + RTE_SET_USED(tsc_timestamp);
> +
> + return -ENOTSUP;
> +}
> +
> +/**
> + * This function is not supported on LOONGARCH.
> + */
> +int
> +rte_power_monitor_wakeup(const unsigned int lcore_id)
> +{
> + RTE_SET_USED(lcore_id);
> +
> + return -ENOTSUP;
> +}
> +
> +int
> +rte_power_monitor_multi(const struct rte_power_monitor_cond pmc[],
> + const uint32_t num, const uint64_t tsc_timestamp)
> +{
> + RTE_SET_USED(pmc);
> + RTE_SET_USED(num);
> + RTE_SET_USED(tsc_timestamp);
> +
> + return -ENOTSUP;
> +}
> diff --git a/meson.build b/meson.build
> index 7d6643da3a..de718974d4 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -56,6 +56,8 @@ elif host_machine.cpu_family().startswith('ppc')
> arch_subdir = 'ppc'
> elif host_machine.cpu_family().startswith('riscv')
> arch_subdir = 'riscv'
> +elif host_machine.cpu_family().startswith('loongarch')
> + arch_subdir = 'loongarch'
> endif
Please insert it earlier, between arm and ppc.
--
David Marchand
^ permalink raw reply [relevance 4%]
* RE: [PATCH v10 6/7] bbdev: add queue related warning and status information
2022-10-03 8:28 3% ` Thomas Monjalon
@ 2022-10-03 16:39 3% ` Chautru, Nicolas
2022-10-03 17:21 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Chautru, Nicolas @ 2022-10-03 16:39 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, gakhil, maxime.coquelin, trix, mdr, Richardson, Bruce,
david.marchand, stephen, Zhang, Mingshan, hemant.agrawal
Hi Thomas,
I will update all your comments below today, thanks.
The one where we need your confirmation is specifically this comment from your, I believe we discussed but good to make sure we are all aligned:
> But the big question is why do we need this "MAX" value?
> The guideline is to avoid using such MAX value for long term compatibility.
This is not a _MAX enum but a _SIZE_MAX for array related to that enum. Note that the actual max value of the enum exists but is used a private macro.
The distinction is that the application cannot make any assumptions on what is the maximum enum value (ie. we don't want enum with MAX value, that is not future proof has captured in doc).
But the application can make some assumption on the sizing of array based on such an enum. The difference being the padding which allows for the enum growth without breaking ABI or application.
The previous name was _PADDED_MAX to make it clear this not a max enum but a padded value. Then more recenrtly the consensus in the community was to change this to _SIZE_MAX to be arguably more explicit this is to be used for array size. The comments I believe also make it clear this is not a MAX enum.
Does that make sense and do you agree this is best consensus so far to move forward?
Thanks Thomas,
Nic
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, October 3, 2022 1:29 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>
> Cc: dev@dpdk.org; gakhil@marvell.com; maxime.coquelin@redhat.com;
> trix@redhat.com; mdr@ashroe.eu; Richardson, Bruce
> <bruce.richardson@intel.com>; david.marchand@redhat.com;
> stephen@networkplumber.org; Zhang, Mingshan
> <mingshan.zhang@intel.com>; hemant.agrawal@nxp.com
> Subject: Re: [PATCH v10 6/7] bbdev: add queue related warning and status
> information
>
> Looking at this patch because I have been alerted about the ABI compat
> handling.
> I see some details that should have been caught in earlier reviews.
>
> 30/09/2022 20:46, Nicolas Chautru:
>
> > +/*
> > + * Maximum size to be used to manage the enum
> > +rte_bbdev_enqueue_status including padding for future
>
> This line is long.
> It is always better to split lines logically, for instance here, before "including".
>
> > + * enum insertion
>
> It could be made clear that the real enum size is smaller or equal.
>
> > + */
> > +#define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6
> [...]
> > +enum rte_bbdev_enqueue_status {
> > + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */
> > + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room in
> queue */
> > + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room in
> ring */
> > + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was
> rejected as invalid */
> > +};
>
> A comment is missing at the end of the enum to remind updating the MAX.
>
> But the big question is why do we need this "MAX" value?
> The guideline is to avoid using such MAX value for long term compatibility.
>
> [...]
> > +/**
> > + * Converts queue status from enum to string
>
> Should be imperative form: "Convert".
> A dot is missing at the end of the sentence.
>
> > + *
> > + * @param status
> > + * Queue status as enum
> > + *
> > + * @returns
> > + * Queue status as string or NULL if op_type is invalid
>
> It is not aligned with above parameter.
> Choose an indentation format and keep it consistent.
>
> [...]
> > # added in 22.11
> > rte_bbdev_device_status_str;
> > + rte_bbdev_enqueue_status_str;
> > rte_bbdev_enqueue_fft_ops;
> > rte_bbdev_dequeue_fft_ops;
>
> It is not alphabetical order.
>
>
^ permalink raw reply [relevance 3%]
* Re: [PATCH v7] eal: add bus cleanup to eal cleanup
2022-10-03 12:35 0% ` David Marchand
@ 2022-10-03 14:39 0% ` Kevin Laatz
0 siblings, 0 replies; 200+ results
From: Kevin Laatz @ 2022-10-03 14:39 UTC (permalink / raw)
To: David Marchand, Bruce Richardson
Cc: Thomas Monjalon, dev, Morten Brørup, Li Zhang, Matan Azrad,
Stephen Hemminger, lihuisong
Hi David,
On 03/10/2022 13:35, David Marchand wrote:
> Hello Bruce, Kevin,
>
> On Mon, Jun 13, 2022 at 5:59 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
>>>> For info, Li has sent a patch for the bus cleanup
>>>> which is not updating the bus code:
>>>> https://patches.dpdk.org/project/dpdk/patch/20220606114650.209612-3-lizh@nvidia.com/
>>>> It may be a temporary solution before the deprecation.
>>> On the principle, that's probably the best, there is no question about
>>> unclear frontier of the ABI.
>>> (In practice though, the mentionned patch is triggering segfaults in
>>> two CI, for pdump).
>>>
>>> Hiding rte_bus object should be straightforward in v22.11, I had some
>>> patches, but never finished the work.
>>>
>>> It would be great too, to look into rte_driver and rte_device which
>>> are exposed important types, but that's another story.
>>>
>> Agreed, we need to look into all this for 22.11 release, let's defer this
>> patch until we get proper deprecation process. Temporary patch looks fine
>> as a fix too.
> The patch needs some rebasing for making it into 22.11.
> Can you work on it, this week?
>
Yes, I'll have a look at it - thanks for your work on the deprecations
and cleanup!
-Kevin
^ permalink raw reply [relevance 0%]
* [PATCH v6 1/6] cryptodev: rework session framework
@ 2022-10-03 13:52 1% ` Akhil Goyal
0 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-10-03 13:52 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, lironh, royzhang1980,
sunilprakashrao.uttarwar, kai.ji, rnagadheeraj, jianjay.zhou,
Akhil Goyal, Ruifeng Wang, David Coyle, Kevin O'Sullivan
As per current design, rte_cryptodev_sym_session_create() and
rte_cryptodev_sym_session_init() use separate mempool objects
for a single session.
And structure rte_cryptodev_sym_session is not directly used
by the application, it may cause ABI breakage if the structure
is modified in future.
To address these two issues, the rte_cryptodev_sym_session_create
will take one mempool object that the session and session private
data are virtually/physically contiguous, and initializes both
fields. The API rte_cryptodev_sym_session_init is removed.
rte_cryptodev_sym_session_create will now return an opaque session
pointer which will be used by the app and other APIs.
In data path, opaque session pointer is attached to rte_crypto_op
and the PMD can call an internal library API to get the session
private data pointer based on the driver id.
Note: currently single session may be used by different device
drivers, given it is initialized by them. After the change the
session created by one device driver cannot be used or
reinitialized by another driver.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Ruifeng Wang <Ruifeng.Wang@arm.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test-crypto-perf/cperf_ops.c | 21 +-
app/test-crypto-perf/cperf_test_latency.c | 6 +-
.../cperf_test_pmd_cyclecount.c | 5 +-
app/test-crypto-perf/cperf_test_throughput.c | 6 +-
app/test-crypto-perf/cperf_test_verify.c | 6 +-
app/test-crypto-perf/main.c | 29 +-
app/test-eventdev/test_perf_common.c | 35 +-
app/test-eventdev/test_perf_common.h | 1 -
app/test/test_cryptodev.c | 303 +++++-------------
app/test/test_cryptodev_blockcipher.c | 16 +-
app/test/test_event_crypto_adapter.c | 35 +-
app/test/test_ipsec.c | 42 +--
drivers/crypto/armv8/armv8_pmd_private.h | 2 -
drivers/crypto/armv8/rte_armv8_pmd.c | 21 +-
drivers/crypto/armv8/rte_armv8_pmd_ops.c | 35 +-
drivers/crypto/bcmfs/bcmfs_sym_session.c | 38 +--
drivers/crypto/bcmfs/bcmfs_sym_session.h | 3 +-
drivers/crypto/caam_jr/caam_jr.c | 28 +-
drivers/crypto/ccp/ccp_crypto.c | 58 +---
drivers/crypto/ccp/ccp_pmd_ops.c | 32 +-
drivers/crypto/ccp/ccp_pmd_private.h | 2 -
drivers/crypto/ccp/rte_ccp_pmd.c | 29 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 36 +--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 31 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 55 +---
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 14 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 31 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 3 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 37 +--
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 4 +-
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 34 +-
drivers/crypto/ipsec_mb/ipsec_mb_private.h | 41 ++-
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 48 +--
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 36 +--
drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 4 -
drivers/crypto/ipsec_mb/pmd_kasumi.c | 10 +-
drivers/crypto/ipsec_mb/pmd_snow3g.c | 9 +-
drivers/crypto/ipsec_mb/pmd_zuc.c | 4 -
drivers/crypto/mlx5/mlx5_crypto.c | 26 +-
drivers/crypto/mvsam/rte_mrvl_pmd.c | 8 +-
drivers/crypto/mvsam/rte_mrvl_pmd_ops.c | 21 +-
drivers/crypto/nitrox/nitrox_sym.c | 39 +--
drivers/crypto/null/null_crypto_pmd.c | 19 +-
drivers/crypto/null/null_crypto_pmd_ops.c | 33 +-
drivers/crypto/null/null_crypto_pmd_private.h | 2 -
.../crypto/octeontx/otx_cryptodev_hw_access.h | 1 -
drivers/crypto/octeontx/otx_cryptodev_ops.c | 67 +---
drivers/crypto/openssl/openssl_pmd_private.h | 2 -
drivers/crypto/openssl/rte_openssl_pmd.c | 24 +-
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 29 +-
drivers/crypto/qat/qat_sym.c | 10 +-
drivers/crypto/qat/qat_sym.h | 4 +-
drivers/crypto/qat/qat_sym_session.c | 40 +--
drivers/crypto/qat/qat_sym_session.h | 6 +-
drivers/crypto/scheduler/scheduler_pmd_ops.c | 38 +--
drivers/crypto/virtio/virtio_cryptodev.c | 40 +--
drivers/crypto/virtio/virtio_rxtx.c | 3 +-
examples/fips_validation/fips_dev_self_test.c | 30 +-
examples/fips_validation/main.c | 35 +-
examples/ipsec-secgw/ipsec-secgw.c | 10 +-
examples/ipsec-secgw/ipsec.c | 7 +-
examples/l2fwd-crypto/main.c | 54 +---
examples/vhost_crypto/main.c | 16 +-
lib/cryptodev/cryptodev_pmd.h | 28 +-
lib/cryptodev/cryptodev_trace_points.c | 6 -
lib/cryptodev/rte_cryptodev.c | 278 ++++++----------
lib/cryptodev/rte_cryptodev.h | 123 ++-----
lib/cryptodev/rte_cryptodev_trace.h | 36 +--
lib/cryptodev/version.map | 6 -
lib/pipeline/rte_table_action.c | 10 +-
lib/vhost/rte_vhost_crypto.h | 3 -
lib/vhost/vhost_crypto.c | 28 +-
72 files changed, 556 insertions(+), 1676 deletions(-)
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index d746d51082..c6f5735bb0 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -912,7 +912,6 @@ cperf_create_session(struct rte_mempool *sess_mp,
&sess_conf, sess_mp, priv_mp);
}
#endif
- sess = rte_cryptodev_sym_session_create(sess_mp);
/*
* cipher only
*/
@@ -937,8 +936,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
cipher_xform.cipher.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &cipher_xform,
+ sess_mp);
/*
* auth only
*/
@@ -965,8 +964,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
auth_xform.auth.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &auth_xform,
+ sess_mp);
/*
* cipher and auth
*/
@@ -1024,13 +1023,13 @@ cperf_create_session(struct rte_mempool *sess_mp,
if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
cipher_xform.next = &auth_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &cipher_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &cipher_xform, sess_mp);
} else { /* auth then cipher */
auth_xform.next = &cipher_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &auth_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &auth_xform, sess_mp);
}
} else { /* options->op_type == CPERF_AEAD */
aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -1050,8 +1049,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
options->aead_aad_sz;
/* Create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &aead_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &aead_xform,
+ sess_mp);
}
return sess;
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index 6f972cea49..afd8cb209b 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -44,10 +44,8 @@ static void
cperf_latency_test_free(struct cperf_latency_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 3f2da13d3a..edd2730b73 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -74,10 +74,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
(struct rte_security_session *)ctx->sess);
} else
#endif
- {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index fba66bbde9..fa13915dc3 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -52,10 +52,8 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
(struct rte_security_session *)ctx->sess);
}
#endif
- else {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ else
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index b691595675..c1465db243 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -39,10 +39,8 @@ static void
cperf_verify_test_free(struct cperf_verify_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 27acd619bc..3469b836e1 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -97,35 +97,14 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
char mp_name[RTE_MEMPOOL_NAMESIZE];
struct rte_mempool *sess_mp;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- sess_mp = rte_mempool_create(mp_name,
- nb_sessions,
- session_priv_size,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (sess_mp == NULL) {
- printf("Cannot create pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- session_pool_socket[socket_id].priv_mp = sess_mp;
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
- nb_sessions, 0, 0, 0, socket_id);
+ nb_sessions, session_priv_size, 0, 0,
+ socket_id);
if (sess_mp == NULL) {
printf("Cannot create pool \"%s\" on socket %d\n",
@@ -136,6 +115,7 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
printf("Allocated pool \"%s\" on socket %d\n",
mp_name, socket_id);
session_pool_socket[socket_id].sess_mp = sess_mp;
+ session_pool_socket[socket_id].priv_mp = sess_mp;
}
return 0;
@@ -323,12 +303,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
return ret;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
if (opts->op_type == CPERF_ASYM_MODEX) {
qp_conf.mp_session = NULL;
- qp_conf.mp_session_private = NULL;
}
ret = rte_cryptodev_configure(cdev_id, &conf);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index 8472a87b99..cd3c1d7ef1 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -863,18 +863,13 @@ cryptodev_sym_sess_create(struct prod_data *p, struct test_perf *t)
cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
cipher_xform.next = NULL;
- sess = rte_cryptodev_sym_session_create(t->ca_sess_pool);
+ sess = rte_cryptodev_sym_session_create(p->ca.cdev_id, &cipher_xform,
+ t->ca_sess_pool);
if (sess == NULL) {
evt_err("Failed to create sym session");
return NULL;
}
- if (rte_cryptodev_sym_session_init(p->ca.cdev_id, sess, &cipher_xform,
- t->ca_sess_priv_pool)) {
- evt_err("Failed to init session");
- return NULL;
- }
-
return sess;
}
@@ -1381,15 +1376,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
goto err;
}
- t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
- "ca_sess_pool", nb_sessions, 0, 0,
- sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
- if (t->ca_sess_pool == NULL) {
- evt_err("Failed to create sym session pool");
- ret = -ENOMEM;
- goto err;
- }
-
max_session_size = 0;
for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
unsigned int session_size;
@@ -1400,12 +1386,11 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
max_session_size = session_size;
}
- max_session_size += sizeof(union rte_event_crypto_metadata);
- t->ca_sess_priv_pool = rte_mempool_create(
- "ca_sess_priv_pool", nb_sessions, max_session_size, 0, 0, NULL,
- NULL, NULL, NULL, SOCKET_ID_ANY, 0);
- if (t->ca_sess_priv_pool == NULL) {
- evt_err("failed to create sym session private pool");
+ t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
+ "ca_sess_pool", nb_sessions, max_session_size, 0,
+ sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
+ if (t->ca_sess_pool == NULL) {
+ evt_err("Failed to create sym session pool");
ret = -ENOMEM;
goto err;
}
@@ -1445,7 +1430,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
qp_conf.nb_descriptors = NB_CRYPTODEV_DESCRIPTORS;
qp_conf.mp_session = t->ca_sess_pool;
- qp_conf.mp_session_private = t->ca_sess_priv_pool;
for (qp_id = 0; qp_id < conf.nb_queue_pairs; qp_id++) {
ret = rte_cryptodev_queue_pair_setup(
@@ -1466,7 +1450,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
return ret;
@@ -1491,8 +1474,7 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
for (flow_id = 0; flow_id < t->nb_flows; flow_id++) {
sess = p->ca.crypto_sess[flow_id];
cdev_id = p->ca.cdev_id;
- rte_cryptodev_sym_session_clear(cdev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(cdev_id, sess);
}
rte_event_crypto_adapter_queue_pair_del(
@@ -1508,7 +1490,6 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
}
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index 8cbd06fe42..d06d52cdf8 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -70,7 +70,6 @@ struct test_perf {
RTE_EVENT_TIMER_ADAPTER_NUM_MAX] __rte_cache_aligned;
struct rte_mempool *ca_op_pool;
struct rte_mempool *ca_sess_pool;
- struct rte_mempool *ca_sess_priv_pool;
struct rte_mempool *ca_asym_sess_pool;
} __rte_cache_aligned;
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 0c39b16b71..ae2b102ecb 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -13,6 +13,7 @@
#include <rte_pause.h>
#include <rte_bus_vdev.h>
#include <rte_ether.h>
+#include <rte_errno.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
@@ -644,23 +645,17 @@ testsuite_setup(void)
}
ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
- "test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+ "test_sess_mp", MAX_NB_SESSIONS, session_size, 0, 0,
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
-
ts_params->session_priv_mpool = rte_mempool_create(
- "test_sess_mp_priv",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
+ "test_sess_mp_priv", MAX_NB_SESSIONS, session_size,
+ 0, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
+
TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
"session mempool allocation failed");
-
-
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
&ts_params->conf),
"Failed to configure cryptodev %u with %u qps",
@@ -668,7 +663,6 @@ testsuite_setup(void)
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -697,15 +691,11 @@ testsuite_teardown(void)
rte_mempool_avail_count(ts_params->op_mpool));
}
- /* Free session mempools */
- if (ts_params->session_priv_mpool != NULL) {
- rte_mempool_free(ts_params->session_priv_mpool);
- ts_params->session_priv_mpool = NULL;
- }
-
if (ts_params->session_mpool != NULL) {
rte_mempool_free(ts_params->session_mpool);
ts_params->session_mpool = NULL;
+ rte_mempool_free(ts_params->session_priv_mpool);
+ ts_params->session_priv_mpool = NULL;
}
res = rte_cryptodev_close(ts_params->valid_devs[0]);
@@ -1392,7 +1382,6 @@ dev_configure_and_start(uint64_t ff_disable)
ts_params->conf.ff_disable = ff_disable;
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
&ts_params->conf),
@@ -1452,10 +1441,8 @@ ut_teardown(void)
#endif
{
if (ut_params->sess) {
- rte_cryptodev_sym_session_clear(
- ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
- rte_cryptodev_sym_session_free(ut_params->sess);
ut_params->sess = NULL;
}
}
@@ -1610,7 +1597,6 @@ test_queue_pair_descriptor_setup(void)
*/
qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -2155,8 +2141,6 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
-
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2200,19 +2184,13 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
ut_params->auth_xform.auth.key.data = hmac_sha1_key;
ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
+ rte_errno = 0;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- /* Create crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ if (rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -2441,7 +2419,6 @@ create_wireless_algo_hash_session(uint8_t dev_id,
enum rte_crypto_auth_algorithm algo)
{
uint8_t hash_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2461,16 +2438,11 @@ create_wireless_algo_hash_session(uint8_t dev_id,
ut_params->auth_xform.auth.digest_length = auth_len;
ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
ut_params->auth_xform.auth.iv.length = iv_len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2483,7 +2455,6 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
uint8_t iv_len)
{
uint8_t cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2503,16 +2474,12 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session */
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2590,7 +2557,6 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
{
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2625,17 +2591,12 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2649,7 +2610,6 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
{
const uint8_t key_len = tdata->key.len;
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2689,16 +2649,11 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2724,7 +2679,6 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
uint8_t cipher_iv_len)
{
uint8_t auth_cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2755,26 +2709,19 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
if (cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
ut_params->auth_xform.next = NULL;
ut_params->cipher_xform.next = &ut_params->auth_xform;
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
} else
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -8205,7 +8152,6 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
uint8_t iv_len)
{
uint8_t aead_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -8227,15 +8173,12 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->aead_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->aead_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -8679,7 +8622,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
/* Create security session */
ut_params->sec_session = rte_security_session_create(ctx,
&sess_conf, ts_params->session_mpool,
- ts_params->session_priv_mpool);
+ NULL);
if (!ut_params->sec_session) {
printf("TestCase %s()-%d line %d failed %s: ",
@@ -12029,7 +11972,6 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
const struct HMAC_MD5_vector *test_case)
{
uint8_t key[64];
- int status;
memcpy(key, test_case->key.data, test_case->key.len);
@@ -12044,16 +11986,11 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
ut_params->auth_xform.auth.key.data = key;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- if (ut_params->sess == NULL)
- return TEST_FAILED;
-
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -12261,12 +12198,9 @@ test_multi_session(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
-
struct rte_cryptodev_info dev_info;
struct rte_cryptodev_sym_session **sessions;
-
uint16_t i;
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12293,20 +12227,15 @@ test_multi_session(void)
/* Create multiple crypto sessions*/
for (i = 0; i < MAX_NB_SESSIONS; i++) {
-
sessions[i] = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
+
TEST_ASSERT_NOT_NULL(sessions[i],
"Session creation failed at session number %u",
i);
-
- status = rte_cryptodev_sym_session_init(
- ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
/* Attempt to send a request on each session */
TEST_ASSERT_SUCCESS( test_AES_CBC_HMAC_SHA512_decrypt_perform(
sessions[i],
@@ -12336,18 +12265,9 @@ test_multi_session(void)
}
}
- sessions[i] = NULL;
- /* Next session create should fail */
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NULL(sessions[i],
- "Session creation succeeded unexpectedly!");
-
for (i = 0; i < MAX_NB_SESSIONS; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12398,7 +12318,6 @@ test_multi_session_random_usage(void)
},
};
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12420,11 +12339,6 @@ test_multi_session_random_usage(void)
* MAX_NB_SESSIONS) + 1, 0);
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- sessions[i] = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(sessions[i],
- "Session creation failed at session number %u",
- i);
rte_memcpy(&ut_paramz[i].ut_params, &unittest_params,
sizeof(struct crypto_unittest_params));
@@ -12434,16 +12348,16 @@ test_multi_session_random_usage(void)
ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
/* Create multiple crypto sessions*/
- status = rte_cryptodev_sym_session_init(
+ sessions[i] = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0],
- sessions[i],
&ut_paramz[i].ut_params.auth_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(sessions[i],
+ "Session creation failed at session number %u",
+ i);
}
srand(time(NULL));
@@ -12481,9 +12395,8 @@ test_multi_session_random_usage(void)
}
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12501,7 +12414,6 @@ test_null_invalid_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int ret;
/* This test is for NULL PMD only */
if (gbl_driver_id != rte_cryptodev_driver_id_get(
@@ -12515,17 +12427,13 @@ test_null_invalid_operation(void)
ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
-
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.next = NULL;
@@ -12533,14 +12441,11 @@ test_null_invalid_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
return TEST_SUCCESS;
@@ -12554,7 +12459,6 @@ test_null_burst_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
unsigned i, burst_len = NULL_BURST_LENGTH;
@@ -12580,19 +12484,14 @@ test_null_burst_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
/* Create Crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0],
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
@@ -12703,7 +12602,6 @@ test_enq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12803,7 +12701,6 @@ test_deq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12990,7 +12887,6 @@ static int create_gmac_session(uint8_t dev_id,
enum rte_crypto_auth_operation auth_op)
{
uint8_t auth_key[tdata->key.len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -13009,15 +12905,13 @@ static int create_gmac_session(uint8_t dev_id,
ut_params->auth_xform.auth.iv.length = tdata->iv.len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -13646,7 +13540,6 @@ create_auth_session(struct crypto_unittest_params *ut_params,
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -13660,15 +13553,13 @@ create_auth_session(struct crypto_unittest_params *ut_params,
ut_params->auth_xform.auth.digest_length = reference->digest.len;
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -13681,7 +13572,6 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -13713,15 +13603,13 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
}
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -14179,7 +14067,6 @@ test_authenticated_encrypt_with_esn(
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
struct rte_cryptodev_info dev_info;
- int status;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -14230,19 +14117,12 @@ test_authenticated_encrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
-
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
"Failed to allocate input buffer in mempool");
@@ -14366,18 +14246,11 @@ test_authenticated_decrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- retval = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- if (retval == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(retval, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
@@ -15125,8 +14998,8 @@ test_scheduler_attach_worker_op(void)
ts_params->session_mpool =
rte_cryptodev_sym_session_pool_create(
"test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0,
- SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, session_size,
+ 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
}
@@ -15149,8 +15022,6 @@ test_scheduler_attach_worker_op(void)
}
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private =
- ts_params->session_priv_mpool;
ret = rte_cryptodev_scheduler_worker_attach(sched_id,
(uint8_t)i);
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index b5813b956f..4fcdd55660 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -68,7 +68,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
struct rte_mempool *sess_mpool,
- struct rte_mempool *sess_priv_mpool,
uint8_t dev_id,
char *test_msg)
{
@@ -514,11 +513,9 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
*/
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) &&
nb_iterates == 0) {
- sess = rte_cryptodev_sym_session_create(sess_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, sess,
- init_xform, sess_priv_mpool);
- if (status == -ENOTSUP) {
+ sess = rte_cryptodev_sym_session_create(dev_id, init_xform,
+ sess_mpool);
+ if (sess == NULL) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "UNSUPPORTED");
status = TEST_SKIPPED;
goto error_exit;
@@ -801,10 +798,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
error_exit:
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- if (sess) {
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
- }
+ if (sess)
+ rte_cryptodev_sym_session_free(dev_id, sess);
rte_free(cipher_xform);
rte_free(auth_xform);
}
@@ -829,7 +824,6 @@ blockcipher_test_case_run(const void *data)
p_testsuite_params->mbuf_pool,
p_testsuite_params->op_mpool,
p_testsuite_params->session_mpool,
- p_testsuite_params->session_priv_mpool,
p_testsuite_params->valid_devs[0],
test_msg);
return status;
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index bb617c1042..0a7f8f8505 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -157,7 +157,6 @@ struct event_crypto_adapter_test_params {
struct rte_mempool *op_mpool;
struct rte_mempool *asym_op_mpool;
struct rte_mempool *session_mpool;
- struct rte_mempool *session_priv_mpool;
struct rte_mempool *asym_sess_mpool;
struct rte_cryptodev_config *config;
uint8_t crypto_event_port_id;
@@ -307,15 +306,10 @@ test_op_forward_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
-
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
&cap);
TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
@@ -683,8 +677,8 @@ test_op_new_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
@@ -699,9 +693,6 @@ test_op_new_mode(uint8_t session_less)
RTE_CRYPTO_OP_WITH_SESSION,
&m_data, sizeof(m_data));
}
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
rte_crypto_op_attach_sym_session(op, sess);
} else {
@@ -994,22 +985,12 @@ configure_cryptodev(void)
params.session_mpool = rte_cryptodev_sym_session_pool_create(
"CRYPTO_ADAPTER_SESSION_MP",
- MAX_NB_SESSIONS, 0, 0,
+ MAX_NB_SESSIONS, session_size, 0,
sizeof(union rte_event_crypto_metadata),
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(params.session_mpool,
"session mempool allocation failed\n");
- params.session_priv_mpool = rte_mempool_create(
- "CRYPTO_AD_SESS_MP_PRIV",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
- TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
- "session mempool allocation failed\n");
-
rte_cryptodev_info_get(TEST_CDEV_ID, &info);
while ((capability = &info.capabilities[i++])->op !=
@@ -1048,7 +1029,6 @@ configure_cryptodev(void)
qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
qp_conf.mp_session = params.session_mpool;
- qp_conf.mp_session_private = params.session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -1418,11 +1398,6 @@ crypto_teardown(void)
rte_mempool_free(params.session_mpool);
params.session_mpool = NULL;
}
- if (params.session_priv_mpool != NULL) {
- rte_mempool_avail_count(params.session_priv_mpool);
- rte_mempool_free(params.session_priv_mpool);
- params.session_priv_mpool = NULL;
- }
/* Free asym session mempool */
if (params.asym_sess_mpool != NULL) {
diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index aa533483fd..04d231468b 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -370,20 +370,9 @@ testsuite_setup(void)
return TEST_FAILED;
}
- ts_params->qp_conf.mp_session_private = rte_mempool_create(
- "test_priv_sess_mp",
- MAX_NB_SESSIONS,
- sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
-
- TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session_private,
- "private session mempool allocation failed");
-
ts_params->qp_conf.mp_session =
rte_cryptodev_sym_session_pool_create("test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, sess_sz, 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session,
"session mempool allocation failed");
@@ -428,11 +417,6 @@ testsuite_teardown(void)
rte_mempool_free(ts_params->qp_conf.mp_session);
ts_params->qp_conf.mp_session = NULL;
}
-
- if (ts_params->qp_conf.mp_session_private != NULL) {
- rte_mempool_free(ts_params->qp_conf.mp_session_private);
- ts_params->qp_conf.mp_session_private = NULL;
- }
}
static int
@@ -647,8 +631,7 @@ create_dummy_sec_session(struct ipsec_unitest_params *ut,
static struct rte_security_session_conf conf;
ut->ss[j].security.ses = rte_security_session_create(&dummy_sec_ctx,
- &conf, qp->mp_session,
- qp->mp_session_private);
+ &conf, qp->mp_session, NULL);
if (ut->ss[j].security.ses == NULL)
return -ENOMEM;
@@ -662,25 +645,15 @@ static int
create_crypto_session(struct ipsec_unitest_params *ut,
struct rte_cryptodev_qp_conf *qp, uint8_t dev_id, uint32_t j)
{
- int32_t rc;
struct rte_cryptodev_sym_session *s;
- s = rte_cryptodev_sym_session_create(qp->mp_session);
+ s = rte_cryptodev_sym_session_create(dev_id, ut->crypto_xforms,
+ qp->mp_session);
if (s == NULL)
return -ENOMEM;
- /* initialize SA crypto session for device */
- rc = rte_cryptodev_sym_session_init(dev_id, s,
- ut->crypto_xforms, qp->mp_session_private);
- if (rc == 0) {
- ut->ss[j].crypto.ses = s;
- return 0;
- } else {
- /* failure, do cleanup */
- rte_cryptodev_sym_session_clear(dev_id, s);
- rte_cryptodev_sym_session_free(s);
- return rc;
- }
+ ut->ss[j].crypto.ses = s;
+ return 0;
}
static int
@@ -1196,8 +1169,7 @@ static void
destroy_crypto_session(struct ipsec_unitest_params *ut,
uint8_t crypto_dev, uint32_t j)
{
- rte_cryptodev_sym_session_clear(crypto_dev, ut->ss[j].crypto.ses);
- rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses);
+ rte_cryptodev_sym_session_free(crypto_dev, ut->ss[j].crypto.ses);
memset(&ut->ss[j], 0, sizeof(ut->ss[j]));
}
diff --git a/drivers/crypto/armv8/armv8_pmd_private.h b/drivers/crypto/armv8/armv8_pmd_private.h
index 75ddba79c1..41292d8851 100644
--- a/drivers/crypto/armv8/armv8_pmd_private.h
+++ b/drivers/crypto/armv8/armv8_pmd_private.h
@@ -106,8 +106,6 @@ struct armv8_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 5c060e71a3..824a2cc735 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -521,34 +521,23 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
/* get existing session */
if (likely(op->sym->session != NULL)) {
- sess = (struct armv8_crypto_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
} else {
/* provide internal session */
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct armv8_crypto_session *)_sess_private_data;
+ sess = (struct armv8_crypto_session *)_sess->driver_priv_data;
if (unlikely(armv8_crypto_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
}
if (unlikely(sess == NULL))
@@ -674,10 +663,6 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct armv8_crypto_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index c07ac0489e..c4964bc112 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -244,7 +244,6 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -265,10 +264,9 @@ armv8_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
/** Configure the session from a crypto xform chain */
static int
-armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
+armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -278,43 +276,22 @@ armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = sess->driver_priv_data;
ret = armv8_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
ARMV8_CRYPTO_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct armv8_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops armv8_crypto_pmd_ops = {
.dev_configure = armv8_crypto_pmd_config,
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index 675ed0ad55..d3334dc920 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -211,8 +211,7 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
} else if (likely(op->sym->session != NULL)) {
/* get existing session */
sess = (struct bcmfs_sym_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_bcmfs_driver_id);
+ op->sym->session->driver_priv_data;
}
if (sess == NULL)
@@ -222,10 +221,9 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
}
int
-bcmfs_sym_session_configure(struct rte_cryptodev *dev,
+bcmfs_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -235,45 +233,23 @@ bcmfs_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- BCMFS_DP_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
BCMFS_DP_LOG(ERR, "Failed configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
void
-bcmfs_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp;
-
- memset(sess_priv, 0, sizeof(struct bcmfs_sym_session));
- sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+bcmfs_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
unsigned int
bcmfs_sym_session_get_private_size(struct rte_cryptodev *dev __rte_unused)
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.h b/drivers/crypto/bcmfs/bcmfs_sym_session.h
index d40595b4bd..4a0a012ae7 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.h
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.h
@@ -93,8 +93,7 @@ bcmfs_process_crypto_op(struct rte_crypto_op *op,
int
bcmfs_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
void
bcmfs_sym_session_clear(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8c0b4909cf..59eaecfbd2 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1357,8 +1357,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
ses = (struct caam_jr_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_driver_id);
+ op->sym->session->driver_priv_data;
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
ses = (struct caam_jr_session *)
@@ -1692,54 +1691,39 @@ caam_jr_set_session_parameters(struct rte_cryptodev *dev,
}
static int
-caam_jr_sym_session_configure(struct rte_cryptodev *dev,
+caam_jr_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
PMD_INIT_FUNC_TRACE();
-
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CAAM_JR_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
+ sess_private_data = (void *)sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct caam_jr_session));
ret = caam_jr_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
CAAM_JR_ERR("failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
static void
-caam_jr_sym_session_clear(struct rte_cryptodev *dev,
+caam_jr_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
struct caam_jr_session *s = (struct caam_jr_session *)sess_priv;
PMD_INIT_FUNC_TRACE();
if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(struct caam_jr_session));
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4bab18323b..bd999abe61 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1585,9 +1585,7 @@ ccp_perform_hmac(struct rte_crypto_op *op,
void *append_ptr;
uint8_t *addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
addr = session->auth.pre_compute;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -1766,9 +1764,7 @@ ccp_perform_sha(struct rte_crypto_op *op,
void *append_ptr;
uint64_t auth_msg_bits;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1859,9 +1855,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr, dest_addr_t;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2005,9 +1999,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2079,9 +2071,7 @@ ccp_perform_aes_cmac(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
key_addr = rte_mem_virt2phy(session->auth.key_ccp);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -2242,9 +2232,7 @@ ccp_perform_aes(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
uint8_t *iv;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
function.raw = 0;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
@@ -2330,9 +2318,7 @@ ccp_perform_3des(struct rte_crypto_op *op,
uint8_t *iv;
phys_addr_t src_addr, dest_addr, key_addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
switch (session->cipher.um.des_mode) {
@@ -2440,9 +2426,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
phys_addr_t digest_dest_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
key_addr = session->cipher.key_phys;
@@ -2607,9 +2591,7 @@ ccp_crypto_cipher(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->cipher.algo) {
case CCP_CIPHER_ALGO_AES_CBC:
@@ -2645,9 +2627,7 @@ ccp_crypto_auth(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_SHA1:
@@ -2715,9 +2695,7 @@ ccp_crypto_aead(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_AES_GCM:
@@ -2780,9 +2758,8 @@ process_ops_to_enqueue(struct ccp_qp *qp,
b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
Q_DESC_SIZE);
for (i = b_idx; i < (nb_ops+b_idx); i++) {
- session = (struct ccp_session *)get_sym_session_private_data(
- op[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
result = ccp_crypto_cipher(op[i], cmd_q, b_info);
@@ -2858,9 +2835,7 @@ static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
int offset, digest_offset;
uint8_t digest_le[64];
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
if (session->cmd_id == CCP_CMD_COMBINED) {
digest_data = op->sym->aead.digest.data;
@@ -2934,9 +2909,8 @@ ccp_prepare_ops(struct ccp_qp *qp,
for (i = b_info->b_idx; i < min_ops; i++) {
op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
- session = (struct ccp_session *)get_sym_session_private_data(
- op_d[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op_d[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 1b600e81ad..e401793a76 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -727,7 +727,6 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
/* mempool for batch info */
qp->batch_mp = rte_mempool_create(
@@ -757,8 +756,7 @@ ccp_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
void *sess_private_data;
@@ -769,40 +767,22 @@ ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -ENOMEM;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CCP_LOG_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
+
internals = (struct ccp_private *)dev->data->dev_private;
ret = ccp_set_session_parameters(sess_private_data, xform, internals);
if (ret != 0) {
CCP_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
return 0;
}
static void
-ccp_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- rte_mempool_put(sess_mp, sess_priv);
- memset(sess_priv, 0, sizeof(struct ccp_session));
- set_sym_session_private_data(sess, index, NULL);
- }
-}
+ccp_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops ccp_ops = {
.dev_configure = ccp_pmd_config,
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 1c4118ee3c..6704e39ab8 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -78,8 +78,6 @@ struct ccp_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_mempool *batch_mp;
/**< Session Mempool for batch info */
struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 013f3be1e6..6a0bfff45f 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -56,33 +56,23 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
if (unlikely(op->sym->session == NULL))
return NULL;
- sess = (struct ccp_session *)
- get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ sess = (void *)op->sym->session->driver_priv_data;
} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- void *_sess;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess;
struct ccp_private *internals;
- if (rte_mempool_get(qp->sess_mp, &_sess))
- return NULL;
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+ if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- sess = (struct ccp_session *)_sess_private_data;
+ sess = (void *)_sess->driver_priv_data;
internals = (struct ccp_private *)qp->dev->data->dev_private;
if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
internals) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- ccp_cryptodev_driver_id,
- _sess_private_data);
+ op->sym->session = _sess;
}
return sess;
@@ -161,13 +151,10 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
for (i = 0; i < nb_dequeued; i++)
if (unlikely(ops[i]->sess_type ==
RTE_CRYPTO_OP_SESSIONLESS)) {
- struct ccp_session *sess = (struct ccp_session *)
- get_sym_session_private_data(
- ops[i]->sym->session,
- ccp_cryptodev_driver_id);
+ struct ccp_session *sess =
+ (void *)ops[i]->sym->session->driver_priv_data;
- rte_mempool_put(qp->sess_mp_priv,
- sess);
+ memset(sess, 0, sizeof(*sess));
rte_mempool_put(qp->sess_mp,
ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 7bbe8726e3..dee1f299d2 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -41,24 +41,23 @@ struct vec_request {
static inline struct cnxk_se_sess *
cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn10k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
- if (ret)
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform,
+ sess);
+ if (ret) {
+ rte_mempool_put(qp->sess_mp, (void *)sess);
goto sess_put;
+ }
- priv = get_sym_session_private_data(sess, driver_id);
-
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
return priv;
@@ -130,8 +129,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
return 0;
w7 = sec_sess->sa.inst.w7;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- sess = get_sym_session_private_data(
- sym_op->session, cn10k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret))
@@ -147,8 +145,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret)) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
return 0;
}
@@ -312,8 +309,9 @@ cn10k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn10k_cryptodev_driver_id);
+ priv = (void *)(
+ ((struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -350,8 +348,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn10k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
} else {
@@ -818,7 +815,6 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
{
const uint8_t uc_compcode = res->uc_compcode;
const uint8_t compcode = res->compcode;
- unsigned int sz;
cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
@@ -895,11 +891,7 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index b753c1cb4b..a44f111ba6 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -56,23 +56,20 @@ cn9k_cpt_sec_inst_fill(struct rte_crypto_op *op,
static inline struct cnxk_se_sess *
cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn9k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform, sess);
if (ret)
goto sess_put;
- priv = get_sym_session_private_data(sess, driver_id);
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
@@ -95,8 +92,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
sym_op = op->sym;
- sess = get_sym_session_private_data(
- sym_op->session, cn9k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
inst->w7.u64 = sess->cpt_inst_w7;
} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
@@ -110,8 +106,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
if (unlikely(ret)) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
}
inst->w7.u64 = sess->cpt_inst_w7;
@@ -349,8 +344,9 @@ cn9k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn9k_cryptodev_driver_id);
+ priv = (void *)((
+ (struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -387,8 +383,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn9k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
} else {
@@ -583,8 +578,6 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
struct cpt_inflight_req *infl_req,
struct cpt_cn9k_res_s *res)
{
- unsigned int sz;
-
if (likely(res->compcode == CPT_COMP_GOOD)) {
if (unlikely(res->uc_compcode)) {
if (res->uc_compcode == ROC_SE_ERR_GC_ICV_MISCOMPARE)
@@ -645,11 +638,7 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index cf91b92c2c..018d7fcee8 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -406,7 +406,6 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = conf->mp_session;
- qp->sess_mp_priv = conf->mp_session_private;
dev->data->queue_pairs[qp_id] = qp;
return 0;
@@ -620,25 +619,15 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)
}
int
-sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
enum cpt_dp_thread_type thr_type;
- struct cnxk_se_sess *sess_priv;
- void *priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
int ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- plt_dp_err("Could not allocate session private data");
- return -ENOMEM;
- }
-
- memset(priv, 0, sizeof(struct cnxk_se_sess));
-
- sess_priv = priv;
-
+ memset(sess_priv, 0, sizeof(struct cnxk_se_sess));
ret = cnxk_sess_fill(roc_cpt, xform, sess_priv);
if (ret)
goto priv_put;
@@ -684,61 +673,39 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
}
sess_priv->cpt_inst_w7 = cnxk_cpt_inst_w7_get(sess_priv, roc_cpt);
-
- set_sym_session_private_data(sess, driver_id, sess_priv);
-
return 0;
priv_put:
- rte_mempool_put(pool, priv);
-
return ret;
}
int
cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
struct cnxk_cpt_vf *vf = dev->data->dev_private;
struct roc_cpt *roc_cpt = &vf->cpt;
- uint8_t driver_id;
- driver_id = dev->driver_id;
-
- return sym_session_configure(roc_cpt, driver_id, xform, sess, pool);
+ return sym_session_configure(roc_cpt, xform, sess);
}
void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
- struct cnxk_se_sess *sess_priv;
- struct rte_mempool *pool;
-
- if (priv == NULL)
- return;
-
- sess_priv = priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
- memset(priv, 0, cnxk_cpt_sym_session_get_size(NULL));
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
+ memset(sess_priv, 0, cnxk_cpt_sym_session_get_size(NULL));
}
void
-cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
+cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
unsigned int
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index d9ed43b40b..baa2b69c52 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -85,8 +85,6 @@ struct cnxk_cpt_qp {
/**< Crypto adapter related info */
struct rte_mempool *sess_mp;
/**< Session mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session private data mempool */
};
int cnxk_cpt_dev_config(struct rte_cryptodev *dev,
@@ -111,18 +109,16 @@ unsigned int cnxk_cpt_sym_session_get_size(struct rte_cryptodev *dev);
int cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
-int sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+int sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
void cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess);
+ struct rte_cryptodev_sym_session *sess);
-void sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess);
+void sym_session_clear(struct rte_cryptodev_sym_session *sess);
unsigned int cnxk_ae_session_size_get(struct rte_cryptodev *dev __rte_unused);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 3b13578de0..fa1cdcf78b 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1379,8 +1379,7 @@ build_sec_fd(struct rte_crypto_op *op,
dpaa2_sec_session *sess;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -1678,8 +1677,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
struct rte_crypto_sym_op *sym_op;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -3754,51 +3752,36 @@ dpaa2_sec_security_session_destroy(void *dev __rte_unused,
}
#endif
static int
-dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA2_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa2_sec_set_session_parameters(xform, sess_private_data);
if (ret != 0) {
DPAA2_SEC_ERR("Failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa2_sec_session *s = (dpaa2_sec_session *)sess_priv;
if (sess_priv) {
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(dpaa2_sec_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index b3242791ac..fb74be6012 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -1012,8 +1012,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa2_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, cryptodev_driver_id);
+ sess = (void *)session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index c6bd785262..7a4c03a882 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -670,10 +670,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
struct qm_sg_entry sg[2];
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa_sec_session *)
@@ -1927,10 +1924,8 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ ses = (void *)
+ op->sym->session->driver_priv_data;
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
@@ -2676,31 +2671,19 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
static int
dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
PMD_INIT_FUNC_TRACE();
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa_sec_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
DPAA_SEC_ERR("failed to configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
ret = dpaa_sec_prep_cdb(sess_private_data);
if (ret) {
DPAA_SEC_ERR("Unable to prepare sec cdb");
@@ -2714,7 +2697,6 @@ static inline void
free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
{
struct dpaa_sec_dev_private *qi = dev->data->dev_private;
- struct rte_mempool *sess_mp = rte_mempool_from_obj((void *)s);
uint8_t i;
for (i = 0; i < MAX_DPAA_CORES; i++) {
@@ -2724,7 +2706,6 @@ free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
s->qp[i] = NULL;
}
free_session_data(s);
- rte_mempool_put(sess_mp, (void *)s);
}
/** Clear the memory of session so it doesn't leave key material behind */
@@ -2733,14 +2714,10 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
- if (sess_priv) {
- free_session_memory(dev, s);
- set_sym_session_private_data(sess, index, NULL);
- }
+ free_session_memory(dev, s);
}
#ifdef RTE_LIB_SECURITY
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index 29c5935739..35f93ceb48 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -1017,8 +1017,8 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)
+ session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 7e8396b4a3..90ce5bc965 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -264,7 +264,6 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
qp->pmd_type = internals->pmd_type;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
qp->ingress_queue = ipsec_mb_qp_create_processed_ops_ring(qp,
qp_conf->nb_descriptors, socket_id);
@@ -312,9 +311,8 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev)
int
ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess, struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
struct ipsec_mb_dev_private *internals = dev->data->dev_private;
struct ipsec_mb_internals *pmd_data =
&ipsec_mb_pmds[internals->pmd_type];
@@ -330,42 +328,22 @@ ipsec_mb_sym_session_configure(
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- IPSEC_MB_LOG(ERR, "Couldn't get object from session mempool");
- free_mb_mgr(mb_mgr);
- return -ENOMEM;
- }
-
- ret = (*pmd_data->session_configure)(mb_mgr, sess_private_data, xform);
+ ret = (*pmd_data->session_configure)(mb_mgr,
+ (void *)sess->driver_priv_data, xform);
if (ret != 0) {
IPSEC_MB_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
free_mb_mgr(mb_mgr);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
free_mb_mgr(mb_mgr);
return 0;
}
/** Clear the session memory */
void
-ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, ipsec_mb_sym_session_get_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+ipsec_mb_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 472b672f08..e4aea7700c 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -136,8 +136,6 @@ struct ipsec_mb_qp {
struct rte_ring *ingress_queue;
/**< Ring for placing operations ready for processing */
struct rte_mempool *sess_mp;
- /**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
/**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
@@ -399,8 +397,7 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev);
int ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
/** Clear the memory of session so it does not leave key material behind */
void
@@ -411,50 +408,50 @@ ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
static __rte_always_inline void *
ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
{
- void *sess = NULL;
+ struct rte_cryptodev_sym_session *sess = NULL;
uint32_t driver_id = ipsec_mb_get_driver_id(qp->pmd_type);
struct rte_crypto_sym_op *sym_op = op->sym;
uint8_t sess_type = op->sess_type;
void *_sess;
- void *_sess_private_data = NULL;
struct ipsec_mb_internals *pmd_data = &ipsec_mb_pmds[qp->pmd_type];
switch (sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
if (likely(sym_op->session != NULL))
- sess = get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
+ else
+ goto error_exit;
break;
case RTE_CRYPTO_OP_SESSIONLESS:
if (!qp->sess_mp ||
rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (!qp->sess_mp_priv ||
- rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
+ sess = _sess;
+ if (sess->sess_data_sz < pmd_data->session_priv_size) {
+ rte_mempool_put(qp->sess_mp, _sess);
+ goto error_exit;
+ }
- sess = _sess_private_data;
if (unlikely(pmd_data->session_configure(qp->mb_mgr,
- sess, sym_op->xform) != 0)) {
+ (void *)sess->driver_priv_data, sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
- sess = NULL;
+ goto error_exit;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sess->driver_id = driver_id;
+ sym_op->session = sess;
+
break;
default:
IPSEC_MB_LOG(ERR, "Unrecognized session type %u", sess_type);
}
- if (unlikely(sess == NULL))
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return (void *)sess->driver_priv_data;
- return sess;
+error_exit:
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return NULL;
}
#endif /* _IPSEC_MB_PRIVATE_H_ */
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
index 2c033c6f28..e4f274b608 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
@@ -241,10 +241,6 @@ handle_completed_gcm_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_gcm_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -455,44 +451,35 @@ static inline struct aesni_gcm_session *
aesni_gcm_get_session(struct ipsec_mb_qp *qp,
struct rte_crypto_op *op)
{
- struct aesni_gcm_session *sess = NULL;
- uint32_t driver_id =
- ipsec_mb_get_driver_id(IPSEC_MB_PMD_TYPE_AESNI_GCM);
+ struct rte_cryptodev_sym_session *sess = NULL;
struct rte_crypto_sym_op *sym_op = op->sym;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
- sess = (struct aesni_gcm_session *)
- get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
} else {
- void *_sess;
- void *_sess_private_data = NULL;
-
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
+ if (unlikely(sess->sess_data_sz <
+ sizeof(struct aesni_gcm_session))) {
+ rte_mempool_put(qp->sess_mp, sess);
return NULL;
-
- sess = (struct aesni_gcm_session *)_sess_private_data;
+ }
if (unlikely(aesni_gcm_session_configure(qp->mb_mgr,
- _sess_private_data, sym_op->xform) != 0)) {
- rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
+ (void *)sess->driver_priv_data,
+ sym_op->xform) != 0)) {
+ rte_mempool_put(qp->sess_mp, sess);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sym_op->session = sess;
}
if (unlikely(sess == NULL))
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return sess;
+ return (void *)sess->driver_priv_data;
}
static uint16_t
@@ -712,22 +699,15 @@ aesni_gmac_sgl_verify(struct aesni_gcm_session *s,
/** Process CPU crypto bulk operations */
static uint32_t
-aesni_gcm_process_bulk(struct rte_cryptodev *dev,
+aesni_gcm_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess,
__rte_unused union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
- struct aesni_gcm_session *s;
+ struct aesni_gcm_session *s = (void *)sess->driver_priv_data;
struct gcm_context_data gdata_ctx;
IMB_MGR *mb_mgr;
- s = (struct aesni_gcm_session *) get_sym_session_private_data(sess,
- dev->driver_id);
- if (unlikely(s == NULL)) {
- aesni_gcm_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 6d5d3ce8eb..f3565b04b5 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1710,8 +1710,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
{
struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data;
struct aesni_mb_session *sess = NULL;
- uint32_t driver_id = ipsec_mb_get_driver_id(
- IPSEC_MB_PMD_TYPE_AESNI_MB);
#ifdef AESNI_MB_DOCSIS_SEC_ENABLED
uint8_t is_docsis_sec = 0;
@@ -1725,15 +1723,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
sess = get_sec_session_private_data(op->sym->sec_session);
} else
#endif
- {
- sess = get_sym_session_private_data(op->sym->session,
- driver_id);
- }
-
- if (unlikely(sess == NULL)) {
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return op;
- }
+ sess = (void *)op->sym->session->driver_priv_data;
if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
switch (job->status) {
@@ -1771,10 +1761,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_mb_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -1962,16 +1948,6 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
return processed_jobs;
}
-
-static inline void
-ipsec_mb_fill_error_code(struct rte_crypto_sym_vec *vec, int32_t err)
-{
- uint32_t i;
-
- for (i = 0; i != vec->num; ++i)
- vec->status[i] = err;
-}
-
static inline int
check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl)
{
@@ -2028,7 +2004,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec,
}
static uint32_t
-aesni_mb_process_bulk(struct rte_cryptodev *dev,
+aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
struct rte_crypto_sym_vec *vec)
{
@@ -2037,15 +2013,9 @@ aesni_mb_process_bulk(struct rte_cryptodev *dev,
void *buf;
IMB_JOB *job;
IMB_MGR *mb_mgr;
- struct aesni_mb_session *s;
+ struct aesni_mb_session *s = (void *)sess->driver_priv_data;
uint8_t tmp_dgst[vec->num][DIGEST_LENGTH_MAX];
- s = get_sym_session_private_data(sess, dev->driver_id);
- if (s == NULL) {
- ipsec_mb_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
index d953d6e5f5..97e7cef233 100644
--- a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
+++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
@@ -290,10 +290,6 @@ handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct chacha20_poly1305_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index fba10b8cf4..b83e2d6715 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -231,11 +231,6 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct kasumi_session));
- memset(
- ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -287,8 +282,9 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct kasumi_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct kasumi_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
return processed_op;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index 9a85f46721..f052d6d847 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -362,10 +362,6 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct snow3g_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -417,8 +413,9 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct snow3g_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct snow3g_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c b/drivers/crypto/ipsec_mb/pmd_zuc.c
index e36c7092d6..92fd9d1808 100644
--- a/drivers/crypto/ipsec_mb/pmd_zuc.c
+++ b/drivers/crypto/ipsec_mb/pmd_zuc.c
@@ -239,10 +239,6 @@ process_ops(struct rte_crypto_op **ops, enum ipsec_mb_operation op_type,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sessions[i], 0, sizeof(struct zuc_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sessions[i]);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index dc8e291f50..e5063b515c 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -171,14 +171,13 @@ mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *session)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *sess_private_data;
+ struct mlx5_crypto_session *sess_private_data =
+ (void *)session->driver_priv_data;
struct rte_crypto_cipher_xform *cipher;
uint8_t encryption_order;
- int ret;
if (unlikely(xform->next != NULL)) {
DRV_LOG(ERR, "Xform next is not supported.");
@@ -189,17 +188,9 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
DRV_LOG(ERR, "Only AES-XTS algorithm is supported.");
return -ENOTSUP;
}
- ret = rte_mempool_get(mp, (void *)&sess_private_data);
- if (ret != 0) {
- DRV_LOG(ERR,
- "Failed to get session %p private data from mempool.",
- sess_private_data);
- return -ENOMEM;
- }
cipher = &xform->cipher;
sess_private_data->dek = mlx5_crypto_dek_prepare(priv, cipher);
if (sess_private_data->dek == NULL) {
- rte_mempool_put(mp, sess_private_data);
DRV_LOG(ERR, "Failed to prepare dek.");
return -ENOMEM;
}
@@ -239,8 +230,6 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
sess_private_data->dek_id =
rte_cpu_to_be_32(sess_private_data->dek->obj->id &
0xffffff);
- set_sym_session_private_data(session, dev->driver_id,
- sess_private_data);
DRV_LOG(DEBUG, "Session %p was configured.", sess_private_data);
return 0;
}
@@ -250,16 +239,13 @@ mlx5_crypto_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *spriv = get_sym_session_private_data(sess,
- dev->driver_id);
+ struct mlx5_crypto_session *spriv = (void *)sess->driver_priv_data;
if (unlikely(spriv == NULL)) {
DRV_LOG(ERR, "Failed to get session %p private data.", spriv);
return;
}
mlx5_crypto_dek_destroy(priv, spriv->dek);
- set_sym_session_private_data(sess, dev->driver_id, NULL);
- rte_mempool_put(rte_mempool_from_obj(spriv), spriv);
DRV_LOG(DEBUG, "Session %p was cleared.", spriv);
}
@@ -369,8 +355,8 @@ mlx5_crypto_wqe_set(struct mlx5_crypto_priv *priv,
struct rte_crypto_op *op,
struct mlx5_umr_wqe *umr)
{
- struct mlx5_crypto_session *sess = get_sym_session_private_data
- (op->sym->session, mlx5_crypto_driver_id);
+ struct mlx5_crypto_session *sess =
+ (void *)op->sym->session->driver_priv_data;
struct mlx5_wqe_cseg *cseg = &umr->ctr;
struct mlx5_wqe_mkey_cseg *mkc = &umr->mkc;
struct mlx5_wqe_dseg *klms = &umr->kseg[0];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index c35876c8b4..fdc9c14227 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -597,13 +597,7 @@ mrvl_request_prepare_crp(struct sam_cio_op_params *request,
return -EINVAL;
}
- sess = (struct mrvl_crypto_session *)get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
- if (unlikely(sess == NULL)) {
- MRVL_LOG(ERR, "Session was not created for this device!");
- return -EINVAL;
- }
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
request->sa = sess->sam_sess;
request->cookie = op;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index f828dc9db5..0066236561 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -736,8 +736,7 @@ mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
static int
mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
struct mrvl_crypto_session *mrvl_sess;
void *sess_private_data;
@@ -748,23 +747,15 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- CDEV_LOG_ERR("Couldn't get object from session mempool.");
- return -ENOMEM;
- }
-
+ sess_private_data = sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session));
ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
MRVL_LOG(ERR, "Failed to configure session parameters!");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
mrvl_sess = (struct mrvl_crypto_session *)sess_private_data;
if (sam_session_create(&mrvl_sess->sam_sess_params,
@@ -791,8 +782,7 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = sess->data;
/* Zero out the whole structure */
if (sess_priv) {
@@ -803,11 +793,6 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
sam_session_destroy(mrvl_sess->sam_sess) < 0) {
MRVL_LOG(ERR, "Error while destroying session!");
}
-
- memset(mrvl_sess, 0, sizeof(struct mrvl_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index cb5393d2f1..505024a810 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -530,24 +530,16 @@ configure_aead_ctx(struct rte_crypto_aead_xform *xform,
}
static int
-nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
+nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *mp_obj;
- struct nitrox_crypto_ctx *ctx;
+ struct nitrox_crypto_ctx *ctx = (void *)sess->driver_priv_data;
struct rte_crypto_cipher_xform *cipher_xform = NULL;
struct rte_crypto_auth_xform *auth_xform = NULL;
struct rte_crypto_aead_xform *aead_xform = NULL;
int ret = -EINVAL;
- if (rte_mempool_get(mempool, &mp_obj)) {
- NITROX_LOG(ERR, "Couldn't allocate context\n");
- return -ENOMEM;
- }
-
- ctx = mp_obj;
ctx->nitrox_chain = get_crypto_chain_order(xform);
switch (ctx->nitrox_chain) {
case NITROX_CHAIN_CIPHER_ONLY:
@@ -585,38 +577,23 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
goto err;
}
- ctx->iova = rte_mempool_virt2iova(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, ctx);
+ ctx->iova = sess->driver_priv_data_iova;
return 0;
err:
- rte_mempool_put(mempool, mp_obj);
return ret;
}
static void
-nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct nitrox_crypto_ctx *ctx = get_sym_session_private_data(sess,
- cdev->driver_id);
- struct rte_mempool *sess_mp;
-
- if (!ctx)
- return;
-
- memset(ctx, 0, sizeof(*ctx));
- sess_mp = rte_mempool_from_obj(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, NULL);
- rte_mempool_put(sess_mp, ctx);
-}
+nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct nitrox_crypto_ctx *
get_crypto_ctx(struct rte_crypto_op *op)
{
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(op->sym->session))
- return get_sym_session_private_data(op->sym->session,
- nitrox_sym_drv_id);
+ return (void *)op->sym->session->driver_priv_data;
}
return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index eab74ad45f..695eeaa1e8 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -58,7 +58,7 @@ process_op(const struct null_crypto_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(op->sym->session, 0,
sizeof(struct null_crypto_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
@@ -78,30 +78,21 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
sess = (struct null_crypto_session *)
- get_sym_session_private_data(
- sym_op->session, cryptodev_driver_id);
+ sym_op->session->driver_priv_data;
} else {
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct null_crypto_session *)_sess_private_data;
+ sess = (struct null_crypto_session *)_sess->driver_priv_data;
if (unlikely(null_crypto_set_session_parameters(sess,
sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+ sym_op->session = _sess;
}
return sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 90a675dfff..fb43d3f7b5 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -233,7 +233,6 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
@@ -256,8 +255,7 @@ null_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -267,43 +265,22 @@ null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- NULL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = null_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
NULL_LOG(ERR, "failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct null_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops pmd_ops = {
.dev_configure = null_crypto_pmd_config,
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index 89c4345b6f..ae34ce6671 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,8 +31,6 @@ struct null_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Mempool */
struct rte_cryptodev_stats qp_stats;
/**< Queue pair statistics */
} __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
index e48805fb09..4647d568de 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
+++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
@@ -49,7 +49,6 @@ struct cpt_instance {
uint32_t queue_id;
uintptr_t rsvd;
struct rte_mempool *sess_mp;
- struct rte_mempool *sess_mp_priv;
struct cpt_qp_meta_info meta_info;
uint8_t ca_enabled;
};
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 11840f5ecf..71856d5e86 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -171,7 +171,6 @@ otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
instance->queue_id = que_pair_id;
instance->sess_mp = qp_conf->mp_session;
- instance->sess_mp_priv = qp_conf->mp_session_private;
dev->data->queue_pairs[que_pair_id] = instance;
return 0;
@@ -243,25 +242,19 @@ sym_xform_verify(struct rte_crypto_sym_xform *xform)
}
static int
-sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+sym_session_configure(struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_crypto_sym_xform *temp_xform = xform;
struct cpt_sess_misc *misc;
vq_cmd_word3_t vq_cmd_w3;
- void *priv;
+ void *priv = (void *)sess->driver_priv_data;
int ret;
ret = sym_xform_verify(xform);
if (unlikely(ret))
return ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- CPT_LOG_ERR("Could not allocate session private data");
- return -ENOMEM;
- }
-
memset(priv, 0, sizeof(struct cpt_sess_misc) +
offsetof(struct cpt_ctx, mc_ctx));
@@ -301,9 +294,7 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
goto priv_put;
}
- set_sym_session_private_data(sess, driver_id, priv);
-
- misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
+ misc->ctx_dma_addr = sess->driver_priv_data_iova +
sizeof(struct cpt_sess_misc);
vq_cmd_w3.u64 = 0;
@@ -316,17 +307,14 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
return 0;
priv_put:
- if (priv)
- rte_mempool_put(pool, priv);
return -ENOTSUP;
}
static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
+ void *priv = (void *)sess->driver_priv_data;
struct cpt_sess_misc *misc;
- struct rte_mempool *pool;
struct cpt_ctx *ctx;
if (priv == NULL)
@@ -336,35 +324,26 @@ sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
ctx = SESS_PRIV(misc);
rte_free(ctx->auth_key);
-
- memset(priv, 0, cpt_get_session_size());
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
}
static int
-otx_cpt_session_cfg(struct rte_cryptodev *dev,
+otx_cpt_session_cfg(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_configure(dev->driver_id, xform, sess, pool);
+ return sym_session_configure(xform, sess);
}
static void
-otx_cpt_session_clear(struct rte_cryptodev *dev,
+otx_cpt_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
static unsigned int
@@ -528,10 +507,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance,
void *req;
uint64_t cpt_op;
- sess = (struct cpt_sess_misc *)
- get_sym_session_private_data(sym_op->session,
- otx_cryptodev_driver_id);
-
+ sess = (struct cpt_sess_misc *)sym_op->session->driver_priv_data;
cpt_op = sess->cpt_op;
if (likely(cpt_op & CPT_OP_CIPHER_MASK))
@@ -560,21 +536,18 @@ static __rte_always_inline void * __rte_hot
otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
struct rte_crypto_op *op)
{
- const int driver_id = otx_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
void *req;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(instance->sess_mp);
- if (sess == NULL) {
+ if (rte_mempool_get(instance->sess_mp, (void **)&sess) < 0) {
rte_errno = ENOMEM;
return NULL;
}
- ret = sym_session_configure(driver_id, sym_op->xform, sess,
- instance->sess_mp_priv);
+ ret = sym_session_configure(sym_op->xform, sess);
if (ret)
goto sess_put;
@@ -583,12 +556,10 @@ otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
/* Enqueue op with the tmp session set */
req = otx_cpt_enq_single_sym(instance, op);
if (unlikely(req == NULL))
- goto priv_put;
+ goto sess_put;
return req;
-priv_put:
- sym_session_clear(driver_id, sess);
sess_put:
rte_mempool_put(instance->sess_mp, sess);
return NULL;
@@ -873,13 +844,9 @@ static inline void
free_sym_session_data(const struct cpt_instance *instance,
struct rte_crypto_op *cop)
{
- void *sess_private_data_t = get_sym_session_private_data(
- cop->sym->session, otx_cryptodev_driver_id);
+ void *sess_private_data_t = (void *)cop->sym->session->driver_priv_data;
+
memset(sess_private_data_t, 0, cpt_get_session_size());
- memset(cop->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session));
- rte_mempool_put(instance->sess_mp_priv, sess_private_data_t);
rte_mempool_put(instance->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/openssl_pmd_private.h b/drivers/crypto/openssl/openssl_pmd_private.h
index c34fd9a546..ed6841e460 100644
--- a/drivers/crypto/openssl/openssl_pmd_private.h
+++ b/drivers/crypto/openssl/openssl_pmd_private.h
@@ -70,8 +70,6 @@ struct openssl_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 3c4ff1ac56..ff5e349ce8 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -887,10 +887,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
/* get existing session */
if (likely(op->sym->session != NULL))
- sess = (struct openssl_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = (void *)
+ op->sym->session->driver_priv_data;
} else {
if (likely(op->asym->session != NULL))
asym_sess = (struct openssl_asym_session *)
@@ -901,32 +899,26 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
return asym_sess;
}
} else {
+ struct rte_cryptodev_sym_session *_sess;
/* sessionless asymmetric not supported */
if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC)
return NULL;
/* provide internal session */
- void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- void *_sess_private_data = NULL;
+ rte_mempool_get(qp->sess_mp, (void **)&_sess);
if (_sess == NULL)
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct openssl_session *)_sess_private_data;
+ sess = (struct openssl_session *)_sess->driver_priv_data;
if (unlikely(openssl_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+
}
if (sess == NULL)
@@ -2900,10 +2892,6 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
openssl_reset_session(sess);
memset(sess, 0, sizeof(struct openssl_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index f7ddbf9c73..2a3662ee5a 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -764,7 +764,6 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -794,10 +793,9 @@ openssl_pmd_asym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
if (unlikely(sess == NULL)) {
@@ -805,24 +803,14 @@ openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- OPENSSL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = openssl_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
OPENSSL_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
@@ -1328,20 +1316,13 @@ openssl_pmd_asym_session_configure(struct rte_cryptodev *dev __rte_unused,
/** Clear the memory of session so it doesn't leave key material behind */
static void
-openssl_pmd_sym_session_clear(struct rte_cryptodev *dev,
+openssl_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
/* Zero out the whole structure */
- if (sess_priv) {
- openssl_reset_session(sess_priv);
- memset(sess_priv, 0, sizeof(struct openssl_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ openssl_reset_session(sess_priv);
}
static void openssl_reset_asym_session(struct openssl_asym_session *sess)
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index f3a99ae15c..2c58a0ec75 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -67,12 +67,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
return -EINVAL;
if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) {
- ctx = get_sym_session_private_data(op->sym->session,
- qat_sym_driver_id);
- if (unlikely(!ctx)) {
- QAT_DP_LOG(ERR, "No session for this device");
- return -EINVAL;
- }
+ ctx = (void *)op->sym->session->driver_priv_data;
if (sess != (uintptr_t)ctx) {
struct rte_cryptodev *cdev;
struct qat_cryptodev_private *internals;
@@ -391,8 +386,7 @@ qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
return -EINVAL;
- ctx = (struct qat_sym_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, qat_sym_driver_id);
+ ctx = (void *)session_ctx.crypto_sess->driver_priv_data;
dp_ctx->session = ctx;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 074612c11b..2853ac5b88 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -317,9 +317,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
#endif
{
sess = (struct qat_sym_session *)
- get_sym_session_private_data(
- rx_op->sym->session,
- qat_sym_driver_id);
+ rx_op->sym->session->driver_priv_data;
is_docsis_sec = 0;
}
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index bfc9836351..da50bcbef1 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -226,22 +226,13 @@ qat_is_auth_alg_supported(enum rte_crypto_auth_algorithm algo,
}
void
-qat_sym_session_clear(struct rte_cryptodev *dev,
+qat_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
- struct qat_sym_session *s = (struct qat_sym_session *)sess_priv;
+ struct qat_sym_session *s = (void *)sess->driver_priv_data;
- if (sess_priv) {
- if (s->bpi_ctx)
- bpi_cipher_ctx_free(s->bpi_ctx);
- memset(s, 0, qat_sym_session_get_private_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ if (s->bpi_ctx)
+ bpi_cipher_ctx_free(s->bpi_ctx);
}
static int
@@ -524,35 +515,24 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
if (ossl_legacy_provider_load())
return -EINVAL;
#endif
- ret = qat_sym_session_set_parameters(dev, xform, sess_private_data);
+ ret = qat_sym_session_set_parameters(dev, xform,
+ (void *)sess->driver_priv_data,
+ sess->driver_priv_data_iova);
if (ret != 0) {
QAT_LOG(ERR,
"Crypto QAT PMD: failed to configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ossl_legacy_provider_unload();
# endif
@@ -561,7 +541,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev,
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private)
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_paddr)
{
struct qat_sym_session *session = session_private;
struct qat_cryptodev_private *internals = dev->data->dev_private;
@@ -570,7 +551,6 @@ qat_sym_session_set_parameters(struct rte_cryptodev *dev,
int qat_cmd_id;
/* Verify the session physical address is known */
- rte_iova_t session_paddr = rte_mempool_virt2iova(session);
if (session_paddr == 0 || session_paddr == RTE_BAD_IOVA) {
QAT_LOG(ERR,
"Session physical address unknown. Bad memory pool.");
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index 01908abd9e..9e4aab06a6 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -123,12 +123,12 @@ struct qat_sym_session {
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private);
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_private_iova);
int
qat_sym_session_configure_aead(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 11b559e025..03df424140 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -470,44 +470,18 @@ scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
}
static int
-scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+ struct rte_crypto_sym_xform *xform __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
- int ret;
-
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- ret = rte_cryptodev_sym_session_init(worker->dev_id, sess,
- xform, mempool);
- if (ret < 0) {
- CR_SCHED_LOG(ERR, "unable to config sym session");
- return ret;
- }
- }
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
-
- /* Clear private data of workers */
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- rte_cryptodev_sym_session_clear(worker->dev_id, sess);
- }
-}
+scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops scheduler_pmd_ops = {
.dev_configure = scheduler_pmd_config,
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 21bd996064..d3b799b28d 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -40,8 +40,7 @@ static void virtio_crypto_sym_clear_session(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
/*
* The set of PCI devices this driver supports
@@ -952,12 +951,7 @@ virtio_crypto_sym_clear_session(
hw = dev->data->dev_private;
vq = hw->cvq;
- session = (struct virtio_crypto_session *)get_sym_session_private_data(
- sess, cryptodev_virtio_driver_id);
- if (session == NULL) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid session parameter");
- return;
- }
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
VIRTIO_CRYPTO_SESSION_LOG_INFO("vq->vq_desc_head_idx = %d, "
"vq = %p", vq->vq_desc_head_idx, vq);
@@ -1070,10 +1064,6 @@ virtio_crypto_sym_clear_session(
VIRTIO_CRYPTO_SESSION_LOG_INFO("Close session %"PRIu64" successfully ",
session->session_id);
- memset(session, 0, sizeof(struct virtio_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(session);
- set_sym_session_private_data(sess, cryptodev_virtio_driver_id, NULL);
- rte_mempool_put(sess_mp, session);
rte_free(malloc_virt_addr);
}
@@ -1292,11 +1282,9 @@ static int
virtio_crypto_check_sym_configure_session_paras(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sym_sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sym_sess)
{
- if (unlikely(xform == NULL) || unlikely(sym_sess == NULL) ||
- unlikely(mempool == NULL)) {
+ if (unlikely(xform == NULL) || unlikely(sym_sess == NULL)) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("NULL pointer");
return -1;
}
@@ -1311,12 +1299,9 @@ static int
virtio_crypto_sym_configure_session(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
- struct virtio_crypto_session crypto_sess;
- void *session_private = &crypto_sess;
struct virtio_crypto_session *session;
struct virtio_crypto_op_ctrl_req *ctrl_req;
enum virtio_crypto_cmd_id cmd_id;
@@ -1328,19 +1313,12 @@ virtio_crypto_sym_configure_session(
PMD_INIT_FUNC_TRACE();
ret = virtio_crypto_check_sym_configure_session_paras(dev, xform,
- sess, mempool);
+ sess);
if (ret < 0) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid parameters");
return ret;
}
-
- if (rte_mempool_get(mempool, &session_private)) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
- session = (struct virtio_crypto_session *)session_private;
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
memset(session, 0, sizeof(struct virtio_crypto_session));
ctrl_req = &session->ctrl;
ctrl_req->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
@@ -1402,10 +1380,6 @@ virtio_crypto_sym_configure_session(
"Unsupported operation chain order parameter");
goto error_out;
}
-
- set_sym_session_private_data(sess, dev->driver_id,
- session_private);
-
return 0;
error_out:
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index 08359b3a39..b7f492a7f2 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -207,8 +207,7 @@ virtqueue_crypto_sym_enqueue_xmit(
offsetof(struct virtio_crypto_op_cookie, iv);
struct rte_crypto_sym_op *sym_op = cop->sym;
struct virtio_crypto_session *session =
- (struct virtio_crypto_session *)get_sym_session_private_data(
- cop->sym->session, cryptodev_virtio_driver_id);
+ (void *)cop->sym->session->driver_priv_data;
struct virtio_crypto_op_data_req *op_data_req;
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c
index 19af134bbe..bce903e007 100644
--- a/examples/fips_validation/fips_dev_self_test.c
+++ b/examples/fips_validation/fips_dev_self_test.c
@@ -969,7 +969,6 @@ struct fips_dev_auto_test_env {
struct rte_mempool *mpool;
struct rte_mempool *op_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mbuf *mbuf;
struct rte_crypto_op *op;
};
@@ -1479,13 +1478,8 @@ run_single_test(uint8_t dev_id,
return ret;
}
- sess = rte_cryptodev_sym_session_create(env->sess_pool);
- if (!sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(dev_id,
- sess, &xform, env->sess_priv_pool);
- if (ret < 0) {
+ sess = rte_cryptodev_sym_session_create(dev_id, &xform, env->sess_pool);
+ if (!sess) {
RTE_LOG(ERR, PMD, "Error %i: Init session\n", ret);
return ret;
}
@@ -1508,8 +1502,7 @@ run_single_test(uint8_t dev_id,
1);
} while (n_deqd == 0);
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(dev_id, sess);
if (env->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
return -1;
@@ -1527,7 +1520,6 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
rte_mempool_free(env->mpool);
rte_mempool_free(env->op_pool);
rte_mempool_free(env->sess_pool);
- rte_mempool_free(env->sess_priv_pool);
rte_cryptodev_stop(dev_id);
}
@@ -1535,7 +1527,7 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
static int
fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
{
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
struct rte_cryptodev_config conf;
char name[128];
@@ -1579,25 +1571,13 @@ fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
snprintf(name, 128, "%s%u", "SELF_TEST_SESS_POOL", dev_id);
env->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- 128, 0, 0, 0, rte_cryptodev_socket_id(dev_id));
+ 128, sess_sz, 0, 0, rte_cryptodev_socket_id(dev_id));
if (!env->sess_pool) {
ret = -ENOMEM;
goto error_exit;
}
- memset(name, 0, 128);
- snprintf(name, 128, "%s%u", "SELF_TEST_SESS_PRIV_POOL", dev_id);
-
- env->sess_priv_pool = rte_mempool_create(name,
- 128, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_cryptodev_socket_id(dev_id), 0);
- if (!env->sess_priv_pool) {
- ret = -ENOMEM;
- goto error_exit;
- }
-
qp_conf.mp_session = env->sess_pool;
- qp_conf.mp_session_private = env->sess_priv_pool;
ret = rte_cryptodev_queue_pair_setup(dev_id, 0, &qp_conf,
rte_cryptodev_socket_id(dev_id));
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e6c0b6a3a1..e73e6b09c3 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -55,7 +55,6 @@ struct cryptodev_fips_validate_env {
uint16_t mbuf_data_room;
struct rte_mempool *mpool;
struct rte_mempool *sess_mpool;
- struct rte_mempool *sess_priv_mpool;
struct rte_mempool *op_pool;
struct rte_mbuf *mbuf;
uint8_t *digest;
@@ -70,7 +69,7 @@ static int
cryptodev_fips_validate_app_int(void)
{
struct rte_cryptodev_config conf = {rte_socket_id(), 1, 0};
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
struct rte_cryptodev_info dev_info;
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
env.dev_id);
@@ -110,16 +109,11 @@ cryptodev_fips_validate_app_int(void)
ret = -ENOMEM;
env.sess_mpool = rte_cryptodev_sym_session_pool_create(
- "FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+ "FIPS_SESS_MEMPOOL", 16, sess_sz, 0, 0,
+ rte_socket_id());
if (!env.sess_mpool)
goto error_exit;
- env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
- 16, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_socket_id(), 0);
- if (!env.sess_priv_mpool)
- goto error_exit;
-
env.op_pool = rte_crypto_op_pool_create(
"FIPS_OP_POOL",
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -134,7 +128,6 @@ cryptodev_fips_validate_app_int(void)
goto error_exit;
qp_conf.mp_session = env.sess_mpool;
- qp_conf.mp_session_private = env.sess_priv_mpool;
ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
rte_socket_id());
@@ -151,7 +144,6 @@ cryptodev_fips_validate_app_int(void)
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
return ret;
@@ -162,11 +154,9 @@ cryptodev_fips_validate_app_uninit(void)
{
rte_pktmbuf_free(env.mbuf);
rte_crypto_op_free(env.op);
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
}
@@ -1202,13 +1192,9 @@ fips_run_test(void)
if (ret < 0)
return ret;
- env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
- if (!env.sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(env.dev_id,
- env.sess, &xform, env.sess_priv_mpool);
- if (ret < 0) {
+ env.sess = rte_cryptodev_sym_session_create(env.dev_id, &xform,
+ env.sess_mpool);
+ if (!env.sess) {
RTE_LOG(ERR, USER1, "Error %i: Init session\n",
ret);
goto exit;
@@ -1237,9 +1223,10 @@ fips_run_test(void)
vec.status = env.op->status;
exit:
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
- env.sess = NULL;
+ if (env.sess) {
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
+ env.sess = NULL;
+ }
return ret;
}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a4ac4174ba..338fbe6236 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1693,8 +1693,6 @@ cryptodevs_init(uint16_t req_queue_num)
qp_conf.nb_descriptors = qp_desc_nb;
qp_conf.mp_session =
socket_ctx[dev_conf.socket_id].session_pool;
- qp_conf.mp_session_private =
- socket_ctx[dev_conf.socket_id].session_priv_pool;
for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
&qp_conf, dev_conf.socket_id))
@@ -2501,12 +2499,8 @@ one_session_free(struct rte_ipsec_session *ips)
if (ips->crypto.ses == NULL)
return 0;
- ret = rte_cryptodev_sym_session_clear(ips->crypto.dev_id,
- ips->crypto.ses);
- if (ret)
- return ret;
-
- ret = rte_cryptodev_sym_session_free(ips->crypto.ses);
+ ret = rte_cryptodev_sym_session_free(ips->crypto.dev_id,
+ ips->crypto.ses);
} else {
/* Session has not been created */
if (ips->security.ctx == NULL || ips->security.ses == NULL)
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 7b7bfff696..bb84dcec7e 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -174,11 +174,8 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[],
}
ips->crypto.dev_id = cdev_id;
- ips->crypto.ses = rte_cryptodev_sym_session_create(
- skt_ctx->session_pool);
- rte_cryptodev_sym_session_init(cdev_id,
- ips->crypto.ses, sa->xforms,
- skt_ctx->session_priv_pool);
+ ips->crypto.ses = rte_cryptodev_sym_session_create(cdev_id,
+ sa->xforms, skt_ctx->session_pool);
rte_cryptodev_info_get(cdev_id, &cdev_info);
}
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index bf4b862379..b555e63ff6 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -228,7 +228,6 @@ struct rte_mempool *l2fwd_pktmbuf_pool;
struct rte_mempool *l2fwd_crypto_op_pool;
static struct {
struct rte_mempool *sess_mp;
- struct rte_mempool *priv_mp;
} session_pool_socket[RTE_MAX_NUMA_NODES];
/* Per-port statistics struct */
@@ -675,7 +674,6 @@ static struct rte_cryptodev_sym_session *
initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
{
struct rte_crypto_sym_xform *first_xform;
- struct rte_cryptodev_sym_session *session;
int retval = rte_cryptodev_socket_id(cdev_id);
if (retval < 0)
@@ -697,17 +695,8 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
first_xform = &options->auth_xform;
}
- session = rte_cryptodev_sym_session_create(
+ return rte_cryptodev_sym_session_create(cdev_id, first_xform,
session_pool_socket[socket_id].sess_mp);
- if (session == NULL)
- return NULL;
-
- if (rte_cryptodev_sym_session_init(cdev_id, session,
- first_xform,
- session_pool_socket[socket_id].priv_mp) < 0)
- return NULL;
-
- return session;
}
/* >8 End of creation of session. */
@@ -2380,13 +2369,10 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
rte_cryptodev_info_get(cdev_id, &dev_info);
- /*
- * Two sessions objects are required for each session
- * (one for the header, one for the private data)
- */
if (!strcmp(dev_info.driver_name, "crypto_scheduler")) {
#ifdef RTE_CRYPTO_SCHEDULER
- uint32_t nb_workers =
+ /* scheduler session header + 1 session per worker */
+ uint32_t nb_workers = 1 +
rte_cryptodev_scheduler_workers_get(cdev_id,
NULL);
@@ -2395,41 +2381,15 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
} else
sessions_needed = enabled_cdev_count;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- char mp_name[RTE_MEMPOOL_NAMESIZE];
-
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- session_pool_socket[socket_id].priv_mp =
- rte_mempool_create(mp_name,
- sessions_needed,
- max_sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- printf("Cannot create pool on socket %d\n",
- socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
char mp_name[RTE_MEMPOOL_NAMESIZE];
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
session_pool_socket[socket_id].sess_mp =
- rte_cryptodev_sym_session_pool_create(
- mp_name,
- sessions_needed,
- 0, 0, 0, socket_id);
-
+ rte_cryptodev_sym_session_pool_create(
+ mp_name, sessions_needed, max_sess_sz,
+ 0, 0, socket_id);
if (session_pool_socket[socket_id].sess_mp == NULL) {
printf("Cannot create pool on socket %d\n",
socket_id);
@@ -2580,8 +2540,6 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
qp_conf.nb_descriptors = 2048;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 7d75623a5e..02987ebd76 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,7 +46,6 @@ struct vhost_crypto_info {
int vids[MAX_NB_SOCKETS];
uint32_t nb_vids;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *cop_pool;
uint8_t cid;
uint32_t qid;
@@ -304,7 +303,6 @@ new_device(int vid)
}
ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
- info->sess_priv_pool,
rte_lcore_to_socket_id(options.los[i].lcore_id));
if (ret) {
RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -458,7 +456,6 @@ free_resource(void)
rte_mempool_free(info->cop_pool);
rte_mempool_free(info->sess_pool);
- rte_mempool_free(info->sess_priv_pool);
for (j = 0; j < lo->nb_sockets; j++) {
rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -544,16 +541,12 @@ main(int argc, char *argv[])
snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- SESSION_MAP_ENTRIES, 0, 0, 0,
- rte_lcore_to_socket_id(lo->lcore_id));
-
- snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
- info->sess_priv_pool = rte_mempool_create(name,
SESSION_MAP_ENTRIES,
rte_cryptodev_sym_get_private_session_size(
- info->cid), 64, 0, NULL, NULL, NULL, NULL,
- rte_lcore_to_socket_id(lo->lcore_id), 0);
- if (!info->sess_priv_pool || !info->sess_pool) {
+ info->cid), 0, 0,
+ rte_lcore_to_socket_id(lo->lcore_id));
+
+ if (!info->sess_pool) {
RTE_LOG(ERR, USER1, "Failed to create mempool");
goto error_exit;
}
@@ -574,7 +567,6 @@ main(int argc, char *argv[])
qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
qp_conf.mp_session = info->sess_pool;
- qp_conf.mp_session_private = info->sess_priv_pool;
for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
ret = rte_cryptodev_queue_pair_setup(info->cid, j,
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 09ba952455..8aa4fe4648 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -302,7 +302,6 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
* @param dev Crypto device pointer
* @param xform Single or chain of crypto xforms
* @param session Pointer to cryptodev's private session structure
- * @param mp Mempool where the private session is allocated
*
* @return
* - Returns 0 if private session structure have been created successfully.
@@ -312,8 +311,8 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
*/
typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
+
/**
* Configure a Crypto asymmetric session on a device.
*
@@ -338,6 +337,7 @@ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev,
*/
typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
+
/**
* Clear asymmetric session private data.
*
@@ -638,28 +638,6 @@ __rte_internal
void *
rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op);
-static inline void *
-get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id) {
- if (unlikely(sess->nb_drivers <= driver_id))
- return NULL;
-
- return sess->sess_data[driver_id].data;
-}
-
-static inline void
-set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id, void *private_data)
-{
- if (unlikely(sess->nb_drivers <= driver_id)) {
- CDEV_LOG_ERR("Set private data for driver %u not allowed",
- driver_id);
- return;
- }
-
- sess->sess_data[driver_id].data = private_data;
-}
-
/**
* @internal
* Cryptodev asymmetric crypto session.
diff --git a/lib/cryptodev/cryptodev_trace_points.c b/lib/cryptodev/cryptodev_trace_points.c
index 9f0ed904ea..727114aa45 100644
--- a/lib/cryptodev/cryptodev_trace_points.c
+++ b/lib/cryptodev/cryptodev_trace_points.c
@@ -39,12 +39,6 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_free,
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_session_free,
lib.cryptodev.asym.free)
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_init,
- lib.cryptodev.sym.init)
-
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_clear,
- lib.cryptodev.sym.clear)
-
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_enqueue_burst,
lib.cryptodev.enq.burst)
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 9e76a1c72d..6acd5f4d91 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -203,12 +203,9 @@ const char *rte_crypto_asym_ke_strings[] = {
[RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY] = "pub_ec_key_verify"
};
-/**
- * The private data structure stored in the sym session mempool private data.
- */
struct rte_cryptodev_sym_session_pool_private_data {
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint16_t sess_data_sz;
+ /**< driver session data size */
uint16_t user_data_sz;
/**< session user data will be placed after sess_data */
};
@@ -1332,6 +1329,24 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
return ret;
}
+static uint8_t
+rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp,
+ uint32_t sess_priv_size)
+{
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (!mp)
+ return 0;
+
+ pool_priv = rte_mempool_get_priv(mp);
+
+ if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
+ pool_priv->sess_data_sz < sess_priv_size)
+ return 0;
+
+ return 1;
+}
+
int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
@@ -1355,17 +1370,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
- (!qp_conf->mp_session && qp_conf->mp_session_private)) {
- CDEV_LOG_ERR("Invalid mempools");
- return -EINVAL;
- }
-
if (qp_conf->mp_session) {
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
- uint32_t obj_size = qp_conf->mp_session->elt_size;
- uint32_t obj_priv_size = qp_conf->mp_session_private->elt_size;
- struct rte_cryptodev_sym_session s = {0};
pool_priv = rte_mempool_get_priv(qp_conf->mp_session);
if (!pool_priv || qp_conf->mp_session->private_data_size <
@@ -1374,13 +1380,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- s.nb_drivers = pool_priv->nb_drivers;
- s.user_data_sz = pool_priv->user_data_sz;
-
- if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
- obj_size) || (s.nb_drivers <= dev->driver_id) ||
- rte_cryptodev_sym_get_private_session_size(dev_id) >
- obj_priv_size) {
+ if (!rte_cryptodev_sym_is_valid_session_pool(qp_conf->mp_session,
+ rte_cryptodev_sym_get_private_session_size(dev_id))) {
CDEV_LOG_ERR("Invalid mempool");
return -EINVAL;
}
@@ -1862,54 +1863,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
rte_spinlock_unlock(&rte_cryptodev_cb_lock);
}
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mp)
-{
- struct rte_cryptodev *dev;
- uint32_t sess_priv_sz = rte_cryptodev_sym_get_private_session_size(
- dev_id);
- uint8_t index;
- int ret;
-
- if (!rte_cryptodev_is_valid_dev(dev_id)) {
- CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
- return -EINVAL;
- }
-
- dev = rte_cryptodev_pmd_get_dev(dev_id);
-
- if (sess == NULL || xforms == NULL || dev == NULL || mp == NULL)
- return -EINVAL;
-
- if (mp->elt_size < sess_priv_sz)
- return -EINVAL;
-
- index = dev->driver_id;
- if (index >= sess->nb_drivers)
- return -EINVAL;
-
- if (*dev->dev_ops->sym_session_configure == NULL)
- return -ENOTSUP;
-
- if (sess->sess_data[index].refcnt == 0) {
- ret = dev->dev_ops->sym_session_configure(dev, xforms,
- sess, mp);
- if (ret < 0) {
- CDEV_LOG_ERR(
- "dev_id %d failed to configure session details",
- dev_id);
- return ret;
- }
- }
-
- rte_cryptodev_trace_sym_session_init(dev_id, sess, xforms, mp);
- sess->sess_data[index].refcnt++;
- return 0;
-}
-
struct rte_mempool *
rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
@@ -1919,16 +1872,12 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
uint32_t obj_sz;
- obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
- if (obj_sz > elt_size)
- CDEV_LOG_INFO("elt_size %u is expanded to %u", elt_size,
- obj_sz);
- else
- obj_sz = elt_size;
+ obj_sz = sizeof(struct rte_cryptodev_sym_session) + elt_size + user_data_size;
+ obj_sz = RTE_ALIGN_CEIL(obj_sz, RTE_CACHE_LINE_SIZE);
mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
- (uint32_t)(sizeof(*pool_priv)),
- NULL, NULL, NULL, NULL,
+ (uint32_t)(sizeof(*pool_priv)), NULL, NULL,
+ NULL, NULL,
socket_id, 0);
if (mp == NULL) {
CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d",
@@ -1944,7 +1893,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
return NULL;
}
- pool_priv->nb_drivers = nb_drivers;
+ pool_priv->sess_data_sz = elt_size;
pool_priv->user_data_sz = user_data_size;
rte_cryptodev_trace_sym_session_pool_create(name, nb_elts,
@@ -2002,64 +1951,71 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
return mp;
}
-static unsigned int
-rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
-{
- return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
- sess->user_data_sz;
-}
-
-static uint8_t
-rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp)
-{
- struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
-
- if (!mp)
- return 0;
-
- pool_priv = rte_mempool_get_priv(mp);
-
- if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
- pool_priv->nb_drivers != nb_drivers ||
- mp->elt_size <
- rte_cryptodev_sym_get_header_session_size()
- + pool_priv->user_data_sz)
- return 0;
-
- return 1;
-}
-
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mp)
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp)
{
+ struct rte_cryptodev *dev;
struct rte_cryptodev_sym_session *sess;
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+ uint32_t sess_priv_sz;
+ int ret;
- if (!rte_cryptodev_sym_is_valid_session_pool(mp)) {
+ if (!rte_cryptodev_is_valid_dev(dev_id)) {
+ CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
+ if (xforms == NULL) {
+ CDEV_LOG_ERR("Invalid xform\n");
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
+ sess_priv_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
+ if (!rte_cryptodev_sym_is_valid_session_pool(mp, sess_priv_sz)) {
CDEV_LOG_ERR("Invalid mempool");
+ rte_errno = EINVAL;
return NULL;
}
- pool_priv = rte_mempool_get_priv(mp);
+ dev = rte_cryptodev_pmd_get_dev(dev_id);
/* Allocate a session structure from the session pool */
if (rte_mempool_get(mp, (void **)&sess)) {
CDEV_LOG_ERR("couldn't get object from session mempool");
+ rte_errno = ENOMEM;
return NULL;
}
- sess->nb_drivers = pool_priv->nb_drivers;
+ pool_priv = rte_mempool_get_priv(mp);
+ sess->driver_id = dev->driver_id;
+ sess->sess_data_sz = pool_priv->sess_data_sz;
sess->user_data_sz = pool_priv->user_data_sz;
- sess->opaque_data = 0;
+ sess->driver_priv_data_iova = rte_mempool_virt2iova(sess) +
+ offsetof(struct rte_cryptodev_sym_session, driver_priv_data);
- /* Clear device session pointer.
- * Include the flag indicating presence of user data
- */
- memset(sess->sess_data, 0,
- rte_cryptodev_sym_session_data_size(sess));
+ if (dev->dev_ops->sym_session_configure == NULL) {
+ rte_errno = ENOTSUP;
+ goto error_exit;
+ }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz + pool_priv->user_data_sz);
- rte_cryptodev_trace_sym_session_create(mp, sess);
- return sess;
+ ret = dev->dev_ops->sym_session_configure(dev, xforms, sess);
+ if (ret < 0) {
+ rte_errno = -ret;
+ goto error_exit;
+ }
+ sess->driver_id = dev->driver_id;
+
+ rte_cryptodev_trace_sym_session_create(dev_id, sess, xforms, mp);
+
+ return (void *)sess;
+error_exit:
+ rte_mempool_put(mp, (void *)sess);
+ return NULL;
}
int
@@ -2139,11 +2095,15 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
}
int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_cryptodev *dev;
- uint8_t driver_id;
+ struct rte_mempool *sess_mp;
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (sess == NULL)
+ return -EINVAL;
if (!rte_cryptodev_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
@@ -2155,41 +2115,28 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
if (dev == NULL || sess == NULL)
return -EINVAL;
- driver_id = dev->driver_id;
- if (sess->sess_data[driver_id].refcnt == 0)
- return 0;
- if (--sess->sess_data[driver_id].refcnt != 0)
- return -EBUSY;
+ sess_mp = rte_mempool_from_obj(sess);
+ if (!sess_mp)
+ return -EINVAL;
+ pool_priv = rte_mempool_get_priv(sess_mp);
+
+ if (sess->driver_id != dev->driver_id) {
+ CDEV_LOG_ERR("Session created by driver %u but freed by %u",
+ sess->driver_id, dev->driver_id);
+ return -EINVAL;
+ }
if (*dev->dev_ops->sym_session_clear == NULL)
return -ENOTSUP;
dev->dev_ops->sym_session_clear(dev, sess);
- rte_cryptodev_trace_sym_session_clear(dev_id, sess);
- return 0;
-}
-
-int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
-{
- uint8_t i;
- struct rte_mempool *sess_mp;
-
- if (sess == NULL)
- return -EINVAL;
-
- /* Check that all device private data has been freed */
- for (i = 0; i < sess->nb_drivers; i++) {
- if (sess->sess_data[i].refcnt != 0)
- return -EBUSY;
- }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz + pool_priv->user_data_sz);
/* Return session to mempool */
- sess_mp = rte_mempool_from_obj(sess);
rte_mempool_put(sess_mp, sess);
- rte_cryptodev_trace_sym_session_free(sess);
+ rte_cryptodev_trace_sym_session_free(dev_id, sess);
return 0;
}
@@ -2224,33 +2171,6 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
return 0;
}
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void)
-{
- /*
- * Header contains pointers to the private data of all registered
- * drivers and all necessary information to ensure safely clear
- * or free al session.
- */
- struct rte_cryptodev_sym_session s = {0};
-
- s.nb_drivers = nb_drivers;
-
- return (unsigned int)(sizeof(s) +
- rte_cryptodev_sym_session_data_size(&s));
-}
-
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess)
-{
- if (!sess)
- return 0;
- else
- return (unsigned int)(sizeof(*sess) +
- rte_cryptodev_sym_session_data_size(sess));
-}
-
unsigned int
rte_cryptodev_asym_get_header_session_size(void)
{
@@ -2303,9 +2223,8 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
int
rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess,
- void *data,
- uint16_t size)
+ struct rte_cryptodev_sym_session *sess, void *data,
+ uint16_t size)
{
if (sess == NULL)
return -EINVAL;
@@ -2313,7 +2232,7 @@ rte_cryptodev_sym_session_set_user_data(
if (sess->user_data_sz < size)
return -ENOMEM;
- rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
+ rte_memcpy(sess->driver_priv_data + sess->sess_data_sz, data, size);
rte_cryptodev_trace_sym_session_set_user_data(sess, data, size);
@@ -2321,15 +2240,14 @@ rte_cryptodev_sym_session_set_user_data(
}
void *
-rte_cryptodev_sym_session_get_user_data(
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_get_user_data(struct rte_cryptodev_sym_session *sess)
{
void *data = NULL;
if (sess == NULL || sess->user_data_sz == 0)
return NULL;
- data = (void *)(sess->sess_data + sess->nb_drivers);
+ data = (void *)(sess->driver_priv_data + sess->sess_data_sz);
rte_cryptodev_trace_sym_session_get_user_data(sess, data);
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56f459c6a0..0c65958f25 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -544,8 +544,6 @@ struct rte_cryptodev_qp_conf {
uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
struct rte_mempool *mp_session;
/**< The mempool for creating session in sessionless mode */
- struct rte_mempool *mp_session_private;
- /**< The mempool for creating sess private data in sessionless mode */
};
/**
@@ -909,17 +907,21 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id);
* has a fixed algo, key, op-type, digest_len etc.
*/
struct rte_cryptodev_sym_session {
+ RTE_MARKER cacheline0;
+ uint8_t driver_id;
uint64_t opaque_data;
/**< Can be used for external metadata */
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint32_t sess_data_sz;
+ /**< Pointer to the user data stored after sess data */
uint16_t user_data_sz;
- /**< session user data will be placed after sess_data */
- __extension__ struct {
- void *data;
- uint16_t refcnt;
- } sess_data[];
- /**< Driver specific session material, variable size */
+ /**< session user data will be placed after sess data */
+ rte_iova_t driver_priv_data_iova;
+ /**< session driver data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ /**< second cache line - start of the driver session data */
+ uint8_t driver_priv_data[0];
+ /**< Driver specific session data, variable size */
};
/**
@@ -954,6 +956,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
int socket_id);
+
/**
* Create an asymmetric session mempool.
*
@@ -980,17 +983,22 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t cache_size, uint16_t user_data_size, int socket_id);
/**
- * Create symmetric crypto session header (generic with no private data)
+ * Create symmetric crypto session and fill out private data for the device id,
+ * based on its device type.
+ *
+ * @param dev_id ID of device that we want the session to be used on
+ * @param xforms Symmetric crypto transform operations to apply on flow
+ * processed with this session
+ * @param mempool Mempool where the private data is allocated.
*
- * @param mempool Symmetric session mempool to allocate session
- * objects from
* @return
- * - On success return pointer to sym-session
- * - On failure returns NULL
+ * - On success return pointer to sym-session.
+ * - On failure returns NULL.
*/
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
-
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp);
/**
* Create and initialise an asymmetric crypto session structure.
* Calls the PMD to configure the private session data.
@@ -1015,19 +1023,20 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
void **session);
/**
- * Frees symmetric crypto session header, after checking that all
- * the device private data has been freed, returning it
- * to its original mempool.
+ * Frees session for the device id and returning it to its mempool.
+ * It is the application's responsibility to ensure that the session
+ * is not still in-flight operations using it.
*
+ * @param dev_id ID of device that uses the session.
* @param sess Session header to be freed.
*
* @return
* - 0 if successful.
- * - -EINVAL if session is NULL.
- * - -EBUSY if not all device private data has been freed.
+ * - -EINVAL if session is NULL or the mismatched device ids.
*/
int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess);
/**
* Clears and frees asymmetric crypto session header and private data,
@@ -1044,72 +1053,6 @@ __rte_experimental
int
rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess);
-/**
- * Fill out private data for the device id, based on its device type.
- *
- * @param dev_id ID of device that we want the session to be used on
- * @param sess Session where the private data will be attached to
- * @param xforms Symmetric crypto transform operations to apply on flow
- * processed with this session
- * @param mempool Mempool where the private data is allocated.
- *
- * @return
- * - On success, zero.
- * - -EINVAL if input parameters are invalid.
- * - -ENOTSUP if crypto device does not support the crypto transform or
- * does not support symmetric operations.
- * - -ENOMEM if the private session could not be allocated.
- */
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mempool);
-
-/**
- * Frees private data for the device id, based on its device type,
- * returning it to its mempool. It is the application's responsibility
- * to ensure that private session data is not cleared while there are
- * still in-flight operations using it.
- *
- * @param dev_id ID of device that uses the session.
- * @param sess Session containing the reference to the private data
- *
- * @return
- * - 0 if successful.
- * - -EINVAL if device is invalid or session is NULL.
- * - -ENOTSUP if crypto device does not support symmetric operations.
- */
-int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess);
-
-/**
- * Get the size of the header session, for all registered drivers excluding
- * the user data size.
- *
- * @return
- * Size of the symmetric header session.
- */
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void);
-
-/**
- * Get the size of the header session from created session.
- *
- * @param sess
- * The sym cryptodev session pointer
- *
- * @return
- * - If sess is not NULL, return the size of the header session including
- * the private data size defined within sess.
- * - If sess is NULL, return 0.
- */
-__rte_experimental
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess);
-
/**
* Get the size of the asymmetric session header.
*
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index 3d9b00145e..6ade0b72c4 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -56,7 +56,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u16(queue_pair_id);
rte_trace_point_emit_u32(conf->nb_descriptors);
rte_trace_point_emit_ptr(conf->mp_session);
- rte_trace_point_emit_ptr(conf->mp_session_private);
)
RTE_TRACE_POINT(
@@ -74,13 +73,16 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_create,
- RTE_TRACE_POINT_ARGS(void *mempool,
- struct rte_cryptodev_sym_session *sess),
- rte_trace_point_emit_ptr(mempool);
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess, void *xforms,
+ void *mempool),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
+ rte_trace_point_emit_u8(sess->driver_id);
rte_trace_point_emit_u16(sess->user_data_sz);
+ rte_trace_point_emit_ptr(xforms);
+ rte_trace_point_emit_ptr(mempool);
)
RTE_TRACE_POINT(
@@ -106,7 +108,8 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_free,
- RTE_TRACE_POINT_ARGS(struct rte_cryptodev_sym_session *sess),
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id, struct rte_cryptodev_sym_session *sess),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
)
@@ -117,27 +120,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_ptr(sess);
)
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_init,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, void *xforms,
- void *mempool),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
- rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
- rte_trace_point_emit_u16(sess->user_data_sz);
- rte_trace_point_emit_ptr(xforms);
- rte_trace_point_emit_ptr(mempool);
-)
-
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_clear,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id, void *sess),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
-)
-
RTE_TRACE_POINT(
rte_cryptodev_trace_callback_register,
RTE_TRACE_POINT_ARGS(uint8_t dev_id,
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 6d9b3e01a6..d9ccb10197 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -38,12 +38,9 @@ DPDK_23 {
rte_cryptodev_sym_capability_check_auth;
rte_cryptodev_sym_capability_check_cipher;
rte_cryptodev_sym_capability_get;
- rte_cryptodev_sym_get_header_session_size;
rte_cryptodev_sym_get_private_session_size;
- rte_cryptodev_sym_session_clear;
rte_cryptodev_sym_session_create;
rte_cryptodev_sym_session_free;
- rte_cryptodev_sym_session_init;
local: *;
};
@@ -60,7 +57,6 @@ EXPERIMENTAL {
rte_cryptodev_asym_xform_capability_check_modlen;
rte_cryptodev_asym_xform_capability_check_optype;
rte_cryptodev_sym_cpu_crypto_process;
- rte_cryptodev_sym_get_existing_header_session_size;
rte_cryptodev_sym_session_get_user_data;
rte_cryptodev_sym_session_pool_create;
rte_cryptodev_sym_session_set_user_data;
@@ -78,8 +74,6 @@ EXPERIMENTAL {
__rte_cryptodev_trace_asym_session_create;
__rte_cryptodev_trace_sym_session_free;
__rte_cryptodev_trace_asym_session_free;
- __rte_cryptodev_trace_sym_session_init;
- __rte_cryptodev_trace_sym_session_clear;
__rte_cryptodev_trace_dequeue_burst;
__rte_cryptodev_trace_enqueue_burst;
diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c
index b1310be565..cb792bbe0d 100644
--- a/lib/pipeline/rte_table_action.c
+++ b/lib/pipeline/rte_table_action.c
@@ -1898,17 +1898,11 @@ sym_crypto_apply(struct sym_crypto_data *data,
}
}
- session = rte_cryptodev_sym_session_create(cfg->mp_create);
+ session = rte_cryptodev_sym_session_create(cfg->cryptodev_id,
+ p->xform, cfg->mp_create);
if (!session)
return -ENOMEM;
- ret = rte_cryptodev_sym_session_init(cfg->cryptodev_id, session,
- p->xform, cfg->mp_init);
- if (ret < 0) {
- rte_cryptodev_sym_session_free(session);
- return ret;
- }
-
data->data_offset = (uint16_t)p->data_offset;
data->session = session;
diff --git a/lib/vhost/rte_vhost_crypto.h b/lib/vhost/rte_vhost_crypto.h
index b49e389579..2b01ecda08 100644
--- a/lib/vhost/rte_vhost_crypto.h
+++ b/lib/vhost/rte_vhost_crypto.h
@@ -54,8 +54,6 @@ rte_vhost_crypto_driver_start(const char *path);
* multiple Vhost-crypto devices.
* @param sess_pool
* The pointer to the created cryptodev session pool.
- * @param sess_priv_pool
- * The pointer to the created cryptodev session private data mempool.
* @param socket_id
* NUMA Socket ID to allocate resources on. *
* @return
@@ -65,7 +63,6 @@ rte_vhost_crypto_driver_start(const char *path);
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id);
/**
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 54946f46d9..7321da21b7 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -197,7 +197,6 @@ struct vhost_crypto {
struct rte_hash *session_map;
struct rte_mempool *mbuf_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *wb_pool;
/** DPDK cryptodev ID */
@@ -376,31 +375,21 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
return;
}
- session = rte_cryptodev_sym_session_create(vcrypto->sess_pool);
+ session = rte_cryptodev_sym_session_create(vcrypto->cid, &xform1,
+ vcrypto->sess_pool);
if (!session) {
VC_LOG_ERR("Failed to create session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
- if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
- vcrypto->sess_priv_pool) < 0) {
- VC_LOG_ERR("Failed to initialize session");
- sess_param->session_id = -VIRTIO_CRYPTO_ERR;
- return;
- }
-
/* insert hash to map */
if (rte_hash_add_key_data(vcrypto->session_map,
&vcrypto->last_session_id, session) < 0) {
VC_LOG_ERR("Failed to insert session to hash table");
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0)
- VC_LOG_ERR("Failed to clear session");
- else {
- if (rte_cryptodev_sym_session_free(session) < 0)
- VC_LOG_ERR("Failed to free session");
- }
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0)
+ VC_LOG_ERR("Failed to free session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
@@ -427,12 +416,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
return -VIRTIO_CRYPTO_INVSESS;
}
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
- VC_LOG_DBG("Failed to clear session");
- return -VIRTIO_CRYPTO_ERR;
- }
-
- if (rte_cryptodev_sym_session_free(session) < 0) {
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0) {
VC_LOG_DBG("Failed to free session");
return -VIRTIO_CRYPTO_ERR;
}
@@ -1393,7 +1377,6 @@ rte_vhost_crypto_driver_start(const char *path)
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id)
{
struct virtio_net *dev = get_device(vid);
@@ -1415,7 +1398,6 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
}
vcrypto->sess_pool = sess_pool;
- vcrypto->sess_priv_pool = sess_priv_pool;
vcrypto->cid = cryptodev_id;
vcrypto->cache_session_id = UINT64_MAX;
vcrypto->last_session_id = 1;
--
2.25.1
^ permalink raw reply [relevance 1%]
* Re: [PATCH v7] eal: add bus cleanup to eal cleanup
@ 2022-10-03 12:35 0% ` David Marchand
2022-10-03 14:39 0% ` Kevin Laatz
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-10-03 12:35 UTC (permalink / raw)
To: Bruce Richardson, Kevin Laatz
Cc: Thomas Monjalon, dev, Morten Brørup, Li Zhang, Matan Azrad,
Stephen Hemminger, lihuisong
Hello Bruce, Kevin,
On Mon, Jun 13, 2022 at 5:59 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> > > For info, Li has sent a patch for the bus cleanup
> > > which is not updating the bus code:
> > > https://patches.dpdk.org/project/dpdk/patch/20220606114650.209612-3-lizh@nvidia.com/
> > > It may be a temporary solution before the deprecation.
> >
> > On the principle, that's probably the best, there is no question about
> > unclear frontier of the ABI.
> > (In practice though, the mentionned patch is triggering segfaults in
> > two CI, for pdump).
> >
> > Hiding rte_bus object should be straightforward in v22.11, I had some
> > patches, but never finished the work.
> >
> > It would be great too, to look into rte_driver and rte_device which
> > are exposed important types, but that's another story.
> >
> Agreed, we need to look into all this for 22.11 release, let's defer this
> patch until we get proper deprecation process. Temporary patch looks fine
> as a fix too.
The patch needs some rebasing for making it into 22.11.
Can you work on it, this week?
Thanks!
--
David Marchand
^ permalink raw reply [relevance 0%]
* Re: [PATCH v10 6/7] bbdev: add queue related warning and status information
@ 2022-10-03 8:28 3% ` Thomas Monjalon
2022-10-03 16:39 3% ` Chautru, Nicolas
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2022-10-03 8:28 UTC (permalink / raw)
To: Nicolas Chautru
Cc: dev, gakhil, maxime.coquelin, trix, mdr, bruce.richardson,
david.marchand, stephen, mingshan.zhang, hemant.agrawal
Looking at this patch because I have been alerted about the ABI compat handling.
I see some details that should have been caught in earlier reviews.
30/09/2022 20:46, Nicolas Chautru:
> +/*
> + * Maximum size to be used to manage the enum rte_bbdev_enqueue_status including padding for future
This line is long.
It is always better to split lines logically,
for instance here, before "including".
> + * enum insertion
It could be made clear that the real enum size is smaller or equal.
> + */
> +#define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6
[...]
> +enum rte_bbdev_enqueue_status {
> + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */
> + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room in queue */
> + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room in ring */
> + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was rejected as invalid */
> +};
A comment is missing at the end of the enum to remind updating the MAX.
But the big question is why do we need this "MAX" value?
The guideline is to avoid using such MAX value for long term compatibility.
[...]
> +/**
> + * Converts queue status from enum to string
Should be imperative form: "Convert".
A dot is missing at the end of the sentence.
> + *
> + * @param status
> + * Queue status as enum
> + *
> + * @returns
> + * Queue status as string or NULL if op_type is invalid
It is not aligned with above parameter.
Choose an indentation format and keep it consistent.
[...]
> # added in 22.11
> rte_bbdev_device_status_str;
> + rte_bbdev_enqueue_status_str;
> rte_bbdev_enqueue_fft_ops;
> rte_bbdev_dequeue_fft_ops;
It is not alphabetical order.
^ permalink raw reply [relevance 3%]
* RE: [PATCH v3] ethdev: queue rate parameter changed from 16b to 32b
2022-09-30 9:57 3% ` Satha Koteswara Rao Kottidi
@ 2022-10-03 5:42 2% ` Satha Koteswara Rao Kottidi
0 siblings, 0 replies; 200+ results
From: Satha Koteswara Rao Kottidi @ 2022-10-03 5:42 UTC (permalink / raw)
To: Aman Singh, Yuying Zhang, Ray Kinsella, Ajit Khaparde,
Somnath Kotur, Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
Sunil Kumar Kori, Qiming Yang, Wenjun Wu, Jiawen Wu, Jian Wang,
Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: dev, ferruh.yigit, bruce.richardson, konstantin.v.ananyev,
Jerin Jacob Kollanukkaran
Ping
-----Original Message-----
From: Satha Koteswara Rao Kottidi <skoteshwar@marvell.com>
Sent: Friday, September 30, 2022 3:27 PM
To: Satha Koteswara Rao Kottidi <skoteshwar@marvell.com>; Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang <yuying.zhang@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Ajit Khaparde <ajit.khaparde@broadcom.com>; Somnath Kotur <somnath.kotur@broadcom.com>; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Qiming Yang <qiming.yang@intel.com>; Wenjun Wu <wenjun1.wu@intel.com>; Jiawen Wu <jiawenwu@trustnetic.com>; Jian Wang <jianwang@trustnetic.com>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@xilinx.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev@dpdk.org; ferruh.yigit@amd.com; bruce.richardson@intel.com; konstantin.v.ananyev@yandex.ru; Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Subject: RE: [PATCH v3] ethdev: queue rate parameter changed from 16b to 32b
Hi All,
Could you please review and provide suggestions if any.
Thanks,
Satha.
-----Original Message-----
From: skoteshwar@marvell.com <skoteshwar@marvell.com>
Sent: Wednesday, September 28, 2022 11:22 AM
To: Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang <yuying.zhang@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Ajit Khaparde <ajit.khaparde@broadcom.com>; Somnath Kotur <somnath.kotur@broadcom.com>; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha Koteswara Rao Kottidi <skoteshwar@marvell.com>; Qiming Yang <qiming.yang@intel.com>; Wenjun Wu <wenjun1.wu@intel.com>; Jiawen Wu <jiawenwu@trustnetic.com>; Jian Wang <jianwang@trustnetic.com>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@xilinx.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev@dpdk.org; ferruh.yigit@amd.com; bruce.richardson@intel.com; konstantin.v.ananyev@yandex.ru; Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Subject: [PATCH v3] ethdev: queue rate parameter changed from 16b to 32b
From: Satha Rao <skoteshwar@marvell.com>
The rate parameter modified to uint32_t, so that it can work for more than 64 Gbps.
Signed-off-by: Satha Rao <skoteshwar@marvell.com>
---
v2: Fixed checkpatch warnings
v3: updated release notes, cleanup deprecation, addressed review comments
app/test-pmd/cmdline.c | 8 ++++----
app/test-pmd/config.c | 4 ++--
app/test-pmd/testpmd.h | 4 ++--
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_22_11.rst | 3 +++
drivers/net/bnxt/rte_pmd_bnxt.c | 4 ++--
drivers/net/bnxt/rte_pmd_bnxt.h | 2 +-
drivers/net/cnxk/cnxk_ethdev.h | 2 +-
drivers/net/cnxk/cnxk_tm.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/ixgbe/ixgbe_ethdev.h | 4 ++--
drivers/net/ixgbe/rte_pmd_ixgbe.c | 2 +-
drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +-
drivers/net/txgbe/txgbe_ethdev.c | 2 +-
drivers/net/txgbe/txgbe_ethdev.h | 2 +-
lib/ethdev/ethdev_driver.h | 2 +-
lib/ethdev/rte_ethdev.c | 2 +-
lib/ethdev/rte_ethdev.h | 2 +-
18 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 51321de..adfdc1d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -8106,7 +8106,7 @@ struct cmd_queue_rate_limit_result {
cmdline_fixed_string_t queue;
uint8_t queue_num;
cmdline_fixed_string_t rate;
- uint16_t rate_num;
+ uint32_t rate_num;
};
static void cmd_queue_rate_limit_parsed(void *parsed_result, @@ -8147,7 +8147,7 @@ static void cmd_queue_rate_limit_parsed(void *parsed_result,
rate, "rate");
static cmdline_parse_token_num_t cmd_queue_rate_limit_ratenum =
TOKEN_NUM_INITIALIZER(struct cmd_queue_rate_limit_result,
- rate_num, RTE_UINT16);
+ rate_num, RTE_UINT32);
static cmdline_parse_inst_t cmd_queue_rate_limit = {
.f = cmd_queue_rate_limit_parsed,
@@ -8174,7 +8174,7 @@ struct cmd_vf_rate_limit_result {
cmdline_fixed_string_t vf;
uint8_t vf_num;
cmdline_fixed_string_t rate;
- uint16_t rate_num;
+ uint32_t rate_num;
cmdline_fixed_string_t q_msk;
uint64_t q_msk_val;
};
@@ -8218,7 +8218,7 @@ static void cmd_vf_rate_limit_parsed(void *parsed_result,
rate, "rate");
static cmdline_parse_token_num_t cmd_vf_rate_limit_ratenum =
TOKEN_NUM_INITIALIZER(struct cmd_vf_rate_limit_result,
- rate_num, RTE_UINT16);
+ rate_num, RTE_UINT32);
static cmdline_parse_token_string_t cmd_vf_rate_limit_q_msk =
TOKEN_STRING_INITIALIZER(struct cmd_vf_rate_limit_result,
q_msk, "queue_mask");
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index c90cdfe..6dd543d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -5914,7 +5914,7 @@ struct igb_ring_desc_16_bytes { }
int
-set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
+set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint32_t
+rate)
{
int diag;
struct rte_eth_link link;
@@ -5942,7 +5942,7 @@ struct igb_ring_desc_16_bytes { }
int
-set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
+set_vf_rate_limit(portid_t port_id, uint16_t vf, uint32_t rate,
+uint64_t q_msk)
{
int diag = -ENOTSUP;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index ddf5e21..0af3aa1 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1097,8 +1097,8 @@ void port_rss_reta_info(portid_t port_id,
uint16_t nb_rx_desc, unsigned int socket_id,
struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp);
-int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate); -int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
+int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint32_t
+rate); int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint32_t
+rate,
uint64_t q_msk);
int set_rxq_avail_thresh(portid_t port_id, uint16_t queue_id, diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e0fa5ef..9292080 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -87,11 +87,6 @@ Deprecation Notices
us extending existing enum/define.
One solution can be using a fixed size array instead of ``.*MAX.*`` value.
-* ethdev: The function ``rte_eth_set_queue_rate_limit`` takes ``rate`` in Mbps.
- The queue rate is limited to 64 Gbps because declared as ``uint16_t``.
- The ``rate`` parameter will be modified to ``uint32_t`` in DPDK 22.11
- so that it can work for more than 64 Gbps.
-
* ethdev: Since no single PMD supports ``RTE_ETH_RX_OFFLOAD_HEADER_SPLIT``
offload and the ``split_hdr_size`` field in structure ``rte_eth_rxmode``
to enable per-port header split, they will be removed in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2e076ba..3c7e471 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -129,6 +129,9 @@ API Changes
configuration (``dev_conf.fdir_conf``). Moved corresponding structures
to internal API since some drivers still use it internally.
+* ethdev: The type of parameter ``rate`` of the
+``rte_eth_set_queue_rate_limit``
+ changed from ``uint16_t`` to ``uint32_t`` to support more than 64 Gbps.
+
ABI Changes
-----------
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index 77ecbef..4dc38a2 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -172,12 +172,12 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, }
int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *eth_dev;
struct rte_eth_dev_info dev_info;
struct bnxt *bp;
- uint16_t tot_rate = 0;
+ uint32_t tot_rate = 0;
uint64_t idx;
int rc;
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h index 86b8d71..174c18a 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -184,7 +184,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
* - (-EINVAL) if *vf* or *mac_addr* is invalid.
*/
int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
/**
* Get VF's statistics
diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index c09e9bf..5204c46 100644
--- a/drivers/net/cnxk/cnxk_ethdev.h
+++ b/drivers/net/cnxk/cnxk_ethdev.h
@@ -558,7 +558,7 @@ int cnxk_nix_timesync_write_time(struct rte_eth_dev *eth_dev, uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev); int cnxk_nix_tm_ops_get(struct rte_eth_dev *eth_dev, void *ops); int cnxk_nix_tm_set_queue_rate_limit(struct rte_eth_dev *eth_dev,
- uint16_t queue_idx, uint16_t tx_rate);
+ uint16_t queue_idx, uint32_t tx_rate);
int cnxk_nix_tm_mark_vlan_dei(struct rte_eth_dev *eth_dev, int mark_green,
int mark_yellow, int mark_red,
struct rte_tm_error *error);
diff --git a/drivers/net/cnxk/cnxk_tm.c b/drivers/net/cnxk/cnxk_tm.c index d45e70a..9d8cd3f 100644
--- a/drivers/net/cnxk/cnxk_tm.c
+++ b/drivers/net/cnxk/cnxk_tm.c
@@ -751,7 +751,7 @@ struct rte_tm_ops cnxk_tm_ops = {
int
cnxk_nix_tm_set_queue_rate_limit(struct rte_eth_dev *eth_dev,
- uint16_t queue_idx, uint16_t tx_rate_mbps)
+ uint16_t queue_idx, uint32_t tx_rate_mbps)
{
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
uint64_t tx_rate = tx_rate_mbps * (uint64_t)1E6; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 1dfad0e..9ff8ee0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2475,7 +2475,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev)
int
ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct ixgbe_hw *hw;
struct ixgbe_vf_info *vfinfo;
@@ -6090,7 +6090,7 @@ static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on)
int
ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
- uint16_t queue_idx, uint16_t tx_rate)
+ uint16_t queue_idx, uint32_t tx_rate)
{
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t rf_dec, rf_int;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 0773a7e..b4db3f4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -753,13 +753,13 @@ void ixgbe_fdir_stats_get(struct rte_eth_dev *dev,
int ixgbe_vt_check(struct ixgbe_hw *hw); int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
bool is_ixgbe_supported(struct rte_eth_dev *dev); int ixgbe_tm_ops_get(struct rte_eth_dev *dev, void *ops); void ixgbe_tm_conf_init(struct rte_eth_dev *dev); void ixgbe_tm_conf_uninit(struct rte_eth_dev *dev); int ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
int ixgbe_rss_conf_init(struct ixgbe_rte_flow_rss_conf *out,
const struct rte_flow_action_rss *in); int ixgbe_action_rss_same(const struct rte_flow_action_rss *comp, diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f85..4ff7f37 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -498,7 +498,7 @@
int
rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *dev;
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index 426fe58..7ca1126 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -380,7 +380,7 @@ int rte_pmd_ixgbe_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
* - (-EINVAL) if bad parameter.
*/
int rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
/**
* Set all the TCs' bandwidth weight.
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 4422472..86ef979 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -3764,7 +3764,7 @@ static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
int
txgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
- uint16_t queue_idx, uint16_t tx_rate)
+ uint16_t queue_idx, uint32_t tx_rate)
{
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
uint32_t bcnrc_val;
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index e425ab4..5171a6c 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -586,7 +586,7 @@ int txgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf, void txgbe_tm_conf_init(struct rte_eth_dev *dev); void txgbe_tm_conf_uninit(struct rte_eth_dev *dev); int txgbe_set_queue_rate_limit(struct rte_eth_dev *dev, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
int txgbe_rss_conf_init(struct txgbe_rte_flow_rss_conf *out,
const struct rte_flow_action_rss *in); int txgbe_action_rss_same(const struct rte_flow_action_rss *comp, diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index a0e0b2a..a89450c 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -598,7 +598,7 @@ typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
/** @internal Set queue Tx rate. */
typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
/** @internal Add tunneling UDP port. */ typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 1979dc0..4b11dae 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -4388,7 +4388,7 @@ enum {
}
int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
- uint16_t tx_rate)
+ uint32_t tx_rate)
{
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index b62ac5b..7149dd7 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -4165,7 +4165,7 @@ int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr,
* - (-EINVAL) if bad parameter.
*/
int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
/**
* Configuration of Receive Side Scaling hash computation of Ethernet device.
--
1.8.3.1
^ permalink raw reply [relevance 2%]
* [PATCH v5 1/6] cryptodev: rework session framework
@ 2022-10-02 18:55 1% ` Akhil Goyal
0 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-10-02 18:55 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, lironh, royzhang1980,
sunilprakashrao.uttarwar, kai.ji, rnagadheeraj, jianjay.zhou,
Akhil Goyal, Ruifeng Wang, David Coyle, Kevin O'Sullivan
As per current design, rte_cryptodev_sym_session_create() and
rte_cryptodev_sym_session_init() use separate mempool objects
for a single session.
And structure rte_cryptodev_sym_session is not directly used
by the application, it may cause ABI breakage if the structure
is modified in future.
To address these two issues, the rte_cryptodev_sym_session_create
will take one mempool object that the session and session private
data are virtually/physically contiguous, and initializes both
fields. The API rte_cryptodev_sym_session_init is removed.
rte_cryptodev_sym_session_create will now return an opaque session
pointer which will be used by the app and other APIs.
In data path, opaque session pointer is attached to rte_crypto_op
and the PMD can call an internal library API to get the session
private data pointer based on the driver id.
Note: currently single session may be used by different device
drivers, given it is initialized by them. After the change the
session created by one device driver cannot be used or
reinitialized by another driver.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Ruifeng Wang <Ruifeng.Wang@arm.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test-crypto-perf/cperf_ops.c | 21 +-
app/test-crypto-perf/cperf_test_latency.c | 6 +-
.../cperf_test_pmd_cyclecount.c | 5 +-
app/test-crypto-perf/cperf_test_throughput.c | 6 +-
app/test-crypto-perf/cperf_test_verify.c | 6 +-
app/test-crypto-perf/main.c | 29 +-
app/test-eventdev/test_perf_common.c | 35 +-
app/test-eventdev/test_perf_common.h | 1 -
app/test/test_cryptodev.c | 303 +++++-------------
app/test/test_cryptodev_blockcipher.c | 16 +-
app/test/test_event_crypto_adapter.c | 35 +-
app/test/test_ipsec.c | 42 +--
drivers/crypto/armv8/armv8_pmd_private.h | 2 -
drivers/crypto/armv8/rte_armv8_pmd.c | 21 +-
drivers/crypto/armv8/rte_armv8_pmd_ops.c | 35 +-
drivers/crypto/bcmfs/bcmfs_sym_session.c | 38 +--
drivers/crypto/bcmfs/bcmfs_sym_session.h | 3 +-
drivers/crypto/caam_jr/caam_jr.c | 28 +-
drivers/crypto/ccp/ccp_crypto.c | 58 +---
drivers/crypto/ccp/ccp_pmd_ops.c | 32 +-
drivers/crypto/ccp/ccp_pmd_private.h | 2 -
drivers/crypto/ccp/rte_ccp_pmd.c | 29 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 36 +--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 31 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 55 +---
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 14 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 31 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 3 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 37 +--
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 4 +-
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 34 +-
drivers/crypto/ipsec_mb/ipsec_mb_private.h | 41 ++-
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 48 +--
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 36 +--
drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 4 -
drivers/crypto/ipsec_mb/pmd_kasumi.c | 10 +-
drivers/crypto/ipsec_mb/pmd_snow3g.c | 9 +-
drivers/crypto/ipsec_mb/pmd_zuc.c | 4 -
drivers/crypto/mlx5/mlx5_crypto.c | 26 +-
drivers/crypto/mvsam/rte_mrvl_pmd.c | 8 +-
drivers/crypto/mvsam/rte_mrvl_pmd_ops.c | 21 +-
drivers/crypto/nitrox/nitrox_sym.c | 39 +--
drivers/crypto/null/null_crypto_pmd.c | 19 +-
drivers/crypto/null/null_crypto_pmd_ops.c | 33 +-
drivers/crypto/null/null_crypto_pmd_private.h | 2 -
.../crypto/octeontx/otx_cryptodev_hw_access.h | 1 -
drivers/crypto/octeontx/otx_cryptodev_ops.c | 67 +---
drivers/crypto/openssl/openssl_pmd_private.h | 2 -
drivers/crypto/openssl/rte_openssl_pmd.c | 24 +-
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 29 +-
drivers/crypto/qat/qat_sym.c | 10 +-
drivers/crypto/qat/qat_sym.h | 4 +-
drivers/crypto/qat/qat_sym_session.c | 40 +--
drivers/crypto/qat/qat_sym_session.h | 6 +-
drivers/crypto/scheduler/scheduler_pmd_ops.c | 38 +--
drivers/crypto/virtio/virtio_cryptodev.c | 40 +--
drivers/crypto/virtio/virtio_rxtx.c | 3 +-
examples/fips_validation/fips_dev_self_test.c | 30 +-
examples/fips_validation/main.c | 35 +-
examples/ipsec-secgw/ipsec-secgw.c | 10 +-
examples/ipsec-secgw/ipsec.c | 7 +-
examples/l2fwd-crypto/main.c | 54 +---
examples/vhost_crypto/main.c | 16 +-
lib/cryptodev/cryptodev_pmd.h | 28 +-
lib/cryptodev/cryptodev_trace_points.c | 6 -
lib/cryptodev/rte_cryptodev.c | 278 ++++++----------
lib/cryptodev/rte_cryptodev.h | 123 ++-----
lib/cryptodev/rte_cryptodev_trace.h | 36 +--
lib/cryptodev/version.map | 6 -
lib/pipeline/rte_table_action.c | 10 +-
lib/vhost/rte_vhost_crypto.h | 3 -
lib/vhost/vhost_crypto.c | 28 +-
72 files changed, 556 insertions(+), 1676 deletions(-)
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index d746d51082..c6f5735bb0 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -912,7 +912,6 @@ cperf_create_session(struct rte_mempool *sess_mp,
&sess_conf, sess_mp, priv_mp);
}
#endif
- sess = rte_cryptodev_sym_session_create(sess_mp);
/*
* cipher only
*/
@@ -937,8 +936,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
cipher_xform.cipher.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &cipher_xform,
+ sess_mp);
/*
* auth only
*/
@@ -965,8 +964,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
auth_xform.auth.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &auth_xform,
+ sess_mp);
/*
* cipher and auth
*/
@@ -1024,13 +1023,13 @@ cperf_create_session(struct rte_mempool *sess_mp,
if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
cipher_xform.next = &auth_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &cipher_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &cipher_xform, sess_mp);
} else { /* auth then cipher */
auth_xform.next = &cipher_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &auth_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &auth_xform, sess_mp);
}
} else { /* options->op_type == CPERF_AEAD */
aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -1050,8 +1049,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
options->aead_aad_sz;
/* Create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &aead_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &aead_xform,
+ sess_mp);
}
return sess;
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index 6f972cea49..afd8cb209b 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -44,10 +44,8 @@ static void
cperf_latency_test_free(struct cperf_latency_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 3f2da13d3a..edd2730b73 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -74,10 +74,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
(struct rte_security_session *)ctx->sess);
} else
#endif
- {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index fba66bbde9..fa13915dc3 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -52,10 +52,8 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
(struct rte_security_session *)ctx->sess);
}
#endif
- else {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ else
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index b691595675..c1465db243 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -39,10 +39,8 @@ static void
cperf_verify_test_free(struct cperf_verify_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 27acd619bc..3469b836e1 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -97,35 +97,14 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
char mp_name[RTE_MEMPOOL_NAMESIZE];
struct rte_mempool *sess_mp;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- sess_mp = rte_mempool_create(mp_name,
- nb_sessions,
- session_priv_size,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (sess_mp == NULL) {
- printf("Cannot create pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- session_pool_socket[socket_id].priv_mp = sess_mp;
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
- nb_sessions, 0, 0, 0, socket_id);
+ nb_sessions, session_priv_size, 0, 0,
+ socket_id);
if (sess_mp == NULL) {
printf("Cannot create pool \"%s\" on socket %d\n",
@@ -136,6 +115,7 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
printf("Allocated pool \"%s\" on socket %d\n",
mp_name, socket_id);
session_pool_socket[socket_id].sess_mp = sess_mp;
+ session_pool_socket[socket_id].priv_mp = sess_mp;
}
return 0;
@@ -323,12 +303,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
return ret;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
if (opts->op_type == CPERF_ASYM_MODEX) {
qp_conf.mp_session = NULL;
- qp_conf.mp_session_private = NULL;
}
ret = rte_cryptodev_configure(cdev_id, &conf);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index 8472a87b99..cd3c1d7ef1 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -863,18 +863,13 @@ cryptodev_sym_sess_create(struct prod_data *p, struct test_perf *t)
cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
cipher_xform.next = NULL;
- sess = rte_cryptodev_sym_session_create(t->ca_sess_pool);
+ sess = rte_cryptodev_sym_session_create(p->ca.cdev_id, &cipher_xform,
+ t->ca_sess_pool);
if (sess == NULL) {
evt_err("Failed to create sym session");
return NULL;
}
- if (rte_cryptodev_sym_session_init(p->ca.cdev_id, sess, &cipher_xform,
- t->ca_sess_priv_pool)) {
- evt_err("Failed to init session");
- return NULL;
- }
-
return sess;
}
@@ -1381,15 +1376,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
goto err;
}
- t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
- "ca_sess_pool", nb_sessions, 0, 0,
- sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
- if (t->ca_sess_pool == NULL) {
- evt_err("Failed to create sym session pool");
- ret = -ENOMEM;
- goto err;
- }
-
max_session_size = 0;
for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
unsigned int session_size;
@@ -1400,12 +1386,11 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
max_session_size = session_size;
}
- max_session_size += sizeof(union rte_event_crypto_metadata);
- t->ca_sess_priv_pool = rte_mempool_create(
- "ca_sess_priv_pool", nb_sessions, max_session_size, 0, 0, NULL,
- NULL, NULL, NULL, SOCKET_ID_ANY, 0);
- if (t->ca_sess_priv_pool == NULL) {
- evt_err("failed to create sym session private pool");
+ t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
+ "ca_sess_pool", nb_sessions, max_session_size, 0,
+ sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
+ if (t->ca_sess_pool == NULL) {
+ evt_err("Failed to create sym session pool");
ret = -ENOMEM;
goto err;
}
@@ -1445,7 +1430,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
qp_conf.nb_descriptors = NB_CRYPTODEV_DESCRIPTORS;
qp_conf.mp_session = t->ca_sess_pool;
- qp_conf.mp_session_private = t->ca_sess_priv_pool;
for (qp_id = 0; qp_id < conf.nb_queue_pairs; qp_id++) {
ret = rte_cryptodev_queue_pair_setup(
@@ -1466,7 +1450,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
return ret;
@@ -1491,8 +1474,7 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
for (flow_id = 0; flow_id < t->nb_flows; flow_id++) {
sess = p->ca.crypto_sess[flow_id];
cdev_id = p->ca.cdev_id;
- rte_cryptodev_sym_session_clear(cdev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(cdev_id, sess);
}
rte_event_crypto_adapter_queue_pair_del(
@@ -1508,7 +1490,6 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
}
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index 8cbd06fe42..d06d52cdf8 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -70,7 +70,6 @@ struct test_perf {
RTE_EVENT_TIMER_ADAPTER_NUM_MAX] __rte_cache_aligned;
struct rte_mempool *ca_op_pool;
struct rte_mempool *ca_sess_pool;
- struct rte_mempool *ca_sess_priv_pool;
struct rte_mempool *ca_asym_sess_pool;
} __rte_cache_aligned;
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 0c39b16b71..ae2b102ecb 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -13,6 +13,7 @@
#include <rte_pause.h>
#include <rte_bus_vdev.h>
#include <rte_ether.h>
+#include <rte_errno.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
@@ -644,23 +645,17 @@ testsuite_setup(void)
}
ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
- "test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+ "test_sess_mp", MAX_NB_SESSIONS, session_size, 0, 0,
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
-
ts_params->session_priv_mpool = rte_mempool_create(
- "test_sess_mp_priv",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
+ "test_sess_mp_priv", MAX_NB_SESSIONS, session_size,
+ 0, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
+
TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
"session mempool allocation failed");
-
-
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
&ts_params->conf),
"Failed to configure cryptodev %u with %u qps",
@@ -668,7 +663,6 @@ testsuite_setup(void)
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -697,15 +691,11 @@ testsuite_teardown(void)
rte_mempool_avail_count(ts_params->op_mpool));
}
- /* Free session mempools */
- if (ts_params->session_priv_mpool != NULL) {
- rte_mempool_free(ts_params->session_priv_mpool);
- ts_params->session_priv_mpool = NULL;
- }
-
if (ts_params->session_mpool != NULL) {
rte_mempool_free(ts_params->session_mpool);
ts_params->session_mpool = NULL;
+ rte_mempool_free(ts_params->session_priv_mpool);
+ ts_params->session_priv_mpool = NULL;
}
res = rte_cryptodev_close(ts_params->valid_devs[0]);
@@ -1392,7 +1382,6 @@ dev_configure_and_start(uint64_t ff_disable)
ts_params->conf.ff_disable = ff_disable;
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
&ts_params->conf),
@@ -1452,10 +1441,8 @@ ut_teardown(void)
#endif
{
if (ut_params->sess) {
- rte_cryptodev_sym_session_clear(
- ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
- rte_cryptodev_sym_session_free(ut_params->sess);
ut_params->sess = NULL;
}
}
@@ -1610,7 +1597,6 @@ test_queue_pair_descriptor_setup(void)
*/
qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -2155,8 +2141,6 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
-
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2200,19 +2184,13 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
ut_params->auth_xform.auth.key.data = hmac_sha1_key;
ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
+ rte_errno = 0;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- /* Create crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ if (rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -2441,7 +2419,6 @@ create_wireless_algo_hash_session(uint8_t dev_id,
enum rte_crypto_auth_algorithm algo)
{
uint8_t hash_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2461,16 +2438,11 @@ create_wireless_algo_hash_session(uint8_t dev_id,
ut_params->auth_xform.auth.digest_length = auth_len;
ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
ut_params->auth_xform.auth.iv.length = iv_len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2483,7 +2455,6 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
uint8_t iv_len)
{
uint8_t cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2503,16 +2474,12 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session */
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2590,7 +2557,6 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
{
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2625,17 +2591,12 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2649,7 +2610,6 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
{
const uint8_t key_len = tdata->key.len;
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2689,16 +2649,11 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2724,7 +2679,6 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
uint8_t cipher_iv_len)
{
uint8_t auth_cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2755,26 +2709,19 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
if (cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
ut_params->auth_xform.next = NULL;
ut_params->cipher_xform.next = &ut_params->auth_xform;
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
} else
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -8205,7 +8152,6 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
uint8_t iv_len)
{
uint8_t aead_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -8227,15 +8173,12 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->aead_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->aead_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -8679,7 +8622,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
/* Create security session */
ut_params->sec_session = rte_security_session_create(ctx,
&sess_conf, ts_params->session_mpool,
- ts_params->session_priv_mpool);
+ NULL);
if (!ut_params->sec_session) {
printf("TestCase %s()-%d line %d failed %s: ",
@@ -12029,7 +11972,6 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
const struct HMAC_MD5_vector *test_case)
{
uint8_t key[64];
- int status;
memcpy(key, test_case->key.data, test_case->key.len);
@@ -12044,16 +11986,11 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
ut_params->auth_xform.auth.key.data = key;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- if (ut_params->sess == NULL)
- return TEST_FAILED;
-
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -12261,12 +12198,9 @@ test_multi_session(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
-
struct rte_cryptodev_info dev_info;
struct rte_cryptodev_sym_session **sessions;
-
uint16_t i;
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12293,20 +12227,15 @@ test_multi_session(void)
/* Create multiple crypto sessions*/
for (i = 0; i < MAX_NB_SESSIONS; i++) {
-
sessions[i] = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
+
TEST_ASSERT_NOT_NULL(sessions[i],
"Session creation failed at session number %u",
i);
-
- status = rte_cryptodev_sym_session_init(
- ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
/* Attempt to send a request on each session */
TEST_ASSERT_SUCCESS( test_AES_CBC_HMAC_SHA512_decrypt_perform(
sessions[i],
@@ -12336,18 +12265,9 @@ test_multi_session(void)
}
}
- sessions[i] = NULL;
- /* Next session create should fail */
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NULL(sessions[i],
- "Session creation succeeded unexpectedly!");
-
for (i = 0; i < MAX_NB_SESSIONS; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12398,7 +12318,6 @@ test_multi_session_random_usage(void)
},
};
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12420,11 +12339,6 @@ test_multi_session_random_usage(void)
* MAX_NB_SESSIONS) + 1, 0);
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- sessions[i] = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(sessions[i],
- "Session creation failed at session number %u",
- i);
rte_memcpy(&ut_paramz[i].ut_params, &unittest_params,
sizeof(struct crypto_unittest_params));
@@ -12434,16 +12348,16 @@ test_multi_session_random_usage(void)
ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
/* Create multiple crypto sessions*/
- status = rte_cryptodev_sym_session_init(
+ sessions[i] = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0],
- sessions[i],
&ut_paramz[i].ut_params.auth_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(sessions[i],
+ "Session creation failed at session number %u",
+ i);
}
srand(time(NULL));
@@ -12481,9 +12395,8 @@ test_multi_session_random_usage(void)
}
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12501,7 +12414,6 @@ test_null_invalid_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int ret;
/* This test is for NULL PMD only */
if (gbl_driver_id != rte_cryptodev_driver_id_get(
@@ -12515,17 +12427,13 @@ test_null_invalid_operation(void)
ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
-
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.next = NULL;
@@ -12533,14 +12441,11 @@ test_null_invalid_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
return TEST_SUCCESS;
@@ -12554,7 +12459,6 @@ test_null_burst_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
unsigned i, burst_len = NULL_BURST_LENGTH;
@@ -12580,19 +12484,14 @@ test_null_burst_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
/* Create Crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0],
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
@@ -12703,7 +12602,6 @@ test_enq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12803,7 +12701,6 @@ test_deq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12990,7 +12887,6 @@ static int create_gmac_session(uint8_t dev_id,
enum rte_crypto_auth_operation auth_op)
{
uint8_t auth_key[tdata->key.len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -13009,15 +12905,13 @@ static int create_gmac_session(uint8_t dev_id,
ut_params->auth_xform.auth.iv.length = tdata->iv.len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -13646,7 +13540,6 @@ create_auth_session(struct crypto_unittest_params *ut_params,
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -13660,15 +13553,13 @@ create_auth_session(struct crypto_unittest_params *ut_params,
ut_params->auth_xform.auth.digest_length = reference->digest.len;
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -13681,7 +13572,6 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -13713,15 +13603,13 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
}
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -14179,7 +14067,6 @@ test_authenticated_encrypt_with_esn(
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
struct rte_cryptodev_info dev_info;
- int status;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -14230,19 +14117,12 @@ test_authenticated_encrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
-
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
"Failed to allocate input buffer in mempool");
@@ -14366,18 +14246,11 @@ test_authenticated_decrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- retval = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- if (retval == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(retval, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
@@ -15125,8 +14998,8 @@ test_scheduler_attach_worker_op(void)
ts_params->session_mpool =
rte_cryptodev_sym_session_pool_create(
"test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0,
- SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, session_size,
+ 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
}
@@ -15149,8 +15022,6 @@ test_scheduler_attach_worker_op(void)
}
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private =
- ts_params->session_priv_mpool;
ret = rte_cryptodev_scheduler_worker_attach(sched_id,
(uint8_t)i);
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index b5813b956f..4fcdd55660 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -68,7 +68,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
struct rte_mempool *sess_mpool,
- struct rte_mempool *sess_priv_mpool,
uint8_t dev_id,
char *test_msg)
{
@@ -514,11 +513,9 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
*/
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) &&
nb_iterates == 0) {
- sess = rte_cryptodev_sym_session_create(sess_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, sess,
- init_xform, sess_priv_mpool);
- if (status == -ENOTSUP) {
+ sess = rte_cryptodev_sym_session_create(dev_id, init_xform,
+ sess_mpool);
+ if (sess == NULL) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "UNSUPPORTED");
status = TEST_SKIPPED;
goto error_exit;
@@ -801,10 +798,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
error_exit:
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- if (sess) {
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
- }
+ if (sess)
+ rte_cryptodev_sym_session_free(dev_id, sess);
rte_free(cipher_xform);
rte_free(auth_xform);
}
@@ -829,7 +824,6 @@ blockcipher_test_case_run(const void *data)
p_testsuite_params->mbuf_pool,
p_testsuite_params->op_mpool,
p_testsuite_params->session_mpool,
- p_testsuite_params->session_priv_mpool,
p_testsuite_params->valid_devs[0],
test_msg);
return status;
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index bb617c1042..0a7f8f8505 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -157,7 +157,6 @@ struct event_crypto_adapter_test_params {
struct rte_mempool *op_mpool;
struct rte_mempool *asym_op_mpool;
struct rte_mempool *session_mpool;
- struct rte_mempool *session_priv_mpool;
struct rte_mempool *asym_sess_mpool;
struct rte_cryptodev_config *config;
uint8_t crypto_event_port_id;
@@ -307,15 +306,10 @@ test_op_forward_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
-
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
&cap);
TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
@@ -683,8 +677,8 @@ test_op_new_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
@@ -699,9 +693,6 @@ test_op_new_mode(uint8_t session_less)
RTE_CRYPTO_OP_WITH_SESSION,
&m_data, sizeof(m_data));
}
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
rte_crypto_op_attach_sym_session(op, sess);
} else {
@@ -994,22 +985,12 @@ configure_cryptodev(void)
params.session_mpool = rte_cryptodev_sym_session_pool_create(
"CRYPTO_ADAPTER_SESSION_MP",
- MAX_NB_SESSIONS, 0, 0,
+ MAX_NB_SESSIONS, session_size, 0,
sizeof(union rte_event_crypto_metadata),
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(params.session_mpool,
"session mempool allocation failed\n");
- params.session_priv_mpool = rte_mempool_create(
- "CRYPTO_AD_SESS_MP_PRIV",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
- TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
- "session mempool allocation failed\n");
-
rte_cryptodev_info_get(TEST_CDEV_ID, &info);
while ((capability = &info.capabilities[i++])->op !=
@@ -1048,7 +1029,6 @@ configure_cryptodev(void)
qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
qp_conf.mp_session = params.session_mpool;
- qp_conf.mp_session_private = params.session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -1418,11 +1398,6 @@ crypto_teardown(void)
rte_mempool_free(params.session_mpool);
params.session_mpool = NULL;
}
- if (params.session_priv_mpool != NULL) {
- rte_mempool_avail_count(params.session_priv_mpool);
- rte_mempool_free(params.session_priv_mpool);
- params.session_priv_mpool = NULL;
- }
/* Free asym session mempool */
if (params.asym_sess_mpool != NULL) {
diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index aa533483fd..04d231468b 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -370,20 +370,9 @@ testsuite_setup(void)
return TEST_FAILED;
}
- ts_params->qp_conf.mp_session_private = rte_mempool_create(
- "test_priv_sess_mp",
- MAX_NB_SESSIONS,
- sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
-
- TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session_private,
- "private session mempool allocation failed");
-
ts_params->qp_conf.mp_session =
rte_cryptodev_sym_session_pool_create("test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, sess_sz, 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session,
"session mempool allocation failed");
@@ -428,11 +417,6 @@ testsuite_teardown(void)
rte_mempool_free(ts_params->qp_conf.mp_session);
ts_params->qp_conf.mp_session = NULL;
}
-
- if (ts_params->qp_conf.mp_session_private != NULL) {
- rte_mempool_free(ts_params->qp_conf.mp_session_private);
- ts_params->qp_conf.mp_session_private = NULL;
- }
}
static int
@@ -647,8 +631,7 @@ create_dummy_sec_session(struct ipsec_unitest_params *ut,
static struct rte_security_session_conf conf;
ut->ss[j].security.ses = rte_security_session_create(&dummy_sec_ctx,
- &conf, qp->mp_session,
- qp->mp_session_private);
+ &conf, qp->mp_session, NULL);
if (ut->ss[j].security.ses == NULL)
return -ENOMEM;
@@ -662,25 +645,15 @@ static int
create_crypto_session(struct ipsec_unitest_params *ut,
struct rte_cryptodev_qp_conf *qp, uint8_t dev_id, uint32_t j)
{
- int32_t rc;
struct rte_cryptodev_sym_session *s;
- s = rte_cryptodev_sym_session_create(qp->mp_session);
+ s = rte_cryptodev_sym_session_create(dev_id, ut->crypto_xforms,
+ qp->mp_session);
if (s == NULL)
return -ENOMEM;
- /* initialize SA crypto session for device */
- rc = rte_cryptodev_sym_session_init(dev_id, s,
- ut->crypto_xforms, qp->mp_session_private);
- if (rc == 0) {
- ut->ss[j].crypto.ses = s;
- return 0;
- } else {
- /* failure, do cleanup */
- rte_cryptodev_sym_session_clear(dev_id, s);
- rte_cryptodev_sym_session_free(s);
- return rc;
- }
+ ut->ss[j].crypto.ses = s;
+ return 0;
}
static int
@@ -1196,8 +1169,7 @@ static void
destroy_crypto_session(struct ipsec_unitest_params *ut,
uint8_t crypto_dev, uint32_t j)
{
- rte_cryptodev_sym_session_clear(crypto_dev, ut->ss[j].crypto.ses);
- rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses);
+ rte_cryptodev_sym_session_free(crypto_dev, ut->ss[j].crypto.ses);
memset(&ut->ss[j], 0, sizeof(ut->ss[j]));
}
diff --git a/drivers/crypto/armv8/armv8_pmd_private.h b/drivers/crypto/armv8/armv8_pmd_private.h
index 75ddba79c1..41292d8851 100644
--- a/drivers/crypto/armv8/armv8_pmd_private.h
+++ b/drivers/crypto/armv8/armv8_pmd_private.h
@@ -106,8 +106,6 @@ struct armv8_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 5c060e71a3..824a2cc735 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -521,34 +521,23 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
/* get existing session */
if (likely(op->sym->session != NULL)) {
- sess = (struct armv8_crypto_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
} else {
/* provide internal session */
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct armv8_crypto_session *)_sess_private_data;
+ sess = (struct armv8_crypto_session *)_sess->driver_priv_data;
if (unlikely(armv8_crypto_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
}
if (unlikely(sess == NULL))
@@ -674,10 +663,6 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct armv8_crypto_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index c07ac0489e..c4964bc112 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -244,7 +244,6 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -265,10 +264,9 @@ armv8_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
/** Configure the session from a crypto xform chain */
static int
-armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
+armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -278,43 +276,22 @@ armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = sess->driver_priv_data;
ret = armv8_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
ARMV8_CRYPTO_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct armv8_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops armv8_crypto_pmd_ops = {
.dev_configure = armv8_crypto_pmd_config,
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index 675ed0ad55..d3334dc920 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -211,8 +211,7 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
} else if (likely(op->sym->session != NULL)) {
/* get existing session */
sess = (struct bcmfs_sym_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_bcmfs_driver_id);
+ op->sym->session->driver_priv_data;
}
if (sess == NULL)
@@ -222,10 +221,9 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
}
int
-bcmfs_sym_session_configure(struct rte_cryptodev *dev,
+bcmfs_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -235,45 +233,23 @@ bcmfs_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- BCMFS_DP_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
BCMFS_DP_LOG(ERR, "Failed configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
void
-bcmfs_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp;
-
- memset(sess_priv, 0, sizeof(struct bcmfs_sym_session));
- sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+bcmfs_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
unsigned int
bcmfs_sym_session_get_private_size(struct rte_cryptodev *dev __rte_unused)
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.h b/drivers/crypto/bcmfs/bcmfs_sym_session.h
index d40595b4bd..4a0a012ae7 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.h
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.h
@@ -93,8 +93,7 @@ bcmfs_process_crypto_op(struct rte_crypto_op *op,
int
bcmfs_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
void
bcmfs_sym_session_clear(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8c0b4909cf..59eaecfbd2 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1357,8 +1357,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
ses = (struct caam_jr_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_driver_id);
+ op->sym->session->driver_priv_data;
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
ses = (struct caam_jr_session *)
@@ -1692,54 +1691,39 @@ caam_jr_set_session_parameters(struct rte_cryptodev *dev,
}
static int
-caam_jr_sym_session_configure(struct rte_cryptodev *dev,
+caam_jr_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
PMD_INIT_FUNC_TRACE();
-
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CAAM_JR_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
+ sess_private_data = (void *)sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct caam_jr_session));
ret = caam_jr_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
CAAM_JR_ERR("failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
static void
-caam_jr_sym_session_clear(struct rte_cryptodev *dev,
+caam_jr_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
struct caam_jr_session *s = (struct caam_jr_session *)sess_priv;
PMD_INIT_FUNC_TRACE();
if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(struct caam_jr_session));
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4bab18323b..bd999abe61 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1585,9 +1585,7 @@ ccp_perform_hmac(struct rte_crypto_op *op,
void *append_ptr;
uint8_t *addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
addr = session->auth.pre_compute;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -1766,9 +1764,7 @@ ccp_perform_sha(struct rte_crypto_op *op,
void *append_ptr;
uint64_t auth_msg_bits;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1859,9 +1855,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr, dest_addr_t;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2005,9 +1999,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2079,9 +2071,7 @@ ccp_perform_aes_cmac(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
key_addr = rte_mem_virt2phy(session->auth.key_ccp);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -2242,9 +2232,7 @@ ccp_perform_aes(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
uint8_t *iv;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
function.raw = 0;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
@@ -2330,9 +2318,7 @@ ccp_perform_3des(struct rte_crypto_op *op,
uint8_t *iv;
phys_addr_t src_addr, dest_addr, key_addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
switch (session->cipher.um.des_mode) {
@@ -2440,9 +2426,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
phys_addr_t digest_dest_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
key_addr = session->cipher.key_phys;
@@ -2607,9 +2591,7 @@ ccp_crypto_cipher(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->cipher.algo) {
case CCP_CIPHER_ALGO_AES_CBC:
@@ -2645,9 +2627,7 @@ ccp_crypto_auth(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_SHA1:
@@ -2715,9 +2695,7 @@ ccp_crypto_aead(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_AES_GCM:
@@ -2780,9 +2758,8 @@ process_ops_to_enqueue(struct ccp_qp *qp,
b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
Q_DESC_SIZE);
for (i = b_idx; i < (nb_ops+b_idx); i++) {
- session = (struct ccp_session *)get_sym_session_private_data(
- op[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
result = ccp_crypto_cipher(op[i], cmd_q, b_info);
@@ -2858,9 +2835,7 @@ static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
int offset, digest_offset;
uint8_t digest_le[64];
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
if (session->cmd_id == CCP_CMD_COMBINED) {
digest_data = op->sym->aead.digest.data;
@@ -2934,9 +2909,8 @@ ccp_prepare_ops(struct ccp_qp *qp,
for (i = b_info->b_idx; i < min_ops; i++) {
op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
- session = (struct ccp_session *)get_sym_session_private_data(
- op_d[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op_d[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 1b600e81ad..e401793a76 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -727,7 +727,6 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
/* mempool for batch info */
qp->batch_mp = rte_mempool_create(
@@ -757,8 +756,7 @@ ccp_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
void *sess_private_data;
@@ -769,40 +767,22 @@ ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -ENOMEM;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CCP_LOG_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
+
internals = (struct ccp_private *)dev->data->dev_private;
ret = ccp_set_session_parameters(sess_private_data, xform, internals);
if (ret != 0) {
CCP_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
return 0;
}
static void
-ccp_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- rte_mempool_put(sess_mp, sess_priv);
- memset(sess_priv, 0, sizeof(struct ccp_session));
- set_sym_session_private_data(sess, index, NULL);
- }
-}
+ccp_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops ccp_ops = {
.dev_configure = ccp_pmd_config,
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 1c4118ee3c..6704e39ab8 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -78,8 +78,6 @@ struct ccp_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_mempool *batch_mp;
/**< Session Mempool for batch info */
struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 013f3be1e6..6a0bfff45f 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -56,33 +56,23 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
if (unlikely(op->sym->session == NULL))
return NULL;
- sess = (struct ccp_session *)
- get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ sess = (void *)op->sym->session->driver_priv_data;
} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- void *_sess;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess;
struct ccp_private *internals;
- if (rte_mempool_get(qp->sess_mp, &_sess))
- return NULL;
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+ if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- sess = (struct ccp_session *)_sess_private_data;
+ sess = (void *)_sess->driver_priv_data;
internals = (struct ccp_private *)qp->dev->data->dev_private;
if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
internals) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- ccp_cryptodev_driver_id,
- _sess_private_data);
+ op->sym->session = _sess;
}
return sess;
@@ -161,13 +151,10 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
for (i = 0; i < nb_dequeued; i++)
if (unlikely(ops[i]->sess_type ==
RTE_CRYPTO_OP_SESSIONLESS)) {
- struct ccp_session *sess = (struct ccp_session *)
- get_sym_session_private_data(
- ops[i]->sym->session,
- ccp_cryptodev_driver_id);
+ struct ccp_session *sess =
+ (void *)ops[i]->sym->session->driver_priv_data;
- rte_mempool_put(qp->sess_mp_priv,
- sess);
+ memset(sess, 0, sizeof(*sess));
rte_mempool_put(qp->sess_mp,
ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 7bbe8726e3..dee1f299d2 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -41,24 +41,23 @@ struct vec_request {
static inline struct cnxk_se_sess *
cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn10k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
- if (ret)
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform,
+ sess);
+ if (ret) {
+ rte_mempool_put(qp->sess_mp, (void *)sess);
goto sess_put;
+ }
- priv = get_sym_session_private_data(sess, driver_id);
-
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
return priv;
@@ -130,8 +129,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
return 0;
w7 = sec_sess->sa.inst.w7;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- sess = get_sym_session_private_data(
- sym_op->session, cn10k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret))
@@ -147,8 +145,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret)) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
return 0;
}
@@ -312,8 +309,9 @@ cn10k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn10k_cryptodev_driver_id);
+ priv = (void *)(
+ ((struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -350,8 +348,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn10k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
} else {
@@ -818,7 +815,6 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
{
const uint8_t uc_compcode = res->uc_compcode;
const uint8_t compcode = res->compcode;
- unsigned int sz;
cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
@@ -895,11 +891,7 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index b753c1cb4b..a44f111ba6 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -56,23 +56,20 @@ cn9k_cpt_sec_inst_fill(struct rte_crypto_op *op,
static inline struct cnxk_se_sess *
cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn9k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform, sess);
if (ret)
goto sess_put;
- priv = get_sym_session_private_data(sess, driver_id);
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
@@ -95,8 +92,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
sym_op = op->sym;
- sess = get_sym_session_private_data(
- sym_op->session, cn9k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
inst->w7.u64 = sess->cpt_inst_w7;
} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
@@ -110,8 +106,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
if (unlikely(ret)) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
}
inst->w7.u64 = sess->cpt_inst_w7;
@@ -349,8 +344,9 @@ cn9k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn9k_cryptodev_driver_id);
+ priv = (void *)((
+ (struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -387,8 +383,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn9k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
} else {
@@ -583,8 +578,6 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
struct cpt_inflight_req *infl_req,
struct cpt_cn9k_res_s *res)
{
- unsigned int sz;
-
if (likely(res->compcode == CPT_COMP_GOOD)) {
if (unlikely(res->uc_compcode)) {
if (res->uc_compcode == ROC_SE_ERR_GC_ICV_MISCOMPARE)
@@ -645,11 +638,7 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index cf91b92c2c..018d7fcee8 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -406,7 +406,6 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = conf->mp_session;
- qp->sess_mp_priv = conf->mp_session_private;
dev->data->queue_pairs[qp_id] = qp;
return 0;
@@ -620,25 +619,15 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)
}
int
-sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
enum cpt_dp_thread_type thr_type;
- struct cnxk_se_sess *sess_priv;
- void *priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
int ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- plt_dp_err("Could not allocate session private data");
- return -ENOMEM;
- }
-
- memset(priv, 0, sizeof(struct cnxk_se_sess));
-
- sess_priv = priv;
-
+ memset(sess_priv, 0, sizeof(struct cnxk_se_sess));
ret = cnxk_sess_fill(roc_cpt, xform, sess_priv);
if (ret)
goto priv_put;
@@ -684,61 +673,39 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
}
sess_priv->cpt_inst_w7 = cnxk_cpt_inst_w7_get(sess_priv, roc_cpt);
-
- set_sym_session_private_data(sess, driver_id, sess_priv);
-
return 0;
priv_put:
- rte_mempool_put(pool, priv);
-
return ret;
}
int
cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
struct cnxk_cpt_vf *vf = dev->data->dev_private;
struct roc_cpt *roc_cpt = &vf->cpt;
- uint8_t driver_id;
- driver_id = dev->driver_id;
-
- return sym_session_configure(roc_cpt, driver_id, xform, sess, pool);
+ return sym_session_configure(roc_cpt, xform, sess);
}
void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
- struct cnxk_se_sess *sess_priv;
- struct rte_mempool *pool;
-
- if (priv == NULL)
- return;
-
- sess_priv = priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
- memset(priv, 0, cnxk_cpt_sym_session_get_size(NULL));
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
+ memset(sess_priv, 0, cnxk_cpt_sym_session_get_size(NULL));
}
void
-cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
+cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
unsigned int
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index d9ed43b40b..baa2b69c52 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -85,8 +85,6 @@ struct cnxk_cpt_qp {
/**< Crypto adapter related info */
struct rte_mempool *sess_mp;
/**< Session mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session private data mempool */
};
int cnxk_cpt_dev_config(struct rte_cryptodev *dev,
@@ -111,18 +109,16 @@ unsigned int cnxk_cpt_sym_session_get_size(struct rte_cryptodev *dev);
int cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
-int sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+int sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
void cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess);
+ struct rte_cryptodev_sym_session *sess);
-void sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess);
+void sym_session_clear(struct rte_cryptodev_sym_session *sess);
unsigned int cnxk_ae_session_size_get(struct rte_cryptodev *dev __rte_unused);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 3b13578de0..fa1cdcf78b 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1379,8 +1379,7 @@ build_sec_fd(struct rte_crypto_op *op,
dpaa2_sec_session *sess;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -1678,8 +1677,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
struct rte_crypto_sym_op *sym_op;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -3754,51 +3752,36 @@ dpaa2_sec_security_session_destroy(void *dev __rte_unused,
}
#endif
static int
-dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA2_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa2_sec_set_session_parameters(xform, sess_private_data);
if (ret != 0) {
DPAA2_SEC_ERR("Failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa2_sec_session *s = (dpaa2_sec_session *)sess_priv;
if (sess_priv) {
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(dpaa2_sec_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index b3242791ac..fb74be6012 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -1012,8 +1012,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa2_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, cryptodev_driver_id);
+ sess = (void *)session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index c6bd785262..7a4c03a882 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -670,10 +670,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
struct qm_sg_entry sg[2];
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa_sec_session *)
@@ -1927,10 +1924,8 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ ses = (void *)
+ op->sym->session->driver_priv_data;
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
@@ -2676,31 +2671,19 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
static int
dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
PMD_INIT_FUNC_TRACE();
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa_sec_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
DPAA_SEC_ERR("failed to configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
ret = dpaa_sec_prep_cdb(sess_private_data);
if (ret) {
DPAA_SEC_ERR("Unable to prepare sec cdb");
@@ -2714,7 +2697,6 @@ static inline void
free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
{
struct dpaa_sec_dev_private *qi = dev->data->dev_private;
- struct rte_mempool *sess_mp = rte_mempool_from_obj((void *)s);
uint8_t i;
for (i = 0; i < MAX_DPAA_CORES; i++) {
@@ -2724,7 +2706,6 @@ free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
s->qp[i] = NULL;
}
free_session_data(s);
- rte_mempool_put(sess_mp, (void *)s);
}
/** Clear the memory of session so it doesn't leave key material behind */
@@ -2733,14 +2714,10 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
- if (sess_priv) {
- free_session_memory(dev, s);
- set_sym_session_private_data(sess, index, NULL);
- }
+ free_session_memory(dev, s);
}
#ifdef RTE_LIB_SECURITY
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index 29c5935739..35f93ceb48 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -1017,8 +1017,8 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)
+ session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 7e8396b4a3..90ce5bc965 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -264,7 +264,6 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
qp->pmd_type = internals->pmd_type;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
qp->ingress_queue = ipsec_mb_qp_create_processed_ops_ring(qp,
qp_conf->nb_descriptors, socket_id);
@@ -312,9 +311,8 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev)
int
ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess, struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
struct ipsec_mb_dev_private *internals = dev->data->dev_private;
struct ipsec_mb_internals *pmd_data =
&ipsec_mb_pmds[internals->pmd_type];
@@ -330,42 +328,22 @@ ipsec_mb_sym_session_configure(
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- IPSEC_MB_LOG(ERR, "Couldn't get object from session mempool");
- free_mb_mgr(mb_mgr);
- return -ENOMEM;
- }
-
- ret = (*pmd_data->session_configure)(mb_mgr, sess_private_data, xform);
+ ret = (*pmd_data->session_configure)(mb_mgr,
+ (void *)sess->driver_priv_data, xform);
if (ret != 0) {
IPSEC_MB_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
free_mb_mgr(mb_mgr);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
free_mb_mgr(mb_mgr);
return 0;
}
/** Clear the session memory */
void
-ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, ipsec_mb_sym_session_get_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+ipsec_mb_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 472b672f08..e4aea7700c 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -136,8 +136,6 @@ struct ipsec_mb_qp {
struct rte_ring *ingress_queue;
/**< Ring for placing operations ready for processing */
struct rte_mempool *sess_mp;
- /**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
/**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
@@ -399,8 +397,7 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev);
int ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
/** Clear the memory of session so it does not leave key material behind */
void
@@ -411,50 +408,50 @@ ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
static __rte_always_inline void *
ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
{
- void *sess = NULL;
+ struct rte_cryptodev_sym_session *sess = NULL;
uint32_t driver_id = ipsec_mb_get_driver_id(qp->pmd_type);
struct rte_crypto_sym_op *sym_op = op->sym;
uint8_t sess_type = op->sess_type;
void *_sess;
- void *_sess_private_data = NULL;
struct ipsec_mb_internals *pmd_data = &ipsec_mb_pmds[qp->pmd_type];
switch (sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
if (likely(sym_op->session != NULL))
- sess = get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
+ else
+ goto error_exit;
break;
case RTE_CRYPTO_OP_SESSIONLESS:
if (!qp->sess_mp ||
rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (!qp->sess_mp_priv ||
- rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
+ sess = _sess;
+ if (sess->sess_data_sz < pmd_data->session_priv_size) {
+ rte_mempool_put(qp->sess_mp, _sess);
+ goto error_exit;
+ }
- sess = _sess_private_data;
if (unlikely(pmd_data->session_configure(qp->mb_mgr,
- sess, sym_op->xform) != 0)) {
+ (void *)sess->driver_priv_data, sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
- sess = NULL;
+ goto error_exit;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sess->driver_id = driver_id;
+ sym_op->session = sess;
+
break;
default:
IPSEC_MB_LOG(ERR, "Unrecognized session type %u", sess_type);
}
- if (unlikely(sess == NULL))
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return (void *)sess->driver_priv_data;
- return sess;
+error_exit:
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return NULL;
}
#endif /* _IPSEC_MB_PRIVATE_H_ */
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
index 2c033c6f28..e4f274b608 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
@@ -241,10 +241,6 @@ handle_completed_gcm_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_gcm_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -455,44 +451,35 @@ static inline struct aesni_gcm_session *
aesni_gcm_get_session(struct ipsec_mb_qp *qp,
struct rte_crypto_op *op)
{
- struct aesni_gcm_session *sess = NULL;
- uint32_t driver_id =
- ipsec_mb_get_driver_id(IPSEC_MB_PMD_TYPE_AESNI_GCM);
+ struct rte_cryptodev_sym_session *sess = NULL;
struct rte_crypto_sym_op *sym_op = op->sym;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
- sess = (struct aesni_gcm_session *)
- get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
} else {
- void *_sess;
- void *_sess_private_data = NULL;
-
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
+ if (unlikely(sess->sess_data_sz <
+ sizeof(struct aesni_gcm_session))) {
+ rte_mempool_put(qp->sess_mp, sess);
return NULL;
-
- sess = (struct aesni_gcm_session *)_sess_private_data;
+ }
if (unlikely(aesni_gcm_session_configure(qp->mb_mgr,
- _sess_private_data, sym_op->xform) != 0)) {
- rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
+ (void *)sess->driver_priv_data,
+ sym_op->xform) != 0)) {
+ rte_mempool_put(qp->sess_mp, sess);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sym_op->session = sess;
}
if (unlikely(sess == NULL))
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return sess;
+ return (void *)sess->driver_priv_data;
}
static uint16_t
@@ -712,22 +699,15 @@ aesni_gmac_sgl_verify(struct aesni_gcm_session *s,
/** Process CPU crypto bulk operations */
static uint32_t
-aesni_gcm_process_bulk(struct rte_cryptodev *dev,
+aesni_gcm_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess,
__rte_unused union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
- struct aesni_gcm_session *s;
+ struct aesni_gcm_session *s = (void *)sess->driver_priv_data;
struct gcm_context_data gdata_ctx;
IMB_MGR *mb_mgr;
- s = (struct aesni_gcm_session *) get_sym_session_private_data(sess,
- dev->driver_id);
- if (unlikely(s == NULL)) {
- aesni_gcm_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 6d5d3ce8eb..f3565b04b5 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1710,8 +1710,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
{
struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data;
struct aesni_mb_session *sess = NULL;
- uint32_t driver_id = ipsec_mb_get_driver_id(
- IPSEC_MB_PMD_TYPE_AESNI_MB);
#ifdef AESNI_MB_DOCSIS_SEC_ENABLED
uint8_t is_docsis_sec = 0;
@@ -1725,15 +1723,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
sess = get_sec_session_private_data(op->sym->sec_session);
} else
#endif
- {
- sess = get_sym_session_private_data(op->sym->session,
- driver_id);
- }
-
- if (unlikely(sess == NULL)) {
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return op;
- }
+ sess = (void *)op->sym->session->driver_priv_data;
if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
switch (job->status) {
@@ -1771,10 +1761,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_mb_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -1962,16 +1948,6 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
return processed_jobs;
}
-
-static inline void
-ipsec_mb_fill_error_code(struct rte_crypto_sym_vec *vec, int32_t err)
-{
- uint32_t i;
-
- for (i = 0; i != vec->num; ++i)
- vec->status[i] = err;
-}
-
static inline int
check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl)
{
@@ -2028,7 +2004,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec,
}
static uint32_t
-aesni_mb_process_bulk(struct rte_cryptodev *dev,
+aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
struct rte_crypto_sym_vec *vec)
{
@@ -2037,15 +2013,9 @@ aesni_mb_process_bulk(struct rte_cryptodev *dev,
void *buf;
IMB_JOB *job;
IMB_MGR *mb_mgr;
- struct aesni_mb_session *s;
+ struct aesni_mb_session *s = (void *)sess->driver_priv_data;
uint8_t tmp_dgst[vec->num][DIGEST_LENGTH_MAX];
- s = get_sym_session_private_data(sess, dev->driver_id);
- if (s == NULL) {
- ipsec_mb_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
index d953d6e5f5..97e7cef233 100644
--- a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
+++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
@@ -290,10 +290,6 @@ handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct chacha20_poly1305_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index fba10b8cf4..b83e2d6715 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -231,11 +231,6 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct kasumi_session));
- memset(
- ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -287,8 +282,9 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct kasumi_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct kasumi_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
return processed_op;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index 9a85f46721..f052d6d847 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -362,10 +362,6 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct snow3g_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -417,8 +413,9 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct snow3g_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct snow3g_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c b/drivers/crypto/ipsec_mb/pmd_zuc.c
index e36c7092d6..92fd9d1808 100644
--- a/drivers/crypto/ipsec_mb/pmd_zuc.c
+++ b/drivers/crypto/ipsec_mb/pmd_zuc.c
@@ -239,10 +239,6 @@ process_ops(struct rte_crypto_op **ops, enum ipsec_mb_operation op_type,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sessions[i], 0, sizeof(struct zuc_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sessions[i]);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index dc8e291f50..e5063b515c 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -171,14 +171,13 @@ mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *session)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *sess_private_data;
+ struct mlx5_crypto_session *sess_private_data =
+ (void *)session->driver_priv_data;
struct rte_crypto_cipher_xform *cipher;
uint8_t encryption_order;
- int ret;
if (unlikely(xform->next != NULL)) {
DRV_LOG(ERR, "Xform next is not supported.");
@@ -189,17 +188,9 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
DRV_LOG(ERR, "Only AES-XTS algorithm is supported.");
return -ENOTSUP;
}
- ret = rte_mempool_get(mp, (void *)&sess_private_data);
- if (ret != 0) {
- DRV_LOG(ERR,
- "Failed to get session %p private data from mempool.",
- sess_private_data);
- return -ENOMEM;
- }
cipher = &xform->cipher;
sess_private_data->dek = mlx5_crypto_dek_prepare(priv, cipher);
if (sess_private_data->dek == NULL) {
- rte_mempool_put(mp, sess_private_data);
DRV_LOG(ERR, "Failed to prepare dek.");
return -ENOMEM;
}
@@ -239,8 +230,6 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
sess_private_data->dek_id =
rte_cpu_to_be_32(sess_private_data->dek->obj->id &
0xffffff);
- set_sym_session_private_data(session, dev->driver_id,
- sess_private_data);
DRV_LOG(DEBUG, "Session %p was configured.", sess_private_data);
return 0;
}
@@ -250,16 +239,13 @@ mlx5_crypto_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *spriv = get_sym_session_private_data(sess,
- dev->driver_id);
+ struct mlx5_crypto_session *spriv = (void *)sess->driver_priv_data;
if (unlikely(spriv == NULL)) {
DRV_LOG(ERR, "Failed to get session %p private data.", spriv);
return;
}
mlx5_crypto_dek_destroy(priv, spriv->dek);
- set_sym_session_private_data(sess, dev->driver_id, NULL);
- rte_mempool_put(rte_mempool_from_obj(spriv), spriv);
DRV_LOG(DEBUG, "Session %p was cleared.", spriv);
}
@@ -369,8 +355,8 @@ mlx5_crypto_wqe_set(struct mlx5_crypto_priv *priv,
struct rte_crypto_op *op,
struct mlx5_umr_wqe *umr)
{
- struct mlx5_crypto_session *sess = get_sym_session_private_data
- (op->sym->session, mlx5_crypto_driver_id);
+ struct mlx5_crypto_session *sess =
+ (void *)op->sym->session->driver_priv_data;
struct mlx5_wqe_cseg *cseg = &umr->ctr;
struct mlx5_wqe_mkey_cseg *mkc = &umr->mkc;
struct mlx5_wqe_dseg *klms = &umr->kseg[0];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index c35876c8b4..fdc9c14227 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -597,13 +597,7 @@ mrvl_request_prepare_crp(struct sam_cio_op_params *request,
return -EINVAL;
}
- sess = (struct mrvl_crypto_session *)get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
- if (unlikely(sess == NULL)) {
- MRVL_LOG(ERR, "Session was not created for this device!");
- return -EINVAL;
- }
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
request->sa = sess->sam_sess;
request->cookie = op;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index f828dc9db5..0066236561 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -736,8 +736,7 @@ mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
static int
mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
struct mrvl_crypto_session *mrvl_sess;
void *sess_private_data;
@@ -748,23 +747,15 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- CDEV_LOG_ERR("Couldn't get object from session mempool.");
- return -ENOMEM;
- }
-
+ sess_private_data = sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session));
ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
MRVL_LOG(ERR, "Failed to configure session parameters!");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
mrvl_sess = (struct mrvl_crypto_session *)sess_private_data;
if (sam_session_create(&mrvl_sess->sam_sess_params,
@@ -791,8 +782,7 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = sess->data;
/* Zero out the whole structure */
if (sess_priv) {
@@ -803,11 +793,6 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
sam_session_destroy(mrvl_sess->sam_sess) < 0) {
MRVL_LOG(ERR, "Error while destroying session!");
}
-
- memset(mrvl_sess, 0, sizeof(struct mrvl_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index cb5393d2f1..505024a810 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -530,24 +530,16 @@ configure_aead_ctx(struct rte_crypto_aead_xform *xform,
}
static int
-nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
+nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *mp_obj;
- struct nitrox_crypto_ctx *ctx;
+ struct nitrox_crypto_ctx *ctx = (void *)sess->driver_priv_data;
struct rte_crypto_cipher_xform *cipher_xform = NULL;
struct rte_crypto_auth_xform *auth_xform = NULL;
struct rte_crypto_aead_xform *aead_xform = NULL;
int ret = -EINVAL;
- if (rte_mempool_get(mempool, &mp_obj)) {
- NITROX_LOG(ERR, "Couldn't allocate context\n");
- return -ENOMEM;
- }
-
- ctx = mp_obj;
ctx->nitrox_chain = get_crypto_chain_order(xform);
switch (ctx->nitrox_chain) {
case NITROX_CHAIN_CIPHER_ONLY:
@@ -585,38 +577,23 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
goto err;
}
- ctx->iova = rte_mempool_virt2iova(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, ctx);
+ ctx->iova = sess->driver_priv_data_iova;
return 0;
err:
- rte_mempool_put(mempool, mp_obj);
return ret;
}
static void
-nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct nitrox_crypto_ctx *ctx = get_sym_session_private_data(sess,
- cdev->driver_id);
- struct rte_mempool *sess_mp;
-
- if (!ctx)
- return;
-
- memset(ctx, 0, sizeof(*ctx));
- sess_mp = rte_mempool_from_obj(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, NULL);
- rte_mempool_put(sess_mp, ctx);
-}
+nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct nitrox_crypto_ctx *
get_crypto_ctx(struct rte_crypto_op *op)
{
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(op->sym->session))
- return get_sym_session_private_data(op->sym->session,
- nitrox_sym_drv_id);
+ return (void *)op->sym->session->driver_priv_data;
}
return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index eab74ad45f..695eeaa1e8 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -58,7 +58,7 @@ process_op(const struct null_crypto_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(op->sym->session, 0,
sizeof(struct null_crypto_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
@@ -78,30 +78,21 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
sess = (struct null_crypto_session *)
- get_sym_session_private_data(
- sym_op->session, cryptodev_driver_id);
+ sym_op->session->driver_priv_data;
} else {
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct null_crypto_session *)_sess_private_data;
+ sess = (struct null_crypto_session *)_sess->driver_priv_data;
if (unlikely(null_crypto_set_session_parameters(sess,
sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+ sym_op->session = _sess;
}
return sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 90a675dfff..fb43d3f7b5 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -233,7 +233,6 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
@@ -256,8 +255,7 @@ null_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -267,43 +265,22 @@ null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- NULL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = null_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
NULL_LOG(ERR, "failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct null_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops pmd_ops = {
.dev_configure = null_crypto_pmd_config,
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index 89c4345b6f..ae34ce6671 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,8 +31,6 @@ struct null_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Mempool */
struct rte_cryptodev_stats qp_stats;
/**< Queue pair statistics */
} __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
index e48805fb09..4647d568de 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
+++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
@@ -49,7 +49,6 @@ struct cpt_instance {
uint32_t queue_id;
uintptr_t rsvd;
struct rte_mempool *sess_mp;
- struct rte_mempool *sess_mp_priv;
struct cpt_qp_meta_info meta_info;
uint8_t ca_enabled;
};
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 11840f5ecf..71856d5e86 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -171,7 +171,6 @@ otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
instance->queue_id = que_pair_id;
instance->sess_mp = qp_conf->mp_session;
- instance->sess_mp_priv = qp_conf->mp_session_private;
dev->data->queue_pairs[que_pair_id] = instance;
return 0;
@@ -243,25 +242,19 @@ sym_xform_verify(struct rte_crypto_sym_xform *xform)
}
static int
-sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+sym_session_configure(struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_crypto_sym_xform *temp_xform = xform;
struct cpt_sess_misc *misc;
vq_cmd_word3_t vq_cmd_w3;
- void *priv;
+ void *priv = (void *)sess->driver_priv_data;
int ret;
ret = sym_xform_verify(xform);
if (unlikely(ret))
return ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- CPT_LOG_ERR("Could not allocate session private data");
- return -ENOMEM;
- }
-
memset(priv, 0, sizeof(struct cpt_sess_misc) +
offsetof(struct cpt_ctx, mc_ctx));
@@ -301,9 +294,7 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
goto priv_put;
}
- set_sym_session_private_data(sess, driver_id, priv);
-
- misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
+ misc->ctx_dma_addr = sess->driver_priv_data_iova +
sizeof(struct cpt_sess_misc);
vq_cmd_w3.u64 = 0;
@@ -316,17 +307,14 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
return 0;
priv_put:
- if (priv)
- rte_mempool_put(pool, priv);
return -ENOTSUP;
}
static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
+ void *priv = (void *)sess->driver_priv_data;
struct cpt_sess_misc *misc;
- struct rte_mempool *pool;
struct cpt_ctx *ctx;
if (priv == NULL)
@@ -336,35 +324,26 @@ sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
ctx = SESS_PRIV(misc);
rte_free(ctx->auth_key);
-
- memset(priv, 0, cpt_get_session_size());
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
}
static int
-otx_cpt_session_cfg(struct rte_cryptodev *dev,
+otx_cpt_session_cfg(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_configure(dev->driver_id, xform, sess, pool);
+ return sym_session_configure(xform, sess);
}
static void
-otx_cpt_session_clear(struct rte_cryptodev *dev,
+otx_cpt_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
static unsigned int
@@ -528,10 +507,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance,
void *req;
uint64_t cpt_op;
- sess = (struct cpt_sess_misc *)
- get_sym_session_private_data(sym_op->session,
- otx_cryptodev_driver_id);
-
+ sess = (struct cpt_sess_misc *)sym_op->session->driver_priv_data;
cpt_op = sess->cpt_op;
if (likely(cpt_op & CPT_OP_CIPHER_MASK))
@@ -560,21 +536,18 @@ static __rte_always_inline void * __rte_hot
otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
struct rte_crypto_op *op)
{
- const int driver_id = otx_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
void *req;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(instance->sess_mp);
- if (sess == NULL) {
+ if (rte_mempool_get(instance->sess_mp, (void **)&sess) < 0) {
rte_errno = ENOMEM;
return NULL;
}
- ret = sym_session_configure(driver_id, sym_op->xform, sess,
- instance->sess_mp_priv);
+ ret = sym_session_configure(sym_op->xform, sess);
if (ret)
goto sess_put;
@@ -583,12 +556,10 @@ otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
/* Enqueue op with the tmp session set */
req = otx_cpt_enq_single_sym(instance, op);
if (unlikely(req == NULL))
- goto priv_put;
+ goto sess_put;
return req;
-priv_put:
- sym_session_clear(driver_id, sess);
sess_put:
rte_mempool_put(instance->sess_mp, sess);
return NULL;
@@ -873,13 +844,9 @@ static inline void
free_sym_session_data(const struct cpt_instance *instance,
struct rte_crypto_op *cop)
{
- void *sess_private_data_t = get_sym_session_private_data(
- cop->sym->session, otx_cryptodev_driver_id);
+ void *sess_private_data_t = (void *)cop->sym->session->driver_priv_data;
+
memset(sess_private_data_t, 0, cpt_get_session_size());
- memset(cop->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session));
- rte_mempool_put(instance->sess_mp_priv, sess_private_data_t);
rte_mempool_put(instance->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/openssl_pmd_private.h b/drivers/crypto/openssl/openssl_pmd_private.h
index c34fd9a546..ed6841e460 100644
--- a/drivers/crypto/openssl/openssl_pmd_private.h
+++ b/drivers/crypto/openssl/openssl_pmd_private.h
@@ -70,8 +70,6 @@ struct openssl_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 3c4ff1ac56..ff5e349ce8 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -887,10 +887,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
/* get existing session */
if (likely(op->sym->session != NULL))
- sess = (struct openssl_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = (void *)
+ op->sym->session->driver_priv_data;
} else {
if (likely(op->asym->session != NULL))
asym_sess = (struct openssl_asym_session *)
@@ -901,32 +899,26 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
return asym_sess;
}
} else {
+ struct rte_cryptodev_sym_session *_sess;
/* sessionless asymmetric not supported */
if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC)
return NULL;
/* provide internal session */
- void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- void *_sess_private_data = NULL;
+ rte_mempool_get(qp->sess_mp, (void **)&_sess);
if (_sess == NULL)
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct openssl_session *)_sess_private_data;
+ sess = (struct openssl_session *)_sess->driver_priv_data;
if (unlikely(openssl_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+
}
if (sess == NULL)
@@ -2900,10 +2892,6 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
openssl_reset_session(sess);
memset(sess, 0, sizeof(struct openssl_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index f7ddbf9c73..2a3662ee5a 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -764,7 +764,6 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -794,10 +793,9 @@ openssl_pmd_asym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
if (unlikely(sess == NULL)) {
@@ -805,24 +803,14 @@ openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- OPENSSL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = openssl_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
OPENSSL_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
@@ -1328,20 +1316,13 @@ openssl_pmd_asym_session_configure(struct rte_cryptodev *dev __rte_unused,
/** Clear the memory of session so it doesn't leave key material behind */
static void
-openssl_pmd_sym_session_clear(struct rte_cryptodev *dev,
+openssl_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
/* Zero out the whole structure */
- if (sess_priv) {
- openssl_reset_session(sess_priv);
- memset(sess_priv, 0, sizeof(struct openssl_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ openssl_reset_session(sess_priv);
}
static void openssl_reset_asym_session(struct openssl_asym_session *sess)
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index f3a99ae15c..2c58a0ec75 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -67,12 +67,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
return -EINVAL;
if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) {
- ctx = get_sym_session_private_data(op->sym->session,
- qat_sym_driver_id);
- if (unlikely(!ctx)) {
- QAT_DP_LOG(ERR, "No session for this device");
- return -EINVAL;
- }
+ ctx = (void *)op->sym->session->driver_priv_data;
if (sess != (uintptr_t)ctx) {
struct rte_cryptodev *cdev;
struct qat_cryptodev_private *internals;
@@ -391,8 +386,7 @@ qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
return -EINVAL;
- ctx = (struct qat_sym_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, qat_sym_driver_id);
+ ctx = (void *)session_ctx.crypto_sess->driver_priv_data;
dp_ctx->session = ctx;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 074612c11b..2853ac5b88 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -317,9 +317,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
#endif
{
sess = (struct qat_sym_session *)
- get_sym_session_private_data(
- rx_op->sym->session,
- qat_sym_driver_id);
+ rx_op->sym->session->driver_priv_data;
is_docsis_sec = 0;
}
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index bfc9836351..da50bcbef1 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -226,22 +226,13 @@ qat_is_auth_alg_supported(enum rte_crypto_auth_algorithm algo,
}
void
-qat_sym_session_clear(struct rte_cryptodev *dev,
+qat_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
- struct qat_sym_session *s = (struct qat_sym_session *)sess_priv;
+ struct qat_sym_session *s = (void *)sess->driver_priv_data;
- if (sess_priv) {
- if (s->bpi_ctx)
- bpi_cipher_ctx_free(s->bpi_ctx);
- memset(s, 0, qat_sym_session_get_private_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ if (s->bpi_ctx)
+ bpi_cipher_ctx_free(s->bpi_ctx);
}
static int
@@ -524,35 +515,24 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
if (ossl_legacy_provider_load())
return -EINVAL;
#endif
- ret = qat_sym_session_set_parameters(dev, xform, sess_private_data);
+ ret = qat_sym_session_set_parameters(dev, xform,
+ (void *)sess->driver_priv_data,
+ sess->driver_priv_data_iova);
if (ret != 0) {
QAT_LOG(ERR,
"Crypto QAT PMD: failed to configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ossl_legacy_provider_unload();
# endif
@@ -561,7 +541,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev,
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private)
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_paddr)
{
struct qat_sym_session *session = session_private;
struct qat_cryptodev_private *internals = dev->data->dev_private;
@@ -570,7 +551,6 @@ qat_sym_session_set_parameters(struct rte_cryptodev *dev,
int qat_cmd_id;
/* Verify the session physical address is known */
- rte_iova_t session_paddr = rte_mempool_virt2iova(session);
if (session_paddr == 0 || session_paddr == RTE_BAD_IOVA) {
QAT_LOG(ERR,
"Session physical address unknown. Bad memory pool.");
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index 01908abd9e..9e4aab06a6 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -123,12 +123,12 @@ struct qat_sym_session {
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private);
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_private_iova);
int
qat_sym_session_configure_aead(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 11b559e025..03df424140 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -470,44 +470,18 @@ scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
}
static int
-scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+ struct rte_crypto_sym_xform *xform __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
- int ret;
-
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- ret = rte_cryptodev_sym_session_init(worker->dev_id, sess,
- xform, mempool);
- if (ret < 0) {
- CR_SCHED_LOG(ERR, "unable to config sym session");
- return ret;
- }
- }
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
-
- /* Clear private data of workers */
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- rte_cryptodev_sym_session_clear(worker->dev_id, sess);
- }
-}
+scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops scheduler_pmd_ops = {
.dev_configure = scheduler_pmd_config,
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 21bd996064..d3b799b28d 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -40,8 +40,7 @@ static void virtio_crypto_sym_clear_session(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
/*
* The set of PCI devices this driver supports
@@ -952,12 +951,7 @@ virtio_crypto_sym_clear_session(
hw = dev->data->dev_private;
vq = hw->cvq;
- session = (struct virtio_crypto_session *)get_sym_session_private_data(
- sess, cryptodev_virtio_driver_id);
- if (session == NULL) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid session parameter");
- return;
- }
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
VIRTIO_CRYPTO_SESSION_LOG_INFO("vq->vq_desc_head_idx = %d, "
"vq = %p", vq->vq_desc_head_idx, vq);
@@ -1070,10 +1064,6 @@ virtio_crypto_sym_clear_session(
VIRTIO_CRYPTO_SESSION_LOG_INFO("Close session %"PRIu64" successfully ",
session->session_id);
- memset(session, 0, sizeof(struct virtio_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(session);
- set_sym_session_private_data(sess, cryptodev_virtio_driver_id, NULL);
- rte_mempool_put(sess_mp, session);
rte_free(malloc_virt_addr);
}
@@ -1292,11 +1282,9 @@ static int
virtio_crypto_check_sym_configure_session_paras(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sym_sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sym_sess)
{
- if (unlikely(xform == NULL) || unlikely(sym_sess == NULL) ||
- unlikely(mempool == NULL)) {
+ if (unlikely(xform == NULL) || unlikely(sym_sess == NULL)) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("NULL pointer");
return -1;
}
@@ -1311,12 +1299,9 @@ static int
virtio_crypto_sym_configure_session(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
- struct virtio_crypto_session crypto_sess;
- void *session_private = &crypto_sess;
struct virtio_crypto_session *session;
struct virtio_crypto_op_ctrl_req *ctrl_req;
enum virtio_crypto_cmd_id cmd_id;
@@ -1328,19 +1313,12 @@ virtio_crypto_sym_configure_session(
PMD_INIT_FUNC_TRACE();
ret = virtio_crypto_check_sym_configure_session_paras(dev, xform,
- sess, mempool);
+ sess);
if (ret < 0) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid parameters");
return ret;
}
-
- if (rte_mempool_get(mempool, &session_private)) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
- session = (struct virtio_crypto_session *)session_private;
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
memset(session, 0, sizeof(struct virtio_crypto_session));
ctrl_req = &session->ctrl;
ctrl_req->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
@@ -1402,10 +1380,6 @@ virtio_crypto_sym_configure_session(
"Unsupported operation chain order parameter");
goto error_out;
}
-
- set_sym_session_private_data(sess, dev->driver_id,
- session_private);
-
return 0;
error_out:
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index 08359b3a39..b7f492a7f2 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -207,8 +207,7 @@ virtqueue_crypto_sym_enqueue_xmit(
offsetof(struct virtio_crypto_op_cookie, iv);
struct rte_crypto_sym_op *sym_op = cop->sym;
struct virtio_crypto_session *session =
- (struct virtio_crypto_session *)get_sym_session_private_data(
- cop->sym->session, cryptodev_virtio_driver_id);
+ (void *)cop->sym->session->driver_priv_data;
struct virtio_crypto_op_data_req *op_data_req;
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c
index 19af134bbe..bce903e007 100644
--- a/examples/fips_validation/fips_dev_self_test.c
+++ b/examples/fips_validation/fips_dev_self_test.c
@@ -969,7 +969,6 @@ struct fips_dev_auto_test_env {
struct rte_mempool *mpool;
struct rte_mempool *op_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mbuf *mbuf;
struct rte_crypto_op *op;
};
@@ -1479,13 +1478,8 @@ run_single_test(uint8_t dev_id,
return ret;
}
- sess = rte_cryptodev_sym_session_create(env->sess_pool);
- if (!sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(dev_id,
- sess, &xform, env->sess_priv_pool);
- if (ret < 0) {
+ sess = rte_cryptodev_sym_session_create(dev_id, &xform, env->sess_pool);
+ if (!sess) {
RTE_LOG(ERR, PMD, "Error %i: Init session\n", ret);
return ret;
}
@@ -1508,8 +1502,7 @@ run_single_test(uint8_t dev_id,
1);
} while (n_deqd == 0);
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(dev_id, sess);
if (env->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
return -1;
@@ -1527,7 +1520,6 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
rte_mempool_free(env->mpool);
rte_mempool_free(env->op_pool);
rte_mempool_free(env->sess_pool);
- rte_mempool_free(env->sess_priv_pool);
rte_cryptodev_stop(dev_id);
}
@@ -1535,7 +1527,7 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
static int
fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
{
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
struct rte_cryptodev_config conf;
char name[128];
@@ -1579,25 +1571,13 @@ fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
snprintf(name, 128, "%s%u", "SELF_TEST_SESS_POOL", dev_id);
env->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- 128, 0, 0, 0, rte_cryptodev_socket_id(dev_id));
+ 128, sess_sz, 0, 0, rte_cryptodev_socket_id(dev_id));
if (!env->sess_pool) {
ret = -ENOMEM;
goto error_exit;
}
- memset(name, 0, 128);
- snprintf(name, 128, "%s%u", "SELF_TEST_SESS_PRIV_POOL", dev_id);
-
- env->sess_priv_pool = rte_mempool_create(name,
- 128, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_cryptodev_socket_id(dev_id), 0);
- if (!env->sess_priv_pool) {
- ret = -ENOMEM;
- goto error_exit;
- }
-
qp_conf.mp_session = env->sess_pool;
- qp_conf.mp_session_private = env->sess_priv_pool;
ret = rte_cryptodev_queue_pair_setup(dev_id, 0, &qp_conf,
rte_cryptodev_socket_id(dev_id));
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e6c0b6a3a1..e73e6b09c3 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -55,7 +55,6 @@ struct cryptodev_fips_validate_env {
uint16_t mbuf_data_room;
struct rte_mempool *mpool;
struct rte_mempool *sess_mpool;
- struct rte_mempool *sess_priv_mpool;
struct rte_mempool *op_pool;
struct rte_mbuf *mbuf;
uint8_t *digest;
@@ -70,7 +69,7 @@ static int
cryptodev_fips_validate_app_int(void)
{
struct rte_cryptodev_config conf = {rte_socket_id(), 1, 0};
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
struct rte_cryptodev_info dev_info;
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
env.dev_id);
@@ -110,16 +109,11 @@ cryptodev_fips_validate_app_int(void)
ret = -ENOMEM;
env.sess_mpool = rte_cryptodev_sym_session_pool_create(
- "FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+ "FIPS_SESS_MEMPOOL", 16, sess_sz, 0, 0,
+ rte_socket_id());
if (!env.sess_mpool)
goto error_exit;
- env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
- 16, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_socket_id(), 0);
- if (!env.sess_priv_mpool)
- goto error_exit;
-
env.op_pool = rte_crypto_op_pool_create(
"FIPS_OP_POOL",
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -134,7 +128,6 @@ cryptodev_fips_validate_app_int(void)
goto error_exit;
qp_conf.mp_session = env.sess_mpool;
- qp_conf.mp_session_private = env.sess_priv_mpool;
ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
rte_socket_id());
@@ -151,7 +144,6 @@ cryptodev_fips_validate_app_int(void)
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
return ret;
@@ -162,11 +154,9 @@ cryptodev_fips_validate_app_uninit(void)
{
rte_pktmbuf_free(env.mbuf);
rte_crypto_op_free(env.op);
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
}
@@ -1202,13 +1192,9 @@ fips_run_test(void)
if (ret < 0)
return ret;
- env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
- if (!env.sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(env.dev_id,
- env.sess, &xform, env.sess_priv_mpool);
- if (ret < 0) {
+ env.sess = rte_cryptodev_sym_session_create(env.dev_id, &xform,
+ env.sess_mpool);
+ if (!env.sess) {
RTE_LOG(ERR, USER1, "Error %i: Init session\n",
ret);
goto exit;
@@ -1237,9 +1223,10 @@ fips_run_test(void)
vec.status = env.op->status;
exit:
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
- env.sess = NULL;
+ if (env.sess) {
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
+ env.sess = NULL;
+ }
return ret;
}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a4ac4174ba..338fbe6236 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1693,8 +1693,6 @@ cryptodevs_init(uint16_t req_queue_num)
qp_conf.nb_descriptors = qp_desc_nb;
qp_conf.mp_session =
socket_ctx[dev_conf.socket_id].session_pool;
- qp_conf.mp_session_private =
- socket_ctx[dev_conf.socket_id].session_priv_pool;
for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
&qp_conf, dev_conf.socket_id))
@@ -2501,12 +2499,8 @@ one_session_free(struct rte_ipsec_session *ips)
if (ips->crypto.ses == NULL)
return 0;
- ret = rte_cryptodev_sym_session_clear(ips->crypto.dev_id,
- ips->crypto.ses);
- if (ret)
- return ret;
-
- ret = rte_cryptodev_sym_session_free(ips->crypto.ses);
+ ret = rte_cryptodev_sym_session_free(ips->crypto.dev_id,
+ ips->crypto.ses);
} else {
/* Session has not been created */
if (ips->security.ctx == NULL || ips->security.ses == NULL)
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 7b7bfff696..bb84dcec7e 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -174,11 +174,8 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[],
}
ips->crypto.dev_id = cdev_id;
- ips->crypto.ses = rte_cryptodev_sym_session_create(
- skt_ctx->session_pool);
- rte_cryptodev_sym_session_init(cdev_id,
- ips->crypto.ses, sa->xforms,
- skt_ctx->session_priv_pool);
+ ips->crypto.ses = rte_cryptodev_sym_session_create(cdev_id,
+ sa->xforms, skt_ctx->session_pool);
rte_cryptodev_info_get(cdev_id, &cdev_info);
}
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index bf4b862379..b555e63ff6 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -228,7 +228,6 @@ struct rte_mempool *l2fwd_pktmbuf_pool;
struct rte_mempool *l2fwd_crypto_op_pool;
static struct {
struct rte_mempool *sess_mp;
- struct rte_mempool *priv_mp;
} session_pool_socket[RTE_MAX_NUMA_NODES];
/* Per-port statistics struct */
@@ -675,7 +674,6 @@ static struct rte_cryptodev_sym_session *
initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
{
struct rte_crypto_sym_xform *first_xform;
- struct rte_cryptodev_sym_session *session;
int retval = rte_cryptodev_socket_id(cdev_id);
if (retval < 0)
@@ -697,17 +695,8 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
first_xform = &options->auth_xform;
}
- session = rte_cryptodev_sym_session_create(
+ return rte_cryptodev_sym_session_create(cdev_id, first_xform,
session_pool_socket[socket_id].sess_mp);
- if (session == NULL)
- return NULL;
-
- if (rte_cryptodev_sym_session_init(cdev_id, session,
- first_xform,
- session_pool_socket[socket_id].priv_mp) < 0)
- return NULL;
-
- return session;
}
/* >8 End of creation of session. */
@@ -2380,13 +2369,10 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
rte_cryptodev_info_get(cdev_id, &dev_info);
- /*
- * Two sessions objects are required for each session
- * (one for the header, one for the private data)
- */
if (!strcmp(dev_info.driver_name, "crypto_scheduler")) {
#ifdef RTE_CRYPTO_SCHEDULER
- uint32_t nb_workers =
+ /* scheduler session header + 1 session per worker */
+ uint32_t nb_workers = 1 +
rte_cryptodev_scheduler_workers_get(cdev_id,
NULL);
@@ -2395,41 +2381,15 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
} else
sessions_needed = enabled_cdev_count;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- char mp_name[RTE_MEMPOOL_NAMESIZE];
-
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- session_pool_socket[socket_id].priv_mp =
- rte_mempool_create(mp_name,
- sessions_needed,
- max_sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- printf("Cannot create pool on socket %d\n",
- socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
char mp_name[RTE_MEMPOOL_NAMESIZE];
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
session_pool_socket[socket_id].sess_mp =
- rte_cryptodev_sym_session_pool_create(
- mp_name,
- sessions_needed,
- 0, 0, 0, socket_id);
-
+ rte_cryptodev_sym_session_pool_create(
+ mp_name, sessions_needed, max_sess_sz,
+ 0, 0, socket_id);
if (session_pool_socket[socket_id].sess_mp == NULL) {
printf("Cannot create pool on socket %d\n",
socket_id);
@@ -2580,8 +2540,6 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
qp_conf.nb_descriptors = 2048;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 7d75623a5e..02987ebd76 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,7 +46,6 @@ struct vhost_crypto_info {
int vids[MAX_NB_SOCKETS];
uint32_t nb_vids;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *cop_pool;
uint8_t cid;
uint32_t qid;
@@ -304,7 +303,6 @@ new_device(int vid)
}
ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
- info->sess_priv_pool,
rte_lcore_to_socket_id(options.los[i].lcore_id));
if (ret) {
RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -458,7 +456,6 @@ free_resource(void)
rte_mempool_free(info->cop_pool);
rte_mempool_free(info->sess_pool);
- rte_mempool_free(info->sess_priv_pool);
for (j = 0; j < lo->nb_sockets; j++) {
rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -544,16 +541,12 @@ main(int argc, char *argv[])
snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- SESSION_MAP_ENTRIES, 0, 0, 0,
- rte_lcore_to_socket_id(lo->lcore_id));
-
- snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
- info->sess_priv_pool = rte_mempool_create(name,
SESSION_MAP_ENTRIES,
rte_cryptodev_sym_get_private_session_size(
- info->cid), 64, 0, NULL, NULL, NULL, NULL,
- rte_lcore_to_socket_id(lo->lcore_id), 0);
- if (!info->sess_priv_pool || !info->sess_pool) {
+ info->cid), 0, 0,
+ rte_lcore_to_socket_id(lo->lcore_id));
+
+ if (!info->sess_pool) {
RTE_LOG(ERR, USER1, "Failed to create mempool");
goto error_exit;
}
@@ -574,7 +567,6 @@ main(int argc, char *argv[])
qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
qp_conf.mp_session = info->sess_pool;
- qp_conf.mp_session_private = info->sess_priv_pool;
for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
ret = rte_cryptodev_queue_pair_setup(info->cid, j,
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 09ba952455..8aa4fe4648 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -302,7 +302,6 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
* @param dev Crypto device pointer
* @param xform Single or chain of crypto xforms
* @param session Pointer to cryptodev's private session structure
- * @param mp Mempool where the private session is allocated
*
* @return
* - Returns 0 if private session structure have been created successfully.
@@ -312,8 +311,8 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
*/
typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
+
/**
* Configure a Crypto asymmetric session on a device.
*
@@ -338,6 +337,7 @@ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev,
*/
typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
+
/**
* Clear asymmetric session private data.
*
@@ -638,28 +638,6 @@ __rte_internal
void *
rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op);
-static inline void *
-get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id) {
- if (unlikely(sess->nb_drivers <= driver_id))
- return NULL;
-
- return sess->sess_data[driver_id].data;
-}
-
-static inline void
-set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id, void *private_data)
-{
- if (unlikely(sess->nb_drivers <= driver_id)) {
- CDEV_LOG_ERR("Set private data for driver %u not allowed",
- driver_id);
- return;
- }
-
- sess->sess_data[driver_id].data = private_data;
-}
-
/**
* @internal
* Cryptodev asymmetric crypto session.
diff --git a/lib/cryptodev/cryptodev_trace_points.c b/lib/cryptodev/cryptodev_trace_points.c
index 9f0ed904ea..727114aa45 100644
--- a/lib/cryptodev/cryptodev_trace_points.c
+++ b/lib/cryptodev/cryptodev_trace_points.c
@@ -39,12 +39,6 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_free,
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_session_free,
lib.cryptodev.asym.free)
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_init,
- lib.cryptodev.sym.init)
-
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_clear,
- lib.cryptodev.sym.clear)
-
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_enqueue_burst,
lib.cryptodev.enq.burst)
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 9e76a1c72d..6acd5f4d91 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -203,12 +203,9 @@ const char *rte_crypto_asym_ke_strings[] = {
[RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY] = "pub_ec_key_verify"
};
-/**
- * The private data structure stored in the sym session mempool private data.
- */
struct rte_cryptodev_sym_session_pool_private_data {
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint16_t sess_data_sz;
+ /**< driver session data size */
uint16_t user_data_sz;
/**< session user data will be placed after sess_data */
};
@@ -1332,6 +1329,24 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
return ret;
}
+static uint8_t
+rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp,
+ uint32_t sess_priv_size)
+{
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (!mp)
+ return 0;
+
+ pool_priv = rte_mempool_get_priv(mp);
+
+ if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
+ pool_priv->sess_data_sz < sess_priv_size)
+ return 0;
+
+ return 1;
+}
+
int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
@@ -1355,17 +1370,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
- (!qp_conf->mp_session && qp_conf->mp_session_private)) {
- CDEV_LOG_ERR("Invalid mempools");
- return -EINVAL;
- }
-
if (qp_conf->mp_session) {
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
- uint32_t obj_size = qp_conf->mp_session->elt_size;
- uint32_t obj_priv_size = qp_conf->mp_session_private->elt_size;
- struct rte_cryptodev_sym_session s = {0};
pool_priv = rte_mempool_get_priv(qp_conf->mp_session);
if (!pool_priv || qp_conf->mp_session->private_data_size <
@@ -1374,13 +1380,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- s.nb_drivers = pool_priv->nb_drivers;
- s.user_data_sz = pool_priv->user_data_sz;
-
- if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
- obj_size) || (s.nb_drivers <= dev->driver_id) ||
- rte_cryptodev_sym_get_private_session_size(dev_id) >
- obj_priv_size) {
+ if (!rte_cryptodev_sym_is_valid_session_pool(qp_conf->mp_session,
+ rte_cryptodev_sym_get_private_session_size(dev_id))) {
CDEV_LOG_ERR("Invalid mempool");
return -EINVAL;
}
@@ -1862,54 +1863,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
rte_spinlock_unlock(&rte_cryptodev_cb_lock);
}
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mp)
-{
- struct rte_cryptodev *dev;
- uint32_t sess_priv_sz = rte_cryptodev_sym_get_private_session_size(
- dev_id);
- uint8_t index;
- int ret;
-
- if (!rte_cryptodev_is_valid_dev(dev_id)) {
- CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
- return -EINVAL;
- }
-
- dev = rte_cryptodev_pmd_get_dev(dev_id);
-
- if (sess == NULL || xforms == NULL || dev == NULL || mp == NULL)
- return -EINVAL;
-
- if (mp->elt_size < sess_priv_sz)
- return -EINVAL;
-
- index = dev->driver_id;
- if (index >= sess->nb_drivers)
- return -EINVAL;
-
- if (*dev->dev_ops->sym_session_configure == NULL)
- return -ENOTSUP;
-
- if (sess->sess_data[index].refcnt == 0) {
- ret = dev->dev_ops->sym_session_configure(dev, xforms,
- sess, mp);
- if (ret < 0) {
- CDEV_LOG_ERR(
- "dev_id %d failed to configure session details",
- dev_id);
- return ret;
- }
- }
-
- rte_cryptodev_trace_sym_session_init(dev_id, sess, xforms, mp);
- sess->sess_data[index].refcnt++;
- return 0;
-}
-
struct rte_mempool *
rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
@@ -1919,16 +1872,12 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
uint32_t obj_sz;
- obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
- if (obj_sz > elt_size)
- CDEV_LOG_INFO("elt_size %u is expanded to %u", elt_size,
- obj_sz);
- else
- obj_sz = elt_size;
+ obj_sz = sizeof(struct rte_cryptodev_sym_session) + elt_size + user_data_size;
+ obj_sz = RTE_ALIGN_CEIL(obj_sz, RTE_CACHE_LINE_SIZE);
mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
- (uint32_t)(sizeof(*pool_priv)),
- NULL, NULL, NULL, NULL,
+ (uint32_t)(sizeof(*pool_priv)), NULL, NULL,
+ NULL, NULL,
socket_id, 0);
if (mp == NULL) {
CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d",
@@ -1944,7 +1893,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
return NULL;
}
- pool_priv->nb_drivers = nb_drivers;
+ pool_priv->sess_data_sz = elt_size;
pool_priv->user_data_sz = user_data_size;
rte_cryptodev_trace_sym_session_pool_create(name, nb_elts,
@@ -2002,64 +1951,71 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
return mp;
}
-static unsigned int
-rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
-{
- return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
- sess->user_data_sz;
-}
-
-static uint8_t
-rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp)
-{
- struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
-
- if (!mp)
- return 0;
-
- pool_priv = rte_mempool_get_priv(mp);
-
- if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
- pool_priv->nb_drivers != nb_drivers ||
- mp->elt_size <
- rte_cryptodev_sym_get_header_session_size()
- + pool_priv->user_data_sz)
- return 0;
-
- return 1;
-}
-
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mp)
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp)
{
+ struct rte_cryptodev *dev;
struct rte_cryptodev_sym_session *sess;
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+ uint32_t sess_priv_sz;
+ int ret;
- if (!rte_cryptodev_sym_is_valid_session_pool(mp)) {
+ if (!rte_cryptodev_is_valid_dev(dev_id)) {
+ CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
+ if (xforms == NULL) {
+ CDEV_LOG_ERR("Invalid xform\n");
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
+ sess_priv_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
+ if (!rte_cryptodev_sym_is_valid_session_pool(mp, sess_priv_sz)) {
CDEV_LOG_ERR("Invalid mempool");
+ rte_errno = EINVAL;
return NULL;
}
- pool_priv = rte_mempool_get_priv(mp);
+ dev = rte_cryptodev_pmd_get_dev(dev_id);
/* Allocate a session structure from the session pool */
if (rte_mempool_get(mp, (void **)&sess)) {
CDEV_LOG_ERR("couldn't get object from session mempool");
+ rte_errno = ENOMEM;
return NULL;
}
- sess->nb_drivers = pool_priv->nb_drivers;
+ pool_priv = rte_mempool_get_priv(mp);
+ sess->driver_id = dev->driver_id;
+ sess->sess_data_sz = pool_priv->sess_data_sz;
sess->user_data_sz = pool_priv->user_data_sz;
- sess->opaque_data = 0;
+ sess->driver_priv_data_iova = rte_mempool_virt2iova(sess) +
+ offsetof(struct rte_cryptodev_sym_session, driver_priv_data);
- /* Clear device session pointer.
- * Include the flag indicating presence of user data
- */
- memset(sess->sess_data, 0,
- rte_cryptodev_sym_session_data_size(sess));
+ if (dev->dev_ops->sym_session_configure == NULL) {
+ rte_errno = ENOTSUP;
+ goto error_exit;
+ }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz + pool_priv->user_data_sz);
- rte_cryptodev_trace_sym_session_create(mp, sess);
- return sess;
+ ret = dev->dev_ops->sym_session_configure(dev, xforms, sess);
+ if (ret < 0) {
+ rte_errno = -ret;
+ goto error_exit;
+ }
+ sess->driver_id = dev->driver_id;
+
+ rte_cryptodev_trace_sym_session_create(dev_id, sess, xforms, mp);
+
+ return (void *)sess;
+error_exit:
+ rte_mempool_put(mp, (void *)sess);
+ return NULL;
}
int
@@ -2139,11 +2095,15 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
}
int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_cryptodev *dev;
- uint8_t driver_id;
+ struct rte_mempool *sess_mp;
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (sess == NULL)
+ return -EINVAL;
if (!rte_cryptodev_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
@@ -2155,41 +2115,28 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
if (dev == NULL || sess == NULL)
return -EINVAL;
- driver_id = dev->driver_id;
- if (sess->sess_data[driver_id].refcnt == 0)
- return 0;
- if (--sess->sess_data[driver_id].refcnt != 0)
- return -EBUSY;
+ sess_mp = rte_mempool_from_obj(sess);
+ if (!sess_mp)
+ return -EINVAL;
+ pool_priv = rte_mempool_get_priv(sess_mp);
+
+ if (sess->driver_id != dev->driver_id) {
+ CDEV_LOG_ERR("Session created by driver %u but freed by %u",
+ sess->driver_id, dev->driver_id);
+ return -EINVAL;
+ }
if (*dev->dev_ops->sym_session_clear == NULL)
return -ENOTSUP;
dev->dev_ops->sym_session_clear(dev, sess);
- rte_cryptodev_trace_sym_session_clear(dev_id, sess);
- return 0;
-}
-
-int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
-{
- uint8_t i;
- struct rte_mempool *sess_mp;
-
- if (sess == NULL)
- return -EINVAL;
-
- /* Check that all device private data has been freed */
- for (i = 0; i < sess->nb_drivers; i++) {
- if (sess->sess_data[i].refcnt != 0)
- return -EBUSY;
- }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz + pool_priv->user_data_sz);
/* Return session to mempool */
- sess_mp = rte_mempool_from_obj(sess);
rte_mempool_put(sess_mp, sess);
- rte_cryptodev_trace_sym_session_free(sess);
+ rte_cryptodev_trace_sym_session_free(dev_id, sess);
return 0;
}
@@ -2224,33 +2171,6 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
return 0;
}
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void)
-{
- /*
- * Header contains pointers to the private data of all registered
- * drivers and all necessary information to ensure safely clear
- * or free al session.
- */
- struct rte_cryptodev_sym_session s = {0};
-
- s.nb_drivers = nb_drivers;
-
- return (unsigned int)(sizeof(s) +
- rte_cryptodev_sym_session_data_size(&s));
-}
-
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess)
-{
- if (!sess)
- return 0;
- else
- return (unsigned int)(sizeof(*sess) +
- rte_cryptodev_sym_session_data_size(sess));
-}
-
unsigned int
rte_cryptodev_asym_get_header_session_size(void)
{
@@ -2303,9 +2223,8 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
int
rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess,
- void *data,
- uint16_t size)
+ struct rte_cryptodev_sym_session *sess, void *data,
+ uint16_t size)
{
if (sess == NULL)
return -EINVAL;
@@ -2313,7 +2232,7 @@ rte_cryptodev_sym_session_set_user_data(
if (sess->user_data_sz < size)
return -ENOMEM;
- rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
+ rte_memcpy(sess->driver_priv_data + sess->sess_data_sz, data, size);
rte_cryptodev_trace_sym_session_set_user_data(sess, data, size);
@@ -2321,15 +2240,14 @@ rte_cryptodev_sym_session_set_user_data(
}
void *
-rte_cryptodev_sym_session_get_user_data(
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_get_user_data(struct rte_cryptodev_sym_session *sess)
{
void *data = NULL;
if (sess == NULL || sess->user_data_sz == 0)
return NULL;
- data = (void *)(sess->sess_data + sess->nb_drivers);
+ data = (void *)(sess->driver_priv_data + sess->sess_data_sz);
rte_cryptodev_trace_sym_session_get_user_data(sess, data);
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56f459c6a0..0c65958f25 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -544,8 +544,6 @@ struct rte_cryptodev_qp_conf {
uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
struct rte_mempool *mp_session;
/**< The mempool for creating session in sessionless mode */
- struct rte_mempool *mp_session_private;
- /**< The mempool for creating sess private data in sessionless mode */
};
/**
@@ -909,17 +907,21 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id);
* has a fixed algo, key, op-type, digest_len etc.
*/
struct rte_cryptodev_sym_session {
+ RTE_MARKER cacheline0;
+ uint8_t driver_id;
uint64_t opaque_data;
/**< Can be used for external metadata */
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint32_t sess_data_sz;
+ /**< Pointer to the user data stored after sess data */
uint16_t user_data_sz;
- /**< session user data will be placed after sess_data */
- __extension__ struct {
- void *data;
- uint16_t refcnt;
- } sess_data[];
- /**< Driver specific session material, variable size */
+ /**< session user data will be placed after sess data */
+ rte_iova_t driver_priv_data_iova;
+ /**< session driver data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ /**< second cache line - start of the driver session data */
+ uint8_t driver_priv_data[0];
+ /**< Driver specific session data, variable size */
};
/**
@@ -954,6 +956,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
int socket_id);
+
/**
* Create an asymmetric session mempool.
*
@@ -980,17 +983,22 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t cache_size, uint16_t user_data_size, int socket_id);
/**
- * Create symmetric crypto session header (generic with no private data)
+ * Create symmetric crypto session and fill out private data for the device id,
+ * based on its device type.
+ *
+ * @param dev_id ID of device that we want the session to be used on
+ * @param xforms Symmetric crypto transform operations to apply on flow
+ * processed with this session
+ * @param mempool Mempool where the private data is allocated.
*
- * @param mempool Symmetric session mempool to allocate session
- * objects from
* @return
- * - On success return pointer to sym-session
- * - On failure returns NULL
+ * - On success return pointer to sym-session.
+ * - On failure returns NULL.
*/
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
-
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp);
/**
* Create and initialise an asymmetric crypto session structure.
* Calls the PMD to configure the private session data.
@@ -1015,19 +1023,20 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
void **session);
/**
- * Frees symmetric crypto session header, after checking that all
- * the device private data has been freed, returning it
- * to its original mempool.
+ * Frees session for the device id and returning it to its mempool.
+ * It is the application's responsibility to ensure that the session
+ * is not still in-flight operations using it.
*
+ * @param dev_id ID of device that uses the session.
* @param sess Session header to be freed.
*
* @return
* - 0 if successful.
- * - -EINVAL if session is NULL.
- * - -EBUSY if not all device private data has been freed.
+ * - -EINVAL if session is NULL or the mismatched device ids.
*/
int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess);
/**
* Clears and frees asymmetric crypto session header and private data,
@@ -1044,72 +1053,6 @@ __rte_experimental
int
rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess);
-/**
- * Fill out private data for the device id, based on its device type.
- *
- * @param dev_id ID of device that we want the session to be used on
- * @param sess Session where the private data will be attached to
- * @param xforms Symmetric crypto transform operations to apply on flow
- * processed with this session
- * @param mempool Mempool where the private data is allocated.
- *
- * @return
- * - On success, zero.
- * - -EINVAL if input parameters are invalid.
- * - -ENOTSUP if crypto device does not support the crypto transform or
- * does not support symmetric operations.
- * - -ENOMEM if the private session could not be allocated.
- */
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mempool);
-
-/**
- * Frees private data for the device id, based on its device type,
- * returning it to its mempool. It is the application's responsibility
- * to ensure that private session data is not cleared while there are
- * still in-flight operations using it.
- *
- * @param dev_id ID of device that uses the session.
- * @param sess Session containing the reference to the private data
- *
- * @return
- * - 0 if successful.
- * - -EINVAL if device is invalid or session is NULL.
- * - -ENOTSUP if crypto device does not support symmetric operations.
- */
-int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess);
-
-/**
- * Get the size of the header session, for all registered drivers excluding
- * the user data size.
- *
- * @return
- * Size of the symmetric header session.
- */
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void);
-
-/**
- * Get the size of the header session from created session.
- *
- * @param sess
- * The sym cryptodev session pointer
- *
- * @return
- * - If sess is not NULL, return the size of the header session including
- * the private data size defined within sess.
- * - If sess is NULL, return 0.
- */
-__rte_experimental
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess);
-
/**
* Get the size of the asymmetric session header.
*
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index 3d9b00145e..6ade0b72c4 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -56,7 +56,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u16(queue_pair_id);
rte_trace_point_emit_u32(conf->nb_descriptors);
rte_trace_point_emit_ptr(conf->mp_session);
- rte_trace_point_emit_ptr(conf->mp_session_private);
)
RTE_TRACE_POINT(
@@ -74,13 +73,16 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_create,
- RTE_TRACE_POINT_ARGS(void *mempool,
- struct rte_cryptodev_sym_session *sess),
- rte_trace_point_emit_ptr(mempool);
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess, void *xforms,
+ void *mempool),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
+ rte_trace_point_emit_u8(sess->driver_id);
rte_trace_point_emit_u16(sess->user_data_sz);
+ rte_trace_point_emit_ptr(xforms);
+ rte_trace_point_emit_ptr(mempool);
)
RTE_TRACE_POINT(
@@ -106,7 +108,8 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_free,
- RTE_TRACE_POINT_ARGS(struct rte_cryptodev_sym_session *sess),
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id, struct rte_cryptodev_sym_session *sess),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
)
@@ -117,27 +120,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_ptr(sess);
)
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_init,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, void *xforms,
- void *mempool),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
- rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
- rte_trace_point_emit_u16(sess->user_data_sz);
- rte_trace_point_emit_ptr(xforms);
- rte_trace_point_emit_ptr(mempool);
-)
-
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_clear,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id, void *sess),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
-)
-
RTE_TRACE_POINT(
rte_cryptodev_trace_callback_register,
RTE_TRACE_POINT_ARGS(uint8_t dev_id,
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 6d9b3e01a6..d9ccb10197 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -38,12 +38,9 @@ DPDK_23 {
rte_cryptodev_sym_capability_check_auth;
rte_cryptodev_sym_capability_check_cipher;
rte_cryptodev_sym_capability_get;
- rte_cryptodev_sym_get_header_session_size;
rte_cryptodev_sym_get_private_session_size;
- rte_cryptodev_sym_session_clear;
rte_cryptodev_sym_session_create;
rte_cryptodev_sym_session_free;
- rte_cryptodev_sym_session_init;
local: *;
};
@@ -60,7 +57,6 @@ EXPERIMENTAL {
rte_cryptodev_asym_xform_capability_check_modlen;
rte_cryptodev_asym_xform_capability_check_optype;
rte_cryptodev_sym_cpu_crypto_process;
- rte_cryptodev_sym_get_existing_header_session_size;
rte_cryptodev_sym_session_get_user_data;
rte_cryptodev_sym_session_pool_create;
rte_cryptodev_sym_session_set_user_data;
@@ -78,8 +74,6 @@ EXPERIMENTAL {
__rte_cryptodev_trace_asym_session_create;
__rte_cryptodev_trace_sym_session_free;
__rte_cryptodev_trace_asym_session_free;
- __rte_cryptodev_trace_sym_session_init;
- __rte_cryptodev_trace_sym_session_clear;
__rte_cryptodev_trace_dequeue_burst;
__rte_cryptodev_trace_enqueue_burst;
diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c
index b1310be565..cb792bbe0d 100644
--- a/lib/pipeline/rte_table_action.c
+++ b/lib/pipeline/rte_table_action.c
@@ -1898,17 +1898,11 @@ sym_crypto_apply(struct sym_crypto_data *data,
}
}
- session = rte_cryptodev_sym_session_create(cfg->mp_create);
+ session = rte_cryptodev_sym_session_create(cfg->cryptodev_id,
+ p->xform, cfg->mp_create);
if (!session)
return -ENOMEM;
- ret = rte_cryptodev_sym_session_init(cfg->cryptodev_id, session,
- p->xform, cfg->mp_init);
- if (ret < 0) {
- rte_cryptodev_sym_session_free(session);
- return ret;
- }
-
data->data_offset = (uint16_t)p->data_offset;
data->session = session;
diff --git a/lib/vhost/rte_vhost_crypto.h b/lib/vhost/rte_vhost_crypto.h
index b49e389579..2b01ecda08 100644
--- a/lib/vhost/rte_vhost_crypto.h
+++ b/lib/vhost/rte_vhost_crypto.h
@@ -54,8 +54,6 @@ rte_vhost_crypto_driver_start(const char *path);
* multiple Vhost-crypto devices.
* @param sess_pool
* The pointer to the created cryptodev session pool.
- * @param sess_priv_pool
- * The pointer to the created cryptodev session private data mempool.
* @param socket_id
* NUMA Socket ID to allocate resources on. *
* @return
@@ -65,7 +63,6 @@ rte_vhost_crypto_driver_start(const char *path);
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id);
/**
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 54946f46d9..7321da21b7 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -197,7 +197,6 @@ struct vhost_crypto {
struct rte_hash *session_map;
struct rte_mempool *mbuf_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *wb_pool;
/** DPDK cryptodev ID */
@@ -376,31 +375,21 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
return;
}
- session = rte_cryptodev_sym_session_create(vcrypto->sess_pool);
+ session = rte_cryptodev_sym_session_create(vcrypto->cid, &xform1,
+ vcrypto->sess_pool);
if (!session) {
VC_LOG_ERR("Failed to create session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
- if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
- vcrypto->sess_priv_pool) < 0) {
- VC_LOG_ERR("Failed to initialize session");
- sess_param->session_id = -VIRTIO_CRYPTO_ERR;
- return;
- }
-
/* insert hash to map */
if (rte_hash_add_key_data(vcrypto->session_map,
&vcrypto->last_session_id, session) < 0) {
VC_LOG_ERR("Failed to insert session to hash table");
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0)
- VC_LOG_ERR("Failed to clear session");
- else {
- if (rte_cryptodev_sym_session_free(session) < 0)
- VC_LOG_ERR("Failed to free session");
- }
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0)
+ VC_LOG_ERR("Failed to free session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
@@ -427,12 +416,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
return -VIRTIO_CRYPTO_INVSESS;
}
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
- VC_LOG_DBG("Failed to clear session");
- return -VIRTIO_CRYPTO_ERR;
- }
-
- if (rte_cryptodev_sym_session_free(session) < 0) {
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0) {
VC_LOG_DBG("Failed to free session");
return -VIRTIO_CRYPTO_ERR;
}
@@ -1393,7 +1377,6 @@ rte_vhost_crypto_driver_start(const char *path)
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id)
{
struct virtio_net *dev = get_device(vid);
@@ -1415,7 +1398,6 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
}
vcrypto->sess_pool = sess_pool;
- vcrypto->sess_priv_pool = sess_priv_pool;
vcrypto->cid = cryptodev_id;
vcrypto->cache_session_id = UINT64_MAX;
vcrypto->last_session_id = 1;
--
2.25.1
^ permalink raw reply [relevance 1%]
* [PATCH v10 1/7] bbdev: allow operation type enum for growth
@ 2022-09-30 18:45 3% ` Nicolas Chautru
1 sibling, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-09-30 18:45 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
Updating the enum for rte_bbdev_op_type
to allow to keep ABI compatible for enum insertion
while adding padded maximum value for array need.
Removing RTE_BBDEV_OP_TYPE_COUNT and instead exposing
RTE_BBDEV_OP_TYPE_SIZE_MAX.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
app/test-bbdev/test_bbdev.c | 2 +-
app/test-bbdev/test_bbdev_perf.c | 4 ++--
examples/bbdev_app/main.c | 2 +-
lib/bbdev/rte_bbdev.c | 8 +++++---
lib/bbdev/rte_bbdev_op.h | 12 ++++++++++--
5 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c
index ac06d7320a..65805977ae 100644
--- a/app/test-bbdev/test_bbdev.c
+++ b/app/test-bbdev/test_bbdev.c
@@ -521,7 +521,7 @@ test_bbdev_op_pool(void)
rte_mempool_free(mp);
TEST_ASSERT((mp = rte_bbdev_op_pool_create("Test_INV",
- RTE_BBDEV_OP_TYPE_COUNT, size, cache_size, 0)) == NULL,
+ RTE_BBDEV_OP_TYPE_SIZE_MAX, size, cache_size, 0)) == NULL,
"Failed test for rte_bbdev_op_pool_create: "
"returned value is not NULL for invalid type");
diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index fad3b1e49d..1abda2d995 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -2428,13 +2428,13 @@ run_test_case_on_device(test_case_function *test_case_func, uint8_t dev_id,
/* Find capabilities */
const struct rte_bbdev_op_cap *cap = info.drv.capabilities;
- for (i = 0; i < RTE_BBDEV_OP_TYPE_COUNT; i++) {
+ do {
if (cap->type == test_vector.op_type) {
capabilities = cap;
break;
}
cap++;
- }
+ } while (cap->type != RTE_BBDEV_OP_NONE);
TEST_ASSERT_NOT_NULL(capabilities,
"Couldn't find capabilities");
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index fc7e8b8174..7e16e16bf8 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -1041,7 +1041,7 @@ main(int argc, char **argv)
void *sigret;
struct app_config_params app_params = def_app_config;
struct rte_mempool *ethdev_mbuf_mempool, *bbdev_mbuf_mempool;
- struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_COUNT];
+ struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_SIZE_MAX];
struct lcore_conf lcore_conf[RTE_MAX_LCORE] = { {0} };
struct lcore_statistics lcore_stats[RTE_MAX_LCORE] = { {0} };
struct stats_lcore_params stats_lcore;
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index aaee7b7872..4da80472a8 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -23,6 +23,8 @@
#define DEV_NAME "BBDEV"
+/* Number of supported operation types */
+#define BBDEV_OP_TYPE_COUNT 5
/* BBDev library logging ID */
RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE);
@@ -890,10 +892,10 @@ rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
return NULL;
}
- if (type >= RTE_BBDEV_OP_TYPE_COUNT) {
+ if (type >= BBDEV_OP_TYPE_COUNT) {
rte_bbdev_log(ERR,
"Invalid op type (%u), should be less than %u",
- type, RTE_BBDEV_OP_TYPE_COUNT);
+ type, BBDEV_OP_TYPE_COUNT);
return NULL;
}
@@ -1125,7 +1127,7 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
"RTE_BBDEV_OP_LDPC_ENC",
};
- if (op_type < RTE_BBDEV_OP_TYPE_COUNT)
+ if (op_type < BBDEV_OP_TYPE_COUNT)
return op_types[op_type];
rte_bbdev_log(ERR, "Invalid operation type");
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index 6d561334e8..4f1cff8412 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -48,6 +48,12 @@ extern "C" {
/* LDPC: Maximum number of Code Blocks in Transport Block.*/
#define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
+/*
+ * Maximum size to be used to manage the enum rte_bbdev_op_type including padding for future
+ * enum insertion
+ */
+#define RTE_BBDEV_OP_TYPE_SIZE_MAX 8
+
/** Flags for turbo decoder operation and capability structure */
enum rte_bbdev_op_td_flag_bitmasks {
/** If sub block de-interleaving is to be performed. */
@@ -741,14 +747,16 @@ struct rte_bbdev_op_cap_ldpc_enc {
uint16_t num_buffers_dst;
};
-/** Different operation types supported by the device */
+/** Different operation types supported by the device
+ * The related macro RTE_BBDEV_OP_TYPE_SIZE_MAX can be used as an absolute maximum for
+ * notably sizing array while allowing for future enumeration insertion.
+ */
enum rte_bbdev_op_type {
RTE_BBDEV_OP_NONE, /**< Dummy operation that does nothing */
RTE_BBDEV_OP_TURBO_DEC, /**< Turbo decode */
RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */
RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */
RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */
- RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */
};
/** Bit indexes of possible errors reported through status field */
--
2.37.1
^ permalink raw reply [relevance 3%]
* RE: [PATCH v3] ethdev: queue rate parameter changed from 16b to 32b
2022-09-28 5:51 3% ` [PATCH v3] " skoteshwar
@ 2022-09-30 9:57 3% ` Satha Koteswara Rao Kottidi
2022-10-03 5:42 2% ` Satha Koteswara Rao Kottidi
0 siblings, 1 reply; 200+ results
From: Satha Koteswara Rao Kottidi @ 2022-09-30 9:57 UTC (permalink / raw)
To: Satha Koteswara Rao Kottidi, Aman Singh, Yuying Zhang,
Ray Kinsella, Ajit Khaparde, Somnath Kotur,
Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
Sunil Kumar Kori, Qiming Yang, Wenjun Wu, Jiawen Wu, Jian Wang,
Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: dev, ferruh.yigit, bruce.richardson, konstantin.v.ananyev,
Jerin Jacob Kollanukkaran
Hi All,
Could you please review and provide suggestions if any.
Thanks,
Satha.
-----Original Message-----
From: skoteshwar@marvell.com <skoteshwar@marvell.com>
Sent: Wednesday, September 28, 2022 11:22 AM
To: Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang <yuying.zhang@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Ajit Khaparde <ajit.khaparde@broadcom.com>; Somnath Kotur <somnath.kotur@broadcom.com>; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha Koteswara Rao Kottidi <skoteshwar@marvell.com>; Qiming Yang <qiming.yang@intel.com>; Wenjun Wu <wenjun1.wu@intel.com>; Jiawen Wu <jiawenwu@trustnetic.com>; Jian Wang <jianwang@trustnetic.com>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@xilinx.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev@dpdk.org; ferruh.yigit@amd.com; bruce.richardson@intel.com; konstantin.v.ananyev@yandex.ru; Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Subject: [PATCH v3] ethdev: queue rate parameter changed from 16b to 32b
From: Satha Rao <skoteshwar@marvell.com>
The rate parameter modified to uint32_t, so that it can work for more than 64 Gbps.
Signed-off-by: Satha Rao <skoteshwar@marvell.com>
---
v2: Fixed checkpatch warnings
v3: updated release notes, cleanup deprecation, addressed review comments
app/test-pmd/cmdline.c | 8 ++++----
app/test-pmd/config.c | 4 ++--
app/test-pmd/testpmd.h | 4 ++--
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_22_11.rst | 3 +++
drivers/net/bnxt/rte_pmd_bnxt.c | 4 ++--
drivers/net/bnxt/rte_pmd_bnxt.h | 2 +-
drivers/net/cnxk/cnxk_ethdev.h | 2 +-
drivers/net/cnxk/cnxk_tm.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/ixgbe/ixgbe_ethdev.h | 4 ++--
drivers/net/ixgbe/rte_pmd_ixgbe.c | 2 +-
drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +-
drivers/net/txgbe/txgbe_ethdev.c | 2 +-
drivers/net/txgbe/txgbe_ethdev.h | 2 +-
lib/ethdev/ethdev_driver.h | 2 +-
lib/ethdev/rte_ethdev.c | 2 +-
lib/ethdev/rte_ethdev.h | 2 +-
18 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 51321de..adfdc1d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -8106,7 +8106,7 @@ struct cmd_queue_rate_limit_result {
cmdline_fixed_string_t queue;
uint8_t queue_num;
cmdline_fixed_string_t rate;
- uint16_t rate_num;
+ uint32_t rate_num;
};
static void cmd_queue_rate_limit_parsed(void *parsed_result, @@ -8147,7 +8147,7 @@ static void cmd_queue_rate_limit_parsed(void *parsed_result,
rate, "rate");
static cmdline_parse_token_num_t cmd_queue_rate_limit_ratenum =
TOKEN_NUM_INITIALIZER(struct cmd_queue_rate_limit_result,
- rate_num, RTE_UINT16);
+ rate_num, RTE_UINT32);
static cmdline_parse_inst_t cmd_queue_rate_limit = {
.f = cmd_queue_rate_limit_parsed,
@@ -8174,7 +8174,7 @@ struct cmd_vf_rate_limit_result {
cmdline_fixed_string_t vf;
uint8_t vf_num;
cmdline_fixed_string_t rate;
- uint16_t rate_num;
+ uint32_t rate_num;
cmdline_fixed_string_t q_msk;
uint64_t q_msk_val;
};
@@ -8218,7 +8218,7 @@ static void cmd_vf_rate_limit_parsed(void *parsed_result,
rate, "rate");
static cmdline_parse_token_num_t cmd_vf_rate_limit_ratenum =
TOKEN_NUM_INITIALIZER(struct cmd_vf_rate_limit_result,
- rate_num, RTE_UINT16);
+ rate_num, RTE_UINT32);
static cmdline_parse_token_string_t cmd_vf_rate_limit_q_msk =
TOKEN_STRING_INITIALIZER(struct cmd_vf_rate_limit_result,
q_msk, "queue_mask");
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index c90cdfe..6dd543d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -5914,7 +5914,7 @@ struct igb_ring_desc_16_bytes { }
int
-set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
+set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint32_t
+rate)
{
int diag;
struct rte_eth_link link;
@@ -5942,7 +5942,7 @@ struct igb_ring_desc_16_bytes { }
int
-set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
+set_vf_rate_limit(portid_t port_id, uint16_t vf, uint32_t rate,
+uint64_t q_msk)
{
int diag = -ENOTSUP;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index ddf5e21..0af3aa1 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1097,8 +1097,8 @@ void port_rss_reta_info(portid_t port_id,
uint16_t nb_rx_desc, unsigned int socket_id,
struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp);
-int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate); -int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
+int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint32_t
+rate); int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint32_t
+rate,
uint64_t q_msk);
int set_rxq_avail_thresh(portid_t port_id, uint16_t queue_id, diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e0fa5ef..9292080 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -87,11 +87,6 @@ Deprecation Notices
us extending existing enum/define.
One solution can be using a fixed size array instead of ``.*MAX.*`` value.
-* ethdev: The function ``rte_eth_set_queue_rate_limit`` takes ``rate`` in Mbps.
- The queue rate is limited to 64 Gbps because declared as ``uint16_t``.
- The ``rate`` parameter will be modified to ``uint32_t`` in DPDK 22.11
- so that it can work for more than 64 Gbps.
-
* ethdev: Since no single PMD supports ``RTE_ETH_RX_OFFLOAD_HEADER_SPLIT``
offload and the ``split_hdr_size`` field in structure ``rte_eth_rxmode``
to enable per-port header split, they will be removed in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2e076ba..3c7e471 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -129,6 +129,9 @@ API Changes
configuration (``dev_conf.fdir_conf``). Moved corresponding structures
to internal API since some drivers still use it internally.
+* ethdev: The type of parameter ``rate`` of the
+``rte_eth_set_queue_rate_limit``
+ changed from ``uint16_t`` to ``uint32_t`` to support more than 64 Gbps.
+
ABI Changes
-----------
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index 77ecbef..4dc38a2 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -172,12 +172,12 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, }
int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *eth_dev;
struct rte_eth_dev_info dev_info;
struct bnxt *bp;
- uint16_t tot_rate = 0;
+ uint32_t tot_rate = 0;
uint64_t idx;
int rc;
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h index 86b8d71..174c18a 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -184,7 +184,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
* - (-EINVAL) if *vf* or *mac_addr* is invalid.
*/
int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
/**
* Get VF's statistics
diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index c09e9bf..5204c46 100644
--- a/drivers/net/cnxk/cnxk_ethdev.h
+++ b/drivers/net/cnxk/cnxk_ethdev.h
@@ -558,7 +558,7 @@ int cnxk_nix_timesync_write_time(struct rte_eth_dev *eth_dev, uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev); int cnxk_nix_tm_ops_get(struct rte_eth_dev *eth_dev, void *ops); int cnxk_nix_tm_set_queue_rate_limit(struct rte_eth_dev *eth_dev,
- uint16_t queue_idx, uint16_t tx_rate);
+ uint16_t queue_idx, uint32_t tx_rate);
int cnxk_nix_tm_mark_vlan_dei(struct rte_eth_dev *eth_dev, int mark_green,
int mark_yellow, int mark_red,
struct rte_tm_error *error);
diff --git a/drivers/net/cnxk/cnxk_tm.c b/drivers/net/cnxk/cnxk_tm.c index d45e70a..9d8cd3f 100644
--- a/drivers/net/cnxk/cnxk_tm.c
+++ b/drivers/net/cnxk/cnxk_tm.c
@@ -751,7 +751,7 @@ struct rte_tm_ops cnxk_tm_ops = {
int
cnxk_nix_tm_set_queue_rate_limit(struct rte_eth_dev *eth_dev,
- uint16_t queue_idx, uint16_t tx_rate_mbps)
+ uint16_t queue_idx, uint32_t tx_rate_mbps)
{
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
uint64_t tx_rate = tx_rate_mbps * (uint64_t)1E6; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 1dfad0e..9ff8ee0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2475,7 +2475,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev)
int
ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct ixgbe_hw *hw;
struct ixgbe_vf_info *vfinfo;
@@ -6090,7 +6090,7 @@ static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on)
int
ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
- uint16_t queue_idx, uint16_t tx_rate)
+ uint16_t queue_idx, uint32_t tx_rate)
{
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t rf_dec, rf_int;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 0773a7e..b4db3f4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -753,13 +753,13 @@ void ixgbe_fdir_stats_get(struct rte_eth_dev *dev,
int ixgbe_vt_check(struct ixgbe_hw *hw); int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
bool is_ixgbe_supported(struct rte_eth_dev *dev); int ixgbe_tm_ops_get(struct rte_eth_dev *dev, void *ops); void ixgbe_tm_conf_init(struct rte_eth_dev *dev); void ixgbe_tm_conf_uninit(struct rte_eth_dev *dev); int ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
int ixgbe_rss_conf_init(struct ixgbe_rte_flow_rss_conf *out,
const struct rte_flow_action_rss *in); int ixgbe_action_rss_same(const struct rte_flow_action_rss *comp, diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f85..4ff7f37 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -498,7 +498,7 @@
int
rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *dev;
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index 426fe58..7ca1126 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -380,7 +380,7 @@ int rte_pmd_ixgbe_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
* - (-EINVAL) if bad parameter.
*/
int rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
/**
* Set all the TCs' bandwidth weight.
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 4422472..86ef979 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -3764,7 +3764,7 @@ static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
int
txgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
- uint16_t queue_idx, uint16_t tx_rate)
+ uint16_t queue_idx, uint32_t tx_rate)
{
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
uint32_t bcnrc_val;
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index e425ab4..5171a6c 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -586,7 +586,7 @@ int txgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf, void txgbe_tm_conf_init(struct rte_eth_dev *dev); void txgbe_tm_conf_uninit(struct rte_eth_dev *dev); int txgbe_set_queue_rate_limit(struct rte_eth_dev *dev, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
int txgbe_rss_conf_init(struct txgbe_rte_flow_rss_conf *out,
const struct rte_flow_action_rss *in); int txgbe_action_rss_same(const struct rte_flow_action_rss *comp, diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index a0e0b2a..a89450c 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -598,7 +598,7 @@ typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
/** @internal Set queue Tx rate. */
typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
/** @internal Add tunneling UDP port. */ typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 1979dc0..4b11dae 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -4388,7 +4388,7 @@ enum {
}
int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
- uint16_t tx_rate)
+ uint32_t tx_rate)
{
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index b62ac5b..7149dd7 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -4165,7 +4165,7 @@ int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr,
* - (-EINVAL) if bad parameter.
*/
int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
/**
* Configuration of Receive Side Scaling hash computation of Ethernet device.
--
1.8.3.1
^ permalink raw reply [relevance 3%]
* [PATCH] ethdev: forbid the use of direction attr in transfer flows
@ 2022-09-30 9:42 4% Ivan Malov
0 siblings, 0 replies; 200+ results
From: Ivan Malov @ 2022-09-30 9:42 UTC (permalink / raw)
To: dev
Cc: Andrew Rybchenko, Ori Kam, Ray Kinsella, Thomas Monjalon, Ferruh Yigit
As part of DPDK 21.11 release, it was announced that the
use of attributes 'ingress' and 'egress' in 'transfer'
rules was deprecated. The transition period is over.
Starting from DPDK 22.11, the use of direction attributes
with attribute 'transfer' is not allowed. To enforce that,
a generic check is added to flow rule validate API.
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
doc/guides/prog_guide/rte_flow.rst | 9 ++-------
doc/guides/rel_notes/deprecation.rst | 4 ----
doc/guides/rel_notes/release_22_11.rst | 4 ++++
lib/ethdev/rte_flow.c | 7 +++++++
lib/ethdev/rte_flow.h | 18 ------------------
5 files changed, 13 insertions(+), 29 deletions(-)
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index cb102633c2..2415dd7226 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -204,13 +204,8 @@ When supported, this effectively enables an application to reroute traffic
not necessarily intended for it (e.g. coming from or addressed to different
physical ports, VFs or applications) at the device level.
-In "transfer" flows, the use of `Attribute: Traffic direction`_ in the sense of
-implicitly matching packets going to or going from the ethdev used to create
-flow rules is **deprecated**. `Attribute: Transfer`_ shifts the viewpoint to
-the embedded switch. In it, `Attribute: Traffic direction`_ is ambiguous as
-the switch serves many different endpoints. The application should match
-traffic originating from precise locations. To do so, it should
-use `Item: PORT_REPRESENTOR`_ and `Item: REPRESENTED_PORT`_.
+In "transfer" flows, the use of `Attribute: Traffic direction`_ in not allowed.
+One may use `Item: PORT_REPRESENTOR`_ and `Item: REPRESENTED_PORT`_ instead.
Pattern item
~~~~~~~~~~~~
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index b718784ad1..dc1e652d99 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -101,10 +101,6 @@ Deprecation Notices
* ethdev: Items and actions ``PF``, ``VF``, ``PHY_PORT``, ``PORT_ID`` are
deprecated as hard-to-use / ambiguous and will be removed in DPDK 22.11.
-* ethdev: The use of attributes ``ingress`` / ``egress`` in "transfer" flows
- is deprecated as ambiguous with respect to the embedded switch. The use of
- these attributes will become invalid starting from DPDK 22.11.
-
* ethdev: Actions ``OF_SET_MPLS_TTL``, ``OF_DEC_MPLS_TTL``, ``OF_SET_NW_TTL``,
``OF_COPY_TTL_OUT``, ``OF_COPY_TTL_IN`` are deprecated as not supported by
any PMD, so they will be removed in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 6d3b43aed2..88e8c49984 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -223,6 +223,10 @@ API Changes
* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+* ethdev: Banned the use of attributes ``ingress``/``egress`` in "transfer"
+ flows, as the final step of deprecation process that had been started
+ in DPDK 21.11. See items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT``.
+
ABI Changes
-----------
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index fd802f87a2..d81b5426d2 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -355,6 +355,13 @@ rte_flow_validate(uint16_t port_id,
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
int ret;
+ if (likely(!!attr) && attr->transfer &&
+ (attr->ingress || attr->egress)) {
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ATTR,
+ attr, "cannot use attr ingress/egress with attr transfer");
+ }
+
if (unlikely(!ops))
return -rte_errno;
if (likely(!!ops->validate)) {
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 4598ccceaf..6d6c736a1b 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -88,28 +88,10 @@ struct rte_flow_attr {
uint32_t priority; /**< Rule priority level within group. */
/**
* The rule in question applies to ingress traffic (non-"transfer").
- *
- * @deprecated
- * It has been possible to combine this attribute with "transfer".
- * Doing so has been assumed to restrict the scope of matching
- * to traffic going from within the embedded switch toward the
- * ethdev the flow rule being created through. This behaviour
- * is deprecated. During the transition period, one may still
- * rely on it, but PMDs and applications are encouraged to
- * gradually move away from this approach.
*/
uint32_t ingress:1;
/**
* The rule in question applies to egress traffic (non-"transfer").
- *
- * @deprecated
- * It has been possible to combine this attribute with "transfer".
- * Doing so has been assumed to restrict the scope of matching
- * to traffic sent by the application by virtue of the ethdev
- * the flow rule being created through. This behaviour is now
- * deprecated. During the transition period, one may still
- * rely on it, but PMDs and applications are encouraged to
- * gradually move away from this approach.
*/
uint32_t egress:1;
/**
--
2.30.2
^ permalink raw reply [relevance 4%]
* Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
2022-09-29 19:48 0% ` Chautru, Nicolas
@ 2022-09-30 7:54 0% ` Maxime Coquelin
0 siblings, 0 replies; 200+ results
From: Maxime Coquelin @ 2022-09-30 7:54 UTC (permalink / raw)
To: Chautru, Nicolas, Akhil Goyal, Ferruh Yigit, dev, ferruh.yigit,
Ray Kinsella, thomas
Cc: trix, Richardson, Bruce, david.marchand, stephen, Zhang,
Mingshan, hemant.agrawal
Hi Nic,
On 9/29/22 21:48, Chautru, Nicolas wrote:
> Hi Thomas,
> In absence of Ray (I did not see email from him for a some time) can you please advise on best option so that as to move on.
> I can either keep as is based on initial review with Ray, or replace _PADDED_MAX to _SIZE_MAX macro as suggested by Ferruh.
> I am happy either way as long as we are able to move forward. There is no full consensus but not strong opinion either from anyone.
I would go with Ferruh's suggestion.
Regards,
Maxime
> Thanks,
> Nic
>
>> -----Original Message-----
>> From: Akhil Goyal <gakhil@marvell.com>
>> Sent: Thursday, September 29, 2022 11:33 AM
>> To: Ferruh Yigit <ferruh.yigit@amd.com>; Chautru, Nicolas
>> <nicolas.chautru@intel.com>; dev@dpdk.org; Maxime Coquelin
>> <maxime.coquelin@redhat.com>; ferruh.yigit@xilinx.com; Ray Kinsella
>> <mdr@ashroe.eu>
>> Cc: thomas@monjalon.net; trix@redhat.com; Richardson, Bruce
>> <bruce.richardson@intel.com>; david.marchand@redhat.com;
>> stephen@networkplumber.org; Zhang, Mingshan
>> <mingshan.zhang@intel.com>; hemant.agrawal@nxp.com
>> Subject: RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status
>> information
>>
>>>> Thanks for your comment.
>>>> To be totally honest I don't yet see how your suggestion would be
>>>> better, but I
>>> quite possibly miss something. I did not reply in line with your
>>> comments so that to try to be clearer and avoid spreading the argument
>>> to much. Ray and Bruce feel free to chime in as well.
>>>>
>>>> First to state the obvious: Nothing will change the fact that in
>>>> case new enums
>>> are being added in DPDK, and if the application doesn't change, then
>>> user would not be able to interpret any such additional
>>> status/capability (backward compatible only feature parity and still
>>> ABI compliant) which is totally accepted as fine and up to the user,
>>> but the intention is at least not to have adverse effect even when
>>> they don’t update their code for such new features (notably in case
>>> they just use an older PMD not supporting such new features as a basic
>> typical example in the ecosystem). I think we agree on that problematic.
>>>>
>>>> In term of history of not using MAX value for enum, I believe there
>>>> is already
>>> well documented and you agree with the reasoning of why we had to move
>>> away from this [1]. Not just cosmetically where the max value is
>>> called an enum or a #define but to have application making hardcoded
>>> assumption on the possible maximum range for such enum notably when
>>> sizing array. The only caveat being that at the time, the community
>>> did spot the weakness but did not come to an agreement with regards to
>>> the best way to manage this moving forward.
>>>>
>>>> In case your point is purely cosmetic to rename the PADDED_MAX value
>>>> from
>>> the enum to a #define (both public) I don't see how this would make
>>> thing clearer by obfuscating the fact it is genuinely a padded value
>>> and to have that value directly related to the enum structure. Also
>>> note that there is already an actual max value defined for these enums
>>> (but kept private on purpose) which is used by the lib/bbdev functions
>>> to restrict usage to what is actually supported in the given implementation
>> (distinct from padded max value).
>>>>
>>>> Arguably the only concern I could understand in your message would
>>>> be this
>>> one " my concern was if user assumes all values valid until PADDED_MAX
>>> and tries to iterate array until that value".
>>>> But really the fact that it is indeed a padded value implies fairly
>>>> explicitly that
>>> we have padded the supported enums with placeholders enums not yet
>> defined.
>>> That is fairly tautological! I cannot see how it could confuse anyone.
>>> That is indeed to avoid such confusion that we went on that direction
>>> to expose a public future-proof padded maximum value.
>>>>
>>>> Then looking at usage in practice: when integrating the bbdev api
>>>> with higher
>>> level SW stacks (such as FlexRAN reference sw or 3rd party stacks) I
>>> don’t see how any of this theoretical concerns you raised would be
>>> relevant for any of these very cases (enqueue status, new capability
>>> etc...). The only genuine concern was sizing array based on MAX value being
>> not ABI compliant.
>>>> I cannot think of any code in the application presently deployed or
>>>> future that
>>> would then do what you are concerned about and cause an issue, and we
>>> definitely don’t do such things in any example for bbdev-test or in
>>> FlexRAN reference code provided to the ecosystem. The application
>>> would already have a default case when an enum being provided has no
>>> matching application, or more accurately in practice they would purely
>>> not look for these and hence these would be ignored seamlessly.
>>>>
>>>> Thanks again for the discussion. I wish this had happened earlier
>>>> (we only
>>> discussed this with Ray and Bruce while you were still at Intel), let
>>> me know what you think.
>>>> It may be more generally good moving forward to come to a general
>>> agreement at your technical forum level to avoid confusion. When we
>>> discussed earlier we came to the conclusion that the DPDK community
>>> had well documented what not to do to avoid ABI breakage but not
>>> necessarily what are the best alternatives.
>>>> Hopefully such future discussion should not delay this serie to be
>>>> applied but
>>> still let me know.
>>>>
>>>
>>> Hi Nic,
>>>
>>> I believe it is more clear/safe to convert to SIZE_MAX macros,
>>> although it is not a blocker.
>>>
>>> Anyway, I am not sure about the value of continuing this discussion,
>>> perhaps it is better to clarify the guidance for similar case with ABI
>>> maintainer and techboard, so it can proceed according to the decision.
>>>
>> I agree with Ferruh's comment for converting to SIZE_MAX macros.
>> However, it is not a strong comment from my side.
>> Moving to techboard would mean this patchset would skip the RC1 window.
>> I believe as Ray is the maintainer and go to person for ABI related issues.
>> I believe if he can take a look at the suggestion and provide ack/nack to
>> whichever Approach would be fine and we can go ahead in that direction.
>> I would like to close this as soon as possible. There are a lot of patches to be
>> blocked on this series.
>>
>> Regards,
>> Akhil
>
^ permalink raw reply [relevance 0%]
* RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
2022-09-29 18:32 3% ` Akhil Goyal
@ 2022-09-29 19:48 0% ` Chautru, Nicolas
2022-09-30 7:54 0% ` Maxime Coquelin
0 siblings, 1 reply; 200+ results
From: Chautru, Nicolas @ 2022-09-29 19:48 UTC (permalink / raw)
To: Akhil Goyal, Ferruh Yigit, dev, Maxime Coquelin, ferruh.yigit,
Ray Kinsella, thomas
Cc: trix, Richardson, Bruce, david.marchand, stephen, Zhang,
Mingshan, hemant.agrawal
Hi Thomas,
In absence of Ray (I did not see email from him for a some time) can you please advise on best option so that as to move on.
I can either keep as is based on initial review with Ray, or replace _PADDED_MAX to _SIZE_MAX macro as suggested by Ferruh.
I am happy either way as long as we are able to move forward. There is no full consensus but not strong opinion either from anyone.
Thanks,
Nic
> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Thursday, September 29, 2022 11:33 AM
> To: Ferruh Yigit <ferruh.yigit@amd.com>; Chautru, Nicolas
> <nicolas.chautru@intel.com>; dev@dpdk.org; Maxime Coquelin
> <maxime.coquelin@redhat.com>; ferruh.yigit@xilinx.com; Ray Kinsella
> <mdr@ashroe.eu>
> Cc: thomas@monjalon.net; trix@redhat.com; Richardson, Bruce
> <bruce.richardson@intel.com>; david.marchand@redhat.com;
> stephen@networkplumber.org; Zhang, Mingshan
> <mingshan.zhang@intel.com>; hemant.agrawal@nxp.com
> Subject: RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status
> information
>
> > > Thanks for your comment.
> > > To be totally honest I don't yet see how your suggestion would be
> > > better, but I
> > quite possibly miss something. I did not reply in line with your
> > comments so that to try to be clearer and avoid spreading the argument
> > to much. Ray and Bruce feel free to chime in as well.
> > >
> > > First to state the obvious: Nothing will change the fact that in
> > > case new enums
> > are being added in DPDK, and if the application doesn't change, then
> > user would not be able to interpret any such additional
> > status/capability (backward compatible only feature parity and still
> > ABI compliant) which is totally accepted as fine and up to the user,
> > but the intention is at least not to have adverse effect even when
> > they don’t update their code for such new features (notably in case
> > they just use an older PMD not supporting such new features as a basic
> typical example in the ecosystem). I think we agree on that problematic.
> > >
> > > In term of history of not using MAX value for enum, I believe there
> > > is already
> > well documented and you agree with the reasoning of why we had to move
> > away from this [1]. Not just cosmetically where the max value is
> > called an enum or a #define but to have application making hardcoded
> > assumption on the possible maximum range for such enum notably when
> > sizing array. The only caveat being that at the time, the community
> > did spot the weakness but did not come to an agreement with regards to
> > the best way to manage this moving forward.
> > >
> > > In case your point is purely cosmetic to rename the PADDED_MAX value
> > > from
> > the enum to a #define (both public) I don't see how this would make
> > thing clearer by obfuscating the fact it is genuinely a padded value
> > and to have that value directly related to the enum structure. Also
> > note that there is already an actual max value defined for these enums
> > (but kept private on purpose) which is used by the lib/bbdev functions
> > to restrict usage to what is actually supported in the given implementation
> (distinct from padded max value).
> > >
> > > Arguably the only concern I could understand in your message would
> > > be this
> > one " my concern was if user assumes all values valid until PADDED_MAX
> > and tries to iterate array until that value".
> > > But really the fact that it is indeed a padded value implies fairly
> > > explicitly that
> > we have padded the supported enums with placeholders enums not yet
> defined.
> > That is fairly tautological! I cannot see how it could confuse anyone.
> > That is indeed to avoid such confusion that we went on that direction
> > to expose a public future-proof padded maximum value.
> > >
> > > Then looking at usage in practice: when integrating the bbdev api
> > > with higher
> > level SW stacks (such as FlexRAN reference sw or 3rd party stacks) I
> > don’t see how any of this theoretical concerns you raised would be
> > relevant for any of these very cases (enqueue status, new capability
> > etc...). The only genuine concern was sizing array based on MAX value being
> not ABI compliant.
> > > I cannot think of any code in the application presently deployed or
> > > future that
> > would then do what you are concerned about and cause an issue, and we
> > definitely don’t do such things in any example for bbdev-test or in
> > FlexRAN reference code provided to the ecosystem. The application
> > would already have a default case when an enum being provided has no
> > matching application, or more accurately in practice they would purely
> > not look for these and hence these would be ignored seamlessly.
> > >
> > > Thanks again for the discussion. I wish this had happened earlier
> > > (we only
> > discussed this with Ray and Bruce while you were still at Intel), let
> > me know what you think.
> > > It may be more generally good moving forward to come to a general
> > agreement at your technical forum level to avoid confusion. When we
> > discussed earlier we came to the conclusion that the DPDK community
> > had well documented what not to do to avoid ABI breakage but not
> > necessarily what are the best alternatives.
> > > Hopefully such future discussion should not delay this serie to be
> > > applied but
> > still let me know.
> > >
> >
> > Hi Nic,
> >
> > I believe it is more clear/safe to convert to SIZE_MAX macros,
> > although it is not a blocker.
> >
> > Anyway, I am not sure about the value of continuing this discussion,
> > perhaps it is better to clarify the guidance for similar case with ABI
> > maintainer and techboard, so it can proceed according to the decision.
> >
> I agree with Ferruh's comment for converting to SIZE_MAX macros.
> However, it is not a strong comment from my side.
> Moving to techboard would mean this patchset would skip the RC1 window.
> I believe as Ray is the maintainer and go to person for ABI related issues.
> I believe if he can take a look at the suggestion and provide ack/nack to
> whichever Approach would be fine and we can go ahead in that direction.
> I would like to close this as soon as possible. There are a lot of patches to be
> blocked on this series.
>
> Regards,
> Akhil
^ permalink raw reply [relevance 0%]
* RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
2022-09-29 18:10 3% ` Ferruh Yigit
@ 2022-09-29 18:32 3% ` Akhil Goyal
2022-09-29 19:48 0% ` Chautru, Nicolas
0 siblings, 1 reply; 200+ results
From: Akhil Goyal @ 2022-09-29 18:32 UTC (permalink / raw)
To: Ferruh Yigit, Chautru, Nicolas, dev, Maxime Coquelin,
ferruh.yigit, Ray Kinsella
Cc: thomas, trix, Richardson, Bruce, david.marchand, stephen, Zhang,
Mingshan, hemant.agrawal
> > Thanks for your comment.
> > To be totally honest I don't yet see how your suggestion would be better, but I
> quite possibly miss something. I did not reply in line with your comments so that
> to try to be clearer and avoid spreading the argument to much. Ray and Bruce
> feel free to chime in as well.
> >
> > First to state the obvious: Nothing will change the fact that in case new enums
> are being added in DPDK, and if the application doesn't change, then user would
> not be able to interpret any such additional status/capability (backward
> compatible only feature parity and still ABI compliant) which is totally accepted
> as fine and up to the user, but the intention is at least not to have adverse effect
> even when they don’t update their code for such new features (notably in case
> they just use an older PMD not supporting such new features as a basic typical
> example in the ecosystem). I think we agree on that problematic.
> >
> > In term of history of not using MAX value for enum, I believe there is already
> well documented and you agree with the reasoning of why we had to move
> away from this [1]. Not just cosmetically where the max value is called an enum
> or a #define but to have application making hardcoded assumption on the
> possible maximum range for such enum notably when sizing array. The only
> caveat being that at the time, the community did spot the weakness but did not
> come to an agreement with regards to the best way to manage this moving
> forward.
> >
> > In case your point is purely cosmetic to rename the PADDED_MAX value from
> the enum to a #define (both public) I don't see how this would make thing
> clearer by obfuscating the fact it is genuinely a padded value and to have that
> value directly related to the enum structure. Also note that there is already an
> actual max value defined for these enums (but kept private on purpose) which is
> used by the lib/bbdev functions to restrict usage to what is actually supported in
> the given implementation (distinct from padded max value).
> >
> > Arguably the only concern I could understand in your message would be this
> one " my concern was if user assumes all values valid until PADDED_MAX and
> tries to iterate array until that value".
> > But really the fact that it is indeed a padded value implies fairly explicitly that
> we have padded the supported enums with placeholders enums not yet defined.
> That is fairly tautological! I cannot see how it could confuse anyone. That is
> indeed to avoid such confusion that we went on that direction to expose a
> public future-proof padded maximum value.
> >
> > Then looking at usage in practice: when integrating the bbdev api with higher
> level SW stacks (such as FlexRAN reference sw or 3rd party stacks) I don’t see
> how any of this theoretical concerns you raised would be relevant for any of
> these very cases (enqueue status, new capability etc...). The only genuine
> concern was sizing array based on MAX value being not ABI compliant.
> > I cannot think of any code in the application presently deployed or future that
> would then do what you are concerned about and cause an issue, and we
> definitely don’t do such things in any example for bbdev-test or in FlexRAN
> reference code provided to the ecosystem. The application would already have
> a default case when an enum being provided has no matching application, or
> more accurately in practice they would purely not look for these and hence
> these would be ignored seamlessly.
> >
> > Thanks again for the discussion. I wish this had happened earlier (we only
> discussed this with Ray and Bruce while you were still at Intel), let me know what
> you think.
> > It may be more generally good moving forward to come to a general
> agreement at your technical forum level to avoid confusion. When we discussed
> earlier we came to the conclusion that the DPDK community had well
> documented what not to do to avoid ABI breakage but not necessarily what are
> the best alternatives.
> > Hopefully such future discussion should not delay this serie to be applied but
> still let me know.
> >
>
> Hi Nic,
>
> I believe it is more clear/safe to convert to SIZE_MAX macros, although
> it is not a blocker.
>
> Anyway, I am not sure about the value of continuing this discussion,
> perhaps it is better to clarify the guidance for similar case with ABI
> maintainer and techboard, so it can proceed according to the decision.
>
I agree with Ferruh's comment for converting to SIZE_MAX macros.
However, it is not a strong comment from my side.
Moving to techboard would mean this patchset would skip the RC1 window.
I believe as Ray is the maintainer and go to person for ABI related issues.
I believe if he can take a look at the suggestion and provide ack/nack to whichever
Approach would be fine and we can go ahead in that direction.
I would like to close this as soon as possible. There are a lot of patches to be blocked on this series.
Regards,
Akhil
^ permalink raw reply [relevance 3%]
* Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
2022-09-27 20:59 5% ` Chautru, Nicolas
@ 2022-09-29 18:10 3% ` Ferruh Yigit
2022-09-29 18:32 3% ` Akhil Goyal
0 siblings, 1 reply; 200+ results
From: Ferruh Yigit @ 2022-09-29 18:10 UTC (permalink / raw)
To: Chautru, Nicolas, Akhil Goyal, dev, Maxime Coquelin,
ferruh.yigit, Ray Kinsella
Cc: thomas, trix, Richardson, Bruce, david.marchand, stephen, Zhang,
Mingshan, hemant.agrawal
On 9/27/2022 9:59 PM, Chautru, Nicolas wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
>
>
> Hi Ferruh,
>
> Thanks for your comment.
> To be totally honest I don't yet see how your suggestion would be better, but I quite possibly miss something. I did not reply in line with your comments so that to try to be clearer and avoid spreading the argument to much. Ray and Bruce feel free to chime in as well.
>
> First to state the obvious: Nothing will change the fact that in case new enums are being added in DPDK, and if the application doesn't change, then user would not be able to interpret any such additional status/capability (backward compatible only feature parity and still ABI compliant) which is totally accepted as fine and up to the user, but the intention is at least not to have adverse effect even when they don’t update their code for such new features (notably in case they just use an older PMD not supporting such new features as a basic typical example in the ecosystem). I think we agree on that problematic.
>
> In term of history of not using MAX value for enum, I believe there is already well documented and you agree with the reasoning of why we had to move away from this [1]. Not just cosmetically where the max value is called an enum or a #define but to have application making hardcoded assumption on the possible maximum range for such enum notably when sizing array. The only caveat being that at the time, the community did spot the weakness but did not come to an agreement with regards to the best way to manage this moving forward.
>
> In case your point is purely cosmetic to rename the PADDED_MAX value from the enum to a #define (both public) I don't see how this would make thing clearer by obfuscating the fact it is genuinely a padded value and to have that value directly related to the enum structure. Also note that there is already an actual max value defined for these enums (but kept private on purpose) which is used by the lib/bbdev functions to restrict usage to what is actually supported in the given implementation (distinct from padded max value).
>
> Arguably the only concern I could understand in your message would be this one " my concern was if user assumes all values valid until PADDED_MAX and tries to iterate array until that value".
> But really the fact that it is indeed a padded value implies fairly explicitly that we have padded the supported enums with placeholders enums not yet defined. That is fairly tautological! I cannot see how it could confuse anyone. That is indeed to avoid such confusion that we went on that direction to expose a public future-proof padded maximum value.
>
> Then looking at usage in practice: when integrating the bbdev api with higher level SW stacks (such as FlexRAN reference sw or 3rd party stacks) I don’t see how any of this theoretical concerns you raised would be relevant for any of these very cases (enqueue status, new capability etc...). The only genuine concern was sizing array based on MAX value being not ABI compliant.
> I cannot think of any code in the application presently deployed or future that would then do what you are concerned about and cause an issue, and we definitely don’t do such things in any example for bbdev-test or in FlexRAN reference code provided to the ecosystem. The application would already have a default case when an enum being provided has no matching application, or more accurately in practice they would purely not look for these and hence these would be ignored seamlessly.
>
> Thanks again for the discussion. I wish this had happened earlier (we only discussed this with Ray and Bruce while you were still at Intel), let me know what you think.
> It may be more generally good moving forward to come to a general agreement at your technical forum level to avoid confusion. When we discussed earlier we came to the conclusion that the DPDK community had well documented what not to do to avoid ABI breakage but not necessarily what are the best alternatives.
> Hopefully such future discussion should not delay this serie to be applied but still let me know.
>
Hi Nic,
I believe it is more clear/safe to convert to SIZE_MAX macros, although
it is not a blocker.
Anyway, I am not sure about the value of continuing this discussion,
perhaps it is better to clarify the guidance for similar case with ABI
maintainer and techboard, so it can proceed according to the decision.
Thanks,
ferruh
> Thanks again
>
> [1]
> * lib: will fix extending some enum/define breaking the ABI. There are multiple
> samples in DPDK that enum/define terminated with a ``.*MAX.*`` value which is
> used by iterators, and arrays holding these values are sized with this
> ``.*MAX.*`` value. So extending this enum/define increases the ``.*MAX.*``
> value which increases the size of the array and depending on how/where the
> array is used this may break the ABI.
> ``RTE_ETH_FLOW_MAX`` is one sample of the mentioned case, adding a new flow
> type will break the ABI because of ``flex_mask[RTE_ETH_FLOW_MAX]`` array
> usage in following public struct hierarchy:
> ``rte_eth_fdir_flex_conf -> rte_eth_fdir_conf -> rte_eth_conf (in the middle)``.
> Need to identify this kind of usages and fix in 20.11, otherwise this blocks
> us extending existing enum/define.
> One solution can be using a fixed size array instead of ``.*MAX.*`` value.
>
>
>> -----Original Message-----
>> From: Chautru, Nicolas
>> Sent: Saturday, September 24, 2022 9:35 AM
>> To: 'Akhil Goyal' <gakhil@marvell.com>; dev@dpdk.org; Maxime Coquelin
>> <maxime.coquelin@redhat.com>; ferruh.yigit@xilinx.com; Ray Kinsella
>> <mdr@ashroe.eu>
>> Cc: 'Akhil Goyal' <gakhil@marvell.com>; Chautru, Nicolas
>> <nicolas.chautru@intel.com>; 'thomas@monjalon.net'
>> <thomas@monjalon.net>; 'Ray Kinsella' <mdr@ashroe.eu>;
>> 'trix@redhat.com' <trix@redhat.com>; Richardson, Bruce
>> <bruce.richardson@intel.com>; 'david.marchand@redhat.com'
>> <david.marchand@redhat.com>; stephen@networkplumber.org; Zhang,
>> Mingshan <mingshan.zhang@intel.com>; 'hemant.agrawal@nxp.com'
>> <hemant.agrawal@nxp.com>
>> Subject: RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and
>> status information
>>
>> Hi Ferruh, Ray, Akhil,
>>
>>
>>>> -----Original Message-----
>>>> From: Ferruh Yigit <ferruh.yigit@amd.com>
>>>> Sent: Friday, September 23, 2022 4:28 PM
>>>> To: Akhil Goyal <gakhil@marvell.com>; Nicolas Chautru
>>>> <nicolas.chautru@intel.com>; dev@dpdk.org; thomas@monjalon.net;
>>>> hemant.agrawal@nxp.com; Ray Kinsella <mdr@ashroe.eu>
>>>> Cc: maxime.coquelin@redhat.com; trix@redhat.com;
>>>> bruce.richardson@intel.com; david.marchand@redhat.com;
>>>> stephen@networkplumber.org; mingshan.zhang@intel.com
>>>> Subject: Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning
>>>> and status information
>>>>
>>>> On 9/21/2022 8:21 PM, Akhil Goyal wrote:
>>>>>> diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index
>>>>>> ed528b8..b7ecf94 100644
>>>>>> --- a/lib/bbdev/rte_bbdev.h
>>>>>> +++ b/lib/bbdev/rte_bbdev.h
>>>>>> @@ -224,6 +224,19 @@ struct rte_bbdev_queue_conf {
>>>>>> rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
>>>>>>
>>>>>> /**
>>>>>> + * Flags indicate the reason why a previous enqueue may not have
>>>>>> + * consumed all requested operations
>>>>>> + * In case of multiple reasons the latter superdes a previous
>>>>>> + one
>>>>> Spell check - supersedes.
>>>>>
>>>>>> + */
>>>>>> +enum rte_bbdev_enqueue_status {
>>>>>> + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to
>> report */
>>>>>> + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not
>> enough room
>>> in
>>>>>> queue */
>>>>>> + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not
>> enough room
>>> in
>>>>>> ring */
>>>>>> + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation
>> was
>>>>>> rejected as invalid */
>>>>>> + RTE_BBDEV_ENQ_STATUS_PADDED_MAX = 6, /**<
>> Maximum enq
>>>>>> status number including padding */
>>>>>
>>>>> Are we ok to have this kind of padding across DPDK for all the
>>>>> enums to avoid
>>>> ABI issues?
>>>>> @Ray, @Thomas: any thoughts?
>>>>>
>>>>>
>>>>
>>>> This kind of usage can prevent ABI tool warning, and can fix issues
>>>> caused by application using returned enum as index [1].
>>>>
>>>> But I think it is still problematic in case application tries to
>>>> walk through till MAX, that is a common usage [2], user may miss that
>> this
>>>> is PADDED.
>>
>> Hi Ferruh,
>> I don’t believe that case can happen here. Even if application was using an
>> undefined index, the related functions are protected for that :
>> See rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
>> The reason for having padded max, is that the application may use this for
>> array sizing if required without concern, we will never return a value that
>> would exceeds this.
>> In the other direction that is not a problem either since application (even it
>> needs to store thigs in array) can used the padded version.
>> Note that this discussed with Ray notably as a BKM.
>>
>>>>
>>>> Overall exchanging enum values between library and application is
>>>> possible trouble for binary compatibility. If application and
>>>> library uses enum values independently, this is OK.
>>>> Since enum cases not deleted but added in new version of the
>>>> libraries, more problematic usage is passing enum value from library
>>>> to application, and bbdev seems doing this in a few places.
>>
>> I don’t see a case where it is a genuine issue.
>> An enum is being reported from library, even if due to future enum insertion
>> there is a new enum reported between 2 ABI changes, that would still be
>> within bounds.
>>
>>>>
>>>> With current approach PADDED_MAX usage is more like #define usage,
>>>> it is not dynamic but a hardcoded value that is used as array size value.
>>>>
>>>> Not providing a MAX enum case restricts the application, application
>>>> can't use it as size of an array or can't use it walk through
>>>> related array, usage reduces to if/switch comparisons.
>>
>> It can use the padded_max to size application array. Even if application was
>> walking through these, there is no adverse effect.
>>
>>>> Although this may not be most convenient for application, it can
>>>> provide safer usage for binary compatibility.
>>>>
>>>>
>>>> @Nic, what do you think provide these PADDED_MAX as #define
>> SIZE_MAX
>>>> macros?
>>>> With this application still can allocate a relevant array with
>>>> correct size, or know the size of library provided array, but can't
>>>> use it to iterate on these arrays.
>>>>
>>
>> That would be back to how it was done before which made things very
>> inflexible and prevented to change these enums between ABIs versions.
>>
>> This change was highlighted and discussed many months ago and flagged in
>> the deprecation notice in previous release for that very reason.
>>
>> Ray, can you please chime in since you know best.
>>
>> Thanks Ferruh,
>> Nic
>>
>>
>>
>>>>
>>>>
>>>>
>>>> [1]
>>>> --------------- library old version ---------------------------- enum
>>>> type {
>>>> CASE_A,
>>>> CASE_B,
>>>> CASE_MAX,
>>>> };
>>>>
>>>> struct data {
>>>> enum type type;
>>>> union {
>>>> type specific struct
>>>> };
>>>> };
>>>>
>>>> int api_get(struct data *data);
>>>>
>>>>
>>>> --------------- application ----------------------------
>>>>
>>>> struct data data;
>>>> int array[CASE_MAX];
>>>>
>>>> api_get(&data);
>>>> foo(array[data.type]);
>>>>
>>>>
>>>> --------------- library NEW version ----------------------------
>>>>
>>>> enum type {
>>>> CASE_A,
>>>> CASE_B,
>>>> CASE_C,
>>>> CASE_D,
>>>> CASE_MAX,
>>>> };
>>>>
>>>>
>>>> When application is NOT recompiled but using new version of the
>>>> library, values 'CASE_C' & 'CASE_D' will crash application, so this
>>>> will create a ABI compatibility issue.
>>>>
>>>> Note: In the past I have claimed that application should check
>>>> 'CASE_MAX', instead of using returned value directly as index, but
>>>> this is refused by argument that we can't control the application and
>>>> should play safe assuming application behaves wrong.
>>>>
>>>>
>>>>
>>>>
>>>> [2]
>>>>
>>>> --------------- library ----------------------------
>>>>
>>>> enum type {
>>>> CASE_NONE,
>>>> CASE_A,
>>>> CASE_B,
>>>> CASE_C,
>>>> CASE_D,
>>>> CASE_PADDED_MAX = 666,
>>>> };
>>>>
>>>> --------------- application ----------------------------
>>>>
>>>> for (int i = CASE_NONE; i < CASE_PADDED_MAX; i++)
>>>> fragile_init(i);
>>>>
>>>> ---
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>
^ permalink raw reply [relevance 3%]
* Re: [PATCH 4/4] ethdev: remove deprecated flow actions to copy TTL
2022-09-29 9:22 3% ` [PATCH 4/4] ethdev: remove deprecated flow actions to copy TTL Andrew Rybchenko
@ 2022-09-29 16:24 0% ` Ajit Khaparde
0 siblings, 0 replies; 200+ results
From: Ajit Khaparde @ 2022-09-29 16:24 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: Ori Kam, Aman Singh, Yuying Zhang, Ray Kinsella, Somnath Kotur,
Thomas Monjalon, Ferruh Yigit, dev
[-- Attachment #1: Type: text/plain, Size: 282 bytes --]
On Thu, Sep 29, 2022 at 2:23 AM Andrew Rybchenko
<andrew.rybchenko@oktetlabs.ru> wrote:
>
> These actions are supported by no drivers.
>
> The patch breaks ABI.
>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [relevance 0%]
* Re: [PATCH 3/4] ethdev: remove deprecated flow action to set layer 3 TTL
2022-09-29 9:22 3% ` [PATCH 3/4] ethdev: remove deprecated flow action to set layer 3 TTL Andrew Rybchenko
@ 2022-09-29 16:24 0% ` Ajit Khaparde
0 siblings, 0 replies; 200+ results
From: Ajit Khaparde @ 2022-09-29 16:24 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: Ori Kam, Aman Singh, Yuying Zhang, Ray Kinsella, Somnath Kotur,
Thomas Monjalon, Ferruh Yigit, dev
[-- Attachment #1: Type: text/plain, Size: 278 bytes --]
On Thu, Sep 29, 2022 at 2:23 AM Andrew Rybchenko
<andrew.rybchenko@oktetlabs.ru> wrote:
>
> The action is supported by no drivers.
>
> The patch breaks ABI.
>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [relevance 0%]
* Re: [PATCH 2/4] ethdev: remove deprecated flow action to decrement MPLS TTL
2022-09-29 9:22 3% ` [PATCH 2/4] ethdev: remove deprecated flow action to decrement " Andrew Rybchenko
@ 2022-09-29 16:23 0% ` Ajit Khaparde
0 siblings, 0 replies; 200+ results
From: Ajit Khaparde @ 2022-09-29 16:23 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: Ori Kam, Aman Singh, Yuying Zhang, Ray Kinsella, Somnath Kotur,
Thomas Monjalon, Ferruh Yigit, dev
[-- Attachment #1: Type: text/plain, Size: 773 bytes --]
On Thu, Sep 29, 2022 at 2:23 AM Andrew Rybchenko
<andrew.rybchenko@oktetlabs.ru> wrote:
>
> The action is supported by no drivers.
>
> The patch breaks ABI.
>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> app/test-pmd/cmdline_flow.c | 9 ---------
> doc/guides/prog_guide/rte_flow.rst | 17 -----------------
> doc/guides/rel_notes/deprecation.rst | 2 +-
> doc/guides/rel_notes/release_22_11.rst | 4 ++--
> drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 4 ----
> lib/ethdev/rte_flow.c | 1 -
> lib/ethdev/rte_flow.h | 11 -----------
> 7 files changed, 3 insertions(+), 45 deletions(-)
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [relevance 0%]
* Re: [PATCH 1/4] ethdev: remove deprecated flow action to set MPLS TTL
2022-09-29 9:22 3% ` [PATCH 1/4] ethdev: remove deprecated flow action to set MPLS TTL Andrew Rybchenko
@ 2022-09-29 16:23 0% ` Ajit Khaparde
0 siblings, 0 replies; 200+ results
From: Ajit Khaparde @ 2022-09-29 16:23 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: Ori Kam, Aman Singh, Yuying Zhang, Ray Kinsella, Somnath Kotur,
Thomas Monjalon, Ferruh Yigit, dev
[-- Attachment #1.1: Type: text/plain, Size: 782 bytes --]
On Thu, Sep 29, 2022 at 2:23 AM Andrew Rybchenko <
andrew.rybchenko@oktetlabs.ru> wrote:
>
> The action is supported by no drivers.
>
> The patch breaks ABI.
>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> app/test-pmd/cmdline_flow.c | 27 -------------------
> doc/guides/prog_guide/rte_flow.rst | 17 ------------
> doc/guides/rel_notes/deprecation.rst | 2 +-
> doc/guides/rel_notes/release_22_11.rst | 4 +++
> drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 4 ---
> lib/ethdev/rte_flow.c | 2 --
> lib/ethdev/rte_flow.h | 24 -----------------
> 7 files changed, 5 insertions(+), 75 deletions(-)
[-- Attachment #1.2: Type: text/html, Size: 1301 bytes --]
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [relevance 0%]
* [PATCH] drivers/bus: set device NUMA node to unknown by default
@ 2022-09-29 12:05 4% Olivier Matz
0 siblings, 0 replies; 200+ results
From: Olivier Matz @ 2022-09-29 12:05 UTC (permalink / raw)
To: dev
Cc: Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
Sachin Saxena, Stephen Hemminger, Long Li
The dev->device.numa_node field is set by each bus driver for
every device it manages to indicate on which NUMA node this device lies.
When this information is unknown, the assigned value is not consistent
across the bus drivers.
Set the default value to SOCKET_ID_ANY (-1) by all bus drivers
when the NUMA information is unavailable.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
doc/guides/rel_notes/deprecation.rst | 7 -------
doc/guides/rel_notes/release_22_11.rst | 6 ++++++
drivers/bus/auxiliary/auxiliary_common.c | 8 ++------
drivers/bus/auxiliary/linux/auxiliary.c | 13 +++++--------
drivers/bus/dpaa/dpaa_bus.c | 1 +
drivers/bus/fslmc/fslmc_bus.c | 1 +
drivers/bus/pci/bsd/pci.c | 2 +-
drivers/bus/pci/linux/pci.c | 16 ++++++----------
drivers/bus/pci/pci_common.c | 8 ++------
drivers/bus/pci/windows/pci.c | 1 -
drivers/bus/vmbus/linux/vmbus_bus.c | 1 -
drivers/bus/vmbus/vmbus_common.c | 8 ++------
12 files changed, 26 insertions(+), 46 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index be231ff8d2..75645f0a9a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -36,13 +36,6 @@ Deprecation Notices
``__atomic_thread_fence`` must be used for patches that need to be merged in
20.08 onwards. This change will not introduce any performance degradation.
-* bus: The ``dev->device.numa_node`` field is set by each bus driver for
- every device it manages to indicate on which NUMA node this device lies.
- When this information is unknown, the assigned value is not consistent
- across the bus drivers.
- In DPDK 22.11, the default value will be set to -1 by all bus drivers
- when the NUMA information is unavailable.
-
* kni: The KNI kernel module and library are not recommended for use by new
applications - other technologies such as virtio-user are recommended instead.
Following the DPDK technical board
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 0231959874..5989e4a04f 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -266,6 +266,12 @@ ABI Changes
* eventdev: Added ``weight`` and ``affinity`` fields
to ``rte_event_queue_conf`` structure.
+* bus: Changed the device numa node to -1 when NUMA information is unavailable.
+ The ``dev->device.numa_node`` field is set by each bus driver for
+ every device it manages to indicate on which NUMA node this device lies.
+ When this information is unknown, the assigned value was not consistent
+ across the bus drivers.
+
Known Issues
------------
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 259ff152c4..6bb1fe7c96 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -105,12 +105,8 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv,
return -1;
}
- if (dev->device.numa_node < 0) {
- if (rte_socket_count() > 1)
- AUXILIARY_LOG(INFO, "Device %s is not NUMA-aware, defaulting socket to 0",
- dev->name);
- dev->device.numa_node = 0;
- }
+ if (dev->device.numa_node < 0 && rte_socket_count() > 1)
+ RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name);
iova_mode = rte_eal_iova_mode();
if ((drv->drv_flags & RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA) > 0 &&
diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index d4c564cd78..02fc9285dc 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -40,14 +40,11 @@ auxiliary_scan_one(const char *dirname, const char *name)
/* Get NUMA node, default to 0 if not present */
snprintf(filename, sizeof(filename), "%s/%s/numa_node",
dirname, name);
- if (access(filename, F_OK) != -1) {
- if (eal_parse_sysfs_value(filename, &tmp) == 0)
- dev->device.numa_node = tmp;
- else
- dev->device.numa_node = -1;
- } else {
- dev->device.numa_node = 0;
- }
+ if (access(filename, F_OK) == 0 &&
+ eal_parse_sysfs_value(filename, &tmp) == 0)
+ dev->device.numa_node = tmp;
+ else
+ dev->device.numa_node = SOCKET_ID_ANY;
auxiliary_on_scan(dev);
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 682427ba2c..447b222a76 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -179,6 +179,7 @@ dpaa_create_device_list(void)
}
dev->device.bus = &rte_dpaa_bus.bus;
+ dev->device.numa_node = SOCKET_ID_ANY;
/* Allocate interrupt handle instance */
dev->intr_handle =
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 8503004e3d..57bfb5111a 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -156,6 +156,7 @@ scan_one_fslmc_device(char *dev_name)
}
dev->device.bus = &rte_fslmc_bus.bus;
+ dev->device.numa_node = SOCKET_ID_ANY;
/* Allocate interrupt instance */
dev->intr_handle =
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 844d145fed..7459d15c7e 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -246,7 +246,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
dev->max_vfs = 0;
/* FreeBSD has no NUMA support (yet) */
- dev->device.numa_node = 0;
+ dev->device.numa_node = SOCKET_ID_ANY;
pci_common_set(dev);
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index c8703d52f3..ade17079fc 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -283,17 +283,13 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
}
/* get numa node, default to 0 if not present */
- snprintf(filename, sizeof(filename), "%s/numa_node",
- dirname);
+ snprintf(filename, sizeof(filename), "%s/numa_node", dirname);
- if (access(filename, F_OK) != -1) {
- if (eal_parse_sysfs_value(filename, &tmp) == 0)
- dev->device.numa_node = tmp;
- else
- dev->device.numa_node = -1;
- } else {
- dev->device.numa_node = 0;
- }
+ if (access(filename, F_OK) == 0 &&
+ eal_parse_sysfs_value(filename, &tmp) == 0)
+ dev->device.numa_node = tmp;
+ else
+ dev->device.numa_node = SOCKET_ID_ANY;
pci_common_set(dev);
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 5ea72bcf23..a59c5b4286 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -235,12 +235,8 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
return 1;
}
- if (dev->device.numa_node < 0) {
- if (rte_socket_count() > 1)
- RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware, defaulting socket to 0\n",
- dev->name);
- dev->device.numa_node = 0;
- }
+ if (dev->device.numa_node < 0 && rte_socket_count() > 1)
+ RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name);
already_probed = rte_dev_is_probed(&dev->device);
if (already_probed && !(dr->drv_flags & RTE_PCI_DRV_PROBE_AGAIN)) {
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 3f7a8b9432..5cf05ce1a0 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -249,7 +249,6 @@ get_device_resource_info(HDEVINFO dev_info,
DWORD error = GetLastError();
if (error == ERROR_NOT_FOUND) {
/* On older CPUs, NUMA is not bound to PCIe locality. */
- dev->device.numa_node = 0;
return ERROR_SUCCESS;
}
RTE_LOG_WIN32_ERR("SetupDiGetDevicePropertyW"
diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index f502783f7a..01d8111b85 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -293,7 +293,6 @@ vmbus_scan_one(const char *name)
goto error;
dev->device.numa_node = tmp;
} else {
- /* if no NUMA support, set default to 0 */
dev->device.numa_node = SOCKET_ID_ANY;
}
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 03b39c82b7..8d32d66504 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -111,12 +111,8 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr,
/* reference driver structure */
dev->driver = dr;
- if (dev->device.numa_node < 0) {
- if (rte_socket_count() > 1)
- VMBUS_LOG(INFO, "Device %s is not NUMA-aware, defaulting socket to 0",
- guid);
- dev->device.numa_node = 0;
- }
+ if (dev->device.numa_node < 0 && rte_socket_count() > 1)
+ VMBUS_LOG(INFO, "Device %s is not NUMA-aware", guid);
/* call the driver probe() function */
VMBUS_LOG(INFO, " probe driver: %s", dr->driver.name);
--
2.30.2
^ permalink raw reply [relevance 4%]
* [PATCH v3 1/1] ethdev: support congestion management
2022-09-28 8:19 0% ` Andrew Rybchenko
@ 2022-09-29 9:35 2% ` skori
2022-10-04 9:02 0% ` Andrew Rybchenko
1 sibling, 1 reply; 200+ results
From: skori @ 2022-09-29 9:35 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon, Andrew Rybchenko, Ray Kinsella
Cc: dev, Jerin Jacob, Sunil Kumar Kori
From: Jerin Jacob <jerinj@marvell.com>
NIC HW controllers often come with congestion management support on
various HW objects such as Rx queue depth or mempool queue depth.
Also, it can support various modes of operation such as RED
(Random early discard), WRED etc on those HW objects.
This patch adds a framework to express such modes(enum rte_cman_mode)
and introduce (enum rte_eth_cman_obj) to enumerate the different
objects where the modes can operate on.
This patch adds RTE_CMAN_RED mode of operation and
RTE_ETH_CMAN_OBJ_RX_QUEUE, RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL object.
Introduced reserved fields in configuration structure
backed by rte_eth_cman_config_init() to add new configuration
parameters without ABI breakage.
Added rte_eth_cman_info_get() API to get the information such as
supported modes and objects.
Added rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs
to configure congestion management on those object with associated mode.
Finally, Added rte_eth_cman_config_get() API to retrieve the
applied configuration.
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v2..v3:
- Rename rte_cman.c to rte_ethdev_cman.c
- Move lib/eal/include/rte_cman.h to lib/ethdev/rte_cman.h
- Fix review comments (Andrew Rybchenko)
- Add release notes
v1..v2:
- Fix review comments (Akhil Goyal)
rfc..v1:
- Added RED specification (http://www.aciri.org/floyd/papers/red/red.html) link
- Fixed doxygen comment issue (Min Hu)
doc/guides/nics/features.rst | 12 ++
doc/guides/nics/features/default.ini | 1 +
doc/guides/rel_notes/release_22_11.rst | 6 +
lib/ethdev/ethdev_driver.h | 25 ++++
lib/ethdev/ethdev_private.c | 12 ++
lib/ethdev/ethdev_private.h | 2 +
lib/ethdev/meson.build | 2 +
lib/ethdev/rte_cman.h | 55 +++++++++
lib/ethdev/rte_ethdev.h | 164 +++++++++++++++++++++++++
lib/ethdev/rte_ethdev_cman.c | 101 +++++++++++++++
lib/ethdev/version.map | 6 +
11 files changed, 386 insertions(+)
create mode 100644 lib/ethdev/rte_cman.h
create mode 100644 lib/ethdev/rte_ethdev_cman.c
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index b4a8e9881c..70ca46e651 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -727,6 +727,18 @@ Supports configuring per-queue stat counter mapping.
``rte_eth_dev_set_tx_queue_stats_mapping()``.
+.. _nic_features_congestion_management:
+
+Congestion management
+---------------------
+
+Supports congestion management.
+
+* **[implements] eth_dev_ops**: ``cman_info_get``, ``cman_config_set``, ``cman_config_get``.
+* **[related] API**: ``rte_eth_cman_info_get()``, ``rte_eth_cman_config_init()``,
+ ``rte_eth_cman_config_set()``, ``rte_eth_cman_config_get()``.
+
+
.. _nic_features_fw_version:
FW version
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index f7192cb0da..a9c0008ebd 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -60,6 +60,7 @@ Tx descriptor status =
Basic stats =
Extended stats =
Stats per queue =
+Congestion management =
FW version =
EEPROM dump =
Module EEPROM dump =
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 0231959874..ea9908e578 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -81,6 +81,12 @@ New Features
* Added AES-CCM support in lookaside protocol (IPsec) for CN9K & CN10K.
* Added AES & DES DOCSIS algorithm support in lookaside crypto for CN9K.
+* **Added support for congestion management for ethdev.**
+
+ Added new APIs ``rte_eth_cman_config_init()``, ``rte_eth_cman_config_get()``,
+ ``rte_eth_cman_config_set()``, ``rte_eth_cman_info_get()``
+ to support congestion management.
+
* **Added eventdev adapter instance get API.**
* Added ``rte_event_eth_rx_adapter_instance_get`` to get Rx adapter
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 8cd8eb8685..e1e2d10a35 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -1094,6 +1094,22 @@ typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
uint16_t *rx_queue_id,
uint8_t *avail_thresh);
+/** @internal Get congestion management information. */
+typedef int (*eth_cman_info_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_cman_info *info);
+
+/** @internal Init congestion management structure with default values. */
+typedef int (*eth_cman_config_init_t)(struct rte_eth_dev *dev,
+ struct rte_eth_cman_config *config);
+
+/** @internal Configure congestion management on a port. */
+typedef int (*eth_cman_config_set_t)(struct rte_eth_dev *dev,
+ const struct rte_eth_cman_config *config);
+
+/** @internal Retrieve congestion management configuration of a port. */
+typedef int (*eth_cman_config_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_cman_config *config);
+
/**
* @internal A structure containing the functions exported by an Ethernet driver.
*/
@@ -1309,6 +1325,15 @@ struct eth_dev_ops {
eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
/** Query Rx queue available descriptors threshold event */
eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
+
+ /** Get congestion management information */
+ eth_cman_info_get_t cman_info_get;
+ /** Initialize congestion management structure with default values */
+ eth_cman_config_init_t cman_config_init;
+ /** Configure congestion management */
+ eth_cman_config_set_t cman_config_set;
+ /** Retrieve congestion management configuration */
+ eth_cman_config_get_t cman_config_get;
};
/**
diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c
index 48090c879a..8787c3985e 100644
--- a/lib/ethdev/ethdev_private.c
+++ b/lib/ethdev/ethdev_private.c
@@ -27,6 +27,18 @@ eth_dev_to_id(const struct rte_eth_dev *dev)
return dev - rte_eth_devices;
}
+int32_t
+eth_check_err(struct rte_eth_dev *dev, int ret)
+{
+ if (ret == 0)
+ return 0;
+
+ if (rte_eth_dev_is_removed(eth_dev_to_id(dev)))
+ return -EIO;
+
+ return ret;
+}
+
struct rte_eth_dev *
eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,
const void *data)
diff --git a/lib/ethdev/ethdev_private.h b/lib/ethdev/ethdev_private.h
index cc9879907c..c7ac074029 100644
--- a/lib/ethdev/ethdev_private.h
+++ b/lib/ethdev/ethdev_private.h
@@ -69,4 +69,6 @@ void eth_dev_txq_release(struct rte_eth_dev *dev, uint16_t qid);
int eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues);
int eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues);
+int32_t eth_check_err(struct rte_eth_dev *dev, int ret);
+
#endif /* _ETH_PRIVATE_H_ */
diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
index 47bb2625b0..39250b5da1 100644
--- a/lib/ethdev/meson.build
+++ b/lib/ethdev/meson.build
@@ -8,6 +8,7 @@ sources = files(
'ethdev_trace_points.c',
'rte_class_eth.c',
'rte_ethdev.c',
+ 'rte_ethdev_cman.c',
'rte_flow.c',
'rte_mtr.c',
'rte_tm.c',
@@ -19,6 +20,7 @@ sources = files(
)
headers = files(
+ 'rte_cman.h',
'rte_ethdev.h',
'rte_ethdev_trace.h',
'rte_ethdev_trace_fp.h',
diff --git a/lib/ethdev/rte_cman.h b/lib/ethdev/rte_cman.h
new file mode 100644
index 0000000000..297db8e095
--- /dev/null
+++ b/lib/ethdev/rte_cman.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2022 Marvell International Ltd.
+ */
+
+#ifndef RTE_CMAN_H
+#define RTE_CMAN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bitops.h>
+
+/**
+ * @file
+ * Congestion management related parameters for DPDK.
+ */
+
+/** Congestion management modes */
+enum rte_cman_mode {
+ /**
+ * Congestion based on Random Early Detection.
+ *
+ * https://en.wikipedia.org/wiki/Random_early_detection
+ * http://www.aciri.org/floyd/papers/red/red.html
+ * @see struct rte_cman_red_params
+ */
+ RTE_CMAN_RED = RTE_BIT32(0),
+};
+
+/**
+ * RED based congestion management configuration parameters.
+ */
+struct rte_cman_red_params {
+ /**
+ * Minimum threshold (min_th) value
+ *
+ * Value expressed as percentage. Value must be in 0 to 100(inclusive).
+ */
+ uint8_t min_th;
+ /**
+ * Maximum threshold (max_th) value
+ *
+ * Value expressed as percentage. Value must be in 0 to 100(inclusive).
+ */
+ uint8_t max_th;
+ /** Inverse of packet marking probability maximum value (maxp = 1 / maxp_inv) */
+ uint16_t maxp_inv;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_CMAN_H */
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 12535c703e..719b5c2707 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -160,6 +160,7 @@ extern "C" {
#define RTE_ETHDEV_DEBUG_TX
#endif
+#include <rte_cman.h>
#include <rte_compat.h>
#include <rte_log.h>
#include <rte_interrupts.h>
@@ -5314,6 +5315,169 @@ typedef struct {
__rte_experimental
int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file);
+/* Congestion management */
+
+/** Enumerate list of ethdev congestion management objects */
+enum rte_eth_cman_obj {
+ /** Congestion management based on Rx queue depth */
+ RTE_ETH_CMAN_OBJ_RX_QUEUE = RTE_BIT32(0),
+ /**
+ * Congestion management based on mempool depth associated with Rx queue
+ * @see rte_eth_rx_queue_setup()
+ */
+ RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL = RTE_BIT32(1),
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
+ *
+ * A structure used to retrieve information of ethdev congestion management.
+ */
+struct rte_eth_cman_info {
+ /**
+ * Set of supported congestion management modes
+ * @see enum rte_cman_mode
+ */
+ uint64_t modes_supported;
+ /**
+ * Set of supported congestion management objects
+ * @see enum rte_eth_cman_obj
+ */
+ uint64_t objs_supported;
+ /**
+ * Reserved for future fields. Always returned as 0 when
+ * rte_eth_cman_info_get() is invoked
+ */
+ uint8_t rsvd[8];
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
+ *
+ * A structure used to configure the ethdev congestion management.
+ */
+struct rte_eth_cman_config {
+ /** Congestion management object */
+ enum rte_eth_cman_obj obj;
+ /** Congestion management mode */
+ enum rte_cman_mode mode;
+ union {
+ /**
+ * Rx queue to configure congestion management.
+ *
+ * Valid when object is RTE_ETH_CMAN_OBJ_RX_QUEUE or
+ * RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL.
+ */
+ uint16_t rx_queue;
+ /**
+ * Reserved for future fields.
+ * It must be set to 0 when rte_eth_cman_config_set() is invoked
+ * and will be returned as 0 when rte_eth_cman_config_get() is
+ * invoked.
+ */
+ uint8_t rsvd_obj_params[4];
+ } obj_param;
+ union {
+ /**
+ * RED configuration parameters.
+ *
+ * Valid when mode is RTE_CMAN_RED.
+ */
+ struct rte_cman_red_params red;
+ /**
+ * Reserved for future fields.
+ * It must be set to 0 when rte_eth_cman_config_set() is invoked
+ * and will be returned as 0 when rte_eth_cman_config_get() is
+ * invoked.
+ */
+ uint8_t rsvd_mode_params[4];
+ } mode_param;
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Retrieve the information for ethdev congestion management
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param info
+ * A pointer to a structure of type *rte_eth_cman_info* to be filled with
+ * the information about congestion management.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if support for cman_info_get does not exist.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Initialize the ethdev congestion management configuration structure with default values.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param config
+ * A pointer to a structure of type *rte_eth_cman_config* to be initialized
+ * with default value.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if support for cman_config_init does not exist.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Configure ethdev congestion management
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param config
+ * A pointer to a structure of type *rte_eth_cman_config* to be configured.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if support for cman_config_set does not exist.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Retrieve the applied ethdev congestion management parameters for the given port.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param config
+ * A pointer to a structure of type *rte_eth_cman_config* to retrieve
+ * congestion management parameters for the given object.
+ * Application must fill all parameters except mode_param parameter in
+ * struct rte_eth_cman_config.
+ *
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if support for cman_config_get does not exist.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config);
+
#include <rte_ethdev_core.h>
/**
diff --git a/lib/ethdev/rte_ethdev_cman.c b/lib/ethdev/rte_ethdev_cman.c
new file mode 100644
index 0000000000..2ad39d7ed4
--- /dev/null
+++ b/lib/ethdev/rte_ethdev_cman.c
@@ -0,0 +1,101 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2022 Marvell International Ltd.
+ */
+
+#include <stdint.h>
+
+#include <rte_errno.h>
+#include "rte_ethdev.h"
+#include "ethdev_driver.h"
+#include "ethdev_private.h"
+
+/* Get congestion management information for a port */
+int
+rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (info == NULL) {
+ RTE_ETHDEV_LOG(ERR, "congestion management info is NULL\n");
+ return -EINVAL;
+ }
+
+ if (dev->dev_ops->cman_info_get == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
+ return -ENOTSUP;
+ }
+
+ memset(info, 0, sizeof(struct rte_eth_cman_info));
+ return eth_check_err(dev, (*dev->dev_ops->cman_info_get)(dev, info));
+}
+
+/* Initialize congestion management structure with default values */
+int
+rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (config == NULL) {
+ RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
+ return -EINVAL;
+ }
+
+ if (dev->dev_ops->cman_config_init == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
+ return -ENOTSUP;
+ }
+
+ memset(config, 0, sizeof(struct rte_eth_cman_config));
+ return eth_check_err(dev, (*dev->dev_ops->cman_config_init)(dev, config));
+}
+
+/* Configure congestion management on a port */
+int
+rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (config == NULL) {
+ RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
+ return -EINVAL;
+ }
+
+ if (dev->dev_ops->cman_config_set == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
+ return -ENOTSUP;
+ }
+
+ return eth_check_err(dev, (*dev->dev_ops->cman_config_set)(dev, config));
+}
+
+/* Retrieve congestion management configuration of a port */
+int
+rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (config == NULL) {
+ RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
+ return -EINVAL;
+ }
+
+ if (dev->dev_ops->cman_config_get == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Function not implemented\n");
+ return -ENOTSUP;
+ }
+
+ memset(config, 0, sizeof(struct rte_eth_cman_config));
+ return eth_check_err(dev, (*dev->dev_ops->cman_config_get)(dev, config));
+}
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 25e54f9d3e..a974ce7140 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -285,6 +285,12 @@ EXPERIMENTAL {
rte_mtr_color_in_protocol_priority_get;
rte_mtr_color_in_protocol_set;
rte_mtr_meter_vlan_table_update;
+
+ # added in 22.11
+ rte_eth_cman_config_get;
+ rte_eth_cman_config_init;
+ rte_eth_cman_config_set;
+ rte_eth_cman_info_get;
};
INTERNAL {
--
2.25.1
^ permalink raw reply [relevance 2%]
* [PATCH 4/4] ethdev: remove deprecated flow actions to copy TTL
` (2 preceding siblings ...)
2022-09-29 9:22 3% ` [PATCH 3/4] ethdev: remove deprecated flow action to set layer 3 TTL Andrew Rybchenko
@ 2022-09-29 9:22 3% ` Andrew Rybchenko
2022-09-29 16:24 0% ` Ajit Khaparde
3 siblings, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-09-29 9:22 UTC (permalink / raw)
To: Ori Kam, Aman Singh, Yuying Zhang, Ray Kinsella, Ajit Khaparde,
Somnath Kotur, Thomas Monjalon, Ferruh Yigit
Cc: dev
These actions are supported by no drivers.
The patch breaks ABI.
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
app/test-pmd/cmdline_flow.c | 18 ----------
doc/guides/prog_guide/rte_flow.rst | 35 -------------------
doc/guides/rel_notes/deprecation.rst | 4 ---
doc/guides/rel_notes/release_22_11.rst | 5 +--
drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 8 -----
lib/ethdev/rte_flow.c | 2 --
lib/ethdev/rte_flow.h | 24 -------------
7 files changed, 3 insertions(+), 93 deletions(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 180fe36e25..eb7b4853a5 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -516,8 +516,6 @@ enum index {
ACTION_METER_INIT_COLOR,
ACTION_METER_STATE,
ACTION_OF_DEC_NW_TTL,
- ACTION_OF_COPY_TTL_OUT,
- ACTION_OF_COPY_TTL_IN,
ACTION_OF_POP_VLAN,
ACTION_OF_PUSH_VLAN,
ACTION_OF_PUSH_VLAN_ETHERTYPE,
@@ -1833,8 +1831,6 @@ static const enum index next_action[] = {
ACTION_METER_COLOR,
ACTION_METER_MARK,
ACTION_OF_DEC_NW_TTL,
- ACTION_OF_COPY_TTL_OUT,
- ACTION_OF_COPY_TTL_IN,
ACTION_OF_POP_VLAN,
ACTION_OF_PUSH_VLAN,
ACTION_OF_SET_VLAN_VID,
@@ -5456,20 +5452,6 @@ static const struct token token_list[] = {
.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
.call = parse_vc,
},
- [ACTION_OF_COPY_TTL_OUT] = {
- .name = "of_copy_ttl_out",
- .help = "OpenFlow's OFPAT_COPY_TTL_OUT",
- .priv = PRIV_ACTION(OF_COPY_TTL_OUT, 0),
- .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_vc,
- },
- [ACTION_OF_COPY_TTL_IN] = {
- .name = "of_copy_ttl_in",
- .help = "OpenFlow's OFPAT_COPY_TTL_IN",
- .priv = PRIV_ACTION(OF_COPY_TTL_IN, 0),
- .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_vc,
- },
[ACTION_OF_POP_VLAN] = {
.name = "of_pop_vlan",
.help = "OpenFlow's OFPAT_POP_VLAN",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 69a0fac619..bdd07a2062 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -2140,41 +2140,6 @@ Implements ``OFPAT_DEC_NW_TTL`` ("decrement IP TTL") as defined by the
| no properties |
+---------------+
-Action: ``OF_COPY_TTL_OUT``
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-This action is deprecated. Consider `Action: MODIFY_FIELD`_.
-
-Implements ``OFPAT_COPY_TTL_OUT`` ("copy TTL "outwards" -- from
-next-to-outermost to outermost") as defined by the `OpenFlow Switch
-Specification`_.
-
-.. _table_rte_flow_action_of_copy_ttl_out:
-
-.. table:: OF_COPY_TTL_OUT
-
- +---------------+
- | Field |
- +===============+
- | no properties |
- +---------------+
-
-Action: ``OF_COPY_TTL_IN``
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-This action is deprecated. Consider `Action: MODIFY_FIELD`_.
-
-Implements ``OFPAT_COPY_TTL_IN`` ("copy TTL "inwards" -- from outermost to
-next-to-outermost") as defined by the `OpenFlow Switch Specification`_.
-
-.. _table_rte_flow_action_of_copy_ttl_in:
-
-.. table:: OF_COPY_TTL_IN
-
- +---------------+
- | Field |
- +===============+
- | no properties |
- +---------------+
-
Action: ``OF_POP_VLAN``
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 83654b8c1a..8c40048471 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -105,10 +105,6 @@ Deprecation Notices
is deprecated as ambiguous with respect to the embedded switch. The use of
these attributes will become invalid starting from DPDK 22.11.
-* ethdev: Actions
- ``OF_COPY_TTL_OUT``, ``OF_COPY_TTL_IN`` are deprecated as not supported by
- any PMD, so they will be removed in DPDK 22.11.
-
* ethdev: Actions ``OF_DEC_NW_TTL``, ``SET_IPV4_SRC``, ``SET_IPV4_DST``,
``SET_IPV6_SRC``, ``SET_IPV6_DST``, ``SET_TP_SRC``, ``SET_TP_DST``,
``DEC_TTL``, ``SET_TTL``, ``SET_MAC_SRC``, ``SET_MAC_DST``, ``INC_TCP_SEQ``,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 0473fbe9a2..c1caf8df40 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -109,8 +109,9 @@ Removed Items
* ethdev: removed ``RTE_FLOW_ACTION_TYPE_PHY_PORT``;
use ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT``.
-* ethdev: removed ``OF_SET_MPLS_TTL``, ``OF_DEC_MPLS_TTL`` and
- ``OF_SET_NW_TTL`` which are not actually supported by any PMD.
+* ethdev: removed ``OF_SET_MPLS_TTL``, ``OF_DEC_MPLS_TTL``,
+ ``OF_SET_NW_TTL``, ``OF_COPY_TTL_OUT`` and ``OF_COPY_TTL_IN``
+ which are not actually supported by any PMD.
``MODIFY_FIELD`` action should be used to do packet edits via RTE flow API.
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
index 3730029f2f..9cf1ebfe1d 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
@@ -77,14 +77,6 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = {
.act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
.proto_act_func = NULL
},
- [RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT] = {
- .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
- .proto_act_func = NULL
- },
- [RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_IN] = {
- .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
- .proto_act_func = NULL
- },
[RTE_FLOW_ACTION_TYPE_OF_POP_VLAN] = {
.act_type = BNXT_ULP_ACT_TYPE_SUPPORTED,
.proto_act_func = ulp_rte_of_pop_vlan_act_handler
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index dc54f5197e..a8b712acf5 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -193,8 +193,6 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(METER, sizeof(struct rte_flow_action_meter)),
MK_FLOW_ACTION(SECURITY, sizeof(struct rte_flow_action_security)),
MK_FLOW_ACTION(OF_DEC_NW_TTL, 0),
- MK_FLOW_ACTION(OF_COPY_TTL_OUT, 0),
- MK_FLOW_ACTION(OF_COPY_TTL_IN, 0),
MK_FLOW_ACTION(OF_POP_VLAN, 0),
MK_FLOW_ACTION(OF_PUSH_VLAN,
sizeof(struct rte_flow_action_of_push_vlan)),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index f1ed44a01a..a59e815a51 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -2286,30 +2286,6 @@ enum rte_flow_action_type {
*/
RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
- /**
- * @deprecated
- * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
- *
- * Implements OFPAT_COPY_TTL_OUT ("copy TTL "outwards" -- from
- * next-to-outermost to outermost") as defined by the OpenFlow
- * Switch Specification.
- *
- * No associated configuration structure.
- */
- RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT,
-
- /**
- * @deprecated
- * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
- *
- * Implements OFPAT_COPY_TTL_IN ("copy TTL "inwards" -- from
- * outermost to next-to-outermost") as defined by the OpenFlow
- * Switch Specification.
- *
- * No associated configuration structure.
- */
- RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_IN,
-
/**
* Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined
* by the OpenFlow Switch Specification.
--
2.30.2
^ permalink raw reply [relevance 3%]
* [PATCH 3/4] ethdev: remove deprecated flow action to set layer 3 TTL
2022-09-29 9:22 3% ` [PATCH 1/4] ethdev: remove deprecated flow action to set MPLS TTL Andrew Rybchenko
2022-09-29 9:22 3% ` [PATCH 2/4] ethdev: remove deprecated flow action to decrement " Andrew Rybchenko
@ 2022-09-29 9:22 3% ` Andrew Rybchenko
2022-09-29 16:24 0% ` Ajit Khaparde
2022-09-29 9:22 3% ` [PATCH 4/4] ethdev: remove deprecated flow actions to copy TTL Andrew Rybchenko
3 siblings, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-09-29 9:22 UTC (permalink / raw)
To: Ori Kam, Aman Singh, Yuying Zhang, Ray Kinsella, Ajit Khaparde,
Somnath Kotur, Thomas Monjalon, Ferruh Yigit
Cc: dev
The action is supported by no drivers.
The patch breaks ABI.
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
app/test-pmd/cmdline_flow.c | 26 -------------------
doc/guides/prog_guide/rte_flow.rst | 17 ------------
doc/guides/rel_notes/deprecation.rst | 2 +-
doc/guides/rel_notes/release_22_11.rst | 4 +--
drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 4 ---
lib/ethdev/rte_flow.c | 2 --
lib/ethdev/rte_flow.h | 24 -----------------
7 files changed, 3 insertions(+), 76 deletions(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index f1fb568211..180fe36e25 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -515,8 +515,6 @@ enum index {
ACTION_METER_COLOR_MODE,
ACTION_METER_INIT_COLOR,
ACTION_METER_STATE,
- ACTION_OF_SET_NW_TTL,
- ACTION_OF_SET_NW_TTL_NW_TTL,
ACTION_OF_DEC_NW_TTL,
ACTION_OF_COPY_TTL_OUT,
ACTION_OF_COPY_TTL_IN,
@@ -1834,7 +1832,6 @@ static const enum index next_action[] = {
ACTION_METER,
ACTION_METER_COLOR,
ACTION_METER_MARK,
- ACTION_OF_SET_NW_TTL,
ACTION_OF_DEC_NW_TTL,
ACTION_OF_COPY_TTL_OUT,
ACTION_OF_COPY_TTL_IN,
@@ -1951,12 +1948,6 @@ static const enum index action_meter_mark[] = {
ZERO,
};
-static const enum index action_of_set_nw_ttl[] = {
- ACTION_OF_SET_NW_TTL_NW_TTL,
- ACTION_NEXT,
- ZERO,
-};
-
static const enum index action_of_push_vlan[] = {
ACTION_OF_PUSH_VLAN_ETHERTYPE,
ACTION_NEXT,
@@ -5458,23 +5449,6 @@ static const struct token token_list[] = {
.args = ARGS(ARGS_ENTRY(struct rte_flow_action_meter_mark, state)),
.call = parse_vc_conf,
},
- [ACTION_OF_SET_NW_TTL] = {
- .name = "of_set_nw_ttl",
- .help = "OpenFlow's OFPAT_SET_NW_TTL",
- .priv = PRIV_ACTION
- (OF_SET_NW_TTL,
- sizeof(struct rte_flow_action_of_set_nw_ttl)),
- .next = NEXT(action_of_set_nw_ttl),
- .call = parse_vc,
- },
- [ACTION_OF_SET_NW_TTL_NW_TTL] = {
- .name = "nw_ttl",
- .help = "IP TTL",
- .next = NEXT(action_of_set_nw_ttl, NEXT_ENTRY(COMMON_UNSIGNED)),
- .args = ARGS(ARGS_ENTRY(struct rte_flow_action_of_set_nw_ttl,
- nw_ttl)),
- .call = parse_vc_conf,
- },
[ACTION_OF_DEC_NW_TTL] = {
.name = "of_dec_nw_ttl",
.help = "OpenFlow's OFPAT_DEC_NW_TTL",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index a5ff8fd64e..69a0fac619 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -2123,23 +2123,6 @@ fields in the pattern items.
| 1 | END |
+-------+----------+
-Action: ``OF_SET_NW_TTL``
-^^^^^^^^^^^^^^^^^^^^^^^^^
-This action is deprecated. Consider `Action: MODIFY_FIELD`_.
-
-Implements ``OFPAT_SET_NW_TTL`` ("IP TTL") as defined by the `OpenFlow
-Switch Specification`_.
-
-.. _table_rte_flow_action_of_set_nw_ttl:
-
-.. table:: OF_SET_NW_TTL
-
- +------------+--------+
- | Field | Value |
- +============+========+
- | ``nw_ttl`` | IP TTL |
- +------------+--------+
-
Action: ``OF_DEC_NW_TTL``
^^^^^^^^^^^^^^^^^^^^^^^^^
This is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 40a1f427af..83654b8c1a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -105,7 +105,7 @@ Deprecation Notices
is deprecated as ambiguous with respect to the embedded switch. The use of
these attributes will become invalid starting from DPDK 22.11.
-* ethdev: Actions ``OF_SET_NW_TTL``,
+* ethdev: Actions
``OF_COPY_TTL_OUT``, ``OF_COPY_TTL_IN`` are deprecated as not supported by
any PMD, so they will be removed in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index c3ace47ed8..0473fbe9a2 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -109,8 +109,8 @@ Removed Items
* ethdev: removed ``RTE_FLOW_ACTION_TYPE_PHY_PORT``;
use ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT``.
-* ethdev: removed ``OF_SET_MPLS_TTL`` and ``OF_DEC_MPLS_TTL`` which are not
- actually supported by any PMD.
+* ethdev: removed ``OF_SET_MPLS_TTL``, ``OF_DEC_MPLS_TTL`` and
+ ``OF_SET_NW_TTL`` which are not actually supported by any PMD.
``MODIFY_FIELD`` action should be used to do packet edits via RTE flow API.
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
index 67f20d83c1..3730029f2f 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
@@ -73,10 +73,6 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = {
.act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
.proto_act_func = NULL
},
- [RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL] = {
- .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
- .proto_act_func = NULL
- },
[RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL] = {
.act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
.proto_act_func = NULL
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 25f13e0287..dc54f5197e 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -192,8 +192,6 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(PORT_ID, sizeof(struct rte_flow_action_port_id)),
MK_FLOW_ACTION(METER, sizeof(struct rte_flow_action_meter)),
MK_FLOW_ACTION(SECURITY, sizeof(struct rte_flow_action_security)),
- MK_FLOW_ACTION(OF_SET_NW_TTL,
- sizeof(struct rte_flow_action_of_set_nw_ttl)),
MK_FLOW_ACTION(OF_DEC_NW_TTL, 0),
MK_FLOW_ACTION(OF_COPY_TTL_OUT, 0),
MK_FLOW_ACTION(OF_COPY_TTL_IN, 0),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index c60f85690e..f1ed44a01a 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -2275,17 +2275,6 @@ enum rte_flow_action_type {
*/
RTE_FLOW_ACTION_TYPE_SECURITY,
- /**
- * @deprecated
- * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
- *
- * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow
- * Switch Specification.
- *
- * See struct rte_flow_action_of_set_nw_ttl.
- */
- RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL,
-
/**
* @warning This is a legacy action.
* @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
@@ -3021,19 +3010,6 @@ struct rte_flow_action_security {
void *security_session; /**< Pointer to security session structure. */
};
-/**
- * @deprecated
- * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
- *
- * RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL
- *
- * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow Switch
- * Specification.
- */
-struct rte_flow_action_of_set_nw_ttl {
- uint8_t nw_ttl; /**< IP TTL. */
-};
-
/**
* RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN
*
--
2.30.2
^ permalink raw reply [relevance 3%]
* [PATCH 2/4] ethdev: remove deprecated flow action to decrement MPLS TTL
2022-09-29 9:22 3% ` [PATCH 1/4] ethdev: remove deprecated flow action to set MPLS TTL Andrew Rybchenko
@ 2022-09-29 9:22 3% ` Andrew Rybchenko
2022-09-29 16:23 0% ` Ajit Khaparde
2022-09-29 9:22 3% ` [PATCH 3/4] ethdev: remove deprecated flow action to set layer 3 TTL Andrew Rybchenko
2022-09-29 9:22 3% ` [PATCH 4/4] ethdev: remove deprecated flow actions to copy TTL Andrew Rybchenko
3 siblings, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-09-29 9:22 UTC (permalink / raw)
To: Ori Kam, Aman Singh, Yuying Zhang, Ray Kinsella, Ajit Khaparde,
Somnath Kotur, Thomas Monjalon, Ferruh Yigit
Cc: dev
The action is supported by no drivers.
The patch breaks ABI.
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
app/test-pmd/cmdline_flow.c | 9 ---------
doc/guides/prog_guide/rte_flow.rst | 17 -----------------
doc/guides/rel_notes/deprecation.rst | 2 +-
doc/guides/rel_notes/release_22_11.rst | 4 ++--
drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 4 ----
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 11 -----------
7 files changed, 3 insertions(+), 45 deletions(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index bdbfe79c5e..f1fb568211 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -515,7 +515,6 @@ enum index {
ACTION_METER_COLOR_MODE,
ACTION_METER_INIT_COLOR,
ACTION_METER_STATE,
- ACTION_OF_DEC_MPLS_TTL,
ACTION_OF_SET_NW_TTL,
ACTION_OF_SET_NW_TTL_NW_TTL,
ACTION_OF_DEC_NW_TTL,
@@ -1835,7 +1834,6 @@ static const enum index next_action[] = {
ACTION_METER,
ACTION_METER_COLOR,
ACTION_METER_MARK,
- ACTION_OF_DEC_MPLS_TTL,
ACTION_OF_SET_NW_TTL,
ACTION_OF_DEC_NW_TTL,
ACTION_OF_COPY_TTL_OUT,
@@ -5460,13 +5458,6 @@ static const struct token token_list[] = {
.args = ARGS(ARGS_ENTRY(struct rte_flow_action_meter_mark, state)),
.call = parse_vc_conf,
},
- [ACTION_OF_DEC_MPLS_TTL] = {
- .name = "of_dec_mpls_ttl",
- .help = "OpenFlow's OFPAT_DEC_MPLS_TTL",
- .priv = PRIV_ACTION(OF_DEC_MPLS_TTL, 0),
- .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_vc,
- },
[ACTION_OF_SET_NW_TTL] = {
.name = "of_set_nw_ttl",
.help = "OpenFlow's OFPAT_SET_NW_TTL",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 81a0701a70..a5ff8fd64e 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -2123,23 +2123,6 @@ fields in the pattern items.
| 1 | END |
+-------+----------+
-Action: ``OF_DEC_MPLS_TTL``
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-This action is deprecated. Consider `Action: MODIFY_FIELD`_.
-
-Implements ``OFPAT_DEC_MPLS_TTL`` ("decrement MPLS TTL") as defined by the
-`OpenFlow Switch Specification`_.
-
-.. _table_rte_flow_action_of_dec_mpls_ttl:
-
-.. table:: OF_DEC_MPLS_TTL
-
- +---------------+
- | Field |
- +===============+
- | no properties |
- +---------------+
-
Action: ``OF_SET_NW_TTL``
^^^^^^^^^^^^^^^^^^^^^^^^^
This action is deprecated. Consider `Action: MODIFY_FIELD`_.
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 9da1ac7ea4..40a1f427af 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -105,7 +105,7 @@ Deprecation Notices
is deprecated as ambiguous with respect to the embedded switch. The use of
these attributes will become invalid starting from DPDK 22.11.
-* ethdev: Actions ``OF_DEC_MPLS_TTL``, ``OF_SET_NW_TTL``,
+* ethdev: Actions ``OF_SET_NW_TTL``,
``OF_COPY_TTL_OUT``, ``OF_COPY_TTL_IN`` are deprecated as not supported by
any PMD, so they will be removed in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 794f6322dc..c3ace47ed8 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -109,8 +109,8 @@ Removed Items
* ethdev: removed ``RTE_FLOW_ACTION_TYPE_PHY_PORT``;
use ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT``.
-* ethdev: removed ``OF_SET_MPLS_TTL`` which is not actually supported by
- any PMD.
+* ethdev: removed ``OF_SET_MPLS_TTL`` and ``OF_DEC_MPLS_TTL`` which are not
+ actually supported by any PMD.
``MODIFY_FIELD`` action should be used to do packet edits via RTE flow API.
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
index 0528606e63..67f20d83c1 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
@@ -73,10 +73,6 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = {
.act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
.proto_act_func = NULL
},
- [RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL] = {
- .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
- .proto_act_func = NULL
- },
[RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL] = {
.act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
.proto_act_func = NULL
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index ca7634bbe9..25f13e0287 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -192,7 +192,6 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(PORT_ID, sizeof(struct rte_flow_action_port_id)),
MK_FLOW_ACTION(METER, sizeof(struct rte_flow_action_meter)),
MK_FLOW_ACTION(SECURITY, sizeof(struct rte_flow_action_security)),
- MK_FLOW_ACTION(OF_DEC_MPLS_TTL, 0),
MK_FLOW_ACTION(OF_SET_NW_TTL,
sizeof(struct rte_flow_action_of_set_nw_ttl)),
MK_FLOW_ACTION(OF_DEC_NW_TTL, 0),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index f49d138fe9..c60f85690e 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -2275,17 +2275,6 @@ enum rte_flow_action_type {
*/
RTE_FLOW_ACTION_TYPE_SECURITY,
- /**
- * @deprecated
- * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
- *
- * Implements OFPAT_DEC_MPLS_TTL ("decrement MPLS TTL") as defined
- * by the OpenFlow Switch Specification.
- *
- * No associated configuration structure.
- */
- RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL,
-
/**
* @deprecated
* @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
--
2.30.2
^ permalink raw reply [relevance 3%]
* [PATCH 1/4] ethdev: remove deprecated flow action to set MPLS TTL
@ 2022-09-29 9:22 3% ` Andrew Rybchenko
2022-09-29 16:23 0% ` Ajit Khaparde
2022-09-29 9:22 3% ` [PATCH 2/4] ethdev: remove deprecated flow action to decrement " Andrew Rybchenko
` (2 subsequent siblings)
3 siblings, 1 reply; 200+ results
From: Andrew Rybchenko @ 2022-09-29 9:22 UTC (permalink / raw)
To: Ori Kam, Aman Singh, Yuying Zhang, Ray Kinsella, Ajit Khaparde,
Somnath Kotur, Thomas Monjalon, Ferruh Yigit
Cc: dev
The action is supported by no drivers.
The patch breaks ABI.
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
app/test-pmd/cmdline_flow.c | 27 -------------------
doc/guides/prog_guide/rte_flow.rst | 17 ------------
doc/guides/rel_notes/deprecation.rst | 2 +-
doc/guides/rel_notes/release_22_11.rst | 4 +++
drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 4 ---
lib/ethdev/rte_flow.c | 2 --
lib/ethdev/rte_flow.h | 24 -----------------
7 files changed, 5 insertions(+), 75 deletions(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 91c6950b60..bdbfe79c5e 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -515,8 +515,6 @@ enum index {
ACTION_METER_COLOR_MODE,
ACTION_METER_INIT_COLOR,
ACTION_METER_STATE,
- ACTION_OF_SET_MPLS_TTL,
- ACTION_OF_SET_MPLS_TTL_MPLS_TTL,
ACTION_OF_DEC_MPLS_TTL,
ACTION_OF_SET_NW_TTL,
ACTION_OF_SET_NW_TTL_NW_TTL,
@@ -1837,7 +1835,6 @@ static const enum index next_action[] = {
ACTION_METER,
ACTION_METER_COLOR,
ACTION_METER_MARK,
- ACTION_OF_SET_MPLS_TTL,
ACTION_OF_DEC_MPLS_TTL,
ACTION_OF_SET_NW_TTL,
ACTION_OF_DEC_NW_TTL,
@@ -1956,12 +1953,6 @@ static const enum index action_meter_mark[] = {
ZERO,
};
-static const enum index action_of_set_mpls_ttl[] = {
- ACTION_OF_SET_MPLS_TTL_MPLS_TTL,
- ACTION_NEXT,
- ZERO,
-};
-
static const enum index action_of_set_nw_ttl[] = {
ACTION_OF_SET_NW_TTL_NW_TTL,
ACTION_NEXT,
@@ -5469,24 +5460,6 @@ static const struct token token_list[] = {
.args = ARGS(ARGS_ENTRY(struct rte_flow_action_meter_mark, state)),
.call = parse_vc_conf,
},
- [ACTION_OF_SET_MPLS_TTL] = {
- .name = "of_set_mpls_ttl",
- .help = "OpenFlow's OFPAT_SET_MPLS_TTL",
- .priv = PRIV_ACTION
- (OF_SET_MPLS_TTL,
- sizeof(struct rte_flow_action_of_set_mpls_ttl)),
- .next = NEXT(action_of_set_mpls_ttl),
- .call = parse_vc,
- },
- [ACTION_OF_SET_MPLS_TTL_MPLS_TTL] = {
- .name = "mpls_ttl",
- .help = "MPLS TTL",
- .next = NEXT(action_of_set_mpls_ttl,
- NEXT_ENTRY(COMMON_UNSIGNED)),
- .args = ARGS(ARGS_ENTRY(struct rte_flow_action_of_set_mpls_ttl,
- mpls_ttl)),
- .call = parse_vc_conf,
- },
[ACTION_OF_DEC_MPLS_TTL] = {
.name = "of_dec_mpls_ttl",
.help = "OpenFlow's OFPAT_DEC_MPLS_TTL",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index cb102633c2..81a0701a70 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -2123,23 +2123,6 @@ fields in the pattern items.
| 1 | END |
+-------+----------+
-Action: ``OF_SET_MPLS_TTL``
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-This action is deprecated. Consider `Action: MODIFY_FIELD`_.
-
-Implements ``OFPAT_SET_MPLS_TTL`` ("MPLS TTL") as defined by the `OpenFlow
-Switch Specification`_.
-
-.. _table_rte_flow_action_of_set_mpls_ttl:
-
-.. table:: OF_SET_MPLS_TTL
-
- +--------------+----------+
- | Field | Value |
- +==============+==========+
- | ``mpls_ttl`` | MPLS TTL |
- +--------------+----------+
-
Action: ``OF_DEC_MPLS_TTL``
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This action is deprecated. Consider `Action: MODIFY_FIELD`_.
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index b718784ad1..9da1ac7ea4 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -105,7 +105,7 @@ Deprecation Notices
is deprecated as ambiguous with respect to the embedded switch. The use of
these attributes will become invalid starting from DPDK 22.11.
-* ethdev: Actions ``OF_SET_MPLS_TTL``, ``OF_DEC_MPLS_TTL``, ``OF_SET_NW_TTL``,
+* ethdev: Actions ``OF_DEC_MPLS_TTL``, ``OF_SET_NW_TTL``,
``OF_COPY_TTL_OUT``, ``OF_COPY_TTL_IN`` are deprecated as not supported by
any PMD, so they will be removed in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 6d3b43aed2..794f6322dc 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -109,6 +109,10 @@ Removed Items
* ethdev: removed ``RTE_FLOW_ACTION_TYPE_PHY_PORT``;
use ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT``.
+* ethdev: removed ``OF_SET_MPLS_TTL`` which is not actually supported by
+ any PMD.
+ ``MODIFY_FIELD`` action should be used to do packet edits via RTE flow API.
+
API Changes
-----------
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
index 042425ff5c..0528606e63 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
@@ -73,10 +73,6 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = {
.act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
.proto_act_func = NULL
},
- [RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL] = {
- .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
- .proto_act_func = NULL
- },
[RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL] = {
.act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,
.proto_act_func = NULL
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index fd802f87a2..ca7634bbe9 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -192,8 +192,6 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(PORT_ID, sizeof(struct rte_flow_action_port_id)),
MK_FLOW_ACTION(METER, sizeof(struct rte_flow_action_meter)),
MK_FLOW_ACTION(SECURITY, sizeof(struct rte_flow_action_security)),
- MK_FLOW_ACTION(OF_SET_MPLS_TTL,
- sizeof(struct rte_flow_action_of_set_mpls_ttl)),
MK_FLOW_ACTION(OF_DEC_MPLS_TTL, 0),
MK_FLOW_ACTION(OF_SET_NW_TTL,
sizeof(struct rte_flow_action_of_set_nw_ttl)),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 4598ccceaf..f49d138fe9 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -2275,17 +2275,6 @@ enum rte_flow_action_type {
*/
RTE_FLOW_ACTION_TYPE_SECURITY,
- /**
- * @deprecated
- * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
- *
- * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the
- * OpenFlow Switch Specification.
- *
- * See struct rte_flow_action_of_set_mpls_ttl.
- */
- RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL,
-
/**
* @deprecated
* @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
@@ -3043,19 +3032,6 @@ struct rte_flow_action_security {
void *security_session; /**< Pointer to security session structure. */
};
-/**
- * @deprecated
- * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
- *
- * RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL
- *
- * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the OpenFlow
- * Switch Specification.
- */
-struct rte_flow_action_of_set_mpls_ttl {
- uint8_t mpls_ttl; /**< MPLS TTL. */
-};
-
/**
* @deprecated
* @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
--
2.30.2
^ permalink raw reply [relevance 3%]
* RE: [EXT] Re: [PATCH v3 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA
2022-09-29 7:44 0% ` Olivier Matz
@ 2022-09-29 8:10 0% ` Shijith Thotton
0 siblings, 0 replies; 200+ results
From: Shijith Thotton @ 2022-09-29 8:10 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, Pavan Nikhilesh Bhagavatula, Honnappa.Nagarahalli,
bruce.richardson, Jerin Jacob Kollanukkaran, mb, stephen, thomas,
david.marchand, Ruifeng Wang, Jan Viktorin,
Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
Sunil Kumar Kori, Satha Koteswara Rao Kottidi, Ankur Dwivedi,
Anoob Joseph, Tejasree Kondoj, Radha Chintakuntla,
Veerasenareddy Burru, Ashwin Sekhar T K, Jakub Palider,
Tomasz Duszynski
>> >> Enabled the flag pmd_iova_as_va in cnxk driver build files as they work
>> >> with IOVA as VA. Updated cn9k and cn10k soc build configurations to
>> >> enable the IOVA as VA build by default.
>> >>
>> >> Signed-off-by: Shijith Thotton <sthotton@marvell.com>
>> >> ---
>> >> config/arm/meson.build | 8 +++-
>> >> drivers/common/cnxk/meson.build | 1 +
>> >> drivers/crypto/cnxk/cn10k_ipsec_la_ops.h | 4 +-
>> >> drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 2 +-
>> >> drivers/crypto/cnxk/meson.build | 2 +
>> >> drivers/dma/cnxk/meson.build | 1 +
>> >> drivers/event/cnxk/meson.build | 1 +
>> >> drivers/mempool/cnxk/meson.build | 1 +
>> >> drivers/net/cnxk/cn10k_tx.h | 55 +++++++-----------------
>> >> drivers/net/cnxk/cn9k_tx.h | 55 +++++++-----------------
>> >> drivers/net/cnxk/cnxk_ethdev.h | 1 -
>> >> drivers/net/cnxk/meson.build | 1 +
>> >> drivers/raw/cnxk_bphy/meson.build | 1 +
>> >> drivers/raw/cnxk_gpio/meson.build | 1 +
>> >> 14 files changed, 50 insertions(+), 84 deletions(-)
>> >>
>> >> diff --git a/config/arm/meson.build b/config/arm/meson.build
>> >> index 9f1636e0d5..4e95e8b388 100644
>> >> --- a/config/arm/meson.build
>> >> +++ b/config/arm/meson.build
>> >> @@ -294,7 +294,8 @@ soc_cn10k = {
>> >> 'flags': [
>> >> ['RTE_MAX_LCORE', 24],
>> >> ['RTE_MAX_NUMA_NODES', 1],
>> >> - ['RTE_MEMPOOL_ALIGN', 128]
>> >> + ['RTE_MEMPOOL_ALIGN', 128],
>> >> + ['RTE_IOVA_AS_VA', 1]
>> >> ],
>> >> 'part_number': '0xd49',
>> >> 'extra_march_features': ['crypto'],
>> >> @@ -370,7 +371,10 @@ soc_cn9k = {
>> >> 'description': 'Marvell OCTEON 9',
>> >> 'implementer': '0x43',
>> >> 'part_number': '0xb2',
>> >> - 'numa': false
>> >> + 'numa': false,
>> >> + 'flags': [
>> >> + ['RTE_IOVA_AS_VA', 1]
>> >> + ]
>> >> }
>> >
>> >I think this could go in a separate patch: "disable IOVA as PA for octeontx2/3"
>> >
>> >The reason is that this patch clearly breaks the API (m->buf_iova field
>> >becomes invalid) and the ABI (mbuf fields are moved) for these
>> >architectures. This ABI breakage has to be advertised in the release
>> >note. In fact, it should have been advertised before, but I suppose it
>> >does not impact general purpose arm distributions, so I guess it is ok.
>> >
>> >One other thing to highlight: enabling RTE_IOVA_AS_VA means that it
>> >disable all drivers that do not have the pmd_iova_as_va flag. Are there
>> >use-cases where drivers other than cnxk are used? For instance, is there
>> >a PCI bus which is likely to be used by a driver/* ?
>> >
>>
>> All always enable drivers are enabled in this mode, which include
>> bus/pci, bus/vdev and mempool/ring.
>
>I was thinking about use cases where a pci PMD (NIC, crypto, ...) is
>used in addition to the SOC drivers. These PMD won't compile when IOVA
>as PA is disabled, and the use case will be broken.
>
>This is probably a corner case (people at Marvell will know better than
>me), I just wanted to highlight it. Should we document it?
Thanks for noting. I will add this to cnxk platform document.
^ permalink raw reply [relevance 0%]
* Re: [EXT] Re: [PATCH v3 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA
2022-09-29 6:19 0% ` [EXT] " Shijith Thotton
@ 2022-09-29 7:44 0% ` Olivier Matz
2022-09-29 8:10 0% ` Shijith Thotton
0 siblings, 1 reply; 200+ results
From: Olivier Matz @ 2022-09-29 7:44 UTC (permalink / raw)
To: Shijith Thotton
Cc: dev, Pavan Nikhilesh Bhagavatula, Honnappa.Nagarahalli,
bruce.richardson, Jerin Jacob Kollanukkaran, mb, stephen, thomas,
david.marchand, Ruifeng Wang, Jan Viktorin,
Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
Sunil Kumar Kori, Satha Koteswara Rao Kottidi, Ankur Dwivedi,
Anoob Joseph, Tejasree Kondoj, Radha Chintakuntla,
Veerasenareddy Burru, Ashwin Sekhar T K, Jakub Palider,
Tomasz Duszynski
On Thu, Sep 29, 2022 at 06:19:32AM +0000, Shijith Thotton wrote:
> >> Enabled the flag pmd_iova_as_va in cnxk driver build files as they work
> >> with IOVA as VA. Updated cn9k and cn10k soc build configurations to
> >> enable the IOVA as VA build by default.
> >>
> >> Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> >> ---
> >> config/arm/meson.build | 8 +++-
> >> drivers/common/cnxk/meson.build | 1 +
> >> drivers/crypto/cnxk/cn10k_ipsec_la_ops.h | 4 +-
> >> drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 2 +-
> >> drivers/crypto/cnxk/meson.build | 2 +
> >> drivers/dma/cnxk/meson.build | 1 +
> >> drivers/event/cnxk/meson.build | 1 +
> >> drivers/mempool/cnxk/meson.build | 1 +
> >> drivers/net/cnxk/cn10k_tx.h | 55 +++++++-----------------
> >> drivers/net/cnxk/cn9k_tx.h | 55 +++++++-----------------
> >> drivers/net/cnxk/cnxk_ethdev.h | 1 -
> >> drivers/net/cnxk/meson.build | 1 +
> >> drivers/raw/cnxk_bphy/meson.build | 1 +
> >> drivers/raw/cnxk_gpio/meson.build | 1 +
> >> 14 files changed, 50 insertions(+), 84 deletions(-)
> >>
> >> diff --git a/config/arm/meson.build b/config/arm/meson.build
> >> index 9f1636e0d5..4e95e8b388 100644
> >> --- a/config/arm/meson.build
> >> +++ b/config/arm/meson.build
> >> @@ -294,7 +294,8 @@ soc_cn10k = {
> >> 'flags': [
> >> ['RTE_MAX_LCORE', 24],
> >> ['RTE_MAX_NUMA_NODES', 1],
> >> - ['RTE_MEMPOOL_ALIGN', 128]
> >> + ['RTE_MEMPOOL_ALIGN', 128],
> >> + ['RTE_IOVA_AS_VA', 1]
> >> ],
> >> 'part_number': '0xd49',
> >> 'extra_march_features': ['crypto'],
> >> @@ -370,7 +371,10 @@ soc_cn9k = {
> >> 'description': 'Marvell OCTEON 9',
> >> 'implementer': '0x43',
> >> 'part_number': '0xb2',
> >> - 'numa': false
> >> + 'numa': false,
> >> + 'flags': [
> >> + ['RTE_IOVA_AS_VA', 1]
> >> + ]
> >> }
> >
> >I think this could go in a separate patch: "disable IOVA as PA for octeontx2/3"
> >
> >The reason is that this patch clearly breaks the API (m->buf_iova field
> >becomes invalid) and the ABI (mbuf fields are moved) for these
> >architectures. This ABI breakage has to be advertised in the release
> >note. In fact, it should have been advertised before, but I suppose it
> >does not impact general purpose arm distributions, so I guess it is ok.
> >
> >One other thing to highlight: enabling RTE_IOVA_AS_VA means that it
> >disable all drivers that do not have the pmd_iova_as_va flag. Are there
> >use-cases where drivers other than cnxk are used? For instance, is there
> >a PCI bus which is likely to be used by a driver/* ?
> >
>
> All always enable drivers are enabled in this mode, which include
> bus/pci, bus/vdev and mempool/ring.
I was thinking about use cases where a pci PMD (NIC, crypto, ...) is
used in addition to the SOC drivers. These PMD won't compile when IOVA
as PA is disabled, and the use case will be broken.
This is probably a corner case (people at Marvell will know better than
me), I just wanted to highlight it. Should we document it?
Thanks,
Olivier
^ permalink raw reply [relevance 0%]
* RE: [EXT] Re: [PATCH v3 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA
2022-09-28 12:53 4% ` Olivier Matz
@ 2022-09-29 6:19 0% ` Shijith Thotton
2022-09-29 7:44 0% ` Olivier Matz
0 siblings, 1 reply; 200+ results
From: Shijith Thotton @ 2022-09-29 6:19 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, Pavan Nikhilesh Bhagavatula, Honnappa.Nagarahalli,
bruce.richardson, Jerin Jacob Kollanukkaran, mb, stephen, thomas,
david.marchand, Ruifeng Wang, Jan Viktorin,
Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
Sunil Kumar Kori, Satha Koteswara Rao Kottidi, Ankur Dwivedi,
Anoob Joseph, Tejasree Kondoj, Radha Chintakuntla,
Veerasenareddy Burru, Ashwin Sekhar T K, Jakub Palider,
Tomasz Duszynski
>> Enabled the flag pmd_iova_as_va in cnxk driver build files as they work
>> with IOVA as VA. Updated cn9k and cn10k soc build configurations to
>> enable the IOVA as VA build by default.
>>
>> Signed-off-by: Shijith Thotton <sthotton@marvell.com>
>> ---
>> config/arm/meson.build | 8 +++-
>> drivers/common/cnxk/meson.build | 1 +
>> drivers/crypto/cnxk/cn10k_ipsec_la_ops.h | 4 +-
>> drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 2 +-
>> drivers/crypto/cnxk/meson.build | 2 +
>> drivers/dma/cnxk/meson.build | 1 +
>> drivers/event/cnxk/meson.build | 1 +
>> drivers/mempool/cnxk/meson.build | 1 +
>> drivers/net/cnxk/cn10k_tx.h | 55 +++++++-----------------
>> drivers/net/cnxk/cn9k_tx.h | 55 +++++++-----------------
>> drivers/net/cnxk/cnxk_ethdev.h | 1 -
>> drivers/net/cnxk/meson.build | 1 +
>> drivers/raw/cnxk_bphy/meson.build | 1 +
>> drivers/raw/cnxk_gpio/meson.build | 1 +
>> 14 files changed, 50 insertions(+), 84 deletions(-)
>>
>> diff --git a/config/arm/meson.build b/config/arm/meson.build
>> index 9f1636e0d5..4e95e8b388 100644
>> --- a/config/arm/meson.build
>> +++ b/config/arm/meson.build
>> @@ -294,7 +294,8 @@ soc_cn10k = {
>> 'flags': [
>> ['RTE_MAX_LCORE', 24],
>> ['RTE_MAX_NUMA_NODES', 1],
>> - ['RTE_MEMPOOL_ALIGN', 128]
>> + ['RTE_MEMPOOL_ALIGN', 128],
>> + ['RTE_IOVA_AS_VA', 1]
>> ],
>> 'part_number': '0xd49',
>> 'extra_march_features': ['crypto'],
>> @@ -370,7 +371,10 @@ soc_cn9k = {
>> 'description': 'Marvell OCTEON 9',
>> 'implementer': '0x43',
>> 'part_number': '0xb2',
>> - 'numa': false
>> + 'numa': false,
>> + 'flags': [
>> + ['RTE_IOVA_AS_VA', 1]
>> + ]
>> }
>
>I think this could go in a separate patch: "disable IOVA as PA for octeontx2/3"
>
>The reason is that this patch clearly breaks the API (m->buf_iova field
>becomes invalid) and the ABI (mbuf fields are moved) for these
>architectures. This ABI breakage has to be advertised in the release
>note. In fact, it should have been advertised before, but I suppose it
>does not impact general purpose arm distributions, so I guess it is ok.
>
>One other thing to highlight: enabling RTE_IOVA_AS_VA means that it
>disable all drivers that do not have the pmd_iova_as_va flag. Are there
>use-cases where drivers other than cnxk are used? For instance, is there
>a PCI bus which is likely to be used by a driver/* ?
>
All always enable drivers are enabled in this mode, which include
bus/pci, bus/vdev and mempool/ring.
>>
>> soc_stingray = {
>> diff --git a/drivers/common/cnxk/meson.build
>b/drivers/common/cnxk/meson.build
>> index 6f808271d1..d019cfa8d1 100644
>> --- a/drivers/common/cnxk/meson.build
>> +++ b/drivers/common/cnxk/meson.build
>> @@ -86,3 +86,4 @@ sources += files('cnxk_telemetry_bphy.c',
>> )
>>
>> deps += ['bus_pci', 'net', 'telemetry']
>> +pmd_iova_as_va = true
>> diff --git a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
>b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
>> index 66cfe6ca98..16db14344d 100644
>> --- a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
>> +++ b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
>> @@ -85,7 +85,7 @@ process_outb_sa(struct roc_cpt_lf *lf, struct rte_crypto_op
>*cop,
>>
>> /* Prepare CPT instruction */
>> inst->w4.u64 = inst_w4_u64 | rte_pktmbuf_pkt_len(m_src);
>> - dptr = rte_pktmbuf_iova(m_src);
>> + dptr = rte_pktmbuf_mtod(m_src, uint64_t);
>> inst->dptr = dptr;
>> inst->rptr = dptr;
>>
>> @@ -102,7 +102,7 @@ process_inb_sa(struct rte_crypto_op *cop, struct
>cn10k_ipsec_sa *sa,
>>
>> /* Prepare CPT instruction */
>> inst->w4.u64 = sa->inst.w4 | rte_pktmbuf_pkt_len(m_src);
>> - dptr = rte_pktmbuf_iova(m_src);
>> + dptr = rte_pktmbuf_mtod(m_src, uint64_t);
>> inst->dptr = dptr;
>> inst->rptr = dptr;
>>
>> diff --git a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
>b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
>> index e469596756..8b68e4c728 100644
>> --- a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
>> +++ b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
>> @@ -99,7 +99,7 @@ process_inb_sa(struct rte_crypto_op *cop, struct
>cn9k_ipsec_sa *sa,
>>
>> /* Prepare CPT instruction */
>> inst->w4.u64 = sa->inst.w4 | rte_pktmbuf_pkt_len(m_src);
>> - inst->dptr = inst->rptr = rte_pktmbuf_iova(m_src);
>> + inst->dptr = inst->rptr = rte_pktmbuf_mtod(m_src, uint64_t);
>> inst->w7.u64 = sa->inst.w7;
>> }
>> #endif /* __CN9K_IPSEC_LA_OPS_H__ */
>> diff --git a/drivers/crypto/cnxk/meson.build b/drivers/crypto/cnxk/meson.build
>> index 23a1cc3aac..764e7bb99a 100644
>> --- a/drivers/crypto/cnxk/meson.build
>> +++ b/drivers/crypto/cnxk/meson.build
>> @@ -31,3 +31,5 @@ if get_option('buildtype').contains('debug')
>> else
>> cflags += [ '-ULA_IPSEC_DEBUG' ]
>> endif
>> +
>> +pmd_iova_as_va = true
>> diff --git a/drivers/dma/cnxk/meson.build b/drivers/dma/cnxk/meson.build
>> index d4be4ee860..ef0e3db109 100644
>> --- a/drivers/dma/cnxk/meson.build
>> +++ b/drivers/dma/cnxk/meson.build
>> @@ -3,3 +3,4 @@
>>
>> deps += ['bus_pci', 'common_cnxk', 'dmadev']
>> sources = files('cnxk_dmadev.c')
>> +pmd_iova_as_va = true
>> diff --git a/drivers/event/cnxk/meson.build b/drivers/event/cnxk/meson.build
>> index b27bae7b12..650d0d4256 100644
>> --- a/drivers/event/cnxk/meson.build
>> +++ b/drivers/event/cnxk/meson.build
>> @@ -479,3 +479,4 @@ foreach flag: extra_flags
>> endforeach
>>
>> deps += ['bus_pci', 'common_cnxk', 'net_cnxk', 'crypto_cnxk']
>> +pmd_iova_as_va = true
>> diff --git a/drivers/mempool/cnxk/meson.build
>b/drivers/mempool/cnxk/meson.build
>> index d5d1978569..a328176457 100644
>> --- a/drivers/mempool/cnxk/meson.build
>> +++ b/drivers/mempool/cnxk/meson.build
>> @@ -17,3 +17,4 @@ sources = files(
>> )
>>
>> deps += ['eal', 'mbuf', 'kvargs', 'bus_pci', 'common_cnxk', 'mempool']
>> +pmd_iova_as_va = true
>> diff --git a/drivers/net/cnxk/cn10k_tx.h b/drivers/net/cnxk/cn10k_tx.h
>> index ea13866b20..2ef62da132 100644
>> --- a/drivers/net/cnxk/cn10k_tx.h
>> +++ b/drivers/net/cnxk/cn10k_tx.h
>> @@ -1775,14 +1775,6 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue,
>uint64_t *ws,
>> mbuf2 = (uint64_t *)tx_pkts[2];
>> mbuf3 = (uint64_t *)tx_pkts[3];
>>
>> - mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
>> - offsetof(struct rte_mbuf, buf_iova));
>> /*
>> * Get mbuf's, olflags, iova, pktlen, dataoff
>> * dataoff_iovaX.D[0] = iova,
>> @@ -1790,28 +1782,24 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue,
>uint64_t *ws,
>> * len_olflagsX.D[0] = ol_flags,
>> * len_olflagsX.D[1](63:32) = mbuf->pkt_len
>> */
>> - dataoff_iova0 = vld1q_u64(mbuf0);
>> - len_olflags0 = vld1q_u64(mbuf0 + 2);
>> - dataoff_iova1 = vld1q_u64(mbuf1);
>> - len_olflags1 = vld1q_u64(mbuf1 + 2);
>> - dataoff_iova2 = vld1q_u64(mbuf2);
>> - len_olflags2 = vld1q_u64(mbuf2 + 2);
>> - dataoff_iova3 = vld1q_u64(mbuf3);
>> - len_olflags3 = vld1q_u64(mbuf3 + 2);
>> + dataoff_iova0 =
>> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off,
>vld1q_u64(mbuf0), 1);
>> + len_olflags0 = vld1q_u64(mbuf0 + 3);
>> + dataoff_iova1 =
>> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off,
>vld1q_u64(mbuf1), 1);
>> + len_olflags1 = vld1q_u64(mbuf1 + 3);
>> + dataoff_iova2 =
>> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off,
>vld1q_u64(mbuf2), 1);
>> + len_olflags2 = vld1q_u64(mbuf2 + 3);
>> + dataoff_iova3 =
>> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off,
>vld1q_u64(mbuf3), 1);
>> + len_olflags3 = vld1q_u64(mbuf3 + 3);
>>
>> /* Move mbufs to point pool */
>> - mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
>> - offsetof(struct rte_mbuf, pool) -
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
>> - offsetof(struct rte_mbuf, pool) -
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
>> - offsetof(struct rte_mbuf, pool) -
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
>> - offsetof(struct rte_mbuf, pool) -
>> - offsetof(struct rte_mbuf, buf_iova));
>> + mbuf0 = (uint64_t *)((uintptr_t)mbuf0 + offsetof(struct rte_mbuf,
>pool));
>> + mbuf1 = (uint64_t *)((uintptr_t)mbuf1 + offsetof(struct rte_mbuf,
>pool));
>> + mbuf2 = (uint64_t *)((uintptr_t)mbuf2 + offsetof(struct rte_mbuf,
>pool));
>> + mbuf3 = (uint64_t *)((uintptr_t)mbuf3 + offsetof(struct rte_mbuf,
>pool));
>>
>> if (flags & (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
>> NIX_TX_OFFLOAD_L3_L4_CSUM_F)) {
>> @@ -1861,17 +1849,6 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue,
>uint64_t *ws,
>> xtmp128 = vzip2q_u64(len_olflags0, len_olflags1);
>> ytmp128 = vzip2q_u64(len_olflags2, len_olflags3);
>>
>> - /* Clear dataoff_iovaX.D[1] bits other than dataoff(15:0) */
>> - const uint64x2_t and_mask0 = {
>> - 0xFFFFFFFFFFFFFFFF,
>> - 0x000000000000FFFF,
>> - };
>> -
>> - dataoff_iova0 = vandq_u64(dataoff_iova0, and_mask0);
>> - dataoff_iova1 = vandq_u64(dataoff_iova1, and_mask0);
>> - dataoff_iova2 = vandq_u64(dataoff_iova2, and_mask0);
>> - dataoff_iova3 = vandq_u64(dataoff_iova3, and_mask0);
>> -
>> /*
>> * Pick only 16 bits of pktlen preset at bits 63:32
>> * and place them at bits 15:0.
>> diff --git a/drivers/net/cnxk/cn9k_tx.h b/drivers/net/cnxk/cn9k_tx.h
>> index 6ce81f5c96..f5d99ccb5a 100644
>> --- a/drivers/net/cnxk/cn9k_tx.h
>> +++ b/drivers/net/cnxk/cn9k_tx.h
>> @@ -1005,14 +1005,6 @@ cn9k_nix_xmit_pkts_vector(void *tx_queue, struct
>rte_mbuf **tx_pkts,
>> mbuf2 = (uint64_t *)tx_pkts[2];
>> mbuf3 = (uint64_t *)tx_pkts[3];
>>
>> - mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
>> - offsetof(struct rte_mbuf, buf_iova));
>> /*
>> * Get mbuf's, olflags, iova, pktlen, dataoff
>> * dataoff_iovaX.D[0] = iova,
>> @@ -1020,28 +1012,24 @@ cn9k_nix_xmit_pkts_vector(void *tx_queue, struct
>rte_mbuf **tx_pkts,
>> * len_olflagsX.D[0] = ol_flags,
>> * len_olflagsX.D[1](63:32) = mbuf->pkt_len
>> */
>> - dataoff_iova0 = vld1q_u64(mbuf0);
>> - len_olflags0 = vld1q_u64(mbuf0 + 2);
>> - dataoff_iova1 = vld1q_u64(mbuf1);
>> - len_olflags1 = vld1q_u64(mbuf1 + 2);
>> - dataoff_iova2 = vld1q_u64(mbuf2);
>> - len_olflags2 = vld1q_u64(mbuf2 + 2);
>> - dataoff_iova3 = vld1q_u64(mbuf3);
>> - len_olflags3 = vld1q_u64(mbuf3 + 2);
>> + dataoff_iova0 =
>> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off,
>vld1q_u64(mbuf0), 1);
>> + len_olflags0 = vld1q_u64(mbuf0 + 3);
>> + dataoff_iova1 =
>> + vsetq_lane_u64(((struct rte_mbuf *)mbuf1)->data_off,
>vld1q_u64(mbuf1), 1);
>> + len_olflags1 = vld1q_u64(mbuf1 + 3);
>> + dataoff_iova2 =
>> + vsetq_lane_u64(((struct rte_mbuf *)mbuf2)->data_off,
>vld1q_u64(mbuf2), 1);
>> + len_olflags2 = vld1q_u64(mbuf2 + 3);
>> + dataoff_iova3 =
>> + vsetq_lane_u64(((struct rte_mbuf *)mbuf3)->data_off,
>vld1q_u64(mbuf3), 1);
>> + len_olflags3 = vld1q_u64(mbuf3 + 3);
>>
>> /* Move mbufs to point pool */
>> - mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
>> - offsetof(struct rte_mbuf, pool) -
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
>> - offsetof(struct rte_mbuf, pool) -
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
>> - offsetof(struct rte_mbuf, pool) -
>> - offsetof(struct rte_mbuf, buf_iova));
>> - mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
>> - offsetof(struct rte_mbuf, pool) -
>> - offsetof(struct rte_mbuf, buf_iova));
>> + mbuf0 = (uint64_t *)((uintptr_t)mbuf0 + offsetof(struct rte_mbuf,
>pool));
>> + mbuf1 = (uint64_t *)((uintptr_t)mbuf1 + offsetof(struct rte_mbuf,
>pool));
>> + mbuf2 = (uint64_t *)((uintptr_t)mbuf2 + offsetof(struct rte_mbuf,
>pool));
>> + mbuf3 = (uint64_t *)((uintptr_t)mbuf3 + offsetof(struct rte_mbuf,
>pool));
>>
>> if (flags & (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
>> NIX_TX_OFFLOAD_L3_L4_CSUM_F)) {
>> @@ -1091,17 +1079,6 @@ cn9k_nix_xmit_pkts_vector(void *tx_queue, struct
>rte_mbuf **tx_pkts,
>> xtmp128 = vzip2q_u64(len_olflags0, len_olflags1);
>> ytmp128 = vzip2q_u64(len_olflags2, len_olflags3);
>>
>> - /* Clear dataoff_iovaX.D[1] bits other than dataoff(15:0) */
>> - const uint64x2_t and_mask0 = {
>> - 0xFFFFFFFFFFFFFFFF,
>> - 0x000000000000FFFF,
>> - };
>> -
>> - dataoff_iova0 = vandq_u64(dataoff_iova0, and_mask0);
>> - dataoff_iova1 = vandq_u64(dataoff_iova1, and_mask0);
>> - dataoff_iova2 = vandq_u64(dataoff_iova2, and_mask0);
>> - dataoff_iova3 = vandq_u64(dataoff_iova3, and_mask0);
>> -
>> /*
>> * Pick only 16 bits of pktlen preset at bits 63:32
>> * and place them at bits 15:0.
>> diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
>> index 4cb7c9e90c..abf1e4215f 100644
>> --- a/drivers/net/cnxk/cnxk_ethdev.h
>> +++ b/drivers/net/cnxk/cnxk_ethdev.h
>> @@ -690,7 +690,6 @@ cnxk_pktmbuf_detach(struct rte_mbuf *m)
>>
>> m->priv_size = priv_size;
>> m->buf_addr = (char *)m + mbuf_size;
>> - m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;
>> m->buf_len = (uint16_t)buf_len;
>> rte_pktmbuf_reset_headroom(m);
>> m->data_len = 0;
>> diff --git a/drivers/net/cnxk/meson.build b/drivers/net/cnxk/meson.build
>> index f347e98fce..01489b3a36 100644
>> --- a/drivers/net/cnxk/meson.build
>> +++ b/drivers/net/cnxk/meson.build
>> @@ -194,3 +194,4 @@ foreach flag: extra_flags
>> endforeach
>>
>> headers = files('rte_pmd_cnxk.h')
>> +pmd_iova_as_va = true
>> diff --git a/drivers/raw/cnxk_bphy/meson.build
>b/drivers/raw/cnxk_bphy/meson.build
>> index 14147feaf4..781ed63e05 100644
>> --- a/drivers/raw/cnxk_bphy/meson.build
>> +++ b/drivers/raw/cnxk_bphy/meson.build
>> @@ -10,3 +10,4 @@ sources = files(
>> 'cnxk_bphy_irq.c',
>> )
>> headers = files('rte_pmd_bphy.h')
>> +pmd_iova_as_va = true
>> diff --git a/drivers/raw/cnxk_gpio/meson.build
>b/drivers/raw/cnxk_gpio/meson.build
>> index a75a5b9084..f9aed173b6 100644
>> --- a/drivers/raw/cnxk_gpio/meson.build
>> +++ b/drivers/raw/cnxk_gpio/meson.build
>> @@ -9,3 +9,4 @@ sources = files(
>> 'cnxk_gpio_selftest.c',
>> )
>> headers = files('rte_pmd_cnxk_gpio.h')
>> +pmd_iova_as_va = true
>> --
>> 2.25.1
>>
^ permalink raw reply [relevance 0%]
* RE: [EXT] Re: [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build
2022-09-28 19:48 0% ` Stephen Hemminger
@ 2022-09-29 6:13 0% ` Shijith Thotton
0 siblings, 0 replies; 200+ results
From: Shijith Thotton @ 2022-09-29 6:13 UTC (permalink / raw)
To: Stephen Hemminger, Olivier Matz
Cc: Thomas Monjalon, dev, Pavan Nikhilesh Bhagavatula,
Honnappa.Nagarahalli, bruce.richardson,
Jerin Jacob Kollanukkaran, mb, david.marchand
>> > > mbuf physical address field is not used in builds which only uses VA. It
>> > > is used to expand the dynamic field area.
>> > >
>> > > Signed-off-by: Shijith Thotton <sthotton@marvell.com>
>> >
>> > We cannot condition the use of the dynamic field.
>> > I think it is enough justification to reject this patch.
>>
>> I don't think it is an issue.
>>
>> > And about adding a compilation option for IOVA in the first patch of this series,
>> > I think it is not the direction the majority wants DPDK to go.
>> > We tend to avoid compilation options.
>>
>> In general, I agree that we don't want to have many custom compile-time
>options,
>> especially if they impact ABI. It has several issues that have already been
>> widely discussed.
>>
>> However, in this specific case, we can suppose that removing buf_iova is a
>> long-term goal (in years). Having this compile-time option is a way to test this
>> approach, and progressively prepare the drivers to support it. Then, in few
>> years (if we are still convinced), we may announce an abi breakage and switch to
>> this new mode by default.
>
>Since field is invalid if compile option is set,
>shouldn't the field be inside an #ifdef so that if a driver or application
>was to make the mistake of using that directly, it would fail at compile
>time instead of runtime.
>
>Leaving booby traps for applications and drivers is bad design.
Will move to using #ifdef in v4.
^ permalink raw reply [relevance 0%]
* Re: [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build
2022-09-28 12:52 4% ` Olivier Matz
2022-09-28 19:33 0% ` Thomas Monjalon
@ 2022-09-28 19:48 0% ` Stephen Hemminger
2022-09-29 6:13 0% ` [EXT] " Shijith Thotton
1 sibling, 1 reply; 200+ results
From: Stephen Hemminger @ 2022-09-28 19:48 UTC (permalink / raw)
To: Olivier Matz
Cc: Thomas Monjalon, Shijith Thotton, dev, pbhagavatula,
Honnappa.Nagarahalli, bruce.richardson, jerinj, mb,
david.marchand
On Wed, 28 Sep 2022 14:52:47 +0200
Olivier Matz <olivier.matz@6wind.com> wrote:
> On Wed, Sep 28, 2022 at 09:24:51AM +0200, Thomas Monjalon wrote:
> > 21/09/2022 15:56, Shijith Thotton:
> > > mbuf physical address field is not used in builds which only uses VA. It
> > > is used to expand the dynamic field area.
> > >
> > > Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> >
> > We cannot condition the use of the dynamic field.
> > I think it is enough justification to reject this patch.
>
> I don't think it is an issue.
>
> > And about adding a compilation option for IOVA in the first patch of this series,
> > I think it is not the direction the majority wants DPDK to go.
> > We tend to avoid compilation options.
>
> In general, I agree that we don't want to have many custom compile-time options,
> especially if they impact ABI. It has several issues that have already been
> widely discussed.
>
> However, in this specific case, we can suppose that removing buf_iova is a
> long-term goal (in years). Having this compile-time option is a way to test this
> approach, and progressively prepare the drivers to support it. Then, in few
> years (if we are still convinced), we may announce an abi breakage and switch to
> this new mode by default.
Since field is invalid if compile option is set,
shouldn't the field be inside an #ifdef so that if a driver or application
was to make the mistake of using that directly, it would fail at compile
time instead of runtime.
Leaving booby traps for applications and drivers is bad design.
^ permalink raw reply [relevance 0%]
* Re: [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build
2022-09-28 12:52 4% ` Olivier Matz
@ 2022-09-28 19:33 0% ` Thomas Monjalon
2022-09-28 19:48 0% ` Stephen Hemminger
1 sibling, 0 replies; 200+ results
From: Thomas Monjalon @ 2022-09-28 19:33 UTC (permalink / raw)
To: Olivier Matz
Cc: Shijith Thotton, dev, pbhagavatula, Honnappa.Nagarahalli,
bruce.richardson, jerinj, mb, stephen, david.marchand
28/09/2022 14:52, Olivier Matz:
> On Wed, Sep 28, 2022 at 09:24:51AM +0200, Thomas Monjalon wrote:
> > 21/09/2022 15:56, Shijith Thotton:
> > > mbuf physical address field is not used in builds which only uses VA. It
> > > is used to expand the dynamic field area.
> > >
> > > Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> >
> > We cannot condition the use of the dynamic field.
> > I think it is enough justification to reject this patch.
>
> I don't think it is an issue.
>
> > And about adding a compilation option for IOVA in the first patch of this series,
> > I think it is not the direction the majority wants DPDK to go.
> > We tend to avoid compilation options.
>
> In general, I agree that we don't want to have many custom compile-time options,
> especially if they impact ABI. It has several issues that have already been
> widely discussed.
>
> However, in this specific case, we can suppose that removing buf_iova is a
> long-term goal (in years). Having this compile-time option is a way to test this
> approach, and progressively prepare the drivers to support it. Then, in few
> years (if we are still convinced), we may announce an abi breakage and switch to
> this new mode by default.
You convinced me.
^ permalink raw reply [relevance 0%]
* Re: [PATCH v3 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA
@ 2022-09-28 12:53 4% ` Olivier Matz
2022-09-29 6:19 0% ` [EXT] " Shijith Thotton
0 siblings, 1 reply; 200+ results
From: Olivier Matz @ 2022-09-28 12:53 UTC (permalink / raw)
To: Shijith Thotton
Cc: dev, pbhagavatula, Honnappa.Nagarahalli, bruce.richardson,
jerinj, mb, stephen, thomas, david.marchand, Ruifeng Wang,
Jan Viktorin, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
Satha Rao, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
Radha Mohan Chintakuntla, Veerasenareddy Burru,
Ashwin Sekhar T K, Jakub Palider, Tomasz Duszynski
On Wed, Sep 21, 2022 at 07:26:20PM +0530, Shijith Thotton wrote:
> Enabled the flag pmd_iova_as_va in cnxk driver build files as they work
> with IOVA as VA. Updated cn9k and cn10k soc build configurations to
> enable the IOVA as VA build by default.
>
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> ---
> config/arm/meson.build | 8 +++-
> drivers/common/cnxk/meson.build | 1 +
> drivers/crypto/cnxk/cn10k_ipsec_la_ops.h | 4 +-
> drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 2 +-
> drivers/crypto/cnxk/meson.build | 2 +
> drivers/dma/cnxk/meson.build | 1 +
> drivers/event/cnxk/meson.build | 1 +
> drivers/mempool/cnxk/meson.build | 1 +
> drivers/net/cnxk/cn10k_tx.h | 55 +++++++-----------------
> drivers/net/cnxk/cn9k_tx.h | 55 +++++++-----------------
> drivers/net/cnxk/cnxk_ethdev.h | 1 -
> drivers/net/cnxk/meson.build | 1 +
> drivers/raw/cnxk_bphy/meson.build | 1 +
> drivers/raw/cnxk_gpio/meson.build | 1 +
> 14 files changed, 50 insertions(+), 84 deletions(-)
>
> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index 9f1636e0d5..4e95e8b388 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -294,7 +294,8 @@ soc_cn10k = {
> 'flags': [
> ['RTE_MAX_LCORE', 24],
> ['RTE_MAX_NUMA_NODES', 1],
> - ['RTE_MEMPOOL_ALIGN', 128]
> + ['RTE_MEMPOOL_ALIGN', 128],
> + ['RTE_IOVA_AS_VA', 1]
> ],
> 'part_number': '0xd49',
> 'extra_march_features': ['crypto'],
> @@ -370,7 +371,10 @@ soc_cn9k = {
> 'description': 'Marvell OCTEON 9',
> 'implementer': '0x43',
> 'part_number': '0xb2',
> - 'numa': false
> + 'numa': false,
> + 'flags': [
> + ['RTE_IOVA_AS_VA', 1]
> + ]
> }
I think this could go in a separate patch: "disable IOVA as PA for octeontx2/3"
The reason is that this patch clearly breaks the API (m->buf_iova field
becomes invalid) and the ABI (mbuf fields are moved) for these
architectures. This ABI breakage has to be advertised in the release
note. In fact, it should have been advertised before, but I suppose it
does not impact general purpose arm distributions, so I guess it is ok.
One other thing to highlight: enabling RTE_IOVA_AS_VA means that it
disable all drivers that do not have the pmd_iova_as_va flag. Are there
use-cases where drivers other than cnxk are used? For instance, is there
a PCI bus which is likely to be used by a driver/* ?
>
> soc_stingray = {
> diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build
> index 6f808271d1..d019cfa8d1 100644
> --- a/drivers/common/cnxk/meson.build
> +++ b/drivers/common/cnxk/meson.build
> @@ -86,3 +86,4 @@ sources += files('cnxk_telemetry_bphy.c',
> )
>
> deps += ['bus_pci', 'net', 'telemetry']
> +pmd_iova_as_va = true
> diff --git a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
> index 66cfe6ca98..16db14344d 100644
> --- a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
> +++ b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
> @@ -85,7 +85,7 @@ process_outb_sa(struct roc_cpt_lf *lf, struct rte_crypto_op *cop,
>
> /* Prepare CPT instruction */
> inst->w4.u64 = inst_w4_u64 | rte_pktmbuf_pkt_len(m_src);
> - dptr = rte_pktmbuf_iova(m_src);
> + dptr = rte_pktmbuf_mtod(m_src, uint64_t);
> inst->dptr = dptr;
> inst->rptr = dptr;
>
> @@ -102,7 +102,7 @@ process_inb_sa(struct rte_crypto_op *cop, struct cn10k_ipsec_sa *sa,
>
> /* Prepare CPT instruction */
> inst->w4.u64 = sa->inst.w4 | rte_pktmbuf_pkt_len(m_src);
> - dptr = rte_pktmbuf_iova(m_src);
> + dptr = rte_pktmbuf_mtod(m_src, uint64_t);
> inst->dptr = dptr;
> inst->rptr = dptr;
>
> diff --git a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
> index e469596756..8b68e4c728 100644
> --- a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
> +++ b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
> @@ -99,7 +99,7 @@ process_inb_sa(struct rte_crypto_op *cop, struct cn9k_ipsec_sa *sa,
>
> /* Prepare CPT instruction */
> inst->w4.u64 = sa->inst.w4 | rte_pktmbuf_pkt_len(m_src);
> - inst->dptr = inst->rptr = rte_pktmbuf_iova(m_src);
> + inst->dptr = inst->rptr = rte_pktmbuf_mtod(m_src, uint64_t);
> inst->w7.u64 = sa->inst.w7;
> }
> #endif /* __CN9K_IPSEC_LA_OPS_H__ */
> diff --git a/drivers/crypto/cnxk/meson.build b/drivers/crypto/cnxk/meson.build
> index 23a1cc3aac..764e7bb99a 100644
> --- a/drivers/crypto/cnxk/meson.build
> +++ b/drivers/crypto/cnxk/meson.build
> @@ -31,3 +31,5 @@ if get_option('buildtype').contains('debug')
> else
> cflags += [ '-ULA_IPSEC_DEBUG' ]
> endif
> +
> +pmd_iova_as_va = true
> diff --git a/drivers/dma/cnxk/meson.build b/drivers/dma/cnxk/meson.build
> index d4be4ee860..ef0e3db109 100644
> --- a/drivers/dma/cnxk/meson.build
> +++ b/drivers/dma/cnxk/meson.build
> @@ -3,3 +3,4 @@
>
> deps += ['bus_pci', 'common_cnxk', 'dmadev']
> sources = files('cnxk_dmadev.c')
> +pmd_iova_as_va = true
> diff --git a/drivers/event/cnxk/meson.build b/drivers/event/cnxk/meson.build
> index b27bae7b12..650d0d4256 100644
> --- a/drivers/event/cnxk/meson.build
> +++ b/drivers/event/cnxk/meson.build
> @@ -479,3 +479,4 @@ foreach flag: extra_flags
> endforeach
>
> deps += ['bus_pci', 'common_cnxk', 'net_cnxk', 'crypto_cnxk']
> +pmd_iova_as_va = true
> diff --git a/drivers/mempool/cnxk/meson.build b/drivers/mempool/cnxk/meson.build
> index d5d1978569..a328176457 100644
> --- a/drivers/mempool/cnxk/meson.build
> +++ b/drivers/mempool/cnxk/meson.build
> @@ -17,3 +17,4 @@ sources = files(
> )
>
> deps += ['eal', 'mbuf', 'kvargs', 'bus_pci', 'common_cnxk', 'mempool']
> +pmd_iova_as_va = true
> diff --git a/drivers/net/cnxk/cn10k_tx.h b/drivers/net/cnxk/cn10k_tx.h
> index ea13866b20..2ef62da132 100644
> --- a/drivers/net/cnxk/cn10k_tx.h
> +++ b/drivers/net/cnxk/cn10k_tx.h
> @@ -1775,14 +1775,6 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue, uint64_t *ws,
> mbuf2 = (uint64_t *)tx_pkts[2];
> mbuf3 = (uint64_t *)tx_pkts[3];
>
> - mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
> - offsetof(struct rte_mbuf, buf_iova));
> /*
> * Get mbuf's, olflags, iova, pktlen, dataoff
> * dataoff_iovaX.D[0] = iova,
> @@ -1790,28 +1782,24 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue, uint64_t *ws,
> * len_olflagsX.D[0] = ol_flags,
> * len_olflagsX.D[1](63:32) = mbuf->pkt_len
> */
> - dataoff_iova0 = vld1q_u64(mbuf0);
> - len_olflags0 = vld1q_u64(mbuf0 + 2);
> - dataoff_iova1 = vld1q_u64(mbuf1);
> - len_olflags1 = vld1q_u64(mbuf1 + 2);
> - dataoff_iova2 = vld1q_u64(mbuf2);
> - len_olflags2 = vld1q_u64(mbuf2 + 2);
> - dataoff_iova3 = vld1q_u64(mbuf3);
> - len_olflags3 = vld1q_u64(mbuf3 + 2);
> + dataoff_iova0 =
> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off, vld1q_u64(mbuf0), 1);
> + len_olflags0 = vld1q_u64(mbuf0 + 3);
> + dataoff_iova1 =
> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off, vld1q_u64(mbuf1), 1);
> + len_olflags1 = vld1q_u64(mbuf1 + 3);
> + dataoff_iova2 =
> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off, vld1q_u64(mbuf2), 1);
> + len_olflags2 = vld1q_u64(mbuf2 + 3);
> + dataoff_iova3 =
> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off, vld1q_u64(mbuf3), 1);
> + len_olflags3 = vld1q_u64(mbuf3 + 3);
>
> /* Move mbufs to point pool */
> - mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
> - offsetof(struct rte_mbuf, pool) -
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
> - offsetof(struct rte_mbuf, pool) -
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
> - offsetof(struct rte_mbuf, pool) -
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
> - offsetof(struct rte_mbuf, pool) -
> - offsetof(struct rte_mbuf, buf_iova));
> + mbuf0 = (uint64_t *)((uintptr_t)mbuf0 + offsetof(struct rte_mbuf, pool));
> + mbuf1 = (uint64_t *)((uintptr_t)mbuf1 + offsetof(struct rte_mbuf, pool));
> + mbuf2 = (uint64_t *)((uintptr_t)mbuf2 + offsetof(struct rte_mbuf, pool));
> + mbuf3 = (uint64_t *)((uintptr_t)mbuf3 + offsetof(struct rte_mbuf, pool));
>
> if (flags & (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
> NIX_TX_OFFLOAD_L3_L4_CSUM_F)) {
> @@ -1861,17 +1849,6 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue, uint64_t *ws,
> xtmp128 = vzip2q_u64(len_olflags0, len_olflags1);
> ytmp128 = vzip2q_u64(len_olflags2, len_olflags3);
>
> - /* Clear dataoff_iovaX.D[1] bits other than dataoff(15:0) */
> - const uint64x2_t and_mask0 = {
> - 0xFFFFFFFFFFFFFFFF,
> - 0x000000000000FFFF,
> - };
> -
> - dataoff_iova0 = vandq_u64(dataoff_iova0, and_mask0);
> - dataoff_iova1 = vandq_u64(dataoff_iova1, and_mask0);
> - dataoff_iova2 = vandq_u64(dataoff_iova2, and_mask0);
> - dataoff_iova3 = vandq_u64(dataoff_iova3, and_mask0);
> -
> /*
> * Pick only 16 bits of pktlen preset at bits 63:32
> * and place them at bits 15:0.
> diff --git a/drivers/net/cnxk/cn9k_tx.h b/drivers/net/cnxk/cn9k_tx.h
> index 6ce81f5c96..f5d99ccb5a 100644
> --- a/drivers/net/cnxk/cn9k_tx.h
> +++ b/drivers/net/cnxk/cn9k_tx.h
> @@ -1005,14 +1005,6 @@ cn9k_nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts,
> mbuf2 = (uint64_t *)tx_pkts[2];
> mbuf3 = (uint64_t *)tx_pkts[3];
>
> - mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
> - offsetof(struct rte_mbuf, buf_iova));
> /*
> * Get mbuf's, olflags, iova, pktlen, dataoff
> * dataoff_iovaX.D[0] = iova,
> @@ -1020,28 +1012,24 @@ cn9k_nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts,
> * len_olflagsX.D[0] = ol_flags,
> * len_olflagsX.D[1](63:32) = mbuf->pkt_len
> */
> - dataoff_iova0 = vld1q_u64(mbuf0);
> - len_olflags0 = vld1q_u64(mbuf0 + 2);
> - dataoff_iova1 = vld1q_u64(mbuf1);
> - len_olflags1 = vld1q_u64(mbuf1 + 2);
> - dataoff_iova2 = vld1q_u64(mbuf2);
> - len_olflags2 = vld1q_u64(mbuf2 + 2);
> - dataoff_iova3 = vld1q_u64(mbuf3);
> - len_olflags3 = vld1q_u64(mbuf3 + 2);
> + dataoff_iova0 =
> + vsetq_lane_u64(((struct rte_mbuf *)mbuf0)->data_off, vld1q_u64(mbuf0), 1);
> + len_olflags0 = vld1q_u64(mbuf0 + 3);
> + dataoff_iova1 =
> + vsetq_lane_u64(((struct rte_mbuf *)mbuf1)->data_off, vld1q_u64(mbuf1), 1);
> + len_olflags1 = vld1q_u64(mbuf1 + 3);
> + dataoff_iova2 =
> + vsetq_lane_u64(((struct rte_mbuf *)mbuf2)->data_off, vld1q_u64(mbuf2), 1);
> + len_olflags2 = vld1q_u64(mbuf2 + 3);
> + dataoff_iova3 =
> + vsetq_lane_u64(((struct rte_mbuf *)mbuf3)->data_off, vld1q_u64(mbuf3), 1);
> + len_olflags3 = vld1q_u64(mbuf3 + 3);
>
> /* Move mbufs to point pool */
> - mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
> - offsetof(struct rte_mbuf, pool) -
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
> - offsetof(struct rte_mbuf, pool) -
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
> - offsetof(struct rte_mbuf, pool) -
> - offsetof(struct rte_mbuf, buf_iova));
> - mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
> - offsetof(struct rte_mbuf, pool) -
> - offsetof(struct rte_mbuf, buf_iova));
> + mbuf0 = (uint64_t *)((uintptr_t)mbuf0 + offsetof(struct rte_mbuf, pool));
> + mbuf1 = (uint64_t *)((uintptr_t)mbuf1 + offsetof(struct rte_mbuf, pool));
> + mbuf2 = (uint64_t *)((uintptr_t)mbuf2 + offsetof(struct rte_mbuf, pool));
> + mbuf3 = (uint64_t *)((uintptr_t)mbuf3 + offsetof(struct rte_mbuf, pool));
>
> if (flags & (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
> NIX_TX_OFFLOAD_L3_L4_CSUM_F)) {
> @@ -1091,17 +1079,6 @@ cn9k_nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts,
> xtmp128 = vzip2q_u64(len_olflags0, len_olflags1);
> ytmp128 = vzip2q_u64(len_olflags2, len_olflags3);
>
> - /* Clear dataoff_iovaX.D[1] bits other than dataoff(15:0) */
> - const uint64x2_t and_mask0 = {
> - 0xFFFFFFFFFFFFFFFF,
> - 0x000000000000FFFF,
> - };
> -
> - dataoff_iova0 = vandq_u64(dataoff_iova0, and_mask0);
> - dataoff_iova1 = vandq_u64(dataoff_iova1, and_mask0);
> - dataoff_iova2 = vandq_u64(dataoff_iova2, and_mask0);
> - dataoff_iova3 = vandq_u64(dataoff_iova3, and_mask0);
> -
> /*
> * Pick only 16 bits of pktlen preset at bits 63:32
> * and place them at bits 15:0.
> diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
> index 4cb7c9e90c..abf1e4215f 100644
> --- a/drivers/net/cnxk/cnxk_ethdev.h
> +++ b/drivers/net/cnxk/cnxk_ethdev.h
> @@ -690,7 +690,6 @@ cnxk_pktmbuf_detach(struct rte_mbuf *m)
>
> m->priv_size = priv_size;
> m->buf_addr = (char *)m + mbuf_size;
> - m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;
> m->buf_len = (uint16_t)buf_len;
> rte_pktmbuf_reset_headroom(m);
> m->data_len = 0;
> diff --git a/drivers/net/cnxk/meson.build b/drivers/net/cnxk/meson.build
> index f347e98fce..01489b3a36 100644
> --- a/drivers/net/cnxk/meson.build
> +++ b/drivers/net/cnxk/meson.build
> @@ -194,3 +194,4 @@ foreach flag: extra_flags
> endforeach
>
> headers = files('rte_pmd_cnxk.h')
> +pmd_iova_as_va = true
> diff --git a/drivers/raw/cnxk_bphy/meson.build b/drivers/raw/cnxk_bphy/meson.build
> index 14147feaf4..781ed63e05 100644
> --- a/drivers/raw/cnxk_bphy/meson.build
> +++ b/drivers/raw/cnxk_bphy/meson.build
> @@ -10,3 +10,4 @@ sources = files(
> 'cnxk_bphy_irq.c',
> )
> headers = files('rte_pmd_bphy.h')
> +pmd_iova_as_va = true
> diff --git a/drivers/raw/cnxk_gpio/meson.build b/drivers/raw/cnxk_gpio/meson.build
> index a75a5b9084..f9aed173b6 100644
> --- a/drivers/raw/cnxk_gpio/meson.build
> +++ b/drivers/raw/cnxk_gpio/meson.build
> @@ -9,3 +9,4 @@ sources = files(
> 'cnxk_gpio_selftest.c',
> )
> headers = files('rte_pmd_cnxk_gpio.h')
> +pmd_iova_as_va = true
> --
> 2.25.1
>
^ permalink raw reply [relevance 4%]
* Re: [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build
@ 2022-09-28 12:52 4% ` Olivier Matz
2022-09-28 19:33 0% ` Thomas Monjalon
2022-09-28 19:48 0% ` Stephen Hemminger
0 siblings, 2 replies; 200+ results
From: Olivier Matz @ 2022-09-28 12:52 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Shijith Thotton, dev, pbhagavatula, Honnappa.Nagarahalli,
bruce.richardson, jerinj, mb, stephen, david.marchand
On Wed, Sep 28, 2022 at 09:24:51AM +0200, Thomas Monjalon wrote:
> 21/09/2022 15:56, Shijith Thotton:
> > mbuf physical address field is not used in builds which only uses VA. It
> > is used to expand the dynamic field area.
> >
> > Signed-off-by: Shijith Thotton <sthotton@marvell.com>
>
> We cannot condition the use of the dynamic field.
> I think it is enough justification to reject this patch.
I don't think it is an issue.
> And about adding a compilation option for IOVA in the first patch of this series,
> I think it is not the direction the majority wants DPDK to go.
> We tend to avoid compilation options.
In general, I agree that we don't want to have many custom compile-time options,
especially if they impact ABI. It has several issues that have already been
widely discussed.
However, in this specific case, we can suppose that removing buf_iova is a
long-term goal (in years). Having this compile-time option is a way to test this
approach, and progressively prepare the drivers to support it. Then, in few
years (if we are still convinced), we may announce an abi breakage and switch to
this new mode by default.
Olivier
^ permalink raw reply [relevance 4%]
* Re: [PATCH v2 1/1] ethdev: support congestion management
@ 2022-09-28 8:19 0% ` Andrew Rybchenko
2022-09-29 9:35 2% ` [PATCH v3 " skori
1 sibling, 0 replies; 200+ results
From: Andrew Rybchenko @ 2022-09-28 8:19 UTC (permalink / raw)
To: skori, Ferruh Yigit, Thomas Monjalon, Ray Kinsella
Cc: dev, Jerin Jacob, david.marchand
Cc David. See some kind of reincarnation of RTE_FUNC_PTR_*
macro below.
On 9/19/22 15:15, skori@marvell.com wrote:
> From: Jerin Jacob <jerinj@marvell.com>
>
> NIC HW controllers often come with congestion management support on
> various HW objects such as Rx queue depth or mempool queue depth.
>
> Also, it can support various modes of operation such as RED
> (Random early discard), WRED etc on those HW objects.
>
> This patch adds a framework to express such modes(enum rte_cman_mode)
> and introduce (enum rte_eth_cman_obj) to enumerate the different
> objects where the modes can operate on.
>
> This patch adds RTE_CMAN_RED mode of operation and
> RTE_ETH_CMAN_OBJ_RX_QUEUE, RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL object.
>
> Introduced reserved fields in configuration structure
> backed by rte_eth_cman_config_init() to add new configuration
> parameters without ABI breakage.
>
> Added rte_eth_cman_info_get() API to get the information such as
> supported modes and objects.
>
> Added rte_eth_cman_config_init(), rte_eth_cman_config_set() APIs
> to configure congestion management on those object with associated mode.
>
> Finally, Added rte_eth_cman_config_get() API to retrieve the
> applied configuration.
>
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
[snip]
> diff --git a/lib/eal/include/rte_cman.h b/lib/eal/include/rte_cman.h
> new file mode 100644
> index 0000000000..1d84ddf0fb
> --- /dev/null
> +++ b/lib/eal/include/rte_cman.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2022 Marvell International Ltd.
> + */
> +
> +#ifndef RTE_CMAN_H
> +#define RTE_CMAN_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_bitops.h>
> +
> +/**
> + * @file
> + * Congestion management related parameters for DPDK.
> + */
> +
> +/** Congestion management modes */
> +enum rte_cman_mode {
> + /**
> + * Congestion based on Random Early Detection.
> + *
> + * https://en.wikipedia.org/wiki/Random_early_detection
> + * http://www.aciri.org/floyd/papers/red/red.html
> + * @see struct rte_cman_red_params
> + */
> + RTE_CMAN_RED = RTE_BIT64(0),
I believe enums with 64-bit values are bad.
> +};
> +
> +/**
> + * RED based congestion management configuration parameters.
> + */
> +struct rte_cman_red_params {
> + /**
> + * Minimum threshold (min_th) value
> + *
> + * Value expressed as percentage. Value must be in 0 to 100(inclusive).
> + */
> + uint8_t min_th;
> + /**
> + * Maximum threshold (max_th) value
> + *
> + * Value expressed as percentage. Value must be in 0 to 100(inclusive).
> + */
> + uint8_t max_th;
> + /** Inverse of packet marking probability maximum value (maxp = 1 / maxp_inv) */
> + uint16_t maxp_inv;
> +};
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* RTE_CMAN_H */
> diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
> index 47bb2625b0..59ad49114f 100644
> --- a/lib/ethdev/meson.build
> +++ b/lib/ethdev/meson.build
> @@ -7,6 +7,7 @@ sources = files(
> 'ethdev_profile.c',
> 'ethdev_trace_points.c',
> 'rte_class_eth.c',
> + 'rte_cman.c',
> 'rte_ethdev.c',
> 'rte_flow.c',
> 'rte_mtr.c',
> diff --git a/lib/ethdev/rte_cman.c b/lib/ethdev/rte_cman.c
> new file mode 100644
> index 0000000000..2093c247d1
> --- /dev/null
> +++ b/lib/ethdev/rte_cman.c
> @@ -0,0 +1,101 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2022 Marvell International Ltd.
> + */
> +
> +#include <stdint.h>
> +
> +#include <rte_errno.h>
> +#include "rte_ethdev.h"
> +#include "ethdev_driver.h"
> +
> +static int
> +eth_err(uint16_t port_id, int ret)
> +{
> + if (ret == 0)
> + return 0;
> +
> + if (rte_eth_dev_is_removed(port_id))
> + return -EIO;
> +
> + return ret;
> +}
It is a dup from rte_ethdev.c. I think it should be moved to some
internal header.
> +
> +#define RTE_CMAN_FUNC_ERR_RET(func) \
There is nothing CMAN specific in the function except location.
Cc David who deprecated similar macros in the release cycle,
but this one have a log message.
> +do { \
> + if (func == NULL) { \
> + RTE_ETHDEV_LOG(ERR, "Function not implemented\n"); \
> + return -ENOTSUP; \
> + } \
> +} while (0)
> +
> +/* Get congestion management information for a port */
> +int
> +rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (info == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management info is NULL\n");
> + return -EINVAL;
> + }
> +
> + RTE_CMAN_FUNC_ERR_RET(dev->dev_ops->cman_info_get);
I think we should memset(&info, 0, sizeof(*info)) here since
all drivers must do it anyway.
> + return eth_err(port_id, (*dev->dev_ops->cman_info_get)(dev, info));
> +}
> +
> +/* Initialize congestion management structure with default values */
> +int
> +rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + RTE_CMAN_FUNC_ERR_RET(dev->dev_ops->cman_config_init);
> + return eth_err(port_id, (*dev->dev_ops->cman_config_init)(dev, config));
> +}
> +
> +/* Configure congestion management on a port */
> +int
> +rte_eth_cman_config_set(uint16_t port_id, struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + RTE_CMAN_FUNC_ERR_RET(dev->dev_ops->cman_config_set);
> + return eth_err(port_id, (*dev->dev_ops->cman_config_set)(dev, config));
> +}
> +
> +/* Retrieve congestion management configuration of a port */
> +int
> +rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
> +
> + if (config == NULL) {
> + RTE_ETHDEV_LOG(ERR, "congestion management config is NULL\n");
> + return -EINVAL;
> + }
> +
> + RTE_CMAN_FUNC_ERR_RET(dev->dev_ops->cman_config_get);
memset(&config, 0, sizeof(*config));
> + return eth_err(port_id, (*dev->dev_ops->cman_config_get)(dev, config));
> +}
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index de9e970d4d..f4bb644c6a 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -160,6 +160,7 @@ extern "C" {
> #define RTE_ETHDEV_DEBUG_TX
> #endif
>
> +#include <rte_cman.h>
> #include <rte_compat.h>
> #include <rte_log.h>
> #include <rte_interrupts.h>
> @@ -5506,6 +5507,156 @@ typedef struct {
> __rte_experimental
> int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file);
>
> +/* Congestion management */
> +
> +/** Enumerate list of ethdev congestion management objects */
> +enum rte_eth_cman_obj {
> + /** Congestion management based on Rx queue depth */
> + RTE_ETH_CMAN_OBJ_RX_QUEUE = RTE_BIT64(0),
> + /**
> + * Congestion management based on mempool depth associated with Rx queue
> + * @see rte_eth_rx_queue_setup()
> + */
> + RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL = RTE_BIT64(1),
Do we really want one more enum with 64-bit initialized member?
IMHO, it should be either defines or 32-bit.
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
> + *
> + * A structure used to retrieve information of ethdev congestion management.
> + */
> +struct rte_eth_cman_info {
> + /**
> + * Set of supported congestion management modes
> + * @see enum rte_cman_mode
> + */
> + uint64_t modes_supported;
> + /**
> + * Set of supported congestion management objects
> + * @see enum rte_eth_cman_obj
> + */
> + uint64_t objs_supported;
> + /** Reserved for future fields */
I think we should highlight that it is set to zeros on get
right now.
> + uint8_t rsvd[8];
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change, or be removed, without prior notice
> + *
> + * A structure used to configure the ethdev congestion management.
> + */
> +struct rte_eth_cman_config {
> + /** Congestion management object */
> + enum rte_eth_cman_obj obj;
> + /** Congestion management mode */
> + enum rte_cman_mode mode;
> + union {
> + /**
> + * Rx queue to configure congestion management.
> + *
> + * Valid when object is RTE_ETH_CMAN_OBJ_RX_QUEUE or
> + * RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL.
> + */
> + uint16_t rx_queue;
> + /** Reserved for future fields */
Must be zeros on get and set right now.
> + uint8_t rsvd_obj_params[4];
> + } obj_param;
> + union {
> + /**
> + * RED configuration parameters.
> + *
> + * Valid when mode is RTE_CMAN_RED.
> + */
> + struct rte_cman_red_params red;
> + /** Reserved for future fields */
> + uint8_t rsvd_mode_params[4];
same here.
> + } mode_param;
> +};
> +
[snip]
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Configure ethdev congestion management
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param config
> + * A pointer to a structure of type *rte_eth_cman_config* to be configured.
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP) if support for cman_config_set does not exist.
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_cman_config_set(uint16_t port_id, struct rte_eth_cman_config *config);
Just a niot, but may be config should be 'const'?
[snip]
^ permalink raw reply [relevance 0%]
* [PATCH v3] ethdev: queue rate parameter changed from 16b to 32b
@ 2022-09-28 5:51 3% ` skoteshwar
2022-09-30 9:57 3% ` Satha Koteswara Rao Kottidi
0 siblings, 1 reply; 200+ results
From: skoteshwar @ 2022-09-28 5:51 UTC (permalink / raw)
To: Aman Singh, Yuying Zhang, Ray Kinsella, Ajit Khaparde,
Somnath Kotur, Nithin Dabilpuram, Kiran Kumar K,
Sunil Kumar Kori, Satha Rao, Qiming Yang, Wenjun Wu, Jiawen Wu,
Jian Wang, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: dev, ferruh.yigit, bruce.richardson, konstantin.v.ananyev, jerinj
From: Satha Rao <skoteshwar@marvell.com>
The rate parameter modified to uint32_t, so that it can work
for more than 64 Gbps.
Signed-off-by: Satha Rao <skoteshwar@marvell.com>
---
v2: Fixed checkpatch warnings
v3: updated release notes, cleanup deprecation, addressed review comments
app/test-pmd/cmdline.c | 8 ++++----
app/test-pmd/config.c | 4 ++--
app/test-pmd/testpmd.h | 4 ++--
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_22_11.rst | 3 +++
drivers/net/bnxt/rte_pmd_bnxt.c | 4 ++--
drivers/net/bnxt/rte_pmd_bnxt.h | 2 +-
drivers/net/cnxk/cnxk_ethdev.h | 2 +-
drivers/net/cnxk/cnxk_tm.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/ixgbe/ixgbe_ethdev.h | 4 ++--
drivers/net/ixgbe/rte_pmd_ixgbe.c | 2 +-
drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +-
drivers/net/txgbe/txgbe_ethdev.c | 2 +-
drivers/net/txgbe/txgbe_ethdev.h | 2 +-
lib/ethdev/ethdev_driver.h | 2 +-
lib/ethdev/rte_ethdev.c | 2 +-
lib/ethdev/rte_ethdev.h | 2 +-
18 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 51321de..adfdc1d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -8106,7 +8106,7 @@ struct cmd_queue_rate_limit_result {
cmdline_fixed_string_t queue;
uint8_t queue_num;
cmdline_fixed_string_t rate;
- uint16_t rate_num;
+ uint32_t rate_num;
};
static void cmd_queue_rate_limit_parsed(void *parsed_result,
@@ -8147,7 +8147,7 @@ static void cmd_queue_rate_limit_parsed(void *parsed_result,
rate, "rate");
static cmdline_parse_token_num_t cmd_queue_rate_limit_ratenum =
TOKEN_NUM_INITIALIZER(struct cmd_queue_rate_limit_result,
- rate_num, RTE_UINT16);
+ rate_num, RTE_UINT32);
static cmdline_parse_inst_t cmd_queue_rate_limit = {
.f = cmd_queue_rate_limit_parsed,
@@ -8174,7 +8174,7 @@ struct cmd_vf_rate_limit_result {
cmdline_fixed_string_t vf;
uint8_t vf_num;
cmdline_fixed_string_t rate;
- uint16_t rate_num;
+ uint32_t rate_num;
cmdline_fixed_string_t q_msk;
uint64_t q_msk_val;
};
@@ -8218,7 +8218,7 @@ static void cmd_vf_rate_limit_parsed(void *parsed_result,
rate, "rate");
static cmdline_parse_token_num_t cmd_vf_rate_limit_ratenum =
TOKEN_NUM_INITIALIZER(struct cmd_vf_rate_limit_result,
- rate_num, RTE_UINT16);
+ rate_num, RTE_UINT32);
static cmdline_parse_token_string_t cmd_vf_rate_limit_q_msk =
TOKEN_STRING_INITIALIZER(struct cmd_vf_rate_limit_result,
q_msk, "queue_mask");
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index c90cdfe..6dd543d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -5914,7 +5914,7 @@ struct igb_ring_desc_16_bytes {
}
int
-set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
+set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint32_t rate)
{
int diag;
struct rte_eth_link link;
@@ -5942,7 +5942,7 @@ struct igb_ring_desc_16_bytes {
}
int
-set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
+set_vf_rate_limit(portid_t port_id, uint16_t vf, uint32_t rate, uint64_t q_msk)
{
int diag = -ENOTSUP;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index ddf5e21..0af3aa1 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1097,8 +1097,8 @@ void port_rss_reta_info(portid_t port_id,
uint16_t nb_rx_desc, unsigned int socket_id,
struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp);
-int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate);
-int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
+int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint32_t rate);
+int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint32_t rate,
uint64_t q_msk);
int set_rxq_avail_thresh(portid_t port_id, uint16_t queue_id,
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e0fa5ef..9292080 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -87,11 +87,6 @@ Deprecation Notices
us extending existing enum/define.
One solution can be using a fixed size array instead of ``.*MAX.*`` value.
-* ethdev: The function ``rte_eth_set_queue_rate_limit`` takes ``rate`` in Mbps.
- The queue rate is limited to 64 Gbps because declared as ``uint16_t``.
- The ``rate`` parameter will be modified to ``uint32_t`` in DPDK 22.11
- so that it can work for more than 64 Gbps.
-
* ethdev: Since no single PMD supports ``RTE_ETH_RX_OFFLOAD_HEADER_SPLIT``
offload and the ``split_hdr_size`` field in structure ``rte_eth_rxmode``
to enable per-port header split, they will be removed in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2e076ba..3c7e471 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -129,6 +129,9 @@ API Changes
configuration (``dev_conf.fdir_conf``). Moved corresponding structures
to internal API since some drivers still use it internally.
+* ethdev: The type of parameter ``rate`` of the ``rte_eth_set_queue_rate_limit``
+ changed from ``uint16_t`` to ``uint32_t`` to support more than 64 Gbps.
+
ABI Changes
-----------
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef..4dc38a2 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -172,12 +172,12 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
}
int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *eth_dev;
struct rte_eth_dev_info dev_info;
struct bnxt *bp;
- uint16_t tot_rate = 0;
+ uint32_t tot_rate = 0;
uint64_t idx;
int rc;
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index 86b8d71..174c18a 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -184,7 +184,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
* - (-EINVAL) if *vf* or *mac_addr* is invalid.
*/
int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
/**
* Get VF's statistics
diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
index c09e9bf..5204c46 100644
--- a/drivers/net/cnxk/cnxk_ethdev.h
+++ b/drivers/net/cnxk/cnxk_ethdev.h
@@ -558,7 +558,7 @@ int cnxk_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
int cnxk_nix_tm_ops_get(struct rte_eth_dev *eth_dev, void *ops);
int cnxk_nix_tm_set_queue_rate_limit(struct rte_eth_dev *eth_dev,
- uint16_t queue_idx, uint16_t tx_rate);
+ uint16_t queue_idx, uint32_t tx_rate);
int cnxk_nix_tm_mark_vlan_dei(struct rte_eth_dev *eth_dev, int mark_green,
int mark_yellow, int mark_red,
struct rte_tm_error *error);
diff --git a/drivers/net/cnxk/cnxk_tm.c b/drivers/net/cnxk/cnxk_tm.c
index d45e70a..9d8cd3f 100644
--- a/drivers/net/cnxk/cnxk_tm.c
+++ b/drivers/net/cnxk/cnxk_tm.c
@@ -751,7 +751,7 @@ struct rte_tm_ops cnxk_tm_ops = {
int
cnxk_nix_tm_set_queue_rate_limit(struct rte_eth_dev *eth_dev,
- uint16_t queue_idx, uint16_t tx_rate_mbps)
+ uint16_t queue_idx, uint32_t tx_rate_mbps)
{
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
uint64_t tx_rate = tx_rate_mbps * (uint64_t)1E6;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 1dfad0e..9ff8ee0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2475,7 +2475,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev)
int
ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct ixgbe_hw *hw;
struct ixgbe_vf_info *vfinfo;
@@ -6090,7 +6090,7 @@ static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on)
int
ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
- uint16_t queue_idx, uint16_t tx_rate)
+ uint16_t queue_idx, uint32_t tx_rate)
{
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t rf_dec, rf_int;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 0773a7e..b4db3f4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -753,13 +753,13 @@ void ixgbe_fdir_stats_get(struct rte_eth_dev *dev,
int ixgbe_vt_check(struct ixgbe_hw *hw);
int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
bool is_ixgbe_supported(struct rte_eth_dev *dev);
int ixgbe_tm_ops_get(struct rte_eth_dev *dev, void *ops);
void ixgbe_tm_conf_init(struct rte_eth_dev *dev);
void ixgbe_tm_conf_uninit(struct rte_eth_dev *dev);
int ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
int ixgbe_rss_conf_init(struct ixgbe_rte_flow_rss_conf *out,
const struct rte_flow_action_rss *in);
int ixgbe_action_rss_same(const struct rte_flow_action_rss *comp,
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f85..4ff7f37 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -498,7 +498,7 @@
int
rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk)
+ uint32_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *dev;
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index 426fe58..7ca1126 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -380,7 +380,7 @@ int rte_pmd_ixgbe_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
* - (-EINVAL) if bad parameter.
*/
int rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
- uint16_t tx_rate, uint64_t q_msk);
+ uint32_t tx_rate, uint64_t q_msk);
/**
* Set all the TCs' bandwidth weight.
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 4422472..86ef979 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -3764,7 +3764,7 @@ static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
int
txgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
- uint16_t queue_idx, uint16_t tx_rate)
+ uint16_t queue_idx, uint32_t tx_rate)
{
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
uint32_t bcnrc_val;
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index e425ab4..5171a6c 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -586,7 +586,7 @@ int txgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
void txgbe_tm_conf_init(struct rte_eth_dev *dev);
void txgbe_tm_conf_uninit(struct rte_eth_dev *dev);
int txgbe_set_queue_rate_limit(struct rte_eth_dev *dev, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
int txgbe_rss_conf_init(struct txgbe_rte_flow_rss_conf *out,
const struct rte_flow_action_rss *in);
int txgbe_action_rss_same(const struct rte_flow_action_rss *comp,
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index a0e0b2a..a89450c 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -598,7 +598,7 @@ typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
/** @internal Set queue Tx rate. */
typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
/** @internal Add tunneling UDP port. */
typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0..4b11dae 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -4388,7 +4388,7 @@ enum {
}
int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
- uint16_t tx_rate)
+ uint32_t tx_rate)
{
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index b62ac5b..7149dd7 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -4165,7 +4165,7 @@ int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr,
* - (-EINVAL) if bad parameter.
*/
int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
- uint16_t tx_rate);
+ uint32_t tx_rate);
/**
* Configuration of Receive Side Scaling hash computation of Ethernet device.
--
1.8.3.1
^ permalink raw reply [relevance 3%]
* RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
2022-09-24 16:34 3% ` Chautru, Nicolas
2022-09-27 9:43 3% ` Ferruh Yigit
@ 2022-09-27 20:59 5% ` Chautru, Nicolas
2022-09-29 18:10 3% ` Ferruh Yigit
1 sibling, 1 reply; 200+ results
From: Chautru, Nicolas @ 2022-09-27 20:59 UTC (permalink / raw)
To: Akhil Goyal, dev, Maxime Coquelin, ferruh.yigit, Ray Kinsella
Cc: Akhil Goyal, thomas, Ray Kinsella, trix, Richardson, Bruce,
david.marchand, stephen, Zhang, Mingshan, hemant.agrawal
Hi Ferruh,
Thanks for your comment.
To be totally honest I don't yet see how your suggestion would be better, but I quite possibly miss something. I did not reply in line with your comments so that to try to be clearer and avoid spreading the argument to much. Ray and Bruce feel free to chime in as well.
First to state the obvious: Nothing will change the fact that in case new enums are being added in DPDK, and if the application doesn't change, then user would not be able to interpret any such additional status/capability (backward compatible only feature parity and still ABI compliant) which is totally accepted as fine and up to the user, but the intention is at least not to have adverse effect even when they don’t update their code for such new features (notably in case they just use an older PMD not supporting such new features as a basic typical example in the ecosystem). I think we agree on that problematic.
In term of history of not using MAX value for enum, I believe there is already well documented and you agree with the reasoning of why we had to move away from this [1]. Not just cosmetically where the max value is called an enum or a #define but to have application making hardcoded assumption on the possible maximum range for such enum notably when sizing array. The only caveat being that at the time, the community did spot the weakness but did not come to an agreement with regards to the best way to manage this moving forward.
In case your point is purely cosmetic to rename the PADDED_MAX value from the enum to a #define (both public) I don't see how this would make thing clearer by obfuscating the fact it is genuinely a padded value and to have that value directly related to the enum structure. Also note that there is already an actual max value defined for these enums (but kept private on purpose) which is used by the lib/bbdev functions to restrict usage to what is actually supported in the given implementation (distinct from padded max value).
Arguably the only concern I could understand in your message would be this one " my concern was if user assumes all values valid until PADDED_MAX and tries to iterate array until that value".
But really the fact that it is indeed a padded value implies fairly explicitly that we have padded the supported enums with placeholders enums not yet defined. That is fairly tautological! I cannot see how it could confuse anyone. That is indeed to avoid such confusion that we went on that direction to expose a public future-proof padded maximum value.
Then looking at usage in practice: when integrating the bbdev api with higher level SW stacks (such as FlexRAN reference sw or 3rd party stacks) I don’t see how any of this theoretical concerns you raised would be relevant for any of these very cases (enqueue status, new capability etc...). The only genuine concern was sizing array based on MAX value being not ABI compliant.
I cannot think of any code in the application presently deployed or future that would then do what you are concerned about and cause an issue, and we definitely don’t do such things in any example for bbdev-test or in FlexRAN reference code provided to the ecosystem. The application would already have a default case when an enum being provided has no matching application, or more accurately in practice they would purely not look for these and hence these would be ignored seamlessly.
Thanks again for the discussion. I wish this had happened earlier (we only discussed this with Ray and Bruce while you were still at Intel), let me know what you think.
It may be more generally good moving forward to come to a general agreement at your technical forum level to avoid confusion. When we discussed earlier we came to the conclusion that the DPDK community had well documented what not to do to avoid ABI breakage but not necessarily what are the best alternatives.
Hopefully such future discussion should not delay this serie to be applied but still let me know.
Thanks again
[1]
* lib: will fix extending some enum/define breaking the ABI. There are multiple
samples in DPDK that enum/define terminated with a ``.*MAX.*`` value which is
used by iterators, and arrays holding these values are sized with this
``.*MAX.*`` value. So extending this enum/define increases the ``.*MAX.*``
value which increases the size of the array and depending on how/where the
array is used this may break the ABI.
``RTE_ETH_FLOW_MAX`` is one sample of the mentioned case, adding a new flow
type will break the ABI because of ``flex_mask[RTE_ETH_FLOW_MAX]`` array
usage in following public struct hierarchy:
``rte_eth_fdir_flex_conf -> rte_eth_fdir_conf -> rte_eth_conf (in the middle)``.
Need to identify this kind of usages and fix in 20.11, otherwise this blocks
us extending existing enum/define.
One solution can be using a fixed size array instead of ``.*MAX.*`` value.
> -----Original Message-----
> From: Chautru, Nicolas
> Sent: Saturday, September 24, 2022 9:35 AM
> To: 'Akhil Goyal' <gakhil@marvell.com>; dev@dpdk.org; Maxime Coquelin
> <maxime.coquelin@redhat.com>; ferruh.yigit@xilinx.com; Ray Kinsella
> <mdr@ashroe.eu>
> Cc: 'Akhil Goyal' <gakhil@marvell.com>; Chautru, Nicolas
> <nicolas.chautru@intel.com>; 'thomas@monjalon.net'
> <thomas@monjalon.net>; 'Ray Kinsella' <mdr@ashroe.eu>;
> 'trix@redhat.com' <trix@redhat.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; 'david.marchand@redhat.com'
> <david.marchand@redhat.com>; stephen@networkplumber.org; Zhang,
> Mingshan <mingshan.zhang@intel.com>; 'hemant.agrawal@nxp.com'
> <hemant.agrawal@nxp.com>
> Subject: RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and
> status information
>
> Hi Ferruh, Ray, Akhil,
>
>
> > > -----Original Message-----
> > > From: Ferruh Yigit <ferruh.yigit@amd.com>
> > > Sent: Friday, September 23, 2022 4:28 PM
> > > To: Akhil Goyal <gakhil@marvell.com>; Nicolas Chautru
> > > <nicolas.chautru@intel.com>; dev@dpdk.org; thomas@monjalon.net;
> > > hemant.agrawal@nxp.com; Ray Kinsella <mdr@ashroe.eu>
> > > Cc: maxime.coquelin@redhat.com; trix@redhat.com;
> > > bruce.richardson@intel.com; david.marchand@redhat.com;
> > > stephen@networkplumber.org; mingshan.zhang@intel.com
> > > Subject: Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning
> > > and status information
> > >
> > > On 9/21/2022 8:21 PM, Akhil Goyal wrote:
> > > >> diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index
> > > >> ed528b8..b7ecf94 100644
> > > >> --- a/lib/bbdev/rte_bbdev.h
> > > >> +++ b/lib/bbdev/rte_bbdev.h
> > > >> @@ -224,6 +224,19 @@ struct rte_bbdev_queue_conf {
> > > >> rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
> > > >>
> > > >> /**
> > > >> + * Flags indicate the reason why a previous enqueue may not have
> > > >> + * consumed all requested operations
> > > >> + * In case of multiple reasons the latter superdes a previous
> > > >> + one
> > > > Spell check - supersedes.
> > > >
> > > >> + */
> > > >> +enum rte_bbdev_enqueue_status {
> > > >> + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to
> report */
> > > >> + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not
> enough room
> > in
> > > >> queue */
> > > >> + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not
> enough room
> > in
> > > >> ring */
> > > >> + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation
> was
> > > >> rejected as invalid */
> > > >> + RTE_BBDEV_ENQ_STATUS_PADDED_MAX = 6, /**<
> Maximum enq
> > > >> status number including padding */
> > > >
> > > > Are we ok to have this kind of padding across DPDK for all the
> > > > enums to avoid
> > > ABI issues?
> > > > @Ray, @Thomas: any thoughts?
> > > >
> > > >
> > >
> > > This kind of usage can prevent ABI tool warning, and can fix issues
> > > caused by application using returned enum as index [1].
> > >
> > > But I think it is still problematic in case application tries to
> > > walk through till MAX, that is a common usage [2], user may miss that
> this
> > > is PADDED.
>
> Hi Ferruh,
> I don’t believe that case can happen here. Even if application was using an
> undefined index, the related functions are protected for that :
> See rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
> The reason for having padded max, is that the application may use this for
> array sizing if required without concern, we will never return a value that
> would exceeds this.
> In the other direction that is not a problem either since application (even it
> needs to store thigs in array) can used the padded version.
> Note that this discussed with Ray notably as a BKM.
>
> > >
> > > Overall exchanging enum values between library and application is
> > > possible trouble for binary compatibility. If application and
> > > library uses enum values independently, this is OK.
> > > Since enum cases not deleted but added in new version of the
> > > libraries, more problematic usage is passing enum value from library
> > > to application, and bbdev seems doing this in a few places.
>
> I don’t see a case where it is a genuine issue.
> An enum is being reported from library, even if due to future enum insertion
> there is a new enum reported between 2 ABI changes, that would still be
> within bounds.
>
> > >
> > > With current approach PADDED_MAX usage is more like #define usage,
> > > it is not dynamic but a hardcoded value that is used as array size value.
> > >
> > > Not providing a MAX enum case restricts the application, application
> > > can't use it as size of an array or can't use it walk through
> > > related array, usage reduces to if/switch comparisons.
>
> It can use the padded_max to size application array. Even if application was
> walking through these, there is no adverse effect.
>
> > > Although this may not be most convenient for application, it can
> > > provide safer usage for binary compatibility.
> > >
> > >
> > > @Nic, what do you think provide these PADDED_MAX as #define
> SIZE_MAX
> > > macros?
> > > With this application still can allocate a relevant array with
> > > correct size, or know the size of library provided array, but can't
> > > use it to iterate on these arrays.
> > >
>
> That would be back to how it was done before which made things very
> inflexible and prevented to change these enums between ABIs versions.
>
> This change was highlighted and discussed many months ago and flagged in
> the deprecation notice in previous release for that very reason.
>
> Ray, can you please chime in since you know best.
>
> Thanks Ferruh,
> Nic
>
>
>
> > >
> > >
> > >
> > > [1]
> > > --------------- library old version ---------------------------- enum
> > > type {
> > > CASE_A,
> > > CASE_B,
> > > CASE_MAX,
> > > };
> > >
> > > struct data {
> > > enum type type;
> > > union {
> > > type specific struct
> > > };
> > > };
> > >
> > > int api_get(struct data *data);
> > >
> > >
> > > --------------- application ----------------------------
> > >
> > > struct data data;
> > > int array[CASE_MAX];
> > >
> > > api_get(&data);
> > > foo(array[data.type]);
> > >
> > >
> > > --------------- library NEW version ----------------------------
> > >
> > > enum type {
> > > CASE_A,
> > > CASE_B,
> > > CASE_C,
> > > CASE_D,
> > > CASE_MAX,
> > > };
> > >
> > >
> > > When application is NOT recompiled but using new version of the
> > > library, values 'CASE_C' & 'CASE_D' will crash application, so this
> > > will create a ABI compatibility issue.
> > >
> > > Note: In the past I have claimed that application should check
> > > 'CASE_MAX', instead of using returned value directly as index, but
> > > this is refused by argument that we can't control the application and
> > > should play safe assuming application behaves wrong.
> > >
> > >
> > >
> > >
> > > [2]
> > >
> > > --------------- library ----------------------------
> > >
> > > enum type {
> > > CASE_NONE,
> > > CASE_A,
> > > CASE_B,
> > > CASE_C,
> > > CASE_D,
> > > CASE_PADDED_MAX = 666,
> > > };
> > >
> > > --------------- application ----------------------------
> > >
> > > for (int i = CASE_NONE; i < CASE_PADDED_MAX; i++)
> > > fragile_init(i);
> > >
> > > ---
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
^ permalink raw reply [relevance 5%]
* Re: [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT
2022-09-27 7:08 0% ` Thomas Monjalon
@ 2022-09-27 16:18 0% ` Ajit Khaparde
0 siblings, 0 replies; 200+ results
From: Ajit Khaparde @ 2022-09-27 16:18 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Ivan Malov, dev, Eli Britstein, Ilya Maximets, Stephen Hemminger,
Jerin Jacob, Andrew Rybchenko, Aman Singh, Yuying Zhang,
Somnath Kotur, Rahul Lakkireddy, Ferruh Yigit, Matan Azrad,
Slava Ovsiienko, Ori Kam
[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]
On Tue, Sep 27, 2022 at 12:08 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 22/08/2022 07:33, Ori Kam:
> > > Such deprecation was commenced in DPDK 21.11.
> > > Since then, no parties have objected. Remove.
> > >
> > > The patch breaks ABI.
> > >
> > > Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> > > Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> >
> > Acked-by: Ori Kam <orika@nvidia.com>
> > Best,
> > Ori
>
>
> The patch is missing following change
> to make devtools/check-doc-vs-code.sh happy:
>
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -850,7 +850,7 @@ struct mlx5_flow_meter_info {
> * applications) at the device level.
> *
> * It complements the behavior of some pattern items such as
> - * RTE_FLOW_ITEM_TYPE_PHY_PORT and is meaningless without them.
> + * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT and is meaningless without them.
> *
> * When transferring flow rules, ingress and egress attributes keep
> * their original meaning, as if processing traffic emitted or
The patch also needs to appropriately update
doc/guides/rel_notes/deprecation.rst
>
>
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [relevance 0%]
* Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
2022-09-24 16:34 3% ` Chautru, Nicolas
@ 2022-09-27 9:43 3% ` Ferruh Yigit
2022-09-27 20:59 5% ` Chautru, Nicolas
1 sibling, 0 replies; 200+ results
From: Ferruh Yigit @ 2022-09-27 9:43 UTC (permalink / raw)
To: Chautru, Nicolas, Akhil Goyal, dev, Maxime Coquelin,
ferruh.yigit, Ray Kinsella
Cc: thomas, trix, Richardson, Bruce, david.marchand, stephen, Zhang,
Mingshan, hemant.agrawal
On 9/24/2022 5:34 PM, Chautru, Nicolas wrote:
> Hi Ferruh, Ray, Akhil,
>
>
>>> -----Original Message-----
>>> From: Ferruh Yigit <ferruh.yigit@amd.com>
>>> Sent: Friday, September 23, 2022 4:28 PM
>>> To: Akhil Goyal <gakhil@marvell.com>; Nicolas Chautru
>>> <nicolas.chautru@intel.com>; dev@dpdk.org; thomas@monjalon.net;
>>> hemant.agrawal@nxp.com; Ray Kinsella <mdr@ashroe.eu>
>>> Cc: maxime.coquelin@redhat.com; trix@redhat.com;
>>> bruce.richardson@intel.com; david.marchand@redhat.com;
>>> stephen@networkplumber.org; mingshan.zhang@intel.com
>>> Subject: Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and
>>> status information
>>>
>>> On 9/21/2022 8:21 PM, Akhil Goyal wrote:
>>>>> diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index
>>>>> ed528b8..b7ecf94 100644
>>>>> --- a/lib/bbdev/rte_bbdev.h
>>>>> +++ b/lib/bbdev/rte_bbdev.h
>>>>> @@ -224,6 +224,19 @@ struct rte_bbdev_queue_conf {
>>>>> rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
>>>>>
>>>>> /**
>>>>> + * Flags indicate the reason why a previous enqueue may not have
>>>>> + * consumed all requested operations
>>>>> + * In case of multiple reasons the latter superdes a previous one
>>>> Spell check - supersedes.
>>>>
>>>>> + */
>>>>> +enum rte_bbdev_enqueue_status {
>>>>> + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */
>>>>> + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room
>> in
>>>>> queue */
>>>>> + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room
>> in
>>>>> ring */
>>>>> + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was
>>>>> rejected as invalid */
>>>>> + RTE_BBDEV_ENQ_STATUS_PADDED_MAX = 6, /**< Maximum enq
>>>>> status number including padding */
>>>>
>>>> Are we ok to have this kind of padding across DPDK for all the enums
>>>> to avoid
>>> ABI issues?
>>>> @Ray, @Thomas: any thoughts?
>>>>
>>>>
>>>
>>> This kind of usage can prevent ABI tool warning, and can fix issues
>>> caused by application using returned enum as index [1].
>>>
>>> But I think it is still problematic in case application tries to walk
>>> through till MAX, that is a common usage [2], user may miss that this
>>> is PADDED.
>
> Hi Ferruh,
> I don’t believe that case can happen here. Even if application was using an undefined index, the related functions are protected for that :
> See rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
It doesn't have to use undefined index for DPDK API, application can
iterate until MAX enum for application specific array or function.
> The reason for having padded max, is that the application may use this for array sizing if required without concern, we will never return a value that would exceeds this.
> In the other direction that is not a problem either since application (even it needs to store thigs in array) can used the padded version.
> Note that this discussed with Ray notably as a BKM.
>
I can see usage is more for size, that is why I think it is better to
have a #define that has SIZE_MAX in name, instead of enum with
PADDED_MAX name.
As said above, since you will never return value exceeds PADDED_MAX it
solves the issue that application using returned enum as index [1]. So,
this usage is not that problematic.
But my concern was if user assumes all values valid until PADDED_MAX and
tries to iterate array until that value [2].
>>>
>>> Overall exchanging enum values between library and application is
>>> possible trouble for binary compatibility. If application and library
>>> uses enum values independently, this is OK.
>>> Since enum cases not deleted but added in new version of the
>>> libraries, more problematic usage is passing enum value from library
>>> to application, and bbdev seems doing this in a few places.
>
> I don’t see a case where it is a genuine issue.
> An enum is being reported from library, even if due to future enum insertion there is a new enum reported between 2 ABI changes, that would still be within bounds.
>
Passing enum case from library to application has problem [1], other
issue can be application may miss that library added new enum cases and
application code needs updating.
Overall I think it is not good idea for library to exchange enum values
in APIs, specially if there is an intention to have ABI compatibility.
>>>
>>> With current approach PADDED_MAX usage is more like #define usage, it
>>> is not dynamic but a hardcoded value that is used as array size value.
>>>
>>> Not providing a MAX enum case restricts the application, application
>>> can't use it as size of an array or can't use it walk through related
>>> array, usage reduces to if/switch comparisons.
>
> It can use the padded_max to size application array. Even if application was walking through these, there is no adverse effect.
>
>>> Although this may not be most convenient for application, it can
>>> provide safer usage for binary compatibility.
>>>
>>>
>>> @Nic, what do you think provide these PADDED_MAX as #define SIZE_MAX
>>> macros?
>>> With this application still can allocate a relevant array with correct
>>> size, or know the size of library provided array, but can't use it to
>>> iterate on these arrays.
>>>
>
> That would be back to how it was done before which made things very inflexible and prevented to change these enums between ABIs versions.
>
It would be same, the problem was MAX enum value changing. Removing MAX
enum but introduce #define SIZE_MAX will be same for application.
Only it would be more clear.
> This change was highlighted and discussed many months ago and flagged in the deprecation notice in previous release for that very reason.
>
As far as I remember the deprecation notice was to remove MAX enum
values, now you are introducing PADDED_MAX enum value.
> Ray, can you please chime in since you know best.
>
I think this PADDED_MAX solution is not too problematic, but I prefer
SIZE_MAX define, I hope my reasoning above is clear.
This is a comment from me, not a blocker, I am OK to go with whatever
consensus is.
> Thanks Ferruh,
> Nic
>
>
>
>>>
>>>
>>>
>>> [1]
>>> --------------- library old version ---------------------------- enum
>>> type {
>>> CASE_A,
>>> CASE_B,
>>> CASE_MAX,
>>> };
>>>
>>> struct data {
>>> enum type type;
>>> union {
>>> type specific struct
>>> };
>>> };
>>>
>>> int api_get(struct data *data);
>>>
>>>
>>> --------------- application ----------------------------
>>>
>>> struct data data;
>>> int array[CASE_MAX];
>>>
>>> api_get(&data);
>>> foo(array[data.type]);
>>>
>>>
>>> --------------- library NEW version ----------------------------
>>>
>>> enum type {
>>> CASE_A,
>>> CASE_B,
>>> CASE_C,
>>> CASE_D,
>>> CASE_MAX,
>>> };
>>>
>>>
>>> When application is NOT recompiled but using new version of the
>>> library, values 'CASE_C' & 'CASE_D' will crash application, so this
>>> will create a ABI compatibility issue.
>>>
>>> Note: In the past I have claimed that application should check
>>> 'CASE_MAX', instead of using returned value directly as index, but
>>> this is refused by argument that we can't control the application and
>>> should play safe assuming application behaves wrong.
>>>
>>>
>>>
>>>
>>> [2]
>>>
>>> --------------- library ----------------------------
>>>
>>> enum type {
>>> CASE_NONE,
>>> CASE_A,
>>> CASE_B,
>>> CASE_C,
>>> CASE_D,
>>> CASE_PADDED_MAX = 666,
>>> };
>>>
>>> --------------- application ----------------------------
>>>
>>> for (int i = CASE_NONE; i < CASE_PADDED_MAX; i++)
>>> fragile_init(i);
>>>
>>> ---
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
^ permalink raw reply [relevance 3%]
* Re: [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT
@ 2022-09-27 7:08 0% ` Thomas Monjalon
2022-09-27 16:18 0% ` Ajit Khaparde
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2022-09-27 7:08 UTC (permalink / raw)
To: Ivan Malov
Cc: dev, Eli Britstein, Ilya Maximets, Stephen Hemminger,
Jerin Jacob, Andrew Rybchenko, Aman Singh, Yuying Zhang,
Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy, Ferruh Yigit,
Matan Azrad, Slava Ovsiienko, Ori Kam
22/08/2022 07:33, Ori Kam:
> > Such deprecation was commenced in DPDK 21.11.
> > Since then, no parties have objected. Remove.
> >
> > The patch breaks ABI.
> >
> > Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> > Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>
> Acked-by: Ori Kam <orika@nvidia.com>
> Best,
> Ori
The patch is missing following change
to make devtools/check-doc-vs-code.sh happy:
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -850,7 +850,7 @@ struct mlx5_flow_meter_info {
* applications) at the device level.
*
* It complements the behavior of some pattern items such as
- * RTE_FLOW_ITEM_TYPE_PHY_PORT and is meaningless without them.
+ * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT and is meaningless without them.
*
* When transferring flow rules, ingress and egress attributes keep
* their original meaning, as if processing traffic emitted or
^ permalink raw reply [relevance 0%]
* [PATCH v4 6/6] security: hide session structure
2022-09-26 19:14 1% ` [PATCH v4 1/6] cryptodev: rework session framework Akhil Goyal
2022-09-26 19:14 1% ` [PATCH v4 3/6] cryptodev: hide sym session structure Akhil Goyal
@ 2022-09-26 19:14 2% ` Akhil Goyal
2 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-26 19:14 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, Akhil Goyal,
David Coyle, Kevin O'Sullivan
Structure rte_security_session is moved to internal
headers which are not visible to applications.
The only field which should be used by app is opaque_data.
This field can now be accessed via set/get APIs added in this
patch.
Subsequent changes in app and lib are made to compile the code.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test-crypto-perf/cperf_ops.c | 6 +-
.../cperf_test_pmd_cyclecount.c | 2 +-
app/test-crypto-perf/cperf_test_throughput.c | 2 +-
app/test/test_cryptodev.c | 2 +-
app/test/test_cryptodev_security_ipsec.c | 2 +-
app/test/test_cryptodev_security_ipsec.h | 2 +-
app/test/test_security.c | 32 ++++----
app/test/test_security_inline_proto.c | 10 +--
doc/guides/rel_notes/deprecation.rst | 4 -
doc/guides/rel_notes/release_22_11.rst | 5 ++
drivers/crypto/caam_jr/caam_jr.c | 2 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 4 +-
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 6 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 6 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 4 +-
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 4 +-
drivers/crypto/qat/qat_sym.c | 4 +-
drivers/crypto/qat/qat_sym.h | 4 +-
drivers/net/iavf/iavf_ipsec_crypto.h | 2 +-
examples/ipsec-secgw/ipsec_worker.c | 2 +-
lib/cryptodev/rte_crypto_sym.h | 4 +-
lib/ipsec/rte_ipsec_group.h | 12 +--
lib/ipsec/ses.c | 2 +-
lib/security/rte_security.c | 13 ++-
lib/security/rte_security.h | 80 ++++++++++++-------
lib/security/rte_security_driver.h | 18 +++++
26 files changed, 137 insertions(+), 97 deletions(-)
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index bd3c941fea..7ba4e13244 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -65,8 +65,7 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
for (i = 0; i < nb_ops; i++) {
struct rte_crypto_sym_op *sym_op = ops[i]->sym;
- struct rte_security_session *sec_sess =
- (struct rte_security_session *)sess;
+ void *sec_sess = (void *)sess;
uint32_t buf_sz;
uint32_t *per_pkt_hfn = rte_crypto_op_ctod_offset(ops[i],
@@ -131,8 +130,7 @@ cperf_set_ops_security_ipsec(struct rte_crypto_op **ops,
uint16_t iv_offset __rte_unused, uint32_t *imix_idx,
uint64_t *tsc_start)
{
- struct rte_security_session *sec_sess =
- (struct rte_security_session *)sess;
+ void *sec_sess = sess;
const uint32_t test_buffer_size = options->test_buffer_size;
const uint32_t headroom_sz = options->headroom_sz;
const uint32_t segment_sz = options->segment_sz;
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index f0ca78af4f..045fd1c29a 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -71,7 +71,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
(struct rte_security_ctx *)
rte_cryptodev_get_sec_ctx(ctx->dev_id);
rte_security_session_destroy(sec_ctx,
- (struct rte_security_session *)ctx->sess);
+ (void *)ctx->sess);
} else
#endif
rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index c924459958..38340dae08 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -49,7 +49,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
rte_cryptodev_get_sec_ctx(ctx->dev_id);
rte_security_session_destroy(
sec_ctx,
- (struct rte_security_session *)ctx->sess);
+ (void *)ctx->sess);
}
#endif
else
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index f0315f9195..981db009b8 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -84,7 +84,7 @@ struct crypto_unittest_params {
union {
struct rte_cryptodev_sym_session *sess;
#ifdef RTE_LIB_SECURITY
- struct rte_security_session *sec_session;
+ void *sec_session;
#endif
};
#ifdef RTE_LIB_SECURITY
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 3f691f0f56..cb77b39dbb 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -1126,7 +1126,7 @@ test_ipsec_status_check(const struct ipsec_test_data *td,
int
test_ipsec_stats_verify(struct rte_security_ctx *ctx,
- struct rte_security_session *sess,
+ void *sess,
const struct ipsec_test_flags *flags,
enum rte_security_ipsec_sa_direction dir)
{
diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h
index 02b08f9f95..6a119bee46 100644
--- a/app/test/test_cryptodev_security_ipsec.h
+++ b/app/test/test_cryptodev_security_ipsec.h
@@ -277,7 +277,7 @@ int test_ipsec_status_check(const struct ipsec_test_data *td,
int pkt_num);
int test_ipsec_stats_verify(struct rte_security_ctx *ctx,
- struct rte_security_session *sess,
+ void *sess,
const struct ipsec_test_flags *flags,
enum rte_security_ipsec_sa_direction dir);
diff --git a/app/test/test_security.c b/app/test/test_security.c
index bb3b3835fa..f336479b2e 100644
--- a/app/test/test_security.c
+++ b/app/test/test_security.c
@@ -234,7 +234,7 @@
static struct mock_session_create_data {
void *device;
struct rte_security_session_conf *conf;
- struct rte_security_session *sess;
+ void *sess;
struct rte_mempool *mp;
struct rte_mempool *priv_mp;
@@ -268,7 +268,7 @@ mock_session_create(void *device,
*/
static struct mock_session_update_data {
void *device;
- struct rte_security_session *sess;
+ void *sess;
struct rte_security_session_conf *conf;
int ret;
@@ -322,7 +322,7 @@ mock_session_get_size(void *device)
*/
static struct mock_session_stats_get_data {
void *device;
- struct rte_security_session *sess;
+ void *sess;
struct rte_security_stats *stats;
int ret;
@@ -352,7 +352,7 @@ mock_session_stats_get(void *device,
*/
static struct mock_session_destroy_data {
void *device;
- struct rte_security_session *sess;
+ void *sess;
int ret;
@@ -377,7 +377,7 @@ mock_session_destroy(void *device, struct rte_security_session *sess)
*/
static struct mock_set_pkt_metadata_data {
void *device;
- struct rte_security_session *sess;
+ void *sess;
struct rte_mbuf *m;
void *params;
@@ -513,7 +513,7 @@ static struct security_testsuite_params {
static struct security_unittest_params {
struct rte_security_ctx ctx;
struct rte_security_session_conf conf;
- struct rte_security_session *sess;
+ void *sess;
} unittest_params = {
.ctx = {
.device = NULL,
@@ -650,7 +650,7 @@ ut_setup_with_session(void)
{
struct security_unittest_params *ut_params = &unittest_params;
struct security_testsuite_params *ts_params = &testsuite_params;
- struct rte_security_session *sess;
+ void *sess;
int ret = ut_setup();
if (ret != TEST_SUCCESS)
@@ -701,7 +701,7 @@ test_session_create_inv_context(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
sess = rte_security_session_create(NULL, &ut_params->conf,
ts_params->session_mpool);
@@ -723,7 +723,7 @@ test_session_create_inv_context_ops(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
ut_params->ctx.ops = NULL;
@@ -747,7 +747,7 @@ test_session_create_inv_context_ops_fun(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
ut_params->ctx.ops = &empty_ops;
@@ -770,7 +770,7 @@ test_session_create_inv_configuration(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
sess = rte_security_session_create(&ut_params->ctx, NULL,
ts_params->session_mpool);
@@ -791,7 +791,7 @@ static int
test_session_create_inv_mempool(void)
{
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf, NULL);
TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
@@ -812,8 +812,8 @@ test_session_create_mempool_empty(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *tmp[SECURITY_TEST_MEMPOOL_SIZE];
- struct rte_security_session *sess;
+ void *tmp[SECURITY_TEST_MEMPOOL_SIZE];
+ void *sess;
/* Get all available objects from mempool. */
int i, ret;
@@ -853,7 +853,7 @@ test_session_create_ops_failure(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
mock_session_create_exp.device = NULL;
mock_session_create_exp.conf = &ut_params->conf;
@@ -879,7 +879,7 @@ test_session_create_success(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
mock_session_create_exp.device = NULL;
mock_session_create_exp.conf = &ut_params->conf;
diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c
index 9c6a09676e..3f520840ac 100644
--- a/app/test/test_security_inline_proto.c
+++ b/app/test/test_security_inline_proto.c
@@ -119,7 +119,7 @@ static struct rte_flow *default_flow[RTE_MAX_ETHPORTS];
/* Create Inline IPsec session */
static int
create_inline_ipsec_session(struct ipsec_test_data *sa, uint16_t portid,
- struct rte_security_session **sess, struct rte_security_ctx **ctx,
+ void **sess, struct rte_security_ctx **ctx,
uint32_t *ol_flags, const struct ipsec_test_flags *flags,
struct rte_security_session_conf *sess_conf)
{
@@ -695,8 +695,8 @@ static int
test_ipsec_with_reassembly(struct reassembly_vector *vector,
const struct ipsec_test_flags *flags)
{
- struct rte_security_session *out_ses[ENCAP_DECAP_BURST_SZ] = {0};
- struct rte_security_session *in_ses[ENCAP_DECAP_BURST_SZ] = {0};
+ void *out_ses[ENCAP_DECAP_BURST_SZ] = {0};
+ void *in_ses[ENCAP_DECAP_BURST_SZ] = {0};
struct rte_eth_ip_reassembly_params reass_capa = {0};
struct rte_security_session_conf sess_conf_out = {0};
struct rte_security_session_conf sess_conf_in = {0};
@@ -963,7 +963,7 @@ test_ipsec_inline_proto_process(struct ipsec_test_data *td,
struct rte_crypto_sym_xform cipher = {0};
struct rte_crypto_sym_xform auth = {0};
struct rte_crypto_sym_xform aead = {0};
- struct rte_security_session *ses;
+ void *ses;
struct rte_security_ctx *ctx;
int nb_rx = 0, nb_sent;
uint32_t ol_flags;
@@ -1199,7 +1199,7 @@ test_ipsec_inline_proto_process_with_esn(struct ipsec_test_data td[],
struct rte_mbuf *rx_pkt = NULL;
struct rte_mbuf *tx_pkt = NULL;
int nb_rx, nb_sent;
- struct rte_security_session *ses;
+ void *ses;
struct rte_security_ctx *ctx;
uint32_t ol_flags;
bool outer_ipv4;
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 9785a0f3ce..701d32b818 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -166,10 +166,6 @@ Deprecation Notices
which got error interrupt to the application,
so that application can reset that particular queue pair.
-* security: Hide structure ``rte_security_session`` and expose an opaque
- pointer for the private data to the application which can be attached
- to the packet while enqueuing.
-
* security: MACsec support is planned to be added in DPDK 22.11,
which would result in updates to structures ``rte_security_macsec_xform``,
``rte_security_macsec_stats`` and security capability structure
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4b8b34d8ba..6a6d1649cc 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,6 +98,11 @@ API Changes
All sample applications were updated to attach an opaque pointer for the session
to the ``rte_crypto_op`` while enqueuing.
+* security: The structure ``rte_security_session`` was made internal and corresponding
+ APIs were updated to take/return an opaque session pointer. The API
+ ``rte_security_session_create`` was updated to take only one mempool which has enough
+ space to hold session and driver private data.
+
ABI Changes
-----------
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index a6d3a494e6..3b06522d06 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1359,7 +1359,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
ses = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
- ses = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ ses = SECURITY_GET_SESS_PRIV(op->sym->session);
break;
default:
CAAM_JR_DP_ERR("sessionless crypto op not supported");
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index f127c84fd3..0dc2dc4baa 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -103,7 +103,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
- sec_sess = SECURITY_GET_SESS_PRIV(sym_op->sec_session);
+ sec_sess = SECURITY_GET_SESS_PRIV(sym_op->session);
ret = cpt_sec_inst_fill(qp, op, sec_sess, &inst[0]);
if (unlikely(ret))
return 0;
@@ -322,7 +322,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
struct cn10k_sec_session *priv;
struct cn10k_ipsec_sa *sa;
- priv = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ priv = SECURITY_GET_SESS_PRIV(op->sym->session);
sa = &priv->sa;
*qp = sa->qp;
*w2 = sa->inst.w2;
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index b395f830b1..2ed298e01f 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -27,7 +27,7 @@ cn9k_cpt_sec_inst_fill(struct rte_crypto_op *op,
struct cn9k_ipsec_sa *sa;
int ret;
- priv = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ priv = SECURITY_GET_SESS_PRIV(op->sym->session);
sa = &priv->sa;
if (unlikely(sym_op->m_dst && sym_op->m_dst != sym_op->m_src)) {
@@ -374,7 +374,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
struct cn9k_sec_session *priv;
struct cn9k_ipsec_sa *sa;
- priv = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ priv = SECURITY_GET_SESS_PRIV(op->sym->session);
sa = &priv->sa;
*qp = sa->qp;
inst->w2.u64 = sa->inst.w2;
@@ -539,7 +539,7 @@ cn9k_cpt_sec_post_process(struct rte_crypto_op *cop,
CPT_OP_FLAGS_IPSEC_INB_REPLAY)) {
int ret;
- priv = SECURITY_GET_SESS_PRIV(sym_op->sec_session);
+ priv = SECURITY_GET_SESS_PRIV(sym_op->session);
sa = &priv->sa;
ret = ipsec_antireplay_check(
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 3c51913dd8..afa9bd0a62 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1382,7 +1382,7 @@ build_sec_fd(struct rte_crypto_op *op,
sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
- sess = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(op->sym->session);
#endif
else {
DPAA2_SEC_DP_ERR("Session type invalid\n");
@@ -1582,7 +1582,7 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd)
mbuf->buf_iova = op->sym->aead.digest.phys_addr;
op->sym->aead.digest.phys_addr = 0L;
- sess_priv = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess_priv = SECURITY_GET_SESS_PRIV(op->sym->session);
if (sess_priv->dir == DIR_ENC)
mbuf->data_off += SEC_FLC_DHR_OUTBOUND;
else
@@ -1678,7 +1678,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
- sess = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(op->sym->session);
#endif
if (sess == NULL)
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 72b848fd49..331e23e628 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -673,7 +673,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
- sess = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(op->sym->session);
#endif
if (sess == NULL) {
printf("session is NULL\n");
@@ -1926,7 +1926,7 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
- ses = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ ses = SECURITY_GET_SESS_PRIV(op->sym->session);
break;
#endif
default:
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index fc9ee01124..8ec2364aa7 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1584,7 +1584,7 @@ set_sec_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
return -1;
}
- session = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ session = SECURITY_GET_SESS_PRIV(op->sym->session);
if (unlikely(session == NULL)) {
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
@@ -1719,7 +1719,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
* this is for DOCSIS
*/
is_docsis_sec = 1;
- sess = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(op->sym->session);
} else
#endif
sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index f8ec8b7233..69f5add637 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -101,7 +101,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
- ctx = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ ctx = SECURITY_GET_SESS_PRIV(op->sym->session);
if (unlikely(!ctx)) {
QAT_DP_LOG(ERR, "No session for this device");
return -EINVAL;
@@ -145,7 +145,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
}
}
- sess = (uintptr_t)op->sym->sec_session;
+ sess = (uintptr_t)op->sym->session;
build_request = ctx->build_request[proc_type];
opaque[0] = sess;
opaque[1] = (uintptr_t)build_request;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 033ec0de85..9a4251e08b 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -277,7 +277,7 @@ qat_sym_preprocess_requests(void **ops, uint16_t nb_ops)
op = (struct rte_crypto_op *)ops[i];
if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
- ctx = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ ctx = SECURITY_GET_SESS_PRIV(op->sym->session);
if (ctx == NULL || ctx->bpi_ctx == NULL)
continue;
@@ -310,7 +310,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
* Assuming at this point that if it's a security
* op, that this is for DOCSIS
*/
- sess = SECURITY_GET_SESS_PRIV(rx_op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(rx_op->sym->session);
is_docsis_sec = 1;
} else
#endif
diff --git a/drivers/net/iavf/iavf_ipsec_crypto.h b/drivers/net/iavf/iavf_ipsec_crypto.h
index 8ea0f9540e..49f9202aca 100644
--- a/drivers/net/iavf/iavf_ipsec_crypto.h
+++ b/drivers/net/iavf/iavf_ipsec_crypto.h
@@ -5,7 +5,7 @@
#ifndef _IAVF_IPSEC_CRYPTO_H_
#define _IAVF_IPSEC_CRYPTO_H_
-#include <rte_security.h>
+#include <rte_security_driver.h>
#include "iavf.h"
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index 5e69450d27..49b1b951f1 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -17,7 +17,7 @@
#endif
struct port_drv_mode_data {
- struct rte_security_session *sess;
+ void *sess;
struct rte_security_ctx *ctx;
};
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index 84deecac48..b1650adcac 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -617,11 +617,9 @@ struct rte_crypto_sym_op {
RTE_STD_C11
union {
void *session;
- /**< Handle for the initialised session context */
+ /**< Handle for the initialised crypto/security session context */
struct rte_crypto_sym_xform *xform;
/**< Session-less API crypto operation parameters */
- struct rte_security_session *sec_session;
- /**< Handle for the initialised security session context */
};
RTE_STD_C11
diff --git a/lib/ipsec/rte_ipsec_group.h b/lib/ipsec/rte_ipsec_group.h
index a4e0e128f8..c6458ef81e 100644
--- a/lib/ipsec/rte_ipsec_group.h
+++ b/lib/ipsec/rte_ipsec_group.h
@@ -44,16 +44,16 @@ struct rte_ipsec_group {
static inline struct rte_ipsec_session *
rte_ipsec_ses_from_crypto(const struct rte_crypto_op *cop)
{
- const struct rte_security_session *ss;
- void *cs;
+ void *ses;
if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
- ss = cop->sym[0].sec_session;
- return (struct rte_ipsec_session *)(uintptr_t)ss->opaque_data;
+ ses = cop->sym[0].session;
+ return (struct rte_ipsec_session *)(uintptr_t)
+ rte_security_session_opaque_data_get(ses);
} else if (cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- cs = cop->sym[0].session;
+ ses = cop->sym[0].session;
return (struct rte_ipsec_session *)(uintptr_t)
- rte_cryptodev_sym_session_opaque_data_get(cs);
+ rte_cryptodev_sym_session_opaque_data_get(ses);
}
return NULL;
}
diff --git a/lib/ipsec/ses.c b/lib/ipsec/ses.c
index 0d3c932302..d9ab1e6d2b 100644
--- a/lib/ipsec/ses.c
+++ b/lib/ipsec/ses.c
@@ -48,7 +48,7 @@ rte_ipsec_session_prepare(struct rte_ipsec_session *ss)
rte_cryptodev_sym_session_opaque_data_set(ss->crypto.ses,
(uintptr_t)ss);
else
- ss->security.ses->opaque_data = (uintptr_t)ss;
+ rte_security_session_opaque_data_set(ss->security.ses, (uintptr_t)ss);
return 0;
}
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 87a21a6e33..59bb141cac 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -42,7 +42,7 @@ rte_security_dynfield_register(void)
return rte_security_dynfield_offset;
}
-struct rte_security_session *
+void *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
struct rte_mempool *mp)
@@ -72,12 +72,12 @@ rte_security_session_create(struct rte_security_ctx *instance,
}
instance->sess_cnt++;
- return sess;
+ return (void *)sess;
}
int
rte_security_session_update(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_security_session_conf *conf)
{
RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, session_update, -EINVAL,
@@ -99,7 +99,7 @@ rte_security_session_get_size(struct rte_security_ctx *instance)
int
rte_security_session_stats_get(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_security_stats *stats)
{
RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, session_stats_get, -EINVAL,
@@ -111,8 +111,7 @@ rte_security_session_stats_get(struct rte_security_ctx *instance,
}
int
-rte_security_session_destroy(struct rte_security_ctx *instance,
- struct rte_security_session *sess)
+rte_security_session_destroy(struct rte_security_ctx *instance, void *sess)
{
int ret;
@@ -134,7 +133,7 @@ rte_security_session_destroy(struct rte_security_ctx *instance,
int
__rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_mbuf *m, void *params)
{
#ifdef RTE_DEBUG
diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
index bf4ff3c18c..2e717b7468 100644
--- a/lib/security/rte_security.h
+++ b/lib/security/rte_security.h
@@ -518,20 +518,6 @@ struct rte_security_session_conf {
/**< Application specific userdata to be saved with session */
};
-struct rte_security_session {
- RTE_MARKER cacheline0;
- uint64_t opaque_data;
- /**< Opaque user defined data */
- uint64_t fast_mdata;
- /**< Fast metadata to be used for inline path */
- rte_iova_t driver_priv_data_iova;
- /**< session private data IOVA address */
-
- RTE_MARKER cacheline1 __rte_cache_min_aligned;
- uint8_t driver_priv_data[0];
- /**< Private session material, variable size (depends on driver) */
-};
-
/**
* Create security session as specified by the session configuration
*
@@ -542,7 +528,7 @@ struct rte_security_session {
* - On success, pointer to session
* - On failure, NULL
*/
-struct rte_security_session *
+void *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
struct rte_mempool *mp);
@@ -560,7 +546,7 @@ rte_security_session_create(struct rte_security_ctx *instance,
__rte_experimental
int
rte_security_session_update(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_security_session_conf *conf);
/**
@@ -590,8 +576,7 @@ rte_security_session_get_size(struct rte_security_ctx *instance);
* - other negative values in case of freeing private data errors.
*/
int
-rte_security_session_destroy(struct rte_security_ctx *instance,
- struct rte_security_session *sess);
+rte_security_session_destroy(struct rte_security_ctx *instance, void *sess);
/** Device-specific metadata field type */
typedef uint64_t rte_security_dynfield_t;
@@ -634,10 +619,52 @@ static inline bool rte_security_dynfield_is_registered(void)
return rte_security_dynfield_offset >= 0;
}
+#define RTE_SECURITY_SESS_OPAQUE_DATA_OFF 0
+#define RTE_SECURITY_SESS_FAST_MDATA_OFF 1
+/**
+ * Get opaque data from session handle
+ */
+static inline uint64_t
+rte_security_session_opaque_data_get(void *sess)
+{
+ return *((uint64_t *)sess + RTE_SECURITY_SESS_OPAQUE_DATA_OFF);
+}
+
+/**
+ * Set opaque data in session handle
+ */
+static inline void
+rte_security_session_opaque_data_set(void *sess, uint64_t opaque)
+{
+ uint64_t *data;
+ data = (((uint64_t *)sess) + RTE_SECURITY_SESS_OPAQUE_DATA_OFF);
+ *data = opaque;
+}
+
+/**
+ * Get fast mdata from session handle
+ */
+static inline uint64_t
+rte_security_session_fast_mdata_get(void *sess)
+{
+ return *((uint64_t *)sess + RTE_SECURITY_SESS_FAST_MDATA_OFF);
+}
+
+/**
+ * Set fast mdata in session handle
+ */
+static inline void
+rte_security_session_fast_mdata_set(void *sess, uint64_t fdata)
+{
+ uint64_t *data;
+ data = (((uint64_t *)sess) + RTE_SECURITY_SESS_FAST_MDATA_OFF);
+ *data = fdata;
+}
+
/** Function to call PMD specific function pointer set_pkt_metadata() */
__rte_experimental
extern int __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_mbuf *m, void *params);
/**
@@ -655,13 +682,13 @@ extern int __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
*/
static inline int
rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_mbuf *mb, void *params)
{
/* Fast Path */
if (instance->flags & RTE_SEC_CTX_F_FAST_SET_MDATA) {
- *rte_security_dynfield(mb) =
- (rte_security_dynfield_t)(sess->fast_mdata);
+ *rte_security_dynfield(mb) = (rte_security_dynfield_t)
+ rte_security_session_fast_mdata_get(sess);
return 0;
}
@@ -710,10 +737,9 @@ rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md)
* @param sess security session
*/
static inline int
-__rte_security_attach_session(struct rte_crypto_sym_op *sym_op,
- struct rte_security_session *sess)
+__rte_security_attach_session(struct rte_crypto_sym_op *sym_op, void *sess)
{
- sym_op->sec_session = sess;
+ sym_op->session = sess;
return 0;
}
@@ -729,7 +755,7 @@ __rte_security_attach_session(struct rte_crypto_sym_op *sym_op,
*/
static inline int
rte_security_attach_session(struct rte_crypto_op *op,
- struct rte_security_session *sess)
+ void *sess)
{
if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC))
return -EINVAL;
@@ -791,7 +817,7 @@ struct rte_security_stats {
__rte_experimental
int
rte_security_session_stats_get(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_security_stats *stats);
/**
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index c8119a8a50..37be87b9f7 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -19,6 +19,24 @@ extern "C" {
#include "rte_security.h"
+/**
+ * @internal
+ * Security session to be used by library for internal usage
+ */
+struct rte_security_session {
+ RTE_MARKER cacheline0;
+ uint64_t opaque_data;
+ /**< Opaque user defined data */
+ uint64_t fast_mdata;
+ /**< Fast metadata to be used for inline path */
+ rte_iova_t driver_priv_data_iova;
+ /**< session private data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ uint8_t driver_priv_data[0];
+ /**< Private session material, variable size (depends on driver) */
+};
+
/**
* Helper macro to get driver private data
*/
--
2.25.1
^ permalink raw reply [relevance 2%]
* [PATCH v4 3/6] cryptodev: hide sym session structure
2022-09-26 19:14 1% ` [PATCH v4 1/6] cryptodev: rework session framework Akhil Goyal
@ 2022-09-26 19:14 1% ` Akhil Goyal
2022-09-26 19:14 2% ` [PATCH v4 6/6] security: hide " Akhil Goyal
2 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-26 19:14 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, Akhil Goyal, Kai Ji,
David Coyle, Kevin O'Sullivan
Structure rte_cryptodev_sym_session is moved to internal
headers which are not visible to applications.
The only field which should be used by app is opaque_data.
This field can now be accessed via set/get APIs added in this
patch.
Subsequent changes in app and lib are made to compile the code.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test/test_ipsec_perf.c | 4 +-
doc/guides/prog_guide/cryptodev_lib.rst | 16 ++----
doc/guides/rel_notes/deprecation.rst | 5 --
doc/guides/rel_notes/release_22_11.rst | 9 +++
drivers/crypto/bcmfs/bcmfs_sym_session.c | 5 +-
drivers/crypto/caam_jr/caam_jr.c | 10 ++--
drivers/crypto/ccp/ccp_crypto.c | 30 +++++-----
drivers/crypto/ccp/ccp_pmd_ops.c | 2 +-
drivers/crypto/ccp/rte_ccp_pmd.c | 4 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 8 +--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 10 ++--
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 4 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 2 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 11 ++--
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 2 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 9 ++-
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 2 +-
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 2 +-
drivers/crypto/ipsec_mb/ipsec_mb_private.h | 4 +-
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 6 +-
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 4 +-
drivers/crypto/ipsec_mb/pmd_kasumi.c | 2 +-
drivers/crypto/ipsec_mb/pmd_snow3g.c | 2 +-
drivers/crypto/mlx5/mlx5_crypto.c | 7 +--
drivers/crypto/nitrox/nitrox_sym.c | 6 +-
drivers/crypto/null/null_crypto_pmd.c | 3 +-
drivers/crypto/null/null_crypto_pmd_ops.c | 2 +-
drivers/crypto/octeontx/otx_cryptodev_ops.c | 10 ++--
drivers/crypto/openssl/rte_openssl_pmd.c | 4 +-
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 4 +-
drivers/crypto/qat/qat_sym.c | 4 +-
drivers/crypto/qat/qat_sym.h | 3 +-
drivers/crypto/qat/qat_sym_session.c | 6 +-
.../scheduler/scheduler_pkt_size_distr.c | 13 ++---
drivers/crypto/scheduler/scheduler_pmd_ops.c | 4 +-
.../crypto/scheduler/scheduler_pmd_private.h | 30 +++++-----
drivers/crypto/virtio/virtio_cryptodev.c | 4 +-
drivers/crypto/virtio/virtio_rxtx.c | 2 +-
examples/fips_validation/fips_dev_self_test.c | 10 ++--
lib/cryptodev/cryptodev_pmd.h | 32 +++++++++++
lib/cryptodev/rte_crypto.h | 3 +-
lib/cryptodev/rte_crypto_sym.h | 7 +--
lib/cryptodev/rte_cryptodev.c | 16 ++++--
lib/cryptodev/rte_cryptodev.h | 56 +++++++++----------
lib/cryptodev/rte_cryptodev_trace.h | 8 +--
lib/ipsec/rte_ipsec_group.h | 5 +-
lib/ipsec/ses.c | 3 +-
47 files changed, 201 insertions(+), 194 deletions(-)
diff --git a/app/test/test_ipsec_perf.c b/app/test/test_ipsec_perf.c
index b5d0c2e036..b221b7fc32 100644
--- a/app/test/test_ipsec_perf.c
+++ b/app/test/test_ipsec_perf.c
@@ -227,7 +227,7 @@ static int
create_sa(enum rte_security_session_action_type action_type,
struct ipsec_sa *sa)
{
- static struct rte_cryptodev_sym_session dummy_ses;
+ void *dummy_ses = NULL;
size_t sz;
int rc;
@@ -247,7 +247,7 @@ create_sa(enum rte_security_session_action_type action_type,
"failed to allocate memory for rte_ipsec_sa\n");
sa->ss[0].type = action_type;
- sa->ss[0].crypto.ses = &dummy_ses;
+ sa->ss[0].crypto.ses = dummy_ses;
rc = rte_ipsec_sa_init(sa->ss[0].sa, &sa->sa_prm, sz);
rc = (rc > 0 && (uint32_t)rc <= sz) ? 0 : -EINVAL;
diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst
index 9e54683aa1..01aad842a9 100644
--- a/doc/guides/prog_guide/cryptodev_lib.rst
+++ b/doc/guides/prog_guide/cryptodev_lib.rst
@@ -125,13 +125,11 @@ Each queue pairs resources may be allocated on a specified socket.
uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
struct rte_mempool *mp_session;
/**< The mempool for creating session in sessionless mode */
- struct rte_mempool *mp_session_private;
- /**< The mempool for creating sess private data in sessionless mode */
};
-The fields ``mp_session`` and ``mp_session_private`` are used for creating
-temporary session to process the crypto operations in the session-less mode.
+The field ``mp_session`` is used for creating temporary session to process
+the crypto operations in the session-less mode.
They can be the same other different mempools. Please note not all Cryptodev
PMDs supports session-less mode.
@@ -595,7 +593,7 @@ chain.
struct rte_mbuf *m_dst;
union {
- struct rte_cryptodev_sym_session *session;
+ void *session;
/**< Handle for the initialised session context */
struct rte_crypto_sym_xform *xform;
/**< Session-less API Crypto operation parameters */
@@ -943,15 +941,11 @@ using one of the crypto PMDs available in DPDK.
/* Create crypto session and initialize it for the crypto device. */
struct rte_cryptodev_sym_session *session;
- session = rte_cryptodev_sym_session_create(session_pool);
+ session = rte_cryptodev_sym_session_create(cdev_id, &cipher_xform,
+ session_pool);
if (session == NULL)
rte_exit(EXIT_FAILURE, "Session could not be created\n");
- if (rte_cryptodev_sym_session_init(cdev_id, session,
- &cipher_xform, session_priv_pool) < 0)
- rte_exit(EXIT_FAILURE, "Session could not be initialized "
- "for the crypto device\n");
-
/* Get a burst of crypto operations. */
struct rte_crypto_op *crypto_ops[BURST_SIZE];
if (rte_crypto_op_bulk_alloc(crypto_op_pool,
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..9785a0f3ce 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -161,11 +161,6 @@ Deprecation Notices
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=23367>`__.
This should be updated in DPDK 22.11.
-* cryptodev: Hide structures ``rte_cryptodev_sym_session`` and
- ``rte_cryptodev_asym_session`` to remove unnecessary indirection between
- session and the private data of session. An opaque pointer can be exposed
- directly to application which can be attached to the ``rte_crypto_op``.
-
* cryptodev: The function ``rte_cryptodev_cb_fn`` will be updated
to have another parameter ``qp_id`` to return the queue pair ID
which got error interrupt to the application,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 7fab9d6550..4b8b34d8ba 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -89,6 +89,15 @@ API Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* cryptodev: The structure ``rte_cryptodev_sym_session`` was made internal.
+ The API ``rte_cryptodev_sym_session_init`` and ``rte_cryptodev_sym_session_clear``
+ were removed and user would only need to call ``rte_cryptodev_sym_session_create``
+ and ``rte_cryptodev_sym_session_free`` to create/destroy sessions.
+ The API ``rte_cryptodev_sym_session_create`` was updated to take a single mempool
+ with element size big enough to hold session data and session private data.
+ All sample applications were updated to attach an opaque pointer for the session
+ to the ``rte_crypto_op`` while enqueuing.
+
ABI Changes
-----------
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index d3334dc920..40813d1fe5 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -210,8 +210,7 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
BCMFS_DP_LOG(ERR, "operations op(%p) is sessionless", op);
} else if (likely(op->sym->session != NULL)) {
/* get existing session */
- sess = (struct bcmfs_sym_session *)
- op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
if (sess == NULL)
@@ -233,7 +232,7 @@ bcmfs_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- sess_private_data = (void *)sess->driver_priv_data;
+ sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
ret = crypto_set_session_parameters(sess_private_data, xform);
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index a9c93dea13..c9c783d19a 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1356,8 +1356,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (struct caam_jr_session *)
- op->sym->session->driver_priv_data;
+ ses = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
ses = (struct caam_jr_session *)
@@ -1699,7 +1698,7 @@ caam_jr_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
int ret;
PMD_INIT_FUNC_TRACE();
- sess_private_data = (void *)sess->driver_priv_data;
+ sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
memset(sess_private_data, 0, sizeof(struct caam_jr_session));
ret = caam_jr_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
@@ -1716,12 +1715,11 @@ static void
caam_jr_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_priv = (void *)sess->driver_priv_data;
- struct caam_jr_session *s = (struct caam_jr_session *)sess_priv;
+ struct caam_jr_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
PMD_INIT_FUNC_TRACE();
- if (sess_priv) {
+ if (s) {
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
}
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index bd999abe61..b21b32e507 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1585,7 +1585,7 @@ ccp_perform_hmac(struct rte_crypto_op *op,
void *append_ptr;
uint8_t *addr;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
addr = session->auth.pre_compute;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -1764,7 +1764,7 @@ ccp_perform_sha(struct rte_crypto_op *op,
void *append_ptr;
uint64_t auth_msg_bits;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1855,7 +1855,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr, dest_addr_t;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1999,7 +1999,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2071,7 +2071,7 @@ ccp_perform_aes_cmac(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
int length, non_align_len;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
key_addr = rte_mem_virt2phy(session->auth.key_ccp);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -2232,7 +2232,7 @@ ccp_perform_aes(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
uint8_t *iv;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
function.raw = 0;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
@@ -2318,7 +2318,7 @@ ccp_perform_3des(struct rte_crypto_op *op,
uint8_t *iv;
phys_addr_t src_addr, dest_addr, key_addr;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
switch (session->cipher.um.des_mode) {
@@ -2426,7 +2426,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
phys_addr_t digest_dest_addr;
int length, non_align_len;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
key_addr = session->cipher.key_phys;
@@ -2591,7 +2591,7 @@ ccp_crypto_cipher(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
switch (session->cipher.algo) {
case CCP_CIPHER_ALGO_AES_CBC:
@@ -2627,7 +2627,7 @@ ccp_crypto_auth(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
switch (session->auth.algo) {
case CCP_AUTH_ALGO_SHA1:
@@ -2695,7 +2695,7 @@ ccp_crypto_aead(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
switch (session->auth.algo) {
case CCP_AUTH_ALGO_AES_GCM:
@@ -2758,8 +2758,7 @@ process_ops_to_enqueue(struct ccp_qp *qp,
b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
Q_DESC_SIZE);
for (i = b_idx; i < (nb_ops+b_idx); i++) {
- session = (struct ccp_session *)
- op[i]->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op[i]->sym->session);
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
result = ccp_crypto_cipher(op[i], cmd_q, b_info);
@@ -2835,7 +2834,7 @@ static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
int offset, digest_offset;
uint8_t digest_le[64];
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
if (session->cmd_id == CCP_CMD_COMBINED) {
digest_data = op->sym->aead.digest.data;
@@ -2909,8 +2908,7 @@ ccp_prepare_ops(struct ccp_qp *qp,
for (i = b_info->b_idx; i < min_ops; i++) {
op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
- session = (struct ccp_session *)
- op_d[i]->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op_d[i]->sym->session);
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index e401793a76..52f320b02b 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -767,7 +767,7 @@ ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -ENOMEM;
}
- sess_private_data = (void *)sess->driver_priv_data;
+ sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
internals = (struct ccp_private *)dev->data->dev_private;
ret = ccp_set_session_parameters(sess_private_data, xform, internals);
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 7502281ad9..c0b016ea36 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -56,7 +56,7 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
if (unlikely(op->sym->session == NULL))
return NULL;
- sess = (void *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
struct rte_cryptodev_sym_session *_sess;
struct ccp_private *internals;
@@ -152,7 +152,7 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
if (unlikely(ops[i]->sess_type ==
RTE_CRYPTO_OP_SESSIONLESS)) {
struct ccp_session *sess =
- (void *)ops[i]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(ops[i]->sym->session);
memset(sess, 0, sizeof(*sess));
rte_mempool_put(qp->sess_mp,
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index f96e132513..4648576ff8 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -110,7 +110,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
return 0;
w7 = sec_sess->sa.inst.w7;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- sess = (void *)sym_op->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(sym_op->session);
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret))
@@ -293,9 +293,7 @@ cn10k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = (void *)(
- ((struct rte_cryptodev_sym_session *)sess)->
- driver_priv_data);
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -332,7 +330,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = (void *)op->sym->session->driver_priv_data;
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
} else {
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index a44f111ba6..5c344a6008 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -69,7 +69,7 @@ cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
if (ret)
goto sess_put;
- priv = (void *)sess->driver_priv_data;
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
sym_op->session = sess;
@@ -92,7 +92,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
sym_op = op->sym;
- sess = (void *)sym_op->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(sym_op->session);
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
inst->w7.u64 = sess->cpt_inst_w7;
} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
@@ -344,9 +344,7 @@ cn9k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = (void *)((
- (struct rte_cryptodev_sym_session *)sess)->
- driver_priv_data);
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -383,7 +381,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = (void *)op->sym->session->driver_priv_data;
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
} else {
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index 018d7fcee8..a5233a942a 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -624,7 +624,7 @@ sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_cryptodev_sym_session *sess)
{
enum cpt_dp_thread_type thr_type;
- struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
+ struct cnxk_se_sess *sess_priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
memset(sess_priv, 0, sizeof(struct cnxk_se_sess));
@@ -693,7 +693,7 @@ cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
void
sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
+ struct cnxk_se_sess *sess_priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index ca90567620..37a7322e0f 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -5,7 +5,7 @@
#ifndef _CNXK_CRYPTODEV_OPS_H_
#define _CNXK_CRYPTODEV_OPS_H_
-#include <rte_cryptodev.h>
+#include <cryptodev_pmd.h>
#include <rte_event_crypto_adapter.h>
#include "roc_api.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 5a38d53022..369fa9c81d 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1379,7 +1379,7 @@ build_sec_fd(struct rte_crypto_op *op,
dpaa2_sec_session *sess;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -1677,7 +1677,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
struct rte_crypto_sym_op *sym_op;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -3756,7 +3756,7 @@ dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data = (void *)sess->driver_priv_data;
+ void *sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
ret = dpaa2_sec_set_session_parameters(xform, sess_private_data);
@@ -3775,10 +3775,9 @@ dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- void *sess_priv = (void *)sess->driver_priv_data;
- dpaa2_sec_session *s = (dpaa2_sec_session *)sess_priv;
+ dpaa2_sec_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
- if (sess_priv) {
+ if (s) {
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index 795be3acc3..8c1e0abb95 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -1012,7 +1012,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa2_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (void *)session_ctx.crypto_sess->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(session_ctx.crypto_sess);
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 0cc773fba6..ec2fe56d1e 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -670,7 +670,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
struct qm_sg_entry sg[2];
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa_sec_session *)
@@ -1924,8 +1924,7 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (void *)
- op->sym->session->driver_priv_data;
+ ses = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
@@ -2673,7 +2672,7 @@ dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data = (void *)sess->driver_priv_data;
+ void *sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
PMD_INIT_FUNC_TRACE();
@@ -2714,7 +2713,7 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- void *sess_priv = (void *)sess->driver_priv_data;
+ void *sess_priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
free_session_memory(dev, s);
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d2e4d9d787..93129e7614 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -1018,7 +1018,7 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
sess = (dpaa_sec_session *)
- session_ctx.crypto_sess->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(session_ctx.crypto_sess);
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 90ce5bc965..cedcaa2742 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -329,7 +329,7 @@ ipsec_mb_sym_session_configure(
}
ret = (*pmd_data->session_configure)(mb_mgr,
- (void *)sess->driver_priv_data, xform);
+ CRYPTODEV_GET_SYM_SESS_PRIV(sess), xform);
if (ret != 0) {
IPSEC_MB_LOG(ERR, "failed configure session parameters");
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 14f962ef28..63e6fd58ee 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -434,7 +434,7 @@ ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
}
if (unlikely(pmd_data->session_configure(qp->mb_mgr,
- (void *)sess->driver_priv_data, sym_op->xform) != 0)) {
+ CRYPTODEV_GET_SYM_SESS_PRIV(sess), sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
goto error_exit;
}
@@ -447,7 +447,7 @@ ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
IPSEC_MB_LOG(ERR, "Unrecognized session type %u", sess_type);
}
- return (void *)sess->driver_priv_data;
+ return CRYPTODEV_GET_SYM_SESS_PRIV(sess);
error_exit:
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
index e4f274b608..8d40bd9169 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
@@ -468,7 +468,7 @@ aesni_gcm_get_session(struct ipsec_mb_qp *qp,
}
if (unlikely(aesni_gcm_session_configure(qp->mb_mgr,
- (void *)sess->driver_priv_data,
+ CRYPTODEV_GET_SYM_SESS_PRIV(sess),
sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, sess);
sess = NULL;
@@ -479,7 +479,7 @@ aesni_gcm_get_session(struct ipsec_mb_qp *qp,
if (unlikely(sess == NULL))
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return (void *)sess->driver_priv_data;
+ return CRYPTODEV_GET_SYM_SESS_PRIV(sess);
}
static uint16_t
@@ -704,7 +704,7 @@ aesni_gcm_process_bulk(struct rte_cryptodev *dev __rte_unused,
__rte_unused union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
- struct aesni_gcm_session *s = (void *)sess->driver_priv_data;
+ struct aesni_gcm_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct gcm_context_data gdata_ctx;
IMB_MGR *mb_mgr;
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index f3565b04b5..7d2f3b0e4b 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1723,7 +1723,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
sess = get_sec_session_private_data(op->sym->sec_session);
} else
#endif
- sess = (void *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
switch (job->status) {
@@ -2013,7 +2013,7 @@ aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
void *buf;
IMB_JOB *job;
IMB_MGR *mb_mgr;
- struct aesni_mb_session *s = (void *)sess->driver_priv_data;
+ struct aesni_mb_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
uint8_t tmp_dgst[vec->num][DIGEST_LENGTH_MAX];
/* get per-thread MB MGR, create one if needed */
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index b2fb168154..705eed9758 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -282,7 +282,7 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session->driver_priv_data, 0,
+ memset(CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session), 0,
sizeof(struct kasumi_session));
rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index f052d6d847..8ed069f428 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -413,7 +413,7 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session->driver_priv_data, 0,
+ memset(CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session), 0,
sizeof(struct snow3g_session));
rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index 46ea507cf5..c7d8fa311c 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -175,7 +175,7 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
struct mlx5_crypto_session *sess_private_data =
- (void *)session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(session);
struct rte_crypto_cipher_xform *cipher;
uint8_t encryption_order;
@@ -239,7 +239,7 @@ mlx5_crypto_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *spriv = (void *)sess->driver_priv_data;
+ struct mlx5_crypto_session *spriv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
if (unlikely(spriv == NULL)) {
DRV_LOG(ERR, "Failed to get session %p private data.", spriv);
@@ -355,8 +355,7 @@ mlx5_crypto_wqe_set(struct mlx5_crypto_priv *priv,
struct rte_crypto_op *op,
struct mlx5_umr_wqe *umr)
{
- struct mlx5_crypto_session *sess =
- (void *)op->sym->session->driver_priv_data;
+ struct mlx5_crypto_session *sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
struct mlx5_wqe_cseg *cseg = &umr->ctr;
struct mlx5_wqe_mkey_cseg *mkc = &umr->mkc;
struct mlx5_wqe_dseg *klms = &umr->kseg[0];
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index 505024a810..dd8457aaa4 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -534,7 +534,7 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
struct rte_crypto_sym_xform *xform,
struct rte_cryptodev_sym_session *sess)
{
- struct nitrox_crypto_ctx *ctx = (void *)sess->driver_priv_data;
+ struct nitrox_crypto_ctx *ctx = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct rte_crypto_cipher_xform *cipher_xform = NULL;
struct rte_crypto_auth_xform *auth_xform = NULL;
struct rte_crypto_aead_xform *aead_xform = NULL;
@@ -577,7 +577,7 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
goto err;
}
- ctx->iova = sess->driver_priv_data_iova;
+ ctx->iova = CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(sess);
return 0;
err:
return ret;
@@ -593,7 +593,7 @@ get_crypto_ctx(struct rte_crypto_op *op)
{
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(op->sym->session))
- return (void *)op->sym->session->driver_priv_data;
+ return CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 09aac3065e..27f750aaca 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -77,8 +77,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
- sess = (struct null_crypto_session *)
- sym_op->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(sym_op->session);
} else {
struct rte_cryptodev_sym_session *_sess = NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index fb43d3f7b5..f07e9c2ea0 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -265,7 +265,7 @@ null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- sess_private_data = (void *)sess->driver_priv_data;
+ sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
ret = null_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index cd5ebc2af6..a5b595c05f 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -248,7 +248,7 @@ sym_session_configure(struct rte_crypto_sym_xform *xform,
struct rte_crypto_sym_xform *temp_xform = xform;
struct cpt_sess_misc *misc;
vq_cmd_word3_t vq_cmd_w3;
- void *priv = (void *)sess->driver_priv_data;
+ void *priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
ret = sym_xform_verify(xform);
@@ -294,7 +294,7 @@ sym_session_configure(struct rte_crypto_sym_xform *xform,
goto priv_put;
}
- misc->ctx_dma_addr = sess->driver_priv_data_iova +
+ misc->ctx_dma_addr = CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(sess) +
sizeof(struct cpt_sess_misc);
vq_cmd_w3.u64 = 0;
@@ -313,7 +313,7 @@ sym_session_configure(struct rte_crypto_sym_xform *xform,
static void
sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = (void *)sess->driver_priv_data;
+ void *priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct cpt_sess_misc *misc;
struct cpt_ctx *ctx;
@@ -507,7 +507,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance,
void *req;
uint64_t cpt_op;
- sess = (struct cpt_sess_misc *)sym_op->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(sym_op->session);
cpt_op = sess->cpt_op;
if (likely(cpt_op & CPT_OP_CIPHER_MASK))
@@ -844,7 +844,7 @@ static inline void
free_sym_session_data(const struct cpt_instance *instance,
struct rte_crypto_op *cop)
{
- void *sess_private_data_t = (void *)cop->sym->session->driver_priv_data;
+ void *sess_private_data_t = CRYPTODEV_GET_SYM_SESS_PRIV(cop->sym->session);
memset(sess_private_data_t, 0, cpt_get_session_size());
rte_mempool_put(instance->sess_mp, cop->sym->session);
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 0bb536c9e3..cc8328cd5f 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -887,8 +887,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
/* get existing session */
if (likely(op->sym->session != NULL))
- sess = (void *)
- op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(
+ op->sym->session);
} else {
if (likely(op->asym->session != NULL))
asym_sess = (struct openssl_asym_session *)
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index 2a3662ee5a..defed4429e 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -795,7 +795,7 @@ openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data = (void *)sess->driver_priv_data;
+ void *sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
if (unlikely(sess == NULL)) {
@@ -1319,7 +1319,7 @@ static void
openssl_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_priv = (void *)sess->driver_priv_data;
+ void *sess_priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
/* Zero out the whole structure */
openssl_reset_session(sess_priv);
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 408ae9e42b..d7696822a8 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -67,7 +67,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
return -EINVAL;
if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) {
- ctx = (void *)op->sym->session->driver_priv_data;
+ ctx = (void *)CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
if (sess != (uintptr_t)ctx) {
struct rte_cryptodev *cdev;
struct qat_cryptodev_private *internals;
@@ -386,7 +386,7 @@ qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
return -EINVAL;
- ctx = (void *)session_ctx.crypto_sess->driver_priv_data;
+ ctx = CRYPTODEV_GET_SYM_SESS_PRIV(session_ctx.crypto_sess);
dp_ctx->session = ctx;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 2853ac5b88..653df0bf69 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -316,8 +316,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
} else
#endif
{
- sess = (struct qat_sym_session *)
- rx_op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(rx_op->sym->session);
is_docsis_sec = 0;
}
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 8dd2357702..c6976f2cdd 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -222,7 +222,7 @@ void
qat_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- struct qat_sym_session *s = (void *)sess->driver_priv_data;
+ struct qat_sym_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
if (s->bpi_ctx)
bpi_cipher_ctx_free(s->bpi_ctx);
@@ -505,8 +505,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
#endif
ret = qat_sym_session_set_parameters(dev, xform,
- (void *)sess->driver_priv_data,
- sess->driver_priv_data_iova);
+ CRYPTODEV_GET_SYM_SESS_PRIV(sess),
+ CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(sess));
if (ret != 0) {
QAT_LOG(ERR,
"Crypto QAT PMD: failed to configure session parameters");
diff --git a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
index 9204f6f608..396cc3723d 100644
--- a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
+++ b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
@@ -76,13 +76,10 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
rte_prefetch0((uint8_t *)ops[i + 7]->sym->session +
sizeof(struct rte_cryptodev_sym_session));
- sess_ctx[0] = (void *)ops[i]->sym->session->driver_priv_data;
- sess_ctx[1] =
- (void *)ops[i + 1]->sym->session->driver_priv_data;
- sess_ctx[2] =
- (void *)ops[i + 2]->sym->session->driver_priv_data;
- sess_ctx[3] =
- (void *)ops[i + 3]->sym->session->driver_priv_data;
+ sess_ctx[0] = CRYPTODEV_GET_SYM_SESS_PRIV(ops[i]->sym->session);
+ sess_ctx[1] = CRYPTODEV_GET_SYM_SESS_PRIV(ops[i + 1]->sym->session);
+ sess_ctx[2] = CRYPTODEV_GET_SYM_SESS_PRIV(ops[i + 2]->sym->session);
+ sess_ctx[3] = CRYPTODEV_GET_SYM_SESS_PRIV(ops[i + 3]->sym->session);
/* job_len is initialized as cipher data length, once
* it is 0, equals to auth data length
@@ -166,7 +163,7 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
for (; i < nb_ops; i++) {
struct scheduler_session_ctx *sess_ctx =
- (void *)ops[i]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(ops[i]->sym->session);
uint32_t job_len;
uint8_t target;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 2bc3f5dd27..707bb7d8d1 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -481,7 +481,7 @@ scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
{
struct scheduler_ctx *sched_ctx = dev->data->dev_private;
struct rte_mempool *mp = rte_mempool_from_obj(sess);
- struct scheduler_session_ctx *sess_ctx = (void *)sess->driver_priv_data;
+ struct scheduler_session_ctx *sess_ctx = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct scheduler_configured_sess_info configured_sess[
RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS] = { 0 };
uint32_t i, j, n_configured_sess = 0;
@@ -543,7 +543,7 @@ scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- struct scheduler_session_ctx *sess_ctx = (void *)sess->driver_priv_data;
+ struct scheduler_session_ctx *sess_ctx = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct scheduler_configured_sess_info deleted_sess[
RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS] = { 0 };
uint32_t i, j, n_deleted_sess = 0;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_private.h b/drivers/crypto/scheduler/scheduler_pmd_private.h
index 0e508727a4..41be928dc3 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_private.h
+++ b/drivers/crypto/scheduler/scheduler_pmd_private.h
@@ -131,28 +131,28 @@ scheduler_set_worker_session(struct rte_crypto_op **ops, uint16_t nb_ops,
if (op[0]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[0]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[0]->sym->session);
op[0]->sym->session =
sess_ctx->worker_sess[worker_index];
}
if (op[1]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[1]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[1]->sym->session);
op[1]->sym->session =
sess_ctx->worker_sess[worker_index];
}
if (op[2]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[2]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[2]->sym->session);
op[2]->sym->session =
sess_ctx->worker_sess[worker_index];
}
if (op[3]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[3]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[3]->sym->session);
op[3]->sym->session =
sess_ctx->worker_sess[worker_index];
}
@@ -164,7 +164,7 @@ scheduler_set_worker_session(struct rte_crypto_op **ops, uint16_t nb_ops,
while (n--) {
if (op[0]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[0]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[0]->sym->session);
op[0]->sym->session =
sess_ctx->worker_sess[worker_index];
@@ -195,17 +195,17 @@ scheduler_retrieve_session(struct rte_crypto_op **ops, uint16_t nb_ops)
}
if (op[0]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[0]->sym->session =
- (void *)op[0]->sym->session->opaque_data;
+ op[0]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[0]->sym->session);
if (op[1]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[1]->sym->session =
- (void *)op[1]->sym->session->opaque_data;
+ op[1]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[1]->sym->session);
if (op[2]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[2]->sym->session =
- (void *)op[2]->sym->session->opaque_data;
+ op[2]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[2]->sym->session);
if (op[3]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[3]->sym->session =
- (void *)op[3]->sym->session->opaque_data;
+ op[3]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[3]->sym->session);
op += 4;
n -= 4;
@@ -213,8 +213,8 @@ scheduler_retrieve_session(struct rte_crypto_op **ops, uint16_t nb_ops)
while (n--) {
if (op[0]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[0]->sym->session =
- (void *)op[0]->sym->session->opaque_data;
+ op[0]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[0]->sym->session);
op++;
}
}
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 6b9e57ee66..f068283290 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -951,7 +951,7 @@ virtio_crypto_sym_clear_session(
hw = dev->data->dev_private;
vq = hw->cvq;
- session = (struct virtio_crypto_session *)sess->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
VIRTIO_CRYPTO_SESSION_LOG_INFO("vq->vq_desc_head_idx = %d, "
"vq = %p", vq->vq_desc_head_idx, vq);
@@ -1318,7 +1318,7 @@ virtio_crypto_sym_configure_session(
VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid parameters");
return ret;
}
- session = (struct virtio_crypto_session *)sess->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
memset(session, 0, sizeof(struct virtio_crypto_session));
ctrl_req = &session->ctrl;
ctrl_req->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index b7f492a7f2..48b5f4ebbb 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -207,7 +207,7 @@ virtqueue_crypto_sym_enqueue_xmit(
offsetof(struct virtio_crypto_op_cookie, iv);
struct rte_crypto_sym_op *sym_op = cop->sym;
struct virtio_crypto_session *session =
- (void *)cop->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(cop->sym->session);
struct virtio_crypto_op_data_req *op_data_req;
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c
index bce903e007..b17f664a5e 100644
--- a/examples/fips_validation/fips_dev_self_test.c
+++ b/examples/fips_validation/fips_dev_self_test.c
@@ -980,7 +980,7 @@ typedef int (*fips_dev_self_test_prepare_xform_t)(uint8_t,
uint32_t);
typedef int (*fips_dev_self_test_prepare_op_t)(struct rte_crypto_op *,
- struct rte_mbuf *, struct rte_cryptodev_sym_session *,
+ struct rte_mbuf *, void *,
uint32_t, struct fips_dev_self_test_vector *);
typedef int (*fips_dev_self_test_check_result_t)(struct rte_crypto_op *,
@@ -1172,7 +1172,7 @@ prepare_aead_xform(uint8_t dev_id,
static int
prepare_cipher_op(struct rte_crypto_op *op,
struct rte_mbuf *mbuf,
- struct rte_cryptodev_sym_session *session,
+ void *session,
uint32_t dir,
struct fips_dev_self_test_vector *vec)
{
@@ -1211,7 +1211,7 @@ prepare_cipher_op(struct rte_crypto_op *op,
static int
prepare_auth_op(struct rte_crypto_op *op,
struct rte_mbuf *mbuf,
- struct rte_cryptodev_sym_session *session,
+ void *session,
uint32_t dir,
struct fips_dev_self_test_vector *vec)
{
@@ -1250,7 +1250,7 @@ prepare_auth_op(struct rte_crypto_op *op,
static int
prepare_aead_op(struct rte_crypto_op *op,
struct rte_mbuf *mbuf,
- struct rte_cryptodev_sym_session *session,
+ void *session,
uint32_t dir,
struct fips_dev_self_test_vector *vec)
{
@@ -1462,7 +1462,7 @@ run_single_test(uint8_t dev_id,
uint32_t negative_test)
{
struct rte_crypto_sym_xform xform;
- struct rte_cryptodev_sym_session *sess;
+ void *sess;
uint16_t n_deqd;
uint8_t key[256];
int ret;
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index f518a0f89b..bf10364b66 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -132,6 +132,38 @@ struct cryptodev_driver {
uint8_t id;
};
+/** Cryptodev symmetric crypto session
+ * Each session is derived from a fixed xform chain. Therefore each session
+ * has a fixed algo, key, op-type, digest_len etc.
+ */
+struct rte_cryptodev_sym_session {
+ RTE_MARKER cacheline0;
+ uint64_t opaque_data;
+ /**< Can be used for external metadata */
+ uint32_t sess_data_sz;
+ /**< Pointer to the user data stored after sess data */
+ uint16_t user_data_sz;
+ /**< Session user data will be placed after sess data */
+ uint8_t driver_id;
+ /**< Driver id to get the session priv */
+ rte_iova_t driver_priv_data_iova;
+ /**< Session driver data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ /**< Second cache line - start of the driver session data */
+ uint8_t driver_priv_data[0];
+ /**< Driver specific session data, variable size */
+};
+
+/**
+ * Helper macro to get driver private data
+ */
+#define CRYPTODEV_GET_SYM_SESS_PRIV(s) \
+ ((void *)(((struct rte_cryptodev_sym_session *)s)->driver_priv_data))
+#define CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(s) \
+ (((struct rte_cryptodev_sym_session *)s)->driver_priv_data_iova)
+
+
/**
* Get the rte_cryptodev structure device pointer for the device. Assumes a
* valid device index.
diff --git a/lib/cryptodev/rte_crypto.h b/lib/cryptodev/rte_crypto.h
index 6dfca2c169..f9644d29ec 100644
--- a/lib/cryptodev/rte_crypto.h
+++ b/lib/cryptodev/rte_crypto.h
@@ -430,8 +430,7 @@ rte_crypto_op_sym_xforms_alloc(struct rte_crypto_op *op, uint8_t nb_xforms)
* @param sess cryptodev session
*/
static inline int
-rte_crypto_op_attach_sym_session(struct rte_crypto_op *op,
- struct rte_cryptodev_sym_session *sess)
+rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, void *sess)
{
if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC))
return -1;
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index daa090b978..84deecac48 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -580,8 +580,6 @@ struct rte_crypto_sym_xform {
};
};
-struct rte_cryptodev_sym_session;
-
/**
* Symmetric Cryptographic Operation.
*
@@ -618,7 +616,7 @@ struct rte_crypto_sym_op {
RTE_STD_C11
union {
- struct rte_cryptodev_sym_session *session;
+ void *session;
/**< Handle for the initialised session context */
struct rte_crypto_sym_xform *xform;
/**< Session-less API crypto operation parameters */
@@ -923,8 +921,7 @@ __rte_crypto_sym_op_sym_xforms_alloc(struct rte_crypto_sym_op *sym_op,
* @param sess cryptodev session
*/
static inline int
-__rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op,
- struct rte_cryptodev_sym_session *sess)
+__rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op, void *sess)
{
sym_op->session = sess;
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index a326eb0e17..9ec015df8a 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -1950,11 +1950,11 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
}
int
-rte_cryptodev_sym_session_free(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_free(uint8_t dev_id, void *_sess)
{
struct rte_cryptodev *dev;
struct rte_mempool *sess_mp;
+ struct rte_cryptodev_sym_session *sess = _sess;
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
if (sess == NULL)
@@ -2069,10 +2069,11 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
}
int
-rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess, void *data,
+rte_cryptodev_sym_session_set_user_data(void *_sess, void *data,
uint16_t size)
{
+ struct rte_cryptodev_sym_session *sess = _sess;
+
if (sess == NULL)
return -EINVAL;
@@ -2084,8 +2085,10 @@ rte_cryptodev_sym_session_set_user_data(
}
void *
-rte_cryptodev_sym_session_get_user_data(struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_get_user_data(void *_sess)
{
+ struct rte_cryptodev_sym_session *sess = _sess;
+
if (sess == NULL || sess->user_data_sz == 0)
return NULL;
@@ -2129,10 +2132,11 @@ sym_crypto_fill_status(struct rte_crypto_sym_vec *vec, int32_t errnum)
uint32_t
rte_cryptodev_sym_cpu_crypto_process(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs,
+ void *_sess, union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
struct rte_cryptodev *dev;
+ struct rte_cryptodev_sym_session *sess = _sess;
if (!rte_cryptodev_is_valid_dev(dev_id)) {
sym_crypto_fill_status(vec, EINVAL);
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 0c65958f25..8b6a7a5c1d 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -902,28 +902,6 @@ struct rte_cryptodev_cb_rcu {
void *
rte_cryptodev_get_sec_ctx(uint8_t dev_id);
-/** Cryptodev symmetric crypto session
- * Each session is derived from a fixed xform chain. Therefore each session
- * has a fixed algo, key, op-type, digest_len etc.
- */
-struct rte_cryptodev_sym_session {
- RTE_MARKER cacheline0;
- uint8_t driver_id;
- uint64_t opaque_data;
- /**< Can be used for external metadata */
- uint32_t sess_data_sz;
- /**< Pointer to the user data stored after sess data */
- uint16_t user_data_sz;
- /**< session user data will be placed after sess data */
- rte_iova_t driver_priv_data_iova;
- /**< session driver data IOVA address */
-
- RTE_MARKER cacheline1 __rte_cache_min_aligned;
- /**< second cache line - start of the driver session data */
- uint8_t driver_priv_data[0];
- /**< Driver specific session data, variable size */
-};
-
/**
* Create a symmetric session mempool.
*
@@ -1036,7 +1014,7 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
*/
int
rte_cryptodev_sym_session_free(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess);
+ void *sess);
/**
* Clears and frees asymmetric crypto session header and private data,
@@ -1136,11 +1114,31 @@ const char *rte_cryptodev_driver_name_get(uint8_t driver_id);
*/
__rte_experimental
int
-rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess,
+rte_cryptodev_sym_session_set_user_data(void *sess,
void *data,
uint16_t size);
+#define CRYPTO_SESS_OPAQUE_DATA_OFF 0
+/**
+ * Get opaque data from session handle
+ */
+static inline uint64_t
+rte_cryptodev_sym_session_opaque_data_get(void *sess)
+{
+ return *((uint64_t *)sess + CRYPTO_SESS_OPAQUE_DATA_OFF);
+}
+
+/**
+ * Set opaque data in session handle
+ */
+static inline void
+rte_cryptodev_sym_session_opaque_data_set(void *sess, uint64_t opaque)
+{
+ uint64_t *data;
+ data = (((uint64_t *)sess) + CRYPTO_SESS_OPAQUE_DATA_OFF);
+ *data = opaque;
+}
+
/**
* Get user data stored in a session.
*
@@ -1153,8 +1151,7 @@ rte_cryptodev_sym_session_set_user_data(
*/
__rte_experimental
void *
-rte_cryptodev_sym_session_get_user_data(
- struct rte_cryptodev_sym_session *sess);
+rte_cryptodev_sym_session_get_user_data(void *sess);
/**
* Store user data in an asymmetric session.
@@ -1202,7 +1199,7 @@ rte_cryptodev_asym_session_get_user_data(void *sess);
__rte_experimental
uint32_t
rte_cryptodev_sym_cpu_crypto_process(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs,
+ void *sess, union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec);
/**
@@ -1244,8 +1241,7 @@ rte_cryptodev_session_event_mdata_set(uint8_t dev_id, void *sess,
* Union of different crypto session types, including session-less xform
* pointer.
*/
-union rte_cryptodev_session_ctx {
- struct rte_cryptodev_sym_session *crypto_sess;
+union rte_cryptodev_session_ctx {void *crypto_sess;
struct rte_crypto_sym_xform *xform;
struct rte_security_session *sec_sess;
};
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index 055c44fb22..7b4ec5c389 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -73,14 +73,10 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_create,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, void *xforms,
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id, void *sess, void *xforms,
void *mempool),
rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
- rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u8(sess->driver_id);
- rte_trace_point_emit_u16(sess->user_data_sz);
rte_trace_point_emit_ptr(xforms);
rte_trace_point_emit_ptr(mempool);
)
@@ -108,7 +104,7 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_free,
- RTE_TRACE_POINT_ARGS(struct rte_cryptodev_sym_session *sess),
+ RTE_TRACE_POINT_ARGS(void *sess),
rte_trace_point_emit_ptr(sess);
)
diff --git a/lib/ipsec/rte_ipsec_group.h b/lib/ipsec/rte_ipsec_group.h
index 62c2bd7217..a4e0e128f8 100644
--- a/lib/ipsec/rte_ipsec_group.h
+++ b/lib/ipsec/rte_ipsec_group.h
@@ -45,14 +45,15 @@ static inline struct rte_ipsec_session *
rte_ipsec_ses_from_crypto(const struct rte_crypto_op *cop)
{
const struct rte_security_session *ss;
- const struct rte_cryptodev_sym_session *cs;
+ void *cs;
if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
ss = cop->sym[0].sec_session;
return (struct rte_ipsec_session *)(uintptr_t)ss->opaque_data;
} else if (cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
cs = cop->sym[0].session;
- return (struct rte_ipsec_session *)(uintptr_t)cs->opaque_data;
+ return (struct rte_ipsec_session *)(uintptr_t)
+ rte_cryptodev_sym_session_opaque_data_get(cs);
}
return NULL;
}
diff --git a/lib/ipsec/ses.c b/lib/ipsec/ses.c
index 3d51ac4986..0d3c932302 100644
--- a/lib/ipsec/ses.c
+++ b/lib/ipsec/ses.c
@@ -45,7 +45,8 @@ rte_ipsec_session_prepare(struct rte_ipsec_session *ss)
ss->pkt_func = fp;
if (ss->type == RTE_SECURITY_ACTION_TYPE_NONE)
- ss->crypto.ses->opaque_data = (uintptr_t)ss;
+ rte_cryptodev_sym_session_opaque_data_set(ss->crypto.ses,
+ (uintptr_t)ss);
else
ss->security.ses->opaque_data = (uintptr_t)ss;
--
2.25.1
^ permalink raw reply [relevance 1%]
* [PATCH v4 1/6] cryptodev: rework session framework
@ 2022-09-26 19:14 1% ` Akhil Goyal
2022-09-26 19:14 1% ` [PATCH v4 3/6] cryptodev: hide sym session structure Akhil Goyal
2022-09-26 19:14 2% ` [PATCH v4 6/6] security: hide " Akhil Goyal
2 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-26 19:14 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, Akhil Goyal,
Ruifeng Wang, Kai Ji, David Coyle, Kevin O'Sullivan
As per current design, rte_cryptodev_sym_session_create() and
rte_cryptodev_sym_session_init() use separate mempool objects
for a single session.
And structure rte_cryptodev_sym_session is not directly used
by the application, it may cause ABI breakage if the structure
is modified in future.
To address these two issues, the rte_cryptodev_sym_session_create
will take one mempool object that the session and session private
data are virtually/physically contiguous, and initializes both
fields. The API rte_cryptodev_sym_session_init is removed.
rte_cryptodev_sym_session_create will now return an opaque session
pointer which will be used by the app and other APIs.
In data path, opaque session pointer is attached to rte_crypto_op
and the PMD can call an internal library API to get the session
private data pointer based on the driver id.
Note: currently single session may be used by different device
drivers, given it is initialized by them. After the change the
session created by one device driver cannot be used or
reinitialized by another driver.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Ruifeng Wang <Ruifeng.Wang@arm.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test-crypto-perf/cperf_ops.c | 21 +-
app/test-crypto-perf/cperf_test_latency.c | 6 +-
.../cperf_test_pmd_cyclecount.c | 5 +-
app/test-crypto-perf/cperf_test_throughput.c | 6 +-
app/test-crypto-perf/cperf_test_verify.c | 6 +-
app/test-crypto-perf/main.c | 29 +-
app/test-eventdev/test_perf_common.c | 35 +-
app/test-eventdev/test_perf_common.h | 1 -
app/test/test_cryptodev.c | 303 +++++-------------
app/test/test_cryptodev_blockcipher.c | 16 +-
app/test/test_event_crypto_adapter.c | 35 +-
app/test/test_ipsec.c | 42 +--
drivers/crypto/armv8/armv8_pmd_private.h | 2 -
drivers/crypto/armv8/rte_armv8_pmd.c | 21 +-
drivers/crypto/armv8/rte_armv8_pmd_ops.c | 35 +-
drivers/crypto/bcmfs/bcmfs_sym_session.c | 38 +--
drivers/crypto/bcmfs/bcmfs_sym_session.h | 3 +-
drivers/crypto/caam_jr/caam_jr.c | 28 +-
drivers/crypto/ccp/ccp_crypto.c | 58 +---
drivers/crypto/ccp/ccp_pmd_ops.c | 32 +-
drivers/crypto/ccp/ccp_pmd_private.h | 2 -
drivers/crypto/ccp/rte_ccp_pmd.c | 29 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 36 +--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 31 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 55 +---
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 14 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 31 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 3 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 37 +--
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 4 +-
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 34 +-
drivers/crypto/ipsec_mb/ipsec_mb_private.h | 41 ++-
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 48 +--
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 36 +--
drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 4 -
drivers/crypto/ipsec_mb/pmd_kasumi.c | 10 +-
drivers/crypto/ipsec_mb/pmd_snow3g.c | 9 +-
drivers/crypto/ipsec_mb/pmd_zuc.c | 4 -
drivers/crypto/mlx5/mlx5_crypto.c | 26 +-
drivers/crypto/mvsam/rte_mrvl_pmd.c | 8 +-
drivers/crypto/mvsam/rte_mrvl_pmd_ops.c | 21 +-
drivers/crypto/nitrox/nitrox_sym.c | 39 +--
drivers/crypto/null/null_crypto_pmd.c | 19 +-
drivers/crypto/null/null_crypto_pmd_ops.c | 33 +-
drivers/crypto/null/null_crypto_pmd_private.h | 2 -
.../crypto/octeontx/otx_cryptodev_hw_access.h | 1 -
drivers/crypto/octeontx/otx_cryptodev_ops.c | 67 +---
drivers/crypto/openssl/openssl_pmd_private.h | 2 -
drivers/crypto/openssl/rte_openssl_pmd.c | 24 +-
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 29 +-
drivers/crypto/qat/qat_sym.c | 10 +-
drivers/crypto/qat/qat_sym.h | 4 +-
drivers/crypto/qat/qat_sym_session.c | 40 +--
drivers/crypto/qat/qat_sym_session.h | 6 +-
drivers/crypto/scheduler/scheduler_pmd_ops.c | 38 +--
drivers/crypto/virtio/virtio_cryptodev.c | 40 +--
drivers/crypto/virtio/virtio_rxtx.c | 3 +-
examples/fips_validation/fips_dev_self_test.c | 30 +-
examples/fips_validation/main.c | 35 +-
examples/ipsec-secgw/ipsec-secgw.c | 10 +-
examples/ipsec-secgw/ipsec.c | 7 +-
examples/l2fwd-crypto/main.c | 54 +---
examples/vhost_crypto/main.c | 16 +-
lib/cryptodev/cryptodev_pmd.h | 28 +-
lib/cryptodev/cryptodev_trace_points.c | 6 -
lib/cryptodev/rte_cryptodev.c | 276 ++++++----------
lib/cryptodev/rte_cryptodev.h | 123 ++-----
lib/cryptodev/rte_cryptodev_trace.h | 33 +-
lib/cryptodev/version.map | 6 -
lib/pipeline/rte_table_action.c | 10 +-
lib/vhost/rte_vhost_crypto.h | 3 -
lib/vhost/vhost_crypto.c | 28 +-
72 files changed, 553 insertions(+), 1674 deletions(-)
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index d746d51082..c6f5735bb0 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -912,7 +912,6 @@ cperf_create_session(struct rte_mempool *sess_mp,
&sess_conf, sess_mp, priv_mp);
}
#endif
- sess = rte_cryptodev_sym_session_create(sess_mp);
/*
* cipher only
*/
@@ -937,8 +936,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
cipher_xform.cipher.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &cipher_xform,
+ sess_mp);
/*
* auth only
*/
@@ -965,8 +964,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
auth_xform.auth.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &auth_xform,
+ sess_mp);
/*
* cipher and auth
*/
@@ -1024,13 +1023,13 @@ cperf_create_session(struct rte_mempool *sess_mp,
if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
cipher_xform.next = &auth_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &cipher_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &cipher_xform, sess_mp);
} else { /* auth then cipher */
auth_xform.next = &cipher_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &auth_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &auth_xform, sess_mp);
}
} else { /* options->op_type == CPERF_AEAD */
aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -1050,8 +1049,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
options->aead_aad_sz;
/* Create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &aead_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &aead_xform,
+ sess_mp);
}
return sess;
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index 6f972cea49..afd8cb209b 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -44,10 +44,8 @@ static void
cperf_latency_test_free(struct cperf_latency_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 3f2da13d3a..edd2730b73 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -74,10 +74,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
(struct rte_security_session *)ctx->sess);
} else
#endif
- {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index fba66bbde9..fa13915dc3 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -52,10 +52,8 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
(struct rte_security_session *)ctx->sess);
}
#endif
- else {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ else
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index b691595675..c1465db243 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -39,10 +39,8 @@ static void
cperf_verify_test_free(struct cperf_verify_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 27acd619bc..3469b836e1 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -97,35 +97,14 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
char mp_name[RTE_MEMPOOL_NAMESIZE];
struct rte_mempool *sess_mp;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- sess_mp = rte_mempool_create(mp_name,
- nb_sessions,
- session_priv_size,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (sess_mp == NULL) {
- printf("Cannot create pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- session_pool_socket[socket_id].priv_mp = sess_mp;
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
- nb_sessions, 0, 0, 0, socket_id);
+ nb_sessions, session_priv_size, 0, 0,
+ socket_id);
if (sess_mp == NULL) {
printf("Cannot create pool \"%s\" on socket %d\n",
@@ -136,6 +115,7 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
printf("Allocated pool \"%s\" on socket %d\n",
mp_name, socket_id);
session_pool_socket[socket_id].sess_mp = sess_mp;
+ session_pool_socket[socket_id].priv_mp = sess_mp;
}
return 0;
@@ -323,12 +303,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
return ret;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
if (opts->op_type == CPERF_ASYM_MODEX) {
qp_conf.mp_session = NULL;
- qp_conf.mp_session_private = NULL;
}
ret = rte_cryptodev_configure(cdev_id, &conf);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index 81420be73a..30cefcb6dd 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -864,18 +864,13 @@ cryptodev_sym_sess_create(struct prod_data *p, struct test_perf *t)
cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
cipher_xform.next = NULL;
- sess = rte_cryptodev_sym_session_create(t->ca_sess_pool);
+ sess = rte_cryptodev_sym_session_create(p->ca.cdev_id, &cipher_xform,
+ t->ca_sess_pool);
if (sess == NULL) {
evt_err("Failed to create sym session");
return NULL;
}
- if (rte_cryptodev_sym_session_init(p->ca.cdev_id, sess, &cipher_xform,
- t->ca_sess_priv_pool)) {
- evt_err("Failed to init session");
- return NULL;
- }
-
return sess;
}
@@ -1382,15 +1377,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
goto err;
}
- t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
- "ca_sess_pool", nb_sessions, 0, 0,
- sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
- if (t->ca_sess_pool == NULL) {
- evt_err("Failed to create sym session pool");
- ret = -ENOMEM;
- goto err;
- }
-
max_session_size = 0;
for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
unsigned int session_size;
@@ -1401,12 +1387,11 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
max_session_size = session_size;
}
- max_session_size += sizeof(union rte_event_crypto_metadata);
- t->ca_sess_priv_pool = rte_mempool_create(
- "ca_sess_priv_pool", nb_sessions, max_session_size, 0, 0, NULL,
- NULL, NULL, NULL, SOCKET_ID_ANY, 0);
- if (t->ca_sess_priv_pool == NULL) {
- evt_err("failed to create sym session private pool");
+ t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
+ "ca_sess_pool", nb_sessions, max_session_size, 0,
+ sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
+ if (t->ca_sess_pool == NULL) {
+ evt_err("Failed to create sym session pool");
ret = -ENOMEM;
goto err;
}
@@ -1446,7 +1431,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
qp_conf.nb_descriptors = NB_CRYPTODEV_DESCRIPTORS;
qp_conf.mp_session = t->ca_sess_pool;
- qp_conf.mp_session_private = t->ca_sess_priv_pool;
for (qp_id = 0; qp_id < conf.nb_queue_pairs; qp_id++) {
ret = rte_cryptodev_queue_pair_setup(
@@ -1467,7 +1451,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
return ret;
@@ -1492,8 +1475,7 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
for (flow_id = 0; flow_id < t->nb_flows; flow_id++) {
sess = p->ca.crypto_sess[flow_id];
cdev_id = p->ca.cdev_id;
- rte_cryptodev_sym_session_clear(cdev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(cdev_id, sess);
}
rte_event_crypto_adapter_queue_pair_del(
@@ -1509,7 +1491,6 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
}
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index 8cbd06fe42..d06d52cdf8 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -70,7 +70,6 @@ struct test_perf {
RTE_EVENT_TIMER_ADAPTER_NUM_MAX] __rte_cache_aligned;
struct rte_mempool *ca_op_pool;
struct rte_mempool *ca_sess_pool;
- struct rte_mempool *ca_sess_priv_pool;
struct rte_mempool *ca_asym_sess_pool;
} __rte_cache_aligned;
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 0c39b16b71..ae2b102ecb 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -13,6 +13,7 @@
#include <rte_pause.h>
#include <rte_bus_vdev.h>
#include <rte_ether.h>
+#include <rte_errno.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
@@ -644,23 +645,17 @@ testsuite_setup(void)
}
ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
- "test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+ "test_sess_mp", MAX_NB_SESSIONS, session_size, 0, 0,
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
-
ts_params->session_priv_mpool = rte_mempool_create(
- "test_sess_mp_priv",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
+ "test_sess_mp_priv", MAX_NB_SESSIONS, session_size,
+ 0, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
+
TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
"session mempool allocation failed");
-
-
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
&ts_params->conf),
"Failed to configure cryptodev %u with %u qps",
@@ -668,7 +663,6 @@ testsuite_setup(void)
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -697,15 +691,11 @@ testsuite_teardown(void)
rte_mempool_avail_count(ts_params->op_mpool));
}
- /* Free session mempools */
- if (ts_params->session_priv_mpool != NULL) {
- rte_mempool_free(ts_params->session_priv_mpool);
- ts_params->session_priv_mpool = NULL;
- }
-
if (ts_params->session_mpool != NULL) {
rte_mempool_free(ts_params->session_mpool);
ts_params->session_mpool = NULL;
+ rte_mempool_free(ts_params->session_priv_mpool);
+ ts_params->session_priv_mpool = NULL;
}
res = rte_cryptodev_close(ts_params->valid_devs[0]);
@@ -1392,7 +1382,6 @@ dev_configure_and_start(uint64_t ff_disable)
ts_params->conf.ff_disable = ff_disable;
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
&ts_params->conf),
@@ -1452,10 +1441,8 @@ ut_teardown(void)
#endif
{
if (ut_params->sess) {
- rte_cryptodev_sym_session_clear(
- ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
- rte_cryptodev_sym_session_free(ut_params->sess);
ut_params->sess = NULL;
}
}
@@ -1610,7 +1597,6 @@ test_queue_pair_descriptor_setup(void)
*/
qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -2155,8 +2141,6 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
-
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2200,19 +2184,13 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
ut_params->auth_xform.auth.key.data = hmac_sha1_key;
ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
+ rte_errno = 0;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- /* Create crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ if (rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -2441,7 +2419,6 @@ create_wireless_algo_hash_session(uint8_t dev_id,
enum rte_crypto_auth_algorithm algo)
{
uint8_t hash_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2461,16 +2438,11 @@ create_wireless_algo_hash_session(uint8_t dev_id,
ut_params->auth_xform.auth.digest_length = auth_len;
ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
ut_params->auth_xform.auth.iv.length = iv_len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2483,7 +2455,6 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
uint8_t iv_len)
{
uint8_t cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2503,16 +2474,12 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session */
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2590,7 +2557,6 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
{
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2625,17 +2591,12 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2649,7 +2610,6 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
{
const uint8_t key_len = tdata->key.len;
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2689,16 +2649,11 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2724,7 +2679,6 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
uint8_t cipher_iv_len)
{
uint8_t auth_cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2755,26 +2709,19 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
if (cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
ut_params->auth_xform.next = NULL;
ut_params->cipher_xform.next = &ut_params->auth_xform;
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
} else
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -8205,7 +8152,6 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
uint8_t iv_len)
{
uint8_t aead_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -8227,15 +8173,12 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->aead_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->aead_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -8679,7 +8622,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
/* Create security session */
ut_params->sec_session = rte_security_session_create(ctx,
&sess_conf, ts_params->session_mpool,
- ts_params->session_priv_mpool);
+ NULL);
if (!ut_params->sec_session) {
printf("TestCase %s()-%d line %d failed %s: ",
@@ -12029,7 +11972,6 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
const struct HMAC_MD5_vector *test_case)
{
uint8_t key[64];
- int status;
memcpy(key, test_case->key.data, test_case->key.len);
@@ -12044,16 +11986,11 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
ut_params->auth_xform.auth.key.data = key;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- if (ut_params->sess == NULL)
- return TEST_FAILED;
-
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -12261,12 +12198,9 @@ test_multi_session(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
-
struct rte_cryptodev_info dev_info;
struct rte_cryptodev_sym_session **sessions;
-
uint16_t i;
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12293,20 +12227,15 @@ test_multi_session(void)
/* Create multiple crypto sessions*/
for (i = 0; i < MAX_NB_SESSIONS; i++) {
-
sessions[i] = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
+
TEST_ASSERT_NOT_NULL(sessions[i],
"Session creation failed at session number %u",
i);
-
- status = rte_cryptodev_sym_session_init(
- ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
/* Attempt to send a request on each session */
TEST_ASSERT_SUCCESS( test_AES_CBC_HMAC_SHA512_decrypt_perform(
sessions[i],
@@ -12336,18 +12265,9 @@ test_multi_session(void)
}
}
- sessions[i] = NULL;
- /* Next session create should fail */
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NULL(sessions[i],
- "Session creation succeeded unexpectedly!");
-
for (i = 0; i < MAX_NB_SESSIONS; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12398,7 +12318,6 @@ test_multi_session_random_usage(void)
},
};
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12420,11 +12339,6 @@ test_multi_session_random_usage(void)
* MAX_NB_SESSIONS) + 1, 0);
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- sessions[i] = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(sessions[i],
- "Session creation failed at session number %u",
- i);
rte_memcpy(&ut_paramz[i].ut_params, &unittest_params,
sizeof(struct crypto_unittest_params));
@@ -12434,16 +12348,16 @@ test_multi_session_random_usage(void)
ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
/* Create multiple crypto sessions*/
- status = rte_cryptodev_sym_session_init(
+ sessions[i] = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0],
- sessions[i],
&ut_paramz[i].ut_params.auth_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(sessions[i],
+ "Session creation failed at session number %u",
+ i);
}
srand(time(NULL));
@@ -12481,9 +12395,8 @@ test_multi_session_random_usage(void)
}
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12501,7 +12414,6 @@ test_null_invalid_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int ret;
/* This test is for NULL PMD only */
if (gbl_driver_id != rte_cryptodev_driver_id_get(
@@ -12515,17 +12427,13 @@ test_null_invalid_operation(void)
ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
-
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.next = NULL;
@@ -12533,14 +12441,11 @@ test_null_invalid_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
return TEST_SUCCESS;
@@ -12554,7 +12459,6 @@ test_null_burst_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
unsigned i, burst_len = NULL_BURST_LENGTH;
@@ -12580,19 +12484,14 @@ test_null_burst_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
/* Create Crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0],
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
@@ -12703,7 +12602,6 @@ test_enq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12803,7 +12701,6 @@ test_deq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12990,7 +12887,6 @@ static int create_gmac_session(uint8_t dev_id,
enum rte_crypto_auth_operation auth_op)
{
uint8_t auth_key[tdata->key.len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -13009,15 +12905,13 @@ static int create_gmac_session(uint8_t dev_id,
ut_params->auth_xform.auth.iv.length = tdata->iv.len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -13646,7 +13540,6 @@ create_auth_session(struct crypto_unittest_params *ut_params,
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -13660,15 +13553,13 @@ create_auth_session(struct crypto_unittest_params *ut_params,
ut_params->auth_xform.auth.digest_length = reference->digest.len;
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -13681,7 +13572,6 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -13713,15 +13603,13 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
}
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -14179,7 +14067,6 @@ test_authenticated_encrypt_with_esn(
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
struct rte_cryptodev_info dev_info;
- int status;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -14230,19 +14117,12 @@ test_authenticated_encrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
-
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
"Failed to allocate input buffer in mempool");
@@ -14366,18 +14246,11 @@ test_authenticated_decrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- retval = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- if (retval == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(retval, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
@@ -15125,8 +14998,8 @@ test_scheduler_attach_worker_op(void)
ts_params->session_mpool =
rte_cryptodev_sym_session_pool_create(
"test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0,
- SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, session_size,
+ 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
}
@@ -15149,8 +15022,6 @@ test_scheduler_attach_worker_op(void)
}
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private =
- ts_params->session_priv_mpool;
ret = rte_cryptodev_scheduler_worker_attach(sched_id,
(uint8_t)i);
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index b5813b956f..4fcdd55660 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -68,7 +68,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
struct rte_mempool *sess_mpool,
- struct rte_mempool *sess_priv_mpool,
uint8_t dev_id,
char *test_msg)
{
@@ -514,11 +513,9 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
*/
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) &&
nb_iterates == 0) {
- sess = rte_cryptodev_sym_session_create(sess_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, sess,
- init_xform, sess_priv_mpool);
- if (status == -ENOTSUP) {
+ sess = rte_cryptodev_sym_session_create(dev_id, init_xform,
+ sess_mpool);
+ if (sess == NULL) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "UNSUPPORTED");
status = TEST_SKIPPED;
goto error_exit;
@@ -801,10 +798,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
error_exit:
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- if (sess) {
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
- }
+ if (sess)
+ rte_cryptodev_sym_session_free(dev_id, sess);
rte_free(cipher_xform);
rte_free(auth_xform);
}
@@ -829,7 +824,6 @@ blockcipher_test_case_run(const void *data)
p_testsuite_params->mbuf_pool,
p_testsuite_params->op_mpool,
p_testsuite_params->session_mpool,
- p_testsuite_params->session_priv_mpool,
p_testsuite_params->valid_devs[0],
test_msg);
return status;
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 2ecc7e2cea..c6cf9c5401 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -157,7 +157,6 @@ struct event_crypto_adapter_test_params {
struct rte_mempool *op_mpool;
struct rte_mempool *asym_op_mpool;
struct rte_mempool *session_mpool;
- struct rte_mempool *session_priv_mpool;
struct rte_mempool *asym_sess_mpool;
struct rte_cryptodev_config *config;
uint8_t crypto_event_port_id;
@@ -307,15 +306,10 @@ test_op_forward_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
-
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
&cap);
TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
@@ -683,8 +677,8 @@ test_op_new_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
@@ -699,9 +693,6 @@ test_op_new_mode(uint8_t session_less)
RTE_CRYPTO_OP_WITH_SESSION,
&m_data, sizeof(m_data));
}
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
rte_crypto_op_attach_sym_session(op, sess);
} else {
@@ -994,22 +985,12 @@ configure_cryptodev(void)
params.session_mpool = rte_cryptodev_sym_session_pool_create(
"CRYPTO_ADAPTER_SESSION_MP",
- MAX_NB_SESSIONS, 0, 0,
+ MAX_NB_SESSIONS, session_size, 0,
sizeof(union rte_event_crypto_metadata),
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(params.session_mpool,
"session mempool allocation failed\n");
- params.session_priv_mpool = rte_mempool_create(
- "CRYPTO_AD_SESS_MP_PRIV",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
- TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
- "session mempool allocation failed\n");
-
rte_cryptodev_info_get(TEST_CDEV_ID, &info);
while ((capability = &info.capabilities[i++])->op !=
@@ -1048,7 +1029,6 @@ configure_cryptodev(void)
qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
qp_conf.mp_session = params.session_mpool;
- qp_conf.mp_session_private = params.session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -1410,11 +1390,6 @@ crypto_teardown(void)
rte_mempool_free(params.session_mpool);
params.session_mpool = NULL;
}
- if (params.session_priv_mpool != NULL) {
- rte_mempool_avail_count(params.session_priv_mpool);
- rte_mempool_free(params.session_priv_mpool);
- params.session_priv_mpool = NULL;
- }
/* Free asym session mempool */
if (params.asym_sess_mpool != NULL) {
diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index aa533483fd..04d231468b 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -370,20 +370,9 @@ testsuite_setup(void)
return TEST_FAILED;
}
- ts_params->qp_conf.mp_session_private = rte_mempool_create(
- "test_priv_sess_mp",
- MAX_NB_SESSIONS,
- sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
-
- TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session_private,
- "private session mempool allocation failed");
-
ts_params->qp_conf.mp_session =
rte_cryptodev_sym_session_pool_create("test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, sess_sz, 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session,
"session mempool allocation failed");
@@ -428,11 +417,6 @@ testsuite_teardown(void)
rte_mempool_free(ts_params->qp_conf.mp_session);
ts_params->qp_conf.mp_session = NULL;
}
-
- if (ts_params->qp_conf.mp_session_private != NULL) {
- rte_mempool_free(ts_params->qp_conf.mp_session_private);
- ts_params->qp_conf.mp_session_private = NULL;
- }
}
static int
@@ -647,8 +631,7 @@ create_dummy_sec_session(struct ipsec_unitest_params *ut,
static struct rte_security_session_conf conf;
ut->ss[j].security.ses = rte_security_session_create(&dummy_sec_ctx,
- &conf, qp->mp_session,
- qp->mp_session_private);
+ &conf, qp->mp_session, NULL);
if (ut->ss[j].security.ses == NULL)
return -ENOMEM;
@@ -662,25 +645,15 @@ static int
create_crypto_session(struct ipsec_unitest_params *ut,
struct rte_cryptodev_qp_conf *qp, uint8_t dev_id, uint32_t j)
{
- int32_t rc;
struct rte_cryptodev_sym_session *s;
- s = rte_cryptodev_sym_session_create(qp->mp_session);
+ s = rte_cryptodev_sym_session_create(dev_id, ut->crypto_xforms,
+ qp->mp_session);
if (s == NULL)
return -ENOMEM;
- /* initialize SA crypto session for device */
- rc = rte_cryptodev_sym_session_init(dev_id, s,
- ut->crypto_xforms, qp->mp_session_private);
- if (rc == 0) {
- ut->ss[j].crypto.ses = s;
- return 0;
- } else {
- /* failure, do cleanup */
- rte_cryptodev_sym_session_clear(dev_id, s);
- rte_cryptodev_sym_session_free(s);
- return rc;
- }
+ ut->ss[j].crypto.ses = s;
+ return 0;
}
static int
@@ -1196,8 +1169,7 @@ static void
destroy_crypto_session(struct ipsec_unitest_params *ut,
uint8_t crypto_dev, uint32_t j)
{
- rte_cryptodev_sym_session_clear(crypto_dev, ut->ss[j].crypto.ses);
- rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses);
+ rte_cryptodev_sym_session_free(crypto_dev, ut->ss[j].crypto.ses);
memset(&ut->ss[j], 0, sizeof(ut->ss[j]));
}
diff --git a/drivers/crypto/armv8/armv8_pmd_private.h b/drivers/crypto/armv8/armv8_pmd_private.h
index 75ddba79c1..41292d8851 100644
--- a/drivers/crypto/armv8/armv8_pmd_private.h
+++ b/drivers/crypto/armv8/armv8_pmd_private.h
@@ -106,8 +106,6 @@ struct armv8_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
char name[RTE_CRYPTODEV_NAME_MAX_LEN];
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 32127a874c..ebca5c09ee 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -521,34 +521,23 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
/* get existing session */
if (likely(op->sym->session != NULL)) {
- sess = (struct armv8_crypto_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
} else {
/* provide internal session */
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct armv8_crypto_session *)_sess_private_data;
+ sess = (struct armv8_crypto_session *)_sess->driver_priv_data;
if (unlikely(armv8_crypto_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
}
if (unlikely(sess == NULL))
@@ -674,10 +663,6 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct armv8_crypto_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index c07ac0489e..c4964bc112 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -244,7 +244,6 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -265,10 +264,9 @@ armv8_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
/** Configure the session from a crypto xform chain */
static int
-armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
+armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -278,43 +276,22 @@ armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = sess->driver_priv_data;
ret = armv8_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
ARMV8_CRYPTO_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct armv8_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops armv8_crypto_pmd_ops = {
.dev_configure = armv8_crypto_pmd_config,
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index 675ed0ad55..d3334dc920 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -211,8 +211,7 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
} else if (likely(op->sym->session != NULL)) {
/* get existing session */
sess = (struct bcmfs_sym_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_bcmfs_driver_id);
+ op->sym->session->driver_priv_data;
}
if (sess == NULL)
@@ -222,10 +221,9 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
}
int
-bcmfs_sym_session_configure(struct rte_cryptodev *dev,
+bcmfs_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -235,45 +233,23 @@ bcmfs_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- BCMFS_DP_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
BCMFS_DP_LOG(ERR, "Failed configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
void
-bcmfs_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp;
-
- memset(sess_priv, 0, sizeof(struct bcmfs_sym_session));
- sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+bcmfs_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
unsigned int
bcmfs_sym_session_get_private_size(struct rte_cryptodev *dev __rte_unused)
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.h b/drivers/crypto/bcmfs/bcmfs_sym_session.h
index d40595b4bd..4a0a012ae7 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.h
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.h
@@ -93,8 +93,7 @@ bcmfs_process_crypto_op(struct rte_crypto_op *op,
int
bcmfs_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
void
bcmfs_sym_session_clear(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8e9cfe73d8..a9c93dea13 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1357,8 +1357,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
ses = (struct caam_jr_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_driver_id);
+ op->sym->session->driver_priv_data;
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
ses = (struct caam_jr_session *)
@@ -1692,54 +1691,39 @@ caam_jr_set_session_parameters(struct rte_cryptodev *dev,
}
static int
-caam_jr_sym_session_configure(struct rte_cryptodev *dev,
+caam_jr_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
PMD_INIT_FUNC_TRACE();
-
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CAAM_JR_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
+ sess_private_data = (void *)sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct caam_jr_session));
ret = caam_jr_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
CAAM_JR_ERR("failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
static void
-caam_jr_sym_session_clear(struct rte_cryptodev *dev,
+caam_jr_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
struct caam_jr_session *s = (struct caam_jr_session *)sess_priv;
PMD_INIT_FUNC_TRACE();
if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(struct caam_jr_session));
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4bab18323b..bd999abe61 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1585,9 +1585,7 @@ ccp_perform_hmac(struct rte_crypto_op *op,
void *append_ptr;
uint8_t *addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
addr = session->auth.pre_compute;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -1766,9 +1764,7 @@ ccp_perform_sha(struct rte_crypto_op *op,
void *append_ptr;
uint64_t auth_msg_bits;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1859,9 +1855,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr, dest_addr_t;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2005,9 +1999,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2079,9 +2071,7 @@ ccp_perform_aes_cmac(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
key_addr = rte_mem_virt2phy(session->auth.key_ccp);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -2242,9 +2232,7 @@ ccp_perform_aes(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
uint8_t *iv;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
function.raw = 0;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
@@ -2330,9 +2318,7 @@ ccp_perform_3des(struct rte_crypto_op *op,
uint8_t *iv;
phys_addr_t src_addr, dest_addr, key_addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
switch (session->cipher.um.des_mode) {
@@ -2440,9 +2426,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
phys_addr_t digest_dest_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
key_addr = session->cipher.key_phys;
@@ -2607,9 +2591,7 @@ ccp_crypto_cipher(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->cipher.algo) {
case CCP_CIPHER_ALGO_AES_CBC:
@@ -2645,9 +2627,7 @@ ccp_crypto_auth(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_SHA1:
@@ -2715,9 +2695,7 @@ ccp_crypto_aead(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_AES_GCM:
@@ -2780,9 +2758,8 @@ process_ops_to_enqueue(struct ccp_qp *qp,
b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
Q_DESC_SIZE);
for (i = b_idx; i < (nb_ops+b_idx); i++) {
- session = (struct ccp_session *)get_sym_session_private_data(
- op[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
result = ccp_crypto_cipher(op[i], cmd_q, b_info);
@@ -2858,9 +2835,7 @@ static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
int offset, digest_offset;
uint8_t digest_le[64];
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
if (session->cmd_id == CCP_CMD_COMBINED) {
digest_data = op->sym->aead.digest.data;
@@ -2934,9 +2909,8 @@ ccp_prepare_ops(struct ccp_qp *qp,
for (i = b_info->b_idx; i < min_ops; i++) {
op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
- session = (struct ccp_session *)get_sym_session_private_data(
- op_d[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op_d[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 1b600e81ad..e401793a76 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -727,7 +727,6 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
/* mempool for batch info */
qp->batch_mp = rte_mempool_create(
@@ -757,8 +756,7 @@ ccp_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
void *sess_private_data;
@@ -769,40 +767,22 @@ ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -ENOMEM;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CCP_LOG_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
+
internals = (struct ccp_private *)dev->data->dev_private;
ret = ccp_set_session_parameters(sess_private_data, xform, internals);
if (ret != 0) {
CCP_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
return 0;
}
static void
-ccp_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- rte_mempool_put(sess_mp, sess_priv);
- memset(sess_priv, 0, sizeof(struct ccp_session));
- set_sym_session_private_data(sess, index, NULL);
- }
-}
+ccp_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops ccp_ops = {
.dev_configure = ccp_pmd_config,
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 1c4118ee3c..6704e39ab8 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -78,8 +78,6 @@ struct ccp_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_mempool *batch_mp;
/**< Session Mempool for batch info */
struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a35a8cd775..7502281ad9 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -56,33 +56,23 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
if (unlikely(op->sym->session == NULL))
return NULL;
- sess = (struct ccp_session *)
- get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ sess = (void *)op->sym->session->driver_priv_data;
} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- void *_sess;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess;
struct ccp_private *internals;
- if (rte_mempool_get(qp->sess_mp, &_sess))
- return NULL;
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+ if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- sess = (struct ccp_session *)_sess_private_data;
+ sess = (void *)_sess->driver_priv_data;
internals = (struct ccp_private *)qp->dev->data->dev_private;
if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
internals) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- ccp_cryptodev_driver_id,
- _sess_private_data);
+ op->sym->session = _sess;
}
return sess;
@@ -161,13 +151,10 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
for (i = 0; i < nb_dequeued; i++)
if (unlikely(ops[i]->sess_type ==
RTE_CRYPTO_OP_SESSIONLESS)) {
- struct ccp_session *sess = (struct ccp_session *)
- get_sym_session_private_data(
- ops[i]->sym->session,
- ccp_cryptodev_driver_id);
+ struct ccp_session *sess =
+ (void *)ops[i]->sym->session->driver_priv_data;
- rte_mempool_put(qp->sess_mp_priv,
- sess);
+ memset(sess, 0, sizeof(*sess));
rte_mempool_put(qp->sess_mp,
ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 586941cd70..f96e132513 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -22,24 +22,23 @@
static inline struct cnxk_se_sess *
cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn10k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
- if (ret)
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform,
+ sess);
+ if (ret) {
+ rte_mempool_put(qp->sess_mp, (void *)sess);
goto sess_put;
+ }
- priv = get_sym_session_private_data(sess, driver_id);
-
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
return priv;
@@ -111,8 +110,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
return 0;
w7 = sec_sess->sa.inst.w7;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- sess = get_sym_session_private_data(
- sym_op->session, cn10k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret))
@@ -128,8 +126,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret)) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
return 0;
}
@@ -296,8 +293,9 @@ cn10k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn10k_cryptodev_driver_id);
+ priv = (void *)(
+ ((struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -334,8 +332,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn10k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
} else {
@@ -543,7 +540,6 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
{
const uint8_t uc_compcode = res->uc_compcode;
const uint8_t compcode = res->compcode;
- unsigned int sz;
cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
@@ -620,11 +616,7 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index b753c1cb4b..a44f111ba6 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -56,23 +56,20 @@ cn9k_cpt_sec_inst_fill(struct rte_crypto_op *op,
static inline struct cnxk_se_sess *
cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn9k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform, sess);
if (ret)
goto sess_put;
- priv = get_sym_session_private_data(sess, driver_id);
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
@@ -95,8 +92,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
sym_op = op->sym;
- sess = get_sym_session_private_data(
- sym_op->session, cn9k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
inst->w7.u64 = sess->cpt_inst_w7;
} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
@@ -110,8 +106,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
if (unlikely(ret)) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
}
inst->w7.u64 = sess->cpt_inst_w7;
@@ -349,8 +344,9 @@ cn9k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn9k_cryptodev_driver_id);
+ priv = (void *)((
+ (struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -387,8 +383,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn9k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
} else {
@@ -583,8 +578,6 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
struct cpt_inflight_req *infl_req,
struct cpt_cn9k_res_s *res)
{
- unsigned int sz;
-
if (likely(res->compcode == CPT_COMP_GOOD)) {
if (unlikely(res->uc_compcode)) {
if (res->uc_compcode == ROC_SE_ERR_GC_ICV_MISCOMPARE)
@@ -645,11 +638,7 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index cf91b92c2c..018d7fcee8 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -406,7 +406,6 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = conf->mp_session;
- qp->sess_mp_priv = conf->mp_session_private;
dev->data->queue_pairs[qp_id] = qp;
return 0;
@@ -620,25 +619,15 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)
}
int
-sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
enum cpt_dp_thread_type thr_type;
- struct cnxk_se_sess *sess_priv;
- void *priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
int ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- plt_dp_err("Could not allocate session private data");
- return -ENOMEM;
- }
-
- memset(priv, 0, sizeof(struct cnxk_se_sess));
-
- sess_priv = priv;
-
+ memset(sess_priv, 0, sizeof(struct cnxk_se_sess));
ret = cnxk_sess_fill(roc_cpt, xform, sess_priv);
if (ret)
goto priv_put;
@@ -684,61 +673,39 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
}
sess_priv->cpt_inst_w7 = cnxk_cpt_inst_w7_get(sess_priv, roc_cpt);
-
- set_sym_session_private_data(sess, driver_id, sess_priv);
-
return 0;
priv_put:
- rte_mempool_put(pool, priv);
-
return ret;
}
int
cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
struct cnxk_cpt_vf *vf = dev->data->dev_private;
struct roc_cpt *roc_cpt = &vf->cpt;
- uint8_t driver_id;
- driver_id = dev->driver_id;
-
- return sym_session_configure(roc_cpt, driver_id, xform, sess, pool);
+ return sym_session_configure(roc_cpt, xform, sess);
}
void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
- struct cnxk_se_sess *sess_priv;
- struct rte_mempool *pool;
-
- if (priv == NULL)
- return;
-
- sess_priv = priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
- memset(priv, 0, cnxk_cpt_sym_session_get_size(NULL));
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
+ memset(sess_priv, 0, cnxk_cpt_sym_session_get_size(NULL));
}
void
-cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
+cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
unsigned int
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index ffe4ae19aa..ca90567620 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -78,8 +78,6 @@ struct cnxk_cpt_qp {
/**< Crypto adapter related info */
struct rte_mempool *sess_mp;
/**< Session mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session private data mempool */
};
int cnxk_cpt_dev_config(struct rte_cryptodev *dev,
@@ -104,18 +102,16 @@ unsigned int cnxk_cpt_sym_session_get_size(struct rte_cryptodev *dev);
int cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
-int sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+int sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
void cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess);
+ struct rte_cryptodev_sym_session *sess);
-void sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess);
+void sym_session_clear(struct rte_cryptodev_sym_session *sess);
unsigned int cnxk_ae_session_size_get(struct rte_cryptodev *dev __rte_unused);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 8444f1a795..5a38d53022 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1379,8 +1379,7 @@ build_sec_fd(struct rte_crypto_op *op,
dpaa2_sec_session *sess;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -1678,8 +1677,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
struct rte_crypto_sym_op *sym_op;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -3754,51 +3752,36 @@ dpaa2_sec_security_session_destroy(void *dev __rte_unused,
}
#endif
static int
-dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA2_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa2_sec_set_session_parameters(xform, sess_private_data);
if (ret != 0) {
DPAA2_SEC_ERR("Failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa2_sec_session *s = (dpaa2_sec_session *)sess_priv;
if (sess_priv) {
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(dpaa2_sec_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index e68a4875dd..795be3acc3 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -1012,8 +1012,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa2_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, cryptodev_driver_id);
+ sess = (void *)session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 05415dbf3b..0cc773fba6 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -670,10 +670,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
struct qm_sg_entry sg[2];
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa_sec_session *)
@@ -1927,10 +1924,8 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ ses = (void *)
+ op->sym->session->driver_priv_data;
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
@@ -2676,31 +2671,19 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
static int
dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
PMD_INIT_FUNC_TRACE();
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa_sec_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
DPAA_SEC_ERR("failed to configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
ret = dpaa_sec_prep_cdb(sess_private_data);
if (ret) {
DPAA_SEC_ERR("Unable to prepare sec cdb");
@@ -2714,7 +2697,6 @@ static inline void
free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
{
struct dpaa_sec_dev_private *qi = dev->data->dev_private;
- struct rte_mempool *sess_mp = rte_mempool_from_obj((void *)s);
uint8_t i;
for (i = 0; i < MAX_DPAA_CORES; i++) {
@@ -2724,7 +2706,6 @@ free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
s->qp[i] = NULL;
}
free_session_data(s);
- rte_mempool_put(sess_mp, (void *)s);
}
/** Clear the memory of session so it doesn't leave key material behind */
@@ -2733,14 +2714,10 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
- if (sess_priv) {
- free_session_memory(dev, s);
- set_sym_session_private_data(sess, index, NULL);
- }
+ free_session_memory(dev, s);
}
#ifdef RTE_LIB_SECURITY
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d081953e26..d2e4d9d787 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -1017,8 +1017,8 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)
+ session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 7e8396b4a3..90ce5bc965 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -264,7 +264,6 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
qp->pmd_type = internals->pmd_type;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
qp->ingress_queue = ipsec_mb_qp_create_processed_ops_ring(qp,
qp_conf->nb_descriptors, socket_id);
@@ -312,9 +311,8 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev)
int
ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess, struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
struct ipsec_mb_dev_private *internals = dev->data->dev_private;
struct ipsec_mb_internals *pmd_data =
&ipsec_mb_pmds[internals->pmd_type];
@@ -330,42 +328,22 @@ ipsec_mb_sym_session_configure(
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- IPSEC_MB_LOG(ERR, "Couldn't get object from session mempool");
- free_mb_mgr(mb_mgr);
- return -ENOMEM;
- }
-
- ret = (*pmd_data->session_configure)(mb_mgr, sess_private_data, xform);
+ ret = (*pmd_data->session_configure)(mb_mgr,
+ (void *)sess->driver_priv_data, xform);
if (ret != 0) {
IPSEC_MB_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
free_mb_mgr(mb_mgr);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
free_mb_mgr(mb_mgr);
return 0;
}
/** Clear the session memory */
void
-ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, ipsec_mb_sym_session_get_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+ipsec_mb_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index d074b33133..14f962ef28 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -136,8 +136,6 @@ struct ipsec_mb_qp {
struct rte_ring *ingress_queue;
/**< Ring for placing operations ready for processing */
struct rte_mempool *sess_mp;
- /**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
/**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
@@ -399,8 +397,7 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev);
int ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
/** Clear the memory of session so it does not leave key material behind */
void
@@ -411,50 +408,50 @@ ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
static __rte_always_inline void *
ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
{
- void *sess = NULL;
+ struct rte_cryptodev_sym_session *sess = NULL;
uint32_t driver_id = ipsec_mb_get_driver_id(qp->pmd_type);
struct rte_crypto_sym_op *sym_op = op->sym;
uint8_t sess_type = op->sess_type;
void *_sess;
- void *_sess_private_data = NULL;
struct ipsec_mb_internals *pmd_data = &ipsec_mb_pmds[qp->pmd_type];
switch (sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
if (likely(sym_op->session != NULL))
- sess = get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
+ else
+ goto error_exit;
break;
case RTE_CRYPTO_OP_SESSIONLESS:
if (!qp->sess_mp ||
rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (!qp->sess_mp_priv ||
- rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
+ sess = _sess;
+ if (sess->sess_data_sz < pmd_data->session_priv_size) {
+ rte_mempool_put(qp->sess_mp, _sess);
+ goto error_exit;
+ }
- sess = _sess_private_data;
if (unlikely(pmd_data->session_configure(qp->mb_mgr,
- sess, sym_op->xform) != 0)) {
+ (void *)sess->driver_priv_data, sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
- sess = NULL;
+ goto error_exit;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sess->driver_id = driver_id;
+ sym_op->session = sess;
+
break;
default:
IPSEC_MB_LOG(ERR, "Unrecognized session type %u", sess_type);
}
- if (unlikely(sess == NULL))
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return (void *)sess->driver_priv_data;
- return sess;
+error_exit:
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return NULL;
}
#endif /* _IPSEC_MB_PRIVATE_H_ */
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
index 2c033c6f28..e4f274b608 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
@@ -241,10 +241,6 @@ handle_completed_gcm_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_gcm_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -455,44 +451,35 @@ static inline struct aesni_gcm_session *
aesni_gcm_get_session(struct ipsec_mb_qp *qp,
struct rte_crypto_op *op)
{
- struct aesni_gcm_session *sess = NULL;
- uint32_t driver_id =
- ipsec_mb_get_driver_id(IPSEC_MB_PMD_TYPE_AESNI_GCM);
+ struct rte_cryptodev_sym_session *sess = NULL;
struct rte_crypto_sym_op *sym_op = op->sym;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
- sess = (struct aesni_gcm_session *)
- get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
} else {
- void *_sess;
- void *_sess_private_data = NULL;
-
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
+ if (unlikely(sess->sess_data_sz <
+ sizeof(struct aesni_gcm_session))) {
+ rte_mempool_put(qp->sess_mp, sess);
return NULL;
-
- sess = (struct aesni_gcm_session *)_sess_private_data;
+ }
if (unlikely(aesni_gcm_session_configure(qp->mb_mgr,
- _sess_private_data, sym_op->xform) != 0)) {
- rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
+ (void *)sess->driver_priv_data,
+ sym_op->xform) != 0)) {
+ rte_mempool_put(qp->sess_mp, sess);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sym_op->session = sess;
}
if (unlikely(sess == NULL))
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return sess;
+ return (void *)sess->driver_priv_data;
}
static uint16_t
@@ -712,22 +699,15 @@ aesni_gmac_sgl_verify(struct aesni_gcm_session *s,
/** Process CPU crypto bulk operations */
static uint32_t
-aesni_gcm_process_bulk(struct rte_cryptodev *dev,
+aesni_gcm_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess,
__rte_unused union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
- struct aesni_gcm_session *s;
+ struct aesni_gcm_session *s = (void *)sess->driver_priv_data;
struct gcm_context_data gdata_ctx;
IMB_MGR *mb_mgr;
- s = (struct aesni_gcm_session *) get_sym_session_private_data(sess,
- dev->driver_id);
- if (unlikely(s == NULL)) {
- aesni_gcm_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 6d5d3ce8eb..f3565b04b5 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1710,8 +1710,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
{
struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data;
struct aesni_mb_session *sess = NULL;
- uint32_t driver_id = ipsec_mb_get_driver_id(
- IPSEC_MB_PMD_TYPE_AESNI_MB);
#ifdef AESNI_MB_DOCSIS_SEC_ENABLED
uint8_t is_docsis_sec = 0;
@@ -1725,15 +1723,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
sess = get_sec_session_private_data(op->sym->sec_session);
} else
#endif
- {
- sess = get_sym_session_private_data(op->sym->session,
- driver_id);
- }
-
- if (unlikely(sess == NULL)) {
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return op;
- }
+ sess = (void *)op->sym->session->driver_priv_data;
if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
switch (job->status) {
@@ -1771,10 +1761,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_mb_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -1962,16 +1948,6 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
return processed_jobs;
}
-
-static inline void
-ipsec_mb_fill_error_code(struct rte_crypto_sym_vec *vec, int32_t err)
-{
- uint32_t i;
-
- for (i = 0; i != vec->num; ++i)
- vec->status[i] = err;
-}
-
static inline int
check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl)
{
@@ -2028,7 +2004,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec,
}
static uint32_t
-aesni_mb_process_bulk(struct rte_cryptodev *dev,
+aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
struct rte_crypto_sym_vec *vec)
{
@@ -2037,15 +2013,9 @@ aesni_mb_process_bulk(struct rte_cryptodev *dev,
void *buf;
IMB_JOB *job;
IMB_MGR *mb_mgr;
- struct aesni_mb_session *s;
+ struct aesni_mb_session *s = (void *)sess->driver_priv_data;
uint8_t tmp_dgst[vec->num][DIGEST_LENGTH_MAX];
- s = get_sym_session_private_data(sess, dev->driver_id);
- if (s == NULL) {
- ipsec_mb_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
index d953d6e5f5..97e7cef233 100644
--- a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
+++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
@@ -290,10 +290,6 @@ handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct chacha20_poly1305_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index c9d4f9d0ae..b2fb168154 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -231,11 +231,6 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct kasumi_session));
- memset(
- ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -287,8 +282,9 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct kasumi_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct kasumi_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
return processed_op;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index 9a85f46721..f052d6d847 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -362,10 +362,6 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct snow3g_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -417,8 +413,9 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct snow3g_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct snow3g_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c b/drivers/crypto/ipsec_mb/pmd_zuc.c
index e36c7092d6..92fd9d1808 100644
--- a/drivers/crypto/ipsec_mb/pmd_zuc.c
+++ b/drivers/crypto/ipsec_mb/pmd_zuc.c
@@ -239,10 +239,6 @@ process_ops(struct rte_crypto_op **ops, enum ipsec_mb_operation op_type,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sessions[i], 0, sizeof(struct zuc_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sessions[i]);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index eb7616257e..46ea507cf5 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -171,14 +171,13 @@ mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *session)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *sess_private_data;
+ struct mlx5_crypto_session *sess_private_data =
+ (void *)session->driver_priv_data;
struct rte_crypto_cipher_xform *cipher;
uint8_t encryption_order;
- int ret;
if (unlikely(xform->next != NULL)) {
DRV_LOG(ERR, "Xform next is not supported.");
@@ -189,17 +188,9 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
DRV_LOG(ERR, "Only AES-XTS algorithm is supported.");
return -ENOTSUP;
}
- ret = rte_mempool_get(mp, (void *)&sess_private_data);
- if (ret != 0) {
- DRV_LOG(ERR,
- "Failed to get session %p private data from mempool.",
- sess_private_data);
- return -ENOMEM;
- }
cipher = &xform->cipher;
sess_private_data->dek = mlx5_crypto_dek_prepare(priv, cipher);
if (sess_private_data->dek == NULL) {
- rte_mempool_put(mp, sess_private_data);
DRV_LOG(ERR, "Failed to prepare dek.");
return -ENOMEM;
}
@@ -239,8 +230,6 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
sess_private_data->dek_id =
rte_cpu_to_be_32(sess_private_data->dek->obj->id &
0xffffff);
- set_sym_session_private_data(session, dev->driver_id,
- sess_private_data);
DRV_LOG(DEBUG, "Session %p was configured.", sess_private_data);
return 0;
}
@@ -250,16 +239,13 @@ mlx5_crypto_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *spriv = get_sym_session_private_data(sess,
- dev->driver_id);
+ struct mlx5_crypto_session *spriv = (void *)sess->driver_priv_data;
if (unlikely(spriv == NULL)) {
DRV_LOG(ERR, "Failed to get session %p private data.", spriv);
return;
}
mlx5_crypto_dek_destroy(priv, spriv->dek);
- set_sym_session_private_data(sess, dev->driver_id, NULL);
- rte_mempool_put(rte_mempool_from_obj(spriv), spriv);
DRV_LOG(DEBUG, "Session %p was cleared.", spriv);
}
@@ -369,8 +355,8 @@ mlx5_crypto_wqe_set(struct mlx5_crypto_priv *priv,
struct rte_crypto_op *op,
struct mlx5_umr_wqe *umr)
{
- struct mlx5_crypto_session *sess = get_sym_session_private_data
- (op->sym->session, mlx5_crypto_driver_id);
+ struct mlx5_crypto_session *sess =
+ (void *)op->sym->session->driver_priv_data;
struct mlx5_wqe_cseg *cseg = &umr->ctr;
struct mlx5_wqe_mkey_cseg *mkc = &umr->mkc;
struct mlx5_wqe_dseg *klms = &umr->kseg[0];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 04efd9aaa8..0fede43817 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -597,13 +597,7 @@ mrvl_request_prepare_crp(struct sam_cio_op_params *request,
return -EINVAL;
}
- sess = (struct mrvl_crypto_session *)get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
- if (unlikely(sess == NULL)) {
- MRVL_LOG(ERR, "Session was not created for this device!");
- return -EINVAL;
- }
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
request->sa = sess->sam_sess;
request->cookie = op;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index f828dc9db5..0066236561 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -736,8 +736,7 @@ mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
static int
mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
struct mrvl_crypto_session *mrvl_sess;
void *sess_private_data;
@@ -748,23 +747,15 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- CDEV_LOG_ERR("Couldn't get object from session mempool.");
- return -ENOMEM;
- }
-
+ sess_private_data = sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session));
ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
MRVL_LOG(ERR, "Failed to configure session parameters!");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
mrvl_sess = (struct mrvl_crypto_session *)sess_private_data;
if (sam_session_create(&mrvl_sess->sam_sess_params,
@@ -791,8 +782,7 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = sess->data;
/* Zero out the whole structure */
if (sess_priv) {
@@ -803,11 +793,6 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
sam_session_destroy(mrvl_sess->sam_sess) < 0) {
MRVL_LOG(ERR, "Error while destroying session!");
}
-
- memset(mrvl_sess, 0, sizeof(struct mrvl_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index cb5393d2f1..505024a810 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -530,24 +530,16 @@ configure_aead_ctx(struct rte_crypto_aead_xform *xform,
}
static int
-nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
+nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *mp_obj;
- struct nitrox_crypto_ctx *ctx;
+ struct nitrox_crypto_ctx *ctx = (void *)sess->driver_priv_data;
struct rte_crypto_cipher_xform *cipher_xform = NULL;
struct rte_crypto_auth_xform *auth_xform = NULL;
struct rte_crypto_aead_xform *aead_xform = NULL;
int ret = -EINVAL;
- if (rte_mempool_get(mempool, &mp_obj)) {
- NITROX_LOG(ERR, "Couldn't allocate context\n");
- return -ENOMEM;
- }
-
- ctx = mp_obj;
ctx->nitrox_chain = get_crypto_chain_order(xform);
switch (ctx->nitrox_chain) {
case NITROX_CHAIN_CIPHER_ONLY:
@@ -585,38 +577,23 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
goto err;
}
- ctx->iova = rte_mempool_virt2iova(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, ctx);
+ ctx->iova = sess->driver_priv_data_iova;
return 0;
err:
- rte_mempool_put(mempool, mp_obj);
return ret;
}
static void
-nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct nitrox_crypto_ctx *ctx = get_sym_session_private_data(sess,
- cdev->driver_id);
- struct rte_mempool *sess_mp;
-
- if (!ctx)
- return;
-
- memset(ctx, 0, sizeof(*ctx));
- sess_mp = rte_mempool_from_obj(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, NULL);
- rte_mempool_put(sess_mp, ctx);
-}
+nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct nitrox_crypto_ctx *
get_crypto_ctx(struct rte_crypto_op *op)
{
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(op->sym->session))
- return get_sym_session_private_data(op->sym->session,
- nitrox_sym_drv_id);
+ return (void *)op->sym->session->driver_priv_data;
}
return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 9ecb434fd0..09aac3065e 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -58,7 +58,7 @@ process_op(const struct null_crypto_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(op->sym->session, 0,
sizeof(struct null_crypto_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
@@ -78,30 +78,21 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
sess = (struct null_crypto_session *)
- get_sym_session_private_data(
- sym_op->session, cryptodev_driver_id);
+ sym_op->session->driver_priv_data;
} else {
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct null_crypto_session *)_sess_private_data;
+ sess = (struct null_crypto_session *)_sess->driver_priv_data;
if (unlikely(null_crypto_set_session_parameters(sess,
sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+ sym_op->session = _sess;
}
return sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 90a675dfff..fb43d3f7b5 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -233,7 +233,6 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
@@ -256,8 +255,7 @@ null_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -267,43 +265,22 @@ null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- NULL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = null_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
NULL_LOG(ERR, "failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct null_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops pmd_ops = {
.dev_configure = null_crypto_pmd_config,
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index 89c4345b6f..ae34ce6671 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,8 +31,6 @@ struct null_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Mempool */
struct rte_cryptodev_stats qp_stats;
/**< Queue pair statistics */
} __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
index e48805fb09..4647d568de 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
+++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
@@ -49,7 +49,6 @@ struct cpt_instance {
uint32_t queue_id;
uintptr_t rsvd;
struct rte_mempool *sess_mp;
- struct rte_mempool *sess_mp_priv;
struct cpt_qp_meta_info meta_info;
uint8_t ca_enabled;
};
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 7aee67ab09..cd5ebc2af6 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -171,7 +171,6 @@ otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
instance->queue_id = que_pair_id;
instance->sess_mp = qp_conf->mp_session;
- instance->sess_mp_priv = qp_conf->mp_session_private;
dev->data->queue_pairs[que_pair_id] = instance;
return 0;
@@ -243,25 +242,19 @@ sym_xform_verify(struct rte_crypto_sym_xform *xform)
}
static int
-sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+sym_session_configure(struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_crypto_sym_xform *temp_xform = xform;
struct cpt_sess_misc *misc;
vq_cmd_word3_t vq_cmd_w3;
- void *priv;
+ void *priv = (void *)sess->driver_priv_data;
int ret;
ret = sym_xform_verify(xform);
if (unlikely(ret))
return ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- CPT_LOG_ERR("Could not allocate session private data");
- return -ENOMEM;
- }
-
memset(priv, 0, sizeof(struct cpt_sess_misc) +
offsetof(struct cpt_ctx, mc_ctx));
@@ -301,9 +294,7 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
goto priv_put;
}
- set_sym_session_private_data(sess, driver_id, priv);
-
- misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
+ misc->ctx_dma_addr = sess->driver_priv_data_iova +
sizeof(struct cpt_sess_misc);
vq_cmd_w3.u64 = 0;
@@ -316,17 +307,14 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
return 0;
priv_put:
- if (priv)
- rte_mempool_put(pool, priv);
return -ENOTSUP;
}
static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
+ void *priv = (void *)sess->driver_priv_data;
struct cpt_sess_misc *misc;
- struct rte_mempool *pool;
struct cpt_ctx *ctx;
if (priv == NULL)
@@ -336,35 +324,26 @@ sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
ctx = SESS_PRIV(misc);
rte_free(ctx->auth_key);
-
- memset(priv, 0, cpt_get_session_size());
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
}
static int
-otx_cpt_session_cfg(struct rte_cryptodev *dev,
+otx_cpt_session_cfg(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_configure(dev->driver_id, xform, sess, pool);
+ return sym_session_configure(xform, sess);
}
static void
-otx_cpt_session_clear(struct rte_cryptodev *dev,
+otx_cpt_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
static unsigned int
@@ -528,10 +507,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance,
void *req;
uint64_t cpt_op;
- sess = (struct cpt_sess_misc *)
- get_sym_session_private_data(sym_op->session,
- otx_cryptodev_driver_id);
-
+ sess = (struct cpt_sess_misc *)sym_op->session->driver_priv_data;
cpt_op = sess->cpt_op;
if (likely(cpt_op & CPT_OP_CIPHER_MASK))
@@ -560,21 +536,18 @@ static __rte_always_inline void * __rte_hot
otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
struct rte_crypto_op *op)
{
- const int driver_id = otx_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
void *req;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(instance->sess_mp);
- if (sess == NULL) {
+ if (rte_mempool_get(instance->sess_mp, (void **)&sess) < 0) {
rte_errno = ENOMEM;
return NULL;
}
- ret = sym_session_configure(driver_id, sym_op->xform, sess,
- instance->sess_mp_priv);
+ ret = sym_session_configure(sym_op->xform, sess);
if (ret)
goto sess_put;
@@ -583,12 +556,10 @@ otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
/* Enqueue op with the tmp session set */
req = otx_cpt_enq_single_sym(instance, op);
if (unlikely(req == NULL))
- goto priv_put;
+ goto sess_put;
return req;
-priv_put:
- sym_session_clear(driver_id, sess);
sess_put:
rte_mempool_put(instance->sess_mp, sess);
return NULL;
@@ -873,13 +844,9 @@ static inline void
free_sym_session_data(const struct cpt_instance *instance,
struct rte_crypto_op *cop)
{
- void *sess_private_data_t = get_sym_session_private_data(
- cop->sym->session, otx_cryptodev_driver_id);
+ void *sess_private_data_t = (void *)cop->sym->session->driver_priv_data;
+
memset(sess_private_data_t, 0, cpt_get_session_size());
- memset(cop->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session));
- rte_mempool_put(instance->sess_mp_priv, sess_private_data_t);
rte_mempool_put(instance->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/openssl_pmd_private.h b/drivers/crypto/openssl/openssl_pmd_private.h
index c34fd9a546..ed6841e460 100644
--- a/drivers/crypto/openssl/openssl_pmd_private.h
+++ b/drivers/crypto/openssl/openssl_pmd_private.h
@@ -70,8 +70,6 @@ struct openssl_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index a078038651..0bb536c9e3 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -887,10 +887,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
/* get existing session */
if (likely(op->sym->session != NULL))
- sess = (struct openssl_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = (void *)
+ op->sym->session->driver_priv_data;
} else {
if (likely(op->asym->session != NULL))
asym_sess = (struct openssl_asym_session *)
@@ -901,32 +899,26 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
return asym_sess;
}
} else {
+ struct rte_cryptodev_sym_session *_sess;
/* sessionless asymmetric not supported */
if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC)
return NULL;
/* provide internal session */
- void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- void *_sess_private_data = NULL;
+ rte_mempool_get(qp->sess_mp, (void **)&_sess);
if (_sess == NULL)
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct openssl_session *)_sess_private_data;
+ sess = (struct openssl_session *)_sess->driver_priv_data;
if (unlikely(openssl_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+
}
if (sess == NULL)
@@ -2900,10 +2892,6 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
openssl_reset_session(sess);
memset(sess, 0, sizeof(struct openssl_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index f7ddbf9c73..2a3662ee5a 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -764,7 +764,6 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -794,10 +793,9 @@ openssl_pmd_asym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
if (unlikely(sess == NULL)) {
@@ -805,24 +803,14 @@ openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- OPENSSL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = openssl_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
OPENSSL_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
@@ -1328,20 +1316,13 @@ openssl_pmd_asym_session_configure(struct rte_cryptodev *dev __rte_unused,
/** Clear the memory of session so it doesn't leave key material behind */
static void
-openssl_pmd_sym_session_clear(struct rte_cryptodev *dev,
+openssl_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
/* Zero out the whole structure */
- if (sess_priv) {
- openssl_reset_session(sess_priv);
- memset(sess_priv, 0, sizeof(struct openssl_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ openssl_reset_session(sess_priv);
}
static void openssl_reset_asym_session(struct openssl_asym_session *sess)
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index db6316fbe9..408ae9e42b 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -67,12 +67,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
return -EINVAL;
if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) {
- ctx = get_sym_session_private_data(op->sym->session,
- qat_sym_driver_id);
- if (unlikely(!ctx)) {
- QAT_DP_LOG(ERR, "No session for this device");
- return -EINVAL;
- }
+ ctx = (void *)op->sym->session->driver_priv_data;
if (sess != (uintptr_t)ctx) {
struct rte_cryptodev *cdev;
struct qat_cryptodev_private *internals;
@@ -391,8 +386,7 @@ qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
return -EINVAL;
- ctx = (struct qat_sym_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, qat_sym_driver_id);
+ ctx = (void *)session_ctx.crypto_sess->driver_priv_data;
dp_ctx->session = ctx;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 074612c11b..2853ac5b88 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -317,9 +317,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
#endif
{
sess = (struct qat_sym_session *)
- get_sym_session_private_data(
- rx_op->sym->session,
- qat_sym_driver_id);
+ rx_op->sym->session->driver_priv_data;
is_docsis_sec = 0;
}
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 52b3455cf0..8dd2357702 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -219,22 +219,13 @@ qat_is_auth_alg_supported(enum rte_crypto_auth_algorithm algo,
}
void
-qat_sym_session_clear(struct rte_cryptodev *dev,
+qat_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
- struct qat_sym_session *s = (struct qat_sym_session *)sess_priv;
+ struct qat_sym_session *s = (void *)sess->driver_priv_data;
- if (sess_priv) {
- if (s->bpi_ctx)
- bpi_cipher_ctx_free(s->bpi_ctx);
- memset(s, 0, qat_sym_session_get_private_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ if (s->bpi_ctx)
+ bpi_cipher_ctx_free(s->bpi_ctx);
}
static int
@@ -505,35 +496,24 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
if (ossl_legacy_provider_load())
return -EINVAL;
#endif
- ret = qat_sym_session_set_parameters(dev, xform, sess_private_data);
+ ret = qat_sym_session_set_parameters(dev, xform,
+ (void *)sess->driver_priv_data,
+ sess->driver_priv_data_iova);
if (ret != 0) {
QAT_LOG(ERR,
"Crypto QAT PMD: failed to configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ossl_legacy_provider_unload();
# endif
@@ -542,7 +522,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev,
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private)
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_paddr)
{
struct qat_sym_session *session = session_private;
struct qat_cryptodev_private *internals = dev->data->dev_private;
@@ -551,7 +532,6 @@ qat_sym_session_set_parameters(struct rte_cryptodev *dev,
int qat_cmd_id;
/* Verify the session physical address is known */
- rte_iova_t session_paddr = rte_mempool_virt2iova(session);
if (session_paddr == 0 || session_paddr == RTE_BAD_IOVA) {
QAT_LOG(ERR,
"Session physical address unknown. Bad memory pool.");
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index 01908abd9e..9e4aab06a6 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -123,12 +123,12 @@ struct qat_sym_session {
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private);
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_private_iova);
int
qat_sym_session_configure_aead(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index f3a1bd626c..b93821783b 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -468,44 +468,18 @@ scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
}
static int
-scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+ struct rte_crypto_sym_xform *xform __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
- int ret;
-
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- ret = rte_cryptodev_sym_session_init(worker->dev_id, sess,
- xform, mempool);
- if (ret < 0) {
- CR_SCHED_LOG(ERR, "unable to config sym session");
- return ret;
- }
- }
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
-
- /* Clear private data of workers */
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- rte_cryptodev_sym_session_clear(worker->dev_id, sess);
- }
-}
+scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops scheduler_pmd_ops = {
.dev_configure = scheduler_pmd_config,
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index ed64866758..6b9e57ee66 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -40,8 +40,7 @@ static void virtio_crypto_sym_clear_session(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
/*
* The set of PCI devices this driver supports
@@ -952,12 +951,7 @@ virtio_crypto_sym_clear_session(
hw = dev->data->dev_private;
vq = hw->cvq;
- session = (struct virtio_crypto_session *)get_sym_session_private_data(
- sess, cryptodev_virtio_driver_id);
- if (session == NULL) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid session parameter");
- return;
- }
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
VIRTIO_CRYPTO_SESSION_LOG_INFO("vq->vq_desc_head_idx = %d, "
"vq = %p", vq->vq_desc_head_idx, vq);
@@ -1070,10 +1064,6 @@ virtio_crypto_sym_clear_session(
VIRTIO_CRYPTO_SESSION_LOG_INFO("Close session %"PRIu64" successfully ",
session->session_id);
- memset(session, 0, sizeof(struct virtio_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(session);
- set_sym_session_private_data(sess, cryptodev_virtio_driver_id, NULL);
- rte_mempool_put(sess_mp, session);
rte_free(malloc_virt_addr);
}
@@ -1292,11 +1282,9 @@ static int
virtio_crypto_check_sym_configure_session_paras(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sym_sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sym_sess)
{
- if (unlikely(xform == NULL) || unlikely(sym_sess == NULL) ||
- unlikely(mempool == NULL)) {
+ if (unlikely(xform == NULL) || unlikely(sym_sess == NULL)) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("NULL pointer");
return -1;
}
@@ -1311,12 +1299,9 @@ static int
virtio_crypto_sym_configure_session(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
- struct virtio_crypto_session crypto_sess;
- void *session_private = &crypto_sess;
struct virtio_crypto_session *session;
struct virtio_crypto_op_ctrl_req *ctrl_req;
enum virtio_crypto_cmd_id cmd_id;
@@ -1328,19 +1313,12 @@ virtio_crypto_sym_configure_session(
PMD_INIT_FUNC_TRACE();
ret = virtio_crypto_check_sym_configure_session_paras(dev, xform,
- sess, mempool);
+ sess);
if (ret < 0) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid parameters");
return ret;
}
-
- if (rte_mempool_get(mempool, &session_private)) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
- session = (struct virtio_crypto_session *)session_private;
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
memset(session, 0, sizeof(struct virtio_crypto_session));
ctrl_req = &session->ctrl;
ctrl_req->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
@@ -1402,10 +1380,6 @@ virtio_crypto_sym_configure_session(
"Unsupported operation chain order parameter");
goto error_out;
}
-
- set_sym_session_private_data(sess, dev->driver_id,
- session_private);
-
return 0;
error_out:
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index 08359b3a39..b7f492a7f2 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -207,8 +207,7 @@ virtqueue_crypto_sym_enqueue_xmit(
offsetof(struct virtio_crypto_op_cookie, iv);
struct rte_crypto_sym_op *sym_op = cop->sym;
struct virtio_crypto_session *session =
- (struct virtio_crypto_session *)get_sym_session_private_data(
- cop->sym->session, cryptodev_virtio_driver_id);
+ (void *)cop->sym->session->driver_priv_data;
struct virtio_crypto_op_data_req *op_data_req;
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c
index 19af134bbe..bce903e007 100644
--- a/examples/fips_validation/fips_dev_self_test.c
+++ b/examples/fips_validation/fips_dev_self_test.c
@@ -969,7 +969,6 @@ struct fips_dev_auto_test_env {
struct rte_mempool *mpool;
struct rte_mempool *op_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mbuf *mbuf;
struct rte_crypto_op *op;
};
@@ -1479,13 +1478,8 @@ run_single_test(uint8_t dev_id,
return ret;
}
- sess = rte_cryptodev_sym_session_create(env->sess_pool);
- if (!sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(dev_id,
- sess, &xform, env->sess_priv_pool);
- if (ret < 0) {
+ sess = rte_cryptodev_sym_session_create(dev_id, &xform, env->sess_pool);
+ if (!sess) {
RTE_LOG(ERR, PMD, "Error %i: Init session\n", ret);
return ret;
}
@@ -1508,8 +1502,7 @@ run_single_test(uint8_t dev_id,
1);
} while (n_deqd == 0);
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(dev_id, sess);
if (env->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
return -1;
@@ -1527,7 +1520,6 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
rte_mempool_free(env->mpool);
rte_mempool_free(env->op_pool);
rte_mempool_free(env->sess_pool);
- rte_mempool_free(env->sess_priv_pool);
rte_cryptodev_stop(dev_id);
}
@@ -1535,7 +1527,7 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
static int
fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
{
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
struct rte_cryptodev_config conf;
char name[128];
@@ -1579,25 +1571,13 @@ fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
snprintf(name, 128, "%s%u", "SELF_TEST_SESS_POOL", dev_id);
env->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- 128, 0, 0, 0, rte_cryptodev_socket_id(dev_id));
+ 128, sess_sz, 0, 0, rte_cryptodev_socket_id(dev_id));
if (!env->sess_pool) {
ret = -ENOMEM;
goto error_exit;
}
- memset(name, 0, 128);
- snprintf(name, 128, "%s%u", "SELF_TEST_SESS_PRIV_POOL", dev_id);
-
- env->sess_priv_pool = rte_mempool_create(name,
- 128, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_cryptodev_socket_id(dev_id), 0);
- if (!env->sess_priv_pool) {
- ret = -ENOMEM;
- goto error_exit;
- }
-
qp_conf.mp_session = env->sess_pool;
- qp_conf.mp_session_private = env->sess_priv_pool;
ret = rte_cryptodev_queue_pair_setup(dev_id, 0, &qp_conf,
rte_cryptodev_socket_id(dev_id));
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e6c0b6a3a1..e73e6b09c3 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -55,7 +55,6 @@ struct cryptodev_fips_validate_env {
uint16_t mbuf_data_room;
struct rte_mempool *mpool;
struct rte_mempool *sess_mpool;
- struct rte_mempool *sess_priv_mpool;
struct rte_mempool *op_pool;
struct rte_mbuf *mbuf;
uint8_t *digest;
@@ -70,7 +69,7 @@ static int
cryptodev_fips_validate_app_int(void)
{
struct rte_cryptodev_config conf = {rte_socket_id(), 1, 0};
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
struct rte_cryptodev_info dev_info;
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
env.dev_id);
@@ -110,16 +109,11 @@ cryptodev_fips_validate_app_int(void)
ret = -ENOMEM;
env.sess_mpool = rte_cryptodev_sym_session_pool_create(
- "FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+ "FIPS_SESS_MEMPOOL", 16, sess_sz, 0, 0,
+ rte_socket_id());
if (!env.sess_mpool)
goto error_exit;
- env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
- 16, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_socket_id(), 0);
- if (!env.sess_priv_mpool)
- goto error_exit;
-
env.op_pool = rte_crypto_op_pool_create(
"FIPS_OP_POOL",
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -134,7 +128,6 @@ cryptodev_fips_validate_app_int(void)
goto error_exit;
qp_conf.mp_session = env.sess_mpool;
- qp_conf.mp_session_private = env.sess_priv_mpool;
ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
rte_socket_id());
@@ -151,7 +144,6 @@ cryptodev_fips_validate_app_int(void)
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
return ret;
@@ -162,11 +154,9 @@ cryptodev_fips_validate_app_uninit(void)
{
rte_pktmbuf_free(env.mbuf);
rte_crypto_op_free(env.op);
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
}
@@ -1202,13 +1192,9 @@ fips_run_test(void)
if (ret < 0)
return ret;
- env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
- if (!env.sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(env.dev_id,
- env.sess, &xform, env.sess_priv_mpool);
- if (ret < 0) {
+ env.sess = rte_cryptodev_sym_session_create(env.dev_id, &xform,
+ env.sess_mpool);
+ if (!env.sess) {
RTE_LOG(ERR, USER1, "Error %i: Init session\n",
ret);
goto exit;
@@ -1237,9 +1223,10 @@ fips_run_test(void)
vec.status = env.op->status;
exit:
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
- env.sess = NULL;
+ if (env.sess) {
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
+ env.sess = NULL;
+ }
return ret;
}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 8a25b83535..ce4b4ba806 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1693,8 +1693,6 @@ cryptodevs_init(uint16_t req_queue_num)
qp_conf.nb_descriptors = qp_desc_nb;
qp_conf.mp_session =
socket_ctx[dev_conf.socket_id].session_pool;
- qp_conf.mp_session_private =
- socket_ctx[dev_conf.socket_id].session_priv_pool;
for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
&qp_conf, dev_conf.socket_id))
@@ -2523,12 +2521,8 @@ one_session_free(struct rte_ipsec_session *ips)
if (ips->crypto.ses == NULL)
return 0;
- ret = rte_cryptodev_sym_session_clear(ips->crypto.dev_id,
- ips->crypto.ses);
- if (ret)
- return ret;
-
- ret = rte_cryptodev_sym_session_free(ips->crypto.ses);
+ ret = rte_cryptodev_sym_session_free(ips->crypto.dev_id,
+ ips->crypto.ses);
} else {
/* Session has not been created */
if (ips->security.ctx == NULL || ips->security.ses == NULL)
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 7b7bfff696..bb84dcec7e 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -174,11 +174,8 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[],
}
ips->crypto.dev_id = cdev_id;
- ips->crypto.ses = rte_cryptodev_sym_session_create(
- skt_ctx->session_pool);
- rte_cryptodev_sym_session_init(cdev_id,
- ips->crypto.ses, sa->xforms,
- skt_ctx->session_priv_pool);
+ ips->crypto.ses = rte_cryptodev_sym_session_create(cdev_id,
+ sa->xforms, skt_ctx->session_pool);
rte_cryptodev_info_get(cdev_id, &cdev_info);
}
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index bf4b862379..b555e63ff6 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -228,7 +228,6 @@ struct rte_mempool *l2fwd_pktmbuf_pool;
struct rte_mempool *l2fwd_crypto_op_pool;
static struct {
struct rte_mempool *sess_mp;
- struct rte_mempool *priv_mp;
} session_pool_socket[RTE_MAX_NUMA_NODES];
/* Per-port statistics struct */
@@ -675,7 +674,6 @@ static struct rte_cryptodev_sym_session *
initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
{
struct rte_crypto_sym_xform *first_xform;
- struct rte_cryptodev_sym_session *session;
int retval = rte_cryptodev_socket_id(cdev_id);
if (retval < 0)
@@ -697,17 +695,8 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
first_xform = &options->auth_xform;
}
- session = rte_cryptodev_sym_session_create(
+ return rte_cryptodev_sym_session_create(cdev_id, first_xform,
session_pool_socket[socket_id].sess_mp);
- if (session == NULL)
- return NULL;
-
- if (rte_cryptodev_sym_session_init(cdev_id, session,
- first_xform,
- session_pool_socket[socket_id].priv_mp) < 0)
- return NULL;
-
- return session;
}
/* >8 End of creation of session. */
@@ -2380,13 +2369,10 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
rte_cryptodev_info_get(cdev_id, &dev_info);
- /*
- * Two sessions objects are required for each session
- * (one for the header, one for the private data)
- */
if (!strcmp(dev_info.driver_name, "crypto_scheduler")) {
#ifdef RTE_CRYPTO_SCHEDULER
- uint32_t nb_workers =
+ /* scheduler session header + 1 session per worker */
+ uint32_t nb_workers = 1 +
rte_cryptodev_scheduler_workers_get(cdev_id,
NULL);
@@ -2395,41 +2381,15 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
} else
sessions_needed = enabled_cdev_count;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- char mp_name[RTE_MEMPOOL_NAMESIZE];
-
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- session_pool_socket[socket_id].priv_mp =
- rte_mempool_create(mp_name,
- sessions_needed,
- max_sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- printf("Cannot create pool on socket %d\n",
- socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
char mp_name[RTE_MEMPOOL_NAMESIZE];
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
session_pool_socket[socket_id].sess_mp =
- rte_cryptodev_sym_session_pool_create(
- mp_name,
- sessions_needed,
- 0, 0, 0, socket_id);
-
+ rte_cryptodev_sym_session_pool_create(
+ mp_name, sessions_needed, max_sess_sz,
+ 0, 0, socket_id);
if (session_pool_socket[socket_id].sess_mp == NULL) {
printf("Cannot create pool on socket %d\n",
socket_id);
@@ -2580,8 +2540,6 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
qp_conf.nb_descriptors = 2048;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 7d75623a5e..02987ebd76 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,7 +46,6 @@ struct vhost_crypto_info {
int vids[MAX_NB_SOCKETS];
uint32_t nb_vids;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *cop_pool;
uint8_t cid;
uint32_t qid;
@@ -304,7 +303,6 @@ new_device(int vid)
}
ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
- info->sess_priv_pool,
rte_lcore_to_socket_id(options.los[i].lcore_id));
if (ret) {
RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -458,7 +456,6 @@ free_resource(void)
rte_mempool_free(info->cop_pool);
rte_mempool_free(info->sess_pool);
- rte_mempool_free(info->sess_priv_pool);
for (j = 0; j < lo->nb_sockets; j++) {
rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -544,16 +541,12 @@ main(int argc, char *argv[])
snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- SESSION_MAP_ENTRIES, 0, 0, 0,
- rte_lcore_to_socket_id(lo->lcore_id));
-
- snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
- info->sess_priv_pool = rte_mempool_create(name,
SESSION_MAP_ENTRIES,
rte_cryptodev_sym_get_private_session_size(
- info->cid), 64, 0, NULL, NULL, NULL, NULL,
- rte_lcore_to_socket_id(lo->lcore_id), 0);
- if (!info->sess_priv_pool || !info->sess_pool) {
+ info->cid), 0, 0,
+ rte_lcore_to_socket_id(lo->lcore_id));
+
+ if (!info->sess_pool) {
RTE_LOG(ERR, USER1, "Failed to create mempool");
goto error_exit;
}
@@ -574,7 +567,6 @@ main(int argc, char *argv[])
qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
qp_conf.mp_session = info->sess_pool;
- qp_conf.mp_session_private = info->sess_priv_pool;
for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
ret = rte_cryptodev_queue_pair_setup(info->cid, j,
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..f518a0f89b 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -301,7 +301,6 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
* @param dev Crypto device pointer
* @param xform Single or chain of crypto xforms
* @param session Pointer to cryptodev's private session structure
- * @param mp Mempool where the private session is allocated
*
* @return
* - Returns 0 if private session structure have been created successfully.
@@ -311,8 +310,8 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
*/
typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
+
/**
* Configure a Crypto asymmetric session on a device.
*
@@ -337,6 +336,7 @@ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev,
*/
typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
+
/**
* Clear asymmetric session private data.
*
@@ -637,28 +637,6 @@ __rte_internal
void *
rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op);
-static inline void *
-get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id) {
- if (unlikely(sess->nb_drivers <= driver_id))
- return NULL;
-
- return sess->sess_data[driver_id].data;
-}
-
-static inline void
-set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id, void *private_data)
-{
- if (unlikely(sess->nb_drivers <= driver_id)) {
- CDEV_LOG_ERR("Set private data for driver %u not allowed\n",
- driver_id);
- return;
- }
-
- sess->sess_data[driver_id].data = private_data;
-}
-
/**
* @internal
* Cryptodev asymmetric crypto session.
diff --git a/lib/cryptodev/cryptodev_trace_points.c b/lib/cryptodev/cryptodev_trace_points.c
index c5bfe08b79..019fc0c800 100644
--- a/lib/cryptodev/cryptodev_trace_points.c
+++ b/lib/cryptodev/cryptodev_trace_points.c
@@ -39,12 +39,6 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_free,
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_session_free,
lib.cryptodev.asym.free)
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_init,
- lib.cryptodev.sym.init)
-
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_clear,
- lib.cryptodev.sym.clear)
-
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_enqueue_burst,
lib.cryptodev.enq.burst)
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 35661f5347..a326eb0e17 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -199,12 +199,9 @@ const char *rte_crypto_asym_ke_strings[] = {
[RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY] = "pub_ec_key_verify"
};
-/**
- * The private data structure stored in the sym session mempool private data.
- */
struct rte_cryptodev_sym_session_pool_private_data {
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint16_t sess_data_sz;
+ /**< driver session data size */
uint16_t user_data_sz;
/**< session user data will be placed after sess_data */
};
@@ -1211,6 +1208,24 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
return 0;
}
+static uint8_t
+rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp,
+ uint32_t sess_priv_size)
+{
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (!mp)
+ return 0;
+
+ pool_priv = rte_mempool_get_priv(mp);
+
+ if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
+ pool_priv->sess_data_sz < sess_priv_size)
+ return 0;
+
+ return 1;
+}
+
int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
@@ -1234,17 +1249,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
- (!qp_conf->mp_session && qp_conf->mp_session_private)) {
- CDEV_LOG_ERR("Invalid mempools\n");
- return -EINVAL;
- }
-
if (qp_conf->mp_session) {
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
- uint32_t obj_size = qp_conf->mp_session->elt_size;
- uint32_t obj_priv_size = qp_conf->mp_session_private->elt_size;
- struct rte_cryptodev_sym_session s = {0};
pool_priv = rte_mempool_get_priv(qp_conf->mp_session);
if (!pool_priv || qp_conf->mp_session->private_data_size <
@@ -1253,13 +1259,9 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- s.nb_drivers = pool_priv->nb_drivers;
- s.user_data_sz = pool_priv->user_data_sz;
-
- if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
- obj_size) || (s.nb_drivers <= dev->driver_id) ||
- rte_cryptodev_sym_get_private_session_size(dev_id) >
- obj_priv_size) {
+ if (!rte_cryptodev_sym_is_valid_session_pool(
+ qp_conf->mp_session,
+ rte_cryptodev_sym_get_private_session_size(dev_id))) {
CDEV_LOG_ERR("Invalid mempool\n");
return -EINVAL;
}
@@ -1719,53 +1721,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
rte_spinlock_unlock(&rte_cryptodev_cb_lock);
}
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mp)
-{
- struct rte_cryptodev *dev;
- uint32_t sess_priv_sz = rte_cryptodev_sym_get_private_session_size(
- dev_id);
- uint8_t index;
- int ret;
-
- if (!rte_cryptodev_is_valid_dev(dev_id)) {
- CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
- return -EINVAL;
- }
-
- dev = rte_cryptodev_pmd_get_dev(dev_id);
-
- if (sess == NULL || xforms == NULL || dev == NULL || mp == NULL)
- return -EINVAL;
-
- if (mp->elt_size < sess_priv_sz)
- return -EINVAL;
-
- index = dev->driver_id;
- if (index >= sess->nb_drivers)
- return -EINVAL;
-
- RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
-
- if (sess->sess_data[index].refcnt == 0) {
- ret = dev->dev_ops->sym_session_configure(dev, xforms,
- sess, mp);
- if (ret < 0) {
- CDEV_LOG_ERR(
- "dev_id %d failed to configure session details",
- dev_id);
- return ret;
- }
- }
-
- rte_cryptodev_trace_sym_session_init(dev_id, sess, xforms, mp);
- sess->sess_data[index].refcnt++;
- return 0;
-}
-
struct rte_mempool *
rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
@@ -1775,16 +1730,13 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
uint32_t obj_sz;
- obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
- if (obj_sz > elt_size)
- CDEV_LOG_INFO("elt_size %u is expanded to %u\n", elt_size,
- obj_sz);
- else
- obj_sz = elt_size;
+ obj_sz = sizeof(struct rte_cryptodev_sym_session) + elt_size +
+ user_data_size;
+ obj_sz = RTE_ALIGN_CEIL(obj_sz, RTE_CACHE_LINE_SIZE);
mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
- (uint32_t)(sizeof(*pool_priv)),
- NULL, NULL, NULL, NULL,
+ (uint32_t)(sizeof(*pool_priv)), NULL, NULL,
+ NULL, NULL,
socket_id, 0);
if (mp == NULL) {
CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d\n",
@@ -1800,7 +1752,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
return NULL;
}
- pool_priv->nb_drivers = nb_drivers;
+ pool_priv->sess_data_sz = elt_size;
pool_priv->user_data_sz = user_data_size;
rte_cryptodev_trace_sym_session_pool_create(name, nb_elts,
@@ -1858,64 +1810,68 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
return mp;
}
-static unsigned int
-rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
-{
- return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
- sess->user_data_sz;
-}
-
-static uint8_t
-rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp)
-{
- struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
-
- if (!mp)
- return 0;
-
- pool_priv = rte_mempool_get_priv(mp);
-
- if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
- pool_priv->nb_drivers != nb_drivers ||
- mp->elt_size <
- rte_cryptodev_sym_get_header_session_size()
- + pool_priv->user_data_sz)
- return 0;
-
- return 1;
-}
-
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mp)
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp)
{
+ struct rte_cryptodev *dev;
struct rte_cryptodev_sym_session *sess;
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
- if (!rte_cryptodev_sym_is_valid_session_pool(mp)) {
+ uint32_t sess_priv_sz;
+ int ret;
+
+ if (!rte_cryptodev_is_valid_dev(dev_id)) {
+ CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+ return NULL;
+ }
+
+ if (xforms == NULL) {
+ CDEV_LOG_ERR("Invalid xform\n");
+ return NULL;
+ }
+
+ sess_priv_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
+ if (!rte_cryptodev_sym_is_valid_session_pool(mp, sess_priv_sz)) {
CDEV_LOG_ERR("Invalid mempool\n");
return NULL;
}
- pool_priv = rte_mempool_get_priv(mp);
+ dev = rte_cryptodev_pmd_get_dev(dev_id);
/* Allocate a session structure from the session pool */
if (rte_mempool_get(mp, (void **)&sess)) {
CDEV_LOG_ERR("couldn't get object from session mempool");
+ rte_errno = ENOMEM;
return NULL;
}
- sess->nb_drivers = pool_priv->nb_drivers;
+ pool_priv = rte_mempool_get_priv(mp);
+ sess->driver_id = dev->driver_id;
+ sess->sess_data_sz = pool_priv->sess_data_sz;
sess->user_data_sz = pool_priv->user_data_sz;
- sess->opaque_data = 0;
+ sess->driver_priv_data_iova = rte_mempool_virt2iova(sess) +
+ offsetof(struct rte_cryptodev_sym_session, driver_priv_data);
- /* Clear device session pointer.
- * Include the flag indicating presence of user data
- */
- memset(sess->sess_data, 0,
- rte_cryptodev_sym_session_data_size(sess));
+ if (dev->dev_ops->sym_session_configure == NULL) {
+ rte_errno = ENOTSUP;
+ goto error_exit;
+ }
- rte_cryptodev_trace_sym_session_create(mp, sess);
- return sess;
+ ret = dev->dev_ops->sym_session_configure(dev, xforms, sess);
+ if (ret < 0) {
+ rte_errno = -ret;
+ goto error_exit;
+ }
+ sess->driver_id = dev->driver_id;
+
+ rte_cryptodev_trace_sym_session_create(dev_id, sess, xforms, mp);
+
+ return (void *)sess;
+error_exit:
+ rte_mempool_put(mp, (void *)sess);
+ return NULL;
}
int
@@ -1994,11 +1950,15 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
}
int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_cryptodev *dev;
- uint8_t driver_id;
+ struct rte_mempool *sess_mp;
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (sess == NULL)
+ return -EINVAL;
if (!rte_cryptodev_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
@@ -2010,37 +1970,24 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
if (dev == NULL || sess == NULL)
return -EINVAL;
- driver_id = dev->driver_id;
- if (sess->sess_data[driver_id].refcnt == 0)
- return 0;
- if (--sess->sess_data[driver_id].refcnt != 0)
- return -EBUSY;
+ sess_mp = rte_mempool_from_obj(sess);
+ if (!sess_mp)
+ return -EINVAL;
+ pool_priv = rte_mempool_get_priv(sess_mp);
+
+ if (sess->driver_id != dev->driver_id) {
+ CDEV_LOG_ERR("Session created by driver %u but freed by %u",
+ sess->driver_id, dev->driver_id);
+ return -EINVAL;
+ }
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
dev->dev_ops->sym_session_clear(dev, sess);
-
- rte_cryptodev_trace_sym_session_clear(dev_id, sess);
- return 0;
-}
-
-int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
-{
- uint8_t i;
- struct rte_mempool *sess_mp;
-
- if (sess == NULL)
- return -EINVAL;
-
- /* Check that all device private data has been freed */
- for (i = 0; i < sess->nb_drivers; i++) {
- if (sess->sess_data[i].refcnt != 0)
- return -EBUSY;
- }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz +
+ pool_priv->user_data_sz);
/* Return session to mempool */
- sess_mp = rte_mempool_from_obj(sess);
rte_mempool_put(sess_mp, sess);
rte_cryptodev_trace_sym_session_free(sess);
@@ -2077,33 +2024,6 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
return 0;
}
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void)
-{
- /*
- * Header contains pointers to the private data of all registered
- * drivers and all necessary information to ensure safely clear
- * or free al session.
- */
- struct rte_cryptodev_sym_session s = {0};
-
- s.nb_drivers = nb_drivers;
-
- return (unsigned int)(sizeof(s) +
- rte_cryptodev_sym_session_data_size(&s));
-}
-
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess)
-{
- if (!sess)
- return 0;
- else
- return (unsigned int)(sizeof(*sess) +
- rte_cryptodev_sym_session_data_size(sess));
-}
-
unsigned int
rte_cryptodev_asym_get_header_session_size(void)
{
@@ -2150,9 +2070,8 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
int
rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess,
- void *data,
- uint16_t size)
+ struct rte_cryptodev_sym_session *sess, void *data,
+ uint16_t size)
{
if (sess == NULL)
return -EINVAL;
@@ -2160,18 +2079,17 @@ rte_cryptodev_sym_session_set_user_data(
if (sess->user_data_sz < size)
return -ENOMEM;
- rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
+ rte_memcpy(sess->driver_priv_data + sess->sess_data_sz, data, size);
return 0;
}
void *
-rte_cryptodev_sym_session_get_user_data(
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_get_user_data(struct rte_cryptodev_sym_session *sess)
{
if (sess == NULL || sess->user_data_sz == 0)
return NULL;
- return (void *)(sess->sess_data + sess->nb_drivers);
+ return (void *)(sess->driver_priv_data + sess->sess_data_sz);
}
int
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56f459c6a0..0c65958f25 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -544,8 +544,6 @@ struct rte_cryptodev_qp_conf {
uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
struct rte_mempool *mp_session;
/**< The mempool for creating session in sessionless mode */
- struct rte_mempool *mp_session_private;
- /**< The mempool for creating sess private data in sessionless mode */
};
/**
@@ -909,17 +907,21 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id);
* has a fixed algo, key, op-type, digest_len etc.
*/
struct rte_cryptodev_sym_session {
+ RTE_MARKER cacheline0;
+ uint8_t driver_id;
uint64_t opaque_data;
/**< Can be used for external metadata */
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint32_t sess_data_sz;
+ /**< Pointer to the user data stored after sess data */
uint16_t user_data_sz;
- /**< session user data will be placed after sess_data */
- __extension__ struct {
- void *data;
- uint16_t refcnt;
- } sess_data[];
- /**< Driver specific session material, variable size */
+ /**< session user data will be placed after sess data */
+ rte_iova_t driver_priv_data_iova;
+ /**< session driver data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ /**< second cache line - start of the driver session data */
+ uint8_t driver_priv_data[0];
+ /**< Driver specific session data, variable size */
};
/**
@@ -954,6 +956,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
int socket_id);
+
/**
* Create an asymmetric session mempool.
*
@@ -980,17 +983,22 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t cache_size, uint16_t user_data_size, int socket_id);
/**
- * Create symmetric crypto session header (generic with no private data)
+ * Create symmetric crypto session and fill out private data for the device id,
+ * based on its device type.
+ *
+ * @param dev_id ID of device that we want the session to be used on
+ * @param xforms Symmetric crypto transform operations to apply on flow
+ * processed with this session
+ * @param mempool Mempool where the private data is allocated.
*
- * @param mempool Symmetric session mempool to allocate session
- * objects from
* @return
- * - On success return pointer to sym-session
- * - On failure returns NULL
+ * - On success return pointer to sym-session.
+ * - On failure returns NULL.
*/
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
-
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp);
/**
* Create and initialise an asymmetric crypto session structure.
* Calls the PMD to configure the private session data.
@@ -1015,19 +1023,20 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
void **session);
/**
- * Frees symmetric crypto session header, after checking that all
- * the device private data has been freed, returning it
- * to its original mempool.
+ * Frees session for the device id and returning it to its mempool.
+ * It is the application's responsibility to ensure that the session
+ * is not still in-flight operations using it.
*
+ * @param dev_id ID of device that uses the session.
* @param sess Session header to be freed.
*
* @return
* - 0 if successful.
- * - -EINVAL if session is NULL.
- * - -EBUSY if not all device private data has been freed.
+ * - -EINVAL if session is NULL or the mismatched device ids.
*/
int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess);
/**
* Clears and frees asymmetric crypto session header and private data,
@@ -1044,72 +1053,6 @@ __rte_experimental
int
rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess);
-/**
- * Fill out private data for the device id, based on its device type.
- *
- * @param dev_id ID of device that we want the session to be used on
- * @param sess Session where the private data will be attached to
- * @param xforms Symmetric crypto transform operations to apply on flow
- * processed with this session
- * @param mempool Mempool where the private data is allocated.
- *
- * @return
- * - On success, zero.
- * - -EINVAL if input parameters are invalid.
- * - -ENOTSUP if crypto device does not support the crypto transform or
- * does not support symmetric operations.
- * - -ENOMEM if the private session could not be allocated.
- */
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mempool);
-
-/**
- * Frees private data for the device id, based on its device type,
- * returning it to its mempool. It is the application's responsibility
- * to ensure that private session data is not cleared while there are
- * still in-flight operations using it.
- *
- * @param dev_id ID of device that uses the session.
- * @param sess Session containing the reference to the private data
- *
- * @return
- * - 0 if successful.
- * - -EINVAL if device is invalid or session is NULL.
- * - -ENOTSUP if crypto device does not support symmetric operations.
- */
-int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess);
-
-/**
- * Get the size of the header session, for all registered drivers excluding
- * the user data size.
- *
- * @return
- * Size of the symmetric header session.
- */
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void);
-
-/**
- * Get the size of the header session from created session.
- *
- * @param sess
- * The sym cryptodev session pointer
- *
- * @return
- * - If sess is not NULL, return the size of the header session including
- * the private data size defined within sess.
- * - If sess is NULL, return 0.
- */
-__rte_experimental
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess);
-
/**
* Get the size of the asymmetric session header.
*
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index a3f6048e7d..055c44fb22 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -56,7 +56,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u16(queue_pair_id);
rte_trace_point_emit_u32(conf->nb_descriptors);
rte_trace_point_emit_ptr(conf->mp_session);
- rte_trace_point_emit_ptr(conf->mp_session_private);
)
RTE_TRACE_POINT(
@@ -74,13 +73,16 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_create,
- RTE_TRACE_POINT_ARGS(void *mempool,
- struct rte_cryptodev_sym_session *sess),
- rte_trace_point_emit_ptr(mempool);
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess, void *xforms,
+ void *mempool),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
+ rte_trace_point_emit_u8(sess->driver_id);
rte_trace_point_emit_u16(sess->user_data_sz);
+ rte_trace_point_emit_ptr(xforms);
+ rte_trace_point_emit_ptr(mempool);
)
RTE_TRACE_POINT(
@@ -117,27 +119,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_ptr(sess);
)
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_init,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, void *xforms,
- void *mempool),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
- rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
- rte_trace_point_emit_u16(sess->user_data_sz);
- rte_trace_point_emit_ptr(xforms);
- rte_trace_point_emit_ptr(mempool);
-)
-
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_clear,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id, void *sess),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
-)
-
#ifdef __cplusplus
}
#endif
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 5aee87c6f7..6fcf6ae985 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -38,12 +38,9 @@ DPDK_23 {
rte_cryptodev_sym_capability_check_auth;
rte_cryptodev_sym_capability_check_cipher;
rte_cryptodev_sym_capability_get;
- rte_cryptodev_sym_get_header_session_size;
rte_cryptodev_sym_get_private_session_size;
- rte_cryptodev_sym_session_clear;
rte_cryptodev_sym_session_create;
rte_cryptodev_sym_session_free;
- rte_cryptodev_sym_session_init;
local: *;
};
@@ -60,7 +57,6 @@ EXPERIMENTAL {
rte_cryptodev_asym_xform_capability_check_modlen;
rte_cryptodev_asym_xform_capability_check_optype;
rte_cryptodev_sym_cpu_crypto_process;
- rte_cryptodev_sym_get_existing_header_session_size;
rte_cryptodev_sym_session_get_user_data;
rte_cryptodev_sym_session_pool_create;
rte_cryptodev_sym_session_set_user_data;
@@ -78,8 +74,6 @@ EXPERIMENTAL {
__rte_cryptodev_trace_asym_session_create;
__rte_cryptodev_trace_sym_session_free;
__rte_cryptodev_trace_asym_session_free;
- __rte_cryptodev_trace_sym_session_init;
- __rte_cryptodev_trace_sym_session_clear;
__rte_cryptodev_trace_dequeue_burst;
__rte_cryptodev_trace_enqueue_burst;
diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c
index b1310be565..cb792bbe0d 100644
--- a/lib/pipeline/rte_table_action.c
+++ b/lib/pipeline/rte_table_action.c
@@ -1898,17 +1898,11 @@ sym_crypto_apply(struct sym_crypto_data *data,
}
}
- session = rte_cryptodev_sym_session_create(cfg->mp_create);
+ session = rte_cryptodev_sym_session_create(cfg->cryptodev_id,
+ p->xform, cfg->mp_create);
if (!session)
return -ENOMEM;
- ret = rte_cryptodev_sym_session_init(cfg->cryptodev_id, session,
- p->xform, cfg->mp_init);
- if (ret < 0) {
- rte_cryptodev_sym_session_free(session);
- return ret;
- }
-
data->data_offset = (uint16_t)p->data_offset;
data->session = session;
diff --git a/lib/vhost/rte_vhost_crypto.h b/lib/vhost/rte_vhost_crypto.h
index b49e389579..2b01ecda08 100644
--- a/lib/vhost/rte_vhost_crypto.h
+++ b/lib/vhost/rte_vhost_crypto.h
@@ -54,8 +54,6 @@ rte_vhost_crypto_driver_start(const char *path);
* multiple Vhost-crypto devices.
* @param sess_pool
* The pointer to the created cryptodev session pool.
- * @param sess_priv_pool
- * The pointer to the created cryptodev session private data mempool.
* @param socket_id
* NUMA Socket ID to allocate resources on. *
* @return
@@ -65,7 +63,6 @@ rte_vhost_crypto_driver_start(const char *path);
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id);
/**
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 54946f46d9..7321da21b7 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -197,7 +197,6 @@ struct vhost_crypto {
struct rte_hash *session_map;
struct rte_mempool *mbuf_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *wb_pool;
/** DPDK cryptodev ID */
@@ -376,31 +375,21 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
return;
}
- session = rte_cryptodev_sym_session_create(vcrypto->sess_pool);
+ session = rte_cryptodev_sym_session_create(vcrypto->cid, &xform1,
+ vcrypto->sess_pool);
if (!session) {
VC_LOG_ERR("Failed to create session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
- if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
- vcrypto->sess_priv_pool) < 0) {
- VC_LOG_ERR("Failed to initialize session");
- sess_param->session_id = -VIRTIO_CRYPTO_ERR;
- return;
- }
-
/* insert hash to map */
if (rte_hash_add_key_data(vcrypto->session_map,
&vcrypto->last_session_id, session) < 0) {
VC_LOG_ERR("Failed to insert session to hash table");
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0)
- VC_LOG_ERR("Failed to clear session");
- else {
- if (rte_cryptodev_sym_session_free(session) < 0)
- VC_LOG_ERR("Failed to free session");
- }
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0)
+ VC_LOG_ERR("Failed to free session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
@@ -427,12 +416,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
return -VIRTIO_CRYPTO_INVSESS;
}
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
- VC_LOG_DBG("Failed to clear session");
- return -VIRTIO_CRYPTO_ERR;
- }
-
- if (rte_cryptodev_sym_session_free(session) < 0) {
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0) {
VC_LOG_DBG("Failed to free session");
return -VIRTIO_CRYPTO_ERR;
}
@@ -1393,7 +1377,6 @@ rte_vhost_crypto_driver_start(const char *path)
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id)
{
struct virtio_net *dev = get_device(vid);
@@ -1415,7 +1398,6 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
}
vcrypto->sess_pool = sess_pool;
- vcrypto->sess_priv_pool = sess_priv_pool;
vcrypto->cid = cryptodev_id;
vcrypto->cache_session_id = UINT64_MAX;
vcrypto->last_session_id = 1;
--
2.25.1
^ permalink raw reply [relevance 1%]
* [PATCH v6 0/3] Add and test IPsec SA expiry events
2022-09-24 13:57 3% ` [PATCH v5 0/3] Add and test IPsec SA expiry events Akhil Goyal
@ 2022-09-26 17:07 3% ` Akhil Goyal
0 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-26 17:07 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jerinj, adwivedi, anoobj,
ndabilpuram, Akhil Goyal
This patchset is carried forward from last release patches [1]
which added test application changes to test inline IPsec.
These patches were not merged due to the ABI compatibility issues
due to the extension of enum.
Changes in v6:
fix doc build in 1/3
Changes in v5:
added reference to struct which raised these interrupts.
[1] https://patches.dpdk.org/project/dpdk/patch/20220416192530.173895-8-gakhil@marvell.com/
Vamsi Attunuru (3):
ethdev: add IPsec SA expiry event subtypes
test/security: add inline IPsec SA soft expiry cases
test/security: add inline IPsec SA hard expiry cases
app/test/test_cryptodev_security_ipsec.h | 2 +
app/test/test_security_inline_proto.c | 158 +++++++++++++++++-
app/test/test_security_inline_proto_vectors.h | 6 +
lib/ethdev/rte_ethdev.h | 23 ++-
4 files changed, 186 insertions(+), 3 deletions(-)
--
2.25.1
^ permalink raw reply [relevance 3%]
* [PATCH v3 6/6] security: hide session structure
2022-09-24 16:35 1% ` [PATCH v3 1/6] cryptodev: rework session framework Akhil Goyal
2022-09-24 16:35 1% ` [PATCH v3 3/6] cryptodev: hide sym session structure Akhil Goyal
@ 2022-09-24 16:35 2% ` Akhil Goyal
3 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-24 16:35 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, Akhil Goyal,
David Coyle, Kevin O'Sullivan
Structure rte_security_session is moved to internal
headers which are not visible to applications.
The only field which should be used by app is opaque_data.
This field can now be accessed via set/get APIs added in this
patch.
Subsequent changes in app and lib are made to compile the code.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test-crypto-perf/cperf_ops.c | 6 +-
.../cperf_test_pmd_cyclecount.c | 2 +-
app/test-crypto-perf/cperf_test_throughput.c | 2 +-
app/test/test_cryptodev.c | 2 +-
app/test/test_cryptodev_security_ipsec.c | 2 +-
app/test/test_cryptodev_security_ipsec.h | 2 +-
app/test/test_security.c | 32 ++++----
app/test/test_security_inline_proto.c | 10 +--
doc/guides/rel_notes/deprecation.rst | 4 -
doc/guides/rel_notes/release_22_11.rst | 5 ++
drivers/crypto/caam_jr/caam_jr.c | 2 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 4 +-
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 6 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 6 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 4 +-
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 4 +-
drivers/crypto/qat/qat_sym.c | 4 +-
drivers/crypto/qat/qat_sym.h | 4 +-
drivers/net/iavf/iavf_ipsec_crypto.h | 2 +-
examples/ipsec-secgw/ipsec_worker.c | 2 +-
lib/cryptodev/rte_crypto_sym.h | 4 +-
lib/ipsec/rte_ipsec_group.h | 12 +--
lib/ipsec/ses.c | 2 +-
lib/security/rte_security.c | 13 ++-
lib/security/rte_security.h | 80 ++++++++++++-------
lib/security/rte_security_driver.h | 18 +++++
26 files changed, 137 insertions(+), 97 deletions(-)
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index bd3c941fea..7ba4e13244 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -65,8 +65,7 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
for (i = 0; i < nb_ops; i++) {
struct rte_crypto_sym_op *sym_op = ops[i]->sym;
- struct rte_security_session *sec_sess =
- (struct rte_security_session *)sess;
+ void *sec_sess = (void *)sess;
uint32_t buf_sz;
uint32_t *per_pkt_hfn = rte_crypto_op_ctod_offset(ops[i],
@@ -131,8 +130,7 @@ cperf_set_ops_security_ipsec(struct rte_crypto_op **ops,
uint16_t iv_offset __rte_unused, uint32_t *imix_idx,
uint64_t *tsc_start)
{
- struct rte_security_session *sec_sess =
- (struct rte_security_session *)sess;
+ void *sec_sess = sess;
const uint32_t test_buffer_size = options->test_buffer_size;
const uint32_t headroom_sz = options->headroom_sz;
const uint32_t segment_sz = options->segment_sz;
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index f0ca78af4f..045fd1c29a 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -71,7 +71,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
(struct rte_security_ctx *)
rte_cryptodev_get_sec_ctx(ctx->dev_id);
rte_security_session_destroy(sec_ctx,
- (struct rte_security_session *)ctx->sess);
+ (void *)ctx->sess);
} else
#endif
rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index c924459958..38340dae08 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -49,7 +49,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
rte_cryptodev_get_sec_ctx(ctx->dev_id);
rte_security_session_destroy(
sec_ctx,
- (struct rte_security_session *)ctx->sess);
+ (void *)ctx->sess);
}
#endif
else
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index abd2882fd6..b77e14cb06 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -84,7 +84,7 @@ struct crypto_unittest_params {
union {
struct rte_cryptodev_sym_session *sess;
#ifdef RTE_LIB_SECURITY
- struct rte_security_session *sec_session;
+ void *sec_session;
#endif
};
#ifdef RTE_LIB_SECURITY
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 3f691f0f56..cb77b39dbb 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -1126,7 +1126,7 @@ test_ipsec_status_check(const struct ipsec_test_data *td,
int
test_ipsec_stats_verify(struct rte_security_ctx *ctx,
- struct rte_security_session *sess,
+ void *sess,
const struct ipsec_test_flags *flags,
enum rte_security_ipsec_sa_direction dir)
{
diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h
index 02b08f9f95..6a119bee46 100644
--- a/app/test/test_cryptodev_security_ipsec.h
+++ b/app/test/test_cryptodev_security_ipsec.h
@@ -277,7 +277,7 @@ int test_ipsec_status_check(const struct ipsec_test_data *td,
int pkt_num);
int test_ipsec_stats_verify(struct rte_security_ctx *ctx,
- struct rte_security_session *sess,
+ void *sess,
const struct ipsec_test_flags *flags,
enum rte_security_ipsec_sa_direction dir);
diff --git a/app/test/test_security.c b/app/test/test_security.c
index bb3b3835fa..f336479b2e 100644
--- a/app/test/test_security.c
+++ b/app/test/test_security.c
@@ -234,7 +234,7 @@
static struct mock_session_create_data {
void *device;
struct rte_security_session_conf *conf;
- struct rte_security_session *sess;
+ void *sess;
struct rte_mempool *mp;
struct rte_mempool *priv_mp;
@@ -268,7 +268,7 @@ mock_session_create(void *device,
*/
static struct mock_session_update_data {
void *device;
- struct rte_security_session *sess;
+ void *sess;
struct rte_security_session_conf *conf;
int ret;
@@ -322,7 +322,7 @@ mock_session_get_size(void *device)
*/
static struct mock_session_stats_get_data {
void *device;
- struct rte_security_session *sess;
+ void *sess;
struct rte_security_stats *stats;
int ret;
@@ -352,7 +352,7 @@ mock_session_stats_get(void *device,
*/
static struct mock_session_destroy_data {
void *device;
- struct rte_security_session *sess;
+ void *sess;
int ret;
@@ -377,7 +377,7 @@ mock_session_destroy(void *device, struct rte_security_session *sess)
*/
static struct mock_set_pkt_metadata_data {
void *device;
- struct rte_security_session *sess;
+ void *sess;
struct rte_mbuf *m;
void *params;
@@ -513,7 +513,7 @@ static struct security_testsuite_params {
static struct security_unittest_params {
struct rte_security_ctx ctx;
struct rte_security_session_conf conf;
- struct rte_security_session *sess;
+ void *sess;
} unittest_params = {
.ctx = {
.device = NULL,
@@ -650,7 +650,7 @@ ut_setup_with_session(void)
{
struct security_unittest_params *ut_params = &unittest_params;
struct security_testsuite_params *ts_params = &testsuite_params;
- struct rte_security_session *sess;
+ void *sess;
int ret = ut_setup();
if (ret != TEST_SUCCESS)
@@ -701,7 +701,7 @@ test_session_create_inv_context(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
sess = rte_security_session_create(NULL, &ut_params->conf,
ts_params->session_mpool);
@@ -723,7 +723,7 @@ test_session_create_inv_context_ops(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
ut_params->ctx.ops = NULL;
@@ -747,7 +747,7 @@ test_session_create_inv_context_ops_fun(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
ut_params->ctx.ops = &empty_ops;
@@ -770,7 +770,7 @@ test_session_create_inv_configuration(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
sess = rte_security_session_create(&ut_params->ctx, NULL,
ts_params->session_mpool);
@@ -791,7 +791,7 @@ static int
test_session_create_inv_mempool(void)
{
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf, NULL);
TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
@@ -812,8 +812,8 @@ test_session_create_mempool_empty(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *tmp[SECURITY_TEST_MEMPOOL_SIZE];
- struct rte_security_session *sess;
+ void *tmp[SECURITY_TEST_MEMPOOL_SIZE];
+ void *sess;
/* Get all available objects from mempool. */
int i, ret;
@@ -853,7 +853,7 @@ test_session_create_ops_failure(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
mock_session_create_exp.device = NULL;
mock_session_create_exp.conf = &ut_params->conf;
@@ -879,7 +879,7 @@ test_session_create_success(void)
{
struct security_testsuite_params *ts_params = &testsuite_params;
struct security_unittest_params *ut_params = &unittest_params;
- struct rte_security_session *sess;
+ void *sess;
mock_session_create_exp.device = NULL;
mock_session_create_exp.conf = &ut_params->conf;
diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c
index 9c6a09676e..3f520840ac 100644
--- a/app/test/test_security_inline_proto.c
+++ b/app/test/test_security_inline_proto.c
@@ -119,7 +119,7 @@ static struct rte_flow *default_flow[RTE_MAX_ETHPORTS];
/* Create Inline IPsec session */
static int
create_inline_ipsec_session(struct ipsec_test_data *sa, uint16_t portid,
- struct rte_security_session **sess, struct rte_security_ctx **ctx,
+ void **sess, struct rte_security_ctx **ctx,
uint32_t *ol_flags, const struct ipsec_test_flags *flags,
struct rte_security_session_conf *sess_conf)
{
@@ -695,8 +695,8 @@ static int
test_ipsec_with_reassembly(struct reassembly_vector *vector,
const struct ipsec_test_flags *flags)
{
- struct rte_security_session *out_ses[ENCAP_DECAP_BURST_SZ] = {0};
- struct rte_security_session *in_ses[ENCAP_DECAP_BURST_SZ] = {0};
+ void *out_ses[ENCAP_DECAP_BURST_SZ] = {0};
+ void *in_ses[ENCAP_DECAP_BURST_SZ] = {0};
struct rte_eth_ip_reassembly_params reass_capa = {0};
struct rte_security_session_conf sess_conf_out = {0};
struct rte_security_session_conf sess_conf_in = {0};
@@ -963,7 +963,7 @@ test_ipsec_inline_proto_process(struct ipsec_test_data *td,
struct rte_crypto_sym_xform cipher = {0};
struct rte_crypto_sym_xform auth = {0};
struct rte_crypto_sym_xform aead = {0};
- struct rte_security_session *ses;
+ void *ses;
struct rte_security_ctx *ctx;
int nb_rx = 0, nb_sent;
uint32_t ol_flags;
@@ -1199,7 +1199,7 @@ test_ipsec_inline_proto_process_with_esn(struct ipsec_test_data td[],
struct rte_mbuf *rx_pkt = NULL;
struct rte_mbuf *tx_pkt = NULL;
int nb_rx, nb_sent;
- struct rte_security_session *ses;
+ void *ses;
struct rte_security_ctx *ctx;
uint32_t ol_flags;
bool outer_ipv4;
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 9785a0f3ce..701d32b818 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -166,10 +166,6 @@ Deprecation Notices
which got error interrupt to the application,
so that application can reset that particular queue pair.
-* security: Hide structure ``rte_security_session`` and expose an opaque
- pointer for the private data to the application which can be attached
- to the packet while enqueuing.
-
* security: MACsec support is planned to be added in DPDK 22.11,
which would result in updates to structures ``rte_security_macsec_xform``,
``rte_security_macsec_stats`` and security capability structure
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4b8b34d8ba..6a6d1649cc 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,6 +98,11 @@ API Changes
All sample applications were updated to attach an opaque pointer for the session
to the ``rte_crypto_op`` while enqueuing.
+* security: The structure ``rte_security_session`` was made internal and corresponding
+ APIs were updated to take/return an opaque session pointer. The API
+ ``rte_security_session_create`` was updated to take only one mempool which has enough
+ space to hold session and driver private data.
+
ABI Changes
-----------
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index a6d3a494e6..3b06522d06 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1359,7 +1359,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
ses = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
- ses = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ ses = SECURITY_GET_SESS_PRIV(op->sym->session);
break;
default:
CAAM_JR_DP_ERR("sessionless crypto op not supported");
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index f127c84fd3..0dc2dc4baa 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -103,7 +103,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
- sec_sess = SECURITY_GET_SESS_PRIV(sym_op->sec_session);
+ sec_sess = SECURITY_GET_SESS_PRIV(sym_op->session);
ret = cpt_sec_inst_fill(qp, op, sec_sess, &inst[0]);
if (unlikely(ret))
return 0;
@@ -322,7 +322,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
struct cn10k_sec_session *priv;
struct cn10k_ipsec_sa *sa;
- priv = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ priv = SECURITY_GET_SESS_PRIV(op->sym->session);
sa = &priv->sa;
*qp = sa->qp;
*w2 = sa->inst.w2;
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index b395f830b1..2ed298e01f 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -27,7 +27,7 @@ cn9k_cpt_sec_inst_fill(struct rte_crypto_op *op,
struct cn9k_ipsec_sa *sa;
int ret;
- priv = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ priv = SECURITY_GET_SESS_PRIV(op->sym->session);
sa = &priv->sa;
if (unlikely(sym_op->m_dst && sym_op->m_dst != sym_op->m_src)) {
@@ -374,7 +374,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
struct cn9k_sec_session *priv;
struct cn9k_ipsec_sa *sa;
- priv = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ priv = SECURITY_GET_SESS_PRIV(op->sym->session);
sa = &priv->sa;
*qp = sa->qp;
inst->w2.u64 = sa->inst.w2;
@@ -539,7 +539,7 @@ cn9k_cpt_sec_post_process(struct rte_crypto_op *cop,
CPT_OP_FLAGS_IPSEC_INB_REPLAY)) {
int ret;
- priv = SECURITY_GET_SESS_PRIV(sym_op->sec_session);
+ priv = SECURITY_GET_SESS_PRIV(sym_op->session);
sa = &priv->sa;
ret = ipsec_antireplay_check(
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 3c51913dd8..afa9bd0a62 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1382,7 +1382,7 @@ build_sec_fd(struct rte_crypto_op *op,
sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
- sess = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(op->sym->session);
#endif
else {
DPAA2_SEC_DP_ERR("Session type invalid\n");
@@ -1582,7 +1582,7 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd)
mbuf->buf_iova = op->sym->aead.digest.phys_addr;
op->sym->aead.digest.phys_addr = 0L;
- sess_priv = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess_priv = SECURITY_GET_SESS_PRIV(op->sym->session);
if (sess_priv->dir == DIR_ENC)
mbuf->data_off += SEC_FLC_DHR_OUTBOUND;
else
@@ -1678,7 +1678,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
- sess = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(op->sym->session);
#endif
if (sess == NULL)
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 72b848fd49..331e23e628 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -673,7 +673,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
- sess = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(op->sym->session);
#endif
if (sess == NULL) {
printf("session is NULL\n");
@@ -1926,7 +1926,7 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
- ses = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ ses = SECURITY_GET_SESS_PRIV(op->sym->session);
break;
#endif
default:
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index fc9ee01124..8ec2364aa7 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1584,7 +1584,7 @@ set_sec_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
return -1;
}
- session = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ session = SECURITY_GET_SESS_PRIV(op->sym->session);
if (unlikely(session == NULL)) {
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
@@ -1719,7 +1719,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
* this is for DOCSIS
*/
is_docsis_sec = 1;
- sess = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(op->sym->session);
} else
#endif
sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index f8ec8b7233..69f5add637 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -101,7 +101,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
- ctx = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ ctx = SECURITY_GET_SESS_PRIV(op->sym->session);
if (unlikely(!ctx)) {
QAT_DP_LOG(ERR, "No session for this device");
return -EINVAL;
@@ -145,7 +145,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
}
}
- sess = (uintptr_t)op->sym->sec_session;
+ sess = (uintptr_t)op->sym->session;
build_request = ctx->build_request[proc_type];
opaque[0] = sess;
opaque[1] = (uintptr_t)build_request;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 033ec0de85..9a4251e08b 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -277,7 +277,7 @@ qat_sym_preprocess_requests(void **ops, uint16_t nb_ops)
op = (struct rte_crypto_op *)ops[i];
if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
- ctx = SECURITY_GET_SESS_PRIV(op->sym->sec_session);
+ ctx = SECURITY_GET_SESS_PRIV(op->sym->session);
if (ctx == NULL || ctx->bpi_ctx == NULL)
continue;
@@ -310,7 +310,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
* Assuming at this point that if it's a security
* op, that this is for DOCSIS
*/
- sess = SECURITY_GET_SESS_PRIV(rx_op->sym->sec_session);
+ sess = SECURITY_GET_SESS_PRIV(rx_op->sym->session);
is_docsis_sec = 1;
} else
#endif
diff --git a/drivers/net/iavf/iavf_ipsec_crypto.h b/drivers/net/iavf/iavf_ipsec_crypto.h
index 8ea0f9540e..49f9202aca 100644
--- a/drivers/net/iavf/iavf_ipsec_crypto.h
+++ b/drivers/net/iavf/iavf_ipsec_crypto.h
@@ -5,7 +5,7 @@
#ifndef _IAVF_IPSEC_CRYPTO_H_
#define _IAVF_IPSEC_CRYPTO_H_
-#include <rte_security.h>
+#include <rte_security_driver.h>
#include "iavf.h"
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index 5e69450d27..49b1b951f1 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -17,7 +17,7 @@
#endif
struct port_drv_mode_data {
- struct rte_security_session *sess;
+ void *sess;
struct rte_security_ctx *ctx;
};
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index 84deecac48..b1650adcac 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -617,11 +617,9 @@ struct rte_crypto_sym_op {
RTE_STD_C11
union {
void *session;
- /**< Handle for the initialised session context */
+ /**< Handle for the initialised crypto/security session context */
struct rte_crypto_sym_xform *xform;
/**< Session-less API crypto operation parameters */
- struct rte_security_session *sec_session;
- /**< Handle for the initialised security session context */
};
RTE_STD_C11
diff --git a/lib/ipsec/rte_ipsec_group.h b/lib/ipsec/rte_ipsec_group.h
index a4e0e128f8..c6458ef81e 100644
--- a/lib/ipsec/rte_ipsec_group.h
+++ b/lib/ipsec/rte_ipsec_group.h
@@ -44,16 +44,16 @@ struct rte_ipsec_group {
static inline struct rte_ipsec_session *
rte_ipsec_ses_from_crypto(const struct rte_crypto_op *cop)
{
- const struct rte_security_session *ss;
- void *cs;
+ void *ses;
if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
- ss = cop->sym[0].sec_session;
- return (struct rte_ipsec_session *)(uintptr_t)ss->opaque_data;
+ ses = cop->sym[0].session;
+ return (struct rte_ipsec_session *)(uintptr_t)
+ rte_security_session_opaque_data_get(ses);
} else if (cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- cs = cop->sym[0].session;
+ ses = cop->sym[0].session;
return (struct rte_ipsec_session *)(uintptr_t)
- rte_cryptodev_sym_session_opaque_data_get(cs);
+ rte_cryptodev_sym_session_opaque_data_get(ses);
}
return NULL;
}
diff --git a/lib/ipsec/ses.c b/lib/ipsec/ses.c
index 0d3c932302..d9ab1e6d2b 100644
--- a/lib/ipsec/ses.c
+++ b/lib/ipsec/ses.c
@@ -48,7 +48,7 @@ rte_ipsec_session_prepare(struct rte_ipsec_session *ss)
rte_cryptodev_sym_session_opaque_data_set(ss->crypto.ses,
(uintptr_t)ss);
else
- ss->security.ses->opaque_data = (uintptr_t)ss;
+ rte_security_session_opaque_data_set(ss->security.ses, (uintptr_t)ss);
return 0;
}
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 87a21a6e33..59bb141cac 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -42,7 +42,7 @@ rte_security_dynfield_register(void)
return rte_security_dynfield_offset;
}
-struct rte_security_session *
+void *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
struct rte_mempool *mp)
@@ -72,12 +72,12 @@ rte_security_session_create(struct rte_security_ctx *instance,
}
instance->sess_cnt++;
- return sess;
+ return (void *)sess;
}
int
rte_security_session_update(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_security_session_conf *conf)
{
RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, session_update, -EINVAL,
@@ -99,7 +99,7 @@ rte_security_session_get_size(struct rte_security_ctx *instance)
int
rte_security_session_stats_get(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_security_stats *stats)
{
RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, session_stats_get, -EINVAL,
@@ -111,8 +111,7 @@ rte_security_session_stats_get(struct rte_security_ctx *instance,
}
int
-rte_security_session_destroy(struct rte_security_ctx *instance,
- struct rte_security_session *sess)
+rte_security_session_destroy(struct rte_security_ctx *instance, void *sess)
{
int ret;
@@ -134,7 +133,7 @@ rte_security_session_destroy(struct rte_security_ctx *instance,
int
__rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_mbuf *m, void *params)
{
#ifdef RTE_DEBUG
diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
index bf4ff3c18c..2e717b7468 100644
--- a/lib/security/rte_security.h
+++ b/lib/security/rte_security.h
@@ -518,20 +518,6 @@ struct rte_security_session_conf {
/**< Application specific userdata to be saved with session */
};
-struct rte_security_session {
- RTE_MARKER cacheline0;
- uint64_t opaque_data;
- /**< Opaque user defined data */
- uint64_t fast_mdata;
- /**< Fast metadata to be used for inline path */
- rte_iova_t driver_priv_data_iova;
- /**< session private data IOVA address */
-
- RTE_MARKER cacheline1 __rte_cache_min_aligned;
- uint8_t driver_priv_data[0];
- /**< Private session material, variable size (depends on driver) */
-};
-
/**
* Create security session as specified by the session configuration
*
@@ -542,7 +528,7 @@ struct rte_security_session {
* - On success, pointer to session
* - On failure, NULL
*/
-struct rte_security_session *
+void *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
struct rte_mempool *mp);
@@ -560,7 +546,7 @@ rte_security_session_create(struct rte_security_ctx *instance,
__rte_experimental
int
rte_security_session_update(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_security_session_conf *conf);
/**
@@ -590,8 +576,7 @@ rte_security_session_get_size(struct rte_security_ctx *instance);
* - other negative values in case of freeing private data errors.
*/
int
-rte_security_session_destroy(struct rte_security_ctx *instance,
- struct rte_security_session *sess);
+rte_security_session_destroy(struct rte_security_ctx *instance, void *sess);
/** Device-specific metadata field type */
typedef uint64_t rte_security_dynfield_t;
@@ -634,10 +619,52 @@ static inline bool rte_security_dynfield_is_registered(void)
return rte_security_dynfield_offset >= 0;
}
+#define RTE_SECURITY_SESS_OPAQUE_DATA_OFF 0
+#define RTE_SECURITY_SESS_FAST_MDATA_OFF 1
+/**
+ * Get opaque data from session handle
+ */
+static inline uint64_t
+rte_security_session_opaque_data_get(void *sess)
+{
+ return *((uint64_t *)sess + RTE_SECURITY_SESS_OPAQUE_DATA_OFF);
+}
+
+/**
+ * Set opaque data in session handle
+ */
+static inline void
+rte_security_session_opaque_data_set(void *sess, uint64_t opaque)
+{
+ uint64_t *data;
+ data = (((uint64_t *)sess) + RTE_SECURITY_SESS_OPAQUE_DATA_OFF);
+ *data = opaque;
+}
+
+/**
+ * Get fast mdata from session handle
+ */
+static inline uint64_t
+rte_security_session_fast_mdata_get(void *sess)
+{
+ return *((uint64_t *)sess + RTE_SECURITY_SESS_FAST_MDATA_OFF);
+}
+
+/**
+ * Set fast mdata in session handle
+ */
+static inline void
+rte_security_session_fast_mdata_set(void *sess, uint64_t fdata)
+{
+ uint64_t *data;
+ data = (((uint64_t *)sess) + RTE_SECURITY_SESS_FAST_MDATA_OFF);
+ *data = fdata;
+}
+
/** Function to call PMD specific function pointer set_pkt_metadata() */
__rte_experimental
extern int __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_mbuf *m, void *params);
/**
@@ -655,13 +682,13 @@ extern int __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
*/
static inline int
rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_mbuf *mb, void *params)
{
/* Fast Path */
if (instance->flags & RTE_SEC_CTX_F_FAST_SET_MDATA) {
- *rte_security_dynfield(mb) =
- (rte_security_dynfield_t)(sess->fast_mdata);
+ *rte_security_dynfield(mb) = (rte_security_dynfield_t)
+ rte_security_session_fast_mdata_get(sess);
return 0;
}
@@ -710,10 +737,9 @@ rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md)
* @param sess security session
*/
static inline int
-__rte_security_attach_session(struct rte_crypto_sym_op *sym_op,
- struct rte_security_session *sess)
+__rte_security_attach_session(struct rte_crypto_sym_op *sym_op, void *sess)
{
- sym_op->sec_session = sess;
+ sym_op->session = sess;
return 0;
}
@@ -729,7 +755,7 @@ __rte_security_attach_session(struct rte_crypto_sym_op *sym_op,
*/
static inline int
rte_security_attach_session(struct rte_crypto_op *op,
- struct rte_security_session *sess)
+ void *sess)
{
if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC))
return -EINVAL;
@@ -791,7 +817,7 @@ struct rte_security_stats {
__rte_experimental
int
rte_security_session_stats_get(struct rte_security_ctx *instance,
- struct rte_security_session *sess,
+ void *sess,
struct rte_security_stats *stats);
/**
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index c8119a8a50..37be87b9f7 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -19,6 +19,24 @@ extern "C" {
#include "rte_security.h"
+/**
+ * @internal
+ * Security session to be used by library for internal usage
+ */
+struct rte_security_session {
+ RTE_MARKER cacheline0;
+ uint64_t opaque_data;
+ /**< Opaque user defined data */
+ uint64_t fast_mdata;
+ /**< Fast metadata to be used for inline path */
+ rte_iova_t driver_priv_data_iova;
+ /**< session private data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ uint8_t driver_priv_data[0];
+ /**< Private session material, variable size (depends on driver) */
+};
+
/**
* Helper macro to get driver private data
*/
--
2.25.1
^ permalink raw reply [relevance 2%]
* [PATCH v3 3/6] cryptodev: hide sym session structure
2022-09-24 16:35 1% ` [PATCH v3 1/6] cryptodev: rework session framework Akhil Goyal
@ 2022-09-24 16:35 1% ` Akhil Goyal
2022-09-24 16:35 2% ` [PATCH v3 6/6] security: hide " Akhil Goyal
3 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-24 16:35 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, Akhil Goyal, Kai Ji,
David Coyle, Kevin O'Sullivan
Structure rte_cryptodev_sym_session is moved to internal
headers which are not visible to applications.
The only field which should be used by app is opaque_data.
This field can now be accessed via set/get APIs added in this
patch.
Subsequent changes in app and lib are made to compile the code.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test/test_ipsec_perf.c | 4 +-
doc/guides/prog_guide/cryptodev_lib.rst | 16 ++----
doc/guides/rel_notes/deprecation.rst | 5 --
doc/guides/rel_notes/release_22_11.rst | 9 +++
drivers/crypto/bcmfs/bcmfs_sym_session.c | 5 +-
drivers/crypto/caam_jr/caam_jr.c | 10 ++--
drivers/crypto/ccp/ccp_crypto.c | 30 +++++-----
drivers/crypto/ccp/ccp_pmd_ops.c | 2 +-
drivers/crypto/ccp/rte_ccp_pmd.c | 4 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 8 +--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 10 ++--
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 4 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 2 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 11 ++--
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 2 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 9 ++-
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 2 +-
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 2 +-
drivers/crypto/ipsec_mb/ipsec_mb_private.h | 4 +-
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 6 +-
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 4 +-
drivers/crypto/ipsec_mb/pmd_kasumi.c | 2 +-
drivers/crypto/ipsec_mb/pmd_snow3g.c | 2 +-
drivers/crypto/mlx5/mlx5_crypto.c | 7 +--
drivers/crypto/nitrox/nitrox_sym.c | 6 +-
drivers/crypto/null/null_crypto_pmd.c | 3 +-
drivers/crypto/null/null_crypto_pmd_ops.c | 2 +-
drivers/crypto/octeontx/otx_cryptodev_ops.c | 10 ++--
drivers/crypto/openssl/rte_openssl_pmd.c | 4 +-
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 4 +-
drivers/crypto/qat/qat_sym.c | 4 +-
drivers/crypto/qat/qat_sym.h | 3 +-
drivers/crypto/qat/qat_sym_session.c | 6 +-
.../scheduler/scheduler_pkt_size_distr.c | 13 ++---
drivers/crypto/scheduler/scheduler_pmd_ops.c | 4 +-
.../crypto/scheduler/scheduler_pmd_private.h | 30 +++++-----
drivers/crypto/virtio/virtio_cryptodev.c | 4 +-
drivers/crypto/virtio/virtio_rxtx.c | 2 +-
examples/fips_validation/fips_dev_self_test.c | 10 ++--
lib/cryptodev/cryptodev_pmd.h | 32 +++++++++++
lib/cryptodev/rte_crypto.h | 3 +-
lib/cryptodev/rte_crypto_sym.h | 7 +--
lib/cryptodev/rte_cryptodev.c | 16 ++++--
lib/cryptodev/rte_cryptodev.h | 56 +++++++++----------
lib/cryptodev/rte_cryptodev_trace.h | 8 +--
lib/ipsec/rte_ipsec_group.h | 5 +-
lib/ipsec/ses.c | 3 +-
47 files changed, 201 insertions(+), 194 deletions(-)
diff --git a/app/test/test_ipsec_perf.c b/app/test/test_ipsec_perf.c
index b5d0c2e036..b221b7fc32 100644
--- a/app/test/test_ipsec_perf.c
+++ b/app/test/test_ipsec_perf.c
@@ -227,7 +227,7 @@ static int
create_sa(enum rte_security_session_action_type action_type,
struct ipsec_sa *sa)
{
- static struct rte_cryptodev_sym_session dummy_ses;
+ void *dummy_ses = NULL;
size_t sz;
int rc;
@@ -247,7 +247,7 @@ create_sa(enum rte_security_session_action_type action_type,
"failed to allocate memory for rte_ipsec_sa\n");
sa->ss[0].type = action_type;
- sa->ss[0].crypto.ses = &dummy_ses;
+ sa->ss[0].crypto.ses = dummy_ses;
rc = rte_ipsec_sa_init(sa->ss[0].sa, &sa->sa_prm, sz);
rc = (rc > 0 && (uint32_t)rc <= sz) ? 0 : -EINVAL;
diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst
index 9e54683aa1..01aad842a9 100644
--- a/doc/guides/prog_guide/cryptodev_lib.rst
+++ b/doc/guides/prog_guide/cryptodev_lib.rst
@@ -125,13 +125,11 @@ Each queue pairs resources may be allocated on a specified socket.
uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
struct rte_mempool *mp_session;
/**< The mempool for creating session in sessionless mode */
- struct rte_mempool *mp_session_private;
- /**< The mempool for creating sess private data in sessionless mode */
};
-The fields ``mp_session`` and ``mp_session_private`` are used for creating
-temporary session to process the crypto operations in the session-less mode.
+The field ``mp_session`` is used for creating temporary session to process
+the crypto operations in the session-less mode.
They can be the same other different mempools. Please note not all Cryptodev
PMDs supports session-less mode.
@@ -595,7 +593,7 @@ chain.
struct rte_mbuf *m_dst;
union {
- struct rte_cryptodev_sym_session *session;
+ void *session;
/**< Handle for the initialised session context */
struct rte_crypto_sym_xform *xform;
/**< Session-less API Crypto operation parameters */
@@ -943,15 +941,11 @@ using one of the crypto PMDs available in DPDK.
/* Create crypto session and initialize it for the crypto device. */
struct rte_cryptodev_sym_session *session;
- session = rte_cryptodev_sym_session_create(session_pool);
+ session = rte_cryptodev_sym_session_create(cdev_id, &cipher_xform,
+ session_pool);
if (session == NULL)
rte_exit(EXIT_FAILURE, "Session could not be created\n");
- if (rte_cryptodev_sym_session_init(cdev_id, session,
- &cipher_xform, session_priv_pool) < 0)
- rte_exit(EXIT_FAILURE, "Session could not be initialized "
- "for the crypto device\n");
-
/* Get a burst of crypto operations. */
struct rte_crypto_op *crypto_ops[BURST_SIZE];
if (rte_crypto_op_bulk_alloc(crypto_op_pool,
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..9785a0f3ce 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -161,11 +161,6 @@ Deprecation Notices
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=23367>`__.
This should be updated in DPDK 22.11.
-* cryptodev: Hide structures ``rte_cryptodev_sym_session`` and
- ``rte_cryptodev_asym_session`` to remove unnecessary indirection between
- session and the private data of session. An opaque pointer can be exposed
- directly to application which can be attached to the ``rte_crypto_op``.
-
* cryptodev: The function ``rte_cryptodev_cb_fn`` will be updated
to have another parameter ``qp_id`` to return the queue pair ID
which got error interrupt to the application,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 7fab9d6550..4b8b34d8ba 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -89,6 +89,15 @@ API Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* cryptodev: The structure ``rte_cryptodev_sym_session`` was made internal.
+ The API ``rte_cryptodev_sym_session_init`` and ``rte_cryptodev_sym_session_clear``
+ were removed and user would only need to call ``rte_cryptodev_sym_session_create``
+ and ``rte_cryptodev_sym_session_free`` to create/destroy sessions.
+ The API ``rte_cryptodev_sym_session_create`` was updated to take a single mempool
+ with element size big enough to hold session data and session private data.
+ All sample applications were updated to attach an opaque pointer for the session
+ to the ``rte_crypto_op`` while enqueuing.
+
ABI Changes
-----------
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index d3334dc920..40813d1fe5 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -210,8 +210,7 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
BCMFS_DP_LOG(ERR, "operations op(%p) is sessionless", op);
} else if (likely(op->sym->session != NULL)) {
/* get existing session */
- sess = (struct bcmfs_sym_session *)
- op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
if (sess == NULL)
@@ -233,7 +232,7 @@ bcmfs_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- sess_private_data = (void *)sess->driver_priv_data;
+ sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
ret = crypto_set_session_parameters(sess_private_data, xform);
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index a9c93dea13..c9c783d19a 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1356,8 +1356,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (struct caam_jr_session *)
- op->sym->session->driver_priv_data;
+ ses = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
ses = (struct caam_jr_session *)
@@ -1699,7 +1698,7 @@ caam_jr_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
int ret;
PMD_INIT_FUNC_TRACE();
- sess_private_data = (void *)sess->driver_priv_data;
+ sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
memset(sess_private_data, 0, sizeof(struct caam_jr_session));
ret = caam_jr_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
@@ -1716,12 +1715,11 @@ static void
caam_jr_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_priv = (void *)sess->driver_priv_data;
- struct caam_jr_session *s = (struct caam_jr_session *)sess_priv;
+ struct caam_jr_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
PMD_INIT_FUNC_TRACE();
- if (sess_priv) {
+ if (s) {
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
}
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index bd999abe61..b21b32e507 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1585,7 +1585,7 @@ ccp_perform_hmac(struct rte_crypto_op *op,
void *append_ptr;
uint8_t *addr;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
addr = session->auth.pre_compute;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -1764,7 +1764,7 @@ ccp_perform_sha(struct rte_crypto_op *op,
void *append_ptr;
uint64_t auth_msg_bits;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1855,7 +1855,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr, dest_addr_t;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1999,7 +1999,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2071,7 +2071,7 @@ ccp_perform_aes_cmac(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
int length, non_align_len;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
key_addr = rte_mem_virt2phy(session->auth.key_ccp);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -2232,7 +2232,7 @@ ccp_perform_aes(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
uint8_t *iv;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
function.raw = 0;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
@@ -2318,7 +2318,7 @@ ccp_perform_3des(struct rte_crypto_op *op,
uint8_t *iv;
phys_addr_t src_addr, dest_addr, key_addr;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
switch (session->cipher.um.des_mode) {
@@ -2426,7 +2426,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
phys_addr_t digest_dest_addr;
int length, non_align_len;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
key_addr = session->cipher.key_phys;
@@ -2591,7 +2591,7 @@ ccp_crypto_cipher(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
switch (session->cipher.algo) {
case CCP_CIPHER_ALGO_AES_CBC:
@@ -2627,7 +2627,7 @@ ccp_crypto_auth(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
switch (session->auth.algo) {
case CCP_AUTH_ALGO_SHA1:
@@ -2695,7 +2695,7 @@ ccp_crypto_aead(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
switch (session->auth.algo) {
case CCP_AUTH_ALGO_AES_GCM:
@@ -2758,8 +2758,7 @@ process_ops_to_enqueue(struct ccp_qp *qp,
b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
Q_DESC_SIZE);
for (i = b_idx; i < (nb_ops+b_idx); i++) {
- session = (struct ccp_session *)
- op[i]->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op[i]->sym->session);
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
result = ccp_crypto_cipher(op[i], cmd_q, b_info);
@@ -2835,7 +2834,7 @@ static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
int offset, digest_offset;
uint8_t digest_le[64];
- session = (struct ccp_session *)op->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
if (session->cmd_id == CCP_CMD_COMBINED) {
digest_data = op->sym->aead.digest.data;
@@ -2909,8 +2908,7 @@ ccp_prepare_ops(struct ccp_qp *qp,
for (i = b_info->b_idx; i < min_ops; i++) {
op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
- session = (struct ccp_session *)
- op_d[i]->sym->session->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(op_d[i]->sym->session);
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index e401793a76..52f320b02b 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -767,7 +767,7 @@ ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -ENOMEM;
}
- sess_private_data = (void *)sess->driver_priv_data;
+ sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
internals = (struct ccp_private *)dev->data->dev_private;
ret = ccp_set_session_parameters(sess_private_data, xform, internals);
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 7502281ad9..c0b016ea36 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -56,7 +56,7 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
if (unlikely(op->sym->session == NULL))
return NULL;
- sess = (void *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
struct rte_cryptodev_sym_session *_sess;
struct ccp_private *internals;
@@ -152,7 +152,7 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
if (unlikely(ops[i]->sess_type ==
RTE_CRYPTO_OP_SESSIONLESS)) {
struct ccp_session *sess =
- (void *)ops[i]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(ops[i]->sym->session);
memset(sess, 0, sizeof(*sess));
rte_mempool_put(qp->sess_mp,
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index f96e132513..4648576ff8 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -110,7 +110,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
return 0;
w7 = sec_sess->sa.inst.w7;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- sess = (void *)sym_op->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(sym_op->session);
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret))
@@ -293,9 +293,7 @@ cn10k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = (void *)(
- ((struct rte_cryptodev_sym_session *)sess)->
- driver_priv_data);
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -332,7 +330,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = (void *)op->sym->session->driver_priv_data;
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
} else {
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index a44f111ba6..5c344a6008 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -69,7 +69,7 @@ cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
if (ret)
goto sess_put;
- priv = (void *)sess->driver_priv_data;
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
sym_op->session = sess;
@@ -92,7 +92,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
sym_op = op->sym;
- sess = (void *)sym_op->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(sym_op->session);
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
inst->w7.u64 = sess->cpt_inst_w7;
} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
@@ -344,9 +344,7 @@ cn9k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = (void *)((
- (struct rte_cryptodev_sym_session *)sess)->
- driver_priv_data);
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -383,7 +381,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = (void *)op->sym->session->driver_priv_data;
+ priv = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
} else {
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index 018d7fcee8..a5233a942a 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -624,7 +624,7 @@ sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_cryptodev_sym_session *sess)
{
enum cpt_dp_thread_type thr_type;
- struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
+ struct cnxk_se_sess *sess_priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
memset(sess_priv, 0, sizeof(struct cnxk_se_sess));
@@ -693,7 +693,7 @@ cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
void
sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
+ struct cnxk_se_sess *sess_priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index ca90567620..37a7322e0f 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -5,7 +5,7 @@
#ifndef _CNXK_CRYPTODEV_OPS_H_
#define _CNXK_CRYPTODEV_OPS_H_
-#include <rte_cryptodev.h>
+#include <cryptodev_pmd.h>
#include <rte_event_crypto_adapter.h>
#include "roc_api.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 5a38d53022..369fa9c81d 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1379,7 +1379,7 @@ build_sec_fd(struct rte_crypto_op *op,
dpaa2_sec_session *sess;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -1677,7 +1677,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
struct rte_crypto_sym_op *sym_op;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -3756,7 +3756,7 @@ dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data = (void *)sess->driver_priv_data;
+ void *sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
ret = dpaa2_sec_set_session_parameters(xform, sess_private_data);
@@ -3775,10 +3775,9 @@ dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- void *sess_priv = (void *)sess->driver_priv_data;
- dpaa2_sec_session *s = (dpaa2_sec_session *)sess_priv;
+ dpaa2_sec_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
- if (sess_priv) {
+ if (s) {
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index 795be3acc3..8c1e0abb95 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -1012,7 +1012,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa2_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (void *)session_ctx.crypto_sess->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(session_ctx.crypto_sess);
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 0cc773fba6..ec2fe56d1e 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -670,7 +670,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
struct qm_sg_entry sg[2];
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa_sec_session *)
@@ -1924,8 +1924,7 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (void *)
- op->sym->session->driver_priv_data;
+ ses = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
@@ -2673,7 +2672,7 @@ dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data = (void *)sess->driver_priv_data;
+ void *sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
PMD_INIT_FUNC_TRACE();
@@ -2714,7 +2713,7 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- void *sess_priv = (void *)sess->driver_priv_data;
+ void *sess_priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
free_session_memory(dev, s);
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d2e4d9d787..93129e7614 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -1018,7 +1018,7 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
sess = (dpaa_sec_session *)
- session_ctx.crypto_sess->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(session_ctx.crypto_sess);
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 90ce5bc965..cedcaa2742 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -329,7 +329,7 @@ ipsec_mb_sym_session_configure(
}
ret = (*pmd_data->session_configure)(mb_mgr,
- (void *)sess->driver_priv_data, xform);
+ CRYPTODEV_GET_SYM_SESS_PRIV(sess), xform);
if (ret != 0) {
IPSEC_MB_LOG(ERR, "failed configure session parameters");
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 14f962ef28..63e6fd58ee 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -434,7 +434,7 @@ ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
}
if (unlikely(pmd_data->session_configure(qp->mb_mgr,
- (void *)sess->driver_priv_data, sym_op->xform) != 0)) {
+ CRYPTODEV_GET_SYM_SESS_PRIV(sess), sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
goto error_exit;
}
@@ -447,7 +447,7 @@ ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
IPSEC_MB_LOG(ERR, "Unrecognized session type %u", sess_type);
}
- return (void *)sess->driver_priv_data;
+ return CRYPTODEV_GET_SYM_SESS_PRIV(sess);
error_exit:
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
index e4f274b608..8d40bd9169 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
@@ -468,7 +468,7 @@ aesni_gcm_get_session(struct ipsec_mb_qp *qp,
}
if (unlikely(aesni_gcm_session_configure(qp->mb_mgr,
- (void *)sess->driver_priv_data,
+ CRYPTODEV_GET_SYM_SESS_PRIV(sess),
sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, sess);
sess = NULL;
@@ -479,7 +479,7 @@ aesni_gcm_get_session(struct ipsec_mb_qp *qp,
if (unlikely(sess == NULL))
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return (void *)sess->driver_priv_data;
+ return CRYPTODEV_GET_SYM_SESS_PRIV(sess);
}
static uint16_t
@@ -704,7 +704,7 @@ aesni_gcm_process_bulk(struct rte_cryptodev *dev __rte_unused,
__rte_unused union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
- struct aesni_gcm_session *s = (void *)sess->driver_priv_data;
+ struct aesni_gcm_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct gcm_context_data gdata_ctx;
IMB_MGR *mb_mgr;
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index f3565b04b5..7d2f3b0e4b 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1723,7 +1723,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
sess = get_sec_session_private_data(op->sym->sec_session);
} else
#endif
- sess = (void *)op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
switch (job->status) {
@@ -2013,7 +2013,7 @@ aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
void *buf;
IMB_JOB *job;
IMB_MGR *mb_mgr;
- struct aesni_mb_session *s = (void *)sess->driver_priv_data;
+ struct aesni_mb_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
uint8_t tmp_dgst[vec->num][DIGEST_LENGTH_MAX];
/* get per-thread MB MGR, create one if needed */
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index b2fb168154..705eed9758 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -282,7 +282,7 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session->driver_priv_data, 0,
+ memset(CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session), 0,
sizeof(struct kasumi_session));
rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index f052d6d847..8ed069f428 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -413,7 +413,7 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session->driver_priv_data, 0,
+ memset(CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session), 0,
sizeof(struct snow3g_session));
rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index 46ea507cf5..c7d8fa311c 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -175,7 +175,7 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
struct mlx5_crypto_session *sess_private_data =
- (void *)session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(session);
struct rte_crypto_cipher_xform *cipher;
uint8_t encryption_order;
@@ -239,7 +239,7 @@ mlx5_crypto_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *spriv = (void *)sess->driver_priv_data;
+ struct mlx5_crypto_session *spriv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
if (unlikely(spriv == NULL)) {
DRV_LOG(ERR, "Failed to get session %p private data.", spriv);
@@ -355,8 +355,7 @@ mlx5_crypto_wqe_set(struct mlx5_crypto_priv *priv,
struct rte_crypto_op *op,
struct mlx5_umr_wqe *umr)
{
- struct mlx5_crypto_session *sess =
- (void *)op->sym->session->driver_priv_data;
+ struct mlx5_crypto_session *sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
struct mlx5_wqe_cseg *cseg = &umr->ctr;
struct mlx5_wqe_mkey_cseg *mkc = &umr->mkc;
struct mlx5_wqe_dseg *klms = &umr->kseg[0];
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index 505024a810..dd8457aaa4 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -534,7 +534,7 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
struct rte_crypto_sym_xform *xform,
struct rte_cryptodev_sym_session *sess)
{
- struct nitrox_crypto_ctx *ctx = (void *)sess->driver_priv_data;
+ struct nitrox_crypto_ctx *ctx = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct rte_crypto_cipher_xform *cipher_xform = NULL;
struct rte_crypto_auth_xform *auth_xform = NULL;
struct rte_crypto_aead_xform *aead_xform = NULL;
@@ -577,7 +577,7 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
goto err;
}
- ctx->iova = sess->driver_priv_data_iova;
+ ctx->iova = CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(sess);
return 0;
err:
return ret;
@@ -593,7 +593,7 @@ get_crypto_ctx(struct rte_crypto_op *op)
{
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(op->sym->session))
- return (void *)op->sym->session->driver_priv_data;
+ return CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
}
return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 09aac3065e..27f750aaca 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -77,8 +77,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
- sess = (struct null_crypto_session *)
- sym_op->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(sym_op->session);
} else {
struct rte_cryptodev_sym_session *_sess = NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index fb43d3f7b5..f07e9c2ea0 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -265,7 +265,7 @@ null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- sess_private_data = (void *)sess->driver_priv_data;
+ sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
ret = null_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index cd5ebc2af6..a5b595c05f 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -248,7 +248,7 @@ sym_session_configure(struct rte_crypto_sym_xform *xform,
struct rte_crypto_sym_xform *temp_xform = xform;
struct cpt_sess_misc *misc;
vq_cmd_word3_t vq_cmd_w3;
- void *priv = (void *)sess->driver_priv_data;
+ void *priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
ret = sym_xform_verify(xform);
@@ -294,7 +294,7 @@ sym_session_configure(struct rte_crypto_sym_xform *xform,
goto priv_put;
}
- misc->ctx_dma_addr = sess->driver_priv_data_iova +
+ misc->ctx_dma_addr = CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(sess) +
sizeof(struct cpt_sess_misc);
vq_cmd_w3.u64 = 0;
@@ -313,7 +313,7 @@ sym_session_configure(struct rte_crypto_sym_xform *xform,
static void
sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = (void *)sess->driver_priv_data;
+ void *priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct cpt_sess_misc *misc;
struct cpt_ctx *ctx;
@@ -507,7 +507,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance,
void *req;
uint64_t cpt_op;
- sess = (struct cpt_sess_misc *)sym_op->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(sym_op->session);
cpt_op = sess->cpt_op;
if (likely(cpt_op & CPT_OP_CIPHER_MASK))
@@ -844,7 +844,7 @@ static inline void
free_sym_session_data(const struct cpt_instance *instance,
struct rte_crypto_op *cop)
{
- void *sess_private_data_t = (void *)cop->sym->session->driver_priv_data;
+ void *sess_private_data_t = CRYPTODEV_GET_SYM_SESS_PRIV(cop->sym->session);
memset(sess_private_data_t, 0, cpt_get_session_size());
rte_mempool_put(instance->sess_mp, cop->sym->session);
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 0bb536c9e3..cc8328cd5f 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -887,8 +887,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
/* get existing session */
if (likely(op->sym->session != NULL))
- sess = (void *)
- op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(
+ op->sym->session);
} else {
if (likely(op->asym->session != NULL))
asym_sess = (struct openssl_asym_session *)
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index 2a3662ee5a..defed4429e 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -795,7 +795,7 @@ openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data = (void *)sess->driver_priv_data;
+ void *sess_private_data = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
int ret;
if (unlikely(sess == NULL)) {
@@ -1319,7 +1319,7 @@ static void
openssl_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- void *sess_priv = (void *)sess->driver_priv_data;
+ void *sess_priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
/* Zero out the whole structure */
openssl_reset_session(sess_priv);
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 408ae9e42b..d7696822a8 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -67,7 +67,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
return -EINVAL;
if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) {
- ctx = (void *)op->sym->session->driver_priv_data;
+ ctx = (void *)CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
if (sess != (uintptr_t)ctx) {
struct rte_cryptodev *cdev;
struct qat_cryptodev_private *internals;
@@ -386,7 +386,7 @@ qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
return -EINVAL;
- ctx = (void *)session_ctx.crypto_sess->driver_priv_data;
+ ctx = CRYPTODEV_GET_SYM_SESS_PRIV(session_ctx.crypto_sess);
dp_ctx->session = ctx;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 2853ac5b88..653df0bf69 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -316,8 +316,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
} else
#endif
{
- sess = (struct qat_sym_session *)
- rx_op->sym->session->driver_priv_data;
+ sess = CRYPTODEV_GET_SYM_SESS_PRIV(rx_op->sym->session);
is_docsis_sec = 0;
}
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 8dd2357702..c6976f2cdd 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -222,7 +222,7 @@ void
qat_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- struct qat_sym_session *s = (void *)sess->driver_priv_data;
+ struct qat_sym_session *s = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
if (s->bpi_ctx)
bpi_cipher_ctx_free(s->bpi_ctx);
@@ -505,8 +505,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
#endif
ret = qat_sym_session_set_parameters(dev, xform,
- (void *)sess->driver_priv_data,
- sess->driver_priv_data_iova);
+ CRYPTODEV_GET_SYM_SESS_PRIV(sess),
+ CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(sess));
if (ret != 0) {
QAT_LOG(ERR,
"Crypto QAT PMD: failed to configure session parameters");
diff --git a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
index 9204f6f608..396cc3723d 100644
--- a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
+++ b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
@@ -76,13 +76,10 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
rte_prefetch0((uint8_t *)ops[i + 7]->sym->session +
sizeof(struct rte_cryptodev_sym_session));
- sess_ctx[0] = (void *)ops[i]->sym->session->driver_priv_data;
- sess_ctx[1] =
- (void *)ops[i + 1]->sym->session->driver_priv_data;
- sess_ctx[2] =
- (void *)ops[i + 2]->sym->session->driver_priv_data;
- sess_ctx[3] =
- (void *)ops[i + 3]->sym->session->driver_priv_data;
+ sess_ctx[0] = CRYPTODEV_GET_SYM_SESS_PRIV(ops[i]->sym->session);
+ sess_ctx[1] = CRYPTODEV_GET_SYM_SESS_PRIV(ops[i + 1]->sym->session);
+ sess_ctx[2] = CRYPTODEV_GET_SYM_SESS_PRIV(ops[i + 2]->sym->session);
+ sess_ctx[3] = CRYPTODEV_GET_SYM_SESS_PRIV(ops[i + 3]->sym->session);
/* job_len is initialized as cipher data length, once
* it is 0, equals to auth data length
@@ -166,7 +163,7 @@ schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops)
for (; i < nb_ops; i++) {
struct scheduler_session_ctx *sess_ctx =
- (void *)ops[i]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(ops[i]->sym->session);
uint32_t job_len;
uint8_t target;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 2bc3f5dd27..707bb7d8d1 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -481,7 +481,7 @@ scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
{
struct scheduler_ctx *sched_ctx = dev->data->dev_private;
struct rte_mempool *mp = rte_mempool_from_obj(sess);
- struct scheduler_session_ctx *sess_ctx = (void *)sess->driver_priv_data;
+ struct scheduler_session_ctx *sess_ctx = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct scheduler_configured_sess_info configured_sess[
RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS] = { 0 };
uint32_t i, j, n_configured_sess = 0;
@@ -543,7 +543,7 @@ scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- struct scheduler_session_ctx *sess_ctx = (void *)sess->driver_priv_data;
+ struct scheduler_session_ctx *sess_ctx = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
struct scheduler_configured_sess_info deleted_sess[
RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS] = { 0 };
uint32_t i, j, n_deleted_sess = 0;
diff --git a/drivers/crypto/scheduler/scheduler_pmd_private.h b/drivers/crypto/scheduler/scheduler_pmd_private.h
index 0e508727a4..41be928dc3 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_private.h
+++ b/drivers/crypto/scheduler/scheduler_pmd_private.h
@@ -131,28 +131,28 @@ scheduler_set_worker_session(struct rte_crypto_op **ops, uint16_t nb_ops,
if (op[0]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[0]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[0]->sym->session);
op[0]->sym->session =
sess_ctx->worker_sess[worker_index];
}
if (op[1]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[1]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[1]->sym->session);
op[1]->sym->session =
sess_ctx->worker_sess[worker_index];
}
if (op[2]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[2]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[2]->sym->session);
op[2]->sym->session =
sess_ctx->worker_sess[worker_index];
}
if (op[3]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[3]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[3]->sym->session);
op[3]->sym->session =
sess_ctx->worker_sess[worker_index];
}
@@ -164,7 +164,7 @@ scheduler_set_worker_session(struct rte_crypto_op **ops, uint16_t nb_ops,
while (n--) {
if (op[0]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct scheduler_session_ctx *sess_ctx =
- (void *)op[0]->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(op[0]->sym->session);
op[0]->sym->session =
sess_ctx->worker_sess[worker_index];
@@ -195,17 +195,17 @@ scheduler_retrieve_session(struct rte_crypto_op **ops, uint16_t nb_ops)
}
if (op[0]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[0]->sym->session =
- (void *)op[0]->sym->session->opaque_data;
+ op[0]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[0]->sym->session);
if (op[1]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[1]->sym->session =
- (void *)op[1]->sym->session->opaque_data;
+ op[1]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[1]->sym->session);
if (op[2]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[2]->sym->session =
- (void *)op[2]->sym->session->opaque_data;
+ op[2]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[2]->sym->session);
if (op[3]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[3]->sym->session =
- (void *)op[3]->sym->session->opaque_data;
+ op[3]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[3]->sym->session);
op += 4;
n -= 4;
@@ -213,8 +213,8 @@ scheduler_retrieve_session(struct rte_crypto_op **ops, uint16_t nb_ops)
while (n--) {
if (op[0]->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- op[0]->sym->session =
- (void *)op[0]->sym->session->opaque_data;
+ op[0]->sym->session = (void *)
+ rte_cryptodev_sym_session_opaque_data_get(op[0]->sym->session);
op++;
}
}
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 6b9e57ee66..f068283290 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -951,7 +951,7 @@ virtio_crypto_sym_clear_session(
hw = dev->data->dev_private;
vq = hw->cvq;
- session = (struct virtio_crypto_session *)sess->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
VIRTIO_CRYPTO_SESSION_LOG_INFO("vq->vq_desc_head_idx = %d, "
"vq = %p", vq->vq_desc_head_idx, vq);
@@ -1318,7 +1318,7 @@ virtio_crypto_sym_configure_session(
VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid parameters");
return ret;
}
- session = (struct virtio_crypto_session *)sess->driver_priv_data;
+ session = CRYPTODEV_GET_SYM_SESS_PRIV(sess);
memset(session, 0, sizeof(struct virtio_crypto_session));
ctrl_req = &session->ctrl;
ctrl_req->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index b7f492a7f2..48b5f4ebbb 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -207,7 +207,7 @@ virtqueue_crypto_sym_enqueue_xmit(
offsetof(struct virtio_crypto_op_cookie, iv);
struct rte_crypto_sym_op *sym_op = cop->sym;
struct virtio_crypto_session *session =
- (void *)cop->sym->session->driver_priv_data;
+ CRYPTODEV_GET_SYM_SESS_PRIV(cop->sym->session);
struct virtio_crypto_op_data_req *op_data_req;
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c
index bce903e007..b17f664a5e 100644
--- a/examples/fips_validation/fips_dev_self_test.c
+++ b/examples/fips_validation/fips_dev_self_test.c
@@ -980,7 +980,7 @@ typedef int (*fips_dev_self_test_prepare_xform_t)(uint8_t,
uint32_t);
typedef int (*fips_dev_self_test_prepare_op_t)(struct rte_crypto_op *,
- struct rte_mbuf *, struct rte_cryptodev_sym_session *,
+ struct rte_mbuf *, void *,
uint32_t, struct fips_dev_self_test_vector *);
typedef int (*fips_dev_self_test_check_result_t)(struct rte_crypto_op *,
@@ -1172,7 +1172,7 @@ prepare_aead_xform(uint8_t dev_id,
static int
prepare_cipher_op(struct rte_crypto_op *op,
struct rte_mbuf *mbuf,
- struct rte_cryptodev_sym_session *session,
+ void *session,
uint32_t dir,
struct fips_dev_self_test_vector *vec)
{
@@ -1211,7 +1211,7 @@ prepare_cipher_op(struct rte_crypto_op *op,
static int
prepare_auth_op(struct rte_crypto_op *op,
struct rte_mbuf *mbuf,
- struct rte_cryptodev_sym_session *session,
+ void *session,
uint32_t dir,
struct fips_dev_self_test_vector *vec)
{
@@ -1250,7 +1250,7 @@ prepare_auth_op(struct rte_crypto_op *op,
static int
prepare_aead_op(struct rte_crypto_op *op,
struct rte_mbuf *mbuf,
- struct rte_cryptodev_sym_session *session,
+ void *session,
uint32_t dir,
struct fips_dev_self_test_vector *vec)
{
@@ -1462,7 +1462,7 @@ run_single_test(uint8_t dev_id,
uint32_t negative_test)
{
struct rte_crypto_sym_xform xform;
- struct rte_cryptodev_sym_session *sess;
+ void *sess;
uint16_t n_deqd;
uint8_t key[256];
int ret;
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index f518a0f89b..bf10364b66 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -132,6 +132,38 @@ struct cryptodev_driver {
uint8_t id;
};
+/** Cryptodev symmetric crypto session
+ * Each session is derived from a fixed xform chain. Therefore each session
+ * has a fixed algo, key, op-type, digest_len etc.
+ */
+struct rte_cryptodev_sym_session {
+ RTE_MARKER cacheline0;
+ uint64_t opaque_data;
+ /**< Can be used for external metadata */
+ uint32_t sess_data_sz;
+ /**< Pointer to the user data stored after sess data */
+ uint16_t user_data_sz;
+ /**< Session user data will be placed after sess data */
+ uint8_t driver_id;
+ /**< Driver id to get the session priv */
+ rte_iova_t driver_priv_data_iova;
+ /**< Session driver data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ /**< Second cache line - start of the driver session data */
+ uint8_t driver_priv_data[0];
+ /**< Driver specific session data, variable size */
+};
+
+/**
+ * Helper macro to get driver private data
+ */
+#define CRYPTODEV_GET_SYM_SESS_PRIV(s) \
+ ((void *)(((struct rte_cryptodev_sym_session *)s)->driver_priv_data))
+#define CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(s) \
+ (((struct rte_cryptodev_sym_session *)s)->driver_priv_data_iova)
+
+
/**
* Get the rte_cryptodev structure device pointer for the device. Assumes a
* valid device index.
diff --git a/lib/cryptodev/rte_crypto.h b/lib/cryptodev/rte_crypto.h
index 6dfca2c169..f9644d29ec 100644
--- a/lib/cryptodev/rte_crypto.h
+++ b/lib/cryptodev/rte_crypto.h
@@ -430,8 +430,7 @@ rte_crypto_op_sym_xforms_alloc(struct rte_crypto_op *op, uint8_t nb_xforms)
* @param sess cryptodev session
*/
static inline int
-rte_crypto_op_attach_sym_session(struct rte_crypto_op *op,
- struct rte_cryptodev_sym_session *sess)
+rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, void *sess)
{
if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC))
return -1;
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index daa090b978..84deecac48 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -580,8 +580,6 @@ struct rte_crypto_sym_xform {
};
};
-struct rte_cryptodev_sym_session;
-
/**
* Symmetric Cryptographic Operation.
*
@@ -618,7 +616,7 @@ struct rte_crypto_sym_op {
RTE_STD_C11
union {
- struct rte_cryptodev_sym_session *session;
+ void *session;
/**< Handle for the initialised session context */
struct rte_crypto_sym_xform *xform;
/**< Session-less API crypto operation parameters */
@@ -923,8 +921,7 @@ __rte_crypto_sym_op_sym_xforms_alloc(struct rte_crypto_sym_op *sym_op,
* @param sess cryptodev session
*/
static inline int
-__rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op,
- struct rte_cryptodev_sym_session *sess)
+__rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op, void *sess)
{
sym_op->session = sess;
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index a326eb0e17..9ec015df8a 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -1950,11 +1950,11 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
}
int
-rte_cryptodev_sym_session_free(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_free(uint8_t dev_id, void *_sess)
{
struct rte_cryptodev *dev;
struct rte_mempool *sess_mp;
+ struct rte_cryptodev_sym_session *sess = _sess;
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
if (sess == NULL)
@@ -2069,10 +2069,11 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
}
int
-rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess, void *data,
+rte_cryptodev_sym_session_set_user_data(void *_sess, void *data,
uint16_t size)
{
+ struct rte_cryptodev_sym_session *sess = _sess;
+
if (sess == NULL)
return -EINVAL;
@@ -2084,8 +2085,10 @@ rte_cryptodev_sym_session_set_user_data(
}
void *
-rte_cryptodev_sym_session_get_user_data(struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_get_user_data(void *_sess)
{
+ struct rte_cryptodev_sym_session *sess = _sess;
+
if (sess == NULL || sess->user_data_sz == 0)
return NULL;
@@ -2129,10 +2132,11 @@ sym_crypto_fill_status(struct rte_crypto_sym_vec *vec, int32_t errnum)
uint32_t
rte_cryptodev_sym_cpu_crypto_process(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs,
+ void *_sess, union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
struct rte_cryptodev *dev;
+ struct rte_cryptodev_sym_session *sess = _sess;
if (!rte_cryptodev_is_valid_dev(dev_id)) {
sym_crypto_fill_status(vec, EINVAL);
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 0c65958f25..8b6a7a5c1d 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -902,28 +902,6 @@ struct rte_cryptodev_cb_rcu {
void *
rte_cryptodev_get_sec_ctx(uint8_t dev_id);
-/** Cryptodev symmetric crypto session
- * Each session is derived from a fixed xform chain. Therefore each session
- * has a fixed algo, key, op-type, digest_len etc.
- */
-struct rte_cryptodev_sym_session {
- RTE_MARKER cacheline0;
- uint8_t driver_id;
- uint64_t opaque_data;
- /**< Can be used for external metadata */
- uint32_t sess_data_sz;
- /**< Pointer to the user data stored after sess data */
- uint16_t user_data_sz;
- /**< session user data will be placed after sess data */
- rte_iova_t driver_priv_data_iova;
- /**< session driver data IOVA address */
-
- RTE_MARKER cacheline1 __rte_cache_min_aligned;
- /**< second cache line - start of the driver session data */
- uint8_t driver_priv_data[0];
- /**< Driver specific session data, variable size */
-};
-
/**
* Create a symmetric session mempool.
*
@@ -1036,7 +1014,7 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
*/
int
rte_cryptodev_sym_session_free(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess);
+ void *sess);
/**
* Clears and frees asymmetric crypto session header and private data,
@@ -1136,11 +1114,31 @@ const char *rte_cryptodev_driver_name_get(uint8_t driver_id);
*/
__rte_experimental
int
-rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess,
+rte_cryptodev_sym_session_set_user_data(void *sess,
void *data,
uint16_t size);
+#define CRYPTO_SESS_OPAQUE_DATA_OFF 0
+/**
+ * Get opaque data from session handle
+ */
+static inline uint64_t
+rte_cryptodev_sym_session_opaque_data_get(void *sess)
+{
+ return *((uint64_t *)sess + CRYPTO_SESS_OPAQUE_DATA_OFF);
+}
+
+/**
+ * Set opaque data in session handle
+ */
+static inline void
+rte_cryptodev_sym_session_opaque_data_set(void *sess, uint64_t opaque)
+{
+ uint64_t *data;
+ data = (((uint64_t *)sess) + CRYPTO_SESS_OPAQUE_DATA_OFF);
+ *data = opaque;
+}
+
/**
* Get user data stored in a session.
*
@@ -1153,8 +1151,7 @@ rte_cryptodev_sym_session_set_user_data(
*/
__rte_experimental
void *
-rte_cryptodev_sym_session_get_user_data(
- struct rte_cryptodev_sym_session *sess);
+rte_cryptodev_sym_session_get_user_data(void *sess);
/**
* Store user data in an asymmetric session.
@@ -1202,7 +1199,7 @@ rte_cryptodev_asym_session_get_user_data(void *sess);
__rte_experimental
uint32_t
rte_cryptodev_sym_cpu_crypto_process(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs,
+ void *sess, union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec);
/**
@@ -1244,8 +1241,7 @@ rte_cryptodev_session_event_mdata_set(uint8_t dev_id, void *sess,
* Union of different crypto session types, including session-less xform
* pointer.
*/
-union rte_cryptodev_session_ctx {
- struct rte_cryptodev_sym_session *crypto_sess;
+union rte_cryptodev_session_ctx {void *crypto_sess;
struct rte_crypto_sym_xform *xform;
struct rte_security_session *sec_sess;
};
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index 055c44fb22..7b4ec5c389 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -73,14 +73,10 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_create,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, void *xforms,
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id, void *sess, void *xforms,
void *mempool),
rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
- rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u8(sess->driver_id);
- rte_trace_point_emit_u16(sess->user_data_sz);
rte_trace_point_emit_ptr(xforms);
rte_trace_point_emit_ptr(mempool);
)
@@ -108,7 +104,7 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_free,
- RTE_TRACE_POINT_ARGS(struct rte_cryptodev_sym_session *sess),
+ RTE_TRACE_POINT_ARGS(void *sess),
rte_trace_point_emit_ptr(sess);
)
diff --git a/lib/ipsec/rte_ipsec_group.h b/lib/ipsec/rte_ipsec_group.h
index 62c2bd7217..a4e0e128f8 100644
--- a/lib/ipsec/rte_ipsec_group.h
+++ b/lib/ipsec/rte_ipsec_group.h
@@ -45,14 +45,15 @@ static inline struct rte_ipsec_session *
rte_ipsec_ses_from_crypto(const struct rte_crypto_op *cop)
{
const struct rte_security_session *ss;
- const struct rte_cryptodev_sym_session *cs;
+ void *cs;
if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
ss = cop->sym[0].sec_session;
return (struct rte_ipsec_session *)(uintptr_t)ss->opaque_data;
} else if (cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
cs = cop->sym[0].session;
- return (struct rte_ipsec_session *)(uintptr_t)cs->opaque_data;
+ return (struct rte_ipsec_session *)(uintptr_t)
+ rte_cryptodev_sym_session_opaque_data_get(cs);
}
return NULL;
}
diff --git a/lib/ipsec/ses.c b/lib/ipsec/ses.c
index 3d51ac4986..0d3c932302 100644
--- a/lib/ipsec/ses.c
+++ b/lib/ipsec/ses.c
@@ -45,7 +45,8 @@ rte_ipsec_session_prepare(struct rte_ipsec_session *ss)
ss->pkt_func = fp;
if (ss->type == RTE_SECURITY_ACTION_TYPE_NONE)
- ss->crypto.ses->opaque_data = (uintptr_t)ss;
+ rte_cryptodev_sym_session_opaque_data_set(ss->crypto.ses,
+ (uintptr_t)ss);
else
ss->security.ses->opaque_data = (uintptr_t)ss;
--
2.25.1
^ permalink raw reply [relevance 1%]
* [PATCH v3 1/6] cryptodev: rework session framework
@ 2022-09-24 16:35 1% ` Akhil Goyal
2022-09-24 16:35 1% ` [PATCH v3 3/6] cryptodev: hide sym session structure Akhil Goyal
` (2 subsequent siblings)
3 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-24 16:35 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, pablo.de.lara.guarch, matan,
g.singh, qiming.yang, wenjun1.wu, jianwang, jingjing.wu,
beilei.xing, ndabilpuram, roy.fan.zhang, Akhil Goyal, Kai Ji,
David Coyle, Kevin O'Sullivan
As per current design, rte_cryptodev_sym_session_create() and
rte_cryptodev_sym_session_init() use separate mempool objects
for a single session.
And structure rte_cryptodev_sym_session is not directly used
by the application, it may cause ABI breakage if the structure
is modified in future.
To address these two issues, the rte_cryptodev_sym_session_create
will take one mempool object that the session and session private
data are virtually/physically contiguous, and initializes both
fields. The API rte_cryptodev_sym_session_init is removed.
rte_cryptodev_sym_session_create will now return an opaque session
pointer which will be used by the app and other APIs.
In data path, opaque session pointer is attached to rte_crypto_op
and the PMD can call an internal library API to get the session
private data pointer based on the driver id.
Note: currently single session may be used by different device
drivers, given it is initialized by them. After the change the
session created by one device driver cannot be used or
reinitialized by another driver.
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Tested-by: Gagandeep Singh <g.singh@nxp.com>
Tested-by: David Coyle <david.coyle@intel.com>
Tested-by: Kevin O'Sullivan <kevin.osullivan@intel.com>
---
app/test-crypto-perf/cperf_ops.c | 21 +-
app/test-crypto-perf/cperf_test_latency.c | 6 +-
.../cperf_test_pmd_cyclecount.c | 5 +-
app/test-crypto-perf/cperf_test_throughput.c | 6 +-
app/test-crypto-perf/cperf_test_verify.c | 6 +-
app/test-crypto-perf/main.c | 29 +-
app/test-eventdev/test_perf_common.c | 35 +-
app/test-eventdev/test_perf_common.h | 1 -
app/test/test_cryptodev.c | 302 +++++-------------
app/test/test_cryptodev_blockcipher.c | 16 +-
app/test/test_event_crypto_adapter.c | 35 +-
app/test/test_ipsec.c | 42 +--
drivers/crypto/armv8/rte_armv8_pmd.c | 21 +-
drivers/crypto/armv8/rte_armv8_pmd_ops.c | 32 +-
drivers/crypto/bcmfs/bcmfs_sym_session.c | 38 +--
drivers/crypto/bcmfs/bcmfs_sym_session.h | 3 +-
drivers/crypto/caam_jr/caam_jr.c | 28 +-
drivers/crypto/ccp/ccp_crypto.c | 58 +---
drivers/crypto/ccp/ccp_pmd_ops.c | 32 +-
drivers/crypto/ccp/ccp_pmd_private.h | 2 -
drivers/crypto/ccp/rte_ccp_pmd.c | 29 +-
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 36 +--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 31 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 55 +---
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 14 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 31 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 3 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 37 +--
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 4 +-
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 34 +-
drivers/crypto/ipsec_mb/ipsec_mb_private.h | 41 ++-
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 48 +--
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 36 +--
drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 4 -
drivers/crypto/ipsec_mb/pmd_kasumi.c | 10 +-
drivers/crypto/ipsec_mb/pmd_snow3g.c | 9 +-
drivers/crypto/ipsec_mb/pmd_zuc.c | 4 -
drivers/crypto/mlx5/mlx5_crypto.c | 26 +-
drivers/crypto/mvsam/rte_mrvl_pmd.c | 8 +-
drivers/crypto/mvsam/rte_mrvl_pmd_ops.c | 21 +-
drivers/crypto/nitrox/nitrox_sym.c | 39 +--
drivers/crypto/null/null_crypto_pmd.c | 19 +-
drivers/crypto/null/null_crypto_pmd_ops.c | 33 +-
drivers/crypto/null/null_crypto_pmd_private.h | 2 -
.../crypto/octeontx/otx_cryptodev_hw_access.h | 1 -
drivers/crypto/octeontx/otx_cryptodev_ops.c | 67 +---
drivers/crypto/openssl/openssl_pmd_private.h | 2 -
drivers/crypto/openssl/rte_openssl_pmd.c | 24 +-
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 29 +-
drivers/crypto/qat/qat_sym.c | 10 +-
drivers/crypto/qat/qat_sym.h | 4 +-
drivers/crypto/qat/qat_sym_session.c | 40 +--
drivers/crypto/qat/qat_sym_session.h | 6 +-
drivers/crypto/scheduler/scheduler_pmd_ops.c | 38 +--
drivers/crypto/virtio/virtio_cryptodev.c | 40 +--
drivers/crypto/virtio/virtio_rxtx.c | 3 +-
examples/fips_validation/fips_dev_self_test.c | 30 +-
examples/fips_validation/main.c | 35 +-
examples/ipsec-secgw/ipsec-secgw.c | 10 +-
examples/ipsec-secgw/ipsec.c | 7 +-
examples/l2fwd-crypto/main.c | 54 +---
examples/vhost_crypto/main.c | 16 +-
lib/cryptodev/cryptodev_pmd.h | 28 +-
lib/cryptodev/cryptodev_trace_points.c | 6 -
lib/cryptodev/rte_cryptodev.c | 276 ++++++----------
lib/cryptodev/rte_cryptodev.h | 123 ++-----
lib/cryptodev/rte_cryptodev_trace.h | 33 +-
lib/cryptodev/version.map | 6 -
lib/pipeline/rte_table_action.c | 10 +-
lib/vhost/rte_vhost_crypto.h | 3 -
lib/vhost/vhost_crypto.c | 28 +-
71 files changed, 551 insertions(+), 1670 deletions(-)
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index d746d51082..c6f5735bb0 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -912,7 +912,6 @@ cperf_create_session(struct rte_mempool *sess_mp,
&sess_conf, sess_mp, priv_mp);
}
#endif
- sess = rte_cryptodev_sym_session_create(sess_mp);
/*
* cipher only
*/
@@ -937,8 +936,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
cipher_xform.cipher.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &cipher_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &cipher_xform,
+ sess_mp);
/*
* auth only
*/
@@ -965,8 +964,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
auth_xform.auth.iv.length = 0;
}
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id, sess, &auth_xform,
- priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &auth_xform,
+ sess_mp);
/*
* cipher and auth
*/
@@ -1024,13 +1023,13 @@ cperf_create_session(struct rte_mempool *sess_mp,
if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
cipher_xform.next = &auth_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &cipher_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &cipher_xform, sess_mp);
} else { /* auth then cipher */
auth_xform.next = &cipher_xform;
/* create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &auth_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id,
+ &auth_xform, sess_mp);
}
} else { /* options->op_type == CPERF_AEAD */
aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
@@ -1050,8 +1049,8 @@ cperf_create_session(struct rte_mempool *sess_mp,
options->aead_aad_sz;
/* Create crypto session */
- rte_cryptodev_sym_session_init(dev_id,
- sess, &aead_xform, priv_mp);
+ sess = rte_cryptodev_sym_session_create(dev_id, &aead_xform,
+ sess_mp);
}
return sess;
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index 6f972cea49..afd8cb209b 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -44,10 +44,8 @@ static void
cperf_latency_test_free(struct cperf_latency_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 3f2da13d3a..edd2730b73 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -74,10 +74,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
(struct rte_security_session *)ctx->sess);
} else
#endif
- {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index fba66bbde9..fa13915dc3 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -52,10 +52,8 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
(struct rte_security_session *)ctx->sess);
}
#endif
- else {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ else
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
}
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index b691595675..c1465db243 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -39,10 +39,8 @@ static void
cperf_verify_test_free(struct cperf_verify_ctx *ctx)
{
if (ctx) {
- if (ctx->sess) {
- rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);
- rte_cryptodev_sym_session_free(ctx->sess);
- }
+ if (ctx->sess)
+ rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess);
rte_mempool_free(ctx->pool);
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 27acd619bc..3469b836e1 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -97,35 +97,14 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
char mp_name[RTE_MEMPOOL_NAMESIZE];
struct rte_mempool *sess_mp;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- sess_mp = rte_mempool_create(mp_name,
- nb_sessions,
- session_priv_size,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (sess_mp == NULL) {
- printf("Cannot create pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- session_pool_socket[socket_id].priv_mp = sess_mp;
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
sess_mp = rte_cryptodev_sym_session_pool_create(mp_name,
- nb_sessions, 0, 0, 0, socket_id);
+ nb_sessions, session_priv_size, 0, 0,
+ socket_id);
if (sess_mp == NULL) {
printf("Cannot create pool \"%s\" on socket %d\n",
@@ -136,6 +115,7 @@ fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
printf("Allocated pool \"%s\" on socket %d\n",
mp_name, socket_id);
session_pool_socket[socket_id].sess_mp = sess_mp;
+ session_pool_socket[socket_id].priv_mp = sess_mp;
}
return 0;
@@ -323,12 +303,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
return ret;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
if (opts->op_type == CPERF_ASYM_MODEX) {
qp_conf.mp_session = NULL;
- qp_conf.mp_session_private = NULL;
}
ret = rte_cryptodev_configure(cdev_id, &conf);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index 81420be73a..30cefcb6dd 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -864,18 +864,13 @@ cryptodev_sym_sess_create(struct prod_data *p, struct test_perf *t)
cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
cipher_xform.next = NULL;
- sess = rte_cryptodev_sym_session_create(t->ca_sess_pool);
+ sess = rte_cryptodev_sym_session_create(p->ca.cdev_id, &cipher_xform,
+ t->ca_sess_pool);
if (sess == NULL) {
evt_err("Failed to create sym session");
return NULL;
}
- if (rte_cryptodev_sym_session_init(p->ca.cdev_id, sess, &cipher_xform,
- t->ca_sess_priv_pool)) {
- evt_err("Failed to init session");
- return NULL;
- }
-
return sess;
}
@@ -1382,15 +1377,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
goto err;
}
- t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
- "ca_sess_pool", nb_sessions, 0, 0,
- sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
- if (t->ca_sess_pool == NULL) {
- evt_err("Failed to create sym session pool");
- ret = -ENOMEM;
- goto err;
- }
-
max_session_size = 0;
for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
unsigned int session_size;
@@ -1401,12 +1387,11 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
max_session_size = session_size;
}
- max_session_size += sizeof(union rte_event_crypto_metadata);
- t->ca_sess_priv_pool = rte_mempool_create(
- "ca_sess_priv_pool", nb_sessions, max_session_size, 0, 0, NULL,
- NULL, NULL, NULL, SOCKET_ID_ANY, 0);
- if (t->ca_sess_priv_pool == NULL) {
- evt_err("failed to create sym session private pool");
+ t->ca_sess_pool = rte_cryptodev_sym_session_pool_create(
+ "ca_sess_pool", nb_sessions, max_session_size, 0,
+ sizeof(union rte_event_crypto_metadata), SOCKET_ID_ANY);
+ if (t->ca_sess_pool == NULL) {
+ evt_err("Failed to create sym session pool");
ret = -ENOMEM;
goto err;
}
@@ -1446,7 +1431,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
qp_conf.nb_descriptors = NB_CRYPTODEV_DESCRIPTORS;
qp_conf.mp_session = t->ca_sess_pool;
- qp_conf.mp_session_private = t->ca_sess_priv_pool;
for (qp_id = 0; qp_id < conf.nb_queue_pairs; qp_id++) {
ret = rte_cryptodev_queue_pair_setup(
@@ -1467,7 +1451,6 @@ perf_cryptodev_setup(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
return ret;
@@ -1492,8 +1475,7 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
for (flow_id = 0; flow_id < t->nb_flows; flow_id++) {
sess = p->ca.crypto_sess[flow_id];
cdev_id = p->ca.cdev_id;
- rte_cryptodev_sym_session_clear(cdev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(cdev_id, sess);
}
rte_event_crypto_adapter_queue_pair_del(
@@ -1509,7 +1491,6 @@ perf_cryptodev_destroy(struct evt_test *test, struct evt_options *opt)
rte_mempool_free(t->ca_op_pool);
rte_mempool_free(t->ca_sess_pool);
- rte_mempool_free(t->ca_sess_priv_pool);
rte_mempool_free(t->ca_asym_sess_pool);
}
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index 8cbd06fe42..d06d52cdf8 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -70,7 +70,6 @@ struct test_perf {
RTE_EVENT_TIMER_ADAPTER_NUM_MAX] __rte_cache_aligned;
struct rte_mempool *ca_op_pool;
struct rte_mempool *ca_sess_pool;
- struct rte_mempool *ca_sess_priv_pool;
struct rte_mempool *ca_asym_sess_pool;
} __rte_cache_aligned;
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 0c39b16b71..f5fef10696 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -13,6 +13,7 @@
#include <rte_pause.h>
#include <rte_bus_vdev.h>
#include <rte_ether.h>
+#include <rte_errno.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
@@ -644,23 +645,17 @@ testsuite_setup(void)
}
ts_params->session_mpool = rte_cryptodev_sym_session_pool_create(
- "test_sess_mp", MAX_NB_SESSIONS, 0, 0, 0,
+ "test_sess_mp", MAX_NB_SESSIONS, session_size, 0, 0,
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
-
ts_params->session_priv_mpool = rte_mempool_create(
- "test_sess_mp_priv",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
+ "test_sess_mp_priv", MAX_NB_SESSIONS, session_size,
+ 0, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
+
TEST_ASSERT_NOT_NULL(ts_params->session_priv_mpool,
"session mempool allocation failed");
-
-
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
&ts_params->conf),
"Failed to configure cryptodev %u with %u qps",
@@ -668,7 +663,6 @@ testsuite_setup(void)
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -697,15 +691,11 @@ testsuite_teardown(void)
rte_mempool_avail_count(ts_params->op_mpool));
}
- /* Free session mempools */
- if (ts_params->session_priv_mpool != NULL) {
- rte_mempool_free(ts_params->session_priv_mpool);
- ts_params->session_priv_mpool = NULL;
- }
-
if (ts_params->session_mpool != NULL) {
rte_mempool_free(ts_params->session_mpool);
ts_params->session_mpool = NULL;
+ rte_mempool_free(ts_params->session_priv_mpool);
+ ts_params->session_priv_mpool = NULL;
}
res = rte_cryptodev_close(ts_params->valid_devs[0]);
@@ -1392,7 +1382,6 @@ dev_configure_and_start(uint64_t ff_disable)
ts_params->conf.ff_disable = ff_disable;
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
&ts_params->conf),
@@ -1452,10 +1441,8 @@ ut_teardown(void)
#endif
{
if (ut_params->sess) {
- rte_cryptodev_sym_session_clear(
- ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
- rte_cryptodev_sym_session_free(ut_params->sess);
ut_params->sess = NULL;
}
}
@@ -1610,7 +1597,6 @@ test_queue_pair_descriptor_setup(void)
*/
qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -2155,8 +2141,6 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
-
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2201,18 +2185,11 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- /* Create crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ if (rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -2441,7 +2418,6 @@ create_wireless_algo_hash_session(uint8_t dev_id,
enum rte_crypto_auth_algorithm algo)
{
uint8_t hash_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2461,16 +2437,11 @@ create_wireless_algo_hash_session(uint8_t dev_id,
ut_params->auth_xform.auth.digest_length = auth_len;
ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
ut_params->auth_xform.auth.iv.length = iv_len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2483,7 +2454,6 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
uint8_t iv_len)
{
uint8_t cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2503,16 +2473,12 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session */
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2590,7 +2556,6 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
{
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2625,17 +2590,12 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2649,7 +2609,6 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
{
const uint8_t key_len = tdata->key.len;
uint8_t cipher_auth_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2689,16 +2648,11 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -2724,7 +2678,6 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
uint8_t cipher_iv_len)
{
uint8_t auth_cipher_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2755,26 +2708,19 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
if (cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
ut_params->auth_xform.next = NULL;
ut_params->cipher_xform.next = &ut_params->auth_xform;
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->cipher_xform, ts_params->session_mpool);
} else
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -8205,7 +8151,6 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
uint8_t iv_len)
{
uint8_t aead_key[key_len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -8227,15 +8172,12 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->aead_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->aead_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -8679,7 +8621,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
/* Create security session */
ut_params->sec_session = rte_security_session_create(ctx,
&sess_conf, ts_params->session_mpool,
- ts_params->session_priv_mpool);
+ NULL);
if (!ut_params->sec_session) {
printf("TestCase %s()-%d line %d failed %s: ",
@@ -12029,7 +11971,6 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
const struct HMAC_MD5_vector *test_case)
{
uint8_t key[64];
- int status;
memcpy(key, test_case->key.data, test_case->key.len);
@@ -12044,16 +11985,11 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
ut_params->auth_xform.auth.key.data = key;
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- if (ut_params->sess == NULL)
- return TEST_FAILED;
-
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -12261,12 +12197,9 @@ test_multi_session(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
-
struct rte_cryptodev_info dev_info;
struct rte_cryptodev_sym_session **sessions;
-
uint16_t i;
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12293,20 +12226,15 @@ test_multi_session(void)
/* Create multiple crypto sessions*/
for (i = 0; i < MAX_NB_SESSIONS; i++) {
-
sessions[i] = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
+
TEST_ASSERT_NOT_NULL(sessions[i],
"Session creation failed at session number %u",
i);
-
- status = rte_cryptodev_sym_session_init(
- ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
/* Attempt to send a request on each session */
TEST_ASSERT_SUCCESS( test_AES_CBC_HMAC_SHA512_decrypt_perform(
sessions[i],
@@ -12336,18 +12264,9 @@ test_multi_session(void)
}
}
- sessions[i] = NULL;
- /* Next session create should fail */
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- sessions[i], &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NULL(sessions[i],
- "Session creation succeeded unexpectedly!");
-
for (i = 0; i < MAX_NB_SESSIONS; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12398,7 +12317,6 @@ test_multi_session_random_usage(void)
},
};
- int status;
/* Verify the capabilities */
struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12420,11 +12338,6 @@ test_multi_session_random_usage(void)
* MAX_NB_SESSIONS) + 1, 0);
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- sessions[i] = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(sessions[i],
- "Session creation failed at session number %u",
- i);
rte_memcpy(&ut_paramz[i].ut_params, &unittest_params,
sizeof(struct crypto_unittest_params));
@@ -12434,16 +12347,16 @@ test_multi_session_random_usage(void)
ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
/* Create multiple crypto sessions*/
- status = rte_cryptodev_sym_session_init(
+ sessions[i] = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0],
- sessions[i],
&ut_paramz[i].ut_params.auth_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ts_params->session_mpool);
+ if (sessions[i] == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(sessions[i],
+ "Session creation failed at session number %u",
+ i);
}
srand(time(NULL));
@@ -12481,9 +12394,8 @@ test_multi_session_random_usage(void)
}
for (i = 0; i < MB_SESSION_NUMBER; i++) {
- rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
sessions[i]);
- rte_cryptodev_sym_session_free(sessions[i]);
}
rte_free(sessions);
@@ -12501,7 +12413,6 @@ test_null_invalid_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int ret;
/* This test is for NULL PMD only */
if (gbl_driver_id != rte_cryptodev_driver_id_get(
@@ -12515,17 +12426,13 @@ test_null_invalid_operation(void)
ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
-
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.next = NULL;
@@ -12533,14 +12440,11 @@ test_null_invalid_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+ /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
+ TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
return TEST_SUCCESS;
@@ -12554,7 +12458,6 @@ test_null_burst_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- int status;
unsigned i, burst_len = NULL_BURST_LENGTH;
@@ -12580,19 +12483,14 @@ test_null_burst_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
/* Create Crypto session*/
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0],
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
@@ -12703,7 +12601,6 @@ test_enq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12803,7 +12700,6 @@ test_deq_callback_setup(void)
qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
qp_conf.mp_session = ts_params->session_mpool;
- qp_conf.mp_session_private = ts_params->session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
@@ -12990,7 +12886,6 @@ static int create_gmac_session(uint8_t dev_id,
enum rte_crypto_auth_operation auth_op)
{
uint8_t auth_key[tdata->key.len];
- int status;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -13009,15 +12904,13 @@ static int create_gmac_session(uint8_t dev_id,
ut_params->auth_xform.auth.iv.length = tdata->iv.len;
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+ &ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- return status;
+ return 0;
}
static int
@@ -13646,7 +13539,6 @@ create_auth_session(struct crypto_unittest_params *ut_params,
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -13660,15 +13552,13 @@ create_auth_session(struct crypto_unittest_params *ut_params,
ut_params->auth_xform.auth.digest_length = reference->digest.len;
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -13681,7 +13571,6 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
- int status;
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -13713,15 +13602,13 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
}
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform,
- ts_params->session_priv_mpool);
+ ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
- return status;
+ return 0;
}
static int
@@ -14179,7 +14066,6 @@ test_authenticated_encrypt_with_esn(
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
struct rte_cryptodev_info dev_info;
- int status;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -14230,19 +14116,12 @@ test_authenticated_encrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- status = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
-
- if (status == -ENOTSUP)
- return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(status, 0, "Session init failed");
-
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
"Failed to allocate input buffer in mempool");
@@ -14366,18 +14245,11 @@ test_authenticated_decrypt_with_esn(
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- retval = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->auth_xform,
- ts_params->session_priv_mpool);
-
- if (retval == -ENOTSUP)
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
-
- TEST_ASSERT_EQUAL(retval, 0, "Session init failed");
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
TEST_ASSERT_NOT_NULL(ut_params->ibuf,
@@ -15125,8 +14997,8 @@ test_scheduler_attach_worker_op(void)
ts_params->session_mpool =
rte_cryptodev_sym_session_pool_create(
"test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0,
- SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, session_size,
+ 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
"session mempool allocation failed");
}
@@ -15149,8 +15021,6 @@ test_scheduler_attach_worker_op(void)
}
ts_params->qp_conf.mp_session = ts_params->session_mpool;
- ts_params->qp_conf.mp_session_private =
- ts_params->session_priv_mpool;
ret = rte_cryptodev_scheduler_worker_attach(sched_id,
(uint8_t)i);
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index b5813b956f..4fcdd55660 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -68,7 +68,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
struct rte_mempool *sess_mpool,
- struct rte_mempool *sess_priv_mpool,
uint8_t dev_id,
char *test_msg)
{
@@ -514,11 +513,9 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
*/
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) &&
nb_iterates == 0) {
- sess = rte_cryptodev_sym_session_create(sess_mpool);
-
- status = rte_cryptodev_sym_session_init(dev_id, sess,
- init_xform, sess_priv_mpool);
- if (status == -ENOTSUP) {
+ sess = rte_cryptodev_sym_session_create(dev_id, init_xform,
+ sess_mpool);
+ if (sess == NULL) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "UNSUPPORTED");
status = TEST_SKIPPED;
goto error_exit;
@@ -801,10 +798,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
error_exit:
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- if (sess) {
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
- }
+ if (sess)
+ rte_cryptodev_sym_session_free(dev_id, sess);
rte_free(cipher_xform);
rte_free(auth_xform);
}
@@ -829,7 +824,6 @@ blockcipher_test_case_run(const void *data)
p_testsuite_params->mbuf_pool,
p_testsuite_params->op_mpool,
p_testsuite_params->session_mpool,
- p_testsuite_params->session_priv_mpool,
p_testsuite_params->valid_devs[0],
test_msg);
return status;
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 2ecc7e2cea..c6cf9c5401 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -157,7 +157,6 @@ struct event_crypto_adapter_test_params {
struct rte_mempool *op_mpool;
struct rte_mempool *asym_op_mpool;
struct rte_mempool *session_mpool;
- struct rte_mempool *session_priv_mpool;
struct rte_mempool *asym_sess_mpool;
struct rte_cryptodev_config *config;
uint8_t crypto_event_port_id;
@@ -307,15 +306,10 @@ test_op_forward_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
-
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
&cap);
TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
@@ -683,8 +677,8 @@ test_op_new_mode(uint8_t session_less)
sym_op = op->sym;
if (!session_less) {
- sess = rte_cryptodev_sym_session_create(
- params.session_mpool);
+ sess = rte_cryptodev_sym_session_create(TEST_CDEV_ID,
+ &cipher_xform, params.session_mpool);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
@@ -699,9 +693,6 @@ test_op_new_mode(uint8_t session_less)
RTE_CRYPTO_OP_WITH_SESSION,
&m_data, sizeof(m_data));
}
- ret = rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,
- &cipher_xform, params.session_priv_mpool);
- TEST_ASSERT_SUCCESS(ret, "Failed to init session\n");
rte_crypto_op_attach_sym_session(op, sess);
} else {
@@ -994,22 +985,12 @@ configure_cryptodev(void)
params.session_mpool = rte_cryptodev_sym_session_pool_create(
"CRYPTO_ADAPTER_SESSION_MP",
- MAX_NB_SESSIONS, 0, 0,
+ MAX_NB_SESSIONS, session_size, 0,
sizeof(union rte_event_crypto_metadata),
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(params.session_mpool,
"session mempool allocation failed\n");
- params.session_priv_mpool = rte_mempool_create(
- "CRYPTO_AD_SESS_MP_PRIV",
- MAX_NB_SESSIONS,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
- TEST_ASSERT_NOT_NULL(params.session_priv_mpool,
- "session mempool allocation failed\n");
-
rte_cryptodev_info_get(TEST_CDEV_ID, &info);
while ((capability = &info.capabilities[i++])->op !=
@@ -1048,7 +1029,6 @@ configure_cryptodev(void)
qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
qp_conf.mp_session = params.session_mpool;
- qp_conf.mp_session_private = params.session_priv_mpool;
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf,
@@ -1410,11 +1390,6 @@ crypto_teardown(void)
rte_mempool_free(params.session_mpool);
params.session_mpool = NULL;
}
- if (params.session_priv_mpool != NULL) {
- rte_mempool_avail_count(params.session_priv_mpool);
- rte_mempool_free(params.session_priv_mpool);
- params.session_priv_mpool = NULL;
- }
/* Free asym session mempool */
if (params.asym_sess_mpool != NULL) {
diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index aa533483fd..04d231468b 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -370,20 +370,9 @@ testsuite_setup(void)
return TEST_FAILED;
}
- ts_params->qp_conf.mp_session_private = rte_mempool_create(
- "test_priv_sess_mp",
- MAX_NB_SESSIONS,
- sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
-
- TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session_private,
- "private session mempool allocation failed");
-
ts_params->qp_conf.mp_session =
rte_cryptodev_sym_session_pool_create("test_sess_mp",
- MAX_NB_SESSIONS, 0, 0, 0, SOCKET_ID_ANY);
+ MAX_NB_SESSIONS, sess_sz, 0, 0, SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->qp_conf.mp_session,
"session mempool allocation failed");
@@ -428,11 +417,6 @@ testsuite_teardown(void)
rte_mempool_free(ts_params->qp_conf.mp_session);
ts_params->qp_conf.mp_session = NULL;
}
-
- if (ts_params->qp_conf.mp_session_private != NULL) {
- rte_mempool_free(ts_params->qp_conf.mp_session_private);
- ts_params->qp_conf.mp_session_private = NULL;
- }
}
static int
@@ -647,8 +631,7 @@ create_dummy_sec_session(struct ipsec_unitest_params *ut,
static struct rte_security_session_conf conf;
ut->ss[j].security.ses = rte_security_session_create(&dummy_sec_ctx,
- &conf, qp->mp_session,
- qp->mp_session_private);
+ &conf, qp->mp_session, NULL);
if (ut->ss[j].security.ses == NULL)
return -ENOMEM;
@@ -662,25 +645,15 @@ static int
create_crypto_session(struct ipsec_unitest_params *ut,
struct rte_cryptodev_qp_conf *qp, uint8_t dev_id, uint32_t j)
{
- int32_t rc;
struct rte_cryptodev_sym_session *s;
- s = rte_cryptodev_sym_session_create(qp->mp_session);
+ s = rte_cryptodev_sym_session_create(dev_id, ut->crypto_xforms,
+ qp->mp_session);
if (s == NULL)
return -ENOMEM;
- /* initialize SA crypto session for device */
- rc = rte_cryptodev_sym_session_init(dev_id, s,
- ut->crypto_xforms, qp->mp_session_private);
- if (rc == 0) {
- ut->ss[j].crypto.ses = s;
- return 0;
- } else {
- /* failure, do cleanup */
- rte_cryptodev_sym_session_clear(dev_id, s);
- rte_cryptodev_sym_session_free(s);
- return rc;
- }
+ ut->ss[j].crypto.ses = s;
+ return 0;
}
static int
@@ -1196,8 +1169,7 @@ static void
destroy_crypto_session(struct ipsec_unitest_params *ut,
uint8_t crypto_dev, uint32_t j)
{
- rte_cryptodev_sym_session_clear(crypto_dev, ut->ss[j].crypto.ses);
- rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses);
+ rte_cryptodev_sym_session_free(crypto_dev, ut->ss[j].crypto.ses);
memset(&ut->ss[j], 0, sizeof(ut->ss[j]));
}
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 32127a874c..75a95e3689 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -521,34 +521,23 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
/* get existing session */
if (likely(op->sym->session != NULL)) {
- sess = (struct armv8_crypto_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = op->sym->session->data;
}
} else {
/* provide internal session */
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct armv8_crypto_session *)_sess_private_data;
+ sess = (struct armv8_crypto_session *)_sess->data;
if (unlikely(armv8_crypto_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
}
if (unlikely(sess == NULL))
@@ -674,10 +663,6 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct armv8_crypto_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index c07ac0489e..176bb9e6a0 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -267,8 +267,7 @@ armv8_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -278,43 +277,22 @@ armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = sess->data;
ret = armv8_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
ARMV8_CRYPTO_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct armv8_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+armv8_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops armv8_crypto_pmd_ops = {
.dev_configure = armv8_crypto_pmd_config,
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index 675ed0ad55..d3334dc920 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -211,8 +211,7 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
} else if (likely(op->sym->session != NULL)) {
/* get existing session */
sess = (struct bcmfs_sym_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_bcmfs_driver_id);
+ op->sym->session->driver_priv_data;
}
if (sess == NULL)
@@ -222,10 +221,9 @@ bcmfs_sym_get_session(struct rte_crypto_op *op)
}
int
-bcmfs_sym_session_configure(struct rte_cryptodev *dev,
+bcmfs_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -235,45 +233,23 @@ bcmfs_sym_session_configure(struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- BCMFS_DP_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
BCMFS_DP_LOG(ERR, "Failed configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
void
-bcmfs_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp;
-
- memset(sess_priv, 0, sizeof(struct bcmfs_sym_session));
- sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+bcmfs_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
unsigned int
bcmfs_sym_session_get_private_size(struct rte_cryptodev *dev __rte_unused)
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.h b/drivers/crypto/bcmfs/bcmfs_sym_session.h
index d40595b4bd..4a0a012ae7 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.h
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.h
@@ -93,8 +93,7 @@ bcmfs_process_crypto_op(struct rte_crypto_op *op,
int
bcmfs_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
void
bcmfs_sym_session_clear(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8e9cfe73d8..a9c93dea13 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1357,8 +1357,7 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
ses = (struct caam_jr_session *)
- get_sym_session_private_data(op->sym->session,
- cryptodev_driver_id);
+ op->sym->session->driver_priv_data;
break;
case RTE_CRYPTO_OP_SECURITY_SESSION:
ses = (struct caam_jr_session *)
@@ -1692,54 +1691,39 @@ caam_jr_set_session_parameters(struct rte_cryptodev *dev,
}
static int
-caam_jr_sym_session_configure(struct rte_cryptodev *dev,
+caam_jr_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
PMD_INIT_FUNC_TRACE();
-
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CAAM_JR_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
+ sess_private_data = (void *)sess->driver_priv_data;
memset(sess_private_data, 0, sizeof(struct caam_jr_session));
ret = caam_jr_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
CAAM_JR_ERR("failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
return 0;
}
/* Clear the memory of session so it doesn't leave key material behind */
static void
-caam_jr_sym_session_clear(struct rte_cryptodev *dev,
+caam_jr_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
struct caam_jr_session *s = (struct caam_jr_session *)sess_priv;
PMD_INIT_FUNC_TRACE();
if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(struct caam_jr_session));
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4bab18323b..bd999abe61 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1585,9 +1585,7 @@ ccp_perform_hmac(struct rte_crypto_op *op,
void *append_ptr;
uint8_t *addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
addr = session->auth.pre_compute;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -1766,9 +1764,7 @@ ccp_perform_sha(struct rte_crypto_op *op,
void *append_ptr;
uint64_t auth_msg_bits;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -1859,9 +1855,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr, dest_addr_t;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2005,9 +1999,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
uint32_t tail;
phys_addr_t src_addr, dest_addr, ctx_paddr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
op->sym->auth.data.offset);
@@ -2079,9 +2071,7 @@ ccp_perform_aes_cmac(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
key_addr = rte_mem_virt2phy(session->auth.key_ccp);
src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
@@ -2242,9 +2232,7 @@ ccp_perform_aes(struct rte_crypto_op *op,
phys_addr_t src_addr, dest_addr, key_addr;
uint8_t *iv;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
function.raw = 0;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
@@ -2330,9 +2318,7 @@ ccp_perform_3des(struct rte_crypto_op *op,
uint8_t *iv;
phys_addr_t src_addr, dest_addr, key_addr;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
switch (session->cipher.um.des_mode) {
@@ -2440,9 +2426,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
phys_addr_t digest_dest_addr;
int length, non_align_len;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
key_addr = session->cipher.key_phys;
@@ -2607,9 +2591,7 @@ ccp_crypto_cipher(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->cipher.algo) {
case CCP_CIPHER_ALGO_AES_CBC:
@@ -2645,9 +2627,7 @@ ccp_crypto_auth(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_SHA1:
@@ -2715,9 +2695,7 @@ ccp_crypto_aead(struct rte_crypto_op *op,
int result = 0;
struct ccp_session *session;
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
switch (session->auth.algo) {
case CCP_AUTH_ALGO_AES_GCM:
@@ -2780,9 +2758,8 @@ process_ops_to_enqueue(struct ccp_qp *qp,
b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
Q_DESC_SIZE);
for (i = b_idx; i < (nb_ops+b_idx); i++) {
- session = (struct ccp_session *)get_sym_session_private_data(
- op[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
result = ccp_crypto_cipher(op[i], cmd_q, b_info);
@@ -2858,9 +2835,7 @@ static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
int offset, digest_offset;
uint8_t digest_le[64];
- session = (struct ccp_session *)get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)op->sym->session->driver_priv_data;
if (session->cmd_id == CCP_CMD_COMBINED) {
digest_data = op->sym->aead.digest.data;
@@ -2934,9 +2909,8 @@ ccp_prepare_ops(struct ccp_qp *qp,
for (i = b_info->b_idx; i < min_ops; i++) {
op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
- session = (struct ccp_session *)get_sym_session_private_data(
- op_d[i]->sym->session,
- ccp_cryptodev_driver_id);
+ session = (struct ccp_session *)
+ op_d[i]->sym->session->driver_priv_data;
switch (session->cmd_id) {
case CCP_CMD_CIPHER:
op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index 1b600e81ad..e401793a76 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -727,7 +727,6 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
/* mempool for batch info */
qp->batch_mp = rte_mempool_create(
@@ -757,8 +756,7 @@ ccp_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
void *sess_private_data;
@@ -769,40 +767,22 @@ ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
return -ENOMEM;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CCP_LOG_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
+
internals = (struct ccp_private *)dev->data->dev_private;
ret = ccp_set_session_parameters(sess_private_data, xform, internals);
if (ret != 0) {
CCP_LOG_ERR("failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
return 0;
}
static void
-ccp_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- if (sess_priv) {
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- rte_mempool_put(sess_mp, sess_priv);
- memset(sess_priv, 0, sizeof(struct ccp_session));
- set_sym_session_private_data(sess, index, NULL);
- }
-}
+ccp_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
struct rte_cryptodev_ops ccp_ops = {
.dev_configure = ccp_pmd_config,
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 1c4118ee3c..6704e39ab8 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -78,8 +78,6 @@ struct ccp_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_mempool *batch_mp;
/**< Session Mempool for batch info */
struct rte_cryptodev_stats qp_stats;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a35a8cd775..7502281ad9 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -56,33 +56,23 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op)
if (unlikely(op->sym->session == NULL))
return NULL;
- sess = (struct ccp_session *)
- get_sym_session_private_data(
- op->sym->session,
- ccp_cryptodev_driver_id);
+ sess = (void *)op->sym->session->driver_priv_data;
} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- void *_sess;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess;
struct ccp_private *internals;
- if (rte_mempool_get(qp->sess_mp, &_sess))
- return NULL;
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
+ if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- sess = (struct ccp_session *)_sess_private_data;
+ sess = (void *)_sess->driver_priv_data;
internals = (struct ccp_private *)qp->dev->data->dev_private;
if (unlikely(ccp_set_session_parameters(sess, op->sym->xform,
internals) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- ccp_cryptodev_driver_id,
- _sess_private_data);
+ op->sym->session = _sess;
}
return sess;
@@ -161,13 +151,10 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
for (i = 0; i < nb_dequeued; i++)
if (unlikely(ops[i]->sess_type ==
RTE_CRYPTO_OP_SESSIONLESS)) {
- struct ccp_session *sess = (struct ccp_session *)
- get_sym_session_private_data(
- ops[i]->sym->session,
- ccp_cryptodev_driver_id);
+ struct ccp_session *sess =
+ (void *)ops[i]->sym->session->driver_priv_data;
- rte_mempool_put(qp->sess_mp_priv,
- sess);
+ memset(sess, 0, sizeof(*sess));
rte_mempool_put(qp->sess_mp,
ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 586941cd70..f96e132513 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -22,24 +22,23 @@
static inline struct cnxk_se_sess *
cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn10k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
- if (ret)
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform,
+ sess);
+ if (ret) {
+ rte_mempool_put(qp->sess_mp, (void *)sess);
goto sess_put;
+ }
- priv = get_sym_session_private_data(sess, driver_id);
-
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
return priv;
@@ -111,8 +110,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
return 0;
w7 = sec_sess->sa.inst.w7;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- sess = get_sym_session_private_data(
- sym_op->session, cn10k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret))
@@ -128,8 +126,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[],
ret = cpt_sym_inst_fill(qp, op, sess, infl_req,
&inst[0]);
if (unlikely(ret)) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
return 0;
}
@@ -296,8 +293,9 @@ cn10k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn10k_cryptodev_driver_id);
+ priv = (void *)(
+ ((struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -334,8 +332,7 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn10k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
} else {
@@ -543,7 +540,6 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
{
const uint8_t uc_compcode = res->uc_compcode;
const uint8_t compcode = res->compcode;
- unsigned int sz;
cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
@@ -620,11 +616,7 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn10k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index b753c1cb4b..a44f111ba6 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -56,23 +56,20 @@ cn9k_cpt_sec_inst_fill(struct rte_crypto_op *op,
static inline struct cnxk_se_sess *
cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
- const int driver_id = cn9k_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
struct cnxk_se_sess *priv;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- if (sess == NULL)
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
return NULL;
- ret = sym_session_configure(qp->lf.roc_cpt, driver_id, sym_op->xform,
- sess, qp->sess_mp_priv);
+ ret = sym_session_configure(qp->lf.roc_cpt, sym_op->xform, sess);
if (ret)
goto sess_put;
- priv = get_sym_session_private_data(sess, driver_id);
+ priv = (void *)sess->driver_priv_data;
sym_op->session = sess;
@@ -95,8 +92,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
sym_op = op->sym;
- sess = get_sym_session_private_data(
- sym_op->session, cn9k_cryptodev_driver_id);
+ sess = (void *)sym_op->session->driver_priv_data;
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
inst->w7.u64 = sess->cpt_inst_w7;
} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
@@ -110,8 +106,7 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
ret = cpt_sym_inst_fill(qp, op, sess, infl_req, inst);
if (unlikely(ret)) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- op->sym->session);
+ sym_session_clear(op->sym->session);
rte_mempool_put(qp->sess_mp, op->sym->session);
}
inst->w7.u64 = sess->cpt_inst_w7;
@@ -349,8 +344,9 @@ cn9k_cpt_crypto_adapter_ev_mdata_set(struct rte_cryptodev *dev __rte_unused,
} else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- sess, cn9k_cryptodev_driver_id);
+ priv = (void *)((
+ (struct rte_cryptodev_sym_session *)sess)->
+ driver_priv_data);
priv->qp = qp;
priv->cpt_inst_w2 = w2;
} else
@@ -387,8 +383,7 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
struct cnxk_se_sess *priv;
- priv = get_sym_session_private_data(
- op->sym->session, cn9k_cryptodev_driver_id);
+ priv = (void *)op->sym->session->driver_priv_data;
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
} else {
@@ -583,8 +578,6 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
struct cpt_inflight_req *infl_req,
struct cpt_cn9k_res_s *res)
{
- unsigned int sz;
-
if (likely(res->compcode == CPT_COMP_GOOD)) {
if (unlikely(res->uc_compcode)) {
if (res->uc_compcode == ROC_SE_ERR_GC_ICV_MISCOMPARE)
@@ -645,11 +638,7 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
temp_sess_free:
if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
- sym_session_clear(cn9k_cryptodev_driver_id,
- cop->sym->session);
- sz = rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session);
- memset(cop->sym->session, 0, sz);
+ sym_session_clear(cop->sym->session);
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index cf91b92c2c..018d7fcee8 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -406,7 +406,6 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = conf->mp_session;
- qp->sess_mp_priv = conf->mp_session_private;
dev->data->queue_pairs[qp_id] = qp;
return 0;
@@ -620,25 +619,15 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)
}
int
-sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
enum cpt_dp_thread_type thr_type;
- struct cnxk_se_sess *sess_priv;
- void *priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
int ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- plt_dp_err("Could not allocate session private data");
- return -ENOMEM;
- }
-
- memset(priv, 0, sizeof(struct cnxk_se_sess));
-
- sess_priv = priv;
-
+ memset(sess_priv, 0, sizeof(struct cnxk_se_sess));
ret = cnxk_sess_fill(roc_cpt, xform, sess_priv);
if (ret)
goto priv_put;
@@ -684,61 +673,39 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
}
sess_priv->cpt_inst_w7 = cnxk_cpt_inst_w7_get(sess_priv, roc_cpt);
-
- set_sym_session_private_data(sess, driver_id, sess_priv);
-
return 0;
priv_put:
- rte_mempool_put(pool, priv);
-
return ret;
}
int
cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
struct cnxk_cpt_vf *vf = dev->data->dev_private;
struct roc_cpt *roc_cpt = &vf->cpt;
- uint8_t driver_id;
- driver_id = dev->driver_id;
-
- return sym_session_configure(roc_cpt, driver_id, xform, sess, pool);
+ return sym_session_configure(roc_cpt, xform, sess);
}
void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
- struct cnxk_se_sess *sess_priv;
- struct rte_mempool *pool;
-
- if (priv == NULL)
- return;
-
- sess_priv = priv;
+ struct cnxk_se_sess *sess_priv = (void *)sess->driver_priv_data;
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
- memset(priv, 0, cnxk_cpt_sym_session_get_size(NULL));
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
+ memset(sess_priv, 0, cnxk_cpt_sym_session_get_size(NULL));
}
void
-cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
+cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
unsigned int
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index ffe4ae19aa..ca90567620 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -78,8 +78,6 @@ struct cnxk_cpt_qp {
/**< Crypto adapter related info */
struct rte_mempool *sess_mp;
/**< Session mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session private data mempool */
};
int cnxk_cpt_dev_config(struct rte_cryptodev *dev,
@@ -104,18 +102,16 @@ unsigned int cnxk_cpt_sym_session_get_size(struct rte_cryptodev *dev);
int cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
-int sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
+int sym_session_configure(struct roc_cpt *roc_cpt,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool);
+ struct rte_cryptodev_sym_session *sess);
void cnxk_cpt_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess);
+ struct rte_cryptodev_sym_session *sess);
-void sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess);
+void sym_session_clear(struct rte_cryptodev_sym_session *sess);
unsigned int cnxk_ae_session_size_get(struct rte_cryptodev *dev __rte_unused);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 8444f1a795..5a38d53022 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1379,8 +1379,7 @@ build_sec_fd(struct rte_crypto_op *op,
dpaa2_sec_session *sess;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIB_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -1678,8 +1677,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op)
struct rte_crypto_sym_op *sym_op;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_driver_id);
+ sess = (dpaa2_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa2_sec_session *)get_sec_session_private_data(
@@ -3754,51 +3752,36 @@ dpaa2_sec_security_session_destroy(void *dev __rte_unused,
}
#endif
static int
-dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA2_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa2_sec_set_session_parameters(xform, sess_private_data);
if (ret != 0) {
DPAA2_SEC_ERR("Failed to configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev,
+dpaa2_sec_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa2_sec_session *s = (dpaa2_sec_session *)sess_priv;
if (sess_priv) {
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(s, 0, sizeof(dpaa2_sec_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index e68a4875dd..795be3acc3 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -1012,8 +1012,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa2_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa2_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, cryptodev_driver_id);
+ sess = (void *)session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 05415dbf3b..0cc773fba6 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -670,10 +670,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp)
struct qm_sg_entry sg[2];
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)op->sym->session->driver_priv_data;
#ifdef RTE_LIBRTE_SECURITY
else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
sess = (dpaa_sec_session *)
@@ -1927,10 +1924,8 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
- ses = (dpaa_sec_session *)
- get_sym_session_private_data(
- op->sym->session,
- dpaa_cryptodev_driver_id);
+ ses = (void *)
+ op->sym->session->driver_priv_data;
break;
#ifdef RTE_LIB_SECURITY
case RTE_CRYPTO_OP_SECURITY_SESSION:
@@ -2676,31 +2671,19 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
static int
dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
PMD_INIT_FUNC_TRACE();
- if (rte_mempool_get(mempool, &sess_private_data)) {
- DPAA_SEC_ERR("Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = dpaa_sec_set_session_parameters(dev, xform, sess_private_data);
if (ret != 0) {
DPAA_SEC_ERR("failed to configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
ret = dpaa_sec_prep_cdb(sess_private_data);
if (ret) {
DPAA_SEC_ERR("Unable to prepare sec cdb");
@@ -2714,7 +2697,6 @@ static inline void
free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
{
struct dpaa_sec_dev_private *qi = dev->data->dev_private;
- struct rte_mempool *sess_mp = rte_mempool_from_obj((void *)s);
uint8_t i;
for (i = 0; i < MAX_DPAA_CORES; i++) {
@@ -2724,7 +2706,6 @@ free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
s->qp[i] = NULL;
}
free_session_data(s);
- rte_mempool_put(sess_mp, (void *)s);
}
/** Clear the memory of session so it doesn't leave key material behind */
@@ -2733,14 +2714,10 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
PMD_INIT_FUNC_TRACE();
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
- if (sess_priv) {
- free_session_memory(dev, s);
- set_sym_session_private_data(sess, index, NULL);
- }
+ free_session_memory(dev, s);
}
#ifdef RTE_LIB_SECURITY
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d081953e26..d2e4d9d787 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -1017,8 +1017,8 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
sess = (dpaa_sec_session *)get_sec_session_private_data(
session_ctx.sec_sess);
else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION)
- sess = (dpaa_sec_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, dpaa_cryptodev_driver_id);
+ sess = (dpaa_sec_session *)
+ session_ctx.crypto_sess->driver_priv_data;
else
return -ENOTSUP;
raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst;
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 7e8396b4a3..90ce5bc965 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -264,7 +264,6 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
qp->pmd_type = internals->pmd_type;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
qp->ingress_queue = ipsec_mb_qp_create_processed_ops_ring(qp,
qp_conf->nb_descriptors, socket_id);
@@ -312,9 +311,8 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev)
int
ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess, struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
struct ipsec_mb_dev_private *internals = dev->data->dev_private;
struct ipsec_mb_internals *pmd_data =
&ipsec_mb_pmds[internals->pmd_type];
@@ -330,42 +328,22 @@ ipsec_mb_sym_session_configure(
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- IPSEC_MB_LOG(ERR, "Couldn't get object from session mempool");
- free_mb_mgr(mb_mgr);
- return -ENOMEM;
- }
-
- ret = (*pmd_data->session_configure)(mb_mgr, sess_private_data, xform);
+ ret = (*pmd_data->session_configure)(mb_mgr,
+ (void *)sess->driver_priv_data, xform);
if (ret != 0) {
IPSEC_MB_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
free_mb_mgr(mb_mgr);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
-
free_mb_mgr(mb_mgr);
return 0;
}
/** Clear the session memory */
void
-ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, ipsec_mb_sym_session_get_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+ipsec_mb_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index d074b33133..14f962ef28 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -136,8 +136,6 @@ struct ipsec_mb_qp {
struct rte_ring *ingress_queue;
/**< Ring for placing operations ready for processing */
struct rte_mempool *sess_mp;
- /**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
/**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
@@ -399,8 +397,7 @@ ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev);
int ipsec_mb_sym_session_configure(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
/** Clear the memory of session so it does not leave key material behind */
void
@@ -411,50 +408,50 @@ ipsec_mb_sym_session_clear(struct rte_cryptodev *dev,
static __rte_always_inline void *
ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct rte_crypto_op *op)
{
- void *sess = NULL;
+ struct rte_cryptodev_sym_session *sess = NULL;
uint32_t driver_id = ipsec_mb_get_driver_id(qp->pmd_type);
struct rte_crypto_sym_op *sym_op = op->sym;
uint8_t sess_type = op->sess_type;
void *_sess;
- void *_sess_private_data = NULL;
struct ipsec_mb_internals *pmd_data = &ipsec_mb_pmds[qp->pmd_type];
switch (sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
if (likely(sym_op->session != NULL))
- sess = get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
+ else
+ goto error_exit;
break;
case RTE_CRYPTO_OP_SESSIONLESS:
if (!qp->sess_mp ||
rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (!qp->sess_mp_priv ||
- rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
+ sess = _sess;
+ if (sess->sess_data_sz < pmd_data->session_priv_size) {
+ rte_mempool_put(qp->sess_mp, _sess);
+ goto error_exit;
+ }
- sess = _sess_private_data;
if (unlikely(pmd_data->session_configure(qp->mb_mgr,
- sess, sym_op->xform) != 0)) {
+ (void *)sess->driver_priv_data, sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
- sess = NULL;
+ goto error_exit;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sess->driver_id = driver_id;
+ sym_op->session = sess;
+
break;
default:
IPSEC_MB_LOG(ERR, "Unrecognized session type %u", sess_type);
}
- if (unlikely(sess == NULL))
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return (void *)sess->driver_priv_data;
- return sess;
+error_exit:
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ return NULL;
}
#endif /* _IPSEC_MB_PRIVATE_H_ */
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
index 2c033c6f28..e4f274b608 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
@@ -241,10 +241,6 @@ handle_completed_gcm_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_gcm_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -455,44 +451,35 @@ static inline struct aesni_gcm_session *
aesni_gcm_get_session(struct ipsec_mb_qp *qp,
struct rte_crypto_op *op)
{
- struct aesni_gcm_session *sess = NULL;
- uint32_t driver_id =
- ipsec_mb_get_driver_id(IPSEC_MB_PMD_TYPE_AESNI_GCM);
+ struct rte_cryptodev_sym_session *sess = NULL;
struct rte_crypto_sym_op *sym_op = op->sym;
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
- sess = (struct aesni_gcm_session *)
- get_sym_session_private_data(sym_op->session,
- driver_id);
+ sess = sym_op->session;
} else {
- void *_sess;
- void *_sess_private_data = NULL;
-
- if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
+ if (unlikely(sess->sess_data_sz <
+ sizeof(struct aesni_gcm_session))) {
+ rte_mempool_put(qp->sess_mp, sess);
return NULL;
-
- sess = (struct aesni_gcm_session *)_sess_private_data;
+ }
if (unlikely(aesni_gcm_session_configure(qp->mb_mgr,
- _sess_private_data, sym_op->xform) != 0)) {
- rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
+ (void *)sess->driver_priv_data,
+ sym_op->xform) != 0)) {
+ rte_mempool_put(qp->sess_mp, sess);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(sym_op->session, driver_id,
- _sess_private_data);
+ sym_op->session = sess;
}
if (unlikely(sess == NULL))
op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return sess;
+ return (void *)sess->driver_priv_data;
}
static uint16_t
@@ -712,22 +699,15 @@ aesni_gmac_sgl_verify(struct aesni_gcm_session *s,
/** Process CPU crypto bulk operations */
static uint32_t
-aesni_gcm_process_bulk(struct rte_cryptodev *dev,
+aesni_gcm_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess,
__rte_unused union rte_crypto_sym_ofs ofs,
struct rte_crypto_sym_vec *vec)
{
- struct aesni_gcm_session *s;
+ struct aesni_gcm_session *s = (void *)sess->driver_priv_data;
struct gcm_context_data gdata_ctx;
IMB_MGR *mb_mgr;
- s = (struct aesni_gcm_session *) get_sym_session_private_data(sess,
- dev->driver_id);
- if (unlikely(s == NULL)) {
- aesni_gcm_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 6d5d3ce8eb..f3565b04b5 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1710,8 +1710,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
{
struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data;
struct aesni_mb_session *sess = NULL;
- uint32_t driver_id = ipsec_mb_get_driver_id(
- IPSEC_MB_PMD_TYPE_AESNI_MB);
#ifdef AESNI_MB_DOCSIS_SEC_ENABLED
uint8_t is_docsis_sec = 0;
@@ -1725,15 +1723,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
sess = get_sec_session_private_data(op->sym->sec_session);
} else
#endif
- {
- sess = get_sym_session_private_data(op->sym->session,
- driver_id);
- }
-
- if (unlikely(sess == NULL)) {
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- return op;
- }
+ sess = (void *)op->sym->session->driver_priv_data;
if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
switch (job->status) {
@@ -1771,10 +1761,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_mb_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
@@ -1962,16 +1948,6 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
return processed_jobs;
}
-
-static inline void
-ipsec_mb_fill_error_code(struct rte_crypto_sym_vec *vec, int32_t err)
-{
- uint32_t i;
-
- for (i = 0; i != vec->num; ++i)
- vec->status[i] = err;
-}
-
static inline int
check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl)
{
@@ -2028,7 +2004,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec,
}
static uint32_t
-aesni_mb_process_bulk(struct rte_cryptodev *dev,
+aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
struct rte_crypto_sym_vec *vec)
{
@@ -2037,15 +2013,9 @@ aesni_mb_process_bulk(struct rte_cryptodev *dev,
void *buf;
IMB_JOB *job;
IMB_MGR *mb_mgr;
- struct aesni_mb_session *s;
+ struct aesni_mb_session *s = (void *)sess->driver_priv_data;
uint8_t tmp_dgst[vec->num][DIGEST_LENGTH_MAX];
- s = get_sym_session_private_data(sess, dev->driver_id);
- if (s == NULL) {
- ipsec_mb_fill_error_code(vec, EINVAL);
- return 0;
- }
-
/* get per-thread MB MGR, create one if needed */
mb_mgr = get_per_thread_mb_mgr();
if (unlikely(mb_mgr == NULL))
diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
index d953d6e5f5..97e7cef233 100644
--- a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
+++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
@@ -290,10 +290,6 @@ handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp,
/* Free session if a session-less crypto op */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct chacha20_poly1305_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index c9d4f9d0ae..b2fb168154 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -231,11 +231,6 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct kasumi_session));
- memset(
- ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -287,8 +282,9 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct kasumi_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct kasumi_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
return processed_op;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index 9a85f46721..f052d6d847 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -362,10 +362,6 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct snow3g_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
@@ -417,8 +413,9 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
/* Free session if a session-less crypto op. */
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
- memset(op->sym->session, 0, sizeof(struct snow3g_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ memset(op->sym->session->driver_priv_data, 0,
+ sizeof(struct snow3g_session));
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c b/drivers/crypto/ipsec_mb/pmd_zuc.c
index e36c7092d6..92fd9d1808 100644
--- a/drivers/crypto/ipsec_mb/pmd_zuc.c
+++ b/drivers/crypto/ipsec_mb/pmd_zuc.c
@@ -239,10 +239,6 @@ process_ops(struct rte_crypto_op **ops, enum ipsec_mb_operation op_type,
/* Free session if a session-less crypto op. */
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sessions[i], 0, sizeof(struct zuc_session));
- memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- ops[i]->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sessions[i]);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
}
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index eb7616257e..46ea507cf5 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -171,14 +171,13 @@ mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *session)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *sess_private_data;
+ struct mlx5_crypto_session *sess_private_data =
+ (void *)session->driver_priv_data;
struct rte_crypto_cipher_xform *cipher;
uint8_t encryption_order;
- int ret;
if (unlikely(xform->next != NULL)) {
DRV_LOG(ERR, "Xform next is not supported.");
@@ -189,17 +188,9 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
DRV_LOG(ERR, "Only AES-XTS algorithm is supported.");
return -ENOTSUP;
}
- ret = rte_mempool_get(mp, (void *)&sess_private_data);
- if (ret != 0) {
- DRV_LOG(ERR,
- "Failed to get session %p private data from mempool.",
- sess_private_data);
- return -ENOMEM;
- }
cipher = &xform->cipher;
sess_private_data->dek = mlx5_crypto_dek_prepare(priv, cipher);
if (sess_private_data->dek == NULL) {
- rte_mempool_put(mp, sess_private_data);
DRV_LOG(ERR, "Failed to prepare dek.");
return -ENOMEM;
}
@@ -239,8 +230,6 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
sess_private_data->dek_id =
rte_cpu_to_be_32(sess_private_data->dek->obj->id &
0xffffff);
- set_sym_session_private_data(session, dev->driver_id,
- sess_private_data);
DRV_LOG(DEBUG, "Session %p was configured.", sess_private_data);
return 0;
}
@@ -250,16 +239,13 @@ mlx5_crypto_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
struct mlx5_crypto_priv *priv = dev->data->dev_private;
- struct mlx5_crypto_session *spriv = get_sym_session_private_data(sess,
- dev->driver_id);
+ struct mlx5_crypto_session *spriv = (void *)sess->driver_priv_data;
if (unlikely(spriv == NULL)) {
DRV_LOG(ERR, "Failed to get session %p private data.", spriv);
return;
}
mlx5_crypto_dek_destroy(priv, spriv->dek);
- set_sym_session_private_data(sess, dev->driver_id, NULL);
- rte_mempool_put(rte_mempool_from_obj(spriv), spriv);
DRV_LOG(DEBUG, "Session %p was cleared.", spriv);
}
@@ -369,8 +355,8 @@ mlx5_crypto_wqe_set(struct mlx5_crypto_priv *priv,
struct rte_crypto_op *op,
struct mlx5_umr_wqe *umr)
{
- struct mlx5_crypto_session *sess = get_sym_session_private_data
- (op->sym->session, mlx5_crypto_driver_id);
+ struct mlx5_crypto_session *sess =
+ (void *)op->sym->session->driver_priv_data;
struct mlx5_wqe_cseg *cseg = &umr->ctr;
struct mlx5_wqe_mkey_cseg *mkc = &umr->mkc;
struct mlx5_wqe_dseg *klms = &umr->kseg[0];
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 04efd9aaa8..bb86f671a4 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -597,13 +597,7 @@ mrvl_request_prepare_crp(struct sam_cio_op_params *request,
return -EINVAL;
}
- sess = (struct mrvl_crypto_session *)get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
- if (unlikely(sess == NULL)) {
- MRVL_LOG(ERR, "Session was not created for this device!");
- return -EINVAL;
- }
+ sess = (struct mrvl_crypto_session *)op->sym->session->data;
request->sa = sess->sam_sess;
request->cookie = op;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index f828dc9db5..214c0fcb08 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -736,8 +736,7 @@ mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
static int
mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
struct mrvl_crypto_session *mrvl_sess;
void *sess_private_data;
@@ -748,23 +747,15 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- CDEV_LOG_ERR("Couldn't get object from session mempool.");
- return -ENOMEM;
- }
-
+ sess_private_data = sess->data;
memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session));
ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
MRVL_LOG(ERR, "Failed to configure session parameters!");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
mrvl_sess = (struct mrvl_crypto_session *)sess_private_data;
if (sam_session_create(&mrvl_sess->sam_sess_params,
@@ -791,8 +782,7 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = sess->data;
/* Zero out the whole structure */
if (sess_priv) {
@@ -803,11 +793,6 @@ mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
sam_session_destroy(mrvl_sess->sam_sess) < 0) {
MRVL_LOG(ERR, "Error while destroying session!");
}
-
- memset(mrvl_sess, 0, sizeof(struct mrvl_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
}
}
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index cb5393d2f1..505024a810 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -530,24 +530,16 @@ configure_aead_ctx(struct rte_crypto_aead_xform *xform,
}
static int
-nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
+nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *mp_obj;
- struct nitrox_crypto_ctx *ctx;
+ struct nitrox_crypto_ctx *ctx = (void *)sess->driver_priv_data;
struct rte_crypto_cipher_xform *cipher_xform = NULL;
struct rte_crypto_auth_xform *auth_xform = NULL;
struct rte_crypto_aead_xform *aead_xform = NULL;
int ret = -EINVAL;
- if (rte_mempool_get(mempool, &mp_obj)) {
- NITROX_LOG(ERR, "Couldn't allocate context\n");
- return -ENOMEM;
- }
-
- ctx = mp_obj;
ctx->nitrox_chain = get_crypto_chain_order(xform);
switch (ctx->nitrox_chain) {
case NITROX_CHAIN_CIPHER_ONLY:
@@ -585,38 +577,23 @@ nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
goto err;
}
- ctx->iova = rte_mempool_virt2iova(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, ctx);
+ ctx->iova = sess->driver_priv_data_iova;
return 0;
err:
- rte_mempool_put(mempool, mp_obj);
return ret;
}
static void
-nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct nitrox_crypto_ctx *ctx = get_sym_session_private_data(sess,
- cdev->driver_id);
- struct rte_mempool *sess_mp;
-
- if (!ctx)
- return;
-
- memset(ctx, 0, sizeof(*ctx));
- sess_mp = rte_mempool_from_obj(ctx);
- set_sym_session_private_data(sess, cdev->driver_id, NULL);
- rte_mempool_put(sess_mp, ctx);
-}
+nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct nitrox_crypto_ctx *
get_crypto_ctx(struct rte_crypto_op *op)
{
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(op->sym->session))
- return get_sym_session_private_data(op->sym->session,
- nitrox_sym_drv_id);
+ return (void *)op->sym->session->driver_priv_data;
}
return NULL;
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 9ecb434fd0..09aac3065e 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -58,7 +58,7 @@ process_op(const struct null_crypto_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(op->sym->session, 0,
sizeof(struct null_crypto_session));
- rte_cryptodev_sym_session_free(op->sym->session);
+ rte_mempool_put(qp->sess_mp, (void *)op->sym->session);
op->sym->session = NULL;
}
@@ -78,30 +78,21 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
if (likely(sym_op->session != NULL))
sess = (struct null_crypto_session *)
- get_sym_session_private_data(
- sym_op->session, cryptodev_driver_id);
+ sym_op->session->driver_priv_data;
} else {
- void *_sess = NULL;
- void *_sess_private_data = NULL;
+ struct rte_cryptodev_sym_session *_sess = NULL;
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct null_crypto_session *)_sess_private_data;
+ sess = (struct null_crypto_session *)_sess->driver_priv_data;
if (unlikely(null_crypto_set_session_parameters(sess,
sym_op->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
- sym_op->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+ sym_op->session = _sess;
}
return sess;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 90a675dfff..fb43d3f7b5 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -233,7 +233,6 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
}
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
@@ -256,8 +255,7 @@ null_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mp)
+ struct rte_cryptodev_sym_session *sess)
{
void *sess_private_data;
int ret;
@@ -267,43 +265,22 @@ null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mp, &sess_private_data)) {
- NULL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
+ sess_private_data = (void *)sess->driver_priv_data;
ret = null_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
NULL_LOG(ERR, "failed configure session parameters");
-
- /* Return session to mempool */
- rte_mempool_put(mp, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
-
- /* Zero out the whole structure */
- if (sess_priv) {
- memset(sess_priv, 0, sizeof(struct null_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
-}
+null_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops pmd_ops = {
.dev_configure = null_crypto_pmd_config,
diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h
index 89c4345b6f..ae34ce6671 100644
--- a/drivers/crypto/null/null_crypto_pmd_private.h
+++ b/drivers/crypto/null/null_crypto_pmd_private.h
@@ -31,8 +31,6 @@ struct null_crypto_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Mempool */
struct rte_cryptodev_stats qp_stats;
/**< Queue pair statistics */
} __rte_cache_aligned;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
index e48805fb09..4647d568de 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
+++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h
@@ -49,7 +49,6 @@ struct cpt_instance {
uint32_t queue_id;
uintptr_t rsvd;
struct rte_mempool *sess_mp;
- struct rte_mempool *sess_mp_priv;
struct cpt_qp_meta_info meta_info;
uint8_t ca_enabled;
};
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 7aee67ab09..cd5ebc2af6 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -171,7 +171,6 @@ otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
instance->queue_id = que_pair_id;
instance->sess_mp = qp_conf->mp_session;
- instance->sess_mp_priv = qp_conf->mp_session_private;
dev->data->queue_pairs[que_pair_id] = instance;
return 0;
@@ -243,25 +242,19 @@ sym_xform_verify(struct rte_crypto_sym_xform *xform)
}
static int
-sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+sym_session_configure(struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_crypto_sym_xform *temp_xform = xform;
struct cpt_sess_misc *misc;
vq_cmd_word3_t vq_cmd_w3;
- void *priv;
+ void *priv = (void *)sess->driver_priv_data;
int ret;
ret = sym_xform_verify(xform);
if (unlikely(ret))
return ret;
- if (unlikely(rte_mempool_get(pool, &priv))) {
- CPT_LOG_ERR("Could not allocate session private data");
- return -ENOMEM;
- }
-
memset(priv, 0, sizeof(struct cpt_sess_misc) +
offsetof(struct cpt_ctx, mc_ctx));
@@ -301,9 +294,7 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
goto priv_put;
}
- set_sym_session_private_data(sess, driver_id, priv);
-
- misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
+ misc->ctx_dma_addr = sess->driver_priv_data_iova +
sizeof(struct cpt_sess_misc);
vq_cmd_w3.u64 = 0;
@@ -316,17 +307,14 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
return 0;
priv_put:
- if (priv)
- rte_mempool_put(pool, priv);
return -ENOTSUP;
}
static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+sym_session_clear(struct rte_cryptodev_sym_session *sess)
{
- void *priv = get_sym_session_private_data(sess, driver_id);
+ void *priv = (void *)sess->driver_priv_data;
struct cpt_sess_misc *misc;
- struct rte_mempool *pool;
struct cpt_ctx *ctx;
if (priv == NULL)
@@ -336,35 +324,26 @@ sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
ctx = SESS_PRIV(misc);
rte_free(ctx->auth_key);
-
- memset(priv, 0, cpt_get_session_size());
-
- pool = rte_mempool_from_obj(priv);
-
- set_sym_session_private_data(sess, driver_id, NULL);
-
- rte_mempool_put(pool, priv);
}
static int
-otx_cpt_session_cfg(struct rte_cryptodev *dev,
+otx_cpt_session_cfg(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *pool)
+ struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_configure(dev->driver_id, xform, sess, pool);
+ return sym_session_configure(xform, sess);
}
static void
-otx_cpt_session_clear(struct rte_cryptodev *dev,
+otx_cpt_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
CPT_PMD_INIT_FUNC_TRACE();
- return sym_session_clear(dev->driver_id, sess);
+ return sym_session_clear(sess);
}
static unsigned int
@@ -528,10 +507,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance,
void *req;
uint64_t cpt_op;
- sess = (struct cpt_sess_misc *)
- get_sym_session_private_data(sym_op->session,
- otx_cryptodev_driver_id);
-
+ sess = (struct cpt_sess_misc *)sym_op->session->driver_priv_data;
cpt_op = sess->cpt_op;
if (likely(cpt_op & CPT_OP_CIPHER_MASK))
@@ -560,21 +536,18 @@ static __rte_always_inline void * __rte_hot
otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
struct rte_crypto_op *op)
{
- const int driver_id = otx_cryptodev_driver_id;
struct rte_crypto_sym_op *sym_op = op->sym;
struct rte_cryptodev_sym_session *sess;
void *req;
int ret;
/* Create temporary session */
- sess = rte_cryptodev_sym_session_create(instance->sess_mp);
- if (sess == NULL) {
+ if (rte_mempool_get(instance->sess_mp, (void **)&sess) < 0) {
rte_errno = ENOMEM;
return NULL;
}
- ret = sym_session_configure(driver_id, sym_op->xform, sess,
- instance->sess_mp_priv);
+ ret = sym_session_configure(sym_op->xform, sess);
if (ret)
goto sess_put;
@@ -583,12 +556,10 @@ otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
/* Enqueue op with the tmp session set */
req = otx_cpt_enq_single_sym(instance, op);
if (unlikely(req == NULL))
- goto priv_put;
+ goto sess_put;
return req;
-priv_put:
- sym_session_clear(driver_id, sess);
sess_put:
rte_mempool_put(instance->sess_mp, sess);
return NULL;
@@ -873,13 +844,9 @@ static inline void
free_sym_session_data(const struct cpt_instance *instance,
struct rte_crypto_op *cop)
{
- void *sess_private_data_t = get_sym_session_private_data(
- cop->sym->session, otx_cryptodev_driver_id);
+ void *sess_private_data_t = (void *)cop->sym->session->driver_priv_data;
+
memset(sess_private_data_t, 0, cpt_get_session_size());
- memset(cop->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- cop->sym->session));
- rte_mempool_put(instance->sess_mp_priv, sess_private_data_t);
rte_mempool_put(instance->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/openssl_pmd_private.h b/drivers/crypto/openssl/openssl_pmd_private.h
index c34fd9a546..ed6841e460 100644
--- a/drivers/crypto/openssl/openssl_pmd_private.h
+++ b/drivers/crypto/openssl/openssl_pmd_private.h
@@ -70,8 +70,6 @@ struct openssl_qp {
/**< Ring for placing process packets */
struct rte_mempool *sess_mp;
/**< Session Mempool */
- struct rte_mempool *sess_mp_priv;
- /**< Session Private Data Mempool */
struct rte_cryptodev_stats stats;
/**< Queue pair statistics */
uint8_t temp_digest[DIGEST_LENGTH_MAX];
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index a078038651..0bb536c9e3 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -887,10 +887,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
if (op->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
/* get existing session */
if (likely(op->sym->session != NULL))
- sess = (struct openssl_session *)
- get_sym_session_private_data(
- op->sym->session,
- cryptodev_driver_id);
+ sess = (void *)
+ op->sym->session->driver_priv_data;
} else {
if (likely(op->asym->session != NULL))
asym_sess = (struct openssl_asym_session *)
@@ -901,32 +899,26 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
return asym_sess;
}
} else {
+ struct rte_cryptodev_sym_session *_sess;
/* sessionless asymmetric not supported */
if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC)
return NULL;
/* provide internal session */
- void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp);
- void *_sess_private_data = NULL;
+ rte_mempool_get(qp->sess_mp, (void **)&_sess);
if (_sess == NULL)
return NULL;
- if (rte_mempool_get(qp->sess_mp_priv,
- (void **)&_sess_private_data))
- return NULL;
-
- sess = (struct openssl_session *)_sess_private_data;
+ sess = (struct openssl_session *)_sess->driver_priv_data;
if (unlikely(openssl_set_session_parameters(sess,
op->sym->xform) != 0)) {
rte_mempool_put(qp->sess_mp, _sess);
- rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
sess = NULL;
}
op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
- set_sym_session_private_data(op->sym->session,
- cryptodev_driver_id, _sess_private_data);
+
}
if (sess == NULL)
@@ -2900,10 +2892,6 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
openssl_reset_session(sess);
memset(sess, 0, sizeof(struct openssl_session));
- memset(op->sym->session, 0,
- rte_cryptodev_sym_get_existing_header_session_size(
- op->sym->session));
- rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index f7ddbf9c73..2a3662ee5a 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -764,7 +764,6 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto qp_setup_cleanup;
qp->sess_mp = qp_conf->mp_session;
- qp->sess_mp_priv = qp_conf->mp_session_private;
memset(&qp->stats, 0, sizeof(qp->stats));
@@ -794,10 +793,9 @@ openssl_pmd_asym_session_get_size(struct rte_cryptodev *dev __rte_unused)
static int
openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
+ void *sess_private_data = (void *)sess->driver_priv_data;
int ret;
if (unlikely(sess == NULL)) {
@@ -805,24 +803,14 @@ openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
return -EINVAL;
}
- if (rte_mempool_get(mempool, &sess_private_data)) {
- OPENSSL_LOG(ERR,
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
ret = openssl_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
OPENSSL_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
return 0;
}
@@ -1328,20 +1316,13 @@ openssl_pmd_asym_session_configure(struct rte_cryptodev *dev __rte_unused,
/** Clear the memory of session so it doesn't leave key material behind */
static void
-openssl_pmd_sym_session_clear(struct rte_cryptodev *dev,
+openssl_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
+ void *sess_priv = (void *)sess->driver_priv_data;
/* Zero out the whole structure */
- if (sess_priv) {
- openssl_reset_session(sess_priv);
- memset(sess_priv, 0, sizeof(struct openssl_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ openssl_reset_session(sess_priv);
}
static void openssl_reset_asym_session(struct openssl_asym_session *sess)
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index db6316fbe9..408ae9e42b 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -67,12 +67,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
return -EINVAL;
if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) {
- ctx = get_sym_session_private_data(op->sym->session,
- qat_sym_driver_id);
- if (unlikely(!ctx)) {
- QAT_DP_LOG(ERR, "No session for this device");
- return -EINVAL;
- }
+ ctx = (void *)op->sym->session->driver_priv_data;
if (sess != (uintptr_t)ctx) {
struct rte_cryptodev *cdev;
struct qat_cryptodev_private *internals;
@@ -391,8 +386,7 @@ qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
return -EINVAL;
- ctx = (struct qat_sym_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, qat_sym_driver_id);
+ ctx = (void *)session_ctx.crypto_sess->driver_priv_data;
dp_ctx->session = ctx;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 074612c11b..2853ac5b88 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -317,9 +317,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
#endif
{
sess = (struct qat_sym_session *)
- get_sym_session_private_data(
- rx_op->sym->session,
- qat_sym_driver_id);
+ rx_op->sym->session->driver_priv_data;
is_docsis_sec = 0;
}
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 52b3455cf0..8dd2357702 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -219,22 +219,13 @@ qat_is_auth_alg_supported(enum rte_crypto_auth_algorithm algo,
}
void
-qat_sym_session_clear(struct rte_cryptodev *dev,
+qat_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
struct rte_cryptodev_sym_session *sess)
{
- uint8_t index = dev->driver_id;
- void *sess_priv = get_sym_session_private_data(sess, index);
- struct qat_sym_session *s = (struct qat_sym_session *)sess_priv;
+ struct qat_sym_session *s = (void *)sess->driver_priv_data;
- if (sess_priv) {
- if (s->bpi_ctx)
- bpi_cipher_ctx_free(s->bpi_ctx);
- memset(s, 0, qat_sym_session_get_private_size(dev));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
- set_sym_session_private_data(sess, index, NULL);
- rte_mempool_put(sess_mp, sess_priv);
- }
+ if (s->bpi_ctx)
+ bpi_cipher_ctx_free(s->bpi_ctx);
}
static int
@@ -505,35 +496,24 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
- void *sess_private_data;
int ret;
- if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
if (ossl_legacy_provider_load())
return -EINVAL;
#endif
- ret = qat_sym_session_set_parameters(dev, xform, sess_private_data);
+ ret = qat_sym_session_set_parameters(dev, xform,
+ (void *)sess->driver_priv_data,
+ sess->driver_priv_data_iova);
if (ret != 0) {
QAT_LOG(ERR,
"Crypto QAT PMD: failed to configure session parameters");
- /* Return session to mempool */
- rte_mempool_put(mempool, sess_private_data);
return ret;
}
- set_sym_session_private_data(sess, dev->driver_id,
- sess_private_data);
-
# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ossl_legacy_provider_unload();
# endif
@@ -542,7 +522,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev,
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private)
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_paddr)
{
struct qat_sym_session *session = session_private;
struct qat_cryptodev_private *internals = dev->data->dev_private;
@@ -551,7 +532,6 @@ qat_sym_session_set_parameters(struct rte_cryptodev *dev,
int qat_cmd_id;
/* Verify the session physical address is known */
- rte_iova_t session_paddr = rte_mempool_virt2iova(session);
if (session_paddr == 0 || session_paddr == RTE_BAD_IOVA) {
QAT_LOG(ERR,
"Session physical address unknown. Bad memory pool.");
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index 01908abd9e..9e4aab06a6 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -123,12 +123,12 @@ struct qat_sym_session {
int
qat_sym_session_configure(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool);
+ struct rte_cryptodev_sym_session *sess);
int
qat_sym_session_set_parameters(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform, void *session_private);
+ struct rte_crypto_sym_xform *xform, void *session_private,
+ rte_iova_t session_private_iova);
int
qat_sym_session_configure_aead(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index f3a1bd626c..b93821783b 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -468,44 +468,18 @@ scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
}
static int
-scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
- struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+ struct rte_crypto_sym_xform *xform __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
- int ret;
-
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- ret = rte_cryptodev_sym_session_init(worker->dev_id, sess,
- xform, mempool);
- if (ret < 0) {
- CR_SCHED_LOG(ERR, "unable to config sym session");
- return ret;
- }
- }
-
return 0;
}
/** Clear the memory of session so it doesn't leave key material behind */
static void
-scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev,
- struct rte_cryptodev_sym_session *sess)
-{
- struct scheduler_ctx *sched_ctx = dev->data->dev_private;
- uint32_t i;
-
- /* Clear private data of workers */
- for (i = 0; i < sched_ctx->nb_workers; i++) {
- struct scheduler_worker *worker = &sched_ctx->workers[i];
-
- rte_cryptodev_sym_session_clear(worker->dev_id, sess);
- }
-}
+scheduler_pmd_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_sym_session *sess __rte_unused)
+{}
static struct rte_cryptodev_ops scheduler_pmd_ops = {
.dev_configure = scheduler_pmd_config,
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index ed64866758..6b9e57ee66 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -40,8 +40,7 @@ static void virtio_crypto_sym_clear_session(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
/*
* The set of PCI devices this driver supports
@@ -952,12 +951,7 @@ virtio_crypto_sym_clear_session(
hw = dev->data->dev_private;
vq = hw->cvq;
- session = (struct virtio_crypto_session *)get_sym_session_private_data(
- sess, cryptodev_virtio_driver_id);
- if (session == NULL) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid session parameter");
- return;
- }
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
VIRTIO_CRYPTO_SESSION_LOG_INFO("vq->vq_desc_head_idx = %d, "
"vq = %p", vq->vq_desc_head_idx, vq);
@@ -1070,10 +1064,6 @@ virtio_crypto_sym_clear_session(
VIRTIO_CRYPTO_SESSION_LOG_INFO("Close session %"PRIu64" successfully ",
session->session_id);
- memset(session, 0, sizeof(struct virtio_crypto_session));
- struct rte_mempool *sess_mp = rte_mempool_from_obj(session);
- set_sym_session_private_data(sess, cryptodev_virtio_driver_id, NULL);
- rte_mempool_put(sess_mp, session);
rte_free(malloc_virt_addr);
}
@@ -1292,11 +1282,9 @@ static int
virtio_crypto_check_sym_configure_session_paras(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sym_sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sym_sess)
{
- if (unlikely(xform == NULL) || unlikely(sym_sess == NULL) ||
- unlikely(mempool == NULL)) {
+ if (unlikely(xform == NULL) || unlikely(sym_sess == NULL)) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("NULL pointer");
return -1;
}
@@ -1311,12 +1299,9 @@ static int
virtio_crypto_sym_configure_session(
struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *sess,
- struct rte_mempool *mempool)
+ struct rte_cryptodev_sym_session *sess)
{
int ret;
- struct virtio_crypto_session crypto_sess;
- void *session_private = &crypto_sess;
struct virtio_crypto_session *session;
struct virtio_crypto_op_ctrl_req *ctrl_req;
enum virtio_crypto_cmd_id cmd_id;
@@ -1328,19 +1313,12 @@ virtio_crypto_sym_configure_session(
PMD_INIT_FUNC_TRACE();
ret = virtio_crypto_check_sym_configure_session_paras(dev, xform,
- sess, mempool);
+ sess);
if (ret < 0) {
VIRTIO_CRYPTO_SESSION_LOG_ERR("Invalid parameters");
return ret;
}
-
- if (rte_mempool_get(mempool, &session_private)) {
- VIRTIO_CRYPTO_SESSION_LOG_ERR(
- "Couldn't get object from session mempool");
- return -ENOMEM;
- }
-
- session = (struct virtio_crypto_session *)session_private;
+ session = (struct virtio_crypto_session *)sess->driver_priv_data;
memset(session, 0, sizeof(struct virtio_crypto_session));
ctrl_req = &session->ctrl;
ctrl_req->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
@@ -1402,10 +1380,6 @@ virtio_crypto_sym_configure_session(
"Unsupported operation chain order parameter");
goto error_out;
}
-
- set_sym_session_private_data(sess, dev->driver_id,
- session_private);
-
return 0;
error_out:
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index 08359b3a39..b7f492a7f2 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -207,8 +207,7 @@ virtqueue_crypto_sym_enqueue_xmit(
offsetof(struct virtio_crypto_op_cookie, iv);
struct rte_crypto_sym_op *sym_op = cop->sym;
struct virtio_crypto_session *session =
- (struct virtio_crypto_session *)get_sym_session_private_data(
- cop->sym->session, cryptodev_virtio_driver_id);
+ (void *)cop->sym->session->driver_priv_data;
struct virtio_crypto_op_data_req *op_data_req;
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c
index 19af134bbe..bce903e007 100644
--- a/examples/fips_validation/fips_dev_self_test.c
+++ b/examples/fips_validation/fips_dev_self_test.c
@@ -969,7 +969,6 @@ struct fips_dev_auto_test_env {
struct rte_mempool *mpool;
struct rte_mempool *op_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mbuf *mbuf;
struct rte_crypto_op *op;
};
@@ -1479,13 +1478,8 @@ run_single_test(uint8_t dev_id,
return ret;
}
- sess = rte_cryptodev_sym_session_create(env->sess_pool);
- if (!sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(dev_id,
- sess, &xform, env->sess_priv_pool);
- if (ret < 0) {
+ sess = rte_cryptodev_sym_session_create(dev_id, &xform, env->sess_pool);
+ if (!sess) {
RTE_LOG(ERR, PMD, "Error %i: Init session\n", ret);
return ret;
}
@@ -1508,8 +1502,7 @@ run_single_test(uint8_t dev_id,
1);
} while (n_deqd == 0);
- rte_cryptodev_sym_session_clear(dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
+ rte_cryptodev_sym_session_free(dev_id, sess);
if (env->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
return -1;
@@ -1527,7 +1520,6 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
rte_mempool_free(env->mpool);
rte_mempool_free(env->op_pool);
rte_mempool_free(env->sess_pool);
- rte_mempool_free(env->sess_priv_pool);
rte_cryptodev_stop(dev_id);
}
@@ -1535,7 +1527,7 @@ fips_dev_auto_test_uninit(uint8_t dev_id,
static int
fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
{
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
struct rte_cryptodev_config conf;
char name[128];
@@ -1579,25 +1571,13 @@ fips_dev_auto_test_init(uint8_t dev_id, struct fips_dev_auto_test_env *env)
snprintf(name, 128, "%s%u", "SELF_TEST_SESS_POOL", dev_id);
env->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- 128, 0, 0, 0, rte_cryptodev_socket_id(dev_id));
+ 128, sess_sz, 0, 0, rte_cryptodev_socket_id(dev_id));
if (!env->sess_pool) {
ret = -ENOMEM;
goto error_exit;
}
- memset(name, 0, 128);
- snprintf(name, 128, "%s%u", "SELF_TEST_SESS_PRIV_POOL", dev_id);
-
- env->sess_priv_pool = rte_mempool_create(name,
- 128, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_cryptodev_socket_id(dev_id), 0);
- if (!env->sess_priv_pool) {
- ret = -ENOMEM;
- goto error_exit;
- }
-
qp_conf.mp_session = env->sess_pool;
- qp_conf.mp_session_private = env->sess_priv_pool;
ret = rte_cryptodev_queue_pair_setup(dev_id, 0, &qp_conf,
rte_cryptodev_socket_id(dev_id));
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index e6c0b6a3a1..e73e6b09c3 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -55,7 +55,6 @@ struct cryptodev_fips_validate_env {
uint16_t mbuf_data_room;
struct rte_mempool *mpool;
struct rte_mempool *sess_mpool;
- struct rte_mempool *sess_priv_mpool;
struct rte_mempool *op_pool;
struct rte_mbuf *mbuf;
uint8_t *digest;
@@ -70,7 +69,7 @@ static int
cryptodev_fips_validate_app_int(void)
{
struct rte_cryptodev_config conf = {rte_socket_id(), 1, 0};
- struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL};
+ struct rte_cryptodev_qp_conf qp_conf = {128, NULL};
struct rte_cryptodev_info dev_info;
uint32_t sess_sz = rte_cryptodev_sym_get_private_session_size(
env.dev_id);
@@ -110,16 +109,11 @@ cryptodev_fips_validate_app_int(void)
ret = -ENOMEM;
env.sess_mpool = rte_cryptodev_sym_session_pool_create(
- "FIPS_SESS_MEMPOOL", 16, 0, 0, 0, rte_socket_id());
+ "FIPS_SESS_MEMPOOL", 16, sess_sz, 0, 0,
+ rte_socket_id());
if (!env.sess_mpool)
goto error_exit;
- env.sess_priv_mpool = rte_mempool_create("FIPS_SESS_PRIV_MEMPOOL",
- 16, sess_sz, 0, 0, NULL, NULL, NULL,
- NULL, rte_socket_id(), 0);
- if (!env.sess_priv_mpool)
- goto error_exit;
-
env.op_pool = rte_crypto_op_pool_create(
"FIPS_OP_POOL",
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -134,7 +128,6 @@ cryptodev_fips_validate_app_int(void)
goto error_exit;
qp_conf.mp_session = env.sess_mpool;
- qp_conf.mp_session_private = env.sess_priv_mpool;
ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf,
rte_socket_id());
@@ -151,7 +144,6 @@ cryptodev_fips_validate_app_int(void)
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
return ret;
@@ -162,11 +154,9 @@ cryptodev_fips_validate_app_uninit(void)
{
rte_pktmbuf_free(env.mbuf);
rte_crypto_op_free(env.op);
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
rte_mempool_free(env.mpool);
rte_mempool_free(env.sess_mpool);
- rte_mempool_free(env.sess_priv_mpool);
rte_mempool_free(env.op_pool);
}
@@ -1202,13 +1192,9 @@ fips_run_test(void)
if (ret < 0)
return ret;
- env.sess = rte_cryptodev_sym_session_create(env.sess_mpool);
- if (!env.sess)
- return -ENOMEM;
-
- ret = rte_cryptodev_sym_session_init(env.dev_id,
- env.sess, &xform, env.sess_priv_mpool);
- if (ret < 0) {
+ env.sess = rte_cryptodev_sym_session_create(env.dev_id, &xform,
+ env.sess_mpool);
+ if (!env.sess) {
RTE_LOG(ERR, USER1, "Error %i: Init session\n",
ret);
goto exit;
@@ -1237,9 +1223,10 @@ fips_run_test(void)
vec.status = env.op->status;
exit:
- rte_cryptodev_sym_session_clear(env.dev_id, env.sess);
- rte_cryptodev_sym_session_free(env.sess);
- env.sess = NULL;
+ if (env.sess) {
+ rte_cryptodev_sym_session_free(env.dev_id, env.sess);
+ env.sess = NULL;
+ }
return ret;
}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 8a25b83535..ce4b4ba806 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1693,8 +1693,6 @@ cryptodevs_init(uint16_t req_queue_num)
qp_conf.nb_descriptors = qp_desc_nb;
qp_conf.mp_session =
socket_ctx[dev_conf.socket_id].session_pool;
- qp_conf.mp_session_private =
- socket_ctx[dev_conf.socket_id].session_priv_pool;
for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++)
if (rte_cryptodev_queue_pair_setup(cdev_id, qp,
&qp_conf, dev_conf.socket_id))
@@ -2523,12 +2521,8 @@ one_session_free(struct rte_ipsec_session *ips)
if (ips->crypto.ses == NULL)
return 0;
- ret = rte_cryptodev_sym_session_clear(ips->crypto.dev_id,
- ips->crypto.ses);
- if (ret)
- return ret;
-
- ret = rte_cryptodev_sym_session_free(ips->crypto.ses);
+ ret = rte_cryptodev_sym_session_free(ips->crypto.dev_id,
+ ips->crypto.ses);
} else {
/* Session has not been created */
if (ips->security.ctx == NULL || ips->security.ses == NULL)
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 7b7bfff696..bb84dcec7e 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -174,11 +174,8 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[],
}
ips->crypto.dev_id = cdev_id;
- ips->crypto.ses = rte_cryptodev_sym_session_create(
- skt_ctx->session_pool);
- rte_cryptodev_sym_session_init(cdev_id,
- ips->crypto.ses, sa->xforms,
- skt_ctx->session_priv_pool);
+ ips->crypto.ses = rte_cryptodev_sym_session_create(cdev_id,
+ sa->xforms, skt_ctx->session_pool);
rte_cryptodev_info_get(cdev_id, &cdev_info);
}
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index bf4b862379..b555e63ff6 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -228,7 +228,6 @@ struct rte_mempool *l2fwd_pktmbuf_pool;
struct rte_mempool *l2fwd_crypto_op_pool;
static struct {
struct rte_mempool *sess_mp;
- struct rte_mempool *priv_mp;
} session_pool_socket[RTE_MAX_NUMA_NODES];
/* Per-port statistics struct */
@@ -675,7 +674,6 @@ static struct rte_cryptodev_sym_session *
initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
{
struct rte_crypto_sym_xform *first_xform;
- struct rte_cryptodev_sym_session *session;
int retval = rte_cryptodev_socket_id(cdev_id);
if (retval < 0)
@@ -697,17 +695,8 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id)
first_xform = &options->auth_xform;
}
- session = rte_cryptodev_sym_session_create(
+ return rte_cryptodev_sym_session_create(cdev_id, first_xform,
session_pool_socket[socket_id].sess_mp);
- if (session == NULL)
- return NULL;
-
- if (rte_cryptodev_sym_session_init(cdev_id, session,
- first_xform,
- session_pool_socket[socket_id].priv_mp) < 0)
- return NULL;
-
- return session;
}
/* >8 End of creation of session. */
@@ -2380,13 +2369,10 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
rte_cryptodev_info_get(cdev_id, &dev_info);
- /*
- * Two sessions objects are required for each session
- * (one for the header, one for the private data)
- */
if (!strcmp(dev_info.driver_name, "crypto_scheduler")) {
#ifdef RTE_CRYPTO_SCHEDULER
- uint32_t nb_workers =
+ /* scheduler session header + 1 session per worker */
+ uint32_t nb_workers = 1 +
rte_cryptodev_scheduler_workers_get(cdev_id,
NULL);
@@ -2395,41 +2381,15 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
} else
sessions_needed = enabled_cdev_count;
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- char mp_name[RTE_MEMPOOL_NAMESIZE];
-
- snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
- "priv_sess_mp_%u", socket_id);
-
- session_pool_socket[socket_id].priv_mp =
- rte_mempool_create(mp_name,
- sessions_needed,
- max_sess_sz,
- 0, 0, NULL, NULL, NULL,
- NULL, socket_id,
- 0);
-
- if (session_pool_socket[socket_id].priv_mp == NULL) {
- printf("Cannot create pool on socket %d\n",
- socket_id);
- return -ENOMEM;
- }
-
- printf("Allocated pool \"%s\" on socket %d\n",
- mp_name, socket_id);
- }
-
if (session_pool_socket[socket_id].sess_mp == NULL) {
char mp_name[RTE_MEMPOOL_NAMESIZE];
snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
"sess_mp_%u", socket_id);
session_pool_socket[socket_id].sess_mp =
- rte_cryptodev_sym_session_pool_create(
- mp_name,
- sessions_needed,
- 0, 0, 0, socket_id);
-
+ rte_cryptodev_sym_session_pool_create(
+ mp_name, sessions_needed, max_sess_sz,
+ 0, 0, socket_id);
if (session_pool_socket[socket_id].sess_mp == NULL) {
printf("Cannot create pool on socket %d\n",
socket_id);
@@ -2580,8 +2540,6 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
qp_conf.nb_descriptors = 2048;
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- qp_conf.mp_session_private =
- session_pool_socket[socket_id].priv_mp;
retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
socket_id);
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 7d75623a5e..02987ebd76 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,7 +46,6 @@ struct vhost_crypto_info {
int vids[MAX_NB_SOCKETS];
uint32_t nb_vids;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *cop_pool;
uint8_t cid;
uint32_t qid;
@@ -304,7 +303,6 @@ new_device(int vid)
}
ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
- info->sess_priv_pool,
rte_lcore_to_socket_id(options.los[i].lcore_id));
if (ret) {
RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -458,7 +456,6 @@ free_resource(void)
rte_mempool_free(info->cop_pool);
rte_mempool_free(info->sess_pool);
- rte_mempool_free(info->sess_priv_pool);
for (j = 0; j < lo->nb_sockets; j++) {
rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -544,16 +541,12 @@ main(int argc, char *argv[])
snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
- SESSION_MAP_ENTRIES, 0, 0, 0,
- rte_lcore_to_socket_id(lo->lcore_id));
-
- snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
- info->sess_priv_pool = rte_mempool_create(name,
SESSION_MAP_ENTRIES,
rte_cryptodev_sym_get_private_session_size(
- info->cid), 64, 0, NULL, NULL, NULL, NULL,
- rte_lcore_to_socket_id(lo->lcore_id), 0);
- if (!info->sess_priv_pool || !info->sess_pool) {
+ info->cid), 0, 0,
+ rte_lcore_to_socket_id(lo->lcore_id));
+
+ if (!info->sess_pool) {
RTE_LOG(ERR, USER1, "Failed to create mempool");
goto error_exit;
}
@@ -574,7 +567,6 @@ main(int argc, char *argv[])
qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS;
qp_conf.mp_session = info->sess_pool;
- qp_conf.mp_session_private = info->sess_priv_pool;
for (j = 0; j < dev_info.max_nb_queue_pairs; j++) {
ret = rte_cryptodev_queue_pair_setup(info->cid, j,
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..f518a0f89b 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -301,7 +301,6 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
* @param dev Crypto device pointer
* @param xform Single or chain of crypto xforms
* @param session Pointer to cryptodev's private session structure
- * @param mp Mempool where the private session is allocated
*
* @return
* - Returns 0 if private session structure have been created successfully.
@@ -311,8 +310,8 @@ typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
*/
typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
struct rte_crypto_sym_xform *xform,
- struct rte_cryptodev_sym_session *session,
- struct rte_mempool *mp);
+ struct rte_cryptodev_sym_session *session);
+
/**
* Configure a Crypto asymmetric session on a device.
*
@@ -337,6 +336,7 @@ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev,
*/
typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
struct rte_cryptodev_sym_session *sess);
+
/**
* Clear asymmetric session private data.
*
@@ -637,28 +637,6 @@ __rte_internal
void *
rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op);
-static inline void *
-get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id) {
- if (unlikely(sess->nb_drivers <= driver_id))
- return NULL;
-
- return sess->sess_data[driver_id].data;
-}
-
-static inline void
-set_sym_session_private_data(struct rte_cryptodev_sym_session *sess,
- uint8_t driver_id, void *private_data)
-{
- if (unlikely(sess->nb_drivers <= driver_id)) {
- CDEV_LOG_ERR("Set private data for driver %u not allowed\n",
- driver_id);
- return;
- }
-
- sess->sess_data[driver_id].data = private_data;
-}
-
/**
* @internal
* Cryptodev asymmetric crypto session.
diff --git a/lib/cryptodev/cryptodev_trace_points.c b/lib/cryptodev/cryptodev_trace_points.c
index c5bfe08b79..019fc0c800 100644
--- a/lib/cryptodev/cryptodev_trace_points.c
+++ b/lib/cryptodev/cryptodev_trace_points.c
@@ -39,12 +39,6 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_free,
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_session_free,
lib.cryptodev.asym.free)
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_init,
- lib.cryptodev.sym.init)
-
-RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_sym_session_clear,
- lib.cryptodev.sym.clear)
-
RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_enqueue_burst,
lib.cryptodev.enq.burst)
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 35661f5347..a326eb0e17 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -199,12 +199,9 @@ const char *rte_crypto_asym_ke_strings[] = {
[RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY] = "pub_ec_key_verify"
};
-/**
- * The private data structure stored in the sym session mempool private data.
- */
struct rte_cryptodev_sym_session_pool_private_data {
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint16_t sess_data_sz;
+ /**< driver session data size */
uint16_t user_data_sz;
/**< session user data will be placed after sess_data */
};
@@ -1211,6 +1208,24 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
return 0;
}
+static uint8_t
+rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp,
+ uint32_t sess_priv_size)
+{
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (!mp)
+ return 0;
+
+ pool_priv = rte_mempool_get_priv(mp);
+
+ if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
+ pool_priv->sess_data_sz < sess_priv_size)
+ return 0;
+
+ return 1;
+}
+
int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
@@ -1234,17 +1249,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- if ((qp_conf->mp_session && !qp_conf->mp_session_private) ||
- (!qp_conf->mp_session && qp_conf->mp_session_private)) {
- CDEV_LOG_ERR("Invalid mempools\n");
- return -EINVAL;
- }
-
if (qp_conf->mp_session) {
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
- uint32_t obj_size = qp_conf->mp_session->elt_size;
- uint32_t obj_priv_size = qp_conf->mp_session_private->elt_size;
- struct rte_cryptodev_sym_session s = {0};
pool_priv = rte_mempool_get_priv(qp_conf->mp_session);
if (!pool_priv || qp_conf->mp_session->private_data_size <
@@ -1253,13 +1259,9 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
return -EINVAL;
}
- s.nb_drivers = pool_priv->nb_drivers;
- s.user_data_sz = pool_priv->user_data_sz;
-
- if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
- obj_size) || (s.nb_drivers <= dev->driver_id) ||
- rte_cryptodev_sym_get_private_session_size(dev_id) >
- obj_priv_size) {
+ if (!rte_cryptodev_sym_is_valid_session_pool(
+ qp_conf->mp_session,
+ rte_cryptodev_sym_get_private_session_size(dev_id))) {
CDEV_LOG_ERR("Invalid mempool\n");
return -EINVAL;
}
@@ -1719,53 +1721,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
rte_spinlock_unlock(&rte_cryptodev_cb_lock);
}
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mp)
-{
- struct rte_cryptodev *dev;
- uint32_t sess_priv_sz = rte_cryptodev_sym_get_private_session_size(
- dev_id);
- uint8_t index;
- int ret;
-
- if (!rte_cryptodev_is_valid_dev(dev_id)) {
- CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
- return -EINVAL;
- }
-
- dev = rte_cryptodev_pmd_get_dev(dev_id);
-
- if (sess == NULL || xforms == NULL || dev == NULL || mp == NULL)
- return -EINVAL;
-
- if (mp->elt_size < sess_priv_sz)
- return -EINVAL;
-
- index = dev->driver_id;
- if (index >= sess->nb_drivers)
- return -EINVAL;
-
- RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
-
- if (sess->sess_data[index].refcnt == 0) {
- ret = dev->dev_ops->sym_session_configure(dev, xforms,
- sess, mp);
- if (ret < 0) {
- CDEV_LOG_ERR(
- "dev_id %d failed to configure session details",
- dev_id);
- return ret;
- }
- }
-
- rte_cryptodev_trace_sym_session_init(dev_id, sess, xforms, mp);
- sess->sess_data[index].refcnt++;
- return 0;
-}
-
struct rte_mempool *
rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
@@ -1775,16 +1730,13 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
uint32_t obj_sz;
- obj_sz = rte_cryptodev_sym_get_header_session_size() + user_data_size;
- if (obj_sz > elt_size)
- CDEV_LOG_INFO("elt_size %u is expanded to %u\n", elt_size,
- obj_sz);
- else
- obj_sz = elt_size;
+ obj_sz = sizeof(struct rte_cryptodev_sym_session) + elt_size +
+ user_data_size;
+ obj_sz = RTE_ALIGN_CEIL(obj_sz, RTE_CACHE_LINE_SIZE);
mp = rte_mempool_create(name, nb_elts, obj_sz, cache_size,
- (uint32_t)(sizeof(*pool_priv)),
- NULL, NULL, NULL, NULL,
+ (uint32_t)(sizeof(*pool_priv)), NULL, NULL,
+ NULL, NULL,
socket_id, 0);
if (mp == NULL) {
CDEV_LOG_ERR("%s(name=%s) failed, rte_errno=%d\n",
@@ -1800,7 +1752,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
return NULL;
}
- pool_priv->nb_drivers = nb_drivers;
+ pool_priv->sess_data_sz = elt_size;
pool_priv->user_data_sz = user_data_size;
rte_cryptodev_trace_sym_session_pool_create(name, nb_elts,
@@ -1858,64 +1810,68 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
return mp;
}
-static unsigned int
-rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
-{
- return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
- sess->user_data_sz;
-}
-
-static uint8_t
-rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp)
-{
- struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
-
- if (!mp)
- return 0;
-
- pool_priv = rte_mempool_get_priv(mp);
-
- if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
- pool_priv->nb_drivers != nb_drivers ||
- mp->elt_size <
- rte_cryptodev_sym_get_header_session_size()
- + pool_priv->user_data_sz)
- return 0;
-
- return 1;
-}
-
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mp)
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp)
{
+ struct rte_cryptodev *dev;
struct rte_cryptodev_sym_session *sess;
struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
- if (!rte_cryptodev_sym_is_valid_session_pool(mp)) {
+ uint32_t sess_priv_sz;
+ int ret;
+
+ if (!rte_cryptodev_is_valid_dev(dev_id)) {
+ CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+ return NULL;
+ }
+
+ if (xforms == NULL) {
+ CDEV_LOG_ERR("Invalid xform\n");
+ return NULL;
+ }
+
+ sess_priv_sz = rte_cryptodev_sym_get_private_session_size(dev_id);
+ if (!rte_cryptodev_sym_is_valid_session_pool(mp, sess_priv_sz)) {
CDEV_LOG_ERR("Invalid mempool\n");
return NULL;
}
- pool_priv = rte_mempool_get_priv(mp);
+ dev = rte_cryptodev_pmd_get_dev(dev_id);
/* Allocate a session structure from the session pool */
if (rte_mempool_get(mp, (void **)&sess)) {
CDEV_LOG_ERR("couldn't get object from session mempool");
+ rte_errno = ENOMEM;
return NULL;
}
- sess->nb_drivers = pool_priv->nb_drivers;
+ pool_priv = rte_mempool_get_priv(mp);
+ sess->driver_id = dev->driver_id;
+ sess->sess_data_sz = pool_priv->sess_data_sz;
sess->user_data_sz = pool_priv->user_data_sz;
- sess->opaque_data = 0;
+ sess->driver_priv_data_iova = rte_mempool_virt2iova(sess) +
+ offsetof(struct rte_cryptodev_sym_session, driver_priv_data);
- /* Clear device session pointer.
- * Include the flag indicating presence of user data
- */
- memset(sess->sess_data, 0,
- rte_cryptodev_sym_session_data_size(sess));
+ if (dev->dev_ops->sym_session_configure == NULL) {
+ rte_errno = ENOTSUP;
+ goto error_exit;
+ }
- rte_cryptodev_trace_sym_session_create(mp, sess);
- return sess;
+ ret = dev->dev_ops->sym_session_configure(dev, xforms, sess);
+ if (ret < 0) {
+ rte_errno = -ret;
+ goto error_exit;
+ }
+ sess->driver_id = dev->driver_id;
+
+ rte_cryptodev_trace_sym_session_create(dev_id, sess, xforms, mp);
+
+ return (void *)sess;
+error_exit:
+ rte_mempool_put(mp, (void *)sess);
+ return NULL;
}
int
@@ -1994,11 +1950,15 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
}
int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess)
{
struct rte_cryptodev *dev;
- uint8_t driver_id;
+ struct rte_mempool *sess_mp;
+ struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+ if (sess == NULL)
+ return -EINVAL;
if (!rte_cryptodev_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
@@ -2010,37 +1970,24 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
if (dev == NULL || sess == NULL)
return -EINVAL;
- driver_id = dev->driver_id;
- if (sess->sess_data[driver_id].refcnt == 0)
- return 0;
- if (--sess->sess_data[driver_id].refcnt != 0)
- return -EBUSY;
+ sess_mp = rte_mempool_from_obj(sess);
+ if (!sess_mp)
+ return -EINVAL;
+ pool_priv = rte_mempool_get_priv(sess_mp);
+
+ if (sess->driver_id != dev->driver_id) {
+ CDEV_LOG_ERR("Session created by driver %u but freed by %u",
+ sess->driver_id, dev->driver_id);
+ return -EINVAL;
+ }
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
dev->dev_ops->sym_session_clear(dev, sess);
-
- rte_cryptodev_trace_sym_session_clear(dev_id, sess);
- return 0;
-}
-
-int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
-{
- uint8_t i;
- struct rte_mempool *sess_mp;
-
- if (sess == NULL)
- return -EINVAL;
-
- /* Check that all device private data has been freed */
- for (i = 0; i < sess->nb_drivers; i++) {
- if (sess->sess_data[i].refcnt != 0)
- return -EBUSY;
- }
+ memset(sess->driver_priv_data, 0, pool_priv->sess_data_sz +
+ pool_priv->user_data_sz);
/* Return session to mempool */
- sess_mp = rte_mempool_from_obj(sess);
rte_mempool_put(sess_mp, sess);
rte_cryptodev_trace_sym_session_free(sess);
@@ -2077,33 +2024,6 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
return 0;
}
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void)
-{
- /*
- * Header contains pointers to the private data of all registered
- * drivers and all necessary information to ensure safely clear
- * or free al session.
- */
- struct rte_cryptodev_sym_session s = {0};
-
- s.nb_drivers = nb_drivers;
-
- return (unsigned int)(sizeof(s) +
- rte_cryptodev_sym_session_data_size(&s));
-}
-
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess)
-{
- if (!sess)
- return 0;
- else
- return (unsigned int)(sizeof(*sess) +
- rte_cryptodev_sym_session_data_size(sess));
-}
-
unsigned int
rte_cryptodev_asym_get_header_session_size(void)
{
@@ -2150,9 +2070,8 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
int
rte_cryptodev_sym_session_set_user_data(
- struct rte_cryptodev_sym_session *sess,
- void *data,
- uint16_t size)
+ struct rte_cryptodev_sym_session *sess, void *data,
+ uint16_t size)
{
if (sess == NULL)
return -EINVAL;
@@ -2160,18 +2079,17 @@ rte_cryptodev_sym_session_set_user_data(
if (sess->user_data_sz < size)
return -ENOMEM;
- rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
+ rte_memcpy(sess->driver_priv_data + sess->sess_data_sz, data, size);
return 0;
}
void *
-rte_cryptodev_sym_session_get_user_data(
- struct rte_cryptodev_sym_session *sess)
+rte_cryptodev_sym_session_get_user_data(struct rte_cryptodev_sym_session *sess)
{
if (sess == NULL || sess->user_data_sz == 0)
return NULL;
- return (void *)(sess->sess_data + sess->nb_drivers);
+ return (void *)(sess->driver_priv_data + sess->sess_data_sz);
}
int
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56f459c6a0..0c65958f25 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -544,8 +544,6 @@ struct rte_cryptodev_qp_conf {
uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
struct rte_mempool *mp_session;
/**< The mempool for creating session in sessionless mode */
- struct rte_mempool *mp_session_private;
- /**< The mempool for creating sess private data in sessionless mode */
};
/**
@@ -909,17 +907,21 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id);
* has a fixed algo, key, op-type, digest_len etc.
*/
struct rte_cryptodev_sym_session {
+ RTE_MARKER cacheline0;
+ uint8_t driver_id;
uint64_t opaque_data;
/**< Can be used for external metadata */
- uint16_t nb_drivers;
- /**< number of elements in sess_data array */
+ uint32_t sess_data_sz;
+ /**< Pointer to the user data stored after sess data */
uint16_t user_data_sz;
- /**< session user data will be placed after sess_data */
- __extension__ struct {
- void *data;
- uint16_t refcnt;
- } sess_data[];
- /**< Driver specific session material, variable size */
+ /**< session user data will be placed after sess data */
+ rte_iova_t driver_priv_data_iova;
+ /**< session driver data IOVA address */
+
+ RTE_MARKER cacheline1 __rte_cache_min_aligned;
+ /**< second cache line - start of the driver session data */
+ uint8_t driver_priv_data[0];
+ /**< Driver specific session data, variable size */
};
/**
@@ -954,6 +956,7 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
int socket_id);
+
/**
* Create an asymmetric session mempool.
*
@@ -980,17 +983,22 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t cache_size, uint16_t user_data_size, int socket_id);
/**
- * Create symmetric crypto session header (generic with no private data)
+ * Create symmetric crypto session and fill out private data for the device id,
+ * based on its device type.
+ *
+ * @param dev_id ID of device that we want the session to be used on
+ * @param xforms Symmetric crypto transform operations to apply on flow
+ * processed with this session
+ * @param mempool Mempool where the private data is allocated.
*
- * @param mempool Symmetric session mempool to allocate session
- * objects from
* @return
- * - On success return pointer to sym-session
- * - On failure returns NULL
+ * - On success return pointer to sym-session.
+ * - On failure returns NULL.
*/
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
-
+void *
+rte_cryptodev_sym_session_create(uint8_t dev_id,
+ struct rte_crypto_sym_xform *xforms,
+ struct rte_mempool *mp);
/**
* Create and initialise an asymmetric crypto session structure.
* Calls the PMD to configure the private session data.
@@ -1015,19 +1023,20 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
void **session);
/**
- * Frees symmetric crypto session header, after checking that all
- * the device private data has been freed, returning it
- * to its original mempool.
+ * Frees session for the device id and returning it to its mempool.
+ * It is the application's responsibility to ensure that the session
+ * is not still in-flight operations using it.
*
+ * @param dev_id ID of device that uses the session.
* @param sess Session header to be freed.
*
* @return
* - 0 if successful.
- * - -EINVAL if session is NULL.
- * - -EBUSY if not all device private data has been freed.
+ * - -EINVAL if session is NULL or the mismatched device ids.
*/
int
-rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
+rte_cryptodev_sym_session_free(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess);
/**
* Clears and frees asymmetric crypto session header and private data,
@@ -1044,72 +1053,6 @@ __rte_experimental
int
rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess);
-/**
- * Fill out private data for the device id, based on its device type.
- *
- * @param dev_id ID of device that we want the session to be used on
- * @param sess Session where the private data will be attached to
- * @param xforms Symmetric crypto transform operations to apply on flow
- * processed with this session
- * @param mempool Mempool where the private data is allocated.
- *
- * @return
- * - On success, zero.
- * - -EINVAL if input parameters are invalid.
- * - -ENOTSUP if crypto device does not support the crypto transform or
- * does not support symmetric operations.
- * - -ENOMEM if the private session could not be allocated.
- */
-int
-rte_cryptodev_sym_session_init(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess,
- struct rte_crypto_sym_xform *xforms,
- struct rte_mempool *mempool);
-
-/**
- * Frees private data for the device id, based on its device type,
- * returning it to its mempool. It is the application's responsibility
- * to ensure that private session data is not cleared while there are
- * still in-flight operations using it.
- *
- * @param dev_id ID of device that uses the session.
- * @param sess Session containing the reference to the private data
- *
- * @return
- * - 0 if successful.
- * - -EINVAL if device is invalid or session is NULL.
- * - -ENOTSUP if crypto device does not support symmetric operations.
- */
-int
-rte_cryptodev_sym_session_clear(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess);
-
-/**
- * Get the size of the header session, for all registered drivers excluding
- * the user data size.
- *
- * @return
- * Size of the symmetric header session.
- */
-unsigned int
-rte_cryptodev_sym_get_header_session_size(void);
-
-/**
- * Get the size of the header session from created session.
- *
- * @param sess
- * The sym cryptodev session pointer
- *
- * @return
- * - If sess is not NULL, return the size of the header session including
- * the private data size defined within sess.
- * - If sess is NULL, return 0.
- */
-__rte_experimental
-unsigned int
-rte_cryptodev_sym_get_existing_header_session_size(
- struct rte_cryptodev_sym_session *sess);
-
/**
* Get the size of the asymmetric session header.
*
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index a3f6048e7d..055c44fb22 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -56,7 +56,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u16(queue_pair_id);
rte_trace_point_emit_u32(conf->nb_descriptors);
rte_trace_point_emit_ptr(conf->mp_session);
- rte_trace_point_emit_ptr(conf->mp_session_private);
)
RTE_TRACE_POINT(
@@ -74,13 +73,16 @@ RTE_TRACE_POINT(
RTE_TRACE_POINT(
rte_cryptodev_trace_sym_session_create,
- RTE_TRACE_POINT_ARGS(void *mempool,
- struct rte_cryptodev_sym_session *sess),
- rte_trace_point_emit_ptr(mempool);
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id,
+ struct rte_cryptodev_sym_session *sess, void *xforms,
+ void *mempool),
+ rte_trace_point_emit_u8(dev_id);
rte_trace_point_emit_ptr(sess);
rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
+ rte_trace_point_emit_u8(sess->driver_id);
rte_trace_point_emit_u16(sess->user_data_sz);
+ rte_trace_point_emit_ptr(xforms);
+ rte_trace_point_emit_ptr(mempool);
)
RTE_TRACE_POINT(
@@ -117,27 +119,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_ptr(sess);
)
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_init,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id,
- struct rte_cryptodev_sym_session *sess, void *xforms,
- void *mempool),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
- rte_trace_point_emit_u64(sess->opaque_data);
- rte_trace_point_emit_u16(sess->nb_drivers);
- rte_trace_point_emit_u16(sess->user_data_sz);
- rte_trace_point_emit_ptr(xforms);
- rte_trace_point_emit_ptr(mempool);
-)
-
-RTE_TRACE_POINT(
- rte_cryptodev_trace_sym_session_clear,
- RTE_TRACE_POINT_ARGS(uint8_t dev_id, void *sess),
- rte_trace_point_emit_u8(dev_id);
- rte_trace_point_emit_ptr(sess);
-)
-
#ifdef __cplusplus
}
#endif
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 5aee87c6f7..6fcf6ae985 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -38,12 +38,9 @@ DPDK_23 {
rte_cryptodev_sym_capability_check_auth;
rte_cryptodev_sym_capability_check_cipher;
rte_cryptodev_sym_capability_get;
- rte_cryptodev_sym_get_header_session_size;
rte_cryptodev_sym_get_private_session_size;
- rte_cryptodev_sym_session_clear;
rte_cryptodev_sym_session_create;
rte_cryptodev_sym_session_free;
- rte_cryptodev_sym_session_init;
local: *;
};
@@ -60,7 +57,6 @@ EXPERIMENTAL {
rte_cryptodev_asym_xform_capability_check_modlen;
rte_cryptodev_asym_xform_capability_check_optype;
rte_cryptodev_sym_cpu_crypto_process;
- rte_cryptodev_sym_get_existing_header_session_size;
rte_cryptodev_sym_session_get_user_data;
rte_cryptodev_sym_session_pool_create;
rte_cryptodev_sym_session_set_user_data;
@@ -78,8 +74,6 @@ EXPERIMENTAL {
__rte_cryptodev_trace_asym_session_create;
__rte_cryptodev_trace_sym_session_free;
__rte_cryptodev_trace_asym_session_free;
- __rte_cryptodev_trace_sym_session_init;
- __rte_cryptodev_trace_sym_session_clear;
__rte_cryptodev_trace_dequeue_burst;
__rte_cryptodev_trace_enqueue_burst;
diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c
index b1310be565..cb792bbe0d 100644
--- a/lib/pipeline/rte_table_action.c
+++ b/lib/pipeline/rte_table_action.c
@@ -1898,17 +1898,11 @@ sym_crypto_apply(struct sym_crypto_data *data,
}
}
- session = rte_cryptodev_sym_session_create(cfg->mp_create);
+ session = rte_cryptodev_sym_session_create(cfg->cryptodev_id,
+ p->xform, cfg->mp_create);
if (!session)
return -ENOMEM;
- ret = rte_cryptodev_sym_session_init(cfg->cryptodev_id, session,
- p->xform, cfg->mp_init);
- if (ret < 0) {
- rte_cryptodev_sym_session_free(session);
- return ret;
- }
-
data->data_offset = (uint16_t)p->data_offset;
data->session = session;
diff --git a/lib/vhost/rte_vhost_crypto.h b/lib/vhost/rte_vhost_crypto.h
index b49e389579..2b01ecda08 100644
--- a/lib/vhost/rte_vhost_crypto.h
+++ b/lib/vhost/rte_vhost_crypto.h
@@ -54,8 +54,6 @@ rte_vhost_crypto_driver_start(const char *path);
* multiple Vhost-crypto devices.
* @param sess_pool
* The pointer to the created cryptodev session pool.
- * @param sess_priv_pool
- * The pointer to the created cryptodev session private data mempool.
* @param socket_id
* NUMA Socket ID to allocate resources on. *
* @return
@@ -65,7 +63,6 @@ rte_vhost_crypto_driver_start(const char *path);
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id);
/**
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 54946f46d9..7321da21b7 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -197,7 +197,6 @@ struct vhost_crypto {
struct rte_hash *session_map;
struct rte_mempool *mbuf_pool;
struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
struct rte_mempool *wb_pool;
/** DPDK cryptodev ID */
@@ -376,31 +375,21 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
return;
}
- session = rte_cryptodev_sym_session_create(vcrypto->sess_pool);
+ session = rte_cryptodev_sym_session_create(vcrypto->cid, &xform1,
+ vcrypto->sess_pool);
if (!session) {
VC_LOG_ERR("Failed to create session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
- if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,
- vcrypto->sess_priv_pool) < 0) {
- VC_LOG_ERR("Failed to initialize session");
- sess_param->session_id = -VIRTIO_CRYPTO_ERR;
- return;
- }
-
/* insert hash to map */
if (rte_hash_add_key_data(vcrypto->session_map,
&vcrypto->last_session_id, session) < 0) {
VC_LOG_ERR("Failed to insert session to hash table");
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0)
- VC_LOG_ERR("Failed to clear session");
- else {
- if (rte_cryptodev_sym_session_free(session) < 0)
- VC_LOG_ERR("Failed to free session");
- }
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0)
+ VC_LOG_ERR("Failed to free session");
sess_param->session_id = -VIRTIO_CRYPTO_ERR;
return;
}
@@ -427,12 +416,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
return -VIRTIO_CRYPTO_INVSESS;
}
- if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
- VC_LOG_DBG("Failed to clear session");
- return -VIRTIO_CRYPTO_ERR;
- }
-
- if (rte_cryptodev_sym_session_free(session) < 0) {
+ if (rte_cryptodev_sym_session_free(vcrypto->cid, session) < 0) {
VC_LOG_DBG("Failed to free session");
return -VIRTIO_CRYPTO_ERR;
}
@@ -1393,7 +1377,6 @@ rte_vhost_crypto_driver_start(const char *path)
int
rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
struct rte_mempool *sess_pool,
- struct rte_mempool *sess_priv_pool,
int socket_id)
{
struct virtio_net *dev = get_device(vid);
@@ -1415,7 +1398,6 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id,
}
vcrypto->sess_pool = sess_pool;
- vcrypto->sess_priv_pool = sess_priv_pool;
vcrypto->cid = cryptodev_id;
vcrypto->cache_session_id = UINT64_MAX;
vcrypto->last_session_id = 1;
--
2.25.1
^ permalink raw reply [relevance 1%]
* RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
[not found] ` <CO6PR18MB44848717BA4EA2FF8967D7CBD8509@CO6PR18MB4484.namprd18.prod.outlook.com>
@ 2022-09-24 16:34 3% ` Chautru, Nicolas
2022-09-27 9:43 3% ` Ferruh Yigit
2022-09-27 20:59 5% ` Chautru, Nicolas
0 siblings, 2 replies; 200+ results
From: Chautru, Nicolas @ 2022-09-24 16:34 UTC (permalink / raw)
To: Akhil Goyal, dev, Maxime Coquelin, ferruh.yigit, Ray Kinsella
Cc: Akhil Goyal, Chautru, Nicolas, thomas, Ray Kinsella, trix,
Richardson, Bruce, david.marchand, stephen, Zhang, Mingshan,
hemant.agrawal
Hi Ferruh, Ray, Akhil,
> > -----Original Message-----
> > From: Ferruh Yigit <ferruh.yigit@amd.com>
> > Sent: Friday, September 23, 2022 4:28 PM
> > To: Akhil Goyal <gakhil@marvell.com>; Nicolas Chautru
> > <nicolas.chautru@intel.com>; dev@dpdk.org; thomas@monjalon.net;
> > hemant.agrawal@nxp.com; Ray Kinsella <mdr@ashroe.eu>
> > Cc: maxime.coquelin@redhat.com; trix@redhat.com;
> > bruce.richardson@intel.com; david.marchand@redhat.com;
> > stephen@networkplumber.org; mingshan.zhang@intel.com
> > Subject: Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and
> > status information
> >
> > On 9/21/2022 8:21 PM, Akhil Goyal wrote:
> > >> diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index
> > >> ed528b8..b7ecf94 100644
> > >> --- a/lib/bbdev/rte_bbdev.h
> > >> +++ b/lib/bbdev/rte_bbdev.h
> > >> @@ -224,6 +224,19 @@ struct rte_bbdev_queue_conf {
> > >> rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
> > >>
> > >> /**
> > >> + * Flags indicate the reason why a previous enqueue may not have
> > >> + * consumed all requested operations
> > >> + * In case of multiple reasons the latter superdes a previous one
> > > Spell check - supersedes.
> > >
> > >> + */
> > >> +enum rte_bbdev_enqueue_status {
> > >> + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */
> > >> + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room
> in
> > >> queue */
> > >> + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room
> in
> > >> ring */
> > >> + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was
> > >> rejected as invalid */
> > >> + RTE_BBDEV_ENQ_STATUS_PADDED_MAX = 6, /**< Maximum enq
> > >> status number including padding */
> > >
> > > Are we ok to have this kind of padding across DPDK for all the enums
> > > to avoid
> > ABI issues?
> > > @Ray, @Thomas: any thoughts?
> > >
> > >
> >
> > This kind of usage can prevent ABI tool warning, and can fix issues
> > caused by application using returned enum as index [1].
> >
> > But I think it is still problematic in case application tries to walk
> > through till MAX, that is a common usage [2], user may miss that this
> > is PADDED.
Hi Ferruh,
I don’t believe that case can happen here. Even if application was using an undefined index, the related functions are protected for that :
See rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
The reason for having padded max, is that the application may use this for array sizing if required without concern, we will never return a value that would exceeds this.
In the other direction that is not a problem either since application (even it needs to store thigs in array) can used the padded version.
Note that this discussed with Ray notably as a BKM.
> >
> > Overall exchanging enum values between library and application is
> > possible trouble for binary compatibility. If application and library
> > uses enum values independently, this is OK.
> > Since enum cases not deleted but added in new version of the
> > libraries, more problematic usage is passing enum value from library
> > to application, and bbdev seems doing this in a few places.
I don’t see a case where it is a genuine issue.
An enum is being reported from library, even if due to future enum insertion there is a new enum reported between 2 ABI changes, that would still be within bounds.
> >
> > With current approach PADDED_MAX usage is more like #define usage, it
> > is not dynamic but a hardcoded value that is used as array size value.
> >
> > Not providing a MAX enum case restricts the application, application
> > can't use it as size of an array or can't use it walk through related
> > array, usage reduces to if/switch comparisons.
It can use the padded_max to size application array. Even if application was walking through these, there is no adverse effect.
> > Although this may not be most convenient for application, it can
> > provide safer usage for binary compatibility.
> >
> >
> > @Nic, what do you think provide these PADDED_MAX as #define SIZE_MAX
> > macros?
> > With this application still can allocate a relevant array with correct
> > size, or know the size of library provided array, but can't use it to
> > iterate on these arrays.
> >
That would be back to how it was done before which made things very inflexible and prevented to change these enums between ABIs versions.
This change was highlighted and discussed many months ago and flagged in the deprecation notice in previous release for that very reason.
Ray, can you please chime in since you know best.
Thanks Ferruh,
Nic
> >
> >
> >
> > [1]
> > --------------- library old version ---------------------------- enum
> > type {
> > CASE_A,
> > CASE_B,
> > CASE_MAX,
> > };
> >
> > struct data {
> > enum type type;
> > union {
> > type specific struct
> > };
> > };
> >
> > int api_get(struct data *data);
> >
> >
> > --------------- application ----------------------------
> >
> > struct data data;
> > int array[CASE_MAX];
> >
> > api_get(&data);
> > foo(array[data.type]);
> >
> >
> > --------------- library NEW version ----------------------------
> >
> > enum type {
> > CASE_A,
> > CASE_B,
> > CASE_C,
> > CASE_D,
> > CASE_MAX,
> > };
> >
> >
> > When application is NOT recompiled but using new version of the
> > library, values 'CASE_C' & 'CASE_D' will crash application, so this
> > will create a ABI compatibility issue.
> >
> > Note: In the past I have claimed that application should check
> > 'CASE_MAX', instead of using returned value directly as index, but
> > this is refused by argument that we can't control the application and
> > should play safe assuming application behaves wrong.
> >
> >
> >
> >
> > [2]
> >
> > --------------- library ----------------------------
> >
> > enum type {
> > CASE_NONE,
> > CASE_A,
> > CASE_B,
> > CASE_C,
> > CASE_D,
> > CASE_PADDED_MAX = 666,
> > };
> >
> > --------------- application ----------------------------
> >
> > for (int i = CASE_NONE; i < CASE_PADDED_MAX; i++)
> > fragile_init(i);
> >
> > ---
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
^ permalink raw reply [relevance 3%]
* [PATCH v5 0/3] Add and test IPsec SA expiry events
@ 2022-09-24 13:57 3% ` Akhil Goyal
2022-09-26 17:07 3% ` [PATCH v6 " Akhil Goyal
0 siblings, 1 reply; 200+ results
From: Akhil Goyal @ 2022-09-24 13:57 UTC (permalink / raw)
To: dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jerinj, adwivedi, anoobj,
ndabilpuram, Akhil Goyal
This patchset is carried forward from last release patches [1]
which added test application changes to test inline IPsec.
These patches were not merged due to the ABI compatibility issues
due to the extension of enum.
Changes in this version:
added reference to struct which raised these interrupts.
[1] https://patches.dpdk.org/project/dpdk/patch/20220416192530.173895-8-gakhil@marvell.com/
Vamsi Attunuru (3):
ethdev: add IPsec SA expiry event subtypes
test/security: add inline IPsec SA soft expiry cases
test/security: add inline IPsec SA hard expiry cases
app/test/test_cryptodev_security_ipsec.h | 2 +
app/test/test_security_inline_proto.c | 158 +++++++++++++++++-
app/test/test_security_inline_proto_vectors.h | 6 +
lib/ethdev/rte_ethdev.h | 23 ++-
4 files changed, 186 insertions(+), 3 deletions(-)
--
2.25.1
^ permalink raw reply [relevance 3%]
* Re: [PATCH v6 00/27] Bus and device cleanup for 22.11
@ 2022-09-24 7:14 0% ` David Marchand
0 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-09-24 7:14 UTC (permalink / raw)
To: dev
Cc: thomas, bruce.richardson, Ferruh Yigit, Andrew Rybchenko,
Ajit Khaparde, Qi Zhang, Jerin Jacob Kollanukkaran,
Raslan Darawsheh, Maxime Coquelin, Xia, Chenbo
On Wed, Sep 14, 2022 at 9:59 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> The rte_bus, rte_driver and rte_device objects are part of the public
> ABI and this has proved to be a problem when needing to extend them.
> This series hides them, and mark associated driver only API as internal.
>
> A good amount of the patches are preparation work on rte_bus.h,
> rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
> between them.
>
> PCI bus specific handling are removed from testpmd, unit tests and
> examples.
>
> After this series, driver-only API headers for registering to buses are
> not exported anymore, unless the enable_driver_sdk meson option is
> selected.
>
> New accessors for rte_bus, rte_driver and rte_device have been added,
> marked with an experimental tag first when introducing them, and later
> in the series marked as stable since external users will want to use
> those drop-in replacements right away.
>
> A check is added to ensure we won't pollute app/ and examples/ again,
> though some unit tests are left intentionnally untouched as they test
> some internals of DPDK.
>
> Changes since v5:
> - fixed Windows build (bis...),
I rebased the series and pushed it to main.
I had tested the series against some next-* repositories before.
It should be rather painless, but please subtree maintainers, don't
wait too much and rebase your trees.
--
David Marchand
^ permalink raw reply [relevance 0%]
* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
2022-09-23 7:13 0% ` David Marchand
@ 2022-09-23 21:56 0% ` Harris, James R
0 siblings, 0 replies; 200+ results
From: Harris, James R @ 2022-09-23 21:56 UTC (permalink / raw)
To: David Marchand
Cc: Walker, Benjamin, dev, Liu, Changpeng, Alexey Marchuk,
Shuhei Matsumoto, Thomas Monjalon, Richardson, Bruce,
Stephen Hemminger
> On Sep 23, 2022, at 12:13 AM, David Marchand <david.marchand@redhat.com> wrote:
>
> On Thu, Sep 22, 2022 at 12:29 AM Harris, James R
> <james.r.harris@intel.com> wrote:
>>
>>
>> So sticking with the internal header copies for now, this works fine
>> for LTS and non-LTS releases. What about stable releases (i.e. 22.11.1)?
>> IIUC, these header files could change in a stable release since they are
>> no longer part of the ABI?
>
> In theory, yes they can change.
> But this is a price to pay, as no one seems willing to invest and
> maintain a stable API for PCI drivers.
Understood. SPDK is preparing for this possibility, just wanted to confirm
it was necessary.
> I just noticed that some parts of the cleanups I had proposed have
> been merged in SPDK.
> Next time, I prefer getting some feedback from SPDK community before
> my SoB is applied (or stripped) on modified patches.
My apologies David. The RTE_DEV_FOREACH cleanup was a nice one and an obvious
improvement. I believe it was applied without any modifications (except for
fuzz offsets) but still should have given you a heads-up.
-Jim
^ permalink raw reply [relevance 0%]
* Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
@ 2022-09-23 10:57 4% ` Ferruh Yigit
[not found] ` <CO6PR18MB44848717BA4EA2FF8967D7CBD8509@CO6PR18MB4484.namprd18.prod.outlook.com>
0 siblings, 1 reply; 200+ results
From: Ferruh Yigit @ 2022-09-23 10:57 UTC (permalink / raw)
To: Akhil Goyal, Nicolas Chautru, dev, thomas, hemant.agrawal, Ray Kinsella
Cc: maxime.coquelin, trix, bruce.richardson, david.marchand, stephen,
mingshan.zhang
On 9/21/2022 8:21 PM, Akhil Goyal wrote:
>> diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
>> index ed528b8..b7ecf94 100644
>> --- a/lib/bbdev/rte_bbdev.h
>> +++ b/lib/bbdev/rte_bbdev.h
>> @@ -224,6 +224,19 @@ struct rte_bbdev_queue_conf {
>> rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
>>
>> /**
>> + * Flags indicate the reason why a previous enqueue may not have
>> + * consumed all requested operations
>> + * In case of multiple reasons the latter superdes a previous one
> Spell check - supersedes.
>
>> + */
>> +enum rte_bbdev_enqueue_status {
>> + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */
>> + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room in
>> queue */
>> + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room in
>> ring */
>> + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was
>> rejected as invalid */
>> + RTE_BBDEV_ENQ_STATUS_PADDED_MAX = 6, /**< Maximum enq
>> status number including padding */
>
> Are we ok to have this kind of padding across DPDK for all the enums to avoid ABI issues?
> @Ray, @Thomas: any thoughts?
>
>
This kind of usage can prevent ABI tool warning, and can fix issues
caused by application using returned enum as index [1].
But I think it is still problematic in case application tries to walk
through till MAX, that is a common usage [2], user may miss that this is
PADDED.
Overall exchanging enum values between library and application is
possible trouble for binary compatibility. If application and library
uses enum values independently, this is OK.
Since enum cases not deleted but added in new version of the libraries,
more problematic usage is passing enum value from library to
application, and bbdev seems doing this in a few places.
With current approach PADDED_MAX usage is more like #define usage, it is
not dynamic but a hardcoded value that is used as array size value.
Not providing a MAX enum case restricts the application, application
can't use it as size of an array or can't use it walk through related
array, usage reduces to if/switch comparisons.
Although this may not be most convenient for application, it can provide
safer usage for binary compatibility.
@Nic, what do you think provide these PADDED_MAX as #define SIZE_MAX macros?
With this application still can allocate a relevant array with correct
size, or know the size of library provided array, but can't use it to
iterate on these arrays.
[1]
--------------- library old version ----------------------------
enum type {
CASE_A,
CASE_B,
CASE_MAX,
};
struct data {
enum type type;
union {
type specific struct
};
};
int api_get(struct data *data);
--------------- application ----------------------------
struct data data;
int array[CASE_MAX];
api_get(&data);
foo(array[data.type]);
--------------- library NEW version ----------------------------
enum type {
CASE_A,
CASE_B,
CASE_C,
CASE_D,
CASE_MAX,
};
When application is NOT recompiled but using new version of the library,
values 'CASE_C' & 'CASE_D' will crash application, so this will create a
ABI compatibility issue.
Note: In the past I have claimed that application should check
'CASE_MAX', instead of using returned value directly as index, but this
is refused by argument that we can't control the application and should
play safe assuming application behaves wrong.
[2]
--------------- library ----------------------------
enum type {
CASE_NONE,
CASE_A,
CASE_B,
CASE_C,
CASE_D,
CASE_PADDED_MAX = 666,
};
--------------- application ----------------------------
for (int i = CASE_NONE; i < CASE_PADDED_MAX; i++)
fragile_init(i);
---
^ permalink raw reply [relevance 4%]
* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
@ 2022-09-23 7:13 0% ` David Marchand
2022-09-23 21:56 0% ` Harris, James R
0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-09-23 7:13 UTC (permalink / raw)
To: Harris, James R
Cc: Walker, Benjamin, dev, Liu, Changpeng, Alexey Marchuk,
Shuhei Matsumoto, Thomas Monjalon, Richardson, Bruce,
Stephen Hemminger
On Thu, Sep 22, 2022 at 12:29 AM Harris, James R
<james.r.harris@intel.com> wrote:
> > On Aug 30, 2022, at 8:09 AM, David Marchand <david.marchand@redhat.com> wrote:
> >
> > On Mon, Aug 29, 2022 at 7:12 PM Walker, Benjamin
> > <benjamin.walker@intel.com> wrote:
> >>>> Can we keep rte_pci_register(), or a new variation of it that keeps
> >>>> the rte_pci_driver structure hidden? Hiding rte_pci_register() would
> >>>> mean SPDK can no longer work with a packaged DPDK. Or the DPDK
> >>>> packages would need to set enable_driver_sdk which I suspect is not the
> >>> intent.
> >>>
> >>> What do you think if SPDK maintains a copy of the internal headers?
> >>>
> >>> The internal API are not supposed to change that often, but we (DPDK) won't
> >>> guarantee it.
> >>> This would still put some maintenance burden on SPDK but I think it is a good
> >>> compromise.
> >>>
> >>
> >> Would these internal symbols be considered part of the public/official ABI? When
> >
> > What do you mean by "public/official"?
> > If you mean the "stable" ABI (as described in the ABI policy document
> > and for which compatibility is preserved across minor versions of the
> > ABI), the answer is no: internal symbols are not part of it.
> >
> >
> >> SPDK goes to dynamically load a shared DPDK library, how can we detect
> >> whether it's a version that we support linking against?
> >
> > The runtime version of a DPDK library is available via rte_version().
> >
> >
> > As for the PCI drivers that SPDK wants to register in DPDK, what do
> > you think if SPDK people added and maintained a "generic" PCI driver
> > in DPDK.
> > This driver would expose a new API (which can not re-expose internal
> > structures, like rte_pci_driver and consorts) and ensure its ABI is
> > maintained in the long term.
> > This makes me think of pci-stub, but in DPDK.
> >
> > I did not think too much about it and I don't understand what SPDK
> > requires, but is there something wrong with this approach?
>
> The stub driver idea is interesting. In the past we’ve needed access to more
> than what a stub driver would provide - for example, to work around kernel
> vfio + pci bugs when we probe 24 NVMe SSDs behind a PCIe switch that is
> hot-inserted, or conversely handling hot removal of that same switch. So
> I’m worried that even if we do the stub driver, we end up running into a
> case where we need these header file copies anyways. Not ruling the stub
> driver out, but I think it's a longer-term goal, not something we would have
> ready for 22.11 obviously.
>
> So sticking with the internal header copies for now, this works fine
> for LTS and non-LTS releases. What about stable releases (i.e. 22.11.1)?
> IIUC, these header files could change in a stable release since they are
> no longer part of the ABI?
In theory, yes they can change.
But this is a price to pay, as no one seems willing to invest and
maintain a stable API for PCI drivers.
I just noticed that some parts of the cleanups I had proposed have
been merged in SPDK.
Next time, I prefer getting some feedback from SPDK community before
my SoB is applied (or stripped) on modified patches.
Thanks.
--
David Marchand
^ permalink raw reply [relevance 0%]
* [PATCH v1 1/1] doc: release note update for the bbdev change
@ 2022-09-22 20:58 4% ` Nic Chautru
0 siblings, 0 replies; 200+ results
From: Nic Chautru @ 2022-09-22 20:58 UTC (permalink / raw)
To: dev, gakhil; +Cc: Nic Chautru
To be squashed by Akhil.
Signed-off-by: Nic Chautru <nicolas.chautru@intel.com>
---
doc/guides/rel_notes/release_22_11.rst | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..22c0f23e39 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,14 @@ API Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* bbdev: Added new operation for FFT processing with notably the new functions
+ ``rte_bbdev_enqueue_fft_ops`` and ``rte_bbdev_dequeue_fft_ops`` and related structures.
+
+* bbdev: Updated enums such as ``rte_bbdev_op_type`` to include padding and to allow for
+ futureproof enum insertion.
+
+* bbdev: Updated structures to allow for new parameters for device status, queue topology and
+ queue status being exposed using ``rte_bbdev_enqueue_status `` and ``rte_bbdev_device_status``.
ABI Changes
-----------
--
2.37.1
^ permalink raw reply [relevance 4%]
* [PATCH v9 1/7] bbdev: allow operation type enum for growth
@ 2022-09-22 17:45 3% ` Nic Chautru
0 siblings, 0 replies; 200+ results
From: Nic Chautru @ 2022-09-22 17:45 UTC (permalink / raw)
To: dev, thomas, gakhil
Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
stephen, mingshan.zhang, hemant.agrawal, Nicolas Chautru
From: Nicolas Chautru <nicolas.chautru@intel.com>
Updating the enum for rte_bbdev_op_type
to allow to keep ABI compatible for enum insertion
while adding padded maximum value for array need.
Removing RTE_BBDEV_OP_TYPE_COUNT and instead exposing
RTE_BBDEV_OP_TYPE_PADDED_MAX.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
app/test-bbdev/test_bbdev.c | 2 +-
app/test-bbdev/test_bbdev_perf.c | 4 ++--
examples/bbdev_app/main.c | 2 +-
lib/bbdev/rte_bbdev.c | 8 +++++---
lib/bbdev/rte_bbdev_op.h | 2 +-
5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c
index ac06d73..1063f6e 100644
--- a/app/test-bbdev/test_bbdev.c
+++ b/app/test-bbdev/test_bbdev.c
@@ -521,7 +521,7 @@ struct bbdev_testsuite_params {
rte_mempool_free(mp);
TEST_ASSERT((mp = rte_bbdev_op_pool_create("Test_INV",
- RTE_BBDEV_OP_TYPE_COUNT, size, cache_size, 0)) == NULL,
+ RTE_BBDEV_OP_TYPE_PADDED_MAX, size, cache_size, 0)) == NULL,
"Failed test for rte_bbdev_op_pool_create: "
"returned value is not NULL for invalid type");
diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index fad3b1e..1abda2d 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -2428,13 +2428,13 @@ typedef int (test_case_function)(struct active_device *ad,
/* Find capabilities */
const struct rte_bbdev_op_cap *cap = info.drv.capabilities;
- for (i = 0; i < RTE_BBDEV_OP_TYPE_COUNT; i++) {
+ do {
if (cap->type == test_vector.op_type) {
capabilities = cap;
break;
}
cap++;
- }
+ } while (cap->type != RTE_BBDEV_OP_NONE);
TEST_ASSERT_NOT_NULL(capabilities,
"Couldn't find capabilities");
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index fc7e8b8..ef0ba76 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -1041,7 +1041,7 @@ uint16_t bbdev_parse_number(const char *mask)
void *sigret;
struct app_config_params app_params = def_app_config;
struct rte_mempool *ethdev_mbuf_mempool, *bbdev_mbuf_mempool;
- struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_COUNT];
+ struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_PADDED_MAX];
struct lcore_conf lcore_conf[RTE_MAX_LCORE] = { {0} };
struct lcore_statistics lcore_stats[RTE_MAX_LCORE] = { {0} };
struct stats_lcore_params stats_lcore;
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index aaee7b7..4da8047 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -23,6 +23,8 @@
#define DEV_NAME "BBDEV"
+/* Number of supported operation types */
+#define BBDEV_OP_TYPE_COUNT 5
/* BBDev library logging ID */
RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE);
@@ -890,10 +892,10 @@ struct rte_mempool *
return NULL;
}
- if (type >= RTE_BBDEV_OP_TYPE_COUNT) {
+ if (type >= BBDEV_OP_TYPE_COUNT) {
rte_bbdev_log(ERR,
"Invalid op type (%u), should be less than %u",
- type, RTE_BBDEV_OP_TYPE_COUNT);
+ type, BBDEV_OP_TYPE_COUNT);
return NULL;
}
@@ -1125,7 +1127,7 @@ struct rte_mempool *
"RTE_BBDEV_OP_LDPC_ENC",
};
- if (op_type < RTE_BBDEV_OP_TYPE_COUNT)
+ if (op_type < BBDEV_OP_TYPE_COUNT)
return op_types[op_type];
rte_bbdev_log(ERR, "Invalid operation type");
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index 6d56133..cd82418 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -748,7 +748,7 @@ enum rte_bbdev_op_type {
RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */
RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */
RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */
- RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */
+ RTE_BBDEV_OP_TYPE_PADDED_MAX = 8, /**< Maximum op type number including padding */
};
/** Bit indexes of possible errors reported through status field */
--
1.8.3.1
^ permalink raw reply [relevance 3%]
* RE: [PATCH v2 1/6] cryptodev: rework session framework
@ 2022-09-22 14:06 0% ` Ji, Kai
0 siblings, 0 replies; 200+ results
From: Ji, Kai @ 2022-09-22 14:06 UTC (permalink / raw)
To: Akhil Goyal, dev
Cc: thomas, david.marchand, hemant.agrawal, vattunuru, ferruh.yigit,
andrew.rybchenko, konstantin.v.ananyev, jiawenwu, yisen.zhuang,
irusskikh, jerinj, adwivedi, maxime.coquelin, chandu,
ruifeng.wang, ajit.khaparde, anoobj, De Lara Guarch, Pablo,
matan, g.singh, Yang, Qiming, Wu, Wenjun1, jianwang, Wu,
Jingjing, Xing, Beilei, ndabilpuram, Zhang, Roy Fan
Acked-by: Kai Ji <kai.ji@intel.com>
> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Wednesday, September 21, 2022 4:03 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; david.marchand@redhat.com;
> hemant.agrawal@nxp.com; vattunuru@marvell.com;
> ferruh.yigit@xilinx.com; andrew.rybchenko@oktetlabs.ru;
> konstantin.v.ananyev@yandex.ru; jiawenwu@trustnetic.com;
> yisen.zhuang@huawei.com; irusskikh@marvell.com; jerinj@marvell.com;
> adwivedi@marvell.com; maxime.coquelin@redhat.com; chandu@amd.com;
> ruifeng.wang@arm.com; ajit.khaparde@broadcom.com;
> anoobj@marvell.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; matan@nvidia.com; g.singh@nxp.com;
> Yang, Qiming <qiming.yang@intel.com>; Wu, Wenjun1
> <wenjun1.wu@intel.com>; jianwang@trustnetic.com; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> ndabilpuram@marvell.com; Akhil Goyal <gakhil@marvell.com>; Zhang, Roy
> Fan <roy.fan.zhang@intel.com>
> Subject: [PATCH v2 1/6] cryptodev: rework session framework
>
> As per current design, rte_cryptodev_sym_session_create() and
> rte_cryptodev_sym_session_init() use separate mempool objects
> for a single session.
> And structure rte_cryptodev_sym_session is not directly used
> by the application, it may cause ABI breakage if the structure
> is modified in future.
>
> To address these two issues, the rte_cryptodev_sym_session_create
> will take one mempool object that the session and session private
> data are virtually/physically contiguous, and initializes both
> fields. The API rte_cryptodev_sym_session_init is removed.
>
> rte_cryptodev_sym_session_create will now return an opaque session
> pointer which will be used by the app and other APIs.
>
> In data path, opaque session pointer is attached to rte_crypto_op
> and the PMD can call an internal library API to get the session
> private data pointer based on the driver id.
>
> Note: currently single session may be used by different device
> drivers, given it is initialized by them. After the change the
> session created by one device driver cannot be used or
> reinitialized by another driver.
>
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
^ permalink raw reply [relevance 0%]
* [PATCH 2/2] net/nfp: optimize ethdev struct
@ 2022-09-22 13:03 4% ` Niklas Söderlund
0 siblings, 0 replies; 200+ results
From: Niklas Söderlund @ 2022-09-22 13:03 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Jin Liu, Chaoyong He, Niklas Söderlund
From: Jin Liu <jin.liu@corigine.com>
Before, use two variables to represent the ethdev structure for
firmware with NFDk and NFD3, but only a few field values differ
between the two variables. Now use one variable only, and to
distinguish different firmware versions in specific functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 36 +++------------------------------
drivers/net/nfp/nfp_ethdev_vf.c | 36 +++------------------------------
drivers/net/nfp/nfp_rxtx.c | 33 ++++++++++++++++++++++++++++--
drivers/net/nfp/nfp_rxtx.h | 5 +----
4 files changed, 38 insertions(+), 72 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index bc69840777eb..3cb889bd015f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -313,7 +313,7 @@ nfp_net_close(struct rte_eth_dev *dev)
}
/* Initialise and register driver with DPDK Application */
-static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = {
+static const struct eth_dev_ops nfp_net_eth_dev_ops = {
.dev_configure = nfp_net_configure,
.dev_start = nfp_net_start,
.dev_stop = nfp_net_stop,
@@ -336,36 +336,7 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = {
.rss_hash_conf_get = nfp_net_rss_hash_conf_get,
.rx_queue_setup = nfp_net_rx_queue_setup,
.rx_queue_release = nfp_net_rx_queue_release,
- .tx_queue_setup = nfp_net_nfd3_tx_queue_setup,
- .tx_queue_release = nfp_net_tx_queue_release,
- .rx_queue_intr_enable = nfp_rx_queue_intr_enable,
- .rx_queue_intr_disable = nfp_rx_queue_intr_disable,
-};
-
-static const struct eth_dev_ops nfp_net_nfdk_eth_dev_ops = {
- .dev_configure = nfp_net_configure,
- .dev_start = nfp_net_start,
- .dev_stop = nfp_net_stop,
- .dev_set_link_up = nfp_net_set_link_up,
- .dev_set_link_down = nfp_net_set_link_down,
- .dev_close = nfp_net_close,
- .promiscuous_enable = nfp_net_promisc_enable,
- .promiscuous_disable = nfp_net_promisc_disable,
- .link_update = nfp_net_link_update,
- .stats_get = nfp_net_stats_get,
- .stats_reset = nfp_net_stats_reset,
- .dev_infos_get = nfp_net_infos_get,
- .dev_supported_ptypes_get = nfp_net_supported_ptypes_get,
- .mtu_set = nfp_net_dev_mtu_set,
- .mac_addr_set = nfp_net_set_mac_addr,
- .vlan_offload_set = nfp_net_vlan_offload_set,
- .reta_update = nfp_net_reta_update,
- .reta_query = nfp_net_reta_query,
- .rss_hash_update = nfp_net_rss_hash_update,
- .rss_hash_conf_get = nfp_net_rss_hash_conf_get,
- .rx_queue_setup = nfp_net_rx_queue_setup,
- .rx_queue_release = nfp_net_rx_queue_release,
- .tx_queue_setup = nfp_net_nfdk_tx_queue_setup,
+ .tx_queue_setup = nfp_net_tx_queue_setup,
.tx_queue_release = nfp_net_tx_queue_release,
.rx_queue_intr_enable = nfp_rx_queue_intr_enable,
.rx_queue_intr_disable = nfp_rx_queue_intr_disable,
@@ -376,7 +347,6 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)
{
switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
case NFP_NET_CFG_VERSION_DP_NFD3:
- eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops;
eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
break;
case NFP_NET_CFG_VERSION_DP_NFDK:
@@ -385,7 +355,6 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)
NFD_CFG_MAJOR_VERSION_of(hw->ver));
return -EINVAL;
}
- eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops;
eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;
break;
default:
@@ -393,6 +362,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)
return -EINVAL;
}
+ eth_dev->dev_ops = &nfp_net_eth_dev_ops;
eth_dev->rx_queue_count = nfp_net_rx_queue_count;
eth_dev->rx_pkt_burst = &nfp_net_recv_pkts;
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index affea9d17cdf..96c4d3cca7bb 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -218,7 +218,7 @@ nfp_netvf_close(struct rte_eth_dev *dev)
}
/* Initialise and register VF driver with DPDK Application */
-static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = {
+static const struct eth_dev_ops nfp_netvf_eth_dev_ops = {
.dev_configure = nfp_net_configure,
.dev_start = nfp_netvf_start,
.dev_stop = nfp_netvf_stop,
@@ -241,36 +241,7 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = {
.rss_hash_conf_get = nfp_net_rss_hash_conf_get,
.rx_queue_setup = nfp_net_rx_queue_setup,
.rx_queue_release = nfp_net_rx_queue_release,
- .tx_queue_setup = nfp_net_nfd3_tx_queue_setup,
- .tx_queue_release = nfp_net_tx_queue_release,
- .rx_queue_intr_enable = nfp_rx_queue_intr_enable,
- .rx_queue_intr_disable = nfp_rx_queue_intr_disable,
-};
-
-static const struct eth_dev_ops nfp_netvf_nfdk_eth_dev_ops = {
- .dev_configure = nfp_net_configure,
- .dev_start = nfp_netvf_start,
- .dev_stop = nfp_netvf_stop,
- .dev_set_link_up = nfp_netvf_set_link_up,
- .dev_set_link_down = nfp_netvf_set_link_down,
- .dev_close = nfp_netvf_close,
- .promiscuous_enable = nfp_net_promisc_enable,
- .promiscuous_disable = nfp_net_promisc_disable,
- .link_update = nfp_net_link_update,
- .stats_get = nfp_net_stats_get,
- .stats_reset = nfp_net_stats_reset,
- .dev_infos_get = nfp_net_infos_get,
- .dev_supported_ptypes_get = nfp_net_supported_ptypes_get,
- .mtu_set = nfp_net_dev_mtu_set,
- .mac_addr_set = nfp_net_set_mac_addr,
- .vlan_offload_set = nfp_net_vlan_offload_set,
- .reta_update = nfp_net_reta_update,
- .reta_query = nfp_net_reta_query,
- .rss_hash_update = nfp_net_rss_hash_update,
- .rss_hash_conf_get = nfp_net_rss_hash_conf_get,
- .rx_queue_setup = nfp_net_rx_queue_setup,
- .rx_queue_release = nfp_net_rx_queue_release,
- .tx_queue_setup = nfp_net_nfdk_tx_queue_setup,
+ .tx_queue_setup = nfp_net_tx_queue_setup,
.tx_queue_release = nfp_net_tx_queue_release,
.rx_queue_intr_enable = nfp_rx_queue_intr_enable,
.rx_queue_intr_disable = nfp_rx_queue_intr_disable,
@@ -281,7 +252,6 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)
{
switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
case NFP_NET_CFG_VERSION_DP_NFD3:
- eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops;
eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
break;
case NFP_NET_CFG_VERSION_DP_NFDK:
@@ -290,7 +260,6 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)
NFD_CFG_MAJOR_VERSION_of(hw->ver));
return -EINVAL;
}
- eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops;
eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;
break;
default:
@@ -298,6 +267,7 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)
return -EINVAL;
}
+ eth_dev->dev_ops = &nfp_netvf_eth_dev_ops;
eth_dev->rx_queue_count = nfp_net_rx_queue_count;
eth_dev->rx_pkt_burst = &nfp_net_recv_pkts;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 8429b44de06d..12db07c276f0 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -657,7 +657,7 @@ nfp_net_reset_tx_queue(struct nfp_net_txq *txq)
txq->rd_p = 0;
}
-int
+static int
nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
uint16_t nb_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf)
@@ -991,7 +991,7 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
return i;
}
-int
+static int
nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
uint16_t queue_idx,
uint16_t nb_desc,
@@ -1108,6 +1108,35 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
+int
+nfp_net_tx_queue_setup(struct rte_eth_dev *dev,
+ uint16_t queue_idx,
+ uint16_t nb_desc,
+ unsigned int socket_id,
+ const struct rte_eth_txconf *tx_conf)
+{
+ struct nfp_net_hw *hw;
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
+ case NFP_NET_CFG_VERSION_DP_NFD3:
+ return nfp_net_nfd3_tx_queue_setup(dev, queue_idx,
+ nb_desc, socket_id, tx_conf);
+ case NFP_NET_CFG_VERSION_DP_NFDK:
+ if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) {
+ PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer, found: %d",
+ NFD_CFG_MAJOR_VERSION_of(hw->ver));
+ return -EINVAL;
+ }
+ return nfp_net_nfdk_tx_queue_setup(dev, queue_idx,
+ nb_desc, socket_id, tx_conf);
+ default:
+ PMD_DRV_LOG(ERR, "The version of firmware is not correct.");
+ return -EINVAL;
+ }
+}
+
static inline uint32_t
nfp_net_nfdk_free_tx_desc(struct nfp_net_txq *txq)
{
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 5c005d74e79b..fa90c3e8e751 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -342,12 +342,9 @@ int nfp_net_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
struct rte_mempool *mp);
void nfp_net_tx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx);
void nfp_net_reset_tx_queue(struct nfp_net_txq *txq);
-int nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
- uint16_t nb_desc, unsigned int socket_id,
- const struct rte_eth_txconf *tx_conf);
uint16_t nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
-int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
+int nfp_net_tx_queue_setup(struct rte_eth_dev *dev,
uint16_t queue_idx,
uint16_t nb_desc,
unsigned int socket_id,
--
2.37.3
^ permalink raw reply [relevance 4%]
Results 2001-2200 of ~18000 next (older) | prev (newer) | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
2021-12-26 15:34 [RFC] mempool: rte_mempool_do_generic_get optimizations Morten Brørup
2022-02-02 10:33 ` [PATCH v4] mempool: fix mempool cache flushing algorithm Morten Brørup
2022-10-04 20:01 0% ` Morten Brørup
2022-10-09 13:37 4% ` [PATCH v6 0/4] " Andrew Rybchenko
2022-10-09 13:37 ` [PATCH v6 3/4] mempool: fix " Andrew Rybchenko
2022-10-09 14:31 3% ` Morten Brørup
2022-10-09 14:51 0% ` Andrew Rybchenko
2022-10-09 15:08 0% ` Morten Brørup
2022-10-14 14:01 3% ` Olivier Matz
2022-10-14 15:57 3% ` Morten Brørup
2022-10-14 19:50 0% ` Olivier Matz
2022-10-15 6:57 0% ` Morten Brørup
2022-10-18 16:32 0% ` Jerin Jacob
2022-04-16 19:25 [PATCH v4 07/10] ethdev: add IPsec SA expiry event subtypes Akhil Goyal
2022-09-24 13:57 3% ` [PATCH v5 0/3] Add and test IPsec SA expiry events Akhil Goyal
2022-09-26 17:07 3% ` [PATCH v6 " Akhil Goyal
2022-04-19 9:01 [PATCH] doc: fix typos 'depreciated' instead of 'deprecated' Stephen Coleman
2022-04-19 15:44 ` Ray Kinsella
2022-11-15 16:13 0% ` Thomas Monjalon
2022-04-19 16:14 [RFC] eal: add bus cleanup to eal cleanup Kevin Laatz
2022-06-03 14:36 ` [PATCH v7] " Kevin Laatz
2022-06-07 11:09 ` Thomas Monjalon
2022-06-07 15:12 ` David Marchand
2022-06-13 15:58 ` Bruce Richardson
2022-10-03 12:35 0% ` David Marchand
2022-10-03 14:39 0% ` Kevin Laatz
2022-06-17 18:37 [PATCH v2 5/5] bbdev: add new operation for FFT processing Nicolas Chautru
2022-08-29 18:07 ` [PATCH v7 0/7] bbdev changes for 22.11 Nicolas Chautru
2022-08-29 18:07 ` [PATCH v7 6/7] bbdev: add queue related warning and status information Nicolas Chautru
2022-09-21 19:21 ` [EXT] " Akhil Goyal
2022-09-23 10:57 4% ` Ferruh Yigit
[not found] ` <CO6PR18MB44848717BA4EA2FF8967D7CBD8509@CO6PR18MB4484.namprd18.prod.outlook.com>
2022-09-24 16:34 3% ` Chautru, Nicolas
2022-09-27 9:43 3% ` Ferruh Yigit
2022-09-27 20:59 5% ` Chautru, Nicolas
2022-09-29 18:10 3% ` Ferruh Yigit
2022-09-29 18:32 3% ` Akhil Goyal
2022-09-29 19:48 0% ` Chautru, Nicolas
2022-09-30 7:54 0% ` Maxime Coquelin
2022-09-22 17:45 ` [PATCH v9 0/7] bbdev changes for 22.11 Nic Chautru
2022-09-22 17:45 3% ` [PATCH v9 1/7] bbdev: allow operation type enum for growth Nic Chautru
2022-09-30 18:45 ` [PATCH v10 0/7] bbdev changes for 22.11 Nicolas Chautru
2022-09-30 18:45 3% ` [PATCH v10 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
2022-09-30 18:46 ` [PATCH v10 6/7] bbdev: add queue related warning and status information Nicolas Chautru
2022-10-03 8:28 3% ` Thomas Monjalon
2022-10-03 16:39 3% ` Chautru, Nicolas
2022-10-03 17:21 0% ` Thomas Monjalon
2022-10-03 18:00 ` [PATCH v11 0/7] bbdev changes for 22.11 Nicolas Chautru
2022-10-03 18:00 7% ` [PATCH v11 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
2022-10-03 18:00 4% ` [PATCH v11 2/7] bbdev: add device status info Nicolas Chautru
2022-10-03 18:00 5% ` [PATCH v11 3/7] bbdev: add device info on queue topology Nicolas Chautru
2022-10-03 18:00 4% ` [PATCH v11 6/7] bbdev: add queue related warning and status information Nicolas Chautru
2022-10-04 17:16 ` [PATCH v12 0/7] bbdev changes for 22.11 Nicolas Chautru
2022-10-04 17:16 7% ` [PATCH v12 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
2022-10-04 17:16 4% ` [PATCH v12 2/7] bbdev: add device status info Nicolas Chautru
2022-10-04 17:16 5% ` [PATCH v12 3/7] bbdev: add device info on queue topology Nicolas Chautru
2022-10-04 17:16 4% ` [PATCH v12 6/7] bbdev: add queue related warning and status information Nicolas Chautru
2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
2022-07-28 15:26 ` [RFC v3 00/26] Bus and device " David Marchand
2022-08-04 23:19 ` Harris, James R
2022-08-25 9:31 ` David Marchand
2022-08-29 17:12 ` Walker, Benjamin
2022-08-30 15:09 ` David Marchand
2022-09-21 22:29 ` Harris, James R
2022-09-23 7:13 0% ` David Marchand
2022-09-23 21:56 0% ` Harris, James R
2022-09-14 7:58 ` [PATCH v6 00/27] " David Marchand
2022-09-24 7:14 0% ` David Marchand
2022-07-13 13:03 [dpdk-dev] [PATCH v1] ethdev: support congestion management jerinj
2022-09-19 12:15 ` [PATCH v2 1/1] " skori
2022-09-28 8:19 0% ` Andrew Rybchenko
2022-09-29 9:35 2% ` [PATCH v3 " skori
2022-10-04 9:02 0% ` Andrew Rybchenko
2022-10-04 9:04 0% ` Andrew Rybchenko
2022-07-21 4:46 [RFC] memarea: introduce memory area library Chengwen Feng
[not found] ` <20221005040952.8166-1-datshan@qq.com>
2022-10-05 4:09 ` [PATCH v5 01/10] memarea: introduce memarea library datshan
2022-10-06 20:15 ` Mattias Rönnblom
2022-10-08 7:53 ` fengchengwen
2022-10-10 16:53 4% ` Mattias Rönnblom
2022-10-10 23:33 0% ` fengchengwen
2022-10-11 15:35 0% ` Mattias Rönnblom
2022-08-04 13:44 [PATCH 0/6] add trace points in ethdev library Ankur Dwivedi
2022-09-29 10:29 ` [PATCH v2 0/4] " Ankur Dwivedi
2022-09-29 10:29 ` [PATCH v2 1/4] ethdev: add trace points Ankur Dwivedi
2022-10-06 7:09 ` Andrew Rybchenko
2022-10-06 7:24 ` [EXT] " Ankur Dwivedi
2022-10-06 7:27 4% ` Andrew Rybchenko
2022-10-06 7:43 0% ` Ankur Dwivedi
2022-10-06 7:50 0% ` Andrew Rybchenko
2022-10-06 7:57 0% ` David Marchand
2022-10-12 9:49 0% ` Jerin Jacob
2022-10-12 9:56 0% ` David Marchand
2022-08-08 10:58 [PATCH 0/1] update abi maintainership Ray Kinsella
2022-08-08 10:58 ` [PATCH 1/1] devtools: eol abi as a separate function Ray Kinsella
2022-10-11 0:36 4% ` Thomas Monjalon
2022-08-12 19:18 [PATCH 00/13] ethdev: proceed with flow subsystem rework Ivan Malov
2022-08-12 19:18 ` [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT Ivan Malov
2022-08-22 5:33 ` Ori Kam
2022-09-27 7:08 0% ` Thomas Monjalon
2022-09-27 16:18 0% ` Ajit Khaparde
2022-08-29 16:06 [PATCH 0/3] cryptodev: sym session framework rework Fan Zhang
2022-09-21 15:02 ` [PATCH v2 0/6] crypto/security " Akhil Goyal
2022-09-21 15:02 ` [PATCH v2 1/6] cryptodev: rework session framework Akhil Goyal
2022-09-22 14:06 0% ` Ji, Kai
2022-09-24 16:35 ` [PATCH v3 0/6] crypto/security session framework rework Akhil Goyal
2022-09-24 16:35 1% ` [PATCH v3 1/6] cryptodev: rework session framework Akhil Goyal
2022-09-24 16:35 1% ` [PATCH v3 3/6] cryptodev: hide sym session structure Akhil Goyal
2022-09-24 16:35 2% ` [PATCH v3 6/6] security: hide " Akhil Goyal
2022-09-26 19:14 ` [PATCH v4 0/6] crypto/security session framework rework Akhil Goyal
2022-09-26 19:14 1% ` [PATCH v4 1/6] cryptodev: rework session framework Akhil Goyal
2022-09-26 19:14 1% ` [PATCH v4 3/6] cryptodev: hide sym session structure Akhil Goyal
2022-09-26 19:14 2% ` [PATCH v4 6/6] security: hide " Akhil Goyal
2022-09-07 13:43 [PATCH v2 0/5] mbuf dynamic field expansion Shijith Thotton
2022-09-21 13:56 ` [PATCH v3 " Shijith Thotton
2022-09-21 13:56 ` [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build Shijith Thotton
2022-09-28 7:24 ` Thomas Monjalon
2022-09-28 12:52 4% ` Olivier Matz
2022-09-28 19:33 0% ` Thomas Monjalon
2022-09-28 19:48 0% ` Stephen Hemminger
2022-09-29 6:13 0% ` [EXT] " Shijith Thotton
2022-09-21 13:56 ` [PATCH v3 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA Shijith Thotton
2022-09-28 12:53 4% ` Olivier Matz
2022-09-29 6:19 0% ` [EXT] " Shijith Thotton
2022-09-29 7:44 0% ` Olivier Matz
2022-09-29 8:10 0% ` Shijith Thotton
2022-10-07 19:30 ` [PATCH v4 0/7] mbuf dynamic field expansion Shijith Thotton
2022-10-07 19:30 5% ` [PATCH v4 5/7] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-10-07 21:02 ` [PATCH v5 0/7] mbuf dynamic field expansion Shijith Thotton
2022-10-07 21:02 5% ` [PATCH v5 5/7] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-09-15 7:07 [PATCH v4 1/3] ethdev: Add support for mulitiple mbuf pools per Rx queue Hanumanth Pothula
2022-10-06 17:01 ` [PATCH v5 1/3] ethdev: support " Hanumanth Pothula
2022-10-06 17:29 ` Stephen Hemminger
2022-10-07 14:13 3% ` Andrew Rybchenko
2022-09-15 8:26 [PATCH] cryptodev: add missing algorithm strings Volodymyr Fialko
2022-11-02 10:50 4% ` Kevin Traynor
2022-11-02 10:58 0% ` [EXT] " Akhil Goyal
2022-11-02 12:13 4% ` David Marchand
2022-11-02 12:31 0% ` Akhil Goyal
2022-09-22 13:03 [PATCH 0/2] net/nfp: use a single struct eth_dev_ops Niklas Söderlund
2022-09-22 13:03 4% ` [PATCH 2/2] net/nfp: optimize ethdev struct Niklas Söderlund
2022-09-22 20:58 [PATCH v1 0/1] doc: release note update related to bbdev Nic Chautru
2022-09-22 20:58 4% ` [PATCH v1 1/1] doc: release note update for the bbdev change Nic Chautru
2022-09-23 13:16 [PATCH] ethdev: queue rate parameter changed from 16b to 32b skoteshwar
2022-09-28 5:51 3% ` [PATCH v3] " skoteshwar
2022-09-30 9:57 3% ` Satha Koteswara Rao Kottidi
2022-10-03 5:42 2% ` Satha Koteswara Rao Kottidi
2022-09-29 9:22 [PATCH 0/4] ethdev: remove not supported flow actions Andrew Rybchenko
2022-09-29 9:22 3% ` [PATCH 1/4] ethdev: remove deprecated flow action to set MPLS TTL Andrew Rybchenko
2022-09-29 16:23 0% ` Ajit Khaparde
2022-09-29 9:22 3% ` [PATCH 2/4] ethdev: remove deprecated flow action to decrement " Andrew Rybchenko
2022-09-29 16:23 0% ` Ajit Khaparde
2022-09-29 9:22 3% ` [PATCH 3/4] ethdev: remove deprecated flow action to set layer 3 TTL Andrew Rybchenko
2022-09-29 16:24 0% ` Ajit Khaparde
2022-09-29 9:22 3% ` [PATCH 4/4] ethdev: remove deprecated flow actions to copy TTL Andrew Rybchenko
2022-09-29 16:24 0% ` Ajit Khaparde
2022-09-29 12:05 4% [PATCH] drivers/bus: set device NUMA node to unknown by default Olivier Matz
2022-09-30 7:10 David Marchand
2022-10-04 14:58 3% ` [PATCH v2] " Olivier Matz
2022-10-05 8:52 0% ` David Marchand
2022-10-05 9:04 0% ` Olivier Matz
2022-10-05 9:32 0% ` Thomas Monjalon
2022-09-30 8:02 [PATCH v7 0/7] Introduce support for LoongArch architecture Min Zhou
2022-09-30 8:02 ` [PATCH v7 1/7] eal/loongarch: support " Min Zhou
2022-10-03 17:15 4% ` David Marchand
2022-10-04 8:49 0% ` zhoumin
2022-09-30 9:42 4% [PATCH] ethdev: forbid the use of direction attr in transfer flows Ivan Malov
2022-10-02 18:55 [PATCH v5 0/6] crypto/security session framework rework Akhil Goyal
2022-10-02 18:55 1% ` [PATCH v5 1/6] cryptodev: rework session framework Akhil Goyal
2022-10-03 13:52 [PATCH v6 0/6] crypto/security session framework rework Akhil Goyal
2022-10-03 13:52 1% ` [PATCH v6 1/6] cryptodev: rework session framework Akhil Goyal
2022-10-04 9:02 2% [PATCH v4] ethdev: support congestion management Andrew Rybchenko
2022-10-06 8:36 0% ` Andrew Rybchenko
2022-10-07 1:56 0% ` [EXT] " Jerin Jacob Kollanukkaran
2022-10-07 6:09 0% ` [EXT] " Sunil Kumar Kori
2022-10-07 10:07 0% ` Andrew Rybchenko
2022-10-04 11:10 [PATCH v7 0/6] crypto/security session framework rework Akhil Goyal
2022-10-04 11:10 1% ` [PATCH v7 1/6] cryptodev: rework session framework Akhil Goyal
2022-10-04 17:37 ` [PATCH v8 0/6] crypto/security session framework rework Akhil Goyal
2022-10-04 17:37 1% ` [PATCH v8 1/6] cryptodev: rework session framework Akhil Goyal
2022-10-04 15:40 [PATCH v8 0/6] Introduce support for LoongArch architecture Min Zhou
2022-10-04 15:40 5% ` [PATCH v8 1/6] eal/loongarch: support " Min Zhou
2022-10-05 14:34 [PATCH 1/2] kni: flag deprecated status at build time Bruce Richardson
2022-10-05 14:34 4% ` [PATCH 2/2] kni: add deprecation warning at runtime Bruce Richardson
2022-10-07 15:01 ` [PATCH v2 1/3] kni: flag deprecated status at build time Bruce Richardson
2022-10-07 15:01 4% ` [PATCH v2 2/3] kni: add deprecation warning at runtime Bruce Richardson
2022-10-10 10:44 ` [PATCH v3 1/3] kni: flag deprecated status at build time Bruce Richardson
2022-10-10 10:44 4% ` [PATCH v3 2/3] kni: add deprecation warning at runtime Bruce Richardson
2022-10-06 15:14 4% DPDK Deprecation Notice Review Meeting 2022-09-30 Mcnamara, John
2022-10-09 13:25 4% [PATCH v5 0/4] mempool: fix mempool cache flushing algorithm Andrew Rybchenko
2022-10-10 6:08 [PATCH v2 00/24] add the basic rte_flow offload support of nfp PMD Chaoyong He
2022-10-10 6:08 ` [PATCH v2 03/24] net/nfp: add the flow APIs " Chaoyong He
2022-10-10 14:51 ` Ferruh Yigit
2022-10-19 3:00 3% ` Chaoyong He
2022-10-19 11:11 3% ` Ferruh Yigit
2022-10-19 11:30 0% ` Chaoyong He
2022-10-19 11:38 0% ` Ferruh Yigit
[not found] <20220128124831.427-1-kalesh-anakkur.purayil@broadcom.com>
2022-10-09 9:10 ` [PATCH v11 0/5] support error handling mode Chengwen Feng
2022-10-09 9:10 ` [PATCH v11 1/5] ethdev: support get port " Chengwen Feng
2022-10-10 8:38 3% ` Andrew Rybchenko
2022-10-10 10:17 [PATCH v5 1/8] net/gve/base: introduce GVE PMD base code Junfeng Guo
2022-10-20 10:36 ` [PATCH v6 0/8] introduce GVE PMD Junfeng Guo
2022-10-20 10:36 ` [PATCH v6 3/8] net/gve: add support for device initialization Junfeng Guo
2022-10-20 14:42 3% ` Ferruh Yigit
2022-10-24 2:10 0% ` Guo, Junfeng
2022-10-10 15:37 4% [PATCH] vhost: promote per-queue stats API to stable Maxime Coquelin
2022-10-17 13:22 0% ` David Marchand
2022-10-24 8:53 0% ` Xia, Chenbo
2022-10-26 9:31 0% ` Xia, Chenbo
2022-10-11 1:50 4% release candidate 22.11-rc1 Thomas Monjalon
2022-10-13 5:28 0% ` Jiang, YuX
2022-10-20 5:24 0% ` Jiang, YuX
2022-10-24 13:12 0% ` David Marchand
2022-10-27 21:00 0% ` Thinh Tran
2022-10-12 8:10 rte_event_dev_xstats_reset id type Morten Brørup
2022-10-12 9:45 ` Jerin Jacob
2022-10-12 10:29 3% ` Van Haaren, Harry
2022-10-12 10:41 4% ` Morten Brørup
2022-10-12 12:14 0% ` Van Haaren, Harry
2022-10-12 15:13 0% ` Thomas Monjalon
2022-10-12 15:35 0% ` Morten Brørup
2022-10-12 16:16 0% ` Jerin Jacob
2022-10-12 16:28 0% ` Thomas Monjalon
2022-10-12 16:47 0% ` Jerin Jacob
2022-10-12 20:44 0% ` Thomas Monjalon
2022-10-13 6:51 0% ` xstats " Morten Brørup
2022-10-13 7:12 3% ` Pavan Nikhilesh Bhagavatula
2022-10-13 8:26 0% ` Thomas Monjalon
2022-10-13 8:33 0% ` [EXT] " Pavan Nikhilesh Bhagavatula
2022-10-13 8:59 0% ` Van Haaren, Harry
2022-10-12 11:45 [PATCH] net/bonding: fix socket_id type Markus Theil
2022-10-12 12:23 ` Ferruh Yigit
2022-10-12 14:20 ` Markus Theil
2022-10-12 15:15 3% ` Ferruh Yigit
2022-10-12 16:29 [PATCH 0/2] GitHub Actions configuration fixes David Marchand
2022-10-12 16:29 6% ` [PATCH 1/2] ci: bump versions of actions in GHA David Marchand
2022-10-12 16:29 14% ` [PATCH 2/2] ci: update to new API for step outputs " David Marchand
2022-10-13 9:15 10% [PATCH] eventdev: update release notes pbhagavatula
2022-10-19 13:00 0% ` Jerin Jacob
2022-10-13 9:23 2% [PATCH] eventdev: increase xstats ID width to 64 bits pbhagavatula
2022-10-13 10:16 0% ` Mattias Rönnblom
2022-10-13 11:35 2% ` [PATCH v2] " pbhagavatula
2022-10-19 13:24 0% ` Jerin Jacob
2022-10-17 14:07 3% [PATCH] ci: combine static and shared linking build tests David Marchand
2022-10-20 11:44 0% ` David Marchand
2022-10-20 15:34 0% ` Aaron Conole
2022-10-27 11:21 0% ` David Marchand
2022-10-21 8:13 [PATCH] eventdev: fix event vector documentation typo Mattias Rönnblom
2022-10-21 9:42 8% ` Jerin Jacob
2022-10-26 14:26 [PATCH v6 0/4] mempool: fix mempool cache flushing algorithm Morten Brørup
2022-10-26 14:44 ` [PATCH] mempool: cache align mempool cache objects Morten Brørup
2022-10-27 8:34 ` Olivier Matz
2022-10-27 9:22 ` Morten Brørup
2022-10-27 11:42 3% ` Olivier Matz
2022-10-27 12:11 0% ` Morten Brørup
2022-10-27 15:20 0% ` Olivier Matz
2022-10-30 11:54 [PATCH] mempool: split statistics from debug Morten Brørup
2022-10-31 11:26 ` [PATCH v2 1/3] " Morten Brørup
2022-10-31 11:26 ` [PATCH v2 3/3] mempool: use cache for frequently updated statistics Morten Brørup
2022-11-02 8:01 3% ` Mattias Rönnblom
2022-11-02 9:29 4% ` Morten Brørup
2022-11-02 17:55 0% ` Mattias Rönnblom
2022-11-03 15:47 9% [PATCH 0/2] ABI check updates David Marchand
2022-11-03 15:47 21% ` [PATCH 1/2] devtools: unify configuration for ABI check David Marchand
2022-11-03 15:47 41% ` [PATCH 2/2] devtools: stop depending on libabigail xml format David Marchand
2022-11-05 13:40 [RFC] mempool: zero-copy cache put bulk Morten Brørup
2022-11-05 23:11 ` Honnappa Nagarahalli
2022-11-06 6:57 ` Morten Brørup
2022-11-09 17:57 3% ` Honnappa Nagarahalli
2022-11-09 20:36 0% ` Morten Brørup
2022-11-09 22:45 0% ` Honnappa Nagarahalli
2022-11-10 10:15 0% ` Morten Brørup
2022-11-08 11:25 FW: [PATCH v4 3/3] mempool: use cache for frequently updated stats Morten Brørup
2022-11-08 13:32 ` Thomas Monjalon
2022-11-08 14:30 ` Morten Brørup
2022-11-08 15:51 ` Thomas Monjalon
2022-11-08 15:59 ` Bruce Richardson
2022-11-08 17:38 3% ` Konstantin Ananyev
2022-11-09 5:03 4% ` Morten Brørup
2022-11-09 8:21 0% ` Mattias Rönnblom
2022-11-09 10:19 4% ` Konstantin Ananyev
2022-11-09 11:42 0% ` Morten Brørup
2022-11-17 13:58 Regarding User Data in DPDK ACL Library venkatesh bs
2022-11-17 22:52 ` Stephen Hemminger
2022-11-18 10:30 3% ` Konstantin Ananyev
2022-11-19 13:13 0% ` venkatesh bs
2022-11-21 5:40 0% ` Honnappa Nagarahalli
2022-11-21 14:15 0% ` Konstantin Ananyev
2022-11-21 16:56 0% ` Honnappa Nagarahalli
2022-11-22 13:38 0% ` Konstantin Ananyev
2022-11-22 15:53 0% ` Honnappa Nagarahalli
2022-11-22 13:09 3% [PATCH] net/nfp: update descriptors logic Niklas Söderlund
2022-11-24 16:56 3% [PATCH v1] doc: update release notes for 22.11 John McNamara
2022-11-27 22:22 4% DPDK 22.11 released Thomas Monjalon
2022-11-28 8:33 11% [PATCH] version: 23.03-rc0 David Marchand
2022-12-01 15:37 0% ` Thomas Monjalon
2022-12-01 15:50 0% ` David Marchand
2022-11-29 14:00 [PATCH] drivers: fix symbol exports when map is omitted David Marchand
2022-11-29 18:23 3% ` Ferruh Yigit
2022-11-30 7:13 4% ` David Marchand
2022-11-30 8:27 0% ` David Marchand
2022-11-30 9:19 0% ` Ferruh Yigit
2022-12-02 11:09 4% ` [PATCH v4 1/2] " David Marchand
2022-12-02 13:39 0% ` Aaron Conole
2022-11-30 22:54 4% help with pthread_t deprecation / api changes Tyler Retzlaff
2022-12-02 1:12 0% ` Tyler Retzlaff
2022-12-02 8:03 0% ` Morten Brørup
2022-12-01 19:01 3% DPDK Release Status Meeting 2022-12-01 Mcnamara, John
2022-12-02 9:46 4% DPDK 22.11.1 released David Marchand
2022-12-03 17:13 3% mbuf performance optimization Morten Brørup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).