mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
vmxnet3: make descriptor count checks more robust
When we update credits there is a potential for a race causing an overflow of vxcr_next (i.e. incrementing it past vxcr_ndesc). Change the check to >= rather than == to be more robust against this. Reviewed by: emaste Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D43712
This commit is contained in:
parent
e5a54f19be
commit
3ff0dc1af8
|
@ -1429,7 +1429,8 @@ vmxnet3_isc_txd_credits_update(void *vsc, uint16_t txqid, bool clear)
|
||||||
return (1);
|
return (1);
|
||||||
vmxnet3_barrier(sc, VMXNET3_BARRIER_RD);
|
vmxnet3_barrier(sc, VMXNET3_BARRIER_RD);
|
||||||
|
|
||||||
if (++txc->vxcr_next == txc->vxcr_ndesc) {
|
MPASS(txc->vxcr_next < txc->vxcr_ndesc);
|
||||||
|
if (++txc->vxcr_next >= txc->vxcr_ndesc) {
|
||||||
txc->vxcr_next = 0;
|
txc->vxcr_next = 0;
|
||||||
txc->vxcr_gen ^= 1;
|
txc->vxcr_gen ^= 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue