From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA74044173; Thu, 6 Jun 2024 12:03:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B137040E72; Thu, 6 Jun 2024 12:03:09 +0200 (CEST) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by mails.dpdk.org (Postfix) with ESMTP id 1AA7A4027D for ; Thu, 6 Jun 2024 12:03:09 +0200 (CEST) Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-43fdd85a284so3878391cf.0 for ; Thu, 06 Jun 2024 03:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717668188; x=1718272988; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vhVghNzykMalWkgrtP73tR9wCM+2wzo3lFJmod9gHUM=; b=LfdusoC9BQzvbXWU+bpKFxdFGb1LTdNt/He82Do0wbl6dcgOKM0sdJHOdVD1z/4IZM bfNlU19IHydDp8flCtbLouilLGcIXkwGZRxIKZG7Vkq+cMs/cJU3jbVFFxT2zIGXJ8i3 bdhPCM2QiNgq2RY15dQlakESZg7EfqU8g53Os56CdxAWbF+oXQpxwmelcW8oOFtN+nGL fjxZ9kBuU9X+mAukWAefFAOU+oXA4Ryj+u/4jWYD1I3rkZo5VvnSsW3p4BtCys/EcnpN /NvzbkpQN5WwURucpcavvs5V9MAFY605V+jRn9droi6TEUxbo742/a8MDUMz0YAnMtrm xVSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717668188; x=1718272988; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vhVghNzykMalWkgrtP73tR9wCM+2wzo3lFJmod9gHUM=; b=ibZH1306tqXA5yhB7ilSnSYITKNu75T7DGFIoykvuuBzmnnYLM+Csu7Zv0bdfawU8E CjRWTb6AwFiqYOPBgyq84m5z1Fhpykqe0PBKTal3NmcX37FNQRFicEvJLivVi/T3oxfS X29FxBBm6tsPPZ2tuO30lGjXvc+1CdUw3fXI1mJm7LjWbg28lPO6rKi3MCJuOg+C+Ejv QR+P1xeiSbsk/A0COjxUY33gYxMxMnc3h/mVr1CXiLCqqN5n7zBO5ZZsCpN5GXEn+gRk nF6BddYP+m+IZPutdHytroQobOobPjav6b6r9GMmeuV84J7u78AGBSUJc4V3MIdGctoX SL8Q== X-Gm-Message-State: AOJu0YxzeHSXQfPkds8FJrXbQiEFMUG05xH92ArNaqT/ViAlLsjxDYxT 2eayv+1XFr/eWP0IYyyvp/Dc3j8ObtheWoTR2a/ArEfndJWcntkmiSUvt2/3pZIvxYMkiTkays2 JvtgTluYOhDhWnUNYQVrxOk0kZ+s= X-Google-Smtp-Source: AGHT+IE4Pt+hRfCsqqnq1fSG0kmcSae6nAoyHvNI/59160ioEXZgE4C64qreFeYYxiZJxACmPPBeO1Vky8yLkReKh0o= X-Received: by 2002:a05:622a:1a9f:b0:43f:fc16:6b56 with SMTP id d75a77b69052e-4402b6a8c8cmr58674661cf.63.1717668188188; Thu, 06 Jun 2024 03:03:08 -0700 (PDT) MIME-Version: 1.0 References: <20240604160847.1573821-1-ganapati.kundapura@intel.com> <20240604161848.1575399-1-ganapati.kundapura@intel.com> In-Reply-To: From: Jerin Jacob Date: Thu, 6 Jun 2024 15:32:42 +0530 Message-ID: Subject: Re: [PATCH v2] eventdev/crypto: restore opaque field between dequeue and enqueue To: Ganapati Kundapura Cc: dev@dpdk.org, jerinj@marvell.com, abhinandan.gujjar@intel.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Jun 6, 2024 at 1:57=E2=80=AFPM Jerin Jacob = wrote: > > On Tue, Jun 4, 2024 at 9:49=E2=80=AFPM Ganapati Kundapura > 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. Also waiting for review and ack from @Gujjar, Abhinandan S > > > > > > Signed-off-by: Ganapati Kundapura > > > > --- > > 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 =3D -1; > > + > > +static int > > +eca_dynfield_register(void) > > +{ > > + static const struct rte_mbuf_dynfield eca_dynfield_desc =3D { > > + .name =3D ECA_DYNFIELD_NAME, > > + .size =3D sizeof(eca_dynfield_t), > > + .align =3D alignof(eca_dynfield_t), > > + .flags =3D 0, > > + }; > > + > > + eca_dynfield_offset =3D > > + 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 =3D ev[i].event_ptr; > > if (crypto_op =3D=3D NULL) > > continue; > > + > > + /** ev::impl_opaque field passed on from eventdev PMD c= ould > > + * have different value per event. > > + * For session-based crypto operations retain ev::impl= _opaque > > + * into mbuf dynfield and restore it back after copyin= g event > > + * information from session event metadata. > > + * For session-less, each crypto operation carries eve= nt > > + * metadata and retains ev::impl_opaque information to= be > > + * passed back to eventdev PMD. > > + */ > > + if (crypto_op->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESS= ION) { > > + struct rte_mbuf *mbuf =3D crypto_op->sym->m_src= ; > > + > > + *RTE_MBUF_DYNFIELD(mbuf, > > + eca_dynfield_offset, > > + eca_dynfield_t *) =3D ev[i].imp= l_opaque; > > + } > > + > > m_data =3D rte_cryptodev_session_event_mdata_get(crypto= _op); > > if (m_data =3D=3D 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 =3D ops[i]; > > + > > + /** restore ev::impl_opaque from mbuf dyn field > > + * for session based crypto operation. > > + * For session-less, each crypto operations carries ev= ent > > + * metadata and retains ev::impl_opaque information to= be > > + * passed back to eventdev PMD. > > + */ > > + if (ops[i]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION= ) { > > + struct rte_mbuf *mbuf =3D ops[i]->sym->m_src; > > + > > + ev->impl_opaque =3D *RTE_MBUF_DYNFIELD(mbuf, > > + eca_dynfield_of= fset, > > + eca_dynfield_t = *); > > + } > > + > > ev->event_type =3D RTE_EVENT_TYPE_CRYPTODEV; > > if (adapter->implicit_release_disabled) > > ev->op =3D RTE_EVENT_OP_FORWARD; > > @@ -895,6 +949,16 @@ eca_init_service(struct event_crypto_adapter *adap= ter, uint8_t id) > > } > > > > adapter->implicit_release_disabled =3D (uint8_t)impl_rel; > > + > > + /* Register for mbuf dyn field to store/restore ev::impl_opaque= */ > > + eca_dynfield_offset =3D 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 =3D 1; > > > > return ret; > > -- > > 2.6.4 > >