diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/ulp/iser/iser_initiator.c | 4 | ||||
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libiscsi.c | 40 |
3 files changed, 22 insertions, 24 deletions
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 0a7d1ab60e6d..89e37283c836 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c | |||
@@ -567,7 +567,7 @@ void iser_rcv_completion(struct iser_desc *rx_desc, | |||
567 | opcode = hdr->opcode & ISCSI_OPCODE_MASK; | 567 | opcode = hdr->opcode & ISCSI_OPCODE_MASK; |
568 | 568 | ||
569 | if (opcode == ISCSI_OP_SCSI_CMD_RSP) { | 569 | if (opcode == ISCSI_OP_SCSI_CMD_RSP) { |
570 | itt = hdr->itt & ISCSI_ITT_MASK; /* mask out cid and age bits */ | 570 | itt = get_itt(hdr->itt); /* mask out cid and age bits */ |
571 | if (!(itt < session->cmds_max)) | 571 | if (!(itt < session->cmds_max)) |
572 | iser_err("itt can't be matched to task!!!" | 572 | iser_err("itt can't be matched to task!!!" |
573 | "conn %p opcode %d cmds_max %d itt %d\n", | 573 | "conn %p opcode %d cmds_max %d itt %d\n", |
@@ -625,7 +625,7 @@ void iser_snd_completion(struct iser_desc *tx_desc) | |||
625 | /* this arithmetic is legal by libiscsi dd_data allocation */ | 625 | /* this arithmetic is legal by libiscsi dd_data allocation */ |
626 | mtask = (void *) ((long)(void *)tx_desc - | 626 | mtask = (void *) ((long)(void *)tx_desc - |
627 | sizeof(struct iscsi_mgmt_task)); | 627 | sizeof(struct iscsi_mgmt_task)); |
628 | if (mtask->hdr->itt == cpu_to_be32(ISCSI_RESERVED_TAG)) { | 628 | if (mtask->hdr->itt == RESERVED_ITT) { |
629 | struct iscsi_session *session = conn->session; | 629 | struct iscsi_session *session = conn->session; |
630 | 630 | ||
631 | spin_lock(&conn->session->lock); | 631 | spin_lock(&conn->session->lock); |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 437684084377..8f55e1431433 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -1375,7 +1375,7 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) | |||
1375 | } | 1375 | } |
1376 | 1376 | ||
1377 | BUG_ON(tcp_mtask->xmstate != XMSTATE_IDLE); | 1377 | BUG_ON(tcp_mtask->xmstate != XMSTATE_IDLE); |
1378 | if (mtask->hdr->itt == cpu_to_be32(ISCSI_RESERVED_TAG)) { | 1378 | if (mtask->hdr->itt == RESERVED_ITT) { |
1379 | struct iscsi_session *session = conn->session; | 1379 | struct iscsi_session *session = conn->session; |
1380 | 1380 | ||
1381 | spin_lock_bh(&session->lock); | 1381 | spin_lock_bh(&session->lock); |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index d37048c96eab..7c75771c77ff 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -113,8 +113,7 @@ static void iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask) | |||
113 | hdr->opcode = ISCSI_OP_SCSI_CMD; | 113 | hdr->opcode = ISCSI_OP_SCSI_CMD; |
114 | hdr->flags = ISCSI_ATTR_SIMPLE; | 114 | hdr->flags = ISCSI_ATTR_SIMPLE; |
115 | int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); | 115 | int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); |
116 | hdr->itt = ctask->itt | (conn->id << ISCSI_CID_SHIFT) | | 116 | hdr->itt = build_itt(ctask->itt, conn->id, session->age); |
117 | (session->age << ISCSI_AGE_SHIFT); | ||
118 | hdr->data_length = cpu_to_be32(sc->request_bufflen); | 117 | hdr->data_length = cpu_to_be32(sc->request_bufflen); |
119 | hdr->cmdsn = cpu_to_be32(session->cmdsn); | 118 | hdr->cmdsn = cpu_to_be32(session->cmdsn); |
120 | session->cmdsn++; | 119 | session->cmdsn++; |
@@ -270,7 +269,7 @@ invalid_datalen: | |||
270 | goto out; | 269 | goto out; |
271 | } | 270 | } |
272 | 271 | ||
273 | senselen = be16_to_cpu(*(uint16_t *)data); | 272 | senselen = be16_to_cpu(*(__be16 *)data); |
274 | if (datalen < senselen) | 273 | if (datalen < senselen) |
275 | goto invalid_datalen; | 274 | goto invalid_datalen; |
276 | 275 | ||
@@ -338,7 +337,7 @@ static int iscsi_handle_reject(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
338 | 337 | ||
339 | if (ntoh24(reject->dlength) >= sizeof(struct iscsi_hdr)) { | 338 | if (ntoh24(reject->dlength) >= sizeof(struct iscsi_hdr)) { |
340 | memcpy(&rejected_pdu, data, sizeof(struct iscsi_hdr)); | 339 | memcpy(&rejected_pdu, data, sizeof(struct iscsi_hdr)); |
341 | itt = rejected_pdu.itt & ISCSI_ITT_MASK; | 340 | itt = get_itt(rejected_pdu.itt); |
342 | printk(KERN_ERR "itt 0x%x had pdu (op 0x%x) rejected " | 341 | printk(KERN_ERR "itt 0x%x had pdu (op 0x%x) rejected " |
343 | "due to DataDigest error.\n", itt, | 342 | "due to DataDigest error.\n", itt, |
344 | rejected_pdu.opcode); | 343 | rejected_pdu.opcode); |
@@ -367,10 +366,10 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
367 | struct iscsi_mgmt_task *mtask; | 366 | struct iscsi_mgmt_task *mtask; |
368 | uint32_t itt; | 367 | uint32_t itt; |
369 | 368 | ||
370 | if (hdr->itt != cpu_to_be32(ISCSI_RESERVED_TAG)) | 369 | if (hdr->itt != RESERVED_ITT) |
371 | itt = hdr->itt & ISCSI_ITT_MASK; | 370 | itt = get_itt(hdr->itt); |
372 | else | 371 | else |
373 | itt = hdr->itt; | 372 | itt = ~0U; |
374 | 373 | ||
375 | if (itt < session->cmds_max) { | 374 | if (itt < session->cmds_max) { |
376 | ctask = session->cmds[itt]; | 375 | ctask = session->cmds[itt]; |
@@ -440,7 +439,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
440 | iscsi_tmf_rsp(conn, hdr); | 439 | iscsi_tmf_rsp(conn, hdr); |
441 | break; | 440 | break; |
442 | case ISCSI_OP_NOOP_IN: | 441 | case ISCSI_OP_NOOP_IN: |
443 | if (hdr->ttt != ISCSI_RESERVED_TAG || datalen) { | 442 | if (hdr->ttt != cpu_to_be32(ISCSI_RESERVED_TAG) || datalen) { |
444 | rc = ISCSI_ERR_PROTO; | 443 | rc = ISCSI_ERR_PROTO; |
445 | break; | 444 | break; |
446 | } | 445 | } |
@@ -457,7 +456,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
457 | rc = ISCSI_ERR_BAD_OPCODE; | 456 | rc = ISCSI_ERR_BAD_OPCODE; |
458 | break; | 457 | break; |
459 | } | 458 | } |
460 | } else if (itt == ISCSI_RESERVED_TAG) { | 459 | } else if (itt == ~0U) { |
461 | rc = iscsi_check_assign_cmdsn(session, | 460 | rc = iscsi_check_assign_cmdsn(session, |
462 | (struct iscsi_nopin*)hdr); | 461 | (struct iscsi_nopin*)hdr); |
463 | if (rc) | 462 | if (rc) |
@@ -470,7 +469,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
470 | break; | 469 | break; |
471 | } | 470 | } |
472 | 471 | ||
473 | if (hdr->ttt == ISCSI_RESERVED_TAG) | 472 | if (hdr->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) |
474 | break; | 473 | break; |
475 | 474 | ||
476 | if (iscsi_recv_pdu(conn->cls_conn, hdr, NULL, 0)) | 475 | if (iscsi_recv_pdu(conn->cls_conn, hdr, NULL, 0)) |
@@ -516,24 +515,24 @@ int iscsi_verify_itt(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
516 | struct iscsi_cmd_task *ctask; | 515 | struct iscsi_cmd_task *ctask; |
517 | uint32_t itt; | 516 | uint32_t itt; |
518 | 517 | ||
519 | if (hdr->itt != cpu_to_be32(ISCSI_RESERVED_TAG)) { | 518 | if (hdr->itt != RESERVED_ITT) { |
520 | if ((hdr->itt & ISCSI_AGE_MASK) != | 519 | if (((__force u32)hdr->itt & ISCSI_AGE_MASK) != |
521 | (session->age << ISCSI_AGE_SHIFT)) { | 520 | (session->age << ISCSI_AGE_SHIFT)) { |
522 | printk(KERN_ERR "iscsi: received itt %x expected " | 521 | printk(KERN_ERR "iscsi: received itt %x expected " |
523 | "session age (%x)\n", hdr->itt, | 522 | "session age (%x)\n", (__force u32)hdr->itt, |
524 | session->age & ISCSI_AGE_MASK); | 523 | session->age & ISCSI_AGE_MASK); |
525 | return ISCSI_ERR_BAD_ITT; | 524 | return ISCSI_ERR_BAD_ITT; |
526 | } | 525 | } |
527 | 526 | ||
528 | if ((hdr->itt & ISCSI_CID_MASK) != | 527 | if (((__force u32)hdr->itt & ISCSI_CID_MASK) != |
529 | (conn->id << ISCSI_CID_SHIFT)) { | 528 | (conn->id << ISCSI_CID_SHIFT)) { |
530 | printk(KERN_ERR "iscsi: received itt %x, expected " | 529 | printk(KERN_ERR "iscsi: received itt %x, expected " |
531 | "CID (%x)\n", hdr->itt, conn->id); | 530 | "CID (%x)\n", (__force u32)hdr->itt, conn->id); |
532 | return ISCSI_ERR_BAD_ITT; | 531 | return ISCSI_ERR_BAD_ITT; |
533 | } | 532 | } |
534 | itt = hdr->itt & ISCSI_ITT_MASK; | 533 | itt = get_itt(hdr->itt); |
535 | } else | 534 | } else |
536 | itt = hdr->itt; | 535 | itt = ~0U; |
537 | 536 | ||
538 | if (itt < session->cmds_max) { | 537 | if (itt < session->cmds_max) { |
539 | ctask = session->cmds[itt]; | 538 | ctask = session->cmds[itt]; |
@@ -896,9 +895,8 @@ iscsi_conn_send_generic(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
896 | /* | 895 | /* |
897 | * pre-format CmdSN for outgoing PDU. | 896 | * pre-format CmdSN for outgoing PDU. |
898 | */ | 897 | */ |
899 | if (hdr->itt != cpu_to_be32(ISCSI_RESERVED_TAG)) { | 898 | if (hdr->itt != RESERVED_ITT) { |
900 | hdr->itt = mtask->itt | (conn->id << ISCSI_CID_SHIFT) | | 899 | hdr->itt = build_itt(mtask->itt, conn->id, session->age); |
901 | (session->age << ISCSI_AGE_SHIFT); | ||
902 | nop->cmdsn = cpu_to_be32(session->cmdsn); | 900 | nop->cmdsn = cpu_to_be32(session->cmdsn); |
903 | if (conn->c_stage == ISCSI_CONN_STARTED && | 901 | if (conn->c_stage == ISCSI_CONN_STARTED && |
904 | !(hdr->opcode & ISCSI_OP_IMMEDIATE)) | 902 | !(hdr->opcode & ISCSI_OP_IMMEDIATE)) |
@@ -1064,7 +1062,7 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc, | |||
1064 | 1062 | ||
1065 | spin_lock_bh(&session->lock); | 1063 | spin_lock_bh(&session->lock); |
1066 | ctask->mtask = (struct iscsi_mgmt_task *) | 1064 | ctask->mtask = (struct iscsi_mgmt_task *) |
1067 | session->mgmt_cmds[(hdr->itt & ISCSI_ITT_MASK) - | 1065 | session->mgmt_cmds[get_itt(hdr->itt) - |
1068 | ISCSI_MGMT_ITT_OFFSET]; | 1066 | ISCSI_MGMT_ITT_OFFSET]; |
1069 | 1067 | ||
1070 | if (conn->tmabort_state == TMABORT_INITIAL) { | 1068 | if (conn->tmabort_state == TMABORT_INITIAL) { |