virtqueue_nused has load-acquire or rte_io_rmb insed */
| 419 | |
| 420 | /* virtqueue_nused has load-acquire or rte_io_rmb insed */ |
| 421 | static inline uint16_t |
| 422 | virtqueue_nused(const struct virtqueue *vq) |
| 423 | { |
| 424 | uint16_t idx; |
| 425 | |
| 426 | if (vq->hw->weak_barriers) { |
| 427 | /** |
| 428 | * x86 prefers to using rte_smp_rmb over __atomic_load_n as it |
| 429 | * reports a slightly better perf, which comes from the saved |
| 430 | * branch by the compiler. |
| 431 | * The if and else branches are identical with the smp and io |
| 432 | * barriers both defined as compiler barriers on x86. |
| 433 | */ |
| 434 | #ifdef RTE_ARCH_X86_64 |
| 435 | idx = vq->vq_split.ring.used->idx; |
| 436 | rte_smp_rmb(); |
| 437 | #else |
| 438 | idx = __atomic_load_n(&(vq)->vq_split.ring.used->idx, |
| 439 | __ATOMIC_ACQUIRE); |
| 440 | #endif |
| 441 | } else { |
| 442 | idx = vq->vq_split.ring.used->idx; |
| 443 | rte_io_rmb(); |
| 444 | } |
| 445 | return idx - vq->vq_used_cons_idx; |
| 446 | } |
| 447 | |
| 448 | void vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx); |
| 449 | void vq_ring_free_chain_packed(struct virtqueue *vq, uint16_t used_idx); |
no outgoing calls
no test coverage detected