cryptodev: change device configuration API
authorFan Zhang <roy.fan.zhang@intel.com>
Fri, 17 Feb 2017 12:01:00 +0000 (12:01 +0000)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 5 Apr 2017 22:17:44 +0000 (00:17 +0200)
This patch changes the device configuration API for rte_cryptodev_ops
function prototype, and update all cryptodev PMDs for this change.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
14 files changed:
doc/guides/rel_notes/deprecation.rst
drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
drivers/crypto/armv8/rte_armv8_pmd_ops.c
drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
drivers/crypto/null/null_crypto_pmd_ops.c
drivers/crypto/openssl/rte_openssl_pmd_ops.c
drivers/crypto/qat/qat_crypto.c
drivers/crypto/qat/qat_crypto.h
drivers/crypto/scheduler/scheduler_pmd_ops.c
drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
drivers/crypto/zuc/rte_zuc_pmd_ops.c
lib/librte_cryptodev/rte_cryptodev.c
lib/librte_cryptodev/rte_cryptodev_pmd.h

index 1df3b46..6bf245d 100644 (file)
@@ -76,10 +76,6 @@ Deprecation Notices
   Target release for removal of the legacy API will be defined once most
   PMDs have switched to rte_flow.
 
-* ABI changes are planned for 17.05 in the ``rte_cryptodev_ops`` structure.
-  A pointer to a rte_cryptodev_config structure will be added to the
-  function prototype ``cryptodev_configure_t``, as a new parameter.
-
 * cryptodev: A new parameter ``max_nb_sessions_per_qp`` will be added to
   ``rte_cryptodev_info.sym``. Some drivers may support limited number of
   sessions per queue_pair. With this new parameter application will know
index afeb4fb..1fc047b 100644 (file)
@@ -114,7 +114,8 @@ static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {
 
 /** Configure device */
 static int
-aesni_gcm_pmd_config(__rte_unused struct rte_cryptodev *dev)
+aesni_gcm_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
index 0f94919..d2bae19 100644 (file)
@@ -233,7 +233,8 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 
 /** Configure device */
 static int
-aesni_mb_pmd_config(__rte_unused struct rte_cryptodev *dev)
+aesni_mb_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
index 0815fcb..4d9ccbf 100644 (file)
@@ -111,7 +111,8 @@ static const struct rte_cryptodev_capabilities
 
 /** Configure device */
 static int
-armv8_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev)
+armv8_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
index e27bc5c..62ebdbd 100644 (file)
@@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities kasumi_pmd_capabilities[] = {
 
 /** Configure device */
 static int
-kasumi_pmd_config(__rte_unused struct rte_cryptodev *dev)
+kasumi_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
index 4a24537..12c946c 100644 (file)
@@ -85,7 +85,8 @@ static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =
 
 /** Configure device */
 static int
-null_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev)
+null_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
index 1beba3a..131a37c 100644 (file)
@@ -449,7 +449,8 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
 
 /** Configure device */
 static int
-openssl_pmd_config(__rte_unused struct rte_cryptodev *dev)
+openssl_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
index 43e1d00..67cb8f8 100644 (file)
@@ -1326,10 +1326,11 @@ void qat_crypto_sym_session_init(struct rte_mempool *mp, void *sym_sess)
                offsetof(struct rte_cryptodev_sym_session, _private);
 }
 
-int qat_dev_config(__rte_unused struct rte_cryptodev *dev)
+int qat_dev_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        PMD_INIT_FUNC_TRACE();
-       return -ENOTSUP;
+       return 0;
 }
 
 int qat_dev_start(__rte_unused struct rte_cryptodev *dev)
index 5766817..78bb2bc 100644 (file)
@@ -85,7 +85,8 @@ struct qat_pmd_private {
        /**< Max number of sessions supported by device */
 };
 
-int qat_dev_config(struct rte_cryptodev *dev);
+int qat_dev_config(struct rte_cryptodev *dev,
+               struct rte_cryptodev_config *config);
 int qat_dev_start(struct rte_cryptodev *dev);
 void qat_dev_stop(struct rte_cryptodev *dev);
 int qat_dev_close(struct rte_cryptodev *dev);
index 287b2fb..d72266d 100644 (file)
@@ -43,7 +43,8 @@
 
 /** Configure device */
 static int
-scheduler_pmd_config(struct rte_cryptodev *dev)
+scheduler_pmd_config(struct rte_cryptodev *dev,
+               struct rte_cryptodev_config *config)
 {
        struct scheduler_ctx *sched_ctx = dev->data->dev_private;
        uint32_t i;
@@ -54,7 +55,8 @@ scheduler_pmd_config(struct rte_cryptodev *dev)
                struct rte_cryptodev *slave_dev =
                                rte_cryptodev_pmd_get_dev(slave_dev_id);
 
-               ret = (*slave_dev->dev_ops->dev_configure)(slave_dev);
+               ret = (*slave_dev->dev_ops->dev_configure)(slave_dev,
+                               config);
                if (ret < 0)
                        break;
        }
index e0fb3cc..7ce96be 100644 (file)
@@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities snow3g_pmd_capabilities[] = {
 
 /** Configure device */
 static int
-snow3g_pmd_config(__rte_unused struct rte_cryptodev *dev)
+snow3g_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
index 0d98313..e793459 100644 (file)
@@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities zuc_pmd_capabilities[] = {
 
 /** Configure device */
 static int
-zuc_pmd_config(__rte_unused struct rte_cryptodev *dev)
+zuc_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
index 0ac23ed..114dd57 100644 (file)
@@ -957,6 +957,8 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
                return -EBUSY;
        }
 
+       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+
        /* Setup new number of queue pairs and reconfigure device. */
        diag = rte_cryptodev_queue_pairs_config(dev, config->nb_queue_pairs,
                        config->socket_id);
@@ -967,10 +969,14 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
        }
 
        /* Setup Session mempool for device */
-       return rte_cryptodev_sym_session_pool_create(dev,
+       diag = rte_cryptodev_sym_session_pool_create(dev,
                        config->session_mp.nb_objs,
                        config->session_mp.cache_size,
                        config->socket_id);
+       if (diag != 0)
+               return diag;
+
+       return (*dev->dev_ops->dev_configure)(dev, config);
 }
 
 
index 1a417e2..8d95dac 100644 (file)
@@ -201,10 +201,12 @@ extern struct rte_cryptodev *rte_cryptodevs;
  *     Function used to configure device.
  *
  * @param      dev     Crypto device pointer
+ *             config  Crypto device configurations
  *
  * @return     Returns 0 on success
  */
-typedef int (*cryptodev_configure_t)(struct rte_cryptodev *dev);
+typedef int (*cryptodev_configure_t)(struct rte_cryptodev *dev,
+               struct rte_cryptodev_config *config);
 
 /**
  * Function used to start a configured device.