Hi Jerin,
> -----Original Message----- > From: Jerin Jacob <jerinjac...@gmail.com> > Sent: Thursday, June 6, 2024 3:33 PM > To: Kundapura, Ganapati <ganapati.kundap...@intel.com> > Cc: dev@dpdk.org; jer...@marvell.com; Gujjar, Abhinandan S > <abhinandan.guj...@intel.com>; Jayatheerthan, Jay > <jay.jayatheert...@intel.com>; Naga Harish K, S V > <s.v.naga.haris...@intel.com> > Subject: Re: [PATCH v2] eventdev/crypto: restore opaque field between > dequeue and enqueue > > On Thu, Jun 6, 2024 at 1:57 PM Jerin Jacob <jerinjac...@gmail.com> wrote: > > > > On Tue, Jun 4, 2024 at 9:49 PM Ganapati Kundapura > > <ganapati.kundap...@intel.com> wrote: > > > > > > For session-less crypto operations, event info is contained in > > > crypto op metadata for each event which is restored in event from > > > the crypto op metadata response info. > > > > > > For session based crypto operations, crypto op contains per session > > > based event info in crypto op metadata. If any PMD passes any > > > implementation specific data in ev::impl_opaque on each event, it's > > > not getting restored. > > > > > > This patch stores ev::impl_opaque in mbuf's dynamic field before > > > enqueueing to cryptodev and restores ev::impl_opaque from mbuf's > > > dynamic field after dequeueing crypto op from cryptodev for session > > > based crypto operations. > > > > > > Is n't Fix ? If so, please share the Fixes: tag, I will update on apply. Posted V3 patch with Fixes tag > > Also waiting for review and ack from @Gujjar, Abhinandan S > > > > > > > > > > Signed-off-by: Ganapati Kundapura <ganapati.kundap...@intel.com> > > > > > > --- > > > v2: > > > * Fixed TYPO_SPELLING warning in commit header > > > > > > diff --git a/lib/eventdev/rte_event_crypto_adapter.c > > > b/lib/eventdev/rte_event_crypto_adapter.c > > > index db1c7f3..91a30ca 100644 > > > --- a/lib/eventdev/rte_event_crypto_adapter.c > > > +++ b/lib/eventdev/rte_event_crypto_adapter.c > > > @@ -138,6 +138,27 @@ static struct event_crypto_adapter > **event_crypto_adapter; > > > } \ > > > } while (0) > > > > > > +#define ECA_DYNFIELD_NAME "eca_ev_opaque_data" > > > +/** Device-specific metadata field type */ typedef uint8_t > > > +eca_dynfield_t; > > > +/** Dynamic mbuf field for device-specific metadata */ int > > > +eca_dynfield_offset = -1; > > > + > > > +static int > > > +eca_dynfield_register(void) > > > +{ > > > + static const struct rte_mbuf_dynfield eca_dynfield_desc = { > > > + .name = ECA_DYNFIELD_NAME, > > > + .size = sizeof(eca_dynfield_t), > > > + .align = alignof(eca_dynfield_t), > > > + .flags = 0, > > > + }; > > > + > > > + eca_dynfield_offset = > > > + rte_mbuf_dynfield_register(&eca_dynfield_desc); > > > + return eca_dynfield_offset; > > > +} > > > + > > > static inline int > > > eca_valid_id(uint8_t id) > > > { > > > @@ -491,6 +512,24 @@ eca_enq_to_cryptodev(struct > event_crypto_adapter *adapter, struct rte_event *ev, > > > crypto_op = ev[i].event_ptr; > > > if (crypto_op == NULL) > > > continue; > > > + > > > + /** ev::impl_opaque field passed on from eventdev PMD > > > could > > > + * have different value per event. > > > + * For session-based crypto operations retain > > > ev::impl_opaque > > > + * into mbuf dynfield and restore it back after copying > > > event > > > + * information from session event metadata. > > > + * For session-less, each crypto operation carries event > > > + * metadata and retains ev::impl_opaque information to be > > > + * passed back to eventdev PMD. > > > + */ > > > + if (crypto_op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { > > > + struct rte_mbuf *mbuf = > > > + crypto_op->sym->m_src; > > > + > > > + *RTE_MBUF_DYNFIELD(mbuf, > > > + eca_dynfield_offset, > > > + eca_dynfield_t *) = > > > ev[i].impl_opaque; > > > + } > > > + > > > m_data = rte_cryptodev_session_event_mdata_get(crypto_op); > > > if (m_data == NULL) { > > > rte_pktmbuf_free(crypto_op->sym->m_src); > > > @@ -657,6 +696,21 @@ eca_ops_enqueue_burst(struct > > > event_crypto_adapter *adapter, > > > > > > rte_memcpy(ev, &m_data->response_info, sizeof(*ev)); > > > ev->event_ptr = ops[i]; > > > + > > > + /** restore ev::impl_opaque from mbuf dyn field > > > + * for session based crypto operation. > > > + * For session-less, each crypto operations carries event > > > + * metadata and retains ev::impl_opaque information to be > > > + * passed back to eventdev PMD. > > > + */ > > > + if (ops[i]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { > > > + struct rte_mbuf *mbuf = ops[i]->sym->m_src; > > > + > > > + ev->impl_opaque = *RTE_MBUF_DYNFIELD(mbuf, > > > + > > > eca_dynfield_offset, > > > + eca_dynfield_t *); > > > + } > > > + > > > ev->event_type = RTE_EVENT_TYPE_CRYPTODEV; > > > if (adapter->implicit_release_disabled) > > > ev->op = RTE_EVENT_OP_FORWARD; @@ -895,6 > > > +949,16 @@ eca_init_service(struct event_crypto_adapter *adapter, > uint8_t id) > > > } > > > > > > adapter->implicit_release_disabled = (uint8_t)impl_rel; > > > + > > > + /* Register for mbuf dyn field to store/restore ev::impl_opaque */ > > > + eca_dynfield_offset = eca_dynfield_register(); > > > + if (eca_dynfield_offset < 0) { > > > + RTE_EDEV_LOG_ERR("Failed to register eca mbuf dyn field"); > > > + eca_circular_buffer_free(&adapter->ebuf); > > > + rte_free(adapter); > > > + return -EINVAL; > > > + } > > > + > > > adapter->service_inited = 1; > > > > > > return ret; > > > -- > > > 2.6.4 > > >