cryptodev: add user data size to symmetric session
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> Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
This commit is contained in:
parent
e764cd72a9
commit
9e5f5ecb5e
@ -327,6 +327,10 @@ the set API to set the user data and retrieve it using get API.
|
||||
void * rte_cryptodev_sym_session_get_user_data(
|
||||
struct rte_cryptodev_sym_session *sess);
|
||||
|
||||
Please note the ``size`` passed to set API cannot be bigger than the predefined
|
||||
``user_data_sz`` when creating the session header mempool, otherwise the
|
||||
function will return error. Also when ``user_data_sz`` was defined as ``0`` when
|
||||
creating the session header mempool, the get API will always return ``NULL``.
|
||||
|
||||
For session-less mode, the private user data information can be placed along with the
|
||||
``struct rte_crypto_op``. The ``rte_crypto_op::private_data_offset`` indicates the
|
||||
|
@ -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
|
||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@ -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);
|
||||
|
@ -955,6 +955,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];
|
||||
@ -1128,7 +1130,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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user