| NVIDIA DOCA SDK | Data Center on a Chip Framework Documentation |
Typedefs | |
| typedef void(* | doca_sha_task_hash_completion_cb_t) (struct doca_sha_task_hash *task, union doca_data task_user_data, union doca_data ctx_user_data) |
| typedef void(* | doca_sha_task_partial_hash_completion_cb_t) (struct doca_sha_task_partial_hash *task, union doca_data task_user_data, union doca_data ctx_user_data) |
Enumerations | |
| enum | doca_sha_algorithm { DOCA_SHA_ALGORITHM_SHA1 , DOCA_SHA_ALGORITHM_SHA256 , DOCA_SHA_ALGORITHM_SHA512 } |
Functions | |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_create (struct doca_dev *dev, struct doca_sha **sha) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_destroy (struct doca_sha *sha) |
| DOCA_EXPERIMENTAL struct doca_ctx * | doca_sha_as_ctx (struct doca_sha *sha) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_cap_task_hash_get_supported (struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_cap_task_partial_hash_get_supported (struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_cap_get_max_list_buf_num_elem (struct doca_devinfo const *devinfo, uint32_t *max_list_buf_num_elem) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_cap_get_max_src_buf_size (struct doca_devinfo const *devinfo, uint64_t *max_src_buf_size) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_cap_get_min_dst_buf_size (struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm, uint32_t *min_dst_buf_size) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_cap_get_partial_hash_block_size (struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm, uint32_t *partial_block_size) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_cap_get_max_num_tasks (struct doca_sha *sha, uint32_t *max_num_tasks) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_hash_set_conf (struct doca_sha *sha, doca_sha_task_hash_completion_cb_t task_completion_cb, doca_sha_task_hash_completion_cb_t task_error_cb, uint8_t log_num_tasks) |
| This method sets the doca_sha hash task pool configuration. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_hash_alloc_init (struct doca_sha *sha, enum doca_sha_algorithm algorithm, struct doca_buf const *src_buf, struct doca_buf *dst_buf, union doca_data user_data, struct doca_sha_task_hash **task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_hash_set_src (struct doca_sha_task_hash *task, struct doca_buf const *src_buf) |
| DOCA_EXPERIMENTAL struct doca_buf const * | doca_sha_task_hash_get_src (struct doca_sha_task_hash const *task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_hash_set_dst (struct doca_sha_task_hash *task, struct doca_buf *dst_buf) |
| DOCA_EXPERIMENTAL struct doca_buf const * | doca_sha_task_hash_get_dst (struct doca_sha_task_hash const *task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_hash_set_algorithm (struct doca_sha_task_hash *task, enum doca_sha_algorithm algorithm) |
| DOCA_EXPERIMENTAL enum doca_sha_algorithm | doca_sha_task_hash_get_algorithm (struct doca_sha_task_hash const *task) |
| DOCA_EXPERIMENTAL struct doca_task * | doca_sha_task_hash_as_task (struct doca_sha_task_hash *task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_partial_hash_set_conf (struct doca_sha *sha, doca_sha_task_partial_hash_completion_cb_t task_completion_cb, doca_sha_task_partial_hash_completion_cb_t task_error_cb, uint8_t log_num_tasks) |
| This method sets the doca_sha partial hash task pool configuration. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_partial_hash_alloc_init (struct doca_sha *sha, enum doca_sha_algorithm algorithm, struct doca_buf const *src_buf, struct doca_buf *dst_buf, union doca_data user_data, struct doca_sha_task_partial_hash **task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_partial_hash_reset (struct doca_sha_task_partial_hash *task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_partial_hash_set_src (struct doca_sha_task_partial_hash *task, struct doca_buf const *src_buf) |
| DOCA_EXPERIMENTAL struct doca_buf const * | doca_sha_task_partial_hash_get_src (struct doca_sha_task_partial_hash const *task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_partial_hash_set_dst (struct doca_sha_task_partial_hash *task, struct doca_buf *dst_buf) |
| DOCA_EXPERIMENTAL struct doca_buf const * | doca_sha_task_partial_hash_get_dst (struct doca_sha_task_partial_hash const *task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_partial_hash_set_algorithm (struct doca_sha_task_partial_hash *task, enum doca_sha_algorithm algorithm) |
| DOCA_EXPERIMENTAL enum doca_sha_algorithm | doca_sha_task_partial_hash_get_algorithm (struct doca_sha_task_partial_hash const *task) |
| DOCA_EXPERIMENTAL doca_error_t | doca_sha_task_partial_hash_set_is_final_buf (struct doca_sha_task_partial_hash *task) |
| DOCA_EXPERIMENTAL uint8_t | doca_sha_task_partial_hash_get_is_final (struct doca_sha_task_partial_hash const *task) |
| DOCA_EXPERIMENTAL uint8_t | doca_sha_task_partial_hash_get_has_result (struct doca_sha_task_partial_hash const *task) |
| DOCA_EXPERIMENTAL struct doca_task * | doca_sha_task_partial_hash_as_task (struct doca_sha_task_partial_hash *task) |
DOCA SHA library. For more details please refer to the user guide on DOCA devzone.
| typedef void(* doca_sha_task_hash_completion_cb_t) (struct doca_sha_task_hash *task, union doca_data task_user_data, union doca_data ctx_user_data) |
Signature of a doca_sha_task_hash completion or error call-back.
Note: A callback may choose to invoke doca_task_free to release the task during the execution of the callback.
| [in] | task | Completed task. The implementation can assume this value is never NULL. |
| [in] | task_user_data | User data as provided during doca_sha_task_hash_alloc_init. |
| [in] | ctx_user_data | User data as provided during doca_ctx_set_user_data. |
Definition at line 283 of file doca_sha.h.
| typedef void(* doca_sha_task_partial_hash_completion_cb_t) (struct doca_sha_task_partial_hash *task, union doca_data task_user_data, union doca_data ctx_user_data) |
Signature of doca_sha_task_partial_hash completion or error call-back.
Note: A callback may choose to invoke doca_task_free to release the task during the execution of the callback.
| [in] | task | Completed task. The implementation can assume this value is never NULL. |
| [in] | task_user_data | User data as provided during doca_sha_task_hash_alloc_init. |
| [in] | ctx_user_data | User data as provided during doca_ctx_set_user_data. |
Definition at line 496 of file doca_sha.h.
| enum doca_sha_algorithm |
Doca sha action type enums, used to specify sha task types.
| Enumerator | |
|---|---|
| DOCA_SHA_ALGORITHM_SHA1 | |
| DOCA_SHA_ALGORITHM_SHA256 | |
| DOCA_SHA_ALGORITHM_SHA512 | |
Definition at line 108 of file doca_sha.h.
| DOCA_EXPERIMENTAL struct doca_ctx* doca_sha_as_ctx | ( | struct doca_sha * | sha | ) |
Adapt a pointer to a doca_sha instance to a general doca_ctx pointer for use with core objects. This does not imply any transfer of ownership. The existing owner of the doca_sha instance continues to be responsible for its' lifetime and must ensure it outlives any core objects which refer to it.
| [in] | sha | doca_sha instance. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_list_buf_num_elem | ( | struct doca_devinfo const * | devinfo, |
| uint32_t * | max_list_buf_num_elem | ||
| ) |
Query the maximum number of chained doca buffers which can be processed for any task submitted to doca_sha
| [in] | devinfo | The DOCA device information. |
| [out] | max_list_buf_num_elem | The maximum supported number of elements in DOCA linked-list buffer. The value 1 indicates that only a single element is supported. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_num_tasks | ( | struct doca_sha * | sha, |
| uint32_t * | max_num_tasks | ||
| ) |
Get the maximum number of tasks
This method retrieves the maximum number of tasks for a device.
| [in] | sha | The sha context |
| [out] | max_num_tasks | Max number of doca_sha_task_hash or doca_sha_task_partial_hash tasks |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_src_buf_size | ( | struct doca_devinfo const * | devinfo, |
| uint64_t * | max_src_buf_size | ||
| ) |
Query the maximum length of data that can be submitted with a task (chained or un-chained)
| [in] | devinfo | The DOCA device information. |
| [out] | max_src_buf_size | The maximum supported buffer size in bytes. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_min_dst_buf_size | ( | struct doca_devinfo const * | devinfo, |
| enum doca_sha_algorithm | algorithm, | ||
| uint32_t * | min_dst_buf_size | ||
| ) |
Query the minimum length of an output buffer for any doca_sha task. A task must have at least this much space in its' output buffer but it may not write to all of it, the actual size of the result can be queried from the output doca buffer when the task has produced an output. Providing an output buffer with less space than this is undefined behavior. The user is responsible for ensuring this requirement is met, it will not be checked during task submission unless task verification is requested.
| [in] | devinfo | The DOCA device information. |
| [in] | algorithm | The algorithm for which to query this capability. |
| [out] | min_dst_buf_size | The minimum required output buffer space. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_partial_hash_block_size | ( | struct doca_devinfo const * | devinfo, |
| enum doca_sha_algorithm | algorithm, | ||
| uint32_t * | partial_block_size | ||
| ) |
All intermediate (non final) input buffers submitted for a partial SHA task must be a multiple of the value returned form this function. The user is responsible for ensuring this requirement is met, it will not be checked during task submission unless task verification is requested.
| [in] | devinfo | The DOCA device information. |
| [in] | algorithm | The algorithm for which to query this capability. |
| [out] | partial_block_size | The partial input buffer block size. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_task_hash_get_supported | ( | struct doca_devinfo const * | devinfo, |
| enum doca_sha_algorithm | algorithm | ||
| ) |
Query if the device represented by the given devinfo is capable of performing doca_sha hash tasks using a given algorithm.
| [in] | devinfo | The DOCA device information. |
| [in] | algorithm | The algorithm to check support for. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_task_partial_hash_get_supported | ( | struct doca_devinfo const * | devinfo, |
| enum doca_sha_algorithm | algorithm | ||
| ) |
Query if the device represented by the given devinfo is capable of performing doca_sha partial hash tasks using a given algorithm.
| [in] | devinfo | The DOCA device information. |
| [in] | algorithm | The algorithm to check support for. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_create | ( | struct doca_dev * | dev, |
| struct doca_sha ** | sha | ||
| ) |
Create an instance of doca_sha
| [in] | dev | The device this doca_sha instance will operate with |
| [out] | sha | Pointer to a pointer which will be populated to point to the newly created doca_sha instance upon success. Caller assumes ownership of the created doca_sha instance and is responsible for destroying it later when no longer required |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_destroy | ( | struct doca_sha * | sha | ) |
Destroy an instance of doca_sha.
| [in] | sha | Pointer to the doca_sha instance to destroy |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_alloc_init | ( | struct doca_sha * | sha, |
| enum doca_sha_algorithm | algorithm, | ||
| struct doca_buf const * | src_buf, | ||
| struct doca_buf * | dst_buf, | ||
| union doca_data | user_data, | ||
| struct doca_sha_task_hash ** | task | ||
| ) |
Allocate doca_sha hash task
This method allocates and initializes a task. The user can choose to modify the task using the associated setters while the task is not in flight. The user may choose to reconfigure and reuse a task or to release it and get a new task as per their own requirements.
| [in] | sha | The doca_sha context to allocate the task from. |
| [in] | algorithm | SHA algorithm to use. |
| [in] | src_buf | Source buffer. |
| [in] | dst_buf | Destination buffer. |
| [in] | user_data | doca_data that can be retrieved from the task (usually when the task is completed). |
| [out] | task | The allocated task. |
| DOCA_EXPERIMENTAL struct doca_task* doca_sha_task_hash_as_task | ( | struct doca_sha_task_hash * | task | ) |
Adapt a pointer to a doca_sha hash task instance to a general doca_task pointer for use with core objects. This does not imply any transfer of ownership. The existing owner of the task continues to be responsible for its' lifetime and must ensure it remains alive until it has completed (successfully, with an error or it was flushed).
| [in] | task | Task to adapt to a doca_task. |
| DOCA_EXPERIMENTAL enum doca_sha_algorithm doca_sha_task_hash_get_algorithm | ( | struct doca_sha_task_hash const * | task | ) |
Get the current algorithm in use by this task.
The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.
| [in] | task | Task to query. |
| DOCA_EXPERIMENTAL struct doca_buf const* doca_sha_task_hash_get_dst | ( | struct doca_sha_task_hash const * | task | ) |
Get the current destination buffer in use by this task.
The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.
| [in] | task | Task to query. |
| DOCA_EXPERIMENTAL struct doca_buf const* doca_sha_task_hash_get_src | ( | struct doca_sha_task_hash const * | task | ) |
Get the current source buffer in use by this task.
The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.
| [in] | task | Task to query. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_algorithm | ( | struct doca_sha_task_hash * | task, |
| enum doca_sha_algorithm | algorithm | ||
| ) |
Set the SHA algorithm to use for this task.
| [in] | task | Task to configure. |
| [in] | algorithm | SHA algorithm to use. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_conf | ( | struct doca_sha * | sha, |
| doca_sha_task_hash_completion_cb_t | task_completion_cb, | ||
| doca_sha_task_hash_completion_cb_t | task_error_cb, | ||
| uint8_t | log_num_tasks | ||
| ) |
This method sets the doca_sha hash task pool configuration.
| [in] | sha | The SHA context to configure. |
| [in] | task_completion_cb | Task completion callback. |
| [in] | task_error_cb | Task error callback. |
| [in] | log_num_tasks | Log2 of number of tasks. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_dst | ( | struct doca_sha_task_hash * | task, |
| struct doca_buf * | dst_buf | ||
| ) |
Set a doca buffer as the destination data for this task.
| [in] | task | Task to configure. |
| [in] | dst_buf | Destination buffer to use. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_src | ( | struct doca_sha_task_hash * | task, |
| struct doca_buf const * | src_buf | ||
| ) |
Set a doca buffer as the source data for this task.
| [in] | task | Task to configure. |
| [in] | src_buf | Source buffer to use. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_alloc_init | ( | struct doca_sha * | sha, |
| enum doca_sha_algorithm | algorithm, | ||
| struct doca_buf const * | src_buf, | ||
| struct doca_buf * | dst_buf, | ||
| union doca_data | user_data, | ||
| struct doca_sha_task_partial_hash ** | task | ||
| ) |
Allocate doca_sha hash task
This method allocates and initializes a task. The user can choose to modify the task using the associated setters while the task is not in flight. With partial tasks it is expected that a user will re-use and re-submit the same task with a new source buffer each time to progress the partial SHA calculation. Once the final part of a partial SHA is completed the user can then either reset or release the task.
| [in] | sha | The doca_sha context to allocate the task from. |
| [in] | algorithm | SHA algorithm to use. |
| [in] | src_buf | Source buffer. |
| [in] | dst_buf | Destination buffer. |
| [in] | user_data | doca_data that can be retrieved from the task (Only set after the final task is completed) |
| [out] | task | The allocated task. |
| DOCA_EXPERIMENTAL struct doca_task* doca_sha_task_partial_hash_as_task | ( | struct doca_sha_task_partial_hash * | task | ) |
Adapt a pointer to a doca_sha partial hash task instance to a general doca_task pointer for use with core objects. This does not imply any transfer of ownership. The existing owner of the task continues to be responsible for its' lifetime and must ensure it remains alive until it has completed (successfully, with an error or it was flushed).
| [in] | task | Task to adapt to a doca_task. |
| DOCA_EXPERIMENTAL enum doca_sha_algorithm doca_sha_task_partial_hash_get_algorithm | ( | struct doca_sha_task_partial_hash const * | task | ) |
Get the current algorithm in use by this task.
The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.
| [in] | task | Task to query. |
| DOCA_EXPERIMENTAL struct doca_buf const* doca_sha_task_partial_hash_get_dst | ( | struct doca_sha_task_partial_hash const * | task | ) |
Get the current destination buffer in use by this task.
The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.
| [in] | task | Task to query. |
| DOCA_EXPERIMENTAL uint8_t doca_sha_task_partial_hash_get_has_result | ( | struct doca_sha_task_partial_hash const * | task | ) |
Does the destination buffer of this task hold a valid value.
| [in] | task | Task to configure |
| DOCA_EXPERIMENTAL uint8_t doca_sha_task_partial_hash_get_is_final | ( | struct doca_sha_task_partial_hash const * | task | ) |
Get if this task is marked as the final segment of a partial SHA calculation or not.
The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.
| [in] | task | Task to query. |
| DOCA_EXPERIMENTAL struct doca_buf const* doca_sha_task_partial_hash_get_src | ( | struct doca_sha_task_partial_hash const * | task | ) |
Get the current source buffer in use by this task.
The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.
| [in] | task | Task to query. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_reset | ( | struct doca_sha_task_partial_hash * | task | ) |
Reset the partial state of this task so it can be re-used. This can be called at any time. All existing partial session state will be lost and cannot be recovered.
| [in] | task | Task to reset. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_algorithm | ( | struct doca_sha_task_partial_hash * | task, |
| enum doca_sha_algorithm | algorithm | ||
| ) |
Set the SHA algorithm to use for this task.
This value can only be set before the first task is sent. (after alloc_init, or after clearing reset)
| [in] | task | Task to configure |
| [in] | algorithm | SHA algorithm to use. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_conf | ( | struct doca_sha * | sha, |
| doca_sha_task_partial_hash_completion_cb_t | task_completion_cb, | ||
| doca_sha_task_partial_hash_completion_cb_t | task_error_cb, | ||
| uint8_t | log_num_tasks | ||
| ) |
This method sets the doca_sha partial hash task pool configuration.
| [in] | sha | The SHA context to configure. |
| [in] | task_completion_cb | Task completion callback. |
| [in] | task_error_cb | Task error callback. |
| [in] | log_num_tasks | Log2 of number of tasks. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_dst | ( | struct doca_sha_task_partial_hash * | task, |
| struct doca_buf * | dst_buf | ||
| ) |
Set a doca buffer as the destination data for this task.
This value can only be set before the first task is sent. (after alloc_init, or after calling reset)
| [in] | task | Task to configure |
| [in] | dst_buf | Destination buffer to use. |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_is_final_buf | ( | struct doca_sha_task_partial_hash * | task | ) |
Identify this task as the final part of the partial SHA. Upon successful completion of this task
This must not be set on the first partial buffer. Instead you should use a non partial hash task.
Note: Setting the final flag on the first buffer is undefined behavior.
| [in] | task | Task to configure |
| DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_src | ( | struct doca_sha_task_partial_hash * | task, |
| struct doca_buf const * | src_buf | ||
| ) |
Set a doca buffer as the source data for this task.
NOTE: If this is the non final segment of a partial hash it must have a data length that is a multiple of the SHA block size. The user is responsible to ensuring this, failure to ensure this is undefined behavior. The final source buffer is not required to be a multiple of the SHA block size.
| [in] | task | Task to configure. |
| [in] | src_buf | Source buffer to use. |