| 299 | } |
| 300 | |
| 301 | int |
| 302 | ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs) |
| 303 | { |
| 304 | if (!rte_is_power_of_2(num_descs) || |
| 305 | num_descs < IONIC_MIN_RING_DESC || |
| 306 | num_descs > IONIC_MAX_RING_DESC) { |
| 307 | IONIC_PRINT(ERR, "%u descriptors (min: %u max: %u)", |
| 308 | num_descs, IONIC_MIN_RING_DESC, IONIC_MAX_RING_DESC); |
| 309 | return -EINVAL; |
| 310 | } |
| 311 | |
| 312 | cq->num_descs = num_descs; |
| 313 | cq->size_mask = num_descs - 1; |
| 314 | cq->tail_idx = 0; |
| 315 | cq->done_color = 1; |
| 316 | |
| 317 | return 0; |
| 318 | } |
| 319 | |
| 320 | void |
| 321 | ionic_cq_reset(struct ionic_cq *cq) |
no test coverage detected