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 0A39F44180; Fri, 7 Jun 2024 10:20:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81B8C4028A; Fri, 7 Jun 2024 10:20:44 +0200 (CEST) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by mails.dpdk.org (Postfix) with ESMTP id DD3E140151 for ; Fri, 7 Jun 2024 10:20:42 +0200 (CEST) Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-43fbbd1eb0cso9672001cf.2 for ; Fri, 07 Jun 2024 01:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717748442; x=1718353242; 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=xtYtZs9k0qdHhFSw5cgJbFno0SlFV9YN9PjCvZV7Yf4=; b=Goj2fmTSHj5UHth0kYFm3lYQLoH/KnGex/uOtiB2Hbjl776e5hMR+Qepkf7Lo6CHAp eYUA5iPpeU+XAN5FqxjdyUbEdoP7Gy/WC4wL82sjoSO4hm8X4hQrG6L6yzIpXR7WG1Ln Cr+CACiuajsjWncRr4U0JTuClnO+TvFRECP5vE2wS+nCQ2VYMQwelgmau+uxlOUbDML+ xxxOoa6sOk7kTO+wrTmFICVJwb54cvgFvFwVKLdQajAJJisNZhIOQFCBc5nBAArBLQGD pGTHpQJIxIoFVTTO/RYT4qqwACv8a2OG+v0RgY8BxjX1boz7KYeoa/6MGEphi+UCNBqT cJ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717748442; x=1718353242; 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=xtYtZs9k0qdHhFSw5cgJbFno0SlFV9YN9PjCvZV7Yf4=; b=got8ypRQeIANkMU1WAApD5zbPLF03CQgCmvDUdUuq8J3MfHUBq7wB1+ka7hWpKJAbp kBMR7dsofTRnzyZTPCT1ryXaU5ujrAbGcsOMxITM3+y5bQ+2jPAJYYNhsZ2ghA3Hi9Q2 uWPp8c5CMyg6ISsfoc4UIEMT2Nl0zAwyTkOVqYIJWufWoDjpwrA3LNl4Lc1YmI6DMx1H 8bCY9EYhF5QA/7ATx+R+o0tfxAbgWQig3nRIH6Z+A8j4uVPvnLUNw1vX9Xg8MXHfnmJI hzK2YdFHhIQDjLtQeFPdvA7Y+yqOINaiCv3jdkqr29q7MlIbXEc3Yu6TTI6fyAvBzI7O 0jNg== X-Gm-Message-State: AOJu0YzvuTDaOfzQTV+2JhimDNm1HWCbsYOCp2d5Tc9PyyuGO7wG2hHA W0wPb+vSE9uCzdRJw+pCMhZIy+nhlNWzbpWy5YV0oMOqDfKK89V77RNbUNcAfYp8JE67IfIAbb4 LG9HVtH5nRaCe1H16/Ah+b7mzXdrQ3PPz X-Google-Smtp-Source: AGHT+IEiyTMUTjeXs5VciwI7DYuSWRqMXx8C2hRLdwOMn/TFbgntpx6oDzpEOjAIVPlW38slQu58mwNFZmCbbOVIcaU= X-Received: by 2002:ac8:7c46:0:b0:440:3894:843e with SMTP id d75a77b69052e-44041cb001amr25425641cf.52.1717748441769; Fri, 07 Jun 2024 01:20:41 -0700 (PDT) MIME-Version: 1.0 References: <20240606133511.2047397-1-ganapati.kundapura@intel.com> <20240606134800.2049198-1-ganapati.kundapura@intel.com> In-Reply-To: <20240606134800.2049198-1-ganapati.kundapura@intel.com> From: Jerin Jacob Date: Fri, 7 Jun 2024 13:50:15 +0530 Message-ID: Subject: Re: [PATCH v5] eventdev/crypto: restore opaque field between dequeue and enqueue To: Ganapati Kundapura Cc: dev@dpdk.org, abhinandan.gujjar@intel.com, jay.jayatheerthan@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 7:18=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 "struct rte_event::impl_opaque" > on each event, it's not getting restored. > > This patch stores "struct rte_event::impl_opaque" in mbuf dynamic > field before enqueueing to cryptodev and restores > "struct rte_event::impl_opaque" from mbuf dynamic field after > dequeueing crypto op from cryptodev for session based crypto operations. > > Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation") > > Acked-by: Abhinandan Gujjar > > Signed-off-by: Ganapati Kundapura Changed git commit to fix following issues[1] and applied to dpdk-next-eventdev/for-main. Thanks eventdev/crypto: fix opaque field handling 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 "struct rte_event::impl_opaque" on each event, it's not getting restored. This patch stores "struct rte_event::impl_opaque" in mbuf dynamic field before enqueueing to cryptodev and restores struct rte_event::impl_opaque" from mbuf dynamic field after dequeueing crypto op from cryptodev for session based crypto operations. Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation") Cc: stable@dpdk.org Signed-off-by: Ganapati Kundapura Acked-by: Abhinandan Gujjar [1] Headline too long: eventdev/crypto: restore opaque field between dequeue and enqueue Is it candidate for Cc: stable@dpdk.org backport? eventdev/crypto: restore opaque field between dequeue and enqueue Wrong tag order: eventdev/crypto: restore opaque field between dequeue and enqueue (Signed-off-by:) Invalid patch(es) found - checked 1 patch check-git-log failed > > --- > v5: > * Replaced ev::impl_opaque with "struct rte_event::impl_opaque" > * in eca_init_service() > > v4: > * Replaced ev::impl_opaque with "struct rte_event::impl_opaque" > * Added Acked-by > > v3: > * Added Fixes tag > > 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..939ca1c 100644 > --- a/lib/eventdev/rte_event_crypto_adapter.c > +++ b/lib/eventdev/rte_event_crypto_adapter.c > @@ -138,6 +138,28 @@ 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; > + > +/* mbuf dynamic field offset 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 +513,25 @@ 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; > + > + /** "struct rte_event::impl_opaque" field passed on from > + * eventdev PMD could have different value per event. > + * For session-based crypto operations retain > + * "struct rte_event::impl_opaque" into mbuf dynamic fie= ld and > + * restore it back after copying event information from > + * session event metadata. > + * For session-less, each crypto operation carries event > + * metadata and retains "struct rte_event:impl_opaque" > + * information to be 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 +698,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 "struct rte_event::impl_opaque" from mbuf > + * dynamic field for session based crypto operation. > + * For session-less, each crypto operations carries even= t > + * metadata and retains "struct rte_event::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_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 +951,18 @@ 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 > + * "struct rte_event::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 >