DPDK patches and discussions
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* 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
  0 siblings, 0 replies; 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
  0 siblings, 0 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
  0 siblings, 0 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
  0 siblings, 0 replies; 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  4%             ` 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-19 12:15  2% ` [PATCH v2 1/1] " skori
  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-19 12:15  2% ` [PATCH v2 1/1] " skori
@ 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  4%             ` 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 4%]

* 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  4%             ` 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-08-22  5:33  0%   ` Ori Kam
@ 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  4%             ` 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-14  7:58  1% ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (3 preceding siblings ...)
  2022-09-14  7:58  2%   ` [PATCH v6 27/27] dev: hide device object David Marchand
@ 2022-09-24  7:14  0%   ` David Marchand
  4 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-21 19:21  3%     ` [EXT] " Akhil Goyal
  2022-09-21 20:57  0%       ` Chautru, Nicolas
@ 2022-09-23 10:57  4%       ` Ferruh Yigit
       [not found]             ` <CO6PR18MB44848717BA4EA2FF8967D7CBD8509@CO6PR18MB4484.namprd18.prod.outlook.com>
  1 sibling, 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-21 22:29  3%           ` Harris, James R
@ 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-21 15:02  1%   ` [PATCH v2 1/6] cryptodev: rework session framework Akhil Goyal
@ 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%]

* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-08-30 15:09  5%         ` David Marchand
@ 2022-09-21 22:29  3%           ` Harris, James R
  2022-09-23  7:13  0%             ` David Marchand
  0 siblings, 1 reply; 200+ results
From: Harris, James R @ 2022-09-21 22:29 UTC (permalink / raw)
  To: David Marchand
  Cc: Walker, Benjamin, dev, Liu, Changpeng, Alexey Marchuk,
	Shuhei Matsumoto, Thomas Monjalon, Richardson, Bruce,
	Stephen Hemminger



> 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?

-Jim



^ permalink raw reply	[relevance 3%]

* [PATCH v8 1/7] bbdev: allow operation type enum for growth
  @ 2022-09-21 21:02  3%   ` Nic Chautru
  0 siblings, 0 replies; 200+ results
From: Nic Chautru @ 2022-09-21 21:02 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: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
  2022-09-21 19:21  3%     ` [EXT] " Akhil Goyal
@ 2022-09-21 20:57  0%       ` Chautru, Nicolas
  2022-09-23 10:57  4%       ` Ferruh Yigit
  1 sibling, 0 replies; 200+ results
From: Chautru, Nicolas @ 2022-09-21 20:57 UTC (permalink / raw)
  To: Akhil Goyal, dev, thomas, hemant.agrawal, Ray Kinsella
  Cc: maxime.coquelin, trix, mdr, Richardson, Bruce, david.marchand,
	stephen, Zhang, Mingshan

Hi Akhil, 

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> 
> > 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.

Thanks, fixed in v8.

> 
> > + */
> > +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 was discussed at the time notably with advises from Ray. But good to close the loop formally. 


^ permalink raw reply	[relevance 0%]

* RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information
  @ 2022-09-21 19:21  3%     ` Akhil Goyal
  2022-09-21 20:57  0%       ` Chautru, Nicolas
  2022-09-23 10:57  4%       ` Ferruh Yigit
  0 siblings, 2 replies; 200+ results
From: Akhil Goyal @ 2022-09-21 19:21 UTC (permalink / raw)
  To: Nicolas Chautru, dev, thomas, hemant.agrawal, Ray Kinsella
  Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
	stephen, mingshan.zhang

> 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?



^ permalink raw reply	[relevance 3%]

* [PATCH v2 3/6] cryptodev: hide sym session structure
    2022-09-21 15:02  1%   ` [PATCH v2 1/6] cryptodev: rework session framework Akhil Goyal
@ 2022-09-21 15:02  1%   ` Akhil Goyal
    2 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-21 15:02 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, Akhil Goyal, Fan Zhang

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>
---
 app/test/test_ipsec_perf.c                    |  4 +-
 doc/guides/prog_guide/cryptodev_lib.rst       | 16 ++----
 doc/guides/rel_notes/deprecation.rst          |  9 +++
 doc/guides/rel_notes/release_22_11.rst        |  7 +++
 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, 208 insertions(+), 189 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..ba46b6930f 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -237,3 +237,12 @@ Deprecation Notices
   applications should be updated to use the ``dmadev`` library instead,
   with the underlying HW-functionality being provided by the ``ioat`` or
   ``idxd`` dma drivers
+
+* cryptodev: Hide structure ``rte_cryptodev_sym_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 functions ``rte_cryptodev_sym_session_init`` and
+  ``rte_cryptodev_sym_session_clear`` are deprecated. The sym crypto session
+  opaque pointer can no longer be used by different crypto device drivers.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 7fab9d6550..d6f199573f 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -89,6 +89,13 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* cryptodev: The structure ``rte_cryptodev_sym_session`` was moved to
+  cryptodev_pmd.h and was hidden from the application. The APIs to create/init and
+  destroy sym crypto session were updated to take a single mempool with element size
+  enough to hold session data and session private data. Inline APIs was created to
+  get and set the session 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 f03235dfee..1ebfbe1edb 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) {
@@ -2024,7 +2024,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 48e8ff107b..6434750147 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..262303f62f 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 63b8255a45..88dbe71c51 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -1941,11 +1941,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)
@@ -2060,10 +2060,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;
 
@@ -2075,8 +2076,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;
 
@@ -2120,10 +2123,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 v2 1/6] cryptodev: rework session framework
  @ 2022-09-21 15:02  1%   ` Akhil Goyal
  2022-09-22 14:06  0%     ` Ji, Kai
  2022-09-21 15:02  1%   ` [PATCH v2 3/6] cryptodev: hide sym session structure Akhil Goyal
    2 siblings, 1 reply; 200+ results
From: Akhil Goyal @ 2022-09-21 15:02 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, Akhil Goyal, Fan Zhang

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>
---
 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        |  29 +-
 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, 553 insertions(+), 1661 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 6b4d09e623..7efeecf848 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -73,10 +73,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 cecf30e470..24261a1d10 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -50,10 +50,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 5c0dc82290..54f7e8ba2f 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -37,10 +37,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 17e30a8e74..55d7614d84 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -96,35 +96,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",
@@ -135,6 +114,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;
@@ -322,12 +302,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 6ee4480399..e181b0aa3e 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]);
@@ -1381,7 +1371,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),
@@ -1441,10 +1430,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;
 		}
 	}
@@ -1599,7 +1586,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(
@@ -2144,8 +2130,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;
@@ -2190,18 +2174,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,
@@ -2430,7 +2407,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;
@@ -2450,16 +2426,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;
 }
@@ -2472,7 +2443,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;
 
@@ -2492,16 +2462,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;
 }
@@ -2579,7 +2545,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;
@@ -2614,17 +2579,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;
 }
 
@@ -2638,7 +2598,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;
@@ -2678,16 +2637,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;
 }
@@ -2713,7 +2667,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;
 
@@ -2744,26 +2697,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;
 }
@@ -8194,7 +8140,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;
@@ -8216,15 +8161,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
@@ -8668,7 +8610,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: ",
@@ -12018,7 +11960,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);
 
@@ -12033,16 +11974,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);
 
@@ -12250,12 +12186,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;
@@ -12282,20 +12215,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],
@@ -12325,18 +12253,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);
@@ -12387,7 +12306,6 @@ test_multi_session_random_usage(void)
 		},
 
 	};
-	int status;
 
 	/* Verify the capabilities */
 	struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12409,11 +12327,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));
@@ -12423,16 +12336,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));
@@ -12470,9 +12383,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);
@@ -12490,7 +12402,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(
@@ -12504,17 +12415,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;
@@ -12522,14 +12429,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;
@@ -12543,7 +12447,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;
 
@@ -12569,19 +12472,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),
@@ -12692,7 +12590,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,
@@ -12792,7 +12689,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,
@@ -12979,7 +12875,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;
@@ -12998,15 +12893,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
@@ -13635,7 +13528,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);
 
@@ -13649,15 +13541,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
@@ -13670,7 +13560,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);
@@ -13702,15 +13591,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
@@ -14168,7 +14055,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;
@@ -14219,19 +14105,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");
@@ -14355,18 +14234,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,
@@ -15114,8 +14986,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");
 		}
@@ -15138,8 +15010,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..f03235dfee 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,7 +1948,7 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	return processed_jobs;
 }
 
-
+#if 0
 static inline void
 ipsec_mb_fill_error_code(struct rte_crypto_sym_vec *vec, int32_t err)
 {
@@ -1971,6 +1957,7 @@ ipsec_mb_fill_error_code(struct rte_crypto_sym_vec *vec, int32_t err)
 	for (i = 0; i != vec->num; ++i)
 		vec->status[i] = err;
 }
+#endif
 
 static inline int
 check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl)
@@ -2028,7 +2015,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 +2024,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 392b546a63..48e8ff107b 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 8bd5a66889..23878f17cd 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -54,7 +54,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;
@@ -69,7 +68,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);
@@ -109,16 +108,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,
@@ -133,7 +127,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());
@@ -150,7 +143,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;
@@ -161,11 +153,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);
 }
 
@@ -1201,13 +1191,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;
@@ -1236,9 +1222,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 42f3221052..63b8255a45 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -190,12 +190,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 */
 };
@@ -1202,6 +1199,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)
@@ -1225,17 +1240,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 <
@@ -1244,13 +1250,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;
 		}
@@ -1710,53 +1712,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,
@@ -1766,16 +1721,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",
@@ -1791,7 +1743,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,
@@ -1849,64 +1801,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
@@ -1985,11 +1941,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);
@@ -2001,37 +1961,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);
@@ -2068,33 +2015,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)
 {
@@ -2141,9 +2061,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;
@@ -2151,18 +2070,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: [PATCH v4] usertools: rewrite pmdinfo
  2022-09-21  7:58  3%       ` Ferruh Yigit
@ 2022-09-21  9:57  0%         ` Ferruh Yigit
  0 siblings, 0 replies; 200+ results
From: Ferruh Yigit @ 2022-09-21  9:57 UTC (permalink / raw)
  To: Robin Jarry, dev; +Cc: Olivier Matz, Bruce Richardson

On 9/21/2022 8:58 AM, Ferruh Yigit wrote:
> On 9/20/2022 8:15 PM, Robin Jarry wrote:
> 
>>
>> Ferruh Yigit, Sep 20, 2022 at 19:48:
>>>> +* The ``dpdk-pmdinfo.py`` script was rewritten to produce valid 
>>>> JSON only.
>>>> +  PCI-IDs parsing has been removed.
>>>> +  To get a similar output to the (now removed) ``-r/--raw`` flag, 
>>>> you may use the following command::
>>>> +
>>>> +     strings $dpdk_binary_or_driver | sed -n 's/^PMD_INFO_STRING= //p'
>>>>
>>>
>>> Empty line is missing (in case there will be a new version for some
>>> other reason).
>>
>> What do you mean?
>>
> 
> just nit picking, there needs to be two empty lines before "ABI 
> Changes", I assume committer can fix it while merging if there won't be 
> any new version.

Also looking twice, this release note update is in "API Changes" 
section, I think that is not correct place, "New Features" section can 
be better place.

^ permalink raw reply	[relevance 0%]

* Re: [PATCH v4] usertools: rewrite pmdinfo
  @ 2022-09-21  7:58  3%       ` Ferruh Yigit
  2022-09-21  9:57  0%         ` Ferruh Yigit
  0 siblings, 1 reply; 200+ results
From: Ferruh Yigit @ 2022-09-21  7:58 UTC (permalink / raw)
  To: Robin Jarry, dev; +Cc: Olivier Matz, Bruce Richardson

On 9/20/2022 8:15 PM, Robin Jarry wrote:

> 
> Ferruh Yigit, Sep 20, 2022 at 19:48:
>>> +* The ``dpdk-pmdinfo.py`` script was rewritten to produce valid JSON only.
>>> +  PCI-IDs parsing has been removed.
>>> +  To get a similar output to the (now removed) ``-r/--raw`` flag, you may use the following command::
>>> +
>>> +     strings $dpdk_binary_or_driver | sed -n 's/^PMD_INFO_STRING= //p'
>>>
>>
>> Empty line is missing (in case there will be a new version for some
>> other reason).
> 
> What do you mean?
> 

just nit picking, there needs to be two empty lines before "ABI 
Changes", I assume committer can fix it while merging if there won't be 
any new version.

^ permalink raw reply	[relevance 3%]

* [PATCH v2] examples/kni: remove deprecated kni example
  2022-09-20 15:14  1% [PATCH] examples/kni: remove deprecated kni example Bruce Richardson
@ 2022-09-20 15:51  1% ` Bruce Richardson
  0 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2022-09-20 15:51 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

As part of the agreed process for deprecating KNI in DPDK, the example
app is scheduled for removal as part of the 22.11 release.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
V2: Correct old release note links to KNI guide by referencing older doc
---
 doc/guides/rel_notes/deprecation.rst          |    1 -
 doc/guides/rel_notes/release_18_11.rst        |    4 +-
 doc/guides/sample_app_ug/index.rst            |    1 -
 .../sample_app_ug/kernel_nic_interface.rst    |  318 -----
 examples/kni/Makefile                         |   52 -
 examples/kni/main.c                           | 1140 -----------------
 examples/kni/meson.build                      |   13 -
 examples/meson.build                          |    1 -
 8 files changed, 2 insertions(+), 1528 deletions(-)
 delete mode 100644 doc/guides/sample_app_ug/kernel_nic_interface.rst
 delete mode 100644 examples/kni/Makefile
 delete mode 100644 examples/kni/main.c
 delete mode 100644 examples/kni/meson.build

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index c1975d6c3e..2ded2d69d1 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -70,7 +70,6 @@ Deprecation Notices
   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.

 * lib: will fix extending some enum/define breaking the ABI. There are multiple
diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst
index be52bf0803..708bc9d4dd 100644
--- a/doc/guides/rel_notes/release_18_11.rst
+++ b/doc/guides/rel_notes/release_18_11.rst
@@ -265,7 +265,7 @@ New Features
   carrier state is set to ``on`` via ``rte_kni_update_link`` or
   by writing ``1`` to ``/sys/devices/virtual/net/<iface>/carrier``.
   In previous versions the default carrier state was left undefined.
-  See :doc:`../prog_guide/kernel_nic_interface` for more information.
+  See `Kernel NIC Interface <https://doc.dpdk.org/guides-18.11/sample_app_ug/kernel_nic_interface.html>`_ for more information.

   Also added the new API function ``rte_kni_update_link()`` to allow the user
   to set the carrier state of the KNI kernel network interface.
@@ -273,7 +273,7 @@ New Features
   Also added a new command line flag ``-m`` to the KNI sample application to
   monitor and automatically reflect the physical NIC carrier state to the
   KNI kernel network interface with the new ``rte_kni_update_link()`` API.
-  See :doc:`../sample_app_ug/kernel_nic_interface` for more information.
+  See `Kernel NIC Interface <https://doc.dpdk.org/guides-18.11/sample_app_ug/kernel_nic_interface.html>`_ for more information.

 * **Added ability to switch queue deferred start flag on testpmd app.**

diff --git a/doc/guides/sample_app_ug/index.rst b/doc/guides/sample_app_ug/index.rst
index cc9fae1e8c..6e1e83d7d7 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -20,7 +20,6 @@ Sample Applications User Guides
     ip_frag
     ipv4_multicast
     ip_reassembly
-    kernel_nic_interface
     keep_alive
     dma
     l2_forward_crypto
diff --git a/doc/guides/sample_app_ug/kernel_nic_interface.rst b/doc/guides/sample_app_ug/kernel_nic_interface.rst
deleted file mode 100644
index ef441cc1e5..0000000000
--- a/doc/guides/sample_app_ug/kernel_nic_interface.rst
+++ /dev/null
@@ -1,318 +0,0 @@
-..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
-
-Kernel NIC Interface Sample Application
-=======================================
-
-The Kernel NIC Interface (KNI) is a DPDK control plane solution that
-allows userspace applications to exchange packets with the kernel networking stack.
-To accomplish this, DPDK userspace applications use an IOCTL call
-to request the creation of a KNI virtual device in the Linux* kernel.
-The IOCTL call provides interface information and the DPDK's physical address space,
-which is re-mapped into the kernel address space by the KNI kernel loadable module
-that saves the information to a virtual device context.
-The DPDK creates FIFO queues for packet ingress and egress
-to the kernel module for each device allocated.
-
-The KNI kernel loadable module is a standard net driver,
-which upon receiving the IOCTL call access the DPDK's FIFO queue to
-receive/transmit packets from/to the DPDK userspace application.
-The FIFO queues contain pointers to data packets in the DPDK. This:
-
-*   Provides a faster mechanism to interface with the kernel net stack and eliminates system calls
-
-*   Facilitates the DPDK using standard Linux* userspace net tools (tshark, rsync, and so on)
-
-*   Eliminate the copy_to_user and copy_from_user operations on packets.
-
-The Kernel NIC Interface sample application is a simple example that demonstrates the use
-of the DPDK to create a path for packets to go through the Linux* kernel.
-This is done by creating one or more kernel net devices for each of the DPDK ports.
-The application allows the use of standard Linux tools (ethtool, iproute, tshark) with the DPDK ports and
-also the exchange of packets between the DPDK application and the Linux* kernel.
-
-The Kernel NIC Interface sample application requires that the
-KNI kernel module ``rte_kni`` be loaded into the kernel.  See
-:doc:`../prog_guide/kernel_nic_interface` for more information on loading
-the ``rte_kni`` kernel module.
-
-Overview
---------
-
-The Kernel NIC Interface sample application ``kni`` allocates one or more
-KNI interfaces for each physical NIC port.  For each physical NIC port,
-``kni`` uses two DPDK threads in user space; one thread reads from the port and
-writes to the corresponding KNI interfaces and the other thread reads from
-the KNI interfaces and writes the data unmodified to the physical NIC port.
-
-It is recommended to configure one KNI interface for each physical NIC port.
-The application can be configured with more than one KNI interface for
-each physical NIC port for performance testing or it can work together with
-VMDq support in future.
-
-The packet flow through the Kernel NIC Interface application is as shown
-in the following figure.
-
-.. _figure_kernel_nic:
-
-.. figure:: img/kernel_nic.*
-
-   Kernel NIC Application Packet Flow
-
-If link monitoring is enabled with the ``-m`` command line flag, one
-additional pthread is launched which will check the link status of each
-physical NIC port and will update the carrier status of the corresponding
-KNI interface(s) to match the physical NIC port's state.  This means that
-the KNI interface(s) will be disabled automatically when the Ethernet link
-goes down and enabled when the Ethernet link goes up.
-
-If link monitoring is enabled, the ``rte_kni`` kernel module should be loaded
-such that the :ref:`default carrier state <kni_default_carrier_state>` is
-set to *off*.  This ensures that the KNI interface is only enabled *after*
-the Ethernet link of the corresponding NIC port has reached the linkup state.
-
-If link monitoring is not enabled, the ``rte_kni`` kernel module should be
-loaded with the :ref:`default carrier state <kni_default_carrier_state>`
-set to *on*.  This sets the carrier state of the KNI interfaces to *on*
-when the KNI interfaces are enabled without regard to the actual link state
-of the corresponding NIC port.  This is useful for testing in loopback
-mode where the NIC port may not be physically connected to anything.
-
-Compiling the Application
--------------------------
-
-To compile the sample application see :doc:`compiling`.
-
-The application is located in the ``examples/kni`` sub-directory.
-
-.. note::
-
-        This application is intended as a linux only.
-
-Running the kni Example Application
------------------------------------
-
-The ``kni`` example application requires a number of command line options:
-
-.. code-block:: console
-
-    dpdk-kni [EAL options] -- -p PORTMASK --config="(port,lcore_rx,lcore_tx[,lcore_kthread,...])[,(port,lcore_rx,lcore_tx[,lcore_kthread,...])]" [-P] [-m]
-
-Where:
-
-*   ``-p PORTMASK``:
-
-    Hexadecimal bitmask of ports to configure.
-
-*   ``--config="(port,lcore_rx,lcore_tx[,lcore_kthread,...])[,(port,lcore_rx,lcore_tx[,lcore_kthread,...])]"``:
-
-    Determines which lcores the Rx and Tx DPDK tasks, and (optionally)
-    the KNI kernel thread(s) are bound to for each physical port.
-
-*   ``-P``:
-
-    Optional flag to set all ports to promiscuous mode so that packets are
-    accepted regardless of the packet's Ethernet MAC destination address.
-    Without this option, only packets with the Ethernet MAC destination
-    address set to the Ethernet address of the port are accepted.
-
-*   ``-m``:
-
-    Optional flag to enable monitoring and updating of the Ethernet
-    carrier state.  With this option set, a thread will be started which
-    will periodically check the Ethernet link status of the physical
-    Ethernet ports and set the carrier state of the corresponding KNI
-    network interface to match it.  This means that the KNI interface will
-    be disabled automatically when the Ethernet link goes down and enabled
-    when the Ethernet link goes up.
-
-Refer to *DPDK Getting Started Guide* for general information on running
-applications and the Environment Abstraction Layer (EAL) options.
-
-The ``-c coremask`` or ``-l corelist`` parameter of the EAL options must
-include the lcores specified by ``lcore_rx`` and ``lcore_tx`` for each port,
-but does not need to include lcores specified by ``lcore_kthread`` as those
-cores are used to pin the kernel threads in the ``rte_kni`` kernel module.
-
-The ``--config`` parameter must include a set of
-``(port,lcore_rx,lcore_tx,[lcore_kthread,...])`` values for each physical
-port specified in the ``-p PORTMASK`` parameter.
-
-The optional ``lcore_kthread`` lcore ID parameter in ``--config`` can be
-specified zero, one or more times for each physical port.
-
-If no lcore ID is specified for ``lcore_kthread``, one KNI interface will
-be created for the physical port ``port`` and the KNI kernel thread(s)
-will have no specific core affinity.
-
-If one or more lcore IDs are specified for ``lcore_kthread``, a KNI interface
-will be created for each lcore ID specified, bound to the physical port
-``port``.  If the ``rte_kni`` kernel module is loaded in :ref:`multiple
-kernel thread <kni_kernel_thread_mode>` mode, a kernel thread will be created
-for each KNI interface and bound to the specified core.  If the ``rte_kni``
-kernel module is loaded in :ref:`single kernel thread <kni_kernel_thread_mode>`
-mode, only one kernel thread is started for all KNI interfaces.  The kernel
-thread will be bound to the first ``lcore_kthread`` lcore ID specified.
-
-Example Configurations
-~~~~~~~~~~~~~~~~~~~~~~~
-
-The following commands will first load the ``rte_kni`` kernel module in
-:ref:`multiple kernel thread <kni_kernel_thread_mode>` mode.  The ``kni``
-application is then started using two ports;  Port 0 uses lcore 4 for the
-Rx task, lcore 6 for the Tx task, and will create a single KNI interface
-``vEth0_0`` with the kernel thread bound to lcore 8.  Port 1 uses lcore
-5 for the Rx task, lcore 7 for the Tx task, and will create a single KNI
-interface ``vEth1_0`` with the kernel thread bound to lcore 9.
-
-.. code-block:: console
-
-    # rmmod rte_kni
-    # insmod <build_dir>/kernel/linux/kni/rte_kni.ko kthread_mode=multiple
-    # ./<build-dir>/examples/dpdk-kni -l 4-7 -n 4 -- -P -p 0x3 -m --config="(0,4,6,8),(1,5,7,9)"
-
-The following example is identical, except an additional ``lcore_kthread``
-core is specified per physical port.  In this case, ``kni`` will create
-four KNI interfaces: ``vEth0_0``/``vEth0_1`` bound to physical port 0 and
-``vEth1_0``/``vEth1_1`` bound to physical port 1.
-
-The kernel thread for each interface will be bound as follows:
-
-    * ``vEth0_0`` - bound to lcore 8.
-    * ``vEth0_1`` - bound to lcore 10.
-    * ``vEth1_0`` - bound to lcore 9.
-    * ``vEth1_1`` - bound to lcore 11
-
-.. code-block:: console
-
-    # rmmod rte_kni
-    # insmod <build_dir>/kernel/linux/kni/rte_kni.ko kthread_mode=multiple
-    # ./<build-dir>/examples/dpdk-kni -l 4-7 -n 4 -- -P -p 0x3 -m --config="(0,4,6,8,10),(1,5,7,9,11)"
-
-The following example can be used to test the interface between the ``kni``
-test application and the ``rte_kni`` kernel module.  In this example,
-the ``rte_kni`` kernel module is loaded in :ref:`single kernel thread
-mode <kni_kernel_thread_mode>`, :ref:`loopback mode <kni_loopback_mode>`
-enabled, and the :ref:`default carrier state <kni_default_carrier_state>`
-is set to *on* so that the corresponding physical NIC port does not have
-to be connected in order to use the KNI interface.  One KNI interface
-``vEth0_0`` is created for port 0 and one KNI interface ``vEth1_0`` is
-created for port 1.  Since ``rte_kni`` is loaded in "single kernel thread"
-mode, the one kernel thread is bound to lcore 8.
-
-Since the physical NIC ports are not being used, link monitoring can be
-disabled by **not** specifying the ``-m`` flag to ``kni``:
-
-.. code-block:: console
-
-    # rmmod rte_kni
-    # insmod <build_dir>/kernel/linux/kni/rte_kni.ko lo_mode=lo_mode_fifo carrier=on
-    # ./<build-dir>/examples/dpdk-kni -l 4-7 -n 4 -- -P -p 0x3 --config="(0,4,6,8),(1,5,7,9)"
-
-KNI Operations
---------------
-
-Once the ``kni`` application is started, the user can use the normal
-Linux commands to manage the KNI interfaces as if they were any other
-Linux network interface.
-
-Enable KNI interface and assign an IP address:
-
-.. code-block:: console
-
-    # ip addr add dev vEth0_0 192.168.0.1
-
-Show KNI interface configuration and statistics:
-
-.. code-block:: console
-
-    # ip -s -d addr show vEth0_0
-
-The user can also check and reset the packet statistics inside the ``kni``
-application by sending the app the USR1 and USR2 signals:
-
-.. code-block:: console
-
-    # Print statistics
-    # pkill -USR1 kni
-
-    # Zero statistics
-    # pkill -USR2 kni
-
-Dump network traffic:
-
-.. code-block:: console
-
-    # tshark -n -i vEth0_0
-
-The normal Linux commands can also be used to change the MAC address and
-MTU size used by the physical NIC which corresponds to the KNI interface.
-However, if more than one KNI interface is configured for a physical port,
-these commands will only work on the first KNI interface for that port.
-
-Change the MAC address:
-
-.. code-block:: console
-
-    # ip link set dev vEth0_0 lladdr 0C:01:02:03:04:08
-
-Change the MTU size:
-
-.. code-block:: console
-
-    # ip link set dev vEth0_0 mtu 1450
-
-Limited ethtool support:
-
-.. code-block:: console
-
-    # ethtool -i vEth0_0
-
-When the ``kni`` application is closed, all the KNI interfaces are deleted
-from the Linux kernel.
-
-Explanation
------------
-
-The following sections provide some explanation of code.
-
-Initialization
-~~~~~~~~~~~~~~
-
-Setup of mbuf pool, driver and queues is similar to the setup done in the :doc:`l2_forward_real_virtual`..
-In addition, one or more kernel NIC interfaces are allocated for each
-of the configured ports according to the command line parameters.
-
-The code for allocating the kernel NIC interfaces for a specific port is
-in the function ``kni_alloc``.
-
-The other step in the initialization process that is unique to this sample application
-is the association of each port with lcores for RX, TX and kernel threads.
-
-*   One lcore to read from the port and write to the associated one or more KNI devices
-
-*   Another lcore to read from one or more KNI devices and write to the port
-
-*   Other lcores for pinning the kernel threads on one by one
-
-This is done by using the ``kni_port_params_array[]`` array, which is indexed by the port ID.
-The code is in the function ``parse_config``.
-
-Packet Forwarding
-~~~~~~~~~~~~~~~~~
-
-After the initialization steps are completed, the main_loop() function is run on each lcore.
-This function first checks the lcore_id against the user provided lcore_rx and lcore_tx
-to see if this lcore is reading from or writing to kernel NIC interfaces.
-
-For the case that reads from a NIC port and writes to the kernel NIC interfaces (``kni_ingress``),
-the packet reception is the same as in L2 Forwarding sample application
-(see :ref:`l2_fwd_app_rx_tx_packets`).
-The packet transmission is done by sending mbufs into the kernel NIC interfaces by ``rte_kni_tx_burst()``.
-The KNI library automatically frees the mbufs after the kernel successfully copied the mbufs.
-
-For the other case that reads from kernel NIC interfaces
-and writes to a physical NIC port (``kni_egress``),
-packets are retrieved by reading mbufs from kernel NIC interfaces by ``rte_kni_rx_burst()``.
-The packet transmission is the same as in the L2 Forwarding sample application
-(see :ref:`l2_fwd_app_rx_tx_packets`).
diff --git a/examples/kni/Makefile b/examples/kni/Makefile
deleted file mode 100644
index 753cb96f5f..0000000000
--- a/examples/kni/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
-
-# binary name
-APP = kni
-
-# all source are stored in SRCS-y
-SRCS-y := main.c
-
-PKGCONF ?= pkg-config
-
-# Build using pkg-config variables if possible
-ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0)
-$(error "no installation of DPDK found")
-endif
-
-all: shared
-.PHONY: shared static
-shared: build/$(APP)-shared
-	ln -sf $(APP)-shared build/$(APP)
-static: build/$(APP)-static
-	ln -sf $(APP)-static build/$(APP)
-
-PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
-CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
-CFLAGS += -DALLOW_EXPERIMENTAL_API
-LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
-LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
-
-ifeq ($(MAKECMDGOALS),static)
-# check for broken pkg-config
-ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
-$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
-$(error "Cannot generate statically-linked binaries with this version of pkg-config")
-endif
-endif
-
-LDFLAGS += -pthread
-
-build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
-	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
-
-build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
-	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
-
-build:
-	@mkdir -p $@
-
-.PHONY: clean
-clean:
-	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	test -d build && rmdir -p build || true
diff --git a/examples/kni/main.c b/examples/kni/main.c
deleted file mode 100644
index e99ef5c38a..0000000000
--- a/examples/kni/main.c
+++ /dev/null
@@ -1,1140 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <string.h>
-#include <sys/queue.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include <netinet/in.h>
-#include <linux/if.h>
-#include <linux/if_tun.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <signal.h>
-
-#include <rte_common.h>
-#include <rte_log.h>
-#include <rte_memory.h>
-#include <rte_memcpy.h>
-#include <rte_eal.h>
-#include <rte_per_lcore.h>
-#include <rte_launch.h>
-#include <rte_lcore.h>
-#include <rte_branch_prediction.h>
-#include <rte_interrupts.h>
-#include <rte_bus_pci.h>
-#include <rte_debug.h>
-#include <rte_ether.h>
-#include <rte_ethdev.h>
-#include <rte_mempool.h>
-#include <rte_mbuf.h>
-#include <rte_string_fns.h>
-#include <rte_cycles.h>
-#include <rte_malloc.h>
-#include <rte_kni.h>
-
-/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
-
-/* Max size of a single packet */
-#define MAX_PACKET_SZ           2048
-
-/* Size of the data buffer in each mbuf */
-#define MBUF_DATA_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM)
-
-/* Number of mbufs in mempool that is created */
-#define NB_MBUF                 (8192 * 16)
-
-/* How many packets to attempt to read from NIC in one go */
-#define PKT_BURST_SZ            32
-
-/* How many objects (mbufs) to keep in per-lcore mempool cache */
-#define MEMPOOL_CACHE_SZ        PKT_BURST_SZ
-
-/* Number of RX ring descriptors */
-#define NB_RXD                  1024
-
-/* Number of TX ring descriptors */
-#define NB_TXD                  1024
-
-/* Total octets in ethernet header */
-#define KNI_ENET_HEADER_SIZE    14
-
-/* Total octets in the FCS */
-#define KNI_ENET_FCS_SIZE       4
-
-#define KNI_US_PER_SECOND       1000000
-#define KNI_SECOND_PER_DAY      86400
-
-#define KNI_MAX_KTHREAD 32
-/*
- * Structure of port parameters
- */
-struct kni_port_params {
-	uint16_t port_id;/* Port ID */
-	unsigned lcore_rx; /* lcore ID for RX */
-	unsigned lcore_tx; /* lcore ID for TX */
-	uint32_t nb_lcore_k; /* Number of lcores for KNI multi kernel threads */
-	uint32_t nb_kni; /* Number of KNI devices to be created */
-	unsigned lcore_k[KNI_MAX_KTHREAD]; /* lcore ID list for kthreads */
-	struct rte_kni *kni[KNI_MAX_KTHREAD]; /* KNI context pointers */
-} __rte_cache_aligned;
-
-static struct kni_port_params *kni_port_params_array[RTE_MAX_ETHPORTS];
-
-
-/* Options for configuring ethernet port */
-static struct rte_eth_conf port_conf = {
-	.txmode = {
-		.mq_mode = RTE_ETH_MQ_TX_NONE,
-	},
-};
-
-/* Mempool for mbufs */
-static struct rte_mempool * pktmbuf_pool = NULL;
-
-/* Mask of enabled ports */
-static uint32_t ports_mask = 0;
-/* Ports set in promiscuous mode off by default. */
-static int promiscuous_on = 0;
-/* Monitor link status continually. off by default. */
-static int monitor_links;
-
-/* Structure type for recording kni interface specific stats */
-struct kni_interface_stats {
-	/* number of pkts received from NIC, and sent to KNI */
-	uint64_t rx_packets;
-
-	/* number of pkts received from NIC, but failed to send to KNI */
-	uint64_t rx_dropped;
-
-	/* number of pkts received from KNI, and sent to NIC */
-	uint64_t tx_packets;
-
-	/* number of pkts received from KNI, but failed to send to NIC */
-	uint64_t tx_dropped;
-};
-
-/* kni device statistics array */
-static struct kni_interface_stats kni_stats[RTE_MAX_ETHPORTS];
-
-static int kni_change_mtu(uint16_t port_id, unsigned int new_mtu);
-static int kni_config_network_interface(uint16_t port_id, uint8_t if_up);
-static int kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]);
-
-static uint32_t kni_stop;
-static uint32_t kni_pause;
-
-/* Print out statistics on packets handled */
-static void
-print_stats(void)
-{
-	uint16_t i;
-
-	printf("\n**KNI example application statistics**\n"
-	       "======  ==============  ============  ============  ============  ============\n"
-	       " Port    Lcore(RX/TX)    rx_packets    rx_dropped    tx_packets    tx_dropped\n"
-	       "------  --------------  ------------  ------------  ------------  ------------\n");
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (!kni_port_params_array[i])
-			continue;
-
-		printf("%7d %10u/%2u %13"PRIu64" %13"PRIu64" %13"PRIu64" "
-							"%13"PRIu64"\n", i,
-					kni_port_params_array[i]->lcore_rx,
-					kni_port_params_array[i]->lcore_tx,
-						kni_stats[i].rx_packets,
-						kni_stats[i].rx_dropped,
-						kni_stats[i].tx_packets,
-						kni_stats[i].tx_dropped);
-	}
-	printf("======  ==============  ============  ============  ============  ============\n");
-
-	fflush(stdout);
-}
-
-/* Custom handling of signals to handle stats and kni processing */
-static void
-signal_handler(int signum)
-{
-	/* When we receive a USR1 signal, print stats */
-	if (signum == SIGUSR1) {
-		print_stats();
-	}
-
-	/* When we receive a USR2 signal, reset stats */
-	if (signum == SIGUSR2) {
-		memset(&kni_stats, 0, sizeof(kni_stats));
-		printf("\n** Statistics have been reset **\n");
-		return;
-	}
-
-	/*
-	 * When we receive a RTMIN or SIGINT or SIGTERM signal,
-	 * stop kni processing
-	 */
-	if (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {
-		printf("\nSIGRTMIN/SIGINT/SIGTERM received. "
-			"KNI processing stopping.\n");
-		__atomic_fetch_add(&kni_stop, 1, __ATOMIC_RELAXED);
-		return;
-        }
-}
-
-static void
-kni_burst_free_mbufs(struct rte_mbuf **pkts, unsigned num)
-{
-	unsigned i;
-
-	if (pkts == NULL)
-		return;
-
-	for (i = 0; i < num; i++) {
-		rte_pktmbuf_free(pkts[i]);
-		pkts[i] = NULL;
-	}
-}
-
-/**
- * Interface to burst rx and enqueue mbufs into rx_q
- */
-static void
-kni_ingress(struct kni_port_params *p)
-{
-	uint8_t i;
-	uint16_t port_id;
-	unsigned nb_rx, num;
-	uint32_t nb_kni;
-	struct rte_mbuf *pkts_burst[PKT_BURST_SZ];
-
-	if (p == NULL)
-		return;
-
-	nb_kni = p->nb_kni;
-	port_id = p->port_id;
-	for (i = 0; i < nb_kni; i++) {
-		/* Burst rx from eth */
-		nb_rx = rte_eth_rx_burst(port_id, 0, pkts_burst, PKT_BURST_SZ);
-		if (unlikely(nb_rx > PKT_BURST_SZ)) {
-			RTE_LOG(ERR, APP, "Error receiving from eth\n");
-			return;
-		}
-		/* Burst tx to kni */
-		num = rte_kni_tx_burst(p->kni[i], pkts_burst, nb_rx);
-		if (num)
-			kni_stats[port_id].rx_packets += num;
-
-		rte_kni_handle_request(p->kni[i]);
-		if (unlikely(num < nb_rx)) {
-			/* Free mbufs not tx to kni interface */
-			kni_burst_free_mbufs(&pkts_burst[num], nb_rx - num);
-			kni_stats[port_id].rx_dropped += nb_rx - num;
-		}
-	}
-}
-
-/**
- * Interface to dequeue mbufs from tx_q and burst tx
- */
-static void
-kni_egress(struct kni_port_params *p)
-{
-	uint8_t i;
-	uint16_t port_id;
-	unsigned nb_tx, num;
-	uint32_t nb_kni;
-	struct rte_mbuf *pkts_burst[PKT_BURST_SZ];
-
-	if (p == NULL)
-		return;
-
-	nb_kni = p->nb_kni;
-	port_id = p->port_id;
-	for (i = 0; i < nb_kni; i++) {
-		/* Burst rx from kni */
-		num = rte_kni_rx_burst(p->kni[i], pkts_burst, PKT_BURST_SZ);
-		if (unlikely(num > PKT_BURST_SZ)) {
-			RTE_LOG(ERR, APP, "Error receiving from KNI\n");
-			return;
-		}
-		/* Burst tx to eth */
-		nb_tx = rte_eth_tx_burst(port_id, 0, pkts_burst, (uint16_t)num);
-		if (nb_tx)
-			kni_stats[port_id].tx_packets += nb_tx;
-		if (unlikely(nb_tx < num)) {
-			/* Free mbufs not tx to NIC */
-			kni_burst_free_mbufs(&pkts_burst[nb_tx], num - nb_tx);
-			kni_stats[port_id].tx_dropped += num - nb_tx;
-		}
-	}
-}
-
-static int
-main_loop(__rte_unused void *arg)
-{
-	uint16_t i;
-	int32_t f_stop;
-	int32_t f_pause;
-	const unsigned lcore_id = rte_lcore_id();
-	enum lcore_rxtx {
-		LCORE_NONE,
-		LCORE_RX,
-		LCORE_TX,
-		LCORE_MAX
-	};
-	enum lcore_rxtx flag = LCORE_NONE;
-
-	RTE_ETH_FOREACH_DEV(i) {
-		if (!kni_port_params_array[i])
-			continue;
-		if (kni_port_params_array[i]->lcore_rx == (uint8_t)lcore_id) {
-			flag = LCORE_RX;
-			break;
-		} else if (kni_port_params_array[i]->lcore_tx ==
-						(uint8_t)lcore_id) {
-			flag = LCORE_TX;
-			break;
-		}
-	}
-
-	if (flag == LCORE_RX) {
-		RTE_LOG(INFO, APP, "Lcore %u is reading from port %d\n",
-					kni_port_params_array[i]->lcore_rx,
-					kni_port_params_array[i]->port_id);
-		while (1) {
-			f_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);
-			f_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);
-			if (f_stop)
-				break;
-			if (f_pause)
-				continue;
-			kni_ingress(kni_port_params_array[i]);
-		}
-	} else if (flag == LCORE_TX) {
-		RTE_LOG(INFO, APP, "Lcore %u is writing to port %d\n",
-					kni_port_params_array[i]->lcore_tx,
-					kni_port_params_array[i]->port_id);
-		while (1) {
-			f_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);
-			f_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);
-			if (f_stop)
-				break;
-			if (f_pause)
-				continue;
-			kni_egress(kni_port_params_array[i]);
-		}
-	} else
-		RTE_LOG(INFO, APP, "Lcore %u has nothing to do\n", lcore_id);
-
-	return 0;
-}
-
-/* Display usage instructions */
-static void
-print_usage(const char *prgname)
-{
-	RTE_LOG(INFO, APP, "\nUsage: %s [EAL options] -- -p PORTMASK -P -m "
-		   "[--config (port,lcore_rx,lcore_tx,lcore_kthread...)"
-		   "[,(port,lcore_rx,lcore_tx,lcore_kthread...)]]\n"
-		   "    -p PORTMASK: hex bitmask of ports to use\n"
-		   "    -P : enable promiscuous mode\n"
-		   "    -m : enable monitoring of port carrier state\n"
-		   "    --config (port,lcore_rx,lcore_tx,lcore_kthread...): "
-		   "port and lcore configurations\n",
-	           prgname);
-}
-
-/* Convert string to unsigned number. 0 is returned if error occurs */
-static uint32_t
-parse_unsigned(const char *portmask)
-{
-	char *end = NULL;
-	unsigned long num;
-
-	num = strtoul(portmask, &end, 16);
-	if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
-		return 0;
-
-	return (uint32_t)num;
-}
-
-static void
-print_config(void)
-{
-	uint32_t i, j;
-	struct kni_port_params **p = kni_port_params_array;
-
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (!p[i])
-			continue;
-		RTE_LOG(DEBUG, APP, "Port ID: %d\n", p[i]->port_id);
-		RTE_LOG(DEBUG, APP, "Rx lcore ID: %u, Tx lcore ID: %u\n",
-					p[i]->lcore_rx, p[i]->lcore_tx);
-		for (j = 0; j < p[i]->nb_lcore_k; j++)
-			RTE_LOG(DEBUG, APP, "Kernel thread lcore ID: %u\n",
-							p[i]->lcore_k[j]);
-	}
-}
-
-static int
-parse_config(const char *arg)
-{
-	const char *p, *p0 = arg;
-	char s[256], *end;
-	unsigned size;
-	enum fieldnames {
-		FLD_PORT = 0,
-		FLD_LCORE_RX,
-		FLD_LCORE_TX,
-		_NUM_FLD = KNI_MAX_KTHREAD + 3,
-	};
-	int i, j, nb_token;
-	char *str_fld[_NUM_FLD];
-	unsigned long int_fld[_NUM_FLD];
-	uint16_t port_id, nb_kni_port_params = 0;
-
-	memset(&kni_port_params_array, 0, sizeof(kni_port_params_array));
-	while (((p = strchr(p0, '(')) != NULL) &&
-		nb_kni_port_params < RTE_MAX_ETHPORTS) {
-		p++;
-		if ((p0 = strchr(p, ')')) == NULL)
-			goto fail;
-		size = p0 - p;
-		if (size >= sizeof(s)) {
-			printf("Invalid config parameters\n");
-			goto fail;
-		}
-		snprintf(s, sizeof(s), "%.*s", size, p);
-		nb_token = rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',');
-		if (nb_token <= FLD_LCORE_TX) {
-			printf("Invalid config parameters\n");
-			goto fail;
-		}
-		for (i = 0; i < nb_token; i++) {
-			errno = 0;
-			int_fld[i] = strtoul(str_fld[i], &end, 0);
-			if (errno != 0 || end == str_fld[i]) {
-				printf("Invalid config parameters\n");
-				goto fail;
-			}
-		}
-
-		i = 0;
-		port_id = int_fld[i++];
-		if (port_id >= RTE_MAX_ETHPORTS) {
-			printf("Port ID %d could not exceed the maximum %d\n",
-						port_id, RTE_MAX_ETHPORTS);
-			goto fail;
-		}
-		if (kni_port_params_array[port_id]) {
-			printf("Port %d has been configured\n", port_id);
-			goto fail;
-		}
-		kni_port_params_array[port_id] =
-			rte_zmalloc("KNI_port_params",
-				    sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);
-		kni_port_params_array[port_id]->port_id = port_id;
-		kni_port_params_array[port_id]->lcore_rx =
-					(uint8_t)int_fld[i++];
-		kni_port_params_array[port_id]->lcore_tx =
-					(uint8_t)int_fld[i++];
-		if (kni_port_params_array[port_id]->lcore_rx >= RTE_MAX_LCORE ||
-		kni_port_params_array[port_id]->lcore_tx >= RTE_MAX_LCORE) {
-			printf("lcore_rx %u or lcore_tx %u ID could not "
-						"exceed the maximum %u\n",
-				kni_port_params_array[port_id]->lcore_rx,
-				kni_port_params_array[port_id]->lcore_tx,
-						(unsigned)RTE_MAX_LCORE);
-			goto fail;
-		}
-		for (j = 0; i < nb_token && j < KNI_MAX_KTHREAD; i++, j++)
-			kni_port_params_array[port_id]->lcore_k[j] =
-						(uint8_t)int_fld[i];
-		kni_port_params_array[port_id]->nb_lcore_k = j;
-	}
-	print_config();
-
-	return 0;
-
-fail:
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (kni_port_params_array[i]) {
-			rte_free(kni_port_params_array[i]);
-			kni_port_params_array[i] = NULL;
-		}
-	}
-
-	return -1;
-}
-
-static int
-validate_parameters(uint32_t portmask)
-{
-	uint32_t i;
-
-	if (!portmask) {
-		printf("No port configured in port mask\n");
-		return -1;
-	}
-
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (((portmask & (1 << i)) && !kni_port_params_array[i]) ||
-			(!(portmask & (1 << i)) && kni_port_params_array[i]))
-			rte_exit(EXIT_FAILURE, "portmask is not consistent "
-				"to port ids specified in --config\n");
-
-		if (kni_port_params_array[i] && !rte_lcore_is_enabled(\
-			(unsigned)(kni_port_params_array[i]->lcore_rx)))
-			rte_exit(EXIT_FAILURE, "lcore id %u for "
-					"port %d receiving not enabled\n",
-					kni_port_params_array[i]->lcore_rx,
-					kni_port_params_array[i]->port_id);
-
-		if (kni_port_params_array[i] && !rte_lcore_is_enabled(\
-			(unsigned)(kni_port_params_array[i]->lcore_tx)))
-			rte_exit(EXIT_FAILURE, "lcore id %u for "
-					"port %d transmitting not enabled\n",
-					kni_port_params_array[i]->lcore_tx,
-					kni_port_params_array[i]->port_id);
-
-	}
-
-	return 0;
-}
-
-#define CMDLINE_OPT_CONFIG  "config"
-
-/* Parse the arguments given in the command line of the application */
-static int
-parse_args(int argc, char **argv)
-{
-	int opt, longindex, ret = 0;
-	const char *prgname = argv[0];
-	static struct option longopts[] = {
-		{CMDLINE_OPT_CONFIG, required_argument, NULL, 0},
-		{NULL, 0, NULL, 0}
-	};
-
-	/* Disable printing messages within getopt() */
-	opterr = 0;
-
-	/* Parse command line */
-	while ((opt = getopt_long(argc, argv, "p:Pm", longopts,
-						&longindex)) != EOF) {
-		switch (opt) {
-		case 'p':
-			ports_mask = parse_unsigned(optarg);
-			break;
-		case 'P':
-			promiscuous_on = 1;
-			break;
-		case 'm':
-			monitor_links = 1;
-			break;
-		case 0:
-			if (!strncmp(longopts[longindex].name,
-				     CMDLINE_OPT_CONFIG,
-				     sizeof(CMDLINE_OPT_CONFIG))) {
-				ret = parse_config(optarg);
-				if (ret) {
-					printf("Invalid config\n");
-					print_usage(prgname);
-					return -1;
-				}
-			}
-			break;
-		default:
-			print_usage(prgname);
-			rte_exit(EXIT_FAILURE, "Invalid option specified\n");
-		}
-	}
-
-	/* Check that options were parsed ok */
-	if (validate_parameters(ports_mask) < 0) {
-		print_usage(prgname);
-		rte_exit(EXIT_FAILURE, "Invalid parameters\n");
-	}
-
-	return ret;
-}
-
-/* Initialize KNI subsystem */
-static void
-init_kni(void)
-{
-	unsigned int num_of_kni_ports = 0, i;
-	struct kni_port_params **params = kni_port_params_array;
-
-	/* Calculate the maximum number of KNI interfaces that will be used */
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (kni_port_params_array[i]) {
-			num_of_kni_ports += (params[i]->nb_lcore_k ?
-				params[i]->nb_lcore_k : 1);
-		}
-	}
-
-	/* Invoke rte KNI init to preallocate the ports */
-	rte_kni_init(num_of_kni_ports);
-}
-
-/* Initialise a single port on an Ethernet device */
-static void
-init_port(uint16_t port)
-{
-	int ret;
-	uint16_t nb_rxd = NB_RXD;
-	uint16_t nb_txd = NB_TXD;
-	struct rte_eth_dev_info dev_info;
-	struct rte_eth_rxconf rxq_conf;
-	struct rte_eth_txconf txq_conf;
-	struct rte_eth_conf local_port_conf = port_conf;
-
-	/* Initialise device and RX/TX queues */
-	RTE_LOG(INFO, APP, "Initialising port %u ...\n", (unsigned)port);
-	fflush(stdout);
-
-	ret = rte_eth_dev_info_get(port, &dev_info);
-	if (ret != 0)
-		rte_exit(EXIT_FAILURE,
-			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-ret));
-
-	if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
-		local_port_conf.txmode.offloads |=
-			RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
-	ret = rte_eth_dev_configure(port, 1, 1, &local_port_conf);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not configure port%u (%d)\n",
-		            (unsigned)port, ret);
-
-	ret = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors "
-				"for port%u (%d)\n", (unsigned)port, ret);
-
-	rxq_conf = dev_info.default_rxconf;
-	rxq_conf.offloads = local_port_conf.rxmode.offloads;
-	ret = rte_eth_rx_queue_setup(port, 0, nb_rxd,
-		rte_eth_dev_socket_id(port), &rxq_conf, pktmbuf_pool);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not setup up RX queue for "
-				"port%u (%d)\n", (unsigned)port, ret);
-
-	txq_conf = dev_info.default_txconf;
-	txq_conf.offloads = local_port_conf.txmode.offloads;
-	ret = rte_eth_tx_queue_setup(port, 0, nb_txd,
-		rte_eth_dev_socket_id(port), &txq_conf);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not setup up TX queue for "
-				"port%u (%d)\n", (unsigned)port, ret);
-
-	ret = rte_eth_dev_start(port);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not start port%u (%d)\n",
-						(unsigned)port, ret);
-
-	if (promiscuous_on) {
-		ret = rte_eth_promiscuous_enable(port);
-		if (ret != 0)
-			rte_exit(EXIT_FAILURE,
-				"Could not enable promiscuous mode for port%u: %s\n",
-				port, rte_strerror(-ret));
-	}
-}
-
-/* Check the link status of all ports in up to 9s, and print them finally */
-static void
-check_all_ports_link_status(uint32_t port_mask)
-{
-#define CHECK_INTERVAL 100 /* 100ms */
-#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
-	uint16_t portid;
-	uint8_t count, all_ports_up, print_flag = 0;
-	struct rte_eth_link link;
-	int ret;
-	char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
-
-	printf("\nChecking link status\n");
-	fflush(stdout);
-	for (count = 0; count <= MAX_CHECK_TIME; count++) {
-		all_ports_up = 1;
-		RTE_ETH_FOREACH_DEV(portid) {
-			if ((port_mask & (1 << portid)) == 0)
-				continue;
-			memset(&link, 0, sizeof(link));
-			ret = rte_eth_link_get_nowait(portid, &link);
-			if (ret < 0) {
-				all_ports_up = 0;
-				if (print_flag == 1)
-					printf("Port %u link get failed: %s\n",
-						portid, rte_strerror(-ret));
-				continue;
-			}
-			/* print link status if flag set */
-			if (print_flag == 1) {
-				rte_eth_link_to_str(link_status_text,
-					sizeof(link_status_text), &link);
-				printf("Port %d %s\n", portid,
-					link_status_text);
-				continue;
-			}
-			/* clear all_ports_up flag if any link down */
-			if (link.link_status == RTE_ETH_LINK_DOWN) {
-				all_ports_up = 0;
-				break;
-			}
-		}
-		/* after finally printing all link status, get out */
-		if (print_flag == 1)
-			break;
-
-		if (all_ports_up == 0) {
-			printf(".");
-			fflush(stdout);
-			rte_delay_ms(CHECK_INTERVAL);
-		}
-
-		/* set the print_flag if all ports up or timeout */
-		if (all_ports_up == 1 || count == (MAX_CHECK_TIME - 1)) {
-			print_flag = 1;
-			printf("done\n");
-		}
-	}
-}
-
-static void
-log_link_state(struct rte_kni *kni, int prev, struct rte_eth_link *link)
-{
-	char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
-	if (kni == NULL || link == NULL)
-		return;
-
-	rte_eth_link_to_str(link_status_text, sizeof(link_status_text), link);
-	if (prev != link->link_status)
-		RTE_LOG(INFO, APP, "%s NIC %s\n",
-			rte_kni_get_name(kni),
-			link_status_text);
-}
-
-/*
- * Monitor the link status of all ports and update the
- * corresponding KNI interface(s)
- */
-static void *
-monitor_all_ports_link_status(void *arg)
-{
-	uint16_t portid;
-	struct rte_eth_link link;
-	unsigned int i;
-	struct kni_port_params **p = kni_port_params_array;
-	int prev;
-	(void) arg;
-	int ret;
-
-	while (monitor_links) {
-		rte_delay_ms(500);
-		RTE_ETH_FOREACH_DEV(portid) {
-			if ((ports_mask & (1 << portid)) == 0)
-				continue;
-			memset(&link, 0, sizeof(link));
-			ret = rte_eth_link_get_nowait(portid, &link);
-			if (ret < 0) {
-				RTE_LOG(ERR, APP,
-					"Get link failed (port %u): %s\n",
-					portid, rte_strerror(-ret));
-				continue;
-			}
-			for (i = 0; i < p[portid]->nb_kni; i++) {
-				prev = rte_kni_update_link(p[portid]->kni[i],
-						link.link_status);
-				log_link_state(p[portid]->kni[i], prev, &link);
-			}
-		}
-	}
-	return NULL;
-}
-
-static int
-kni_change_mtu_(uint16_t port_id, unsigned int new_mtu)
-{
-	int ret;
-	uint16_t nb_rxd = NB_RXD;
-	uint16_t nb_txd = NB_TXD;
-	struct rte_eth_conf conf;
-	struct rte_eth_dev_info dev_info;
-	struct rte_eth_rxconf rxq_conf;
-	struct rte_eth_txconf txq_conf;
-
-	if (!rte_eth_dev_is_valid_port(port_id)) {
-		RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id);
-		return -EINVAL;
-	}
-
-	RTE_LOG(INFO, APP, "Change MTU of port %d to %u\n", port_id, new_mtu);
-
-	/* Stop specific port */
-	ret = rte_eth_dev_stop(port_id);
-	if (ret != 0) {
-		RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
-			port_id, rte_strerror(-ret));
-		return ret;
-	}
-
-	memcpy(&conf, &port_conf, sizeof(conf));
-
-	conf.rxmode.mtu = new_mtu;
-	ret = rte_eth_dev_configure(port_id, 1, 1, &conf);
-	if (ret < 0) {
-		RTE_LOG(ERR, APP, "Fail to reconfigure port %d\n", port_id);
-		return ret;
-	}
-
-	ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors "
-				"for port%u (%d)\n", (unsigned int)port_id,
-				ret);
-
-	ret = rte_eth_dev_info_get(port_id, &dev_info);
-	if (ret != 0) {
-		RTE_LOG(ERR, APP,
-			"Error during getting device (port %u) info: %s\n",
-			port_id, strerror(-ret));
-
-		return ret;
-	}
-
-	rxq_conf = dev_info.default_rxconf;
-	rxq_conf.offloads = conf.rxmode.offloads;
-	ret = rte_eth_rx_queue_setup(port_id, 0, nb_rxd,
-		rte_eth_dev_socket_id(port_id), &rxq_conf, pktmbuf_pool);
-	if (ret < 0) {
-		RTE_LOG(ERR, APP, "Fail to setup Rx queue of port %d\n",
-				port_id);
-		return ret;
-	}
-
-	txq_conf = dev_info.default_txconf;
-	txq_conf.offloads = conf.txmode.offloads;
-	ret = rte_eth_tx_queue_setup(port_id, 0, nb_txd,
-		rte_eth_dev_socket_id(port_id), &txq_conf);
-	if (ret < 0) {
-		RTE_LOG(ERR, APP, "Fail to setup Tx queue of port %d\n",
-				port_id);
-		return ret;
-	}
-
-	/* Restart specific port */
-	ret = rte_eth_dev_start(port_id);
-	if (ret < 0) {
-		RTE_LOG(ERR, APP, "Fail to restart port %d\n", port_id);
-		return ret;
-	}
-
-	return 0;
-}
-
-/* Callback for request of changing MTU */
-static int
-kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
-{
-	int ret;
-
-	__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);
-	ret =  kni_change_mtu_(port_id, new_mtu);
-	__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
-
-	return ret;
-}
-
-/* Callback for request of configuring network interface up/down */
-static int
-kni_config_network_interface(uint16_t port_id, uint8_t if_up)
-{
-	int ret = 0;
-
-	if (!rte_eth_dev_is_valid_port(port_id)) {
-		RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id);
-		return -EINVAL;
-	}
-
-	RTE_LOG(INFO, APP, "Configure network interface of %d %s\n",
-					port_id, if_up ? "up" : "down");
-
-	__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);
-
-	if (if_up != 0) { /* Configure network interface up */
-		ret = rte_eth_dev_stop(port_id);
-		if (ret != 0) {
-			RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
-				port_id, rte_strerror(-ret));
-			__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
-			return ret;
-		}
-		ret = rte_eth_dev_start(port_id);
-	} else { /* Configure network interface down */
-		ret = rte_eth_dev_stop(port_id);
-		if (ret != 0) {
-			RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
-				port_id, rte_strerror(-ret));
-			__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
-			return ret;
-		}
-	}
-
-	__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
-
-	if (ret < 0)
-		RTE_LOG(ERR, APP, "Failed to start port %d\n", port_id);
-
-	return ret;
-}
-
-static void
-print_ethaddr(const char *name, struct rte_ether_addr *mac_addr)
-{
-	char buf[RTE_ETHER_ADDR_FMT_SIZE];
-	rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, mac_addr);
-	RTE_LOG(INFO, APP, "\t%s%s\n", name, buf);
-}
-
-/* Callback for request of configuring mac address */
-static int
-kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
-{
-	int ret = 0;
-
-	if (!rte_eth_dev_is_valid_port(port_id)) {
-		RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id);
-		return -EINVAL;
-	}
-
-	RTE_LOG(INFO, APP, "Configure mac address of %d\n", port_id);
-	print_ethaddr("Address:", (struct rte_ether_addr *)mac_addr);
-
-	ret = rte_eth_dev_default_mac_addr_set(port_id,
-					(struct rte_ether_addr *)mac_addr);
-	if (ret < 0)
-		RTE_LOG(ERR, APP, "Failed to config mac_addr for port %d\n",
-			port_id);
-
-	return ret;
-}
-
-static int
-kni_alloc(uint16_t port_id)
-{
-	uint8_t i;
-	struct rte_kni *kni;
-	struct rte_kni_conf conf;
-	struct kni_port_params **params = kni_port_params_array;
-	int ret;
-
-	if (port_id >= RTE_MAX_ETHPORTS || !params[port_id])
-		return -1;
-
-	params[port_id]->nb_kni = params[port_id]->nb_lcore_k ?
-				params[port_id]->nb_lcore_k : 1;
-
-	for (i = 0; i < params[port_id]->nb_kni; i++) {
-		/* Clear conf at first */
-		memset(&conf, 0, sizeof(conf));
-		if (params[port_id]->nb_lcore_k) {
-			snprintf(conf.name, RTE_KNI_NAMESIZE,
-					"vEth%u_%u", port_id, i);
-			conf.core_id = params[port_id]->lcore_k[i];
-			conf.force_bind = 1;
-		} else
-			snprintf(conf.name, RTE_KNI_NAMESIZE,
-						"vEth%u", port_id);
-		conf.group_id = port_id;
-		conf.mbuf_size = MAX_PACKET_SZ;
-		/*
-		 * The first KNI device associated to a port
-		 * is the main, for multiple kernel thread
-		 * environment.
-		 */
-		if (i == 0) {
-			struct rte_kni_ops ops;
-			struct rte_eth_dev_info dev_info;
-
-			ret = rte_eth_dev_info_get(port_id, &dev_info);
-			if (ret != 0)
-				rte_exit(EXIT_FAILURE,
-					"Error during getting device (port %u) info: %s\n",
-					port_id, strerror(-ret));
-
-			/* Get the interface default mac address */
-			ret = rte_eth_macaddr_get(port_id,
-				(struct rte_ether_addr *)&conf.mac_addr);
-			if (ret != 0)
-				rte_exit(EXIT_FAILURE,
-					"Failed to get MAC address (port %u): %s\n",
-					port_id, rte_strerror(-ret));
-
-			rte_eth_dev_get_mtu(port_id, &conf.mtu);
-
-			conf.min_mtu = dev_info.min_mtu;
-			conf.max_mtu = dev_info.max_mtu;
-
-			memset(&ops, 0, sizeof(ops));
-			ops.port_id = port_id;
-			ops.change_mtu = kni_change_mtu;
-			ops.config_network_if = kni_config_network_interface;
-			ops.config_mac_address = kni_config_mac_address;
-
-			kni = rte_kni_alloc(pktmbuf_pool, &conf, &ops);
-		} else
-			kni = rte_kni_alloc(pktmbuf_pool, &conf, NULL);
-
-		if (!kni)
-			rte_exit(EXIT_FAILURE, "Fail to create kni for "
-						"port: %d\n", port_id);
-		params[port_id]->kni[i] = kni;
-	}
-
-	return 0;
-}
-
-static int
-kni_free_kni(uint16_t port_id)
-{
-	uint8_t i;
-	int ret;
-	struct kni_port_params **p = kni_port_params_array;
-
-	if (port_id >= RTE_MAX_ETHPORTS || !p[port_id])
-		return -1;
-
-	for (i = 0; i < p[port_id]->nb_kni; i++) {
-		if (rte_kni_release(p[port_id]->kni[i]))
-			printf("Fail to release kni\n");
-		p[port_id]->kni[i] = NULL;
-	}
-	ret = rte_eth_dev_stop(port_id);
-	if (ret != 0)
-		RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
-			port_id, rte_strerror(-ret));
-	rte_eth_dev_close(port_id);
-
-	return 0;
-}
-
-/* Initialise ports/queues etc. and start main loop on each core */
-int
-main(int argc, char** argv)
-{
-	int ret;
-	uint16_t nb_sys_ports, port;
-	unsigned i;
-	void *retval;
-	pthread_t kni_link_tid;
-	int pid;
-
-	/* Associate signal_handler function with USR signals */
-	signal(SIGUSR1, signal_handler);
-	signal(SIGUSR2, signal_handler);
-	signal(SIGRTMIN, signal_handler);
-	signal(SIGINT, signal_handler);
-	signal(SIGTERM, signal_handler);
-
-	/* Initialise EAL */
-	ret = rte_eal_init(argc, argv);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not initialise EAL (%d)\n", ret);
-	argc -= ret;
-	argv += ret;
-
-	/* Parse application arguments (after the EAL ones) */
-	ret = parse_args(argc, argv);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not parse input parameters\n");
-
-	/* Create the mbuf pool */
-	pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF,
-		MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, rte_socket_id());
-	if (pktmbuf_pool == NULL) {
-		rte_exit(EXIT_FAILURE, "Could not initialise mbuf pool\n");
-		return -1;
-	}
-
-	/* Get number of ports found in scan */
-	nb_sys_ports = rte_eth_dev_count_avail();
-	if (nb_sys_ports == 0)
-		rte_exit(EXIT_FAILURE, "No supported Ethernet device found\n");
-
-	/* Check if the configured port ID is valid */
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
-		if (kni_port_params_array[i] && !rte_eth_dev_is_valid_port(i))
-			rte_exit(EXIT_FAILURE, "Configured invalid "
-						"port ID %u\n", i);
-
-	/* Initialize KNI subsystem */
-	init_kni();
-
-	/* Initialise each port */
-	RTE_ETH_FOREACH_DEV(port) {
-		/* Skip ports that are not enabled */
-		if (!(ports_mask & (1 << port)))
-			continue;
-		init_port(port);
-
-		if (port >= RTE_MAX_ETHPORTS)
-			rte_exit(EXIT_FAILURE, "Can not use more than "
-				"%d ports for kni\n", RTE_MAX_ETHPORTS);
-
-		kni_alloc(port);
-	}
-	check_all_ports_link_status(ports_mask);
-
-	pid = getpid();
-	RTE_LOG(INFO, APP, "========================\n");
-	RTE_LOG(INFO, APP, "KNI Running\n");
-	RTE_LOG(INFO, APP, "kill -SIGUSR1 %d\n", pid);
-	RTE_LOG(INFO, APP, "    Show KNI Statistics.\n");
-	RTE_LOG(INFO, APP, "kill -SIGUSR2 %d\n", pid);
-	RTE_LOG(INFO, APP, "    Zero KNI Statistics.\n");
-	RTE_LOG(INFO, APP, "========================\n");
-	fflush(stdout);
-
-	ret = rte_ctrl_thread_create(&kni_link_tid,
-				     "KNI link status check", NULL,
-				     monitor_all_ports_link_status, NULL);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE,
-			"Could not create link status thread!\n");
-
-	/* Launch per-lcore function on every lcore */
-	rte_eal_mp_remote_launch(main_loop, NULL, CALL_MAIN);
-	RTE_LCORE_FOREACH_WORKER(i) {
-		if (rte_eal_wait_lcore(i) < 0)
-			return -1;
-	}
-	monitor_links = 0;
-	pthread_join(kni_link_tid, &retval);
-
-	/* Release resources */
-	RTE_ETH_FOREACH_DEV(port) {
-		if (!(ports_mask & (1 << port)))
-			continue;
-		kni_free_kni(port);
-	}
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
-		if (kni_port_params_array[i]) {
-			rte_free(kni_port_params_array[i]);
-			kni_port_params_array[i] = NULL;
-		}
-
-	/* clean up the EAL */
-	rte_eal_cleanup();
-
-	return 0;
-}
diff --git a/examples/kni/meson.build b/examples/kni/meson.build
deleted file mode 100644
index 6bd4eb50e6..0000000000
--- a/examples/kni/meson.build
+++ /dev/null
@@ -1,13 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
-
-# meson file, for building this example as part of a main DPDK build.
-#
-# To build this example as a standalone application with an already-installed
-# DPDK instance, use 'make'
-
-deps += ['kni', 'bus_pci']
-sources = files(
-        'main.c',
-)
-allow_experimental_apis = true
diff --git a/examples/meson.build b/examples/meson.build
index 81e93799f2..6968c09252 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,7 +24,6 @@ all_examples = [
         'ip_reassembly',
         'ipsec-secgw',
         'ipv4_multicast',
-        'kni',
         'l2fwd',
         'l2fwd-cat',
         'l2fwd-crypto',
--
2.34.1


^ permalink raw reply	[relevance 1%]

* [PATCH] examples/kni: remove deprecated kni example
@ 2022-09-20 15:14  1% Bruce Richardson
  2022-09-20 15:51  1% ` [PATCH v2] " Bruce Richardson
  0 siblings, 1 reply; 200+ results
From: Bruce Richardson @ 2022-09-20 15:14 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

As part of the agreed process for deprecating KNI in DPDK, the example
app is scheduled for removal as part of the 22.11 release.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 doc/guides/rel_notes/deprecation.rst          |    1 -
 doc/guides/sample_app_ug/index.rst            |    1 -
 .../sample_app_ug/kernel_nic_interface.rst    |  318 -----
 examples/kni/Makefile                         |   52 -
 examples/kni/main.c                           | 1140 -----------------
 examples/kni/meson.build                      |   13 -
 examples/meson.build                          |    1 -
 7 files changed, 1526 deletions(-)
 delete mode 100644 doc/guides/sample_app_ug/kernel_nic_interface.rst
 delete mode 100644 examples/kni/Makefile
 delete mode 100644 examples/kni/main.c
 delete mode 100644 examples/kni/meson.build

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index c1975d6c3e..2ded2d69d1 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -70,7 +70,6 @@ Deprecation Notices
   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.
 
 * lib: will fix extending some enum/define breaking the ABI. There are multiple
diff --git a/doc/guides/sample_app_ug/index.rst b/doc/guides/sample_app_ug/index.rst
index cc9fae1e8c..6e1e83d7d7 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -20,7 +20,6 @@ Sample Applications User Guides
     ip_frag
     ipv4_multicast
     ip_reassembly
-    kernel_nic_interface
     keep_alive
     dma
     l2_forward_crypto
diff --git a/doc/guides/sample_app_ug/kernel_nic_interface.rst b/doc/guides/sample_app_ug/kernel_nic_interface.rst
deleted file mode 100644
index ef441cc1e5..0000000000
--- a/doc/guides/sample_app_ug/kernel_nic_interface.rst
+++ /dev/null
@@ -1,318 +0,0 @@
-..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
-
-Kernel NIC Interface Sample Application
-=======================================
-
-The Kernel NIC Interface (KNI) is a DPDK control plane solution that
-allows userspace applications to exchange packets with the kernel networking stack.
-To accomplish this, DPDK userspace applications use an IOCTL call
-to request the creation of a KNI virtual device in the Linux* kernel.
-The IOCTL call provides interface information and the DPDK's physical address space,
-which is re-mapped into the kernel address space by the KNI kernel loadable module
-that saves the information to a virtual device context.
-The DPDK creates FIFO queues for packet ingress and egress
-to the kernel module for each device allocated.
-
-The KNI kernel loadable module is a standard net driver,
-which upon receiving the IOCTL call access the DPDK's FIFO queue to
-receive/transmit packets from/to the DPDK userspace application.
-The FIFO queues contain pointers to data packets in the DPDK. This:
-
-*   Provides a faster mechanism to interface with the kernel net stack and eliminates system calls
-
-*   Facilitates the DPDK using standard Linux* userspace net tools (tshark, rsync, and so on)
-
-*   Eliminate the copy_to_user and copy_from_user operations on packets.
-
-The Kernel NIC Interface sample application is a simple example that demonstrates the use
-of the DPDK to create a path for packets to go through the Linux* kernel.
-This is done by creating one or more kernel net devices for each of the DPDK ports.
-The application allows the use of standard Linux tools (ethtool, iproute, tshark) with the DPDK ports and
-also the exchange of packets between the DPDK application and the Linux* kernel.
-
-The Kernel NIC Interface sample application requires that the
-KNI kernel module ``rte_kni`` be loaded into the kernel.  See
-:doc:`../prog_guide/kernel_nic_interface` for more information on loading
-the ``rte_kni`` kernel module.
-
-Overview
---------
-
-The Kernel NIC Interface sample application ``kni`` allocates one or more
-KNI interfaces for each physical NIC port.  For each physical NIC port,
-``kni`` uses two DPDK threads in user space; one thread reads from the port and
-writes to the corresponding KNI interfaces and the other thread reads from
-the KNI interfaces and writes the data unmodified to the physical NIC port.
-
-It is recommended to configure one KNI interface for each physical NIC port.
-The application can be configured with more than one KNI interface for
-each physical NIC port for performance testing or it can work together with
-VMDq support in future.
-
-The packet flow through the Kernel NIC Interface application is as shown
-in the following figure.
-
-.. _figure_kernel_nic:
-
-.. figure:: img/kernel_nic.*
-
-   Kernel NIC Application Packet Flow
-
-If link monitoring is enabled with the ``-m`` command line flag, one
-additional pthread is launched which will check the link status of each
-physical NIC port and will update the carrier status of the corresponding
-KNI interface(s) to match the physical NIC port's state.  This means that
-the KNI interface(s) will be disabled automatically when the Ethernet link
-goes down and enabled when the Ethernet link goes up.
-
-If link monitoring is enabled, the ``rte_kni`` kernel module should be loaded
-such that the :ref:`default carrier state <kni_default_carrier_state>` is
-set to *off*.  This ensures that the KNI interface is only enabled *after*
-the Ethernet link of the corresponding NIC port has reached the linkup state.
-
-If link monitoring is not enabled, the ``rte_kni`` kernel module should be
-loaded with the :ref:`default carrier state <kni_default_carrier_state>`
-set to *on*.  This sets the carrier state of the KNI interfaces to *on*
-when the KNI interfaces are enabled without regard to the actual link state
-of the corresponding NIC port.  This is useful for testing in loopback
-mode where the NIC port may not be physically connected to anything.
-
-Compiling the Application
--------------------------
-
-To compile the sample application see :doc:`compiling`.
-
-The application is located in the ``examples/kni`` sub-directory.
-
-.. note::
-
-        This application is intended as a linux only.
-
-Running the kni Example Application
------------------------------------
-
-The ``kni`` example application requires a number of command line options:
-
-.. code-block:: console
-
-    dpdk-kni [EAL options] -- -p PORTMASK --config="(port,lcore_rx,lcore_tx[,lcore_kthread,...])[,(port,lcore_rx,lcore_tx[,lcore_kthread,...])]" [-P] [-m]
-
-Where:
-
-*   ``-p PORTMASK``:
-
-    Hexadecimal bitmask of ports to configure.
-
-*   ``--config="(port,lcore_rx,lcore_tx[,lcore_kthread,...])[,(port,lcore_rx,lcore_tx[,lcore_kthread,...])]"``:
-
-    Determines which lcores the Rx and Tx DPDK tasks, and (optionally)
-    the KNI kernel thread(s) are bound to for each physical port.
-
-*   ``-P``:
-
-    Optional flag to set all ports to promiscuous mode so that packets are
-    accepted regardless of the packet's Ethernet MAC destination address.
-    Without this option, only packets with the Ethernet MAC destination
-    address set to the Ethernet address of the port are accepted.
-
-*   ``-m``:
-
-    Optional flag to enable monitoring and updating of the Ethernet
-    carrier state.  With this option set, a thread will be started which
-    will periodically check the Ethernet link status of the physical
-    Ethernet ports and set the carrier state of the corresponding KNI
-    network interface to match it.  This means that the KNI interface will
-    be disabled automatically when the Ethernet link goes down and enabled
-    when the Ethernet link goes up.
-
-Refer to *DPDK Getting Started Guide* for general information on running
-applications and the Environment Abstraction Layer (EAL) options.
-
-The ``-c coremask`` or ``-l corelist`` parameter of the EAL options must
-include the lcores specified by ``lcore_rx`` and ``lcore_tx`` for each port,
-but does not need to include lcores specified by ``lcore_kthread`` as those
-cores are used to pin the kernel threads in the ``rte_kni`` kernel module.
-
-The ``--config`` parameter must include a set of
-``(port,lcore_rx,lcore_tx,[lcore_kthread,...])`` values for each physical
-port specified in the ``-p PORTMASK`` parameter.
-
-The optional ``lcore_kthread`` lcore ID parameter in ``--config`` can be
-specified zero, one or more times for each physical port.
-
-If no lcore ID is specified for ``lcore_kthread``, one KNI interface will
-be created for the physical port ``port`` and the KNI kernel thread(s)
-will have no specific core affinity.
-
-If one or more lcore IDs are specified for ``lcore_kthread``, a KNI interface
-will be created for each lcore ID specified, bound to the physical port
-``port``.  If the ``rte_kni`` kernel module is loaded in :ref:`multiple
-kernel thread <kni_kernel_thread_mode>` mode, a kernel thread will be created
-for each KNI interface and bound to the specified core.  If the ``rte_kni``
-kernel module is loaded in :ref:`single kernel thread <kni_kernel_thread_mode>`
-mode, only one kernel thread is started for all KNI interfaces.  The kernel
-thread will be bound to the first ``lcore_kthread`` lcore ID specified.
-
-Example Configurations
-~~~~~~~~~~~~~~~~~~~~~~~
-
-The following commands will first load the ``rte_kni`` kernel module in
-:ref:`multiple kernel thread <kni_kernel_thread_mode>` mode.  The ``kni``
-application is then started using two ports;  Port 0 uses lcore 4 for the
-Rx task, lcore 6 for the Tx task, and will create a single KNI interface
-``vEth0_0`` with the kernel thread bound to lcore 8.  Port 1 uses lcore
-5 for the Rx task, lcore 7 for the Tx task, and will create a single KNI
-interface ``vEth1_0`` with the kernel thread bound to lcore 9.
-
-.. code-block:: console
-
-    # rmmod rte_kni
-    # insmod <build_dir>/kernel/linux/kni/rte_kni.ko kthread_mode=multiple
-    # ./<build-dir>/examples/dpdk-kni -l 4-7 -n 4 -- -P -p 0x3 -m --config="(0,4,6,8),(1,5,7,9)"
-
-The following example is identical, except an additional ``lcore_kthread``
-core is specified per physical port.  In this case, ``kni`` will create
-four KNI interfaces: ``vEth0_0``/``vEth0_1`` bound to physical port 0 and
-``vEth1_0``/``vEth1_1`` bound to physical port 1.
-
-The kernel thread for each interface will be bound as follows:
-
-    * ``vEth0_0`` - bound to lcore 8.
-    * ``vEth0_1`` - bound to lcore 10.
-    * ``vEth1_0`` - bound to lcore 9.
-    * ``vEth1_1`` - bound to lcore 11
-
-.. code-block:: console
-
-    # rmmod rte_kni
-    # insmod <build_dir>/kernel/linux/kni/rte_kni.ko kthread_mode=multiple
-    # ./<build-dir>/examples/dpdk-kni -l 4-7 -n 4 -- -P -p 0x3 -m --config="(0,4,6,8,10),(1,5,7,9,11)"
-
-The following example can be used to test the interface between the ``kni``
-test application and the ``rte_kni`` kernel module.  In this example,
-the ``rte_kni`` kernel module is loaded in :ref:`single kernel thread
-mode <kni_kernel_thread_mode>`, :ref:`loopback mode <kni_loopback_mode>`
-enabled, and the :ref:`default carrier state <kni_default_carrier_state>`
-is set to *on* so that the corresponding physical NIC port does not have
-to be connected in order to use the KNI interface.  One KNI interface
-``vEth0_0`` is created for port 0 and one KNI interface ``vEth1_0`` is
-created for port 1.  Since ``rte_kni`` is loaded in "single kernel thread"
-mode, the one kernel thread is bound to lcore 8.
-
-Since the physical NIC ports are not being used, link monitoring can be
-disabled by **not** specifying the ``-m`` flag to ``kni``:
-
-.. code-block:: console
-
-    # rmmod rte_kni
-    # insmod <build_dir>/kernel/linux/kni/rte_kni.ko lo_mode=lo_mode_fifo carrier=on
-    # ./<build-dir>/examples/dpdk-kni -l 4-7 -n 4 -- -P -p 0x3 --config="(0,4,6,8),(1,5,7,9)"
-
-KNI Operations
---------------
-
-Once the ``kni`` application is started, the user can use the normal
-Linux commands to manage the KNI interfaces as if they were any other
-Linux network interface.
-
-Enable KNI interface and assign an IP address:
-
-.. code-block:: console
-
-    # ip addr add dev vEth0_0 192.168.0.1
-
-Show KNI interface configuration and statistics:
-
-.. code-block:: console
-
-    # ip -s -d addr show vEth0_0
-
-The user can also check and reset the packet statistics inside the ``kni``
-application by sending the app the USR1 and USR2 signals:
-
-.. code-block:: console
-
-    # Print statistics
-    # pkill -USR1 kni
-
-    # Zero statistics
-    # pkill -USR2 kni
-
-Dump network traffic:
-
-.. code-block:: console
-
-    # tshark -n -i vEth0_0
-
-The normal Linux commands can also be used to change the MAC address and
-MTU size used by the physical NIC which corresponds to the KNI interface.
-However, if more than one KNI interface is configured for a physical port,
-these commands will only work on the first KNI interface for that port.
-
-Change the MAC address:
-
-.. code-block:: console
-
-    # ip link set dev vEth0_0 lladdr 0C:01:02:03:04:08
-
-Change the MTU size:
-
-.. code-block:: console
-
-    # ip link set dev vEth0_0 mtu 1450
-
-Limited ethtool support:
-
-.. code-block:: console
-
-    # ethtool -i vEth0_0
-
-When the ``kni`` application is closed, all the KNI interfaces are deleted
-from the Linux kernel.
-
-Explanation
------------
-
-The following sections provide some explanation of code.
-
-Initialization
-~~~~~~~~~~~~~~
-
-Setup of mbuf pool, driver and queues is similar to the setup done in the :doc:`l2_forward_real_virtual`..
-In addition, one or more kernel NIC interfaces are allocated for each
-of the configured ports according to the command line parameters.
-
-The code for allocating the kernel NIC interfaces for a specific port is
-in the function ``kni_alloc``.
-
-The other step in the initialization process that is unique to this sample application
-is the association of each port with lcores for RX, TX and kernel threads.
-
-*   One lcore to read from the port and write to the associated one or more KNI devices
-
-*   Another lcore to read from one or more KNI devices and write to the port
-
-*   Other lcores for pinning the kernel threads on one by one
-
-This is done by using the ``kni_port_params_array[]`` array, which is indexed by the port ID.
-The code is in the function ``parse_config``.
-
-Packet Forwarding
-~~~~~~~~~~~~~~~~~
-
-After the initialization steps are completed, the main_loop() function is run on each lcore.
-This function first checks the lcore_id against the user provided lcore_rx and lcore_tx
-to see if this lcore is reading from or writing to kernel NIC interfaces.
-
-For the case that reads from a NIC port and writes to the kernel NIC interfaces (``kni_ingress``),
-the packet reception is the same as in L2 Forwarding sample application
-(see :ref:`l2_fwd_app_rx_tx_packets`).
-The packet transmission is done by sending mbufs into the kernel NIC interfaces by ``rte_kni_tx_burst()``.
-The KNI library automatically frees the mbufs after the kernel successfully copied the mbufs.
-
-For the other case that reads from kernel NIC interfaces
-and writes to a physical NIC port (``kni_egress``),
-packets are retrieved by reading mbufs from kernel NIC interfaces by ``rte_kni_rx_burst()``.
-The packet transmission is the same as in the L2 Forwarding sample application
-(see :ref:`l2_fwd_app_rx_tx_packets`).
diff --git a/examples/kni/Makefile b/examples/kni/Makefile
deleted file mode 100644
index 753cb96f5f..0000000000
--- a/examples/kni/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
-
-# binary name
-APP = kni
-
-# all source are stored in SRCS-y
-SRCS-y := main.c
-
-PKGCONF ?= pkg-config
-
-# Build using pkg-config variables if possible
-ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0)
-$(error "no installation of DPDK found")
-endif
-
-all: shared
-.PHONY: shared static
-shared: build/$(APP)-shared
-	ln -sf $(APP)-shared build/$(APP)
-static: build/$(APP)-static
-	ln -sf $(APP)-static build/$(APP)
-
-PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
-CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
-CFLAGS += -DALLOW_EXPERIMENTAL_API
-LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
-LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
-
-ifeq ($(MAKECMDGOALS),static)
-# check for broken pkg-config
-ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
-$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
-$(error "Cannot generate statically-linked binaries with this version of pkg-config")
-endif
-endif
-
-LDFLAGS += -pthread
-
-build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
-	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
-
-build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
-	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
-
-build:
-	@mkdir -p $@
-
-.PHONY: clean
-clean:
-	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	test -d build && rmdir -p build || true
diff --git a/examples/kni/main.c b/examples/kni/main.c
deleted file mode 100644
index e99ef5c38a..0000000000
--- a/examples/kni/main.c
+++ /dev/null
@@ -1,1140 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <string.h>
-#include <sys/queue.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include <netinet/in.h>
-#include <linux/if.h>
-#include <linux/if_tun.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <signal.h>
-
-#include <rte_common.h>
-#include <rte_log.h>
-#include <rte_memory.h>
-#include <rte_memcpy.h>
-#include <rte_eal.h>
-#include <rte_per_lcore.h>
-#include <rte_launch.h>
-#include <rte_lcore.h>
-#include <rte_branch_prediction.h>
-#include <rte_interrupts.h>
-#include <rte_bus_pci.h>
-#include <rte_debug.h>
-#include <rte_ether.h>
-#include <rte_ethdev.h>
-#include <rte_mempool.h>
-#include <rte_mbuf.h>
-#include <rte_string_fns.h>
-#include <rte_cycles.h>
-#include <rte_malloc.h>
-#include <rte_kni.h>
-
-/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
-
-/* Max size of a single packet */
-#define MAX_PACKET_SZ           2048
-
-/* Size of the data buffer in each mbuf */
-#define MBUF_DATA_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM)
-
-/* Number of mbufs in mempool that is created */
-#define NB_MBUF                 (8192 * 16)
-
-/* How many packets to attempt to read from NIC in one go */
-#define PKT_BURST_SZ            32
-
-/* How many objects (mbufs) to keep in per-lcore mempool cache */
-#define MEMPOOL_CACHE_SZ        PKT_BURST_SZ
-
-/* Number of RX ring descriptors */
-#define NB_RXD                  1024
-
-/* Number of TX ring descriptors */
-#define NB_TXD                  1024
-
-/* Total octets in ethernet header */
-#define KNI_ENET_HEADER_SIZE    14
-
-/* Total octets in the FCS */
-#define KNI_ENET_FCS_SIZE       4
-
-#define KNI_US_PER_SECOND       1000000
-#define KNI_SECOND_PER_DAY      86400
-
-#define KNI_MAX_KTHREAD 32
-/*
- * Structure of port parameters
- */
-struct kni_port_params {
-	uint16_t port_id;/* Port ID */
-	unsigned lcore_rx; /* lcore ID for RX */
-	unsigned lcore_tx; /* lcore ID for TX */
-	uint32_t nb_lcore_k; /* Number of lcores for KNI multi kernel threads */
-	uint32_t nb_kni; /* Number of KNI devices to be created */
-	unsigned lcore_k[KNI_MAX_KTHREAD]; /* lcore ID list for kthreads */
-	struct rte_kni *kni[KNI_MAX_KTHREAD]; /* KNI context pointers */
-} __rte_cache_aligned;
-
-static struct kni_port_params *kni_port_params_array[RTE_MAX_ETHPORTS];
-
-
-/* Options for configuring ethernet port */
-static struct rte_eth_conf port_conf = {
-	.txmode = {
-		.mq_mode = RTE_ETH_MQ_TX_NONE,
-	},
-};
-
-/* Mempool for mbufs */
-static struct rte_mempool * pktmbuf_pool = NULL;
-
-/* Mask of enabled ports */
-static uint32_t ports_mask = 0;
-/* Ports set in promiscuous mode off by default. */
-static int promiscuous_on = 0;
-/* Monitor link status continually. off by default. */
-static int monitor_links;
-
-/* Structure type for recording kni interface specific stats */
-struct kni_interface_stats {
-	/* number of pkts received from NIC, and sent to KNI */
-	uint64_t rx_packets;
-
-	/* number of pkts received from NIC, but failed to send to KNI */
-	uint64_t rx_dropped;
-
-	/* number of pkts received from KNI, and sent to NIC */
-	uint64_t tx_packets;
-
-	/* number of pkts received from KNI, but failed to send to NIC */
-	uint64_t tx_dropped;
-};
-
-/* kni device statistics array */
-static struct kni_interface_stats kni_stats[RTE_MAX_ETHPORTS];
-
-static int kni_change_mtu(uint16_t port_id, unsigned int new_mtu);
-static int kni_config_network_interface(uint16_t port_id, uint8_t if_up);
-static int kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]);
-
-static uint32_t kni_stop;
-static uint32_t kni_pause;
-
-/* Print out statistics on packets handled */
-static void
-print_stats(void)
-{
-	uint16_t i;
-
-	printf("\n**KNI example application statistics**\n"
-	       "======  ==============  ============  ============  ============  ============\n"
-	       " Port    Lcore(RX/TX)    rx_packets    rx_dropped    tx_packets    tx_dropped\n"
-	       "------  --------------  ------------  ------------  ------------  ------------\n");
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (!kni_port_params_array[i])
-			continue;
-
-		printf("%7d %10u/%2u %13"PRIu64" %13"PRIu64" %13"PRIu64" "
-							"%13"PRIu64"\n", i,
-					kni_port_params_array[i]->lcore_rx,
-					kni_port_params_array[i]->lcore_tx,
-						kni_stats[i].rx_packets,
-						kni_stats[i].rx_dropped,
-						kni_stats[i].tx_packets,
-						kni_stats[i].tx_dropped);
-	}
-	printf("======  ==============  ============  ============  ============  ============\n");
-
-	fflush(stdout);
-}
-
-/* Custom handling of signals to handle stats and kni processing */
-static void
-signal_handler(int signum)
-{
-	/* When we receive a USR1 signal, print stats */
-	if (signum == SIGUSR1) {
-		print_stats();
-	}
-
-	/* When we receive a USR2 signal, reset stats */
-	if (signum == SIGUSR2) {
-		memset(&kni_stats, 0, sizeof(kni_stats));
-		printf("\n** Statistics have been reset **\n");
-		return;
-	}
-
-	/*
-	 * When we receive a RTMIN or SIGINT or SIGTERM signal,
-	 * stop kni processing
-	 */
-	if (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {
-		printf("\nSIGRTMIN/SIGINT/SIGTERM received. "
-			"KNI processing stopping.\n");
-		__atomic_fetch_add(&kni_stop, 1, __ATOMIC_RELAXED);
-		return;
-        }
-}
-
-static void
-kni_burst_free_mbufs(struct rte_mbuf **pkts, unsigned num)
-{
-	unsigned i;
-
-	if (pkts == NULL)
-		return;
-
-	for (i = 0; i < num; i++) {
-		rte_pktmbuf_free(pkts[i]);
-		pkts[i] = NULL;
-	}
-}
-
-/**
- * Interface to burst rx and enqueue mbufs into rx_q
- */
-static void
-kni_ingress(struct kni_port_params *p)
-{
-	uint8_t i;
-	uint16_t port_id;
-	unsigned nb_rx, num;
-	uint32_t nb_kni;
-	struct rte_mbuf *pkts_burst[PKT_BURST_SZ];
-
-	if (p == NULL)
-		return;
-
-	nb_kni = p->nb_kni;
-	port_id = p->port_id;
-	for (i = 0; i < nb_kni; i++) {
-		/* Burst rx from eth */
-		nb_rx = rte_eth_rx_burst(port_id, 0, pkts_burst, PKT_BURST_SZ);
-		if (unlikely(nb_rx > PKT_BURST_SZ)) {
-			RTE_LOG(ERR, APP, "Error receiving from eth\n");
-			return;
-		}
-		/* Burst tx to kni */
-		num = rte_kni_tx_burst(p->kni[i], pkts_burst, nb_rx);
-		if (num)
-			kni_stats[port_id].rx_packets += num;
-
-		rte_kni_handle_request(p->kni[i]);
-		if (unlikely(num < nb_rx)) {
-			/* Free mbufs not tx to kni interface */
-			kni_burst_free_mbufs(&pkts_burst[num], nb_rx - num);
-			kni_stats[port_id].rx_dropped += nb_rx - num;
-		}
-	}
-}
-
-/**
- * Interface to dequeue mbufs from tx_q and burst tx
- */
-static void
-kni_egress(struct kni_port_params *p)
-{
-	uint8_t i;
-	uint16_t port_id;
-	unsigned nb_tx, num;
-	uint32_t nb_kni;
-	struct rte_mbuf *pkts_burst[PKT_BURST_SZ];
-
-	if (p == NULL)
-		return;
-
-	nb_kni = p->nb_kni;
-	port_id = p->port_id;
-	for (i = 0; i < nb_kni; i++) {
-		/* Burst rx from kni */
-		num = rte_kni_rx_burst(p->kni[i], pkts_burst, PKT_BURST_SZ);
-		if (unlikely(num > PKT_BURST_SZ)) {
-			RTE_LOG(ERR, APP, "Error receiving from KNI\n");
-			return;
-		}
-		/* Burst tx to eth */
-		nb_tx = rte_eth_tx_burst(port_id, 0, pkts_burst, (uint16_t)num);
-		if (nb_tx)
-			kni_stats[port_id].tx_packets += nb_tx;
-		if (unlikely(nb_tx < num)) {
-			/* Free mbufs not tx to NIC */
-			kni_burst_free_mbufs(&pkts_burst[nb_tx], num - nb_tx);
-			kni_stats[port_id].tx_dropped += num - nb_tx;
-		}
-	}
-}
-
-static int
-main_loop(__rte_unused void *arg)
-{
-	uint16_t i;
-	int32_t f_stop;
-	int32_t f_pause;
-	const unsigned lcore_id = rte_lcore_id();
-	enum lcore_rxtx {
-		LCORE_NONE,
-		LCORE_RX,
-		LCORE_TX,
-		LCORE_MAX
-	};
-	enum lcore_rxtx flag = LCORE_NONE;
-
-	RTE_ETH_FOREACH_DEV(i) {
-		if (!kni_port_params_array[i])
-			continue;
-		if (kni_port_params_array[i]->lcore_rx == (uint8_t)lcore_id) {
-			flag = LCORE_RX;
-			break;
-		} else if (kni_port_params_array[i]->lcore_tx ==
-						(uint8_t)lcore_id) {
-			flag = LCORE_TX;
-			break;
-		}
-	}
-
-	if (flag == LCORE_RX) {
-		RTE_LOG(INFO, APP, "Lcore %u is reading from port %d\n",
-					kni_port_params_array[i]->lcore_rx,
-					kni_port_params_array[i]->port_id);
-		while (1) {
-			f_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);
-			f_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);
-			if (f_stop)
-				break;
-			if (f_pause)
-				continue;
-			kni_ingress(kni_port_params_array[i]);
-		}
-	} else if (flag == LCORE_TX) {
-		RTE_LOG(INFO, APP, "Lcore %u is writing to port %d\n",
-					kni_port_params_array[i]->lcore_tx,
-					kni_port_params_array[i]->port_id);
-		while (1) {
-			f_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);
-			f_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);
-			if (f_stop)
-				break;
-			if (f_pause)
-				continue;
-			kni_egress(kni_port_params_array[i]);
-		}
-	} else
-		RTE_LOG(INFO, APP, "Lcore %u has nothing to do\n", lcore_id);
-
-	return 0;
-}
-
-/* Display usage instructions */
-static void
-print_usage(const char *prgname)
-{
-	RTE_LOG(INFO, APP, "\nUsage: %s [EAL options] -- -p PORTMASK -P -m "
-		   "[--config (port,lcore_rx,lcore_tx,lcore_kthread...)"
-		   "[,(port,lcore_rx,lcore_tx,lcore_kthread...)]]\n"
-		   "    -p PORTMASK: hex bitmask of ports to use\n"
-		   "    -P : enable promiscuous mode\n"
-		   "    -m : enable monitoring of port carrier state\n"
-		   "    --config (port,lcore_rx,lcore_tx,lcore_kthread...): "
-		   "port and lcore configurations\n",
-	           prgname);
-}
-
-/* Convert string to unsigned number. 0 is returned if error occurs */
-static uint32_t
-parse_unsigned(const char *portmask)
-{
-	char *end = NULL;
-	unsigned long num;
-
-	num = strtoul(portmask, &end, 16);
-	if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
-		return 0;
-
-	return (uint32_t)num;
-}
-
-static void
-print_config(void)
-{
-	uint32_t i, j;
-	struct kni_port_params **p = kni_port_params_array;
-
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (!p[i])
-			continue;
-		RTE_LOG(DEBUG, APP, "Port ID: %d\n", p[i]->port_id);
-		RTE_LOG(DEBUG, APP, "Rx lcore ID: %u, Tx lcore ID: %u\n",
-					p[i]->lcore_rx, p[i]->lcore_tx);
-		for (j = 0; j < p[i]->nb_lcore_k; j++)
-			RTE_LOG(DEBUG, APP, "Kernel thread lcore ID: %u\n",
-							p[i]->lcore_k[j]);
-	}
-}
-
-static int
-parse_config(const char *arg)
-{
-	const char *p, *p0 = arg;
-	char s[256], *end;
-	unsigned size;
-	enum fieldnames {
-		FLD_PORT = 0,
-		FLD_LCORE_RX,
-		FLD_LCORE_TX,
-		_NUM_FLD = KNI_MAX_KTHREAD + 3,
-	};
-	int i, j, nb_token;
-	char *str_fld[_NUM_FLD];
-	unsigned long int_fld[_NUM_FLD];
-	uint16_t port_id, nb_kni_port_params = 0;
-
-	memset(&kni_port_params_array, 0, sizeof(kni_port_params_array));
-	while (((p = strchr(p0, '(')) != NULL) &&
-		nb_kni_port_params < RTE_MAX_ETHPORTS) {
-		p++;
-		if ((p0 = strchr(p, ')')) == NULL)
-			goto fail;
-		size = p0 - p;
-		if (size >= sizeof(s)) {
-			printf("Invalid config parameters\n");
-			goto fail;
-		}
-		snprintf(s, sizeof(s), "%.*s", size, p);
-		nb_token = rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',');
-		if (nb_token <= FLD_LCORE_TX) {
-			printf("Invalid config parameters\n");
-			goto fail;
-		}
-		for (i = 0; i < nb_token; i++) {
-			errno = 0;
-			int_fld[i] = strtoul(str_fld[i], &end, 0);
-			if (errno != 0 || end == str_fld[i]) {
-				printf("Invalid config parameters\n");
-				goto fail;
-			}
-		}
-
-		i = 0;
-		port_id = int_fld[i++];
-		if (port_id >= RTE_MAX_ETHPORTS) {
-			printf("Port ID %d could not exceed the maximum %d\n",
-						port_id, RTE_MAX_ETHPORTS);
-			goto fail;
-		}
-		if (kni_port_params_array[port_id]) {
-			printf("Port %d has been configured\n", port_id);
-			goto fail;
-		}
-		kni_port_params_array[port_id] =
-			rte_zmalloc("KNI_port_params",
-				    sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);
-		kni_port_params_array[port_id]->port_id = port_id;
-		kni_port_params_array[port_id]->lcore_rx =
-					(uint8_t)int_fld[i++];
-		kni_port_params_array[port_id]->lcore_tx =
-					(uint8_t)int_fld[i++];
-		if (kni_port_params_array[port_id]->lcore_rx >= RTE_MAX_LCORE ||
-		kni_port_params_array[port_id]->lcore_tx >= RTE_MAX_LCORE) {
-			printf("lcore_rx %u or lcore_tx %u ID could not "
-						"exceed the maximum %u\n",
-				kni_port_params_array[port_id]->lcore_rx,
-				kni_port_params_array[port_id]->lcore_tx,
-						(unsigned)RTE_MAX_LCORE);
-			goto fail;
-		}
-		for (j = 0; i < nb_token && j < KNI_MAX_KTHREAD; i++, j++)
-			kni_port_params_array[port_id]->lcore_k[j] =
-						(uint8_t)int_fld[i];
-		kni_port_params_array[port_id]->nb_lcore_k = j;
-	}
-	print_config();
-
-	return 0;
-
-fail:
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (kni_port_params_array[i]) {
-			rte_free(kni_port_params_array[i]);
-			kni_port_params_array[i] = NULL;
-		}
-	}
-
-	return -1;
-}
-
-static int
-validate_parameters(uint32_t portmask)
-{
-	uint32_t i;
-
-	if (!portmask) {
-		printf("No port configured in port mask\n");
-		return -1;
-	}
-
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (((portmask & (1 << i)) && !kni_port_params_array[i]) ||
-			(!(portmask & (1 << i)) && kni_port_params_array[i]))
-			rte_exit(EXIT_FAILURE, "portmask is not consistent "
-				"to port ids specified in --config\n");
-
-		if (kni_port_params_array[i] && !rte_lcore_is_enabled(\
-			(unsigned)(kni_port_params_array[i]->lcore_rx)))
-			rte_exit(EXIT_FAILURE, "lcore id %u for "
-					"port %d receiving not enabled\n",
-					kni_port_params_array[i]->lcore_rx,
-					kni_port_params_array[i]->port_id);
-
-		if (kni_port_params_array[i] && !rte_lcore_is_enabled(\
-			(unsigned)(kni_port_params_array[i]->lcore_tx)))
-			rte_exit(EXIT_FAILURE, "lcore id %u for "
-					"port %d transmitting not enabled\n",
-					kni_port_params_array[i]->lcore_tx,
-					kni_port_params_array[i]->port_id);
-
-	}
-
-	return 0;
-}
-
-#define CMDLINE_OPT_CONFIG  "config"
-
-/* Parse the arguments given in the command line of the application */
-static int
-parse_args(int argc, char **argv)
-{
-	int opt, longindex, ret = 0;
-	const char *prgname = argv[0];
-	static struct option longopts[] = {
-		{CMDLINE_OPT_CONFIG, required_argument, NULL, 0},
-		{NULL, 0, NULL, 0}
-	};
-
-	/* Disable printing messages within getopt() */
-	opterr = 0;
-
-	/* Parse command line */
-	while ((opt = getopt_long(argc, argv, "p:Pm", longopts,
-						&longindex)) != EOF) {
-		switch (opt) {
-		case 'p':
-			ports_mask = parse_unsigned(optarg);
-			break;
-		case 'P':
-			promiscuous_on = 1;
-			break;
-		case 'm':
-			monitor_links = 1;
-			break;
-		case 0:
-			if (!strncmp(longopts[longindex].name,
-				     CMDLINE_OPT_CONFIG,
-				     sizeof(CMDLINE_OPT_CONFIG))) {
-				ret = parse_config(optarg);
-				if (ret) {
-					printf("Invalid config\n");
-					print_usage(prgname);
-					return -1;
-				}
-			}
-			break;
-		default:
-			print_usage(prgname);
-			rte_exit(EXIT_FAILURE, "Invalid option specified\n");
-		}
-	}
-
-	/* Check that options were parsed ok */
-	if (validate_parameters(ports_mask) < 0) {
-		print_usage(prgname);
-		rte_exit(EXIT_FAILURE, "Invalid parameters\n");
-	}
-
-	return ret;
-}
-
-/* Initialize KNI subsystem */
-static void
-init_kni(void)
-{
-	unsigned int num_of_kni_ports = 0, i;
-	struct kni_port_params **params = kni_port_params_array;
-
-	/* Calculate the maximum number of KNI interfaces that will be used */
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (kni_port_params_array[i]) {
-			num_of_kni_ports += (params[i]->nb_lcore_k ?
-				params[i]->nb_lcore_k : 1);
-		}
-	}
-
-	/* Invoke rte KNI init to preallocate the ports */
-	rte_kni_init(num_of_kni_ports);
-}
-
-/* Initialise a single port on an Ethernet device */
-static void
-init_port(uint16_t port)
-{
-	int ret;
-	uint16_t nb_rxd = NB_RXD;
-	uint16_t nb_txd = NB_TXD;
-	struct rte_eth_dev_info dev_info;
-	struct rte_eth_rxconf rxq_conf;
-	struct rte_eth_txconf txq_conf;
-	struct rte_eth_conf local_port_conf = port_conf;
-
-	/* Initialise device and RX/TX queues */
-	RTE_LOG(INFO, APP, "Initialising port %u ...\n", (unsigned)port);
-	fflush(stdout);
-
-	ret = rte_eth_dev_info_get(port, &dev_info);
-	if (ret != 0)
-		rte_exit(EXIT_FAILURE,
-			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-ret));
-
-	if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
-		local_port_conf.txmode.offloads |=
-			RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
-	ret = rte_eth_dev_configure(port, 1, 1, &local_port_conf);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not configure port%u (%d)\n",
-		            (unsigned)port, ret);
-
-	ret = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors "
-				"for port%u (%d)\n", (unsigned)port, ret);
-
-	rxq_conf = dev_info.default_rxconf;
-	rxq_conf.offloads = local_port_conf.rxmode.offloads;
-	ret = rte_eth_rx_queue_setup(port, 0, nb_rxd,
-		rte_eth_dev_socket_id(port), &rxq_conf, pktmbuf_pool);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not setup up RX queue for "
-				"port%u (%d)\n", (unsigned)port, ret);
-
-	txq_conf = dev_info.default_txconf;
-	txq_conf.offloads = local_port_conf.txmode.offloads;
-	ret = rte_eth_tx_queue_setup(port, 0, nb_txd,
-		rte_eth_dev_socket_id(port), &txq_conf);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not setup up TX queue for "
-				"port%u (%d)\n", (unsigned)port, ret);
-
-	ret = rte_eth_dev_start(port);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not start port%u (%d)\n",
-						(unsigned)port, ret);
-
-	if (promiscuous_on) {
-		ret = rte_eth_promiscuous_enable(port);
-		if (ret != 0)
-			rte_exit(EXIT_FAILURE,
-				"Could not enable promiscuous mode for port%u: %s\n",
-				port, rte_strerror(-ret));
-	}
-}
-
-/* Check the link status of all ports in up to 9s, and print them finally */
-static void
-check_all_ports_link_status(uint32_t port_mask)
-{
-#define CHECK_INTERVAL 100 /* 100ms */
-#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
-	uint16_t portid;
-	uint8_t count, all_ports_up, print_flag = 0;
-	struct rte_eth_link link;
-	int ret;
-	char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
-
-	printf("\nChecking link status\n");
-	fflush(stdout);
-	for (count = 0; count <= MAX_CHECK_TIME; count++) {
-		all_ports_up = 1;
-		RTE_ETH_FOREACH_DEV(portid) {
-			if ((port_mask & (1 << portid)) == 0)
-				continue;
-			memset(&link, 0, sizeof(link));
-			ret = rte_eth_link_get_nowait(portid, &link);
-			if (ret < 0) {
-				all_ports_up = 0;
-				if (print_flag == 1)
-					printf("Port %u link get failed: %s\n",
-						portid, rte_strerror(-ret));
-				continue;
-			}
-			/* print link status if flag set */
-			if (print_flag == 1) {
-				rte_eth_link_to_str(link_status_text,
-					sizeof(link_status_text), &link);
-				printf("Port %d %s\n", portid,
-					link_status_text);
-				continue;
-			}
-			/* clear all_ports_up flag if any link down */
-			if (link.link_status == RTE_ETH_LINK_DOWN) {
-				all_ports_up = 0;
-				break;
-			}
-		}
-		/* after finally printing all link status, get out */
-		if (print_flag == 1)
-			break;
-
-		if (all_ports_up == 0) {
-			printf(".");
-			fflush(stdout);
-			rte_delay_ms(CHECK_INTERVAL);
-		}
-
-		/* set the print_flag if all ports up or timeout */
-		if (all_ports_up == 1 || count == (MAX_CHECK_TIME - 1)) {
-			print_flag = 1;
-			printf("done\n");
-		}
-	}
-}
-
-static void
-log_link_state(struct rte_kni *kni, int prev, struct rte_eth_link *link)
-{
-	char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
-	if (kni == NULL || link == NULL)
-		return;
-
-	rte_eth_link_to_str(link_status_text, sizeof(link_status_text), link);
-	if (prev != link->link_status)
-		RTE_LOG(INFO, APP, "%s NIC %s\n",
-			rte_kni_get_name(kni),
-			link_status_text);
-}
-
-/*
- * Monitor the link status of all ports and update the
- * corresponding KNI interface(s)
- */
-static void *
-monitor_all_ports_link_status(void *arg)
-{
-	uint16_t portid;
-	struct rte_eth_link link;
-	unsigned int i;
-	struct kni_port_params **p = kni_port_params_array;
-	int prev;
-	(void) arg;
-	int ret;
-
-	while (monitor_links) {
-		rte_delay_ms(500);
-		RTE_ETH_FOREACH_DEV(portid) {
-			if ((ports_mask & (1 << portid)) == 0)
-				continue;
-			memset(&link, 0, sizeof(link));
-			ret = rte_eth_link_get_nowait(portid, &link);
-			if (ret < 0) {
-				RTE_LOG(ERR, APP,
-					"Get link failed (port %u): %s\n",
-					portid, rte_strerror(-ret));
-				continue;
-			}
-			for (i = 0; i < p[portid]->nb_kni; i++) {
-				prev = rte_kni_update_link(p[portid]->kni[i],
-						link.link_status);
-				log_link_state(p[portid]->kni[i], prev, &link);
-			}
-		}
-	}
-	return NULL;
-}
-
-static int
-kni_change_mtu_(uint16_t port_id, unsigned int new_mtu)
-{
-	int ret;
-	uint16_t nb_rxd = NB_RXD;
-	uint16_t nb_txd = NB_TXD;
-	struct rte_eth_conf conf;
-	struct rte_eth_dev_info dev_info;
-	struct rte_eth_rxconf rxq_conf;
-	struct rte_eth_txconf txq_conf;
-
-	if (!rte_eth_dev_is_valid_port(port_id)) {
-		RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id);
-		return -EINVAL;
-	}
-
-	RTE_LOG(INFO, APP, "Change MTU of port %d to %u\n", port_id, new_mtu);
-
-	/* Stop specific port */
-	ret = rte_eth_dev_stop(port_id);
-	if (ret != 0) {
-		RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
-			port_id, rte_strerror(-ret));
-		return ret;
-	}
-
-	memcpy(&conf, &port_conf, sizeof(conf));
-
-	conf.rxmode.mtu = new_mtu;
-	ret = rte_eth_dev_configure(port_id, 1, 1, &conf);
-	if (ret < 0) {
-		RTE_LOG(ERR, APP, "Fail to reconfigure port %d\n", port_id);
-		return ret;
-	}
-
-	ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors "
-				"for port%u (%d)\n", (unsigned int)port_id,
-				ret);
-
-	ret = rte_eth_dev_info_get(port_id, &dev_info);
-	if (ret != 0) {
-		RTE_LOG(ERR, APP,
-			"Error during getting device (port %u) info: %s\n",
-			port_id, strerror(-ret));
-
-		return ret;
-	}
-
-	rxq_conf = dev_info.default_rxconf;
-	rxq_conf.offloads = conf.rxmode.offloads;
-	ret = rte_eth_rx_queue_setup(port_id, 0, nb_rxd,
-		rte_eth_dev_socket_id(port_id), &rxq_conf, pktmbuf_pool);
-	if (ret < 0) {
-		RTE_LOG(ERR, APP, "Fail to setup Rx queue of port %d\n",
-				port_id);
-		return ret;
-	}
-
-	txq_conf = dev_info.default_txconf;
-	txq_conf.offloads = conf.txmode.offloads;
-	ret = rte_eth_tx_queue_setup(port_id, 0, nb_txd,
-		rte_eth_dev_socket_id(port_id), &txq_conf);
-	if (ret < 0) {
-		RTE_LOG(ERR, APP, "Fail to setup Tx queue of port %d\n",
-				port_id);
-		return ret;
-	}
-
-	/* Restart specific port */
-	ret = rte_eth_dev_start(port_id);
-	if (ret < 0) {
-		RTE_LOG(ERR, APP, "Fail to restart port %d\n", port_id);
-		return ret;
-	}
-
-	return 0;
-}
-
-/* Callback for request of changing MTU */
-static int
-kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
-{
-	int ret;
-
-	__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);
-	ret =  kni_change_mtu_(port_id, new_mtu);
-	__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
-
-	return ret;
-}
-
-/* Callback for request of configuring network interface up/down */
-static int
-kni_config_network_interface(uint16_t port_id, uint8_t if_up)
-{
-	int ret = 0;
-
-	if (!rte_eth_dev_is_valid_port(port_id)) {
-		RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id);
-		return -EINVAL;
-	}
-
-	RTE_LOG(INFO, APP, "Configure network interface of %d %s\n",
-					port_id, if_up ? "up" : "down");
-
-	__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);
-
-	if (if_up != 0) { /* Configure network interface up */
-		ret = rte_eth_dev_stop(port_id);
-		if (ret != 0) {
-			RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
-				port_id, rte_strerror(-ret));
-			__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
-			return ret;
-		}
-		ret = rte_eth_dev_start(port_id);
-	} else { /* Configure network interface down */
-		ret = rte_eth_dev_stop(port_id);
-		if (ret != 0) {
-			RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
-				port_id, rte_strerror(-ret));
-			__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
-			return ret;
-		}
-	}
-
-	__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
-
-	if (ret < 0)
-		RTE_LOG(ERR, APP, "Failed to start port %d\n", port_id);
-
-	return ret;
-}
-
-static void
-print_ethaddr(const char *name, struct rte_ether_addr *mac_addr)
-{
-	char buf[RTE_ETHER_ADDR_FMT_SIZE];
-	rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, mac_addr);
-	RTE_LOG(INFO, APP, "\t%s%s\n", name, buf);
-}
-
-/* Callback for request of configuring mac address */
-static int
-kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
-{
-	int ret = 0;
-
-	if (!rte_eth_dev_is_valid_port(port_id)) {
-		RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id);
-		return -EINVAL;
-	}
-
-	RTE_LOG(INFO, APP, "Configure mac address of %d\n", port_id);
-	print_ethaddr("Address:", (struct rte_ether_addr *)mac_addr);
-
-	ret = rte_eth_dev_default_mac_addr_set(port_id,
-					(struct rte_ether_addr *)mac_addr);
-	if (ret < 0)
-		RTE_LOG(ERR, APP, "Failed to config mac_addr for port %d\n",
-			port_id);
-
-	return ret;
-}
-
-static int
-kni_alloc(uint16_t port_id)
-{
-	uint8_t i;
-	struct rte_kni *kni;
-	struct rte_kni_conf conf;
-	struct kni_port_params **params = kni_port_params_array;
-	int ret;
-
-	if (port_id >= RTE_MAX_ETHPORTS || !params[port_id])
-		return -1;
-
-	params[port_id]->nb_kni = params[port_id]->nb_lcore_k ?
-				params[port_id]->nb_lcore_k : 1;
-
-	for (i = 0; i < params[port_id]->nb_kni; i++) {
-		/* Clear conf at first */
-		memset(&conf, 0, sizeof(conf));
-		if (params[port_id]->nb_lcore_k) {
-			snprintf(conf.name, RTE_KNI_NAMESIZE,
-					"vEth%u_%u", port_id, i);
-			conf.core_id = params[port_id]->lcore_k[i];
-			conf.force_bind = 1;
-		} else
-			snprintf(conf.name, RTE_KNI_NAMESIZE,
-						"vEth%u", port_id);
-		conf.group_id = port_id;
-		conf.mbuf_size = MAX_PACKET_SZ;
-		/*
-		 * The first KNI device associated to a port
-		 * is the main, for multiple kernel thread
-		 * environment.
-		 */
-		if (i == 0) {
-			struct rte_kni_ops ops;
-			struct rte_eth_dev_info dev_info;
-
-			ret = rte_eth_dev_info_get(port_id, &dev_info);
-			if (ret != 0)
-				rte_exit(EXIT_FAILURE,
-					"Error during getting device (port %u) info: %s\n",
-					port_id, strerror(-ret));
-
-			/* Get the interface default mac address */
-			ret = rte_eth_macaddr_get(port_id,
-				(struct rte_ether_addr *)&conf.mac_addr);
-			if (ret != 0)
-				rte_exit(EXIT_FAILURE,
-					"Failed to get MAC address (port %u): %s\n",
-					port_id, rte_strerror(-ret));
-
-			rte_eth_dev_get_mtu(port_id, &conf.mtu);
-
-			conf.min_mtu = dev_info.min_mtu;
-			conf.max_mtu = dev_info.max_mtu;
-
-			memset(&ops, 0, sizeof(ops));
-			ops.port_id = port_id;
-			ops.change_mtu = kni_change_mtu;
-			ops.config_network_if = kni_config_network_interface;
-			ops.config_mac_address = kni_config_mac_address;
-
-			kni = rte_kni_alloc(pktmbuf_pool, &conf, &ops);
-		} else
-			kni = rte_kni_alloc(pktmbuf_pool, &conf, NULL);
-
-		if (!kni)
-			rte_exit(EXIT_FAILURE, "Fail to create kni for "
-						"port: %d\n", port_id);
-		params[port_id]->kni[i] = kni;
-	}
-
-	return 0;
-}
-
-static int
-kni_free_kni(uint16_t port_id)
-{
-	uint8_t i;
-	int ret;
-	struct kni_port_params **p = kni_port_params_array;
-
-	if (port_id >= RTE_MAX_ETHPORTS || !p[port_id])
-		return -1;
-
-	for (i = 0; i < p[port_id]->nb_kni; i++) {
-		if (rte_kni_release(p[port_id]->kni[i]))
-			printf("Fail to release kni\n");
-		p[port_id]->kni[i] = NULL;
-	}
-	ret = rte_eth_dev_stop(port_id);
-	if (ret != 0)
-		RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
-			port_id, rte_strerror(-ret));
-	rte_eth_dev_close(port_id);
-
-	return 0;
-}
-
-/* Initialise ports/queues etc. and start main loop on each core */
-int
-main(int argc, char** argv)
-{
-	int ret;
-	uint16_t nb_sys_ports, port;
-	unsigned i;
-	void *retval;
-	pthread_t kni_link_tid;
-	int pid;
-
-	/* Associate signal_handler function with USR signals */
-	signal(SIGUSR1, signal_handler);
-	signal(SIGUSR2, signal_handler);
-	signal(SIGRTMIN, signal_handler);
-	signal(SIGINT, signal_handler);
-	signal(SIGTERM, signal_handler);
-
-	/* Initialise EAL */
-	ret = rte_eal_init(argc, argv);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not initialise EAL (%d)\n", ret);
-	argc -= ret;
-	argv += ret;
-
-	/* Parse application arguments (after the EAL ones) */
-	ret = parse_args(argc, argv);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE, "Could not parse input parameters\n");
-
-	/* Create the mbuf pool */
-	pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF,
-		MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, rte_socket_id());
-	if (pktmbuf_pool == NULL) {
-		rte_exit(EXIT_FAILURE, "Could not initialise mbuf pool\n");
-		return -1;
-	}
-
-	/* Get number of ports found in scan */
-	nb_sys_ports = rte_eth_dev_count_avail();
-	if (nb_sys_ports == 0)
-		rte_exit(EXIT_FAILURE, "No supported Ethernet device found\n");
-
-	/* Check if the configured port ID is valid */
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
-		if (kni_port_params_array[i] && !rte_eth_dev_is_valid_port(i))
-			rte_exit(EXIT_FAILURE, "Configured invalid "
-						"port ID %u\n", i);
-
-	/* Initialize KNI subsystem */
-	init_kni();
-
-	/* Initialise each port */
-	RTE_ETH_FOREACH_DEV(port) {
-		/* Skip ports that are not enabled */
-		if (!(ports_mask & (1 << port)))
-			continue;
-		init_port(port);
-
-		if (port >= RTE_MAX_ETHPORTS)
-			rte_exit(EXIT_FAILURE, "Can not use more than "
-				"%d ports for kni\n", RTE_MAX_ETHPORTS);
-
-		kni_alloc(port);
-	}
-	check_all_ports_link_status(ports_mask);
-
-	pid = getpid();
-	RTE_LOG(INFO, APP, "========================\n");
-	RTE_LOG(INFO, APP, "KNI Running\n");
-	RTE_LOG(INFO, APP, "kill -SIGUSR1 %d\n", pid);
-	RTE_LOG(INFO, APP, "    Show KNI Statistics.\n");
-	RTE_LOG(INFO, APP, "kill -SIGUSR2 %d\n", pid);
-	RTE_LOG(INFO, APP, "    Zero KNI Statistics.\n");
-	RTE_LOG(INFO, APP, "========================\n");
-	fflush(stdout);
-
-	ret = rte_ctrl_thread_create(&kni_link_tid,
-				     "KNI link status check", NULL,
-				     monitor_all_ports_link_status, NULL);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE,
-			"Could not create link status thread!\n");
-
-	/* Launch per-lcore function on every lcore */
-	rte_eal_mp_remote_launch(main_loop, NULL, CALL_MAIN);
-	RTE_LCORE_FOREACH_WORKER(i) {
-		if (rte_eal_wait_lcore(i) < 0)
-			return -1;
-	}
-	monitor_links = 0;
-	pthread_join(kni_link_tid, &retval);
-
-	/* Release resources */
-	RTE_ETH_FOREACH_DEV(port) {
-		if (!(ports_mask & (1 << port)))
-			continue;
-		kni_free_kni(port);
-	}
-	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
-		if (kni_port_params_array[i]) {
-			rte_free(kni_port_params_array[i]);
-			kni_port_params_array[i] = NULL;
-		}
-
-	/* clean up the EAL */
-	rte_eal_cleanup();
-
-	return 0;
-}
diff --git a/examples/kni/meson.build b/examples/kni/meson.build
deleted file mode 100644
index 6bd4eb50e6..0000000000
--- a/examples/kni/meson.build
+++ /dev/null
@@ -1,13 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
-
-# meson file, for building this example as part of a main DPDK build.
-#
-# To build this example as a standalone application with an already-installed
-# DPDK instance, use 'make'
-
-deps += ['kni', 'bus_pci']
-sources = files(
-        'main.c',
-)
-allow_experimental_apis = true
diff --git a/examples/meson.build b/examples/meson.build
index 81e93799f2..6968c09252 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,7 +24,6 @@ all_examples = [
         'ip_reassembly',
         'ipsec-secgw',
         'ipv4_multicast',
-        'kni',
         'l2fwd',
         'l2fwd-cat',
         'l2fwd-crypto',
-- 
2.34.1


^ permalink raw reply	[relevance 1%]

* Re: [PATCH 1/8] memarea: introduce memory area library
  2022-09-20 11:30  4%     ` Dmitry Kozlyuk
@ 2022-09-20 12:06  3%       ` fengchengwen
  0 siblings, 0 replies; 200+ results
From: fengchengwen @ 2022-09-20 12:06 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: thomas, dev, stephen, jerinjacobk

Hi Dmitry,

On 2022/9/20 19:30, Dmitry Kozlyuk wrote:
> 2022-09-20 03:46 (UTC+0000), Chengwen Feng:
>> The memarea library is an allocator of variable-size object. It is a
>> collection of allocated objects that can be efficiently alloc or free
>> all at once, the main features are as follows:
>> a) it facilitate alloc and free of memory with low overhead.
> Yet, the overhead is 64B per element, just like rte_malloc.
>
>> b) it provides refcnt feature which could be useful in some scenes.
> Are you sure refcnt should be in this library?
> I've expressed my concerns here:
>
> https://inbox.dpdk.org/dev/CAEYuUWBpC-9dCqKJ0LZi6RkCUwyeYEghLRBMBUBtUx4Ljg+pAQ@mail.gmail.com
>
> There are more unanswered questions in that mail,
> it would be good to clarify them before reviewing these patches
> in order to understand all the intentions.

Sorry to forgot reply it.

We have the following scene which used refcnt:

     nic-rx  ->  decoder ->  process

                                    |

                                   ->  recording

as above show, the process and recording module both use the decoder's 
output, the are just reader.

so in this case, the refcnt is useful.

>
>> +static int
>> +memarea_check_param(const struct rte_memarea_param *init)
>> +{
>> +	size_t len;
>> +
>> +	len = strnlen(init->name, RTE_MEMAREA_NAMESIZE);
>> +	if (len == 0 || len >= RTE_MEMAREA_NAMESIZE) {
>> +		RTE_LOG(ERR, MEMAREA, "memarea name invalid!\n");
>> +		return -EINVAL;
>> +	}
> Please check init->name == NULL first.

No need checking because name is an array.

Maybe I should check init == NULL here.

>
>> +struct rte_memarea *
>> +rte_memarea_create(const struct rte_memarea_param *init)
>> +{
> [...]
>> +		RTE_LOG(ERR, MEMAREA, "malloc memarea management obj fail!\n");
> In all error messages, it would be useful to provide details:
> the name of the area, what size was requested, etc.

will fix in v2.

>
>> +/**
>> + * Memarea memory source.
>> + */
>> +enum rte_memarea_source {
>> +	/** Memory source comes from system API (e.g. malloc). */
>> +	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,
>> +
>> +	RTE_MEMAREA_SOURCE_BUTT
> DPDK enumerations must not include an item to hold the element count,
> because it is harmful for ABI (e.g. developers create arrays of this size
> and when a new item is added in a new DPDK version, the array overflows).
>
> If it's supposed to mean "the end of item list",
> the proper word would be "last" or "max" BTW :)
will fix in v2
>
>> +};
>> +
>> +struct rte_memarea {
>> +	void *private_data; /**< private management data pointer. */
>> +};
> Jerin and Stephen suggested to make the structure opaque,
> i.e. only declare the struct and define it privately.
> It would reduce ABI and simplify allocation.
> Any justification to expose it?

do you mean the rte_memarea just void * ? it just (void 
*)(memarea_private *)priv ?

It's another popular type to impl ABI compatiable.

It's more simpler, will fix in v2


^ permalink raw reply	[relevance 3%]

* Re: [PATCH 1/8] memarea: introduce memory area library
  @ 2022-09-20 11:30  4%     ` Dmitry Kozlyuk
  2022-09-20 12:06  3%       ` fengchengwen
  0 siblings, 1 reply; 200+ results
From: Dmitry Kozlyuk @ 2022-09-20 11:30 UTC (permalink / raw)
  To: Chengwen Feng; +Cc: thomas, dev, stephen, jerinjacobk

2022-09-20 03:46 (UTC+0000), Chengwen Feng:
> The memarea library is an allocator of variable-size object. It is a
> collection of allocated objects that can be efficiently alloc or free
> all at once, the main features are as follows:
> a) it facilitate alloc and free of memory with low overhead.

Yet, the overhead is 64B per element, just like rte_malloc.

> b) it provides refcnt feature which could be useful in some scenes.

Are you sure refcnt should be in this library?
I've expressed my concerns here:

https://inbox.dpdk.org/dev/CAEYuUWBpC-9dCqKJ0LZi6RkCUwyeYEghLRBMBUBtUx4Ljg+pAQ@mail.gmail.com

There are more unanswered questions in that mail,
it would be good to clarify them before reviewing these patches
in order to understand all the intentions.

> +static int
> +memarea_check_param(const struct rte_memarea_param *init)
> +{
> +	size_t len;
> +
> +	len = strnlen(init->name, RTE_MEMAREA_NAMESIZE);
> +	if (len == 0 || len >= RTE_MEMAREA_NAMESIZE) {
> +		RTE_LOG(ERR, MEMAREA, "memarea name invalid!\n");
> +		return -EINVAL;
> +	}

Please check init->name == NULL first.

> +struct rte_memarea *
> +rte_memarea_create(const struct rte_memarea_param *init)
> +{
[...]
> +		RTE_LOG(ERR, MEMAREA, "malloc memarea management obj fail!\n");

In all error messages, it would be useful to provide details:
the name of the area, what size was requested, etc.

> +/**
> + * Memarea memory source.
> + */
> +enum rte_memarea_source {
> +	/** Memory source comes from system API (e.g. malloc). */
> +	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,
> +
> +	RTE_MEMAREA_SOURCE_BUTT

DPDK enumerations must not include an item to hold the element count,
because it is harmful for ABI (e.g. developers create arrays of this size
and when a new item is added in a new DPDK version, the array overflows).

If it's supposed to mean "the end of item list",
the proper word would be "last" or "max" BTW :)

> +};
> +
> +struct rte_memarea {
> +	void *private_data; /**< private management data pointer. */
> +};

Jerin and Stephen suggested to make the structure opaque,
i.e. only declare the struct and define it privately.
It would reduce ABI and simplify allocation.
Any justification to expose it?

^ permalink raw reply	[relevance 4%]

* [PATCH v4] usertools: rewrite pmdinfo
  2022-09-13 10:58  1% [PATCH] usertools: rewrite pmdinfo Robin Jarry
  2022-09-13 19:42  1% ` [PATCH v2] " Robin Jarry
  2022-09-20  9:08  1% ` [PATCH v3] " Robin Jarry
@ 2022-09-20 10:42  1% ` Robin Jarry
    2 siblings, 1 reply; 200+ results
From: Robin Jarry @ 2022-09-20 10:42 UTC (permalink / raw)
  To: dev; +Cc: Robin Jarry, Olivier Matz, Ferruh Yigit, Bruce Richardson

dpdk-pmdinfo.py does not produce any parseable output. The -r/--raw flag
merely prints multiple independent JSON lines which cannot be fed
directly to any JSON parser. Moreover, the script complexity is rather
high for such a simple task: extracting PMD_INFO_STRING from .rodata ELF
sections. Rewrite it so that it can produce valid JSON.

Remove the PCI database parsing for PCI-ID to Vendor-Device names
conversion. This should be done by external scripts (if really needed).

Here are some examples of use with jq:

Get the complete info for a given driver:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.name == "dmadev_idxd_pci")'
 {
   "name": "dmadev_idxd_pci",
   "params": "max_queues=0",
   "kmod": "vfio-pci",
   "pci_ids": [
     {
       "vendor": "8086",
       "device": "0b25"
     }
   ]
 }

Get only the required kernel modules for a given driver:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.name == "net_i40e").kmod'
 "* igb_uio | uio_pci_generic | vfio-pci"

Get only the required kernel modules for a given device:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.pci_ids[] | .vendor == "15b3" and .device == "1013").kmod'
 "* ib_uverbs & mlx5_core & mlx5_ib"

Print the list of drivers which define multiple parameters without
space separators:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.params!=null and (.params|test("=[^ ]+="))) | {name, params}'
 ...

The script passes flake8, black, isort and pylint checks.

I have tested this with a matrix of python/pyelftools versions:

                             pyelftools
               0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29
         3.6     ok   ok   ok   ok   ok   ok   ok   ok
         3.7     ok   ok   ok   ok   ok   ok   ok   ok
  Python 3.8     ok   ok   ok   ok   ok   ok   ok   ok
         3.9     ok   ok   ok   ok   ok   ok   ok   ok
         3.10  fail fail fail fail   ok   ok   ok   ok

All failures with python 3.10 are related to the same issue:

  File "elftools/construct/lib/container.py", line 5, in <module>
    from collections import MutableMapping
  ImportError: cannot import name 'MutableMapping' from 'collections'

Python 3.10 support is only available since pyelftools 0.26. The script
will only work with Python 3.6 and later. Update the minimal system
requirements and release notes.

NB: The output produced by the legacy -r/--raw flag can be obtained with
the following command:

  strings build/app/dpdk-testpmd | sed -n 's/^PMD_INFO_STRING= //p'

Cc: Olivier Matz <olivier.matz@6wind.com>
Cc: Ferruh Yigit <ferruh.yigit@xilinx.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
v3 -> v4:

* also strip pci_id fields when they have the wildcard 0xFFFF value.

v2 -> v3:

* strip "pci_ids" when it is empty (some drivers do not support any
  pci devices)

v1 -> v2:

* update release notes and minimal python version requirement
* hide warnings by default (-v/--verbose to show them)
* show debug messages with -vv
* also search libs in folders listed in /etc/ld.so.conf/*.conf
* only search for DT_NEEDED on executables, not on dynamic libraries
* take DT_RUNPATH into account for searching libraries
* fix weird broken pipe error
* fix some typos:
    s/begining/beginning/
    s/subsystem_device/subsystem_vendor/
    s/subsystem_system/subsystem_device/
* change field names for pci_ids elements (remove _id suffixes)
* DT_NEEDED of files are analyzed. There is no way to differentiate
  between dynamically linked executables and dynamic libraries.

 doc/guides/linux_gsg/sys_reqs.rst      |   2 +-
 doc/guides/rel_notes/release_22_11.rst |   5 +
 usertools/dpdk-pmdinfo.py              | 924 +++++++++----------------
 3 files changed, 324 insertions(+), 607 deletions(-)

diff --git a/doc/guides/linux_gsg/sys_reqs.rst b/doc/guides/linux_gsg/sys_reqs.rst
index 08d45898f025..f842105eeda7 100644
--- a/doc/guides/linux_gsg/sys_reqs.rst
+++ b/doc/guides/linux_gsg/sys_reqs.rst
@@ -41,7 +41,7 @@ Compilation of the DPDK
    resulting in statically linked applications not being linked properly.
    Use an updated version of ``pkg-config`` or ``pkgconf`` instead when building applications
 
-*   Python 3.5 or later.
+*   Python 3.6 or later.
 
 *   Meson (version 0.49.2+) and ninja
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf0505e..67054f5acdc9 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* The ``dpdk-pmdinfo.py`` script was rewritten to produce valid JSON only.
+  PCI-IDs parsing has been removed.
+  To get a similar output to the (now removed) ``-r/--raw`` flag, you may use the following command::
+
+     strings $dpdk_binary_or_driver | sed -n 's/^PMD_INFO_STRING= //p'
 
 ABI Changes
 -----------
diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py
index 40ef5cec6cba..a68921296609 100755
--- a/usertools/dpdk-pmdinfo.py
+++ b/usertools/dpdk-pmdinfo.py
@@ -1,626 +1,338 @@
 #!/usr/bin/env python3
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2016  Neil Horman <nhorman@tuxdriver.com>
+# Copyright(c) 2022  Robin Jarry
+# pylint: disable=invalid-name
+
+r"""
+Utility to dump PMD_INFO_STRING support from DPDK binaries.
+
+This script prints JSON output to be interpreted by other tools. Here are some
+examples with jq:
+
+Get the complete info for a given driver:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.name == "cnxk_nix_inl")'
+
+Get only the required kernel modules for a given driver:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.name == "net_i40e").kmod'
+
+Get only the required kernel modules for a given device:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.devices[] | .vendor_id == "15b3" and .device_id == "1013").kmod'
+"""
 
-# -------------------------------------------------------------------------
-#
-# Utility to dump PMD_INFO_STRING support from an object file
-#
-# -------------------------------------------------------------------------
-import json
-import os
-import platform
-import sys
 import argparse
-from elftools.common.exceptions import ELFError
-from elftools.common.py3compat import byte2int
-from elftools.elf.elffile import ELFFile
-
-
-# For running from development directory. It should take precedence over the
-# installed pyelftools.
-sys.path.insert(0, '.')
-
-raw_output = False
-pcidb = None
-
-# ===========================================
-
-class Vendor:
-    """
-    Class for vendors. This is the top level class
-    for the devices belong to a specific vendor.
-    self.devices is the device dictionary
-    subdevices are in each device.
-    """
-
-    def __init__(self, vendorStr):
-        """
-        Class initializes with the raw line from pci.ids
-        Parsing takes place inside __init__
-        """
-        self.ID = vendorStr.split()[0]
-        self.name = vendorStr.replace("%s " % self.ID, "").rstrip()
-        self.devices = {}
-
-    def addDevice(self, deviceStr):
-        """
-        Adds a device to self.devices
-        takes the raw line from pci.ids
-        """
-        s = deviceStr.strip()
-        devID = s.split()[0]
-        if devID in self.devices:
-            pass
-        else:
-            self.devices[devID] = Device(deviceStr)
-
-    def report(self):
-        print(self.ID, self.name)
-        for id, dev in self.devices.items():
-            dev.report()
-
-    def find_device(self, devid):
-        # convert to a hex string and remove 0x
-        devid = hex(devid)[2:]
-        try:
-            return self.devices[devid]
-        except:
-            return Device("%s  Unknown Device" % devid)
-
-
-class Device:
-
-    def __init__(self, deviceStr):
-        """
-        Class for each device.
-        Each vendor has its own devices dictionary.
-        """
-        s = deviceStr.strip()
-        self.ID = s.split()[0]
-        self.name = s.replace("%s  " % self.ID, "")
-        self.subdevices = {}
-
-    def report(self):
-        print("\t%s\t%s" % (self.ID, self.name))
-        for subID, subdev in self.subdevices.items():
-            subdev.report()
-
-    def addSubDevice(self, subDeviceStr):
-        """
-        Adds a subvendor, subdevice to device.
-        Uses raw line from pci.ids
-        """
-        s = subDeviceStr.strip()
-        spl = s.split()
-        subVendorID = spl[0]
-        subDeviceID = spl[1]
-        subDeviceName = s.split("  ")[-1]
-        devID = "%s:%s" % (subVendorID, subDeviceID)
-        self.subdevices[devID] = SubDevice(
-            subVendorID, subDeviceID, subDeviceName)
-
-    def find_subid(self, subven, subdev):
-        subven = hex(subven)[2:]
-        subdev = hex(subdev)[2:]
-        devid = "%s:%s" % (subven, subdev)
-
-        try:
-            return self.subdevices[devid]
-        except:
-            if (subven == "ffff" and subdev == "ffff"):
-                return SubDevice("ffff", "ffff", "(All Subdevices)")
-            return SubDevice(subven, subdev, "(Unknown Subdevice)")
-
-
-class SubDevice:
-    """
-    Class for subdevices.
-    """
-
-    def __init__(self, vendor, device, name):
-        """
-        Class initializes with vendorid, deviceid and name
-        """
-        self.vendorID = vendor
-        self.deviceID = device
-        self.name = name
-
-    def report(self):
-        print("\t\t%s\t%s\t%s" % (self.vendorID, self.deviceID, self.name))
-
-
-class PCIIds:
-    """
-    Top class for all pci.ids entries.
-    All queries will be asked to this class.
-    PCIIds.vendors["0e11"].devices["0046"].\
-    subdevices["0e11:4091"].name  =  "Smart Array 6i"
-    """
-
-    def __init__(self, filename):
-        """
-        Prepares the directories.
-        Checks local data file.
-        Tries to load from local, if not found, downloads from web
-        """
-        self.version = ""
-        self.date = ""
-        self.vendors = {}
-        self.contents = None
-        self.readLocal(filename)
-        self.parse()
-
-    def reportVendors(self):
-        """Reports the vendors
-        """
-        for vid, v in self.vendors.items():
-            print(v.ID, v.name)
-
-    def report(self, vendor=None):
-        """
-        Reports everything for all vendors or a specific vendor
-        PCIIds.report()  reports everything
-        PCIIDs.report("0e11") reports only "Compaq Computer Corporation"
-        """
-        if vendor is not None:
-            self.vendors[vendor].report()
-        else:
-            for vID, v in self.vendors.items():
-                v.report()
-
-    def find_vendor(self, vid):
-        # convert vid to a hex string and remove the 0x
-        vid = hex(vid)[2:]
-
-        try:
-            return self.vendors[vid]
-        except:
-            return Vendor("%s Unknown Vendor" % (vid))
-
-    def findDate(self, content):
-        for l in content:
-            if l.find("Date:") > -1:
-                return l.split()[-2].replace("-", "")
-        return None
-
-    def parse(self):
-        if not self.contents:
-            print("data/%s-pci.ids not found" % self.date)
-        else:
-            vendorID = ""
-            deviceID = ""
-            for l in self.contents:
-                if l[0] == "#":
-                    continue
-                elif not l.strip():
-                    continue
-                else:
-                    if l.find("\t\t") == 0:
-                        self.vendors[vendorID].devices[
-                            deviceID].addSubDevice(l)
-                    elif l.find("\t") == 0:
-                        deviceID = l.strip().split()[0]
-                        self.vendors[vendorID].addDevice(l)
-                    else:
-                        vendorID = l.split()[0]
-                        self.vendors[vendorID] = Vendor(l)
-
-    def readLocal(self, filename):
-        """
-        Reads the local file
-        """
-        with open(filename, 'r', encoding='utf-8') as f:
-            self.contents = f.readlines()
-        self.date = self.findDate(self.contents)
-
-    def loadLocal(self):
-        """
-        Loads database from local. If there is no file,
-        it creates a new one from web
-        """
-        self.date = idsfile[0].split("/")[1].split("-")[0]
-        self.readLocal()
-
-
-# =======================================
-
-def search_file(filename, search_path):
-    """ Given a search path, find file with requested name """
-    for path in search_path.split(':'):
-        candidate = os.path.join(path, filename)
-        if os.path.exists(candidate):
-            return os.path.abspath(candidate)
-    return None
-
-
-class ReadElf(object):
-    """ display_* methods are used to emit output into the output stream
-    """
-
-    def __init__(self, file, output):
-        """ file:
-                stream object with the ELF file to read
-
-            output:
-                output stream to write to
-        """
-        self.elffile = ELFFile(file)
-        self.output = output
-
-        # Lazily initialized if a debug dump is requested
-        self._dwarfinfo = None
-
-        self._versioninfo = None
-
-    def _section_from_spec(self, spec):
-        """ Retrieve a section given a "spec" (either number or name).
-            Return None if no such section exists in the file.
-        """
-        try:
-            num = int(spec)
-            if num < self.elffile.num_sections():
-                return self.elffile.get_section(num)
-            return None
-        except ValueError:
-            # Not a number. Must be a name then
-            section = self.elffile.get_section_by_name(force_unicode(spec))
-            if section is None:
-                # No match with a unicode name.
-                # Some versions of pyelftools (<= 0.23) store internal strings
-                # as bytes. Try again with the name encoded as bytes.
-                section = self.elffile.get_section_by_name(force_bytes(spec))
-            return section
-
-    def pretty_print_pmdinfo(self, pmdinfo):
-        global pcidb
-
-        for i in pmdinfo["pci_ids"]:
-            vendor = pcidb.find_vendor(i[0])
-            device = vendor.find_device(i[1])
-            subdev = device.find_subid(i[2], i[3])
-            print("%s (%s) : %s (%s) %s" %
-                  (vendor.name, vendor.ID, device.name,
-                   device.ID, subdev.name))
-
-    def parse_pmd_info_string(self, mystring):
-        global raw_output
-        global pcidb
-
-        optional_pmd_info = [
-            {'id': 'params', 'tag': 'PMD PARAMETERS'},
-            {'id': 'kmod', 'tag': 'PMD KMOD DEPENDENCIES'}
-        ]
-
-        i = mystring.index("=")
-        mystring = mystring[i + 2:]
-        pmdinfo = json.loads(mystring)
-
-        if raw_output:
-            print(json.dumps(pmdinfo))
-            return
-
-        print("PMD NAME: " + pmdinfo["name"])
-        for i in optional_pmd_info:
-            try:
-                print("%s: %s" % (i['tag'], pmdinfo[i['id']]))
-            except KeyError:
-                continue
-
-        if pmdinfo["pci_ids"]:
-            print("PMD HW SUPPORT:")
-            if pcidb is not None:
-                self.pretty_print_pmdinfo(pmdinfo)
-            else:
-                print("VENDOR\t DEVICE\t SUBVENDOR\t SUBDEVICE")
-                for i in pmdinfo["pci_ids"]:
-                    print("0x%04x\t 0x%04x\t 0x%04x\t\t 0x%04x" %
-                          (i[0], i[1], i[2], i[3]))
-
-        print("")
-
-    def display_pmd_info_strings(self, section_spec):
-        """ Display a strings dump of a section. section_spec is either a
-            section number or a name.
-        """
-        section = self._section_from_spec(section_spec)
-        if section is None:
-            return
-
-        data = section.data()
-        dataptr = 0
-
-        while dataptr < len(data):
-            while (dataptr < len(data) and
-                   not 32 <= byte2int(data[dataptr]) <= 127):
-                dataptr += 1
-
-            if dataptr >= len(data):
-                break
-
-            endptr = dataptr
-            while endptr < len(data) and byte2int(data[endptr]) != 0:
-                endptr += 1
-
-            # pyelftools may return byte-strings, force decode them
-            mystring = force_unicode(data[dataptr:endptr])
-            rc = mystring.find("PMD_INFO_STRING")
-            if rc != -1:
-                self.parse_pmd_info_string(mystring[rc:])
-
-            dataptr = endptr
-
-    def find_librte_eal(self, section):
-        for tag in section.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_NEEDED':
-                if "librte_eal" in force_unicode(tag.needed):
-                    return force_unicode(tag.needed)
-        return None
-
-    def search_for_autoload_path(self):
-        scanelf = self
-        scanfile = None
-        library = None
-
-        section = self._section_from_spec(".dynamic")
-        try:
-            eallib = self.find_librte_eal(section)
-            if eallib is not None:
-                ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-                if ldlibpath is None:
-                    ldlibpath = ""
-                dtr = self.get_dt_runpath(section)
-                library = search_file(eallib,
-                                      dtr + ":" + ldlibpath +
-                                      ":/usr/lib64:/lib64:/usr/lib:/lib")
-                if library is None:
-                    return (None, None)
-                if not raw_output:
-                    print("Scanning for autoload path in %s" % library)
-                scanfile = open(library, 'rb')
-                scanelf = ReadElf(scanfile, sys.stdout)
-        except AttributeError:
-            # Not a dynamic binary
-            pass
-        except ELFError:
-            scanfile.close()
-            return (None, None)
-
-        section = scanelf._section_from_spec(".rodata")
-        if section is None:
-            if scanfile is not None:
-                scanfile.close()
-            return (None, None)
-
-        data = section.data()
-        dataptr = 0
-
-        while dataptr < len(data):
-            while (dataptr < len(data) and
-                   not 32 <= byte2int(data[dataptr]) <= 127):
-                dataptr += 1
-
-            if dataptr >= len(data):
-                break
-
-            endptr = dataptr
-            while endptr < len(data) and byte2int(data[endptr]) != 0:
-                endptr += 1
-
-            # pyelftools may return byte-strings, force decode them
-            mystring = force_unicode(data[dataptr:endptr])
-            rc = mystring.find("DPDK_PLUGIN_PATH")
-            if rc != -1:
-                rc = mystring.find("=")
-                return (mystring[rc + 1:], library)
-
-            dataptr = endptr
-        if scanfile is not None:
-            scanfile.close()
-        return (None, None)
-
-    def get_dt_runpath(self, dynsec):
-        for tag in dynsec.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_RUNPATH':
-                return force_unicode(tag.runpath)
-        return ""
-
-    def process_dt_needed_entries(self):
-        """ Look to see if there are any DT_NEEDED entries in the binary
-            And process those if there are
-        """
-        runpath = ""
-        ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-        if ldlibpath is None:
-            ldlibpath = ""
-
-        dynsec = self._section_from_spec(".dynamic")
-        try:
-            runpath = self.get_dt_runpath(dynsec)
-        except AttributeError:
-            # dynsec is None, just return
-            return
-
-        for tag in dynsec.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_NEEDED':
-                if 'librte_' in force_unicode(tag.needed):
-                    library = search_file(force_unicode(tag.needed),
-                                          runpath + ":" + ldlibpath +
-                                          ":/usr/lib64:/lib64:/usr/lib:/lib")
-                    if library is not None:
-                        with open(library, 'rb') as file:
-                            try:
-                                libelf = ReadElf(file, sys.stdout)
-                            except ELFError:
-                                print("%s is no an ELF file" % library)
-                                continue
-                            libelf.process_dt_needed_entries()
-                            libelf.display_pmd_info_strings(".rodata")
-                            file.close()
-
-
-# compat: remove force_unicode & force_bytes when pyelftools<=0.23 support is
-# dropped.
-def force_unicode(s):
-    if hasattr(s, 'decode') and callable(s.decode):
-        s = s.decode('latin-1')  # same encoding used in pyelftools py3compat
-    return s
-
-
-def force_bytes(s):
-    if hasattr(s, 'encode') and callable(s.encode):
-        s = s.encode('latin-1')  # same encoding used in pyelftools py3compat
-    return s
-
-
-def scan_autoload_path(autoload_path):
-    global raw_output
-
-    if not os.path.exists(autoload_path):
-        return
-
+import glob
+import json
+import logging
+import os
+import re
+import string
+import sys
+from pathlib import Path
+from typing import Iterable, Iterator, List, Union
+
+import elftools
+from elftools.elf.elffile import ELFError, ELFFile
+
+
+# ----------------------------------------------------------------------------
+def main() -> int:  # pylint: disable=missing-docstring
     try:
-        dirs = os.listdir(autoload_path)
-    except OSError:
-        # Couldn't read the directory, give up
-        return
-
-    for d in dirs:
-        dpath = os.path.join(autoload_path, d)
-        if os.path.isdir(dpath):
-            scan_autoload_path(dpath)
-        if os.path.isfile(dpath):
-            try:
-                file = open(dpath, 'rb')
-                readelf = ReadElf(file, sys.stdout)
-            except ELFError:
-                # this is likely not an elf file, skip it
-                continue
-            except IOError:
-                # No permission to read the file, skip it
-                continue
-
-            if not raw_output:
-                print("Hw Support for library %s" % d)
-            readelf.display_pmd_info_strings(".rodata")
-            file.close()
+        args = parse_args()
+        logging.basicConfig(
+            stream=sys.stderr,
+            format="%(levelname)s: %(message)s",
+            level={
+                0: logging.ERROR,
+                1: logging.WARNING,
+            }.get(args.verbose, logging.DEBUG),
+        )
+        info = parse_pmdinfo(args.elf_files, args.search_plugins)
+        print(json.dumps(info, indent=2))
+    except BrokenPipeError:
+        pass
+    except KeyboardInterrupt:
+        return 1
+    except Exception as e:  # pylint: disable=broad-except
+        logging.error("%s", e)
+        return 1
+    return 0
 
 
-def scan_for_autoload_pmds(dpdk_path):
+# ----------------------------------------------------------------------------
+def parse_args() -> argparse.Namespace:
     """
-    search the specified application or path for a pmd autoload path
-    then scan said path for pmds and report hw support
+    Parse command line arguments.
     """
-    global raw_output
-
-    if not os.path.isfile(dpdk_path):
-        if not raw_output:
-            print("Must specify a file name")
-        return
-
-    file = open(dpdk_path, 'rb')
-    try:
-        readelf = ReadElf(file, sys.stdout)
-    except ElfError:
-        if not raw_output:
-            print("Unable to parse %s" % file)
-        return
-
-    (autoload_path, scannedfile) = readelf.search_for_autoload_path()
-    if not autoload_path:
-        if not raw_output:
-            print("No autoload path configured in %s" % dpdk_path)
-        return
-    if not raw_output:
-        if scannedfile is None:
-            scannedfile = dpdk_path
-        print("Found autoload path %s in %s" % (autoload_path, scannedfile))
-
-    file.close()
-    if not raw_output:
-        print("Discovered Autoload HW Support:")
-    scan_autoload_path(autoload_path)
-    return
-
-
-def main(stream=None):
-    global raw_output
-    global pcidb
-
-    pcifile_default = "./pci.ids"  # For unknown OS's assume local file
-    if platform.system() == 'Linux':
-        # hwdata is the legacy location, misc is supported going forward
-        pcifile_default = "/usr/share/misc/pci.ids"
-        if not os.path.exists(pcifile_default):
-            pcifile_default = "/usr/share/hwdata/pci.ids"
-    elif platform.system() == 'FreeBSD':
-        pcifile_default = "/usr/local/share/pciids/pci.ids"
-        if not os.path.exists(pcifile_default):
-            pcifile_default = "/usr/share/misc/pci_vendors"
-
     parser = argparse.ArgumentParser(
-        usage='usage: %(prog)s [-hrtp] [-d <pci id file>] elf_file',
-        description="Dump pmd hardware support info")
-    group = parser.add_mutually_exclusive_group()
-    group.add_argument('-r', '--raw',
-                       action='store_true', dest='raw_output',
-                       help='dump raw json strings')
-    group.add_argument("-t", "--table", dest="tblout",
-                       help="output information on hw support as a hex table",
-                       action='store_true')
-    parser.add_argument("-d", "--pcidb", dest="pcifile",
-                        help="specify a pci database to get vendor names from",
-                        default=pcifile_default, metavar="FILE")
-    parser.add_argument("-p", "--plugindir", dest="pdir",
-                        help="scan dpdk for autoload plugins",
-                        action='store_true')
-    parser.add_argument("elf_file", help="driver shared object file")
-    args = parser.parse_args()
+        description=__doc__,
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+    )
+    parser.add_argument(
+        "-p",
+        "--search-plugins",
+        action="store_true",
+        help="""
+        In addition of ELF_FILEs and their linked dynamic libraries, also scan
+        the DPDK plugins path.
+        """,
+    )
+    parser.add_argument(
+        "-v",
+        "--verbose",
+        action="count",
+        default=0,
+        help="""
+        Display warnings due to linked libraries not found or ELF/JSON parsing
+        errors in these libraries. Use twice to show debug messages.
+        """,
+    )
+    parser.add_argument(
+        "elf_files",
+        metavar="ELF_FILE",
+        nargs="+",
+        type=existing_file,
+        help="""
+        DPDK application binary or dynamic library.
+        """,
+    )
+    return parser.parse_args()
 
-    if args.raw_output:
-        raw_output = True
 
-    if args.tblout:
-        args.pcifile = None
+# ----------------------------------------------------------------------------
+def parse_pmdinfo(paths: Iterable[Path], search_plugins: bool) -> List[dict]:
+    """
+    Extract DPDK PMD info JSON strings from an ELF file.
 
-    if args.pcifile:
-        pcidb = PCIIds(args.pcifile)
-        if pcidb is None:
-            print("Pci DB file not found")
-            exit(1)
+    :returns:
+        A list of DPDK drivers info dictionaries.
+    """
+    binaries = set(paths)
+    for p in paths:
+        binaries.update(get_needed_libs(p))
+    if search_plugins:
+        # cast to list to avoid errors with update while iterating
+        binaries.update(list(get_plugin_libs(binaries)))
 
-    if args.pdir:
-        exit(scan_for_autoload_pmds(args.elf_file))
+    drivers = []
 
-    ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-    if ldlibpath is None:
-        ldlibpath = ""
-
-    if os.path.exists(args.elf_file):
-        myelffile = args.elf_file
-    else:
-        myelffile = search_file(args.elf_file,
-                                ldlibpath + ":/usr/lib64:/lib64:/usr/lib:/lib")
-
-    if myelffile is None:
-        print("File not found")
-        sys.exit(1)
-
-    with open(myelffile, 'rb') as file:
+    for b in binaries:
+        logging.debug("analyzing %s", b)
         try:
-            readelf = ReadElf(file, sys.stdout)
-            readelf.process_dt_needed_entries()
-            readelf.display_pmd_info_strings(".rodata")
-            sys.exit(0)
+            for s in get_elf_strings(b, ".rodata", "PMD_INFO_STRING="):
+                try:
+                    info = json.loads(s)
+                    scrub_pci_ids(info)
+                    drivers.append(info)
+                except ValueError as e:
+                    # invalid JSON, should never happen
+                    logging.warning("%s: %s", b, e)
+        except ELFError as e:
+            # only happens for discovered plugins that are not ELF
+            logging.debug("%s: cannot parse ELF: %s", b, e)
 
-        except ELFError as ex:
-            sys.stderr.write('ELF error: %s\n' % ex)
-            sys.exit(1)
+    return drivers
 
 
-# -------------------------------------------------------------------------
-if __name__ == '__main__':
-    main()
+# ----------------------------------------------------------------------------
+PCI_FIELDS = ("vendor", "device", "subsystem_vendor", "subsystem_device")
+
+
+def scrub_pci_ids(info: dict):
+    """
+    Convert numerical ids to hex strings.
+    Strip empty pci_ids lists.
+    Strip wildcard 0xFFFF ids.
+    """
+    pci_ids = []
+    for pci_fields in info.pop("pci_ids"):
+        pci = {}
+        for name, value in zip(PCI_FIELDS, pci_fields):
+            if value != 0xFFFF:
+                pci[name] = f"{value:04x}"
+        if pci:
+            pci_ids.append(pci)
+    if pci_ids:
+        info["pci_ids"] = pci_ids
+
+
+# ----------------------------------------------------------------------------
+def get_plugin_libs(binaries: Iterable[Path]) -> Iterator[Path]:
+    """
+    Look into the provided binaries for DPDK_PLUGIN_PATH and scan the path
+    for files.
+    """
+    for b in binaries:
+        for p in get_elf_strings(b, ".rodata", "DPDK_PLUGIN_PATH="):
+            plugin_path = p.strip()
+            logging.debug("discovering plugins in %s", plugin_path)
+            for root, _, files in os.walk(plugin_path):
+                for f in files:
+                    yield Path(root) / f
+            # no need to search in other binaries.
+            return
+
+
+# ----------------------------------------------------------------------------
+def existing_file(value: str) -> Path:
+    """
+    Argparse type= callback to ensure an argument points to a valid file path.
+    """
+    path = Path(value)
+    if not path.is_file():
+        raise argparse.ArgumentTypeError(f"{value}: No such file")
+    return path
+
+
+# ----------------------------------------------------------------------------
+PRINTABLE_BYTES = frozenset(string.printable.encode("ascii"))
+
+
+def find_strings(buf: bytes, prefix: str) -> Iterator[str]:
+    """
+    Extract strings of printable ASCII characters from a bytes buffer.
+    """
+    view = memoryview(buf)
+    start = None
+
+    for i, b in enumerate(view):
+        if start is None and b in PRINTABLE_BYTES:
+            # mark beginning of string
+            start = i
+            continue
+        if start is not None:
+            if b in PRINTABLE_BYTES:
+                # string not finished
+                continue
+            if b == 0:
+                # end of string
+                s = view[start:i].tobytes().decode("ascii")
+                if s.startswith(prefix):
+                    yield s[len(prefix) :]
+            # There can be byte sequences where a non-printable byte
+            # follows a printable one. Ignore that.
+            start = None
+
+
+# ----------------------------------------------------------------------------
+def elftools_version():
+    """
+    Extract pyelftools version as a tuple of integers for easy comparison.
+    """
+    version = getattr(elftools, "__version__", "")
+    match = re.match(r"^(\d+)\.(\d+).*$", str(version))
+    if not match:
+        # cannot determine version, hope for the best
+        return (0, 24)
+    return (int(match[1]), int(match[2]))
+
+
+ELFTOOLS_VERSION = elftools_version()
+
+
+def from_elftools(s: Union[bytes, str]) -> str:
+    """
+    Earlier versions of pyelftools (< 0.24) return bytes encoded with "latin-1"
+    instead of python strings.
+    """
+    if isinstance(s, bytes):
+        return s.decode("latin-1")
+    return s
+
+
+def to_elftools(s: str) -> Union[bytes, str]:
+    """
+    Earlier versions of pyelftools (< 0.24) assume that ELF section and tags
+    are bytes encoded with "latin-1" instead of python strings.
+    """
+    if ELFTOOLS_VERSION < (0, 24):
+        return s.encode("latin-1")
+    return s
+
+
+# ----------------------------------------------------------------------------
+def get_elf_strings(path: Path, section: str, prefix: str) -> Iterator[str]:
+    """
+    Extract strings from a named ELF section in a file.
+    """
+    with path.open("rb") as f:
+        elf = ELFFile(f)
+        sec = elf.get_section_by_name(to_elftools(section))
+        if not sec:
+            return
+        yield from find_strings(sec.data(), prefix)
+
+
+# ----------------------------------------------------------------------------
+def ld_so_path() -> Iterator[str]:
+    """
+    Return the list of directories where dynamic libraries are loaded based
+    on the contents of /etc/ld.so.conf/*.conf.
+    """
+    for conf in glob.iglob("/etc/ld.so.conf/*.conf"):
+        try:
+            with open(conf, "r", encoding="utf-8") as f:
+                for line in f:
+                    line = line.strip()
+                    if os.path.isdir(line):
+                        yield line
+        except OSError:
+            pass
+
+
+LD_SO_CONF_PATH = ld_so_path()
+
+
+def search_dt_needed(origin: Path, needed: str, runpath: List[str]) -> Path:
+    """
+    Search a file into LD_LIBRARY_PATH (if defined), runpath (if set) and in
+    all folders declared in /etc/ld.so.conf/*.conf. Finally, look in the
+    standard folders (/lib followed by /usr/lib).
+    """
+    folders = []
+    if "LD_LIBRARY_PATH" in os.environ:
+        folders += os.environ["LD_LIBRARY_PATH"].split(":")
+    folders += runpath
+    folders += LD_SO_CONF_PATH
+    folders += ["/lib", "/usr/lib"]
+    for d in folders:
+        d = d.replace("$ORIGIN", str(origin.parent.absolute()))
+        filepath = Path(d) / needed
+        if filepath.is_file():
+            return filepath
+    raise FileNotFoundError(needed)
+
+
+# ----------------------------------------------------------------------------
+def get_needed_libs(path: Path) -> Iterator[Path]:
+    """
+    Extract the dynamic library dependencies from an ELF executable.
+    """
+    with path.open("rb") as f:
+        elf = ELFFile(f)
+        dyn = elf.get_section_by_name(to_elftools(".dynamic"))
+        if not dyn:
+            return
+        runpath = []
+        for tag in dyn.iter_tags(to_elftools("DT_RUNPATH")):
+            runpath += from_elftools(tag.runpath).split(":")
+        for tag in dyn.iter_tags(to_elftools("DT_NEEDED")):
+            needed = from_elftools(tag.needed)
+            if not needed.startswith("librte_"):
+                continue
+            logging.debug("%s: DT_NEEDED %s", path, needed)
+            try:
+                yield search_dt_needed(path, needed, runpath)
+            except FileNotFoundError:
+                logging.warning("%s: DT_NEEDED not found: %s", path, needed)
+
+
+# ----------------------------------------------------------------------------
+if __name__ == "__main__":
+    sys.exit(main())
-- 
2.37.3


^ permalink raw reply	[relevance 1%]

* [PATCH v3] usertools: rewrite pmdinfo
  2022-09-13 10:58  1% [PATCH] usertools: rewrite pmdinfo Robin Jarry
  2022-09-13 19:42  1% ` [PATCH v2] " Robin Jarry
@ 2022-09-20  9:08  1% ` Robin Jarry
  2022-09-20 10:42  1% ` [PATCH v4] " Robin Jarry
  2 siblings, 0 replies; 200+ results
From: Robin Jarry @ 2022-09-20  9:08 UTC (permalink / raw)
  To: dev; +Cc: Robin Jarry, Olivier Matz, Ferruh Yigit, Bruce Richardson

dpdk-pmdinfo.py does not produce any parseable output. The -r/--raw flag
merely prints multiple independent JSON lines which cannot be fed
directly to any JSON parser. Moreover, the script complexity is rather
high for such a simple task: extracting PMD_INFO_STRING from .rodata ELF
sections. Rewrite it so that it can produce valid JSON.

Remove the PCI database parsing for PCI-ID to Vendor-Device names
conversion. This should be done by external scripts (if really needed).

Here are some examples of use with jq:

Get the complete info for a given driver:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.name == "dmadev_idxd_pci")'
 {
   "name": "dmadev_idxd_pci",
   "params": "max_queues=0",
   "kmod": "vfio-pci",
   "pci_ids": [
     {
       "vendor": "8086",
       "device": "0b25",
       "subsystem_vendor": "ffff",
       "subsystem_device": "ffff"
     }
   ]
 }

Get only the required kernel modules for a given driver:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.name == "net_i40e").kmod'
 "* igb_uio | uio_pci_generic | vfio-pci"

Get only the required kernel modules for a given device:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.pci_ids[] | .vendor == "15b3" and .device == "1013").kmod'
 "* ib_uverbs & mlx5_core & mlx5_ib"

Print the list of drivers which define multiple parameters without
string separators:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.params!=null and (.params|test("=[^ ]+="))) | {name, params}'
 ...

The script passes flake8, black, isort and pylint checks.

I have tested this with a matrix of python/pyelftools versions:

                             pyelftools
               0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29
         3.6     ok   ok   ok   ok   ok   ok   ok   ok
         3.7     ok   ok   ok   ok   ok   ok   ok   ok
  Python 3.8     ok   ok   ok   ok   ok   ok   ok   ok
         3.9     ok   ok   ok   ok   ok   ok   ok   ok
         3.10  fail fail fail fail   ok   ok   ok   ok

All failures with python 3.10 are related to the same issue:

  File "elftools/construct/lib/container.py", line 5, in <module>
    from collections import MutableMapping
  ImportError: cannot import name 'MutableMapping' from 'collections'

Python 3.10 support is only available since pyelftools 0.26. The script
will only work with Python 3.6 and later. Update the minimal system
requirements and release notes.

NB: The output produced by the legacy -r/--raw flag can be obtained with
the following command:

  strings build/app/dpdk-testpmd | sed -n 's/^PMD_INFO_STRING= //p'

Cc: Olivier Matz <olivier.matz@6wind.com>
Cc: Ferruh Yigit <ferruh.yigit@xilinx.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
v2 -> v3:

* strip "pci_ids" when it is empty (some drivers do not support any pci
  devices)

v1 -> v2:

* update release notes and minimal python version requirement
* hide warnings by default (-v/--verbose to show them)
* show debug messages with -vv
* also search libs in folders listed in /etc/ld.so.conf/*.conf
* only search for DT_NEEDED on executables, not on dynamic libraries
* take DT_RUNPATH into account for searching libraries
* fix weird broken pipe error
* fix some typos:
    s/begining/beginning/
    s/subsystem_device/subsystem_vendor/
    s/subsystem_system/subsystem_device/
* change field names for pci_ids elements (remove _id suffixes)
* DT_NEEDED of files are analyzed. There is no way to differentiate
  between dynamically linked executables and dynamic libraries.

 doc/guides/linux_gsg/sys_reqs.rst      |   2 +-
 doc/guides/rel_notes/release_22_11.rst |   5 +
 usertools/dpdk-pmdinfo.py              | 914 +++++++++----------------
 3 files changed, 314 insertions(+), 607 deletions(-)

diff --git a/doc/guides/linux_gsg/sys_reqs.rst b/doc/guides/linux_gsg/sys_reqs.rst
index 08d45898f025..f842105eeda7 100644
--- a/doc/guides/linux_gsg/sys_reqs.rst
+++ b/doc/guides/linux_gsg/sys_reqs.rst
@@ -41,7 +41,7 @@ Compilation of the DPDK
    resulting in statically linked applications not being linked properly.
    Use an updated version of ``pkg-config`` or ``pkgconf`` instead when building applications
 
-*   Python 3.5 or later.
+*   Python 3.6 or later.
 
 *   Meson (version 0.49.2+) and ninja
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf0505e..67054f5acdc9 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* The ``dpdk-pmdinfo.py`` script was rewritten to produce valid JSON only.
+  PCI-IDs parsing has been removed.
+  To get a similar output to the (now removed) ``-r/--raw`` flag, you may use the following command::
+
+     strings $dpdk_binary_or_driver | sed -n 's/^PMD_INFO_STRING= //p'
 
 ABI Changes
 -----------
diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py
index 40ef5cec6cba..068fdba2a603 100755
--- a/usertools/dpdk-pmdinfo.py
+++ b/usertools/dpdk-pmdinfo.py
@@ -1,626 +1,328 @@
 #!/usr/bin/env python3
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2016  Neil Horman <nhorman@tuxdriver.com>
+# Copyright(c) 2022  Robin Jarry
+# pylint: disable=invalid-name
+
+r"""
+Utility to dump PMD_INFO_STRING support from DPDK binaries.
+
+This script prints JSON output to be interpreted by other tools. Here are some
+examples with jq:
+
+Get the complete info for a given driver:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.name == "cnxk_nix_inl")'
+
+Get only the required kernel modules for a given driver:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.name == "net_i40e").kmod'
+
+Get only the required kernel modules for a given device:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.devices[] | .vendor_id == "15b3" and .device_id == "1013").kmod'
+"""
 
-# -------------------------------------------------------------------------
-#
-# Utility to dump PMD_INFO_STRING support from an object file
-#
-# -------------------------------------------------------------------------
-import json
-import os
-import platform
-import sys
 import argparse
-from elftools.common.exceptions import ELFError
-from elftools.common.py3compat import byte2int
-from elftools.elf.elffile import ELFFile
-
-
-# For running from development directory. It should take precedence over the
-# installed pyelftools.
-sys.path.insert(0, '.')
-
-raw_output = False
-pcidb = None
-
-# ===========================================
-
-class Vendor:
-    """
-    Class for vendors. This is the top level class
-    for the devices belong to a specific vendor.
-    self.devices is the device dictionary
-    subdevices are in each device.
-    """
-
-    def __init__(self, vendorStr):
-        """
-        Class initializes with the raw line from pci.ids
-        Parsing takes place inside __init__
-        """
-        self.ID = vendorStr.split()[0]
-        self.name = vendorStr.replace("%s " % self.ID, "").rstrip()
-        self.devices = {}
-
-    def addDevice(self, deviceStr):
-        """
-        Adds a device to self.devices
-        takes the raw line from pci.ids
-        """
-        s = deviceStr.strip()
-        devID = s.split()[0]
-        if devID in self.devices:
-            pass
-        else:
-            self.devices[devID] = Device(deviceStr)
-
-    def report(self):
-        print(self.ID, self.name)
-        for id, dev in self.devices.items():
-            dev.report()
-
-    def find_device(self, devid):
-        # convert to a hex string and remove 0x
-        devid = hex(devid)[2:]
-        try:
-            return self.devices[devid]
-        except:
-            return Device("%s  Unknown Device" % devid)
-
-
-class Device:
-
-    def __init__(self, deviceStr):
-        """
-        Class for each device.
-        Each vendor has its own devices dictionary.
-        """
-        s = deviceStr.strip()
-        self.ID = s.split()[0]
-        self.name = s.replace("%s  " % self.ID, "")
-        self.subdevices = {}
-
-    def report(self):
-        print("\t%s\t%s" % (self.ID, self.name))
-        for subID, subdev in self.subdevices.items():
-            subdev.report()
-
-    def addSubDevice(self, subDeviceStr):
-        """
-        Adds a subvendor, subdevice to device.
-        Uses raw line from pci.ids
-        """
-        s = subDeviceStr.strip()
-        spl = s.split()
-        subVendorID = spl[0]
-        subDeviceID = spl[1]
-        subDeviceName = s.split("  ")[-1]
-        devID = "%s:%s" % (subVendorID, subDeviceID)
-        self.subdevices[devID] = SubDevice(
-            subVendorID, subDeviceID, subDeviceName)
-
-    def find_subid(self, subven, subdev):
-        subven = hex(subven)[2:]
-        subdev = hex(subdev)[2:]
-        devid = "%s:%s" % (subven, subdev)
-
-        try:
-            return self.subdevices[devid]
-        except:
-            if (subven == "ffff" and subdev == "ffff"):
-                return SubDevice("ffff", "ffff", "(All Subdevices)")
-            return SubDevice(subven, subdev, "(Unknown Subdevice)")
-
-
-class SubDevice:
-    """
-    Class for subdevices.
-    """
-
-    def __init__(self, vendor, device, name):
-        """
-        Class initializes with vendorid, deviceid and name
-        """
-        self.vendorID = vendor
-        self.deviceID = device
-        self.name = name
-
-    def report(self):
-        print("\t\t%s\t%s\t%s" % (self.vendorID, self.deviceID, self.name))
-
-
-class PCIIds:
-    """
-    Top class for all pci.ids entries.
-    All queries will be asked to this class.
-    PCIIds.vendors["0e11"].devices["0046"].\
-    subdevices["0e11:4091"].name  =  "Smart Array 6i"
-    """
-
-    def __init__(self, filename):
-        """
-        Prepares the directories.
-        Checks local data file.
-        Tries to load from local, if not found, downloads from web
-        """
-        self.version = ""
-        self.date = ""
-        self.vendors = {}
-        self.contents = None
-        self.readLocal(filename)
-        self.parse()
-
-    def reportVendors(self):
-        """Reports the vendors
-        """
-        for vid, v in self.vendors.items():
-            print(v.ID, v.name)
-
-    def report(self, vendor=None):
-        """
-        Reports everything for all vendors or a specific vendor
-        PCIIds.report()  reports everything
-        PCIIDs.report("0e11") reports only "Compaq Computer Corporation"
-        """
-        if vendor is not None:
-            self.vendors[vendor].report()
-        else:
-            for vID, v in self.vendors.items():
-                v.report()
-
-    def find_vendor(self, vid):
-        # convert vid to a hex string and remove the 0x
-        vid = hex(vid)[2:]
-
-        try:
-            return self.vendors[vid]
-        except:
-            return Vendor("%s Unknown Vendor" % (vid))
-
-    def findDate(self, content):
-        for l in content:
-            if l.find("Date:") > -1:
-                return l.split()[-2].replace("-", "")
-        return None
-
-    def parse(self):
-        if not self.contents:
-            print("data/%s-pci.ids not found" % self.date)
-        else:
-            vendorID = ""
-            deviceID = ""
-            for l in self.contents:
-                if l[0] == "#":
-                    continue
-                elif not l.strip():
-                    continue
-                else:
-                    if l.find("\t\t") == 0:
-                        self.vendors[vendorID].devices[
-                            deviceID].addSubDevice(l)
-                    elif l.find("\t") == 0:
-                        deviceID = l.strip().split()[0]
-                        self.vendors[vendorID].addDevice(l)
-                    else:
-                        vendorID = l.split()[0]
-                        self.vendors[vendorID] = Vendor(l)
-
-    def readLocal(self, filename):
-        """
-        Reads the local file
-        """
-        with open(filename, 'r', encoding='utf-8') as f:
-            self.contents = f.readlines()
-        self.date = self.findDate(self.contents)
-
-    def loadLocal(self):
-        """
-        Loads database from local. If there is no file,
-        it creates a new one from web
-        """
-        self.date = idsfile[0].split("/")[1].split("-")[0]
-        self.readLocal()
-
-
-# =======================================
-
-def search_file(filename, search_path):
-    """ Given a search path, find file with requested name """
-    for path in search_path.split(':'):
-        candidate = os.path.join(path, filename)
-        if os.path.exists(candidate):
-            return os.path.abspath(candidate)
-    return None
-
-
-class ReadElf(object):
-    """ display_* methods are used to emit output into the output stream
-    """
-
-    def __init__(self, file, output):
-        """ file:
-                stream object with the ELF file to read
-
-            output:
-                output stream to write to
-        """
-        self.elffile = ELFFile(file)
-        self.output = output
-
-        # Lazily initialized if a debug dump is requested
-        self._dwarfinfo = None
-
-        self._versioninfo = None
-
-    def _section_from_spec(self, spec):
-        """ Retrieve a section given a "spec" (either number or name).
-            Return None if no such section exists in the file.
-        """
-        try:
-            num = int(spec)
-            if num < self.elffile.num_sections():
-                return self.elffile.get_section(num)
-            return None
-        except ValueError:
-            # Not a number. Must be a name then
-            section = self.elffile.get_section_by_name(force_unicode(spec))
-            if section is None:
-                # No match with a unicode name.
-                # Some versions of pyelftools (<= 0.23) store internal strings
-                # as bytes. Try again with the name encoded as bytes.
-                section = self.elffile.get_section_by_name(force_bytes(spec))
-            return section
-
-    def pretty_print_pmdinfo(self, pmdinfo):
-        global pcidb
-
-        for i in pmdinfo["pci_ids"]:
-            vendor = pcidb.find_vendor(i[0])
-            device = vendor.find_device(i[1])
-            subdev = device.find_subid(i[2], i[3])
-            print("%s (%s) : %s (%s) %s" %
-                  (vendor.name, vendor.ID, device.name,
-                   device.ID, subdev.name))
-
-    def parse_pmd_info_string(self, mystring):
-        global raw_output
-        global pcidb
-
-        optional_pmd_info = [
-            {'id': 'params', 'tag': 'PMD PARAMETERS'},
-            {'id': 'kmod', 'tag': 'PMD KMOD DEPENDENCIES'}
-        ]
-
-        i = mystring.index("=")
-        mystring = mystring[i + 2:]
-        pmdinfo = json.loads(mystring)
-
-        if raw_output:
-            print(json.dumps(pmdinfo))
-            return
-
-        print("PMD NAME: " + pmdinfo["name"])
-        for i in optional_pmd_info:
-            try:
-                print("%s: %s" % (i['tag'], pmdinfo[i['id']]))
-            except KeyError:
-                continue
-
-        if pmdinfo["pci_ids"]:
-            print("PMD HW SUPPORT:")
-            if pcidb is not None:
-                self.pretty_print_pmdinfo(pmdinfo)
-            else:
-                print("VENDOR\t DEVICE\t SUBVENDOR\t SUBDEVICE")
-                for i in pmdinfo["pci_ids"]:
-                    print("0x%04x\t 0x%04x\t 0x%04x\t\t 0x%04x" %
-                          (i[0], i[1], i[2], i[3]))
-
-        print("")
-
-    def display_pmd_info_strings(self, section_spec):
-        """ Display a strings dump of a section. section_spec is either a
-            section number or a name.
-        """
-        section = self._section_from_spec(section_spec)
-        if section is None:
-            return
-
-        data = section.data()
-        dataptr = 0
-
-        while dataptr < len(data):
-            while (dataptr < len(data) and
-                   not 32 <= byte2int(data[dataptr]) <= 127):
-                dataptr += 1
-
-            if dataptr >= len(data):
-                break
-
-            endptr = dataptr
-            while endptr < len(data) and byte2int(data[endptr]) != 0:
-                endptr += 1
-
-            # pyelftools may return byte-strings, force decode them
-            mystring = force_unicode(data[dataptr:endptr])
-            rc = mystring.find("PMD_INFO_STRING")
-            if rc != -1:
-                self.parse_pmd_info_string(mystring[rc:])
-
-            dataptr = endptr
-
-    def find_librte_eal(self, section):
-        for tag in section.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_NEEDED':
-                if "librte_eal" in force_unicode(tag.needed):
-                    return force_unicode(tag.needed)
-        return None
-
-    def search_for_autoload_path(self):
-        scanelf = self
-        scanfile = None
-        library = None
-
-        section = self._section_from_spec(".dynamic")
-        try:
-            eallib = self.find_librte_eal(section)
-            if eallib is not None:
-                ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-                if ldlibpath is None:
-                    ldlibpath = ""
-                dtr = self.get_dt_runpath(section)
-                library = search_file(eallib,
-                                      dtr + ":" + ldlibpath +
-                                      ":/usr/lib64:/lib64:/usr/lib:/lib")
-                if library is None:
-                    return (None, None)
-                if not raw_output:
-                    print("Scanning for autoload path in %s" % library)
-                scanfile = open(library, 'rb')
-                scanelf = ReadElf(scanfile, sys.stdout)
-        except AttributeError:
-            # Not a dynamic binary
-            pass
-        except ELFError:
-            scanfile.close()
-            return (None, None)
-
-        section = scanelf._section_from_spec(".rodata")
-        if section is None:
-            if scanfile is not None:
-                scanfile.close()
-            return (None, None)
-
-        data = section.data()
-        dataptr = 0
-
-        while dataptr < len(data):
-            while (dataptr < len(data) and
-                   not 32 <= byte2int(data[dataptr]) <= 127):
-                dataptr += 1
-
-            if dataptr >= len(data):
-                break
-
-            endptr = dataptr
-            while endptr < len(data) and byte2int(data[endptr]) != 0:
-                endptr += 1
-
-            # pyelftools may return byte-strings, force decode them
-            mystring = force_unicode(data[dataptr:endptr])
-            rc = mystring.find("DPDK_PLUGIN_PATH")
-            if rc != -1:
-                rc = mystring.find("=")
-                return (mystring[rc + 1:], library)
-
-            dataptr = endptr
-        if scanfile is not None:
-            scanfile.close()
-        return (None, None)
-
-    def get_dt_runpath(self, dynsec):
-        for tag in dynsec.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_RUNPATH':
-                return force_unicode(tag.runpath)
-        return ""
-
-    def process_dt_needed_entries(self):
-        """ Look to see if there are any DT_NEEDED entries in the binary
-            And process those if there are
-        """
-        runpath = ""
-        ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-        if ldlibpath is None:
-            ldlibpath = ""
-
-        dynsec = self._section_from_spec(".dynamic")
-        try:
-            runpath = self.get_dt_runpath(dynsec)
-        except AttributeError:
-            # dynsec is None, just return
-            return
-
-        for tag in dynsec.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_NEEDED':
-                if 'librte_' in force_unicode(tag.needed):
-                    library = search_file(force_unicode(tag.needed),
-                                          runpath + ":" + ldlibpath +
-                                          ":/usr/lib64:/lib64:/usr/lib:/lib")
-                    if library is not None:
-                        with open(library, 'rb') as file:
-                            try:
-                                libelf = ReadElf(file, sys.stdout)
-                            except ELFError:
-                                print("%s is no an ELF file" % library)
-                                continue
-                            libelf.process_dt_needed_entries()
-                            libelf.display_pmd_info_strings(".rodata")
-                            file.close()
-
-
-# compat: remove force_unicode & force_bytes when pyelftools<=0.23 support is
-# dropped.
-def force_unicode(s):
-    if hasattr(s, 'decode') and callable(s.decode):
-        s = s.decode('latin-1')  # same encoding used in pyelftools py3compat
-    return s
-
-
-def force_bytes(s):
-    if hasattr(s, 'encode') and callable(s.encode):
-        s = s.encode('latin-1')  # same encoding used in pyelftools py3compat
-    return s
-
-
-def scan_autoload_path(autoload_path):
-    global raw_output
-
-    if not os.path.exists(autoload_path):
-        return
-
+import glob
+import json
+import logging
+import os
+import re
+import string
+import sys
+from pathlib import Path
+from typing import Iterable, Iterator, List, Union
+
+import elftools
+from elftools.elf.elffile import ELFError, ELFFile
+
+
+# ----------------------------------------------------------------------------
+def main() -> int:  # pylint: disable=missing-docstring
     try:
-        dirs = os.listdir(autoload_path)
-    except OSError:
-        # Couldn't read the directory, give up
-        return
-
-    for d in dirs:
-        dpath = os.path.join(autoload_path, d)
-        if os.path.isdir(dpath):
-            scan_autoload_path(dpath)
-        if os.path.isfile(dpath):
-            try:
-                file = open(dpath, 'rb')
-                readelf = ReadElf(file, sys.stdout)
-            except ELFError:
-                # this is likely not an elf file, skip it
-                continue
-            except IOError:
-                # No permission to read the file, skip it
-                continue
-
-            if not raw_output:
-                print("Hw Support for library %s" % d)
-            readelf.display_pmd_info_strings(".rodata")
-            file.close()
+        args = parse_args()
+        logging.basicConfig(
+            stream=sys.stderr,
+            format="%(levelname)s: %(message)s",
+            level={
+                0: logging.ERROR,
+                1: logging.WARNING,
+            }.get(args.verbose, logging.DEBUG),
+        )
+        info = parse_pmdinfo(args.elf_files, args.search_plugins)
+        print(json.dumps(info, indent=2))
+    except BrokenPipeError:
+        pass
+    except KeyboardInterrupt:
+        return 1
+    except Exception as e:  # pylint: disable=broad-except
+        logging.error("%s", e)
+        return 1
+    return 0
 
 
-def scan_for_autoload_pmds(dpdk_path):
+# ----------------------------------------------------------------------------
+def parse_args() -> argparse.Namespace:
     """
-    search the specified application or path for a pmd autoload path
-    then scan said path for pmds and report hw support
+    Parse command line arguments.
     """
-    global raw_output
-
-    if not os.path.isfile(dpdk_path):
-        if not raw_output:
-            print("Must specify a file name")
-        return
-
-    file = open(dpdk_path, 'rb')
-    try:
-        readelf = ReadElf(file, sys.stdout)
-    except ElfError:
-        if not raw_output:
-            print("Unable to parse %s" % file)
-        return
-
-    (autoload_path, scannedfile) = readelf.search_for_autoload_path()
-    if not autoload_path:
-        if not raw_output:
-            print("No autoload path configured in %s" % dpdk_path)
-        return
-    if not raw_output:
-        if scannedfile is None:
-            scannedfile = dpdk_path
-        print("Found autoload path %s in %s" % (autoload_path, scannedfile))
-
-    file.close()
-    if not raw_output:
-        print("Discovered Autoload HW Support:")
-    scan_autoload_path(autoload_path)
-    return
-
-
-def main(stream=None):
-    global raw_output
-    global pcidb
-
-    pcifile_default = "./pci.ids"  # For unknown OS's assume local file
-    if platform.system() == 'Linux':
-        # hwdata is the legacy location, misc is supported going forward
-        pcifile_default = "/usr/share/misc/pci.ids"
-        if not os.path.exists(pcifile_default):
-            pcifile_default = "/usr/share/hwdata/pci.ids"
-    elif platform.system() == 'FreeBSD':
-        pcifile_default = "/usr/local/share/pciids/pci.ids"
-        if not os.path.exists(pcifile_default):
-            pcifile_default = "/usr/share/misc/pci_vendors"
-
     parser = argparse.ArgumentParser(
-        usage='usage: %(prog)s [-hrtp] [-d <pci id file>] elf_file',
-        description="Dump pmd hardware support info")
-    group = parser.add_mutually_exclusive_group()
-    group.add_argument('-r', '--raw',
-                       action='store_true', dest='raw_output',
-                       help='dump raw json strings')
-    group.add_argument("-t", "--table", dest="tblout",
-                       help="output information on hw support as a hex table",
-                       action='store_true')
-    parser.add_argument("-d", "--pcidb", dest="pcifile",
-                        help="specify a pci database to get vendor names from",
-                        default=pcifile_default, metavar="FILE")
-    parser.add_argument("-p", "--plugindir", dest="pdir",
-                        help="scan dpdk for autoload plugins",
-                        action='store_true')
-    parser.add_argument("elf_file", help="driver shared object file")
-    args = parser.parse_args()
+        description=__doc__,
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+    )
+    parser.add_argument(
+        "-p",
+        "--search-plugins",
+        action="store_true",
+        help="""
+        In addition of ELF_FILEs and their linked dynamic libraries, also scan
+        the DPDK plugins path.
+        """,
+    )
+    parser.add_argument(
+        "-v",
+        "--verbose",
+        action="count",
+        default=0,
+        help="""
+        Display warnings due to linked libraries not found or ELF/JSON parsing
+        errors in these libraries. Use twice to show debug messages.
+        """,
+    )
+    parser.add_argument(
+        "elf_files",
+        metavar="ELF_FILE",
+        nargs="+",
+        type=existing_file,
+        help="""
+        DPDK application binary or dynamic library.
+        """,
+    )
+    return parser.parse_args()
 
-    if args.raw_output:
-        raw_output = True
 
-    if args.tblout:
-        args.pcifile = None
+# ----------------------------------------------------------------------------
+def parse_pmdinfo(paths: Iterable[Path], search_plugins: bool) -> List[dict]:
+    """
+    Extract DPDK PMD info JSON strings from an ELF file.
 
-    if args.pcifile:
-        pcidb = PCIIds(args.pcifile)
-        if pcidb is None:
-            print("Pci DB file not found")
-            exit(1)
+    :returns:
+        A list of DPDK drivers info dictionaries.
+    """
+    binaries = set(paths)
+    for p in paths:
+        binaries.update(get_needed_libs(p))
+    if search_plugins:
+        # cast to list to avoid errors with update while iterating
+        binaries.update(list(get_plugin_libs(binaries)))
 
-    if args.pdir:
-        exit(scan_for_autoload_pmds(args.elf_file))
+    drivers = []
 
-    ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-    if ldlibpath is None:
-        ldlibpath = ""
-
-    if os.path.exists(args.elf_file):
-        myelffile = args.elf_file
-    else:
-        myelffile = search_file(args.elf_file,
-                                ldlibpath + ":/usr/lib64:/lib64:/usr/lib:/lib")
-
-    if myelffile is None:
-        print("File not found")
-        sys.exit(1)
-
-    with open(myelffile, 'rb') as file:
+    for b in binaries:
+        logging.debug("analyzing %s", b)
         try:
-            readelf = ReadElf(file, sys.stdout)
-            readelf.process_dt_needed_entries()
-            readelf.display_pmd_info_strings(".rodata")
-            sys.exit(0)
+            for s in get_elf_strings(b, ".rodata", "PMD_INFO_STRING="):
+                try:
+                    info = json.loads(s)
+                    # convert numerical ids to hex strings
+                    pci_ids = []
+                    for vendor, device, subven, subdev in info.pop("pci_ids"):
+                        pci_ids.append(
+                            {
+                                "vendor": f"{vendor:04x}",
+                                "device": f"{device:04x}",
+                                "subsystem_vendor": f"{subven:04x}",
+                                "subsystem_device": f"{subdev:04x}",
+                            }
+                        )
+                    if pci_ids:
+                        info["pci_ids"] = pci_ids
+                    drivers.append(info)
+                except ValueError as e:
+                    # invalid JSON, should never happen
+                    logging.warning("%s: %s", b, e)
+        except ELFError as e:
+            # only happens for discovered plugins that are not ELF
+            logging.debug("%s: cannot parse ELF: %s", b, e)
 
-        except ELFError as ex:
-            sys.stderr.write('ELF error: %s\n' % ex)
-            sys.exit(1)
+    return drivers
 
 
-# -------------------------------------------------------------------------
-if __name__ == '__main__':
-    main()
+# ----------------------------------------------------------------------------
+def get_plugin_libs(binaries: Iterable[Path]) -> Iterator[Path]:
+    """
+    Look into the provided binaries for DPDK_PLUGIN_PATH and scan the path
+    for files.
+    """
+    for b in binaries:
+        for p in get_elf_strings(b, ".rodata", "DPDK_PLUGIN_PATH="):
+            plugin_path = p.strip()
+            logging.debug("discovering plugins in %s", plugin_path)
+            for root, _, files in os.walk(plugin_path):
+                for f in files:
+                    yield Path(root) / f
+            # no need to search in other binaries.
+            return
+
+
+# ----------------------------------------------------------------------------
+def existing_file(value: str) -> Path:
+    """
+    Argparse type= callback to ensure an argument points to a valid file path.
+    """
+    path = Path(value)
+    if not path.is_file():
+        raise argparse.ArgumentTypeError(f"{value}: No such file")
+    return path
+
+
+# ----------------------------------------------------------------------------
+PRINTABLE_BYTES = frozenset(string.printable.encode("ascii"))
+
+
+def find_strings(buf: bytes, prefix: str) -> Iterator[str]:
+    """
+    Extract strings of printable ASCII characters from a bytes buffer.
+    """
+    view = memoryview(buf)
+    start = None
+
+    for i, b in enumerate(view):
+        if start is None and b in PRINTABLE_BYTES:
+            # mark beginning of string
+            start = i
+            continue
+        if start is not None:
+            if b in PRINTABLE_BYTES:
+                # string not finished
+                continue
+            if b == 0:
+                # end of string
+                s = view[start:i].tobytes().decode("ascii")
+                if s.startswith(prefix):
+                    yield s[len(prefix) :]
+            # There can be byte sequences where a non-printable byte
+            # follows a printable one. Ignore that.
+            start = None
+
+
+# ----------------------------------------------------------------------------
+def elftools_version():
+    """
+    Extract pyelftools version as a tuple of integers for easy comparison.
+    """
+    version = getattr(elftools, "__version__", "")
+    match = re.match(r"^(\d+)\.(\d+).*$", str(version))
+    if not match:
+        # cannot determine version, hope for the best
+        return (0, 24)
+    return (int(match[1]), int(match[2]))
+
+
+ELFTOOLS_VERSION = elftools_version()
+
+
+def from_elftools(s: Union[bytes, str]) -> str:
+    """
+    Earlier versions of pyelftools (< 0.24) return bytes encoded with "latin-1"
+    instead of python strings.
+    """
+    if isinstance(s, bytes):
+        return s.decode("latin-1")
+    return s
+
+
+def to_elftools(s: str) -> Union[bytes, str]:
+    """
+    Earlier versions of pyelftools (< 0.24) assume that ELF section and tags
+    are bytes encoded with "latin-1" instead of python strings.
+    """
+    if ELFTOOLS_VERSION < (0, 24):
+        return s.encode("latin-1")
+    return s
+
+
+# ----------------------------------------------------------------------------
+def get_elf_strings(path: Path, section: str, prefix: str) -> Iterator[str]:
+    """
+    Extract strings from a named ELF section in a file.
+    """
+    with path.open("rb") as f:
+        elf = ELFFile(f)
+        sec = elf.get_section_by_name(to_elftools(section))
+        if not sec:
+            return
+        yield from find_strings(sec.data(), prefix)
+
+
+# ----------------------------------------------------------------------------
+def ld_so_path() -> Iterator[str]:
+    """
+    Return the list of directories where dynamic libraries are loaded based
+    on the contents of /etc/ld.so.conf/*.conf.
+    """
+    for conf in glob.iglob("/etc/ld.so.conf/*.conf"):
+        try:
+            with open(conf, "r", encoding="utf-8") as f:
+                for line in f:
+                    line = line.strip()
+                    if os.path.isdir(line):
+                        yield line
+        except OSError:
+            pass
+
+
+LD_SO_CONF_PATH = ld_so_path()
+
+
+def search_dt_needed(origin: Path, needed: str, runpath: List[str]) -> Path:
+    """
+    Search a file into LD_LIBRARY_PATH (if defined), runpath (if set) and in
+    all folders declared in /etc/ld.so.conf/*.conf. Finally, look in the
+    standard folders (/lib followed by /usr/lib).
+    """
+    folders = []
+    if "LD_LIBRARY_PATH" in os.environ:
+        folders += os.environ["LD_LIBRARY_PATH"].split(":")
+    folders += runpath
+    folders += LD_SO_CONF_PATH
+    folders += ["/lib", "/usr/lib"]
+    for d in folders:
+        d = d.replace("$ORIGIN", str(origin.parent.absolute()))
+        filepath = Path(d) / needed
+        if filepath.is_file():
+            return filepath
+    raise FileNotFoundError(needed)
+
+
+# ----------------------------------------------------------------------------
+def get_needed_libs(path: Path) -> Iterator[Path]:
+    """
+    Extract the dynamic library dependencies from an ELF executable.
+    """
+    with path.open("rb") as f:
+        elf = ELFFile(f)
+        dyn = elf.get_section_by_name(to_elftools(".dynamic"))
+        if not dyn:
+            return
+        runpath = []
+        for tag in dyn.iter_tags(to_elftools("DT_RUNPATH")):
+            runpath += from_elftools(tag.runpath).split(":")
+        for tag in dyn.iter_tags(to_elftools("DT_NEEDED")):
+            needed = from_elftools(tag.needed)
+            if not needed.startswith("librte_"):
+                continue
+            logging.debug("%s: DT_NEEDED %s", path, needed)
+            try:
+                yield search_dt_needed(path, needed, runpath)
+            except FileNotFoundError:
+                logging.warning("%s: DT_NEEDED not found: %s", path, needed)
+
+
+# ----------------------------------------------------------------------------
+if __name__ == "__main__":
+    sys.exit(main())
-- 
2.37.3


^ permalink raw reply	[relevance 1%]

* [PATCH v2 1/1] ethdev: support congestion management
  @ 2022-09-19 12:15  2% ` skori
  2022-09-28  8:19  0%   ` Andrew Rybchenko
  2022-09-29  9:35  2%   ` [PATCH v3 " skori
  0 siblings, 2 replies; 200+ results
From: skori @ 2022-09-19 12:15 UTC (permalink / raw)
  To: Ferruh Yigit, Thomas Monjalon, Andrew Rybchenko, Ray Kinsella
  Cc: dev, Jerin Jacob

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>
---
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 +
 lib/eal/include/meson.build          |   1 +
 lib/eal/include/rte_cman.h           |  55 ++++++++++
 lib/ethdev/ethdev_driver.h           |  25 +++++
 lib/ethdev/meson.build               |   1 +
 lib/ethdev/rte_cman.c                | 101 ++++++++++++++++++
 lib/ethdev/rte_ethdev.h              | 151 +++++++++++++++++++++++++++
 lib/ethdev/version.map               |   6 ++
 9 files changed, 353 insertions(+)
 create mode 100644 lib/eal/include/rte_cman.h
 create mode 100644 lib/ethdev/rte_cman.c

diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index 7f6cb914a5..aa22d8bb22 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 d1db0c256a..38a5767b06 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/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..e569ba7cf4 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -10,6 +10,7 @@ headers += files(
         'rte_branch_prediction.h',
         'rte_bus.h',
         'rte_class.h',
+        'rte_cman.h',
         'rte_common.h',
         'rte_compat.h',
         'rte_debug.h',
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),
+};
+
+/**
+ * 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/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..9b6ad5c5c1 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -1093,6 +1093,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,
+				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.
  */
@@ -1308,6 +1324,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/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;
+}
+
+#define RTE_CMAN_FUNC_ERR_RET(func)					\
+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);
+	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);
+	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),
+};
+
+/**
+ * @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 */
+	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 */
+		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];
+	} 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, 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/version.map b/lib/ethdev/version.map
index 03f52fee91..ea9b9497ad 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%]

* Re: [PATCH] eventdev: add weight and affinity attributes to queue conf
  2022-09-14 12:34  0% ` Jerin Jacob
@ 2022-09-15 16:53  0%   ` Jerin Jacob
  0 siblings, 0 replies; 200+ results
From: Jerin Jacob @ 2022-09-15 16:53 UTC (permalink / raw)
  To: Shijith Thotton, McDaniel, Timothy, Gujjar, Abhinandan S,
	Van Haaren, Harry, Hemant Agrawal, Liang Ma,
	Mattias Rönnblom, Erik Gabriel Carrillo, Nipun Gupta,
	Jayatheerthan, Jay, Peter Mccarthy
  Cc: jerinj, dev, Ray Kinsella, Pavan Nikhilesh

On Wed, Sep 14, 2022 at 6:04 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Wed, Aug 10, 2022 at 1:13 PM Shijith Thotton <sthotton@marvell.com> wrote:
> >
> > Added new fields to represent event queue weight and affinity in
> > rte_event_queue_conf structure. Internal op to get queue attribute is
> > removed as it is no longer needed. Updated driver to use the new field.
> >
> > Signed-off-by: Shijith Thotton <sthotton@marvell.com>
>
> Acked-by: Jerin Jacob <jerinj@marvell.com>
>
> + eventdev PMD maintainers to raise any feedback before merging to next-eventdev


Applied to dpdk-next-net-eventdev/for-main. Thanks


>
>
> > ---
> >  doc/guides/rel_notes/deprecation.rst   |  3 --
> >  doc/guides/rel_notes/release_22_11.rst |  3 ++
> >  drivers/event/cnxk/cn10k_eventdev.c    |  1 -
> >  drivers/event/cnxk/cn9k_eventdev.c     |  1 -
> >  drivers/event/cnxk/cnxk_eventdev.c     | 42 ++++++--------------------
> >  drivers/event/cnxk/cnxk_eventdev.h     |  9 ------
> >  lib/eventdev/eventdev_pmd.h            | 22 --------------
> >  lib/eventdev/rte_eventdev.c            | 10 +++---
> >  lib/eventdev/rte_eventdev.h            | 16 ++++++++++
> >  9 files changed, 33 insertions(+), 74 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> > index e7583cae4c..13e7c6370e 100644
> > --- a/doc/guides/rel_notes/deprecation.rst
> > +++ b/doc/guides/rel_notes/deprecation.rst
> > @@ -206,9 +206,6 @@ Deprecation Notices
> >    ``rte_event_vector::elem_offset`` gives the number of valid elements left
> >    to process from the ``rte_event_vector::elem_offset``.
> >
> > -* eventdev: New fields to represent event queue weight and affinity
> > -  will be added to ``rte_event_queue_conf`` structure in DPDK 22.11.
> > -
> >  * metrics: The function ``rte_metrics_init`` will have a non-void return
> >    in order to notify errors instead of calling ``rte_exit``.
> >
> > diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> > index 8c021cf050..8ffd71e650 100644
> > --- a/doc/guides/rel_notes/release_22_11.rst
> > +++ b/doc/guides/rel_notes/release_22_11.rst
> > @@ -88,6 +88,9 @@ API Changes
> >  ABI Changes
> >  -----------
> >
> > +* eventdev: Added ``weight`` and ``affinity`` fields to ``rte_event_queue_conf``
> > +  structure.
> > +
> >  .. This section should contain ABI changes. Sample format:
> >
> >     * sample: Add a short 1-2 sentence description of the ABI change
> > diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
> > index 5a0cab40a9..aa8ae394bc 100644
> > --- a/drivers/event/cnxk/cn10k_eventdev.c
> > +++ b/drivers/event/cnxk/cn10k_eventdev.c
> > @@ -922,7 +922,6 @@ static struct eventdev_ops cn10k_sso_dev_ops = {
> >         .queue_def_conf = cnxk_sso_queue_def_conf,
> >         .queue_setup = cnxk_sso_queue_setup,
> >         .queue_release = cnxk_sso_queue_release,
> > -       .queue_attr_get = cnxk_sso_queue_attribute_get,
> >         .queue_attr_set = cnxk_sso_queue_attribute_set,
> >
> >         .port_def_conf = cnxk_sso_port_def_conf,
> > diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
> > index 2e27030049..58c72a580a 100644
> > --- a/drivers/event/cnxk/cn9k_eventdev.c
> > +++ b/drivers/event/cnxk/cn9k_eventdev.c
> > @@ -1153,7 +1153,6 @@ static struct eventdev_ops cn9k_sso_dev_ops = {
> >         .queue_def_conf = cnxk_sso_queue_def_conf,
> >         .queue_setup = cnxk_sso_queue_setup,
> >         .queue_release = cnxk_sso_queue_release,
> > -       .queue_attr_get = cnxk_sso_queue_attribute_get,
> >         .queue_attr_set = cnxk_sso_queue_attribute_set,
> >
> >         .port_def_conf = cnxk_sso_port_def_conf,
> > diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c
> > index 97dcf7b66e..45c53ffb4e 100644
> > --- a/drivers/event/cnxk/cnxk_eventdev.c
> > +++ b/drivers/event/cnxk/cnxk_eventdev.c
> > @@ -321,6 +321,8 @@ cnxk_sso_queue_def_conf(struct rte_eventdev *event_dev, uint8_t queue_id,
> >         queue_conf->nb_atomic_order_sequences = (1ULL << 20);
> >         queue_conf->event_queue_cfg = RTE_EVENT_QUEUE_CFG_ALL_TYPES;
> >         queue_conf->priority = RTE_EVENT_DEV_PRIORITY_NORMAL;
> > +       queue_conf->weight = RTE_EVENT_QUEUE_WEIGHT_LOWEST;
> > +       queue_conf->affinity = RTE_EVENT_QUEUE_AFFINITY_HIGHEST;
> >  }
> >
> >  int
> > @@ -330,18 +332,12 @@ cnxk_sso_queue_setup(struct rte_eventdev *event_dev, uint8_t queue_id,
> >         struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> >         uint8_t priority, weight, affinity;
> >
> > -       /* Default weight and affinity */
> > -       dev->mlt_prio[queue_id].weight = RTE_EVENT_QUEUE_WEIGHT_LOWEST;
> > -       dev->mlt_prio[queue_id].affinity = RTE_EVENT_QUEUE_AFFINITY_HIGHEST;
> > -
> >         priority = CNXK_QOS_NORMALIZE(queue_conf->priority, 0,
> >                                       RTE_EVENT_DEV_PRIORITY_LOWEST,
> >                                       CNXK_SSO_PRIORITY_CNT);
> > -       weight = CNXK_QOS_NORMALIZE(
> > -               dev->mlt_prio[queue_id].weight, CNXK_SSO_WEIGHT_MIN,
> > -               RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
> > -       affinity = CNXK_QOS_NORMALIZE(dev->mlt_prio[queue_id].affinity, 0,
> > -                                     RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
> > +       weight = CNXK_QOS_NORMALIZE(queue_conf->weight, CNXK_SSO_WEIGHT_MIN,
> > +                                   RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
> > +       affinity = CNXK_QOS_NORMALIZE(queue_conf->affinity, 0, RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
> >                                       CNXK_SSO_AFFINITY_CNT);
> >
> >         plt_sso_dbg("Queue=%u prio=%u weight=%u affinity=%u", queue_id,
> > @@ -358,22 +354,6 @@ cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id)
> >         RTE_SET_USED(queue_id);
> >  }
> >
> > -int
> > -cnxk_sso_queue_attribute_get(struct rte_eventdev *event_dev, uint8_t queue_id,
> > -                            uint32_t attr_id, uint32_t *attr_value)
> > -{
> > -       struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> > -
> > -       if (attr_id == RTE_EVENT_QUEUE_ATTR_WEIGHT)
> > -               *attr_value = dev->mlt_prio[queue_id].weight;
> > -       else if (attr_id == RTE_EVENT_QUEUE_ATTR_AFFINITY)
> > -               *attr_value = dev->mlt_prio[queue_id].affinity;
> > -       else
> > -               return -EINVAL;
> > -
> > -       return 0;
> > -}
> > -
> >  int
> >  cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
> >                              uint32_t attr_id, uint64_t attr_value)
> > @@ -389,10 +369,10 @@ cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
> >                 conf->priority = attr_value;
> >                 break;
> >         case RTE_EVENT_QUEUE_ATTR_WEIGHT:
> > -               dev->mlt_prio[queue_id].weight = attr_value;
> > +               conf->weight = attr_value;
> >                 break;
> >         case RTE_EVENT_QUEUE_ATTR_AFFINITY:
> > -               dev->mlt_prio[queue_id].affinity = attr_value;
> > +               conf->affinity = attr_value;
> >                 break;
> >         case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS:
> >         case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES:
> > @@ -409,11 +389,9 @@ cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
> >         priority = CNXK_QOS_NORMALIZE(conf->priority, 0,
> >                                       RTE_EVENT_DEV_PRIORITY_LOWEST,
> >                                       CNXK_SSO_PRIORITY_CNT);
> > -       weight = CNXK_QOS_NORMALIZE(
> > -               dev->mlt_prio[queue_id].weight, CNXK_SSO_WEIGHT_MIN,
> > -               RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
> > -       affinity = CNXK_QOS_NORMALIZE(dev->mlt_prio[queue_id].affinity, 0,
> > -                                     RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
> > +       weight = CNXK_QOS_NORMALIZE(conf->weight, CNXK_SSO_WEIGHT_MIN,
> > +                                   RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
> > +       affinity = CNXK_QOS_NORMALIZE(conf->affinity, 0, RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
> >                                       CNXK_SSO_AFFINITY_CNT);
> >
> >         return roc_sso_hwgrp_set_priority(&dev->sso, queue_id, weight, affinity,
> > diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
> > index bfd0c5627e..d78fb4ea2f 100644
> > --- a/drivers/event/cnxk/cnxk_eventdev.h
> > +++ b/drivers/event/cnxk/cnxk_eventdev.h
> > @@ -88,11 +88,6 @@ struct cnxk_sso_qos {
> >         uint16_t iaq_prcnt;
> >  };
> >
> > -struct cnxk_sso_mlt_prio {
> > -       uint8_t weight;
> > -       uint8_t affinity;
> > -};
> > -
> >  struct cnxk_sso_evdev {
> >         struct roc_sso sso;
> >         uint8_t max_event_queues;
> > @@ -123,7 +118,6 @@ struct cnxk_sso_evdev {
> >         uint64_t *timer_adptr_sz;
> >         uint16_t vec_pool_cnt;
> >         uint64_t *vec_pools;
> > -       struct cnxk_sso_mlt_prio mlt_prio[RTE_EVENT_MAX_QUEUES_PER_DEV];
> >         /* Dev args */
> >         uint32_t xae_cnt;
> >         uint8_t qos_queue_cnt;
> > @@ -250,9 +244,6 @@ void cnxk_sso_queue_def_conf(struct rte_eventdev *event_dev, uint8_t queue_id,
> >  int cnxk_sso_queue_setup(struct rte_eventdev *event_dev, uint8_t queue_id,
> >                          const struct rte_event_queue_conf *queue_conf);
> >  void cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id);
> > -int cnxk_sso_queue_attribute_get(struct rte_eventdev *event_dev,
> > -                                uint8_t queue_id, uint32_t attr_id,
> > -                                uint32_t *attr_value);
> >  int cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev,
> >                                  uint8_t queue_id, uint32_t attr_id,
> >                                  uint64_t attr_value);
> > diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> > index 69402668d8..8879e43feb 100644
> > --- a/lib/eventdev/eventdev_pmd.h
> > +++ b/lib/eventdev/eventdev_pmd.h
> > @@ -341,26 +341,6 @@ typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
> >  typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
> >                 uint8_t queue_id);
> >
> > -/**
> > - * Get an event queue attribute at runtime.
> > - *
> > - * @param dev
> > - *   Event device pointer
> > - * @param queue_id
> > - *   Event queue index
> > - * @param attr_id
> > - *   Event queue attribute id
> > - * @param[out] attr_value
> > - *   Event queue attribute value
> > - *
> > - * @return
> > - *  - 0: Success.
> > - *  - <0: Error code on failure.
> > - */
> > -typedef int (*eventdev_queue_attr_get_t)(struct rte_eventdev *dev,
> > -                                        uint8_t queue_id, uint32_t attr_id,
> > -                                        uint32_t *attr_value);
> > -
> >  /**
> >   * Set an event queue attribute at runtime.
> >   *
> > @@ -1268,8 +1248,6 @@ struct eventdev_ops {
> >         /**< Set up an event queue. */
> >         eventdev_queue_release_t queue_release;
> >         /**< Release an event queue. */
> > -       eventdev_queue_attr_get_t queue_attr_get;
> > -       /**< Get an event queue attribute. */
> >         eventdev_queue_attr_set_t queue_attr_set;
> >         /**< Set an event queue attribute. */
> >
> > diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> > index 1dc4f966be..b96185b25d 100644
> > --- a/lib/eventdev/rte_eventdev.c
> > +++ b/lib/eventdev/rte_eventdev.c
> > @@ -859,15 +859,13 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
> >                 break;
> >         case RTE_EVENT_QUEUE_ATTR_WEIGHT:
> >                 *attr_value = RTE_EVENT_QUEUE_WEIGHT_LOWEST;
> > -               if (dev->dev_ops->queue_attr_get)
> > -                       return (*dev->dev_ops->queue_attr_get)(
> > -                               dev, queue_id, attr_id, attr_value);
> > +               if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
> > +                       *attr_value = conf->weight;
> >                 break;
> >         case RTE_EVENT_QUEUE_ATTR_AFFINITY:
> >                 *attr_value = RTE_EVENT_QUEUE_AFFINITY_LOWEST;
> > -               if (dev->dev_ops->queue_attr_get)
> > -                       return (*dev->dev_ops->queue_attr_get)(
> > -                               dev, queue_id, attr_id, attr_value);
> > +               if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
> > +                       *attr_value = conf->affinity;
> >                 break;
> >         default:
> >                 return -EINVAL;
> > diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
> > index 6a6f6ea4c1..f1908b82b2 100644
> > --- a/lib/eventdev/rte_eventdev.h
> > +++ b/lib/eventdev/rte_eventdev.h
> > @@ -640,6 +640,22 @@ struct rte_event_queue_conf {
> >          * event device supported priority value.
> >          * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
> >          */
> > +       uint8_t weight;
> > +       /**< Weight of the event queue relative to other event queues.
> > +        * The requested weight should be in the range of
> > +        * [RTE_EVENT_DEV_WEIGHT_HIGHEST, RTE_EVENT_DEV_WEIGHT_LOWEST].
> > +        * The implementation shall normalize the requested weight to event
> > +        * device supported weight value.
> > +        * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability.
> > +        */
> > +       uint8_t affinity;
> > +       /**< Affinity of the event queue relative to other event queues.
> > +        * The requested affinity should be in the range of
> > +        * [RTE_EVENT_DEV_AFFINITY_HIGHEST, RTE_EVENT_DEV_AFFINITY_LOWEST].
> > +        * The implementation shall normalize the requested affinity to event
> > +        * device supported affinity value.
> > +        * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability.
> > +        */
> >  };
> >
> >  /**
> > --
> > 2.25.1
> >

^ permalink raw reply	[relevance 0%]

* RE: [RFC v2] eal/linux: add support for fast virt/iova translation
  2022-09-15 12:13  0%     ` Don Wallwork
@ 2022-09-15 12:49  0%       ` Morten Brørup
  0 siblings, 0 replies; 200+ results
From: Morten Brørup @ 2022-09-15 12:49 UTC (permalink / raw)
  To: Don Wallwork, dev, bruce.richardson; +Cc: dmitry.kozliuk, anatoly.burakov

> From: Don Wallwork [mailto:donw@xsightlabs.com]
> Sent: Thursday, 15 September 2022 14.14
> 
> On 9/15/2022 3:40 AM, Morten Brørup wrote:
> >> From: Don Wallwork [mailto:donw@xsightlabs.com]
> >> Sent: Wednesday, 14 September 2022 23.12
> >>
> >> This patch maps hugepage memory such that address translation from
> >> virtual to iova or vice versa can be done by simple addition/
> >> subtraction of a constant value without any page table walks.
> >>
> >> A new '--const-translate' EAL option is added to enable this mode.

[...]

> > rte_mem_fast_virt2iova() and rte_mem_fast_iova2virt() serve the same
> purpose as rte_mem_virt2iova() and rte_mem_iova2virt(). Can't this
> alternative algorithm be implemented in the existing functions, or is
> there a reason for adding separate functions?
> It is necessary to keep a version of the translation functions that
> does
> the page table walks since that method must be used at init time.  My
> intention was to add new functions that are safe for use in fast path
> code.
> >
> > Minor detail about names: The DPDK community has a general aversion
> against using "fast" in function names - because everything in DPDK is
> supposed to be fast. If they need to be separate, perhaps use "_fp"
> (for fast path) at the end of their names, like the Trace library's
> RTE_TRACE_POINT_FP() variant of the RTE_TRACE_POINT() macro.
> Thought that might be the case.. I can change to _fp.

That should fly - at least there's a reference to point at. :-)

> >
> > If these two functions need to be really fast, they could be inline
> instead of proper functions. In my opinion, they are short enough to
> allow inlining. And, if merged with the original functions, the fast
> code path could be inline and fall back to calling the original, slower
> functions (which would then need to be renamed). Others might disagree
> about inlining. Reusing the existing names might also probably break
> the ABI.
> Agree that this could be inlined, but probably best not to merge with
> the page walk version since it would not be desirable for fast path
> code
> to fall back to that mode.

I have no strong opinion regarding merging.

And since I don't know how much these functions are going to be used, I have no strong opinion about inlining.

> Also since this patch implements support for
> Linux EAL only, the inline functions may need to be added to a Linux
> specific header.

These fast path functions (whether merged with their slow cousins or not) will be part of the public API, so fallback implementations for other operating systems need to be implemented. Making them inline or proper functions shouldn't have a big impact on the development effort.

I must admit that the way the DPDK EAL implements inline functions for various architectures seems a bit weird to me; being based largely on copy-paste, rather than a clear separation of declaration and implementation. I guess that the DPDK EAL suffers from the same weirdness for various operating systems.

> >
> >  From a high level perspective - and referring to my previous
> argument about optimizations not being features [1] - I wonder if this
> patch should be a build time option instead of a runtime feature?

Making it a build time option would probably also implicitly answer some of the questions about how to implement the fast path functions.

> > @Don: My preference for build time options is somewhat controversial,
> so don't waste time converting to a build time option before the
> community has provided feedback on the subject.
> >
> > [1]:
> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Finbox.
> dpdk.org%2Fdev%2F98CBD80474FA8B44BF855DF32C47DC35D870EB%40smartserver.s
> martshare.dk%2F&amp;data=05%7C01%7Cdonw%40xsightlabs.com%7C27c0102845d0
> 42a17bb408da96ed96f7%7C646a3e3483ea42739177ab01923abaa9%7C0%7C0%7C63798
> 8244443228274%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM
> zIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=bW9ZmyZ9Ap9
> rAG5juYGEUgvCNTCJ96Q1IwPf8ExaEGI%3D&amp;reserved=0


^ permalink raw reply	[relevance 0%]

* Re: [RFC v2] eal/linux: add support for fast virt/iova translation
  2022-09-15  7:40  3%   ` Morten Brørup
@ 2022-09-15 12:13  0%     ` Don Wallwork
  2022-09-15 12:49  0%       ` Morten Brørup
  0 siblings, 1 reply; 200+ results
From: Don Wallwork @ 2022-09-15 12:13 UTC (permalink / raw)
  To: Morten Brørup, dev, bruce.richardson; +Cc: dmitry.kozliuk, anatoly.burakov

On 9/15/2022 3:40 AM, Morten Brørup wrote:
>> From: Don Wallwork [mailto:donw@xsightlabs.com]
>> Sent: Wednesday, 14 September 2022 23.12
>>
>> This patch maps hugepage memory such that address translation from
>> virtual to iova or vice versa can be done by simple addition/
>> subtraction of a constant value without any page table walks.
>>
>> A new '--const-translate' EAL option is added to enable this mode.
[...]
>> diff --git a/lib/eal/include/rte_memory.h
>> b/lib/eal/include/rte_memory.h
>> index 68b069fd04..c87777ca01 100644
>> --- a/lib/eal/include/rte_memory.h
>> +++ b/lib/eal/include/rte_memory.h
>> @@ -134,6 +134,34 @@ rte_iova_t rte_mem_virt2iova(const void *virt);
>>   void *
>>   rte_mem_iova2virt(rte_iova_t iova);
>>
>> +/**
>> + * Get IO virtual address of any mapped virtual address in the current
>> process.
>> + *
>> + * @note This function provides a fast implementation of virtual to
>> physical
>> + *       addresses that does not walk any page tables.  Suitable for
>> use in
>> + *       data plane threads.
>> + *
>> + * @param virt
>> + *   The virtual address.
>> + * @return
>> + *   The IO address or RTE_BAD_IOVA on error.
>> + */
>> +rte_iova_t rte_mem_fast_virt2iova(const void *virt);
>> +
>> +/**
>> + * Get virtual memory address corresponding to iova address.
>> + *
>> + * @note This function provides a fast implementation of physical to
>> virtual to
>> + *       addresses.  Suitable for use in data plane threads.
>> + *
>> + * @param iova
>> + *   The iova address.
>> + * @return
>> + *   Virtual address corresponding to iova address (or NULL if address
>> does not
>> + *   exist within DPDK memory map).
>> + */
>> +void *rte_mem_fast_iova2virt(rte_iova_t iova);
>> +
>>   /**
>>    * Get memseg to which a particular virtual address belongs.
>>    *
> rte_mem_fast_virt2iova() and rte_mem_fast_iova2virt() serve the same purpose as rte_mem_virt2iova() and rte_mem_iova2virt(). Can't this alternative algorithm be implemented in the existing functions, or is there a reason for adding separate functions?
It is necessary to keep a version of the translation functions that does 
the page table walks since that method must be used at init time.  My 
intention was to add new functions that are safe for use in fast path code.
>
> Minor detail about names: The DPDK community has a general aversion against using "fast" in function names - because everything in DPDK is supposed to be fast. If they need to be separate, perhaps use "_fp" (for fast path) at the end of their names, like the Trace library's RTE_TRACE_POINT_FP() variant of the RTE_TRACE_POINT() macro.
Thought that might be the case.. I can change to _fp.
>
> If these two functions need to be really fast, they could be inline instead of proper functions. In my opinion, they are short enough to allow inlining. And, if merged with the original functions, the fast code path could be inline and fall back to calling the original, slower functions (which would then need to be renamed). Others might disagree about inlining. Reusing the existing names might also probably break the ABI.
Agree that this could be inlined, but probably best not to merge with 
the page walk version since it would not be desirable for fast path code 
to fall back to that mode.  Also since this patch implements support for 
Linux EAL only, the inline functions may need to be added to a Linux 
specific header.
>
>  From a high level perspective - and referring to my previous argument about optimizations not being features [1] - I wonder if this patch should be a build time option instead of a runtime feature?
> @Don: My preference for build time options is somewhat controversial, so don't waste time converting to a build time option before the community has provided feedback on the subject.
>
> [1]: https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Finbox.dpdk.org%2Fdev%2F98CBD80474FA8B44BF855DF32C47DC35D870EB%40smartserver.smartshare.dk%2F&amp;data=05%7C01%7Cdonw%40xsightlabs.com%7C27c0102845d042a17bb408da96ed96f7%7C646a3e3483ea42739177ab01923abaa9%7C0%7C0%7C637988244443228274%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=bW9ZmyZ9Ap9rAG5juYGEUgvCNTCJ96Q1IwPf8ExaEGI%3D&amp;reserved=0
>
> [...]
>
>> diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
>> index c890c42106..3fefb3dc9d 100644
>> --- a/lib/eal/linux/eal_memory.c
>> +++ b/lib/eal/linux/eal_memory.c
>> @@ -148,6 +148,47 @@ rte_mem_virt2iova(const void *virtaddr)
>>   	return rte_mem_virt2phy(virtaddr);
>>   }
>>
>> +static void *const_va_pa_delta;
> This variable is primarily used as an address offset, not a pointer, so consider making it "uintptr_t" instead of "void *".
Good point.
>> +
>> +#ifdef RTE_MEM_SANITY_CHECK
>> +#define __rte_mem_validate(v) rte_mem_validate(v)
>> +
>> +static int rte_mem_validate(const void *virtaddr)
>> +{
>> +	if (!rte_mem_virt2memseg(virt, NULL)) {
>> +		RTE_LOG(ERR, EAL, "Invalid virtual address %p\n",
>> virtaddr);
>> +		return -1;
>> +	}
>> +	return 0;
>> +}
>> +#else
>> +#define __rte_mem_validate(v) 0
>> +#endif
>> +
>> +rte_iova_t rte_mem_fast_virt2iova(const void *virtaddr)
>> +{
>> +	if (rte_eal_iova_mode() == RTE_IOVA_VA)
>> +		return (uintptr_t)virtaddr;
>> +
>> +	if (__rte_mem_validate(virtaddr) != 0)
>> +		return RTE_BAD_IOVA;
>> +
>> +	return (rte_iova_t)((uintptr_t)virtaddr -
>> (uintptr_t)const_va_pa_delta);
> You can probably use RTE_PTR_SUB() instead.
Will do.
>
>> +}
>> +
>> +void *rte_mem_fast_iova2virt(rte_iova_t iova)
>> +{
>> +	if (rte_eal_iova_mode() == RTE_IOVA_VA)
>> +		return (void *)(uintptr_t)iova;
>> +
>> +	void *virtaddr = (void *)((uintptr_t)const_va_pa_delta + iova);
> You can probably use RTE_PTR_ADD() instead.
Agreed.

-Don
>
>> +
>> +	if (__rte_mem_validate(virtaddr) != 0)
>> +		return NULL;
>> +
>> +	return virtaddr;
>> +}
>> +


^ permalink raw reply	[relevance 0%]

* RE: [RFC v2] eal/linux: add support for fast virt/iova translation
  @ 2022-09-15  7:40  3%   ` Morten Brørup
  2022-09-15 12:13  0%     ` Don Wallwork
  0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-09-15  7:40 UTC (permalink / raw)
  To: Don Wallwork, dev, bruce.richardson; +Cc: dmitry.kozliuk, anatoly.burakov

> From: Don Wallwork [mailto:donw@xsightlabs.com]
> Sent: Wednesday, 14 September 2022 23.12
> 
> This patch maps hugepage memory such that address translation from
> virtual to iova or vice versa can be done by simple addition/
> subtraction of a constant value without any page table walks.
> 
> A new '--const-translate' EAL option is added to enable this mode.
> 
> The following example describes how this works:
> 
> Say you have a system with 4 huge pages that are 1G each and the
> physical addresses are 10, 11, 17 and 22G. If we map 13G of virtual
> address space, that will be enough to cover all of the huge page
> physical addresses.
> 
> If the VA region starts at 1G, all of the hugepage PAs can
> be mapped into that region as shown below under Proposed
> heading.  For comparison, existing mapping that would be
> done in legacy mode is shown under the Current heading.
> 
> Proposed      Current (Legacy)
> 
>  VA | PA         VA | PA
> ----+----       ----+----
>  1G | 10G        1G | 10G
>  2G | 11G        2G | 11G
>  3G |  -         3G |  -
>  4G |  -         4G | 17G
>  5G |  -         5G |  -
>  6G |  -         6G | 22G
>  7G |  -
>  8G | 17G
>  9G |  -
> 10G |  -
> 11G |  -
> 12G |  -
> 13G | 22G
> 
> So in this example, we have a fixed offset of 9G to translate
> between VA to PA or vice versa.This works whether the huge
> pages happen to be allocated statically (legacy mode) or
> dynamically.
> 
> The unused VA address space from 3G-7G and 9G-12G can be
> unmapped in just two unmap calls.
> 
> This patch applies to legacy-mem mode only.
> ---

[...]

> diff --git a/lib/eal/include/rte_memory.h
> b/lib/eal/include/rte_memory.h
> index 68b069fd04..c87777ca01 100644
> --- a/lib/eal/include/rte_memory.h
> +++ b/lib/eal/include/rte_memory.h
> @@ -134,6 +134,34 @@ rte_iova_t rte_mem_virt2iova(const void *virt);
>  void *
>  rte_mem_iova2virt(rte_iova_t iova);
> 
> +/**
> + * Get IO virtual address of any mapped virtual address in the current
> process.
> + *
> + * @note This function provides a fast implementation of virtual to
> physical
> + *       addresses that does not walk any page tables.  Suitable for
> use in
> + *       data plane threads.
> + *
> + * @param virt
> + *   The virtual address.
> + * @return
> + *   The IO address or RTE_BAD_IOVA on error.
> + */
> +rte_iova_t rte_mem_fast_virt2iova(const void *virt);
> +
> +/**
> + * Get virtual memory address corresponding to iova address.
> + *
> + * @note This function provides a fast implementation of physical to
> virtual to
> + *       addresses.  Suitable for use in data plane threads.
> + *
> + * @param iova
> + *   The iova address.
> + * @return
> + *   Virtual address corresponding to iova address (or NULL if address
> does not
> + *   exist within DPDK memory map).
> + */
> +void *rte_mem_fast_iova2virt(rte_iova_t iova);
> +
>  /**
>   * Get memseg to which a particular virtual address belongs.
>   *

rte_mem_fast_virt2iova() and rte_mem_fast_iova2virt() serve the same purpose as rte_mem_virt2iova() and rte_mem_iova2virt(). Can't this alternative algorithm be implemented in the existing functions, or is there a reason for adding separate functions?

Minor detail about names: The DPDK community has a general aversion against using "fast" in function names - because everything in DPDK is supposed to be fast. If they need to be separate, perhaps use "_fp" (for fast path) at the end of their names, like the Trace library's RTE_TRACE_POINT_FP() variant of the RTE_TRACE_POINT() macro.

If these two functions need to be really fast, they could be inline instead of proper functions. In my opinion, they are short enough to allow inlining. And, if merged with the original functions, the fast code path could be inline and fall back to calling the original, slower functions (which would then need to be renamed). Others might disagree about inlining. Reusing the existing names might also probably break the ABI.

From a high level perspective - and referring to my previous argument about optimizations not being features [1] - I wonder if this patch should be a build time option instead of a runtime feature?
@Don: My preference for build time options is somewhat controversial, so don't waste time converting to a build time option before the community has provided feedback on the subject.

[1]: http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D870EB@smartserver.smartshare.dk/

[...]

> diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
> index c890c42106..3fefb3dc9d 100644
> --- a/lib/eal/linux/eal_memory.c
> +++ b/lib/eal/linux/eal_memory.c
> @@ -148,6 +148,47 @@ rte_mem_virt2iova(const void *virtaddr)
>  	return rte_mem_virt2phy(virtaddr);
>  }
> 
> +static void *const_va_pa_delta;

This variable is primarily used as an address offset, not a pointer, so consider making it "uintptr_t" instead of "void *".

> +
> +#ifdef RTE_MEM_SANITY_CHECK
> +#define __rte_mem_validate(v) rte_mem_validate(v)
> +
> +static int rte_mem_validate(const void *virtaddr)
> +{
> +	if (!rte_mem_virt2memseg(virt, NULL)) {
> +		RTE_LOG(ERR, EAL, "Invalid virtual address %p\n",
> virtaddr);
> +		return -1;
> +	}
> +	return 0;
> +}
> +#else
> +#define __rte_mem_validate(v) 0
> +#endif
> +
> +rte_iova_t rte_mem_fast_virt2iova(const void *virtaddr)
> +{
> +	if (rte_eal_iova_mode() == RTE_IOVA_VA)
> +		return (uintptr_t)virtaddr;
> +
> +	if (__rte_mem_validate(virtaddr) != 0)
> +		return RTE_BAD_IOVA;
> +
> +	return (rte_iova_t)((uintptr_t)virtaddr -
> (uintptr_t)const_va_pa_delta);

You can probably use RTE_PTR_SUB() instead.

> +}
> +
> +void *rte_mem_fast_iova2virt(rte_iova_t iova)
> +{
> +	if (rte_eal_iova_mode() == RTE_IOVA_VA)
> +		return (void *)(uintptr_t)iova;
> +
> +	void *virtaddr = (void *)((uintptr_t)const_va_pa_delta + iova);

You can probably use RTE_PTR_ADD() instead.

> +
> +	if (__rte_mem_validate(virtaddr) != 0)
> +		return NULL;
> +
> +	return virtaddr;
> +}
> +


^ permalink raw reply	[relevance 3%]

* RE: [EXT] [PATCH 1/3] cryptodev: rework session framework
  2022-09-15  7:07  0%   ` [EXT] " Akhil Goyal
@ 2022-09-15  7:26  0%     ` Akhil Goyal
  0 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-15  7:26 UTC (permalink / raw)
  To: Fan Zhang, dev, konstantin.v.ananyev
  Cc: maxime.coquelin, chandu, ruifeng.wang, ajit.khaparde,
	Anoob Joseph, pablo.de.lara.guarch, matan, g.singh, jianjay.zhou

++Konstantin

Requesting everyone in cc to review this patchset from last year.
This patch was not merged in 21.11 due to lack of review.
Please help getting this merged in RC1 for 22.11.

Regards,
Akhil
> -----Original Message-----
> From: Akhil Goyal
> Sent: Thursday, September 15, 2022 12:38 PM
> To: Fan Zhang <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; chandu@amd.com;
> ruifeng.wang@arm.com; ajit.khaparde@broadcom.com; Anoob Joseph
> <anoobj@marvell.com>; pablo.de.lara.guarch@intel.com; matan@nvidia.com;
> g.singh@nxp.com; jianjay.zhou@huawei.com
> Subject: RE: [EXT] [PATCH 1/3] 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: Fan Zhang <roy.fan.zhang@intel.com>
> > Signed-off-by: Akhil Goyal <gakhil@marvell.com>
> 
> Please fix compilation for unused function ipsec_mb_fill_error_code

^ permalink raw reply	[relevance 0%]

* RE: [EXT] [PATCH 1/3] cryptodev: rework session framework
  2022-08-29 16:06  1% ` [PATCH 1/3] cryptodev: rework session framework Fan Zhang
@ 2022-09-15  7:07  0%   ` Akhil Goyal
  2022-09-15  7:26  0%     ` Akhil Goyal
  0 siblings, 1 reply; 200+ results
From: Akhil Goyal @ 2022-09-15  7:07 UTC (permalink / raw)
  To: Fan Zhang, dev
  Cc: maxime.coquelin, chandu, ruifeng.wang, ajit.khaparde,
	Anoob Joseph, pablo.de.lara.guarch, matan, g.singh, jianjay.zhou

> 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: Fan Zhang <roy.fan.zhang@intel.com>
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>

Please fix compilation for unused function ipsec_mb_fill_error_code

^ permalink raw reply	[relevance 0%]

* Re: [PATCH v7 1/3] eventdev/timer: add periodic event timer support
  2022-09-14 15:33  5%     ` [PATCH v7 " Naga Harish K S V
@ 2022-09-15  6:40  0%       ` Jerin Jacob
  0 siblings, 0 replies; 200+ results
From: Jerin Jacob @ 2022-09-15  6:40 UTC (permalink / raw)
  To: Naga Harish K S V; +Cc: jerinj, dev, erik.g.carrillo, pbhagavatula, sthotton

On Wed, Sep 14, 2022 at 9:03 PM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> This patch adds support to configure and use periodic event
> timers in software timer adapter.
>
> The structure ``rte_event_timer_adapter_stats`` is extended
> by adding a new field, ``evtim_drop_count``. This stat
> represents the number of times an event_timer expiry event
> is dropped by the event timer adapter.
>
> update the software eventdev pmd timer_adapter_caps_get
> callback function to report the support of periodic
> event timer capability
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>

Added missing Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>

Updated the git commit as follows and applied to
dpdk-next-net-eventdev/for-main. Thanks


    eventdev/timer: add periodic event timer support

    Add support to configure and use periodic event timers in
    software timer adapter.

    The structure ``rte_event_timer_adapter_stats`` is extended
    by adding a new field, ``evtim_drop_count``. This stat
    represents the number of times an event_timer expiry event
    is dropped by the event timer adapter.

    Updated the software eventdev pmd timer_adapter_caps_get
    callback function to report the support of periodic
    event timer capability.

    Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
    Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>

> ---
>  doc/guides/rel_notes/deprecation.rst   |   7 --
>  doc/guides/rel_notes/release_22_11.rst |   3 +
>  drivers/event/sw/sw_evdev.c            |   2 +-
>  lib/eventdev/eventdev_pmd.h            |   3 +
>  lib/eventdev/rte_event_timer_adapter.c | 106 ++++++++++++++++---------
>  lib/eventdev/rte_event_timer_adapter.h |   2 +
>  lib/eventdev/rte_eventdev.c            |   6 +-
>  7 files changed, 84 insertions(+), 45 deletions(-)
>
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index e7583cae4c..fd8ef4dff7 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -186,13 +186,6 @@ Deprecation Notices
>    Event will be one of the configuration fields,
>    together with additional vector parameters.
>
> -* eventdev: The structure ``rte_event_timer_adapter_stats`` will be
> -  extended by adding a new field ``evtim_drop_count``.
> -  This counter will represent the number of times an event_timer expiry event
> -  is dropped by the timer adapter.
> -  This field will be used to add periodic mode support
> -  to the software timer adapter in DPDK 22.11.
> -
>  * eventdev: The function pointer declaration ``eventdev_stop_flush_t``
>    will be renamed to ``rte_eventdev_stop_flush_t`` 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 c32c18ff49..1bbdd7068a 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -94,6 +94,9 @@ API Changes
>  ABI Changes
>  -----------
>
> +* eventdev: Added ``evtim_drop_count`` field to ``rte_event_timer_adapter_stats``
> +  structure.
> +
>  .. This section should contain ABI changes. Sample format:
>
>     * sample: Add a short 1-2 sentence description of the ABI change
> diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
> index c9efe35bf4..e866150379 100644
> --- a/drivers/event/sw/sw_evdev.c
> +++ b/drivers/event/sw/sw_evdev.c
> @@ -564,7 +564,7 @@ sw_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t flags,
>  {
>         RTE_SET_USED(dev);
>         RTE_SET_USED(flags);
> -       *caps = 0;
> +       *caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
>
>         /* Use default SW ops */
>         *ops = NULL;
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index f514a37575..085563ff52 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -81,6 +81,9 @@ extern "C" {
>   * the ethdev to eventdev use a SW service function
>   */
>
> +#define RTE_EVENT_TIMER_ADAPTER_SW_CAP \
> +               RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC
> +
>  #define RTE_EVENTDEV_DETACHED  (0)
>  #define RTE_EVENTDEV_ATTACHED  (1)
>
> diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
> index e0d978d641..d2480060c5 100644
> --- a/lib/eventdev/rte_event_timer_adapter.c
> +++ b/lib/eventdev/rte_event_timer_adapter.c
> @@ -53,6 +53,14 @@ static const struct event_timer_adapter_ops swtim_ops;
>  #define EVTIM_SVC_LOG_DBG(...) (void)0
>  #endif
>
> +static inline enum rte_timer_type
> +get_timer_type(const struct rte_event_timer_adapter *adapter)
> +{
> +       return (adapter->data->conf.flags &
> +                       RTE_EVENT_TIMER_ADAPTER_F_PERIODIC) ?
> +                       PERIODICAL : SINGLE;
> +}
> +
>  static int
>  default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
>                      void *conf_arg)
> @@ -195,13 +203,14 @@ rte_event_timer_adapter_create_ext(
>         adapter->data->conf = *conf;  /* copy conf structure */
>
>         /* Query eventdev PMD for timer adapter capabilities and ops */
> -       ret = dev->dev_ops->timer_adapter_caps_get(dev,
> -                                                  adapter->data->conf.flags,
> -                                                  &adapter->data->caps,
> -                                                  &adapter->ops);
> -       if (ret < 0) {
> -               rte_errno = -ret;
> -               goto free_memzone;
> +       if (dev->dev_ops->timer_adapter_caps_get) {
> +               ret = dev->dev_ops->timer_adapter_caps_get(dev,
> +                               adapter->data->conf.flags,
> +                               &adapter->data->caps, &adapter->ops);
> +               if (ret < 0) {
> +                       rte_errno = -ret;
> +                       goto free_memzone;
> +               }
>         }
>
>         if (!(adapter->data->caps &
> @@ -348,13 +357,14 @@ rte_event_timer_adapter_lookup(uint16_t adapter_id)
>         dev = &rte_eventdevs[adapter->data->event_dev_id];
>
>         /* Query eventdev PMD for timer adapter capabilities and ops */
> -       ret = dev->dev_ops->timer_adapter_caps_get(dev,
> -                                                  adapter->data->conf.flags,
> -                                                  &adapter->data->caps,
> -                                                  &adapter->ops);
> -       if (ret < 0) {
> -               rte_errno = EINVAL;
> -               return NULL;
> +       if (dev->dev_ops->timer_adapter_caps_get) {
> +               ret = dev->dev_ops->timer_adapter_caps_get(dev,
> +                               adapter->data->conf.flags,
> +                               &adapter->data->caps, &adapter->ops);
> +               if (ret < 0) {
> +                       rte_errno = EINVAL;
> +                       return NULL;
> +               }
>         }
>
>         /* If eventdev PMD did not provide ops, use default software
> @@ -612,35 +622,44 @@ swtim_callback(struct rte_timer *tim)
>         uint64_t opaque;
>         int ret;
>         int n_lcores;
> +       enum rte_timer_type type;
>
>         opaque = evtim->impl_opaque[1];
>         adapter = (struct rte_event_timer_adapter *)(uintptr_t)opaque;
>         sw = swtim_pmd_priv(adapter);
> +       type = get_timer_type(adapter);
> +
> +       if (unlikely(sw->in_use[lcore].v == 0)) {
> +               sw->in_use[lcore].v = 1;
> +               n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
> +                                            __ATOMIC_RELAXED);
> +               __atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
> +                               __ATOMIC_RELAXED);
> +       }
>
>         ret = event_buffer_add(&sw->buffer, &evtim->ev);
>         if (ret < 0) {
> -               /* If event buffer is full, put timer back in list with
> -                * immediate expiry value, so that we process it again on the
> -                * next iteration.
> -                */
> -               ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0, SINGLE,
> -                                         lcore, NULL, evtim);
> -               if (ret < 0) {
> -                       EVTIM_LOG_DBG("event buffer full, failed to reset "
> -                                     "timer with immediate expiry value");
> +               if (type == SINGLE) {
> +                       /* If event buffer is full, put timer back in list with
> +                        * immediate expiry value, so that we process it again
> +                        * on the next iteration.
> +                        */
> +                       ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0,
> +                                               SINGLE, lcore, NULL, evtim);
> +                       if (ret < 0) {
> +                               EVTIM_LOG_DBG("event buffer full, failed to "
> +                                               "reset timer with immediate "
> +                                               "expiry value");
> +                       } else {
> +                               sw->stats.evtim_retry_count++;
> +                               EVTIM_LOG_DBG("event buffer full, resetting "
> +                                               "rte_timer with immediate "
> +                                               "expiry value");
> +                       }
>                 } else {
> -                       sw->stats.evtim_retry_count++;
> -                       EVTIM_LOG_DBG("event buffer full, resetting rte_timer "
> -                                     "with immediate expiry value");
> +                       sw->stats.evtim_drop_count++;
>                 }
>
> -               if (unlikely(sw->in_use[lcore].v == 0)) {
> -                       sw->in_use[lcore].v = 1;
> -                       n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
> -                                                    __ATOMIC_RELAXED);
> -                       __atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
> -                                       __ATOMIC_RELAXED);
> -               }
>         } else {
>                 EVTIM_BUF_LOG_DBG("buffered an event timer expiry event");
>
> @@ -654,10 +673,15 @@ swtim_callback(struct rte_timer *tim)
>                         sw->n_expired_timers = 0;
>                 }
>
> -               sw->expired_timers[sw->n_expired_timers++] = tim;
> +               /* Don't free rte_timer for a periodic event timer until
> +                * it is cancelled
> +                */
> +               if (type == SINGLE)
> +                       sw->expired_timers[sw->n_expired_timers++] = tim;
>                 sw->stats.evtim_exp_count++;
>
> -               __atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,
> +               if (type == SINGLE)
> +                       __atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,
>                                 __ATOMIC_RELEASE);
>         }
>
> @@ -947,6 +971,12 @@ swtim_uninit(struct rte_event_timer_adapter *adapter)
>                            swtim_free_tim,
>                            sw);
>
> +       ret = rte_timer_data_dealloc(sw->timer_data_id);
> +       if (ret < 0) {
> +               EVTIM_LOG_ERR("failed to deallocate timer data instance");
> +               return ret;
> +       }
> +
>         ret = rte_service_component_unregister(sw->service_id);
>         if (ret < 0) {
>                 EVTIM_LOG_ERR("failed to unregister service component");
> @@ -1053,6 +1083,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
>         /* Timer list for this lcore is not in use. */
>         uint16_t exp_state = 0;
>         enum rte_event_timer_state n_state;
> +       enum rte_timer_type type = SINGLE;
>
>  #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
>         /* Check that the service is running. */
> @@ -1092,6 +1123,9 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
>                 return 0;
>         }
>
> +       /* update timer type for periodic adapter */
> +       type = get_timer_type(adapter);
> +
>         for (i = 0; i < nb_evtims; i++) {
>                 n_state = __atomic_load_n(&evtims[i]->state, __ATOMIC_ACQUIRE);
>                 if (n_state == RTE_EVENT_TIMER_ARMED) {
> @@ -1135,7 +1169,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
>
>                 cycles = get_timeout_cycles(evtims[i], adapter);
>                 ret = rte_timer_alt_reset(sw->timer_data_id, tim, cycles,
> -                                         SINGLE, lcore_id, NULL, evtims[i]);
> +                                         type, lcore_id, NULL, evtims[i]);
>                 if (ret < 0) {
>                         /* tim was in RUNNING or CONFIG state */
>                         __atomic_store_n(&evtims[i]->state,
> diff --git a/lib/eventdev/rte_event_timer_adapter.h b/lib/eventdev/rte_event_timer_adapter.h
> index eab8e59a57..cd10db19e4 100644
> --- a/lib/eventdev/rte_event_timer_adapter.h
> +++ b/lib/eventdev/rte_event_timer_adapter.h
> @@ -193,6 +193,8 @@ struct rte_event_timer_adapter_stats {
>         /**< Event timer retry count */
>         uint64_t adapter_tick_count;
>         /**< Tick count for the adapter, at its resolution */
> +       uint64_t evtim_drop_count;
> +       /**< event timer expiries dropped */
>  };
>
>  struct rte_event_timer_adapter;
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 1dc4f966be..59d8b49ef6 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -139,7 +139,11 @@ rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps)
>
>         if (caps == NULL)
>                 return -EINVAL;
> -       *caps = 0;
> +
> +       if (dev->dev_ops->timer_adapter_caps_get == NULL)
> +               *caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
> +       else
> +               *caps = 0;
>
>         return dev->dev_ops->timer_adapter_caps_get ?
>                                 (*dev->dev_ops->timer_adapter_caps_get)(dev,
> --
> 2.25.1
>

^ permalink raw reply	[relevance 0%]

* Re: [PATCH v2 02/37] baseband/acc100: update ring availability calculation
  @ 2022-09-14 16:43  3%   ` Maxime Coquelin
  0 siblings, 0 replies; 200+ results
From: Maxime Coquelin @ 2022-09-14 16:43 UTC (permalink / raw)
  To: Hernan Vargas, dev, gakhil, trix; +Cc: nicolas.chautru, qi.z.zhang

Hi,

On 8/20/22 04:31, Hernan Vargas wrote:
> Refactor of the queue availability computation to prevent the
> application to dequeue more than what may have been enqueued.
> 

That sounds like a fix, is it?

If so, it should have the Fixes tag, so that existing application can
get the fix without having to upgrade to a newer DPDK version that may
have introduced API/ABI changes.

> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
>   drivers/baseband/acc100/rte_acc100_pmd.c | 39 ++++++++++++++++--------
>   1 file changed, 27 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
> index 7f698ec3d2..0598d33582 100644
> --- a/drivers/baseband/acc100/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
> @@ -3465,13 +3465,27 @@ acc100_enqueue_queue_full(struct rte_bbdev_queue_data *q_data)
>   	acc100_enqueue_status(q_data, RTE_BBDEV_ENQ_STATUS_QUEUE_FULL);
>   }
>   
> +/* Number of available descriptor in ring to enqueue */

s/descriptor/descriptors/

> +static uint32_t
> +acc100_ring_avail_enq(struct acc100_queue *q)
> +{
> +	return (q->sw_ring_depth - 1 + q->sw_ring_tail - q->sw_ring_head) % q->sw_ring_depth;
> +}
> +
> +/* Number of available descriptor in ring to dequeue */

s/descriptor/descriptors/

> +static uint32_t
> +acc100_ring_avail_deq(struct acc100_queue *q)
> +{
> +	return (q->sw_ring_depth + q->sw_ring_head - q->sw_ring_tail) % q->sw_ring_depth;
> +}
> +
>   /* Enqueue encode operations for ACC100 device in CB mode. */
>   static uint16_t
>   acc100_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,
>   		struct rte_bbdev_enc_op **ops, uint16_t num)
>   {
>   	struct acc100_queue *q = q_data->queue_private;
> -	int32_t avail = q->sw_ring_depth + q->sw_ring_tail - q->sw_ring_head;
> +	int32_t avail = acc100_ring_avail_enq(q);

acc100_ring_avail_enq returns an uint32_t, but avail is an int32_t.

I think avail should be a uint32_t and underflow check should be changed to:

	if (unlikely(avail == 0)) {

Same comment applies in other places.

Maxime


^ permalink raw reply	[relevance 3%]

* RE: [PATCH v6 1/3] eventdev/timer: add periodic event timer support
  2022-09-14 15:24  0%     ` Jerin Jacob
@ 2022-09-14 16:43  0%       ` Naga Harish K, S V
  0 siblings, 0 replies; 200+ results
From: Naga Harish K, S V @ 2022-09-14 16:43 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: jerinj, dev, Carrillo, Erik G, pbhagavatula, sthotton



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Wednesday, September 14, 2022 8:54 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; dev@dpdk.org; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; pbhagavatula@marvell.com;
> sthotton@marvell.com
> Subject: Re: [PATCH v6 1/3] eventdev/timer: add periodic event timer
> support
> 
> On Wed, Sep 14, 2022 at 7:21 PM Naga Harish K S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > This patch adds support to configure and use periodic event timers in
> > software timer adapter.
> >
> > The structure ``rte_event_timer_adapter_stats`` is extended by adding
> > a new field, ``evtim_drop_count``. This stat represents the number of
> > times an event_timer expiry event is dropped by the event timer
> > adapter.
> >
> > update the software eventdev pmd timer_adapter_caps_get callback
> > function to report the support of periodic event timer capability
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> 
> 
> Fix doc build issue
> 
> See: http://mails.dpdk.org/archives/test-report/2022-
> September/306650.html
> 
> 
 Fixed in V7 version of the patch set.

> > ---
> >  doc/guides/rel_notes/deprecation.rst   |   7 --
> >  doc/guides/rel_notes/release_22_11.rst |   2 +
> >  drivers/event/sw/sw_evdev.c            |   2 +-
> >  lib/eventdev/eventdev_pmd.h            |   3 +
> >  lib/eventdev/rte_event_timer_adapter.c | 106 ++++++++++++++++-------
> --
> >  lib/eventdev/rte_event_timer_adapter.h |   2 +
> >  lib/eventdev/rte_eventdev.c            |   6 +-
> >  7 files changed, 83 insertions(+), 45 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/deprecation.rst
> > b/doc/guides/rel_notes/deprecation.rst
> > index e7583cae4c..fd8ef4dff7 100644
> > --- a/doc/guides/rel_notes/deprecation.rst
> > +++ b/doc/guides/rel_notes/deprecation.rst
> > @@ -186,13 +186,6 @@ Deprecation Notices
> >    Event will be one of the configuration fields,
> >    together with additional vector parameters.
> >
> > -* eventdev: The structure ``rte_event_timer_adapter_stats`` will be
> > -  extended by adding a new field ``evtim_drop_count``.
> > -  This counter will represent the number of times an event_timer
> > expiry event
> > -  is dropped by the timer adapter.
> > -  This field will be used to add periodic mode support
> > -  to the software timer adapter in DPDK 22.11.
> > -
> >  * eventdev: The function pointer declaration ``eventdev_stop_flush_t``
> >    will be renamed to ``rte_eventdev_stop_flush_t`` 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 c32c18ff49..976a74b054 100644
> > --- a/doc/guides/rel_notes/release_22_11.rst
> > +++ b/doc/guides/rel_notes/release_22_11.rst
> > @@ -94,6 +94,8 @@ API Changes
> >  ABI Changes
> >  -----------
> >
> > +* eventdev: Added ``evtim_drop_count`` field to
> > +``rte_event_timer_adapter_stats``
> > +  structure.
> >  .. This section should contain ABI changes. Sample format:
> >
> >     * sample: Add a short 1-2 sentence description of the ABI change
> > diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
> > index c9efe35bf4..e866150379 100644
> > --- a/drivers/event/sw/sw_evdev.c
> > +++ b/drivers/event/sw/sw_evdev.c
> > @@ -564,7 +564,7 @@ sw_timer_adapter_caps_get(const struct
> > rte_eventdev *dev, uint64_t flags,  {
> >         RTE_SET_USED(dev);
> >         RTE_SET_USED(flags);
> > -       *caps = 0;
> > +       *caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
> >
> >         /* Use default SW ops */
> >         *ops = NULL;
> > diff --git a/lib/eventdev/eventdev_pmd.h
> b/lib/eventdev/eventdev_pmd.h
> > index f514a37575..085563ff52 100644
> > --- a/lib/eventdev/eventdev_pmd.h
> > +++ b/lib/eventdev/eventdev_pmd.h
> > @@ -81,6 +81,9 @@ extern "C" {
> >   * the ethdev to eventdev use a SW service function
> >   */
> >
> > +#define RTE_EVENT_TIMER_ADAPTER_SW_CAP \
> > +               RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC
> > +
> >  #define RTE_EVENTDEV_DETACHED  (0)
> >  #define RTE_EVENTDEV_ATTACHED  (1)
> >
> > diff --git a/lib/eventdev/rte_event_timer_adapter.c
> > b/lib/eventdev/rte_event_timer_adapter.c
> > index e0d978d641..d2480060c5 100644
> > --- a/lib/eventdev/rte_event_timer_adapter.c
> > +++ b/lib/eventdev/rte_event_timer_adapter.c
> > @@ -53,6 +53,14 @@ static const struct event_timer_adapter_ops
> > swtim_ops;  #define EVTIM_SVC_LOG_DBG(...) (void)0  #endif
> >
> > +static inline enum rte_timer_type
> > +get_timer_type(const struct rte_event_timer_adapter *adapter) {
> > +       return (adapter->data->conf.flags &
> > +                       RTE_EVENT_TIMER_ADAPTER_F_PERIODIC) ?
> > +                       PERIODICAL : SINGLE; }
> > +
> >  static int
> >  default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t
> *event_port_id,
> >                      void *conf_arg)
> > @@ -195,13 +203,14 @@ rte_event_timer_adapter_create_ext(
> >         adapter->data->conf = *conf;  /* copy conf structure */
> >
> >         /* Query eventdev PMD for timer adapter capabilities and ops */
> > -       ret = dev->dev_ops->timer_adapter_caps_get(dev,
> > -                                                  adapter->data->conf.flags,
> > -                                                  &adapter->data->caps,
> > -                                                  &adapter->ops);
> > -       if (ret < 0) {
> > -               rte_errno = -ret;
> > -               goto free_memzone;
> > +       if (dev->dev_ops->timer_adapter_caps_get) {
> > +               ret = dev->dev_ops->timer_adapter_caps_get(dev,
> > +                               adapter->data->conf.flags,
> > +                               &adapter->data->caps, &adapter->ops);
> > +               if (ret < 0) {
> > +                       rte_errno = -ret;
> > +                       goto free_memzone;
> > +               }
> >         }
> >
> >         if (!(adapter->data->caps &
> > @@ -348,13 +357,14 @@ rte_event_timer_adapter_lookup(uint16_t
> adapter_id)
> >         dev = &rte_eventdevs[adapter->data->event_dev_id];
> >
> >         /* Query eventdev PMD for timer adapter capabilities and ops */
> > -       ret = dev->dev_ops->timer_adapter_caps_get(dev,
> > -                                                  adapter->data->conf.flags,
> > -                                                  &adapter->data->caps,
> > -                                                  &adapter->ops);
> > -       if (ret < 0) {
> > -               rte_errno = EINVAL;
> > -               return NULL;
> > +       if (dev->dev_ops->timer_adapter_caps_get) {
> > +               ret = dev->dev_ops->timer_adapter_caps_get(dev,
> > +                               adapter->data->conf.flags,
> > +                               &adapter->data->caps, &adapter->ops);
> > +               if (ret < 0) {
> > +                       rte_errno = EINVAL;
> > +                       return NULL;
> > +               }
> >         }
> >
> >         /* If eventdev PMD did not provide ops, use default software
> > @@ -612,35 +622,44 @@ swtim_callback(struct rte_timer *tim)
> >         uint64_t opaque;
> >         int ret;
> >         int n_lcores;
> > +       enum rte_timer_type type;
> >
> >         opaque = evtim->impl_opaque[1];
> >         adapter = (struct rte_event_timer_adapter *)(uintptr_t)opaque;
> >         sw = swtim_pmd_priv(adapter);
> > +       type = get_timer_type(adapter);
> > +
> > +       if (unlikely(sw->in_use[lcore].v == 0)) {
> > +               sw->in_use[lcore].v = 1;
> > +               n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
> > +                                            __ATOMIC_RELAXED);
> > +               __atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
> > +                               __ATOMIC_RELAXED);
> > +       }
> >
> >         ret = event_buffer_add(&sw->buffer, &evtim->ev);
> >         if (ret < 0) {
> > -               /* If event buffer is full, put timer back in list with
> > -                * immediate expiry value, so that we process it again on the
> > -                * next iteration.
> > -                */
> > -               ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0, SINGLE,
> > -                                         lcore, NULL, evtim);
> > -               if (ret < 0) {
> > -                       EVTIM_LOG_DBG("event buffer full, failed to reset "
> > -                                     "timer with immediate expiry value");
> > +               if (type == SINGLE) {
> > +                       /* If event buffer is full, put timer back in list with
> > +                        * immediate expiry value, so that we process it again
> > +                        * on the next iteration.
> > +                        */
> > +                       ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0,
> > +                                               SINGLE, lcore, NULL, evtim);
> > +                       if (ret < 0) {
> > +                               EVTIM_LOG_DBG("event buffer full, failed to "
> > +                                               "reset timer with immediate "
> > +                                               "expiry value");
> > +                       } else {
> > +                               sw->stats.evtim_retry_count++;
> > +                               EVTIM_LOG_DBG("event buffer full, resetting "
> > +                                               "rte_timer with immediate "
> > +                                               "expiry value");
> > +                       }
> >                 } else {
> > -                       sw->stats.evtim_retry_count++;
> > -                       EVTIM_LOG_DBG("event buffer full, resetting rte_timer "
> > -                                     "with immediate expiry value");
> > +                       sw->stats.evtim_drop_count++;
> >                 }
> >
> > -               if (unlikely(sw->in_use[lcore].v == 0)) {
> > -                       sw->in_use[lcore].v = 1;
> > -                       n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
> > -                                                    __ATOMIC_RELAXED);
> > -                       __atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
> > -                                       __ATOMIC_RELAXED);
> > -               }
> >         } else {
> >                 EVTIM_BUF_LOG_DBG("buffered an event timer expiry
> > event");
> >
> > @@ -654,10 +673,15 @@ swtim_callback(struct rte_timer *tim)
> >                         sw->n_expired_timers = 0;
> >                 }
> >
> > -               sw->expired_timers[sw->n_expired_timers++] = tim;
> > +               /* Don't free rte_timer for a periodic event timer until
> > +                * it is cancelled
> > +                */
> > +               if (type == SINGLE)
> > +                       sw->expired_timers[sw->n_expired_timers++] =
> > + tim;
> >                 sw->stats.evtim_exp_count++;
> >
> > -               __atomic_store_n(&evtim->state,
> RTE_EVENT_TIMER_NOT_ARMED,
> > +               if (type == SINGLE)
> > +                       __atomic_store_n(&evtim->state,
> > + RTE_EVENT_TIMER_NOT_ARMED,
> >                                 __ATOMIC_RELEASE);
> >         }
> >
> > @@ -947,6 +971,12 @@ swtim_uninit(struct rte_event_timer_adapter
> *adapter)
> >                            swtim_free_tim,
> >                            sw);
> >
> > +       ret = rte_timer_data_dealloc(sw->timer_data_id);
> > +       if (ret < 0) {
> > +               EVTIM_LOG_ERR("failed to deallocate timer data instance");
> > +               return ret;
> > +       }
> > +
> >         ret = rte_service_component_unregister(sw->service_id);
> >         if (ret < 0) {
> >                 EVTIM_LOG_ERR("failed to unregister service
> > component"); @@ -1053,6 +1083,7 @@ __swtim_arm_burst(const struct
> rte_event_timer_adapter *adapter,
> >         /* Timer list for this lcore is not in use. */
> >         uint16_t exp_state = 0;
> >         enum rte_event_timer_state n_state;
> > +       enum rte_timer_type type = SINGLE;
> >
> >  #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
> >         /* Check that the service is running. */ @@ -1092,6 +1123,9 @@
> > __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
> >                 return 0;
> >         }
> >
> > +       /* update timer type for periodic adapter */
> > +       type = get_timer_type(adapter);
> > +
> >         for (i = 0; i < nb_evtims; i++) {
> >                 n_state = __atomic_load_n(&evtims[i]->state,
> __ATOMIC_ACQUIRE);
> >                 if (n_state == RTE_EVENT_TIMER_ARMED) { @@ -1135,7
> > +1169,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter
> > *adapter,
> >
> >                 cycles = get_timeout_cycles(evtims[i], adapter);
> >                 ret = rte_timer_alt_reset(sw->timer_data_id, tim, cycles,
> > -                                         SINGLE, lcore_id, NULL, evtims[i]);
> > +                                         type, lcore_id, NULL,
> > + evtims[i]);
> >                 if (ret < 0) {
> >                         /* tim was in RUNNING or CONFIG state */
> >                         __atomic_store_n(&evtims[i]->state,
> > diff --git a/lib/eventdev/rte_event_timer_adapter.h
> > b/lib/eventdev/rte_event_timer_adapter.h
> > index eab8e59a57..cd10db19e4 100644
> > --- a/lib/eventdev/rte_event_timer_adapter.h
> > +++ b/lib/eventdev/rte_event_timer_adapter.h
> > @@ -193,6 +193,8 @@ struct rte_event_timer_adapter_stats {
> >         /**< Event timer retry count */
> >         uint64_t adapter_tick_count;
> >         /**< Tick count for the adapter, at its resolution */
> > +       uint64_t evtim_drop_count;
> > +       /**< event timer expiries dropped */
> >  };
> >
> >  struct rte_event_timer_adapter;
> > diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> > index 1dc4f966be..59d8b49ef6 100644
> > --- a/lib/eventdev/rte_eventdev.c
> > +++ b/lib/eventdev/rte_eventdev.c
> > @@ -139,7 +139,11 @@ rte_event_timer_adapter_caps_get(uint8_t
> dev_id,
> > uint32_t *caps)
> >
> >         if (caps == NULL)
> >                 return -EINVAL;
> > -       *caps = 0;
> > +
> > +       if (dev->dev_ops->timer_adapter_caps_get == NULL)
> > +               *caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
> > +       else
> > +               *caps = 0;
> >
> >         return dev->dev_ops->timer_adapter_caps_get ?
> >
> > (*dev->dev_ops->timer_adapter_caps_get)(dev,
> > --
> > 2.25.1
> >

^ permalink raw reply	[relevance 0%]

* [PATCH v7 1/3] eventdev/timer: add periodic event timer support
  2022-09-14 13:51  5%   ` [PATCH v6 1/3] eventdev/timer: add periodic event timer support Naga Harish K S V
  2022-09-14 15:24  0%     ` Jerin Jacob
@ 2022-09-14 15:33  5%     ` Naga Harish K S V
  2022-09-15  6:40  0%       ` Jerin Jacob
  1 sibling, 1 reply; 200+ results
From: Naga Harish K S V @ 2022-09-14 15:33 UTC (permalink / raw)
  To: jerinj; +Cc: dev, erik.g.carrillo, pbhagavatula, sthotton

This patch adds support to configure and use periodic event
timers in software timer adapter.

The structure ``rte_event_timer_adapter_stats`` is extended
by adding a new field, ``evtim_drop_count``. This stat
represents the number of times an event_timer expiry event
is dropped by the event timer adapter.

update the software eventdev pmd timer_adapter_caps_get
callback function to report the support of periodic
event timer capability

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
 doc/guides/rel_notes/deprecation.rst   |   7 --
 doc/guides/rel_notes/release_22_11.rst |   3 +
 drivers/event/sw/sw_evdev.c            |   2 +-
 lib/eventdev/eventdev_pmd.h            |   3 +
 lib/eventdev/rte_event_timer_adapter.c | 106 ++++++++++++++++---------
 lib/eventdev/rte_event_timer_adapter.h |   2 +
 lib/eventdev/rte_eventdev.c            |   6 +-
 7 files changed, 84 insertions(+), 45 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..fd8ef4dff7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -186,13 +186,6 @@ Deprecation Notices
   Event will be one of the configuration fields,
   together with additional vector parameters.
 
-* eventdev: The structure ``rte_event_timer_adapter_stats`` will be
-  extended by adding a new field ``evtim_drop_count``.
-  This counter will represent the number of times an event_timer expiry event
-  is dropped by the timer adapter.
-  This field will be used to add periodic mode support
-  to the software timer adapter in DPDK 22.11.
-
 * eventdev: The function pointer declaration ``eventdev_stop_flush_t``
   will be renamed to ``rte_eventdev_stop_flush_t`` 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 c32c18ff49..1bbdd7068a 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -94,6 +94,9 @@ API Changes
 ABI Changes
 -----------
 
+* eventdev: Added ``evtim_drop_count`` field to ``rte_event_timer_adapter_stats``
+  structure.
+
 .. This section should contain ABI changes. Sample format:
 
    * sample: Add a short 1-2 sentence description of the ABI change
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index c9efe35bf4..e866150379 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -564,7 +564,7 @@ sw_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t flags,
 {
 	RTE_SET_USED(dev);
 	RTE_SET_USED(flags);
-	*caps = 0;
+	*caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
 
 	/* Use default SW ops */
 	*ops = NULL;
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index f514a37575..085563ff52 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -81,6 +81,9 @@ extern "C" {
  * the ethdev to eventdev use a SW service function
  */
 
+#define RTE_EVENT_TIMER_ADAPTER_SW_CAP \
+		RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC
+
 #define RTE_EVENTDEV_DETACHED  (0)
 #define RTE_EVENTDEV_ATTACHED  (1)
 
diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index e0d978d641..d2480060c5 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -53,6 +53,14 @@ static const struct event_timer_adapter_ops swtim_ops;
 #define EVTIM_SVC_LOG_DBG(...) (void)0
 #endif
 
+static inline enum rte_timer_type
+get_timer_type(const struct rte_event_timer_adapter *adapter)
+{
+	return (adapter->data->conf.flags &
+			RTE_EVENT_TIMER_ADAPTER_F_PERIODIC) ?
+			PERIODICAL : SINGLE;
+}
+
 static int
 default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
 		     void *conf_arg)
@@ -195,13 +203,14 @@ rte_event_timer_adapter_create_ext(
 	adapter->data->conf = *conf;  /* copy conf structure */
 
 	/* Query eventdev PMD for timer adapter capabilities and ops */
-	ret = dev->dev_ops->timer_adapter_caps_get(dev,
-						   adapter->data->conf.flags,
-						   &adapter->data->caps,
-						   &adapter->ops);
-	if (ret < 0) {
-		rte_errno = -ret;
-		goto free_memzone;
+	if (dev->dev_ops->timer_adapter_caps_get) {
+		ret = dev->dev_ops->timer_adapter_caps_get(dev,
+				adapter->data->conf.flags,
+				&adapter->data->caps, &adapter->ops);
+		if (ret < 0) {
+			rte_errno = -ret;
+			goto free_memzone;
+		}
 	}
 
 	if (!(adapter->data->caps &
@@ -348,13 +357,14 @@ rte_event_timer_adapter_lookup(uint16_t adapter_id)
 	dev = &rte_eventdevs[adapter->data->event_dev_id];
 
 	/* Query eventdev PMD for timer adapter capabilities and ops */
-	ret = dev->dev_ops->timer_adapter_caps_get(dev,
-						   adapter->data->conf.flags,
-						   &adapter->data->caps,
-						   &adapter->ops);
-	if (ret < 0) {
-		rte_errno = EINVAL;
-		return NULL;
+	if (dev->dev_ops->timer_adapter_caps_get) {
+		ret = dev->dev_ops->timer_adapter_caps_get(dev,
+				adapter->data->conf.flags,
+				&adapter->data->caps, &adapter->ops);
+		if (ret < 0) {
+			rte_errno = EINVAL;
+			return NULL;
+		}
 	}
 
 	/* If eventdev PMD did not provide ops, use default software
@@ -612,35 +622,44 @@ swtim_callback(struct rte_timer *tim)
 	uint64_t opaque;
 	int ret;
 	int n_lcores;
+	enum rte_timer_type type;
 
 	opaque = evtim->impl_opaque[1];
 	adapter = (struct rte_event_timer_adapter *)(uintptr_t)opaque;
 	sw = swtim_pmd_priv(adapter);
+	type = get_timer_type(adapter);
+
+	if (unlikely(sw->in_use[lcore].v == 0)) {
+		sw->in_use[lcore].v = 1;
+		n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
+					     __ATOMIC_RELAXED);
+		__atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
+				__ATOMIC_RELAXED);
+	}
 
 	ret = event_buffer_add(&sw->buffer, &evtim->ev);
 	if (ret < 0) {
-		/* If event buffer is full, put timer back in list with
-		 * immediate expiry value, so that we process it again on the
-		 * next iteration.
-		 */
-		ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0, SINGLE,
-					  lcore, NULL, evtim);
-		if (ret < 0) {
-			EVTIM_LOG_DBG("event buffer full, failed to reset "
-				      "timer with immediate expiry value");
+		if (type == SINGLE) {
+			/* If event buffer is full, put timer back in list with
+			 * immediate expiry value, so that we process it again
+			 * on the next iteration.
+			 */
+			ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0,
+						SINGLE,	lcore, NULL, evtim);
+			if (ret < 0) {
+				EVTIM_LOG_DBG("event buffer full, failed to "
+						"reset timer with immediate "
+						"expiry value");
+			} else {
+				sw->stats.evtim_retry_count++;
+				EVTIM_LOG_DBG("event buffer full, resetting "
+						"rte_timer with immediate "
+						"expiry value");
+			}
 		} else {
-			sw->stats.evtim_retry_count++;
-			EVTIM_LOG_DBG("event buffer full, resetting rte_timer "
-				      "with immediate expiry value");
+			sw->stats.evtim_drop_count++;
 		}
 
-		if (unlikely(sw->in_use[lcore].v == 0)) {
-			sw->in_use[lcore].v = 1;
-			n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
-						     __ATOMIC_RELAXED);
-			__atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
-					__ATOMIC_RELAXED);
-		}
 	} else {
 		EVTIM_BUF_LOG_DBG("buffered an event timer expiry event");
 
@@ -654,10 +673,15 @@ swtim_callback(struct rte_timer *tim)
 			sw->n_expired_timers = 0;
 		}
 
-		sw->expired_timers[sw->n_expired_timers++] = tim;
+		/* Don't free rte_timer for a periodic event timer until
+		 * it is cancelled
+		 */
+		if (type == SINGLE)
+			sw->expired_timers[sw->n_expired_timers++] = tim;
 		sw->stats.evtim_exp_count++;
 
-		__atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,
+		if (type == SINGLE)
+			__atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,
 				__ATOMIC_RELEASE);
 	}
 
@@ -947,6 +971,12 @@ swtim_uninit(struct rte_event_timer_adapter *adapter)
 			   swtim_free_tim,
 			   sw);
 
+	ret = rte_timer_data_dealloc(sw->timer_data_id);
+	if (ret < 0) {
+		EVTIM_LOG_ERR("failed to deallocate timer data instance");
+		return ret;
+	}
+
 	ret = rte_service_component_unregister(sw->service_id);
 	if (ret < 0) {
 		EVTIM_LOG_ERR("failed to unregister service component");
@@ -1053,6 +1083,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
 	/* Timer list for this lcore is not in use. */
 	uint16_t exp_state = 0;
 	enum rte_event_timer_state n_state;
+	enum rte_timer_type type = SINGLE;
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 	/* Check that the service is running. */
@@ -1092,6 +1123,9 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
 		return 0;
 	}
 
+	/* update timer type for periodic adapter */
+	type = get_timer_type(adapter);
+
 	for (i = 0; i < nb_evtims; i++) {
 		n_state = __atomic_load_n(&evtims[i]->state, __ATOMIC_ACQUIRE);
 		if (n_state == RTE_EVENT_TIMER_ARMED) {
@@ -1135,7 +1169,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
 
 		cycles = get_timeout_cycles(evtims[i], adapter);
 		ret = rte_timer_alt_reset(sw->timer_data_id, tim, cycles,
-					  SINGLE, lcore_id, NULL, evtims[i]);
+					  type, lcore_id, NULL, evtims[i]);
 		if (ret < 0) {
 			/* tim was in RUNNING or CONFIG state */
 			__atomic_store_n(&evtims[i]->state,
diff --git a/lib/eventdev/rte_event_timer_adapter.h b/lib/eventdev/rte_event_timer_adapter.h
index eab8e59a57..cd10db19e4 100644
--- a/lib/eventdev/rte_event_timer_adapter.h
+++ b/lib/eventdev/rte_event_timer_adapter.h
@@ -193,6 +193,8 @@ struct rte_event_timer_adapter_stats {
 	/**< Event timer retry count */
 	uint64_t adapter_tick_count;
 	/**< Tick count for the adapter, at its resolution */
+	uint64_t evtim_drop_count;
+	/**< event timer expiries dropped */
 };
 
 struct rte_event_timer_adapter;
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 1dc4f966be..59d8b49ef6 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -139,7 +139,11 @@ rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps)
 
 	if (caps == NULL)
 		return -EINVAL;
-	*caps = 0;
+
+	if (dev->dev_ops->timer_adapter_caps_get == NULL)
+		*caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
+	else
+		*caps = 0;
 
 	return dev->dev_ops->timer_adapter_caps_get ?
 				(*dev->dev_ops->timer_adapter_caps_get)(dev,
-- 
2.25.1


^ permalink raw reply	[relevance 5%]

* Re: [PATCH v6 1/3] eventdev/timer: add periodic event timer support
  2022-09-14 13:51  5%   ` [PATCH v6 1/3] eventdev/timer: add periodic event timer support Naga Harish K S V
@ 2022-09-14 15:24  0%     ` Jerin Jacob
  2022-09-14 16:43  0%       ` Naga Harish K, S V
  2022-09-14 15:33  5%     ` [PATCH v7 " Naga Harish K S V
  1 sibling, 1 reply; 200+ results
From: Jerin Jacob @ 2022-09-14 15:24 UTC (permalink / raw)
  To: Naga Harish K S V; +Cc: jerinj, dev, erik.g.carrillo, pbhagavatula, sthotton

On Wed, Sep 14, 2022 at 7:21 PM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> This patch adds support to configure and use periodic event
> timers in software timer adapter.
>
> The structure ``rte_event_timer_adapter_stats`` is extended
> by adding a new field, ``evtim_drop_count``. This stat
> represents the number of times an event_timer expiry event
> is dropped by the event timer adapter.
>
> update the software eventdev pmd timer_adapter_caps_get
> callback function to report the support of periodic
> event timer capability
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>


Fix doc build issue

See: http://mails.dpdk.org/archives/test-report/2022-September/306650.html


> ---
>  doc/guides/rel_notes/deprecation.rst   |   7 --
>  doc/guides/rel_notes/release_22_11.rst |   2 +
>  drivers/event/sw/sw_evdev.c            |   2 +-
>  lib/eventdev/eventdev_pmd.h            |   3 +
>  lib/eventdev/rte_event_timer_adapter.c | 106 ++++++++++++++++---------
>  lib/eventdev/rte_event_timer_adapter.h |   2 +
>  lib/eventdev/rte_eventdev.c            |   6 +-
>  7 files changed, 83 insertions(+), 45 deletions(-)
>
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index e7583cae4c..fd8ef4dff7 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -186,13 +186,6 @@ Deprecation Notices
>    Event will be one of the configuration fields,
>    together with additional vector parameters.
>
> -* eventdev: The structure ``rte_event_timer_adapter_stats`` will be
> -  extended by adding a new field ``evtim_drop_count``.
> -  This counter will represent the number of times an event_timer expiry event
> -  is dropped by the timer adapter.
> -  This field will be used to add periodic mode support
> -  to the software timer adapter in DPDK 22.11.
> -
>  * eventdev: The function pointer declaration ``eventdev_stop_flush_t``
>    will be renamed to ``rte_eventdev_stop_flush_t`` 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 c32c18ff49..976a74b054 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -94,6 +94,8 @@ API Changes
>  ABI Changes
>  -----------
>
> +* eventdev: Added ``evtim_drop_count`` field to ``rte_event_timer_adapter_stats``
> +  structure.
>  .. This section should contain ABI changes. Sample format:
>
>     * sample: Add a short 1-2 sentence description of the ABI change
> diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
> index c9efe35bf4..e866150379 100644
> --- a/drivers/event/sw/sw_evdev.c
> +++ b/drivers/event/sw/sw_evdev.c
> @@ -564,7 +564,7 @@ sw_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t flags,
>  {
>         RTE_SET_USED(dev);
>         RTE_SET_USED(flags);
> -       *caps = 0;
> +       *caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
>
>         /* Use default SW ops */
>         *ops = NULL;
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index f514a37575..085563ff52 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -81,6 +81,9 @@ extern "C" {
>   * the ethdev to eventdev use a SW service function
>   */
>
> +#define RTE_EVENT_TIMER_ADAPTER_SW_CAP \
> +               RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC
> +
>  #define RTE_EVENTDEV_DETACHED  (0)
>  #define RTE_EVENTDEV_ATTACHED  (1)
>
> diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
> index e0d978d641..d2480060c5 100644
> --- a/lib/eventdev/rte_event_timer_adapter.c
> +++ b/lib/eventdev/rte_event_timer_adapter.c
> @@ -53,6 +53,14 @@ static const struct event_timer_adapter_ops swtim_ops;
>  #define EVTIM_SVC_LOG_DBG(...) (void)0
>  #endif
>
> +static inline enum rte_timer_type
> +get_timer_type(const struct rte_event_timer_adapter *adapter)
> +{
> +       return (adapter->data->conf.flags &
> +                       RTE_EVENT_TIMER_ADAPTER_F_PERIODIC) ?
> +                       PERIODICAL : SINGLE;
> +}
> +
>  static int
>  default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
>                      void *conf_arg)
> @@ -195,13 +203,14 @@ rte_event_timer_adapter_create_ext(
>         adapter->data->conf = *conf;  /* copy conf structure */
>
>         /* Query eventdev PMD for timer adapter capabilities and ops */
> -       ret = dev->dev_ops->timer_adapter_caps_get(dev,
> -                                                  adapter->data->conf.flags,
> -                                                  &adapter->data->caps,
> -                                                  &adapter->ops);
> -       if (ret < 0) {
> -               rte_errno = -ret;
> -               goto free_memzone;
> +       if (dev->dev_ops->timer_adapter_caps_get) {
> +               ret = dev->dev_ops->timer_adapter_caps_get(dev,
> +                               adapter->data->conf.flags,
> +                               &adapter->data->caps, &adapter->ops);
> +               if (ret < 0) {
> +                       rte_errno = -ret;
> +                       goto free_memzone;
> +               }
>         }
>
>         if (!(adapter->data->caps &
> @@ -348,13 +357,14 @@ rte_event_timer_adapter_lookup(uint16_t adapter_id)
>         dev = &rte_eventdevs[adapter->data->event_dev_id];
>
>         /* Query eventdev PMD for timer adapter capabilities and ops */
> -       ret = dev->dev_ops->timer_adapter_caps_get(dev,
> -                                                  adapter->data->conf.flags,
> -                                                  &adapter->data->caps,
> -                                                  &adapter->ops);
> -       if (ret < 0) {
> -               rte_errno = EINVAL;
> -               return NULL;
> +       if (dev->dev_ops->timer_adapter_caps_get) {
> +               ret = dev->dev_ops->timer_adapter_caps_get(dev,
> +                               adapter->data->conf.flags,
> +                               &adapter->data->caps, &adapter->ops);
> +               if (ret < 0) {
> +                       rte_errno = EINVAL;
> +                       return NULL;
> +               }
>         }
>
>         /* If eventdev PMD did not provide ops, use default software
> @@ -612,35 +622,44 @@ swtim_callback(struct rte_timer *tim)
>         uint64_t opaque;
>         int ret;
>         int n_lcores;
> +       enum rte_timer_type type;
>
>         opaque = evtim->impl_opaque[1];
>         adapter = (struct rte_event_timer_adapter *)(uintptr_t)opaque;
>         sw = swtim_pmd_priv(adapter);
> +       type = get_timer_type(adapter);
> +
> +       if (unlikely(sw->in_use[lcore].v == 0)) {
> +               sw->in_use[lcore].v = 1;
> +               n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
> +                                            __ATOMIC_RELAXED);
> +               __atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
> +                               __ATOMIC_RELAXED);
> +       }
>
>         ret = event_buffer_add(&sw->buffer, &evtim->ev);
>         if (ret < 0) {
> -               /* If event buffer is full, put timer back in list with
> -                * immediate expiry value, so that we process it again on the
> -                * next iteration.
> -                */
> -               ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0, SINGLE,
> -                                         lcore, NULL, evtim);
> -               if (ret < 0) {
> -                       EVTIM_LOG_DBG("event buffer full, failed to reset "
> -                                     "timer with immediate expiry value");
> +               if (type == SINGLE) {
> +                       /* If event buffer is full, put timer back in list with
> +                        * immediate expiry value, so that we process it again
> +                        * on the next iteration.
> +                        */
> +                       ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0,
> +                                               SINGLE, lcore, NULL, evtim);
> +                       if (ret < 0) {
> +                               EVTIM_LOG_DBG("event buffer full, failed to "
> +                                               "reset timer with immediate "
> +                                               "expiry value");
> +                       } else {
> +                               sw->stats.evtim_retry_count++;
> +                               EVTIM_LOG_DBG("event buffer full, resetting "
> +                                               "rte_timer with immediate "
> +                                               "expiry value");
> +                       }
>                 } else {
> -                       sw->stats.evtim_retry_count++;
> -                       EVTIM_LOG_DBG("event buffer full, resetting rte_timer "
> -                                     "with immediate expiry value");
> +                       sw->stats.evtim_drop_count++;
>                 }
>
> -               if (unlikely(sw->in_use[lcore].v == 0)) {
> -                       sw->in_use[lcore].v = 1;
> -                       n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
> -                                                    __ATOMIC_RELAXED);
> -                       __atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
> -                                       __ATOMIC_RELAXED);
> -               }
>         } else {
>                 EVTIM_BUF_LOG_DBG("buffered an event timer expiry event");
>
> @@ -654,10 +673,15 @@ swtim_callback(struct rte_timer *tim)
>                         sw->n_expired_timers = 0;
>                 }
>
> -               sw->expired_timers[sw->n_expired_timers++] = tim;
> +               /* Don't free rte_timer for a periodic event timer until
> +                * it is cancelled
> +                */
> +               if (type == SINGLE)
> +                       sw->expired_timers[sw->n_expired_timers++] = tim;
>                 sw->stats.evtim_exp_count++;
>
> -               __atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,
> +               if (type == SINGLE)
> +                       __atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,
>                                 __ATOMIC_RELEASE);
>         }
>
> @@ -947,6 +971,12 @@ swtim_uninit(struct rte_event_timer_adapter *adapter)
>                            swtim_free_tim,
>                            sw);
>
> +       ret = rte_timer_data_dealloc(sw->timer_data_id);
> +       if (ret < 0) {
> +               EVTIM_LOG_ERR("failed to deallocate timer data instance");
> +               return ret;
> +       }
> +
>         ret = rte_service_component_unregister(sw->service_id);
>         if (ret < 0) {
>                 EVTIM_LOG_ERR("failed to unregister service component");
> @@ -1053,6 +1083,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
>         /* Timer list for this lcore is not in use. */
>         uint16_t exp_state = 0;
>         enum rte_event_timer_state n_state;
> +       enum rte_timer_type type = SINGLE;
>
>  #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
>         /* Check that the service is running. */
> @@ -1092,6 +1123,9 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
>                 return 0;
>         }
>
> +       /* update timer type for periodic adapter */
> +       type = get_timer_type(adapter);
> +
>         for (i = 0; i < nb_evtims; i++) {
>                 n_state = __atomic_load_n(&evtims[i]->state, __ATOMIC_ACQUIRE);
>                 if (n_state == RTE_EVENT_TIMER_ARMED) {
> @@ -1135,7 +1169,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
>
>                 cycles = get_timeout_cycles(evtims[i], adapter);
>                 ret = rte_timer_alt_reset(sw->timer_data_id, tim, cycles,
> -                                         SINGLE, lcore_id, NULL, evtims[i]);
> +                                         type, lcore_id, NULL, evtims[i]);
>                 if (ret < 0) {
>                         /* tim was in RUNNING or CONFIG state */
>                         __atomic_store_n(&evtims[i]->state,
> diff --git a/lib/eventdev/rte_event_timer_adapter.h b/lib/eventdev/rte_event_timer_adapter.h
> index eab8e59a57..cd10db19e4 100644
> --- a/lib/eventdev/rte_event_timer_adapter.h
> +++ b/lib/eventdev/rte_event_timer_adapter.h
> @@ -193,6 +193,8 @@ struct rte_event_timer_adapter_stats {
>         /**< Event timer retry count */
>         uint64_t adapter_tick_count;
>         /**< Tick count for the adapter, at its resolution */
> +       uint64_t evtim_drop_count;
> +       /**< event timer expiries dropped */
>  };
>
>  struct rte_event_timer_adapter;
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 1dc4f966be..59d8b49ef6 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -139,7 +139,11 @@ rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps)
>
>         if (caps == NULL)
>                 return -EINVAL;
> -       *caps = 0;
> +
> +       if (dev->dev_ops->timer_adapter_caps_get == NULL)
> +               *caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
> +       else
> +               *caps = 0;
>
>         return dev->dev_ops->timer_adapter_caps_get ?
>                                 (*dev->dev_ops->timer_adapter_caps_get)(dev,
> --
> 2.25.1
>

^ permalink raw reply	[relevance 0%]

* RE: [PATCH v5 4/4] doc: remove deprecation notice
  2022-09-14 12:41  3%     ` Jerin Jacob
@ 2022-09-14 13:54  0%       ` Naga Harish K, S V
  0 siblings, 0 replies; 200+ results
From: Naga Harish K, S V @ 2022-09-14 13:54 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: jerinj, dev, Carrillo, Erik G, pbhagavatula, sthotton



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Wednesday, September 14, 2022 6:11 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; dev@dpdk.org; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; pbhagavatula@marvell.com;
> sthotton@marvell.com
> Subject: Re: [PATCH v5 4/4] doc: remove deprecation notice
> 
> On Wed, Sep 14, 2022 at 10:46 AM Naga Harish K S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > This patch removes event timer expiry drop stat deprecation
> > notification.
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > ---
> >  doc/guides/rel_notes/deprecation.rst | 7 -------
> 
> Please squash this patch with 1/5.
> Also, Please update "ABI Changes" in
> doc/guides/rel_notes/release_22_11.rst.
> See
> https://patches.dpdk.org/project/dpdk/patch/dcd3cf0ec034632f97223bb9df
> 389f9cedf9753c.1660116951.git.sthotton@marvell.com/
> as example.
> 
> 
V6 version is posted with requested changes.

> >  1 file changed, 7 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/deprecation.rst
> > b/doc/guides/rel_notes/deprecation.rst
> > index e7583cae4c..fd8ef4dff7 100644
> > --- a/doc/guides/rel_notes/deprecation.rst
> > +++ b/doc/guides/rel_notes/deprecation.rst
> > @@ -186,13 +186,6 @@ Deprecation Notices
> >    Event will be one of the configuration fields,
> >    together with additional vector parameters.
> >
> > -* eventdev: The structure ``rte_event_timer_adapter_stats`` will be
> > -  extended by adding a new field ``evtim_drop_count``.
> > -  This counter will represent the number of times an event_timer
> > expiry event
> > -  is dropped by the timer adapter.
> > -  This field will be used to add periodic mode support
> > -  to the software timer adapter in DPDK 22.11.
> > -
> >  * eventdev: The function pointer declaration ``eventdev_stop_flush_t``
> >    will be renamed to ``rte_eventdev_stop_flush_t`` in DPDK 22.11.
> >
> > --
> > 2.25.1
> >

^ permalink raw reply	[relevance 0%]

* [PATCH v6 1/3] eventdev/timer: add periodic event timer support
    @ 2022-09-14 13:51  5%   ` Naga Harish K S V
  2022-09-14 15:24  0%     ` Jerin Jacob
  2022-09-14 15:33  5%     ` [PATCH v7 " Naga Harish K S V
  1 sibling, 2 replies; 200+ results
From: Naga Harish K S V @ 2022-09-14 13:51 UTC (permalink / raw)
  To: jerinj; +Cc: dev, erik.g.carrillo, pbhagavatula, sthotton

This patch adds support to configure and use periodic event
timers in software timer adapter.

The structure ``rte_event_timer_adapter_stats`` is extended
by adding a new field, ``evtim_drop_count``. This stat
represents the number of times an event_timer expiry event
is dropped by the event timer adapter.

update the software eventdev pmd timer_adapter_caps_get
callback function to report the support of periodic
event timer capability

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
 doc/guides/rel_notes/deprecation.rst   |   7 --
 doc/guides/rel_notes/release_22_11.rst |   2 +
 drivers/event/sw/sw_evdev.c            |   2 +-
 lib/eventdev/eventdev_pmd.h            |   3 +
 lib/eventdev/rte_event_timer_adapter.c | 106 ++++++++++++++++---------
 lib/eventdev/rte_event_timer_adapter.h |   2 +
 lib/eventdev/rte_eventdev.c            |   6 +-
 7 files changed, 83 insertions(+), 45 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..fd8ef4dff7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -186,13 +186,6 @@ Deprecation Notices
   Event will be one of the configuration fields,
   together with additional vector parameters.
 
-* eventdev: The structure ``rte_event_timer_adapter_stats`` will be
-  extended by adding a new field ``evtim_drop_count``.
-  This counter will represent the number of times an event_timer expiry event
-  is dropped by the timer adapter.
-  This field will be used to add periodic mode support
-  to the software timer adapter in DPDK 22.11.
-
 * eventdev: The function pointer declaration ``eventdev_stop_flush_t``
   will be renamed to ``rte_eventdev_stop_flush_t`` 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 c32c18ff49..976a74b054 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -94,6 +94,8 @@ API Changes
 ABI Changes
 -----------
 
+* eventdev: Added ``evtim_drop_count`` field to ``rte_event_timer_adapter_stats``
+  structure.
 .. This section should contain ABI changes. Sample format:
 
    * sample: Add a short 1-2 sentence description of the ABI change
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index c9efe35bf4..e866150379 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -564,7 +564,7 @@ sw_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t flags,
 {
 	RTE_SET_USED(dev);
 	RTE_SET_USED(flags);
-	*caps = 0;
+	*caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
 
 	/* Use default SW ops */
 	*ops = NULL;
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index f514a37575..085563ff52 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -81,6 +81,9 @@ extern "C" {
  * the ethdev to eventdev use a SW service function
  */
 
+#define RTE_EVENT_TIMER_ADAPTER_SW_CAP \
+		RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC
+
 #define RTE_EVENTDEV_DETACHED  (0)
 #define RTE_EVENTDEV_ATTACHED  (1)
 
diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index e0d978d641..d2480060c5 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -53,6 +53,14 @@ static const struct event_timer_adapter_ops swtim_ops;
 #define EVTIM_SVC_LOG_DBG(...) (void)0
 #endif
 
+static inline enum rte_timer_type
+get_timer_type(const struct rte_event_timer_adapter *adapter)
+{
+	return (adapter->data->conf.flags &
+			RTE_EVENT_TIMER_ADAPTER_F_PERIODIC) ?
+			PERIODICAL : SINGLE;
+}
+
 static int
 default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
 		     void *conf_arg)
@@ -195,13 +203,14 @@ rte_event_timer_adapter_create_ext(
 	adapter->data->conf = *conf;  /* copy conf structure */
 
 	/* Query eventdev PMD for timer adapter capabilities and ops */
-	ret = dev->dev_ops->timer_adapter_caps_get(dev,
-						   adapter->data->conf.flags,
-						   &adapter->data->caps,
-						   &adapter->ops);
-	if (ret < 0) {
-		rte_errno = -ret;
-		goto free_memzone;
+	if (dev->dev_ops->timer_adapter_caps_get) {
+		ret = dev->dev_ops->timer_adapter_caps_get(dev,
+				adapter->data->conf.flags,
+				&adapter->data->caps, &adapter->ops);
+		if (ret < 0) {
+			rte_errno = -ret;
+			goto free_memzone;
+		}
 	}
 
 	if (!(adapter->data->caps &
@@ -348,13 +357,14 @@ rte_event_timer_adapter_lookup(uint16_t adapter_id)
 	dev = &rte_eventdevs[adapter->data->event_dev_id];
 
 	/* Query eventdev PMD for timer adapter capabilities and ops */
-	ret = dev->dev_ops->timer_adapter_caps_get(dev,
-						   adapter->data->conf.flags,
-						   &adapter->data->caps,
-						   &adapter->ops);
-	if (ret < 0) {
-		rte_errno = EINVAL;
-		return NULL;
+	if (dev->dev_ops->timer_adapter_caps_get) {
+		ret = dev->dev_ops->timer_adapter_caps_get(dev,
+				adapter->data->conf.flags,
+				&adapter->data->caps, &adapter->ops);
+		if (ret < 0) {
+			rte_errno = EINVAL;
+			return NULL;
+		}
 	}
 
 	/* If eventdev PMD did not provide ops, use default software
@@ -612,35 +622,44 @@ swtim_callback(struct rte_timer *tim)
 	uint64_t opaque;
 	int ret;
 	int n_lcores;
+	enum rte_timer_type type;
 
 	opaque = evtim->impl_opaque[1];
 	adapter = (struct rte_event_timer_adapter *)(uintptr_t)opaque;
 	sw = swtim_pmd_priv(adapter);
+	type = get_timer_type(adapter);
+
+	if (unlikely(sw->in_use[lcore].v == 0)) {
+		sw->in_use[lcore].v = 1;
+		n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
+					     __ATOMIC_RELAXED);
+		__atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
+				__ATOMIC_RELAXED);
+	}
 
 	ret = event_buffer_add(&sw->buffer, &evtim->ev);
 	if (ret < 0) {
-		/* If event buffer is full, put timer back in list with
-		 * immediate expiry value, so that we process it again on the
-		 * next iteration.
-		 */
-		ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0, SINGLE,
-					  lcore, NULL, evtim);
-		if (ret < 0) {
-			EVTIM_LOG_DBG("event buffer full, failed to reset "
-				      "timer with immediate expiry value");
+		if (type == SINGLE) {
+			/* If event buffer is full, put timer back in list with
+			 * immediate expiry value, so that we process it again
+			 * on the next iteration.
+			 */
+			ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0,
+						SINGLE,	lcore, NULL, evtim);
+			if (ret < 0) {
+				EVTIM_LOG_DBG("event buffer full, failed to "
+						"reset timer with immediate "
+						"expiry value");
+			} else {
+				sw->stats.evtim_retry_count++;
+				EVTIM_LOG_DBG("event buffer full, resetting "
+						"rte_timer with immediate "
+						"expiry value");
+			}
 		} else {
-			sw->stats.evtim_retry_count++;
-			EVTIM_LOG_DBG("event buffer full, resetting rte_timer "
-				      "with immediate expiry value");
+			sw->stats.evtim_drop_count++;
 		}
 
-		if (unlikely(sw->in_use[lcore].v == 0)) {
-			sw->in_use[lcore].v = 1;
-			n_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,
-						     __ATOMIC_RELAXED);
-			__atomic_store_n(&sw->poll_lcores[n_lcores], lcore,
-					__ATOMIC_RELAXED);
-		}
 	} else {
 		EVTIM_BUF_LOG_DBG("buffered an event timer expiry event");
 
@@ -654,10 +673,15 @@ swtim_callback(struct rte_timer *tim)
 			sw->n_expired_timers = 0;
 		}
 
-		sw->expired_timers[sw->n_expired_timers++] = tim;
+		/* Don't free rte_timer for a periodic event timer until
+		 * it is cancelled
+		 */
+		if (type == SINGLE)
+			sw->expired_timers[sw->n_expired_timers++] = tim;
 		sw->stats.evtim_exp_count++;
 
-		__atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,
+		if (type == SINGLE)
+			__atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,
 				__ATOMIC_RELEASE);
 	}
 
@@ -947,6 +971,12 @@ swtim_uninit(struct rte_event_timer_adapter *adapter)
 			   swtim_free_tim,
 			   sw);
 
+	ret = rte_timer_data_dealloc(sw->timer_data_id);
+	if (ret < 0) {
+		EVTIM_LOG_ERR("failed to deallocate timer data instance");
+		return ret;
+	}
+
 	ret = rte_service_component_unregister(sw->service_id);
 	if (ret < 0) {
 		EVTIM_LOG_ERR("failed to unregister service component");
@@ -1053,6 +1083,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
 	/* Timer list for this lcore is not in use. */
 	uint16_t exp_state = 0;
 	enum rte_event_timer_state n_state;
+	enum rte_timer_type type = SINGLE;
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 	/* Check that the service is running. */
@@ -1092,6 +1123,9 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
 		return 0;
 	}
 
+	/* update timer type for periodic adapter */
+	type = get_timer_type(adapter);
+
 	for (i = 0; i < nb_evtims; i++) {
 		n_state = __atomic_load_n(&evtims[i]->state, __ATOMIC_ACQUIRE);
 		if (n_state == RTE_EVENT_TIMER_ARMED) {
@@ -1135,7 +1169,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,
 
 		cycles = get_timeout_cycles(evtims[i], adapter);
 		ret = rte_timer_alt_reset(sw->timer_data_id, tim, cycles,
-					  SINGLE, lcore_id, NULL, evtims[i]);
+					  type, lcore_id, NULL, evtims[i]);
 		if (ret < 0) {
 			/* tim was in RUNNING or CONFIG state */
 			__atomic_store_n(&evtims[i]->state,
diff --git a/lib/eventdev/rte_event_timer_adapter.h b/lib/eventdev/rte_event_timer_adapter.h
index eab8e59a57..cd10db19e4 100644
--- a/lib/eventdev/rte_event_timer_adapter.h
+++ b/lib/eventdev/rte_event_timer_adapter.h
@@ -193,6 +193,8 @@ struct rte_event_timer_adapter_stats {
 	/**< Event timer retry count */
 	uint64_t adapter_tick_count;
 	/**< Tick count for the adapter, at its resolution */
+	uint64_t evtim_drop_count;
+	/**< event timer expiries dropped */
 };
 
 struct rte_event_timer_adapter;
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 1dc4f966be..59d8b49ef6 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -139,7 +139,11 @@ rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps)
 
 	if (caps == NULL)
 		return -EINVAL;
-	*caps = 0;
+
+	if (dev->dev_ops->timer_adapter_caps_get == NULL)
+		*caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;
+	else
+		*caps = 0;
 
 	return dev->dev_ops->timer_adapter_caps_get ?
 				(*dev->dev_ops->timer_adapter_caps_get)(dev,
-- 
2.25.1


^ permalink raw reply	[relevance 5%]

* Re: [PATCH v5 4/4] doc: remove deprecation notice
  @ 2022-09-14 12:41  3%     ` Jerin Jacob
  2022-09-14 13:54  0%       ` Naga Harish K, S V
  0 siblings, 1 reply; 200+ results
From: Jerin Jacob @ 2022-09-14 12:41 UTC (permalink / raw)
  To: Naga Harish K S V; +Cc: jerinj, dev, erik.g.carrillo, pbhagavatula, sthotton

On Wed, Sep 14, 2022 at 10:46 AM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> This patch removes event timer expiry drop stat deprecation
> notification.
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
>  doc/guides/rel_notes/deprecation.rst | 7 -------

Please squash this patch with 1/5.
Also, Please update "ABI Changes" in doc/guides/rel_notes/release_22_11.rst.
See https://patches.dpdk.org/project/dpdk/patch/dcd3cf0ec034632f97223bb9df389f9cedf9753c.1660116951.git.sthotton@marvell.com/
as example.


>  1 file changed, 7 deletions(-)
>
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index e7583cae4c..fd8ef4dff7 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -186,13 +186,6 @@ Deprecation Notices
>    Event will be one of the configuration fields,
>    together with additional vector parameters.
>
> -* eventdev: The structure ``rte_event_timer_adapter_stats`` will be
> -  extended by adding a new field ``evtim_drop_count``.
> -  This counter will represent the number of times an event_timer expiry event
> -  is dropped by the timer adapter.
> -  This field will be used to add periodic mode support
> -  to the software timer adapter in DPDK 22.11.
> -
>  * eventdev: The function pointer declaration ``eventdev_stop_flush_t``
>    will be renamed to ``rte_eventdev_stop_flush_t`` in DPDK 22.11.
>
> --
> 2.25.1
>

^ permalink raw reply	[relevance 3%]

* Re: [PATCH] eventdev: add weight and affinity attributes to queue conf
  @ 2022-09-14 12:34  0% ` Jerin Jacob
  2022-09-15 16:53  0%   ` Jerin Jacob
  0 siblings, 1 reply; 200+ results
From: Jerin Jacob @ 2022-09-14 12:34 UTC (permalink / raw)
  To: Shijith Thotton, McDaniel, Timothy, Gujjar, Abhinandan S,
	Van Haaren, Harry, Hemant Agrawal, Liang Ma,
	Mattias Rönnblom, Erik Gabriel Carrillo, Nipun Gupta,
	Jayatheerthan, Jay, Peter Mccarthy
  Cc: jerinj, dev, Ray Kinsella, Pavan Nikhilesh

On Wed, Aug 10, 2022 at 1:13 PM Shijith Thotton <sthotton@marvell.com> wrote:
>
> Added new fields to represent event queue weight and affinity in
> rte_event_queue_conf structure. Internal op to get queue attribute is
> removed as it is no longer needed. Updated driver to use the new field.
>
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>

+ eventdev PMD maintainers to raise any feedback before merging to next-eventdev


> ---
>  doc/guides/rel_notes/deprecation.rst   |  3 --
>  doc/guides/rel_notes/release_22_11.rst |  3 ++
>  drivers/event/cnxk/cn10k_eventdev.c    |  1 -
>  drivers/event/cnxk/cn9k_eventdev.c     |  1 -
>  drivers/event/cnxk/cnxk_eventdev.c     | 42 ++++++--------------------
>  drivers/event/cnxk/cnxk_eventdev.h     |  9 ------
>  lib/eventdev/eventdev_pmd.h            | 22 --------------
>  lib/eventdev/rte_eventdev.c            | 10 +++---
>  lib/eventdev/rte_eventdev.h            | 16 ++++++++++
>  9 files changed, 33 insertions(+), 74 deletions(-)
>
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index e7583cae4c..13e7c6370e 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -206,9 +206,6 @@ Deprecation Notices
>    ``rte_event_vector::elem_offset`` gives the number of valid elements left
>    to process from the ``rte_event_vector::elem_offset``.
>
> -* eventdev: New fields to represent event queue weight and affinity
> -  will be added to ``rte_event_queue_conf`` structure in DPDK 22.11.
> -
>  * metrics: The function ``rte_metrics_init`` will have a non-void return
>    in order to notify errors instead of calling ``rte_exit``.
>
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 8c021cf050..8ffd71e650 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -88,6 +88,9 @@ API Changes
>  ABI Changes
>  -----------
>
> +* eventdev: Added ``weight`` and ``affinity`` fields to ``rte_event_queue_conf``
> +  structure.
> +
>  .. This section should contain ABI changes. Sample format:
>
>     * sample: Add a short 1-2 sentence description of the ABI change
> diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
> index 5a0cab40a9..aa8ae394bc 100644
> --- a/drivers/event/cnxk/cn10k_eventdev.c
> +++ b/drivers/event/cnxk/cn10k_eventdev.c
> @@ -922,7 +922,6 @@ static struct eventdev_ops cn10k_sso_dev_ops = {
>         .queue_def_conf = cnxk_sso_queue_def_conf,
>         .queue_setup = cnxk_sso_queue_setup,
>         .queue_release = cnxk_sso_queue_release,
> -       .queue_attr_get = cnxk_sso_queue_attribute_get,
>         .queue_attr_set = cnxk_sso_queue_attribute_set,
>
>         .port_def_conf = cnxk_sso_port_def_conf,
> diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
> index 2e27030049..58c72a580a 100644
> --- a/drivers/event/cnxk/cn9k_eventdev.c
> +++ b/drivers/event/cnxk/cn9k_eventdev.c
> @@ -1153,7 +1153,6 @@ static struct eventdev_ops cn9k_sso_dev_ops = {
>         .queue_def_conf = cnxk_sso_queue_def_conf,
>         .queue_setup = cnxk_sso_queue_setup,
>         .queue_release = cnxk_sso_queue_release,
> -       .queue_attr_get = cnxk_sso_queue_attribute_get,
>         .queue_attr_set = cnxk_sso_queue_attribute_set,
>
>         .port_def_conf = cnxk_sso_port_def_conf,
> diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c
> index 97dcf7b66e..45c53ffb4e 100644
> --- a/drivers/event/cnxk/cnxk_eventdev.c
> +++ b/drivers/event/cnxk/cnxk_eventdev.c
> @@ -321,6 +321,8 @@ cnxk_sso_queue_def_conf(struct rte_eventdev *event_dev, uint8_t queue_id,
>         queue_conf->nb_atomic_order_sequences = (1ULL << 20);
>         queue_conf->event_queue_cfg = RTE_EVENT_QUEUE_CFG_ALL_TYPES;
>         queue_conf->priority = RTE_EVENT_DEV_PRIORITY_NORMAL;
> +       queue_conf->weight = RTE_EVENT_QUEUE_WEIGHT_LOWEST;
> +       queue_conf->affinity = RTE_EVENT_QUEUE_AFFINITY_HIGHEST;
>  }
>
>  int
> @@ -330,18 +332,12 @@ cnxk_sso_queue_setup(struct rte_eventdev *event_dev, uint8_t queue_id,
>         struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
>         uint8_t priority, weight, affinity;
>
> -       /* Default weight and affinity */
> -       dev->mlt_prio[queue_id].weight = RTE_EVENT_QUEUE_WEIGHT_LOWEST;
> -       dev->mlt_prio[queue_id].affinity = RTE_EVENT_QUEUE_AFFINITY_HIGHEST;
> -
>         priority = CNXK_QOS_NORMALIZE(queue_conf->priority, 0,
>                                       RTE_EVENT_DEV_PRIORITY_LOWEST,
>                                       CNXK_SSO_PRIORITY_CNT);
> -       weight = CNXK_QOS_NORMALIZE(
> -               dev->mlt_prio[queue_id].weight, CNXK_SSO_WEIGHT_MIN,
> -               RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
> -       affinity = CNXK_QOS_NORMALIZE(dev->mlt_prio[queue_id].affinity, 0,
> -                                     RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
> +       weight = CNXK_QOS_NORMALIZE(queue_conf->weight, CNXK_SSO_WEIGHT_MIN,
> +                                   RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
> +       affinity = CNXK_QOS_NORMALIZE(queue_conf->affinity, 0, RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
>                                       CNXK_SSO_AFFINITY_CNT);
>
>         plt_sso_dbg("Queue=%u prio=%u weight=%u affinity=%u", queue_id,
> @@ -358,22 +354,6 @@ cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id)
>         RTE_SET_USED(queue_id);
>  }
>
> -int
> -cnxk_sso_queue_attribute_get(struct rte_eventdev *event_dev, uint8_t queue_id,
> -                            uint32_t attr_id, uint32_t *attr_value)
> -{
> -       struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> -
> -       if (attr_id == RTE_EVENT_QUEUE_ATTR_WEIGHT)
> -               *attr_value = dev->mlt_prio[queue_id].weight;
> -       else if (attr_id == RTE_EVENT_QUEUE_ATTR_AFFINITY)
> -               *attr_value = dev->mlt_prio[queue_id].affinity;
> -       else
> -               return -EINVAL;
> -
> -       return 0;
> -}
> -
>  int
>  cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
>                              uint32_t attr_id, uint64_t attr_value)
> @@ -389,10 +369,10 @@ cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
>                 conf->priority = attr_value;
>                 break;
>         case RTE_EVENT_QUEUE_ATTR_WEIGHT:
> -               dev->mlt_prio[queue_id].weight = attr_value;
> +               conf->weight = attr_value;
>                 break;
>         case RTE_EVENT_QUEUE_ATTR_AFFINITY:
> -               dev->mlt_prio[queue_id].affinity = attr_value;
> +               conf->affinity = attr_value;
>                 break;
>         case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS:
>         case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES:
> @@ -409,11 +389,9 @@ cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
>         priority = CNXK_QOS_NORMALIZE(conf->priority, 0,
>                                       RTE_EVENT_DEV_PRIORITY_LOWEST,
>                                       CNXK_SSO_PRIORITY_CNT);
> -       weight = CNXK_QOS_NORMALIZE(
> -               dev->mlt_prio[queue_id].weight, CNXK_SSO_WEIGHT_MIN,
> -               RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
> -       affinity = CNXK_QOS_NORMALIZE(dev->mlt_prio[queue_id].affinity, 0,
> -                                     RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
> +       weight = CNXK_QOS_NORMALIZE(conf->weight, CNXK_SSO_WEIGHT_MIN,
> +                                   RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
> +       affinity = CNXK_QOS_NORMALIZE(conf->affinity, 0, RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
>                                       CNXK_SSO_AFFINITY_CNT);
>
>         return roc_sso_hwgrp_set_priority(&dev->sso, queue_id, weight, affinity,
> diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
> index bfd0c5627e..d78fb4ea2f 100644
> --- a/drivers/event/cnxk/cnxk_eventdev.h
> +++ b/drivers/event/cnxk/cnxk_eventdev.h
> @@ -88,11 +88,6 @@ struct cnxk_sso_qos {
>         uint16_t iaq_prcnt;
>  };
>
> -struct cnxk_sso_mlt_prio {
> -       uint8_t weight;
> -       uint8_t affinity;
> -};
> -
>  struct cnxk_sso_evdev {
>         struct roc_sso sso;
>         uint8_t max_event_queues;
> @@ -123,7 +118,6 @@ struct cnxk_sso_evdev {
>         uint64_t *timer_adptr_sz;
>         uint16_t vec_pool_cnt;
>         uint64_t *vec_pools;
> -       struct cnxk_sso_mlt_prio mlt_prio[RTE_EVENT_MAX_QUEUES_PER_DEV];
>         /* Dev args */
>         uint32_t xae_cnt;
>         uint8_t qos_queue_cnt;
> @@ -250,9 +244,6 @@ void cnxk_sso_queue_def_conf(struct rte_eventdev *event_dev, uint8_t queue_id,
>  int cnxk_sso_queue_setup(struct rte_eventdev *event_dev, uint8_t queue_id,
>                          const struct rte_event_queue_conf *queue_conf);
>  void cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id);
> -int cnxk_sso_queue_attribute_get(struct rte_eventdev *event_dev,
> -                                uint8_t queue_id, uint32_t attr_id,
> -                                uint32_t *attr_value);
>  int cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev,
>                                  uint8_t queue_id, uint32_t attr_id,
>                                  uint64_t attr_value);
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index 69402668d8..8879e43feb 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -341,26 +341,6 @@ typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
>  typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
>                 uint8_t queue_id);
>
> -/**
> - * Get an event queue attribute at runtime.
> - *
> - * @param dev
> - *   Event device pointer
> - * @param queue_id
> - *   Event queue index
> - * @param attr_id
> - *   Event queue attribute id
> - * @param[out] attr_value
> - *   Event queue attribute value
> - *
> - * @return
> - *  - 0: Success.
> - *  - <0: Error code on failure.
> - */
> -typedef int (*eventdev_queue_attr_get_t)(struct rte_eventdev *dev,
> -                                        uint8_t queue_id, uint32_t attr_id,
> -                                        uint32_t *attr_value);
> -
>  /**
>   * Set an event queue attribute at runtime.
>   *
> @@ -1268,8 +1248,6 @@ struct eventdev_ops {
>         /**< Set up an event queue. */
>         eventdev_queue_release_t queue_release;
>         /**< Release an event queue. */
> -       eventdev_queue_attr_get_t queue_attr_get;
> -       /**< Get an event queue attribute. */
>         eventdev_queue_attr_set_t queue_attr_set;
>         /**< Set an event queue attribute. */
>
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 1dc4f966be..b96185b25d 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -859,15 +859,13 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
>                 break;
>         case RTE_EVENT_QUEUE_ATTR_WEIGHT:
>                 *attr_value = RTE_EVENT_QUEUE_WEIGHT_LOWEST;
> -               if (dev->dev_ops->queue_attr_get)
> -                       return (*dev->dev_ops->queue_attr_get)(
> -                               dev, queue_id, attr_id, attr_value);
> +               if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
> +                       *attr_value = conf->weight;
>                 break;
>         case RTE_EVENT_QUEUE_ATTR_AFFINITY:
>                 *attr_value = RTE_EVENT_QUEUE_AFFINITY_LOWEST;
> -               if (dev->dev_ops->queue_attr_get)
> -                       return (*dev->dev_ops->queue_attr_get)(
> -                               dev, queue_id, attr_id, attr_value);
> +               if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
> +                       *attr_value = conf->affinity;
>                 break;
>         default:
>                 return -EINVAL;
> diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
> index 6a6f6ea4c1..f1908b82b2 100644
> --- a/lib/eventdev/rte_eventdev.h
> +++ b/lib/eventdev/rte_eventdev.h
> @@ -640,6 +640,22 @@ struct rte_event_queue_conf {
>          * event device supported priority value.
>          * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
>          */
> +       uint8_t weight;
> +       /**< Weight of the event queue relative to other event queues.
> +        * The requested weight should be in the range of
> +        * [RTE_EVENT_DEV_WEIGHT_HIGHEST, RTE_EVENT_DEV_WEIGHT_LOWEST].
> +        * The implementation shall normalize the requested weight to event
> +        * device supported weight value.
> +        * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability.
> +        */
> +       uint8_t affinity;
> +       /**< Affinity of the event queue relative to other event queues.
> +        * The requested affinity should be in the range of
> +        * [RTE_EVENT_DEV_AFFINITY_HIGHEST, RTE_EVENT_DEV_AFFINITY_LOWEST].
> +        * The implementation shall normalize the requested affinity to event
> +        * device supported affinity value.
> +        * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability.
> +        */
>  };
>
>  /**
> --
> 2.25.1
>

^ permalink raw reply	[relevance 0%]

* [PATCH v6 27/27] dev: hide device object
  2022-09-14  7:58  1% ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (2 preceding siblings ...)
  2022-09-14  7:58  1%   ` [PATCH v6 23/27] dev: hide driver object David Marchand
@ 2022-09-14  7:58  2%   ` David Marchand
  2022-09-24  7:14  0%   ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  4 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Ray Kinsella, Maxime Coquelin, Chenbo Xia

Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Some applications may have been dereferencing rte_device objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/deprecation.rst   |  7 -----
 doc/guides/rel_notes/release_22_11.rst |  4 +--
 lib/eal/common/eal_private.h           |  2 +-
 lib/eal/include/dev_driver.h           | 13 +++++++++
 lib/eal/include/rte_dev.h              | 37 --------------------------
 lib/eal/version.map                    | 14 +++++-----
 lib/vhost/vdpa.c                       |  1 +
 7 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 98a00da385..64668500c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,13 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* drivers: As a follow-up of the work on the ``rte_bus`` object,
-  the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
-  their bus-specific counterparts) will be made opaque in DPDK 22.11.
-  Registering a driver on a bus will be marked as an internal API:
-  external users may still register their drivers using the bus-specific
-  driver header (see ``enable_driver_sdk`` meson option).
-
 * 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
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4e20345b7a..43502349bd 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,8 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
   headers (see ``enable_driver_sdk`` meson option).
-  The ``rte_driver`` object is now opaque and must be manipulated through added
-  accessors.
+  The ``rte_driver`` and ``rte_device`` objects are now opaque and must be
+  manipulated through added accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..5efa8c437e 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -21,6 +21,19 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index f010dd6441..dc1acc8953 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -86,90 +86,66 @@ rte_driver_name(const struct rte_driver *driver);
 /**
  * Retrieve a device bus.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device bus.
  */
-__rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
 /**
  * Retrieve bus specific information for a device.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A string describing this device or NULL if none is available.
  */
-__rte_experimental
 const char *
 rte_dev_bus_info(const struct rte_device *dev);
 
 /**
  * Retrieve a device arguments.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device devargs.
  */
-__rte_experimental
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev);
 
 /**
  * Retrieve a device driver.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device driver.
  */
-__rte_experimental
 const struct rte_driver *
 rte_dev_driver(const struct rte_device *dev);
 
 /**
  * Retrieve a device name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device name.
  */
-__rte_experimental
 const char *
 rte_dev_name(const struct rte_device *dev);
 
 /**
  * Retrieve a device numa node.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device numa node.
  */
-__rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
@@ -179,19 +155,6 @@ rte_dev_numa_node(const struct rte_device *dev);
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const char *bus_info;         /**< Device bus specific information */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 0cf321605e..3c14cf2724 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -26,7 +26,13 @@ DPDK_23 {
 	rte_delay_us_block;
 	rte_delay_us_callback_register;
 	rte_delay_us_sleep;
+	rte_dev_bus;
+	rte_dev_bus_info;
+	rte_dev_devargs;
+	rte_dev_driver;
 	rte_dev_is_probed;
+	rte_dev_name;
+	rte_dev_numa_node;
 	rte_dev_probe;
 	rte_dev_remove;
 	rte_devargs_add;
@@ -424,14 +430,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_dev_bus;
-	rte_dev_bus_info;
-	rte_dev_devargs;
-	rte_dev_driver;
-	rte_dev_name;
-	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index a6ca785b29..bb828577cb 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.37.3


^ permalink raw reply	[relevance 2%]

* [PATCH v6 23/27] dev: hide driver object
  2022-09-14  7:58  1% ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  2022-09-14  7:58  4%   ` [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor David Marchand
  2022-09-14  7:58  3%   ` [PATCH v6 21/27] bus: hide bus object David Marchand
@ 2022-09-14  7:58  1%   ` David Marchand
  2022-09-14  7:58  2%   ` [PATCH v6 27/27] dev: hide device object David Marchand
  2022-09-24  7:14  0%   ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  4 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Jay Jayatheerthan, Ajit Khaparde,
	Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Kevin Laatz, Timothy McDaniel, Jerin Jacob,
	Elena Agostini, Ciara Loftus, Qi Zhang, Shepard Siegel, Ed Czeck,
	John Miller, Steven Webster, Matt Peters, Rasesh Mody,
	Shahed Shaikh, Somnath Kotur, Rahul Lakkireddy, Simei Su,
	Wenjun Wu, Marcin Wojtas, Michal Krawczyk, Shai Brandes,
	Evgeny Schemeilin, Igor Chauskin, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Yuying Zhang, Beilei Xing, Jingjing Wu,
	Qiming Yang, Matan Azrad, Viacheslav Ovsiienko, Chaoyong He,
	Niklas Soderlund, Harman Kalra, Devendra Singh Rawat,
	Andrew Rybchenko, Maciej Czekaj, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Ori Kam,
	Akhil Goyal, Chengwen Feng, Ray Kinsella, Ferruh Yigit,
	Abhinandan Gujjar, Olivier Matz, Reshma Pattan

Make rte_driver opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_driver definition.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_driver objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/release_22_11.rst        |  2 ++
 drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
 drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
 drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
 drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
 drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |  2 +-
 drivers/bus/pci/bus_pci_driver.h              |  2 +-
 drivers/bus/pci/pci_params.c                  |  2 +-
 drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
 drivers/bus/vdev/vdev.c                       |  2 +-
 drivers/bus/vdev/vdev_params.c                |  2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
 drivers/common/qat/qat_qp.c                   |  2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
 drivers/dma/idxd/idxd_bus.c                   |  1 +
 drivers/event/dlb2/dlb2.c                     |  2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
 drivers/event/octeontx/ssovf_evdev.c          |  2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
 drivers/gpu/cuda/cuda.c                       |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
 drivers/net/ark/ark_global.h                  |  2 +-
 drivers/net/avp/avp_ethdev.c                  |  2 +-
 drivers/net/axgbe/axgbe_common.h              |  2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
 drivers/net/cxgbe/base/t4_hw.c                |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                |  2 +-
 drivers/net/cxgbe/sge.c                       |  2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
 drivers/net/e1000/em_ethdev.c                 |  2 +-
 drivers/net/e1000/igb_ethdev.c                |  2 +-
 drivers/net/e1000/igb_flow.c                  |  2 +-
 drivers/net/ena/ena_ethdev.h                  |  2 +-
 drivers/net/enic/enic_ethdev.c                |  2 +-
 drivers/net/enic/enic_vf_representor.c        |  2 +-
 drivers/net/failsafe/failsafe_private.h       |  2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
 drivers/net/i40e/i40e_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_vchnl.c                 |  2 +-
 drivers/net/ice/ice_dcf.c                     |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
 drivers/net/mlx4/mlx4.c                       |  2 +-
 drivers/net/netvsc/hn_ethdev.c                |  2 +-
 drivers/net/netvsc/hn_nvs.c                   |  2 +-
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/netvsc/hn_rxtx.c                  |  2 +-
 drivers/net/nfp/nfp_common.c                  |  2 +-
 drivers/net/nfp/nfp_ethdev.c                  |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
 drivers/net/qede/qede_ethdev.h                |  2 +-
 drivers/net/sfc/sfc_ethdev.c                  |  2 +-
 drivers/net/sfc/sfc_sw_stats.c                |  2 +-
 drivers/net/sfc/sfc_sw_stats.h                |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
 lib/compressdev/rte_compressdev.c             |  2 +-
 lib/compressdev/rte_compressdev_pmd.c         |  2 +-
 lib/compressdev/rte_compressdev_pmd.h         |  1 +
 lib/cryptodev/cryptodev_pmd.c                 |  2 +-
 lib/cryptodev/cryptodev_pmd.h                 |  1 +
 lib/cryptodev/rte_cryptodev.c                 |  2 +-
 lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
 lib/eal/common/eal_common_dev.c               |  2 +-
 lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
 lib/eal/include/meson.build                   |  1 +
 lib/eal/include/rte_dev.h                     | 15 ++--------
 lib/eal/version.map                           |  4 +--
 lib/ethdev/ethdev_driver.h                    |  1 +
 lib/eventdev/eventdev_pmd.h                   |  2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
 lib/eventdev/rte_eventdev.c                   |  2 +-
 lib/gpudev/gpudev_driver.h                    |  2 +-
 lib/mempool/rte_mempool_ops.c                 |  2 +-
 lib/pcapng/rte_pcapng.c                       |  2 +-
 lib/rawdev/rte_rawdev.c                       |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
 lib/security/rte_security.c                   |  2 +-
 115 files changed, 144 insertions(+), 122 deletions(-)
 create mode 100644 lib/eal/include/dev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 36df0ccf93..4e20345b7a 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,6 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
   headers (see ``enable_driver_sdk`` meson option).
+  The ``rte_driver`` object is now opaque and must be manipulated through added
+  accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 801e8920df..e2d9409185 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_byteorder.h>
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 c1d877c87f..51dd090c1b 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index f16814e241..036579e3ec 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a889e392c6..e4c7ee0c3b 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <bus_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1c2d2c04af..58fb7c7f69 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -25,7 +25,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index cf66fc0c53..26a83b2cdf 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -7,7 +7,7 @@
 #define BUS_DPAA_DRIVER_H
 
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 798ddebf3a..7ac5fe6ff1 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -29,7 +29,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8604e43947..5966776a85 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -28,7 +28,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index cfe4280f87..d7f6e45b7d 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -18,7 +18,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_pool_ops.h>
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index b7d81b518c..07256ed7ec 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <fslmc_logs.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 071b0d297d..4aec7b2cd8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -30,7 +30,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index 223e34bcba..65e2d799c3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "private.h"
 #include <fslmc_logs.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b5c7dee617..0f2f9b5101 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_compat.h>
 
 /** Pathname of PCI devices directory. */
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 39d702a418..d24cc201b8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -6,7 +6,7 @@
 
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 36748cdfae..bc7e30d7c6 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 
 #include <rte_bus_vdev.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 809a8bb08f..b176b658fc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 2c72614776..2d10a1e8ad 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index 3424e791c9..e2475a642d 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_bus_vmbus.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 struct vmbus_channel;
 struct vmbus_mon_page;
diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
index 7ffde5f4c8..85d6ddfcf4 100644
--- a/drivers/common/qat/dev/qat_dev_gen4.c
+++ b/drivers/common/qat/dev/qat_dev_gen4.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "qat_device.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 5916e745e2..9cbd19a481 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 7d657d81bc..445a3baa67 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
index 61d457f4e0..d1ede5e990 100644
--- a/drivers/crypto/bcmfs/bcmfs_qp.c
+++ b/drivers/crypto/bcmfs/bcmfs_qp.c
@@ -8,7 +8,7 @@
 #include <rte_atomic.h>
 #include <rte_bitmap.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_prefetch.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
index bc7fb67218..78272d616c 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
@@ -4,7 +4,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 6c3e45e333..013f3be1e6 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 
 #include "ccp_crypto.h"
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 3fd9f3c426..db11ac7444 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn10k_cryptodev.h"
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index bd425f95ff..4cfc1f2150 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn9k_cryptodev.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0cce861899..3b13578de0 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_common.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7e554cb2b1..c6bd785262 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -19,7 +19,7 @@
 #include <rte_security_driver.h>
 #endif
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 83ae6b6be9..11b559e025 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -5,7 +5,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index e30dcfc281..9b7b16c6e3 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -9,6 +9,7 @@
 #include <libgen.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 5a443acff8..759578378f 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -17,7 +17,7 @@
 #include <rte_config.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 9f8c6cd8b8..71ac141b66 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -15,7 +15,7 @@
 
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
 #include <rte_ring.h>
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index aa403f9e06..8e470584ea 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 08df6e223a..1001297cda 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <bus_fslmc_driver.h>
 #include <rte_lcore.h>
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 3882a9cf1d..a68d3ac154 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index fe157c59d5..99fa326ad5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <ethdev_driver.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 6bd8fec6d4..8513b9a013 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -12,7 +12,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 2be7b8d2df..a552aabeb8 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -8,7 +8,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <gpudev_driver.h>
 
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 56c629c681..84371d5d1a 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -20,7 +20,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include "rte_dpaa2_mempool.h"
 
 #include "fslmc_vfio.h"
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fd7be47311..9957de2314 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -24,7 +24,7 @@
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 748db590c1..71d0b53e03 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_version.h>
 
 #include "ark_pktdir.h"
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7c0cb666fb..b2a08f5635 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_cycles.h>
 #include <rte_spinlock.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index b9ebf64fb8..a5d11c5832 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -33,7 +33,7 @@
 #include <rte_memzone.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_pci.h>
 #include <rte_common.h>
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f36ad30e17..4448cf2de2 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -9,7 +9,7 @@
 #include "bnx2x_rxtx.h"
 
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53f..1460dce2ab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef04c..fd1506ddd4 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -7,7 +7,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 384080e6d3..bed755f5d9 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -18,7 +18,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_byteorder.h>
 
 #include "common.h"
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index fd71a50a58..45bbeaef0c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -31,7 +31,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "cxgbe.h"
 #include "cxgbe_pfvf.h"
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3c02c98b3d..f8dd833032 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -31,7 +31,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "base/common.h"
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5d91355c9a..5b13cb5c94 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -30,7 +30,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 9509f6e8a3..4d33b51fea 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <dpaa2_pmd_logs.h>
 #include <dpaa2_hw_pvt.h>
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index f876f4790c..37a8b43114 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 #include "rte_dpaa2_mempool.h"
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 932570c6e0..fbfdf360d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -14,7 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7b9c528d13..9436a95ac8 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hexdump.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
index ba0d500f74..63463c4fbf 100644
--- a/drivers/net/dpaa2/dpaa2_sparser.c
+++ b/drivers/net/dpaa2/dpaa2_sparser.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <fslmc_vfio.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 409de50083..8ee9be12ad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 43979992d3..d6bcc5bf58 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index e46697b6a1..b775310651 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -21,7 +21,7 @@
 #include <rte_eal.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 4709675af8..4d27fba585 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -14,7 +14,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_timer.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 
 #include "ena_com.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 998436e5e8..cdf0915591 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 7312c411bd..46f85964e9 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -7,7 +7,7 @@
 
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index a80f5e2caf..53a451c1b1 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -11,7 +11,7 @@
 #include <pthread.h>
 
 #include <rte_atomic.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_devargs.h>
 #include <rte_flow.h>
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8bbd8b445d..7adb20bff9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_spinlock.h>
 #include <rte_kvargs.h>
 #include <rte_vect.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bdc453ec1..67111ac251 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -23,7 +23,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_alarm.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_hash_crc.h>
 #include <rte_bitmap.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..ef2ab06475 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,7 +24,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 21bd1e2193..15f695682d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,7 +19,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..1c3d22ae0f 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -21,7 +21,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "ice_dcf.h"
 #include "ice_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 0da267db1f..dee712af98 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -18,7 +18,7 @@
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <iavf_devids.h>
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 552e41692c..04c9ce78a2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..67373a7b78 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -27,7 +27,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 910b76a92c..7e7e1824ef 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ccc06bdda6..d0bbc0a4c0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -30,7 +30,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 817fb06dfb..7db82af9f3 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -28,7 +28,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 20f75a17b0..e6f1f28768 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -26,7 +26,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 61cf374224..bc6f60c64a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -25,7 +25,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 #include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c792..eaafe11fb9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -19,7 +19,7 @@
 #include <rte_debug.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e588..47359501bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_common.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9ada22e2ff..0eee191566 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -15,7 +15,7 @@
 #include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index a38b701183..b781bcdcfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -13,7 +13,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ip.h>
 
 /* ecore includes */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 506c62a726..2ec743ebce 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -7,7 +7,7 @@
  * for Solarflare) and Solarflare Communications, Inc.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 81f5aa3cc4..3ae5023b6f 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2021 Xilinx, Inc.
  */
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_bitmap.h>
 
 #include "sfc.h"
diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
index 1abded8018..d9738e5214 100644
--- a/drivers/net/sfc/sfc_sw_stats.h
+++ b/drivers/net/sfc/sfc_sw_stats.h
@@ -5,7 +5,7 @@
 #ifndef _SFC_SW_STATS_H
 #define _SFC_SW_STATS_H
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "sfc.h"
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 28183ec740..9f57cb1a20 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index dc90569df1..c3e045d892 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -27,7 +27,7 @@
 #include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d180162abd..edf3becd32 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -24,7 +24,7 @@
 #include <rte_memory.h>
 #include <rte_eal_paging.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 2b9e35cef5..abc63b0935 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -16,7 +16,7 @@
 
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "virtio.h"
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 101b1cb500..fd946dec5c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/vmxnet3_defs.h"
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index db029cbf34..909fb8faab 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -3,7 +3,7 @@
  */
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 6831cc8d20..5dd5bbb652 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index fc257c5f44..8ef7a6b127 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_rawdev.h>
 #include <bus_vdev_driver.h>
 #include <rte_test.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 6ab62a12fc..92cf5f495e 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -11,7 +11,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_glue.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index e997bd01ed..cf2c20a704 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 9bfae077db..41f1415bea 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
index 9fabc399c5..72e52f876f 100644
--- a/lib/compressdev/rte_compressdev_pmd.h
+++ b/lib/compressdev/rte_compressdev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 
 #include "rte_compressdev.h"
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 75d0075b86..f07b92dfd7 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..96d7e225b0 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 6250302f3b..29c9c55131 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -13,7 +13,7 @@
 
 #include <rte_log.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index 82ab7a8cc7..acd7f71cd1 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -14,7 +14,7 @@
  * by any application.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_dmadev.h"
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 16c5aef1d8..98f3c78795 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -9,7 +9,7 @@
 
 #include <bus_driver.h>
 #include <rte_class.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_errno.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
new file mode 100644
index 0000000000..015188abd5
--- /dev/null
+++ b/lib/eal/include/dev_driver.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef DEV_DRIVER_H
+#define DEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include <rte_dev.h>
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+	const char *name;                   /**< Driver name. */
+	const char *alias;              /**< Driver alias. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEV_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index 77d8621a51..cfcd40aaed 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -57,6 +57,7 @@ headers += files(
 
 driver_sdk_headers = files(
         'bus_driver.h',
+        'dev_driver.h',
 )
 
 # special case install the generic headers, since they go in a subdir
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ddea163cca..7214f5d7fb 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,8 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_driver;
+
 /**
  * The device event type.
  */
@@ -67,27 +69,14 @@ struct rte_mem_resource {
 	void *addr;         /**< Virtual address, NULL when not mapped. */
 };
 
-/**
- * A structure describing a device driver.
- */
-struct rte_driver {
-	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
-	const char *name;                   /**< Driver name. */
-	const char *alias;              /**< Driver alias. */
-};
-
 /**
  * Retrieve a driver name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param driver
  *   A pointer to a driver structure.
  * @return
  *   A pointer to the driver name string.
  */
-__rte_experimental
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index d10fd89458..8b53a1d258 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -37,6 +37,7 @@ DPDK_23 {
 	rte_devargs_parsef;
 	rte_devargs_remove;
 	rte_devargs_type_count;
+	rte_driver_name;
 	rte_dump_physmem_layout;
 	rte_dump_stack;
 	rte_dump_tailq;
@@ -423,9 +424,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..47a55a419e 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -19,6 +19,7 @@ extern "C" {
  *
  */
 
+#include <dev_driver.h>
 #include <rte_ethdev.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..def6cd0876 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 4938b4ee07..a8ef5bac06 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 8e81cf774d..29515401bd 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -9,7 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_log.h>
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 79b905e9fc..bbb027aa0c 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 0e55b00bfe..23972b3dbd 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_gpudev.h"
 
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index ac32c4bb72..3b43edc548 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -9,7 +9,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_mempool_trace.h"
 
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 72aabd4dd0..af2b814251 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -14,7 +14,7 @@
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index e157d65332..569e836560 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_telemetry.h>
diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 3b7be57d3e..a51944c8ff 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -19,7 +19,7 @@ extern "C" {
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 1a2a408f0e..94160f4177 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -5,7 +5,7 @@
  */
 
 #include <rte_cryptodev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_telemetry.h>
 #include "rte_security.h"
 #include "rte_security_driver.h"
-- 
2.37.3


^ permalink raw reply	[relevance 1%]

* [PATCH v6 21/27] bus: hide bus object
  2022-09-14  7:58  1% ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  2022-09-14  7:58  4%   ` [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-09-14  7:58  3%   ` David Marchand
  2022-09-14  7:58  1%   ` [PATCH v6 23/27] dev: hide driver object David Marchand
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Anatoly Burakov,
	Stephen Hemminger, Long Li, Matan Azrad, Viacheslav Ovsiienko,
	Kevin Laatz, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Ferruh Yigit,
	Andrew Rybchenko, Reshma Pattan

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_bus objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

Changes since RFC v1:
- update all existing users of the public header to use the internal one,

---
 app/test/test_devargs.c                  |   2 +-
 app/test/test_vdev.c                     |   2 +-
 doc/guides/rel_notes/deprecation.rst     |   6 -
 doc/guides/rel_notes/release_22_11.rst   |   6 +
 drivers/bus/auxiliary/auxiliary_common.c |   2 +-
 drivers/bus/auxiliary/auxiliary_params.c |   2 +-
 drivers/bus/auxiliary/private.h          |   2 +-
 drivers/bus/dpaa/dpaa_bus.c              |   2 +-
 drivers/bus/fslmc/fslmc_bus.c            |   2 +-
 drivers/bus/fslmc/private.h              |   2 +-
 drivers/bus/ifpga/ifpga_bus.c            |   2 +-
 drivers/bus/pci/linux/pci_vfio.c         |   2 +-
 drivers/bus/pci/pci_common.c             |   2 +-
 drivers/bus/pci/pci_params.c             |   2 +-
 drivers/bus/pci/private.h                |   2 +-
 drivers/bus/vdev/vdev.c                  |   2 +-
 drivers/bus/vmbus/private.h              |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c    |   2 +-
 drivers/dma/idxd/idxd_bus.c              |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c  |   2 +-
 drivers/net/failsafe/failsafe.c          |   2 +-
 drivers/net/failsafe/failsafe_eal.c      |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c         |   2 +-
 drivers/net/netvsc/hn_ethdev.c           |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c    |   2 +-
 drivers/net/virtio/virtio_pci.c          |   2 +-
 drivers/raw/ioat/idxd_bus.c              |   2 +-
 lib/eal/common/eal_common_bus.c          |   2 +-
 lib/eal/common/eal_common_dev.c          |   2 +-
 lib/eal/common/eal_common_devargs.c      |   2 +-
 lib/eal/common/hotplug_mp.c              |   2 +-
 lib/eal/include/bus_driver.h             | 296 +++++++++++++++++++++++
 lib/eal/include/meson.build              |   4 +
 lib/eal/include/rte_bus.h                | 278 +--------------------
 lib/eal/linux/eal_dev.c                  |   2 +-
 lib/eal/version.map                      |   8 +-
 lib/ethdev/rte_ethdev.c                  |   2 +-
 lib/pcapng/rte_pcapng.c                  |   2 +-
 38 files changed, 343 insertions(+), 319 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..0a4c34a1ad 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 5eeff3106d..1904e76e44 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 5b4ffc992d..98a00da385 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,12 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* bus: The ``rte_bus`` object will be made opaque in DPDK 22.11.
-  The goal is to remove it from the public ABI and make this object extendable.
-  As a side effect, registering a bus will be marked as an internal API:
-  external users may still register their bus using a new driver header
-  (see ``enable_driver_sdk`` meson option).
-
 * drivers: As a follow-up of the work on the ``rte_bus`` object,
   the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
   their bus-specific counterparts) will be made opaque 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 e08a548285..36df0ccf93 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,6 +88,12 @@ API Changes
   in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
   to update their code.
 
+* bus: Registering a bus has been marked as an internal API.
+  External users may still register their bus using the ``bus_driver.h``
+  driver header (see ``enable_driver_sdk`` meson option).
+  The ``rte_bus`` object is now opaque and must be manipulated through added
+  accessors.
+
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 6cf6c170ec..259ff152c4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -12,7 +12,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 0289777922..a889e392c6 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 3f49f62493..3dee13e1d1 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "bus_auxiliary_driver.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 1ac6aa314f..682427ba2c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -29,7 +29,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index b9b0981329..8503004e3d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 60d68155e1..6f14085d98 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef BUS_FSLMC_PRIVATE_H
 #define BUS_FSLMC_PRIVATE_H
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 27e2de7072..bb943b58b5 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index cd0d0b1670..fab3483d9f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_vfio.h>
 #include <rte_eal.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 0d61d49287..c26aacd364 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_lcore.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 61a868707f..39d702a418 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 4e40a2ed85..fddf49251d 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7d78cf93bc..809a8bb08f 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 3d233fa83c..e33424675c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e82cb881bf..73178ce0f3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 1a86eb3c00..6553166f5c 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 5d4d52c341..32811403b4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..d71b512f81 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,7 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index efb262e368..4f0a6f4d55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 188d92ffac..ccc06bdda6 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 65043a04eb..dc90569df1 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..9cf4d760b4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -9,7 +9,7 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "virtio_pci.h"
 #include "virtio_logs.h"
diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 539f51b1b1..f32d811055 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include "ioat_private.h"
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..62a598957c 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..03e6e59baf 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..5202bd5658 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..d2e615a736
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,296 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_devargs;
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+typedef int (*rte_bus_scan_t)(void);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * This is called while iterating over each registered bus.
+ *
+ * @return
+ *	0 for successful probe
+ *	!0 for any error while probing
+ */
+typedef int (*rte_bus_probe_t)(void);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */
+	const char *name;            /**< Name of the bus */
+	rte_bus_scan_t scan;         /**< Scan for devices attached to bus */
+	rte_bus_probe_t probe;       /**< Probe devices on bus */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 3848b44db0..dfe756fb11 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,284 +20,21 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-typedef int (*rte_bus_scan_t)(void);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * This is called while iterating over each registered bus.
- *
- * @return
- *	0 for successful probe
- *	!0 for any error while probing
- */
-typedef int (*rte_bus_probe_t)(void);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */
-	const char *name;            /**< Name of the bus */
-	rte_bus_scan_t scan;         /**< Scan for devices attached to bus */
-	rte_bus_probe_t probe;       /**< Probe devices on bus */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * Retrieve a bus name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param bus
  *   A pointer to a rte_bus structure.
  * @return
  *   A pointer to the bus name string.
  */
-__rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -387,17 +124,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..098a2c3076 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -13,7 +13,7 @@
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index aa53064db1..6ec15f1147 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -12,10 +12,9 @@ DPDK_23 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
+	rte_bus_name;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -424,14 +423,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_bus_name;
 };
 
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9e358d187a..0c2c1088c0 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..72aabd4dd0 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.3


^ permalink raw reply	[relevance 3%]

* [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor
  2022-09-14  7:58  1% ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
@ 2022-09-14  7:58  4%   ` David Marchand
  2022-09-14  7:58  3%   ` [PATCH v6 21/27] bus: hide bus object David Marchand
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * 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.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.37.3


^ permalink raw reply	[relevance 4%]

* [PATCH v6 00/27] Bus and device cleanup for 22.11
                     ` (3 preceding siblings ...)
  2022-09-05  8:39  1% ` David Marchand
@ 2022-09-14  7:58  1% ` David Marchand
  2022-09-14  7:58  4%   ` [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (4 more replies)
  4 siblings, 5 replies; 200+ results
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

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...),

Changes since v4:
- (hopefully, because I can't test) fixed Windows build,
- dropped unneeded change in vdev unit test,

Changes since RFC v3:
- marked the series as non-RFC,
- rebased on v22.11-rc0,
- marked RTE_FUNC_PTR_* macros as deprecated,
- split the bus specific patch in two patches,

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (27):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  eal: deprecate RTE_FUNC_PTR_* macros
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide bus specific information
  bus/pci: fill bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   5 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |  20 +-
 doc/guides/rel_notes/release_22_11.rst        |  19 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 drivers/bus/auxiliary/linux/auxiliary.c       |   2 -
 drivers/bus/auxiliary/meson.build             |   4 +-
 drivers/bus/auxiliary/private.h               |  30 +-
 drivers/bus/auxiliary/version.map             |   3 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  53 ++-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |  35 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   8 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 drivers/net/dpaa2/dpaa2_ethdev.h              |   2 +-
 drivers/net/dpaa2/dpaa2_mux.c                 |   2 +-
 drivers/net/dpaa2/dpaa2_ptp.c                 |   2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  21 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  25 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |  48 ++-
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |  45 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_dev.h                     | 104 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       | 277 +++++++++-----
 lib/ethdev/rte_ethdev.h                       |  11 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  12 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  15 +-
 lib/eventdev/rte_eventdev.c                   |  64 ++--
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   5 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |  77 ++--
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |  59 +--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   8 +-
 lib/vhost/vdpa.c                              |  10 +-
 lib/vhost/vhost_user.c                        |   6 +-
 367 files changed, 2226 insertions(+), 2490 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.37.3


^ permalink raw reply	[relevance 1%]

* [PATCH v2] usertools: rewrite pmdinfo
  2022-09-13 10:58  1% [PATCH] usertools: rewrite pmdinfo Robin Jarry
@ 2022-09-13 19:42  1% ` Robin Jarry
  2022-09-20  9:08  1% ` [PATCH v3] " Robin Jarry
  2022-09-20 10:42  1% ` [PATCH v4] " Robin Jarry
  2 siblings, 0 replies; 200+ results
From: Robin Jarry @ 2022-09-13 19:42 UTC (permalink / raw)
  To: dev; +Cc: Robin Jarry, Olivier Matz, Ferruh Yigit, Bruce Richardson

dpdk-pmdinfo.py does not produce any parseable output. The -r/--raw flag
merely prints multiple independent JSON lines which cannot be fed
directly to any JSON parser. Moreover, the script complexity is rather
high for such a simple task: extracting PMD_INFO_STRING from .rodata ELF
sections. Rewrite it so that it can produce valid JSON.

Remove the PCI database parsing for PCI-ID to Vendor-Device names
conversion. This should be done by external scripts (if really needed).

Here are some examples of use with jq:

Get the complete info for a given driver:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.name == "dmadev_idxd_pci")'
 {
   "name": "dmadev_idxd_pci",
   "params": "max_queues=0",
   "kmod": "vfio-pci",
   "pci_ids": [
     {
       "vendor": "8086",
       "device": "0b25",
       "subsystem_vendor": "ffff",
       "subsystem_device": "ffff"
     }
   ]
 }

Get only the required kernel modules for a given driver:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.name == "net_i40e").kmod'
 "* igb_uio | uio_pci_generic | vfio-pci"

Get only the required kernel modules for a given device:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.pci_ids[] | .vendor == "15b3" and .device == "1013").kmod'
 "* ib_uverbs & mlx5_core & mlx5_ib"

Print the list of drivers which define multiple parameters without
string separators:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.params!=null and (.params|test("=[^ ]+="))) | {name, params}'
 ...

The script passes flake8, black, isort and pylint checks.

I have tested this with a matrix of python/pyelftools versions:

                             pyelftools
               0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29
         3.6     ok   ok   ok   ok   ok   ok   ok   ok
         3.7     ok   ok   ok   ok   ok   ok   ok   ok
  Python 3.8     ok   ok   ok   ok   ok   ok   ok   ok
         3.9     ok   ok   ok   ok   ok   ok   ok   ok
         3.10  fail fail fail fail   ok   ok   ok   ok

All failures with python 3.10 are related to the same issue:

  File "elftools/construct/lib/container.py", line 5, in <module>
    from collections import MutableMapping
  ImportError: cannot import name 'MutableMapping' from 'collections'

Python 3.10 support is only available since pyelftools 0.26. The script
will only work with Python 3.6 and later. Update the minimal system
requirements and release notes.

NB: The output produced by the legacy -r/--raw flag can be obtained with
the following command:

  strings build/app/dpdk-testpmd | sed -n 's/^PMD_INFO_STRING= //p'

Cc: Olivier Matz <olivier.matz@6wind.com>
Cc: Ferruh Yigit <ferruh.yigit@xilinx.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
v1 -> v2:

* update release notes and minimal python version requirement
* hide warnings by default (-v/--verbose to show them)
* show debug messages with -vv
* also search libs in folders listed in /etc/ld.so.conf/*.conf
* only search for DT_NEEDED on executables, not on dynamic libraries
* take DT_RUNPATH into account for searching libraries
* fix weird broken pipe error
* fix some typos:
    s/begining/beginning/
    s/subsystem_device/subsystem_vendor/
    s/subsystem_system/subsystem_device/
* change field names for pci_ids elements (remove _id suffixes)
* DT_NEEDED of all files are analyzed. There is no way to differentiate
  between dynamically linked executables and dynamic libraries.

 doc/guides/linux_gsg/sys_reqs.rst      |   2 +-
 doc/guides/rel_notes/release_22_11.rst |   5 +
 usertools/dpdk-pmdinfo.py              | 913 +++++++++----------------
 3 files changed, 313 insertions(+), 607 deletions(-)

diff --git a/doc/guides/linux_gsg/sys_reqs.rst b/doc/guides/linux_gsg/sys_reqs.rst
index 08d45898f025..f842105eeda7 100644
--- a/doc/guides/linux_gsg/sys_reqs.rst
+++ b/doc/guides/linux_gsg/sys_reqs.rst
@@ -41,7 +41,7 @@ Compilation of the DPDK
    resulting in statically linked applications not being linked properly.
    Use an updated version of ``pkg-config`` or ``pkgconf`` instead when building applications
 
-*   Python 3.5 or later.
+*   Python 3.6 or later.
 
 *   Meson (version 0.49.2+) and ninja
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf0505e..67054f5acdc9 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* The ``dpdk-pmdinfo.py`` script was rewritten to produce valid JSON only.
+  PCI-IDs parsing has been removed.
+  To get a similar output to the (now removed) ``-r/--raw`` flag, you may use the following command::
+
+     strings $dpdk_binary_or_driver | sed -n 's/^PMD_INFO_STRING= //p'
 
 ABI Changes
 -----------
diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py
index 40ef5cec6cba..ac043f5e4ed8 100755
--- a/usertools/dpdk-pmdinfo.py
+++ b/usertools/dpdk-pmdinfo.py
@@ -1,626 +1,327 @@
 #!/usr/bin/env python3
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2016  Neil Horman <nhorman@tuxdriver.com>
+# Copyright(c) 2022  Robin Jarry
+# pylint: disable=invalid-name
+
+r"""
+Utility to dump PMD_INFO_STRING support from DPDK binaries.
+
+This script prints JSON output to be interpreted by other tools. Here are some
+examples with jq:
+
+Get the complete info for a given driver:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.name == "cnxk_nix_inl")'
+
+Get only the required kernel modules for a given driver:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.name == "net_i40e").kmod'
+
+Get only the required kernel modules for a given device:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.devices[] | .vendor_id == "15b3" and .device_id == "1013").kmod'
+"""
 
-# -------------------------------------------------------------------------
-#
-# Utility to dump PMD_INFO_STRING support from an object file
-#
-# -------------------------------------------------------------------------
-import json
-import os
-import platform
-import sys
 import argparse
-from elftools.common.exceptions import ELFError
-from elftools.common.py3compat import byte2int
-from elftools.elf.elffile import ELFFile
-
-
-# For running from development directory. It should take precedence over the
-# installed pyelftools.
-sys.path.insert(0, '.')
-
-raw_output = False
-pcidb = None
-
-# ===========================================
-
-class Vendor:
-    """
-    Class for vendors. This is the top level class
-    for the devices belong to a specific vendor.
-    self.devices is the device dictionary
-    subdevices are in each device.
-    """
-
-    def __init__(self, vendorStr):
-        """
-        Class initializes with the raw line from pci.ids
-        Parsing takes place inside __init__
-        """
-        self.ID = vendorStr.split()[0]
-        self.name = vendorStr.replace("%s " % self.ID, "").rstrip()
-        self.devices = {}
-
-    def addDevice(self, deviceStr):
-        """
-        Adds a device to self.devices
-        takes the raw line from pci.ids
-        """
-        s = deviceStr.strip()
-        devID = s.split()[0]
-        if devID in self.devices:
-            pass
-        else:
-            self.devices[devID] = Device(deviceStr)
-
-    def report(self):
-        print(self.ID, self.name)
-        for id, dev in self.devices.items():
-            dev.report()
-
-    def find_device(self, devid):
-        # convert to a hex string and remove 0x
-        devid = hex(devid)[2:]
-        try:
-            return self.devices[devid]
-        except:
-            return Device("%s  Unknown Device" % devid)
-
-
-class Device:
-
-    def __init__(self, deviceStr):
-        """
-        Class for each device.
-        Each vendor has its own devices dictionary.
-        """
-        s = deviceStr.strip()
-        self.ID = s.split()[0]
-        self.name = s.replace("%s  " % self.ID, "")
-        self.subdevices = {}
-
-    def report(self):
-        print("\t%s\t%s" % (self.ID, self.name))
-        for subID, subdev in self.subdevices.items():
-            subdev.report()
-
-    def addSubDevice(self, subDeviceStr):
-        """
-        Adds a subvendor, subdevice to device.
-        Uses raw line from pci.ids
-        """
-        s = subDeviceStr.strip()
-        spl = s.split()
-        subVendorID = spl[0]
-        subDeviceID = spl[1]
-        subDeviceName = s.split("  ")[-1]
-        devID = "%s:%s" % (subVendorID, subDeviceID)
-        self.subdevices[devID] = SubDevice(
-            subVendorID, subDeviceID, subDeviceName)
-
-    def find_subid(self, subven, subdev):
-        subven = hex(subven)[2:]
-        subdev = hex(subdev)[2:]
-        devid = "%s:%s" % (subven, subdev)
-
-        try:
-            return self.subdevices[devid]
-        except:
-            if (subven == "ffff" and subdev == "ffff"):
-                return SubDevice("ffff", "ffff", "(All Subdevices)")
-            return SubDevice(subven, subdev, "(Unknown Subdevice)")
-
-
-class SubDevice:
-    """
-    Class for subdevices.
-    """
-
-    def __init__(self, vendor, device, name):
-        """
-        Class initializes with vendorid, deviceid and name
-        """
-        self.vendorID = vendor
-        self.deviceID = device
-        self.name = name
-
-    def report(self):
-        print("\t\t%s\t%s\t%s" % (self.vendorID, self.deviceID, self.name))
-
-
-class PCIIds:
-    """
-    Top class for all pci.ids entries.
-    All queries will be asked to this class.
-    PCIIds.vendors["0e11"].devices["0046"].\
-    subdevices["0e11:4091"].name  =  "Smart Array 6i"
-    """
-
-    def __init__(self, filename):
-        """
-        Prepares the directories.
-        Checks local data file.
-        Tries to load from local, if not found, downloads from web
-        """
-        self.version = ""
-        self.date = ""
-        self.vendors = {}
-        self.contents = None
-        self.readLocal(filename)
-        self.parse()
-
-    def reportVendors(self):
-        """Reports the vendors
-        """
-        for vid, v in self.vendors.items():
-            print(v.ID, v.name)
-
-    def report(self, vendor=None):
-        """
-        Reports everything for all vendors or a specific vendor
-        PCIIds.report()  reports everything
-        PCIIDs.report("0e11") reports only "Compaq Computer Corporation"
-        """
-        if vendor is not None:
-            self.vendors[vendor].report()
-        else:
-            for vID, v in self.vendors.items():
-                v.report()
-
-    def find_vendor(self, vid):
-        # convert vid to a hex string and remove the 0x
-        vid = hex(vid)[2:]
-
-        try:
-            return self.vendors[vid]
-        except:
-            return Vendor("%s Unknown Vendor" % (vid))
-
-    def findDate(self, content):
-        for l in content:
-            if l.find("Date:") > -1:
-                return l.split()[-2].replace("-", "")
-        return None
-
-    def parse(self):
-        if not self.contents:
-            print("data/%s-pci.ids not found" % self.date)
-        else:
-            vendorID = ""
-            deviceID = ""
-            for l in self.contents:
-                if l[0] == "#":
-                    continue
-                elif not l.strip():
-                    continue
-                else:
-                    if l.find("\t\t") == 0:
-                        self.vendors[vendorID].devices[
-                            deviceID].addSubDevice(l)
-                    elif l.find("\t") == 0:
-                        deviceID = l.strip().split()[0]
-                        self.vendors[vendorID].addDevice(l)
-                    else:
-                        vendorID = l.split()[0]
-                        self.vendors[vendorID] = Vendor(l)
-
-    def readLocal(self, filename):
-        """
-        Reads the local file
-        """
-        with open(filename, 'r', encoding='utf-8') as f:
-            self.contents = f.readlines()
-        self.date = self.findDate(self.contents)
-
-    def loadLocal(self):
-        """
-        Loads database from local. If there is no file,
-        it creates a new one from web
-        """
-        self.date = idsfile[0].split("/")[1].split("-")[0]
-        self.readLocal()
-
-
-# =======================================
-
-def search_file(filename, search_path):
-    """ Given a search path, find file with requested name """
-    for path in search_path.split(':'):
-        candidate = os.path.join(path, filename)
-        if os.path.exists(candidate):
-            return os.path.abspath(candidate)
-    return None
-
-
-class ReadElf(object):
-    """ display_* methods are used to emit output into the output stream
-    """
-
-    def __init__(self, file, output):
-        """ file:
-                stream object with the ELF file to read
-
-            output:
-                output stream to write to
-        """
-        self.elffile = ELFFile(file)
-        self.output = output
-
-        # Lazily initialized if a debug dump is requested
-        self._dwarfinfo = None
-
-        self._versioninfo = None
-
-    def _section_from_spec(self, spec):
-        """ Retrieve a section given a "spec" (either number or name).
-            Return None if no such section exists in the file.
-        """
-        try:
-            num = int(spec)
-            if num < self.elffile.num_sections():
-                return self.elffile.get_section(num)
-            return None
-        except ValueError:
-            # Not a number. Must be a name then
-            section = self.elffile.get_section_by_name(force_unicode(spec))
-            if section is None:
-                # No match with a unicode name.
-                # Some versions of pyelftools (<= 0.23) store internal strings
-                # as bytes. Try again with the name encoded as bytes.
-                section = self.elffile.get_section_by_name(force_bytes(spec))
-            return section
-
-    def pretty_print_pmdinfo(self, pmdinfo):
-        global pcidb
-
-        for i in pmdinfo["pci_ids"]:
-            vendor = pcidb.find_vendor(i[0])
-            device = vendor.find_device(i[1])
-            subdev = device.find_subid(i[2], i[3])
-            print("%s (%s) : %s (%s) %s" %
-                  (vendor.name, vendor.ID, device.name,
-                   device.ID, subdev.name))
-
-    def parse_pmd_info_string(self, mystring):
-        global raw_output
-        global pcidb
-
-        optional_pmd_info = [
-            {'id': 'params', 'tag': 'PMD PARAMETERS'},
-            {'id': 'kmod', 'tag': 'PMD KMOD DEPENDENCIES'}
-        ]
-
-        i = mystring.index("=")
-        mystring = mystring[i + 2:]
-        pmdinfo = json.loads(mystring)
-
-        if raw_output:
-            print(json.dumps(pmdinfo))
-            return
-
-        print("PMD NAME: " + pmdinfo["name"])
-        for i in optional_pmd_info:
-            try:
-                print("%s: %s" % (i['tag'], pmdinfo[i['id']]))
-            except KeyError:
-                continue
-
-        if pmdinfo["pci_ids"]:
-            print("PMD HW SUPPORT:")
-            if pcidb is not None:
-                self.pretty_print_pmdinfo(pmdinfo)
-            else:
-                print("VENDOR\t DEVICE\t SUBVENDOR\t SUBDEVICE")
-                for i in pmdinfo["pci_ids"]:
-                    print("0x%04x\t 0x%04x\t 0x%04x\t\t 0x%04x" %
-                          (i[0], i[1], i[2], i[3]))
-
-        print("")
-
-    def display_pmd_info_strings(self, section_spec):
-        """ Display a strings dump of a section. section_spec is either a
-            section number or a name.
-        """
-        section = self._section_from_spec(section_spec)
-        if section is None:
-            return
-
-        data = section.data()
-        dataptr = 0
-
-        while dataptr < len(data):
-            while (dataptr < len(data) and
-                   not 32 <= byte2int(data[dataptr]) <= 127):
-                dataptr += 1
-
-            if dataptr >= len(data):
-                break
-
-            endptr = dataptr
-            while endptr < len(data) and byte2int(data[endptr]) != 0:
-                endptr += 1
-
-            # pyelftools may return byte-strings, force decode them
-            mystring = force_unicode(data[dataptr:endptr])
-            rc = mystring.find("PMD_INFO_STRING")
-            if rc != -1:
-                self.parse_pmd_info_string(mystring[rc:])
-
-            dataptr = endptr
-
-    def find_librte_eal(self, section):
-        for tag in section.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_NEEDED':
-                if "librte_eal" in force_unicode(tag.needed):
-                    return force_unicode(tag.needed)
-        return None
-
-    def search_for_autoload_path(self):
-        scanelf = self
-        scanfile = None
-        library = None
-
-        section = self._section_from_spec(".dynamic")
-        try:
-            eallib = self.find_librte_eal(section)
-            if eallib is not None:
-                ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-                if ldlibpath is None:
-                    ldlibpath = ""
-                dtr = self.get_dt_runpath(section)
-                library = search_file(eallib,
-                                      dtr + ":" + ldlibpath +
-                                      ":/usr/lib64:/lib64:/usr/lib:/lib")
-                if library is None:
-                    return (None, None)
-                if not raw_output:
-                    print("Scanning for autoload path in %s" % library)
-                scanfile = open(library, 'rb')
-                scanelf = ReadElf(scanfile, sys.stdout)
-        except AttributeError:
-            # Not a dynamic binary
-            pass
-        except ELFError:
-            scanfile.close()
-            return (None, None)
-
-        section = scanelf._section_from_spec(".rodata")
-        if section is None:
-            if scanfile is not None:
-                scanfile.close()
-            return (None, None)
-
-        data = section.data()
-        dataptr = 0
-
-        while dataptr < len(data):
-            while (dataptr < len(data) and
-                   not 32 <= byte2int(data[dataptr]) <= 127):
-                dataptr += 1
-
-            if dataptr >= len(data):
-                break
-
-            endptr = dataptr
-            while endptr < len(data) and byte2int(data[endptr]) != 0:
-                endptr += 1
-
-            # pyelftools may return byte-strings, force decode them
-            mystring = force_unicode(data[dataptr:endptr])
-            rc = mystring.find("DPDK_PLUGIN_PATH")
-            if rc != -1:
-                rc = mystring.find("=")
-                return (mystring[rc + 1:], library)
-
-            dataptr = endptr
-        if scanfile is not None:
-            scanfile.close()
-        return (None, None)
-
-    def get_dt_runpath(self, dynsec):
-        for tag in dynsec.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_RUNPATH':
-                return force_unicode(tag.runpath)
-        return ""
-
-    def process_dt_needed_entries(self):
-        """ Look to see if there are any DT_NEEDED entries in the binary
-            And process those if there are
-        """
-        runpath = ""
-        ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-        if ldlibpath is None:
-            ldlibpath = ""
-
-        dynsec = self._section_from_spec(".dynamic")
-        try:
-            runpath = self.get_dt_runpath(dynsec)
-        except AttributeError:
-            # dynsec is None, just return
-            return
-
-        for tag in dynsec.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_NEEDED':
-                if 'librte_' in force_unicode(tag.needed):
-                    library = search_file(force_unicode(tag.needed),
-                                          runpath + ":" + ldlibpath +
-                                          ":/usr/lib64:/lib64:/usr/lib:/lib")
-                    if library is not None:
-                        with open(library, 'rb') as file:
-                            try:
-                                libelf = ReadElf(file, sys.stdout)
-                            except ELFError:
-                                print("%s is no an ELF file" % library)
-                                continue
-                            libelf.process_dt_needed_entries()
-                            libelf.display_pmd_info_strings(".rodata")
-                            file.close()
-
-
-# compat: remove force_unicode & force_bytes when pyelftools<=0.23 support is
-# dropped.
-def force_unicode(s):
-    if hasattr(s, 'decode') and callable(s.decode):
-        s = s.decode('latin-1')  # same encoding used in pyelftools py3compat
-    return s
-
-
-def force_bytes(s):
-    if hasattr(s, 'encode') and callable(s.encode):
-        s = s.encode('latin-1')  # same encoding used in pyelftools py3compat
-    return s
-
-
-def scan_autoload_path(autoload_path):
-    global raw_output
-
-    if not os.path.exists(autoload_path):
-        return
-
+import glob
+import json
+import logging
+import os
+import re
+import string
+import sys
+from pathlib import Path
+from typing import Iterable, Iterator, List, Union
+
+import elftools
+from elftools.elf.elffile import ELFError, ELFFile
+
+
+# ----------------------------------------------------------------------------
+def main() -> int:  # pylint: disable=missing-docstring
     try:
-        dirs = os.listdir(autoload_path)
-    except OSError:
-        # Couldn't read the directory, give up
-        return
-
-    for d in dirs:
-        dpath = os.path.join(autoload_path, d)
-        if os.path.isdir(dpath):
-            scan_autoload_path(dpath)
-        if os.path.isfile(dpath):
-            try:
-                file = open(dpath, 'rb')
-                readelf = ReadElf(file, sys.stdout)
-            except ELFError:
-                # this is likely not an elf file, skip it
-                continue
-            except IOError:
-                # No permission to read the file, skip it
-                continue
-
-            if not raw_output:
-                print("Hw Support for library %s" % d)
-            readelf.display_pmd_info_strings(".rodata")
-            file.close()
+        args = parse_args()
+        logging.basicConfig(
+            stream=sys.stderr,
+            format="%(levelname)s: %(message)s",
+            level={
+                0: logging.ERROR,
+                1: logging.WARNING,
+            }.get(args.verbose, logging.DEBUG),
+        )
+        info = parse_pmdinfo(args.elf_files, args.search_plugins)
+        print(json.dumps(info, indent=2))
+    except BrokenPipeError:
+        pass
+    except KeyboardInterrupt:
+        return 1
+    except Exception as e:  # pylint: disable=broad-except
+        logging.error("%s", e)
+        return 1
+    return 0
 
 
-def scan_for_autoload_pmds(dpdk_path):
+# ----------------------------------------------------------------------------
+def parse_args() -> argparse.Namespace:
     """
-    search the specified application or path for a pmd autoload path
-    then scan said path for pmds and report hw support
+    Parse command line arguments.
     """
-    global raw_output
-
-    if not os.path.isfile(dpdk_path):
-        if not raw_output:
-            print("Must specify a file name")
-        return
-
-    file = open(dpdk_path, 'rb')
-    try:
-        readelf = ReadElf(file, sys.stdout)
-    except ElfError:
-        if not raw_output:
-            print("Unable to parse %s" % file)
-        return
-
-    (autoload_path, scannedfile) = readelf.search_for_autoload_path()
-    if not autoload_path:
-        if not raw_output:
-            print("No autoload path configured in %s" % dpdk_path)
-        return
-    if not raw_output:
-        if scannedfile is None:
-            scannedfile = dpdk_path
-        print("Found autoload path %s in %s" % (autoload_path, scannedfile))
-
-    file.close()
-    if not raw_output:
-        print("Discovered Autoload HW Support:")
-    scan_autoload_path(autoload_path)
-    return
-
-
-def main(stream=None):
-    global raw_output
-    global pcidb
-
-    pcifile_default = "./pci.ids"  # For unknown OS's assume local file
-    if platform.system() == 'Linux':
-        # hwdata is the legacy location, misc is supported going forward
-        pcifile_default = "/usr/share/misc/pci.ids"
-        if not os.path.exists(pcifile_default):
-            pcifile_default = "/usr/share/hwdata/pci.ids"
-    elif platform.system() == 'FreeBSD':
-        pcifile_default = "/usr/local/share/pciids/pci.ids"
-        if not os.path.exists(pcifile_default):
-            pcifile_default = "/usr/share/misc/pci_vendors"
-
     parser = argparse.ArgumentParser(
-        usage='usage: %(prog)s [-hrtp] [-d <pci id file>] elf_file',
-        description="Dump pmd hardware support info")
-    group = parser.add_mutually_exclusive_group()
-    group.add_argument('-r', '--raw',
-                       action='store_true', dest='raw_output',
-                       help='dump raw json strings')
-    group.add_argument("-t", "--table", dest="tblout",
-                       help="output information on hw support as a hex table",
-                       action='store_true')
-    parser.add_argument("-d", "--pcidb", dest="pcifile",
-                        help="specify a pci database to get vendor names from",
-                        default=pcifile_default, metavar="FILE")
-    parser.add_argument("-p", "--plugindir", dest="pdir",
-                        help="scan dpdk for autoload plugins",
-                        action='store_true')
-    parser.add_argument("elf_file", help="driver shared object file")
-    args = parser.parse_args()
+        description=__doc__,
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+    )
+    parser.add_argument(
+        "-p",
+        "--search-plugins",
+        action="store_true",
+        help="""
+        In addition of ELF_FILEs and their linked dynamic libraries, also scan
+        the DPDK plugins path.
+        """,
+    )
+    parser.add_argument(
+        "-v",
+        "--verbose",
+        action="count",
+        default=0,
+        help="""
+        Display warnings due to linked libraries not found or ELF/JSON parsing
+        errors in these libraries. Use twice to show debug messages.
+        """,
+    )
+    parser.add_argument(
+        "elf_files",
+        metavar="ELF_FILE",
+        nargs="+",
+        type=existing_file,
+        help="""
+        DPDK application binary or dynamic library.
+        """,
+    )
+    return parser.parse_args()
 
-    if args.raw_output:
-        raw_output = True
 
-    if args.tblout:
-        args.pcifile = None
+# ----------------------------------------------------------------------------
+def parse_pmdinfo(paths: Iterable[Path], search_plugins: bool) -> List[dict]:
+    """
+    Extract DPDK PMD info JSON strings from an ELF file.
 
-    if args.pcifile:
-        pcidb = PCIIds(args.pcifile)
-        if pcidb is None:
-            print("Pci DB file not found")
-            exit(1)
+    :returns:
+        A list of DPDK drivers info dictionaries.
+    """
+    binaries = set(paths)
+    for p in paths:
+        binaries.update(get_needed_libs(p))
+    if search_plugins:
+        # cast to list to avoid errors with update while iterating
+        binaries.update(list(get_plugin_libs(binaries)))
 
-    if args.pdir:
-        exit(scan_for_autoload_pmds(args.elf_file))
+    drivers = []
 
-    ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-    if ldlibpath is None:
-        ldlibpath = ""
-
-    if os.path.exists(args.elf_file):
-        myelffile = args.elf_file
-    else:
-        myelffile = search_file(args.elf_file,
-                                ldlibpath + ":/usr/lib64:/lib64:/usr/lib:/lib")
-
-    if myelffile is None:
-        print("File not found")
-        sys.exit(1)
-
-    with open(myelffile, 'rb') as file:
+    for b in binaries:
+        logging.debug("analyzing %s", b)
         try:
-            readelf = ReadElf(file, sys.stdout)
-            readelf.process_dt_needed_entries()
-            readelf.display_pmd_info_strings(".rodata")
-            sys.exit(0)
+            for s in get_elf_strings(b, ".rodata", "PMD_INFO_STRING="):
+                try:
+                    info = json.loads(s)
+                    # convert numerical ids to hex strings
+                    pci_ids = []
+                    for vendor, device, subven, subdev in info.pop("pci_ids"):
+                        pci_ids.append(
+                            {
+                                "vendor": f"{vendor:04x}",
+                                "device": f"{device:04x}",
+                                "subsystem_vendor": f"{subven:04x}",
+                                "subsystem_device": f"{subdev:04x}",
+                            }
+                        )
+                    info["pci_ids"] = pci_ids
+                    drivers.append(info)
+                except ValueError as e:
+                    # invalid JSON, should never happen
+                    logging.warning("%s: %s", b, e)
+        except ELFError as e:
+            # only happens for discovered plugins that are not ELF
+            logging.debug("%s: cannot parse ELF: %s", b, e)
 
-        except ELFError as ex:
-            sys.stderr.write('ELF error: %s\n' % ex)
-            sys.exit(1)
+    return drivers
 
 
-# -------------------------------------------------------------------------
-if __name__ == '__main__':
-    main()
+# ----------------------------------------------------------------------------
+def get_plugin_libs(binaries: Iterable[Path]) -> Iterator[Path]:
+    """
+    Look into the provided binaries for DPDK_PLUGIN_PATH and scan the path
+    for files.
+    """
+    for b in binaries:
+        for p in get_elf_strings(b, ".rodata", "DPDK_PLUGIN_PATH="):
+            plugin_path = p.strip()
+            logging.debug("discovering plugins in %s", plugin_path)
+            for root, _, files in os.walk(plugin_path):
+                for f in files:
+                    yield Path(root) / f
+            # no need to search in other binaries.
+            return
+
+
+# ----------------------------------------------------------------------------
+def existing_file(value: str) -> Path:
+    """
+    Argparse type= callback to ensure an argument points to a valid file path.
+    """
+    path = Path(value)
+    if not path.is_file():
+        raise argparse.ArgumentTypeError(f"{value}: No such file")
+    return path
+
+
+# ----------------------------------------------------------------------------
+PRINTABLE_BYTES = frozenset(string.printable.encode("ascii"))
+
+
+def find_strings(buf: bytes, prefix: str) -> Iterator[str]:
+    """
+    Extract strings of printable ASCII characters from a bytes buffer.
+    """
+    view = memoryview(buf)
+    start = None
+
+    for i, b in enumerate(view):
+        if start is None and b in PRINTABLE_BYTES:
+            # mark beginning of string
+            start = i
+            continue
+        if start is not None:
+            if b in PRINTABLE_BYTES:
+                # string not finished
+                continue
+            if b == 0:
+                # end of string
+                s = view[start:i].tobytes().decode("ascii")
+                if s.startswith(prefix):
+                    yield s[len(prefix) :]
+            # There can be byte sequences where a non-printable byte
+            # follows a printable one. Ignore that.
+            start = None
+
+
+# ----------------------------------------------------------------------------
+def elftools_version():
+    """
+    Extract pyelftools version as a tuple of integers for easy comparison.
+    """
+    version = getattr(elftools, "__version__", "")
+    match = re.match(r"^(\d+)\.(\d+).*$", str(version))
+    if not match:
+        # cannot determine version, hope for the best
+        return (0, 24)
+    return (int(match[1]), int(match[2]))
+
+
+ELFTOOLS_VERSION = elftools_version()
+
+
+def from_elftools(s: Union[bytes, str]) -> str:
+    """
+    Earlier versions of pyelftools (< 0.24) return bytes encoded with "latin-1"
+    instead of python strings.
+    """
+    if isinstance(s, bytes):
+        return s.decode("latin-1")
+    return s
+
+
+def to_elftools(s: str) -> Union[bytes, str]:
+    """
+    Earlier versions of pyelftools (< 0.24) assume that ELF section and tags
+    are bytes encoded with "latin-1" instead of python strings.
+    """
+    if ELFTOOLS_VERSION < (0, 24):
+        return s.encode("latin-1")
+    return s
+
+
+# ----------------------------------------------------------------------------
+def get_elf_strings(path: Path, section: str, prefix: str) -> Iterator[str]:
+    """
+    Extract strings from a named ELF section in a file.
+    """
+    with path.open("rb") as f:
+        elf = ELFFile(f)
+        sec = elf.get_section_by_name(to_elftools(section))
+        if not sec:
+            return
+        yield from find_strings(sec.data(), prefix)
+
+
+# ----------------------------------------------------------------------------
+def ld_so_path() -> Iterator[str]:
+    """
+    Return the list of directories where dynamic libraries are loaded based
+    on the contents of /etc/ld.so.conf/*.conf.
+    """
+    for conf in glob.iglob("/etc/ld.so.conf/*.conf"):
+        try:
+            with open(conf, "r", encoding="utf-8") as f:
+                for line in f:
+                    line = line.strip()
+                    if os.path.isdir(line):
+                        yield line
+        except OSError:
+            pass
+
+
+LD_SO_CONF_PATH = ld_so_path()
+
+
+def search_dt_needed(origin: Path, needed: str, runpath: List[str]) -> Path:
+    """
+    Search a file into LD_LIBRARY_PATH (if defined), runpath (if set) and in
+    all folders declared in /etc/ld.so.conf/*.conf. Finally, look in the
+    standard folders (/lib followed by /usr/lib).
+    """
+    folders = []
+    if "LD_LIBRARY_PATH" in os.environ:
+        folders += os.environ["LD_LIBRARY_PATH"].split(":")
+    folders += runpath
+    folders += LD_SO_CONF_PATH
+    folders += ["/lib", "/usr/lib"]
+    for d in folders:
+        d = d.replace("$ORIGIN", str(origin.parent.absolute()))
+        filepath = Path(d) / needed
+        if filepath.is_file():
+            return filepath
+    raise FileNotFoundError(needed)
+
+
+# ----------------------------------------------------------------------------
+def get_needed_libs(path: Path) -> Iterator[Path]:
+    """
+    Extract the dynamic library dependencies from an ELF executable.
+    """
+    with path.open("rb") as f:
+        elf = ELFFile(f)
+        dyn = elf.get_section_by_name(to_elftools(".dynamic"))
+        if not dyn:
+            return
+        runpath = []
+        for tag in dyn.iter_tags(to_elftools("DT_RUNPATH")):
+            runpath += from_elftools(tag.runpath).split(":")
+        for tag in dyn.iter_tags(to_elftools("DT_NEEDED")):
+            needed = from_elftools(tag.needed)
+            if not needed.startswith("librte_"):
+                continue
+            logging.debug("%s: DT_NEEDED %s", path, needed)
+            try:
+                yield search_dt_needed(path, needed, runpath)
+            except FileNotFoundError:
+                logging.warning("%s: DT_NEEDED not found: %s", path, needed)
+
+
+# ----------------------------------------------------------------------------
+if __name__ == "__main__":
+    sys.exit(main())
-- 
2.37.3


^ permalink raw reply	[relevance 1%]

* [PATCH] usertools: rewrite pmdinfo
@ 2022-09-13 10:58  1% Robin Jarry
  2022-09-13 19:42  1% ` [PATCH v2] " Robin Jarry
                   ` (2 more replies)
  0 siblings, 3 replies; 200+ results
From: Robin Jarry @ 2022-09-13 10:58 UTC (permalink / raw)
  To: dev; +Cc: Robin Jarry, Olivier Matz

dpdk-pmdinfo.py does not produce any parseable output. The -r/--raw flag
merely prints multiple independent JSON lines which cannot be fed
directly to any JSON parser. Moreover, the script complexity is rather
high for such a simple task: extracting PMD_INFO_STRING from .rodata ELF
sections. Rewrite it so that it can produce valid JSON.

Remove the PCI database parsing for PCI-ID to Vendor-Device names
conversion. This should be done by external scripts (if really needed).

Here are some examples of use with jq:

Get the complete info for a given driver:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.name == "dmadev_idxd_pci")'
 {
   "name": "dmadev_idxd_pci",
   "params": "max_queues=0",
   "kmod": "vfio-pci",
   "devices": [
     {
       "vendor_id": "8086",
       "device_id": "0b25",
       "subsystem_device_id": "ffff",
       "subsystem_system_id": "ffff"
     }
   ]
 }

Get only the required kernel modules for a given driver:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.name == "net_i40e").kmod'
 "* igb_uio | uio_pci_generic | vfio-pci"

Get only the required kernel modules for a given device:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.devices[] | .vendor_id == "15b3" and .device_id == "1013").kmod'
 "* ib_uverbs & mlx5_core & mlx5_ib"

Print the list of drivers which define multiple parameters without
string separators:

 ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \
   jq '.[] | select(.params!=null and (.params|test("=[^ ]+="))) | {name, params}'
 ...

The script passes flake8, black, isort and pylint checks.

I have tested this with a matrix of python/pyelftools versions:

                             pyelftools
               0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29
         3.6     ok   ok   ok   ok   ok   ok   ok   ok
         3.7     ok   ok   ok   ok   ok   ok   ok   ok
  Python 3.8     ok   ok   ok   ok   ok   ok   ok   ok
         3.9     ok   ok   ok   ok   ok   ok   ok   ok
         3.10  fail fail fail fail   ok   ok   ok   ok

All failures with python 3.10 are related to the same issue:

  File "elftools/construct/lib/container.py", line 5, in <module>
    from collections import MutableMapping
  ImportError: cannot import name 'MutableMapping' from 'collections'

Python 3.10 support is only available since pyelftools 0.26.

NB: The output produced by the legacy -r/--raw flag can be obtained with
the following command:

  strings build/app/dpdk-testpmd | sed -n 's/^PMD_INFO_STRING= //p'

Cc: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
---
There were multiple compatibility issues with this script in the past
years. Also, the style and complexity may be unsettling for python
developers. After this patch, maintenance should be much easier.

 doc/guides/rel_notes/release_22_11.rst |   5 +
 usertools/dpdk-pmdinfo.py              | 856 ++++++++-----------------
 2 files changed, 261 insertions(+), 600 deletions(-)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf0505e..67054f5acdc9 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* The ``dpdk-pmdinfo.py`` script was rewritten to produce valid JSON only.
+  PCI-IDs parsing has been removed.
+  To get a similar output to the (now removed) ``-r/--raw`` flag, you may use the following command::
+
+     strings $dpdk_binary_or_driver | sed -n 's/^PMD_INFO_STRING= //p'
 
 ABI Changes
 -----------
diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py
index 40ef5cec6cba..cc72e5ce27a2 100755
--- a/usertools/dpdk-pmdinfo.py
+++ b/usertools/dpdk-pmdinfo.py
@@ -1,626 +1,282 @@
 #!/usr/bin/env python3
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2016  Neil Horman <nhorman@tuxdriver.com>
+# Copyright(c) 2022  Robin Jarry
+# pylint: disable=invalid-name
 
-# -------------------------------------------------------------------------
-#
-# Utility to dump PMD_INFO_STRING support from an object file
-#
-# -------------------------------------------------------------------------
+r"""
+Utility to dump PMD_INFO_STRING support from DPDK binaries.
+
+This script prints JSON output to be interpreted by other tools. Here are some
+examples with jq:
+
+Get the complete info for a given driver:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.name == "cnxk_nix_inl")'
+
+Get only the required kernel modules for a given driver:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.name == "net_i40e").kmod'
+
+Get only the required kernel modules for a given device:
+
+  %(prog)s dpdk-testpmd | \
+  jq '.[] | select(.devices[] | .vendor_id == "15b3" and .device_id == "1013").kmod'
+"""
+
+import argparse
 import json
 import os
-import platform
+import re
+import string
 import sys
-import argparse
-from elftools.common.exceptions import ELFError
-from elftools.common.py3compat import byte2int
-from elftools.elf.elffile import ELFFile
+from pathlib import Path
+from typing import Iterable, Iterator, List, Union
 
+import elftools
+from elftools.elf.elffile import ELFError, ELFFile
 
-# For running from development directory. It should take precedence over the
-# installed pyelftools.
-sys.path.insert(0, '.')
-
-raw_output = False
-pcidb = None
-
-# ===========================================
-
-class Vendor:
-    """
-    Class for vendors. This is the top level class
-    for the devices belong to a specific vendor.
-    self.devices is the device dictionary
-    subdevices are in each device.
-    """
-
-    def __init__(self, vendorStr):
-        """
-        Class initializes with the raw line from pci.ids
-        Parsing takes place inside __init__
-        """
-        self.ID = vendorStr.split()[0]
-        self.name = vendorStr.replace("%s " % self.ID, "").rstrip()
-        self.devices = {}
-
-    def addDevice(self, deviceStr):
-        """
-        Adds a device to self.devices
-        takes the raw line from pci.ids
-        """
-        s = deviceStr.strip()
-        devID = s.split()[0]
-        if devID in self.devices:
-            pass
-        else:
-            self.devices[devID] = Device(deviceStr)
-
-    def report(self):
-        print(self.ID, self.name)
-        for id, dev in self.devices.items():
-            dev.report()
-
-    def find_device(self, devid):
-        # convert to a hex string and remove 0x
-        devid = hex(devid)[2:]
-        try:
-            return self.devices[devid]
-        except:
-            return Device("%s  Unknown Device" % devid)
-
-
-class Device:
-
-    def __init__(self, deviceStr):
-        """
-        Class for each device.
-        Each vendor has its own devices dictionary.
-        """
-        s = deviceStr.strip()
-        self.ID = s.split()[0]
-        self.name = s.replace("%s  " % self.ID, "")
-        self.subdevices = {}
-
-    def report(self):
-        print("\t%s\t%s" % (self.ID, self.name))
-        for subID, subdev in self.subdevices.items():
-            subdev.report()
-
-    def addSubDevice(self, subDeviceStr):
-        """
-        Adds a subvendor, subdevice to device.
-        Uses raw line from pci.ids
-        """
-        s = subDeviceStr.strip()
-        spl = s.split()
-        subVendorID = spl[0]
-        subDeviceID = spl[1]
-        subDeviceName = s.split("  ")[-1]
-        devID = "%s:%s" % (subVendorID, subDeviceID)
-        self.subdevices[devID] = SubDevice(
-            subVendorID, subDeviceID, subDeviceName)
-
-    def find_subid(self, subven, subdev):
-        subven = hex(subven)[2:]
-        subdev = hex(subdev)[2:]
-        devid = "%s:%s" % (subven, subdev)
-
-        try:
-            return self.subdevices[devid]
-        except:
-            if (subven == "ffff" and subdev == "ffff"):
-                return SubDevice("ffff", "ffff", "(All Subdevices)")
-            return SubDevice(subven, subdev, "(Unknown Subdevice)")
-
-
-class SubDevice:
-    """
-    Class for subdevices.
-    """
-
-    def __init__(self, vendor, device, name):
-        """
-        Class initializes with vendorid, deviceid and name
-        """
-        self.vendorID = vendor
-        self.deviceID = device
-        self.name = name
-
-    def report(self):
-        print("\t\t%s\t%s\t%s" % (self.vendorID, self.deviceID, self.name))
-
-
-class PCIIds:
-    """
-    Top class for all pci.ids entries.
-    All queries will be asked to this class.
-    PCIIds.vendors["0e11"].devices["0046"].\
-    subdevices["0e11:4091"].name  =  "Smart Array 6i"
-    """
-
-    def __init__(self, filename):
-        """
-        Prepares the directories.
-        Checks local data file.
-        Tries to load from local, if not found, downloads from web
-        """
-        self.version = ""
-        self.date = ""
-        self.vendors = {}
-        self.contents = None
-        self.readLocal(filename)
-        self.parse()
-
-    def reportVendors(self):
-        """Reports the vendors
-        """
-        for vid, v in self.vendors.items():
-            print(v.ID, v.name)
-
-    def report(self, vendor=None):
-        """
-        Reports everything for all vendors or a specific vendor
-        PCIIds.report()  reports everything
-        PCIIDs.report("0e11") reports only "Compaq Computer Corporation"
-        """
-        if vendor is not None:
-            self.vendors[vendor].report()
-        else:
-            for vID, v in self.vendors.items():
-                v.report()
-
-    def find_vendor(self, vid):
-        # convert vid to a hex string and remove the 0x
-        vid = hex(vid)[2:]
-
-        try:
-            return self.vendors[vid]
-        except:
-            return Vendor("%s Unknown Vendor" % (vid))
-
-    def findDate(self, content):
-        for l in content:
-            if l.find("Date:") > -1:
-                return l.split()[-2].replace("-", "")
-        return None
-
-    def parse(self):
-        if not self.contents:
-            print("data/%s-pci.ids not found" % self.date)
-        else:
-            vendorID = ""
-            deviceID = ""
-            for l in self.contents:
-                if l[0] == "#":
-                    continue
-                elif not l.strip():
-                    continue
-                else:
-                    if l.find("\t\t") == 0:
-                        self.vendors[vendorID].devices[
-                            deviceID].addSubDevice(l)
-                    elif l.find("\t") == 0:
-                        deviceID = l.strip().split()[0]
-                        self.vendors[vendorID].addDevice(l)
-                    else:
-                        vendorID = l.split()[0]
-                        self.vendors[vendorID] = Vendor(l)
-
-    def readLocal(self, filename):
-        """
-        Reads the local file
-        """
-        with open(filename, 'r', encoding='utf-8') as f:
-            self.contents = f.readlines()
-        self.date = self.findDate(self.contents)
-
-    def loadLocal(self):
-        """
-        Loads database from local. If there is no file,
-        it creates a new one from web
-        """
-        self.date = idsfile[0].split("/")[1].split("-")[0]
-        self.readLocal()
-
-
-# =======================================
-
-def search_file(filename, search_path):
-    """ Given a search path, find file with requested name """
-    for path in search_path.split(':'):
-        candidate = os.path.join(path, filename)
-        if os.path.exists(candidate):
-            return os.path.abspath(candidate)
-    return None
-
-
-class ReadElf(object):
-    """ display_* methods are used to emit output into the output stream
-    """
-
-    def __init__(self, file, output):
-        """ file:
-                stream object with the ELF file to read
-
-            output:
-                output stream to write to
-        """
-        self.elffile = ELFFile(file)
-        self.output = output
-
-        # Lazily initialized if a debug dump is requested
-        self._dwarfinfo = None
-
-        self._versioninfo = None
-
-    def _section_from_spec(self, spec):
-        """ Retrieve a section given a "spec" (either number or name).
-            Return None if no such section exists in the file.
-        """
-        try:
-            num = int(spec)
-            if num < self.elffile.num_sections():
-                return self.elffile.get_section(num)
-            return None
-        except ValueError:
-            # Not a number. Must be a name then
-            section = self.elffile.get_section_by_name(force_unicode(spec))
-            if section is None:
-                # No match with a unicode name.
-                # Some versions of pyelftools (<= 0.23) store internal strings
-                # as bytes. Try again with the name encoded as bytes.
-                section = self.elffile.get_section_by_name(force_bytes(spec))
-            return section
-
-    def pretty_print_pmdinfo(self, pmdinfo):
-        global pcidb
-
-        for i in pmdinfo["pci_ids"]:
-            vendor = pcidb.find_vendor(i[0])
-            device = vendor.find_device(i[1])
-            subdev = device.find_subid(i[2], i[3])
-            print("%s (%s) : %s (%s) %s" %
-                  (vendor.name, vendor.ID, device.name,
-                   device.ID, subdev.name))
-
-    def parse_pmd_info_string(self, mystring):
-        global raw_output
-        global pcidb
-
-        optional_pmd_info = [
-            {'id': 'params', 'tag': 'PMD PARAMETERS'},
-            {'id': 'kmod', 'tag': 'PMD KMOD DEPENDENCIES'}
-        ]
-
-        i = mystring.index("=")
-        mystring = mystring[i + 2:]
-        pmdinfo = json.loads(mystring)
-
-        if raw_output:
-            print(json.dumps(pmdinfo))
-            return
-
-        print("PMD NAME: " + pmdinfo["name"])
-        for i in optional_pmd_info:
-            try:
-                print("%s: %s" % (i['tag'], pmdinfo[i['id']]))
-            except KeyError:
-                continue
-
-        if pmdinfo["pci_ids"]:
-            print("PMD HW SUPPORT:")
-            if pcidb is not None:
-                self.pretty_print_pmdinfo(pmdinfo)
-            else:
-                print("VENDOR\t DEVICE\t SUBVENDOR\t SUBDEVICE")
-                for i in pmdinfo["pci_ids"]:
-                    print("0x%04x\t 0x%04x\t 0x%04x\t\t 0x%04x" %
-                          (i[0], i[1], i[2], i[3]))
-
-        print("")
-
-    def display_pmd_info_strings(self, section_spec):
-        """ Display a strings dump of a section. section_spec is either a
-            section number or a name.
-        """
-        section = self._section_from_spec(section_spec)
-        if section is None:
-            return
-
-        data = section.data()
-        dataptr = 0
-
-        while dataptr < len(data):
-            while (dataptr < len(data) and
-                   not 32 <= byte2int(data[dataptr]) <= 127):
-                dataptr += 1
-
-            if dataptr >= len(data):
-                break
-
-            endptr = dataptr
-            while endptr < len(data) and byte2int(data[endptr]) != 0:
-                endptr += 1
-
-            # pyelftools may return byte-strings, force decode them
-            mystring = force_unicode(data[dataptr:endptr])
-            rc = mystring.find("PMD_INFO_STRING")
-            if rc != -1:
-                self.parse_pmd_info_string(mystring[rc:])
-
-            dataptr = endptr
-
-    def find_librte_eal(self, section):
-        for tag in section.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_NEEDED':
-                if "librte_eal" in force_unicode(tag.needed):
-                    return force_unicode(tag.needed)
-        return None
-
-    def search_for_autoload_path(self):
-        scanelf = self
-        scanfile = None
-        library = None
-
-        section = self._section_from_spec(".dynamic")
-        try:
-            eallib = self.find_librte_eal(section)
-            if eallib is not None:
-                ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-                if ldlibpath is None:
-                    ldlibpath = ""
-                dtr = self.get_dt_runpath(section)
-                library = search_file(eallib,
-                                      dtr + ":" + ldlibpath +
-                                      ":/usr/lib64:/lib64:/usr/lib:/lib")
-                if library is None:
-                    return (None, None)
-                if not raw_output:
-                    print("Scanning for autoload path in %s" % library)
-                scanfile = open(library, 'rb')
-                scanelf = ReadElf(scanfile, sys.stdout)
-        except AttributeError:
-            # Not a dynamic binary
-            pass
-        except ELFError:
-            scanfile.close()
-            return (None, None)
-
-        section = scanelf._section_from_spec(".rodata")
-        if section is None:
-            if scanfile is not None:
-                scanfile.close()
-            return (None, None)
-
-        data = section.data()
-        dataptr = 0
-
-        while dataptr < len(data):
-            while (dataptr < len(data) and
-                   not 32 <= byte2int(data[dataptr]) <= 127):
-                dataptr += 1
-
-            if dataptr >= len(data):
-                break
-
-            endptr = dataptr
-            while endptr < len(data) and byte2int(data[endptr]) != 0:
-                endptr += 1
-
-            # pyelftools may return byte-strings, force decode them
-            mystring = force_unicode(data[dataptr:endptr])
-            rc = mystring.find("DPDK_PLUGIN_PATH")
-            if rc != -1:
-                rc = mystring.find("=")
-                return (mystring[rc + 1:], library)
-
-            dataptr = endptr
-        if scanfile is not None:
-            scanfile.close()
-        return (None, None)
-
-    def get_dt_runpath(self, dynsec):
-        for tag in dynsec.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_RUNPATH':
-                return force_unicode(tag.runpath)
-        return ""
-
-    def process_dt_needed_entries(self):
-        """ Look to see if there are any DT_NEEDED entries in the binary
-            And process those if there are
-        """
-        runpath = ""
-        ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-        if ldlibpath is None:
-            ldlibpath = ""
-
-        dynsec = self._section_from_spec(".dynamic")
-        try:
-            runpath = self.get_dt_runpath(dynsec)
-        except AttributeError:
-            # dynsec is None, just return
-            return
-
-        for tag in dynsec.iter_tags():
-            # pyelftools may return byte-strings, force decode them
-            if force_unicode(tag.entry.d_tag) == 'DT_NEEDED':
-                if 'librte_' in force_unicode(tag.needed):
-                    library = search_file(force_unicode(tag.needed),
-                                          runpath + ":" + ldlibpath +
-                                          ":/usr/lib64:/lib64:/usr/lib:/lib")
-                    if library is not None:
-                        with open(library, 'rb') as file:
-                            try:
-                                libelf = ReadElf(file, sys.stdout)
-                            except ELFError:
-                                print("%s is no an ELF file" % library)
-                                continue
-                            libelf.process_dt_needed_entries()
-                            libelf.display_pmd_info_strings(".rodata")
-                            file.close()
-
-
-# compat: remove force_unicode & force_bytes when pyelftools<=0.23 support is
-# dropped.
-def force_unicode(s):
-    if hasattr(s, 'decode') and callable(s.decode):
-        s = s.decode('latin-1')  # same encoding used in pyelftools py3compat
-    return s
-
-
-def force_bytes(s):
-    if hasattr(s, 'encode') and callable(s.encode):
-        s = s.encode('latin-1')  # same encoding used in pyelftools py3compat
-    return s
-
-
-def scan_autoload_path(autoload_path):
-    global raw_output
-
-    if not os.path.exists(autoload_path):
-        return
 
+# ----------------------------------------------------------------------------
+def main() -> int:  # pylint: disable=missing-docstring
     try:
-        dirs = os.listdir(autoload_path)
-    except OSError:
-        # Couldn't read the directory, give up
-        return
+        args = parse_args()
+        info = parse_pmdinfo(args.elf_files, args.search_plugins)
+        json.dump(info, sys.stdout, indent=2)
+        sys.stdout.write("\n")
+    except BrokenPipeError:
+        pass
+    except KeyboardInterrupt:
+        return 1
+    except Exception as e:  # pylint: disable=broad-except
+        print(f"error: {e}", file=sys.stderr)
+        return 1
 
-    for d in dirs:
-        dpath = os.path.join(autoload_path, d)
-        if os.path.isdir(dpath):
-            scan_autoload_path(dpath)
-        if os.path.isfile(dpath):
-            try:
-                file = open(dpath, 'rb')
-                readelf = ReadElf(file, sys.stdout)
-            except ELFError:
-                # this is likely not an elf file, skip it
-                continue
-            except IOError:
-                # No permission to read the file, skip it
-                continue
-
-            if not raw_output:
-                print("Hw Support for library %s" % d)
-            readelf.display_pmd_info_strings(".rodata")
-            file.close()
+    return 0
 
 
-def scan_for_autoload_pmds(dpdk_path):
+# ----------------------------------------------------------------------------
+def parse_args() -> argparse.Namespace:
     """
-    search the specified application or path for a pmd autoload path
-    then scan said path for pmds and report hw support
+    Parse command line arguments.
     """
-    global raw_output
-
-    if not os.path.isfile(dpdk_path):
-        if not raw_output:
-            print("Must specify a file name")
-        return
-
-    file = open(dpdk_path, 'rb')
-    try:
-        readelf = ReadElf(file, sys.stdout)
-    except ElfError:
-        if not raw_output:
-            print("Unable to parse %s" % file)
-        return
-
-    (autoload_path, scannedfile) = readelf.search_for_autoload_path()
-    if not autoload_path:
-        if not raw_output:
-            print("No autoload path configured in %s" % dpdk_path)
-        return
-    if not raw_output:
-        if scannedfile is None:
-            scannedfile = dpdk_path
-        print("Found autoload path %s in %s" % (autoload_path, scannedfile))
-
-    file.close()
-    if not raw_output:
-        print("Discovered Autoload HW Support:")
-    scan_autoload_path(autoload_path)
-    return
-
-
-def main(stream=None):
-    global raw_output
-    global pcidb
-
-    pcifile_default = "./pci.ids"  # For unknown OS's assume local file
-    if platform.system() == 'Linux':
-        # hwdata is the legacy location, misc is supported going forward
-        pcifile_default = "/usr/share/misc/pci.ids"
-        if not os.path.exists(pcifile_default):
-            pcifile_default = "/usr/share/hwdata/pci.ids"
-    elif platform.system() == 'FreeBSD':
-        pcifile_default = "/usr/local/share/pciids/pci.ids"
-        if not os.path.exists(pcifile_default):
-            pcifile_default = "/usr/share/misc/pci_vendors"
-
     parser = argparse.ArgumentParser(
-        usage='usage: %(prog)s [-hrtp] [-d <pci id file>] elf_file',
-        description="Dump pmd hardware support info")
-    group = parser.add_mutually_exclusive_group()
-    group.add_argument('-r', '--raw',
-                       action='store_true', dest='raw_output',
-                       help='dump raw json strings')
-    group.add_argument("-t", "--table", dest="tblout",
-                       help="output information on hw support as a hex table",
-                       action='store_true')
-    parser.add_argument("-d", "--pcidb", dest="pcifile",
-                        help="specify a pci database to get vendor names from",
-                        default=pcifile_default, metavar="FILE")
-    parser.add_argument("-p", "--plugindir", dest="pdir",
-                        help="scan dpdk for autoload plugins",
-                        action='store_true')
-    parser.add_argument("elf_file", help="driver shared object file")
-    args = parser.parse_args()
+        description=__doc__,
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+    )
+    parser.add_argument(
+        "-p",
+        "--search-plugins",
+        action="store_true",
+        help="""
+        In addition of ELF_FILEs and their linked dynamic libraries, also scan
+        the DPDK plugins path.
+        """,
+    )
+    parser.add_argument(
+        "elf_files",
+        metavar="ELF_FILE",
+        nargs="+",
+        type=existing_file,
+        help="""
+        DPDK application binary or dynamic library.
+        """,
+    )
+    return parser.parse_args()
 
-    if args.raw_output:
-        raw_output = True
 
-    if args.tblout:
-        args.pcifile = None
+# ----------------------------------------------------------------------------
+def parse_pmdinfo(paths: Iterable[Path], search_plugins: bool) -> List[dict]:
+    """
+    Extract DPDK PMD info JSON strings from an ELF file.
 
-    if args.pcifile:
-        pcidb = PCIIds(args.pcifile)
-        if pcidb is None:
-            print("Pci DB file not found")
-            exit(1)
+    :returns:
+        A list of DPDK drivers info dictionaries.
+    """
+    binaries = set(paths)
+    for p in paths:
+        binaries.update(get_needed_libs(p))
+    if search_plugins:
+        # cast to list to avoid errors with update while iterating
+        binaries.update(list(get_plugin_libs(binaries)))
 
-    if args.pdir:
-        exit(scan_for_autoload_pmds(args.elf_file))
+    drivers = []
 
-    ldlibpath = os.environ.get('LD_LIBRARY_PATH')
-    if ldlibpath is None:
-        ldlibpath = ""
-
-    if os.path.exists(args.elf_file):
-        myelffile = args.elf_file
-    else:
-        myelffile = search_file(args.elf_file,
-                                ldlibpath + ":/usr/lib64:/lib64:/usr/lib:/lib")
-
-    if myelffile is None:
-        print("File not found")
-        sys.exit(1)
-
-    with open(myelffile, 'rb') as file:
+    for b in binaries:
         try:
-            readelf = ReadElf(file, sys.stdout)
-            readelf.process_dt_needed_entries()
-            readelf.display_pmd_info_strings(".rodata")
-            sys.exit(0)
+            for s in get_elf_strings(b, ".rodata", "PMD_INFO_STRING="):
+                try:
+                    info = json.loads(s)
+                    # convert numerical ids to hex strings
+                    info["devices"] = []
+                    for vendor, device, subdev, subsys in info.pop("pci_ids"):
+                        info["devices"].append(
+                            {
+                                "vendor_id": f"{vendor:04x}",
+                                "device_id": f"{device:04x}",
+                                "subsystem_device_id": f"{subdev:04x}",
+                                "subsystem_system_id": f"{subsys:04x}",
+                            }
+                        )
+                    drivers.append(info)
+                except ValueError as e:
+                    print(f"warning: {b}: {e}", file=sys.stderr)
+        except FileNotFoundError as e:
+            print(f"warning: {b}: {e}", file=sys.stderr)
+        except ELFError as e:
+            print(f"warning: {b}: elf error: {e}", file=sys.stderr)
 
-        except ELFError as ex:
-            sys.stderr.write('ELF error: %s\n' % ex)
-            sys.exit(1)
+    return drivers
 
 
-# -------------------------------------------------------------------------
-if __name__ == '__main__':
-    main()
+# ----------------------------------------------------------------------------
+def get_plugin_libs(binaries: Iterable[Path]) -> Iterator[Path]:
+    """
+    Look into the provided binaries for DPDK_PLUGIN_PATH and scan the path
+    for files.
+    """
+    for b in binaries:
+        for p in get_elf_strings(b, ".rodata", "DPDK_PLUGIN_PATH="):
+            plugin_path = p.strip()
+            for root, _, files in os.walk(plugin_path):
+                for f in files:
+                    yield Path(root) / f
+            # no need to search in other binaries.
+            return
+
+
+# ----------------------------------------------------------------------------
+def existing_file(value: str) -> Path:
+    """
+    Argparse type= callback to ensure an argument points to a valid file path.
+    """
+    path = Path(value)
+    if not path.is_file():
+        raise argparse.ArgumentTypeError(f"{value}: No such file")
+    return path
+
+
+# ----------------------------------------------------------------------------
+def search_ld_library_path(name: str) -> Path:
+    """
+    Search a file into LD_LIBRARY_PATH and the standard folders where libraries
+    are usually located.
+
+    :raises FileNotFoundError:
+    """
+    folders = []
+    if "LD_LIBRARY_PATH" in os.environ:
+        folders += os.environ["LD_LIBRARY_PATH"].split(":")
+    folders += ["/usr/lib64", "/lib64", "/usr/lib", "/lib"]
+    for d in folders:
+        filepath = Path(d) / name
+        if filepath.is_file():
+            return filepath
+    raise FileNotFoundError(name)
+
+
+# ----------------------------------------------------------------------------
+PRINTABLE_BYTES = frozenset(string.printable.encode("ascii"))
+
+
+def find_strings(buf: bytes, prefix: str) -> Iterator[str]:
+    """
+    Extract strings of printable ASCII characters from a bytes buffer.
+    """
+    view = memoryview(buf)
+    start = None
+
+    for i, b in enumerate(view):
+        if start is None and b in PRINTABLE_BYTES:
+            # mark begining of string
+            start = i
+            continue
+
+        if start is not None:
+            if b in PRINTABLE_BYTES:
+                # string not finished
+                continue
+            if b == 0:
+                # end of string
+                s = view[start:i].tobytes().decode("ascii")
+                if s.startswith(prefix):
+                    yield s[len(prefix) :]
+            # There can be byte sequences where a non-printable character
+            # follows a printable one. Ignore that.
+            start = None
+
+
+# ----------------------------------------------------------------------------
+def elftools_version():
+    """
+    Extract pyelftools version as a tuple of integers for easy comparison.
+    """
+    version = getattr(elftools, "__version__", "")
+    match = re.match(r"^(\d+)\.(\d+).*$", str(version))
+    if not match:
+        # cannot determine version, hope for the best
+        return (0, 24)
+    return (int(match[1]), int(match[2]))
+
+
+ELFTOOLS_VERSION = elftools_version()
+
+
+def from_elftools(s: Union[bytes, str]) -> str:
+    """
+    Earlier versions of pyelftools (< 0.24) return bytes encoded with "latin-1"
+    instead of python strings.
+    """
+    if isinstance(s, bytes):
+        return s.decode("latin-1")
+    return s
+
+
+def to_elftools(s: str) -> Union[bytes, str]:
+    """
+    Earlier versions of pyelftools (< 0.24) assume that ELF section and tags
+    are bytes encoded with "latin-1" instead of python strings.
+    """
+    if ELFTOOLS_VERSION < (0, 24):
+        return s.encode("latin-1")
+    return s
+
+
+# ----------------------------------------------------------------------------
+def get_elf_strings(path: Path, section: str, prefix: str) -> Iterator[str]:
+    """
+    Extract strings from a named ELF section in a file.
+    """
+    with path.open("rb") as f:
+        elf = ELFFile(f)
+        sec = elf.get_section_by_name(to_elftools(section))
+        if not sec:
+            return
+        yield from find_strings(sec.data(), prefix)
+
+
+# ----------------------------------------------------------------------------
+def get_needed_libs(path: Path) -> Iterator[Path]:
+    """
+    Extract the dynamic library dependencies from an ELF file.
+    """
+    with path.open("rb") as f:
+        elf = ELFFile(f)
+        dyn = elf.get_section_by_name(to_elftools(".dynamic"))
+        if not dyn:
+            return
+        for tag in dyn.iter_tags(to_elftools("DT_NEEDED")):
+            needed = from_elftools(tag.needed)
+            if not needed.startswith("librte_"):
+                continue
+            try:
+                yield search_ld_library_path(needed)
+            except FileNotFoundError:
+                print(f"warning: cannot find {needed}", file=sys.stderr)
+
+
+# ----------------------------------------------------------------------------
+if __name__ == "__main__":
+    sys.exit(main())
-- 
2.37.3


^ permalink raw reply	[relevance 1%]

* [Bug 1079] [dpdk 22.11] kernel/linux/kni meson build failed with gcc 7.5 on suse15.4
@ 2022-09-09  5:30  4% bugzilla
  0 siblings, 0 replies; 200+ results
From: bugzilla @ 2022-09-09  5:30 UTC (permalink / raw)
  To: dev

https://bugs.dpdk.org/show_bug.cgi?id=1079

            Bug ID: 1079
           Summary: [dpdk 22.11] kernel/linux/kni meson build failed with
                    gcc 7.5 on suse15.4
           Product: DPDK
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev@dpdk.org
          Reporter: daxuex.gao@intel.com
  Target Milestone: ---

[DPDK version]:
commit 72206323a5dd3182b13f61b25a64abdddfee595c (HEAD -> main, origin/main,
origin/for-next-net, origin/HEAD)
Author: David Marchand <david.marchand@redhat.com>
Date:   Sat Jul 9 10:43:09 2022 +0200

    version: 22.11-rc0

    Start a new release cycle with empty release notes.

    The ABI version becomes 23.0.
    The map files are updated to the new ABI major number (23).
    The ABI exceptions are dropped and CI ABI checks are disabled because
    compatibility is not preserved.
    Special handling of removed drivers is also dropped in check-abi.sh and
    a note has been added in libabigail.abignore as a reminder.

    Signed-off-by: David Marchand <david.marchand@redhat.com>
    Acked-by: Thomas Monjalon <thomas@monjalon.net>

[OS version]:
openSUSE Leap 15.4/Linux 5.14.21-150400.24.18-default
gcc version 7.5 20220909

[Test Setup]:
sed -i "" "/#define RTE_LIBRTE_PMD_SKELETON_EVENTDEV_DEBUG/d"
config/rte_config.h

CC=gcc meson --werror -Denable_kmods=True -Dlibdir=lib -Dexamples=all
--default-library=static x86_64-native-linuxapp-gcc 
ninja -j 10 -C x86_64-native-linuxapp-gcc/


[Log]
ninja: Entering directory `x86_64-native-linuxapp-gcc'
[3575/3580] Generating rte_kni with a custom command
FAILED: kernel/linux/kni/rte_kni.ko
/usr/bin/make -j4 -C /lib/modules/5.14.21-150400.24.18-default/build
M=/opt/dpdk/x86_64-native-linuxapp-gcc/kernel/linux/kni
src=/opt/dpdk/kernel/linux/kni 'MODULE_CFLAGS= -DHAVE_ARG_TX_QUEUE -include
/opt/dpdk/config/rte_config.h -I/opt/dpdk/lib/eal/include -I/opt/dpdk/lib/kni
-I/opt/dpdk/x86_64-native-linuxapp-gcc -I/opt/dpdk/kernel/linux/kni' modules
make: Entering directory
'/usr/src/linux-5.14.21-150400.24.18-obj/x86_64/default'
  CC [M]  /opt/dpdk/x86_64-native-linuxapp-gcc/kernel/linux/kni/kni_net.o
  CC [M]  /opt/dpdk/x86_64-native-linuxapp-gcc/kernel/linux/kni/kni_misc.o
In file included from
/usr/src/linux-5.14.21-150400.24.18/include/linux/mm_types.h:14:0,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/buildid.h:5,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/module.h:14,
                 from /opt/dpdk/kernel/linux/kni/kni_misc.c:7:
/usr/src/linux-5.14.21-150400.24.18/include/linux/uprobes.h:91:1: internal
compiler error: Segmentation fault
 };
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.opensuse.org/> for instructions.
make[2]: *** [/usr/src/linux-5.14.21-150400.24.18/scripts/Makefile.build:272:
/opt/dpdk/x86_64-native-linuxapp-gcc/kernel/linux/kni/kni_misc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from
/usr/src/linux-5.14.21-150400.24.18/include/linux/cred.h:13:0,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/sched/signal.h:10,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/rcuwait.h:6,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/percpu-rwsem.h:7,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/fs.h:33,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/huge_mm.h:8,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/mm.h:728,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/bvec.h:14,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/skbuff.h:17,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/net/net_namespace.h:39,
                 from
/usr/src/linux-5.14.21-150400.24.18/include/linux/netdevice.h:37,
                 from /opt/dpdk/kernel/linux/kni/kni_net.c:14:
/usr/src/linux-5.14.21-150400.24.18/include/linux/key.h:247:3: internal
compiler error: Segmentation fault
   };
   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.opensuse.org/> for instructions.
make[2]: *** [/usr/src/linux-5.14.21-150400.24.18/scripts/Makefile.build:272:
/opt/dpdk/x86_64-native-linuxapp-gcc/kernel/linux/kni/kni_net.o] Error 1
make[1]: *** [/usr/src/linux-5.14.21-150400.24.18/Makefile:1885:
/opt/dpdk/x86_64-native-linuxapp-gcc/kernel/linux/kni] Error 2
make: *** [../../../linux-5.14.21-150400.24.18/Makefile:220: __sub-make] Error
2
make: Leaving directory
'/usr/src/linux-5.14.21-150400.24.18-obj/x86_64/default'
[3580/3580] Linking target examples/dpdk-vmdq_dcb
ninja: build stopped: subcommand failed.

[Bad commit]
This is new os found problem, old os no found problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[relevance 4%]

* RE: [PATCH v5 23/27] dev: hide driver object
  2022-09-05  8:39  1%   ` [PATCH v5 23/27] dev: hide driver object David Marchand
  2022-09-06  6:05  0%     ` [EXT] " Akhil Goyal
@ 2022-09-06  6:46  0%     ` Gujjar, Abhinandan S
  1 sibling, 0 replies; 200+ results
From: Gujjar, Abhinandan S @ 2022-09-06  6:46 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, Richardson, Bruce, Jayatheerthan, Jay, Ajit Khaparde,
	Chautru, Nicolas, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Zhang, Roy Fan,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Laatz, Kevin, McDaniel, Timothy, Jerin Jacob,
	Elena Agostini, Loftus, Ciara, Zhang, Qi Z, Shepard Siegel,
	Ed Czeck, John Miller, Webster, Steven, Peters, Matt,
	Rasesh Mody, Shahed Shaikh, Somnath Kotur, Rahul Lakkireddy, Su,
	Simei, Wu, Wenjun1, Marcin Wojtas, Michal Krawczyk, Shai Brandes,
	Evgeny Schemeilin, Igor Chauskin, Daley, John, Hyong Youb Kim,
	Gaetan Rivet, Wang, Xiao W, Zhang, Yuying, Xing, Beilei, Wu,
	Jingjing, Yang, Qiming, Matan Azrad, Viacheslav Ovsiienko,
	Chaoyong He, Niklas Soderlund, Harman Kalra,
	Devendra Singh Rawat, Andrew Rybchenko, Maciej Czekaj,
	Maxime Coquelin, Xia, Chenbo, Jochen Behrens, Jakub Palider,
	Tomasz Duszynski, Ori Kam, Akhil Goyal, Chengwen Feng,
	Ray Kinsella, Ferruh Yigit, Matz, Olivier, Pattan,  Reshma

Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, September 5, 2022 2:09 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; Richardson, Bruce <bruce.richardson@intel.com>;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Ajit Khaparde
> <ajit.khaparde@broadcom.com>; Chautru, Nicolas
> <nicolas.chautru@intel.com>; Parav Pandit <parav@nvidia.com>; Xueming Li
> <xuemingl@nvidia.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Sachin Saxena <sachin.saxena@oss.nxp.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; Long Li <longli@microsoft.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; Sunila Sahu <ssahu@marvell.com>; Ashish Gupta
> <ashish.gupta@marvell.com>; Raveendra Padasalagi
> <raveendra.padasalagi@broadcom.com>; Vikas Gupta
> <vikas.gupta@broadcom.com>; Chandubabu Namburu <chandu@amd.com>;
> Ankur Dwivedi <adwivedi@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; Tejasree Kondoj <ktejasree@marvell.com>;
> Gagandeep Singh <g.singh@nxp.com>; Laatz, Kevin <kevin.laatz@intel.com>;
> McDaniel, Timothy <timothy.mcdaniel@intel.com>; Jerin Jacob
> <jerinj@marvell.com>; Elena Agostini <eagostini@nvidia.com>; Loftus, Ciara
> <ciara.loftus@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Shepard Siegel
> <shepard.siegel@atomicrules.com>; Ed Czeck <ed.czeck@atomicrules.com>;
> John Miller <john.miller@atomicrules.com>; Webster, Steven
> <steven.webster@windriver.com>; Peters, Matt <matt.peters@windriver.com>;
> Rasesh Mody <rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>;
> Somnath Kotur <somnath.kotur@broadcom.com>; Rahul Lakkireddy
> <rahul.lakkireddy@chelsio.com>; Su, Simei <simei.su@intel.com>; Wu,
> Wenjun1 <wenjun1.wu@intel.com>; Marcin Wojtas <mw@semihalf.com>;
> Michal Krawczyk <mk@semihalf.com>; Shai Brandes <shaibran@amazon.com>;
> Evgeny Schemeilin <evgenys@amazon.com>; Igor Chauskin
> <igorch@amazon.com>; Daley, John <johndale@cisco.com>; Hyong Youb Kim
> <hyonkim@cisco.com>; Gaetan Rivet <grive@u256.net>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Yang,
> Qiming <qiming.yang@intel.com>; Matan Azrad <matan@nvidia.com>;
> Viacheslav Ovsiienko <viacheslavo@nvidia.com>; Chaoyong He
> <chaoyong.he@corigine.com>; Niklas Soderlund
> <niklas.soderlund@corigine.com>; Harman Kalra <hkalra@marvell.com>;
> Devendra Singh Rawat <dsinghrawat@marvell.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Maciej Czekaj <mczekaj@marvell.com>;
> Maxime Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo
> <chenbo.xia@intel.com>; Jochen Behrens <jbehrens@vmware.com>; Jakub
> Palider <jpalider@marvell.com>; Tomasz Duszynski <tduszynski@marvell.com>;
> Ori Kam <orika@nvidia.com>; Akhil Goyal <gakhil@marvell.com>; Chengwen
> Feng <fengchengwen@huawei.com>; Ray Kinsella <mdr@ashroe.eu>; Ferruh
> Yigit <ferruh.yigit@xilinx.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Matz, Olivier <olivier.matz@6wind.com>;
> Pattan, Reshma <reshma.pattan@intel.com>
> Subject: [PATCH v5 23/27] dev: hide driver object
> 
> Make rte_driver opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Introduce a new driver header and move rte_driver definition.
> Update drivers and library to use the internal header.
> 
> Some applications may have been dereferencing rte_driver objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> Changes since RFC v2:
> - updated release notes,
> - marked accessors as stable,
> 
> ---
>  doc/guides/rel_notes/release_22_11.rst        |  2 ++
>  drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
>  .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
>  drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
>  drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
>  drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
>  drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
>  drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
>  drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
>  drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |  2 +-
>  drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |  2 +-
>  drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |  2 +-
>  drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |  2 +-
>  drivers/bus/pci/bus_pci_driver.h              |  2 +-
>  drivers/bus/pci/pci_params.c                  |  2 +-
>  drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
>  drivers/bus/vdev/vdev.c                       |  2 +-
>  drivers/bus/vdev/vdev_params.c                |  2 +-
>  drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
>  drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
>  drivers/common/qat/qat_qp.c                   |  2 +-
>  drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
>  drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
>  drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
>  drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
>  drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
>  drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
>  drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
>  drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
>  drivers/dma/idxd/idxd_bus.c                   |  1 +
>  drivers/event/dlb2/dlb2.c                     |  2 +-
>  drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
>  drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
>  drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
>  drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
>  drivers/event/octeontx/ssovf_evdev.c          |  2 +-
>  drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
>  drivers/gpu/cuda/cuda.c                       |  2 +-
>  drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
>  drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
>  drivers/net/ark/ark_global.h                  |  2 +-
>  drivers/net/avp/avp_ethdev.c                  |  2 +-
>  drivers/net/axgbe/axgbe_common.h              |  2 +-
>  drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
>  drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
>  drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
>  drivers/net/cxgbe/base/t4_hw.c                |  2 +-
>  drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
>  drivers/net/cxgbe/cxgbe_main.c                |  2 +-
>  drivers/net/cxgbe/sge.c                       |  2 +-
>  drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
>  drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
>  drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
>  drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
>  drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
>  drivers/net/e1000/em_ethdev.c                 |  2 +-
>  drivers/net/e1000/igb_ethdev.c                |  2 +-
>  drivers/net/e1000/igb_flow.c                  |  2 +-
>  drivers/net/ena/ena_ethdev.h                  |  2 +-
>  drivers/net/enic/enic_ethdev.c                |  2 +-
>  drivers/net/enic/enic_vf_representor.c        |  2 +-
>  drivers/net/failsafe/failsafe_private.h       |  2 +-
>  drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
>  drivers/net/i40e/i40e_ethdev.c                |  2 +-
>  drivers/net/iavf/iavf_ethdev.c                |  2 +-
>  drivers/net/iavf/iavf_vchnl.c                 |  2 +-
>  drivers/net/ice/ice_dcf.c                     |  2 +-
>  drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
>  drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
>  drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
>  drivers/net/mlx4/mlx4.c                       |  2 +-
>  drivers/net/netvsc/hn_ethdev.c                |  2 +-
>  drivers/net/netvsc/hn_nvs.c                   |  2 +-
>  drivers/net/netvsc/hn_rndis.c                 |  2 +-
>  drivers/net/netvsc/hn_rxtx.c                  |  2 +-
>  drivers/net/nfp/nfp_common.c                  |  2 +-
>  drivers/net/nfp/nfp_ethdev.c                  |  2 +-
>  drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
>  drivers/net/qede/qede_ethdev.h                |  2 +-
>  drivers/net/sfc/sfc_ethdev.c                  |  2 +-
>  drivers/net/sfc/sfc_sw_stats.c                |  2 +-
>  drivers/net/sfc/sfc_sw_stats.h                |  2 +-
>  drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
>  drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
>  drivers/net/virtio/virtio_ethdev.c            |  2 +-
>  drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
>  drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
>  drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
>  drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
>  drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
>  drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
>  lib/compressdev/rte_compressdev.c             |  2 +-
>  lib/compressdev/rte_compressdev_pmd.c         |  2 +-
>  lib/compressdev/rte_compressdev_pmd.h         |  1 +
>  lib/cryptodev/cryptodev_pmd.c                 |  2 +-
>  lib/cryptodev/cryptodev_pmd.h                 |  1 +
>  lib/cryptodev/rte_cryptodev.c                 |  2 +-
>  lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
>  lib/eal/common/eal_common_dev.c               |  2 +-
>  lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
>  lib/eal/include/meson.build                   |  1 +
>  lib/eal/include/rte_dev.h                     | 15 ++--------
>  lib/eal/version.map                           |  4 +--
>  lib/ethdev/ethdev_driver.h                    |  1 +
>  lib/eventdev/eventdev_pmd.h                   |  2 +-
>  lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
>  lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
>  lib/eventdev/rte_eventdev.c                   |  2 +-
>  lib/gpudev/gpudev_driver.h                    |  2 +-
>  lib/mempool/rte_mempool_ops.c                 |  2 +-
>  lib/pcapng/rte_pcapng.c                       |  2 +-
>  lib/rawdev/rte_rawdev.c                       |  2 +-
>  lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
>  lib/security/rte_security.c                   |  2 +-
>  115 files changed, 144 insertions(+), 122 deletions(-)
>  create mode 100644 lib/eal/include/dev_driver.h
> 
> diff --git a/doc/guides/rel_notes/release_22_11.rst
> b/doc/guides/rel_notes/release_22_11.rst
> index 36df0ccf93..4e20345b7a 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -98,6 +98,8 @@ API Changes
>    ``vdev``, ``vmbus`` buses has been marked as an internal API.
>    External users may still register their driver using the associated driver
>    headers (see ``enable_driver_sdk`` meson option).
> +  The ``rte_driver`` object is now opaque and must be manipulated through
> added
> +  accessors.
> 
>  * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
> 
> diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c
> b/drivers/baseband/acc100/rte_acc100_pmd.c
> index 801e8920df..e2d9409185 100644
> --- a/drivers/baseband/acc100/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_byteorder.h>
> 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 c1d877c87f..51dd090c1b 100644
> --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> index f16814e241..036579e3ec 100644
> --- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> +++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> diff --git a/drivers/bus/auxiliary/auxiliary_params.c
> b/drivers/bus/auxiliary/auxiliary_params.c
> index a889e392c6..e4c7ee0c3b 100644
> --- a/drivers/bus/auxiliary/auxiliary_params.c
> +++ b/drivers/bus/auxiliary/auxiliary_params.c
> @@ -5,7 +5,7 @@
>  #include <string.h>
> 
>  #include <bus_driver.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_kvargs.h>
> 
> diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h
> b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> index 1c2d2c04af..58fb7c7f69 100644
> --- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
> +++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> @@ -25,7 +25,7 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_debug.h>
>  #include <rte_interrupts.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #define RTE_BUS_AUXILIARY_NAME "auxiliary"
> diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h
> b/drivers/bus/dpaa/bus_dpaa_driver.h
> index cf66fc0c53..26a83b2cdf 100644
> --- a/drivers/bus/dpaa/bus_dpaa_driver.h
> +++ b/drivers/bus/dpaa/bus_dpaa_driver.h
> @@ -7,7 +7,7 @@
>  #define BUS_DPAA_DRIVER_H
> 
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_mbuf_dyn.h>
>  #include <rte_mempool.h>
> 
> diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h
> b/drivers/bus/fslmc/bus_fslmc_driver.h
> index 798ddebf3a..7ac5fe6ff1 100644
> --- a/drivers/bus/fslmc/bus_fslmc_driver.h
> +++ b/drivers/bus/fslmc/bus_fslmc_driver.h
> @@ -29,7 +29,7 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_debug.h>
>  #include <rte_interrupts.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_tailq.h>
>  #include <rte_devargs.h>
>  #include <rte_mbuf.h>
> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
> index 8604e43947..5966776a85 100644
> --- a/drivers/bus/fslmc/fslmc_vfio.c
> +++ b/drivers/bus/fslmc/fslmc_vfio.c
> @@ -28,7 +28,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal_memconfig.h>
> 
>  #include "private.h"
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> index cfe4280f87..d7f6e45b7d 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> @@ -18,7 +18,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_mbuf_pool_ops.h>
> 
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> index b7d81b518c..07256ed7ec 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
> 
>  #include <fslmc_logs.h>
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> index 071b0d297d..4aec7b2cd8 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> @@ -30,7 +30,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <fslmc_logs.h>
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> index 223e34bcba..65e2d799c3 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> @@ -10,7 +10,7 @@
>  #include <errno.h>
> 
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "private.h"
>  #include <fslmc_logs.h>
> diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
> index b5c7dee617..0f2f9b5101 100644
> --- a/drivers/bus/pci/bus_pci_driver.h
> +++ b/drivers/bus/pci/bus_pci_driver.h
> @@ -11,7 +11,7 @@ extern "C" {
>  #endif
> 
>  #include <rte_bus_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_compat.h>
> 
>  /** Pathname of PCI devices directory. */
> diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
> index 39d702a418..d24cc201b8 100644
> --- a/drivers/bus/pci/pci_params.c
> +++ b/drivers/bus/pci/pci_params.c
> @@ -6,7 +6,7 @@
> 
>  #include <bus_driver.h>
>  #include <rte_bus_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_kvargs.h>
>  #include <rte_devargs.h>
> diff --git a/drivers/bus/vdev/bus_vdev_driver.h
> b/drivers/bus/vdev/bus_vdev_driver.h
> index 36748cdfae..bc7e30d7c6 100644
> --- a/drivers/bus/vdev/bus_vdev_driver.h
> +++ b/drivers/bus/vdev/bus_vdev_driver.h
> @@ -11,7 +11,7 @@ extern "C" {
> 
>  #include <rte_bus_vdev.h>
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
> 
>  struct rte_vdev_device {
> diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
> index 809a8bb08f..b176b658fc 100644
> --- a/drivers/bus/vdev/vdev.c
> +++ b/drivers/bus/vdev/vdev.c
> @@ -11,7 +11,7 @@
>  #include <sys/queue.h>
> 
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_driver.h>
>  #include <rte_common.h>
>  #include <rte_devargs.h>
> diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
> index 2c72614776..2d10a1e8ad 100644
> --- a/drivers/bus/vdev/vdev_params.c
> +++ b/drivers/bus/vdev/vdev_params.c
> @@ -4,7 +4,7 @@
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
>  #include <rte_errno.h>
> 
> diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h
> b/drivers/bus/vmbus/bus_vmbus_driver.h
> index 3424e791c9..e2475a642d 100644
> --- a/drivers/bus/vmbus/bus_vmbus_driver.h
> +++ b/drivers/bus/vmbus/bus_vmbus_driver.h
> @@ -12,7 +12,7 @@ extern "C" {
> 
>  #include <rte_bus_vmbus.h>
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  struct vmbus_channel;
>  struct vmbus_mon_page;
> diff --git a/drivers/common/qat/dev/qat_dev_gen4.c
> b/drivers/common/qat/dev/qat_dev_gen4.c
> index 7ffde5f4c8..85d6ddfcf4 100644
> --- a/drivers/common/qat/dev/qat_dev_gen4.c
> +++ b/drivers/common/qat/dev/qat_dev_gen4.c
> @@ -2,7 +2,7 @@
>   * Copyright(c) 2021 Intel Corporation
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "qat_device.h"
> diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
> index 5916e745e2..9cbd19a481 100644
> --- a/drivers/common/qat/qat_qp.c
> +++ b/drivers/common/qat/qat_qp.c
> @@ -4,7 +4,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_pci.h>
> diff --git a/drivers/compress/zlib/zlib_pmd_ops.c
> b/drivers/compress/zlib/zlib_pmd_ops.c
> index 7d657d81bc..445a3baa67 100644
> --- a/drivers/compress/zlib/zlib_pmd_ops.c
> +++ b/drivers/compress/zlib/zlib_pmd_ops.c
> @@ -4,7 +4,7 @@
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_common.h>
>  #include <rte_malloc.h>
> 
> diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c
> b/drivers/crypto/bcmfs/bcmfs_qp.c
> index 61d457f4e0..d1ede5e990 100644
> --- a/drivers/crypto/bcmfs/bcmfs_qp.c
> +++ b/drivers/crypto/bcmfs/bcmfs_qp.c
> @@ -8,7 +8,7 @@
>  #include <rte_atomic.h>
>  #include <rte_bitmap.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_prefetch.h>
> diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> index bc7fb67218..78272d616c 100644
> --- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> +++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> @@ -4,7 +4,7 @@
>   */
> 
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_malloc.h>
>  #include <cryptodev_pmd.h>
> diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c
> b/drivers/crypto/ccp/rte_ccp_pmd.c
> index 6c3e45e333..013f3be1e6 100644
> --- a/drivers/crypto/ccp/rte_ccp_pmd.c
> +++ b/drivers/crypto/ccp/rte_ccp_pmd.c
> @@ -9,7 +9,7 @@
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
> 
>  #include "ccp_crypto.h"
> diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c
> b/drivers/crypto/cnxk/cn10k_cryptodev.c
> index 3fd9f3c426..db11ac7444 100644
> --- a/drivers/crypto/cnxk/cn10k_cryptodev.c
> +++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
> @@ -7,7 +7,7 @@
>  #include <rte_crypto.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "cn10k_cryptodev.h"
> diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c
> b/drivers/crypto/cnxk/cn9k_cryptodev.c
> index bd425f95ff..4cfc1f2150 100644
> --- a/drivers/crypto/cnxk/cn9k_cryptodev.c
> +++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
> @@ -7,7 +7,7 @@
>  #include <rte_crypto.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "cn9k_cryptodev.h"
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 0cce861899..3b13578de0 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_common.h>
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c
> b/drivers/crypto/dpaa_sec/dpaa_sec.c
> index 7e554cb2b1..c6bd785262 100644
> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c
> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
> @@ -19,7 +19,7 @@
>  #include <rte_security_driver.h>
>  #endif
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_io.h>
>  #include <rte_ip.h>
>  #include <rte_kvargs.h>
> diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> index 83ae6b6be9..11b559e025 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> @@ -5,7 +5,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_reorder.h>
> diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
> index e30dcfc281..9b7b16c6e3 100644
> --- a/drivers/dma/idxd/idxd_bus.c
> +++ b/drivers/dma/idxd/idxd_bus.c
> @@ -9,6 +9,7 @@
>  #include <libgen.h>
> 
>  #include <bus_driver.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_eal.h>
>  #include <rte_log.h>
> diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
> index 5a443acff8..759578378f 100644
> --- a/drivers/event/dlb2/dlb2.c
> +++ b/drivers/event/dlb2/dlb2.c
> @@ -17,7 +17,7 @@
>  #include <rte_config.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_eventdev.h>
>  #include <eventdev_pmd.h>
> diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
> index 9f8c6cd8b8..71ac141b66 100644
> --- a/drivers/event/dlb2/pf/dlb2_pf.c
> +++ b/drivers/event/dlb2/pf/dlb2_pf.c
> @@ -15,7 +15,7 @@
> 
>  #include <rte_debug.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_mbuf.h>
>  #include <rte_ring.h>
> diff --git a/drivers/event/dpaa/dpaa_eventdev.c
> b/drivers/event/dpaa/dpaa_eventdev.c
> index aa403f9e06..8e470584ea 100644
> --- a/drivers/event/dpaa/dpaa_eventdev.c
> +++ b/drivers/event/dpaa/dpaa_eventdev.c
> @@ -14,7 +14,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_lcore.h>
>  #include <rte_log.h>
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 08df6e223a..1001297cda 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -14,7 +14,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_lcore.h>
> diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> index 3882a9cf1d..a68d3ac154 100644
> --- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> +++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
> 
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/event/octeontx/ssovf_evdev.c
> b/drivers/event/octeontx/ssovf_evdev.c
> index fe157c59d5..99fa326ad5 100644
> --- a/drivers/event/octeontx/ssovf_evdev.c
> +++ b/drivers/event/octeontx/ssovf_evdev.c
> @@ -7,7 +7,7 @@
>  #include <rte_common.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <ethdev_driver.h>
>  #include <rte_event_eth_rx_adapter.h>
> diff --git a/drivers/event/skeleton/skeleton_eventdev.c
> b/drivers/event/skeleton/skeleton_eventdev.c
> index 6bd8fec6d4..8513b9a013 100644
> --- a/drivers/event/skeleton/skeleton_eventdev.c
> +++ b/drivers/event/skeleton/skeleton_eventdev.c
> @@ -12,7 +12,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_log.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
> index 2be7b8d2df..a552aabeb8 100644
> --- a/drivers/gpu/cuda/cuda.c
> +++ b/drivers/gpu/cuda/cuda.c
> @@ -8,7 +8,7 @@
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <rte_byteorder.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <gpudev_driver.h>
> 
> diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> index 56c629c681..84371d5d1a 100644
> --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> @@ -20,7 +20,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include "rte_dpaa2_mempool.h"
> 
>  #include "fslmc_vfio.h"
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index fd7be47311..9957de2314 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -24,7 +24,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_branch_prediction.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_ether.h>
>  #include <rte_lcore.h>
> diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
> index 748db590c1..71d0b53e03 100644
> --- a/drivers/net/ark/ark_global.h
> +++ b/drivers/net/ark/ark_global.h
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_version.h>
> 
>  #include "ark_pktdir.h"
> diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
> index 7c0cb666fb..b2a08f5635 100644
> --- a/drivers/net/avp/avp_ethdev.c
> +++ b/drivers/net/avp/avp_ethdev.c
> @@ -22,7 +22,7 @@
>  #include <rte_cycles.h>
>  #include <rte_spinlock.h>
>  #include <rte_byteorder.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_io.h>
> diff --git a/drivers/net/axgbe/axgbe_common.h
> b/drivers/net/axgbe/axgbe_common.h
> index b9ebf64fb8..a5d11c5832 100644
> --- a/drivers/net/axgbe/axgbe_common.h
> +++ b/drivers/net/axgbe/axgbe_common.h
> @@ -33,7 +33,7 @@
>  #include <rte_memzone.h>
>  #include <rte_ether.h>
>  #include <rte_ethdev.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_pci.h>
>  #include <rte_common.h>
> diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c
> b/drivers/net/bnx2x/bnx2x_ethdev.c
> index f36ad30e17..4448cf2de2 100644
> --- a/drivers/net/bnx2x/bnx2x_ethdev.c
> +++ b/drivers/net/bnx2x/bnx2x_ethdev.c
> @@ -9,7 +9,7 @@
>  #include "bnx2x_rxtx.h"
> 
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_alarm.h>
> 
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index e275d3a53f..1460dce2ab 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -6,7 +6,7 @@
>  #include <inttypes.h>
>  #include <stdbool.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c
> b/drivers/net/bnxt/rte_pmd_bnxt.c
> index 77ecbef04c..fd1506ddd4 100644
> --- a/drivers/net/bnxt/rte_pmd_bnxt.c
> +++ b/drivers/net/bnxt/rte_pmd_bnxt.c
> @@ -7,7 +7,7 @@
>  #include <stdbool.h>
>  #include <unistd.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_cycles.h>
> diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
> index 384080e6d3..bed755f5d9 100644
> --- a/drivers/net/cxgbe/base/t4_hw.c
> +++ b/drivers/net/cxgbe/base/t4_hw.c
> @@ -18,7 +18,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_byteorder.h>
> 
>  #include "common.h"
> diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c
> b/drivers/net/cxgbe/cxgbe_ethdev.c
> index fd71a50a58..45bbeaef0c 100644
> --- a/drivers/net/cxgbe/cxgbe_ethdev.c
> +++ b/drivers/net/cxgbe/cxgbe_ethdev.c
> @@ -31,7 +31,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "cxgbe.h"
>  #include "cxgbe_pfvf.h"
> diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
> index 3c02c98b3d..f8dd833032 100644
> --- a/drivers/net/cxgbe/cxgbe_main.c
> +++ b/drivers/net/cxgbe/cxgbe_main.c
> @@ -31,7 +31,7 @@
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #include "base/common.h"
> diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
> index 5d91355c9a..5b13cb5c94 100644
> --- a/drivers/net/cxgbe/sge.c
> +++ b/drivers/net/cxgbe/sge.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "base/common.h"
>  #include "base/t4_regs.h"
> diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> index 9509f6e8a3..4d33b51fea 100644
> --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <dpaa2_pmd_logs.h>
>  #include <dpaa2_hw_pvt.h>
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c
> b/drivers/net/dpaa2/dpaa2_ethdev.c
> index f876f4790c..37a8b43114 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_flow_driver.h>
>  #include "rte_dpaa2_mempool.h"
> diff --git a/drivers/net/dpaa2/dpaa2_recycle.c
> b/drivers/net/dpaa2/dpaa2_recycle.c
> index 932570c6e0..fbfdf360d1 100644
> --- a/drivers/net/dpaa2/dpaa2_recycle.c
> +++ b/drivers/net/dpaa2/dpaa2_recycle.c
> @@ -14,7 +14,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_flow_driver.h>
> 
> diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
> index 7b9c528d13..9436a95ac8 100644
> --- a/drivers/net/dpaa2/dpaa2_rxtx.c
> +++ b/drivers/net/dpaa2/dpaa2_rxtx.c
> @@ -13,7 +13,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hexdump.h>
> 
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/net/dpaa2/dpaa2_sparser.c
> b/drivers/net/dpaa2/dpaa2_sparser.c
> index ba0d500f74..63463c4fbf 100644
> --- a/drivers/net/dpaa2/dpaa2_sparser.c
> +++ b/drivers/net/dpaa2/dpaa2_sparser.c
> @@ -7,7 +7,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <fslmc_logs.h>
>  #include <fslmc_vfio.h>
> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
> index 409de50083..8ee9be12ad 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -20,7 +20,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "e1000_logs.h"
>  #include "base/e1000_api.h"
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index 43979992d3..d6bcc5bf58 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -22,7 +22,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "e1000_logs.h"
>  #include "base/e1000_api.h"
> diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
> index e46697b6a1..b775310651 100644
> --- a/drivers/net/e1000/igb_flow.c
> +++ b/drivers/net/e1000/igb_flow.c
> @@ -21,7 +21,7 @@
>  #include <rte_eal.h>
>  #include <rte_atomic.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_flow.h>
>  #include <rte_flow_driver.h>
> 
> diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
> index 4709675af8..4d27fba585 100644
> --- a/drivers/net/ena/ena_ethdev.h
> +++ b/drivers/net/ena/ena_ethdev.h
> @@ -14,7 +14,7 @@
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <rte_timer.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_net.h>
> 
>  #include "ena_com.h"
> diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
> index 998436e5e8..cdf0915591 100644
> --- a/drivers/net/enic/enic_ethdev.c
> +++ b/drivers/net/enic/enic_ethdev.c
> @@ -6,7 +6,7 @@
>  #include <stdio.h>
>  #include <stdint.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <ethdev_driver.h>
> diff --git a/drivers/net/enic/enic_vf_representor.c
> b/drivers/net/enic/enic_vf_representor.c
> index 7312c411bd..46f85964e9 100644
> --- a/drivers/net/enic/enic_vf_representor.c
> +++ b/drivers/net/enic/enic_vf_representor.c
> @@ -7,7 +7,7 @@
> 
>  #include <bus_pci_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_flow_driver.h>
> diff --git a/drivers/net/failsafe/failsafe_private.h
> b/drivers/net/failsafe/failsafe_private.h
> index a80f5e2caf..53a451c1b1 100644
> --- a/drivers/net/failsafe/failsafe_private.h
> +++ b/drivers/net/failsafe/failsafe_private.h
> @@ -11,7 +11,7 @@
>  #include <pthread.h>
> 
>  #include <rte_atomic.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_flow.h>
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> b/drivers/net/fm10k/fm10k_ethdev.c
> index 8bbd8b445d..7adb20bff9 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -7,7 +7,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_spinlock.h>
>  #include <rte_kvargs.h>
>  #include <rte_vect.h>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 7bdc453ec1..67111ac251 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -23,7 +23,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_alarm.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_tailq.h>
>  #include <rte_hash_crc.h>
>  #include <rte_bitmap.h>
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 506fcff6e3..ef2ab06475 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -24,7 +24,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "iavf.h"
>  #include "iavf_rxtx.h"
> diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
> index 21bd1e2193..15f695682d 100644
> --- a/drivers/net/iavf/iavf_vchnl.c
> +++ b/drivers/net/iavf/iavf_vchnl.c
> @@ -19,7 +19,7 @@
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "iavf.h"
>  #include "iavf_rxtx.h"
> diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
> index 885d58c0f4..1c3d22ae0f 100644
> --- a/drivers/net/ice/ice_dcf.c
> +++ b/drivers/net/ice/ice_dcf.c
> @@ -21,7 +21,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "ice_dcf.h"
>  #include "ice_rxtx.h"
> diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
> index 0da267db1f..dee712af98 100644
> --- a/drivers/net/ice/ice_dcf_ethdev.c
> +++ b/drivers/net/ice/ice_dcf_ethdev.c
> @@ -18,7 +18,7 @@
>  #include <rte_kvargs.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <iavf_devids.h>
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 552e41692c..04c9ce78a2 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hash_crc.h>
>  #ifdef RTE_LIB_SECURITY
>  #include <rte_security_driver.h>
> diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
> index 368342872a..67373a7b78 100644
> --- a/drivers/net/ixgbe/ixgbe_flow.c
> +++ b/drivers/net/ixgbe/ixgbe_flow.c
> @@ -27,7 +27,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hash_crc.h>
>  #include <rte_flow.h>
>  #include <rte_flow_driver.h>
> diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
> index 910b76a92c..7e7e1824ef 100644
> --- a/drivers/net/mlx4/mlx4.c
> +++ b/drivers/net/mlx4/mlx4.c
> @@ -31,7 +31,7 @@
>  #endif
> 
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
> index ccc06bdda6..d0bbc0a4c0 100644
> --- a/drivers/net/netvsc/hn_ethdev.c
> +++ b/drivers/net/netvsc/hn_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <rte_errno.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_driver.h>
>  #include <bus_vmbus_driver.h>
>  #include <rte_alarm.h>
> diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
> index 817fb06dfb..7db82af9f3 100644
> --- a/drivers/net/netvsc/hn_nvs.c
> +++ b/drivers/net/netvsc/hn_nvs.c
> @@ -28,7 +28,7 @@
>  #include <rte_cycles.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_vmbus_driver.h>
> 
>  #include "hn_logs.h"
> diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
> index 20f75a17b0..e6f1f28768 100644
> --- a/drivers/net/netvsc/hn_rndis.c
> +++ b/drivers/net/netvsc/hn_rndis.c
> @@ -26,7 +26,7 @@
>  #include <rte_cycles.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_vmbus_driver.h>
> 
>  #include "hn_logs.h"
> diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
> index 61cf374224..bc6f60c64a 100644
> --- a/drivers/net/netvsc/hn_rxtx.c
> +++ b/drivers/net/netvsc/hn_rxtx.c
> @@ -25,7 +25,7 @@
>  #include <rte_errno.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_net.h>
>  #include <bus_vmbus_driver.h>
>  #include <rte_spinlock.h>
> diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
> index 0e55f0c792..eaafe11fb9 100644
> --- a/drivers/net/nfp/nfp_common.c
> +++ b/drivers/net/nfp/nfp_common.c
> @@ -19,7 +19,7 @@
>  #include <rte_debug.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ether.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
> index 5cdd34e588..47359501bc 100644
> --- a/drivers/net/nfp/nfp_ethdev.c
> +++ b/drivers/net/nfp/nfp_ethdev.c
> @@ -16,7 +16,7 @@
>  #include <rte_common.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ether.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c
> b/drivers/net/octeontx/octeontx_ethdev.c
> index 9ada22e2ff..0eee191566 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -15,7 +15,7 @@
>  #include <bus_vdev_driver.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_kvargs.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
> index a38b701183..b781bcdcfd 100644
> --- a/drivers/net/qede/qede_ethdev.h
> +++ b/drivers/net/qede/qede_ethdev.h
> @@ -13,7 +13,7 @@
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ip.h>
> 
>  /* ecore includes */
> diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
> index 506c62a726..2ec743ebce 100644
> --- a/drivers/net/sfc/sfc_ethdev.c
> +++ b/drivers/net/sfc/sfc_ethdev.c
> @@ -7,7 +7,7 @@
>   * for Solarflare) and Solarflare Communications, Inc.
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_pci.h>
> diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
> index 81f5aa3cc4..3ae5023b6f 100644
> --- a/drivers/net/sfc/sfc_sw_stats.c
> +++ b/drivers/net/sfc/sfc_sw_stats.c
> @@ -2,7 +2,7 @@
>   *
>   * Copyright(c) 2021 Xilinx, Inc.
>   */
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_bitmap.h>
> 
>  #include "sfc.h"
> diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
> index 1abded8018..d9738e5214 100644
> --- a/drivers/net/sfc/sfc_sw_stats.h
> +++ b/drivers/net/sfc/sfc_sw_stats.h
> @@ -5,7 +5,7 @@
>  #ifndef _SFC_SW_STATS_H
>  #define _SFC_SW_STATS_H
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "sfc.h"
> 
> diff --git a/drivers/net/thunderx/nicvf_ethdev.c
> b/drivers/net/thunderx/nicvf_ethdev.c
> index 28183ec740..9f57cb1a20 100644
> --- a/drivers/net/thunderx/nicvf_ethdev.c
> +++ b/drivers/net/thunderx/nicvf_ethdev.c
> @@ -20,7 +20,7 @@
>  #include <rte_common.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
> diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c
> b/drivers/net/vdev_netvsc/vdev_netvsc.c
> index dc90569df1..c3e045d892 100644
> --- a/drivers/net/vdev_netvsc/vdev_netvsc.c
> +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
> @@ -27,7 +27,7 @@
>  #include <bus_driver.h>
>  #include <bus_vdev_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_ethdev.h>
>  #include <rte_ether.h>
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index d180162abd..edf3becd32 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -24,7 +24,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal_paging.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> 
> diff --git a/drivers/net/virtio/virtio_pci_ethdev.c
> b/drivers/net/virtio/virtio_pci_ethdev.c
> index 2b9e35cef5..abc63b0935 100644
> --- a/drivers/net/virtio/virtio_pci_ethdev.c
> +++ b/drivers/net/virtio/virtio_pci_ethdev.c
> @@ -16,7 +16,7 @@
> 
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #include "virtio.h"
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> index 101b1cb500..fd946dec5c 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "base/vmxnet3_defs.h"
> 
> diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c
> b/drivers/raw/cnxk_bphy/cnxk_bphy.c
> index db029cbf34..909fb8faab 100644
> --- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
> +++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
> @@ -3,7 +3,7 @@
>   */
>  #include <bus_pci_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_lcore.h>
>  #include <rte_pci.h>
> diff --git a/drivers/raw/skeleton/skeleton_rawdev.c
> b/drivers/raw/skeleton/skeleton_rawdev.c
> index 6831cc8d20..5dd5bbb652 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev.c
> @@ -13,7 +13,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_kvargs.h>
>  #include <rte_log.h>
> diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c
> b/drivers/raw/skeleton/skeleton_rawdev_test.c
> index fc257c5f44..8ef7a6b127 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev_test.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
> @@ -6,7 +6,7 @@
>  #include <rte_mbuf.h>
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_rawdev.h>
>  #include <bus_vdev_driver.h>
>  #include <rte_test.h>
> diff --git a/drivers/regex/mlx5/mlx5_regex_control.c
> b/drivers/regex/mlx5/mlx5_regex_control.c
> index 6ab62a12fc..92cf5f495e 100644
> --- a/drivers/regex/mlx5/mlx5_regex_control.c
> +++ b/drivers/regex/mlx5/mlx5_regex_control.c
> @@ -11,7 +11,7 @@
>  #include <rte_regexdev.h>
>  #include <rte_regexdev_core.h>
>  #include <rte_regexdev_driver.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <mlx5_common.h>
>  #include <mlx5_glue.h>
> diff --git a/lib/compressdev/rte_compressdev.c
> b/lib/compressdev/rte_compressdev.c
> index e997bd01ed..cf2c20a704 100644
> --- a/lib/compressdev/rte_compressdev.c
> +++ b/lib/compressdev/rte_compressdev.c
> @@ -8,7 +8,7 @@
> 
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_memzone.h>
> 
> diff --git a/lib/compressdev/rte_compressdev_pmd.c
> b/lib/compressdev/rte_compressdev_pmd.c
> index 9bfae077db..41f1415bea 100644
> --- a/lib/compressdev/rte_compressdev_pmd.c
> +++ b/lib/compressdev/rte_compressdev_pmd.c
> @@ -5,7 +5,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
> 
>  #include "rte_compressdev_internal.h"
> diff --git a/lib/compressdev/rte_compressdev_pmd.h
> b/lib/compressdev/rte_compressdev_pmd.h
> index 9fabc399c5..72e52f876f 100644
> --- a/lib/compressdev/rte_compressdev_pmd.h
> +++ b/lib/compressdev/rte_compressdev_pmd.h
> @@ -19,6 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> +#include <dev_driver.h>
> 
>  #include "rte_compressdev.h"
>  #include "rte_compressdev_internal.h"
> diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
> index 75d0075b86..f07b92dfd7 100644
> --- a/lib/cryptodev/cryptodev_pmd.c
> +++ b/lib/cryptodev/cryptodev_pmd.c
> @@ -4,7 +4,7 @@
> 
>  #include <sys/queue.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
> index 3dcc3cb7ed..96d7e225b0 100644
> --- a/lib/cryptodev/cryptodev_pmd.h
> +++ b/lib/cryptodev/cryptodev_pmd.h
> @@ -19,6 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_log.h>
>  #include <rte_common.h>
> diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
> index 6250302f3b..29c9c55131 100644
> --- a/lib/cryptodev/rte_cryptodev.c
> +++ b/lib/cryptodev/rte_cryptodev.c
> @@ -13,7 +13,7 @@
> 
>  #include <rte_log.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memory.h>
>  #include <rte_memcpy.h>
>  #include <rte_memzone.h>
> diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
> index 82ab7a8cc7..acd7f71cd1 100644
> --- a/lib/dmadev/rte_dmadev_pmd.h
> +++ b/lib/dmadev/rte_dmadev_pmd.h
> @@ -14,7 +14,7 @@
>   * by any application.
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_dmadev.h"
> 
> diff --git a/lib/eal/common/eal_common_dev.c
> b/lib/eal/common/eal_common_dev.c
> index 16c5aef1d8..98f3c78795 100644
> --- a/lib/eal/common/eal_common_dev.c
> +++ b/lib/eal/common/eal_common_dev.c
> @@ -9,7 +9,7 @@
> 
>  #include <bus_driver.h>
>  #include <rte_class.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_errno.h>
>  #include <rte_log.h>
> diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
> new file mode 100644
> index 0000000000..015188abd5
> --- /dev/null
> +++ b/lib/eal/include/dev_driver.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Red Hat, Inc.
> + */
> +
> +#ifndef DEV_DRIVER_H
> +#define DEV_DRIVER_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +#include <rte_dev.h>
> +
> +/**
> + * A structure describing a device driver.
> + */
> +struct rte_driver {
> +	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
> +	const char *name;                   /**< Driver name. */
> +	const char *alias;              /**< Driver alias. */
> +};
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* DEV_DRIVER_H */
> diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
> index 77d8621a51..cfcd40aaed 100644
> --- a/lib/eal/include/meson.build
> +++ b/lib/eal/include/meson.build
> @@ -57,6 +57,7 @@ headers += files(
> 
>  driver_sdk_headers = files(
>          'bus_driver.h',
> +        'dev_driver.h',
>  )
> 
>  # special case install the generic headers, since they go in a subdir
> diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
> index ddea163cca..7214f5d7fb 100644
> --- a/lib/eal/include/rte_dev.h
> +++ b/lib/eal/include/rte_dev.h
> @@ -24,6 +24,8 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_log.h>
> 
> +struct rte_driver;
> +
>  /**
>   * The device event type.
>   */
> @@ -67,27 +69,14 @@ struct rte_mem_resource {
>  	void *addr;         /**< Virtual address, NULL when not mapped. */
>  };
> 
> -/**
> - * A structure describing a device driver.
> - */
> -struct rte_driver {
> -	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
> -	const char *name;                   /**< Driver name. */
> -	const char *alias;              /**< Driver alias. */
> -};
> -
>  /**
>   * Retrieve a driver name.
>   *
> - * @warning
> - * @b EXPERIMENTAL: this API may change without prior notice
> - *
>   * @param driver
>   *   A pointer to a driver structure.
>   * @return
>   *   A pointer to the driver name string.
>   */
> -__rte_experimental
>  const char *
>  rte_driver_name(const struct rte_driver *driver);
> 
> diff --git a/lib/eal/version.map b/lib/eal/version.map
> index d10fd89458..8b53a1d258 100644
> --- a/lib/eal/version.map
> +++ b/lib/eal/version.map
> @@ -37,6 +37,7 @@ DPDK_23 {
>  	rte_devargs_parsef;
>  	rte_devargs_remove;
>  	rte_devargs_type_count;
> +	rte_driver_name;
>  	rte_dump_physmem_layout;
>  	rte_dump_stack;
>  	rte_dump_tailq;
> @@ -423,9 +424,6 @@ EXPERIMENTAL {
>  	rte_thread_self;
>  	rte_thread_set_affinity_by_id;
>  	rte_thread_set_priority;
> -
> -	# added in 22.11
> -	rte_driver_name;
>  };
> 
>  INTERNAL {
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 5101868ea7..47a55a419e 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -19,6 +19,7 @@ extern "C" {
>   *
>   */
> 
> +#include <dev_driver.h>
>  #include <rte_ethdev.h>
> 
>  /**
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index 69402668d8..def6cd0876 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -22,7 +22,7 @@ extern "C" {
>  #include <rte_common.h>
>  #include <rte_compat.h>
>  #include <rte_config.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_log.h>
>  #include <rte_malloc.h>
>  #include <rte_mbuf.h>
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> b/lib/eventdev/rte_event_crypto_adapter.c
> index 4938b4ee07..a8ef5bac06 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -6,7 +6,7 @@
>  #include <string.h>
>  #include <stdbool.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> b/lib/eventdev/rte_event_eth_rx_adapter.c
> index 8e81cf774d..29515401bd 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -9,7 +9,7 @@
> 
>  #include <rte_cycles.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_driver.h>
>  #include <rte_log.h>
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 79b905e9fc..bbb027aa0c 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -12,7 +12,7 @@
> 
>  #include <rte_string_fns.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memzone.h>
>  #include <rte_eal.h>
>  #include <rte_common.h>
> diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
> index 0e55b00bfe..23972b3dbd 100644
> --- a/lib/gpudev/gpudev_driver.h
> +++ b/lib/gpudev/gpudev_driver.h
> @@ -14,7 +14,7 @@
>  #include <stdint.h>
>  #include <sys/queue.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_gpudev.h"
> 
> diff --git a/lib/mempool/rte_mempool_ops.c
> b/lib/mempool/rte_mempool_ops.c
> index ac32c4bb72..3b43edc548 100644
> --- a/lib/mempool/rte_mempool_ops.c
> +++ b/lib/mempool/rte_mempool_ops.c
> @@ -9,7 +9,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_mempool_trace.h"
> 
> diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
> index 72aabd4dd0..af2b814251 100644
> --- a/lib/pcapng/rte_pcapng.c
> +++ b/lib/pcapng/rte_pcapng.c
> @@ -14,7 +14,7 @@
>  #include <bus_driver.h>
>  #include <rte_common.h>
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_ethdev.h>
>  #include <rte_ether.h>
> diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
> index e157d65332..569e836560 100644
> --- a/lib/rawdev/rte_rawdev.c
> +++ b/lib/rawdev/rte_rawdev.c
> @@ -12,7 +12,7 @@
> 
>  #include <rte_string_fns.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_common.h>
>  #include <rte_malloc.h>
>  #include <rte_telemetry.h>
> diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
> index 3b7be57d3e..a51944c8ff 100644
> --- a/lib/rawdev/rte_rawdev_pmd.h
> +++ b/lib/rawdev/rte_rawdev_pmd.h
> @@ -19,7 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_log.h>
>  #include <rte_common.h>
> diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
> index 1a2a408f0e..94160f4177 100644
> --- a/lib/security/rte_security.c
> +++ b/lib/security/rte_security.c
> @@ -5,7 +5,7 @@
>   */
> 
>  #include <rte_cryptodev.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_telemetry.h>
>  #include "rte_security.h"
>  #include "rte_security_driver.h"
> --
> 2.37.2


^ permalink raw reply	[relevance 0%]

* RE: [EXT] [PATCH v5 23/27] dev: hide driver object
  2022-09-05  8:39  1%   ` [PATCH v5 23/27] dev: hide driver object David Marchand
@ 2022-09-06  6:05  0%     ` Akhil Goyal
  2022-09-06  6:46  0%     ` Gujjar, Abhinandan S
  1 sibling, 0 replies; 200+ results
From: Akhil Goyal @ 2022-09-06  6:05 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, bruce.richardson, Jay Jayatheerthan, Ajit Khaparde,
	Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Kevin Laatz, Timothy McDaniel,
	Jerin Jacob Kollanukkaran, Elena Agostini, Ciara Loftus,
	Qi Zhang, Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Gaetan Rivet, Xiao Wang,
	Yuying Zhang, Beilei Xing, Jingjing Wu, Qiming Yang, Matan Azrad,
	Viacheslav Ovsiienko, Chaoyong He, Niklas Soderlund,
	Harman Kalra, Devendra Singh Rawat, Andrew Rybchenko,
	Maciej Czekaj [C],
	Maxime Coquelin, Chenbo Xia, Jochen Behrens, Jakub Palider,
	Tomasz Duszynski, Ori Kam, Chengwen Feng, Ray Kinsella,
	Ferruh Yigit, Abhinandan Gujjar, Olivier Matz, Reshma Pattan

> Make rte_driver opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Introduce a new driver header and move rte_driver definition.
> Update drivers and library to use the internal header.
> 
> Some applications may have been dereferencing rte_driver objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>

^ permalink raw reply	[relevance 0%]

* [PATCH v5 27/27] dev: hide device object
  2022-09-05  8:39  1% ` David Marchand
                     ` (2 preceding siblings ...)
  2022-09-05  8:39  1%   ` [PATCH v5 23/27] dev: hide driver object David Marchand
@ 2022-09-05  8:39  2%   ` David Marchand
  3 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Ray Kinsella, Maxime Coquelin, Chenbo Xia

Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Some applications may have been dereferencing rte_device objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/deprecation.rst   |  7 -----
 doc/guides/rel_notes/release_22_11.rst |  4 +--
 lib/eal/common/eal_private.h           |  2 +-
 lib/eal/include/dev_driver.h           | 13 +++++++++
 lib/eal/include/rte_dev.h              | 37 --------------------------
 lib/eal/version.map                    | 14 +++++-----
 lib/vhost/vdpa.c                       |  1 +
 7 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 98a00da385..64668500c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,13 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* drivers: As a follow-up of the work on the ``rte_bus`` object,
-  the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
-  their bus-specific counterparts) will be made opaque in DPDK 22.11.
-  Registering a driver on a bus will be marked as an internal API:
-  external users may still register their drivers using the bus-specific
-  driver header (see ``enable_driver_sdk`` meson option).
-
 * 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
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4e20345b7a..43502349bd 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,8 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
   headers (see ``enable_driver_sdk`` meson option).
-  The ``rte_driver`` object is now opaque and must be manipulated through added
-  accessors.
+  The ``rte_driver`` and ``rte_device`` objects are now opaque and must be
+  manipulated through added accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..5efa8c437e 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -21,6 +21,19 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index f010dd6441..dc1acc8953 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -86,90 +86,66 @@ rte_driver_name(const struct rte_driver *driver);
 /**
  * Retrieve a device bus.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device bus.
  */
-__rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
 /**
  * Retrieve bus specific information for a device.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A string describing this device or NULL if none is available.
  */
-__rte_experimental
 const char *
 rte_dev_bus_info(const struct rte_device *dev);
 
 /**
  * Retrieve a device arguments.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device devargs.
  */
-__rte_experimental
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev);
 
 /**
  * Retrieve a device driver.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device driver.
  */
-__rte_experimental
 const struct rte_driver *
 rte_dev_driver(const struct rte_device *dev);
 
 /**
  * Retrieve a device name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device name.
  */
-__rte_experimental
 const char *
 rte_dev_name(const struct rte_device *dev);
 
 /**
  * Retrieve a device numa node.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device numa node.
  */
-__rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
@@ -179,19 +155,6 @@ rte_dev_numa_node(const struct rte_device *dev);
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const char *bus_info;         /**< Device bus specific information */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 0cf321605e..3c14cf2724 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -26,7 +26,13 @@ DPDK_23 {
 	rte_delay_us_block;
 	rte_delay_us_callback_register;
 	rte_delay_us_sleep;
+	rte_dev_bus;
+	rte_dev_bus_info;
+	rte_dev_devargs;
+	rte_dev_driver;
 	rte_dev_is_probed;
+	rte_dev_name;
+	rte_dev_numa_node;
 	rte_dev_probe;
 	rte_dev_remove;
 	rte_devargs_add;
@@ -424,14 +430,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_dev_bus;
-	rte_dev_bus_info;
-	rte_dev_devargs;
-	rte_dev_driver;
-	rte_dev_name;
-	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index a6ca785b29..bb828577cb 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.37.2


^ permalink raw reply	[relevance 2%]

* [PATCH v5 23/27] dev: hide driver object
  2022-09-05  8:39  1% ` David Marchand
  2022-09-05  8:39  4%   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
  2022-09-05  8:39  3%   ` [PATCH v5 21/27] bus: hide bus object David Marchand
@ 2022-09-05  8:39  1%   ` David Marchand
  2022-09-06  6:05  0%     ` [EXT] " Akhil Goyal
  2022-09-06  6:46  0%     ` Gujjar, Abhinandan S
  2022-09-05  8:39  2%   ` [PATCH v5 27/27] dev: hide device object David Marchand
  3 siblings, 2 replies; 200+ results
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Jay Jayatheerthan, Ajit Khaparde,
	Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Kevin Laatz, Timothy McDaniel, Jerin Jacob,
	Elena Agostini, Ciara Loftus, Qi Zhang, Shepard Siegel, Ed Czeck,
	John Miller, Steven Webster, Matt Peters, Rasesh Mody,
	Shahed Shaikh, Somnath Kotur, Rahul Lakkireddy, Simei Su,
	Wenjun Wu, Marcin Wojtas, Michal Krawczyk, Shai Brandes,
	Evgeny Schemeilin, Igor Chauskin, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Yuying Zhang, Beilei Xing, Jingjing Wu,
	Qiming Yang, Matan Azrad, Viacheslav Ovsiienko, Chaoyong He,
	Niklas Soderlund, Harman Kalra, Devendra Singh Rawat,
	Andrew Rybchenko, Maciej Czekaj, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Ori Kam,
	Akhil Goyal, Chengwen Feng, Ray Kinsella, Ferruh Yigit,
	Abhinandan Gujjar, Olivier Matz, Reshma Pattan

Make rte_driver opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_driver definition.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_driver objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/release_22_11.rst        |  2 ++
 drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
 drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
 drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
 drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
 drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |  2 +-
 drivers/bus/pci/bus_pci_driver.h              |  2 +-
 drivers/bus/pci/pci_params.c                  |  2 +-
 drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
 drivers/bus/vdev/vdev.c                       |  2 +-
 drivers/bus/vdev/vdev_params.c                |  2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
 drivers/common/qat/qat_qp.c                   |  2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
 drivers/dma/idxd/idxd_bus.c                   |  1 +
 drivers/event/dlb2/dlb2.c                     |  2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
 drivers/event/octeontx/ssovf_evdev.c          |  2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
 drivers/gpu/cuda/cuda.c                       |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
 drivers/net/ark/ark_global.h                  |  2 +-
 drivers/net/avp/avp_ethdev.c                  |  2 +-
 drivers/net/axgbe/axgbe_common.h              |  2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
 drivers/net/cxgbe/base/t4_hw.c                |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                |  2 +-
 drivers/net/cxgbe/sge.c                       |  2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
 drivers/net/e1000/em_ethdev.c                 |  2 +-
 drivers/net/e1000/igb_ethdev.c                |  2 +-
 drivers/net/e1000/igb_flow.c                  |  2 +-
 drivers/net/ena/ena_ethdev.h                  |  2 +-
 drivers/net/enic/enic_ethdev.c                |  2 +-
 drivers/net/enic/enic_vf_representor.c        |  2 +-
 drivers/net/failsafe/failsafe_private.h       |  2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
 drivers/net/i40e/i40e_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_vchnl.c                 |  2 +-
 drivers/net/ice/ice_dcf.c                     |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
 drivers/net/mlx4/mlx4.c                       |  2 +-
 drivers/net/netvsc/hn_ethdev.c                |  2 +-
 drivers/net/netvsc/hn_nvs.c                   |  2 +-
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/netvsc/hn_rxtx.c                  |  2 +-
 drivers/net/nfp/nfp_common.c                  |  2 +-
 drivers/net/nfp/nfp_ethdev.c                  |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
 drivers/net/qede/qede_ethdev.h                |  2 +-
 drivers/net/sfc/sfc_ethdev.c                  |  2 +-
 drivers/net/sfc/sfc_sw_stats.c                |  2 +-
 drivers/net/sfc/sfc_sw_stats.h                |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
 lib/compressdev/rte_compressdev.c             |  2 +-
 lib/compressdev/rte_compressdev_pmd.c         |  2 +-
 lib/compressdev/rte_compressdev_pmd.h         |  1 +
 lib/cryptodev/cryptodev_pmd.c                 |  2 +-
 lib/cryptodev/cryptodev_pmd.h                 |  1 +
 lib/cryptodev/rte_cryptodev.c                 |  2 +-
 lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
 lib/eal/common/eal_common_dev.c               |  2 +-
 lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
 lib/eal/include/meson.build                   |  1 +
 lib/eal/include/rte_dev.h                     | 15 ++--------
 lib/eal/version.map                           |  4 +--
 lib/ethdev/ethdev_driver.h                    |  1 +
 lib/eventdev/eventdev_pmd.h                   |  2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
 lib/eventdev/rte_eventdev.c                   |  2 +-
 lib/gpudev/gpudev_driver.h                    |  2 +-
 lib/mempool/rte_mempool_ops.c                 |  2 +-
 lib/pcapng/rte_pcapng.c                       |  2 +-
 lib/rawdev/rte_rawdev.c                       |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
 lib/security/rte_security.c                   |  2 +-
 115 files changed, 144 insertions(+), 122 deletions(-)
 create mode 100644 lib/eal/include/dev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 36df0ccf93..4e20345b7a 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,6 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
   headers (see ``enable_driver_sdk`` meson option).
+  The ``rte_driver`` object is now opaque and must be manipulated through added
+  accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 801e8920df..e2d9409185 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_byteorder.h>
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 c1d877c87f..51dd090c1b 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index f16814e241..036579e3ec 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a889e392c6..e4c7ee0c3b 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <bus_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1c2d2c04af..58fb7c7f69 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -25,7 +25,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index cf66fc0c53..26a83b2cdf 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -7,7 +7,7 @@
 #define BUS_DPAA_DRIVER_H
 
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 798ddebf3a..7ac5fe6ff1 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -29,7 +29,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8604e43947..5966776a85 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -28,7 +28,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index cfe4280f87..d7f6e45b7d 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -18,7 +18,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_pool_ops.h>
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index b7d81b518c..07256ed7ec 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <fslmc_logs.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 071b0d297d..4aec7b2cd8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -30,7 +30,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index 223e34bcba..65e2d799c3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "private.h"
 #include <fslmc_logs.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b5c7dee617..0f2f9b5101 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_compat.h>
 
 /** Pathname of PCI devices directory. */
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 39d702a418..d24cc201b8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -6,7 +6,7 @@
 
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 36748cdfae..bc7e30d7c6 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 
 #include <rte_bus_vdev.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 809a8bb08f..b176b658fc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 2c72614776..2d10a1e8ad 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index 3424e791c9..e2475a642d 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_bus_vmbus.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 struct vmbus_channel;
 struct vmbus_mon_page;
diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
index 7ffde5f4c8..85d6ddfcf4 100644
--- a/drivers/common/qat/dev/qat_dev_gen4.c
+++ b/drivers/common/qat/dev/qat_dev_gen4.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "qat_device.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 5916e745e2..9cbd19a481 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 7d657d81bc..445a3baa67 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
index 61d457f4e0..d1ede5e990 100644
--- a/drivers/crypto/bcmfs/bcmfs_qp.c
+++ b/drivers/crypto/bcmfs/bcmfs_qp.c
@@ -8,7 +8,7 @@
 #include <rte_atomic.h>
 #include <rte_bitmap.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_prefetch.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
index bc7fb67218..78272d616c 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
@@ -4,7 +4,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 6c3e45e333..013f3be1e6 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 
 #include "ccp_crypto.h"
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 3fd9f3c426..db11ac7444 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn10k_cryptodev.h"
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index bd425f95ff..4cfc1f2150 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn9k_cryptodev.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0cce861899..3b13578de0 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_common.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7e554cb2b1..c6bd785262 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -19,7 +19,7 @@
 #include <rte_security_driver.h>
 #endif
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 83ae6b6be9..11b559e025 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -5,7 +5,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index e30dcfc281..9b7b16c6e3 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -9,6 +9,7 @@
 #include <libgen.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 5a443acff8..759578378f 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -17,7 +17,7 @@
 #include <rte_config.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 9f8c6cd8b8..71ac141b66 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -15,7 +15,7 @@
 
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
 #include <rte_ring.h>
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index aa403f9e06..8e470584ea 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 08df6e223a..1001297cda 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <bus_fslmc_driver.h>
 #include <rte_lcore.h>
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 3882a9cf1d..a68d3ac154 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index fe157c59d5..99fa326ad5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <ethdev_driver.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 6bd8fec6d4..8513b9a013 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -12,7 +12,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 2be7b8d2df..a552aabeb8 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -8,7 +8,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <gpudev_driver.h>
 
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 56c629c681..84371d5d1a 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -20,7 +20,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include "rte_dpaa2_mempool.h"
 
 #include "fslmc_vfio.h"
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fd7be47311..9957de2314 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -24,7 +24,7 @@
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 748db590c1..71d0b53e03 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_version.h>
 
 #include "ark_pktdir.h"
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7c0cb666fb..b2a08f5635 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_cycles.h>
 #include <rte_spinlock.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index b9ebf64fb8..a5d11c5832 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -33,7 +33,7 @@
 #include <rte_memzone.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_pci.h>
 #include <rte_common.h>
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f36ad30e17..4448cf2de2 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -9,7 +9,7 @@
 #include "bnx2x_rxtx.h"
 
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53f..1460dce2ab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef04c..fd1506ddd4 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -7,7 +7,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 384080e6d3..bed755f5d9 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -18,7 +18,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_byteorder.h>
 
 #include "common.h"
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index fd71a50a58..45bbeaef0c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -31,7 +31,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "cxgbe.h"
 #include "cxgbe_pfvf.h"
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3c02c98b3d..f8dd833032 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -31,7 +31,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "base/common.h"
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5d91355c9a..5b13cb5c94 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -30,7 +30,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 9509f6e8a3..4d33b51fea 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <dpaa2_pmd_logs.h>
 #include <dpaa2_hw_pvt.h>
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index f876f4790c..37a8b43114 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 #include "rte_dpaa2_mempool.h"
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 932570c6e0..fbfdf360d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -14,7 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7b9c528d13..9436a95ac8 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hexdump.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
index ba0d500f74..63463c4fbf 100644
--- a/drivers/net/dpaa2/dpaa2_sparser.c
+++ b/drivers/net/dpaa2/dpaa2_sparser.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <fslmc_vfio.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 409de50083..8ee9be12ad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 43979992d3..d6bcc5bf58 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index e46697b6a1..b775310651 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -21,7 +21,7 @@
 #include <rte_eal.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 4709675af8..4d27fba585 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -14,7 +14,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_timer.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 
 #include "ena_com.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 998436e5e8..cdf0915591 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 7312c411bd..46f85964e9 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -7,7 +7,7 @@
 
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index a80f5e2caf..53a451c1b1 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -11,7 +11,7 @@
 #include <pthread.h>
 
 #include <rte_atomic.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_devargs.h>
 #include <rte_flow.h>
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8bbd8b445d..7adb20bff9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_spinlock.h>
 #include <rte_kvargs.h>
 #include <rte_vect.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bdc453ec1..67111ac251 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -23,7 +23,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_alarm.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_hash_crc.h>
 #include <rte_bitmap.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..ef2ab06475 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,7 +24,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 21bd1e2193..15f695682d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,7 +19,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..1c3d22ae0f 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -21,7 +21,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "ice_dcf.h"
 #include "ice_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 0da267db1f..dee712af98 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -18,7 +18,7 @@
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <iavf_devids.h>
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 552e41692c..04c9ce78a2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..67373a7b78 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -27,7 +27,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 910b76a92c..7e7e1824ef 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ccc06bdda6..d0bbc0a4c0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -30,7 +30,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 817fb06dfb..7db82af9f3 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -28,7 +28,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 20f75a17b0..e6f1f28768 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -26,7 +26,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 61cf374224..bc6f60c64a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -25,7 +25,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 #include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c792..eaafe11fb9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -19,7 +19,7 @@
 #include <rte_debug.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e588..47359501bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_common.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9ada22e2ff..0eee191566 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -15,7 +15,7 @@
 #include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index a38b701183..b781bcdcfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -13,7 +13,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ip.h>
 
 /* ecore includes */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 506c62a726..2ec743ebce 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -7,7 +7,7 @@
  * for Solarflare) and Solarflare Communications, Inc.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 81f5aa3cc4..3ae5023b6f 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2021 Xilinx, Inc.
  */
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_bitmap.h>
 
 #include "sfc.h"
diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
index 1abded8018..d9738e5214 100644
--- a/drivers/net/sfc/sfc_sw_stats.h
+++ b/drivers/net/sfc/sfc_sw_stats.h
@@ -5,7 +5,7 @@
 #ifndef _SFC_SW_STATS_H
 #define _SFC_SW_STATS_H
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "sfc.h"
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 28183ec740..9f57cb1a20 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index dc90569df1..c3e045d892 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -27,7 +27,7 @@
 #include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d180162abd..edf3becd32 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -24,7 +24,7 @@
 #include <rte_memory.h>
 #include <rte_eal_paging.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 2b9e35cef5..abc63b0935 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -16,7 +16,7 @@
 
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "virtio.h"
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 101b1cb500..fd946dec5c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/vmxnet3_defs.h"
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index db029cbf34..909fb8faab 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -3,7 +3,7 @@
  */
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 6831cc8d20..5dd5bbb652 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index fc257c5f44..8ef7a6b127 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_rawdev.h>
 #include <bus_vdev_driver.h>
 #include <rte_test.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 6ab62a12fc..92cf5f495e 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -11,7 +11,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_glue.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index e997bd01ed..cf2c20a704 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 9bfae077db..41f1415bea 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
index 9fabc399c5..72e52f876f 100644
--- a/lib/compressdev/rte_compressdev_pmd.h
+++ b/lib/compressdev/rte_compressdev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 
 #include "rte_compressdev.h"
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 75d0075b86..f07b92dfd7 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..96d7e225b0 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 6250302f3b..29c9c55131 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -13,7 +13,7 @@
 
 #include <rte_log.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index 82ab7a8cc7..acd7f71cd1 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -14,7 +14,7 @@
  * by any application.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_dmadev.h"
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 16c5aef1d8..98f3c78795 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -9,7 +9,7 @@
 
 #include <bus_driver.h>
 #include <rte_class.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_errno.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
new file mode 100644
index 0000000000..015188abd5
--- /dev/null
+++ b/lib/eal/include/dev_driver.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef DEV_DRIVER_H
+#define DEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include <rte_dev.h>
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+	const char *name;                   /**< Driver name. */
+	const char *alias;              /**< Driver alias. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEV_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index 77d8621a51..cfcd40aaed 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -57,6 +57,7 @@ headers += files(
 
 driver_sdk_headers = files(
         'bus_driver.h',
+        'dev_driver.h',
 )
 
 # special case install the generic headers, since they go in a subdir
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ddea163cca..7214f5d7fb 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,8 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_driver;
+
 /**
  * The device event type.
  */
@@ -67,27 +69,14 @@ struct rte_mem_resource {
 	void *addr;         /**< Virtual address, NULL when not mapped. */
 };
 
-/**
- * A structure describing a device driver.
- */
-struct rte_driver {
-	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
-	const char *name;                   /**< Driver name. */
-	const char *alias;              /**< Driver alias. */
-};
-
 /**
  * Retrieve a driver name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param driver
  *   A pointer to a driver structure.
  * @return
  *   A pointer to the driver name string.
  */
-__rte_experimental
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index d10fd89458..8b53a1d258 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -37,6 +37,7 @@ DPDK_23 {
 	rte_devargs_parsef;
 	rte_devargs_remove;
 	rte_devargs_type_count;
+	rte_driver_name;
 	rte_dump_physmem_layout;
 	rte_dump_stack;
 	rte_dump_tailq;
@@ -423,9 +424,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..47a55a419e 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -19,6 +19,7 @@ extern "C" {
  *
  */
 
+#include <dev_driver.h>
 #include <rte_ethdev.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..def6cd0876 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 4938b4ee07..a8ef5bac06 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 8e81cf774d..29515401bd 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -9,7 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_log.h>
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 79b905e9fc..bbb027aa0c 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 0e55b00bfe..23972b3dbd 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_gpudev.h"
 
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index ac32c4bb72..3b43edc548 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -9,7 +9,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_mempool_trace.h"
 
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 72aabd4dd0..af2b814251 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -14,7 +14,7 @@
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index e157d65332..569e836560 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_telemetry.h>
diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 3b7be57d3e..a51944c8ff 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -19,7 +19,7 @@ extern "C" {
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 1a2a408f0e..94160f4177 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -5,7 +5,7 @@
  */
 
 #include <rte_cryptodev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_telemetry.h>
 #include "rte_security.h"
 #include "rte_security_driver.h"
-- 
2.37.2


^ permalink raw reply	[relevance 1%]

* [PATCH v5 21/27] bus: hide bus object
  2022-09-05  8:39  1% ` David Marchand
  2022-09-05  8:39  4%   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-09-05  8:39  3%   ` David Marchand
  2022-09-05  8:39  1%   ` [PATCH v5 23/27] dev: hide driver object David Marchand
  2022-09-05  8:39  2%   ` [PATCH v5 27/27] dev: hide device object David Marchand
  3 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Anatoly Burakov,
	Stephen Hemminger, Long Li, Matan Azrad, Viacheslav Ovsiienko,
	Kevin Laatz, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Ferruh Yigit,
	Andrew Rybchenko, Reshma Pattan

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_bus objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

Changes since RFC v1:
- update all existing users of the public header to use the internal one,

---
 app/test/test_devargs.c                  |   2 +-
 app/test/test_vdev.c                     |   2 +-
 doc/guides/rel_notes/deprecation.rst     |   6 -
 doc/guides/rel_notes/release_22_11.rst   |   6 +
 drivers/bus/auxiliary/auxiliary_common.c |   2 +-
 drivers/bus/auxiliary/auxiliary_params.c |   2 +-
 drivers/bus/auxiliary/private.h          |   2 +-
 drivers/bus/dpaa/dpaa_bus.c              |   2 +-
 drivers/bus/fslmc/fslmc_bus.c            |   2 +-
 drivers/bus/fslmc/private.h              |   2 +-
 drivers/bus/ifpga/ifpga_bus.c            |   2 +-
 drivers/bus/pci/linux/pci_vfio.c         |   2 +-
 drivers/bus/pci/pci_common.c             |   2 +-
 drivers/bus/pci/pci_params.c             |   2 +-
 drivers/bus/pci/private.h                |   2 +-
 drivers/bus/vdev/vdev.c                  |   2 +-
 drivers/bus/vmbus/private.h              |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c    |   2 +-
 drivers/dma/idxd/idxd_bus.c              |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c  |   2 +-
 drivers/net/failsafe/failsafe.c          |   2 +-
 drivers/net/failsafe/failsafe_eal.c      |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c         |   2 +-
 drivers/net/netvsc/hn_ethdev.c           |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c    |   2 +-
 drivers/net/virtio/virtio_pci.c          |   2 +-
 drivers/raw/ioat/idxd_bus.c              |   2 +-
 lib/eal/common/eal_common_bus.c          |   2 +-
 lib/eal/common/eal_common_dev.c          |   2 +-
 lib/eal/common/eal_common_devargs.c      |   2 +-
 lib/eal/common/hotplug_mp.c              |   2 +-
 lib/eal/include/bus_driver.h             | 296 +++++++++++++++++++++++
 lib/eal/include/meson.build              |   4 +
 lib/eal/include/rte_bus.h                | 278 +--------------------
 lib/eal/linux/eal_dev.c                  |   2 +-
 lib/eal/version.map                      |   8 +-
 lib/ethdev/rte_ethdev.c                  |   2 +-
 lib/pcapng/rte_pcapng.c                  |   2 +-
 38 files changed, 343 insertions(+), 319 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..0a4c34a1ad 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 5eeff3106d..1904e76e44 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 5b4ffc992d..98a00da385 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,12 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* bus: The ``rte_bus`` object will be made opaque in DPDK 22.11.
-  The goal is to remove it from the public ABI and make this object extendable.
-  As a side effect, registering a bus will be marked as an internal API:
-  external users may still register their bus using a new driver header
-  (see ``enable_driver_sdk`` meson option).
-
 * drivers: As a follow-up of the work on the ``rte_bus`` object,
   the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
   their bus-specific counterparts) will be made opaque 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 e08a548285..36df0ccf93 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,6 +88,12 @@ API Changes
   in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
   to update their code.
 
+* bus: Registering a bus has been marked as an internal API.
+  External users may still register their bus using the ``bus_driver.h``
+  driver header (see ``enable_driver_sdk`` meson option).
+  The ``rte_bus`` object is now opaque and must be manipulated through added
+  accessors.
+
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 6cf6c170ec..259ff152c4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -12,7 +12,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 0289777922..a889e392c6 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 3f49f62493..3dee13e1d1 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "bus_auxiliary_driver.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 1ac6aa314f..682427ba2c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -29,7 +29,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index b9b0981329..8503004e3d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 60d68155e1..6f14085d98 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef BUS_FSLMC_PRIVATE_H
 #define BUS_FSLMC_PRIVATE_H
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 27e2de7072..bb943b58b5 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index cd0d0b1670..fab3483d9f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_vfio.h>
 #include <rte_eal.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 0d61d49287..c26aacd364 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_lcore.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 61a868707f..39d702a418 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 4e40a2ed85..fddf49251d 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7d78cf93bc..809a8bb08f 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 3d233fa83c..e33424675c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e82cb881bf..73178ce0f3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 1a86eb3c00..6553166f5c 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 5d4d52c341..32811403b4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..d71b512f81 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,7 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index efb262e368..4f0a6f4d55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 188d92ffac..ccc06bdda6 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 65043a04eb..dc90569df1 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..9cf4d760b4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -9,7 +9,7 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "virtio_pci.h"
 #include "virtio_logs.h"
diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 539f51b1b1..f32d811055 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include "ioat_private.h"
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..62a598957c 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..03e6e59baf 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..5202bd5658 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..d2e615a736
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,296 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_devargs;
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+typedef int (*rte_bus_scan_t)(void);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * This is called while iterating over each registered bus.
+ *
+ * @return
+ *	0 for successful probe
+ *	!0 for any error while probing
+ */
+typedef int (*rte_bus_probe_t)(void);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */
+	const char *name;            /**< Name of the bus */
+	rte_bus_scan_t scan;         /**< Scan for devices attached to bus */
+	rte_bus_probe_t probe;       /**< Probe devices on bus */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 3848b44db0..dfe756fb11 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,284 +20,21 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-typedef int (*rte_bus_scan_t)(void);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * This is called while iterating over each registered bus.
- *
- * @return
- *	0 for successful probe
- *	!0 for any error while probing
- */
-typedef int (*rte_bus_probe_t)(void);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */
-	const char *name;            /**< Name of the bus */
-	rte_bus_scan_t scan;         /**< Scan for devices attached to bus */
-	rte_bus_probe_t probe;       /**< Probe devices on bus */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * Retrieve a bus name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param bus
  *   A pointer to a rte_bus structure.
  * @return
  *   A pointer to the bus name string.
  */
-__rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -387,17 +124,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..098a2c3076 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -13,7 +13,7 @@
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index aa53064db1..6ec15f1147 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -12,10 +12,9 @@ DPDK_23 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
+	rte_bus_name;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -424,14 +423,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_bus_name;
 };
 
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9e358d187a..0c2c1088c0 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..72aabd4dd0 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.2


^ permalink raw reply	[relevance 3%]

* [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor
  2022-09-05  8:39  1% ` David Marchand
@ 2022-09-05  8:39  4%   ` David Marchand
  2022-09-05  8:39  3%   ` [PATCH v5 21/27] bus: hide bus object David Marchand
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * 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.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.37.2


^ permalink raw reply	[relevance 4%]

* [PATCH v5 00/27] Bus and device cleanup for 22.11
                     ` (2 preceding siblings ...)
  2022-09-05  8:35  1% ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
@ 2022-09-05  8:39  1% ` David Marchand
  2022-09-05  8:39  4%   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (3 more replies)
  2022-09-14  7:58  1% ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  4 siblings, 4 replies; 200+ results
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

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 v4:
- (hopefully, because I can't test) fixed Windows build,
- dropped unneeded change in vdev unit test,

Changes since RFC v3:
- marked the series as non-RFC,
- rebased on v22.11-rc0,
- marked RTE_FUNC_PTR_* macros as deprecated,
- split the bus specific patch in two patches,

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (27):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  eal: deprecate RTE_FUNC_PTR_* macros
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide bus specific information
  bus/pci: fill bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   5 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |  20 +-
 doc/guides/rel_notes/release_22_11.rst        |  19 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 drivers/bus/auxiliary/linux/auxiliary.c       |   2 -
 drivers/bus/auxiliary/meson.build             |   4 +-
 drivers/bus/auxiliary/private.h               |  30 +-
 drivers/bus/auxiliary/version.map             |   3 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  52 ++-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |  35 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   8 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 drivers/net/dpaa2/dpaa2_ethdev.h              |   2 +-
 drivers/net/dpaa2/dpaa2_mux.c                 |   2 +-
 drivers/net/dpaa2/dpaa2_ptp.c                 |   2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  21 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  25 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |  48 ++-
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |  45 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_dev.h                     | 104 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       | 277 +++++++++-----
 lib/ethdev/rte_ethdev.h                       |  11 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  12 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  15 +-
 lib/eventdev/rte_eventdev.c                   |  64 ++--
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   5 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |  77 ++--
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |  59 +--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   8 +-
 lib/vhost/vdpa.c                              |  10 +-
 lib/vhost/vhost_user.c                        |   6 +-
 367 files changed, 2225 insertions(+), 2490 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.37.2


^ permalink raw reply	[relevance 1%]

* Re: [PATCH v5 00/27] Bus and device cleanup for 22.11
  2022-09-05  8:35  1% ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
  2022-09-05  8:35  4%   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-09-05  8:39  0%   ` David Marchand
  1 sibling, 0 replies; 200+ results
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: Thomas Monjalon, Bruce Richardson

On Mon, Sep 5, 2022 at 10:36 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 v4:
> - (hopefully, because I can't test) fixed Windows build,
> - dropped unneeded change in vdev unit test,

Pebcak, I only sent the first patches... resending the whole series.
Sorry for the noise.


-- 
David Marchand


^ permalink raw reply	[relevance 0%]

* [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor
  2022-09-05  8:35  1% ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
@ 2022-09-05  8:35  4%   ` David Marchand
  2022-09-05  8:39  0%   ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
  1 sibling, 0 replies; 200+ results
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * 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.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.37.2


^ permalink raw reply	[relevance 4%]

* [PATCH v5 00/27] Bus and device cleanup for 22.11
      2022-08-26 12:41  1% ` [PATCH v4 00/27] " David Marchand
@ 2022-09-05  8:35  1% ` David Marchand
  2022-09-05  8:35  4%   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
  2022-09-05  8:39  0%   ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
  2022-09-05  8:39  1% ` David Marchand
  2022-09-14  7:58  1% ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  4 siblings, 2 replies; 200+ results
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

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 v4:
- (hopefully, because I can't test) fixed Windows build,
- dropped unneeded change in vdev unit test,

Changes since RFC v3:
- marked the series as non-RFC,
- rebased on v22.11-rc0,
- marked RTE_FUNC_PTR_* macros as deprecated,
- split the bus specific patch in two patches,

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (27):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  eal: deprecate RTE_FUNC_PTR_* macros
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide bus specific information
  bus/pci: fill bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   5 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |  20 +-
 doc/guides/rel_notes/release_22_11.rst        |  19 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 drivers/bus/auxiliary/linux/auxiliary.c       |   2 -
 drivers/bus/auxiliary/meson.build             |   4 +-
 drivers/bus/auxiliary/private.h               |  30 +-
 drivers/bus/auxiliary/version.map             |   3 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  52 ++-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |  35 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   8 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 drivers/net/dpaa2/dpaa2_ethdev.h              |   2 +-
 drivers/net/dpaa2/dpaa2_mux.c                 |   2 +-
 drivers/net/dpaa2/dpaa2_ptp.c                 |   2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  21 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  25 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |  48 ++-
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |  45 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_dev.h                     | 104 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       | 277 +++++++++-----
 lib/ethdev/rte_ethdev.h                       |  11 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  12 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  15 +-
 lib/eventdev/rte_eventdev.c                   |  64 ++--
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   5 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |  77 ++--
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |  59 +--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   8 +-
 lib/vhost/vdpa.c                              |  10 +-
 lib/vhost/vhost_user.c                        |   6 +-
 367 files changed, 2225 insertions(+), 2490 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.37.2


^ permalink raw reply	[relevance 1%]

* [PATCH 9/9] net/ngbe: support to set link down/up
  @ 2022-09-02  3:00  4% ` Jiawen Wu
  0 siblings, 0 replies; 200+ results
From: Jiawen Wu @ 2022-09-02  3:00 UTC (permalink / raw)
  To: dev; +Cc: Jiawen Wu

Add support to set device link down/up.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 doc/guides/rel_notes/release_22_11.rst |  4 ++++
 drivers/net/ngbe/base/ngbe_phy.c       |  1 +
 drivers/net/ngbe/base/ngbe_phy_rtl.c   | 13 ++++++++++++
 drivers/net/ngbe/base/ngbe_phy_rtl.h   |  2 ++
 drivers/net/ngbe/ngbe_ethdev.c         | 28 ++++++++++++++++++++++++++
 5 files changed, 48 insertions(+)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..843501c7c2 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,10 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* **Updated Wangxun ngbe driver.**
+
+  * Added support to set device link down/up.
+
 
 ABI Changes
 -----------
diff --git a/drivers/net/ngbe/base/ngbe_phy.c b/drivers/net/ngbe/base/ngbe_phy.c
index 06562b594f..acff7bfebf 100644
--- a/drivers/net/ngbe/base/ngbe_phy.c
+++ b/drivers/net/ngbe/base/ngbe_phy.c
@@ -400,6 +400,7 @@ s32 ngbe_init_phy(struct ngbe_hw *hw)
 		hw->phy.init_hw = ngbe_init_phy_rtl;
 		hw->phy.check_link = ngbe_check_phy_link_rtl;
 		hw->phy.setup_link = ngbe_setup_phy_link_rtl;
+		hw->phy.set_phy_power = ngbe_set_phy_power_rtl;
 		hw->phy.get_adv_pause = ngbe_get_phy_advertised_pause_rtl;
 		hw->phy.get_lp_adv_pause = ngbe_get_phy_lp_advertised_pause_rtl;
 		hw->phy.set_pause_adv = ngbe_set_phy_pause_adv_rtl;
diff --git a/drivers/net/ngbe/base/ngbe_phy_rtl.c b/drivers/net/ngbe/base/ngbe_phy_rtl.c
index 33c5e79e87..9b323624ec 100644
--- a/drivers/net/ngbe/base/ngbe_phy_rtl.c
+++ b/drivers/net/ngbe/base/ngbe_phy_rtl.c
@@ -393,3 +393,16 @@ s32 ngbe_check_phy_link_rtl(struct ngbe_hw *hw, u32 *speed, bool *link_up)
 	return status;
 }
 
+s32 ngbe_set_phy_power_rtl(struct ngbe_hw *hw, bool on)
+{
+	u16 value = 0;
+
+	hw->phy.read_reg(hw, RTL_BMCR, 0, &value);
+	if (on)
+		value &= ~RTL_BMCR_PWDN;
+	else
+		value |= RTL_BMCR_PWDN;
+	hw->phy.write_reg(hw, RTL_BMCR, 0, value);
+
+	return 0;
+}
diff --git a/drivers/net/ngbe/base/ngbe_phy_rtl.h b/drivers/net/ngbe/base/ngbe_phy_rtl.h
index d717a1915c..b2fbc4f74d 100644
--- a/drivers/net/ngbe/base/ngbe_phy_rtl.h
+++ b/drivers/net/ngbe/base/ngbe_phy_rtl.h
@@ -15,6 +15,7 @@
 #define   RTL_BMCR_RESET		MS16(15, 0x1)
 #define	  RTL_BMCR_SPEED_SELECT0	MS16(13, 0x1)
 #define   RTL_BMCR_ANE			MS16(12, 0x1)
+#define   RTL_BMCR_PWDN			MS16(11, 0x1)
 #define   RTL_BMCR_RESTART_AN		MS16(9, 0x1)
 #define   RTL_BMCR_DUPLEX		MS16(8, 0x1)
 #define   RTL_BMCR_SPEED_SELECT1	MS16(6, 0x1)
@@ -88,5 +89,6 @@ s32 ngbe_get_phy_lp_advertised_pause_rtl(struct ngbe_hw *hw, u8 *pause_bit);
 s32 ngbe_set_phy_pause_adv_rtl(struct ngbe_hw *hw, u16 pause_bit);
 s32 ngbe_check_phy_link_rtl(struct ngbe_hw *hw,
 			u32 *speed, bool *link_up);
+s32 ngbe_set_phy_power_rtl(struct ngbe_hw *hw, bool on);
 
 #endif /* _NGBE_PHY_RTL_H_ */
diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
index 1090ba9a11..afdb3ad41f 100644
--- a/drivers/net/ngbe/ngbe_ethdev.c
+++ b/drivers/net/ngbe/ngbe_ethdev.c
@@ -1219,6 +1219,32 @@ ngbe_dev_stop(struct rte_eth_dev *dev)
 	return 0;
 }
 
+/*
+ * Set device link up: power on.
+ */
+static int
+ngbe_dev_set_link_up(struct rte_eth_dev *dev)
+{
+	struct ngbe_hw *hw = ngbe_dev_hw(dev);
+
+	hw->phy.set_phy_power(hw, true);
+
+	return 0;
+}
+
+/*
+ * Set device link down: power off.
+ */
+static int
+ngbe_dev_set_link_down(struct rte_eth_dev *dev)
+{
+	struct ngbe_hw *hw = ngbe_dev_hw(dev);
+
+	hw->phy.set_phy_power(hw, false);
+
+	return 0;
+}
+
 /*
  * Reset and stop device.
  */
@@ -3030,6 +3056,8 @@ static const struct eth_dev_ops ngbe_eth_dev_ops = {
 	.dev_infos_get              = ngbe_dev_info_get,
 	.dev_start                  = ngbe_dev_start,
 	.dev_stop                   = ngbe_dev_stop,
+	.dev_set_link_up            = ngbe_dev_set_link_up,
+	.dev_set_link_down          = ngbe_dev_set_link_down,
 	.dev_close                  = ngbe_dev_close,
 	.dev_reset                  = ngbe_dev_reset,
 	.promiscuous_enable         = ngbe_dev_promiscuous_enable,
-- 
2.27.0



^ permalink raw reply	[relevance 4%]

* RE: [PATCH v5 2/7] bbdev: add device status info
  2022-08-30  7:08  3%             ` Maxime Coquelin
@ 2022-08-30 19:38  0%               ` Chautru, Nicolas
  0 siblings, 0 replies; 200+ results
From: Chautru, Nicolas @ 2022-08-30 19:38 UTC (permalink / raw)
  To: Maxime Coquelin, dev, thomas, gakhil, hemant.agrawal
  Cc: trix, mdr, Richardson, Bruce, david.marchand, stephen

Hi Maxime, 

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Tuesday, August 30, 2022 12:09 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> thomas@monjalon.net; gakhil@marvell.com; hemant.agrawal@nxp.com
> Cc: trix@redhat.com; mdr@ashroe.eu; Richardson, Bruce
> <bruce.richardson@intel.com>; david.marchand@redhat.com;
> stephen@networkplumber.org
> Subject: Re: [PATCH v5 2/7] bbdev: add device status info
> 
> 
> 
> On 8/29/22 18:10, Chautru, Nicolas wrote:
> > Hi Maxime,
> >
> >> -----Original Message-----
> >> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> >> Sent: Friday, August 26, 2022 3:13 AM
> >> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> >> thomas@monjalon.net; gakhil@marvell.com; hemant.agrawal@nxp.com
> >> Cc: trix@redhat.com; mdr@ashroe.eu; Richardson, Bruce
> >> <bruce.richardson@intel.com>; david.marchand@redhat.com;
> >> stephen@networkplumber.org
> >> Subject: Re: [PATCH v5 2/7] bbdev: add device status info
> >>
> >> Hi,
> >>
> >> On 8/25/22 20:30, Chautru, Nicolas wrote:
> >>> Thanks Maxime,
> >>>
> >>>> -----Original Message-----
> >>>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> >>>> Sent: Thursday, August 25, 2022 7:19 AM
> >>>> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> >>>> thomas@monjalon.net; gakhil@marvell.com;
> hemant.agrawal@nxp.com
> >>>> Cc: trix@redhat.com; mdr@ashroe.eu; Richardson, Bruce
> >>>> <bruce.richardson@intel.com>; david.marchand@redhat.com;
> >>>> stephen@networkplumber.org
> >>>> Subject: Re: [PATCH v5 2/7] bbdev: add device status info
> >>>>
> >>>>
> >>>>
> >>>> On 7/7/22 01:28, Nicolas Chautru wrote:
> >>>>> 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>
> >>>>> ---
> >>>>>     drivers/baseband/acc100/rte_acc100_pmd.c           |  1 +
> >>>>>     drivers/baseband/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 +
> >>>>>     drivers/baseband/turbo_sw/bbdev_turbo_software.c   |  1 +
> >>>>>     lib/bbdev/rte_bbdev.c                              | 22 ++++++++++++++
> >>>>>     lib/bbdev/rte_bbdev.h                              | 35
> ++++++++++++++++++++--
> >>>>>     lib/bbdev/version.map                              |  6 ++++
> >>>>>     9 files changed, 67 insertions(+), 2 deletions(-)
> >>>>>
> >>>>> diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c
> >>>>> b/drivers/baseband/acc100/rte_acc100_pmd.c
> >>>>> index de7e4bc..17ba798 100644
> >>>>> --- a/drivers/baseband/acc100/rte_acc100_pmd.c
> >>>>> +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
> >>>>> @@ -1060,6 +1060,7 @@
> >>>>>
> >>>>>     	/* 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 82ae6ba..57b12af 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 @@
> >>>>>     	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 21d3529..2a330c4 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 @@ struct __rte_cache_aligned fpga_queue {
> >>>>>     	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 4d1bd16..c1f88c6 100644
> >>>>> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> >>>>> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> >>>>> @@ -100,6 +100,7 @@ struct bbdev_la12xx_params {
> >>>>>     	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 248e129..94a1976 100644
> >>>>> --- a/drivers/baseband/null/bbdev_null.c
> >>>>> +++ b/drivers/baseband/null/bbdev_null.c
> >>>>> @@ -82,6 +82,7 @@ struct bbdev_queue {
> >>>>>     	 * 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 af7bc41..dbc5524 100644
> >>>>> --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> >>>>> +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> >>>>> @@ -254,6 +254,7 @@ struct turbo_sw_queue {
> >>>>>     	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
> >>>>> 4da8047..38630a2 100644
> >>>>> --- a/lib/bbdev/rte_bbdev.c
> >>>>> +++ b/lib/bbdev/rte_bbdev.c
> >>>>> @@ -1133,3 +1133,25 @@ struct rte_mempool *
> >>>>>     	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
> >>>>> b88c881..9b1ffa4 100644
> >>>>> --- a/lib/bbdev/rte_bbdev.h
> >>>>> +++ b/lib/bbdev/rte_bbdev.h
> >>>>> @@ -223,6 +223,21 @@ struct rte_bbdev_queue_conf {
> >>>>>     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 */
> >>>>> +};
> >>>>
> >>>> I don't have a strong opinion on this, but I think NOT_SUPPORTED
> >>>> should be a special value. If you want to keep 0 value for
> >>>> NOSTATUS, maybe you could
> >>>> do:
> >>>>
> >>>> enum rte_bbdev_device_status {
> >>>> 	RTE_BBDEV_DEV_NOT_SUPPORTED = -1,   /**< Device status is not
> >>>> supported
> >>>> on the PMD */
> >>>> 	RTE_BBDEV_DEV_NOSTATUS = 0,        /**< Nothing being reported
> >>>> */
> >>>> 	RTE_BBDEV_DEV_RESET,           /**< Device in reset and un-
> >>>> configured
> >>>> state */
> >>>> ...
> >>>
> >>> Thanks Maxime. My concern is that I am upstreaming in parallel in
> >> pf_bb_config in parallel hence would like to keep it unchanged if possible.
> >>> Given you don’t have a strong opinion is that okay to keep as is? Or
> >>> I can
> >> force special value 1 for NOT_SUPPORTED so that this is explicitly
> >> defined. But really enum should always be used.
> >>
> >> I don't understand. It should not have any impact on pf_bb_config,
> >> given pf_bb_config does not use DPDK.
> >>
> >> Maxime
> >
> > That device status is being shared from pf_bb_config to the bbdev PMD
> through PF2VF communications, hence they share that same enum.
> >
> 
> Ok, but generic DPDK ABI should not be dependent on a vendor internal
> implementation IMHO.
> 

I agree. This is the opposite direction, pf_bb_config is reusing the same API enumeration for now the assumption is that enum is being applied. 
In case we change here (for a fairly cosmetic reason) that would cause to change as well on the other ingredient, which is doable but has overhead.
If you really believe that there is a strong reason to do such a change let me know now, we would need to impact pf_bb_config release to have similar change and match that API change which is possible but not ideal. 

Thanks
Nic




^ permalink raw reply	[relevance 0%]

* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-08-29 17:12  3%       ` Walker, Benjamin
@ 2022-08-30 15:09  5%         ` David Marchand
  2022-09-21 22:29  3%           ` Harris, James R
  0 siblings, 1 reply; 200+ results
From: David Marchand @ 2022-08-30 15:09 UTC (permalink / raw)
  To: Walker, Benjamin
  Cc: Harris, James R, dev, Liu, Changpeng, Alexey Marchuk,
	Shuhei Matsumoto, Thomas Monjalon, Bruce Richardson,
	Stephen Hemminger

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?


-- 
David Marchand


^ permalink raw reply	[relevance 5%]

* Re: [RFC] memarea: introduce memory area library
  @ 2022-08-30 12:41  3% ` Dmitry Kozlyuk
         [not found]     ` <20221005040952.8166-1-datshan@qq.com>
  2 siblings, 0 replies; 200+ results
From: Dmitry Kozlyuk @ 2022-08-30 12:41 UTC (permalink / raw)
  To: Chengwen Feng; +Cc: Thomas Monjalon, dpdk-dev

[-- Attachment #1: Type: text/plain, Size: 4369 bytes --]

>
> Note:
> a) the memarea is oriented towards the application layer, which could
> provides 'region-based memory management' [1] function.
>

Judging from the API, this library would rather provide
an interface to a generic allocator over a fixed memory extent,
because it offers freeing of specific elements, and thus must track them.
So it's more than RBMM. Is this intended?
It's a very interesting RFC anyway, just trying to understand the scope.

b) the eal library also provide memory zone/heap management, but these
> are tied to huge pages management.
>
[...]
> + * The memarea is a collection of allocated objects that can be
> efficiently
> + * alloc or free all at once, the main feature are as follows:
> + *   a) it facilitate alloc and free of memory with low overhead.
> + *   [...]
>
+ *   c) it supports MT-safe as long as it's specified at creation time.
>

These two bullets seem to add the most value compared to DPDK heap API.
DPDK heap overhead is at least 64 bytes per allocation (sizeof malloc_elem),
so I assume memarea aims at a large number of small elements.


> +struct rte_memarea_param {
> +       char name[RTE_MEMAREA_NAMESIZE]; /**< Name of memarea */
> +       enum rte_memarea_source source;  /**< Memory source of memarea */
> +       uint64_t size;                   /**< Size (byte) of memarea */
>

Is it an upper limit or a guaranteed size?
It probably depends on the source: guaranteed for USER_ADDR,
upper limit for SYSAPI (or it would be no different from USER_ADDR),
not sure about USER_MEMAREA.

Do you envision memarea as always limited?
Generic allocators usually have means of adding extents,
even if this one doesn't currently.

Nit: size is uint64_t here but uint32_t in rte_memarea_allloc().
Should be size_t in both places.


> +       uint32_t align;                  /**< Align of allocated object */
>
+       /** Indicates whether the memarea should be MT-safe */
> +       bool mt_safe;
> +       /** Indicates whether the memarea is visible to multiple process.
> +        * If the memory source is RTE_MEMAREA_SOURCE_USER_ADDR, this filed
> +        * depends on user settings and must be set.
> +        * If the memory source is RTE_MEMAREA_SOURCE_SYSAPI or
> +        * RTE_MEMAREA_SOURCE_USER_MEMAREA, this filed does not need to be
> set.
> +        */
> +       bool mp_visible;
> +       /** User provided address, this field is valid only when source
> +        * is set to RTE_MEMAREA_SOURCE_USER_ADDR.
> +        */
> +       void *user_addr;
> +       /** User provided memarea, this field is valid only when source
> +        * is set to RTE_MEMAREA_SOURCE_MEMAREA.
> +        */
> +       struct rte_memarea *user_memarea;
>

Jerin already suggested a union here.
I'll add another reason to do so: if in the future there will be new
memarea types
that require new options, one pointer-sized field can be used to pass
anything
without breaking the ABI once this structure becomes stable.


> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice.
> + *
> + * Update memory's refcnt.
> + *
> + * Update one memory region's refcnt.
> + *
> + * @param ma
> + *   The pointer of memarea.
> + * @param ptr
> + *   The pointer of memory region which need be updated refcnt.
> + * @param value
> + *   The value which need be updated.
> + *   Note: it could be negative.
> + *
> + * @return
> + *   0 on success. Otherwise negative value is returned.
> + */
> +__rte_experimental
> +int rte_memarea_refcnt_update(struct rte_memarea *ma, void *ptr, int16_t
> value);
>

If this function only updates the refcnt, an API to inspect the refcnt is
missing.
Furthermore, in this case refcnt is just a value attached to every object,
what is the benefit compared to simply storing it in the object?

If this function also frees "ptr" when refcnt reaches zero,
missing is a way for the user to know that it did.
What happens if refcnt > 1 on rte_memarea_free()?

I don't think refcnt belongs to this library.
A principal objection: memarea is for freeing all objects at once,
refcnt is for releasing objects one-by-one when they're not used.
Technical issues I foresee: refcnt can be atomic (and require alignment) or
not,
16 bits may be too few (rte_flow_action_handle ref'd by thousands of
rte_flow).
Refcnt could be optional per memarea, but it seems like another
complication.

[-- Attachment #2: Type: text/html, Size: 6663 bytes --]

^ permalink raw reply	[relevance 3%]

* Re: [PATCH v5 2/7] bbdev: add device status info
  @ 2022-08-30  7:08  3%             ` Maxime Coquelin
  2022-08-30 19:38  0%               ` Chautru, Nicolas
  0 siblings, 1 reply; 200+ results
From: Maxime Coquelin @ 2022-08-30  7:08 UTC (permalink / raw)
  To: Chautru, Nicolas, dev, thomas, gakhil, hemant.agrawal
  Cc: trix, mdr, Richardson, Bruce, david.marchand, stephen



On 8/29/22 18:10, Chautru, Nicolas wrote:
> Hi Maxime,
> 
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Sent: Friday, August 26, 2022 3:13 AM
>> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
>> thomas@monjalon.net; gakhil@marvell.com; hemant.agrawal@nxp.com
>> Cc: trix@redhat.com; mdr@ashroe.eu; Richardson, Bruce
>> <bruce.richardson@intel.com>; david.marchand@redhat.com;
>> stephen@networkplumber.org
>> Subject: Re: [PATCH v5 2/7] bbdev: add device status info
>>
>> Hi,
>>
>> On 8/25/22 20:30, Chautru, Nicolas wrote:
>>> Thanks Maxime,
>>>
>>>> -----Original Message-----
>>>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>>>> Sent: Thursday, August 25, 2022 7:19 AM
>>>> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
>>>> thomas@monjalon.net; gakhil@marvell.com; hemant.agrawal@nxp.com
>>>> Cc: trix@redhat.com; mdr@ashroe.eu; Richardson, Bruce
>>>> <bruce.richardson@intel.com>; david.marchand@redhat.com;
>>>> stephen@networkplumber.org
>>>> Subject: Re: [PATCH v5 2/7] bbdev: add device status info
>>>>
>>>>
>>>>
>>>> On 7/7/22 01:28, Nicolas Chautru wrote:
>>>>> 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>
>>>>> ---
>>>>>     drivers/baseband/acc100/rte_acc100_pmd.c           |  1 +
>>>>>     drivers/baseband/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 +
>>>>>     drivers/baseband/turbo_sw/bbdev_turbo_software.c   |  1 +
>>>>>     lib/bbdev/rte_bbdev.c                              | 22 ++++++++++++++
>>>>>     lib/bbdev/rte_bbdev.h                              | 35 ++++++++++++++++++++--
>>>>>     lib/bbdev/version.map                              |  6 ++++
>>>>>     9 files changed, 67 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c
>>>>> b/drivers/baseband/acc100/rte_acc100_pmd.c
>>>>> index de7e4bc..17ba798 100644
>>>>> --- a/drivers/baseband/acc100/rte_acc100_pmd.c
>>>>> +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
>>>>> @@ -1060,6 +1060,7 @@
>>>>>
>>>>>     	/* 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 82ae6ba..57b12af 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 @@
>>>>>     	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 21d3529..2a330c4 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 @@ struct __rte_cache_aligned fpga_queue {
>>>>>     	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 4d1bd16..c1f88c6 100644
>>>>> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
>>>>> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
>>>>> @@ -100,6 +100,7 @@ struct bbdev_la12xx_params {
>>>>>     	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 248e129..94a1976 100644
>>>>> --- a/drivers/baseband/null/bbdev_null.c
>>>>> +++ b/drivers/baseband/null/bbdev_null.c
>>>>> @@ -82,6 +82,7 @@ struct bbdev_queue {
>>>>>     	 * 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 af7bc41..dbc5524 100644
>>>>> --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
>>>>> +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
>>>>> @@ -254,6 +254,7 @@ struct turbo_sw_queue {
>>>>>     	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
>>>>> 4da8047..38630a2 100644
>>>>> --- a/lib/bbdev/rte_bbdev.c
>>>>> +++ b/lib/bbdev/rte_bbdev.c
>>>>> @@ -1133,3 +1133,25 @@ struct rte_mempool *
>>>>>     	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
>>>>> b88c881..9b1ffa4 100644
>>>>> --- a/lib/bbdev/rte_bbdev.h
>>>>> +++ b/lib/bbdev/rte_bbdev.h
>>>>> @@ -223,6 +223,21 @@ struct rte_bbdev_queue_conf {
>>>>>     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 */
>>>>> +};
>>>>
>>>> I don't have a strong opinion on this, but I think NOT_SUPPORTED
>>>> should be a special value. If you want to keep 0 value for NOSTATUS,
>>>> maybe you could
>>>> do:
>>>>
>>>> enum rte_bbdev_device_status {
>>>> 	RTE_BBDEV_DEV_NOT_SUPPORTED = -1,   /**< Device status is not
>>>> supported
>>>> on the PMD */
>>>> 	RTE_BBDEV_DEV_NOSTATUS = 0,        /**< Nothing being reported
>>>> */
>>>> 	RTE_BBDEV_DEV_RESET,           /**< Device in reset and un-
>>>> configured
>>>> state */
>>>> ...
>>>
>>> Thanks Maxime. My concern is that I am upstreaming in parallel in
>> pf_bb_config in parallel hence would like to keep it unchanged if possible.
>>> Given you don’t have a strong opinion is that okay to keep as is? Or I can
>> force special value 1 for NOT_SUPPORTED so that this is explicitly defined. But
>> really enum should always be used.
>>
>> I don't understand. It should not have any impact on pf_bb_config, given
>> pf_bb_config does not use DPDK.
>>
>> Maxime
> 
> That device status is being shared from pf_bb_config to the bbdev PMD through PF2VF communications, hence they share that same enum.
> 

Ok, but generic DPDK ABI should not be dependent on a vendor internal
implementation IMHO.

Maxime


^ permalink raw reply	[relevance 3%]

* Re: [PATCH] net/ice: remove deprecated VF flow action
@ 2022-08-30  1:23  0% Xu, Ke1
  0 siblings, 0 replies; 200+ results
From: Xu, Ke1 @ 2022-08-30  1:23 UTC (permalink / raw)
  To: Zeng, ZhichaoX; +Cc: dev, Zhang, Qi Z, Yang, Qiming, Zhou, YidingX


> Subject: [PATCH] net/ice: remove deprecated VF flow action
> Date: Wed, 10 Aug 2022 14:49:37 +0800
> Message-ID: <20220810064937.162455-1-zhichaox.zeng@intel.com> (raw)
> 
> From: Zhichao Zeng <zhichaox.zeng@intel.com>
> 
> According to the ABI and API Deprecation, remove deprecated VF action
> as hard-to-use / ambiguous.
> 
> Action REPRESENTED_PORT should be used instead.
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>

Tested and passed.

Regards,
Tested-by: Ke Xu <ke1.xu@intel.com>

> ---
>  doc/guides/nics/features/ice.ini    |  1 -
>  drivers/net/ice/ice_switch_filter.c | 22 ----------------------
>  2 files changed, 23 deletions(-)

^ permalink raw reply	[relevance 0%]

* [PATCH v7 1/7] bbdev: allow operation type enum for growth
  @ 2022-08-29 18:07  3%   ` Nicolas Chautru
    1 sibling, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-08-29 18:07 UTC (permalink / raw)
  To: dev, thomas, gakhil, hemant.agrawal
  Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
	stephen, mingshan.zhang, 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_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: [RFC v3 00/26] Bus and device cleanup for 22.11
  @ 2022-08-29 17:12  3%       ` Walker, Benjamin
  2022-08-30 15:09  5%         ` David Marchand
  0 siblings, 1 reply; 200+ results
From: Walker, Benjamin @ 2022-08-29 17:12 UTC (permalink / raw)
  To: David Marchand, Harris, James R
  Cc: dev, Liu, Changpeng, Alexey Marchuk, Shuhei Matsumoto

> From: David Marchand <david.marchand@redhat.com>
> 
> Hello,
> 
> On Fri, Aug 5, 2022 at 1:19 AM Harris, James R <james.r.harris@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
SPDK goes to dynamically load a shared DPDK library, how can we detect
whether it's a version that we support linking against?

 
> I did a PoC this morning and put patches in my forked repo:
> https://github.com/david-marchand/spdk/commits/master
> 
> 
> --
> David Marchand


^ permalink raw reply	[relevance 3%]

* [PATCH 3/3] cryptodev: hide sym session structure
    2022-08-29 16:06  1% ` [PATCH 1/3] cryptodev: rework session framework Fan Zhang
@ 2022-08-29 16:06  3% ` Fan Zhang
    2 siblings, 0 replies; 200+ results
From: Fan Zhang @ 2022-08-29 16:06 UTC (permalink / raw)
  To: dev
  Cc: gakhil, maxime.coquelin, chandu, ruifeng.wang, ajit.khaparde,
	anoobj, pablo.de.lara.guarch, matan, g.singh, jianjay.zhou,
	Fan Zhang

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: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
 app/test/test_ipsec_perf.c                  |  4 +-
 doc/guides/prog_guide/cryptodev_lib.rst     | 16 ++----
 doc/guides/rel_notes/deprecation.rst        |  9 ++++
 doc/guides/rel_notes/release_22_11.rst      |  7 +++
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c   |  2 +-
 drivers/crypto/qat/qat_sym.c                |  2 +-
 lib/cryptodev/cryptodev_pmd.h               | 31 ++++++++++++
 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 +-
 13 files changed, 100 insertions(+), 61 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..ba46b6930f 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -237,3 +237,12 @@ Deprecation Notices
   applications should be updated to use the ``dmadev`` library instead,
   with the underlying HW-functionality being provided by the ``ioat`` or
   ``idxd`` dma drivers
+
+* cryptodev: Hide structure ``rte_cryptodev_sym_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 functions ``rte_cryptodev_sym_session_init`` and
+  ``rte_cryptodev_sym_session_clear`` are deprecated. The sym crypto session
+  opaque pointer can no longer be used by different crypto device drivers.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 7fab9d6550..d6f199573f 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -89,6 +89,13 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* cryptodev: The structure ``rte_cryptodev_sym_session`` was moved to
+  cryptodev_pmd.h and was hidden from the application. The APIs to create/init and
+  destroy sym crypto session were updated to take a single mempool with element size
+  enough to hold session data and session private data. Inline APIs was created to
+  get and set the session 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/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_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/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 408ae9e42b..e94a199f4b 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -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/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index f518a0f89b..7bd39e02a3 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -132,6 +132,37 @@ 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;
+	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 */
+};
+
+/**
+ * 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_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 63b8255a45..88dbe71c51 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -1941,11 +1941,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)
@@ -2060,10 +2060,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;
 
@@ -2075,8 +2076,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;
 
@@ -2120,10 +2123,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..0cbdccc61a 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.34.1


^ permalink raw reply	[relevance 3%]

* [PATCH 1/3] cryptodev: rework session framework
  @ 2022-08-29 16:06  1% ` Fan Zhang
  2022-09-15  7:07  0%   ` [EXT] " Akhil Goyal
  2022-08-29 16:06  3% ` [PATCH 3/3] cryptodev: hide sym session structure Fan Zhang
    2 siblings, 1 reply; 200+ results
From: Fan Zhang @ 2022-08-29 16:06 UTC (permalink / raw)
  To: dev
  Cc: gakhil, maxime.coquelin, chandu, ruifeng.wang, ajit.khaparde,
	anoobj, pablo.de.lara.guarch, matan, g.singh, jianjay.zhou,
	Fan Zhang

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: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Akhil Goyal <gakhil@marvell.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                     | 298 +++++-------------
 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      |  54 +---
 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        |  26 +-
 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                 | 272 ++++++----------
 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, 545 insertions(+), 1657 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 6b4d09e623..7efeecf848 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -73,10 +73,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 cecf30e470..24261a1d10 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -50,10 +50,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 5c0dc82290..54f7e8ba2f 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -37,10 +37,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 17e30a8e74..55d7614d84 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -96,35 +96,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",
@@ -135,6 +114,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;
@@ -322,12 +302,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 6ee4480399..c975c38001 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]);
@@ -1381,7 +1371,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),
@@ -1441,10 +1430,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;
 		}
 	}
@@ -1599,7 +1586,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(
@@ -2144,8 +2130,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;
@@ -2190,18 +2174,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,
@@ -2430,7 +2407,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;
@@ -2450,16 +2426,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;
 }
@@ -2472,7 +2443,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;
 
@@ -2492,16 +2462,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;
 }
@@ -2579,7 +2545,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;
@@ -2614,17 +2579,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;
 }
 
@@ -2638,7 +2598,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;
@@ -2678,16 +2637,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;
 }
@@ -2713,7 +2667,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;
 
@@ -2744,26 +2697,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;
 }
@@ -8194,7 +8140,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;
@@ -8216,15 +8161,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
@@ -8668,7 +8610,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: ",
@@ -12018,7 +11960,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);
 
@@ -12033,16 +11974,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);
 
@@ -12250,12 +12186,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;
@@ -12282,20 +12215,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],
@@ -12325,18 +12253,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);
@@ -12387,7 +12306,6 @@ test_multi_session_random_usage(void)
 		},
 
 	};
-	int status;
 
 	/* Verify the capabilities */
 	struct rte_cryptodev_sym_capability_idx cap_idx;
@@ -12409,11 +12327,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));
@@ -12423,16 +12336,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));
@@ -12470,9 +12383,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);
@@ -12490,7 +12402,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(
@@ -12504,17 +12415,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;
@@ -12522,14 +12429,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;
@@ -12543,7 +12447,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;
 
@@ -12569,19 +12472,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),
@@ -12692,7 +12590,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,
@@ -12792,7 +12689,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,
@@ -12979,7 +12875,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;
@@ -12998,15 +12893,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
@@ -13635,7 +13528,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);
 
@@ -13649,15 +13541,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
@@ -13670,7 +13560,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);
@@ -13702,15 +13591,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
@@ -14168,7 +14055,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;
@@ -14219,18 +14105,11 @@ 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);
-	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)
+	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");
 
 	ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
 	TEST_ASSERT_NOT_NULL(ut_params->ibuf,
@@ -14355,18 +14234,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,
@@ -15138,8 +15010,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..0c76dd36a6 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,14 @@ 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;
-
 	ret = cnxk_sess_fill(roc_cpt, xform, sess_priv);
 	if (ret)
 		goto priv_put;
@@ -684,61 +672,37 @@ 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);
 }
 
 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..fe5a7005f3 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;
 	}
@@ -2028,7 +2014,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 +2023,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 392b546a63..48e8ff107b 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;
-
-	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);
+	struct qat_sym_session *s = (void *)sess->driver_priv_data;
 
-		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 8bd5a66889..23878f17cd 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -54,7 +54,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;
@@ -69,7 +68,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);
@@ -109,16 +108,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,
@@ -133,7 +127,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());
@@ -150,7 +143,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;
@@ -161,11 +153,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);
 }
 
@@ -1201,13 +1191,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;
@@ -1236,9 +1222,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 42f3221052..63b8255a45 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -190,12 +190,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 */
 };
@@ -1202,6 +1199,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)
@@ -1225,17 +1240,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 <
@@ -1244,13 +1250,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;
 		}
@@ -1710,53 +1712,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,
@@ -1766,16 +1721,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",
@@ -1791,7 +1743,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,
@@ -1849,64 +1801,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)
+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 (!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;
+	uint32_t sess_priv_sz;
+	int ret;
 
-	return 1;
-}
+	if (!rte_cryptodev_is_valid_dev(dev_id)) {
+		CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+		return NULL;
+	}
 
-struct rte_cryptodev_sym_session *
-rte_cryptodev_sym_session_create(struct rte_mempool *mp)
-{
-	struct rte_cryptodev_sym_session *sess;
-	struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+	if (xforms == NULL) {
+		CDEV_LOG_ERR("Invalid xform\n");
+		return NULL;
+	}
 
-	if (!rte_cryptodev_sym_is_valid_session_pool(mp)) {
+	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
@@ -1985,11 +1941,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);
@@ -2001,37 +1961,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);
@@ -2068,33 +2015,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)
 {
@@ -2141,9 +2061,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;
@@ -2151,18 +2070,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.34.1


^ permalink raw reply	[relevance 1%]

* [PATCH v4 3/4] eal: uninline rte_str_to_size
  @ 2022-08-27 11:32  3%       ` Dmitry Kozlyuk
  0 siblings, 0 replies; 200+ results
From: Dmitry Kozlyuk @ 2022-08-27 11:32 UTC (permalink / raw)
  To: dev
  Cc: Dmitry Kozlyuk, Ray Kinsella, Morten Brørup,
	Bruce Richardson, Chengwen Feng

There is no reason for rte_str_to_size() to be inline.
Move the implementation out of <rte_common.h>.
Export it as a stable ABI because it always has been public.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++
 lib/eal/include/rte_common.h           | 30 ++----------------------
 lib/eal/version.map                    |  1 +
 3 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/lib/eal/common/eal_common_string_fns.c b/lib/eal/common/eal_common_string_fns.c
index 0236ae4023..5fc4ee71dc 100644
--- a/lib/eal/common/eal_common_string_fns.c
+++ b/lib/eal/common/eal_common_string_fns.c
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize)
 	rte_errno = E2BIG;
 	return -rte_errno;
 }
+
+uint64_t
+rte_str_to_size(const char *str)
+{
+	char *endptr;
+	unsigned long long size;
+
+	while (isspace((int)*str))
+		str++;
+	if (*str == '-')
+		return 0;
+
+	errno = 0;
+	size = strtoull(str, &endptr, 0);
+	if (errno)
+		return 0;
+
+	if (*endptr == ' ')
+		endptr++; /* allow 1 space gap */
+
+	switch (*endptr) {
+	case 'G': case 'g':
+		size *= 1024; /* fall-through */
+	case 'M': case 'm':
+		size *= 1024; /* fall-through */
+	case 'K': case 'k':
+		size *= 1024; /* fall-through */
+	default:
+		break;
+	}
+	return size;
+}
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index b65555bac6..86c50c55e0 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -873,34 +873,8 @@ rte_log2_u64(uint64_t v)
  * @return
  *     Number.
  */
-static inline uint64_t
-rte_str_to_size(const char *str)
-{
-	char *endptr;
-	unsigned long long size;
-
-	while (isspace((int)*str))
-		str++;
-	if (*str == '-')
-		return 0;
-
-	errno = 0;
-	size = strtoull(str, &endptr, 0);
-	if (errno)
-		return 0;
-
-	if (*endptr == ' ')
-		endptr++; /* allow 1 space gap */
-
-	switch (*endptr){
-	case 'G': case 'g': size *= 1024; /* fall-through */
-	case 'M': case 'm': size *= 1024; /* fall-through */
-	case 'K': case 'k': size *= 1024; /* fall-through */
-	default:
-		break;
-	}
-	return size;
-}
+uint64_t
+rte_str_to_size(const char *str);
 
 /**
  * Function to terminate the application immediately, printing an error
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..773b0902c0 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -261,6 +261,7 @@ DPDK_23 {
 	rte_socket_id;
 	rte_socket_id_by_idx;
 	rte_srand;
+	rte_str_to_size;
 	rte_strerror;
 	rte_strscpy;
 	rte_strsplit;
-- 
2.33.1


^ permalink raw reply	[relevance 3%]

* [PATCH v4 27/27] dev: hide device object
  2022-08-26 12:41  1% ` [PATCH v4 00/27] " David Marchand
                     ` (2 preceding siblings ...)
  2022-08-26 12:42  1%   ` [PATCH v4 23/27] dev: hide driver object David Marchand
@ 2022-08-26 12:42  2%   ` David Marchand
  3 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Ray Kinsella, Maxime Coquelin, Chenbo Xia

Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Some applications may have been dereferencing rte_device objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/deprecation.rst   |  7 -----
 doc/guides/rel_notes/release_22_11.rst |  4 +--
 lib/eal/common/eal_private.h           |  2 +-
 lib/eal/include/dev_driver.h           | 13 +++++++++
 lib/eal/include/rte_dev.h              | 37 --------------------------
 lib/eal/version.map                    | 14 +++++-----
 lib/vhost/vdpa.c                       |  1 +
 7 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 98a00da385..64668500c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,13 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* drivers: As a follow-up of the work on the ``rte_bus`` object,
-  the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
-  their bus-specific counterparts) will be made opaque in DPDK 22.11.
-  Registering a driver on a bus will be marked as an internal API:
-  external users may still register their drivers using the bus-specific
-  driver header (see ``enable_driver_sdk`` meson option).
-
 * 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
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4e20345b7a..43502349bd 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,8 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
   headers (see ``enable_driver_sdk`` meson option).
-  The ``rte_driver`` object is now opaque and must be manipulated through added
-  accessors.
+  The ``rte_driver`` and ``rte_device`` objects are now opaque and must be
+  manipulated through added accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..5efa8c437e 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -21,6 +21,19 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index f010dd6441..dc1acc8953 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -86,90 +86,66 @@ rte_driver_name(const struct rte_driver *driver);
 /**
  * Retrieve a device bus.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device bus.
  */
-__rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
 /**
  * Retrieve bus specific information for a device.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A string describing this device or NULL if none is available.
  */
-__rte_experimental
 const char *
 rte_dev_bus_info(const struct rte_device *dev);
 
 /**
  * Retrieve a device arguments.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device devargs.
  */
-__rte_experimental
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev);
 
 /**
  * Retrieve a device driver.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device driver.
  */
-__rte_experimental
 const struct rte_driver *
 rte_dev_driver(const struct rte_device *dev);
 
 /**
  * Retrieve a device name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device name.
  */
-__rte_experimental
 const char *
 rte_dev_name(const struct rte_device *dev);
 
 /**
  * Retrieve a device numa node.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device numa node.
  */
-__rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
@@ -179,19 +155,6 @@ rte_dev_numa_node(const struct rte_device *dev);
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const char *bus_info;         /**< Device bus specific information */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 0cf321605e..3c14cf2724 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -26,7 +26,13 @@ DPDK_23 {
 	rte_delay_us_block;
 	rte_delay_us_callback_register;
 	rte_delay_us_sleep;
+	rte_dev_bus;
+	rte_dev_bus_info;
+	rte_dev_devargs;
+	rte_dev_driver;
 	rte_dev_is_probed;
+	rte_dev_name;
+	rte_dev_numa_node;
 	rte_dev_probe;
 	rte_dev_remove;
 	rte_devargs_add;
@@ -424,14 +430,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_dev_bus;
-	rte_dev_bus_info;
-	rte_dev_devargs;
-	rte_dev_driver;
-	rte_dev_name;
-	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index a6ca785b29..bb828577cb 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.37.2


^ permalink raw reply	[relevance 2%]

* [PATCH v4 23/27] dev: hide driver object
  2022-08-26 12:41  1% ` [PATCH v4 00/27] " David Marchand
  2022-08-26 12:41  4%   ` [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor David Marchand
  2022-08-26 12:42  3%   ` [PATCH v4 21/27] bus: hide bus object David Marchand
@ 2022-08-26 12:42  1%   ` David Marchand
  2022-08-26 12:42  2%   ` [PATCH v4 27/27] dev: hide device object David Marchand
  3 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Jay Jayatheerthan, Ajit Khaparde,
	Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Kevin Laatz, Timothy McDaniel, Jerin Jacob,
	Elena Agostini, Ciara Loftus, Qi Zhang, Shepard Siegel, Ed Czeck,
	John Miller, Steven Webster, Matt Peters, Rasesh Mody,
	Shahed Shaikh, Somnath Kotur, Rahul Lakkireddy, Simei Su,
	Wenjun Wu, Marcin Wojtas, Michal Krawczyk, Shai Brandes,
	Evgeny Schemeilin, Igor Chauskin, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Yuying Zhang, Beilei Xing, Jingjing Wu,
	Qiming Yang, Matan Azrad, Viacheslav Ovsiienko, Chaoyong He,
	Niklas Soderlund, Harman Kalra, Devendra Singh Rawat,
	Andrew Rybchenko, Maciej Czekaj, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Ori Kam,
	Akhil Goyal, Chengwen Feng, Ray Kinsella, Ferruh Yigit,
	Abhinandan Gujjar, Olivier Matz, Reshma Pattan

Make rte_driver opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_driver definition.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_driver objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/release_22_11.rst        |  2 ++
 drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
 drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
 drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
 drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
 drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |  2 +-
 drivers/bus/pci/bus_pci_driver.h              |  2 +-
 drivers/bus/pci/pci_params.c                  |  2 +-
 drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
 drivers/bus/vdev/vdev.c                       |  2 +-
 drivers/bus/vdev/vdev_params.c                |  2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
 drivers/common/qat/qat_qp.c                   |  2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
 drivers/dma/idxd/idxd_bus.c                   |  1 +
 drivers/event/dlb2/dlb2.c                     |  2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
 drivers/event/octeontx/ssovf_evdev.c          |  2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
 drivers/gpu/cuda/cuda.c                       |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
 drivers/net/ark/ark_global.h                  |  2 +-
 drivers/net/avp/avp_ethdev.c                  |  2 +-
 drivers/net/axgbe/axgbe_common.h              |  2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
 drivers/net/cxgbe/base/t4_hw.c                |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                |  2 +-
 drivers/net/cxgbe/sge.c                       |  2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
 drivers/net/e1000/em_ethdev.c                 |  2 +-
 drivers/net/e1000/igb_ethdev.c                |  2 +-
 drivers/net/e1000/igb_flow.c                  |  2 +-
 drivers/net/ena/ena_ethdev.h                  |  2 +-
 drivers/net/enic/enic_ethdev.c                |  2 +-
 drivers/net/enic/enic_vf_representor.c        |  2 +-
 drivers/net/failsafe/failsafe_private.h       |  2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
 drivers/net/i40e/i40e_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_vchnl.c                 |  2 +-
 drivers/net/ice/ice_dcf.c                     |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
 drivers/net/mlx4/mlx4.c                       |  2 +-
 drivers/net/netvsc/hn_ethdev.c                |  2 +-
 drivers/net/netvsc/hn_nvs.c                   |  2 +-
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/netvsc/hn_rxtx.c                  |  2 +-
 drivers/net/nfp/nfp_common.c                  |  2 +-
 drivers/net/nfp/nfp_ethdev.c                  |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
 drivers/net/qede/qede_ethdev.h                |  2 +-
 drivers/net/sfc/sfc_ethdev.c                  |  2 +-
 drivers/net/sfc/sfc_sw_stats.c                |  2 +-
 drivers/net/sfc/sfc_sw_stats.h                |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
 lib/compressdev/rte_compressdev.c             |  2 +-
 lib/compressdev/rte_compressdev_pmd.c         |  2 +-
 lib/compressdev/rte_compressdev_pmd.h         |  1 +
 lib/cryptodev/cryptodev_pmd.c                 |  2 +-
 lib/cryptodev/cryptodev_pmd.h                 |  1 +
 lib/cryptodev/rte_cryptodev.c                 |  2 +-
 lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
 lib/eal/common/eal_common_dev.c               |  2 +-
 lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
 lib/eal/include/meson.build                   |  1 +
 lib/eal/include/rte_dev.h                     | 15 ++--------
 lib/eal/version.map                           |  4 +--
 lib/ethdev/ethdev_driver.h                    |  1 +
 lib/eventdev/eventdev_pmd.h                   |  2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
 lib/eventdev/rte_eventdev.c                   |  2 +-
 lib/gpudev/gpudev_driver.h                    |  2 +-
 lib/mempool/rte_mempool_ops.c                 |  2 +-
 lib/pcapng/rte_pcapng.c                       |  2 +-
 lib/rawdev/rte_rawdev.c                       |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
 lib/security/rte_security.c                   |  2 +-
 115 files changed, 144 insertions(+), 122 deletions(-)
 create mode 100644 lib/eal/include/dev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 36df0ccf93..4e20345b7a 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,6 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
   headers (see ``enable_driver_sdk`` meson option).
+  The ``rte_driver`` object is now opaque and must be manipulated through added
+  accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 801e8920df..e2d9409185 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_byteorder.h>
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 c1d877c87f..51dd090c1b 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index f16814e241..036579e3ec 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a889e392c6..e4c7ee0c3b 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <bus_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1c2d2c04af..58fb7c7f69 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -25,7 +25,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index cf66fc0c53..26a83b2cdf 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -7,7 +7,7 @@
 #define BUS_DPAA_DRIVER_H
 
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 798ddebf3a..7ac5fe6ff1 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -29,7 +29,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8604e43947..5966776a85 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -28,7 +28,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index cfe4280f87..d7f6e45b7d 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -18,7 +18,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_pool_ops.h>
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index b7d81b518c..07256ed7ec 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <fslmc_logs.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 071b0d297d..4aec7b2cd8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -30,7 +30,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index 223e34bcba..65e2d799c3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "private.h"
 #include <fslmc_logs.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b5c7dee617..0f2f9b5101 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_compat.h>
 
 /** Pathname of PCI devices directory. */
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 39d702a418..d24cc201b8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -6,7 +6,7 @@
 
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 36748cdfae..bc7e30d7c6 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 
 #include <rte_bus_vdev.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 809a8bb08f..b176b658fc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 2c72614776..2d10a1e8ad 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index 3424e791c9..e2475a642d 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_bus_vmbus.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 struct vmbus_channel;
 struct vmbus_mon_page;
diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
index 7ffde5f4c8..85d6ddfcf4 100644
--- a/drivers/common/qat/dev/qat_dev_gen4.c
+++ b/drivers/common/qat/dev/qat_dev_gen4.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "qat_device.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 5916e745e2..9cbd19a481 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 7d657d81bc..445a3baa67 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
index 61d457f4e0..d1ede5e990 100644
--- a/drivers/crypto/bcmfs/bcmfs_qp.c
+++ b/drivers/crypto/bcmfs/bcmfs_qp.c
@@ -8,7 +8,7 @@
 #include <rte_atomic.h>
 #include <rte_bitmap.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_prefetch.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
index bc7fb67218..78272d616c 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
@@ -4,7 +4,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 6c3e45e333..013f3be1e6 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 
 #include "ccp_crypto.h"
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 3fd9f3c426..db11ac7444 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn10k_cryptodev.h"
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index bd425f95ff..4cfc1f2150 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn9k_cryptodev.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0cce861899..3b13578de0 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_common.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7e554cb2b1..c6bd785262 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -19,7 +19,7 @@
 #include <rte_security_driver.h>
 #endif
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 83ae6b6be9..11b559e025 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -5,7 +5,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index e30dcfc281..9b7b16c6e3 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -9,6 +9,7 @@
 #include <libgen.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 5a443acff8..759578378f 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -17,7 +17,7 @@
 #include <rte_config.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 9f8c6cd8b8..71ac141b66 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -15,7 +15,7 @@
 
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
 #include <rte_ring.h>
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index aa403f9e06..8e470584ea 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 08df6e223a..1001297cda 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <bus_fslmc_driver.h>
 #include <rte_lcore.h>
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 3882a9cf1d..a68d3ac154 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index fe157c59d5..99fa326ad5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <ethdev_driver.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 6bd8fec6d4..8513b9a013 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -12,7 +12,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 2be7b8d2df..a552aabeb8 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -8,7 +8,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <gpudev_driver.h>
 
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 56c629c681..84371d5d1a 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -20,7 +20,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include "rte_dpaa2_mempool.h"
 
 #include "fslmc_vfio.h"
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fd7be47311..9957de2314 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -24,7 +24,7 @@
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 748db590c1..71d0b53e03 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_version.h>
 
 #include "ark_pktdir.h"
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7c0cb666fb..b2a08f5635 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_cycles.h>
 #include <rte_spinlock.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index b9ebf64fb8..a5d11c5832 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -33,7 +33,7 @@
 #include <rte_memzone.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_pci.h>
 #include <rte_common.h>
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f36ad30e17..4448cf2de2 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -9,7 +9,7 @@
 #include "bnx2x_rxtx.h"
 
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53f..1460dce2ab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef04c..fd1506ddd4 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -7,7 +7,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 384080e6d3..bed755f5d9 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -18,7 +18,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_byteorder.h>
 
 #include "common.h"
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index fd71a50a58..45bbeaef0c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -31,7 +31,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "cxgbe.h"
 #include "cxgbe_pfvf.h"
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3c02c98b3d..f8dd833032 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -31,7 +31,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "base/common.h"
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5d91355c9a..5b13cb5c94 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -30,7 +30,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 9509f6e8a3..4d33b51fea 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <dpaa2_pmd_logs.h>
 #include <dpaa2_hw_pvt.h>
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index f876f4790c..37a8b43114 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 #include "rte_dpaa2_mempool.h"
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 932570c6e0..fbfdf360d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -14,7 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7b9c528d13..9436a95ac8 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hexdump.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
index ba0d500f74..63463c4fbf 100644
--- a/drivers/net/dpaa2/dpaa2_sparser.c
+++ b/drivers/net/dpaa2/dpaa2_sparser.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <fslmc_vfio.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 409de50083..8ee9be12ad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 43979992d3..d6bcc5bf58 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index e46697b6a1..b775310651 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -21,7 +21,7 @@
 #include <rte_eal.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 4709675af8..4d27fba585 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -14,7 +14,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_timer.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 
 #include "ena_com.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 998436e5e8..cdf0915591 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 7312c411bd..46f85964e9 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -7,7 +7,7 @@
 
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index a80f5e2caf..53a451c1b1 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -11,7 +11,7 @@
 #include <pthread.h>
 
 #include <rte_atomic.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_devargs.h>
 #include <rte_flow.h>
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8bbd8b445d..7adb20bff9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_spinlock.h>
 #include <rte_kvargs.h>
 #include <rte_vect.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bdc453ec1..67111ac251 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -23,7 +23,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_alarm.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_hash_crc.h>
 #include <rte_bitmap.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..ef2ab06475 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,7 +24,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 21bd1e2193..15f695682d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,7 +19,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..1c3d22ae0f 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -21,7 +21,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "ice_dcf.h"
 #include "ice_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 0da267db1f..dee712af98 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -18,7 +18,7 @@
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <iavf_devids.h>
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 552e41692c..04c9ce78a2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..67373a7b78 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -27,7 +27,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 910b76a92c..7e7e1824ef 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ccc06bdda6..d0bbc0a4c0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -30,7 +30,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 817fb06dfb..7db82af9f3 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -28,7 +28,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 20f75a17b0..e6f1f28768 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -26,7 +26,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 61cf374224..bc6f60c64a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -25,7 +25,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 #include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c792..eaafe11fb9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -19,7 +19,7 @@
 #include <rte_debug.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e588..47359501bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_common.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9ada22e2ff..0eee191566 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -15,7 +15,7 @@
 #include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index a38b701183..b781bcdcfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -13,7 +13,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ip.h>
 
 /* ecore includes */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 506c62a726..2ec743ebce 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -7,7 +7,7 @@
  * for Solarflare) and Solarflare Communications, Inc.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 81f5aa3cc4..3ae5023b6f 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2021 Xilinx, Inc.
  */
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_bitmap.h>
 
 #include "sfc.h"
diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
index 1abded8018..d9738e5214 100644
--- a/drivers/net/sfc/sfc_sw_stats.h
+++ b/drivers/net/sfc/sfc_sw_stats.h
@@ -5,7 +5,7 @@
 #ifndef _SFC_SW_STATS_H
 #define _SFC_SW_STATS_H
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "sfc.h"
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 28183ec740..9f57cb1a20 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index dc90569df1..c3e045d892 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -27,7 +27,7 @@
 #include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d180162abd..edf3becd32 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -24,7 +24,7 @@
 #include <rte_memory.h>
 #include <rte_eal_paging.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 2b9e35cef5..abc63b0935 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -16,7 +16,7 @@
 
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "virtio.h"
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 101b1cb500..fd946dec5c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/vmxnet3_defs.h"
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index db029cbf34..909fb8faab 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -3,7 +3,7 @@
  */
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 6831cc8d20..5dd5bbb652 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index fc257c5f44..8ef7a6b127 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_rawdev.h>
 #include <bus_vdev_driver.h>
 #include <rte_test.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 6ab62a12fc..92cf5f495e 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -11,7 +11,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_glue.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index e997bd01ed..cf2c20a704 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 9bfae077db..41f1415bea 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
index 9fabc399c5..72e52f876f 100644
--- a/lib/compressdev/rte_compressdev_pmd.h
+++ b/lib/compressdev/rte_compressdev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 
 #include "rte_compressdev.h"
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 75d0075b86..f07b92dfd7 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..96d7e225b0 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 6250302f3b..29c9c55131 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -13,7 +13,7 @@
 
 #include <rte_log.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index 82ab7a8cc7..acd7f71cd1 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -14,7 +14,7 @@
  * by any application.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_dmadev.h"
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 16c5aef1d8..98f3c78795 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -9,7 +9,7 @@
 
 #include <bus_driver.h>
 #include <rte_class.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_errno.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
new file mode 100644
index 0000000000..015188abd5
--- /dev/null
+++ b/lib/eal/include/dev_driver.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef DEV_DRIVER_H
+#define DEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include <rte_dev.h>
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+	const char *name;                   /**< Driver name. */
+	const char *alias;              /**< Driver alias. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEV_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index 77d8621a51..cfcd40aaed 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -57,6 +57,7 @@ headers += files(
 
 driver_sdk_headers = files(
         'bus_driver.h',
+        'dev_driver.h',
 )
 
 # special case install the generic headers, since they go in a subdir
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ddea163cca..7214f5d7fb 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,8 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_driver;
+
 /**
  * The device event type.
  */
@@ -67,27 +69,14 @@ struct rte_mem_resource {
 	void *addr;         /**< Virtual address, NULL when not mapped. */
 };
 
-/**
- * A structure describing a device driver.
- */
-struct rte_driver {
-	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
-	const char *name;                   /**< Driver name. */
-	const char *alias;              /**< Driver alias. */
-};
-
 /**
  * Retrieve a driver name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param driver
  *   A pointer to a driver structure.
  * @return
  *   A pointer to the driver name string.
  */
-__rte_experimental
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index d10fd89458..8b53a1d258 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -37,6 +37,7 @@ DPDK_23 {
 	rte_devargs_parsef;
 	rte_devargs_remove;
 	rte_devargs_type_count;
+	rte_driver_name;
 	rte_dump_physmem_layout;
 	rte_dump_stack;
 	rte_dump_tailq;
@@ -423,9 +424,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..47a55a419e 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -19,6 +19,7 @@ extern "C" {
  *
  */
 
+#include <dev_driver.h>
 #include <rte_ethdev.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..def6cd0876 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 4938b4ee07..a8ef5bac06 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 8e81cf774d..29515401bd 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -9,7 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_log.h>
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 79b905e9fc..bbb027aa0c 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 0e55b00bfe..23972b3dbd 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_gpudev.h"
 
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index ac32c4bb72..3b43edc548 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -9,7 +9,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_mempool_trace.h"
 
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 72aabd4dd0..af2b814251 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -14,7 +14,7 @@
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index e157d65332..569e836560 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_telemetry.h>
diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 3b7be57d3e..a51944c8ff 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -19,7 +19,7 @@ extern "C" {
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 1a2a408f0e..94160f4177 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -5,7 +5,7 @@
  */
 
 #include <rte_cryptodev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_telemetry.h>
 #include "rte_security.h"
 #include "rte_security_driver.h"
-- 
2.37.2


^ permalink raw reply	[relevance 1%]

* [PATCH v4 21/27] bus: hide bus object
  2022-08-26 12:41  1% ` [PATCH v4 00/27] " David Marchand
  2022-08-26 12:41  4%   ` [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-08-26 12:42  3%   ` David Marchand
  2022-08-26 12:42  1%   ` [PATCH v4 23/27] dev: hide driver object David Marchand
  2022-08-26 12:42  2%   ` [PATCH v4 27/27] dev: hide device object David Marchand
  3 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Anatoly Burakov,
	Stephen Hemminger, Long Li, Matan Azrad, Viacheslav Ovsiienko,
	Kevin Laatz, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Ferruh Yigit,
	Andrew Rybchenko, Reshma Pattan

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_bus objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

Changes since RFC v1:
- update all existing users of the public header to use the internal one,

---
 app/test/test_devargs.c                  |   2 +-
 app/test/test_vdev.c                     |   2 +-
 doc/guides/rel_notes/deprecation.rst     |   6 -
 doc/guides/rel_notes/release_22_11.rst   |   6 +
 drivers/bus/auxiliary/auxiliary_common.c |   2 +-
 drivers/bus/auxiliary/auxiliary_params.c |   2 +-
 drivers/bus/auxiliary/private.h          |   2 +-
 drivers/bus/dpaa/dpaa_bus.c              |   2 +-
 drivers/bus/fslmc/fslmc_bus.c            |   2 +-
 drivers/bus/fslmc/private.h              |   2 +-
 drivers/bus/ifpga/ifpga_bus.c            |   2 +-
 drivers/bus/pci/linux/pci_vfio.c         |   2 +-
 drivers/bus/pci/pci_common.c             |   2 +-
 drivers/bus/pci/pci_params.c             |   2 +-
 drivers/bus/pci/private.h                |   2 +-
 drivers/bus/vdev/vdev.c                  |   2 +-
 drivers/bus/vmbus/private.h              |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c    |   2 +-
 drivers/dma/idxd/idxd_bus.c              |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c  |   2 +-
 drivers/net/failsafe/failsafe.c          |   2 +-
 drivers/net/failsafe/failsafe_eal.c      |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c         |   2 +-
 drivers/net/netvsc/hn_ethdev.c           |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c    |   2 +-
 drivers/net/virtio/virtio_pci.c          |   2 +-
 drivers/raw/ioat/idxd_bus.c              |   2 +-
 lib/eal/common/eal_common_bus.c          |   2 +-
 lib/eal/common/eal_common_dev.c          |   2 +-
 lib/eal/common/eal_common_devargs.c      |   2 +-
 lib/eal/common/hotplug_mp.c              |   2 +-
 lib/eal/include/bus_driver.h             | 296 +++++++++++++++++++++++
 lib/eal/include/meson.build              |   4 +
 lib/eal/include/rte_bus.h                | 278 +--------------------
 lib/eal/linux/eal_dev.c                  |   2 +-
 lib/eal/version.map                      |   8 +-
 lib/ethdev/rte_ethdev.c                  |   2 +-
 lib/pcapng/rte_pcapng.c                  |   2 +-
 38 files changed, 343 insertions(+), 319 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..0a4c34a1ad 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 3cc3abe70b..c3a8ad64bb 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "test.h"
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 5b4ffc992d..98a00da385 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,12 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* bus: The ``rte_bus`` object will be made opaque in DPDK 22.11.
-  The goal is to remove it from the public ABI and make this object extendable.
-  As a side effect, registering a bus will be marked as an internal API:
-  external users may still register their bus using a new driver header
-  (see ``enable_driver_sdk`` meson option).
-
 * drivers: As a follow-up of the work on the ``rte_bus`` object,
   the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
   their bus-specific counterparts) will be made opaque 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 e08a548285..36df0ccf93 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,6 +88,12 @@ API Changes
   in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
   to update their code.
 
+* bus: Registering a bus has been marked as an internal API.
+  External users may still register their bus using the ``bus_driver.h``
+  driver header (see ``enable_driver_sdk`` meson option).
+  The ``rte_bus`` object is now opaque and must be manipulated through added
+  accessors.
+
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 6cf6c170ec..259ff152c4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -12,7 +12,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 0289777922..a889e392c6 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 3f49f62493..3dee13e1d1 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "bus_auxiliary_driver.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 1ac6aa314f..682427ba2c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -29,7 +29,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index b9b0981329..8503004e3d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 60d68155e1..6f14085d98 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef BUS_FSLMC_PRIVATE_H
 #define BUS_FSLMC_PRIVATE_H
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 27e2de7072..bb943b58b5 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index cd0d0b1670..fab3483d9f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_vfio.h>
 #include <rte_eal.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 0d61d49287..c26aacd364 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_lcore.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 61a868707f..39d702a418 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 4e40a2ed85..fddf49251d 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7d78cf93bc..809a8bb08f 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 3d233fa83c..e33424675c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e82cb881bf..73178ce0f3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 1a86eb3c00..6553166f5c 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 5d4d52c341..32811403b4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..d71b512f81 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,7 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index efb262e368..4f0a6f4d55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 188d92ffac..ccc06bdda6 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 65043a04eb..dc90569df1 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..9cf4d760b4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -9,7 +9,7 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "virtio_pci.h"
 #include "virtio_logs.h"
diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 539f51b1b1..f32d811055 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include "ioat_private.h"
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..62a598957c 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..03e6e59baf 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..5202bd5658 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..d2e615a736
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,296 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_devargs;
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+typedef int (*rte_bus_scan_t)(void);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * This is called while iterating over each registered bus.
+ *
+ * @return
+ *	0 for successful probe
+ *	!0 for any error while probing
+ */
+typedef int (*rte_bus_probe_t)(void);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */
+	const char *name;            /**< Name of the bus */
+	rte_bus_scan_t scan;         /**< Scan for devices attached to bus */
+	rte_bus_probe_t probe;       /**< Probe devices on bus */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 3848b44db0..dfe756fb11 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,284 +20,21 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-typedef int (*rte_bus_scan_t)(void);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * This is called while iterating over each registered bus.
- *
- * @return
- *	0 for successful probe
- *	!0 for any error while probing
- */
-typedef int (*rte_bus_probe_t)(void);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */
-	const char *name;            /**< Name of the bus */
-	rte_bus_scan_t scan;         /**< Scan for devices attached to bus */
-	rte_bus_probe_t probe;       /**< Probe devices on bus */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * Retrieve a bus name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param bus
  *   A pointer to a rte_bus structure.
  * @return
  *   A pointer to the bus name string.
  */
-__rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -387,17 +124,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..098a2c3076 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -13,7 +13,7 @@
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index aa53064db1..6ec15f1147 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -12,10 +12,9 @@ DPDK_23 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
+	rte_bus_name;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -424,14 +423,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_bus_name;
 };
 
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9e358d187a..0c2c1088c0 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..72aabd4dd0 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.2


^ permalink raw reply	[relevance 3%]

* [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor
  2022-08-26 12:41  1% ` [PATCH v4 00/27] " David Marchand
@ 2022-08-26 12:41  4%   ` David Marchand
  2022-08-26 12:42  3%   ` [PATCH v4 21/27] bus: hide bus object David Marchand
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 200+ results
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * 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.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.37.2


^ permalink raw reply	[relevance 4%]

* [PATCH v4 00/27] Bus and device cleanup for 22.11
    @ 2022-08-26 12:41  1% ` David Marchand
  2022-08-26 12:41  4%   ` [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (3 more replies)
  2022-09-05  8:35  1% ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
                   ` (2 subsequent siblings)
  4 siblings, 4 replies; 200+ results
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

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 RFC v3:
- marked the series as non-RFC,
- rebased on v22.11-rc0,
- marked RTE_FUNC_PTR_* macros as deprecated,
- split the bus specific patch in two patches,

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (27):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  eal: deprecate RTE_FUNC_PTR_* macros
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide bus specific information
  bus/pci: fill bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   3 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |  20 +-
 doc/guides/rel_notes/release_22_11.rst        |  19 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 drivers/bus/auxiliary/linux/auxiliary.c       |   2 -
 drivers/bus/auxiliary/meson.build             |   4 +-
 drivers/bus/auxiliary/private.h               |  30 +-
 drivers/bus/auxiliary/version.map             |   3 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  21 +-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |  35 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   8 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 drivers/net/dpaa2/dpaa2_ethdev.h              |   2 +-
 drivers/net/dpaa2/dpaa2_mux.c                 |   2 +-
 drivers/net/dpaa2/dpaa2_ptp.c                 |   2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  21 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  25 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |  48 ++-
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |  45 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_dev.h                     | 104 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       | 277 +++++++++-----
 lib/ethdev/rte_ethdev.h                       |  11 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  12 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  15 +-
 lib/eventdev/rte_eventdev.c                   |  64 ++--
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   5 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |  77 ++--
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |  59 +--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   8 +-
 lib/vhost/vdpa.c                              |  10 +-
 lib/vhost/vhost_user.c                        |   6 +-
 367 files changed, 2193 insertions(+), 2489 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.37.2


^ permalink raw reply	[relevance 1%]

* [PATCH v3 3/4] eal: uninline rte_str_to_size
  @ 2022-08-25 22:33  3%     ` Dmitry Kozlyuk
    1 sibling, 0 replies; 200+ results
From: Dmitry Kozlyuk @ 2022-08-25 22:33 UTC (permalink / raw)
  To: dev
  Cc: Dmitry Kozlyuk, Ray Kinsella, Morten Brørup,
	Bruce Richardson, Chengwen Feng

There is no reason for rte_str_to_size() to be inline.
Move the implementation out of <rte_common.h>.
Export it as a stable ABI because it always has been public.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++
 lib/eal/include/rte_common.h           | 30 ++----------------------
 lib/eal/version.map                    |  1 +
 3 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/lib/eal/common/eal_common_string_fns.c b/lib/eal/common/eal_common_string_fns.c
index 0236ae4023..5fc4ee71dc 100644
--- a/lib/eal/common/eal_common_string_fns.c
+++ b/lib/eal/common/eal_common_string_fns.c
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize)
 	rte_errno = E2BIG;
 	return -rte_errno;
 }
+
+uint64_t
+rte_str_to_size(const char *str)
+{
+	char *endptr;
+	unsigned long long size;
+
+	while (isspace((int)*str))
+		str++;
+	if (*str == '-')
+		return 0;
+
+	errno = 0;
+	size = strtoull(str, &endptr, 0);
+	if (errno)
+		return 0;
+
+	if (*endptr == ' ')
+		endptr++; /* allow 1 space gap */
+
+	switch (*endptr) {
+	case 'G': case 'g':
+		size *= 1024; /* fall-through */
+	case 'M': case 'm':
+		size *= 1024; /* fall-through */
+	case 'K': case 'k':
+		size *= 1024; /* fall-through */
+	default:
+		break;
+	}
+	return size;
+}
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index b65555bac6..86c50c55e0 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -873,34 +873,8 @@ rte_log2_u64(uint64_t v)
  * @return
  *     Number.
  */
-static inline uint64_t
-rte_str_to_size(const char *str)
-{
-	char *endptr;
-	unsigned long long size;
-
-	while (isspace((int)*str))
-		str++;
-	if (*str == '-')
-		return 0;
-
-	errno = 0;
-	size = strtoull(str, &endptr, 0);
-	if (errno)
-		return 0;
-
-	if (*endptr == ' ')
-		endptr++; /* allow 1 space gap */
-
-	switch (*endptr){
-	case 'G': case 'g': size *= 1024; /* fall-through */
-	case 'M': case 'm': size *= 1024; /* fall-through */
-	case 'K': case 'k': size *= 1024; /* fall-through */
-	default:
-		break;
-	}
-	return size;
-}
+uint64_t
+rte_str_to_size(const char *str);
 
 /**
  * Function to terminate the application immediately, printing an error
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..773b0902c0 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -261,6 +261,7 @@ DPDK_23 {
 	rte_socket_id;
 	rte_socket_id_by_idx;
 	rte_srand;
+	rte_str_to_size;
 	rte_strerror;
 	rte_strscpy;
 	rte_strsplit;
-- 
2.33.1


^ permalink raw reply	[relevance 3%]

* [PATCH v6 1/7] bbdev: allow operation type enum for growth
  @ 2022-08-25 18:24  3%   ` Nicolas Chautru
  0 siblings, 0 replies; 200+ results
From: Nicolas Chautru @ 2022-08-25 18:24 UTC (permalink / raw)
  To: dev, thomas, gakhil, hemant.agrawal
  Cc: maxime.coquelin, trix, mdr, bruce.richardson, david.marchand,
	stephen, 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_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%]

* [PATCH v2 3/4] eal: uninline rte_str_to_size
  @ 2022-08-25 15:37  3%   ` Dmitry Kozlyuk
    1 sibling, 0 replies; 200+ results
From: Dmitry Kozlyuk @ 2022-08-25 15:37 UTC (permalink / raw)
  To: dev
  Cc: Dmitry Kozlyuk, Ray Kinsella, Morten Brørup,
	Bruce Richardson, Chengwen Feng

There is no reason for rte_str_to_size() to be inline.
Move the implementation out of <rte_common.h>.
Export it as a stable ABI because it always has been public.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++
 lib/eal/include/rte_common.h           | 30 ++----------------------
 lib/eal/version.map                    |  1 +
 3 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/lib/eal/common/eal_common_string_fns.c b/lib/eal/common/eal_common_string_fns.c
index 0236ae4023..5fc4ee71dc 100644
--- a/lib/eal/common/eal_common_string_fns.c
+++ b/lib/eal/common/eal_common_string_fns.c
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize)
 	rte_errno = E2BIG;
 	return -rte_errno;
 }
+
+uint64_t
+rte_str_to_size(const char *str)
+{
+	char *endptr;
+	unsigned long long size;
+
+	while (isspace((int)*str))
+		str++;
+	if (*str == '-')
+		return 0;
+
+	errno = 0;
+	size = strtoull(str, &endptr, 0);
+	if (errno)
+		return 0;
+
+	if (*endptr == ' ')
+		endptr++; /* allow 1 space gap */
+
+	switch (*endptr) {
+	case 'G': case 'g':
+		size *= 1024; /* fall-through */
+	case 'M': case 'm':
+		size *= 1024; /* fall-through */
+	case 'K': case 'k':
+		size *= 1024; /* fall-through */
+	default:
+		break;
+	}
+	return size;
+}
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index b65555bac6..86c50c55e0 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -873,34 +873,8 @@ rte_log2_u64(uint64_t v)
  * @return
  *     Number.
  */
-static inline uint64_t
-rte_str_to_size(const char *str)
-{
-	char *endptr;
-	unsigned long long size;
-
-	while (isspace((int)*str))
-		str++;
-	if (*str == '-')
-		return 0;
-
-	errno = 0;
-	size = strtoull(str, &endptr, 0);
-	if (errno)
-		return 0;
-
-	if (*endptr == ' ')
-		endptr++; /* allow 1 space gap */
-
-	switch (*endptr){
-	case 'G': case 'g': size *= 1024; /* fall-through */
-	case 'M': case 'm': size *= 1024; /* fall-through */
-	case 'K': case 'k': size *= 1024; /* fall-through */
-	default:
-		break;
-	}
-	return size;
-}
+uint64_t
+rte_str_to_size(const char *str);
 
 /**
  * Function to terminate the application immediately, printing an error
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..773b0902c0 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -261,6 +261,7 @@ DPDK_23 {
 	rte_socket_id;
 	rte_socket_id_by_idx;
 	rte_srand;
+	rte_str_to_size;
 	rte_strerror;
 	rte_strscpy;
 	rte_strsplit;
-- 
2.33.1


^ permalink raw reply	[relevance 3%]

* Re: [PATCH v4 2/7] bbdev: add device status info
  @ 2022-08-25 14:08  3%         ` Maxime Coquelin
  0 siblings, 0 replies; 200+ results
From: Maxime Coquelin @ 2022-08-25 14:08 UTC (permalink / raw)
  To: Chautru, Nicolas, Tom Rix, dev, thomas, gakhil, hemant.agrawal
  Cc: mdr, Richardson, Bruce, david.marchand, stephen



On 7/6/22 23:16, Chautru, Nicolas wrote:
>>> +};
>>> +
>>>    /** Device statistics. */
>>>    struct rte_bbdev_stats {
>>>    	uint64_t enqueued_count;  /**< Count of all operations enqueued */
>>> @@ -285,12 +300,14 @@ struct rte_bbdev_driver_info {
>>>    	/** Set if device supports per-queue interrupts */
>>>    	bool queue_intr_supported;
>>>    	/** Minimum alignment of buffers, in bytes */
>>> -	uint16_t min_alignment;
>>> -	/** HARQ memory available in kB */
>>> +	/** Device Status */
>>> +	enum rte_bbdev_device_status device_status;
>> New elements should be added to the end to improve backward compatibility.
> Same comment in different patch. I would like to know if there is a real recommendation from DPDK on this. I have heard opposite view as well.
> In that very case we are breaking the ABI in that new serie for 22.11 (sizes and offsets are changing).
> 

Since we are breaking ABI anyways, I don't find it unreasonable to take
the opportunity to improve packing the struct.

Maxime


^ permalink raw reply	[relevance 3%]

* Re: [PATCH v5 1/7] bbdev: allow operation type enum for growth
  @ 2022-08-25 13:54  0%     ` Maxime Coquelin
  0 siblings, 0 replies; 200+ results
From: Maxime Coquelin @ 2022-08-25 13:54 UTC (permalink / raw)
  To: Nicolas Chautru, dev, thomas, gakhil, hemant.agrawal
  Cc: trix, mdr, bruce.richardson, david.marchand, stephen

Hi Nicolas,

On 7/7/22 01:28, Nicolas Chautru wrote:
> 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>
> ---
>   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(-)
> 

Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[relevance 0%]

* [RFC PATCH v1 05/10] dts: add system under test node
  @ 2022-08-24 16:24  2% ` Juraj Linkeš
  0 siblings, 0 replies; 200+ results
From: Juraj Linkeš @ 2022-08-24 16:24 UTC (permalink / raw)
  To: thomas, david.marchand, ronan.randles, Honnappa.Nagarahalli,
	ohilyard, lijuan.tu
  Cc: dev, Juraj Linkeš

The SUT node contains methods to configure the node and build and
configure DPDK.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 dts/framework/sut_node.py | 603 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 603 insertions(+)
 create mode 100644 dts/framework/sut_node.py

diff --git a/dts/framework/sut_node.py b/dts/framework/sut_node.py
new file mode 100644
index 0000000000..c9f5e69d73
--- /dev/null
+++ b/dts/framework/sut_node.py
@@ -0,0 +1,603 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2022 PANTHEON.tech s.r.o.
+#
+
+import os
+import re
+import tarfile
+import time
+from typing import List, Optional, Union
+
+from framework.config import NodeConfiguration
+
+from .exception import ParameterInvalidException
+from .node import Node
+from .settings import SETTINGS
+
+
+class SutNode(Node):
+    """
+    A class for managing connections to the System under test, providing
+    methods that retrieve the necessary information about the node (such as
+    cpu, memory and NIC details) and configuration capabilities.
+    """
+
+    def __init__(self, node_config: NodeConfiguration):
+        super(SutNode, self).__init__(node_config)
+        self.tg_node = None
+        self.architecture = node_config.arch
+        self.prefix_subfix = (
+            str(os.getpid()) + "_" + time.strftime("%Y%m%d%H%M%S", time.localtime())
+        )
+        self.hugepage_path = None
+        self.dpdk_version = ""
+        self.testpmd = None
+
+    def prerequisites(self):
+        """
+        Copy DPDK package to SUT and apply patch files.
+        """
+        self.prepare_package()
+        self.sut_prerequisites()
+
+    def prepare_package(self):
+        if not self.skip_setup:
+            assert os.path.isfile(SETTINGS.dpdk_ref) is True, "Invalid package"
+
+            out = self.send_expect(
+                "ls -d %s" % SETTINGS.remote_dpdk_dir, "# ", verify=True
+            )
+            if out == 2:
+                self.send_expect("mkdir -p %s" % SETTINGS.remote_dpdk_dir, "# ")
+
+            out = self.send_expect(
+                "ls %s && cd %s" % (SETTINGS.remote_dpdk_dir, SETTINGS.remote_dpdk_dir),
+                "#",
+                verify=True,
+            )
+            if out == -1:
+                raise IOError(
+                    f"A failure occurred when creating {SETTINGS.remote_dpdk_dir} on "
+                    f"{self}."
+                )
+            self.main_session.copy_file_to(SETTINGS.dpdk_ref, SETTINGS.remote_dpdk_dir)
+            self.kill_all()
+
+            # enable core dump
+            self.send_expect("ulimit -c unlimited", "#")
+
+            with tarfile.open(SETTINGS.dpdk_ref) as dpdk_tar:
+                dpdk_top_dir = dpdk_tar.getnames()[0]
+
+            remote_dpdk_top_dir = os.path.join(SETTINGS.remote_dpdk_dir, dpdk_top_dir)
+
+            # unpack the code and change to the working folder
+            self.send_expect("rm -rf %s" % remote_dpdk_top_dir, "#")
+
+            remote_dpdk_path = os.path.join(
+                SETTINGS.remote_dpdk_dir, os.path.basename(SETTINGS.dpdk_ref)
+            )
+
+            # unpack dpdk
+            out = self.send_expect(
+                f"tar xfm {remote_dpdk_path} -C {SETTINGS.remote_dpdk_dir}",
+                "# ",
+                60,
+                verify=True,
+            )
+            if out == -1:
+                raise IOError(
+                    f"Extracting remote DPDK package {remote_dpdk_path} to "
+                    f"{SETTINGS.remote_dpdk_dir} failed."
+                )
+
+            # check dpdk dir name is expect
+            out = self.send_expect("ls %s" % remote_dpdk_top_dir, "# ", 20, verify=True)
+            if out == -1:
+                raise FileNotFoundError(
+                    f"Remote DPDK dir {remote_dpdk_top_dir} not found."
+                )
+
+    def set_target(self, target):
+        """
+        Set env variable, these have to be setup all the time. Some tests
+        need to compile example apps by themselves and will fail otherwise.
+        Set hugepage on SUT and install modules required by DPDK.
+        Configure default ixgbe PMD function.
+        """
+        self.target = target
+
+        self.set_toolchain(target)
+
+        # set env variable
+        self.set_env_variable()
+
+        if not self.skip_setup:
+            self.build_install_dpdk(target)
+
+        self.setup_memory()
+
+    def set_env_variable(self):
+        # These have to be setup all the time. Some tests need to compile
+        # example apps by themselves and will fail otherwise.
+        self.send_expect("export RTE_TARGET=" + self.target, "#")
+        self.send_expect("export RTE_SDK=`pwd`", "#")
+
+    def build_install_dpdk(self, target):
+        """
+        Build DPDK source code with specified target.
+        """
+        if self.get_os() == "linux":
+            self.build_install_dpdk_linux_meson(target)
+
+    def build_install_dpdk_linux_meson(self, target):
+        """
+        Build DPDK source code on linux use meson
+        """
+        build_time = 1800
+        target_info = target.split("-")
+        arch = target_info[0]
+        toolchain = target_info[3]
+
+        default_library = "static"
+        if arch == "i686":
+            # find the pkg-config path and set the PKG_CONFIG_LIBDIR environmental variable to point it
+            out = self.send_expect("find /usr -type d -name pkgconfig", "# ")
+            pkg_path = ""
+            res_path = out.split("\r\n")
+            for cur_path in res_path:
+                if "i386" in cur_path:
+                    pkg_path = cur_path
+                    break
+            assert (
+                pkg_path != ""
+            ), "please make sure you env have the i386 pkg-config path"
+
+            self.send_expect("export CFLAGS=-m32", "# ")
+            self.send_expect("export PKG_CONFIG_LIBDIR=%s" % pkg_path, "# ")
+
+        self.send_expect("rm -rf " + target, "#")
+        out = self.send_expect(
+            "CC=%s meson -Denable_kmods=True -Dlibdir=lib --default-library=%s %s"
+            % (toolchain, default_library, target),
+            "[~|~\]]# ",
+            build_time,
+        )
+        assert "FAILED" not in out, "meson setup failed ..."
+
+        out = self.send_expect("ninja -C %s" % target, "[~|~\]]# ", build_time)
+        assert "FAILED" not in out, "ninja complie failed ..."
+
+        # copy kmod file to the folder same as make
+        out = self.send_expect(
+            "find ./%s/kernel/ -name *.ko" % target, "# ", verify=True
+        )
+        self.send_expect("mkdir -p %s/kmod" % target, "# ")
+        if not isinstance(out, int) and len(out) > 0:
+            kmod = out.split("\r\n")
+            for mod in kmod:
+                self.send_expect("cp %s %s/kmod/" % (mod, target), "# ")
+
+    def build_dpdk_apps(self, folder):
+        """
+        Build dpdk sample applications.
+        """
+        if self.get_os() == "linux":
+            return self.build_dpdk_apps_linux_meson(folder)
+
+    def build_dpdk_apps_linux_meson(self, folder):
+        """
+        Build dpdk sample applications on linux use meson
+        """
+        # icc compile need more time
+        if "icc" in self.target:
+            timeout = 300
+        else:
+            timeout = 90
+
+        target_info = self.target.split("-")
+        arch = target_info[0]
+        if arch == "i686":
+            # find the pkg-config path and set the PKG_CONFIG_LIBDIR environmental variable to point it
+            out = self.send_expect("find /usr -type d -name pkgconfig", "# ")
+            pkg_path = ""
+            res_path = out.split("\r\n")
+            for cur_path in res_path:
+                if "i386" in cur_path:
+                    pkg_path = cur_path
+                    break
+            assert (
+                pkg_path != ""
+            ), "please make sure you env have the i386 pkg-config path"
+
+            self.send_expect("export CFLAGS=-m32", "# ", alt_session=True)
+            self.send_expect(
+                "export PKG_CONFIG_LIBDIR=%s" % pkg_path, "# ", alt_session=True
+            )
+
+        folder_info = folder.split("/")
+        name = folder_info[-1]
+
+        if name == "examples":
+            example = "all"
+        else:
+            example = "/".join(folder_info[folder_info.index("examples") + 1 :])
+        out = self.send_expect(
+            "meson configure -Dexamples=%s %s" % (example, self.target), "# "
+        )
+        assert "FAILED" not in out, "Compilation error..."
+        out = self.send_expect("ninja -C %s" % self.target, "[~|~\]]# ", timeout)
+        assert "FAILED" not in out, "Compilation error..."
+
+        # verify the app build in the config path
+        if example != "all":
+            out = self.send_expect("ls %s" % self.apps_name[name], "# ", verify=True)
+            assert isinstance(out, str), (
+                "please confirm %s app path and name in app_name.cfg" % name
+            )
+
+        return out
+
+    def filter_cores_from_node_cfg(self) -> None:
+        # get core list from conf.yaml
+        core_list = []
+        all_core_list = [str(core.core) for core in self.cores]
+        core_list_str = self._config.cores
+        if core_list_str == "":
+            core_list = all_core_list
+        split_by_comma = core_list_str.split(",")
+        range_cores = []
+        for item in split_by_comma:
+            if "-" in item:
+                tmp = item.split("-")
+                range_cores.extend(
+                    [str(i) for i in range(int(tmp[0]), int(tmp[1]) + 1)]
+                )
+            else:
+                core_list.append(item)
+        core_list.extend(range_cores)
+
+        abnormal_core_list = []
+        for core in core_list:
+            if core not in all_core_list:
+                abnormal_core_list.append(core)
+
+        if abnormal_core_list:
+            self.logger.info(
+                "those %s cores are out of range system, all core list of system are %s"
+                % (abnormal_core_list, all_core_list)
+            )
+            raise Exception("configured cores out of range system")
+
+        core_list = [core for core in self.cores if str(core.core) in core_list]
+        self.cores = core_list
+        self.number_of_cores = len(self.cores)
+
+    def create_eal_parameters(
+        self,
+        fixed_prefix: bool = False,
+        socket: Optional[int] = None,
+        cores: Union[str, List[int], List[str]] = "default",
+        prefix: str = "",
+        no_pci: bool = False,
+        vdevs: List[str] = None,
+        other_eal_param: str = "",
+    ) -> str:
+        """
+        generate eal parameters character string;
+        :param fixed_prefix: use fixed file-prefix or not, when it is true,
+                             the file-prefix will not be added a timestamp
+        :param socket: the physical CPU socket index, -1 means no care cpu socket;
+        :param cores: set the core info, eg:
+                        cores=[0,1,2,3],
+                        cores=['0', '1', '2', '3'],
+                        cores='default',
+                        cores='1S/4C/1T',
+                        cores='all';
+        :param prefix: set file prefix string, eg:
+                        prefix='vf';
+        :param no_pci: switch of disable PCI bus eg:
+                        no_pci=True;
+        :param vdevs: virtual device list, eg:
+                        vdevs=['net_ring0', 'net_ring1'];
+        :param other_eal_param: user defined DPDK eal parameters, eg:
+                        other_eal_param='--single-file-segments';
+        :return: eal param string, eg:
+                '-c 0xf -a 0000:88:00.0 --file-prefix=dpdk_1112_20190809143420';
+        if DPDK version < 20.11-rc4, eal_str eg:
+                '-c 0xf -w 0000:88:00.0 --file-prefix=dpdk_1112_20190809143420';
+        """
+        if vdevs is None:
+            vdevs = []
+
+        if socket is None:
+            socket = -1
+
+        config = {
+            "cores": cores,
+            "prefix": prefix,
+            "no_pci": no_pci,
+            "vdevs": vdevs,
+            "other_eal_param": other_eal_param,
+        }
+
+        eal_parameter_creator = _EalParameter(
+            sut_node=self, fixed_prefix=fixed_prefix, socket=socket, **config
+        )
+        eal_str = eal_parameter_creator.make_eal_param()
+
+        return eal_str
+
+    def set_toolchain(self, target):
+        """
+        This looks at the current target and instantiates an attribute to
+        be either a NodeLinuxApp or NodeBareMetal object. These latter two
+        classes are private and should not be used directly by client code.
+        """
+        self.kill_all()
+        self.target = target
+        [arch, _, _, toolchain] = target.split("-")
+
+        if toolchain == "icc":
+            icc_vars = os.getenv("ICC_VARS", "/opt/intel/composer_xe_2013/bin/")
+            icc_vars += "compilervars.sh"
+
+            if arch == "x86_64":
+                icc_arch = "intel64"
+            elif arch == "i686":
+                icc_arch = "ia32"
+            self.send_expect("source " + icc_vars + " " + icc_arch, "# ")
+
+        self.architecture = arch
+
+    def sut_prerequisites(self):
+        """
+        Prerequest function should be called before execute any test case.
+        Will call function to scan all lcore's information which on SUT.
+        Then call pci scan function to collect nic device information.
+        At last setup SUT' environment for validation.
+        """
+        out = self.send_expect(f"cd {SETTINGS.remote_dpdk_dir}", "# ")
+        assert "No such file or directory" not in out, "Can't switch to dpdk folder!!!"
+        out = self.send_expect("cat VERSION", "# ")
+        if "No such file or directory" in out:
+            self.logger.error("Can't get DPDK version due to VERSION not exist!!!")
+        else:
+            self.dpdk_version = out
+        self.send_expect("alias ls='ls --color=none'", "#")
+
+        self.init_core_list()
+        self.filter_cores_from_node_cfg()
+
+    def setup_memory(self, hugepages=-1):
+        """
+        Setup hugepage on SUT.
+        """
+        function_name = "setup_memory_%s" % self.get_os()
+        try:
+            setup_memory = getattr(self, function_name)
+            setup_memory(hugepages)
+        except AttributeError:
+            self.logger.error("%s is not implemented" % function_name)
+
+    def setup_memory_linux(self, hugepages=-1):
+        """
+        Setup Linux hugepages.
+        """
+        hugepages_size = self.send_expect(
+            "awk '/Hugepagesize/ {print $2}' /proc/meminfo", "# "
+        )
+        total_huge_pages = self.get_total_huge_pages()
+        numa_nodes = self.send_expect("ls /sys/devices/system/node | grep node*", "# ")
+        if not numa_nodes:
+            total_numa_nodes = -1
+        else:
+            numa_nodes = numa_nodes.splitlines()
+            total_numa_nodes = len(numa_nodes)
+            self.logger.info(numa_nodes)
+
+        force_socket = False
+
+        if int(hugepages_size) < (1024 * 1024):
+            if hugepages <= 0:
+                if self.architecture == "x86_64":
+                    arch_huge_pages = 4096
+                elif self.architecture == "i686":
+                    arch_huge_pages = 512
+                    force_socket = True
+                # set huge pagesize for x86_x32 abi target
+                elif self.architecture == "x86_x32":
+                    arch_huge_pages = 256
+                    force_socket = True
+                elif self.architecture == "ppc_64":
+                    arch_huge_pages = 512
+                elif self.architecture == "arm64":
+                    if int(hugepages_size) >= (512 * 1024):
+                        arch_huge_pages = 8
+                    else:
+                        arch_huge_pages = 2048
+                else:
+                    arch_huge_pages = 256
+            else:
+                arch_huge_pages = hugepages
+
+            if total_huge_pages != arch_huge_pages:
+                if total_numa_nodes == -1:
+                    self.set_huge_pages(arch_huge_pages)
+                else:
+                    # before all hugepage average distribution  by all socket,
+                    # but sometimes create mbuf pool on socket 0 failed when
+                    # setup testpmd, so set all huge page on first socket
+                    if force_socket:
+                        self.set_huge_pages(arch_huge_pages, numa_nodes[0])
+                        self.logger.info("force_socket on %s" % numa_nodes[0])
+                    else:
+                        # set huge pages to all numa_nodes
+                        for numa_node in numa_nodes:
+                            self.set_huge_pages(arch_huge_pages, numa_node)
+
+        self.mount_huge_pages()
+        self.hugepage_path = self.strip_hugepage_path()
+
+    def get_memory_channels(self):
+        n = self._config.memory_channels
+        if n is not None and n > 0:
+            return n
+        else:
+            return 1
+
+
+class _EalParameter(object):
+    def __init__(
+        self,
+        sut_node: SutNode,
+        fixed_prefix: bool,
+        socket: int,
+        cores: Union[str, List[int], List[str]],
+        prefix: str,
+        no_pci: bool,
+        vdevs: List[str],
+        other_eal_param: str,
+    ):
+        """
+        generate eal parameters character string;
+        :param sut_node: SUT Node;
+        :param fixed_prefix: use fixed file-prefix or not, when it is true,
+                             the file-prefix will not be added a timestamp
+        :param socket: the physical CPU socket index, -1 means no care cpu socket;
+        :param cores: set the core info, eg:
+                        cores=[0,1,2,3],
+                        cores=['0','1','2','3'],
+                        cores='default',
+                        cores='1S/4C/1T',
+                        cores='all';
+        param prefix: set file prefix string, eg:
+                        prefix='vf';
+        param no_pci: switch of disable PCI bus eg:
+                        no_pci=True;
+        param vdevs: virtual device list, eg:
+                        vdevs=['net_ring0', 'net_ring1'];
+        param other_eal_param: user defined DPDK eal parameters, eg:
+                        other_eal_param='--single-file-segments';
+        """
+        self.os = sut_node.get_os()
+        self.fixed_prefix = fixed_prefix
+        self.socket = socket
+        self.sut_node = sut_node
+        self.cores = self._validate_cores(cores)
+        self.prefix = prefix
+        self.no_pci = no_pci
+        self.vdevs = vdevs
+        self.other_eal_param = other_eal_param
+
+    _param_validate_exception_info_template = (
+        "Invalid parameter of %s about value of %s, Please reference API doc."
+    )
+
+    @staticmethod
+    def _validate_cores(cores: Union[str, List[int], List[str]]):
+        core_string_match = r"default|all|\d+S/\d+C/\d+T|$"
+        if isinstance(cores, list) and (
+            all(map(lambda _core: type(_core) == int, cores))
+            or all(map(lambda _core: type(_core) == str, cores))
+        ):
+            return cores
+        elif type(cores) == str and re.match(core_string_match, cores, re.I):
+            return cores
+        else:
+            raise ParameterInvalidException("cores", cores)
+
+    def _make_cores_param(self) -> str:
+        is_use_default_cores = (
+            self.cores == ""
+            or isinstance(self.cores, str)
+            and self.cores.lower() == "default"
+        )
+        if is_use_default_cores:
+            default_cores = "1S/2C/1T"
+            core_list = self.sut_node.get_core_list(default_cores)
+        else:
+            core_list = self._get_cores()
+
+        def _get_consecutive_cores_range(_cores: List[int]):
+            _formated_core_list = []
+            _tmp_cores_list = list(sorted(map(int, _cores)))
+            _segment = _tmp_cores_list[:1]
+            for _core_num in _tmp_cores_list[1:]:
+                if _core_num - _segment[-1] == 1:
+                    _segment.append(_core_num)
+                else:
+                    _formated_core_list.append(
+                        f"{_segment[0]}-{_segment[-1]}"
+                        if len(_segment) > 1
+                        else f"{_segment[0]}"
+                    )
+                    _index = _tmp_cores_list.index(_core_num)
+                    _formated_core_list.extend(
+                        _get_consecutive_cores_range(_tmp_cores_list[_index:])
+                    )
+                    _segment.clear()
+                    break
+            if len(_segment) > 0:
+                _formated_core_list.append(
+                    f"{_segment[0]}-{_segment[-1]}"
+                    if len(_segment) > 1
+                    else f"{_segment[0]}"
+                )
+            return _formated_core_list
+
+        return f'-l {",".join(_get_consecutive_cores_range(core_list))}'
+
+    def _make_memory_channels(self) -> str:
+        param_template = "-n {}"
+        return param_template.format(self.sut_node.get_memory_channels())
+
+    def _make_no_pci_param(self) -> str:
+        if self.no_pci is True:
+            return "--no-pci"
+        else:
+            return ""
+
+    def _make_prefix_param(self) -> str:
+        if self.prefix == "":
+            fixed_file_prefix = "dpdk" + "_" + self.sut_node.prefix_subfix
+        else:
+            fixed_file_prefix = self.prefix
+            if not self.fixed_prefix:
+                fixed_file_prefix = (
+                    fixed_file_prefix + "_" + self.sut_node.prefix_subfix
+                )
+        fixed_file_prefix = self._do_os_handle_with_prefix_param(fixed_file_prefix)
+        return fixed_file_prefix
+
+    def _make_vdevs_param(self) -> str:
+        if len(self.vdevs) == 0:
+            return ""
+        else:
+            _vdevs = ["--vdev " + vdev for vdev in self.vdevs]
+            return " ".join(_vdevs)
+
+    def _get_cores(self) -> List[int]:
+        if type(self.cores) == list:
+            return self.cores
+        elif isinstance(self.cores, str):
+            return self.sut_node.get_core_list(self.cores, socket=self.socket)
+
+    def _do_os_handle_with_prefix_param(self, file_prefix: str) -> str:
+        self.sut_node.prefix_list.append(file_prefix)
+        return "--file-prefix=" + file_prefix
+
+    def make_eal_param(self) -> str:
+        _eal_str = " ".join(
+            [
+                self._make_cores_param(),
+                self._make_memory_channels(),
+                self._make_prefix_param(),
+                self._make_no_pci_param(),
+                self._make_vdevs_param(),
+                # append user defined eal parameters
+                self.other_eal_param,
+            ]
+        )
+        return _eal_str
-- 
2.30.2


^ permalink raw reply	[relevance 2%]

* Re: [PATCH 2/3] eal: uninline rte_str_to_size
  2022-08-22  7:24  0%   ` Morten Brørup
@ 2022-08-22 14:06  0%     ` Bruce Richardson
  0 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2022-08-22 14:06 UTC (permalink / raw)
  To: Morten Brørup; +Cc: Dmitry Kozlyuk, dev, Ray Kinsella

On Mon, Aug 22, 2022 at 09:24:47AM +0200, Morten Brørup wrote:
> > From: Dmitry Kozlyuk [mailto:dmitry.kozliuk@gmail.com]
> > Sent: Sunday, 21 August 2022 22.50
> > To: dev@dpdk.org
> > Cc: Dmitry Kozlyuk; Ray Kinsella
> > Subject: [PATCH 2/3] eal: uninline rte_str_to_size
> > 
> > There is no reason for rte_str_to_size() to be inline.
> > Move the implementation out of <rte_common.h>.
> > Export it as a stable ABI because it always has been public.
> > 
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> 
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> 
> > ---
> > Now <rte_common.h> doesn't need to #include <ctypes.h> and <stdlib.h>,
> > but removing them breaks some DPDK code, may break user code too.
> > I'm not sure what is the compatibility policy in this regard.
> > If such a breakage is allowed, I'd remove includes and fix DPDK code.
> > 
> 
> The question I'm asking myself here is: Do we want rte_common.h to include common headers like these, just so we don't need to include them elsewhere? I think not.
> 
> I'm in favor of the principle of keeping it clean: Remove them from rte_common.h, and deal with the consequences.
> 
> If we keep them, we will forget why they are there, and some day in the future, someone will ask what these unused headers are doing in <rte_common.h>.
> 
+1
Since removing headers is a build-time issue only and not runtime, I think
we should just remove them.

/Bruce

^ permalink raw reply	[relevance 0%]

* Re: Reason to alway to build both static and shared libs
  @ 2022-08-22 11:23  3% ` Bruce Richardson
  0 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2022-08-22 11:23 UTC (permalink / raw)
  To: Jianshen Liu; +Cc: dev

On Wed, Aug 03, 2022 at 10:13:24PM -0700, Jianshen Liu wrote:
>    Hi all, Could I know the reason for always building both static and
>    shared libs of DPDK? I can find the [1]patch to enable this behavior,
>    but it seems that it didn't mention the reason behind it. Also, if I
>    propose a change to use "both" as the default for default_library in
>    meson's config file and still allow users to choose either static or
>    shared as they want, is there any reason against that change?  Thanks,
>    Jianshen
> 
When DPDK moved to use the meson build system, there was no "both" option
for static and shared libs, so that is the primary reason why it is not
used as the default. As for why even without that both libraries are always
built, the main reasons we do so are:
* traditionally DPDK has been built and linked into applications as a
  static library, and when moving build systems from make to meson we wanted
  to keep that as the default, since the transition was already confusing
  enough for users.
* with the older make build system when users submitted patches to DPDK
  there was many, many cases where the patches did not include changes to
  the version.map files, leading to shared lib build failures. By ensuring
  that shared libs are always built, this whole class of patch errors are
  caught before users push their patches to the mailing list.
Therefore by always building both shared and static we can keep consistency
and ensure higher quality patches to the mailing list.

I have looked a little into this in the past and from that investigation
some other considerations are:

* We can't actually use the built-in "both_libraries" option in DPDK
  directly since - due to ABI versioning - some files actually need to be
  compiled with different flags for static libraries (which don't have
  function versions) and shared libs (which do). This means that even if we
  do use "both_library" function, or "library" function with a default of
  "both" we will still need to maintain the code path fallback for building
  static and shared separately.
* The built-in option for building static and/or shared libraries only
  controls what libraries get built - it does not control what way things
  get linked. Right now, the default in DPDK is to build both libraries but
  link the applications like testpmd or examples, using the static libs. If
  we use the defaults in meson for "both" the shared library versions will
  be used for linking in preference to the static ones. This means that if
  we switch to using the default_library option for building only
  static/shared/both we also need a separate flag for indicating whether to
  link apps statically or dynamically in the "both" case.

I'm also a bit curious as to how much benefit you would expect to come from
this change. Since in 99% of cases the C files are only ever built once and
then put into the static and shared libs, I would not expect there to be a
large build-time improvement from disabling one of the library types.
However, having never tested it, I may be wrong on this and there may be a
boost from disabling the shared libs - though that in turn means fewer
build-time checks for the version.map files, for example. Let me know if
you do try it and see a big benefit.

Hope this input helps.
Regards,
/Bruce

^ permalink raw reply	[relevance 3%]

* RE: [PATCH 2/3] eal: uninline rte_str_to_size
  2022-08-21 20:50  3% ` [PATCH 2/3] eal: uninline rte_str_to_size Dmitry Kozlyuk
@ 2022-08-22  7:24  0%   ` Morten Brørup
  2022-08-22 14:06  0%     ` Bruce Richardson
  0 siblings, 1 reply; 200+ results
From: Morten Brørup @ 2022-08-22  7:24 UTC (permalink / raw)
  To: Dmitry Kozlyuk, dev; +Cc: Ray Kinsella

> From: Dmitry Kozlyuk [mailto:dmitry.kozliuk@gmail.com]
> Sent: Sunday, 21 August 2022 22.50
> To: dev@dpdk.org
> Cc: Dmitry Kozlyuk; Ray Kinsella
> Subject: [PATCH 2/3] eal: uninline rte_str_to_size
> 
> There is no reason for rte_str_to_size() to be inline.
> Move the implementation out of <rte_common.h>.
> Export it as a stable ABI because it always has been public.
> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

Acked-by: Morten Brørup <mb@smartsharesystems.com>

> ---
> Now <rte_common.h> doesn't need to #include <ctypes.h> and <stdlib.h>,
> but removing them breaks some DPDK code, may break user code too.
> I'm not sure what is the compatibility policy in this regard.
> If such a breakage is allowed, I'd remove includes and fix DPDK code.
> 

The question I'm asking myself here is: Do we want rte_common.h to include common headers like these, just so we don't need to include them elsewhere? I think not.

I'm in favor of the principle of keeping it clean: Remove them from rte_common.h, and deal with the consequences.

If we keep them, we will forget why they are there, and some day in the future, someone will ask what these unused headers are doing in <rte_common.h>.


^ permalink raw reply	[relevance 0%]

* RE: [PATCH 11/13] ethdev: remove deprecated flow item VF
  2022-08-12 19:18  1% ` [PATCH 11/13] ethdev: remove deprecated flow item VF Ivan Malov
@ 2022-08-22  5:50  0%   ` Ori Kam
  0 siblings, 0 replies; 200+ results
From: Ori Kam @ 2022-08-22  5:50 UTC (permalink / raw)
  To: Ivan Malov, dev
  Cc: Eli Britstein, Ilya Maximets,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Aman Singh,
	Yuying Zhang, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
	Ferruh Yigit, Beilei Xing

Hi Ivan

Some comments inline,

> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Friday, 12 August 2022 22:18
> Subject: [PATCH 11/13] ethdev: remove deprecated flow item VF
> 
> 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


^ permalink raw reply	[relevance 0%]

* RE: [PATCH 13/13] ethdev: remove deprecated flow action PHY PORT
  2022-08-12 19:18  5% ` [PATCH 13/13] ethdev: remove deprecated flow action " Ivan Malov
@ 2022-08-22  5:33  0%   ` Ori Kam
  0 siblings, 0 replies; 200+ results
From: Ori Kam @ 2022-08-22  5:33 UTC (permalink / raw)
  To: Ivan Malov, dev
  Cc: Eli Britstein, Ilya Maximets,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Aman Singh,
	Yuying Zhang, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
	Ferruh Yigit, Hemant Agrawal, Sachin Saxena

Hi Ivan,

> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Friday, 12 August 2022 22:18
> Subject: [PATCH 13/13] ethdev: remove deprecated flow action PHY PORT
> 
> 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

^ permalink raw reply	[relevance 0%]

* RE: [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT
  2022-08-12 19:18  1% ` [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT Ivan Malov
@ 2022-08-22  5:33  0%   ` Ori Kam
  2022-09-27  7:08  0%     ` Thomas Monjalon
  0 siblings, 1 reply; 200+ results
From: Ori Kam @ 2022-08-22  5:33 UTC (permalink / raw)
  To: Ivan Malov, dev
  Cc: Eli Britstein, Ilya Maximets,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Aman Singh,
	Yuying Zhang, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
	Ferruh Yigit, Matan Azrad, Slava Ovsiienko

Hi

> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Friday, 12 August 2022 22:18
> Subject: [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT
> 
> 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

^ permalink raw reply	[relevance 0%]

* RE: [PATCH 10/13] ethdev: remove deprecated flow item PF
  2022-08-12 19:18  5% ` [PATCH 10/13] ethdev: remove deprecated flow item PF Ivan Malov
@ 2022-08-22  5:32  0%   ` Ori Kam
  0 siblings, 0 replies; 200+ results
From: Ori Kam @ 2022-08-22  5:32 UTC (permalink / raw)
  To: Ivan Malov, dev
  Cc: Eli Britstein, Ilya Maximets,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Aman Singh,
	Yuying Zhang, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
	Ferruh Yigit

Hi Ivan

> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Friday, 12 August 2022 22:18
PF
> 
> 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>
> ---
>  app/test-pmd/cmdline_flow.c                   |  9 ----
>  doc/guides/nics/features/bnxt.ini             |  1 -
>  doc/guides/nics/features/cxgbe.ini            |  1 -
>  doc/guides/nics/features/default.ini          |  1 -
>  doc/guides/nics/features/sfc.ini              |  1 -
>  doc/guides/nics/sfc_efx.rst                   |  2 -
>  doc/guides/prog_guide/rte_flow.rst            | 34 -------------
>  .../prog_guide/switch_representation.rst      | 14 ------
>  doc/guides/rel_notes/release_22_11.rst        |  5 ++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  2 -
>  drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |  4 --
>  drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      | 25 ----------
>  drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |  5 --
>  drivers/net/cxgbe/cxgbe_flow.c                | 21 --------
>  drivers/net/sfc/sfc_mae.c                     | 48 -------------------
>  lib/ethdev/rte_flow.c                         |  1 -
>  lib/ethdev/rte_flow.h                         | 15 ------
>  17 files changed, 5 insertions(+), 184 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 23889f7ab1..2722d5a48d 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -249,7 +249,6 @@ enum index {
>  	ITEM_INVERT,
>  	ITEM_ANY,
>  	ITEM_ANY_NUM,
> -	ITEM_PF,
>  	ITEM_VF,
>  	ITEM_VF_ID,
>  	ITEM_PHY_PORT,
> @@ -1278,7 +1277,6 @@ static const enum index next_item[] = {
>  	ITEM_VOID,
>  	ITEM_INVERT,
>  	ITEM_ANY,
> -	ITEM_PF,
>  	ITEM_VF,
>  	ITEM_PHY_PORT,
>  	ITEM_PORT_ID,
> @@ -3461,13 +3459,6 @@ static const struct token token_list[] = {
>  		.next = NEXT(item_any,
> NEXT_ENTRY(COMMON_UNSIGNED), item_param),
>  		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_any, num)),
>  	},
> -	[ITEM_PF] = {
> -		.name = "pf",
> -		.help = "match traffic from/to the physical function",
> -		.priv = PRIV_ITEM(PF, 0),
> -		.next = NEXT(NEXT_ENTRY(ITEM_NEXT)),
> -		.call = parse_vc,
> -	},
>  	[ITEM_VF] = {
>  		.name = "vf",
>  		.help = "match traffic from/to a virtual function ID",
> diff --git a/doc/guides/nics/features/bnxt.ini
> b/doc/guides/nics/features/bnxt.ini
> index afb5414b49..259480d1df 100644
> --- a/doc/guides/nics/features/bnxt.ini
> +++ b/doc/guides/nics/features/bnxt.ini
> @@ -63,7 +63,6 @@ ipv6                 = Y
>  gre                  = Y
>  icmp                 = Y
>  icmp6                = Y
> -pf                   = Y
>  phy_port             = Y
>  port_id              = Y
>  port_representor     = Y
> diff --git a/doc/guides/nics/features/cxgbe.ini
> b/doc/guides/nics/features/cxgbe.ini
> index f674803ec4..d869f2100f 100644
> --- a/doc/guides/nics/features/cxgbe.ini
> +++ b/doc/guides/nics/features/cxgbe.ini
> @@ -39,7 +39,6 @@ Usage doc            = Y
>  eth                  = Y
>  ipv4                 = Y
>  ipv6                 = Y
> -pf                   = Y
>  phy_port             = Y
>  tcp                  = Y
>  udp                  = Y
> diff --git a/doc/guides/nics/features/default.ini
> b/doc/guides/nics/features/default.ini
> index d1db0c256a..aff236134e 100644
> --- a/doc/guides/nics/features/default.ini
> +++ b/doc/guides/nics/features/default.ini
> @@ -121,7 +121,6 @@ meta                 =
>  mpls                 =
>  nsh                  =
>  nvgre                =
> -pf                   =
>  pfcp                 =
>  phy_port             =
>  port_id              =
> diff --git a/doc/guides/nics/features/sfc.ini
> b/doc/guides/nics/features/sfc.ini
> index 2e798b5ef5..355174d5c2 100644
> --- a/doc/guides/nics/features/sfc.ini
> +++ b/doc/guides/nics/features/sfc.ini
> @@ -47,7 +47,6 @@ ipv4                 = Y
>  ipv6                 = Y
>  mark                 = P
>  nvgre                = Y
> -pf                   = Y
>  phy_port             = Y
>  port_id              = Y
>  port_representor     = Y
> diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
> index 39c6e23d5b..2dbc59e8f7 100644
> --- a/doc/guides/nics/sfc_efx.rst
> +++ b/doc/guides/nics/sfc_efx.rst
> @@ -200,8 +200,6 @@ Supported pattern items (***transfer*** rules):
> 
>  - PHY_PORT (cannot repeat; conflicts with other traffic source items)
> 
> -- PF (cannot repeat; conflicts with other traffic source items)
> -
>  - VF (cannot repeat; conflicts with other traffic source items)
> 
>  - ETH
> diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> index 588914b231..72f0c3d346 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -535,37 +535,6 @@ Usage example, matching non-TCPv4 packets only:
>     | 4     | END      |
>     +-------+----------+
> 
> -Item: ``PF``
> -^^^^^^^^^^^^
> -
> -This item is deprecated. Consider:
> - - `Item: PORT_REPRESENTOR`_
> - - `Item: REPRESENTED_PORT`_
> -
> -Matches traffic originating from (ingress) or going to (egress) the physical
> -function of the current device.
> -
> -If supported, should work even if the physical function is not managed by
> -the application and thus not associated with a DPDK port ID.
> -
> -- Can be combined with any number of `Item: VF`_ to match both PF and VF
> -  traffic.
> -- ``spec``, ``last`` and ``mask`` must not be set.
> -
> -.. _table_rte_flow_item_pf:
> -
> -.. table:: PF
> -
> -   +----------+-------+
> -   | Field    | Value |
> -   +==========+=======+
> -   | ``spec`` | unset |
> -   +----------+-------+
> -   | ``last`` | unset |
> -   +----------+-------+
> -   | ``mask`` | unset |
> -   +----------+-------+
> -
>  Item: ``VF``
>  ^^^^^^^^^^^^
> 
> @@ -584,7 +553,6 @@ separate entities, should be addressed through their
> own DPDK port IDs.
> 
>  - Can be specified multiple times to match traffic addressed to several VF
>    IDs.
> -- Can be combined with a PF item to match both PF and VF traffic.
>  - Default ``mask`` matches any VF ID.
> 
>  .. _table_rte_flow_item_vf:
> @@ -2074,8 +2042,6 @@ This action is deprecated. Consider:
>  Directs matching traffic to the physical function (PF) of the current
>  device.
> 
> -See `Item: PF`_.
> -
>  - No configurable properties.
> 
>  .. _table_rte_flow_action_pf:
> diff --git a/doc/guides/prog_guide/switch_representation.rst
> b/doc/guides/prog_guide/switch_representation.rst
> index 3da30fc779..6fd7b98bdc 100644
> --- a/doc/guides/prog_guide/switch_representation.rst
> +++ b/doc/guides/prog_guide/switch_representation.rst
> @@ -624,25 +624,11 @@ Same restrictions as `PORT_ID pattern item`_.
> 
>  - Targets **A**, **B** or **C** in `traffic steering`_.
> 
> -PF Pattern Item
> -^^^^^^^^^^^^^^^
> -
> -Matches traffic originating from (ingress) or going to (egress) the physical
> -function of the current device.
> -
> -If supported, should work even if the physical function is not managed by
> -the application and thus not associated with a DPDK port ID. Its behavior is
> -otherwise similar to `PORT_ID pattern item`_ using PF port ID.
> -
> -- Matches **A** in `traffic steering`_.
> -
>  PF Action
>  ^^^^^^^^^
> 
>  Directs matching traffic to the physical function of the current device.
> 
> -Same restrictions as `PF pattern item`_.
> -
>  - Targets **A** in `traffic steering`_.
> 
>  VF Pattern Item
> diff --git a/doc/guides/rel_notes/release_22_11.rst
> b/doc/guides/rel_notes/release_22_11.rst
> index c4ce32daed..b7469708af 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -76,6 +76,9 @@ Removed Items
>     Also, make sure to start the actual text at the margin.
>     =======================================================
> 
> +* ethdev: removed ``RTE_FLOW_ITEM_TYPE_PF``;
> +  use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
> +
> 
>  API Changes
>  -----------
> @@ -122,6 +125,8 @@ ABI Changes
>     Also, make sure to start the actual text at the margin.
>     =======================================================
> 
> +* ethdev: enum ``RTE_FLOW_ITEM`` was affected by deprecation
> procedure.
> +
> 
>  Known Issues
>  ------------
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index c105200fe7..4446560369 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3665,8 +3665,6 @@ This section lists supported pattern items and their
> attributes, if any.
> 
>    - ``num {unsigned}``: number of layers covered.
> 
> -- ``pf``: match traffic from/to the physical function.
> -
>  - ``vf``: match traffic from/to a virtual function ID.
> 
>    - ``id {unsigned}``: VF ID.
> 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 e9337ecd2c..17216426d8 100644
> --- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
> +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
> @@ -260,10 +260,6 @@ struct bnxt_ulp_rte_hdr_info ulp_hdr_info[] = {
>  	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
>  	.proto_hdr_func          = ulp_rte_item_any_handler
>  	},
> -	[RTE_FLOW_ITEM_TYPE_PF] = {
> -	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
> -	.proto_hdr_func          = ulp_rte_pf_hdr_handler
> -	},
>  	[RTE_FLOW_ITEM_TYPE_VF] = {
>  	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
>  	.proto_hdr_func          = ulp_rte_vf_hdr_handler
> diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
> b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
> index 9edf3e8799..6a1d235f77 100644
> --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
> +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
> @@ -507,31 +507,6 @@ ulp_rte_parser_implicit_act_port_process(struct
> ulp_rte_parser_params *params)
>  	return BNXT_TF_RC_SUCCESS;
>  }
> 
> -/* Function to handle the parsing of RTE Flow item PF Header. */
> -int32_t
> -ulp_rte_pf_hdr_handler(const struct rte_flow_item *item __rte_unused,
> -		       struct ulp_rte_parser_params *params)
> -{
> -	uint16_t port_id = 0;
> -	uint16_t svif_mask = 0xFFFF;
> -	uint32_t ifindex;
> -
> -	/* Get the implicit port id */
> -	port_id = ULP_COMP_FLD_IDX_RD(params,
> BNXT_ULP_CF_IDX_INCOMING_IF);
> -
> -	/* perform the conversion from dpdk port to bnxt ifindex */
> -	if (ulp_port_db_dev_port_to_ulp_index(params->ulp_ctx,
> -					      port_id,
> -					      &ifindex)) {
> -		BNXT_TF_DBG(ERR, "ParseErr:Portid is not valid\n");
> -		return BNXT_TF_RC_ERROR;
> -	}
> -
> -	/* Update the SVIF details */
> -	return ulp_rte_parser_svif_set(params, ifindex, svif_mask,
> -				       BNXT_ULP_DIR_INVALID);
> -}
> -
>  /* Function to handle the parsing of RTE Flow item VF Header. */
>  int32_t
>  ulp_rte_vf_hdr_handler(const struct rte_flow_item *item,
> diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
> b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
> index e4225d00f8..94918f6b4a 100644
> --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
> +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
> @@ -80,11 +80,6 @@ bnxt_ulp_rte_parser_act_parse(const struct
> rte_flow_action actions[],
>  void
>  bnxt_ulp_rte_parser_post_process(struct ulp_rte_parser_params
> *params);
> 
> -/* Function to handle the parsing of RTE Flow item PF Header. */
> -int32_t
> -ulp_rte_pf_hdr_handler(const struct rte_flow_item *item,
> -		       struct ulp_rte_parser_params *params);
> -
>  /* Function to handle the parsing of RTE Flow item VF Header. */
>  int32_t
>  ulp_rte_vf_hdr_handler(const struct rte_flow_item *item,
> diff --git a/drivers/net/cxgbe/cxgbe_flow.c
> b/drivers/net/cxgbe/cxgbe_flow.c
> index 6e460dfe2e..e4f9c152b5 100644
> --- a/drivers/net/cxgbe/cxgbe_flow.c
> +++ b/drivers/net/cxgbe/cxgbe_flow.c
> @@ -288,22 +288,6 @@ ch_rte_parsetype_vlan(const void *dmask, const
> struct rte_flow_item *item,
>  	return 0;
>  }
> 
> -static int
> -ch_rte_parsetype_pf(const void *dmask __rte_unused,
> -		    const struct rte_flow_item *item __rte_unused,
> -		    struct ch_filter_specification *fs,
> -		    struct rte_flow_error *e __rte_unused)
> -{
> -	struct rte_flow *flow = (struct rte_flow *)fs->private;
> -	struct rte_eth_dev *dev = flow->dev;
> -	struct adapter *adap = ethdev2adap(dev);
> -
> -	CXGBE_FILL_FS(1, 1, pfvf_vld);
> -
> -	CXGBE_FILL_FS(adap->pf, 0x7, pf);
> -	return 0;
> -}
> -
>  static int
>  ch_rte_parsetype_vf(const void *dmask, const struct rte_flow_item *item,
>  		    struct ch_filter_specification *fs,
> @@ -1022,11 +1006,6 @@ static struct chrte_fparse parseitem[] = {
>  		.dmask = &rte_flow_item_tcp_mask,
>  	},
> 
> -	[RTE_FLOW_ITEM_TYPE_PF] = {
> -		.fptr = ch_rte_parsetype_pf,
> -		.dmask = NULL,
> -	},
> -
>  	[RTE_FLOW_ITEM_TYPE_VF] = {
>  		.fptr = ch_rte_parsetype_vf,
>  		.dmask = &(const struct rte_flow_item_vf){
> diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
> index eb197fbdeb..e8da2d2a0d 100644
> --- a/drivers/net/sfc/sfc_mae.c
> +++ b/drivers/net/sfc/sfc_mae.c
> @@ -1685,42 +1685,6 @@ sfc_mae_rule_parse_item_phy_port(const struct
> rte_flow_item *item,
>  	return 0;
>  }
> 
> -static int
> -sfc_mae_rule_parse_item_pf(const struct rte_flow_item *item,
> -			   struct sfc_flow_parse_ctx *ctx,
> -			   struct rte_flow_error *error)
> -{
> -	struct sfc_mae_parse_ctx *ctx_mae = ctx->mae;
> -	const efx_nic_cfg_t *encp = efx_nic_cfg_get(ctx_mae->sa->nic);
> -	efx_mport_sel_t mport_v;
> -	int rc;
> -
> -	if (ctx_mae->match_mport_set) {
> -		return rte_flow_error_set(error, ENOTSUP,
> -				RTE_FLOW_ERROR_TYPE_ITEM, item,
> -				"Can't handle multiple traffic source items");
> -	}
> -
> -	rc = efx_mae_mport_by_pcie_function(encp->enc_pf,
> EFX_PCI_VF_INVALID,
> -					    &mport_v);
> -	if (rc != 0) {
> -		return rte_flow_error_set(error, rc,
> -				RTE_FLOW_ERROR_TYPE_ITEM, item,
> -				"Failed to convert the PF ID");
> -	}
> -
> -	rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec,
> &mport_v, NULL);
> -	if (rc != 0) {
> -		return rte_flow_error_set(error, rc,
> -				RTE_FLOW_ERROR_TYPE_ITEM, item,
> -				"Failed to set MPORT for the PF");
> -	}
> -
> -	ctx_mae->match_mport_set = B_TRUE;
> -
> -	return 0;
> -}
> -
>  static int
>  sfc_mae_rule_parse_item_vf(const struct rte_flow_item *item,
>  			   struct sfc_flow_parse_ctx *ctx,
> @@ -2591,18 +2555,6 @@ static const struct sfc_flow_item sfc_flow_items[]
> = {
>  		.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
>  		.parse = sfc_mae_rule_parse_item_phy_port,
>  	},
> -	{
> -		.type = RTE_FLOW_ITEM_TYPE_PF,
> -		.name = "PF",
> -		/*
> -		 * In terms of RTE flow, this item is a META one,
> -		 * and its position in the pattern is don't care.
> -		 */
> -		.prev_layer = SFC_FLOW_ITEM_ANY_LAYER,
> -		.layer = SFC_FLOW_ITEM_ANY_LAYER,
> -		.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
> -		.parse = sfc_mae_rule_parse_item_pf,
> -	},
>  	{
>  		.type = RTE_FLOW_ITEM_TYPE_VF,
>  		.name = "VF",
> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> index 501be9d602..6ece72bf36 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -97,7 +97,6 @@ static const struct rte_flow_desc_data
> rte_flow_desc_item[] = {
>  	MK_FLOW_ITEM(VOID, 0),
>  	MK_FLOW_ITEM(INVERT, 0),
>  	MK_FLOW_ITEM(ANY, sizeof(struct rte_flow_item_any)),
> -	MK_FLOW_ITEM(PF, 0),
>  	MK_FLOW_ITEM(VF, sizeof(struct rte_flow_item_vf)),
>  	MK_FLOW_ITEM(PHY_PORT, sizeof(struct
> rte_flow_item_phy_port)),
>  	MK_FLOW_ITEM(PORT_ID, sizeof(struct rte_flow_item_port_id)),
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index bc68fd5631..97de98e232 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -188,20 +188,6 @@ enum rte_flow_item_type {
>  	 */
>  	RTE_FLOW_ITEM_TYPE_ANY,
> 
> -	/**
> -	 * @deprecated
> -	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
> -	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
> -	 *
> -	 * [META]
> -	 *
> -	 * Matches traffic originating from (ingress) or going to (egress)
> -	 * the physical function of the current device.
> -	 *
> -	 * No associated specification structure.
> -	 */
> -	RTE_FLOW_ITEM_TYPE_PF,
> -
>  	/**
>  	 * @deprecated
>  	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
> @@ -732,7 +718,6 @@ static const struct rte_flow_item_any
> rte_flow_item_any_mask = {
>   *
>   * - Can be specified multiple times to match traffic addressed to several
>   *   VF IDs.
> - * - Can be combined with a PF item to match both PF and VF traffic.
>   *
>   * A zeroed mask can be used to match any VF ID.
>   */
> --
> 2.30.2

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori


^ permalink raw reply	[relevance 0%]

* [PATCH 2/3] eal: uninline rte_str_to_size
  @ 2022-08-21 20:50  3% ` Dmitry Kozlyuk
  2022-08-22  7:24  0%   ` Morten Brørup
    1 sibling, 1 reply; 200+ results
From: Dmitry Kozlyuk @ 2022-08-21 20:50 UTC (permalink / raw)
  To: dev; +Cc: Dmitry Kozlyuk, Ray Kinsella

There is no reason for rte_str_to_size() to be inline.
Move the implementation out of <rte_common.h>.
Export it as a stable ABI because it always has been public.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
Now <rte_common.h> doesn't need to #include <ctypes.h> and <stdlib.h>,
but removing them breaks some DPDK code, may break user code too.
I'm not sure what is the compatibility policy in this regard.
If such a breakage is allowed, I'd remove includes and fix DPDK code.

 lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++
 lib/eal/include/rte_common.h           | 30 ++----------------------
 lib/eal/version.map                    |  1 +
 3 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/lib/eal/common/eal_common_string_fns.c b/lib/eal/common/eal_common_string_fns.c
index 0236ae4023..5fc4ee71dc 100644
--- a/lib/eal/common/eal_common_string_fns.c
+++ b/lib/eal/common/eal_common_string_fns.c
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize)
 	rte_errno = E2BIG;
 	return -rte_errno;
 }
+
+uint64_t
+rte_str_to_size(const char *str)
+{
+	char *endptr;
+	unsigned long long size;
+
+	while (isspace((int)*str))
+		str++;
+	if (*str == '-')
+		return 0;
+
+	errno = 0;
+	size = strtoull(str, &endptr, 0);
+	if (errno)
+		return 0;
+
+	if (*endptr == ' ')
+		endptr++; /* allow 1 space gap */
+
+	switch (*endptr) {
+	case 'G': case 'g':
+		size *= 1024; /* fall-through */
+	case 'M': case 'm':
+		size *= 1024; /* fall-through */
+	case 'K': case 'k':
+		size *= 1024; /* fall-through */
+	default:
+		break;
+	}
+	return size;
+}
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index d517e9f75f..772e40f8c2 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -875,34 +875,8 @@ rte_log2_u64(uint64_t v)
  * @return
  *     Number.
  */
-static inline uint64_t
-rte_str_to_size(const char *str)
-{
-	char *endptr;
-	unsigned long long size;
-
-	while (isspace((int)*str))
-		str++;
-	if (*str == '-')
-		return 0;
-
-	errno = 0;
-	size = strtoull(str, &endptr, 0);
-	if (errno)
-		return 0;
-
-	if (*endptr == ' ')
-		endptr++; /* allow 1 space gap */
-
-	switch (*endptr){
-	case 'G': case 'g': size *= 1024; /* fall-through */
-	case 'M': case 'm': size *= 1024; /* fall-through */
-	case 'K': case 'k': size *= 1024; /* fall-through */
-	default:
-		break;
-	}
-	return size;
-}
+uint64_t
+rte_str_to_size(const char *str);
 
 /**
  * Function to terminate the application immediately, printing an error
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..773b0902c0 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -261,6 +261,7 @@ DPDK_23 {
 	rte_socket_id;
 	rte_socket_id_by_idx;
 	rte_srand;
+	rte_str_to_size;
 	rte_strerror;
 	rte_strscpy;
 	rte_strsplit;
-- 
2.33.1


^ permalink raw reply	[relevance 3%]

* [Bug 1042] [dpdk-22.07](ABI) unit_tests_eal/link_bonding_rssconf: link_bonding_rssconf_autotest test failed
  @ 2022-08-19  8:45  4% ` bugzilla
  0 siblings, 0 replies; 200+ results
From: bugzilla @ 2022-08-19  8:45 UTC (permalink / raw)
  To: dev

https://bugs.dpdk.org/show_bug.cgi?id=1042

lingwei (weix.ling@intel.com) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from lingwei (weix.ling@intel.com) ---
Verified based on dpdk-stable branch 21.11 with these 2 patches PASSED.
http://git.dpdk.org/next/dpdk-next-net/commit/?id=dfa70bf8097dd3bce3a4d4e1ccc8fd2536b51d30
http://git.dpdk.org/next/dpdk-next-net/commit/?id=22fd87b7ad7c500cfa9e6448cdce3e0a3c11d7d7

OS: Red Hat Enterprise Linux 8.4 (Ootpa)/Linux 4.18.0-305.el8.x86_64
NIC driver & firmware: ice-2.19.3/8.70 0x8000c40f 1.3179.0

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[relevance 4%]

* RE: [PATCH v5 0/7]  bbdev changes for 22.11
      @ 2022-08-15 17:54  0%   ` Chautru, Nicolas
  2 siblings, 0 replies; 200+ results
From: Chautru, Nicolas @ 2022-08-15 17:54 UTC (permalink / raw)
  To: dev, thomas, gakhil, hemant.agrawal
  Cc: maxime.coquelin, trix, mdr, Richardson, Bruce, david.marchand, stephen

Hi Hemant, 

Could you please provide a +1 for that serie please? This has been under review for a while but would like to get it merged soon if possible. I believe you had already reviewed and acked a previous version. 
Much appreciated, thanks, 

Nic

> -----Original Message-----
> From: Chautru, Nicolas <nicolas.chautru@intel.com>
> Sent: Wednesday, July 6, 2022 4:28 PM
> To: dev@dpdk.org; thomas@monjalon.net; gakhil@marvell.com;
> hemant.agrawal@nxp.com
> Cc: maxime.coquelin@redhat.com; trix@redhat.com; mdr@ashroe.eu;
> Richardson, Bruce <bruce.richardson@intel.com>;
> david.marchand@redhat.com; stephen@networkplumber.org; Chautru,
> Nicolas <nicolas.chautru@intel.com>
> Subject: [PATCH v5 0/7] bbdev changes for 22.11
> 
> v5: update base on review from Tom Rix. Number of typos reported and
> resolved, removed the commit related to rw_lock for now, added a commit
> for code clean up from review, resolved one rebase issue between 2
> commits, used size of array for some bound check implementation. Thanks.
> v4: update to the last 2 commits to include function to print the queue status
> and a fix to the rte_lock within the wrong structure
> v3: update to device status info to also use padded size for the related array.
> Adding also 2 additionals commits to allow the API struc to expose more
> information related to queues corner cases/warning as well as an optional
> rw lock.
> Hemant, Maxime, this is planned for DPDK 21.11 but would like review/ack
> early is possible to get this applied earlier and due to time off this summer.
> Thanks
> Nic
> 
> --
> 
> Hi,
> 
> Agregating together in a single serie a number of bbdev api changes
> previously submitted over the last few months and all targeted for 22.11 (4
> different series detailed below). Related deprecation notice being pushed in
> 22.07 in parallel.
> * bbdev: add device status info
> * bbdev: add new operation for FFT processing
> * bbdev: add device info on queue topology
> * bbdev: allow operation type enum for growth
> 
> v2: Update to the RTE_BBDEV_COUNT removal based on feedback from
> Thomas/Stephen : rejecting out of range op type and adjusting the new
> name for the padded maximum value used for fixed size arrays.
> 
> ---
> 
> Previous cover letters agregated below:
> 
> * bbdev: add device status info
> https://patches.dpdk.org/project/dpdk/list/?series=23367
> 
> The updated structure will allow PMDs to expose through info_get what be
> may the status of the underlying accelerator, notably in case an HW error
> event having happened.
> 
> * bbdev: add new operation for FFT processing
> https://patches.dpdk.org/project/dpdk/list/?series=22111
> 
> This contribution adds a new operation type to the existing ones already
> supported by the bbdev PMDs.
> This set of operation is FFT-based processing for 5GNR baseband processing
> acceleration. This operates in the same lookaside fashion as other existing
> bbdev operation with a dedicated set of capabilities and parameters (marked
> as experimental).
> 
> I plan to also include a new PMD supporting this operation (and most of the
> related capabilities) in the next couple of months (either in 22.06 or 22.09) as
> well as extending the related bbdev-test.
> 
> * bbdev: add device info on queue topology
> https://patches.dpdk.org/project/dpdk/list/?series=22076
> 
> Addressing an historical concern that the device info struct only imperfectly
> captured what queues are available on the device (number of operation and
> priority). This ended up being an iterative process for application to find each
> queue could be configured.
> 
> ie. the gap was captured as technical debt previously  in comments
> /* 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
>  * priorities
>  */
> 
> This is now being exposed explictly based on the what the device actually
> supports using the existing info_get api
> 
> * bbdev: allow operation type enum for growth
> https://patches.dpdk.org/project/dpdk/list/?series=23509
> 
> This is related to the general intent to remove using MAX value for enums.
> There is consensus that we should avoid this for a while notably for future-
> proofed ABI concerns
> https://patches.dpdk.org/project/dpdk/patch/20200130142003.2645765-1-
> ferruh.yigit@intel.com/.
> But still there is arguably not yet an explicit best recommendation to handle
> this especially when we actualy need to expose array whose index is such an
> enum.
> As a specific example here I am refering to RTE_BBDEV_OP_TYPE_COUNT in
> enum rte_bbdev_op_type which is being extended for new operation type
> being support in bbdev (such as
> https://patches.dpdk.org/project/dpdk/patch/1646956157-245769-2-git-
> send-email-nicolas.chautru@intel.com/ adding new FFT operation)
> 
> There is also the intent to be able to expose information for each operation
> type through the bbdev api such as dynamically configured queues
> information per such operation type
> https://patches.dpdk.org/project/dpdk/patch/1646785355-168133-2-git-
> send-email-nicolas.chautru@intel.com/
> 
> Basically we are considering best way to accomodate for this, notably based
> on discussions with Ray Kinsella and Bruce Richardson, to handle such a case
> moving forward: specifically for the example with
> RTE_BBDEV_OP_TYPE_COUNT and also more generally.
> 
> One possible option is captured in that patchset and is basically based on the
> simple principle to allow for growth and prevent ABI breakage. Ie. the last
> value of the enum is set with a higher value than required so that to allow
> insertion of new enum outside of the major ABI versions.
> In that case the RTE_BBDEV_OP_TYPE_COUNT is still present and can be
> exposed and used while still allowing for addition thanks to the implicit
> padding-like room. As an alternate variant, instead of using that last enum
> value, that extended size could be exposed as an #define outside of the
> enum but would be fundamentally the same (public).
> 
> Another option would be to avoid array alltogether and use each time this a
> new dedicated API function (operation type enum being an input argument
> instead of an index to an array in an existing structure so that to get access
> to structure related to a given operation type enum) but that is arguably not
> well scalable within DPDK to use such a scheme for each enums and keep an
> uncluttered and clean API. In that very example that would be very odd
> indeed not to get this simply from info_get().
> 
> Some pros and cons, arguably the simple option in that patchset is a valid
> compromise option and a step in the right direction but we would like to
> know your view wrt best recommendation, or any other thought.
> 
> 
> 
> Nicolas Chautru (7):
>   bbdev: allow operation type enum for growth
>   bbdev: add device status info
>   bbdev: add device info on queue topology
>   drivers/baseband: update PMDs to expose queue per operation
>   bbdev: add new operation for FFT processing
>   bbdev: add queue related warning and status information
>   bbdev: remove unnecessary if-check
> 
>  app/test-bbdev/test_bbdev.c                        |   2 +-
>  app/test-bbdev/test_bbdev_perf.c                   |   6 +-
>  doc/guides/prog_guide/bbdev.rst                    | 130 +++++++++++++++++
>  drivers/baseband/acc100/rte_acc100_pmd.c           |  30 ++--
>  drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c |   9 ++
>  drivers/baseband/fpga_lte_fec/fpga_lte_fec.c       |   9 ++
>  drivers/baseband/la12xx/bbdev_la12xx.c             |  10 +-
>  drivers/baseband/null/bbdev_null.c                 |   1 +
>  drivers/baseband/turbo_sw/bbdev_turbo_software.c   |  12 ++
>  examples/bbdev_app/main.c                          |   2 +-
>  lib/bbdev/rte_bbdev.c                              |  57 +++++++-
>  lib/bbdev/rte_bbdev.h                              | 149 +++++++++++++++++++-
>  lib/bbdev/rte_bbdev_op.h                           | 156 ++++++++++++++++++++-
>  lib/bbdev/version.map                              |  11 ++
>  14 files changed, 555 insertions(+), 29 deletions(-)
> 
> --
> 1.8.3.1


^ permalink raw reply	[relevance 0%]

* RE: [PATCH 02/13] ethdev: strip experimental tag off port ID items and actions
  2022-08-12 19:18  4% ` [PATCH 02/13] ethdev: strip experimental tag off port ID items and actions Ivan Malov
@ 2022-08-15 12:59  0%   ` Ori Kam
  0 siblings, 0 replies; 200+ results
From: Ori Kam @ 2022-08-15 12:59 UTC (permalink / raw)
  To: Ivan Malov, dev
  Cc: Eli Britstein, Ilya Maximets,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Ferruh Yigit

Hi,

> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Friday, 12 August 2022 22:18
> 
> The following set of primitives has been introduced in 21.11:
> 
> - RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
> - RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
> - RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
> - RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
> 
> Since then, no one has requested any fixes. At the same time,
> the set is required by series [1] in OvS for the new release.
> 
> [1] http://patchwork.ozlabs.org/project/openvswitch/list/?series=310415
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
>  doc/guides/rel_notes/release_22_11.rst | 8 ++++++++
>  lib/ethdev/rte_flow.h                  | 6 ------
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_22_11.rst
> b/doc/guides/rel_notes/release_22_11.rst
> index 6760ab8b87..f039b857e2 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -87,6 +87,14 @@ API Changes
>  * ethdev: promoted ``rte_eth_rx_metadata_negotiate()``
>    from experimental to stable.
> 
> +* ethdev: promoted the following flow primitives
> +  from experimental to stable:
> +
> +  - ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR``
> +  - ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT``
> +  - ``RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR``
> +  - ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``
> +
> 
>  ABI Changes
>  -----------
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index a79f1e7ef0..e5d2d87403 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -1918,9 +1918,6 @@ static const struct rte_flow_item_conntrack
> rte_flow_item_conntrack_mask = {
>  #endif
> 
>  /**
> - * @warning
> - * @b EXPERIMENTAL: this structure may change without prior notice
> - *
>   * Provides an ethdev port ID for use with the following items:
>   * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
>   * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT.
> @@ -3643,9 +3640,6 @@ struct rte_flow_action_meter_color {
>  };
> 
>  /**
> - * @warning
> - * @b EXPERIMENTAL: this structure may change without prior notice
> - *
>   * Provides an ethdev port ID for use with the following actions:
>   * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
>   * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT.
> --
> 2.30.2

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori



^ permalink raw reply	[relevance 0%]

* RE: [PATCH 03/13] ethdev: remove experimental tag from flow transfer proxy API
  2022-08-12 19:18  4% ` [PATCH 03/13] ethdev: remove experimental tag from flow transfer proxy API Ivan Malov
@ 2022-08-15 12:58  0%   ` Ori Kam
  0 siblings, 0 replies; 200+ results
From: Ori Kam @ 2022-08-15 12:58 UTC (permalink / raw)
  To: Ivan Malov, dev
  Cc: Eli Britstein, Ilya Maximets,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Ferruh Yigit,
	Ray Kinsella

Hi,

> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Friday, 12 August 2022 22:18
> 
> rte_flow_pick_transfer_proxy() was first added to DPDK 21.11.
> Since then, no one has requested any fixes. At the same time,
> the API is required by series [1] in OvS for the new release.
> 
> [1] http://patchwork.ozlabs.org/project/openvswitch/list/?series=310415
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
>  doc/guides/rel_notes/release_22_11.rst | 3 +++
>  lib/ethdev/rte_flow.h                  | 4 ----
>  lib/ethdev/version.map                 | 2 +-
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_22_11.rst
> b/doc/guides/rel_notes/release_22_11.rst
> index f039b857e2..b74e90d27f 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -95,6 +95,9 @@ API Changes
>    - ``RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR``
>    - ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``
> 
> +* ethdev: promoted ``rte_flow_pick_transfer_proxy()``
> +  from experimental to stable.
> +
> 
>  ABI Changes
>  -----------
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index e5d2d87403..bc68fd5631 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -4792,9 +4792,6 @@ rte_flow_tunnel_item_release(uint16_t port_id,
>  			     struct rte_flow_error *error);
> 
>  /**
> - * @warning
> - * @b EXPERIMENTAL: this API may change without prior notice.
> - *
>   * Get a proxy port to manage "transfer" flows.
>   *
>   * Managing "transfer" flows requires that the user communicate them
> @@ -4819,7 +4816,6 @@ rte_flow_tunnel_item_release(uint16_t port_id,
>   * @return
>   *   0 on success, a negative error code otherwise
>   */
> -__rte_experimental
>  int
>  rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
>  			     struct rte_flow_error *error);
> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
> index 2ecc1af571..25e54f9d3e 100644
> --- a/lib/ethdev/version.map
> +++ b/lib/ethdev/version.map
> @@ -132,6 +132,7 @@ DPDK_23 {
>  	rte_flow_error_set;
>  	rte_flow_flush;
>  	rte_flow_isolate;
> +	rte_flow_pick_transfer_proxy;
>  	rte_flow_query;
>  	rte_flow_validate;
> 
> @@ -253,7 +254,6 @@ EXPERIMENTAL {
>  	rte_eth_macaddrs_get;
>  	rte_flow_flex_item_create;
>  	rte_flow_flex_item_release;
> -	rte_flow_pick_transfer_proxy;
> 
>  	# added in 22.03
>  	rte_eth_dev_priority_flow_ctrl_queue_configure;
> --
> 2.30.2

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori

^ permalink raw reply	[relevance 0%]

* [PATCH 13/13] ethdev: remove deprecated flow action PHY PORT
                     ` (4 preceding siblings ...)
  2022-08-12 19:18  1% ` [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT Ivan Malov
@ 2022-08-12 19:18  5% ` Ivan Malov
  2022-08-22  5:33  0%   ` Ori Kam
  5 siblings, 1 reply; 200+ results
From: Ivan Malov @ 2022-08-12 19:18 UTC (permalink / raw)
  To: dev
  Cc: Ori Kam, Eli Britstein, Ilya Maximets, Thomas Monjalon,
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Aman Singh,
	Yuying Zhang, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
	Ferruh Yigit, Hemant Agrawal, Sachin Saxena

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>
---
 app/test-pmd/cmdline_flow.c                   | 35 -------------
 doc/guides/nics/features/bnxt.ini             |  1 -
 doc/guides/nics/features/cxgbe.ini            |  1 -
 doc/guides/nics/features/default.ini          |  1 -
 doc/guides/nics/features/dpaa2.ini            |  1 -
 doc/guides/nics/features/sfc.ini              |  1 -
 doc/guides/nics/sfc_efx.rst                   |  2 -
 doc/guides/prog_guide/rte_flow.rst            | 22 ---------
 doc/guides/rel_notes/release_22_11.rst        |  5 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  5 --
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |  4 --
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      | 49 -------------------
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |  5 --
 drivers/net/cxgbe/cxgbe_flow.c                |  6 ---
 drivers/net/dpaa2/dpaa2_flow.c                | 13 +----
 drivers/net/sfc/sfc_mae.c                     | 36 --------------
 lib/ethdev/rte_flow.c                         |  1 -
 lib/ethdev/rte_flow.h                         | 28 -----------
 18 files changed, 6 insertions(+), 210 deletions(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 758c1f0efa..80f4c0bbef 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -487,9 +487,6 @@ enum index {
 	ACTION_VF,
 	ACTION_VF_ORIGINAL,
 	ACTION_VF_ID,
-	ACTION_PHY_PORT,
-	ACTION_PHY_PORT_ORIGINAL,
-	ACTION_PHY_PORT_INDEX,
 	ACTION_PORT_ID,
 	ACTION_PORT_ID_ORIGINAL,
 	ACTION_PORT_ID_ID,
@@ -1799,7 +1796,6 @@ static const enum index next_action[] = {
 	ACTION_RSS,
 	ACTION_PF,
 	ACTION_VF,
-	ACTION_PHY_PORT,
 	ACTION_PORT_ID,
 	ACTION_METER,
 	ACTION_METER_COLOR,
@@ -1893,13 +1889,6 @@ static const enum index action_vf[] = {
 	ZERO,
 };
 
-static const enum index action_phy_port[] = {
-	ACTION_PHY_PORT_ORIGINAL,
-	ACTION_PHY_PORT_INDEX,
-	ACTION_NEXT,
-	ZERO,
-};
-
 static const enum index action_port_id[] = {
 	ACTION_PORT_ID_ORIGINAL,
 	ACTION_PORT_ID_ID,
@@ -5240,30 +5229,6 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_action_vf, id)),
 		.call = parse_vc_conf,
 	},
-	[ACTION_PHY_PORT] = {
-		.name = "phy_port",
-		.help = "direct packets to physical port index",
-		.priv = PRIV_ACTION(PHY_PORT,
-				    sizeof(struct rte_flow_action_phy_port)),
-		.next = NEXT(action_phy_port),
-		.call = parse_vc,
-	},
-	[ACTION_PHY_PORT_ORIGINAL] = {
-		.name = "original",
-		.help = "use original port index if possible",
-		.next = NEXT(action_phy_port, NEXT_ENTRY(COMMON_BOOLEAN)),
-		.args = ARGS(ARGS_ENTRY_BF(struct rte_flow_action_phy_port,
-					   original, 1)),
-		.call = parse_vc_conf,
-	},
-	[ACTION_PHY_PORT_INDEX] = {
-		.name = "index",
-		.help = "physical port index",
-		.next = NEXT(action_phy_port, NEXT_ENTRY(COMMON_UNSIGNED)),
-		.args = ARGS(ARGS_ENTRY(struct rte_flow_action_phy_port,
-					index)),
-		.call = parse_vc_conf,
-	},
 	[ACTION_PORT_ID] = {
 		.name = "port_id",
 		.help = "direct matching traffic to a given DPDK port ID",
diff --git a/doc/guides/nics/features/bnxt.ini b/doc/guides/nics/features/bnxt.ini
index c05bcff909..b2d54f06aa 100644
--- a/doc/guides/nics/features/bnxt.ini
+++ b/doc/guides/nics/features/bnxt.ini
@@ -82,7 +82,6 @@ of_push_vlan         = Y
 of_set_vlan_pcp      = Y
 of_set_vlan_vid      = Y
 pf                   = Y
-phy_port             = Y
 port_id              = Y
 port_representor     = Y
 represented_port     = Y
diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini
index 295816ab9d..a9dbcd0573 100644
--- a/doc/guides/nics/features/cxgbe.ini
+++ b/doc/guides/nics/features/cxgbe.ini
@@ -51,7 +51,6 @@ of_pop_vlan          = Y
 of_push_vlan         = Y
 of_set_vlan_pcp      = Y
 of_set_vlan_vid      = Y
-phy_port             = Y
 queue                = Y
 set_ipv4_dst         = Y
 set_ipv4_src         = Y
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index 7ed5bd8cb9..f7192cb0da 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -170,7 +170,6 @@ of_set_vlan_pcp      =
 of_set_vlan_vid      =
 passthru             =
 pf                   =
-phy_port             =
 port_id              =
 port_representor     =
 queue                =
diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini
index 53148ad467..cedc234f26 100644
--- a/doc/guides/nics/features/dpaa2.ini
+++ b/doc/guides/nics/features/dpaa2.ini
@@ -45,7 +45,6 @@ vlan                 = Y
 
 [rte_flow actions]
 drop                 = Y
-phy_port             = Y
 port_id              = Y
 queue                = Y
 represented_port     = Y
diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini
index 3dac105e35..f5ac644278 100644
--- a/doc/guides/nics/features/sfc.ini
+++ b/doc/guides/nics/features/sfc.ini
@@ -70,7 +70,6 @@ of_push_vlan         = Y
 of_set_vlan_pcp      = Y
 of_set_vlan_vid      = Y
 pf                   = Y
-phy_port             = Y
 port_id              = Y
 port_representor     = Y
 represented_port     = Y
diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 6eca86e96f..fcad671da2 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -244,8 +244,6 @@ Supported actions (***transfer*** rules):
 
 - MARK
 
-- PHY_PORT
-
 - PF
 
 - VF
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 9cf4261494..becf7c29c9 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -2003,28 +2003,6 @@ rule or if packets are not addressed to a VF in the first place.
    | ``id``       | VF ID                          |
    +--------------+--------------------------------+
 
-Action: ``PHY_PORT``
-^^^^^^^^^^^^^^^^^^^^
-
-This action is deprecated. Consider:
- - `Action: PORT_REPRESENTOR`_
- - `Action: REPRESENTED_PORT`_
-
-Directs matching traffic to a given physical port index of the underlying
-device.
-
-.. _table_rte_flow_action_phy_port:
-
-.. table:: PHY_PORT
-
-   +--------------+-------------------------------------+
-   | Field        | Value                               |
-   +==============+=====================================+
-   | ``original`` | use original port index if possible |
-   +--------------+-------------------------------------+
-   | ``index``    | physical port index                 |
-   +--------------+-------------------------------------+
-
 Action: ``PORT_ID``
 ^^^^^^^^^^^^^^^^^^^
 This action is deprecated. Consider:
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 343f40a041..a7a2bf2c60 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -85,6 +85,9 @@ Removed Items
 * ethdev: removed ``RTE_FLOW_ITEM_TYPE_PHY_PORT``;
   use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
 
+* ethdev: removed ``RTE_FLOW_ACTION_TYPE_PHY_PORT``;
+  use ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT``.
+
 
 API Changes
 -----------
@@ -133,6 +136,8 @@ ABI Changes
 
 * ethdev: enum ``RTE_FLOW_ITEM`` was affected by deprecation procedure.
 
+* ethdev: enum ``RTE_FLOW_ACTION`` was affected by deprecation procedure.
+
 
 Known Issues
 ------------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index b9c2d7a6fe..710d69ddca 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4014,11 +4014,6 @@ This section lists supported actions and their attributes, if any.
   - ``original {boolean}``: use original VF ID if possible.
   - ``id {unsigned}``: VF ID.
 
-- ``phy_port``: direct packets to physical port index.
-
-  - ``original {boolean}``: use original port index if possible.
-  - ``index {unsigned}``: physical port index.
-
 - ``port_id``: direct matching traffic to a given DPDK port ID.
 
   - ``original {boolean}``: use original DPDK port ID if possible.
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 66cd2fba7e..042425ff5c 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
@@ -61,10 +61,6 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = {
 	.act_type                = BNXT_ULP_ACT_TYPE_SUPPORTED,
 	.proto_act_func          = ulp_rte_vf_act_handler
 	},
-	[RTE_FLOW_ACTION_TYPE_PHY_PORT] = {
-	.act_type                = BNXT_ULP_ACT_TYPE_SUPPORTED,
-	.proto_act_func          = ulp_rte_phy_port_act_handler
-	},
 	[RTE_FLOW_ACTION_TYPE_PORT_ID] = {
 	.act_type                = BNXT_ULP_ACT_TYPE_SUPPORTED,
 	.proto_act_func          = ulp_rte_port_act_handler
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 3faafcf788..1be649a16c 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -2255,55 +2255,6 @@ ulp_rte_port_act_handler(const struct rte_flow_action *act_item,
 	return ulp_rte_parser_act_port_set(param, ifindex, act_dir);
 }
 
-/* Function to handle the parsing of RTE Flow action phy_port. */
-int32_t
-ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item,
-			     struct ulp_rte_parser_params *prm)
-{
-	const struct rte_flow_action_phy_port *phy_port;
-	uint32_t pid;
-	int32_t rc;
-	uint16_t pid_s;
-	enum bnxt_ulp_direction_type dir;
-
-	phy_port = action_item->conf;
-	if (!phy_port) {
-		BNXT_TF_DBG(ERR,
-			    "ParseErr: Invalid Argument\n");
-		return BNXT_TF_RC_PARSE_ERR;
-	}
-
-	if (phy_port->original) {
-		BNXT_TF_DBG(ERR,
-			    "Parse Err:Port Original not supported\n");
-		return BNXT_TF_RC_PARSE_ERR;
-	}
-	dir = ULP_COMP_FLD_IDX_RD(prm, BNXT_ULP_CF_IDX_DIRECTION);
-	if (dir != BNXT_ULP_DIR_EGRESS) {
-		BNXT_TF_DBG(ERR,
-			    "Parse Err:Phy ports are valid only for egress\n");
-		return BNXT_TF_RC_PARSE_ERR;
-	}
-	/* Get the physical port details from port db */
-	rc = ulp_port_db_phy_port_vport_get(prm->ulp_ctx, phy_port->index,
-					    &pid_s);
-	if (rc) {
-		BNXT_TF_DBG(ERR, "Failed to get port details\n");
-		return -EINVAL;
-	}
-
-	pid = pid_s;
-	pid = rte_cpu_to_be_32(pid);
-	memcpy(&prm->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VPORT],
-	       &pid, BNXT_ULP_ACT_PROP_SZ_VPORT);
-
-	/* Update the action port set bit */
-	ULP_COMP_FLD_IDX_WR(prm, BNXT_ULP_CF_IDX_ACT_PORT_IS_SET, 1);
-	ULP_COMP_FLD_IDX_WR(prm, BNXT_ULP_CF_IDX_ACT_PORT_TYPE,
-			    BNXT_ULP_INTF_TYPE_PHY_PORT);
-	return BNXT_TF_RC_SUCCESS;
-}
-
 /* Function to handle the parsing of RTE Flow action pop vlan. */
 int32_t
 ulp_rte_of_pop_vlan_act_handler(const struct rte_flow_action *a __rte_unused,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
index 5a9b056b16..f59b10e88b 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
@@ -194,11 +194,6 @@ int32_t
 ulp_rte_port_act_handler(const struct rte_flow_action *act_item,
 			 struct ulp_rte_parser_params *params);
 
-/* Function to handle the parsing of RTE Flow action phy_port. */
-int32_t
-ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item,
-			     struct ulp_rte_parser_params *params);
-
 /* Function to handle the parsing of RTE Flow action pop vlan. */
 int32_t
 ulp_rte_of_pop_vlan_act_handler(const struct rte_flow_action *action_item,
diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c
index d383334415..d66672a9e6 100644
--- a/drivers/net/cxgbe/cxgbe_flow.c
+++ b/drivers/net/cxgbe/cxgbe_flow.c
@@ -598,7 +598,6 @@ ch_rte_parse_atype_switch(const struct rte_flow_action *a,
 	const struct rte_flow_action_set_ipv4 *ipv4;
 	const struct rte_flow_action_set_ipv6 *ipv6;
 	const struct rte_flow_action_set_tp *tp_port;
-	const struct rte_flow_action_phy_port *port;
 	const struct rte_flow_action_set_mac *mac;
 	int item_index;
 	u16 tmp_vlan;
@@ -645,10 +644,6 @@ ch_rte_parse_atype_switch(const struct rte_flow_action *a,
 	case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:
 		fs->newvlan = VLAN_REMOVE;
 		break;
-	case RTE_FLOW_ACTION_TYPE_PHY_PORT:
-		port = (const struct rte_flow_action_phy_port *)a->conf;
-		fs->eport = port->index;
-		break;
 	case RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC:
 		item_index = cxgbe_get_flow_item_index(items,
 						       RTE_FLOW_ITEM_TYPE_IPV4);
@@ -836,7 +831,6 @@ cxgbe_rtef_parse_actions(struct rte_flow *flow,
 			goto action_switch;
 		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
 		case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:
-		case RTE_FLOW_ACTION_TYPE_PHY_PORT:
 		case RTE_FLOW_ACTION_TYPE_MAC_SWAP:
 		case RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC:
 		case RTE_FLOW_ACTION_TYPE_SET_IPV4_DST:
diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c
index 25616b0035..df06c3862e 100644
--- a/drivers/net/dpaa2/dpaa2_flow.c
+++ b/drivers/net/dpaa2/dpaa2_flow.c
@@ -83,7 +83,6 @@ static const
 enum rte_flow_action_type dpaa2_supported_action_type[] = {
 	RTE_FLOW_ACTION_TYPE_END,
 	RTE_FLOW_ACTION_TYPE_QUEUE,
-	RTE_FLOW_ACTION_TYPE_PHY_PORT,
 	RTE_FLOW_ACTION_TYPE_PORT_ID,
 	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
 	RTE_FLOW_ACTION_TYPE_RSS
@@ -92,7 +91,6 @@ enum rte_flow_action_type dpaa2_supported_action_type[] = {
 static const
 enum rte_flow_action_type dpaa2_supported_fs_action_type[] = {
 	RTE_FLOW_ACTION_TYPE_QUEUE,
-	RTE_FLOW_ACTION_TYPE_PHY_PORT,
 	RTE_FLOW_ACTION_TYPE_PORT_ID,
 	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
 };
@@ -3281,17 +3279,11 @@ static inline struct rte_eth_dev *
 dpaa2_flow_redirect_dev(struct dpaa2_dev_priv *priv,
 	const struct rte_flow_action *action)
 {
-	const struct rte_flow_action_phy_port *phy_port;
 	const struct rte_flow_action_port_id *port_id;
 	int idx = -1;
 	struct rte_eth_dev *dest_dev;
 
-	if (action->type == RTE_FLOW_ACTION_TYPE_PHY_PORT) {
-		phy_port = (const struct rte_flow_action_phy_port *)
-					action->conf;
-		if (!phy_port->original)
-			idx = phy_port->index;
-	} else if (action->type == RTE_FLOW_ACTION_TYPE_PORT_ID) {
+	if (action->type == RTE_FLOW_ACTION_TYPE_PORT_ID) {
 		port_id = (const struct rte_flow_action_port_id *)
 					action->conf;
 		if (!port_id->original)
@@ -3345,7 +3337,6 @@ dpaa2_flow_verify_action(
 			}
 			break;
 		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
-		case RTE_FLOW_ACTION_TYPE_PHY_PORT:
 		case RTE_FLOW_ACTION_TYPE_PORT_ID:
 			if (!dpaa2_flow_redirect_dev(priv, &actions[j])) {
 				DPAA2_PMD_ERR("Invalid port id of action");
@@ -3523,7 +3514,6 @@ dpaa2_generic_flow_set(struct rte_flow *flow,
 		switch (actions[j].type) {
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
-		case RTE_FLOW_ACTION_TYPE_PHY_PORT:
 		case RTE_FLOW_ACTION_TYPE_PORT_ID:
 			memset(&action, 0, sizeof(struct dpni_fs_action_cfg));
 			flow->action = actions[j].type;
@@ -4098,7 +4088,6 @@ int dpaa2_flow_destroy(struct rte_eth_dev *dev,
 	switch (flow->action) {
 	case RTE_FLOW_ACTION_TYPE_QUEUE:
 	case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
-	case RTE_FLOW_ACTION_TYPE_PHY_PORT:
 	case RTE_FLOW_ACTION_TYPE_PORT_ID:
 		if (priv->num_rx_tc > 1) {
 			/* Remove entry from QoS table first */
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 4ddb63cbe5..421bb6da95 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -3463,36 +3463,6 @@ sfc_mae_rule_parse_action_count(struct sfc_adapter *sa,
 	return rc;
 }
 
-static int
-sfc_mae_rule_parse_action_phy_port(struct sfc_adapter *sa,
-				   const struct rte_flow_action_phy_port *conf,
-				   efx_mae_actions_t *spec)
-{
-	efx_mport_sel_t mport;
-	uint32_t phy_port;
-	int rc;
-
-	if (conf->original != 0)
-		phy_port = efx_nic_cfg_get(sa->nic)->enc_assigned_port;
-	else
-		phy_port = conf->index;
-
-	rc = efx_mae_mport_by_phy_port(phy_port, &mport);
-	if (rc != 0) {
-		sfc_err(sa, "failed to convert phys. port ID %u to m-port selector: %s",
-			phy_port, strerror(rc));
-		return rc;
-	}
-
-	rc = efx_mae_action_set_populate_deliver(spec, &mport);
-	if (rc != 0) {
-		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
-	}
-
-	return rc;
-}
-
 static int
 sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa,
 				const struct rte_flow_action_vf *vf_conf,
@@ -3626,7 +3596,6 @@ static const char * const action_names[] = {
 	[RTE_FLOW_ACTION_TYPE_COUNT] = "COUNT",
 	[RTE_FLOW_ACTION_TYPE_FLAG] = "FLAG",
 	[RTE_FLOW_ACTION_TYPE_MARK] = "MARK",
-	[RTE_FLOW_ACTION_TYPE_PHY_PORT] = "PHY_PORT",
 	[RTE_FLOW_ACTION_TYPE_PF] = "PF",
 	[RTE_FLOW_ACTION_TYPE_VF] = "VF",
 	[RTE_FLOW_ACTION_TYPE_PORT_ID] = "PORT_ID",
@@ -3745,11 +3714,6 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa,
 			custom_error = B_TRUE;
 		}
 		break;
-	case RTE_FLOW_ACTION_TYPE_PHY_PORT:
-		SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PHY_PORT,
-				       bundle->actions_mask);
-		rc = sfc_mae_rule_parse_action_phy_port(sa, action->conf, spec);
-		break;
 	case RTE_FLOW_ACTION_TYPE_PF:
 		SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PF,
 				       bundle->actions_mask);
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index e7ccdb772e..eeb9398e77 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -188,7 +188,6 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(RSS, sizeof(struct rte_flow_action_rss)),
 	MK_FLOW_ACTION(PF, 0),
 	MK_FLOW_ACTION(VF, sizeof(struct rte_flow_action_vf)),
-	MK_FLOW_ACTION(PHY_PORT, sizeof(struct rte_flow_action_phy_port)),
 	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)),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 066e8c8a99..8c33e84ee8 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -2224,18 +2224,6 @@ enum rte_flow_action_type {
 	 */
 	RTE_FLOW_ACTION_TYPE_VF,
 
-	/**
-	 * @deprecated
-	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
-	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
-	 *
-	 * Directs packets to a given physical port index of the underlying
-	 * device.
-	 *
-	 * See struct rte_flow_action_phy_port.
-	 */
-	RTE_FLOW_ACTION_TYPE_PHY_PORT,
-
 	/**
 	 * @deprecated
 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
@@ -2960,22 +2948,6 @@ struct rte_flow_action_vf {
 	uint32_t id; /**< VF ID. */
 };
 
-/**
- * @deprecated
- * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
- * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
- *
- * RTE_FLOW_ACTION_TYPE_PHY_PORT
- *
- * Directs packets to a given physical port index of the underlying
- * device.
- */
-struct rte_flow_action_phy_port {
-	uint32_t original:1; /**< Use original port index if possible. */
-	uint32_t reserved:31; /**< Reserved, must be zero. */
-	uint32_t index; /**< Physical port index. */
-};
-
 /**
  * @deprecated
  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
-- 
2.30.2


^ permalink raw reply	[relevance 5%]

* [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT
                     ` (3 preceding siblings ...)
  2022-08-12 19:18  1% ` [PATCH 11/13] ethdev: remove deprecated flow item VF Ivan Malov
@ 2022-08-12 19:18  1% ` Ivan Malov
  2022-08-22  5:33  0%   ` Ori Kam
  2022-08-12 19:18  5% ` [PATCH 13/13] ethdev: remove deprecated flow action " Ivan Malov
  5 siblings, 1 reply; 200+ results
From: Ivan Malov @ 2022-08-12 19:18 UTC (permalink / raw)
  To: dev
  Cc: Ori Kam, Eli Britstein, Ilya Maximets, Thomas Monjalon,
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Aman Singh,
	Yuying Zhang, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
	Ferruh Yigit, Matan Azrad, Viacheslav Ovsiienko

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>
---
 app/test-pmd/cmdline_flow.c                   | 24 ------
 doc/guides/nics/features/bnxt.ini             |  1 -
 doc/guides/nics/features/cxgbe.ini            |  1 -
 doc/guides/nics/features/default.ini          |  1 -
 doc/guides/nics/features/mlx5.ini             |  1 -
 doc/guides/nics/features/sfc.ini              |  1 -
 doc/guides/nics/sfc_efx.rst                   |  2 -
 doc/guides/prog_guide/rte_flow.rst            | 45 -----------
 doc/guides/rel_notes/release_22_11.rst        |  3 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  4 -
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |  4 -
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      | 75 -------------------
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |  5 --
 drivers/net/cxgbe/cxgbe_flow.c                | 32 --------
 drivers/net/sfc/sfc_mae.c                     | 69 -----------------
 lib/ethdev/rte_flow.c                         |  1 -
 lib/ethdev/rte_flow.h                         | 56 --------------
 17 files changed, 3 insertions(+), 322 deletions(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 31b906178c..758c1f0efa 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -249,8 +249,6 @@ enum index {
 	ITEM_INVERT,
 	ITEM_ANY,
 	ITEM_ANY_NUM,
-	ITEM_PHY_PORT,
-	ITEM_PHY_PORT_INDEX,
 	ITEM_PORT_ID,
 	ITEM_PORT_ID_ID,
 	ITEM_MARK,
@@ -1275,7 +1273,6 @@ static const enum index next_item[] = {
 	ITEM_VOID,
 	ITEM_INVERT,
 	ITEM_ANY,
-	ITEM_PHY_PORT,
 	ITEM_PORT_ID,
 	ITEM_MARK,
 	ITEM_RAW,
@@ -1345,12 +1342,6 @@ static const enum index item_any[] = {
 	ZERO,
 };
 
-static const enum index item_phy_port[] = {
-	ITEM_PHY_PORT_INDEX,
-	ITEM_NEXT,
-	ZERO,
-};
-
 static const enum index item_port_id[] = {
 	ITEM_PORT_ID_ID,
 	ITEM_NEXT,
@@ -3450,21 +3441,6 @@ static const struct token token_list[] = {
 		.next = NEXT(item_any, NEXT_ENTRY(COMMON_UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_any, num)),
 	},
-	[ITEM_PHY_PORT] = {
-		.name = "phy_port",
-		.help = "match traffic from/to a specific physical port",
-		.priv = PRIV_ITEM(PHY_PORT,
-				  sizeof(struct rte_flow_item_phy_port)),
-		.next = NEXT(item_phy_port),
-		.call = parse_vc,
-	},
-	[ITEM_PHY_PORT_INDEX] = {
-		.name = "index",
-		.help = "physical port index",
-		.next = NEXT(item_phy_port, NEXT_ENTRY(COMMON_UNSIGNED),
-			     item_param),
-		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_phy_port, index)),
-	},
 	[ITEM_PORT_ID] = {
 		.name = "port_id",
 		.help = "match traffic from/to a given DPDK port ID",
diff --git a/doc/guides/nics/features/bnxt.ini b/doc/guides/nics/features/bnxt.ini
index 860a0a8cf6..c05bcff909 100644
--- a/doc/guides/nics/features/bnxt.ini
+++ b/doc/guides/nics/features/bnxt.ini
@@ -63,7 +63,6 @@ ipv6                 = Y
 gre                  = Y
 icmp                 = Y
 icmp6                = Y
-phy_port             = Y
 port_id              = Y
 port_representor     = Y
 represented_port     = Y
diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini
index 3f11cc2ac0..295816ab9d 100644
--- a/doc/guides/nics/features/cxgbe.ini
+++ b/doc/guides/nics/features/cxgbe.ini
@@ -39,7 +39,6 @@ Usage doc            = Y
 eth                  = Y
 ipv4                 = Y
 ipv6                 = Y
-phy_port             = Y
 tcp                  = Y
 udp                  = Y
 vlan                 = Y
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index 8fbe1de46a..7ed5bd8cb9 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -122,7 +122,6 @@ mpls                 =
 nsh                  =
 nvgre                =
 pfcp                 =
-phy_port             =
 port_id              =
 port_representor     =
 ppp                  =
diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini
index e056516deb..e5974063c8 100644
--- a/doc/guides/nics/features/mlx5.ini
+++ b/doc/guides/nics/features/mlx5.ini
@@ -76,7 +76,6 @@ mark                 = Y
 meta                 = Y
 mpls                 = Y
 nvgre                = Y
-phy_port             = Y
 port_id              = Y
 tag                  = Y
 tcp                  = Y
diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini
index 363fc6d0ec..3dac105e35 100644
--- a/doc/guides/nics/features/sfc.ini
+++ b/doc/guides/nics/features/sfc.ini
@@ -47,7 +47,6 @@ ipv4                 = Y
 ipv6                 = Y
 mark                 = P
 nvgre                = Y
-phy_port             = Y
 port_id              = Y
 port_representor     = Y
 pppoed               = Y
diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 0e0088b09f..6eca86e96f 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -198,8 +198,6 @@ Supported pattern items (***transfer*** rules):
 
 - PORT_ID (cannot repeat; conflicts with other traffic source items)
 
-- PHY_PORT (cannot repeat; conflicts with other traffic source items)
-
 - ETH
 
 - VLAN (double-tagging is supported)
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 85bf2bf123..9cf4261494 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -535,44 +535,6 @@ Usage example, matching non-TCPv4 packets only:
    | 4     | END      |
    +-------+----------+
 
-Item: ``PHY_PORT``
-^^^^^^^^^^^^^^^^^^
-
-This item is deprecated. Consider:
- - `Item: PORT_REPRESENTOR`_
- - `Item: REPRESENTED_PORT`_
-
-Matches traffic originating from (ingress) or going to (egress) a physical
-port of the underlying device.
-
-The first PHY_PORT item overrides the physical port normally associated with
-the specified DPDK input port (port_id). This item can be provided several
-times to match additional physical ports.
-
-Note that physical ports are not necessarily tied to DPDK input ports
-(port_id) when those are not under DPDK control. Possible values are
-specific to each device, they are not necessarily indexed from zero and may
-not be contiguous.
-
-As a device property, the list of allowed values as well as the value
-associated with a port_id should be retrieved by other means.
-
-- Default ``mask`` matches any port index.
-
-.. _table_rte_flow_item_phy_port:
-
-.. table:: PHY_PORT
-
-   +----------+-----------+--------------------------------+
-   | Field    | Subfield  | Value                          |
-   +==========+===========+================================+
-   | ``spec`` | ``index`` | physical port index            |
-   +----------+-----------+--------------------------------+
-   | ``last`` | ``index`` | upper range value              |
-   +----------+-----------+--------------------------------+
-   | ``mask`` | ``index`` | zeroed to match any port index |
-   +----------+-----------+--------------------------------+
-
 Item: ``PORT_ID``
 ^^^^^^^^^^^^^^^^^
 
@@ -586,11 +548,6 @@ port ID.
 Normally only supported if the port ID in question is known by the
 underlying PMD and related to the device the flow rule is created against.
 
-This must not be confused with `Item: PHY_PORT`_ which refers to the
-physical port of a device, whereas `Item: PORT_ID`_ refers to a ``struct
-rte_eth_dev`` object on the application side (also known as "port
-representor" depending on the kind of underlying device).
-
 - Default ``mask`` matches the specified DPDK port ID.
 
 .. _table_rte_flow_item_port_id:
@@ -2056,8 +2013,6 @@ This action is deprecated. Consider:
 Directs matching traffic to a given physical port index of the underlying
 device.
 
-See `Item: PHY_PORT`_.
-
 .. _table_rte_flow_action_phy_port:
 
 .. table:: PHY_PORT
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index cf3d6e4efb..343f40a041 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -82,6 +82,9 @@ Removed Items
 * ethdev: removed ``RTE_FLOW_ITEM_TYPE_VF``;
   use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
 
+* ethdev: removed ``RTE_FLOW_ITEM_TYPE_PHY_PORT``;
+  use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
+
 
 API Changes
 -----------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 17049e59f8..b9c2d7a6fe 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3665,10 +3665,6 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``num {unsigned}``: number of layers covered.
 
-- ``phy_port``: match traffic from/to a specific physical port.
-
-  - ``index {unsigned}``: physical port index.
-
 - ``port_id``: match traffic from/to a given DPDK port ID.
 
   - ``id {unsigned}``: DPDK port ID.
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 23081fc99b..66cd2fba7e 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
@@ -260,10 +260,6 @@ struct bnxt_ulp_rte_hdr_info ulp_hdr_info[] = {
 	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
 	.proto_hdr_func          = ulp_rte_item_any_handler
 	},
-	[RTE_FLOW_ITEM_TYPE_PHY_PORT] = {
-	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
-	.proto_hdr_func          = ulp_rte_phy_port_hdr_handler
-	},
 	[RTE_FLOW_ITEM_TYPE_PORT_ID] = {
 	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
 	.proto_hdr_func          = ulp_rte_port_hdr_handler
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 38799840dd..3faafcf788 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -571,81 +571,6 @@ ulp_rte_port_hdr_handler(const struct rte_flow_item *item,
 	return ulp_rte_parser_svif_set(params, ifindex, mask, item_dir);
 }
 
-/* Function to handle the parsing of RTE Flow item phy port Header. */
-int32_t
-ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item,
-			     struct ulp_rte_parser_params *params)
-{
-	const struct rte_flow_item_phy_port *port_spec = item->spec;
-	const struct rte_flow_item_phy_port *port_mask = item->mask;
-	uint16_t mask = 0;
-	int32_t rc = BNXT_TF_RC_ERROR;
-	uint16_t svif;
-	enum bnxt_ulp_direction_type dir;
-	struct ulp_rte_hdr_field *hdr_field;
-
-	/* Copy the rte_flow_item for phy port into hdr_field */
-	if (!port_spec) {
-		BNXT_TF_DBG(ERR, "ParseErr:Phy Port id is not valid\n");
-		return rc;
-	}
-	if (!port_mask) {
-		BNXT_TF_DBG(ERR, "ParseErr:Phy Port mask is not valid\n");
-		return rc;
-	}
-	mask = port_mask->index;
-
-	/* Update the match port type */
-	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_MATCH_PORT_TYPE,
-			    BNXT_ULP_INTF_TYPE_PHY_PORT);
-
-	/* Compute the Hw direction */
-	bnxt_ulp_rte_parser_direction_compute(params);
-
-	/* Direction validation */
-	dir = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_DIRECTION);
-	if (dir == BNXT_ULP_DIR_EGRESS) {
-		BNXT_TF_DBG(ERR,
-			    "Parse Err:Phy ports are valid only for ingress\n");
-		return BNXT_TF_RC_PARSE_ERR;
-	}
-
-	/* Get the physical port details from port db */
-	rc = ulp_port_db_phy_port_svif_get(params->ulp_ctx, port_spec->index,
-					   &svif);
-	if (rc) {
-		BNXT_TF_DBG(ERR, "Failed to get port details\n");
-		return BNXT_TF_RC_PARSE_ERR;
-	}
-
-	/* Update the SVIF details */
-	svif = rte_cpu_to_be_16(svif);
-	hdr_field = &params->hdr_field[BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX];
-	memcpy(hdr_field->spec, &svif, sizeof(svif));
-	memcpy(hdr_field->mask, &mask, sizeof(mask));
-	hdr_field->size = sizeof(svif);
-	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_SVIF_FLAG,
-			    rte_be_to_cpu_16(svif));
-	if (!mask) {
-		uint32_t port_id = 0;
-		uint16_t phy_port = 0;
-
-		/* Validate the control port */
-		port_id = ULP_COMP_FLD_IDX_RD(params,
-					      BNXT_ULP_CF_IDX_DEV_PORT_ID);
-		if (ulp_port_db_phy_port_get(params->ulp_ctx,
-					     port_id, &phy_port) ||
-		    (uint16_t)port_spec->index != phy_port) {
-			BNXT_TF_DBG(ERR, "Mismatch of control and phy_port\n");
-			return BNXT_TF_RC_PARSE_ERR;
-		}
-		ULP_BITMAP_SET(params->hdr_bitmap.bits,
-			       BNXT_ULP_HDR_BIT_SVIF_IGNORE);
-		memset(hdr_field->mask, 0xFF, sizeof(mask));
-	}
-	return BNXT_TF_RC_SUCCESS;
-}
-
 /* Function to handle the update of proto header based on field values */
 static void
 ulp_rte_l2_proto_type_update(struct ulp_rte_parser_params *param,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
index 0e246abbd8..5a9b056b16 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
@@ -85,11 +85,6 @@ int32_t
 ulp_rte_port_hdr_handler(const struct rte_flow_item *item,
 			 struct ulp_rte_parser_params *params);
 
-/* Function to handle the parsing of RTE Flow item port Header. */
-int32_t
-ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item,
-			     struct ulp_rte_parser_params *params);
-
 /* Function to handle the RTE item Ethernet Header. */
 int32_t
 ulp_rte_eth_hdr_handler(const struct rte_flow_item *item,
diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c
index 8b4efc697b..d383334415 100644
--- a/drivers/net/cxgbe/cxgbe_flow.c
+++ b/drivers/net/cxgbe/cxgbe_flow.c
@@ -208,31 +208,6 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item,
 	return 0;
 }
 
-static int
-ch_rte_parsetype_port(const void *dmask, const struct rte_flow_item *item,
-		      struct ch_filter_specification *fs,
-		      struct rte_flow_error *e)
-{
-	const struct rte_flow_item_phy_port *val = item->spec;
-	const struct rte_flow_item_phy_port *umask = item->mask;
-	const struct rte_flow_item_phy_port *mask;
-
-	mask = umask ? umask : (const struct rte_flow_item_phy_port *)dmask;
-
-	if (!val)
-		return 0; /* Wildcard, match all physical ports */
-
-	if (val->index > 0x7)
-		return rte_flow_error_set(e, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
-					  item,
-					  "port index up to 0x7 is supported");
-
-	if (val->index || (umask && umask->index))
-		CXGBE_FILL_FS(val->index, mask->index, iport);
-
-	return 0;
-}
-
 static int
 ch_rte_parsetype_vlan(const void *dmask, const struct rte_flow_item *item,
 		      struct ch_filter_specification *fs,
@@ -926,13 +901,6 @@ static struct chrte_fparse parseitem[] = {
 		}
 	},
 
-	[RTE_FLOW_ITEM_TYPE_PHY_PORT] = {
-		.fptr = ch_rte_parsetype_port,
-		.dmask = &(const struct rte_flow_item_phy_port){
-			.index = 0x7,
-		}
-	},
-
 	[RTE_FLOW_ITEM_TYPE_VLAN] = {
 		.fptr = ch_rte_parsetype_vlan,
 		.dmask = &(const struct rte_flow_item_vlan){
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 06de659ee2..4ddb63cbe5 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -1628,63 +1628,6 @@ sfc_mae_rule_parse_item_ethdev_based(const struct rte_flow_item *item,
 	return 0;
 }
 
-static int
-sfc_mae_rule_parse_item_phy_port(const struct rte_flow_item *item,
-				 struct sfc_flow_parse_ctx *ctx,
-				 struct rte_flow_error *error)
-{
-	struct sfc_mae_parse_ctx *ctx_mae = ctx->mae;
-	const struct rte_flow_item_phy_port supp_mask = {
-		.index = 0xffffffff,
-	};
-	const void *def_mask = &rte_flow_item_phy_port_mask;
-	const struct rte_flow_item_phy_port *spec = NULL;
-	const struct rte_flow_item_phy_port *mask = NULL;
-	efx_mport_sel_t mport_v;
-	int rc;
-
-	if (ctx_mae->match_mport_set) {
-		return rte_flow_error_set(error, ENOTSUP,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Can't handle multiple traffic source items");
-	}
-
-	rc = sfc_flow_parse_init(item,
-				 (const void **)&spec, (const void **)&mask,
-				 (const void *)&supp_mask, def_mask,
-				 sizeof(struct rte_flow_item_phy_port), error);
-	if (rc != 0)
-		return rc;
-
-	if (mask->index != supp_mask.index) {
-		return rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Bad mask in the PHY_PORT pattern item");
-	}
-
-	/* If "spec" is not set, could be any physical port */
-	if (spec == NULL)
-		return 0;
-
-	rc = efx_mae_mport_by_phy_port(spec->index, &mport_v);
-	if (rc != 0) {
-		return rte_flow_error_set(error, rc,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Failed to convert the PHY_PORT index");
-	}
-
-	rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec, &mport_v, NULL);
-	if (rc != 0) {
-		return rte_flow_error_set(error, rc,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Failed to set MPORT for the PHY_PORT");
-	}
-
-	ctx_mae->match_mport_set = B_TRUE;
-
-	return 0;
-}
-
 /*
  * Having this field ID in a field locator means that this
  * locator cannot be used to actually set the field at the
@@ -2478,18 +2421,6 @@ static const struct sfc_flow_item sfc_flow_items[] = {
 		.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
 		.parse = sfc_mae_rule_parse_item_ethdev_based,
 	},
-	{
-		.type = RTE_FLOW_ITEM_TYPE_PHY_PORT,
-		.name = "PHY_PORT",
-		/*
-		 * In terms of RTE flow, this item is a META one,
-		 * and its position in the pattern is don't care.
-		 */
-		.prev_layer = SFC_FLOW_ITEM_ANY_LAYER,
-		.layer = SFC_FLOW_ITEM_ANY_LAYER,
-		.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
-		.parse = sfc_mae_rule_parse_item_phy_port,
-	},
 	{
 		.type = RTE_FLOW_ITEM_TYPE_ETH,
 		.name = "ETH",
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 65c74687e3..e7ccdb772e 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -97,7 +97,6 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(VOID, 0),
 	MK_FLOW_ITEM(INVERT, 0),
 	MK_FLOW_ITEM(ANY, sizeof(struct rte_flow_item_any)),
-	MK_FLOW_ITEM(PHY_PORT, sizeof(struct rte_flow_item_phy_port)),
 	MK_FLOW_ITEM(PORT_ID, sizeof(struct rte_flow_item_port_id)),
 	MK_FLOW_ITEM(RAW, sizeof(struct rte_flow_item_raw)),
 	MK_FLOW_ITEM(ETH, sizeof(struct rte_flow_item_eth)),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 0a98db9c1c..066e8c8a99 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -188,20 +188,6 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_ANY,
 
-	/**
-	 * @deprecated
-	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
-	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
-	 *
-	 * [META]
-	 *
-	 * Matches traffic originating from (ingress) or going to (egress) a
-	 * physical port of the underlying device.
-	 *
-	 * See struct rte_flow_item_phy_port.
-	 */
-	RTE_FLOW_ITEM_TYPE_PHY_PORT,
-
 	/**
 	 * @deprecated
 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
@@ -686,41 +672,6 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = {
 };
 #endif
 
-/**
- * @deprecated
- * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
- * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
- *
- * RTE_FLOW_ITEM_TYPE_PHY_PORT
- *
- * Matches traffic originating from (ingress) or going to (egress) a
- * physical port of the underlying device.
- *
- * The first PHY_PORT item overrides the physical port normally associated
- * with the specified DPDK input port (port_id). This item can be provided
- * several times to match additional physical ports.
- *
- * Note that physical ports are not necessarily tied to DPDK input ports
- * (port_id) when those are not under DPDK control. Possible values are
- * specific to each device, they are not necessarily indexed from zero and
- * may not be contiguous.
- *
- * As a device property, the list of allowed values as well as the value
- * associated with a port_id should be retrieved by other means.
- *
- * A zeroed mask can be used to match any port index.
- */
-struct rte_flow_item_phy_port {
-	uint32_t index; /**< Physical port index. */
-};
-
-/** Default mask for RTE_FLOW_ITEM_TYPE_PHY_PORT. */
-#ifndef __cplusplus
-static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = {
-	.index = 0x00000000,
-};
-#endif
-
 /**
  * @deprecated
  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
@@ -734,11 +685,6 @@ static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = {
  * Normally only supported if the port ID in question is known by the
  * underlying PMD and related to the device the flow rule is created
  * against.
- *
- * This must not be confused with @p PHY_PORT which refers to the physical
- * port of a device, whereas @p PORT_ID refers to a struct rte_eth_dev
- * object on the application side (also known as "port representor"
- * depending on the kind of underlying device).
  */
 struct rte_flow_item_port_id {
 	uint32_t id; /**< DPDK port ID. */
@@ -3023,8 +2969,6 @@ struct rte_flow_action_vf {
  *
  * Directs packets to a given physical port index of the underlying
  * device.
- *
- * @see RTE_FLOW_ITEM_TYPE_PHY_PORT
  */
 struct rte_flow_action_phy_port {
 	uint32_t original:1; /**< Use original port index if possible. */
-- 
2.30.2


^ permalink raw reply	[relevance 1%]

* [PATCH 11/13] ethdev: remove deprecated flow item VF
                     ` (2 preceding siblings ...)
  2022-08-12 19:18  5% ` [PATCH 10/13] ethdev: remove deprecated flow item PF Ivan Malov
@ 2022-08-12 19:18  1% ` Ivan Malov
  2022-08-22  5:50  0%   ` Ori Kam
  2022-08-12 19:18  1% ` [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT Ivan Malov
  2022-08-12 19:18  5% ` [PATCH 13/13] ethdev: remove deprecated flow action " Ivan Malov
  5 siblings, 1 reply; 200+ results
From: Ivan Malov @ 2022-08-12 19:18 UTC (permalink / raw)
  To: dev
  Cc: Ori Kam, Eli Britstein, Ilya Maximets, Thomas Monjalon,
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Aman Singh,
	Yuying Zhang, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
	Ferruh Yigit, Beilei Xing

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>
---
 app/test-pmd/cmdline_flow.c                   |  25 -
 doc/guides/nics/features/bnxt.ini             |   1 -
 doc/guides/nics/features/cxgbe.ini            |   1 -
 doc/guides/nics/features/default.ini          |   1 -
 doc/guides/nics/features/i40e.ini             |   1 -
 doc/guides/nics/features/sfc.ini              |   1 -
 doc/guides/nics/sfc_efx.rst                   |   2 -
 doc/guides/prog_guide/rte_flow.rst            |  40 +-
 doc/guides/rel_notes/release_22_11.rst        |   3 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |   4 -
 drivers/net/bnxt/bnxt_flow.c                  |  58 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |   4 -
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  34 -
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   5 -
 drivers/net/cxgbe/cxgbe_flow.c                |  36 -
 drivers/net/i40e/i40e_flow.c                  | 987 ++----------------
 drivers/net/sfc/sfc_mae.c                     |  77 --
 lib/ethdev/rte_flow.c                         |   1 -
 lib/ethdev/rte_flow.h                         |  46 -
 19 files changed, 110 insertions(+), 1217 deletions(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 2722d5a48d..31b906178c 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -249,8 +249,6 @@ enum index {
 	ITEM_INVERT,
 	ITEM_ANY,
 	ITEM_ANY_NUM,
-	ITEM_VF,
-	ITEM_VF_ID,
 	ITEM_PHY_PORT,
 	ITEM_PHY_PORT_INDEX,
 	ITEM_PORT_ID,
@@ -1277,7 +1275,6 @@ static const enum index next_item[] = {
 	ITEM_VOID,
 	ITEM_INVERT,
 	ITEM_ANY,
-	ITEM_VF,
 	ITEM_PHY_PORT,
 	ITEM_PORT_ID,
 	ITEM_MARK,
@@ -1348,12 +1345,6 @@ static const enum index item_any[] = {
 	ZERO,
 };
 
-static const enum index item_vf[] = {
-	ITEM_VF_ID,
-	ITEM_NEXT,
-	ZERO,
-};
-
 static const enum index item_phy_port[] = {
 	ITEM_PHY_PORT_INDEX,
 	ITEM_NEXT,
@@ -3459,19 +3450,6 @@ static const struct token token_list[] = {
 		.next = NEXT(item_any, NEXT_ENTRY(COMMON_UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_any, num)),
 	},
-	[ITEM_VF] = {
-		.name = "vf",
-		.help = "match traffic from/to a virtual function ID",
-		.priv = PRIV_ITEM(VF, sizeof(struct rte_flow_item_vf)),
-		.next = NEXT(item_vf),
-		.call = parse_vc,
-	},
-	[ITEM_VF_ID] = {
-		.name = "id",
-		.help = "VF ID",
-		.next = NEXT(item_vf, NEXT_ENTRY(COMMON_UNSIGNED), item_param),
-		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_vf, id)),
-	},
 	[ITEM_PHY_PORT] = {
 		.name = "phy_port",
 		.help = "match traffic from/to a specific physical port",
@@ -10669,9 +10647,6 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_ANY:
 		mask = &rte_flow_item_any_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_VF:
-		mask = &rte_flow_item_vf_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_PORT_ID:
 		mask = &rte_flow_item_port_id_mask;
 		break;
diff --git a/doc/guides/nics/features/bnxt.ini b/doc/guides/nics/features/bnxt.ini
index 259480d1df..860a0a8cf6 100644
--- a/doc/guides/nics/features/bnxt.ini
+++ b/doc/guides/nics/features/bnxt.ini
@@ -69,7 +69,6 @@ port_representor     = Y
 represented_port     = Y
 tcp                  = Y
 udp                  = Y
-vf                   = Y
 vlan                 = Y
 vxlan                = Y
 
diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini
index d869f2100f..3f11cc2ac0 100644
--- a/doc/guides/nics/features/cxgbe.ini
+++ b/doc/guides/nics/features/cxgbe.ini
@@ -42,7 +42,6 @@ ipv6                 = Y
 phy_port             = Y
 tcp                  = Y
 udp                  = Y
-vf                   = Y
 vlan                 = Y
 
 [rte_flow actions]
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index aff236134e..8fbe1de46a 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -135,7 +135,6 @@ sctp                 =
 tag                  =
 tcp                  =
 udp                  =
-vf                   =
 vlan                 =
 vxlan                =
 vxlan_gpe            =
diff --git a/doc/guides/nics/features/i40e.ini b/doc/guides/nics/features/i40e.ini
index dd18fec217..95e39aaba0 100644
--- a/doc/guides/nics/features/i40e.ini
+++ b/doc/guides/nics/features/i40e.ini
@@ -68,7 +68,6 @@ raw                  = Y
 sctp                 = Y
 tcp                  = Y
 udp                  = Y
-vf                   = Y
 vlan                 = Y
 vxlan                = Y
 
diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini
index 355174d5c2..363fc6d0ec 100644
--- a/doc/guides/nics/features/sfc.ini
+++ b/doc/guides/nics/features/sfc.ini
@@ -55,7 +55,6 @@ pppoes               = Y
 represented_port     = Y
 tcp                  = Y
 udp                  = Y
-vf                   = Y
 vlan                 = Y
 vxlan                = Y
 
diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 2dbc59e8f7..0e0088b09f 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -200,8 +200,6 @@ Supported pattern items (***transfer*** rules):
 
 - PHY_PORT (cannot repeat; conflicts with other traffic source items)
 
-- VF (cannot repeat; conflicts with other traffic source items)
-
 - ETH
 
 - VLAN (double-tagging is supported)
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 72f0c3d346..85bf2bf123 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -535,40 +535,6 @@ Usage example, matching non-TCPv4 packets only:
    | 4     | END      |
    +-------+----------+
 
-Item: ``VF``
-^^^^^^^^^^^^
-
-This item is deprecated. Consider:
- - `Item: PORT_REPRESENTOR`_
- - `Item: REPRESENTED_PORT`_
-
-Matches traffic originating from (ingress) or going to (egress) a given
-virtual function of the current device.
-
-If supported, should work even if the virtual function is not managed by the
-application and thus not associated with a DPDK port ID.
-
-Note this pattern item does not match VF representors traffic which, as
-separate entities, should be addressed through their own DPDK port IDs.
-
-- Can be specified multiple times to match traffic addressed to several VF
-  IDs.
-- Default ``mask`` matches any VF ID.
-
-.. _table_rte_flow_item_vf:
-
-.. table:: VF
-
-   +----------+----------+---------------------------+
-   | Field    | Subfield | Value                     |
-   +==========+==========+===========================+
-   | ``spec`` | ``id``   | destination VF ID         |
-   +----------+----------+---------------------------+
-   | ``last`` | ``id``   | upper range value         |
-   +----------+----------+---------------------------+
-   | ``mask`` | ``id``   | zeroed to match any VF ID |
-   +----------+----------+---------------------------+
-
 Item: ``PHY_PORT``
 ^^^^^^^^^^^^^^^^^^
 
@@ -2063,13 +2029,11 @@ This action is deprecated. Consider:
 
 Directs matching traffic to a given virtual function of the current device.
 
-Packets matched by a VF pattern item can be redirected to their original VF
-ID instead of the specified one. This parameter may not be available and is
+Packets can be redirected to the VF they originate from,
+instead of the specified one. This parameter may not be available and is
 not guaranteed to work properly if the VF part is matched by a prior flow
 rule or if packets are not addressed to a VF in the first place.
 
-See `Item: VF`_.
-
 .. _table_rte_flow_action_vf:
 
 .. table:: VF
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index b7469708af..cf3d6e4efb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -79,6 +79,9 @@ Removed Items
 * ethdev: removed ``RTE_FLOW_ITEM_TYPE_PF``;
   use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
 
+* ethdev: removed ``RTE_FLOW_ITEM_TYPE_VF``;
+  use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
+
 
 API Changes
 -----------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 4446560369..17049e59f8 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3665,10 +3665,6 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``num {unsigned}``: number of layers covered.
 
-- ``vf``: match traffic from/to a virtual function ID.
-
-  - ``id {unsigned}``: VF ID.
-
 - ``phy_port``: match traffic from/to a specific physical port.
 
   - ``index {unsigned}``: physical port index.
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index f8e10968e3..96ef00460c 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -126,8 +126,7 @@ bnxt_filter_type_check(const struct rte_flow_item pattern[],
 }
 
 static int
-bnxt_validate_and_parse_flow_type(struct bnxt *bp,
-				  const struct rte_flow_attr *attr,
+bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr,
 				  const struct rte_flow_item pattern[],
 				  struct rte_flow_error *error,
 				  struct bnxt_filter_info *filter)
@@ -148,16 +147,13 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 	const struct rte_flow_item_vxlan *vxlan_mask;
 	uint8_t vni_mask[] = {0xFF, 0xFF, 0xFF};
 	uint8_t tni_mask[] = {0xFF, 0xFF, 0xFF};
-	const struct rte_flow_item_vf *vf_spec;
 	uint32_t tenant_id_be = 0, valid_flags = 0;
 	bool vni_masked = 0;
 	bool tni_masked = 0;
 	uint32_t en_ethertype;
 	uint8_t inner = 0;
-	uint32_t vf = 0;
 	uint32_t en = 0;
 	int use_ntuple;
-	int dflt_vnic;
 
 	use_ntuple = bnxt_filter_type_check(pattern, error);
 	if (use_ntuple < 0)
@@ -680,56 +676,6 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 			}
 			break;
 
-		case RTE_FLOW_ITEM_TYPE_VF:
-			vf_spec = item->spec;
-			vf = vf_spec->id;
-			if (!BNXT_PF(bp)) {
-				rte_flow_error_set(error,
-						   EINVAL,
-						   RTE_FLOW_ERROR_TYPE_ITEM,
-						   item,
-						   "Configuring on a VF!");
-				return -rte_errno;
-			}
-
-			if (vf >= bp->pdev->max_vfs) {
-				rte_flow_error_set(error,
-						   EINVAL,
-						   RTE_FLOW_ERROR_TYPE_ITEM,
-						   item,
-						   "Incorrect VF id!");
-				return -rte_errno;
-			}
-
-			if (!attr->transfer) {
-				rte_flow_error_set(error,
-						   ENOTSUP,
-						   RTE_FLOW_ERROR_TYPE_ITEM,
-						   item,
-						   "Matching VF traffic without"
-						   " affecting it (transfer attribute)"
-						   " is unsupported");
-				return -rte_errno;
-			}
-
-			filter->mirror_vnic_id =
-			dflt_vnic = bnxt_hwrm_func_qcfg_vf_dflt_vnic_id(bp, vf);
-			if (dflt_vnic < 0) {
-				/* This simply indicates there's no driver
-				 * loaded. This is not an error.
-				 */
-				rte_flow_error_set
-					(error,
-					 EINVAL,
-					 RTE_FLOW_ERROR_TYPE_ITEM,
-					 item,
-					 "Unable to get default VNIC for VF");
-				return -rte_errno;
-			}
-
-			filter->mirror_vnic_id = dflt_vnic;
-			en |= NTUPLE_FLTR_ALLOC_INPUT_EN_MIRROR_VNIC_ID;
-			break;
 		default:
 			break;
 		}
@@ -1298,7 +1244,7 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 	int rc, use_ntuple;
 
 	rc =
-	bnxt_validate_and_parse_flow_type(bp, attr, pattern, error, filter);
+	bnxt_validate_and_parse_flow_type(attr, pattern, error, filter);
 	if (rc != 0)
 		goto ret;
 
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 17216426d8..23081fc99b 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
@@ -260,10 +260,6 @@ struct bnxt_ulp_rte_hdr_info ulp_hdr_info[] = {
 	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
 	.proto_hdr_func          = ulp_rte_item_any_handler
 	},
-	[RTE_FLOW_ITEM_TYPE_VF] = {
-	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
-	.proto_hdr_func          = ulp_rte_vf_hdr_handler
-	},
 	[RTE_FLOW_ITEM_TYPE_PHY_PORT] = {
 	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
 	.proto_hdr_func          = ulp_rte_phy_port_hdr_handler
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 6a1d235f77..38799840dd 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -507,40 +507,6 @@ ulp_rte_parser_implicit_act_port_process(struct ulp_rte_parser_params *params)
 	return BNXT_TF_RC_SUCCESS;
 }
 
-/* Function to handle the parsing of RTE Flow item VF Header. */
-int32_t
-ulp_rte_vf_hdr_handler(const struct rte_flow_item *item,
-		       struct ulp_rte_parser_params *params)
-{
-	const struct rte_flow_item_vf *vf_spec = item->spec;
-	const struct rte_flow_item_vf *vf_mask = item->mask;
-	uint16_t mask = 0;
-	uint32_t ifindex;
-	int32_t rc = BNXT_TF_RC_PARSE_ERR;
-
-	/* Get VF rte_flow_item for Port details */
-	if (!vf_spec) {
-		BNXT_TF_DBG(ERR, "ParseErr:VF id is not valid\n");
-		return rc;
-	}
-	if (!vf_mask) {
-		BNXT_TF_DBG(ERR, "ParseErr:VF mask is not valid\n");
-		return rc;
-	}
-	mask = vf_mask->id;
-
-	/* perform the conversion from VF Func id to bnxt ifindex */
-	if (ulp_port_db_dev_func_id_to_ulp_index(params->ulp_ctx,
-						 vf_spec->id,
-						 &ifindex)) {
-		BNXT_TF_DBG(ERR, "ParseErr:Portid is not valid\n");
-		return rc;
-	}
-	/* Update the SVIF details */
-	return ulp_rte_parser_svif_set(params, ifindex, mask,
-				       BNXT_ULP_DIR_INVALID);
-}
-
 /* Parse items PORT_ID, PORT_REPRESENTOR and REPRESENTED_PORT. */
 int32_t
 ulp_rte_port_hdr_handler(const struct rte_flow_item *item,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
index 94918f6b4a..0e246abbd8 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
@@ -80,11 +80,6 @@ bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action actions[],
 void
 bnxt_ulp_rte_parser_post_process(struct ulp_rte_parser_params *params);
 
-/* Function to handle the parsing of RTE Flow item VF Header. */
-int32_t
-ulp_rte_vf_hdr_handler(const struct rte_flow_item *item,
-		       struct ulp_rte_parser_params *params);
-
 /* Parse items PORT_ID, PORT_REPRESENTOR and REPRESENTED_PORT. */
 int32_t
 ulp_rte_port_hdr_handler(const struct rte_flow_item *item,
diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c
index e4f9c152b5..8b4efc697b 100644
--- a/drivers/net/cxgbe/cxgbe_flow.c
+++ b/drivers/net/cxgbe/cxgbe_flow.c
@@ -288,35 +288,6 @@ ch_rte_parsetype_vlan(const void *dmask, const struct rte_flow_item *item,
 	return 0;
 }
 
-static int
-ch_rte_parsetype_vf(const void *dmask, const struct rte_flow_item *item,
-		    struct ch_filter_specification *fs,
-		    struct rte_flow_error *e)
-{
-	const struct rte_flow_item_vf *umask = item->mask;
-	const struct rte_flow_item_vf *val = item->spec;
-	const struct rte_flow_item_vf *mask;
-
-	/* If user has not given any mask, then use chelsio supported mask. */
-	mask = umask ? umask : (const struct rte_flow_item_vf *)dmask;
-
-	CXGBE_FILL_FS(1, 1, pfvf_vld);
-
-	if (!val)
-		return 0; /* Wildcard, match all Vf */
-
-	if (val->id > UCHAR_MAX)
-		return rte_flow_error_set(e, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ITEM,
-					  item,
-					  "VF ID > MAX(255)");
-
-	if (val->id || (umask && umask->id))
-		CXGBE_FILL_FS(val->id, mask->id, vf);
-
-	return 0;
-}
-
 static int
 ch_rte_parsetype_udp(const void *dmask, const struct rte_flow_item *item,
 		     struct ch_filter_specification *fs,
@@ -1005,13 +976,6 @@ static struct chrte_fparse parseitem[] = {
 		.fptr  = ch_rte_parsetype_tcp,
 		.dmask = &rte_flow_item_tcp_mask,
 	},
-
-	[RTE_FLOW_ITEM_TYPE_VF] = {
-		.fptr = ch_rte_parsetype_vf,
-		.dmask = &(const struct rte_flow_item_vf){
-			.id = 0xffffffff,
-		}
-	},
 };
 
 static int
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 4f3808cb5f..65a826d51c 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -62,7 +62,6 @@ static int i40e_flow_parse_ethertype_action(struct rte_eth_dev *dev,
 				    struct rte_flow_error *error,
 				    struct rte_eth_ethertype_filter *filter);
 static int i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
-					const struct rte_flow_attr *attr,
 					const struct rte_flow_item *pattern,
 					struct rte_flow_error *error,
 					struct i40e_fdir_filter_conf *filter);
@@ -148,1171 +147,508 @@ const struct rte_flow_ops i40e_flow_ops = {
 
 static union i40e_filter_t cons_filter;
 static enum rte_filter_type cons_filter_type = RTE_ETH_FILTER_NONE;
-/* internal pattern w/o VOID items */
-struct rte_flow_item g_items[32];
-
-/* Pattern matched ethertype filter */
-static enum rte_flow_item_type pattern_ethertype[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-/* Pattern matched flow director filter */
-static enum rte_flow_item_type pattern_fdir_ipv4[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_udp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_tcp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_sctp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_gtpc[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_GTPC,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_gtpu[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_GTPU,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_gtpu_ipv4[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_GTPU,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_gtpu_ipv6[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_GTPU,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_udp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_tcp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_sctp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_gtpc[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_GTPC,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_gtpu[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_GTPU,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_gtpu_ipv4[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_GTPU,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_gtpu_ipv6[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_GTPU,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ethertype_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ethertype_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ethertype_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ethertype_vlan[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
+/* internal pattern w/o VOID items */
+struct rte_flow_item g_items[32];
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_3[] = {
+/* Pattern matched ethertype filter */
+static enum rte_flow_item_type pattern_ethertype[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_1[] = {
+/* Pattern matched flow director filter */
+static enum rte_flow_item_type pattern_fdir_ipv4[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_2[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_udp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
+	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_3[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_tcp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_1[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_sctp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_2[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_gtpc[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_GTPC,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_3[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_gtpu[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_2[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_3[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
+	RTE_FLOW_ITEM_TYPE_GTPU,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_2[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_gtpu_ipv4[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
+	RTE_FLOW_ITEM_TYPE_GTPU,
+	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_3[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_gtpu_ipv6[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_1[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
+	RTE_FLOW_ITEM_TYPE_GTPU,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_2[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_3[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_udp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
+	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_1[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_tcp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
+	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_2[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_sctp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_3[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_gtpc[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_vf[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_VF,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_udp_vf[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_VF,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_tcp_vf[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_VF,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv4_sctp_vf[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
-	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_VF,
+	RTE_FLOW_ITEM_TYPE_GTPC,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_gtpu[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_VF,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_GTPU,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_udp_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_gtpu_ipv4[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_VF,
+	RTE_FLOW_ITEM_TYPE_GTPU,
+	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_tcp_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_gtpu_ipv6[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_VF,
-	RTE_FLOW_ITEM_TYPE_END,
-};
-
-static enum rte_flow_item_type pattern_fdir_ipv6_sctp_vf[] = {
-	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_GTPU,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ethertype_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ethertype_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ethertype_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ethertype_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ethertype_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ethertype_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ethertype_vlan_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ethertype_vlan[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_UDP,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_TCP,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_SCTP,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
@@ -1320,32 +656,29 @@ static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_3_vf[] = {
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
@@ -1353,32 +686,29 @@ static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_3_vf[] = {
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV4,
@@ -1386,62 +716,56 @@ static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_3_vf[] = {
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_UDP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
@@ -1449,32 +773,29 @@ static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_3_vf[] = {
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_TCP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
@@ -1482,32 +803,29 @@ static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_3_vf[] = {
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_1_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_1[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_2_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_2[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_SCTP,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
-static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_3_vf[] = {
+static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_3[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_IPV6,
@@ -1515,7 +833,6 @@ static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_3_vf[] = {
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
 	RTE_FLOW_ITEM_TYPE_RAW,
-	RTE_FLOW_ITEM_TYPE_VF,
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
@@ -1765,78 +1082,6 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_vlan_ipv6_sctp_raw_1, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_vlan_ipv6_sctp_raw_2, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_vlan_ipv6_sctp_raw_3, i40e_flow_parse_fdir_filter },
-	/* FDIR - support VF item */
-	{ pattern_fdir_ipv4_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_udp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_tcp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_sctp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_udp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_tcp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_sctp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ethertype_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ethertype_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ethertype_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_udp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_udp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_udp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_tcp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_tcp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_tcp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_sctp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_sctp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv4_sctp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_udp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_udp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_udp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_tcp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_tcp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_tcp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_sctp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_sctp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ipv6_sctp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ethertype_vlan_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_udp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_tcp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_sctp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_udp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_tcp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_sctp_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ethertype_vlan_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ethertype_vlan_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_ethertype_vlan_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_udp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_udp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_udp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_tcp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_tcp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_tcp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_sctp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_sctp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv4_sctp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_udp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_udp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_udp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_tcp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_tcp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_tcp_raw_3_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_sctp_raw_1_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_sctp_raw_2_vf, i40e_flow_parse_fdir_filter },
-	{ pattern_fdir_vlan_ipv6_sctp_raw_3_vf, i40e_flow_parse_fdir_filter },
 	/* VXLAN */
 	{ pattern_vxlan_1, i40e_flow_parse_vxlan_filter },
 	{ pattern_vxlan_2, i40e_flow_parse_vxlan_filter },
@@ -2348,7 +1593,6 @@ i40e_flow_set_filter_spi(struct i40e_fdir_filter_conf *filter,
  */
 static int
 i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
-			     const struct rte_flow_attr *attr,
 			     const struct rte_flow_item *pattern,
 			     struct rte_flow_error *error,
 			     struct i40e_fdir_filter_conf *filter)
@@ -2365,7 +1609,6 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
 	const struct rte_flow_item_esp *esp_spec, *esp_mask;
 	const struct rte_flow_item_raw *raw_spec, *raw_mask;
-	const struct rte_flow_item_vf *vf_spec;
 	const struct rte_flow_item_l2tpv3oip *l2tpv3oip_spec, *l2tpv3oip_mask;
 
 	uint8_t pctype = 0;
@@ -3067,29 +2310,6 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 			filter->input.flow_ext.raw_id = raw_id;
 			filter->input.flow_ext.is_flex_flow = true;
 			break;
-		case RTE_FLOW_ITEM_TYPE_VF:
-			vf_spec = item->spec;
-			if (!attr->transfer) {
-				rte_flow_error_set(error, ENOTSUP,
-						   RTE_FLOW_ERROR_TYPE_ITEM,
-						   item,
-						   "Matching VF traffic"
-						   " without affecting it"
-						   " (transfer attribute)"
-						   " is unsupported");
-				return -rte_errno;
-			}
-			filter->input.flow_ext.is_vf = 1;
-			filter->input.flow_ext.dst_id = vf_spec->id;
-			if (filter->input.flow_ext.is_vf &&
-			    filter->input.flow_ext.dst_id >= pf->vf_num) {
-				rte_flow_error_set(error, EINVAL,
-						   RTE_FLOW_ERROR_TYPE_ITEM,
-						   item,
-						   "Invalid VF ID for FDIR.");
-				return -rte_errno;
-			}
-			break;
 		case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
 			l2tpv3oip_spec = item->spec;
 			l2tpv3oip_mask = item->mask;
@@ -3277,8 +2497,7 @@ i40e_flow_parse_fdir_filter(struct rte_eth_dev *dev,
 		&filter->fdir_filter;
 	int ret;
 
-	ret = i40e_flow_parse_fdir_pattern(dev, attr, pattern, error,
-					   fdir_filter);
+	ret = i40e_flow_parse_fdir_pattern(dev, pattern, error, fdir_filter);
 	if (ret)
 		return ret;
 
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index e8da2d2a0d..06de659ee2 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -1685,71 +1685,6 @@ sfc_mae_rule_parse_item_phy_port(const struct rte_flow_item *item,
 	return 0;
 }
 
-static int
-sfc_mae_rule_parse_item_vf(const struct rte_flow_item *item,
-			   struct sfc_flow_parse_ctx *ctx,
-			   struct rte_flow_error *error)
-{
-	struct sfc_mae_parse_ctx *ctx_mae = ctx->mae;
-	const efx_nic_cfg_t *encp = efx_nic_cfg_get(ctx_mae->sa->nic);
-	const struct rte_flow_item_vf supp_mask = {
-		.id = 0xffffffff,
-	};
-	const void *def_mask = &rte_flow_item_vf_mask;
-	const struct rte_flow_item_vf *spec = NULL;
-	const struct rte_flow_item_vf *mask = NULL;
-	efx_mport_sel_t mport_v;
-	int rc;
-
-	if (ctx_mae->match_mport_set) {
-		return rte_flow_error_set(error, ENOTSUP,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Can't handle multiple traffic source items");
-	}
-
-	rc = sfc_flow_parse_init(item,
-				 (const void **)&spec, (const void **)&mask,
-				 (const void *)&supp_mask, def_mask,
-				 sizeof(struct rte_flow_item_vf), error);
-	if (rc != 0)
-		return rc;
-
-	if (mask->id != supp_mask.id) {
-		return rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Bad mask in the VF pattern item");
-	}
-
-	/*
-	 * If "spec" is not set, the item requests any VF related to the
-	 * PF of the current DPDK port (but not the PF itself).
-	 * Reject this match criterion as unsupported.
-	 */
-	if (spec == NULL) {
-		return rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Bad spec in the VF pattern item");
-	}
-
-	rc = efx_mae_mport_by_pcie_function(encp->enc_pf, spec->id, &mport_v);
-	if (rc != 0) {
-		return rte_flow_error_set(error, rc,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Failed to convert the PF + VF IDs");
-	}
-
-	rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec, &mport_v, NULL);
-	if (rc != 0) {
-		return rte_flow_error_set(error, rc,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Failed to set MPORT for the PF + VF");
-	}
-
-	ctx_mae->match_mport_set = B_TRUE;
-
-	return 0;
-}
-
 /*
  * Having this field ID in a field locator means that this
  * locator cannot be used to actually set the field at the
@@ -2555,18 +2490,6 @@ static const struct sfc_flow_item sfc_flow_items[] = {
 		.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
 		.parse = sfc_mae_rule_parse_item_phy_port,
 	},
-	{
-		.type = RTE_FLOW_ITEM_TYPE_VF,
-		.name = "VF",
-		/*
-		 * In terms of RTE flow, this item is a META one,
-		 * and its position in the pattern is don't care.
-		 */
-		.prev_layer = SFC_FLOW_ITEM_ANY_LAYER,
-		.layer = SFC_FLOW_ITEM_ANY_LAYER,
-		.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
-		.parse = sfc_mae_rule_parse_item_vf,
-	},
 	{
 		.type = RTE_FLOW_ITEM_TYPE_ETH,
 		.name = "ETH",
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 6ece72bf36..65c74687e3 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -97,7 +97,6 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(VOID, 0),
 	MK_FLOW_ITEM(INVERT, 0),
 	MK_FLOW_ITEM(ANY, sizeof(struct rte_flow_item_any)),
-	MK_FLOW_ITEM(VF, sizeof(struct rte_flow_item_vf)),
 	MK_FLOW_ITEM(PHY_PORT, sizeof(struct rte_flow_item_phy_port)),
 	MK_FLOW_ITEM(PORT_ID, sizeof(struct rte_flow_item_port_id)),
 	MK_FLOW_ITEM(RAW, sizeof(struct rte_flow_item_raw)),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 97de98e232..0a98db9c1c 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -188,20 +188,6 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_ANY,
 
-	/**
-	 * @deprecated
-	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
-	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
-	 *
-	 * [META]
-	 *
-	 * Matches traffic originating from (ingress) or going to (egress) a
-	 * given virtual function of the current device.
-	 *
-	 * See struct rte_flow_item_vf.
-	 */
-	RTE_FLOW_ITEM_TYPE_VF,
-
 	/**
 	 * @deprecated
 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
@@ -700,38 +686,6 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = {
 };
 #endif
 
-/**
- * @deprecated
- * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
- * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
- *
- * RTE_FLOW_ITEM_TYPE_VF
- *
- * Matches traffic originating from (ingress) or going to (egress) a given
- * virtual function of the current device.
- *
- * If supported, should work even if the virtual function is not managed by
- * the application and thus not associated with a DPDK port ID.
- *
- * Note this pattern item does not match VF representors traffic which, as
- * separate entities, should be addressed through their own DPDK port IDs.
- *
- * - Can be specified multiple times to match traffic addressed to several
- *   VF IDs.
- *
- * A zeroed mask can be used to match any VF ID.
- */
-struct rte_flow_item_vf {
-	uint32_t id; /**< VF ID. */
-};
-
-/** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
-#ifndef __cplusplus
-static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
-	.id = 0x00000000,
-};
-#endif
-
 /**
  * @deprecated
  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
-- 
2.30.2


^ permalink raw reply	[relevance 1%]

* [PATCH 10/13] ethdev: remove deprecated flow item PF
    2022-08-12 19:18  4% ` [PATCH 02/13] ethdev: strip experimental tag off port ID items and actions Ivan Malov
  2022-08-12 19:18  4% ` [PATCH 03/13] ethdev: remove experimental tag from flow transfer proxy API Ivan Malov
@ 2022-08-12 19:18  5% ` Ivan Malov
  2022-08-22  5:32  0%   ` Ori Kam
  2022-08-12 19:18  1% ` [PATCH 11/13] ethdev: remove deprecated flow item VF Ivan Malov
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 200+ results
From: Ivan Malov @ 2022-08-12 19:18 UTC (permalink / raw)
  To: dev
  Cc: Ori Kam, Eli Britstein, Ilya Maximets, Thomas Monjalon,
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Aman Singh,
	Yuying Zhang, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
	Ferruh Yigit

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>
---
 app/test-pmd/cmdline_flow.c                   |  9 ----
 doc/guides/nics/features/bnxt.ini             |  1 -
 doc/guides/nics/features/cxgbe.ini            |  1 -
 doc/guides/nics/features/default.ini          |  1 -
 doc/guides/nics/features/sfc.ini              |  1 -
 doc/guides/nics/sfc_efx.rst                   |  2 -
 doc/guides/prog_guide/rte_flow.rst            | 34 -------------
 .../prog_guide/switch_representation.rst      | 14 ------
 doc/guides/rel_notes/release_22_11.rst        |  5 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  2 -
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |  4 --
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      | 25 ----------
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |  5 --
 drivers/net/cxgbe/cxgbe_flow.c                | 21 --------
 drivers/net/sfc/sfc_mae.c                     | 48 -------------------
 lib/ethdev/rte_flow.c                         |  1 -
 lib/ethdev/rte_flow.h                         | 15 ------
 17 files changed, 5 insertions(+), 184 deletions(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 23889f7ab1..2722d5a48d 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -249,7 +249,6 @@ enum index {
 	ITEM_INVERT,
 	ITEM_ANY,
 	ITEM_ANY_NUM,
-	ITEM_PF,
 	ITEM_VF,
 	ITEM_VF_ID,
 	ITEM_PHY_PORT,
@@ -1278,7 +1277,6 @@ static const enum index next_item[] = {
 	ITEM_VOID,
 	ITEM_INVERT,
 	ITEM_ANY,
-	ITEM_PF,
 	ITEM_VF,
 	ITEM_PHY_PORT,
 	ITEM_PORT_ID,
@@ -3461,13 +3459,6 @@ static const struct token token_list[] = {
 		.next = NEXT(item_any, NEXT_ENTRY(COMMON_UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_any, num)),
 	},
-	[ITEM_PF] = {
-		.name = "pf",
-		.help = "match traffic from/to the physical function",
-		.priv = PRIV_ITEM(PF, 0),
-		.next = NEXT(NEXT_ENTRY(ITEM_NEXT)),
-		.call = parse_vc,
-	},
 	[ITEM_VF] = {
 		.name = "vf",
 		.help = "match traffic from/to a virtual function ID",
diff --git a/doc/guides/nics/features/bnxt.ini b/doc/guides/nics/features/bnxt.ini
index afb5414b49..259480d1df 100644
--- a/doc/guides/nics/features/bnxt.ini
+++ b/doc/guides/nics/features/bnxt.ini
@@ -63,7 +63,6 @@ ipv6                 = Y
 gre                  = Y
 icmp                 = Y
 icmp6                = Y
-pf                   = Y
 phy_port             = Y
 port_id              = Y
 port_representor     = Y
diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini
index f674803ec4..d869f2100f 100644
--- a/doc/guides/nics/features/cxgbe.ini
+++ b/doc/guides/nics/features/cxgbe.ini
@@ -39,7 +39,6 @@ Usage doc            = Y
 eth                  = Y
 ipv4                 = Y
 ipv6                 = Y
-pf                   = Y
 phy_port             = Y
 tcp                  = Y
 udp                  = Y
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index d1db0c256a..aff236134e 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -121,7 +121,6 @@ meta                 =
 mpls                 =
 nsh                  =
 nvgre                =
-pf                   =
 pfcp                 =
 phy_port             =
 port_id              =
diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini
index 2e798b5ef5..355174d5c2 100644
--- a/doc/guides/nics/features/sfc.ini
+++ b/doc/guides/nics/features/sfc.ini
@@ -47,7 +47,6 @@ ipv4                 = Y
 ipv6                 = Y
 mark                 = P
 nvgre                = Y
-pf                   = Y
 phy_port             = Y
 port_id              = Y
 port_representor     = Y
diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 39c6e23d5b..2dbc59e8f7 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -200,8 +200,6 @@ Supported pattern items (***transfer*** rules):
 
 - PHY_PORT (cannot repeat; conflicts with other traffic source items)
 
-- PF (cannot repeat; conflicts with other traffic source items)
-
 - VF (cannot repeat; conflicts with other traffic source items)
 
 - ETH
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 588914b231..72f0c3d346 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -535,37 +535,6 @@ Usage example, matching non-TCPv4 packets only:
    | 4     | END      |
    +-------+----------+
 
-Item: ``PF``
-^^^^^^^^^^^^
-
-This item is deprecated. Consider:
- - `Item: PORT_REPRESENTOR`_
- - `Item: REPRESENTED_PORT`_
-
-Matches traffic originating from (ingress) or going to (egress) the physical
-function of the current device.
-
-If supported, should work even if the physical function is not managed by
-the application and thus not associated with a DPDK port ID.
-
-- Can be combined with any number of `Item: VF`_ to match both PF and VF
-  traffic.
-- ``spec``, ``last`` and ``mask`` must not be set.
-
-.. _table_rte_flow_item_pf:
-
-.. table:: PF
-
-   +----------+-------+
-   | Field    | Value |
-   +==========+=======+
-   | ``spec`` | unset |
-   +----------+-------+
-   | ``last`` | unset |
-   +----------+-------+
-   | ``mask`` | unset |
-   +----------+-------+
-
 Item: ``VF``
 ^^^^^^^^^^^^
 
@@ -584,7 +553,6 @@ separate entities, should be addressed through their own DPDK port IDs.
 
 - Can be specified multiple times to match traffic addressed to several VF
   IDs.
-- Can be combined with a PF item to match both PF and VF traffic.
 - Default ``mask`` matches any VF ID.
 
 .. _table_rte_flow_item_vf:
@@ -2074,8 +2042,6 @@ This action is deprecated. Consider:
 Directs matching traffic to the physical function (PF) of the current
 device.
 
-See `Item: PF`_.
-
 - No configurable properties.
 
 .. _table_rte_flow_action_pf:
diff --git a/doc/guides/prog_guide/switch_representation.rst b/doc/guides/prog_guide/switch_representation.rst
index 3da30fc779..6fd7b98bdc 100644
--- a/doc/guides/prog_guide/switch_representation.rst
+++ b/doc/guides/prog_guide/switch_representation.rst
@@ -624,25 +624,11 @@ Same restrictions as `PORT_ID pattern item`_.
 
 - Targets **A**, **B** or **C** in `traffic steering`_.
 
-PF Pattern Item
-^^^^^^^^^^^^^^^
-
-Matches traffic originating from (ingress) or going to (egress) the physical
-function of the current device.
-
-If supported, should work even if the physical function is not managed by
-the application and thus not associated with a DPDK port ID. Its behavior is
-otherwise similar to `PORT_ID pattern item`_ using PF port ID.
-
-- Matches **A** in `traffic steering`_.
-
 PF Action
 ^^^^^^^^^
 
 Directs matching traffic to the physical function of the current device.
 
-Same restrictions as `PF pattern item`_.
-
 - Targets **A** in `traffic steering`_.
 
 VF Pattern Item
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index c4ce32daed..b7469708af 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -76,6 +76,9 @@ Removed Items
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* ethdev: removed ``RTE_FLOW_ITEM_TYPE_PF``;
+  use ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``.
+
 
 API Changes
 -----------
@@ -122,6 +125,8 @@ ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* ethdev: enum ``RTE_FLOW_ITEM`` was affected by deprecation procedure.
+
 
 Known Issues
 ------------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index c105200fe7..4446560369 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3665,8 +3665,6 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``num {unsigned}``: number of layers covered.
 
-- ``pf``: match traffic from/to the physical function.
-
 - ``vf``: match traffic from/to a virtual function ID.
 
   - ``id {unsigned}``: VF ID.
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 e9337ecd2c..17216426d8 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
@@ -260,10 +260,6 @@ struct bnxt_ulp_rte_hdr_info ulp_hdr_info[] = {
 	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
 	.proto_hdr_func          = ulp_rte_item_any_handler
 	},
-	[RTE_FLOW_ITEM_TYPE_PF] = {
-	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
-	.proto_hdr_func          = ulp_rte_pf_hdr_handler
-	},
 	[RTE_FLOW_ITEM_TYPE_VF] = {
 	.hdr_type                = BNXT_ULP_HDR_TYPE_SUPPORTED,
 	.proto_hdr_func          = ulp_rte_vf_hdr_handler
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 9edf3e8799..6a1d235f77 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -507,31 +507,6 @@ ulp_rte_parser_implicit_act_port_process(struct ulp_rte_parser_params *params)
 	return BNXT_TF_RC_SUCCESS;
 }
 
-/* Function to handle the parsing of RTE Flow item PF Header. */
-int32_t
-ulp_rte_pf_hdr_handler(const struct rte_flow_item *item __rte_unused,
-		       struct ulp_rte_parser_params *params)
-{
-	uint16_t port_id = 0;
-	uint16_t svif_mask = 0xFFFF;
-	uint32_t ifindex;
-
-	/* Get the implicit port id */
-	port_id = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_INCOMING_IF);
-
-	/* perform the conversion from dpdk port to bnxt ifindex */
-	if (ulp_port_db_dev_port_to_ulp_index(params->ulp_ctx,
-					      port_id,
-					      &ifindex)) {
-		BNXT_TF_DBG(ERR, "ParseErr:Portid is not valid\n");
-		return BNXT_TF_RC_ERROR;
-	}
-
-	/* Update the SVIF details */
-	return ulp_rte_parser_svif_set(params, ifindex, svif_mask,
-				       BNXT_ULP_DIR_INVALID);
-}
-
 /* Function to handle the parsing of RTE Flow item VF Header. */
 int32_t
 ulp_rte_vf_hdr_handler(const struct rte_flow_item *item,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
index e4225d00f8..94918f6b4a 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
@@ -80,11 +80,6 @@ bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action actions[],
 void
 bnxt_ulp_rte_parser_post_process(struct ulp_rte_parser_params *params);
 
-/* Function to handle the parsing of RTE Flow item PF Header. */
-int32_t
-ulp_rte_pf_hdr_handler(const struct rte_flow_item *item,
-		       struct ulp_rte_parser_params *params);
-
 /* Function to handle the parsing of RTE Flow item VF Header. */
 int32_t
 ulp_rte_vf_hdr_handler(const struct rte_flow_item *item,
diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c
index 6e460dfe2e..e4f9c152b5 100644
--- a/drivers/net/cxgbe/cxgbe_flow.c
+++ b/drivers/net/cxgbe/cxgbe_flow.c
@@ -288,22 +288,6 @@ ch_rte_parsetype_vlan(const void *dmask, const struct rte_flow_item *item,
 	return 0;
 }
 
-static int
-ch_rte_parsetype_pf(const void *dmask __rte_unused,
-		    const struct rte_flow_item *item __rte_unused,
-		    struct ch_filter_specification *fs,
-		    struct rte_flow_error *e __rte_unused)
-{
-	struct rte_flow *flow = (struct rte_flow *)fs->private;
-	struct rte_eth_dev *dev = flow->dev;
-	struct adapter *adap = ethdev2adap(dev);
-
-	CXGBE_FILL_FS(1, 1, pfvf_vld);
-
-	CXGBE_FILL_FS(adap->pf, 0x7, pf);
-	return 0;
-}
-
 static int
 ch_rte_parsetype_vf(const void *dmask, const struct rte_flow_item *item,
 		    struct ch_filter_specification *fs,
@@ -1022,11 +1006,6 @@ static struct chrte_fparse parseitem[] = {
 		.dmask = &rte_flow_item_tcp_mask,
 	},
 
-	[RTE_FLOW_ITEM_TYPE_PF] = {
-		.fptr = ch_rte_parsetype_pf,
-		.dmask = NULL,
-	},
-
 	[RTE_FLOW_ITEM_TYPE_VF] = {
 		.fptr = ch_rte_parsetype_vf,
 		.dmask = &(const struct rte_flow_item_vf){
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index eb197fbdeb..e8da2d2a0d 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -1685,42 +1685,6 @@ sfc_mae_rule_parse_item_phy_port(const struct rte_flow_item *item,
 	return 0;
 }
 
-static int
-sfc_mae_rule_parse_item_pf(const struct rte_flow_item *item,
-			   struct sfc_flow_parse_ctx *ctx,
-			   struct rte_flow_error *error)
-{
-	struct sfc_mae_parse_ctx *ctx_mae = ctx->mae;
-	const efx_nic_cfg_t *encp = efx_nic_cfg_get(ctx_mae->sa->nic);
-	efx_mport_sel_t mport_v;
-	int rc;
-
-	if (ctx_mae->match_mport_set) {
-		return rte_flow_error_set(error, ENOTSUP,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Can't handle multiple traffic source items");
-	}
-
-	rc = efx_mae_mport_by_pcie_function(encp->enc_pf, EFX_PCI_VF_INVALID,
-					    &mport_v);
-	if (rc != 0) {
-		return rte_flow_error_set(error, rc,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Failed to convert the PF ID");
-	}
-
-	rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec, &mport_v, NULL);
-	if (rc != 0) {
-		return rte_flow_error_set(error, rc,
-				RTE_FLOW_ERROR_TYPE_ITEM, item,
-				"Failed to set MPORT for the PF");
-	}
-
-	ctx_mae->match_mport_set = B_TRUE;
-
-	return 0;
-}
-
 static int
 sfc_mae_rule_parse_item_vf(const struct rte_flow_item *item,
 			   struct sfc_flow_parse_ctx *ctx,
@@ -2591,18 +2555,6 @@ static const struct sfc_flow_item sfc_flow_items[] = {
 		.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
 		.parse = sfc_mae_rule_parse_item_phy_port,
 	},
-	{
-		.type = RTE_FLOW_ITEM_TYPE_PF,
-		.name = "PF",
-		/*
-		 * In terms of RTE flow, this item is a META one,
-		 * and its position in the pattern is don't care.
-		 */
-		.prev_layer = SFC_FLOW_ITEM_ANY_LAYER,
-		.layer = SFC_FLOW_ITEM_ANY_LAYER,
-		.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
-		.parse = sfc_mae_rule_parse_item_pf,
-	},
 	{
 		.type = RTE_FLOW_ITEM_TYPE_VF,
 		.name = "VF",
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 501be9d602..6ece72bf36 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -97,7 +97,6 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(VOID, 0),
 	MK_FLOW_ITEM(INVERT, 0),
 	MK_FLOW_ITEM(ANY, sizeof(struct rte_flow_item_any)),
-	MK_FLOW_ITEM(PF, 0),
 	MK_FLOW_ITEM(VF, sizeof(struct rte_flow_item_vf)),
 	MK_FLOW_ITEM(PHY_PORT, sizeof(struct rte_flow_item_phy_port)),
 	MK_FLOW_ITEM(PORT_ID, sizeof(struct rte_flow_item_port_id)),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index bc68fd5631..97de98e232 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -188,20 +188,6 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_ANY,
 
-	/**
-	 * @deprecated
-	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
-	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
-	 *
-	 * [META]
-	 *
-	 * Matches traffic originating from (ingress) or going to (egress)
-	 * the physical function of the current device.
-	 *
-	 * No associated specification structure.
-	 */
-	RTE_FLOW_ITEM_TYPE_PF,
-
 	/**
 	 * @deprecated
 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
@@ -732,7 +718,6 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = {
  *
  * - Can be specified multiple times to match traffic addressed to several
  *   VF IDs.
- * - Can be combined with a PF item to match both PF and VF traffic.
  *
  * A zeroed mask can be used to match any VF ID.
  */
-- 
2.30.2


^ permalink raw reply	[relevance 5%]

* [PATCH 03/13] ethdev: remove experimental tag from flow transfer proxy API
    2022-08-12 19:18  4% ` [PATCH 02/13] ethdev: strip experimental tag off port ID items and actions Ivan Malov
@ 2022-08-12 19:18  4% ` Ivan Malov
  2022-08-15 12:58  0%   ` Ori Kam
  2022-08-12 19:18  5% ` [PATCH 10/13] ethdev: remove deprecated flow item PF Ivan Malov
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 200+ results
From: Ivan Malov @ 2022-08-12 19:18 UTC (permalink / raw)
  To: dev
  Cc: Ori Kam, Eli Britstein, Ilya Maximets, Thomas Monjalon,
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Ferruh Yigit,
	Ray Kinsella

rte_flow_pick_transfer_proxy() was first added to DPDK 21.11.
Since then, no one has requested any fixes. At the same time,
the API is required by series [1] in OvS for the new release.

[1] http://patchwork.ozlabs.org/project/openvswitch/list/?series=310415

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 doc/guides/rel_notes/release_22_11.rst | 3 +++
 lib/ethdev/rte_flow.h                  | 4 ----
 lib/ethdev/version.map                 | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index f039b857e2..b74e90d27f 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -95,6 +95,9 @@ API Changes
   - ``RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR``
   - ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``
 
+* ethdev: promoted ``rte_flow_pick_transfer_proxy()``
+  from experimental to stable.
+
 
 ABI Changes
 -----------
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index e5d2d87403..bc68fd5631 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -4792,9 +4792,6 @@ rte_flow_tunnel_item_release(uint16_t port_id,
 			     struct rte_flow_error *error);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Get a proxy port to manage "transfer" flows.
  *
  * Managing "transfer" flows requires that the user communicate them
@@ -4819,7 +4816,6 @@ rte_flow_tunnel_item_release(uint16_t port_id,
  * @return
  *   0 on success, a negative error code otherwise
  */
-__rte_experimental
 int
 rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
 			     struct rte_flow_error *error);
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 2ecc1af571..25e54f9d3e 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -132,6 +132,7 @@ DPDK_23 {
 	rte_flow_error_set;
 	rte_flow_flush;
 	rte_flow_isolate;
+	rte_flow_pick_transfer_proxy;
 	rte_flow_query;
 	rte_flow_validate;
 
@@ -253,7 +254,6 @@ EXPERIMENTAL {
 	rte_eth_macaddrs_get;
 	rte_flow_flex_item_create;
 	rte_flow_flex_item_release;
-	rte_flow_pick_transfer_proxy;
 
 	# added in 22.03
 	rte_eth_dev_priority_flow_ctrl_queue_configure;
-- 
2.30.2


^ permalink raw reply	[relevance 4%]

* [PATCH 02/13] ethdev: strip experimental tag off port ID items and actions
  @ 2022-08-12 19:18  4% ` Ivan Malov
  2022-08-15 12:59  0%   ` Ori Kam
  2022-08-12 19:18  4% ` [PATCH 03/13] ethdev: remove experimental tag from flow transfer proxy API Ivan Malov
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 200+ results
From: Ivan Malov @ 2022-08-12 19:18 UTC (permalink / raw)
  To: dev
  Cc: Ori Kam, Eli Britstein, Ilya Maximets, Thomas Monjalon,
	Stephen Hemminger, Jerin Jacob, Andrew Rybchenko, Ferruh Yigit

The following set of primitives has been introduced in 21.11:

- RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
- RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
- RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
- RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT

Since then, no one has requested any fixes. At the same time,
the set is required by series [1] in OvS for the new release.

[1] http://patchwork.ozlabs.org/project/openvswitch/list/?series=310415

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 doc/guides/rel_notes/release_22_11.rst | 8 ++++++++
 lib/ethdev/rte_flow.h                  | 6 ------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 6760ab8b87..f039b857e2 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -87,6 +87,14 @@ API Changes
 * ethdev: promoted ``rte_eth_rx_metadata_negotiate()``
   from experimental to stable.
 
+* ethdev: promoted the following flow primitives
+  from experimental to stable:
+
+  - ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR``
+  - ``RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT``
+  - ``RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR``
+  - ``RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT``
+
 
 ABI Changes
 -----------
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index a79f1e7ef0..e5d2d87403 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -1918,9 +1918,6 @@ static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = {
 #endif
 
 /**
- * @warning
- * @b EXPERIMENTAL: this structure may change without prior notice
- *
  * Provides an ethdev port ID for use with the following items:
  * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
  * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT.
@@ -3643,9 +3640,6 @@ struct rte_flow_action_meter_color {
 };
 
 /**
- * @warning
- * @b EXPERIMENTAL: this structure may change without prior notice
- *
  * Provides an ethdev port ID for use with the following actions:
  * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
  * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT.
-- 
2.30.2


^ permalink raw reply	[relevance 4%]

Results 1801-2000 of ~18000   |  | 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-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 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-07-06  0:23     ` [PATCH v4 0/7] bbdev changes for 22.11 Nicolas Chautru
2022-07-06  0:23       ` [PATCH v4 2/7] bbdev: add device status info Nicolas Chautru
2022-07-06 15:38         ` Tom Rix
2022-07-06 21:16           ` Chautru, Nicolas
2022-08-25 14:08  3%         ` Maxime Coquelin
2022-07-06 23:28     ` [PATCH v5 0/7] bbdev changes for 22.11 Nicolas Chautru
2022-07-06 23:28       ` [PATCH v5 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
2022-08-25 13:54  0%     ` Maxime Coquelin
2022-07-06 23:28       ` [PATCH v5 2/7] bbdev: add device status info Nicolas Chautru
2022-08-25 14:18         ` Maxime Coquelin
2022-08-25 18:30           ` Chautru, Nicolas
2022-08-26 10:12             ` Maxime Coquelin
2022-08-29 16:10               ` Chautru, Nicolas
2022-08-30  7:08  3%             ` Maxime Coquelin
2022-08-30 19:38  0%               ` Chautru, Nicolas
2022-08-15 17:54  0%   ` [PATCH v5 0/7] bbdev changes for 22.11 Chautru, Nicolas
2022-08-25 18:24     ` [PATCH v6 " Nicolas Chautru
2022-08-25 18:24  3%   ` [PATCH v6 1/7] bbdev: allow operation type enum for growth Nicolas Chautru
2022-08-29 18:07     ` [PATCH v7 0/7] bbdev changes for 22.11 Nicolas Chautru
2022-08-29 18:07  3%   ` [PATCH v7 1/7] bbdev: allow operation type enum for growth 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  3%     ` [EXT] " Akhil Goyal
2022-09-21 20:57  0%       ` Chautru, Nicolas
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  4%             ` 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-21 21:02     ` [PATCH v8 0/7] bbdev changes for 22.11 Nic Chautru
2022-09-21 21:02  3%   ` [PATCH v8 1/7] bbdev: allow operation type enum for growth Nic Chautru
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-27  9:32     [Bug 1042] [dpdk-22.07](ABI) unit_tests_eal/link_bonding_rssconf: link_bonding_rssconf_autotest test failed bugzilla
2022-08-19  8:45  4% ` bugzilla
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  3%       ` Walker, Benjamin
2022-08-30 15:09  5%         ` David Marchand
2022-09-21 22:29  3%           ` Harris, James R
2022-09-23  7:13  0%             ` David Marchand
2022-09-23 21:56  0%               ` Harris, James R
2022-08-26 12:41  1% ` [PATCH v4 00/27] " David Marchand
2022-08-26 12:41  4%   ` [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor David Marchand
2022-08-26 12:42  3%   ` [PATCH v4 21/27] bus: hide bus object David Marchand
2022-08-26 12:42  1%   ` [PATCH v4 23/27] dev: hide driver object David Marchand
2022-08-26 12:42  2%   ` [PATCH v4 27/27] dev: hide device object David Marchand
2022-09-05  8:35  1% ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
2022-09-05  8:35  4%   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
2022-09-05  8:39  0%   ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
2022-09-05  8:39  1% ` David Marchand
2022-09-05  8:39  4%   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
2022-09-05  8:39  3%   ` [PATCH v5 21/27] bus: hide bus object David Marchand
2022-09-05  8:39  1%   ` [PATCH v5 23/27] dev: hide driver object David Marchand
2022-09-06  6:05  0%     ` [EXT] " Akhil Goyal
2022-09-06  6:46  0%     ` Gujjar, Abhinandan S
2022-09-05  8:39  2%   ` [PATCH v5 27/27] dev: hide device object David Marchand
2022-09-14  7:58  1% ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
2022-09-14  7:58  4%   ` [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor David Marchand
2022-09-14  7:58  3%   ` [PATCH v6 21/27] bus: hide bus object David Marchand
2022-09-14  7:58  1%   ` [PATCH v6 23/27] dev: hide driver object David Marchand
2022-09-14  7:58  2%   ` [PATCH v6 27/27] dev: hide device object David Marchand
2022-09-24  7:14  0%   ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
2022-07-13 13:03     [dpdk-dev] [PATCH v1] ethdev: support congestion management jerinj
2022-09-19 12:15  2% ` [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
2022-08-30 12:41  3% ` Dmitry Kozlyuk
2022-09-20  3:46     ` [PATCH 0/8] introduce memarea library Chengwen Feng
2022-09-20  3:46       ` [PATCH 1/8] memarea: introduce memory area library Chengwen Feng
2022-09-20 11:30  4%     ` Dmitry Kozlyuk
2022-09-20 12:06  3%       ` fengchengwen
     [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  5:13     Reason to alway to build both static and shared libs Jianshen Liu
2022-08-22 11:23  3% ` Bruce Richardson
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-10  7:36     [PATCH] eventdev: add weight and affinity attributes to queue conf Shijith Thotton
2022-09-14 12:34  0% ` Jerin Jacob
2022-09-15 16:53  0%   ` Jerin Jacob
2022-08-12 16:07     [PATCH v4 1/4] eventdev/timer: add periodic event timer support Naga Harish K S V
2022-09-14  5:15     ` [PATCH v5 " Naga Harish K S V
2022-09-14  5:15       ` [PATCH v5 4/4] doc: remove deprecation notice Naga Harish K S V
2022-09-14 12:41  3%     ` Jerin Jacob
2022-09-14 13:54  0%       ` Naga Harish K, S V
2022-09-14 13:51  5%   ` [PATCH v6 1/3] eventdev/timer: add periodic event timer support Naga Harish K S V
2022-09-14 15:24  0%     ` Jerin Jacob
2022-09-14 16:43  0%       ` Naga Harish K, S V
2022-09-14 15:33  5%     ` [PATCH v7 " Naga Harish K S V
2022-09-15  6:40  0%       ` Jerin Jacob
2022-08-12 19:18     [PATCH 00/13] ethdev: proceed with flow subsystem rework Ivan Malov
2022-08-12 19:18  4% ` [PATCH 02/13] ethdev: strip experimental tag off port ID items and actions Ivan Malov
2022-08-15 12:59  0%   ` Ori Kam
2022-08-12 19:18  4% ` [PATCH 03/13] ethdev: remove experimental tag from flow transfer proxy API Ivan Malov
2022-08-15 12:58  0%   ` Ori Kam
2022-08-12 19:18  5% ` [PATCH 10/13] ethdev: remove deprecated flow item PF Ivan Malov
2022-08-22  5:32  0%   ` Ori Kam
2022-08-12 19:18  1% ` [PATCH 11/13] ethdev: remove deprecated flow item VF Ivan Malov
2022-08-22  5:50  0%   ` Ori Kam
2022-08-12 19:18  1% ` [PATCH 12/13] ethdev: remove deprecated flow item PHY PORT Ivan Malov
2022-08-22  5:33  0%   ` Ori Kam
2022-09-27  7:08  0%     ` Thomas Monjalon
2022-09-27 16:18  0%       ` Ajit Khaparde
2022-08-12 19:18  5% ` [PATCH 13/13] ethdev: remove deprecated flow action " Ivan Malov
2022-08-22  5:33  0%   ` Ori Kam
2022-08-20  2:31     [PATCH v2 00/37] baseband/acc100: changes for 22.11 Hernan Vargas
2022-08-20  2:31     ` [PATCH v2 02/37] baseband/acc100: update ring availability calculation Hernan Vargas
2022-09-14 16:43  3%   ` Maxime Coquelin
2022-08-21 20:50     [PATCH 0/3] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-21 20:50  3% ` [PATCH 2/3] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-22  7:24  0%   ` Morten Brørup
2022-08-22 14:06  0%     ` Bruce Richardson
2022-08-25 15:37     ` [PATCH v2 0/4] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-25 15:37  3%   ` [PATCH v2 3/4] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-25 22:33       ` [PATCH v3 0/4] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-25 22:33  3%     ` [PATCH v3 3/4] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-27 11:32         ` [PATCH v4 0/4] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-27 11:32  3%       ` [PATCH v4 3/4] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-24 16:24     [RFC PATCH v1 00/10] dts: add hello world testcase Juraj Linkeš
2022-08-24 16:24  2% ` [RFC PATCH v1 05/10] dts: add system under test node Juraj Linkeš
2022-08-29 16:06     [PATCH 0/3] cryptodev: sym session framework rework Fan Zhang
2022-08-29 16:06  1% ` [PATCH 1/3] cryptodev: rework session framework Fan Zhang
2022-09-15  7:07  0%   ` [EXT] " Akhil Goyal
2022-09-15  7:26  0%     ` Akhil Goyal
2022-08-29 16:06  3% ` [PATCH 3/3] cryptodev: hide sym session structure Fan Zhang
2022-09-21 15:02     ` [PATCH v2 0/6] crypto/security session framework rework Akhil Goyal
2022-09-21 15:02  1%   ` [PATCH v2 1/6] cryptodev: rework session framework Akhil Goyal
2022-09-22 14:06  0%     ` Ji, Kai
2022-09-21 15:02  1%   ` [PATCH v2 3/6] cryptodev: hide sym session structure Akhil Goyal
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-08-30  1:23  0% [PATCH] net/ice: remove deprecated VF flow action Xu, Ke1
2022-09-02  3:00     [PATCH 0/9] Wangxun fixes and supports Jiawen Wu
2022-09-02  3:00  4% ` [PATCH 9/9] net/ngbe: support to set link down/up Jiawen Wu
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-09  5:30  4% [Bug 1079] [dpdk 22.11] kernel/linux/kni meson build failed with gcc 7.5 on suse15.4 bugzilla
2022-09-13 10:58  1% [PATCH] usertools: rewrite pmdinfo Robin Jarry
2022-09-13 19:42  1% ` [PATCH v2] " Robin Jarry
2022-09-20  9:08  1% ` [PATCH v3] " Robin Jarry
2022-09-20 10:42  1% ` [PATCH v4] " Robin Jarry
2022-09-20 17:48       ` Ferruh Yigit
2022-09-20 19:15         ` Robin Jarry
2022-09-21  7:58  3%       ` Ferruh Yigit
2022-09-21  9:57  0%         ` Ferruh Yigit
2022-09-14 21:12     [RFC v2] eal/linux: add support for fast virt/iova translation Don Wallwork
2022-09-14 21:12     ` Don Wallwork
2022-09-15  7:40  3%   ` Morten Brørup
2022-09-15 12:13  0%     ` Don Wallwork
2022-09-15 12:49  0%       ` Morten Brørup
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-20 15:14  1% [PATCH] examples/kni: remove deprecated kni example Bruce Richardson
2022-09-20 15:51  1% ` [PATCH v2] " Bruce Richardson
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
     [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 15:37  4% [PATCH] vhost: promote per-queue stats API to stable Maxime Coquelin
2022-10-11  1:50  4% release candidate 22.11-rc1 Thomas Monjalon
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 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

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).