* [PATCH 19.11] eventdev/crypto: fix multi-process
@ 2022-11-11 16:09 Ganapati Kundapura
2022-11-15 8:18 ` Christian Ehrhardt
0 siblings, 1 reply; 2+ messages in thread
From: Ganapati Kundapura @ 2022-11-11 16:09 UTC (permalink / raw)
To: stable; +Cc: Abhinandan Gujjar
[ upstream commit 8f4ff7de39693dfd26336afea5e12e1a7d8fd9b0 ]
Secondary process is not able to call the crypto adapter
APIs stats get/reset as crypto adapter memzone memory
is not accessible by secondary process.
Added memzone lookup so that secondary process can call the
crypto adapter APIs(stats_get etc)
Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
diff --git a/lib/librte_eventdev/rte_event_crypto_adapter.c b/lib/librte_eventdev/rte_event_crypto_adapter.c
index 3c330c6cb..4f67b8faf 100644
--- a/lib/librte_eventdev/rte_event_crypto_adapter.c
+++ b/lib/librte_eventdev/rte_event_crypto_adapter.c
@@ -29,6 +29,8 @@
*/
#define CRYPTO_ENQ_FLUSH_THRESHOLD 1024
+#define ECA_ADAPTER_ARRAY "crypto_adapter_array"
+
struct rte_event_crypto_adapter {
/* Event device identifier */
uint8_t eventdev_id;
@@ -117,7 +119,6 @@ eca_valid_id(uint8_t id)
static int
eca_init(void)
{
- const char *name = "crypto_adapter_array";
const struct rte_memzone *mz;
unsigned int sz;
@@ -125,9 +126,10 @@ eca_init(void)
RTE_EVENT_CRYPTO_ADAPTER_MAX_INSTANCE;
sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
- mz = rte_memzone_lookup(name);
+ mz = rte_memzone_lookup(ECA_ADAPTER_ARRAY);
if (mz == NULL) {
- mz = rte_memzone_reserve_aligned(name, sz, rte_socket_id(), 0,
+ mz = rte_memzone_reserve_aligned(ECA_ADAPTER_ARRAY, sz,
+ rte_socket_id(), 0,
RTE_CACHE_LINE_SIZE);
if (mz == NULL) {
RTE_EDEV_LOG_ERR("failed to reserve memzone err = %"
@@ -140,6 +142,22 @@ eca_init(void)
return 0;
}
+static int
+eca_memzone_lookup(void)
+{
+ const struct rte_memzone *mz;
+
+ if (event_crypto_adapter == NULL) {
+ mz = rte_memzone_lookup(ECA_ADAPTER_ARRAY);
+ if (mz == NULL)
+ return -ENOMEM;
+
+ event_crypto_adapter = mz->addr;
+ }
+
+ return 0;
+}
+
static inline struct rte_event_crypto_adapter *
eca_id_to_adapter(uint8_t id)
{
@@ -1037,6 +1055,9 @@ rte_event_crypto_adapter_stats_get(uint8_t id,
uint32_t i;
int ret;
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
adapter = eca_id_to_adapter(id);
@@ -1078,6 +1099,9 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
struct rte_eventdev *dev;
uint32_t i;
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
adapter = eca_id_to_adapter(id);
--
2.23.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 19.11] eventdev/crypto: fix multi-process
2022-11-11 16:09 [PATCH 19.11] eventdev/crypto: fix multi-process Ganapati Kundapura
@ 2022-11-15 8:18 ` Christian Ehrhardt
0 siblings, 0 replies; 2+ messages in thread
From: Christian Ehrhardt @ 2022-11-15 8:18 UTC (permalink / raw)
To: Ganapati Kundapura; +Cc: stable, Abhinandan Gujjar
On Fri, Nov 11, 2022 at 5:09 PM Ganapati Kundapura
<ganapati.kundapura@intel.com> wrote:
>
> [ upstream commit 8f4ff7de39693dfd26336afea5e12e1a7d8fd9b0 ]
Thanks, applied to the WIP branch - expect it to be part of 19.11.14
unless some builds stumble over it.
> Secondary process is not able to call the crypto adapter
> APIs stats get/reset as crypto adapter memzone memory
> is not accessible by secondary process.
>
> Added memzone lookup so that secondary process can call the
> crypto adapter APIs(stats_get etc)
>
> Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
>
> diff --git a/lib/librte_eventdev/rte_event_crypto_adapter.c b/lib/librte_eventdev/rte_event_crypto_adapter.c
> index 3c330c6cb..4f67b8faf 100644
> --- a/lib/librte_eventdev/rte_event_crypto_adapter.c
> +++ b/lib/librte_eventdev/rte_event_crypto_adapter.c
> @@ -29,6 +29,8 @@
> */
> #define CRYPTO_ENQ_FLUSH_THRESHOLD 1024
>
> +#define ECA_ADAPTER_ARRAY "crypto_adapter_array"
> +
> struct rte_event_crypto_adapter {
> /* Event device identifier */
> uint8_t eventdev_id;
> @@ -117,7 +119,6 @@ eca_valid_id(uint8_t id)
> static int
> eca_init(void)
> {
> - const char *name = "crypto_adapter_array";
> const struct rte_memzone *mz;
> unsigned int sz;
>
> @@ -125,9 +126,10 @@ eca_init(void)
> RTE_EVENT_CRYPTO_ADAPTER_MAX_INSTANCE;
> sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
>
> - mz = rte_memzone_lookup(name);
> + mz = rte_memzone_lookup(ECA_ADAPTER_ARRAY);
> if (mz == NULL) {
> - mz = rte_memzone_reserve_aligned(name, sz, rte_socket_id(), 0,
> + mz = rte_memzone_reserve_aligned(ECA_ADAPTER_ARRAY, sz,
> + rte_socket_id(), 0,
> RTE_CACHE_LINE_SIZE);
> if (mz == NULL) {
> RTE_EDEV_LOG_ERR("failed to reserve memzone err = %"
> @@ -140,6 +142,22 @@ eca_init(void)
> return 0;
> }
>
> +static int
> +eca_memzone_lookup(void)
> +{
> + const struct rte_memzone *mz;
> +
> + if (event_crypto_adapter == NULL) {
> + mz = rte_memzone_lookup(ECA_ADAPTER_ARRAY);
> + if (mz == NULL)
> + return -ENOMEM;
> +
> + event_crypto_adapter = mz->addr;
> + }
> +
> + return 0;
> +}
> +
> static inline struct rte_event_crypto_adapter *
> eca_id_to_adapter(uint8_t id)
> {
> @@ -1037,6 +1055,9 @@ rte_event_crypto_adapter_stats_get(uint8_t id,
> uint32_t i;
> int ret;
>
> + if (eca_memzone_lookup())
> + return -ENOMEM;
> +
> EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
>
> adapter = eca_id_to_adapter(id);
> @@ -1078,6 +1099,9 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
> struct rte_eventdev *dev;
> uint32_t i;
>
> + if (eca_memzone_lookup())
> + return -ENOMEM;
> +
> EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
>
> adapter = eca_id_to_adapter(id);
> --
> 2.23.0
>
--
Christian Ehrhardt
Senior Staff Engineer, Ubuntu Server
Canonical Ltd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-15 8:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11 16:09 [PATCH 19.11] eventdev/crypto: fix multi-process Ganapati Kundapura
2022-11-15 8:18 ` Christian Ehrhardt
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).