summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/mlxcx/mlxcx_gld.c
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2020-09-22 10:39:49 -0400
committerDan McDonald <danmcd@joyent.com>2020-09-22 10:39:49 -0400
commit267e12a7d9bf6e5fcefb9cc00f46bfff0dc5226e (patch)
tree19a3941920d0039c35d53a5cbee189b5ca51995a /usr/src/uts/common/io/mlxcx/mlxcx_gld.c
parent517abc5c668925e6092495bf332233c3599980d2 (diff)
parente9faba760cdf80d7dfa110fe0830917ab94668c2 (diff)
downloadillumos-joyent-vpc.tar.gz
Merge branch 'master' into vpcvpc
Diffstat (limited to 'usr/src/uts/common/io/mlxcx/mlxcx_gld.c')
-rw-r--r--usr/src/uts/common/io/mlxcx/mlxcx_gld.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/usr/src/uts/common/io/mlxcx/mlxcx_gld.c b/usr/src/uts/common/io/mlxcx/mlxcx_gld.c
index 89645bb2b1..941eb0f9e7 100644
--- a/usr/src/uts/common/io/mlxcx/mlxcx_gld.c
+++ b/usr/src/uts/common/io/mlxcx/mlxcx_gld.c
@@ -809,19 +809,32 @@ mlxcx_mac_ring_stop(mac_ring_driver_t rh)
if (wq->mlwq_state & MLXCX_WQ_BUFFERS) {
+ list_t cq_buffers;
+
+ /*
+ * Take the buffers away from the CQ. If the CQ is being
+ * processed and the WQ has been stopped, a completion
+ * which does not match to a buffer will be ignored.
+ */
+ list_create(&cq_buffers, sizeof (mlxcx_buffer_t),
+ offsetof(mlxcx_buffer_t, mlb_cq_entry));
+
+ list_move_tail(&cq_buffers, &cq->mlcq_buffers);
+
+ mutex_enter(&cq->mlcq_bufbmtx);
+ list_move_tail(&cq_buffers, &cq->mlcq_buffers_b);
+ mutex_exit(&cq->mlcq_bufbmtx);
+
+ cq->mlcq_bufcnt = 0;
+
mutex_exit(&wq->mlwq_mtx);
mutex_exit(&cq->mlcq_mtx);
/* Return any outstanding buffers to the free pool. */
- while ((buf = list_remove_head(&cq->mlcq_buffers)) != NULL) {
+ while ((buf = list_remove_head(&cq_buffers)) != NULL) {
mlxcx_buf_return_chain(mlxp, buf, B_FALSE);
}
- mutex_enter(&cq->mlcq_bufbmtx);
- while ((buf = list_remove_head(&cq->mlcq_buffers_b)) != NULL) {
- mlxcx_buf_return_chain(mlxp, buf, B_FALSE);
- }
- mutex_exit(&cq->mlcq_bufbmtx);
- cq->mlcq_bufcnt = 0;
+ list_destroy(&cq_buffers);
s = wq->mlwq_bufs;
mutex_enter(&s->mlbs_mtx);