Re: [PATCH 03/12] scsi: iscsi: Add recv workqueue helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/7/22 16:27, Mike Christie wrote:
Add helpers to allow the drivers to run their recv paths from libiscsi's
workqueue.

Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx>
---
  drivers/scsi/libiscsi.c | 29 +++++++++++++++++++++++++++--
  include/scsi/libiscsi.h |  4 ++++
  2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index fa44445dc75f..fec64cbfa4b6 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -93,6 +93,16 @@ inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn)
  }
  EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit);
+inline void iscsi_conn_queue_recv(struct iscsi_conn *conn)
+{
+	struct Scsi_Host *shost = conn->session->host;
+	struct iscsi_host *ihost = shost_priv(shost);
+
+	if (ihost->workq && !test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))
+		queue_work(ihost->workq, &conn->recvwork);
+}
+EXPORT_SYMBOL_GPL(iscsi_conn_queue_recv);
+
  static void __iscsi_update_cmdsn(struct iscsi_session *session,
  				 uint32_t exp_cmdsn, uint32_t max_cmdsn)
  {
@@ -1942,7 +1952,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_queue);
/**
   * iscsi_suspend_tx - suspend iscsi_data_xmit
- * @conn: iscsi conn tp stop processing IO on.
+ * @conn: iscsi conn to stop processing IO on.
   *
   * This function sets the suspend bit to prevent iscsi_data_xmit
   * from sending new IO, and if work is queued on the xmit thread
@@ -1955,7 +1965,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn)
set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
  	if (ihost->workq)
-		flush_workqueue(ihost->workq);
+		flush_work(&conn->xmitwork);
  }
  EXPORT_SYMBOL_GPL(iscsi_suspend_tx);
@@ -1965,6 +1975,21 @@ static void iscsi_start_tx(struct iscsi_conn *conn)
  	iscsi_conn_queue_xmit(conn);
  }
+/**
+ * iscsi_suspend_rx - Prevent recvwork from running again.
+ * @conn: iscsi conn to stop.
+ */
+void iscsi_suspend_rx(struct iscsi_conn *conn)
+{
+	struct Scsi_Host *shost = conn->session->host;
+	struct iscsi_host *ihost = shost_priv(shost);
+
+	set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags);
+	if (ihost->workq)
+		flush_work(&conn->recvwork);
+}
+EXPORT_SYMBOL_GPL(iscsi_suspend_rx);
+
  /*
   * We want to make sure a ping is in flight. It has timed out.
   * And we are not busy processing a pdu that is making
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index b567ea4700e5..522fd16f1dbb 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -201,6 +201,8 @@ struct iscsi_conn {
  	struct list_head	cmdqueue;	/* data-path cmd queue */
  	struct list_head	requeue;	/* tasks needing another run */
  	struct work_struct	xmitwork;	/* per-conn. xmit workqueue */
+	/* recv */
+	struct work_struct	recvwork;
  	unsigned long		flags;		/* ISCSI_CONN_FLAGs */
/* negotiated params */
@@ -440,8 +442,10 @@ extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
  extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr,
  				     enum iscsi_param param, char *buf);
  extern void iscsi_suspend_tx(struct iscsi_conn *conn);
+extern void iscsi_suspend_rx(struct iscsi_conn *conn);
  extern void iscsi_suspend_queue(struct iscsi_conn *conn);
  extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn);
+extern void iscsi_conn_queue_recv(struct iscsi_conn *conn);
#define iscsi_conn_printk(prefix, _c, fmt, a...) \
  	iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \

Reviewed-by: Lee Duncan <lduncan@xxxxxxxx>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux