vscsi 52 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_parse_command(struct scsi_info *vscsi, vscsi 55 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_adapter_idle(struct scsi_info *vscsi); vscsi 99 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static bool connection_broken(struct scsi_info *vscsi) vscsi 112 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c h_return_code = h_send_crq(vscsi->dds.unit_id, vscsi 116 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Connection_broken: rc %ld\n", h_return_code); vscsi 139 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_unregister_command_q(struct scsi_info *vscsi) vscsi 146 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c qrc = h_free_crq(vscsi->dds.unit_id); vscsi 149 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 150 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~PREP_FOR_SUSPEND_FLAGS; vscsi 151 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 156 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "unregister_command_q: error from h_free_crq %ld\n", vscsi 188 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "unregister_command_q: unknown error %ld from h_free_crq\n", vscsi 200 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Excessive wait for h_free_crq\n"); vscsi 204 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Freeing CRQ: phyp rc %ld, rc %ld\n", qrc, rc); vscsi 219 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_delete_client_info(struct scsi_info *vscsi, vscsi 222 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->client_cap = 0; vscsi 230 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->client_data.os_type = 0; vscsi 252 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_free_command_q(struct scsi_info *vscsi) vscsi 259 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!(vscsi->flags & CRQ_CLOSED)) { vscsi 260 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vio_disable_interrupts(vscsi->dma_dev); vscsi 262 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c state_under_lock = vscsi->new_state; vscsi 263 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c flags_under_lock = vscsi->flags; vscsi 264 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->phyp_acr_state = 0; vscsi 265 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->phyp_acr_flags = 0; vscsi 267 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 268 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_unregister_command_q(vscsi); vscsi 269 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 271 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (state_under_lock != vscsi->new_state) vscsi 272 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->phyp_acr_state = vscsi->new_state; vscsi 274 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->phyp_acr_flags = ((~flags_under_lock) & vscsi->flags); vscsi 277 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c bytes = vscsi->cmd_q.size * PAGE_SIZE; vscsi 278 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c memset(vscsi->cmd_q.base_addr, 0, bytes); vscsi 279 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.index = 0; vscsi 280 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= CRQ_CLOSED; vscsi 282 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_delete_client_info(vscsi, false); vscsi 285 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "free_command_q: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n", vscsi 286 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state, vscsi->phyp_acr_flags, vscsi 287 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->phyp_acr_state); vscsi 330 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_send_init_message(struct scsi_info *vscsi, u8 format) vscsi 339 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_send_crq(vscsi->dds.unit_id, cpu_to_be64(buffer[MSG_HI]), vscsi 357 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_check_init_msg(struct scsi_info *vscsi, uint *format) vscsi 362 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c crq = ibmvscsis_cmd_q_dequeue(vscsi->cmd_q.mask, &vscsi->cmd_q.index, vscsi 363 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.base_addr); vscsi 376 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c crq = ibmvscsis_cmd_q_dequeue(vscsi->cmd_q.mask, vscsi 377 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c &vscsi->cmd_q.index, vscsi 378 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.base_addr); vscsi 410 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = container_of(work, struct scsi_info, vscsi 415 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 416 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c new_state = vscsi->new_state; vscsi 417 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->new_state = 0; vscsi 419 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= DISCONNECT_SCHEDULED; vscsi 420 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~SCHEDULE_DISCONNECT; vscsi 422 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "disconnect: flags 0x%x, state 0x%hx\n", vscsi 423 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state); vscsi 429 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c switch (vscsi->state) { vscsi 442 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = new_state; vscsi 453 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = new_state; vscsi 466 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = new_state; vscsi 472 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = new_state; vscsi 473 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 474 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~(SCHEDULE_DISCONNECT | vscsi 477 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->flags & CFG_SLEEPING) { vscsi 478 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~CFG_SLEEPING; vscsi 479 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c complete(&vscsi->unconfig); vscsi 487 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "disconnect: invalid state %d for WAIT_IDLE\n", vscsi 488 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 496 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 497 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = new_state; vscsi 498 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~(SCHEDULE_DISCONNECT | vscsi 500 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_command_q(vscsi); vscsi 504 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = new_state; vscsi 521 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = new_state; vscsi 527 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = new_state; vscsi 534 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "disconnect start wait, active %d, sched %d\n", vscsi 535 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (int)list_empty(&vscsi->active_q), vscsi 536 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (int)list_empty(&vscsi->schedule_q)); vscsi 537 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!list_empty(&vscsi->active_q) || vscsi 538 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c !list_empty(&vscsi->schedule_q)) { vscsi 539 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= WAIT_FOR_IDLE; vscsi 540 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "disconnect flags 0x%x\n", vscsi 541 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags); vscsi 546 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 547 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c wait_for_completion(&vscsi->wait_idle); vscsi 548 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 550 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "disconnect stop wait\n"); vscsi 552 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_adapter_idle(vscsi); vscsi 555 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 571 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_post_disconnect(struct scsi_info *vscsi, uint new_state, vscsi 585 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "post_disconnect: Invalid new state %d\n", vscsi 590 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= flag_bits; vscsi 592 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "post_disconnect: new_state 0x%x, flag_bits 0x%x, vscsi->flags 0x%x, state %hx\n", vscsi 593 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c new_state, flag_bits, vscsi->flags, vscsi->state); vscsi 595 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!(vscsi->flags & (DISCONNECT_SCHEDULED | SCHEDULE_DISCONNECT))) { vscsi 596 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= SCHEDULE_DISCONNECT; vscsi 597 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->new_state = new_state; vscsi 599 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c INIT_WORK(&vscsi->proc_work, ibmvscsis_disconnect); vscsi 600 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (void)queue_work(vscsi->work_q, &vscsi->proc_work); vscsi 602 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->new_state) vscsi 603 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c state = vscsi->new_state; vscsi 605 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c state = vscsi->state; vscsi 616 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->new_state = new_state; vscsi 623 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->new_state = new_state; vscsi 635 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->new_state = new_state; vscsi 643 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving post_disconnect: flags 0x%x, new_state 0x%x\n", vscsi 644 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->new_state); vscsi 653 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_handle_init_compl_msg(struct scsi_info *vscsi) vscsi 657 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c switch (vscsi->state) { vscsi 668 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = CONNECTED; vscsi 677 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "init_msg: invalid state %d to get init compl msg\n", vscsi 678 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 679 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 692 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_handle_init_msg(struct scsi_info *vscsi) vscsi 696 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c switch (vscsi->state) { vscsi 698 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_send_init_message(vscsi, INIT_COMPLETE_MSG); vscsi 701 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = CONNECTED; vscsi 705 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "init_msg: failed to send, rc %ld\n", vscsi 707 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT, 0); vscsi 711 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "init_msg: failed to send, rc %ld\n", vscsi 714 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 719 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "init_msg: failed to send, rc %ld\n", vscsi 743 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "init_msg: invalid state %d to get init msg\n", vscsi 744 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 745 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 760 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_init_msg(struct scsi_info *vscsi, struct viosrp_crq *crq) vscsi 764 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "init_msg: state 0x%hx\n", vscsi->state); vscsi 766 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_vioctl(vscsi->dds.unit_id, H_GET_PARTNER_INFO, vscsi 767 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (u64)vscsi->map_ioba | ((u64)PAGE_SIZE << 32), 0, 0, 0, vscsi 770 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->client_data.partition_number = vscsi 771 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c be64_to_cpu(*(u64 *)vscsi->map_buf); vscsi 772 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "init_msg, part num %d\n", vscsi 773 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->client_data.partition_number); vscsi 775 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "init_msg h_vioctl rc %ld\n", rc); vscsi 780 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_handle_init_msg(vscsi); vscsi 782 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_handle_init_compl_msg(vscsi); vscsi 785 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "init_msg: invalid format %d\n", vscsi 787 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 799 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_establish_new_q(struct scsi_info *vscsi) vscsi 804 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_vioctl(vscsi->dds.unit_id, H_ENABLE_PREPARE_FOR_SUSPEND, 30000, vscsi 807 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= PREP_FOR_SUSPEND_ENABLED; vscsi 809 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Error from Enable Prepare for Suspend: %ld\n", vscsi 812 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= PRESERVE_FLAG_FIELDS; vscsi 813 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->rsp_q_timer.timer_pops = 0; vscsi 814 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit = 0; vscsi 815 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->credit = 0; vscsi 817 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = vio_enable_interrupts(vscsi->dma_dev); vscsi 819 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "establish_new_q: failed to enable interrupts, rc %ld\n", vscsi 824 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_check_init_msg(vscsi, &format); vscsi 826 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "establish_new_q: check_init_msg failed, rc %ld\n", vscsi 832 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_send_init_message(vscsi, INIT_MSG); vscsi 845 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = UNDEFINED; vscsi 850 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_handle_init_msg(vscsi); vscsi 875 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_reset_queue(struct scsi_info *vscsi) vscsi 880 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "reset_queue: flags 0x%x\n", vscsi->flags); vscsi 883 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->flags & (CLIENT_FAILED | TRANS_EVENT)) { vscsi 884 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= PRESERVE_FLAG_FIELDS; vscsi 885 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->rsp_q_timer.timer_pops = 0; vscsi 886 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit = 0; vscsi 887 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->credit = 0; vscsi 888 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = WAIT_CONNECTION; vscsi 889 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vio_enable_interrupts(vscsi->dma_dev); vscsi 891 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_free_command_q(vscsi); vscsi 893 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = WAIT_CONNECTION; vscsi 895 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c bytes = vscsi->cmd_q.size * PAGE_SIZE; vscsi 896 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_reg_crq(vscsi->dds.unit_id, vscsi 897 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.crq_token, bytes); vscsi 899 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_establish_new_q(vscsi); vscsi 903 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "reset_queue: reg_crq rc %ld\n", vscsi 906 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = ERR_DISCONNECTED; vscsi 907 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 908 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_command_q(vscsi); vscsi 911 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = ERR_DISCONNECTED; vscsi 912 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 924 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_free_cmd_resources(struct scsi_info *vscsi, vscsi 936 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->debit) vscsi 937 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit -= 1; vscsi 940 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~PROCESSING_MAD; vscsi 945 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "free_cmd_resources unknown type %d\n", vscsi 951 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->free_cmd); vscsi 954 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (list_empty(&vscsi->active_q) && list_empty(&vscsi->schedule_q) && vscsi 955 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_empty(&vscsi->waiting_rsp) && (vscsi->flags & WAIT_FOR_IDLE)) { vscsi 956 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~WAIT_FOR_IDLE; vscsi 957 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c complete(&vscsi->wait_idle); vscsi 975 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_ready_for_suspend(struct scsi_info *vscsi, bool idle) vscsi 981 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index; vscsi 983 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "ready_suspend: flags 0x%x, state 0x%hx crq_valid:%x\n", vscsi 984 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state, (int)crq->valid); vscsi 986 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!(vscsi->flags & PREP_FOR_SUSPEND_ABORTED) && !(crq->valid)) { vscsi 987 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_vioctl(vscsi->dds.unit_id, H_READY_FOR_SUSPEND, 0, 0, 0, vscsi 990 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Ready for Suspend Vioctl failed: %ld\n", vscsi 994 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c } else if (((vscsi->flags & PREP_FOR_SUSPEND_OVERWRITE) && vscsi 995 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (vscsi->flags & PREP_FOR_SUSPEND_ABORTED)) || vscsi 999 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = ERR_DISCONNECT_RECONNECT; vscsi 1000 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_reset_queue(vscsi); vscsi 1002 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c } else if (vscsi->state == CONNECTED) { vscsi 1003 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 1007 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~PREP_FOR_SUSPEND_OVERWRITE; vscsi 1011 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Invalid element in CRQ after Prepare for Suspend"); vscsi 1014 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~(PREP_FOR_SUSPEND_PENDING | PREP_FOR_SUSPEND_ABORTED); vscsi 1030 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_trans_event(struct scsi_info *vscsi, vscsi 1035 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "trans_event: format %d, flags 0x%x, state 0x%hx\n", vscsi 1036 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (int)crq->format, vscsi->flags, vscsi->state); vscsi 1042 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_delete_client_info(vscsi, true); vscsi 1044 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~PREP_FOR_SUSPEND_OVERWRITE; vscsi 1045 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c switch (vscsi->state) { vscsi 1052 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= (RESPONSE_Q_DOWN | TRANS_EVENT); vscsi 1062 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, WAIT_IDLE, vscsi 1068 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if ((vscsi->debit > 0) || vscsi 1069 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c !list_empty(&vscsi->schedule_q) || vscsi 1070 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c !list_empty(&vscsi->waiting_rsp) || vscsi 1071 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c !list_empty(&vscsi->active_q)) { vscsi 1072 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "debit %d, sched %d, wait %d, active %d\n", vscsi 1073 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit, vscsi 1074 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (int)list_empty(&vscsi->schedule_q), vscsi 1075 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (int)list_empty(&vscsi->waiting_rsp), vscsi 1076 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (int)list_empty(&vscsi->active_q)); vscsi 1077 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "connection lost with outstanding work\n"); vscsi 1079 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "trans_event: SRP Processing, but no outstanding work\n"); vscsi 1082 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, WAIT_IDLE, vscsi 1090 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= (RESPONSE_Q_DOWN | TRANS_EVENT); vscsi 1096 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Prep for Suspend, crq status = 0x%x\n", vscsi 1098 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c switch (vscsi->state) { vscsi 1102 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_ready_for_suspend(vscsi, false); vscsi 1105 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->resume_state = vscsi->state; vscsi 1106 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= PREP_FOR_SUSPEND_PENDING; vscsi 1108 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= PREP_FOR_SUSPEND_OVERWRITE; vscsi 1109 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, WAIT_IDLE, 0); vscsi 1118 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Invalid state for Prepare for Suspend Trans Event: 0x%x\n", vscsi 1119 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 1125 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Resume from Suspend, crq status = 0x%x\n", vscsi 1127 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->flags & PREP_FOR_SUSPEND_PENDING) { vscsi 1128 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= PREP_FOR_SUSPEND_ABORTED; vscsi 1131 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (vscsi->flags & PREP_FOR_SUSPEND_OVERWRITE)) { vscsi 1132 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 1135 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~PREP_FOR_SUSPEND_OVERWRITE; vscsi 1142 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "trans_event: invalid format %d\n", vscsi 1144 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT, vscsi 1149 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = vscsi->flags & SCHEDULE_DISCONNECT; vscsi 1151 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving trans_event: flags 0x%x, state 0x%hx, rc %ld\n", vscsi 1152 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state, rc); vscsi 1167 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi) vscsi 1174 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "poll_cmd_q: flags 0x%x, state 0x%hx, q index %ud\n", vscsi 1175 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state, vscsi->cmd_q.index); vscsi 1177 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = vscsi->flags & SCHEDULE_DISCONNECT; vscsi 1178 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index; vscsi 1184 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.index = vscsi 1185 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (vscsi->cmd_q.index + 1) & vscsi->cmd_q.mask; vscsi 1188 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_parse_command(vscsi, crq); vscsi 1197 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_trans_event(vscsi, crq); vscsi 1198 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c } else if (vscsi->flags & TRANS_EVENT) { vscsi 1203 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "poll_cmd_q, ignoring\n"); vscsi 1209 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->cmd_q.index) vscsi 1210 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.index -= 1; vscsi 1216 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.index = vscsi->cmd_q.mask; vscsi 1223 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index; vscsi 1230 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vio_enable_interrupts(vscsi->dma_dev); vscsi 1232 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "poll_cmd_q, reenabling interrupts\n"); vscsi 1240 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving poll_cmd_q: rc %ld\n", rc); vscsi 1253 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_free_cmd_qs(struct scsi_info *vscsi) vscsi 1257 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "free_cmd_qs: waiting_rsp empty %d, timer starter %d\n", vscsi 1258 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (int)list_empty(&vscsi->waiting_rsp), vscsi 1259 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->rsp_q_timer.started); vscsi 1261 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_for_each_entry_safe(cmd, nxt, &vscsi->waiting_rsp, list) { vscsi 1263 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 1273 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static struct ibmvscsis_cmd *ibmvscsis_get_free_cmd(struct scsi_info *vscsi) vscsi 1278 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c iue = srp_iu_get(&vscsi->target); vscsi 1280 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c cmd = list_first_entry_or_null(&vscsi->free_cmd, vscsi 1311 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_adapter_idle(struct scsi_info *vscsi) vscsi 1316 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "adapter_idle: flags 0x%x, state 0x%hx\n", vscsi 1317 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state); vscsi 1320 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->state != WAIT_CONNECTION || vscsi->flags & TRANS_EVENT) vscsi 1323 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c switch (vscsi->state) { vscsi 1325 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_command_q(vscsi); vscsi 1328 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->flags & CFG_SLEEPING) { vscsi 1329 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~CFG_SLEEPING; vscsi 1330 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c complete(&vscsi->unconfig); vscsi 1334 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_reset_queue(vscsi); vscsi 1335 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "adapter_idle, disc_rec: flags 0x%x\n", vscsi 1336 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags); vscsi 1340 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_command_q(vscsi); vscsi 1341 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~(SCHEDULE_DISCONNECT | DISCONNECT_SCHEDULED); vscsi 1342 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 1343 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->tport.enabled) vscsi 1344 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = ERR_DISCONNECTED; vscsi 1346 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = WAIT_ENABLED; vscsi 1347 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "adapter_idle, disc: flags 0x%x, state 0x%hx\n", vscsi 1348 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state); vscsi 1352 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->rsp_q_timer.timer_pops = 0; vscsi 1353 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit = 0; vscsi 1354 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->credit = 0; vscsi 1355 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->flags & PREP_FOR_SUSPEND_PENDING) { vscsi 1356 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = vscsi->resume_state; vscsi 1357 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->resume_state = 0; vscsi 1358 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_ready_for_suspend(vscsi, true); vscsi 1359 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~DISCONNECT_SCHEDULED; vscsi 1362 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c } else if (vscsi->flags & TRANS_EVENT) { vscsi 1363 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = WAIT_CONNECTION; vscsi 1364 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= PRESERVE_FLAG_FIELDS; vscsi 1366 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = CONNECTED; vscsi 1367 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~DISCONNECT_SCHEDULED; vscsi 1370 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "adapter_idle, wait: flags 0x%x, state 0x%hx\n", vscsi 1371 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state); vscsi 1372 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_poll_cmd_q(vscsi); vscsi 1376 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~DISCONNECT_SCHEDULED; vscsi 1377 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "adapter_idle, disconnected: flags 0x%x, state 0x%hx\n", vscsi 1378 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state); vscsi 1382 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "adapter_idle: in invalid state %d\n", vscsi 1383 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 1388 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_qs(vscsi); vscsi 1408 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->phyp_acr_state != 0) { vscsi 1414 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= vscsi->phyp_acr_flags; vscsi 1415 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi->phyp_acr_state, 0); vscsi 1416 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->phyp_acr_state = 0; vscsi 1417 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->phyp_acr_flags = 0; vscsi 1419 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "adapter_idle: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n", vscsi 1420 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state, vscsi->phyp_acr_flags, vscsi 1421 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->phyp_acr_state); vscsi 1424 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving adapter_idle: flags 0x%x, state 0x%hx, new_state 0x%x\n", vscsi 1425 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state, vscsi->new_state); vscsi 1440 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_copy_crq_packet(struct scsi_info *vscsi, vscsi 1450 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "copy_crq: Invalid len %d passed", len); vscsi 1451 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 1455 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_copy_rdma(len, vscsi->dds.window[REMOTE].liobn, vscsi 1457 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[LOCAL].liobn, iue->sbuf->dma); vscsi 1464 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "copy_crq: ioba 0x%llx, init_time 0x%llx\n", vscsi 1468 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) vscsi 1469 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 1474 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 1477 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "copy_crq: h_copy_rdma failed, rc %ld\n", vscsi 1483 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "copy_crq: h_copy_rdma failed, rc %ld\n", vscsi 1485 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 1500 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_adapter_info(struct scsi_info *vscsi, vscsi 1516 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c info = dma_alloc_coherent(&vscsi->dma_dev->dev, sizeof(*info), &token, vscsi 1519 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "bad dma_alloc_coherent %p\n", vscsi 1527 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[REMOTE].liobn, vscsi 1529 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[LOCAL].liobn, token); vscsi 1533 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) vscsi 1536 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "adapter_info: h_copy_rdma from client failed, rc %ld\n", vscsi 1538 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "adapter_info: ioba 0x%llx, flags 0x%x, flag_bits 0x%x\n", vscsi 1539 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c be64_to_cpu(mad->buffer), vscsi->flags, flag_bits); vscsi 1540 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, vscsi 1550 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->client_data.partition_number == 0) vscsi 1551 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->client_data.partition_number = vscsi 1553 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c strncpy(vscsi->client_data.srp_version, info->srp_version, vscsi 1554 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c sizeof(vscsi->client_data.srp_version)); vscsi 1555 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c strncpy(vscsi->client_data.partition_name, info->partition_name, vscsi 1556 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c sizeof(vscsi->client_data.partition_name)); vscsi 1557 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->client_data.mad_version = be32_to_cpu(info->mad_version); vscsi 1558 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->client_data.os_type = be32_to_cpu(info->os_type); vscsi 1563 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c strncpy(info->partition_name, vscsi->dds.partition_name, vscsi 1565 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c info->partition_number = cpu_to_be32(vscsi->dds.partition_num); vscsi 1572 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_copy_rdma(sizeof(*info), vscsi->dds.window[LOCAL].liobn, vscsi 1573 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c token, vscsi->dds.window[REMOTE].liobn, vscsi 1582 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) vscsi 1586 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "adapter_info: h_copy_rdma to client failed, rc %ld\n", vscsi 1588 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 1595 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dma_free_coherent(&vscsi->dma_dev->dev, sizeof(*info), info, token); vscsi 1596 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving adapter_info, rc %ld\n", rc); vscsi 1612 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue) vscsi 1630 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "cap_mad: invalid len %d\n", olen); vscsi 1635 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c cap = dma_alloc_coherent(&vscsi->dma_dev->dev, olen, &token, vscsi 1638 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "bad dma_alloc_coherent %p\n", vscsi 1643 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_copy_rdma(olen, vscsi->dds.window[REMOTE].liobn, vscsi 1645 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[LOCAL].liobn, token); vscsi 1647 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c strncpy(cap->name, dev_name(&vscsi->dma_dev->dev), vscsi 1655 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "cap_mad: len left %hd, cap type %d, cap len %hd\n", vscsi 1661 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "cap_mad: cap len mismatch with total len\n"); vscsi 1667 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "cap_mad: cap len is 0\n"); vscsi 1674 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "cap_mad: unsupported capability\n"); vscsi 1689 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_copy_rdma(olen, vscsi->dds.window[LOCAL].liobn, token, vscsi 1690 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[REMOTE].liobn, vscsi 1694 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "cap_mad: failed to copy to client, rc %ld\n", vscsi 1698 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) vscsi 1703 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "cap_mad: error copying data to client, rc %ld\n", vscsi 1705 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 1711 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dma_free_coherent(&vscsi->dma_dev->dev, olen, cap, token); vscsi 1713 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving cap_mad, rc %ld, client_cap 0x%x\n", vscsi 1714 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc, vscsi->client_cap); vscsi 1726 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_process_mad(struct scsi_info *vscsi, struct iu_entry *iue) vscsi 1735 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->empty_iu_id = be64_to_cpu(empty->buffer); vscsi 1736 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->empty_iu_tag = be64_to_cpu(empty->common.tag); vscsi 1740 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_adapter_info(vscsi, iue); vscsi 1743 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_cap_mad(vscsi, iue); vscsi 1746 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->state == CONNECTED) { vscsi 1747 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->fast_fail = true; vscsi 1750 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "fast fail mad sent after login\n"); vscsi 1769 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void srp_snd_msg_failed(struct scsi_info *vscsi, long rc) vscsi 1774 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_qs(vscsi); vscsi 1777 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= CLIENT_FAILED; vscsi 1780 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!(vscsi->flags & RESPONSE_Q_DOWN)) { vscsi 1781 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 1782 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!(vscsi->state & (ERR_DISCONNECT | vscsi 1785 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "snd_msg_failed: setting RESPONSE_Q_DOWN, state 0x%hx, flags 0x%x, rc %ld\n", vscsi 1786 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state, vscsi->flags, rc); vscsi 1788 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 1808 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if ((vscsi->rsp_q_timer.timer_pops < MAX_TIMER_POPS) || vscsi 1809 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (vscsi->state == SRP_PROCESSING)) { vscsi 1810 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "snd_msg_failed: response queue full, flags 0x%x, timer started %d, pops %d\n", vscsi 1811 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, (int)vscsi->rsp_q_timer.started, vscsi 1812 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->rsp_q_timer.timer_pops); vscsi 1818 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!vscsi->rsp_q_timer.started) { vscsi 1819 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->rsp_q_timer.timer_pops < vscsi 1830 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->rsp_q_timer.started = true; vscsi 1831 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c hrtimer_start(&vscsi->rsp_q_timer.timer, kt, vscsi 1843 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 1844 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_qs(vscsi); vscsi 1850 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!(vscsi->state & (ERR_DISCONNECT | vscsi 1853 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "client crq full too long\n"); vscsi 1854 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 1872 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_send_messages(struct scsi_info *vscsi) vscsi 1884 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!(vscsi->flags & RESPONSE_Q_DOWN)) { vscsi 1887 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_for_each_entry_safe(cmd, nxt, &vscsi->waiting_rsp, vscsi 1912 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, vscsi 1932 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->credit += 1; vscsi 1944 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_send_crq(vscsi->dma_dev->unit_address, vscsi 1948 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "send_messages: cmd %p, tag 0x%llx, rc %ld\n", vscsi 1957 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->rsp_q_timer.timer_pops = 0; vscsi 1960 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, vscsi 1963 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c srp_snd_msg_failed(vscsi, rc); vscsi 1976 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->rsp_q_timer.timer_pops = 0; vscsi 1979 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_qs(vscsi); vscsi 1984 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_send_mad_resp(struct scsi_info *vscsi, vscsi 1995 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[LOCAL].liobn, iue->sbuf->dma, vscsi 1996 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[REMOTE].liobn, vscsi 2002 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->waiting_rsp); vscsi 2003 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_send_messages(vscsi); vscsi 2005 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Error sending mad response, rc %ld\n", vscsi 2008 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) vscsi 2011 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "mad: failed to copy to client, rc %ld\n", vscsi 2014 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2015 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, vscsi 2028 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq) vscsi 2035 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c switch (vscsi->state) { vscsi 2042 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "mad: in Wait Connection state, ignoring MAD, flags %d\n", vscsi 2043 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags); vscsi 2059 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "mad: invalid adapter state %d for mad\n", vscsi 2060 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 2064 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c cmd = ibmvscsis_get_free_cmd(vscsi); vscsi 2066 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "mad: failed to get cmd, debit %d\n", vscsi 2067 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit); vscsi 2068 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2074 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_copy_crq_packet(vscsi, cmd, crq); vscsi 2078 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "mad: type %d\n", be32_to_cpu(mad->type)); vscsi 2080 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_process_mad(vscsi, iue); vscsi 2082 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "mad: status %hd, rc %ld\n", vscsi 2086 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_send_mad_resp(vscsi, cmd, crq); vscsi 2088 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2091 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving mad, rc %ld\n", rc); vscsi 2103 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_login_rsp(struct scsi_info *vscsi, vscsi 2115 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rsp->req_lim_delta = cpu_to_be32(vscsi->request_limit); vscsi 2121 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->credit = 0; vscsi 2126 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_copy_rdma(cmd->rsp.len, vscsi->dds.window[LOCAL].liobn, vscsi 2127 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c iue->sbuf->dma, vscsi->dds.window[REMOTE].liobn, vscsi 2135 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) vscsi 2137 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "login_rsp: error copying to client, rc %ld\n", vscsi 2139 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, vscsi 2145 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "login_rsp: error copying to client, rc %ld\n", vscsi 2147 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2163 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_srp_login_rej(struct scsi_info *vscsi, vscsi 2183 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_copy_rdma(cmd->rsp.len, vscsi->dds.window[LOCAL].liobn, vscsi 2184 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c iue->sbuf->dma, vscsi->dds.window[REMOTE].liobn, vscsi 2191 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) vscsi 2193 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "login_rej: error copying to client, rc %ld\n", vscsi 2195 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, vscsi 2201 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "login_rej: error copying to client, rc %ld\n", vscsi 2203 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2214 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport); vscsi 2218 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "tport->ibmv_nexus already exists\n"); vscsi 2224 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Unable to allocate struct ibmvscsis_nexus\n"); vscsi 2277 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_srp_login(struct scsi_info *vscsi, vscsi 2308 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->state == SRP_PROCESSING) vscsi 2311 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_make_nexus(&vscsi->tport); vscsi 2318 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "srp_login: reason 0x%x\n", reason); vscsi 2321 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_srp_login_rej(vscsi, cmd, reason); vscsi 2323 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_login_rsp(vscsi, cmd); vscsi 2327 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = SRP_PROCESSING; vscsi 2329 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->waiting_rsp); vscsi 2330 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_send_messages(vscsi); vscsi 2332 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2335 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving srp_login, rc %ld\n", rc); vscsi 2351 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_srp_i_logout(struct scsi_info *vscsi, vscsi 2359 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if ((vscsi->debit > 0) || !list_empty(&vscsi->schedule_q) || vscsi 2360 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c !list_empty(&vscsi->waiting_rsp)) { vscsi 2361 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "i_logout: outstanding work\n"); vscsi 2362 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT, 0); vscsi 2367 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->waiting_rsp); vscsi 2368 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_send_messages(vscsi); vscsi 2370 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, WAIT_IDLE, 0); vscsi 2377 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_srp_cmd(struct scsi_info *vscsi, struct viosrp_crq *crq) vscsi 2385 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->request_limit - vscsi->debit <= 0) { vscsi 2387 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Client exceeded the request limit (%d), debit %d\n", vscsi 2388 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->request_limit, vscsi->debit); vscsi 2389 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2393 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c cmd = ibmvscsis_get_free_cmd(vscsi); vscsi 2395 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "srp_cmd failed to get cmd, debit %d\n", vscsi 2396 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit); vscsi 2397 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2403 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_copy_crq_packet(vscsi, cmd, crq); vscsi 2405 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2409 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->state == SRP_PROCESSING) { vscsi 2412 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_srp_login(vscsi, cmd, crq); vscsi 2417 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "tsk_mgmt tag: %llu (0x%llx)\n", vscsi 2420 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit += 1; vscsi 2422 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->schedule_q); vscsi 2423 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c queue_work(vscsi->work_q, &cmd->work); vscsi 2427 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "srp_cmd tag: %llu (0x%llx)\n", vscsi 2430 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->debit += 1; vscsi 2436 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->schedule_q); vscsi 2437 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c queue_work(vscsi->work_q, &cmd->work); vscsi 2441 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_srp_i_logout(vscsi, cmd, crq); vscsi 2447 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2448 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "invalid srp cmd, opcode %d\n", vscsi 2450 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 2454 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c } else if (srp->opcode == SRP_LOGIN_REQ && vscsi->state == CONNECTED) { vscsi 2455 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_srp_login(vscsi, cmd, crq); vscsi 2457 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2458 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Invalid state %d to handle srp cmd\n", vscsi 2459 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 2460 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2477 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_ping_response(struct scsi_info *vscsi) vscsi 2488 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_send_crq(vscsi->dds.unit_id, cpu_to_be64(buffer[MSG_HI]), vscsi 2495 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= CLIENT_FAILED; vscsi 2498 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 2501 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "ping_response: h_send_crq failed, rc %ld\n", vscsi 2503 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2506 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "ping_response: h_send_crq returned unknown rc %ld\n", vscsi 2508 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT, 0); vscsi 2527 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_parse_command(struct scsi_info *vscsi, vscsi 2539 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->flags & PROCESSING_MAD) { vscsi 2541 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "parse_command: already processing mad\n"); vscsi 2542 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 2546 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= PROCESSING_MAD; vscsi 2547 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_mad(vscsi, crq); vscsi 2552 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_srp_cmd(vscsi, crq); vscsi 2557 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_ping_response(vscsi); vscsi 2561 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "parse_command: invalid format %d\n", vscsi 2563 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, vscsi 2570 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_trans_event(vscsi, crq); vscsi 2574 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_init_msg(vscsi, crq); vscsi 2578 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "parse_command: invalid valid field %d\n", vscsi 2580 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2588 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = vscsi->flags & SCHEDULE_DISCONNECT; vscsi 2593 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static int read_dma_window(struct scsi_info *vscsi) vscsi 2595 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct vio_dev *vdev = vscsi->dma_dev; vscsi 2607 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Couldn't find ibm,my-dma-window property\n"); vscsi 2611 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[LOCAL].liobn = be32_to_cpu(*dma_window); vscsi 2617 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "Couldn't find ibm,#dma-address-cells property\n"); vscsi 2626 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_warn(&vscsi->dev, "Couldn't find ibm,#dma-size-cells property\n"); vscsi 2633 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[REMOTE].liobn = be32_to_cpu(*dma_window); vscsi 2642 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi; vscsi 2645 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_for_each_entry(vscsi, &ibmvscsis_dev_list, list) { vscsi 2646 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vdev = vscsi->dma_dev; vscsi 2648 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c tport = &vscsi->tport; vscsi 2668 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_parse_cmd(struct scsi_info *vscsi, vscsi 2679 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c nexus = vscsi->tport.ibmv_nexus; vscsi 2689 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "parse_cmd: reserved bits set in IU\n"); vscsi 2690 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2691 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2692 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2693 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2698 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "0x%llx: parsing SRP descriptor table failed.\n", vscsi 2719 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Invalid task attribute %d\n", vscsi 2726 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2727 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->active_q); vscsi 2728 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2736 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "target_submit_cmd failed, rc %d\n", rc); vscsi 2737 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2739 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2740 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2746 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2747 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, 0); vscsi 2748 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2763 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_parse_task(struct scsi_info *vscsi, vscsi 2773 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c nexus = vscsi->tport.ibmv_nexus; vscsi 2795 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "unknown task mgmt func %d\n", vscsi 2806 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2807 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->active_q); vscsi 2808 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2812 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "calling submit_tmr, func %d\n", vscsi 2818 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "target_submit_tmr failed, rc %d\n", vscsi 2820 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2822 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2836 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = cmd->adapter; vscsi 2838 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2844 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->flags & (SCHEDULE_DISCONNECT | DISCONNECT_SCHEDULED)) { vscsi 2845 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2848 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (list_empty(&vscsi->active_q) && vscsi 2849 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_empty(&vscsi->schedule_q) && vscsi 2850 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (vscsi->flags & WAIT_FOR_IDLE)) { vscsi 2851 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags &= ~WAIT_FOR_IDLE; vscsi 2852 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c complete(&vscsi->wait_idle); vscsi 2855 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2859 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2863 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_parse_cmd(vscsi, cmd); vscsi 2866 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_parse_task(vscsi, cmd); vscsi 2869 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "scheduler, invalid cmd type %d\n", vscsi 2871 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2872 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmd_resources(vscsi, cmd); vscsi 2873 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2878 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static int ibmvscsis_alloc_cmds(struct scsi_info *vscsi, int num) vscsi 2883 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c INIT_LIST_HEAD(&vscsi->free_cmd); vscsi 2884 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_pool = kcalloc(num, sizeof(struct ibmvscsis_cmd), vscsi 2886 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!vscsi->cmd_pool) vscsi 2889 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c for (i = 0, cmd = (struct ibmvscsis_cmd *)vscsi->cmd_pool; i < num; vscsi 2892 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c cmd->adapter = vscsi; vscsi 2894 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&cmd->list, &vscsi->free_cmd); vscsi 2900 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_free_cmds(struct scsi_info *vscsi) vscsi 2902 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c kfree(vscsi->cmd_pool); vscsi 2903 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_pool = NULL; vscsi 2904 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c INIT_LIST_HEAD(&vscsi->free_cmd); vscsi 2923 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = container_of(p_timer, struct scsi_info, vscsi 2926 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 2929 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_send_messages(vscsi); vscsi 2930 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 2935 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_alloctimer(struct scsi_info *vscsi) vscsi 2939 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c p_timer = &vscsi->rsp_q_timer; vscsi 2949 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_freetimer(struct scsi_info *vscsi) vscsi 2953 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c p_timer = &vscsi->rsp_q_timer; vscsi 2963 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = data; vscsi 2965 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vio_disable_interrupts(vscsi->dma_dev); vscsi 2966 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c tasklet_schedule(&vscsi->work_task); vscsi 2980 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_enable_change_state(struct scsi_info *vscsi) vscsi 2985 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c bytes = vscsi->cmd_q.size * PAGE_SIZE; vscsi 2986 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_reg_crq(vscsi->dds.unit_id, vscsi->cmd_q.crq_token, bytes); vscsi 2988 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = WAIT_CONNECTION; vscsi 2989 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_establish_new_q(vscsi); vscsi 2993 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = ERR_DISCONNECTED; vscsi 2994 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN; vscsi 3012 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long ibmvscsis_create_command_q(struct scsi_info *vscsi, int num_cmds) vscsi 3015 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct vio_dev *vdev = vscsi->dma_dev; vscsi 3020 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.size = pages; vscsi 3022 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.base_addr = vscsi 3024 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!vscsi->cmd_q.base_addr) vscsi 3027 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.mask = ((uint)pages * CRQ_PER_PAGE) - 1; vscsi 3029 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.crq_token = dma_map_single(&vdev->dev, vscsi 3030 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.base_addr, vscsi 3032 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (dma_mapping_error(&vdev->dev, vscsi->cmd_q.crq_token)) { vscsi 3033 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c free_page((unsigned long)vscsi->cmd_q.base_addr); vscsi 3049 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static void ibmvscsis_destroy_command_q(struct scsi_info *vscsi) vscsi 3051 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dma_unmap_single(&vscsi->dma_dev->dev, vscsi->cmd_q.crq_token, vscsi 3053 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c free_page((unsigned long)vscsi->cmd_q.base_addr); vscsi 3054 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.base_addr = NULL; vscsi 3055 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = NO_QUEUE; vscsi 3058 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static u8 ibmvscsis_fast_fail(struct scsi_info *vscsi, vscsi 3067 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->fast_fail && (READ_CMD(srp->cdb) || WRITE_CMD(srp->cdb))) vscsi 3089 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c static long srp_build_response(struct scsi_info *vscsi, vscsi 3101 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 3110 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit); vscsi 3115 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rsp->status = ibmvscsis_fast_fail(vscsi, cmd); vscsi 3117 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "build_resp: cmd %p, scsi status %d\n", vscsi 3131 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "build_resp: cmd %p, fast fail\n", vscsi 3174 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = h_copy_rdma(len, vscsi->dds.window[LOCAL].liobn, iue->sbuf->dma, vscsi 3175 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[REMOTE].liobn, vscsi 3180 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->credit = 0; vscsi 3184 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) vscsi 3185 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= RESPONSE_Q_DOWN | CLIENT_FAILED; vscsi 3187 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "build_response: error copying to client, rc %ld, flags 0x%x, state 0x%hx\n", vscsi 3188 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc, vscsi->flags, vscsi->state); vscsi 3193 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "build_response: error copying to client, rc %ld\n", vscsi 3198 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 3209 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = target->ldata; vscsi 3230 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "rdma: ran out of client memory descriptors\n"); vscsi 3239 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "rdma: ran out of scatter/gather list\n"); vscsi 3261 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[REMOTE].liobn, vscsi 3263 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[LOCAL].liobn, vscsi 3275 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[LOCAL].liobn, vscsi 3277 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[REMOTE].liobn, vscsi 3286 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (connection_broken(vscsi)) { vscsi 3287 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 3288 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= vscsi 3290 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 3292 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "rdma: h_copy_rdma failed, rc %ld\n", vscsi 3297 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "rdma: unknown error %ld from h_copy_rdma\n", vscsi 3337 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = (struct scsi_info *)data; vscsi 3343 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 3345 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "got interrupt\n"); vscsi 3352 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (TARGET_STOP(vscsi)) { vscsi 3353 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vio_enable_interrupts(vscsi->dma_dev); vscsi 3355 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "handle_crq, don't process: flags 0x%x, state 0x%hx\n", vscsi 3356 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state); vscsi 3357 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 3361 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = vscsi->flags & SCHEDULE_DISCONNECT; vscsi 3362 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index; vscsi 3374 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.index = vscsi 3375 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (vscsi->cmd_q.index + 1) & vscsi->cmd_q.mask; vscsi 3378 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_parse_command(vscsi, crq); vscsi 3387 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_trans_event(vscsi, crq); vscsi 3388 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c } else if (vscsi->flags & TRANS_EVENT) { vscsi 3396 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (vscsi->cmd_q.index) vscsi 3397 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.index -= 1; vscsi 3403 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->cmd_q.index = vscsi->cmd_q.mask; vscsi 3410 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index; vscsi 3417 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vio_enable_interrupts(vscsi->dma_dev); vscsi 3419 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "handle_crq, reenabling interrupts\n"); vscsi 3426 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "handle_crq, error: flags 0x%x, state 0x%hx, crq index 0x%x\n", vscsi 3427 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags, vscsi->state, vscsi->cmd_q.index); vscsi 3430 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Leaving handle_crq: schedule_q empty %d, flags 0x%x, state 0x%hx\n", vscsi 3431 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (int)list_empty(&vscsi->schedule_q), vscsi->flags, vscsi 3432 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 3434 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 3440 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi; vscsi 3445 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL); vscsi 3446 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!vscsi) { vscsi 3452 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dma_dev = vdev; vscsi 3453 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dev = vdev->dev; vscsi 3454 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c INIT_LIST_HEAD(&vscsi->schedule_q); vscsi 3455 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c INIT_LIST_HEAD(&vscsi->waiting_rsp); vscsi 3456 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c INIT_LIST_HEAD(&vscsi->active_q); vscsi 3458 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c snprintf(vscsi->tport.tport_name, IBMVSCSIS_NAMELEN, "%s", vscsi 3461 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "probe tport_name: %s\n", vscsi->tport.tport_name); vscsi 3463 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = read_dma_window(vscsi); vscsi 3466 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "Probe: liobn 0x%x, riobn 0x%x\n", vscsi 3467 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[LOCAL].liobn, vscsi 3468 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.window[REMOTE].liobn); vscsi 3470 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name); vscsi 3472 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.unit_id = vdev->unit_address; vscsi 3473 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c strscpy(vscsi->dds.partition_name, partition_name, vscsi 3474 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c sizeof(vscsi->dds.partition_name)); vscsi 3475 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->dds.partition_num = partition_number; vscsi 3478 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_add_tail(&vscsi->list, &ibmvscsis_dev_list); vscsi 3485 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->request_limit = INITIAL_SRP_LIMIT; vscsi 3486 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = srp_target_alloc(&vscsi->target, &vdev->dev, vscsi->request_limit, vscsi 3491 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->target.ldata = vscsi; vscsi 3493 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_alloc_cmds(vscsi, vscsi->request_limit); vscsi 3495 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "alloc_cmds failed, rc %d, num %d\n", vscsi 3496 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc, vscsi->request_limit); vscsi 3504 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_init(&vscsi->intr_lock); vscsi 3506 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_alloctimer(vscsi); vscsi 3508 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "probe: alloctimer failed, rc %d\n", rc); vscsi 3512 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = ibmvscsis_create_command_q(vscsi, 256); vscsi 3514 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "probe: create_command_q failed, rc %d\n", vscsi 3519 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->map_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); vscsi 3520 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!vscsi->map_buf) { vscsi 3522 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "probe: allocating cmd buffer failed\n"); vscsi 3526 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->map_ioba = dma_map_single(&vdev->dev, vscsi->map_buf, PAGE_SIZE, vscsi 3528 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (dma_mapping_error(&vdev->dev, vscsi->map_ioba)) { vscsi 3530 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "probe: error mapping command buffer\n"); vscsi 3534 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c hrc = h_vioctl(vscsi->dds.unit_id, H_GET_PARTNER_INFO, vscsi 3535 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (u64)vscsi->map_ioba | ((u64)PAGE_SIZE << 32), 0, 0, 0, vscsi 3538 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->client_data.partition_number = vscsi 3539 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c be64_to_cpu(*(u64 *)vscsi->map_buf); vscsi 3545 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "probe hrc %ld, client partition num %d\n", vscsi 3546 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c hrc, vscsi->client_data.partition_number); vscsi 3548 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c tasklet_init(&vscsi->work_task, ibmvscsis_handle_crq, vscsi 3549 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c (unsigned long)vscsi); vscsi 3551 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c init_completion(&vscsi->wait_idle); vscsi 3552 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c init_completion(&vscsi->unconfig); vscsi 3555 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->work_q = create_workqueue(wq_name); vscsi 3556 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if (!vscsi->work_q) { vscsi 3558 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "create_workqueue failed\n"); vscsi 3562 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c rc = request_irq(vdev->irq, ibmvscsis_interrupt, 0, "ibmvscsis", vscsi); vscsi 3565 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "probe: request_irq failed, rc %d\n", rc); vscsi 3569 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state = WAIT_ENABLED; vscsi 3571 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_set_drvdata(&vdev->dev, vscsi); vscsi 3576 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c destroy_workqueue(vscsi->work_q); vscsi 3578 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dma_unmap_single(&vdev->dev, vscsi->map_ioba, PAGE_SIZE, vscsi 3581 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c kfree(vscsi->map_buf); vscsi 3583 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c tasklet_kill(&vscsi->work_task); vscsi 3584 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_unregister_command_q(vscsi); vscsi 3585 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_destroy_command_q(vscsi); vscsi 3587 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_freetimer(vscsi); vscsi 3589 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmds(vscsi); vscsi 3591 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c srp_target_free(&vscsi->target); vscsi 3594 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_del(&vscsi->list); vscsi 3597 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c kfree(vscsi); vscsi 3604 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = dev_get_drvdata(&vdev->dev); vscsi 3606 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "remove (%s)\n", dev_name(&vscsi->dma_dev->dev)); vscsi 3608 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 3609 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, UNCONFIGURING, 0); vscsi 3610 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags |= CFG_SLEEPING; vscsi 3611 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 3612 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c wait_for_completion(&vscsi->unconfig); vscsi 3615 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c free_irq(vdev->irq, vscsi); vscsi 3616 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c destroy_workqueue(vscsi->work_q); vscsi 3617 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dma_unmap_single(&vdev->dev, vscsi->map_ioba, PAGE_SIZE, vscsi 3619 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c kfree(vscsi->map_buf); vscsi 3620 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c tasklet_kill(&vscsi->work_task); vscsi 3621 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_destroy_command_q(vscsi); vscsi 3622 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_freetimer(vscsi); vscsi 3623 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_free_cmds(vscsi); vscsi 3624 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c srp_target_free(&vscsi->target); vscsi 3626 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_del(&vscsi->list); vscsi 3628 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c kfree(vscsi); vscsi 3648 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = container_of(dev, struct scsi_info, dev); vscsi 3650 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c return snprintf(buf, PAGE_SIZE, "%x\n", vscsi->dma_dev->unit_address); vscsi 3737 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = cmd->adapter; vscsi 3739 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 3741 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_move_tail(&cmd->list, &vscsi->waiting_rsp); vscsi 3742 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_send_messages(vscsi); vscsi 3743 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 3755 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = cmd->adapter; vscsi 3764 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) { vscsi 3765 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "write_pending failed since: %d\n", vscsi 3766 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->flags); vscsi 3774 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "srp_transfer_data() failed: %d\n", rc); vscsi 3799 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = cmd->adapter; vscsi 3807 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "srp_transfer_data failed: %d\n", rc); vscsi 3816 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c srp_build_response(vscsi, cmd, &len); vscsi 3827 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = cmd->adapter; vscsi 3830 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "queue_status %p\n", se_cmd); vscsi 3832 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c srp_build_response(vscsi, cmd, &len); vscsi 3843 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = cmd->adapter; vscsi 3850 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "queue_tm_rsp %p, status %d\n", vscsi 3855 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 3856 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c list_for_each_entry(cmd_itr, &vscsi->active_q, list) { vscsi 3863 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 3866 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c srp_build_response(vscsi, cmd, &len); vscsi 3875 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = cmd->adapter; vscsi 3877 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "ibmvscsis_aborted_task %p task_tag: %llu\n", vscsi 3886 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi; vscsi 3890 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi = container_of(tport, struct scsi_info, tport); vscsi 3892 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "make_tport(%s), pointer:%p, tport_id:%x\n", vscsi 3905 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport); vscsi 3907 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "drop_tport(%s)\n", vscsi 3985 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport); vscsi 3992 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Unable to extract srpt_tpg_store_enable\n"); vscsi 3997 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "Illegal value for srpt_tpg_store_enable\n"); vscsi 4002 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 4004 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c lrc = ibmvscsis_enable_change_state(vscsi); vscsi 4006 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_err(&vscsi->dev, "enable_change_state failed, rc %ld state %d\n", vscsi 4007 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c lrc, vscsi->state); vscsi 4008 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 4010 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_lock_bh(&vscsi->intr_lock); vscsi 4013 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT, 0); vscsi 4014 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c spin_unlock_bh(&vscsi->intr_lock); vscsi 4017 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c dev_dbg(&vscsi->dev, "tpg_enable_store, tmp %ld, state %d\n", tmp, vscsi 4018 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c vscsi->state); vscsi 58 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi; vscsi 108 drivers/scsi/virtio_scsi.c static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf) vscsi 119 drivers/scsi/virtio_scsi.c virtscsi_compute_resid(sc, virtio32_to_cpu(vscsi->vdev, resp->resid)); vscsi 157 drivers/scsi/virtio_scsi.c WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) > vscsi 162 drivers/scsi/virtio_scsi.c virtio32_to_cpu(vscsi->vdev, resp->sense_len), vscsi 171 drivers/scsi/virtio_scsi.c static void virtscsi_vq_done(struct virtio_scsi *vscsi, vscsi 173 drivers/scsi/virtio_scsi.c void (*fn)(struct virtio_scsi *vscsi, void *buf)) vscsi 184 drivers/scsi/virtio_scsi.c fn(vscsi, buf); vscsi 195 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(sh); vscsi 197 drivers/scsi/virtio_scsi.c struct virtio_scsi_vq *req_vq = &vscsi->req_vqs[index]; vscsi 199 drivers/scsi/virtio_scsi.c virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd); vscsi 202 drivers/scsi/virtio_scsi.c static void virtscsi_poll_requests(struct virtio_scsi *vscsi) vscsi 206 drivers/scsi/virtio_scsi.c num_vqs = vscsi->num_queues; vscsi 208 drivers/scsi/virtio_scsi.c virtscsi_vq_done(vscsi, &vscsi->req_vqs[i], vscsi 212 drivers/scsi/virtio_scsi.c static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf) vscsi 223 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(sh); vscsi 225 drivers/scsi/virtio_scsi.c virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free); vscsi 230 drivers/scsi/virtio_scsi.c static int virtscsi_kick_event(struct virtio_scsi *vscsi, vscsi 240 drivers/scsi/virtio_scsi.c spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); vscsi 242 drivers/scsi/virtio_scsi.c err = virtqueue_add_inbuf(vscsi->event_vq.vq, &sg, 1, event_node, vscsi 245 drivers/scsi/virtio_scsi.c virtqueue_kick(vscsi->event_vq.vq); vscsi 247 drivers/scsi/virtio_scsi.c spin_unlock_irqrestore(&vscsi->event_vq.vq_lock, flags); vscsi 252 drivers/scsi/virtio_scsi.c static int virtscsi_kick_event_all(struct virtio_scsi *vscsi) vscsi 257 drivers/scsi/virtio_scsi.c vscsi->event_list[i].vscsi = vscsi; vscsi 258 drivers/scsi/virtio_scsi.c virtscsi_kick_event(vscsi, &vscsi->event_list[i]); vscsi 264 drivers/scsi/virtio_scsi.c static void virtscsi_cancel_event_work(struct virtio_scsi *vscsi) vscsi 269 drivers/scsi/virtio_scsi.c spin_lock_irq(&vscsi->event_vq.vq_lock); vscsi 270 drivers/scsi/virtio_scsi.c vscsi->stop_events = true; vscsi 271 drivers/scsi/virtio_scsi.c spin_unlock_irq(&vscsi->event_vq.vq_lock); vscsi 274 drivers/scsi/virtio_scsi.c cancel_work_sync(&vscsi->event_list[i].work); vscsi 277 drivers/scsi/virtio_scsi.c static void virtscsi_handle_transport_reset(struct virtio_scsi *vscsi, vscsi 281 drivers/scsi/virtio_scsi.c struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev); vscsi 285 drivers/scsi/virtio_scsi.c switch (virtio32_to_cpu(vscsi->vdev, event->reason)) { vscsi 304 drivers/scsi/virtio_scsi.c static void virtscsi_handle_param_change(struct virtio_scsi *vscsi, vscsi 308 drivers/scsi/virtio_scsi.c struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev); vscsi 311 drivers/scsi/virtio_scsi.c u8 asc = virtio32_to_cpu(vscsi->vdev, event->reason) & 255; vscsi 312 drivers/scsi/virtio_scsi.c u8 ascq = virtio32_to_cpu(vscsi->vdev, event->reason) >> 8; vscsi 329 drivers/scsi/virtio_scsi.c static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi) vscsi 332 drivers/scsi/virtio_scsi.c struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev); vscsi 363 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = event_node->vscsi; vscsi 367 drivers/scsi/virtio_scsi.c cpu_to_virtio32(vscsi->vdev, VIRTIO_SCSI_T_EVENTS_MISSED)) { vscsi 368 drivers/scsi/virtio_scsi.c event->event &= ~cpu_to_virtio32(vscsi->vdev, vscsi 370 drivers/scsi/virtio_scsi.c virtscsi_rescan_hotunplug(vscsi); vscsi 371 drivers/scsi/virtio_scsi.c scsi_scan_host(virtio_scsi_host(vscsi->vdev)); vscsi 374 drivers/scsi/virtio_scsi.c switch (virtio32_to_cpu(vscsi->vdev, event->event)) { vscsi 378 drivers/scsi/virtio_scsi.c virtscsi_handle_transport_reset(vscsi, event); vscsi 381 drivers/scsi/virtio_scsi.c virtscsi_handle_param_change(vscsi, event); vscsi 386 drivers/scsi/virtio_scsi.c virtscsi_kick_event(vscsi, event_node); vscsi 389 drivers/scsi/virtio_scsi.c static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) vscsi 393 drivers/scsi/virtio_scsi.c if (!vscsi->stop_events) vscsi 400 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(sh); vscsi 402 drivers/scsi/virtio_scsi.c virtscsi_vq_done(vscsi, &vscsi->event_vq, virtscsi_complete_event); vscsi 532 drivers/scsi/virtio_scsi.c static struct virtio_scsi_vq *virtscsi_pick_vq_mq(struct virtio_scsi *vscsi, vscsi 538 drivers/scsi/virtio_scsi.c return &vscsi->req_vqs[hwq]; vscsi 544 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(shost); vscsi 545 drivers/scsi/virtio_scsi.c struct virtio_scsi_vq *req_vq = virtscsi_pick_vq_mq(vscsi, sc); vscsi 565 drivers/scsi/virtio_scsi.c if (virtio_has_feature(vscsi->vdev, VIRTIO_SCSI_F_T10_PI)) { vscsi 566 drivers/scsi/virtio_scsi.c virtio_scsi_init_hdr_pi(vscsi->vdev, &cmd->req.cmd_pi, sc); vscsi 572 drivers/scsi/virtio_scsi.c virtio_scsi_init_hdr(vscsi->vdev, &cmd->req.cmd, sc); vscsi 582 drivers/scsi/virtio_scsi.c virtscsi_complete_cmd(vscsi, cmd); vscsi 590 drivers/scsi/virtio_scsi.c static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd) vscsi 596 drivers/scsi/virtio_scsi.c if (virtscsi_add_cmd(&vscsi->ctrl_vq, cmd, vscsi 615 drivers/scsi/virtio_scsi.c virtscsi_poll_requests(vscsi); vscsi 624 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(sc->device->host); vscsi 635 drivers/scsi/virtio_scsi.c .subtype = cpu_to_virtio32(vscsi->vdev, vscsi 642 drivers/scsi/virtio_scsi.c return virtscsi_tmf(vscsi, cmd); vscsi 682 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(sc->device->host); vscsi 698 drivers/scsi/virtio_scsi.c .tag = cpu_to_virtio64(vscsi->vdev, (unsigned long)sc), vscsi 700 drivers/scsi/virtio_scsi.c return virtscsi_tmf(vscsi, cmd); vscsi 705 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(shost); vscsi 708 drivers/scsi/virtio_scsi.c return blk_mq_virtio_map_queues(qmap, vscsi->vdev, 2); vscsi 713 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(shost); vscsi 715 drivers/scsi/virtio_scsi.c virtscsi_kick_vq(&vscsi->req_vqs[hwq]); vscsi 776 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi) vscsi 786 drivers/scsi/virtio_scsi.c num_vqs = vscsi->num_queues + VIRTIO_SCSI_VQ_BASE; vscsi 811 drivers/scsi/virtio_scsi.c virtscsi_init_vq(&vscsi->ctrl_vq, vqs[0]); vscsi 812 drivers/scsi/virtio_scsi.c virtscsi_init_vq(&vscsi->event_vq, vqs[1]); vscsi 814 drivers/scsi/virtio_scsi.c virtscsi_init_vq(&vscsi->req_vqs[i - VIRTIO_SCSI_VQ_BASE], vscsi 834 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi; vscsi 853 drivers/scsi/virtio_scsi.c struct_size(vscsi, req_vqs, num_queues)); vscsi 859 drivers/scsi/virtio_scsi.c vscsi = shost_priv(shost); vscsi 860 drivers/scsi/virtio_scsi.c vscsi->vdev = vdev; vscsi 861 drivers/scsi/virtio_scsi.c vscsi->num_queues = num_queues; vscsi 864 drivers/scsi/virtio_scsi.c err = virtscsi_init(vdev, vscsi); vscsi 868 drivers/scsi/virtio_scsi.c shost->can_queue = virtqueue_get_vring_size(vscsi->req_vqs[0].vq); vscsi 903 drivers/scsi/virtio_scsi.c virtscsi_kick_event_all(vscsi); vscsi 918 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(shost); vscsi 921 drivers/scsi/virtio_scsi.c virtscsi_cancel_event_work(vscsi); vscsi 938 drivers/scsi/virtio_scsi.c struct virtio_scsi *vscsi = shost_priv(sh); vscsi 941 drivers/scsi/virtio_scsi.c err = virtscsi_init(vdev, vscsi); vscsi 948 drivers/scsi/virtio_scsi.c virtscsi_kick_event_all(vscsi);