Create crypto device */
| 202 | |
| 203 | /** Create crypto device */ |
| 204 | static int |
| 205 | cryptodev_ccp_create(const char *name, |
| 206 | struct rte_pci_device *pci_dev, |
| 207 | struct ccp_pmd_init_params *init_params, |
| 208 | struct rte_pci_driver *pci_drv) |
| 209 | { |
| 210 | struct rte_cryptodev *dev; |
| 211 | struct ccp_private *internals; |
| 212 | |
| 213 | if (init_params->def_p.name[0] == '\0') |
| 214 | strlcpy(init_params->def_p.name, name, |
| 215 | sizeof(init_params->def_p.name)); |
| 216 | |
| 217 | dev = rte_cryptodev_pmd_create(init_params->def_p.name, |
| 218 | &pci_dev->device, |
| 219 | &init_params->def_p); |
| 220 | if (dev == NULL) { |
| 221 | CCP_LOG_ERR("failed to create cryptodev vdev"); |
| 222 | goto init_error; |
| 223 | } |
| 224 | |
| 225 | if (ccp_probe_device(pci_dev) != 0) { |
| 226 | CCP_LOG_ERR("failed to detect CCP crypto device"); |
| 227 | goto init_error; |
| 228 | } |
| 229 | cryptodev_cnt++; |
| 230 | |
| 231 | CCP_LOG_DBG("CCP : Crypto device count = %d", cryptodev_cnt); |
| 232 | dev->device = &pci_dev->device; |
| 233 | dev->device->driver = &pci_drv->driver; |
| 234 | dev->driver_id = ccp_cryptodev_driver_id; |
| 235 | |
| 236 | /* register rx/tx burst functions for data path */ |
| 237 | dev->dev_ops = ccp_pmd_ops; |
| 238 | dev->enqueue_burst = ccp_pmd_enqueue_burst; |
| 239 | dev->dequeue_burst = ccp_pmd_dequeue_burst; |
| 240 | |
| 241 | dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | |
| 242 | RTE_CRYPTODEV_FF_HW_ACCELERATED | |
| 243 | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | |
| 244 | RTE_CRYPTODEV_FF_SYM_SESSIONLESS; |
| 245 | |
| 246 | internals = dev->data->dev_private; |
| 247 | |
| 248 | internals->max_nb_qpairs = init_params->def_p.max_nb_queue_pairs; |
| 249 | internals->auth_opt = init_params->auth_opt; |
| 250 | internals->crypto_num_dev = cryptodev_cnt; |
| 251 | |
| 252 | rte_cryptodev_pmd_probing_finish(dev); |
| 253 | |
| 254 | return 0; |
| 255 | |
| 256 | init_error: |
| 257 | CCP_LOG_ERR("driver %s: %s() failed", |
| 258 | init_params->def_p.name, __func__); |
| 259 | cryptodev_ccp_remove(pci_dev); |
| 260 | |
| 261 | return -EFAULT; |
no test coverage detected