| 92 | } |
| 93 | |
| 94 | struct rte_compressdev * |
| 95 | rte_compressdev_pmd_create(const char *name, |
| 96 | struct rte_device *device, |
| 97 | size_t private_data_size, |
| 98 | struct rte_compressdev_pmd_init_params *params) |
| 99 | { |
| 100 | struct rte_compressdev *compressdev; |
| 101 | |
| 102 | if (params->name[0] != '\0') { |
| 103 | COMPRESSDEV_LOG(INFO, "User specified device name = %s", |
| 104 | params->name); |
| 105 | name = params->name; |
| 106 | } |
| 107 | |
| 108 | COMPRESSDEV_LOG(INFO, "Creating compressdev %s", name); |
| 109 | |
| 110 | COMPRESSDEV_LOG(INFO, "Init parameters - name: %s, socket id: %d", |
| 111 | name, params->socket_id); |
| 112 | |
| 113 | /* allocate device structure */ |
| 114 | compressdev = rte_compressdev_pmd_allocate(name, params->socket_id); |
| 115 | if (compressdev == NULL) { |
| 116 | COMPRESSDEV_LOG(ERR, "Failed to allocate comp device %s", name); |
| 117 | return NULL; |
| 118 | } |
| 119 | |
| 120 | /* allocate private device structure */ |
| 121 | if (rte_eal_process_type() == RTE_PROC_PRIMARY) { |
| 122 | compressdev->data->dev_private = |
| 123 | rte_zmalloc_socket("compressdev device private", |
| 124 | private_data_size, |
| 125 | RTE_CACHE_LINE_SIZE, |
| 126 | params->socket_id); |
| 127 | |
| 128 | if (compressdev->data->dev_private == NULL) { |
| 129 | COMPRESSDEV_LOG(ERR, |
| 130 | "Cannot allocate memory for compressdev" |
| 131 | " %s private data", name); |
| 132 | |
| 133 | rte_compressdev_pmd_release_device(compressdev); |
| 134 | return NULL; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | compressdev->device = device; |
| 139 | |
| 140 | return compressdev; |
| 141 | } |
| 142 | |
| 143 | int |
| 144 | rte_compressdev_pmd_destroy(struct rte_compressdev *compressdev) |
no test coverage detected