cryptodev: move session type to generic crypto op
[dpdk.git] / lib / librte_cryptodev / rte_crypto.h
index 9019518..b816b45 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -81,6 +81,16 @@ enum rte_crypto_op_status {
        /**< Error handling operation */
 };
 
+/**
+ * Crypto operation session type. This is used to specify whether a crypto
+ * operation has session structure attached for immutable parameters or if all
+ * operation information is included in the operation data structure.
+ */
+enum rte_crypto_op_sess_type {
+       RTE_CRYPTO_OP_WITH_SESSION,     /**< Session based crypto operation */
+       RTE_CRYPTO_OP_SESSIONLESS       /**< Session-less crypto operation */
+};
+
 /**
  * Cryptographic Operation.
  *
@@ -102,6 +112,8 @@ struct rte_crypto_op {
         * will be set to RTE_CRYPTO_OP_STATUS_SUCCESS after crypto operation
         * is successfully processed by a crypto PMD
         */
+       enum rte_crypto_op_sess_type  sess_type;
+       /**< operation session type */
 
        struct rte_mempool *mempool;
        /**< crypto operation mempool which operation is allocated from */
@@ -130,6 +142,7 @@ __rte_crypto_op_reset(struct rte_crypto_op *op, enum rte_crypto_op_type type)
 {
        op->type = type;
        op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
+       op->sess_type = RTE_CRYPTO_OP_SESSIONLESS;
 
        switch (type) {
        case RTE_CRYPTO_OP_TYPE_SYMMETRIC:
@@ -407,6 +420,8 @@ rte_crypto_op_attach_sym_session(struct rte_crypto_op *op,
        if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC))
                return -1;
 
+       op->sess_type = RTE_CRYPTO_OP_WITH_SESSION;
+
        return __rte_crypto_sym_op_attach_sym_session(op->sym, sess);
 }