Lines Matching defs:ctl_softc

82 struct ctl_softc *control_softc = NULL;
364 static int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun,
369 static void ctl_failover_change_pages(struct ctl_softc *softc,
374 static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun,
395 static int ctl_scsiio_lun_check(struct ctl_softc *ctl_softc,
399 //static int ctl_check_rtr(union ctl_io *pending_io, struct ctl_softc *softc);
401 static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc,
405 static int ctl_bus_reset(struct ctl_softc *ctl_softc, union ctl_io *io);
406 static int ctl_target_reset(struct ctl_softc *ctl_softc, union ctl_io *io,
411 static void ctl_run_task_queue(struct ctl_softc *ctl_softc);
464 ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc,
487 STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, &ctsio->io_hdr, links);
492 ctl_isc_handler_finish_ser_only(struct ctl_softc *ctl_softc,
534 STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, &ctsio->io_hdr, links);
545 struct ctl_softc *ctl_softc;
550 ctl_softc = control_softc;
570 mtx_lock(&ctl_softc->ctl_lock);
577 io = ctl_alloc_io((void *)ctl_softc->othersc_pool);
583 mtx_unlock(&ctl_softc->ctl_lock);
610 if (ctl_softc->ha_mode == CTL_HA_MODE_SER_ONLY)
624 if (ctl_softc->ha_mode == CTL_HA_MODE_XFER) {
634 STAILQ_INSERT_TAIL(&ctl_softc->isc_queue,
741 STAILQ_INSERT_TAIL(&ctl_softc->isc_queue,
771 STAILQ_INSERT_TAIL(&ctl_softc->isc_queue,
782 mtx_unlock(&ctl_softc->ctl_lock);
791 STAILQ_INSERT_TAIL(&ctl_softc->isc_queue,
803 if (ctl_softc->ha_mode == CTL_HA_MODE_XFER)
804 ctl_isc_handler_finish_xfer(ctl_softc,
807 ctl_isc_handler_finish_ser_only(ctl_softc,
830 STAILQ_INSERT_TAIL(&ctl_softc->isc_queue,
839 (void *)ctl_softc->othersc_pool);
846 mtx_unlock(&ctl_softc->ctl_lock);
863 STAILQ_INSERT_TAIL(&ctl_softc->task_queue,
865 ctl_softc->flags |= CTL_FLAG_TASK_PENDING;
872 (void *)ctl_softc->othersc_pool);
878 mtx_unlock(&ctl_softc->ctl_lock);
884 STAILQ_INSERT_TAIL(&ctl_softc->isc_queue,
903 lun = ctl_softc->ctl_luns[targ_lun];
915 mtx_unlock(&ctl_softc->ctl_lock);
949 struct ctl_softc *softc;
1155 struct ctl_softc *softc;
1159 softc = (struct ctl_softc *)control_softc;
1240 struct ctl_softc *softc;
1286 struct ctl_softc *softc;
1310 struct ctl_softc *softc;
1390 struct ctl_softc *softc;
1423 struct ctl_softc *softc;
1684 struct ctl_softc *ctl_softc;
1690 ctl_softc = control_softc;
1692 mtx_lock(&ctl_softc->ctl_lock);
1697 lun = ctl_softc->ctl_luns[targ_lun];
1726 mtx_unlock(&ctl_softc->ctl_lock);
1743 if (ctl_softc->ha_mode == CTL_HA_MODE_XFER) {
1745 STAILQ_INSERT_TAIL(&ctl_softc->rtr_queue,
1842 mtx_unlock(&ctl_softc->ctl_lock);
2173 struct ctl_softc *softc;
3346 * ctl_softc, pool_type, total_ctl_io are passed in.
3350 ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type,
3368 pool->ctl_softc = ctl_softc;
3370 mtx_lock(&ctl_softc->ctl_lock);
3371 pool->id = ctl_softc->cur_pool_id++;
3372 mtx_unlock(&ctl_softc->ctl_lock);
3410 mtx_lock(&ctl_softc->ctl_lock);
3411 ctl_softc->num_pools++;
3412 STAILQ_INSERT_TAIL(&ctl_softc->io_pools, pool, links);
3429 mtx_unlock(&ctl_softc->ctl_lock);
3480 ctl_pool_free(pool->ctl_softc, pool);
3487 ctl_pool_free(struct ctl_softc *ctl_softc, struct ctl_io_pool *pool)
3491 mtx_assert(&ctl_softc->ctl_lock, MA_OWNED);
3502 STAILQ_REMOVE(&ctl_softc->io_pools, pool, ctl_io_pool, links);
3503 ctl_softc->num_pools--;
3527 struct ctl_softc *ctl_softc;
3540 ctl_softc = pool->ctl_softc;
3542 mtx_lock(&ctl_softc->ctl_lock);
3552 mtx_unlock(&ctl_softc->ctl_lock);
3561 STAILQ_FOREACH(npool, &ctl_softc->io_pools, links) {
3575 mtx_unlock(&ctl_softc->ctl_lock);
3582 mtx_unlock(&ctl_softc->ctl_lock);
3595 mtx_lock(&ctl_softc->ctl_lock);
3607 mtx_unlock(&ctl_softc->ctl_lock);
3627 struct ctl_softc *ctl_softc;
3632 ctl_softc = control_softc;
3638 mtx_lock(&pool->ctl_softc->ctl_lock);
3643 &ctl_softc->task_queue); tmp_io != NULL; i++,
3676 mtx_unlock(&pool->ctl_softc->ctl_lock);
3756 struct ctl_softc *softc;
3910 struct ctl_softc *softc;
3915 softc = lun->ctl_softc;
4240 * - ctl_softc is always set
4246 ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun,
4283 mtx_lock(&ctl_softc->ctl_lock);
4290 || (ctl_is_set(ctl_softc->ctl_lun_mask, be_lun->req_lun_id))) {
4291 mtx_unlock(&ctl_softc->ctl_lock);
4312 lun_number = ctl_ffz(ctl_softc->ctl_lun_mask, CTL_MAX_LUNS);
4314 mtx_unlock(&ctl_softc->ctl_lock);
4324 ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number);
4347 lun->ctl_softc = ctl_softc;
4367 STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) {
4373 STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links);
4375 ctl_softc->ctl_luns[lun_number] = lun;
4377 ctl_softc->num_luns++;
4389 mtx_unlock(&ctl_softc->ctl_lock);
4398 STAILQ_FOREACH(fe, &ctl_softc->fe_list, links) {
4440 struct ctl_softc *softc;
4448 softc = lun->ctl_softc;
4577 struct ctl_softc *ctl_softc;
4579 ctl_softc = control_softc;
4584 ctl_alloc_lun(ctl_softc, NULL, be_lun, ctl_softc->target);
4590 struct ctl_softc *ctl_softc;
4592 ctl_softc = control_softc;
4594 mtx_lock(&ctl_softc->ctl_lock);
4595 STAILQ_INSERT_TAIL(&ctl_softc->pending_lun_queue, be_lun, links);
4596 mtx_unlock(&ctl_softc->ctl_lock);
4606 struct ctl_softc *ctl_softc;
4611 ctl_softc = control_softc;
4615 mtx_lock(&ctl_softc->ctl_lock);
4621 mtx_unlock(&ctl_softc->ctl_lock);
4626 for (fe = STAILQ_FIRST(&ctl_softc->fe_list); fe != NULL; fe = nfe) {
4634 mtx_unlock(&ctl_softc->ctl_lock);
4636 mtx_lock(&ctl_softc->ctl_lock);
4651 mtx_unlock(&ctl_softc->ctl_lock);
4659 struct ctl_softc *ctl_softc;
4664 ctl_softc = control_softc;
4668 mtx_lock(&ctl_softc->ctl_lock);
4671 mtx_unlock(&ctl_softc->ctl_lock);
4676 STAILQ_FOREACH(fe, &ctl_softc->fe_list, links) {
4677 mtx_unlock(&ctl_softc->ctl_lock);
4687 mtx_lock(&ctl_softc->ctl_lock);
4696 mtx_unlock(&ctl_softc->ctl_lock);
4704 struct ctl_softc *ctl_softc;
4707 ctl_softc = control_softc;
4711 mtx_lock(&ctl_softc->ctl_lock);
4713 mtx_unlock(&ctl_softc->ctl_lock);
4721 struct ctl_softc *ctl_softc;
4724 ctl_softc = control_softc;
4728 mtx_lock(&ctl_softc->ctl_lock);
4730 mtx_unlock(&ctl_softc->ctl_lock);
4738 struct ctl_softc *ctl_softc;
4741 ctl_softc = control_softc;
4745 mtx_lock(&ctl_softc->ctl_lock);
4747 mtx_unlock(&ctl_softc->ctl_lock);
4755 struct ctl_softc *ctl_softc;
4758 ctl_softc = control_softc;
4762 mtx_lock(&ctl_softc->ctl_lock);
4764 mtx_unlock(&ctl_softc->ctl_lock);
4772 struct ctl_softc *ctl_softc;
4775 ctl_softc = control_softc;
4779 mtx_lock(&ctl_softc->ctl_lock);
4785 mtx_unlock(&ctl_softc->ctl_lock);
4800 mtx_unlock(&ctl_softc->ctl_lock);
4808 struct ctl_softc *ctl_softc;
4811 ctl_softc = control_softc;
4814 mtx_lock(&ctl_softc->ctl_lock);
4816 mtx_unlock(&ctl_softc->ctl_lock);
4824 struct ctl_softc *ctl_softc;
4827 ctl_softc = control_softc;
4830 mtx_lock(&ctl_softc->ctl_lock);
4832 mtx_unlock(&ctl_softc->ctl_lock);
4841 struct ctl_softc *softc;
4925 struct ctl_softc *softc;
5056 struct ctl_softc *ctl_softc;
5065 ctl_softc = control_softc;
5151 mtx_lock(&ctl_softc->ctl_lock);
5177 mtx_unlock(&ctl_softc->ctl_lock);
5189 struct ctl_softc *ctl_softc;
5202 ctl_softc = control_softc;
5286 mtx_lock(&ctl_softc->ctl_lock);
5310 mtx_unlock(&ctl_softc->ctl_lock);
5321 struct ctl_softc *ctl_softc;
5327 ctl_softc = control_softc;
5420 mtx_lock(&ctl_softc->ctl_lock);
5428 mtx_unlock(&ctl_softc->ctl_lock);
5432 mtx_unlock(&ctl_softc->ctl_lock);
5483 struct ctl_softc *ctl_softc;
5492 ctl_softc = control_softc;
5593 mtx_lock(&ctl_softc->ctl_lock);
5594 if ((ctl_softc->flags & CTL_FLAG_REAL_SYNC)
5597 mtx_unlock(&ctl_softc->ctl_lock);
5600 mtx_unlock(&ctl_softc->ctl_lock);
5615 struct ctl_softc *ctl_softc;
5621 ctl_softc = control_softc;
5693 mtx_lock(&ctl_softc->ctl_lock);
5695 mtx_unlock(&ctl_softc->ctl_lock);
5716 struct ctl_softc *ctl_softc;
5727 ctl_softc = control_softc;
5818 struct ctl_softc *softc;
5983 struct ctl_softc *softc;
6966 struct ctl_softc *softc;
7114 struct ctl_softc *softc;
7338 ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key,
7815 struct ctl_softc *softc;
8286 struct ctl_softc *softc;
8865 mtx_lock(&lun->ctl_softc->ctl_lock);
8914 mtx_unlock(&lun->ctl_softc->ctl_lock);
9126 struct ctl_softc *ctl_softc;
9134 ctl_softc = control_softc;
9136 mtx_lock(&ctl_softc->ctl_lock);
9137 fe = ctl_softc->ctl_ports[ctl_port_idx(ctsio->io_hdr.nexus.targ_port)];
9138 mtx_unlock(&ctl_softc->ctl_lock);
9194 mtx_lock(&ctl_softc->ctl_lock);
9214 mtx_unlock(&ctl_softc->ctl_lock);
9346 struct ctl_softc *ctl_softc;
9351 ctl_softc = control_softc;
9358 mtx_lock(&ctl_softc->ctl_lock);
9359 if (ctl_softc->ctl_ports[ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]->port_type !=
9364 mtx_unlock(&ctl_softc->ctl_lock);
9437 else if (ctl_softc->inquiry_pq_no_lun == 0)
9943 struct ctl_softc *softc;
10001 STAILQ_INSERT_TAIL(&lun->ctl_softc->rtr_queue,
10050 ctl_scsiio_lun_check(struct ctl_softc *ctl_softc, struct ctl_lun *lun,
10063 if (((ctl_softc->flags & CTL_FLAG_MASTER_SHELF) == 0)
10155 struct ctl_softc *ctl_softc;
10161 ctl_softc = control_softc;
10163 mtx_lock(&ctl_softc->ctl_lock);
10172 for (io = (union ctl_io *)STAILQ_FIRST(&ctl_softc->rtr_queue);
10176 STAILQ_REMOVE(&ctl_softc->rtr_queue, &io->io_hdr,
10180 for (lun_idx=0; lun_idx < ctl_softc->num_luns; lun_idx++) {
10181 lun = ctl_softc->ctl_luns[lun_idx];
10193 && (ctl_softc->ha_mode == CTL_HA_MODE_SER_ONLY)) {
10235 && (ctl_softc->ha_mode == CTL_HA_MODE_XFER)) {
10253 && (ctl_softc->ha_mode == CTL_HA_MODE_XFER)) {
10299 && (ctl_softc->ha_mode == CTL_HA_MODE_SER_ONLY)) {
10319 STAILQ_INSERT_TAIL(&ctl_softc->rtr_queue,
10364 &ctl_softc->rtr_queue,
10401 "ha_mode = #%x", lun->flags, ctl_softc->ha_mode);
10405 mtx_unlock(&ctl_softc->ctl_lock);
10409 ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio)
10423 mtx_lock(&ctl_softc->ctl_lock);
10429 && (ctl_softc->ctl_luns[targ_lun] != NULL)) {
10430 lun = ctl_softc->ctl_luns[targ_lun];
10468 mtx_unlock(&ctl_softc->ctl_lock);
10489 mtx_unlock(&ctl_softc->ctl_lock);
10499 mtx_unlock(&ctl_softc->ctl_lock);
10570 mtx_unlock(&ctl_softc->ctl_lock);
10578 if (ctl_scsiio_lun_check(ctl_softc, lun, entry, ctsio) != 0) {
10579 mtx_unlock(&ctl_softc->ctl_lock);
10649 mtx_unlock(&ctl_softc->ctl_lock);
10655 mtx_unlock(&ctl_softc->ctl_lock);
10664 mtx_unlock(&ctl_softc->ctl_lock);
10674 STAILQ_INSERT_TAIL(&ctl_softc->rtr_queue, &ctsio->io_hdr, links);
10677 mtx_unlock(&ctl_softc->ctl_lock);
10719 ctl_bus_reset(struct ctl_softc *ctl_softc, union ctl_io *io)
10721 return(ctl_target_reset(ctl_softc, io, CTL_UA_BUS_RESET));
10725 ctl_target_reset(struct ctl_softc *ctl_softc, union ctl_io *io,
10749 STAILQ_FOREACH(lun, &ctl_softc->lun_list, links)
10831 struct ctl_softc *ctl_softc;
10839 ctl_softc = control_softc;
10849 && (ctl_softc->ctl_luns[targ_lun] != NULL))
10850 lun = ctl_softc->ctl_luns[targ_lun];
10978 ctl_run_task_queue(struct ctl_softc *ctl_softc)
10982 mtx_assert(&ctl_softc->ctl_lock, MA_OWNED);
10986 for (io = (union ctl_io *)STAILQ_FIRST(&ctl_softc->task_queue);
11044 && (ctl_softc->ctl_luns[targ_lun] != NULL))
11045 lun = ctl_softc->ctl_luns[targ_lun];
11076 retval = ctl_target_reset(ctl_softc, io,
11080 retval = ctl_bus_reset(ctl_softc, io);
11097 STAILQ_REMOVE(&ctl_softc->task_queue, &io->io_hdr,
11119 STAILQ_REMOVE(&ctl_softc->task_queue, &io->io_hdr,
11127 ctl_softc->flags &= ~CTL_FLAG_TASK_PENDING;
11139 struct ctl_softc *ctl_softc;
11142 ctl_softc = control_softc;
11147 lun = ctl_softc->ctl_luns[targ_lun];
11164 mtx_lock(&ctl_softc->ctl_lock);
11165 if (ctl_scsiio_lun_check(ctl_softc, lun,
11168 mtx_unlock(&ctl_softc->ctl_lock);
11172 STAILQ_INSERT_TAIL(&ctl_softc->rtr_queue,
11174 mtx_unlock(&ctl_softc->ctl_lock);
11178 if (ctl_softc->ha_mode == CTL_HA_MODE_XFER) {
11183 mtx_lock(&ctl_softc->ctl_lock);
11186 STAILQ_REMOVE(&ctl_softc->task_queue,
11189 mtx_unlock(&ctl_softc->ctl_lock);
11862 struct ctl_softc *softc;
12223 struct ctl_softc *softc;
12315 struct ctl_softc *ctl_softc;
12386 ctl_softc = lun->ctl_softc;
12392 mtx_lock(&ctl_softc->ctl_lock);
12593 if ((time_uptime - ctl_softc->last_print_jiffies) <= 0){
12594 ctl_softc->skipped_prints++;
12596 mtx_unlock(&ctl_softc->ctl_lock);
12600 skipped_prints = ctl_softc->skipped_prints;
12602 ctl_softc->skipped_prints = 0;
12603 ctl_softc->last_print_jiffies = time_uptime;
12606 mtx_unlock(&ctl_softc->ctl_lock);
12624 mtx_unlock(&ctl_softc->ctl_lock);
12630 mtx_unlock(&ctl_softc->ctl_lock);
12635 mtx_unlock(&ctl_softc->ctl_lock);
12653 if ((ctl_softc->ha_mode == CTL_HA_MODE_XFER)
12702 struct ctl_softc *ctl_softc;
12705 ctl_softc = control_softc;
12716 mtx_lock(&ctl_softc->ctl_lock);
12726 && (ctl_softc->ctl_luns[targ_lun] != NULL))
12727 lun = ctl_softc->ctl_luns[targ_lun];
12745 mtx_unlock(&ctl_softc->ctl_lock);
12759 struct ctl_softc *ctl_softc;
12763 ctl_softc = control_softc;
12770 mtx_lock(&ctl_softc->ctl_lock);
12774 STAILQ_INSERT_TAIL(&ctl_softc->incoming_queue, &io->io_hdr,
12778 STAILQ_INSERT_TAIL(&ctl_softc->task_queue, &io->io_hdr, links);
12795 ctl_softc->flags |= CTL_FLAG_TASK_PENDING;
12798 mtx_unlock(&ctl_softc->ctl_lock);
12803 mtx_unlock(&ctl_softc->ctl_lock);
12824 struct ctl_softc *ctl_softc;
12829 ctl_softc = control_softc;
12832 mtx_lock(&ctl_softc->ctl_lock);
12866 mtx_unlock(&ctl_softc->ctl_lock);
12914 mtx_unlock(&ctl_softc->ctl_lock);
12920 STAILQ_INSERT_TAIL(&ctl_softc->done_queue, &io->io_hdr, links);
12924 mtx_unlock(&ctl_softc->ctl_lock);
12928 for (xio = (union ctl_io *)STAILQ_FIRST(&ctl_softc->done_queue);
12930 xio =(union ctl_io *)STAILQ_FIRST(&ctl_softc->done_queue)) {
12932 STAILQ_REMOVE_HEAD(&ctl_softc->done_queue, links);
12937 mtx_unlock(&ctl_softc->ctl_lock);
12968 struct ctl_softc *softc;
12975 softc = (struct ctl_softc *)arg;
13076 struct ctl_softc *softc;