Skip to content

Commit

Permalink
api: crypto: allow both basic and out-of-place ops in one session
Browse files Browse the repository at this point in the history
Introduce ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP crypto operation type that
allows both basic and out-of-place operations in the same session.
The actual operation type applied depends on whether an output packet
is specified.

This can be useful for applications that want to perform both basic
and out-of-place operations with the same crypto and cannot have two
different sessions due to memory pressure or packet ordering constraints.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Anoob Joseph <anoobj@marvell.com>
  • Loading branch information
JannePeltonen authored and MatiasElo committed Oct 20, 2023
1 parent 88bab54 commit 68baf7c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/odp/api/spec/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ int odp_crypto_result(odp_crypto_packet_result_t *result,
* segmentation) of the output packet may differ from that of the input
* packet.
*
* The value of pktout[n] is ignored as pktout[n] is used purely as an
* The value of pkt_out[n] is ignored as pkt_out[n] is used purely as an
* output parameter that returns the handle of the newly allocated packet.
*
* ODP_CRYPTO_OP_TYPE_OOP:
Expand Down Expand Up @@ -264,6 +264,12 @@ int odp_crypto_result(odp_crypto_packet_result_t *result,
* the MAC/digest result. pkt_out[n] must not be the same as any input
* packet or any other output packet.
*
* OOP_CRYPTO_OP_TYPE_BASIC_AND_OOP:
*
* Behaves as the ODP_CRYPTO_OP_TYPE_BASIC operation type if pkt_out[n] is
* ODP_PACKET_INVALID. Otherwise behaves as the ODP_CRYPTO_OP_TYPE_OOP
* operation type.
*
* @param pkt_in Packets to be processed
* @param[in,out] pkt_out Packet handle array for resulting packets
* @param param Operation parameters array
Expand Down
15 changes: 15 additions & 0 deletions include/odp/api/spec/crypto_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,21 @@ typedef enum odp_crypto_op_type_t {
* MAC/digest (in encode sessions) of the input packet.
*/
ODP_CRYPTO_OP_TYPE_OOP,

/**
* Basic or out-of-place crypto operation depending on op params.
*
* If the output packet specified in a crypto operation (i.e.
* pkt_out[i] is ODP_PACKET_INVALID) then the packet is processed
* the same way as in the ODP_CRYPTO_OP_TYPE_BASIC operation type.
* Otherwise the packet is processed as in the ODP_CRYPTO_OP_TYPE_OOP
* operation type.
*
* Sessions of this operation type may have lower performance than
* the more specific operation types.
*/
ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP,

} odp_crypto_op_type_t;

/**
Expand Down

0 comments on commit 68baf7c

Please sign in to comment.