| 99 | } |
| 100 | |
| 101 | struct rte_cryptodev * |
| 102 | rte_cryptodev_pmd_create(const char *name, |
| 103 | struct rte_device *device, |
| 104 | struct rte_cryptodev_pmd_init_params *params) |
| 105 | { |
| 106 | struct rte_cryptodev *cryptodev; |
| 107 | |
| 108 | if (params->name[0] != '\0') { |
| 109 | CDEV_LOG_INFO("User specified device name = %s", params->name); |
| 110 | name = params->name; |
| 111 | } |
| 112 | |
| 113 | CDEV_LOG_INFO("Creating cryptodev %s", name); |
| 114 | |
| 115 | CDEV_LOG_INFO("Initialisation parameters - name: %s," |
| 116 | "socket id: %d, max queue pairs: %u", |
| 117 | name, params->socket_id, params->max_nb_queue_pairs); |
| 118 | |
| 119 | /* allocate device structure */ |
| 120 | cryptodev = rte_cryptodev_pmd_allocate(name, params->socket_id); |
| 121 | if (cryptodev == NULL) { |
| 122 | CDEV_LOG_ERR("Failed to allocate crypto device for %s", name); |
| 123 | return NULL; |
| 124 | } |
| 125 | |
| 126 | /* allocate private device structure */ |
| 127 | if (rte_eal_process_type() == RTE_PROC_PRIMARY) { |
| 128 | cryptodev->data->dev_private = |
| 129 | rte_zmalloc_socket("cryptodev device private", |
| 130 | params->private_data_size, |
| 131 | RTE_CACHE_LINE_SIZE, |
| 132 | params->socket_id); |
| 133 | |
| 134 | if (cryptodev->data->dev_private == NULL) { |
| 135 | CDEV_LOG_ERR("Cannot allocate memory for cryptodev %s" |
| 136 | " private data", name); |
| 137 | |
| 138 | rte_cryptodev_pmd_release_device(cryptodev); |
| 139 | return NULL; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | cryptodev->device = device; |
| 144 | |
| 145 | /* initialise user call-back tail queue */ |
| 146 | TAILQ_INIT(&(cryptodev->link_intr_cbs)); |
| 147 | |
| 148 | return cryptodev; |
| 149 | } |
| 150 | |
| 151 | int |
| 152 | rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev) |
no test coverage detected