aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi/iscsi_target_nego.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_nego.c')
-rw-r--r--drivers/target/iscsi/iscsi_target_nego.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 2dba448cac19..e9053a04f24c 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -44,7 +44,7 @@ void convert_null_to_semi(char *buf, int len)
44 buf[i] = ';'; 44 buf[i] = ';';
45} 45}
46 46
47int strlen_semi(char *buf) 47static int strlen_semi(char *buf)
48{ 48{
49 int i = 0; 49 int i = 0;
50 50
@@ -339,14 +339,14 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log
339 hton24(login_rsp->dlength, login->rsp_length); 339 hton24(login_rsp->dlength, login->rsp_length);
340 memcpy(login_rsp->isid, login->isid, 6); 340 memcpy(login_rsp->isid, login->isid, 6);
341 login_rsp->tsih = cpu_to_be16(login->tsih); 341 login_rsp->tsih = cpu_to_be16(login->tsih);
342 login_rsp->itt = cpu_to_be32(login->init_task_tag); 342 login_rsp->itt = login->init_task_tag;
343 login_rsp->statsn = cpu_to_be32(conn->stat_sn++); 343 login_rsp->statsn = cpu_to_be32(conn->stat_sn++);
344 login_rsp->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); 344 login_rsp->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn);
345 login_rsp->max_cmdsn = cpu_to_be32(conn->sess->max_cmd_sn); 345 login_rsp->max_cmdsn = cpu_to_be32(conn->sess->max_cmd_sn);
346 346
347 pr_debug("Sending Login Response, Flags: 0x%02x, ITT: 0x%08x," 347 pr_debug("Sending Login Response, Flags: 0x%02x, ITT: 0x%08x,"
348 " ExpCmdSN; 0x%08x, MaxCmdSN: 0x%08x, StatSN: 0x%08x, Length:" 348 " ExpCmdSN; 0x%08x, MaxCmdSN: 0x%08x, StatSN: 0x%08x, Length:"
349 " %u\n", login_rsp->flags, ntohl(login_rsp->itt), 349 " %u\n", login_rsp->flags, (__force u32)login_rsp->itt,
350 ntohl(login_rsp->exp_cmdsn), ntohl(login_rsp->max_cmdsn), 350 ntohl(login_rsp->exp_cmdsn), ntohl(login_rsp->max_cmdsn),
351 ntohl(login_rsp->statsn), login->rsp_length); 351 ntohl(login_rsp->statsn), login->rsp_length);
352 352
@@ -360,12 +360,9 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log
360 return -1; 360 return -1;
361 361
362 login->rsp_length = 0; 362 login->rsp_length = 0;
363 login_rsp->tsih = be16_to_cpu(login_rsp->tsih);
364 login_rsp->itt = be32_to_cpu(login_rsp->itt);
365 login_rsp->statsn = be32_to_cpu(login_rsp->statsn);
366 mutex_lock(&sess->cmdsn_mutex); 363 mutex_lock(&sess->cmdsn_mutex);
367 login_rsp->exp_cmdsn = be32_to_cpu(sess->exp_cmd_sn); 364 login_rsp->exp_cmdsn = cpu_to_be32(sess->exp_cmd_sn);
368 login_rsp->max_cmdsn = be32_to_cpu(sess->max_cmd_sn); 365 login_rsp->max_cmdsn = cpu_to_be32(sess->max_cmd_sn);
369 mutex_unlock(&sess->cmdsn_mutex); 366 mutex_unlock(&sess->cmdsn_mutex);
370 367
371 return 0; 368 return 0;
@@ -381,11 +378,6 @@ static int iscsi_target_do_rx_login_io(struct iscsi_conn *conn, struct iscsi_log
381 378
382 login_req = (struct iscsi_login_req *) login->req; 379 login_req = (struct iscsi_login_req *) login->req;
383 payload_length = ntoh24(login_req->dlength); 380 payload_length = ntoh24(login_req->dlength);
384 login_req->tsih = be16_to_cpu(login_req->tsih);
385 login_req->itt = be32_to_cpu(login_req->itt);
386 login_req->cid = be16_to_cpu(login_req->cid);
387 login_req->cmdsn = be32_to_cpu(login_req->cmdsn);
388 login_req->exp_statsn = be32_to_cpu(login_req->exp_statsn);
389 381
390 pr_debug("Got Login Command, Flags 0x%02x, ITT: 0x%08x," 382 pr_debug("Got Login Command, Flags 0x%02x, ITT: 0x%08x,"
391 " CmdSN: 0x%08x, ExpStatSN: 0x%08x, CID: %hu, Length: %u\n", 383 " CmdSN: 0x%08x, ExpStatSN: 0x%08x, CID: %hu, Length: %u\n",
@@ -550,7 +542,7 @@ static int iscsi_target_handle_csg_zero(
550 SENDER_INITIATOR|SENDER_RECEIVER, 542 SENDER_INITIATOR|SENDER_RECEIVER,
551 login->req_buf, 543 login->req_buf,
552 payload_length, 544 payload_length,
553 conn->param_list); 545 conn);
554 if (ret < 0) 546 if (ret < 0)
555 return -1; 547 return -1;
556 548
@@ -627,7 +619,7 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn *conn, struct iscsi_log
627 SENDER_INITIATOR|SENDER_RECEIVER, 619 SENDER_INITIATOR|SENDER_RECEIVER,
628 login->req_buf, 620 login->req_buf,
629 payload_length, 621 payload_length,
630 conn->param_list); 622 conn);
631 if (ret < 0) 623 if (ret < 0)
632 return -1; 624 return -1;
633 625
@@ -762,11 +754,11 @@ static int iscsi_target_locate_portal(
762 login->version_min = login_req->min_version; 754 login->version_min = login_req->min_version;
763 login->version_max = login_req->max_version; 755 login->version_max = login_req->max_version;
764 memcpy(login->isid, login_req->isid, 6); 756 memcpy(login->isid, login_req->isid, 6);
765 login->cmd_sn = login_req->cmdsn; 757 login->cmd_sn = be32_to_cpu(login_req->cmdsn);
766 login->init_task_tag = login_req->itt; 758 login->init_task_tag = login_req->itt;
767 login->initial_exp_statsn = login_req->exp_statsn; 759 login->initial_exp_statsn = be32_to_cpu(login_req->exp_statsn);
768 login->cid = login_req->cid; 760 login->cid = be16_to_cpu(login_req->cid);
769 login->tsih = login_req->tsih; 761 login->tsih = be16_to_cpu(login_req->tsih);
770 762
771 if (iscsi_target_get_initial_payload(conn, login) < 0) 763 if (iscsi_target_get_initial_payload(conn, login) < 0)
772 return -1; 764 return -1;
@@ -1000,7 +992,6 @@ struct iscsi_login *iscsi_target_init_negotiation(
1000 * Locates Target Portal from NP -> Target IQN 992 * Locates Target Portal from NP -> Target IQN
1001 */ 993 */
1002 if (iscsi_target_locate_portal(np, conn, login) < 0) { 994 if (iscsi_target_locate_portal(np, conn, login) < 0) {
1003 pr_err("iSCSI Login negotiation failed.\n");
1004 goto out; 995 goto out;
1005 } 996 }
1006 997