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 DD8D244172; Thu, 6 Jun 2024 10:28:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F1C94027D; Thu, 6 Jun 2024 10:28:27 +0200 (CEST) Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by mails.dpdk.org (Postfix) with ESMTP id 9CBBE4021E for ; Thu, 6 Jun 2024 10:28:26 +0200 (CEST) Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-44026036ea8so3435461cf.0 for ; Thu, 06 Jun 2024 01:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717662506; x=1718267306; 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=DzuhqWmaZosvv9n6G5ExNWFPzma2hNWPyJtN/s9MEiE=; b=XNBSy4wfkAMg8tKZcVdU6Kvg8/u6saZS/R2+HYfN1b/kIQByWqkLYjZOlknasn8P3H di8JAeeRoyMfdh0KY8PWm/stg7lHCS8qD7CQhxIWN94P42MjGVLw456QMWwAJ5pjnwQ5 /xeK1AFqSysULb0jzV5+kqlACqBBtr/jfUHUROuEKHkstajdte1BbAIcoGEF+5lN9YoG T3AuRyF0c7AiVLDDqTiadkk9VS8/Xm0eE0Jrr33x/yxbyDBFO9JNKG/J48VgZRXfvsSS kmVDlPZdZgLC2GJ8MnvMptkHVBgIPoMbLgKjQqY1w91ZwqkYZr7axy/7J0cCfShOZVuP F0Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717662506; x=1718267306; 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=DzuhqWmaZosvv9n6G5ExNWFPzma2hNWPyJtN/s9MEiE=; b=Ws19OPUBQADBqpFRa1nFuVNiZQfvj6xKT3OhibwpVsdVVERytCZ8s8zeQEUY7jAXYz PmUUraXdTrW6Jr62lh1QMH9k7Aclo5jMBZ3Rjj8rGTBDxdoXceMghXjwW+uJsYQO6CKB f4RDMz2ocBxDdQ8p/h6BVCt5LiYEDiQYpa6BjOmhv+2ovtwpWaI4vVKRnafdnWZHmUlx Hl90f3X53ypAzVidFETGbPv6k2gRW+SjDXLAaVLu8+nT7Uul9PTcVHncVCoxL6T9gZxJ zIX8yp1Qj563oDwOwjR2HoQtsaux1Np6MVN10hG2Kg3bKOWkqOie9NQQca8ANP1IrOq5 QaiQ== X-Gm-Message-State: AOJu0Yx4Y5nWt4jKoBSrZoWt19/KO0IkxauA8PTA7CO054Co8lymKd3b nBJz1k2jrEko75DsJEDLrI7necagjxdVfh+W5WrH8wnbjtG0zmCS+GDSFPC7ozY4S/G44zZ4hti DHr4ndHgm2FSFuIBAYCJJGhXA3t0= X-Google-Smtp-Source: AGHT+IHIZuRTeQMhLlX/T28xSbIgJcHq0DGrj8rzl/PNJqCnN+GFelBwhLZ1Kbo4B/Tc723p7Bd/nWTlbdWXehd5D68= X-Received: by 2002:ac8:590d:0:b0:43e:2639:a987 with SMTP id d75a77b69052e-4402b6d42b7mr51765471cf.59.1717662505747; Thu, 06 Jun 2024 01:28:25 -0700 (PDT) MIME-Version: 1.0 References: <20240604160847.1573821-1-ganapati.kundapura@intel.com> <20240604161848.1575399-1-ganapati.kundapura@intel.com> In-Reply-To: <20240604161848.1575399-1-ganapati.kundapura@intel.com> From: Jerin Jacob Date: Thu, 6 Jun 2024 13:57:58 +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 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. > > 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_e= vent_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_ad= apter; > } \ > } 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 *ad= apter, 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 cou= ld > + * have different value per event. > + * For session-based crypto operations retain ev::impl_o= paque > + * 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 b= e > + * passed back to eventdev PMD. > + */ > + if (crypto_op->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSIO= N) { > + struct rte_mbuf *mbuf =3D crypto_op->sym->m_src; > + > + *RTE_MBUF_DYNFIELD(mbuf, > + eca_dynfield_offset, > + eca_dynfield_t *) =3D ev[i].impl_= opaque; > + } > + > m_data =3D rte_cryptodev_session_event_mdata_get(crypto_o= p); > 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 *a= dapter, > > 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 even= t > + * metadata and retains ev::impl_opaque information to b= e > + * 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_offs= et, > + 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 *adapte= r, 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 >