| 224 | } |
| 225 | |
| 226 | static int32_t |
| 227 | qid_init(struct sw_evdev *sw, unsigned int idx, int type, |
| 228 | const struct rte_event_queue_conf *queue_conf) |
| 229 | { |
| 230 | unsigned int i; |
| 231 | int socket_id = sw->data->socket_id; |
| 232 | struct sw_qid *qid = &sw->qids[idx]; |
| 233 | |
| 234 | /* Initialize the FID structures to no pinning (-1), and zero packets */ |
| 235 | const struct sw_fid_t fid = {.cq = -1, .pcount = 0}; |
| 236 | for (i = 0; i < RTE_DIM(qid->fids); i++) |
| 237 | qid->fids[i] = fid; |
| 238 | |
| 239 | qid->id = idx; |
| 240 | qid->type = type; |
| 241 | qid->priority = queue_conf->priority; |
| 242 | |
| 243 | if (qid->type == RTE_SCHED_TYPE_ORDERED) { |
| 244 | uint32_t window_size; |
| 245 | |
| 246 | /* rte_ring and window_size_mask require window_size to |
| 247 | * be a power-of-2. |
| 248 | */ |
| 249 | window_size = rte_align32pow2( |
| 250 | queue_conf->nb_atomic_order_sequences); |
| 251 | |
| 252 | qid->window_size = window_size - 1; |
| 253 | |
| 254 | if (!window_size) { |
| 255 | SW_LOG_DBG( |
| 256 | "invalid reorder_window_size for ordered queue" |
| 257 | ); |
| 258 | goto cleanup; |
| 259 | } |
| 260 | |
| 261 | qid->reorder_buffer = rte_zmalloc_socket(NULL, |
| 262 | window_size * sizeof(qid->reorder_buffer[0]), |
| 263 | 0, socket_id); |
| 264 | if (!qid->reorder_buffer) { |
| 265 | SW_LOG_DBG("reorder_buffer malloc failed"); |
| 266 | goto cleanup; |
| 267 | } |
| 268 | |
| 269 | memset(&qid->reorder_buffer[0], |
| 270 | 0, |
| 271 | window_size * sizeof(qid->reorder_buffer[0])); |
| 272 | |
| 273 | qid->reorder_buffer_freelist = rob_ring_create(window_size, |
| 274 | socket_id); |
| 275 | if (!qid->reorder_buffer_freelist) { |
| 276 | SW_LOG_DBG("freelist ring create failed"); |
| 277 | goto cleanup; |
| 278 | } |
| 279 | |
| 280 | /* Populate the freelist with reorder buffer entries. Enqueue |
| 281 | * 'window_size - 1' entries because the rte_ring holds only |
| 282 | * that many. |
| 283 | */ |
no test coverage detected