mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
netmap: iflib: fix asserts in netmap_fl_refill()
When netmap_fl_refill() is called at initialization time (e.g., during netmap_iflib_register()), nic_i must be 0, since the free list is reinitialized. At the end of the refill cycle, nic_i must still be zero, because exactly N descriptors (N is the ring size) are refilled. This patch therefore fixes the assertions to check on nic_i rather than on nm_i. The current netmap_reset() may in fact cause nm_i to be != 0 while the device is resetting: this may happen when multiple non-cooperating processes open different subsets of the available netmap rings. PR: 252518 MFC after: 1 week
This commit is contained in:
parent
1d238b07d5
commit
3189ba6167
1 changed files with 2 additions and 1 deletions
|
|
@ -883,6 +883,7 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init)
|
|||
iru_init(&iru, rxq, 0 /* flid */);
|
||||
map = fl->ifl_sds.ifsd_map;
|
||||
nic_i = fl->ifl_pidx;
|
||||
MPASS(!init || nic_i == 0); /* on init/reset, nic_i must be 0 */
|
||||
MPASS(nic_i == netmap_idx_k2n(kring, nm_i));
|
||||
DBG_COUNTER_INC(fl_refills);
|
||||
while (n > 0) {
|
||||
|
|
@ -923,7 +924,7 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init)
|
|||
ctx->isc_rxd_refill(ctx->ifc_softc, &iru);
|
||||
}
|
||||
fl->ifl_pidx = nic_i;
|
||||
MPASS(!init || nm_i == 0);
|
||||
MPASS(!init || nic_i == 0); /* on init/reset nic_i wraps around to 0 */
|
||||
MPASS(nm_i == kring->rhead);
|
||||
kring->nr_hwcur = nm_i;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue