cryptodev: fix initialization on multi-process

Primary process is responsible to initialize the data struct of each
crypto devices.

Secondary process should not override this data during the
initialization.

Fixes: d11b0f30df ("cryptodev: introduce API and framework for crypto devices")
Cc: stable@dpdk.org

Signed-off-by: Julien Meunier <julien.meunier@nokia.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
This commit is contained in:
Julien Meunier 2019-08-07 11:39:23 +03:00 committed by Akhil Goyal
parent e2e60edbdb
commit 1a60db7f35

View File

@ -725,12 +725,14 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
cryptodev->data = *cryptodev_data;
strlcpy(cryptodev->data->name, name,
RTE_CRYPTODEV_NAME_MAX_LEN);
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
strlcpy(cryptodev->data->name, name,
RTE_CRYPTODEV_NAME_MAX_LEN);
cryptodev->data->dev_id = dev_id;
cryptodev->data->socket_id = socket_id;
cryptodev->data->dev_started = 0;
cryptodev->data->dev_id = dev_id;
cryptodev->data->socket_id = socket_id;
cryptodev->data->dev_started = 0;
}
/* init user callbacks */
TAILQ_INIT(&(cryptodev->link_intr_cbs));