| 277 | } |
| 278 | |
| 279 | static uint32_t |
| 280 | ccp_lsb_alloc(struct ccp_queue *cmd_q, unsigned int count) |
| 281 | { |
| 282 | struct ccp_device *ccp; |
| 283 | int start; |
| 284 | |
| 285 | /* First look at the map for the queue */ |
| 286 | if (cmd_q->lsb >= 0) { |
| 287 | start = (uint32_t)ccp_bitmap_find_next_zero_area(cmd_q->lsbmap, |
| 288 | LSB_SIZE, 0, |
| 289 | count); |
| 290 | if (start < LSB_SIZE) { |
| 291 | ccp_bitmap_set(cmd_q->lsbmap, start, count); |
| 292 | return start + cmd_q->lsb * LSB_SIZE; |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | /* try to get an entry from the shared blocks */ |
| 297 | ccp = cmd_q->dev; |
| 298 | |
| 299 | rte_spinlock_lock(&ccp->lsb_lock); |
| 300 | |
| 301 | start = (uint32_t)ccp_bitmap_find_next_zero_area(ccp->lsbmap, |
| 302 | MAX_LSB_CNT * LSB_SIZE, |
| 303 | 0, count); |
| 304 | if (start <= MAX_LSB_CNT * LSB_SIZE) { |
| 305 | ccp_bitmap_set(ccp->lsbmap, start, count); |
| 306 | rte_spinlock_unlock(&ccp->lsb_lock); |
| 307 | return start * LSB_ITEM_SIZE; |
| 308 | } |
| 309 | CCP_LOG_ERR("NO LSBs available"); |
| 310 | |
| 311 | rte_spinlock_unlock(&ccp->lsb_lock); |
| 312 | |
| 313 | return 0; |
| 314 | } |
| 315 | |
| 316 | static void __rte_unused |
| 317 | ccp_lsb_free(struct ccp_queue *cmd_q, |
no test coverage detected