From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, pablo.de.lara.guarch@intel.com,
fiona.trahe@intel.com
Subject: [dpdk-dev] [PATCH v4 10/12] cryptodev: add user data size to symmetric session
Date: Wed, 9 Jan 2019 22:56:07 +0000 [thread overview]
Message-ID: <20190109225609.20590-11-roy.fan.zhang@intel.com> (raw)
In-Reply-To: <20190109225609.20590-1-roy.fan.zhang@intel.com>
This patch adds a user_data_sz field to cryptodev symmetric session.
The field is used to check if reading or writing the session's user
data field is eligible.
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
doc/guides/prog_guide/img/cryptodev_sym_sess.svg | 172 ++++++++++++-----------
lib/librte_cryptodev/rte_cryptodev.c | 11 +-
lib/librte_cryptodev/rte_cryptodev.h | 5 +-
3 files changed, 103 insertions(+), 85 deletions(-)
diff --git a/doc/guides/prog_guide/img/cryptodev_sym_sess.svg b/doc/guides/prog_guide/img/cryptodev_sym_sess.svg
index 5c843f736..20059cc0f 100644
--- a/doc/guides/prog_guide/img/cryptodev_sym_sess.svg
+++ b/doc/guides/prog_guide/img/cryptodev_sym_sess.svg
@@ -37,7 +37,7 @@
showgrid="false"
inkscape:zoom="1.7495789"
inkscape:cx="208.74719"
- inkscape:cy="216.52777"
+ inkscape:cy="170.80248"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
@@ -150,7 +150,7 @@
id="filter_2"><feGaussianBlur
stdDeviation="2"
id="feGaussianBlur12" /></filter></defs><g
- transform="matrix(1,0,0,0.41409874,-12.05774,-5.77269)"
+ transform="matrix(1,0,0,0.46836022,-12.05774,-7.0354309)"
id="shape18-1"><title
id="title18">Rounded Rectangle.12</title><desc
id="desc20">Crypto Symmetric Session</desc><path
@@ -162,87 +162,83 @@
transform="matrix(1,0,0,0.41409874,-2.136529,-9.5289258)"
id="shape19-6"><title
id="title27">Rounded Rectangle.13</title><desc
- id="desc29">Private Session Data</desc></g><g
- id="g4079"
- transform="matrix(0.9997031,0,0,1.070998,206.15511,-5.6465883)"><path
- style="fill:#ffffff;stroke:#41719c;stroke-width:1.15444767"
- inkscape:connector-curvature="0"
- id="path43"
- class="st7"
- d="m -189.55935,139.62776 h 123.25 a 5.90925,14.000977 0 0 0 5.91,-13.97905 V 39.476089 a 5.90925,14.000977 0 0 0 -5.91,-14.002757 h -123.25 a 5.90925,14.000977 0 0 0 -5.91,14.002757 v 86.172621 a 5.90925,14.000977 0 0 0 5.91,13.97905 z" /><rect
- y="118.60072"
- x="-181.11736"
- height="14.896484"
- width="15.968175"
- id="rect4604"
- style="fill:none;fill-opacity:1;stroke:#41719c;stroke-width:0.75000221;stroke-opacity:1" /><rect
- y="118.60072"
- x="-165.14919"
- height="14.896484"
- width="15.968174"
- id="rect4604-7"
- style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
- y="118.60072"
- x="-149.181"
- height="14.896484"
- width="15.968174"
- id="rect4604-7-6"
- style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
- y="118.60072"
- x="-133.21283"
- height="14.896484"
- width="15.968174"
- id="rect4604-7-6-9"
- style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
- y="118.60072"
- x="-117.24466"
- height="14.896484"
- width="15.968174"
- id="rect4604-7-6-9-8"
- style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
- y="118.60072"
- x="-101.27649"
- height="14.896484"
- width="15.968174"
- id="rect4604-7-6-9-8-9"
- style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><rect
- y="118.60072"
- x="-85.308311"
- height="14.896484"
- width="15.968174"
- id="rect4604-7-6-9-8-9-6"
- style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.75000221;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1" /><text
- transform="scale(0.48757738,2.0509565)"
- style="font-size:21.61449814px;font-family:Calibri;overflow:visible;color-interpolation-filters:sRGB;fill:#41719c;fill-rule:evenodd;stroke-width:2.16144276;stroke-linecap:square;stroke-miterlimit:3"
- id="text65-3"
- class="st6"
- y="50.793892"
- x="-374.07562" />
+ id="desc29">Private Session Data</desc></g><path
+ d="m 16.65204,162.41822 h 123.21341 a 5.9074955,17.266947 0 0 0 5.90824,-17.2399 V 38.904442 A 5.9074955,17.266947 0 0 0 139.86545,21.635299 H 16.65204 A 5.9074955,17.266947 0 0 0 10.743795,38.904442 V 145.17832 a 5.9074955,17.266947 0 0 0 5.908245,17.2399 z"
+ class="st7"
+ id="path43"
+ inkscape:connector-curvature="0"
+ style="fill:#ffffff;stroke:#41719c;stroke-width:1.28185344" /><rect
+ style="fill:none;fill-opacity:1;stroke:#41719c;stroke-width:0.7760548;stroke-opacity:1"
+ id="rect4604"
+ width="15.963434"
+ height="15.954105"
+ x="25.091528"
+ y="121.37455" /><rect
+ style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.7760548;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
+ id="rect4604-7"
+ width="15.963433"
+ height="15.954105"
+ x="41.054958"
+ y="121.37455" /><rect
+ style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.7760548;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
+ id="rect4604-7-6"
+ width="15.963433"
+ height="15.954105"
+ x="57.018402"
+ y="121.37455" /><rect
+ style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.7760548;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
+ id="rect4604-7-6-9"
+ width="15.963433"
+ height="15.954105"
+ x="72.981834"
+ y="121.37455" /><rect
+ style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.7760548;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
+ id="rect4604-7-6-9-8"
+ width="15.963433"
+ height="15.954105"
+ x="88.945259"
+ y="121.37455" /><rect
+ style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.7760548;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
+ id="rect4604-7-6-9-8-9"
+ width="15.963433"
+ height="15.954105"
+ x="104.90869"
+ y="121.37455" /><rect
+ style="font-size:12px;overflow:visible;color-interpolation-filters:sRGB;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#41719c;stroke-width:0.7760548;stroke-linecap:square;stroke-miterlimit:3;stroke-opacity:1"
+ id="rect4604-7-6-9-8-9-6"
+ width="15.963433"
+ height="15.954105"
+ x="120.87212"
+ y="121.37455" /><text
+ x="50.562523"
+ y="49.898369"
+ class="st6"
+ id="text65-3"
+ style="font-size:22.36531448px;font-family:Calibri;overflow:visible;color-interpolation-filters:sRGB;fill:#41719c;fill-rule:evenodd;stroke-width:2.23652411;stroke-linecap:square;stroke-miterlimit:3"
+ transform="scale(0.47106923,2.1228302)" />
<text
- xml:space="preserve"
- style="font-style:normal;font-weight:normal;font-size:28.99296951px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.72482425"
- x="-172.30693"
- y="83.585136"
- id="text4129"
- transform="scale(1.035044,0.96614251)"><tspan
- sodipodi:role="line"
- id="tspan4127"
- x="-172.30693"
- y="109.23712"
- style="stroke-width:0.72482425"></tspan></text>
+ id="text4129"
+ y="80.842018"
+ x="27.862804"
+ style="font-style:normal;font-weight:normal;font-size:30.00008965px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.75000226"
+ xml:space="preserve"><tspan
+ style="stroke-width:0.75000226"
+ y="107.38506"
+ x="27.862804"
+ id="tspan4127"
+ sodipodi:role="line"></tspan></text>
<text
- xml:space="preserve"
- style="font-style:normal;font-weight:normal;font-size:28.99296951px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.72482425"
- x="-174.79263"
- y="75.713715"
- id="text4139"
- transform="scale(1.035044,0.96614251)"><tspan
- sodipodi:role="line"
- id="tspan4137"
- x="-174.79263"
- y="101.3657"
- style="stroke-width:0.72482425"></tspan></text>
-</g><path
+ id="text4139"
+ y="72.697174"
+ x="25.290758"
+ style="font-style:normal;font-weight:normal;font-size:30.00008965px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.75000226"
+ xml:space="preserve"><tspan
+ style="stroke-width:0.75000226"
+ y="99.240219"
+ x="25.290758"
+ id="tspan4137"
+ sodipodi:role="line"></tspan></text>
+<path
style="fill:none;fill-opacity:1;stroke:#41719c;stroke-width:0.86738265px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
d="m 128.80127,137.90141 -0.20704,20.06801 44.6966,-0.10399 0.20705,-93.424256 16.84434,0.62379"
id="path5030"
@@ -298,6 +294,20 @@
class="st2"
y="144.3279"
x="-240.04274">} session_data[];</text>
+<text
+ transform="scale(0.71276665,1.4029837)"
+ style="font-size:14.02988338px;font-family:Calibri;overflow:visible;color-interpolation-filters:sRGB;fill:#386288;fill-rule:evenodd;stroke-width:1.40298378;stroke-linecap:square;stroke-miterlimit:3"
+ id="text24-5-5-1"
+ class="st2"
+ y="58.945786"
+ x="-240.51538">uint16_t user_data_sz;</text>
+<text
+ transform="scale(0.71276665,1.4029837)"
+ style="font-size:14.02988338px;font-family:Calibri;overflow:visible;color-interpolation-filters:sRGB;fill:#386288;fill-rule:evenodd;stroke-width:1.40298378;stroke-linecap:square;stroke-miterlimit:3"
+ id="text24-5-5-2"
+ class="st2"
+ y="189.4823"
+ x="-185.78569">user_data</text>
</g><g
transform="matrix(1.022976,0,0,0.71529071,199.82034,-39.936699)"
id="shape19-6-5"><title
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index ea61f9269..82ebf58f0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -992,6 +992,7 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
}
s.nb_drivers = pool_priv->nb_drivers;
+ s.user_data_sz = pool_priv->user_data_sz;
if ((rte_cryptodev_sym_get_existing_header_session_size(&s) >
obj_size) || (s.nb_drivers <= dev->driver_id) ||
@@ -1307,7 +1308,8 @@ rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
static unsigned int
rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
{
- return (sizeof(sess->sess_data[0]) * sess->nb_drivers);
+ return (sizeof(sess->sess_data[0]) * sess->nb_drivers) +
+ sess->user_data_sz;
}
struct rte_cryptodev_sym_session *
@@ -1335,7 +1337,7 @@ rte_cryptodev_sym_session_create(struct rte_mempool *mp)
}
sess->nb_drivers = pool_priv->nb_drivers;
-
+ sess->user_data_sz = pool_priv->user_data_sz;
/* Clear device session pointer.
* Include the flag indicating presence of user data
@@ -1538,6 +1540,9 @@ rte_cryptodev_sym_session_set_user_data(
if (sess == NULL)
return -EINVAL;
+ if (sess->user_data_sz < size)
+ return -ENOMEM;
+
rte_memcpy(sess->sess_data + sess->nb_drivers, data, size);
return 0;
}
@@ -1546,7 +1551,7 @@ void * __rte_experimental
rte_cryptodev_sym_session_get_user_data(
struct rte_cryptodev_sym_session *sess)
{
- if (sess == NULL)
+ if (sess == NULL || sess->user_data_sz == 0)
return NULL;
return (void *)(sess->sess_data + sess->nb_drivers);
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 81b7fd1aa..4ca7425c6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -959,6 +959,8 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
struct rte_cryptodev_sym_session {
uint16_t nb_drivers;
/**< number of elements in sess_data array */
+ uint16_t user_data_sz;
+ /**< session user data will be placed after sess_data */
__extension__ struct {
void *data;
} sess_data[0];
@@ -1132,7 +1134,8 @@ rte_cryptodev_asym_session_clear(uint8_t dev_id,
struct rte_cryptodev_asym_session *sess);
/**
- * Get the size of the header session, for all registered drivers.
+ * Get the size of the header session, for all registered drivers excluding
+ * the user data size.
*
* @return
* Size of the symmetric eader session.
--
2.13.6
next prev parent reply other threads:[~2019-01-09 22:56 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 17:24 [dpdk-dev] [PATCH 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
2018-11-15 17:24 ` [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure Fan Zhang
2018-11-16 12:05 ` Ananyev, Konstantin
2018-11-19 10:12 ` Zhang, Roy Fan
2018-12-04 16:05 ` Trahe, Fiona
2018-11-15 17:24 ` [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure Fan Zhang
2018-11-16 0:47 ` Ananyev, Konstantin
2018-11-16 14:32 ` Ananyev, Konstantin
2018-11-19 10:11 ` Zhang, Roy Fan
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure Fan Zhang
2018-12-17 19:31 ` Trahe, Fiona
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure Fan Zhang
2018-12-17 20:29 ` Trahe, Fiona
2018-12-18 16:25 ` Zhang, Roy Fan
2018-12-18 16:32 ` Trahe, Fiona
2018-12-11 12:26 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Ananyev, Konstantin
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 0/2] cryptodev: " Fan Zhang
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure Fan Zhang
2019-01-08 23:20 ` De Lara Guarch, Pablo
2019-01-09 11:30 ` Zhang, Roy Fan
2019-01-09 10:41 ` De Lara Guarch, Pablo
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure Fan Zhang
2019-01-08 16:12 ` Trahe, Fiona
2019-01-09 11:01 ` De Lara Guarch, Pablo
2019-01-09 11:10 ` Zhang, Roy Fan
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 01/12] cryptodev: change queue pair configure structure Fan Zhang
2019-01-10 9:47 ` De Lara Guarch, Pablo
2019-01-10 11:24 ` De Lara Guarch, Pablo
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 02/12] cryptodev: add sym session mempool create Fan Zhang
2019-01-10 11:22 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 03/12] app/test-crypto-perf: use separate session mempools Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 04/12] net/softnic: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 05/12] examples: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 06/12] vhost/crypto: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 07/12] test/crypto: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 08/12] cryptodev: add sym session header size API Fan Zhang
2019-01-10 13:28 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 09/12] cryptodev: update symmetric session structure Fan Zhang
2019-01-10 13:06 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` Fan Zhang [this message]
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 11/12] cryptodev: add reference count to session private data Fan Zhang
2019-01-10 12:35 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 12/12] cryptodev: add opaque data field to symmetric session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 00/12] cryptodev: change qp conf and sym session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 01/12] cryptodev: change queue pair configure structure Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 02/12] cryptodev: add sym session mempool create Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 03/12] app/test-crypto-perf: use separate session mempools Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 04/12] net/softnic: " Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 05/12] examples: " Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 06/12] vhost/crypto: " Fan Zhang
2019-01-11 9:13 ` Maxime Coquelin
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 07/12] test/crypto: " Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 08/12] cryptodev: add sym session header size API Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 09/12] cryptodev: update symmetric session structure Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 10/12] cryptodev: add user data size to symmetric session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 11/12] cryptodev: add reference count to session private data Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 12/12] cryptodev: add opaque data field to symmetric session Fan Zhang
2019-01-10 15:06 ` [dpdk-dev] [PATCH v5 00/12] cryptodev: change qp conf and sym session Akhil Goyal
2019-01-10 17:18 ` De Lara Guarch, Pablo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190109225609.20590-11-roy.fan.zhang@intel.com \
--to=roy.fan.zhang@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=pablo.de.lara.guarch@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).