Security Software—Programming Model
Intel
®
EP80579 Software for Security Applications on Intel
®
QuickAssist Technology
PG August 2009
46 Order Number: 320183-004US
• There is a 1:1 relationship between an asynchronous request call and a completion
callback (response). [NPF API] allows for 1:N relationships here. The complexity
associated with managing multiple responses per callback was judged to outweigh
the potential performance benfit of coalescing responses. As a result of this:
— There is only one asynchronous response per callback.
— There is no need for an overall status.
— There is no need for the callback data to contain a number/array of
asynchronous responses.
For a summary of what is contained within this callback data structure, see Section
10.4.3, “Callback Data Structures” on page 46.
Note that the context in which callbacks are invoked is described in Section 3.5,
“Process View” on page 18.
10.4.2 Memory Allocation and Ownership
[NPF API], Section 6.4, briefly discusses memory ownership. To make the issue clearer,
the following conventions have been adopted.
For all output parameters on asynchronous API functions, the following memory
allocation model applies:
• Memory should be allocated by the client
• The memory is passed into the Acceleration API function as a pointer.
• The pointer is returned in the callback data structure, which is a parameter to the
completion callback function.
• Memory should be freed by the client.
This means that ownership is temporarily granted to the asynchronous API
implementation, and reverts to the client only after the function completion callback
function is invoked. See Section 10.4.1, “Asynchronous API and Function Completion
Callbacks” on page 45 for details.
In some of the EP80579 security software APIs, there are numerous input and output
parameters, and/or multiple parameters within a single data structure, some of which
are inputs and some of which are outputs. To make the memory ownership clear in
these cases, all memory for which ownership is temporarily granted to the API
implementation should be grouped into a single data structure. By convention, this
data structure has the suffix “_op_data_t” (for operation data).
Where there is a single output parameter, this struct is typically not created.
Any exceptions to this model are documented by the corresponding APIs. For example,
in some cases, the ownership of a data structure is retained by the API implementation
even after the function completion callback has been invoked.
10.4.3 Callback Data Structures
The function completion callback function takes the following parameters:
• Correlator (discussed in Section 10.4.1, “Asynchronous API and Function
Completion Callbacks” on page 45)
• Callback data structure, which contains the following information:
— Status of the requested operation