This patch corrects driver id for virtio and virtio_user
pmds.

Fixes: 25500d4b8076 ("crypto/virtio: support device init")

Signed-off-by: Rajesh Mudimadugula <rmudimadu...@marvell.com>
---
 drivers/crypto/virtio/virtio_cryptodev.c      | 4 ++--
 drivers/crypto/virtio/virtio_user_cryptodev.c | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/virtio/virtio_cryptodev.c 
b/drivers/crypto/virtio/virtio_cryptodev.c
index fa215fe528..ca06cf2e37 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -550,7 +550,6 @@ crypto_virtio_dev_init(struct rte_cryptodev *cryptodev, 
uint64_t features,
 {
        struct virtio_crypto_hw *hw;
 
-       cryptodev->driver_id = cryptodev_virtio_driver_id;
        cryptodev->dev_ops = &virtio_crypto_dev_ops;
 
        cryptodev->enqueue_burst = virtio_crypto_pkt_tx_burst;
@@ -599,6 +598,7 @@ crypto_virtio_create(const char *name, struct 
rte_pci_device *pci_dev,
        if (cryptodev == NULL)
                return -ENODEV;
 
+       cryptodev->driver_id = cryptodev_virtio_driver_id;
        if (crypto_virtio_dev_init(cryptodev, VIRTIO_CRYPTO_PMD_GUEST_FEATURES,
                        pci_dev) < 0)
                return -1;
@@ -1666,7 +1666,7 @@ virtio_crypto_dev_info_get(struct rte_cryptodev *dev,
        PMD_INIT_FUNC_TRACE();
 
        if (info != NULL) {
-               info->driver_id = cryptodev_virtio_driver_id;
+               info->driver_id = dev->driver_id;
                info->feature_flags = dev->feature_flags;
                info->max_nb_queue_pairs = hw->max_dataqueues;
                /* No limit of number of sessions */
diff --git a/drivers/crypto/virtio/virtio_user_cryptodev.c 
b/drivers/crypto/virtio/virtio_user_cryptodev.c
index 992e8fb43b..4daa188e1d 100644
--- a/drivers/crypto/virtio/virtio_user_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_user_cryptodev.c
@@ -26,6 +26,8 @@
 
 #define virtio_user_get_dev(hwp) container_of(hwp, struct virtio_user_dev, hw)
 
+uint8_t cryptodev_virtio_user_driver_id;
+
 static void
 virtio_user_read_dev_config(struct virtio_crypto_hw *hw, size_t offset,
                     void *dst, int length __rte_unused)
@@ -460,6 +462,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev)
                goto end;
        }
 
+       cryptodev->driver_id = cryptodev_virtio_user_driver_id;
        if (crypto_virtio_dev_init(cryptodev, 
VIRTIO_USER_CRYPTO_PMD_GUEST_FEATURES,
                        NULL) < 0) {
                PMD_INIT_LOG(ERR, "crypto_virtio_dev_init fails");
@@ -563,8 +566,6 @@ static struct rte_vdev_driver virtio_user_driver = {
 
 static struct cryptodev_driver virtio_crypto_drv;
 
-uint8_t cryptodev_virtio_user_driver_id;
-
 RTE_PMD_REGISTER_VDEV(crypto_virtio_user, virtio_user_driver);
 RTE_PMD_REGISTER_CRYPTO_DRIVER(virtio_crypto_drv,
        virtio_user_driver.driver,
-- 
2.34.1

Reply via email to