aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-05-21 16:54:04 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-12 09:22:18 -0400
commit0af967f5d4f2dd1e00618d34ac988037d37a6c3b (patch)
tree08297980d1b6dab820d22c12c7fe1c54602f2486 /drivers/infiniband
parentb40977d95fb3a1898ace6a7d97e4ed1a33a440a4 (diff)
[SCSI] libiscsi, iscsi_tcp, iser: add session cmds array accessor
Currently to get a ctask from the session cmd array, you have to know to use the itt modifier. To make this easier on LLDs and so in the future we can easilly kill the session array and use the host shared map instead, this patch adds a nice wrapper to strip the itt into a session->cmds index and return a ctask. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c8
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c23
2 files changed, 11 insertions, 20 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 8a1bfb7277c8..7b1468869066 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -98,7 +98,6 @@ iscsi_iser_recv(struct iscsi_conn *conn,
98 struct iscsi_hdr *hdr, char *rx_data, int rx_data_len) 98 struct iscsi_hdr *hdr, char *rx_data, int rx_data_len)
99{ 99{
100 int rc = 0; 100 int rc = 0;
101 uint32_t ret_itt;
102 int datalen; 101 int datalen;
103 int ahslen; 102 int ahslen;
104 103
@@ -114,12 +113,7 @@ iscsi_iser_recv(struct iscsi_conn *conn,
114 /* read AHS */ 113 /* read AHS */
115 ahslen = hdr->hlength * 4; 114 ahslen = hdr->hlength * 4;
116 115
117 /* verify itt (itt encoding: age+cid+itt) */ 116 rc = iscsi_complete_pdu(conn, hdr, rx_data, rx_data_len);
118 rc = iscsi_verify_itt(conn, hdr, &ret_itt);
119
120 if (!rc)
121 rc = iscsi_complete_pdu(conn, hdr, rx_data, rx_data_len);
122
123 if (rc && rc != ISCSI_ERR_NO_SCSI_CMD) 117 if (rc && rc != ISCSI_ERR_NO_SCSI_CMD)
124 goto error; 118 goto error;
125 119
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 08dc81c46f41..b82a5f2d4d37 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -537,13 +537,11 @@ void iser_rcv_completion(struct iser_desc *rx_desc,
537{ 537{
538 struct iser_dto *dto = &rx_desc->dto; 538 struct iser_dto *dto = &rx_desc->dto;
539 struct iscsi_iser_conn *conn = dto->ib_conn->iser_conn; 539 struct iscsi_iser_conn *conn = dto->ib_conn->iser_conn;
540 struct iscsi_session *session = conn->iscsi_conn->session;
541 struct iscsi_cmd_task *ctask; 540 struct iscsi_cmd_task *ctask;
542 struct iscsi_iser_cmd_task *iser_ctask; 541 struct iscsi_iser_cmd_task *iser_ctask;
543 struct iscsi_hdr *hdr; 542 struct iscsi_hdr *hdr;
544 char *rx_data = NULL; 543 char *rx_data = NULL;
545 int rx_data_len = 0; 544 int rx_data_len = 0;
546 unsigned int itt;
547 unsigned char opcode; 545 unsigned char opcode;
548 546
549 hdr = &rx_desc->iscsi_header; 547 hdr = &rx_desc->iscsi_header;
@@ -559,19 +557,18 @@ void iser_rcv_completion(struct iser_desc *rx_desc,
559 opcode = hdr->opcode & ISCSI_OPCODE_MASK; 557 opcode = hdr->opcode & ISCSI_OPCODE_MASK;
560 558
561 if (opcode == ISCSI_OP_SCSI_CMD_RSP) { 559 if (opcode == ISCSI_OP_SCSI_CMD_RSP) {
562 itt = get_itt(hdr->itt); /* mask out cid and age bits */ 560 ctask = iscsi_itt_to_ctask(conn->iscsi_conn, hdr->itt);
563 if (!(itt < session->cmds_max)) 561 if (!ctask)
564 iser_err("itt can't be matched to task!!! " 562 iser_err("itt can't be matched to task!!! "
565 "conn %p opcode %d cmds_max %d itt %d\n", 563 "conn %p opcode %d itt %d\n",
566 conn->iscsi_conn,opcode,session->cmds_max,itt); 564 conn->iscsi_conn, opcode, hdr->itt);
567 /* use the mapping given with the cmds array indexed by itt */ 565 else {
568 ctask = (struct iscsi_cmd_task *)session->cmds[itt]; 566 iser_ctask = ctask->dd_data;
569 iser_ctask = ctask->dd_data; 567 iser_dbg("itt %d ctask %p\n",hdr->itt, ctask);
570 iser_dbg("itt %d ctask %p\n",itt,ctask); 568 iser_ctask->status = ISER_TASK_STATUS_COMPLETED;
571 iser_ctask->status = ISER_TASK_STATUS_COMPLETED; 569 iser_ctask_rdma_finalize(iser_ctask);
572 iser_ctask_rdma_finalize(iser_ctask); 570 }
573 } 571 }
574
575 iser_dto_buffs_release(dto); 572 iser_dto_buffs_release(dto);
576 573
577 iscsi_iser_recv(conn->iscsi_conn, hdr, rx_data, rx_data_len); 574 iscsi_iser_recv(conn->iscsi_conn, hdr, rx_data, rx_data_len);