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

Function iflib_fl_refill_all

freebsd/net/iflib.c:2143–2168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2141}
2142
2143static inline uint8_t
2144iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl)
2145{
2146 /*
2147 * We leave an unused descriptor to avoid pidx to catch up with cidx.
2148 * This is important as it confuses most NICs. For instance,
2149 * Intel NICs have (per receive ring) RDH and RDT registers, where
2150 * RDH points to the next receive descriptor to be used by the NIC,
2151 * and RDT for the next receive descriptor to be published by the
2152 * driver to the NIC (RDT - 1 is thus the last valid one).
2153 * The condition RDH == RDT means no descriptors are available to
2154 * the NIC, and thus it would be ambiguous if it also meant that
2155 * all the descriptors are available to the NIC.
2156 */
2157 int32_t reclaimable = fl->ifl_size - fl->ifl_credits - 1;
2158#ifdef INVARIANTS
2159 int32_t delta = fl->ifl_size - get_inuse(fl->ifl_size, fl->ifl_cidx, fl->ifl_pidx, fl->ifl_gen) - 1;
2160#endif
2161
2162 MPASS(fl->ifl_credits <= fl->ifl_size);
2163 MPASS(reclaimable == delta);
2164
2165 if (reclaimable > 0)
2166 return (iflib_fl_refill(ctx, fl, reclaimable));
2167 return (0);
2168}
2169
2170uint8_t
2171iflib_in_detach(if_ctx_t ctx)

Callers 1

iflib_rxeofFunction · 0.85

Calls 2

get_inuseFunction · 0.85
iflib_fl_refillFunction · 0.85

Tested by

no test coverage detected