Private data
~~~~~~~~~~~~
For session-based operations, the set and get API provides a mechanism for an
-application to store and retrieve the private data information stored along with
-the crypto session.
+application to store and retrieve the private user data information stored along
+with the crypto session.
For example, suppose an application is submitting a crypto operation with a session
-associated and wants to indicate private data information which is required to be
+associated and wants to indicate private user data information which is required to be
used after completion of the crypto operation. In this case, the application can use
-the set API to set the private data and retrieve it using get API.
+the set API to set the user data and retrieve it using get API.
.. code-block:: c
- int rte_cryptodev_sym_session_set_private_data(
+ int rte_cryptodev_sym_session_set_user_data(
struct rte_cryptodev_sym_session *sess, void *data, uint16_t size);
- void * rte_cryptodev_sym_session_get_private_data(
+ void * rte_cryptodev_sym_session_get_user_data(
struct rte_cryptodev_sym_session *sess);
-For session-less mode, the private data information can be placed along with the
+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
start of private data information. The offset is counted from the start of the
rte_crypto_op including other crypto information such as the IVs (since there can
The ``rte_crypto_op::private_data_offset`` is used to locate the request/
response in the ``rte_crypto_op``.
-For crypto session, ``rte_cryptodev_sym_session_set_private_data()`` API
+For crypto session, ``rte_cryptodev_sym_session_set_user_data()`` API
will be used to set request/response data. The same data will be obtained
-by ``rte_cryptodev_sym_session_get_private_data()`` API. The
+by ``rte_cryptodev_sym_session_get_user_data()`` API. The
RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA capability indicates
whether HW or SW supports this feature.
m_data.request_info.cdev_id = cdev_id;
m_data.request_info.queue_pair_id = qp_id;
/* Call set API to store private data information */
- rte_cryptodev_sym_session_set_private_data(
+ rte_cryptodev_sym_session_set_user_data(
op->sym->session,
&m_data,
sizeof(m_data));
- ``RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT``
- ``RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT``
+* cryptodev: Renamed cryptodev experimental APIs:
+
+ Used user_data instead of private_data in following APIs to avoid confusion
+ with the existing session parameter ``sess_private_data[]`` and related APIs.
+ ``rte_cryptodev_sym_session_set_private_data()`` changed to
+ ``rte_cryptodev_sym_session_set_user_data()``
+ ``rte_cryptodev_sym_session_get_private_data()`` changed to
+ ``rte_cryptodev_sym_session_get_user_data()``
+
* compressdev: Feature flag ``RTE_COMP_FF_MBUF_SCATTER_GATHER`` is
replaced with the following more explicit flags:
- ``RTE_COMP_FF_OOP_SGL_IN_SGL_OUT``
}
/* Clear device session pointer.
- * Include the flag indicating presence of private data
+ * Include the flag indicating presence of user data
*/
memset(sess, 0, (sizeof(void *) * nb_drivers) + sizeof(uint8_t));
/*
* Header contains pointers to the private data
* of all registered drivers, and a flag which
- * indicates presence of private data
+ * indicates presence of user data
*/
return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
}
}
int __rte_experimental
-rte_cryptodev_sym_session_set_private_data(
+rte_cryptodev_sym_session_set_user_data(
struct rte_cryptodev_sym_session *sess,
void *data,
uint16_t size)
{
uint16_t off_set = sizeof(void *) * nb_drivers;
- uint8_t *private_data_present = (uint8_t *)sess + off_set;
+ uint8_t *user_data_present = (uint8_t *)sess + off_set;
if (sess == NULL)
return -EINVAL;
- *private_data_present = 1;
+ *user_data_present = 1;
off_set += sizeof(uint8_t);
rte_memcpy((uint8_t *)sess + off_set, data, size);
return 0;
}
void * __rte_experimental
-rte_cryptodev_sym_session_get_private_data(
+rte_cryptodev_sym_session_get_user_data(
struct rte_cryptodev_sym_session *sess)
{
uint16_t off_set = sizeof(void *) * nb_drivers;
- uint8_t *private_data_present = (uint8_t *)sess + off_set;
+ uint8_t *user_data_present = (uint8_t *)sess + off_set;
- if (sess == NULL || !*private_data_present)
+ if (sess == NULL || !*user_data_present)
return NULL;
off_set += sizeof(uint8_t);
const char *rte_cryptodev_driver_name_get(uint8_t driver_id);
/**
- * Set private data for a session.
+ * Store user data in a session.
*
* @param sess Session pointer allocated by
* *rte_cryptodev_sym_session_create*.
- * @param data Pointer to the private data.
- * @param size Size of the private data.
+ * @param data Pointer to the user data.
+ * @param size Size of the user data.
*
* @return
* - On success, zero.
* - On failure, a negative value.
*/
int __rte_experimental
-rte_cryptodev_sym_session_set_private_data(
+rte_cryptodev_sym_session_set_user_data(
struct rte_cryptodev_sym_session *sess,
void *data,
uint16_t size);
/**
- * Get private data of a session.
+ * Get user data stored in a session.
*
* @param sess Session pointer allocated by
* *rte_cryptodev_sym_session_create*.
*
* @return
- * - On success return pointer to private data.
+ * - On success return pointer to user data.
* - On failure returns NULL.
*/
void * __rte_experimental
-rte_cryptodev_sym_session_get_private_data(
+rte_cryptodev_sym_session_get_user_data(
struct rte_cryptodev_sym_session *sess);
#ifdef __cplusplus
EXPERIMENTAL {
global:
- rte_cryptodev_sym_session_get_private_data;
- rte_cryptodev_sym_session_set_private_data;
+ rte_cryptodev_sym_session_get_user_data;
+ rte_cryptodev_sym_session_set_user_data;
};
if (crypto_op == NULL)
continue;
if (crypto_op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- m_data = rte_cryptodev_sym_session_get_private_data(
+ m_data = rte_cryptodev_sym_session_get_user_data(
crypto_op->sym->session);
if (m_data == NULL) {
rte_pktmbuf_free(crypto_op->sym->m_src);
for (i = 0; i < num; i++) {
struct rte_event *ev = &events[nb_ev++];
if (ops[i]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
- m_data = rte_cryptodev_sym_session_get_private_data(
+ m_data = rte_cryptodev_sym_session_get_user_data(
ops[i]->sym->session);
} else if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS &&
ops[i]->private_data_offset) {
TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) {
- /* Fill in private date information */
+ /* Fill in private user data information */
rte_memcpy(&m_data.response_info, &response_info,
sizeof(response_info));
rte_memcpy(&m_data.request_info, &request_info,
sizeof(request_info));
- rte_cryptodev_sym_session_set_private_data(sess,
+ rte_cryptodev_sym_session_set_user_data(sess,
&m_data, sizeof(m_data));
}
TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) {
- /* Fill in private data information */
+ /* Fill in private user data information */
rte_memcpy(&m_data.response_info, &response_info,
sizeof(m_data));
- rte_cryptodev_sym_session_set_private_data(sess,
+ rte_cryptodev_sym_session_set_user_data(sess,
&m_data, sizeof(m_data));
}
rte_cryptodev_sym_session_init(TEST_CDEV_ID, sess,