* Fills one descriptor with mbufs. Does not advance the head index. */
| 312 | * Fills one descriptor with mbufs. Does not advance the head index. |
| 313 | */ |
| 314 | static __rte_always_inline int |
| 315 | ionic_rx_fill_one(struct ionic_rx_qcq *rxq) |
| 316 | { |
| 317 | struct ionic_queue *q = &rxq->qcq.q; |
| 318 | struct rte_mbuf *rxm; |
| 319 | struct ionic_rxq_desc *desc, *desc_base = q->base; |
| 320 | rte_iova_t data_iova; |
| 321 | void **info; |
| 322 | int ret; |
| 323 | |
| 324 | info = &q->info[q->head_idx]; |
| 325 | desc = &desc_base[q->head_idx]; |
| 326 | |
| 327 | /* mbuf is unused */ |
| 328 | if (info[0]) |
| 329 | return 0; |
| 330 | |
| 331 | if (rxq->mb_idx == 0) { |
| 332 | ret = rte_mempool_get_bulk(rxq->mb_pool, |
| 333 | (void **)rxq->mbs, |
| 334 | IONIC_MBUF_BULK_ALLOC); |
| 335 | if (ret) { |
| 336 | assert(0); |
| 337 | return -ENOMEM; |
| 338 | } |
| 339 | |
| 340 | rxq->mb_idx = IONIC_MBUF_BULK_ALLOC; |
| 341 | } |
| 342 | |
| 343 | rxm = rxq->mbs[--rxq->mb_idx]; |
| 344 | info[0] = rxm; |
| 345 | |
| 346 | data_iova = rte_mbuf_data_iova_default(rxm); |
| 347 | desc->addr = rte_cpu_to_le_64(data_iova); |
| 348 | |
| 349 | return 0; |
| 350 | } |
| 351 | |
| 352 | /* |
| 353 | * Walk the CQ to find completed receive descriptors. |
no test coverage detected