+ * iser_poll_for_flush_errors - Don't settle for less than all.
+ * @struct ib_conn: IB context of the connection
+ *
+ * This routine is called when the QP is in error state
+ * It polls the send CQ until all flush errors are consumed and
+ * returns when all flush errors were processed.
+ */
+static void iser_poll_for_flush_errors(struct ib_conn *ib_conn)
+{
+ struct iser_device *device = ib_conn->device;
+ int count = 0;
+
+ while (ib_conn->post_recv_buf_count > 0 ||
+ atomic_read(&ib_conn->post_send_buf_count) > 0) {
+ msleep(100);
+ if (atomic_read(&ib_conn->post_send_buf_count) > 0)
+ iser_drain_tx_cq(device, ib_conn->cq_index);
+
+ count++;
+ /* Don't flood with prints */
+ if (count % 30 == 0)
+ iser_dbg("post_recv %d post_send %d",
+ ib_conn->post_recv_buf_count,
+ atomic_read(&ib_conn->post_send_buf_count));
+ }
+}
+
+/**