common/sfc_efx/base: fix dereferencing null pointer
[dpdk.git] / drivers / common / qat / qat_device.h
index 09a4c55..e6337c6 100644 (file)
@@ -32,6 +32,37 @@ enum qat_comp_num_im_buffers {
        QAT_NUM_INTERM_BUFS_GEN3 = 20
 };
 
+struct qat_device_info {
+       const struct rte_memzone *mz;
+       /**< mz to store the qat_pci_device so it can be
+        * shared across processes
+        */
+       struct rte_pci_device *pci_dev;
+       struct rte_device sym_rte_dev;
+       /**< This represents the crypto sym subset of this pci device.
+        * Register with this rather than with the one in
+        * pci_dev so that its driver can have a crypto-specific name
+        */
+
+       struct rte_device asym_rte_dev;
+       /**< This represents the crypto asym subset of this pci device.
+        * Register with this rather than with the one in
+        * pci_dev so that its driver can have a crypto-specific name
+        */
+
+       struct rte_device comp_rte_dev;
+       /**< This represents the compression subset of this pci device.
+        * Register with this rather than with the one in
+        * pci_dev so that its driver can have a compression-specific name
+        */
+};
+
+extern struct qat_device_info qat_pci_devs[];
+
+struct qat_sym_dev_private;
+struct qat_asym_dev_private;
+struct qat_comp_dev_private;
+
 /*
  * This struct holds all the data about a QAT pci device
  * including data about all services it supports.
@@ -39,27 +70,20 @@ enum qat_comp_num_im_buffers {
  *  - hw_data
  *  - config data
  *  - runtime data
+ * Note: as this data can be shared in a multi-process scenario,
+ * any pointers in it must also point to shared memory.
  */
-struct qat_sym_dev_private;
-struct qat_asym_dev_private;
-struct qat_comp_dev_private;
-
 struct qat_pci_device {
 
        /* Data used by all services */
        char name[QAT_DEV_NAME_MAX_LEN];
        /**< Name of qat pci device */
        uint8_t qat_dev_id;
-       /**< Device instance for this qat pci device */
-       struct rte_pci_device *pci_dev;
-       /**< PCI information. */
+       /**< Id of device instance for this qat pci device */
        enum qat_device_gen qat_dev_gen;
        /**< QAT device generation */
        rte_spinlock_t arb_csr_lock;
        /**< lock to protect accesses to the arbiter CSR */
-       __extension__
-       uint8_t attached : 1;
-       /**< Flag indicating the device is attached */
 
        struct qat_qp *qps_in_use[QAT_MAX_SERVICES][ADF_MAX_QPS_ON_ANY_SERVICE];
        /**< links to qps set up for each service, index same as on API */
@@ -67,32 +91,20 @@ struct qat_pci_device {
        /* Data relating to symmetric crypto service */
        struct qat_sym_dev_private *sym_dev;
        /**< link back to cryptodev private data */
-       struct rte_device sym_rte_dev;
-       /**< This represents the crypto sym subset of this pci device.
-        * Register with this rather than with the one in
-        * pci_dev so that its driver can have a crypto-specific name
-        */
+
+       int qat_sym_driver_id;
+       /**< Symmetric driver id used by this device */
 
        /* Data relating to asymmetric crypto service */
        struct qat_asym_dev_private *asym_dev;
        /**< link back to cryptodev private data */
-       struct rte_device asym_rte_dev;
-       /**< This represents the crypto asym subset of this pci device.
-        * Register with this rather than with the one in
-        * pci_dev so that its driver can have a crypto-specific name
-        */
+
+       int qat_asym_driver_id;
+       /**< Symmetric driver id used by this device */
 
        /* Data relating to compression service */
        struct qat_comp_dev_private *comp_dev;
        /**< link back to compressdev private data */
-       struct rte_device comp_rte_dev;
-       /**< This represents the compression subset of this pci device.
-        * Register with this rather than with the one in
-        * pci_dev so that its driver can have a compression-specific name
-        */
-
-       /* Data relating to asymmetric crypto service */
-
 };
 
 struct qat_gen_hw_data {
@@ -107,9 +119,6 @@ struct qat_pci_device *
 qat_pci_device_allocate(struct rte_pci_device *pci_dev,
                struct qat_dev_cmd_param *qat_dev_cmd_param);
 
-int
-qat_pci_device_release(struct rte_pci_device *pci_dev);
-
 struct qat_pci_device *
 qat_get_qat_dev_from_pci_dev(struct rte_pci_device *pci_dev);