aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libiscsi.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index a7ee4bb4070..67b2a2b0028 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -109,12 +109,9 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn)
109} 109}
110EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); 110EXPORT_SYMBOL_GPL(iscsi_conn_queue_work);
111 111
112void 112static void __iscsi_update_cmdsn(struct iscsi_session *session,
113iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr) 113 uint32_t exp_cmdsn, uint32_t max_cmdsn)
114{ 114{
115 uint32_t max_cmdsn = be32_to_cpu(hdr->max_cmdsn);
116 uint32_t exp_cmdsn = be32_to_cpu(hdr->exp_cmdsn);
117
118 /* 115 /*
119 * standard specifies this check for when to update expected and 116 * standard specifies this check for when to update expected and
120 * max sequence numbers 117 * max sequence numbers
@@ -138,6 +135,12 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)
138 iscsi_conn_queue_work(session->leadconn); 135 iscsi_conn_queue_work(session->leadconn);
139 } 136 }
140} 137}
138
139void iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)
140{
141 __iscsi_update_cmdsn(session, be32_to_cpu(hdr->exp_cmdsn),
142 be32_to_cpu(hdr->max_cmdsn));
143}
141EXPORT_SYMBOL_GPL(iscsi_update_cmdsn); 144EXPORT_SYMBOL_GPL(iscsi_update_cmdsn);
142 145
143/** 146/**
@@ -499,6 +502,31 @@ static void iscsi_complete_task(struct iscsi_task *task, int state)
499 __iscsi_put_task(task); 502 __iscsi_put_task(task);
500} 503}
501 504
505/**
506 * iscsi_complete_scsi_task - finish scsi task normally
507 * @task: iscsi task for scsi cmd
508 * @exp_cmdsn: expected cmd sn in cpu format
509 * @max_cmdsn: max cmd sn in cpu format
510 *
511 * This is used when drivers do not need or cannot perform
512 * lower level pdu processing.
513 *
514 * Called with session lock
515 */
516void iscsi_complete_scsi_task(struct iscsi_task *task,
517 uint32_t exp_cmdsn, uint32_t max_cmdsn)
518{
519 struct iscsi_conn *conn = task->conn;
520
521 ISCSI_DBG_SESSION(conn->session, "[itt 0x%x]\n", task->itt);
522
523 conn->last_recv = jiffies;
524 __iscsi_update_cmdsn(conn->session, exp_cmdsn, max_cmdsn);
525 iscsi_complete_task(task, ISCSI_TASK_COMPLETED);
526}
527EXPORT_SYMBOL_GPL(iscsi_complete_scsi_task);
528
529
502/* 530/*
503 * session lock must be held and if not called for a task that is 531 * session lock must be held and if not called for a task that is
504 * still pending or from the xmit thread, then xmit thread must 532 * still pending or from the xmit thread, then xmit thread must