cryptodev: do not use AAD in wireless algorithms
[dpdk.git] / lib / librte_cryptodev / rte_cryptodev.h
index d61a43e..75b423a 100644 (file)
@@ -49,6 +49,7 @@ extern "C" {
 #include "rte_crypto.h"
 #include "rte_dev.h"
 #include <rte_common.h>
+#include <rte_vdev.h>
 
 #define CRYPTODEV_NAME_NULL_PMD                crypto_null
 /**< Null crypto PMD device name */
@@ -70,6 +71,8 @@ extern "C" {
 /**< ARMv8 Crypto PMD device name */
 #define CRYPTODEV_NAME_SCHEDULER_PMD   crypto_scheduler
 /**< Scheduler Crypto PMD device name */
+#define CRYPTODEV_NAME_DPAA2_SEC_PMD   cryptodev_dpaa2_sec_pmd
+/**< NXP DPAA2 - SEC PMD device name */
 
 /** Crypto device type */
 enum rte_cryptodev_type {
@@ -83,6 +86,7 @@ enum rte_cryptodev_type {
        RTE_CRYPTODEV_OPENSSL_PMD,    /**<  OpenSSL PMD */
        RTE_CRYPTODEV_ARMV8_PMD,        /**< ARMv8 crypto PMD */
        RTE_CRYPTODEV_SCHEDULER_PMD,    /**< Crypto Scheduler PMD */
+       RTE_CRYPTODEV_DPAA2_SEC_PMD,    /**< NXP DPAA2 - SEC PMD */
 };
 
 extern const char **rte_cyptodev_names;
@@ -115,6 +119,38 @@ extern const char **rte_cyptodev_names;
 #define CDEV_PMD_TRACE(...) (void)0
 #endif
 
+
+
+/**
+ * A macro that points to an offset from the start
+ * of the crypto operation structure (rte_crypto_op)
+ *
+ * The returned pointer is cast to type t.
+ *
+ * @param c
+ *   The crypto operation.
+ * @param o
+ *   The offset from the start of the crypto operation.
+ * @param t
+ *   The type to cast the result into.
+ */
+#define rte_crypto_op_ctod_offset(c, t, o)     \
+       ((t)((char *)(c) + (o)))
+
+/**
+ * A macro that returns the physical address that points
+ * to an offset from the start of the crypto operation
+ * (rte_crypto_op)
+ *
+ * @param c
+ *   The crypto operation.
+ * @param o
+ *   The offset from the start of the crypto operation
+ *   to calculate address from.
+ */
+#define rte_crypto_op_ctophys_offset(c, o)     \
+       (phys_addr_t)((c)->phys_addr + (o))
+
 /**
  * Crypto parameters range description
  */
@@ -148,6 +184,8 @@ struct rte_cryptodev_symmetric_capability {
                        /**< digest size range */
                        struct rte_crypto_param_range aad_size;
                        /**< Additional authentication data size range */
+                       struct rte_crypto_param_range iv_size;
+                       /**< Initialisation vector data size range */
                } auth;
                /**< Symmetric Authentication transform capabilities */
                struct {
@@ -224,6 +262,7 @@ rte_cryptodev_sym_capability_check_cipher(
  * @param      key_size        Auth key size.
  * @param      digest_size     Auth digest size.
  * @param      aad_size        Auth aad size.
+ * @param      iv_size         Auth initial vector size.
  *
  * @return
  *   - Return 0 if the parameters are in range of the capability.
@@ -232,7 +271,8 @@ rte_cryptodev_sym_capability_check_cipher(
 int
 rte_cryptodev_sym_capability_check_auth(
                const struct rte_cryptodev_symmetric_capability *capability,
-               uint16_t key_size, uint16_t digest_size, uint16_t aad_size);
+               uint16_t key_size, uint16_t digest_size, uint16_t aad_size,
+               uint16_t iv_size);
 
 /**
  * Provide the cipher algorithm enum, given an algorithm string
@@ -332,6 +372,10 @@ struct rte_cryptodev_info {
        struct {
                unsigned max_nb_sessions;
                /**< Maximum number of sessions supported by device. */
+               unsigned int max_nb_sessions_per_qp;
+               /**< Maximum number of sessions per queue pair.
+                * Default 0 for infinite sessions
+                */
        } sym;
 };
 
@@ -378,35 +422,6 @@ struct rte_cryptodev_stats {
 
 #define RTE_CRYPTODEV_NAME_MAX_LEN     (64)
 /**< Max length of name of crypto PMD */
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS  8
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS     2048
-
-/**
- * @internal
- * Initialisation parameters for virtual crypto devices
- */
-struct rte_crypto_vdev_init_params {
-       unsigned max_nb_queue_pairs;
-       unsigned max_nb_sessions;
-       uint8_t socket_id;
-       char name[RTE_CRYPTODEV_NAME_MAX_LEN];
-};
-
-/**
- * Parse virtual device initialisation parameters input arguments
- * @internal
- *
- * @params     params          Initialisation parameters with defaults set.
- * @params     input_args      Command line arguments
- *
- * @return
- * 0 on successful parse
- * <0 on failure to parse
- */
-int
-rte_cryptodev_parse_vdev_init_params(
-               struct rte_crypto_vdev_init_params *params,
-               const char *input_args);
 
 /**
  * Create a virtual crypto device
@@ -456,9 +471,10 @@ extern uint8_t
 rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
 
 /**
- * Get number and identifiers of attached crypto device.
+ * Get number and identifiers of attached crypto devices that
+ * use the same crypto driver.
  *
- * @param      dev_name        device name.
+ * @param      driver_name     driver name.
  * @param      devices         output devices identifiers.
  * @param      nb_devices      maximal number of devices.
  *
@@ -466,7 +482,7 @@ rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
  *   Returns number of attached crypto device.
  */
 uint8_t
-rte_cryptodev_devices_get(const char *dev_name, uint8_t *devices,
+rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
                uint8_t nb_devices);
 /*
  * Return the NUMA socket to which a device is connected
@@ -714,8 +730,6 @@ struct rte_cryptodev {
        enqueue_pkt_burst_t enqueue_burst;
        /**< Pointer to PMD transmit function. */
 
-       const struct rte_cryptodev_driver *driver;
-       /**< Driver for this device */
        struct rte_cryptodev_data *data;
        /**< Pointer to device data */
        struct rte_cryptodev_ops *dev_ops;
@@ -915,6 +929,36 @@ extern struct rte_cryptodev_sym_session *
 rte_cryptodev_sym_session_free(uint8_t dev_id,
                struct rte_cryptodev_sym_session *session);
 
+/**
+ * Attach queue pair with sym session.
+ *
+ * @param      qp_id           Queue pair to which session will be attached.
+ * @param      session         Session pointer previously allocated by
+ *                             *rte_cryptodev_sym_session_create*.
+ *
+ * @return
+ *  - On success, zero.
+ *  - On failure, a negative value.
+ */
+int
+rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id,
+               struct rte_cryptodev_sym_session *session);
+
+/**
+ * Detach queue pair with sym session.
+ *
+ * @param      qp_id           Queue pair to which session is attached.
+ * @param      session         Session pointer previously allocated by
+ *                             *rte_cryptodev_sym_session_create*.
+ *
+ * @return
+ *  - On success, zero.
+ *  - On failure, a negative value.
+ */
+int
+rte_cryptodev_queue_pair_detach_sym_session(uint16_t qp_id,
+               struct rte_cryptodev_sym_session *session);
+
 
 #ifdef __cplusplus
 }