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 BB07E454E9 for ; Tue, 25 Jun 2024 02:01:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4785410DC; Tue, 25 Jun 2024 02:01:50 +0200 (CEST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id 955AF40EDD for ; Tue, 25 Jun 2024 02:01:48 +0200 (CEST) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-365663f51adso3654939f8f.1 for ; Mon, 24 Jun 2024 17:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273708; x=1719878508; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=crTwzcPTW1YhLsWT5n2fcWee8mRvPxgO9GQfdzFqY1g=; b=JFCYQGycKXcS1YIfzlCMY7m1UrZNcRJ2nWo4KYgNQysVVzNx8BL0Ue8o1fCzL3eKPL X9oMayc2+eCg7dPNV4lfe6wygztewwRqRp6NP6mvkaCbVdUh0FspMOAoe5+QxScRYCjE 08tx5sqNFnQNM0RAOBfWV8mNc6ONFoRExRYtzACzWkq3xU6EbMiIflux86uXPnfJTy6W Xg8FkIYxeRIjwpfHdkL8AL+o8OILem/Of2Mtv5A9ErNxZczWYwqlsslGGUUljrT1MXHQ ssxiiXROlxkNuJxmWNzE94PI4ABNKczE0VaWa3ZZXyBwx6GSyyZpx9WgBUiQzhhsDEgk G4Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273708; x=1719878508; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=crTwzcPTW1YhLsWT5n2fcWee8mRvPxgO9GQfdzFqY1g=; b=vq/xwhDtaz9O1gcx9GGNbDRykUJ/+9IdwrfV+46zceqbVNKGXkNiL8qqmpdXkatU+d 3P9n3TJABww7+5qDV94msknHDjV/aZOf4A11/JoCZOL7NTU+3zrlYHaSzLCiFSVegBeo KLZAMgn9pIQIsC+pu4A1EKxpEqe40Z+oBicUV69I5Bp4lWbXxrNYhG34L1ERs4oRm79n Xv7g7rsAc+UC8hxY5Kr+QIiWF0cbDttO2hmfoCLblz4yguzG+PQEbuB1Ocv+IXUJmHz1 MRiQW9xx2LQ2KtbDC08dJxgpuPZS4NXzokifuwsx12JTXzPSvBRM8ZcU7sosvfWD0+eq 7tLQ== X-Forwarded-Encrypted: i=1; AJvYcCX+NQU/7yf5oNobG7d/zKl/IU4Xhpc+K6+vn2vIWpbwGcT+yNlyMwOOmIN70PhEGiwwPL2c2SW1luYPP03xk+c= X-Gm-Message-State: AOJu0YzFSVe0TXc4IaAzf78igiexA4/Lv+LpZMkhKP78OXRGNtbZ2iPY b5PVhGwP9qgi/4DeqDAgOscP/ZNsJ8XQOLQJiQDcqbK1V04Q2ZBN X-Google-Smtp-Source: AGHT+IG4EHLB6KbYg6AX12qbtJIIHb3Vbh0ID2DKL7De49RcGPmzx9H3KsFshPwmzN1UGZcUtxzLZQ== X-Received: by 2002:a05:6000:1379:b0:360:9e6a:5987 with SMTP id ffacd0b85a97d-366e4ecc631mr5128045f8f.12.1719273708059; Mon, 24 Jun 2024 17:01:48 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c7c79sm11337923f8f.96.2024.06.24.17.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 17:01:47 -0700 (PDT) From: luca.boccassi@gmail.com To: Ganapati Kundapura Cc: Abhinandan Gujjar , dpdk stable Subject: patch 'eventdev/crypto: fix opaque field handling' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:58:35 +0100 Message-Id: <20240624235907.885628-49-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/55754590621b079ecf0d2f458309c42be4c0907a Thanks. Luca Boccassi --- >From 55754590621b079ecf0d2f458309c42be4c0907a Mon Sep 17 00:00:00 2001 From: Ganapati Kundapura Date: Thu, 6 Jun 2024 08:48:00 -0500 Subject: [PATCH] eventdev/crypto: fix opaque field handling [ upstream commit ad12d08f05db8323ac1fb655b75dcef69e536a04 ] 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") Signed-off-by: Ganapati Kundapura Acked-by: Abhinandan Gujjar --- lib/eventdev/rte_event_crypto_adapter.c | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c index a25316a43a..258be0f339 100644 --- a/lib/eventdev/rte_event_crypto_adapter.c +++ b/lib/eventdev/rte_event_crypto_adapter.c @@ -131,6 +131,28 @@ 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; + +/* mbuf dynamic field offset 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) { @@ -492,6 +514,25 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev, crypto_op = ev[i].event_ptr; if (crypto_op == 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 field 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 == 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); @@ -658,6 +699,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 "struct rte_event::impl_opaque" from mbuf + * dynamic field for session based crypto operation. + * For session-less, each crypto operations carries event + * metadata and retains "struct rte_event::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; @@ -882,6 +938,18 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id) adapter->max_nb = adapter_conf.max_nb; adapter->event_port_id = adapter_conf.event_port_id; + + /** Register for mbuf dyn field to store/restore + * "struct rte_event::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.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:16.416677107 +0100 +++ 0049-eventdev-crypto-fix-opaque-field-handling.patch 2024-06-25 00:22:13.181185567 +0100 @@ -1 +1 @@ -From ad12d08f05db8323ac1fb655b75dcef69e536a04 Mon Sep 17 00:00:00 2001 +From 55754590621b079ecf0d2f458309c42be4c0907a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ad12d08f05db8323ac1fb655b75dcef69e536a04 ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org @@ -30 +31 @@ -index db1c7f3906..939ca1cad9 100644 +index a25316a43a..258be0f339 100644 @@ -33 +34 @@ -@@ -138,6 +138,28 @@ static struct event_crypto_adapter **event_crypto_adapter; +@@ -131,6 +131,28 @@ static struct event_crypto_adapter **event_crypto_adapter; @@ -50 +51 @@ -+ .align = alignof(eca_dynfield_t), ++ .align = __alignof__(eca_dynfield_t), @@ -62 +63 @@ -@@ -491,6 +513,25 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev, +@@ -492,6 +514,25 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev, @@ -88 +89 @@ -@@ -657,6 +698,21 @@ eca_ops_enqueue_burst(struct event_crypto_adapter *adapter, +@@ -658,6 +699,21 @@ eca_ops_enqueue_burst(struct event_crypto_adapter *adapter, @@ -110,2 +111 @@ -@@ -895,6 +951,18 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id) - } +@@ -882,6 +938,18 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id) @@ -113 +113,2 @@ - adapter->implicit_release_disabled = (uint8_t)impl_rel; + adapter->max_nb = adapter_conf.max_nb; + adapter->event_port_id = adapter_conf.event_port_id;