Lines Matching defs:req_ccb

295 collect_text_data(pdu_t *pdu, ccb_t *req_ccb)
298 if (req_ccb->ccb_text_data) {
302 nlen = req_ccb->ccb_text_len + pdu->pdu_temp_data_len;
305 DEBOUT(("Collect Text Data: Out of Memory, ccb = %p\n", req_ccb));
306 req_ccb->ccb_status = ISCSI_STATUS_NO_RESOURCES;
310 memcpy(newp, req_ccb->ccb_text_data, req_ccb->ccb_text_len);
311 memcpy(&newp[req_ccb->ccb_text_len], pdu->pdu_temp_data, pdu->pdu_temp_data_len);
313 free(req_ccb->ccb_text_data, M_TEMP);
316 req_ccb->ccb_text_data = NULL;
322 req_ccb->ccb_text_data = pdu->pdu_temp_data;
323 req_ccb->ccb_text_len = pdu->pdu_temp_data_len;
326 acknowledge_text(req_ccb->ccb_connection, pdu, req_ccb);
450 receive_login_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
458 if (req_ccb == NULL) {
468 wake_ccb(req_ccb, ISCSI_STATUS_LOGIN_FAILED);
479 if ((rc = collect_text_data(pdu, req_ccb)) != 0)
483 negotiate_login(conn, pdu, req_ccb);
501 receive_text_response_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
511 if (req_ccb == NULL) {
518 if (req_ccb->ccb_pdu_waiting != NULL) {
519 ccb_timeout_start(req_ccb, COMMAND_TIMEOUT);
520 req_ccb->ccb_num_timeouts = 0;
523 if ((rc = collect_text_data(pdu, req_ccb)) != 0) {
526 negotiate_text(conn, pdu, req_ccb);
543 receive_logout_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
549 otherconn = (req_ccb != NULL) ? (req_ccb->ccb_flags & CCBF_OTHERCONN) != 0 : 1;
553 req_ccb, otherconn, response));
555 if (req_ccb == NULL)
577 connection_t *refconn = (otherconn) ? req_ccb->ccb_par : conn;
583 wake_ccb(req_ccb, status);
615 receive_data_in_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
623 if (req_ccb == NULL || !req_ccb->ccb_data_in || !req_ccb->ccb_data_len) {
624 DEBOUT(("Received Data In, but req_ccb not waiting for it, ignored\n"));
627 req_ccb->ccb_flags |= CCBF_GOT_RSP;
629 if (req_ccb->ccb_pdu_waiting != NULL) {
630 ccb_timeout_start(req_ccb, COMMAND_TIMEOUT);
631 req_ccb->ccb_num_timeouts = 0;
636 if ((rc = add_sernum(&req_ccb->ccb_DataSN_buf, sn)) != 1) {
642 handle_connection_error(req_ccb->ccb_connection,
647 req_ccb->ccb_DataSN_buf.ExpSN, rc - 1));
651 snack_missing(req_ccb->ccb_connection, req_ccb,
652 SNACK_DATA_NAK, req_ccb->ccb_DataSN_buf.ExpSN,
663 ack_sernum(&req_ccb->ccb_DataSN_buf, sn);
665 req_ccb->ccb_xfer_len += dsl;
668 send_snack(conn, pdu, req_ccb, SNACK_DATA_ACK);
670 done = sn_empty(&req_ccb->ccb_DataSN_buf);
674 req_ccb->ccb_CmdSN, done));
676 req_ccb->ccb_flags |= CCBF_COMPLETE;
681 wake_ccb(req_ccb, ISCSI_STATUS_SUCCESS);
685 } else if (done && (req_ccb->ccb_flags & CCBF_COMPLETE)) {
686 wake_ccb(req_ccb, ISCSI_STATUS_SUCCESS);
705 receive_r2t_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
708 DEBC(conn, 10, ("Received R2T PDU - CCB = %p\n", req_ccb));
710 if (req_ccb != NULL) {
711 if (req_ccb->ccb_pdu_waiting != NULL) {
712 ccb_timeout_start(req_ccb, COMMAND_TIMEOUT);
713 req_ccb->ccb_num_timeouts = 0;
715 send_data_out(conn, pdu, req_ccb, CCBDISP_NOWAIT, TRUE);
733 receive_command_response_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
740 if (pdu->pdu_temp_data_len && req_ccb != NULL && req_ccb->ccb_sense_len_req) {
741 len = min(req_ccb->ccb_sense_len_req,
743 memcpy(req_ccb->ccb_sense_ptr, ((uint16_t *) pdu->pdu_temp_data) + 1,
745 req_ccb->ccb_sense_len_got = len;
748 if (req_ccb == NULL) {
754 if (req_ccb->ccb_flags & CCBF_COMPLETE) {
759 if (req_ccb->ccb_pdu_waiting != NULL) {
760 ccb_timeout_start(req_ccb, COMMAND_TIMEOUT);
761 req_ccb->ccb_num_timeouts = 0;
764 req_ccb->ccb_flags |= CCBF_COMPLETE;
790 req_ccb->ccb_residual = ntohl(pdu->pdu_hdr.pduh_p.response.ResidualCount);
792 done = status || sn_empty(&req_ccb->ccb_DataSN_buf);
795 req_ccb->ccb_CmdSN,
802 wake_ccb(req_ccb, status);
886 ccb_t *req_ccb;
894 req_ccb = ccb_from_itt(conn, hpdu->pduh_InitiatorTaskTag);
897 hpdu->pduh_InitiatorTaskTag, req_ccb));
898 if (!req_ccb) {
906 resend_pdu(req_ccb);
911 resend_pdu(req_ccb);
932 wake_ccb(req_ccb, status);
951 receive_task_management_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
955 DEBC(conn, 2, ("Received Task Management PDU, response %d, req_ccb %p\n",
956 pdu->pdu_hdr.pduh_OpcodeSpecific[0], req_ccb));
958 if (req_ccb != NULL) {
988 wake_ccb(req_ccb, status);
1008 receive_nop_in_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
1011 ("Received NOP_In PDU, req_ccb=%p, ITT=%x, TTT=%x, StatSN=%u\n",
1012 req_ccb, pdu->pdu_hdr.pduh_InitiatorTaskTag,
1030 } else if (req_ccb != NULL) {
1035 wake_ccb(req_ccb, ISCSI_STATUS_SUCCESS);
1061 ccb_t *req_ccb;
1084 req_ccb = ccb_from_itt(conn, pdu->pdu_hdr.pduh_InitiatorTaskTag);
1086 if (req_ccb != NULL && req_ccb->ccb_data_in && req_ccb->ccb_data_len &&
1093 if ((offset + dsl) > req_ccb->ccb_data_len) {
1101 req_ccb, dsl, offset));
1103 rc = read_pdu_data(pdu, req_ccb->ccb_data_ptr, offset);
1112 rc = receive_nop_in_pdu(conn, pdu, req_ccb);
1116 rc = receive_command_response_pdu(conn, pdu, req_ccb);
1120 rc = receive_task_management_pdu(conn, pdu, req_ccb);
1124 rc = receive_login_pdu(conn, pdu, req_ccb);
1128 rc = receive_text_response_pdu(conn, pdu, req_ccb);
1132 rc = receive_data_in_pdu(conn, pdu, req_ccb);
1136 rc = receive_logout_pdu(conn, pdu, req_ccb);
1140 rc = receive_r2t_pdu(conn, pdu, req_ccb);