cryptodev: decouple from PCI device
This makes struct rte_cryptodev independent of struct rte_pci_device by replacing it with a pointer to the generic struct rte_device. This is inline with the recent changes in ethdev Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> Acked-by: John Griffin <john.griffin@intel.com> Reviewed-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This commit is contained in:
parent
b815872e70
commit
3b84878c4b
@ -136,6 +136,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
|
||||
int socket_id)
|
||||
{
|
||||
struct qat_qp *qp;
|
||||
struct rte_pci_device *pci_dev;
|
||||
int ret;
|
||||
char op_cookie_pool_name[RTE_RING_NAMESIZE];
|
||||
uint32_t i;
|
||||
@ -156,7 +157,9 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (dev->pci_dev->mem_resource[0].addr == NULL) {
|
||||
pci_dev = RTE_DEV_TO_PCI(dev->device);
|
||||
|
||||
if (pci_dev->mem_resource[0].addr == NULL) {
|
||||
PMD_DRV_LOG(ERR, "Could not find VF config space "
|
||||
"(UIO driver attached?).");
|
||||
return -EINVAL;
|
||||
@ -181,7 +184,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
|
||||
qp_conf->nb_descriptors * sizeof(*qp->op_cookies),
|
||||
RTE_CACHE_LINE_SIZE);
|
||||
|
||||
qp->mmap_bar_addr = dev->pci_dev->mem_resource[0].addr;
|
||||
qp->mmap_bar_addr = pci_dev->mem_resource[0].addr;
|
||||
rte_atomic16_init(&qp->inflights16);
|
||||
|
||||
if (qat_tx_queue_create(dev, &(qp->tx_q),
|
||||
@ -344,6 +347,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
|
||||
void *io_addr;
|
||||
const struct rte_memzone *qp_mz;
|
||||
uint32_t queue_size_bytes = nb_desc*desc_size;
|
||||
struct rte_pci_device *pci_dev;
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
if (desc_size > ADF_MSG_SIZE_TO_BYTES(ADF_MAX_MSG_SIZE)) {
|
||||
@ -404,7 +408,9 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
|
||||
|
||||
queue_base = BUILD_RING_BASE_ADDR(queue->base_phys_addr,
|
||||
queue->queue_size);
|
||||
io_addr = dev->pci_dev->mem_resource[0].addr;
|
||||
pci_dev = RTE_DEV_TO_PCI(dev->device);
|
||||
|
||||
io_addr = pci_dev->mem_resource[0].addr;
|
||||
|
||||
WRITE_CSR_RING_BASE(io_addr, queue->hw_bundle_number,
|
||||
queue->hw_queue_number, queue_base);
|
||||
|
@ -88,9 +88,9 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
PMD_DRV_LOG(DEBUG, "Found crypto device at %02x:%02x.%x",
|
||||
cryptodev->pci_dev->addr.bus,
|
||||
cryptodev->pci_dev->addr.devid,
|
||||
cryptodev->pci_dev->addr.function);
|
||||
RTE_DEV_TO_PCI(cryptodev->device)->addr.bus,
|
||||
RTE_DEV_TO_PCI(cryptodev->device)->addr.devid,
|
||||
RTE_DEV_TO_PCI(cryptodev->device)->addr.function);
|
||||
|
||||
cryptodev->dev_type = RTE_CRYPTODEV_QAT_SYM_PMD;
|
||||
cryptodev->dev_ops = &crypto_qat_ops;
|
||||
|
@ -520,7 +520,7 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
|
||||
"device data");
|
||||
}
|
||||
|
||||
cryptodev->pci_dev = pci_dev;
|
||||
cryptodev->device = &pci_dev->device;
|
||||
cryptodev->driver = cryptodrv;
|
||||
|
||||
/* init user callbacks */
|
||||
@ -580,7 +580,7 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
|
||||
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
|
||||
rte_free(cryptodev->data->dev_private);
|
||||
|
||||
cryptodev->pci_dev = NULL;
|
||||
cryptodev->device = NULL;
|
||||
cryptodev->driver = NULL;
|
||||
cryptodev->data = NULL;
|
||||
|
||||
@ -941,7 +941,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
|
||||
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
|
||||
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
|
||||
|
||||
dev_info->pci_dev = dev->pci_dev;
|
||||
dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
|
||||
if (dev->driver)
|
||||
dev_info->driver_name = dev->driver->pci_drv.driver.name;
|
||||
}
|
||||
|
@ -636,8 +636,8 @@ struct rte_cryptodev {
|
||||
/**< Functions exported by PMD */
|
||||
uint64_t feature_flags;
|
||||
/**< Supported features */
|
||||
struct rte_pci_device *pci_dev;
|
||||
/**< PCI info. supplied by probing */
|
||||
struct rte_device *device;
|
||||
/**< Backing device */
|
||||
|
||||
enum rte_cryptodev_type dev_type;
|
||||
/**< Crypto device type */
|
||||
|
Loading…
x
Reference in New Issue
Block a user