MCPcopy Create free account
hub / github.com/F-Stack/f-stack / get_inuse

Function get_inuse

freebsd/net/iflib.c:399–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397} __aligned(CACHE_LINE_SIZE);
398
399static inline qidx_t
400get_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

Callers 1

iflib_fl_refill_allFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected