diff options
| author | John Levon <john.levon@joyent.com> | 2020-04-27 12:13:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-27 12:13:35 +0100 |
| commit | 6fcbeecca7f56c616db6edcc081a5ad4fea1ac05 (patch) | |
| tree | 64e2369c2120a6098fd184d78494ce5c6af48a32 /usr/src/uts/common/io/mlxcx/mlxcx_gld.c | |
| parent | 6b8372c7be33da3e049ec99ed01e05fc957aa76c (diff) | |
| parent | 31f2b09b95899b5b69759d52e8abc6cf122d0e74 (diff) | |
| download | illumos-joyent-6fcbeecca7f56c616db6edcc081a5ad4fea1ac05.tar.gz | |
Merge branch 'master' into OS-8161OS-8161
Diffstat (limited to 'usr/src/uts/common/io/mlxcx/mlxcx_gld.c')
| -rw-r--r-- | usr/src/uts/common/io/mlxcx/mlxcx_gld.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr/src/uts/common/io/mlxcx/mlxcx_gld.c b/usr/src/uts/common/io/mlxcx/mlxcx_gld.c index a1d50659c1..a08cec3980 100644 --- a/usr/src/uts/common/io/mlxcx/mlxcx_gld.c +++ b/usr/src/uts/common/io/mlxcx/mlxcx_gld.c @@ -395,6 +395,7 @@ mlxcx_mac_ring_tx(void *arg, mblk_t *mp) uint32_t chkflags = 0; boolean_t ok; size_t take = 0; + uint_t bcount; VERIFY(mp->b_next == NULL); @@ -430,8 +431,8 @@ mlxcx_mac_ring_tx(void *arg, mblk_t *mp) } } - b = mlxcx_buf_bind_or_copy(mlxp, sq, kmp, take); - if (b == NULL) { + bcount = mlxcx_buf_bind_or_copy(mlxp, sq, kmp, take, &b); + if (bcount == 0) { atomic_or_uint(&sq->mlwq_state, MLXCX_WQ_BLOCKED_MAC); return (mp); } @@ -457,10 +458,12 @@ mlxcx_mac_ring_tx(void *arg, mblk_t *mp) } /* - * Similar logic here: bufcnt is only manipulated atomically, and - * bufhwm is set at startup. + * If the completion queue buffer count is already at or above + * the high water mark, or the addition of this new chain will + * exceed the CQ ring size, then indicate we are blocked. */ - if (cq->mlcq_bufcnt >= cq->mlcq_bufhwm) { + if (cq->mlcq_bufcnt >= cq->mlcq_bufhwm || + (cq->mlcq_bufcnt + bcount) > cq->mlcq_nents) { atomic_or_uint(&cq->mlcq_state, MLXCX_CQ_BLOCKED_MAC); goto blocked; } |
