diff options
| -rw-r--r-- | drivers/scsi/libiscsi.c | 38 | ||||
| -rw-r--r-- | include/scsi/libiscsi.h | 2 |
2 files changed, 35 insertions, 5 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index a7ee4bb40708..67b2a2b00286 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 | } |
| 110 | EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); | 110 | EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); |
| 111 | 111 | ||
| 112 | void | 112 | static void __iscsi_update_cmdsn(struct iscsi_session *session, |
| 113 | iscsi_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 | |||
| 139 | void 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 | } | ||
| 141 | EXPORT_SYMBOL_GPL(iscsi_update_cmdsn); | 144 | EXPORT_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 | */ | ||
| 516 | void 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 | } | ||
| 527 | EXPORT_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 |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 61afeb59a836..439c8b75cb69 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
| @@ -415,6 +415,8 @@ extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t); | |||
| 415 | extern void iscsi_requeue_task(struct iscsi_task *task); | 415 | extern void iscsi_requeue_task(struct iscsi_task *task); |
| 416 | extern void iscsi_put_task(struct iscsi_task *task); | 416 | extern void iscsi_put_task(struct iscsi_task *task); |
| 417 | extern void __iscsi_get_task(struct iscsi_task *task); | 417 | extern void __iscsi_get_task(struct iscsi_task *task); |
| 418 | extern void iscsi_complete_scsi_task(struct iscsi_task *task, | ||
| 419 | uint32_t exp_cmdsn, uint32_t max_cmdsn); | ||
| 418 | 420 | ||
| 419 | /* | 421 | /* |
| 420 | * generic helpers | 422 | * generic helpers |
