| 397 | } __aligned(CACHE_LINE_SIZE); |
| 398 | |
| 399 | static inline qidx_t |
| 400 | get_inuse(int size, qidx_t cidx, qidx_t pidx, uint8_t gen) |
| 401 | { |
| 402 | qidx_t used; |
| 403 | |
| 404 | if (pidx > cidx) |
| 405 | used = pidx - cidx; |
| 406 | else if (pidx < cidx) |
| 407 | used = size - cidx + pidx; |
| 408 | else if (gen == 0 && pidx == cidx) |
| 409 | used = 0; |
| 410 | else if (gen == 1 && pidx == cidx) |
| 411 | used = size; |
| 412 | else |
| 413 | panic("bad state"); |
| 414 | |
| 415 | return (used); |
| 416 | } |
| 417 | |
| 418 | #define TXQ_AVAIL(txq) (txq->ift_size - get_inuse(txq->ift_size, txq->ift_cidx, txq->ift_pidx, txq->ift_gen)) |
| 419 |
no test coverage detected