Lines Matching refs:hdr

117 void iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)  in iscsi_update_cmdsn()  argument
119 __iscsi_update_cmdsn(session, be32_to_cpu(hdr->exp_cmdsn), in iscsi_update_cmdsn()
120 be32_to_cpu(hdr->max_cmdsn)); in iscsi_update_cmdsn()
137 struct iscsi_data *hdr) in iscsi_prep_data_out_pdu() argument
144 memset(hdr, 0, sizeof(struct iscsi_data)); in iscsi_prep_data_out_pdu()
145 hdr->ttt = r2t->ttt; in iscsi_prep_data_out_pdu()
146 hdr->datasn = cpu_to_be32(r2t->datasn); in iscsi_prep_data_out_pdu()
148 hdr->opcode = ISCSI_OP_SCSI_DATA_OUT; in iscsi_prep_data_out_pdu()
149 hdr->lun = task->lun; in iscsi_prep_data_out_pdu()
150 hdr->itt = task->hdr_itt; in iscsi_prep_data_out_pdu()
151 hdr->exp_statsn = r2t->exp_statsn; in iscsi_prep_data_out_pdu()
152 hdr->offset = cpu_to_be32(r2t->data_offset + r2t->sent); in iscsi_prep_data_out_pdu()
154 hton24(hdr->dlength, conn->max_xmit_dlength); in iscsi_prep_data_out_pdu()
156 hdr->flags = 0; in iscsi_prep_data_out_pdu()
158 hton24(hdr->dlength, left); in iscsi_prep_data_out_pdu()
160 hdr->flags = ISCSI_FLAG_CMD_FINAL; in iscsi_prep_data_out_pdu()
289 task->hdr->opcode, opcode, in iscsi_check_tmf_restrictions()
301 task->hdr->opcode, opcode, in iscsi_check_tmf_restrictions()
340 struct iscsi_scsi_req *hdr; in iscsi_prep_scsi_cmd_pdu() local
354 hdr = (struct iscsi_scsi_req *)task->hdr; in iscsi_prep_scsi_cmd_pdu()
355 itt = hdr->itt; in iscsi_prep_scsi_cmd_pdu()
356 memset(hdr, 0, sizeof(*hdr)); in iscsi_prep_scsi_cmd_pdu()
359 hdr->itt = task->hdr_itt = itt; in iscsi_prep_scsi_cmd_pdu()
361 hdr->itt = task->hdr_itt = build_itt(task->itt, in iscsi_prep_scsi_cmd_pdu()
364 rc = iscsi_add_hdr(task, sizeof(*hdr)); in iscsi_prep_scsi_cmd_pdu()
367 hdr->opcode = ISCSI_OP_SCSI_CMD; in iscsi_prep_scsi_cmd_pdu()
368 hdr->flags = ISCSI_ATTR_SIMPLE; in iscsi_prep_scsi_cmd_pdu()
369 int_to_scsilun(sc->device->lun, &hdr->lun); in iscsi_prep_scsi_cmd_pdu()
370 task->lun = hdr->lun; in iscsi_prep_scsi_cmd_pdu()
371 hdr->exp_statsn = cpu_to_be32(conn->exp_statsn); in iscsi_prep_scsi_cmd_pdu()
374 memset(&hdr->cdb[cmd_len], 0, ISCSI_CDB_SIZE - cmd_len); in iscsi_prep_scsi_cmd_pdu()
381 memcpy(hdr->cdb, sc->cmnd, cmd_len); in iscsi_prep_scsi_cmd_pdu()
385 hdr->flags |= ISCSI_FLAG_CMD_READ; in iscsi_prep_scsi_cmd_pdu()
395 hdr->data_length = cpu_to_be32(transfer_length); in iscsi_prep_scsi_cmd_pdu()
399 hdr->flags |= ISCSI_FLAG_CMD_WRITE; in iscsi_prep_scsi_cmd_pdu()
423 hton24(hdr->dlength, task->imm_count); in iscsi_prep_scsi_cmd_pdu()
425 zero_data(hdr->dlength); in iscsi_prep_scsi_cmd_pdu()
438 hdr->flags |= ISCSI_FLAG_CMD_FINAL; in iscsi_prep_scsi_cmd_pdu()
440 hdr->flags |= ISCSI_FLAG_CMD_FINAL; in iscsi_prep_scsi_cmd_pdu()
441 zero_data(hdr->dlength); in iscsi_prep_scsi_cmd_pdu()
444 hdr->flags |= ISCSI_FLAG_CMD_READ; in iscsi_prep_scsi_cmd_pdu()
448 hdrlength = task->hdr_len - sizeof(*hdr); in iscsi_prep_scsi_cmd_pdu()
454 hdr->hlength = hdrlength & 0xFF; in iscsi_prep_scsi_cmd_pdu()
455 hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn); in iscsi_prep_scsi_cmd_pdu()
652 struct iscsi_hdr *hdr = task->hdr; in iscsi_prep_mgmt_task() local
653 struct iscsi_nopout *nop = (struct iscsi_nopout *)hdr; in iscsi_prep_mgmt_task()
654 uint8_t opcode = hdr->opcode & ISCSI_OPCODE_MASK; in iscsi_prep_mgmt_task()
665 if (hdr->itt != RESERVED_ITT) { in iscsi_prep_mgmt_task()
675 !(hdr->opcode & ISCSI_OP_IMMEDIATE)) { in iscsi_prep_mgmt_task()
684 if ((hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGOUT) in iscsi_prep_mgmt_task()
689 "datalen %d]\n", hdr->opcode & ISCSI_OPCODE_MASK, in iscsi_prep_mgmt_task()
690 hdr->itt, task->data_count); in iscsi_prep_mgmt_task()
695 __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, in __iscsi_conn_send_pdu() argument
700 uint8_t opcode = hdr->opcode & ISCSI_OPCODE_MASK; in __iscsi_conn_send_pdu()
760 if (conn->session->tt->alloc_pdu(task, hdr->opcode)) { in __iscsi_conn_send_pdu()
767 itt = task->hdr->itt; in __iscsi_conn_send_pdu()
769 memcpy(task->hdr, hdr, sizeof(struct iscsi_hdr)); in __iscsi_conn_send_pdu()
771 if (hdr->itt != RESERVED_ITT) { in __iscsi_conn_send_pdu()
773 task->hdr->itt = itt; in __iscsi_conn_send_pdu()
775 task->hdr->itt = build_itt(task->itt, in __iscsi_conn_send_pdu()
800 int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, in iscsi_conn_send_pdu() argument
808 if (!__iscsi_conn_send_pdu(conn, hdr, data, data_size)) in iscsi_conn_send_pdu()
826 static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, in iscsi_scsi_cmd_rsp() argument
830 struct iscsi_scsi_rsp *rhdr = (struct iscsi_scsi_rsp *)hdr; in iscsi_scsi_cmd_rsp()
932 iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, in iscsi_data_in_rsp() argument
935 struct iscsi_data_rsp *rhdr = (struct iscsi_data_rsp *)hdr; in iscsi_data_in_rsp()
941 iscsi_update_cmdsn(conn->session, (struct iscsi_nopin *)hdr); in iscsi_data_in_rsp()
963 static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) in iscsi_tmf_rsp() argument
965 struct iscsi_tm_rsp *tmf = (struct iscsi_tm_rsp *)hdr; in iscsi_tmf_rsp()
967 conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; in iscsi_tmf_rsp()
984 struct iscsi_nopout hdr; in iscsi_send_nopout() local
990 memset(&hdr, 0, sizeof(struct iscsi_nopout)); in iscsi_send_nopout()
991 hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; in iscsi_send_nopout()
992 hdr.flags = ISCSI_FLAG_CMD_FINAL; in iscsi_send_nopout()
995 hdr.lun = rhdr->lun; in iscsi_send_nopout()
996 hdr.ttt = rhdr->ttt; in iscsi_send_nopout()
997 hdr.itt = RESERVED_ITT; in iscsi_send_nopout()
999 hdr.ttt = RESERVED_ITT; in iscsi_send_nopout()
1001 task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); in iscsi_send_nopout()
1031 static int iscsi_handle_reject(struct iscsi_conn *conn, struct iscsi_hdr *hdr, in iscsi_handle_reject() argument
1034 struct iscsi_reject *reject = (struct iscsi_reject *)hdr; in iscsi_handle_reject()
1154 int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, in __iscsi_complete_pdu() argument
1158 int opcode = hdr->opcode & ISCSI_OPCODE_MASK, rc = 0; in __iscsi_complete_pdu()
1163 rc = iscsi_verify_itt(conn, hdr->itt); in __iscsi_complete_pdu()
1167 if (hdr->itt != RESERVED_ITT) in __iscsi_complete_pdu()
1168 itt = get_itt(hdr->itt); in __iscsi_complete_pdu()
1176 iscsi_update_cmdsn(session, (struct iscsi_nopin*)hdr); in __iscsi_complete_pdu()
1185 if (hdr->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) in __iscsi_complete_pdu()
1191 iscsi_send_nopout(conn, (struct iscsi_nopin*)hdr); in __iscsi_complete_pdu()
1196 rc = iscsi_handle_reject(conn, hdr, data, datalen); in __iscsi_complete_pdu()
1199 conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; in __iscsi_complete_pdu()
1200 if (iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen)) in __iscsi_complete_pdu()
1213 task = iscsi_itt_to_ctask(conn, hdr->itt); in __iscsi_complete_pdu()
1228 task = iscsi_itt_to_task(conn, hdr->itt); in __iscsi_complete_pdu()
1238 iscsi_scsi_cmd_rsp(conn, hdr, task, data, datalen); in __iscsi_complete_pdu()
1241 iscsi_data_in_rsp(conn, hdr, task); in __iscsi_complete_pdu()
1244 iscsi_update_cmdsn(session, (struct iscsi_nopin*)hdr); in __iscsi_complete_pdu()
1249 conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; in __iscsi_complete_pdu()
1253 iscsi_update_cmdsn(session, (struct iscsi_nopin*)hdr); in __iscsi_complete_pdu()
1260 iscsi_update_cmdsn(session, (struct iscsi_nopin*)hdr); in __iscsi_complete_pdu()
1266 iscsi_tmf_rsp(conn, hdr); in __iscsi_complete_pdu()
1270 iscsi_update_cmdsn(session, (struct iscsi_nopin*)hdr); in __iscsi_complete_pdu()
1271 if (hdr->ttt != cpu_to_be32(ISCSI_RESERVED_TAG) || datalen) { in __iscsi_complete_pdu()
1275 conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; in __iscsi_complete_pdu()
1277 rc = iscsi_nop_out_rsp(task, (struct iscsi_nopin*)hdr, in __iscsi_complete_pdu()
1288 if (iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen)) in __iscsi_complete_pdu()
1295 int iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, in iscsi_complete_pdu() argument
1301 rc = __iscsi_complete_pdu(conn, hdr, data, datalen); in iscsi_complete_pdu()
1800 struct iscsi_tm *hdr, int age, in iscsi_exec_task_mgmt_fn() argument
1806 task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr, in iscsi_exec_task_mgmt_fn()
2110 struct iscsi_tm *hdr) in iscsi_prep_abort_task_pdu() argument
2112 memset(hdr, 0, sizeof(*hdr)); in iscsi_prep_abort_task_pdu()
2113 hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE; in iscsi_prep_abort_task_pdu()
2114 hdr->flags = ISCSI_TM_FUNC_ABORT_TASK & ISCSI_FLAG_TM_FUNC_MASK; in iscsi_prep_abort_task_pdu()
2115 hdr->flags |= ISCSI_FLAG_CMD_FINAL; in iscsi_prep_abort_task_pdu()
2116 hdr->lun = task->lun; in iscsi_prep_abort_task_pdu()
2117 hdr->rtt = task->hdr_itt; in iscsi_prep_abort_task_pdu()
2118 hdr->refcmdsn = task->cmdsn; in iscsi_prep_abort_task_pdu()
2127 struct iscsi_tm *hdr; in iscsi_eh_abort() local
2186 hdr = &conn->tmhdr; in iscsi_eh_abort()
2187 iscsi_prep_abort_task_pdu(task, hdr); in iscsi_eh_abort()
2189 if (iscsi_exec_task_mgmt_fn(conn, hdr, age, session->abort_timeout)) { in iscsi_eh_abort()
2210 memset(hdr, 0, sizeof(*hdr)); in iscsi_eh_abort()
2221 memset(hdr, 0, sizeof(*hdr)); in iscsi_eh_abort()
2251 static void iscsi_prep_lun_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr) in iscsi_prep_lun_reset_pdu() argument
2253 memset(hdr, 0, sizeof(*hdr)); in iscsi_prep_lun_reset_pdu()
2254 hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE; in iscsi_prep_lun_reset_pdu()
2255 hdr->flags = ISCSI_TM_FUNC_LOGICAL_UNIT_RESET & ISCSI_FLAG_TM_FUNC_MASK; in iscsi_prep_lun_reset_pdu()
2256 hdr->flags |= ISCSI_FLAG_CMD_FINAL; in iscsi_prep_lun_reset_pdu()
2257 int_to_scsilun(sc->device->lun, &hdr->lun); in iscsi_prep_lun_reset_pdu()
2258 hdr->rtt = RESERVED_ITT; in iscsi_prep_lun_reset_pdu()
2266 struct iscsi_tm *hdr; in iscsi_eh_device_reset() local
2290 hdr = &conn->tmhdr; in iscsi_eh_device_reset()
2291 iscsi_prep_lun_reset_pdu(sc, hdr); in iscsi_eh_device_reset()
2293 if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age, in iscsi_eh_device_reset()
2317 memset(hdr, 0, sizeof(*hdr)); in iscsi_eh_device_reset()
2409 static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr) in iscsi_prep_tgt_reset_pdu() argument
2411 memset(hdr, 0, sizeof(*hdr)); in iscsi_prep_tgt_reset_pdu()
2412 hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE; in iscsi_prep_tgt_reset_pdu()
2413 hdr->flags = ISCSI_TM_FUNC_TARGET_WARM_RESET & ISCSI_FLAG_TM_FUNC_MASK; in iscsi_prep_tgt_reset_pdu()
2414 hdr->flags |= ISCSI_FLAG_CMD_FINAL; in iscsi_prep_tgt_reset_pdu()
2415 hdr->rtt = RESERVED_ITT; in iscsi_prep_tgt_reset_pdu()
2429 struct iscsi_tm *hdr; in iscsi_eh_target_reset() local
2453 hdr = &conn->tmhdr; in iscsi_eh_target_reset()
2454 iscsi_prep_tgt_reset_pdu(sc, hdr); in iscsi_eh_target_reset()
2456 if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age, in iscsi_eh_target_reset()
2480 memset(hdr, 0, sizeof(*hdr)); in iscsi_eh_target_reset()