net/txgbe: fix queue statistics mapping
[dpdk.git] / drivers / crypto / octeontx / otx_cryptodev.c
index 8df4b71..337d06a 100644 (file)
@@ -4,18 +4,20 @@
 
 #include <rte_bus_pci.h>
 #include <rte_common.h>
-#include <rte_cryptodev.h>
-#include <rte_cryptodev_pmd.h>
+#include <cryptodev_pmd.h>
 #include <rte_log.h>
 #include <rte_pci.h>
 
-/* CPT common headers */
-#include "cpt_pmd_logs.h"
-
 #include "otx_cryptodev.h"
 #include "otx_cryptodev_ops.h"
 
-static int otx_cryptodev_logtype;
+#include "cpt_pmd_logs.h"
+
+/* Device ID */
+#define PCI_VENDOR_ID_CAVIUM           0x177d
+#define CPT_81XX_PCI_VF_DEVICE_ID      0xa041
+
+uint8_t otx_cryptodev_driver_id;
 
 static struct rte_pci_id pci_id_cpt_table[] = {
        {
@@ -27,12 +29,6 @@ static struct rte_pci_id pci_id_cpt_table[] = {
        },
 };
 
-static void
-otx_cpt_logtype_init(void)
-{
-       cpt_logtype = otx_cryptodev_logtype;
-}
-
 static int
 otx_cpt_pci_probe(struct rte_pci_driver *pci_drv,
                        struct rte_pci_device *pci_dev)
@@ -57,13 +53,12 @@ otx_cpt_pci_probe(struct rte_pci_driver *pci_drv,
        /* init user callbacks */
        TAILQ_INIT(&(cryptodev->link_intr_cbs));
 
-       /* init logtype used in common */
-       otx_cpt_logtype_init();
-
        /* Invoke PMD device initialization function */
        retval = otx_cpt_dev_create(cryptodev);
-       if (retval == 0)
+       if (retval == 0) {
+               rte_cryptodev_pmd_probing_finish(cryptodev);
                return 0;
+       }
 
        CPT_LOG_ERR("[DRV %s]: Failed to create device "
                        "(vendor_id: 0x%x device_id: 0x%x",
@@ -81,6 +76,7 @@ otx_cpt_pci_remove(struct rte_pci_device *pci_dev)
 {
        struct rte_cryptodev *cryptodev;
        char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+       void *dev_priv;
 
        if (pci_dev == NULL)
                return -EINVAL;
@@ -94,11 +90,13 @@ otx_cpt_pci_remove(struct rte_pci_device *pci_dev)
        if (pci_dev->driver == NULL)
                return -ENODEV;
 
+       dev_priv = cryptodev->data->dev_private;
+
        /* free crypto device */
        rte_cryptodev_pmd_release_device(cryptodev);
 
        if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-               rte_free(cryptodev->data->dev_private);
+               rte_free(dev_priv);
 
        cryptodev->device->driver = NULL;
        cryptodev->device = NULL;
@@ -121,11 +119,4 @@ RTE_PMD_REGISTER_PCI_TABLE(CRYPTODEV_NAME_OCTEONTX_PMD, pci_id_cpt_table);
 RTE_PMD_REGISTER_KMOD_DEP(CRYPTODEV_NAME_OCTEONTX_PMD, "vfio-pci");
 RTE_PMD_REGISTER_CRYPTO_DRIVER(otx_cryptodev_drv, otx_cryptodev_pmd.driver,
                otx_cryptodev_driver_id);
-
-RTE_INIT(otx_cpt_init_log)
-{
-       /* Bus level logs */
-       otx_cryptodev_logtype = rte_log_register("pmd.crypto.octeontx");
-       if (otx_cryptodev_logtype >= 0)
-               rte_log_set_level(otx_cryptodev_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER_DEFAULT(otx_cpt_logtype, NOTICE);