/linux-4.4.14/drivers/scsi/snic/ |
H A D | Makefile | 1 obj-$(CONFIG_SCSI_SNIC) += snic.o 3 snic-y := \ 17 snic-$(CONFIG_SCSI_SNIC_DEBUG_FS) += snic_debugfs.o snic_trc.o
|
H A D | snic_isr.c | 27 #include "snic.h" 37 struct snic *snic = data; snic_isr_msix_wq() local 40 snic->s_stats.misc.last_isr_time = jiffies; snic_isr_msix_wq() 41 atomic64_inc(&snic->s_stats.misc.isr_cnt); snic_isr_msix_wq() 43 wq_work_done = snic_wq_cmpl_handler(snic, -1); snic_isr_msix_wq() 44 svnic_intr_return_credits(&snic->intr[SNIC_MSIX_WQ], snic_isr_msix_wq() 55 struct snic *snic = data; snic_isr_msix_io_cmpl() local 58 snic->s_stats.misc.last_isr_time = jiffies; snic_isr_msix_io_cmpl() 59 atomic64_inc(&snic->s_stats.misc.isr_cnt); snic_isr_msix_io_cmpl() 61 iocmpl_work_done = snic_fwcq_cmpl_handler(snic, -1); snic_isr_msix_io_cmpl() 62 svnic_intr_return_credits(&snic->intr[SNIC_MSIX_IO_CMPL], snic_isr_msix_io_cmpl() 73 struct snic *snic = data; snic_isr_msix_err_notify() local 75 snic->s_stats.misc.last_isr_time = jiffies; snic_isr_msix_err_notify() 76 atomic64_inc(&snic->s_stats.misc.isr_cnt); snic_isr_msix_err_notify() 78 svnic_intr_return_all_credits(&snic->intr[SNIC_MSIX_ERR_NOTIFY]); snic_isr_msix_err_notify() 79 snic_log_q_error(snic); snic_isr_msix_err_notify() 82 snic_handle_link_event(snic); snic_isr_msix_err_notify() 89 snic_free_intr(struct snic *snic) snic_free_intr() argument 94 for (i = 0; i < ARRAY_SIZE(snic->msix); i++) { snic_free_intr() 95 if (snic->msix[i].requested) { snic_free_intr() 96 free_irq(snic->msix_entry[i].vector, snic_free_intr() 97 snic->msix[i].devid); snic_free_intr() 103 snic_request_intr(struct snic *snic) snic_request_intr() argument 108 intr_mode = svnic_dev_get_intr_mode(snic->vdev); snic_request_intr() 112 * Currently HW supports single WQ and CQ. So passing devid as snic. snic_request_intr() 114 * to pass devid as corresponding WQ or CQ ptr and retrieve snic snic_request_intr() 118 sprintf(snic->msix[SNIC_MSIX_WQ].devname, snic_request_intr() 120 snic->name); snic_request_intr() 121 snic->msix[SNIC_MSIX_WQ].isr = snic_isr_msix_wq; snic_request_intr() 122 snic->msix[SNIC_MSIX_WQ].devid = snic; snic_request_intr() 124 sprintf(snic->msix[SNIC_MSIX_IO_CMPL].devname, snic_request_intr() 126 snic->name); snic_request_intr() 127 snic->msix[SNIC_MSIX_IO_CMPL].isr = snic_isr_msix_io_cmpl; snic_request_intr() 128 snic->msix[SNIC_MSIX_IO_CMPL].devid = snic; snic_request_intr() 130 sprintf(snic->msix[SNIC_MSIX_ERR_NOTIFY].devname, snic_request_intr() 132 snic->name); snic_request_intr() 133 snic->msix[SNIC_MSIX_ERR_NOTIFY].isr = snic_isr_msix_err_notify; snic_request_intr() 134 snic->msix[SNIC_MSIX_ERR_NOTIFY].devid = snic; snic_request_intr() 136 for (i = 0; i < ARRAY_SIZE(snic->msix); i++) { snic_request_intr() 137 ret = request_irq(snic->msix_entry[i].vector, snic_request_intr() 138 snic->msix[i].isr, snic_request_intr() 140 snic->msix[i].devname, snic_request_intr() 141 snic->msix[i].devid); snic_request_intr() 143 SNIC_HOST_ERR(snic->shost, snic_request_intr() 147 snic_free_intr(snic); snic_request_intr() 150 snic->msix[i].requested = 1; snic_request_intr() 157 snic_set_intr_mode(struct snic *snic) snic_set_intr_mode() argument 159 unsigned int n = ARRAY_SIZE(snic->wq); snic_set_intr_mode() 168 BUILD_BUG_ON((ARRAY_SIZE(snic->wq) + SNIC_CQ_IO_CMPL_MAX) > snic_set_intr_mode() 169 ARRAY_SIZE(snic->intr)); snic_set_intr_mode() 170 SNIC_BUG_ON(ARRAY_SIZE(snic->msix_entry) < (n + m + 1)); snic_set_intr_mode() 173 snic->msix_entry[i].entry = i; snic_set_intr_mode() 175 if (snic->wq_count >= n && snic->cq_count >= (n + m)) { snic_set_intr_mode() 176 if (!pci_enable_msix(snic->pdev, snic_set_intr_mode() 177 snic->msix_entry, snic_set_intr_mode() 179 snic->wq_count = n; snic_set_intr_mode() 180 snic->cq_count = n + m; snic_set_intr_mode() 181 snic->intr_count = n + m + 1; snic_set_intr_mode() 182 snic->err_intr_offset = SNIC_MSIX_ERR_NOTIFY; snic_set_intr_mode() 184 SNIC_ISR_DBG(snic->shost, snic_set_intr_mode() 186 svnic_dev_set_intr_mode(snic->vdev, snic_set_intr_mode() 193 svnic_dev_set_intr_mode(snic->vdev, VNIC_DEV_INTR_MODE_UNKNOWN); snic_set_intr_mode() 199 snic_clear_intr_mode(struct snic *snic) snic_clear_intr_mode() argument 201 pci_disable_msix(snic->pdev); snic_clear_intr_mode() 203 svnic_dev_set_intr_mode(snic->vdev, VNIC_DEV_INTR_MODE_INTX); snic_clear_intr_mode()
|
H A D | snic_res.c | 30 #include "snic.h" 33 snic_get_vnic_config(struct snic *snic) snic_get_vnic_config() argument 35 struct vnic_snic_config *c = &snic->config; snic_get_vnic_config() 40 ret = svnic_dev_spec(snic->vdev, \ snic_get_vnic_config() 45 SNIC_HOST_ERR(snic->shost, \ snic_get_vnic_config() 120 snic_get_res_counts(struct snic *snic) snic_get_res_counts() argument 122 snic->wq_count = svnic_dev_get_res_count(snic->vdev, RES_TYPE_WQ); snic_get_res_counts() 123 SNIC_BUG_ON(snic->wq_count == 0); snic_get_res_counts() 124 snic->cq_count = svnic_dev_get_res_count(snic->vdev, RES_TYPE_CQ); snic_get_res_counts() 125 SNIC_BUG_ON(snic->cq_count == 0); snic_get_res_counts() 126 snic->intr_count = svnic_dev_get_res_count(snic->vdev, snic_get_res_counts() 128 SNIC_BUG_ON(snic->intr_count == 0); snic_get_res_counts() 132 snic_free_vnic_res(struct snic *snic) snic_free_vnic_res() argument 136 for (i = 0; i < snic->wq_count; i++) snic_free_vnic_res() 137 svnic_wq_free(&snic->wq[i]); snic_free_vnic_res() 139 for (i = 0; i < snic->cq_count; i++) snic_free_vnic_res() 140 svnic_cq_free(&snic->cq[i]); snic_free_vnic_res() 142 for (i = 0; i < snic->intr_count; i++) snic_free_vnic_res() 143 svnic_intr_free(&snic->intr[i]); snic_free_vnic_res() 147 snic_alloc_vnic_res(struct snic *snic) snic_alloc_vnic_res() argument 157 intr_mode = svnic_dev_get_intr_mode(snic->vdev); snic_alloc_vnic_res() 170 SNIC_INFO("wq %d cq %d intr %d\n", snic->wq_count, snic_alloc_vnic_res() 171 snic->cq_count, snic_alloc_vnic_res() 172 snic->intr_count); snic_alloc_vnic_res() 176 for (i = 0; i < snic->wq_count; i++) { snic_alloc_vnic_res() 177 ret = svnic_wq_alloc(snic->vdev, snic_alloc_vnic_res() 178 &snic->wq[i], snic_alloc_vnic_res() 180 snic->config.wq_enet_desc_count, snic_alloc_vnic_res() 187 for (i = 0; i < snic->wq_count; i++) { snic_alloc_vnic_res() 188 ret = svnic_cq_alloc(snic->vdev, snic_alloc_vnic_res() 189 &snic->cq[i], snic_alloc_vnic_res() 191 snic->config.wq_enet_desc_count, snic_alloc_vnic_res() 197 SNIC_BUG_ON(snic->cq_count != 2 * snic->wq_count); snic_alloc_vnic_res() 199 for (i = snic->wq_count; i < snic->cq_count; i++) { snic_alloc_vnic_res() 200 ret = svnic_cq_alloc(snic->vdev, snic_alloc_vnic_res() 201 &snic->cq[i], snic_alloc_vnic_res() 203 (snic->config.wq_enet_desc_count * 3), snic_alloc_vnic_res() 209 for (i = 0; i < snic->intr_count; i++) { snic_alloc_vnic_res() 210 ret = svnic_intr_alloc(snic->vdev, &snic->intr[i], i); snic_alloc_vnic_res() 221 err_intr_offset = snic->err_intr_offset; snic_alloc_vnic_res() 223 for (i = 0; i < snic->wq_count; i++) { snic_alloc_vnic_res() 224 svnic_wq_init(&snic->wq[i], snic_alloc_vnic_res() 230 for (i = 0; i < snic->cq_count; i++) { snic_alloc_vnic_res() 233 svnic_cq_init(&snic->cq[i], snic_alloc_vnic_res() 248 * Assumption : snic is always in MSI-X mode snic_alloc_vnic_res() 253 for (i = 0; i < snic->intr_count; i++) { snic_alloc_vnic_res() 254 svnic_intr_init(&snic->intr[i], snic_alloc_vnic_res() 255 snic->config.intr_timer, snic_alloc_vnic_res() 256 snic->config.intr_timer_type, snic_alloc_vnic_res() 261 ret = svnic_dev_stats_dump(snic->vdev, &snic->stats); snic_alloc_vnic_res() 263 SNIC_HOST_ERR(snic->shost, snic_alloc_vnic_res() 270 svnic_dev_stats_clear(snic->vdev); snic_alloc_vnic_res() 276 snic_free_vnic_res(snic); snic_alloc_vnic_res() 282 snic_log_q_error(struct snic *snic) snic_log_q_error() argument 287 for (i = 0; i < snic->wq_count; i++) { snic_log_q_error() 288 err_status = ioread32(&snic->wq[i].ctrl->error_status); snic_log_q_error() 290 SNIC_HOST_ERR(snic->shost, snic_log_q_error()
|
H A D | snic_ctl.c | 30 #include "snic.h" 40 struct snic *snic = container_of(work, struct snic, link_work); snic_handle_link() local 42 if (snic->config.xpt_type != SNIC_DAS) { snic_handle_link() 43 SNIC_HOST_INFO(snic->shost, "Link Event Received.\n"); snic_handle_link() 49 snic->link_status = svnic_dev_link_status(snic->vdev); snic_handle_link() 50 snic->link_down_cnt = svnic_dev_link_down_cnt(snic->vdev); snic_handle_link() 51 SNIC_HOST_INFO(snic->shost, "Link Event: Link %s.\n", snic_handle_link() 52 ((snic->link_status) ? "Up" : "Down")); snic_handle_link() 108 snic_queue_exch_ver_req(struct snic *snic) snic_queue_exch_ver_req() argument 115 SNIC_HOST_INFO(snic->shost, "Exch Ver Req Preparing...\n"); snic_queue_exch_ver_req() 117 rqi = snic_req_init(snic, 0); snic_queue_exch_ver_req() 119 SNIC_HOST_ERR(snic->shost, snic_queue_exch_ver_req() 131 snic->config.hid, 0, (ulong)rqi); snic_queue_exch_ver_req() 136 snic_handle_untagged_req(snic, rqi); snic_queue_exch_ver_req() 138 ret = snic_queue_wq_desc(snic, req, sizeof(*req)); snic_queue_exch_ver_req() 140 snic_release_untagged_req(snic, rqi); snic_queue_exch_ver_req() 141 SNIC_HOST_ERR(snic->shost, snic_queue_exch_ver_req() 147 SNIC_HOST_INFO(snic->shost, "Exch Ver Req is issued. ret = %d\n", ret); snic_queue_exch_ver_req() 157 snic_io_exch_ver_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) snic_io_exch_ver_cmpl_handler() argument 167 SNIC_HOST_INFO(snic->shost, "Exch Ver Compl Received.\n"); snic_io_exch_ver_cmpl_handler() 169 SNIC_BUG_ON(snic->config.hid != hid); snic_io_exch_ver_cmpl_handler() 173 SNIC_HOST_ERR(snic->shost, snic_io_exch_ver_cmpl_handler() 180 spin_lock_irqsave(&snic->snic_lock, flags); snic_io_exch_ver_cmpl_handler() 181 snic->fwinfo.fw_ver = le32_to_cpu(exv_cmpl->version); snic_io_exch_ver_cmpl_handler() 182 snic->fwinfo.hid = le32_to_cpu(exv_cmpl->hid); snic_io_exch_ver_cmpl_handler() 183 snic->fwinfo.max_concur_ios = le32_to_cpu(exv_cmpl->max_concur_ios); snic_io_exch_ver_cmpl_handler() 184 snic->fwinfo.max_sgs_per_cmd = le32_to_cpu(exv_cmpl->max_sgs_per_cmd); snic_io_exch_ver_cmpl_handler() 185 snic->fwinfo.max_io_sz = le32_to_cpu(exv_cmpl->max_io_sz); snic_io_exch_ver_cmpl_handler() 186 snic->fwinfo.max_tgts = le32_to_cpu(exv_cmpl->max_tgts); snic_io_exch_ver_cmpl_handler() 187 snic->fwinfo.io_tmo = le16_to_cpu(exv_cmpl->io_timeout); snic_io_exch_ver_cmpl_handler() 189 SNIC_HOST_INFO(snic->shost, snic_io_exch_ver_cmpl_handler() 191 snic->fwinfo.fw_ver, snic_io_exch_ver_cmpl_handler() 192 snic->fwinfo.hid, snic_io_exch_ver_cmpl_handler() 193 snic->fwinfo.max_concur_ios, snic_io_exch_ver_cmpl_handler() 194 snic->fwinfo.max_sgs_per_cmd, snic_io_exch_ver_cmpl_handler() 195 snic->fwinfo.max_io_sz, snic_io_exch_ver_cmpl_handler() 196 snic->fwinfo.max_tgts, snic_io_exch_ver_cmpl_handler() 197 snic->fwinfo.io_tmo); snic_io_exch_ver_cmpl_handler() 199 SNIC_HOST_INFO(snic->shost, snic_io_exch_ver_cmpl_handler() 204 max_sgs = snic->fwinfo.max_sgs_per_cmd; snic_io_exch_ver_cmpl_handler() 206 snic->shost->sg_tablesize = max_sgs; snic_io_exch_ver_cmpl_handler() 207 SNIC_HOST_INFO(snic->shost, "Max SGs set to %d\n", snic_io_exch_ver_cmpl_handler() 208 snic->shost->sg_tablesize); snic_io_exch_ver_cmpl_handler() 209 } else if (max_sgs > snic->shost->sg_tablesize) { snic_io_exch_ver_cmpl_handler() 210 SNIC_HOST_INFO(snic->shost, snic_io_exch_ver_cmpl_handler() 212 snic->config.xpt_type, max_sgs, snic_io_exch_ver_cmpl_handler() 213 snic->shost->sg_tablesize); snic_io_exch_ver_cmpl_handler() 216 if (snic->shost->can_queue > snic->fwinfo.max_concur_ios) snic_io_exch_ver_cmpl_handler() 217 snic->shost->can_queue = snic->fwinfo.max_concur_ios; snic_io_exch_ver_cmpl_handler() 219 snic->shost->max_sectors = snic->fwinfo.max_io_sz >> 9; snic_io_exch_ver_cmpl_handler() 220 if (snic->fwinfo.wait) snic_io_exch_ver_cmpl_handler() 221 complete(snic->fwinfo.wait); snic_io_exch_ver_cmpl_handler() 223 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_io_exch_ver_cmpl_handler() 226 snic_release_untagged_req(snic, rqi); snic_io_exch_ver_cmpl_handler() 228 SNIC_HOST_INFO(snic->shost, "Exch_cmpl Done, hdr_stat %d.\n", hdr_stat); snic_io_exch_ver_cmpl_handler() 236 * Synchronous call, and Retrieves snic params. 239 snic_get_conf(struct snic *snic) snic_get_conf() argument 246 SNIC_HOST_INFO(snic->shost, "Retrieving snic params.\n"); snic_get_conf() 247 spin_lock_irqsave(&snic->snic_lock, flags); snic_get_conf() 248 memset(&snic->fwinfo, 0, sizeof(snic->fwinfo)); snic_get_conf() 249 snic->fwinfo.wait = &wait; snic_get_conf() 250 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_get_conf() 260 ret = snic_queue_exch_ver_req(snic); snic_get_conf() 265 spin_lock_irqsave(&snic->snic_lock, flags); snic_get_conf() 266 ret = (snic->fwinfo.fw_ver != 0) ? 0 : -ETIMEDOUT; snic_get_conf() 268 SNIC_HOST_ERR(snic->shost, snic_get_conf() 269 "Failed to retrieve snic params,\n"); snic_get_conf() 273 snic->fwinfo.wait = NULL; snic_get_conf() 275 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_get_conf()
|
H A D | snic_main.c | 32 #include "snic.h" 37 /* Supported devices by snic module */ 45 MODULE_PARM_DESC(snic_log_level, "bitmask for snic logging levels"); 51 "Total allocated memory pages for snic trace buffer"); 80 struct snic *snic = shost_priv(sdev->host); snic_slave_configure() local 89 if (snic->fwinfo.io_tmo > 1) snic_slave_configure() 90 tmo = snic->fwinfo.io_tmo * HZ; snic_slave_configure() 136 snic_handle_link_event(struct snic *snic) snic_handle_link_event() argument 140 spin_lock_irqsave(&snic->snic_lock, flags); snic_handle_link_event() 141 if (snic->stop_link_events) { snic_handle_link_event() 142 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_handle_link_event() 146 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_handle_link_event() 148 queue_work(snic_glob->event_q, &snic->link_work); snic_handle_link_event() 154 * Note: snic supports only MSIX interrupts, in which we can just call 158 snic_notify_set(struct snic *snic) snic_notify_set() argument 163 intr_mode = svnic_dev_get_intr_mode(snic->vdev); snic_notify_set() 166 ret = svnic_dev_notify_set(snic->vdev, SNIC_MSIX_ERR_NOTIFY); snic_notify_set() 168 SNIC_HOST_ERR(snic->shost, snic_notify_set() 218 * Stops the snic device, masks all interrupts, Completed CQ entries are 222 snic_cleanup(struct snic *snic) snic_cleanup() argument 227 svnic_dev_disable(snic->vdev); snic_cleanup() 228 for (i = 0; i < snic->intr_count; i++) snic_cleanup() 229 svnic_intr_mask(&snic->intr[i]); snic_cleanup() 231 for (i = 0; i < snic->wq_count; i++) { snic_cleanup() 232 ret = svnic_wq_disable(&snic->wq[i]); snic_cleanup() 238 snic_fwcq_cmpl_handler(snic, -1); snic_cleanup() 240 snic_wq_cmpl_handler(snic, -1); snic_cleanup() 243 for (i = 0; i < snic->wq_count; i++) snic_cleanup() 244 svnic_wq_clean(&snic->wq[i], snic_free_wq_buf); snic_cleanup() 246 for (i = 0; i < snic->cq_count; i++) snic_cleanup() 247 svnic_cq_clean(&snic->cq[i]); snic_cleanup() 249 for (i = 0; i < snic->intr_count; i++) snic_cleanup() 250 svnic_intr_clean(&snic->intr[i]); snic_cleanup() 252 /* Cleanup snic specific requests */ snic_cleanup() 253 snic_free_all_untagged_reqs(snic); snic_cleanup() 256 snic_shutdown_scsi_cleanup(snic); snic_cleanup() 259 mempool_destroy(snic->req_pool[i]); snic_cleanup() 266 snic_iounmap(struct snic *snic) snic_iounmap() argument 268 if (snic->bar0.vaddr) snic_iounmap() 269 iounmap(snic->bar0.vaddr); snic_iounmap() 278 struct snic *snic = svnic_dev_priv(vdev); snic_vdev_open_done() local 287 SNIC_HOST_INFO(snic->shost, "VNIC_DEV_OPEN Timedout.\n"); snic_vdev_open_done() 304 "snic: scsi_add_host failed. %d\n", snic_add_host() 335 snic_get_state(struct snic *snic) snic_get_state() argument 337 return atomic_read(&snic->state); snic_get_state() 341 snic_set_state(struct snic *snic, enum snic_state state) snic_set_state() argument 343 SNIC_HOST_INFO(snic->shost, "snic state change from %s to %s\n", snic_set_state() 344 snic_state_to_str(snic_get_state(snic)), snic_set_state() 347 atomic_set(&snic->state, state); snic_set_state() 351 * snic_probe : Initialize the snic interface. 357 struct snic *snic; snic_probe() local 364 SNIC_INFO("snic device %4x:%4x:%4x:%4x: ", snic_probe() 368 SNIC_INFO("snic device bus %x: slot %x: fn %x\n", snic_probe() 373 * Allocate SCSI Host and setup association between host, and snic snic_probe() 375 shost = scsi_host_alloc(&snic_host_template, sizeof(struct snic)); snic_probe() 382 snic = shost_priv(shost); snic_probe() 383 snic->shost = shost; snic_probe() 385 snprintf(snic->name, sizeof(snic->name) - 1, "%s%d", SNIC_DRV_NAME, snic_probe() 389 "snic%d = %p shost = %p device bus %x: slot %x: fn %x\n", snic_probe() 390 shost->host_no, snic, shost, pdev->bus->number, snic_probe() 393 /* Per snic debugfs init */ snic_probe() 394 ret = snic_stats_debugfs_init(snic); snic_probe() 396 SNIC_HOST_ERR(snic->shost, snic_probe() 398 snic_stats_debugfs_remove(snic); snic_probe() 403 pci_set_drvdata(pdev, snic); snic_probe() 404 snic->pdev = pdev; snic_probe() 470 snic->bar0.vaddr = pci_iomap(pdev, 0, 0); snic_probe() 471 if (!snic->bar0.vaddr) { snic_probe() 479 snic->bar0.bus_addr = pci_resource_start(pdev, 0); snic_probe() 480 snic->bar0.len = pci_resource_len(pdev, 0); snic_probe() 481 SNIC_BUG_ON(snic->bar0.bus_addr == 0); snic_probe() 484 snic->vdev = svnic_dev_alloc_discover(NULL, snic, pdev, &snic->bar0, 1); snic_probe() 485 if (!snic->vdev) { snic_probe() 492 ret = svnic_dev_cmd_init(snic->vdev, 0); snic_probe() 499 ret = snic_dev_wait(snic->vdev, svnic_dev_open, snic_vdev_open_done, 0); snic_probe() 508 ret = svnic_dev_init(snic->vdev, 0); snic_probe() 518 ret = snic_get_vnic_config(snic); snic_probe() 528 max_ios = snic->config.io_throttle_count; snic_probe() 533 snic->max_tag_id = shost->can_queue; snic_probe() 535 shost->max_lun = snic->config.luns_per_tgt; snic_probe() 540 snic_get_res_counts(snic); snic_probe() 545 ret = snic_set_intr_mode(snic); snic_probe() 554 ret = snic_alloc_vnic_res(snic); snic_probe() 564 INIT_LIST_HEAD(&snic->list); snic_probe() 567 * spl_cmd_list for maintaining snic specific cmds snic_probe() 570 INIT_LIST_HEAD(&snic->spl_cmd_list); snic_probe() 571 spin_lock_init(&snic->spl_cmd_lock); snic_probe() 573 /* initialize all snic locks */ snic_probe() 574 spin_lock_init(&snic->snic_lock); snic_probe() 577 spin_lock_init(&snic->wq_lock[i]); snic_probe() 580 spin_lock_init(&snic->io_req_lock[i]); snic_probe() 590 snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL] = pool; snic_probe() 600 snic->req_pool[SNIC_REQ_CACHE_MAX_SGL] = pool; snic_probe() 605 SNIC_HOST_ERR(shost, "snic tmreq info pool creation failed.\n"); snic_probe() 610 snic->req_pool[SNIC_REQ_TM_CACHE] = pool; snic_probe() 612 /* Initialize snic state */ snic_probe() 613 atomic_set(&snic->state, SNIC_INIT); snic_probe() 615 atomic_set(&snic->ios_inflight, 0); snic_probe() 618 ret = snic_notify_set(snic); snic_probe() 641 list_add_tail(&snic->list, &snic_glob->snic_list); snic_probe() 644 snic_disc_init(&snic->disc); snic_probe() 645 INIT_WORK(&snic->tgt_work, snic_handle_tgt_disc); snic_probe() 646 INIT_WORK(&snic->disc_work, snic_handle_disc); snic_probe() 647 INIT_WORK(&snic->link_work, snic_handle_link); snic_probe() 650 for (i = 0; i < snic->wq_count; i++) snic_probe() 651 svnic_wq_enable(&snic->wq[i]); snic_probe() 653 ret = svnic_dev_enable_wait(snic->vdev); snic_probe() 662 ret = snic_request_intr(snic); snic_probe() 669 for (i = 0; i < snic->intr_count; i++) snic_probe() 670 svnic_intr_unmask(&snic->intr[i]); snic_probe() 672 snic_set_state(snic, SNIC_ONLINE); snic_probe() 674 /* Get snic params */ snic_probe() 675 ret = snic_get_conf(snic); snic_probe() 678 "Failed to get snic io config from FW w err %d\n", snic_probe() 684 ret = snic_disc_start(snic); snic_probe() 697 snic_free_all_untagged_reqs(snic); snic_probe() 699 for (i = 0; i < snic->intr_count; i++) snic_probe() 700 svnic_intr_mask(&snic->intr[i]); snic_probe() 702 snic_free_intr(snic); snic_probe() 705 svnic_dev_disable(snic->vdev); snic_probe() 708 for (i = 0; i < snic->wq_count; i++) { snic_probe() 711 rc = svnic_wq_disable(&snic->wq[i]); snic_probe() 719 snic_del_host(snic->shost); snic_probe() 722 svnic_dev_notify_unset(snic->vdev); snic_probe() 725 mempool_destroy(snic->req_pool[SNIC_REQ_TM_CACHE]); snic_probe() 728 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_MAX_SGL]); snic_probe() 731 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL]); snic_probe() 734 snic_free_vnic_res(snic); snic_probe() 737 snic_clear_intr_mode(snic); snic_probe() 740 svnic_dev_close(snic->vdev); snic_probe() 743 svnic_dev_unregister(snic->vdev); snic_probe() 746 snic_iounmap(snic); snic_probe() 756 snic_stats_debugfs_remove(snic); snic_probe() 777 struct snic *snic = pci_get_drvdata(pdev); snic_remove() local 780 if (!snic) { snic_remove() 781 SNIC_INFO("sNIC dev: bus %d slot %d fn %d snic inst is null.\n", snic_remove() 792 * items on the snic workqueue snic_remove() 794 snic_set_state(snic, SNIC_OFFLINE); snic_remove() 795 spin_lock_irqsave(&snic->snic_lock, flags); snic_remove() 796 snic->stop_link_events = 1; snic_remove() 797 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_remove() 800 snic_disc_term(snic); snic_remove() 802 spin_lock_irqsave(&snic->snic_lock, flags); snic_remove() 803 snic->in_remove = 1; snic_remove() 804 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_remove() 807 * This stops the snic device, masks all interrupts, Completed snic_remove() 811 snic_cleanup(snic); snic_remove() 814 list_del(&snic->list); snic_remove() 817 snic_tgt_del_all(snic); snic_remove() 819 snic_stats_debugfs_remove(snic); snic_remove() 821 snic_del_host(snic->shost); snic_remove() 823 svnic_dev_notify_unset(snic->vdev); snic_remove() 824 snic_free_intr(snic); snic_remove() 825 snic_free_vnic_res(snic); snic_remove() 826 snic_clear_intr_mode(snic); snic_remove() 827 svnic_dev_close(snic->vdev); snic_remove() 828 svnic_dev_unregister(snic->vdev); snic_remove() 829 snic_iounmap(snic); snic_remove() 834 /* this frees Scsi_Host and snic memory (continuous chunk) */ snic_remove() 835 scsi_host_put(snic->shost); snic_remove() 864 /* Create debugfs entries for snic */ snic_global_data_init() 891 SNIC_ERR("Failed to create snic default sgl slab\n"); snic_global_data_init() 904 SNIC_ERR("Failed to create snic max sgl slab\n"); snic_global_data_init() 915 SNIC_ERR("Failed to create snic tm req slab\n"); snic_global_data_init() 925 SNIC_ERR("snic event queue create failed\n"); snic_global_data_init()
|
H A D | snic_disc.c | 24 #include "snic.h" 28 /* snic target types */ 80 snic_queue_report_tgt_req(struct snic *snic) snic_queue_report_tgt_req() argument 88 rqi = snic_req_init(snic, 1); snic_queue_report_tgt_req() 94 if (snic->fwinfo.max_tgts) snic_queue_report_tgt_req() 95 ntgts = min_t(u32, snic->fwinfo.max_tgts, snic->shost->max_id); snic_queue_report_tgt_req() 97 ntgts = snic->shost->max_id; snic_queue_report_tgt_req() 105 snic_req_free(snic, rqi); snic_queue_report_tgt_req() 106 SNIC_HOST_ERR(snic->shost, "Resp Buf Alloc Failed.\n"); snic_queue_report_tgt_req() 114 pa = pci_map_single(snic->pdev, buf, buf_len, PCI_DMA_FROMDEVICE); snic_queue_report_tgt_req() 115 if (pci_dma_mapping_error(snic->pdev, pa)) { snic_queue_report_tgt_req() 117 snic_req_free(snic, rqi); snic_queue_report_tgt_req() 118 SNIC_HOST_ERR(snic->shost, snic_queue_report_tgt_req() 131 snic->config.hid, snic_queue_report_tgt_req() 137 snic_handle_untagged_req(snic, rqi); snic_queue_report_tgt_req() 139 ret = snic_queue_wq_desc(snic, rqi->req, rqi->req_len); snic_queue_report_tgt_req() 141 pci_unmap_single(snic->pdev, pa, buf_len, PCI_DMA_FROMDEVICE); snic_queue_report_tgt_req() 144 snic_release_untagged_req(snic, rqi); snic_queue_report_tgt_req() 145 SNIC_HOST_ERR(snic->shost, "Queuing Report Tgts Failed.\n"); snic_queue_report_tgt_req() 150 SNIC_DISC_DBG(snic->shost, "Report Targets Issued.\n"); snic_queue_report_tgt_req() 155 SNIC_HOST_ERR(snic->shost, snic_queue_report_tgt_req() 185 snic_tgt_lookup(struct snic *snic, struct snic_tgt_id *tgtid) snic_tgt_lookup() argument 190 list_for_each_safe(cur, nxt, &snic->disc.tgt_list) { snic_tgt_lookup() 248 snic_tgt_create(struct snic *snic, struct snic_tgt_id *tgtid) snic_tgt_create() argument 254 tgt = snic_tgt_lookup(snic, tgtid); snic_tgt_create() 262 SNIC_HOST_ERR(snic->shost, "Failure to allocate snic_tgt.\n"); snic_tgt_create() 281 tgt->dev.parent = get_device(&snic->shost->shost_gendev); snic_tgt_create() 288 snic->shost->host_no, tgt->channel, tgt->id); snic_tgt_create() 293 snic->shost->host_no, tgt->channel, tgt->id); snic_tgt_create() 297 SNIC_HOST_INFO(snic->shost, "Target type Unknown Detected.\n"); snic_tgt_create() 299 snic->shost->host_no, tgt->channel, tgt->id); snic_tgt_create() 303 spin_lock_irqsave(snic->shost->host_lock, flags); snic_tgt_create() 304 list_add_tail(&tgt->list, &snic->disc.tgt_list); snic_tgt_create() 305 tgt->scsi_tgt_id = snic->disc.nxt_tgt_id++; snic_tgt_create() 307 spin_unlock_irqrestore(snic->shost->host_lock, flags); snic_tgt_create() 309 SNIC_HOST_INFO(snic->shost, snic_tgt_create() 315 SNIC_HOST_ERR(snic->shost, snic_tgt_create() 319 put_device(&snic->shost->shost_gendev); snic_tgt_create() 326 SNIC_HOST_INFO(snic->shost, "Scanning %s.\n", dev_name(&tgt->dev)); snic_tgt_create() 328 scsi_queue_work(snic->shost, &tgt->scan_work); snic_tgt_create() 337 struct snic *snic = container_of(work, struct snic, tgt_work); snic_handle_tgt_disc() local 343 spin_lock_irqsave(&snic->snic_lock, flags); snic_handle_tgt_disc() 344 if (snic->in_remove) { snic_handle_tgt_disc() 345 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_handle_tgt_disc() 346 kfree(snic->disc.rtgt_info); snic_handle_tgt_disc() 350 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_handle_tgt_disc() 352 mutex_lock(&snic->disc.mutex); snic_handle_tgt_disc() 354 if (snic->disc.req_cnt) { snic_handle_tgt_disc() 355 snic->disc.state = SNIC_DISC_DONE; snic_handle_tgt_disc() 356 snic->disc.req_cnt = 0; snic_handle_tgt_disc() 357 mutex_unlock(&snic->disc.mutex); snic_handle_tgt_disc() 358 kfree(snic->disc.rtgt_info); snic_handle_tgt_disc() 359 snic->disc.rtgt_info = NULL; snic_handle_tgt_disc() 361 SNIC_HOST_INFO(snic->shost, "tgt_disc: Discovery restart.\n"); snic_handle_tgt_disc() 363 snic_disc_start(snic); snic_handle_tgt_disc() 368 tgtid = (struct snic_tgt_id *)snic->disc.rtgt_info; snic_handle_tgt_disc() 370 SNIC_BUG_ON(snic->disc.rtgt_cnt == 0 || tgtid == NULL); snic_handle_tgt_disc() 372 for (i = 0; i < snic->disc.rtgt_cnt; i++) { snic_handle_tgt_disc() 373 tgt = snic_tgt_create(snic, &tgtid[i]); snic_handle_tgt_disc() 375 int buf_sz = snic->disc.rtgt_cnt * sizeof(*tgtid); snic_handle_tgt_disc() 377 SNIC_HOST_ERR(snic->shost, "Failed to create tgt.\n"); snic_handle_tgt_disc() 383 snic->disc.rtgt_info = NULL; snic_handle_tgt_disc() 384 snic->disc.state = SNIC_DISC_DONE; snic_handle_tgt_disc() 385 mutex_unlock(&snic->disc.mutex); snic_handle_tgt_disc() 387 SNIC_HOST_INFO(snic->shost, "Discovery Completed.\n"); snic_handle_tgt_disc() 394 snic_report_tgt_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) snic_report_tgt_cmpl_handler() argument 410 SNIC_HOST_ERR(snic->shost, "No Targets Found on this host.\n"); snic_report_tgt_cmpl_handler() 417 SNIC_HOST_INFO(snic->shost, "Target Count = %d\n", tgt_cnt); snic_report_tgt_cmpl_handler() 419 SNIC_BUG_ON(tgt_cnt > snic->fwinfo.max_tgts); snic_report_tgt_cmpl_handler() 422 SNIC_HOST_INFO(snic->shost, snic_report_tgt_cmpl_handler() 430 snic->disc.rtgt_cnt = tgt_cnt; snic_report_tgt_cmpl_handler() 431 snic->disc.rtgt_info = (u8 *) tgtid; snic_report_tgt_cmpl_handler() 432 queue_work(snic_glob->event_q, &snic->tgt_work); snic_report_tgt_cmpl_handler() 437 snic_pci_unmap_rsp_buf(snic, rqi); snic_report_tgt_cmpl_handler() 442 snic_release_untagged_req(snic, rqi); snic_report_tgt_cmpl_handler() 464 snic_disc_term(struct snic *snic) snic_disc_term() argument 466 struct snic_disc *disc = &snic->disc; snic_disc_term() 471 SNIC_SCSI_DBG(snic->shost, "Terminating Discovery.\n"); snic_disc_term() 480 snic_disc_start(struct snic *snic) snic_disc_start() argument 482 struct snic_disc *disc = &snic->disc; snic_disc_start() 485 SNIC_SCSI_DBG(snic->shost, "Discovery Start.\n"); snic_disc_start() 497 ret = snic_queue_report_tgt_req(snic); snic_disc_start() 499 SNIC_HOST_INFO(snic->shost, "Discovery Failed, err=%d.\n", ret); snic_disc_start() 510 struct snic *snic = container_of(work, struct snic, disc_work); snic_handle_disc() local 513 SNIC_HOST_INFO(snic->shost, "disc_work: Discovery\n"); snic_handle_disc() 515 ret = snic_disc_start(snic); snic_handle_disc() 520 SNIC_HOST_ERR(snic->shost, snic_handle_disc() 526 * snic_tgt_del_all : cleanup all snic targets 530 snic_tgt_del_all(struct snic *snic) snic_tgt_del_all() argument 536 mutex_lock(&snic->disc.mutex); snic_tgt_del_all() 537 spin_lock_irqsave(snic->shost->host_lock, flags); snic_tgt_del_all() 539 list_for_each_safe(cur, nxt, &snic->disc.tgt_list) { snic_tgt_del_all() 543 SNIC_HOST_INFO(snic->shost, "Tgt %d q'ing for del\n", tgt->id); snic_tgt_del_all() 547 spin_unlock_irqrestore(snic->shost->host_lock, flags); snic_tgt_del_all() 549 scsi_flush_work(snic->shost); snic_tgt_del_all() 550 mutex_unlock(&snic->disc.mutex); snic_tgt_del_all()
|
H A D | snic_io.c | 29 #include "snic.h" 39 struct snic *snic = svnic_dev_priv(wq->vdev); snic_wq_cmpl_frame_send() local 44 SNIC_HOST_INFO(snic->shost, snic_wq_cmpl_frame_send() 48 SNIC_TRC(snic->shost->host_no, 0, 0, snic_wq_cmpl_frame_send() 51 pci_unmap_single(snic->pdev, buf->dma_addr, buf->len, PCI_DMA_TODEVICE); snic_wq_cmpl_frame_send() 63 struct snic *snic = svnic_dev_priv(vdev); snic_wq_cmpl_handler_cont() local 68 spin_lock_irqsave(&snic->wq_lock[q_num], flags); snic_wq_cmpl_handler_cont() 69 svnic_wq_service(&snic->wq[q_num], snic_wq_cmpl_handler_cont() 74 spin_unlock_irqrestore(&snic->wq_lock[q_num], flags); snic_wq_cmpl_handler_cont() 80 snic_wq_cmpl_handler(struct snic *snic, int work_to_do) snic_wq_cmpl_handler() argument 85 snic->s_stats.misc.last_ack_time = jiffies; snic_wq_cmpl_handler() 86 for (i = 0; i < snic->wq_count; i++) { snic_wq_cmpl_handler() 87 work_done += svnic_cq_service(&snic->cq[i], snic_wq_cmpl_handler() 101 struct snic *snic = svnic_dev_priv(wq->vdev); snic_free_wq_buf() local 105 pci_unmap_single(snic->pdev, buf->dma_addr, buf->len, PCI_DMA_TODEVICE); snic_free_wq_buf() 108 spin_lock_irqsave(&snic->spl_cmd_lock, flags); snic_free_wq_buf() 110 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); snic_free_wq_buf() 116 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); snic_free_wq_buf() 119 snic_pci_unmap_rsp_buf(snic, rqi); snic_free_wq_buf() 123 snic_req_free(snic, rqi); snic_free_wq_buf() 124 SNIC_HOST_INFO(snic->shost, "snic_free_wq_buf .. freed.\n"); snic_free_wq_buf() 132 snic_select_wq(struct snic *snic) snic_select_wq() argument 141 snic_queue_wq_desc(struct snic *snic, void *os_buf, u16 len) snic_queue_wq_desc() argument 145 struct snic_fw_stats *fwstats = &snic->s_stats.fw; snic_queue_wq_desc() 152 pa = pci_map_single(snic->pdev, os_buf, len, PCI_DMA_TODEVICE); snic_queue_wq_desc() 153 if (pci_dma_mapping_error(snic->pdev, pa)) { snic_queue_wq_desc() 154 SNIC_HOST_ERR(snic->shost, "qdesc: PCI DMA Mapping Fail.\n"); snic_queue_wq_desc() 159 q_num = snic_select_wq(snic); snic_queue_wq_desc() 161 spin_lock_irqsave(&snic->wq_lock[q_num], flags); snic_queue_wq_desc() 162 if (!svnic_wq_desc_avail(snic->wq)) { snic_queue_wq_desc() 163 pci_unmap_single(snic->pdev, pa, len, PCI_DMA_TODEVICE); snic_queue_wq_desc() 164 spin_unlock_irqrestore(&snic->wq_lock[q_num], flags); snic_queue_wq_desc() 165 atomic64_inc(&snic->s_stats.misc.wq_alloc_fail); snic_queue_wq_desc() 166 SNIC_DBG("host = %d, WQ is Full\n", snic->shost->host_no); snic_queue_wq_desc() 171 snic_queue_wq_eth_desc(&snic->wq[q_num], os_buf, pa, len, 0, 0, 1); snic_queue_wq_desc() 172 spin_unlock_irqrestore(&snic->wq_lock[q_num], flags); snic_queue_wq_desc() 183 * snic_handle_untagged_req: Adds snic specific requests to spl_cmd_list. 187 snic_handle_untagged_req(struct snic *snic, struct snic_req_info *rqi) snic_handle_untagged_req() argument 193 spin_lock_irqsave(&snic->spl_cmd_lock, flags); snic_handle_untagged_req() 194 list_add_tail(&rqi->list, &snic->spl_cmd_list); snic_handle_untagged_req() 195 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); snic_handle_untagged_req() 203 snic_req_init(struct snic *snic, int sg_cnt) snic_req_init() argument 211 rqi = mempool_alloc(snic->req_pool[typ], GFP_ATOMIC); snic_req_init() 213 atomic64_inc(&snic->s_stats.io.alloc_fail); snic_req_init() 214 SNIC_HOST_ERR(snic->shost, snic_req_init() 215 "Failed to allocate memory from snic req pool id = %d\n", snic_req_init() 225 rqi->snic = snic; snic_req_init() 234 if (sg_cnt > atomic64_read(&snic->s_stats.io.max_sgl)) snic_req_init() 235 atomic64_set(&snic->s_stats.io.max_sgl, sg_cnt); snic_req_init() 238 atomic64_inc(&snic->s_stats.io.sgl_cnt[sg_cnt - 1]); snic_req_init() 246 SNIC_SCSI_DBG(snic->shost, "Req_alloc:rqi = %p allocatd.\n", rqi); snic_req_init() 255 snic_abort_req_init(struct snic *snic, struct snic_req_info *rqi) snic_abort_req_init() argument 266 req = mempool_alloc(snic->req_pool[SNIC_REQ_TM_CACHE], GFP_ATOMIC); snic_abort_req_init() 268 SNIC_HOST_ERR(snic->shost, "abts:Failed to alloc tm req.\n"); snic_abort_req_init() 286 snic_dr_req_init(struct snic *snic, struct snic_req_info *rqi) snic_dr_req_init() argument 292 req = mempool_alloc(snic->req_pool[SNIC_REQ_TM_CACHE], GFP_ATOMIC); snic_dr_req_init() 294 SNIC_HOST_ERR(snic->shost, "dr:Failed to alloc tm req.\n"); snic_dr_req_init() 311 snic_req_free(struct snic *snic, struct snic_req_info *rqi) snic_req_free() argument 317 SNIC_SCSI_DBG(snic->shost, snic_req_free() 322 mempool_free(rqi->abort_req, snic->req_pool[SNIC_REQ_TM_CACHE]); snic_req_free() 325 mempool_free(rqi->dr_req, snic->req_pool[SNIC_REQ_TM_CACHE]); snic_req_free() 327 mempool_free(rqi, snic->req_pool[rqi->rq_pool_type]); snic_req_free() 331 snic_pci_unmap_rsp_buf(struct snic *snic, struct snic_req_info *rqi) snic_pci_unmap_rsp_buf() argument 337 pci_unmap_single(snic->pdev, snic_pci_unmap_rsp_buf() 347 snic_free_all_untagged_reqs(struct snic *snic) snic_free_all_untagged_reqs() argument 353 spin_lock_irqsave(&snic->spl_cmd_lock, flags); snic_free_all_untagged_reqs() 354 list_for_each_safe(cur, nxt, &snic->spl_cmd_list) { snic_free_all_untagged_reqs() 358 snic_pci_unmap_rsp_buf(snic, rqi); snic_free_all_untagged_reqs() 363 snic_req_free(snic, rqi); snic_free_all_untagged_reqs() 365 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); snic_free_all_untagged_reqs() 372 snic_release_untagged_req(struct snic *snic, struct snic_req_info *rqi) snic_release_untagged_req() argument 376 spin_lock_irqsave(&snic->snic_lock, flags); snic_release_untagged_req() 377 if (snic->in_remove) { snic_release_untagged_req() 378 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_release_untagged_req() 381 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_release_untagged_req() 383 spin_lock_irqsave(&snic->spl_cmd_lock, flags); snic_release_untagged_req() 385 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); snic_release_untagged_req() 389 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); snic_release_untagged_req() 390 snic_req_free(snic, rqi); snic_release_untagged_req() 510 snic_calc_io_process_time(struct snic *snic, struct snic_req_info *rqi) snic_calc_io_process_time() argument 516 if (duration > atomic64_read(&snic->s_stats.io.max_time)) snic_calc_io_process_time() 517 atomic64_set(&snic->s_stats.io.max_time, duration); snic_calc_io_process_time()
|
H A D | snic_scsi.c | 34 #include "snic.h" 56 /* snic cmd status strings */ 80 static void snic_scsi_cleanup(struct snic *, int); 112 snic_io_lock_hash(struct snic *snic, struct scsi_cmnd *sc) snic_io_lock_hash() argument 116 return &snic->io_req_lock[hash]; snic_io_lock_hash() 120 snic_io_lock_tag(struct snic *snic, int tag) snic_io_lock_tag() argument 122 return &snic->io_req_lock[tag & (SNIC_IO_LOCKS - 1)]; snic_io_lock_tag() 127 snic_release_req_buf(struct snic *snic, snic_release_req_buf() argument 142 SNIC_SCSI_DBG(snic->shost, snic_release_req_buf() 149 pci_unmap_single(snic->pdev, snic_release_req_buf() 156 snic_req_free(snic, rqi); snic_release_req_buf() 163 snic_queue_icmnd_req(struct snic *snic, snic_queue_icmnd_req() argument 188 pa = pci_map_single(snic->pdev, snic_queue_icmnd_req() 193 if (pci_dma_mapping_error(snic->pdev, pa)) { snic_queue_icmnd_req() 194 SNIC_HOST_ERR(snic->shost, snic_queue_icmnd_req() 211 snic->config.hid, /* hid */ snic_queue_icmnd_req() 224 ret = snic_queue_wq_desc(snic, rqi->req, rqi->req_len); snic_queue_icmnd_req() 226 SNIC_HOST_ERR(snic->shost, snic_queue_icmnd_req() 237 snic_issue_scsi_req(struct snic *snic, snic_issue_scsi_req() argument 253 SNIC_TRC((u16)snic->shost->host_no, tag, (ulong) sc, 0, snic_issue_scsi_req() 256 SNIC_HOST_ERR(snic->shost, "issue_sc:Failed to map SG List.\n"); snic_issue_scsi_req() 262 rqi = snic_req_init(snic, sg_cnt); snic_issue_scsi_req() 278 io_lock = snic_io_lock_hash(snic, sc); snic_issue_scsi_req() 281 ret = snic_queue_icmnd_req(snic, rqi, sc, sg_cnt); snic_issue_scsi_req() 283 SNIC_HOST_ERR(snic->shost, snic_issue_scsi_req() 295 snic_release_req_buf(snic, rqi, sc); snic_issue_scsi_req() 297 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, 0, 0, 0, snic_issue_scsi_req() 302 struct snic_io_stats *iostats = &snic->s_stats.io; snic_issue_scsi_req() 310 SNIC_SCSI_DBG(snic->shost, snic_issue_scsi_req() 314 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, (ulong) rqi, snic_issue_scsi_req() 333 struct snic *snic = shost_priv(shost); snic_queuecommand() local 340 atomic64_inc(&snic->s_stats.misc.tgt_not_rdy); snic_queuecommand() 347 if (snic_get_state(snic) != SNIC_ONLINE) { snic_queuecommand() 348 SNIC_HOST_ERR(shost, "snic state is %s\n", snic_queuecommand() 349 snic_state_str[snic_get_state(snic)]); snic_queuecommand() 353 atomic_inc(&snic->ios_inflight); snic_queuecommand() 360 ret = snic_issue_scsi_req(snic, tgt, sc); snic_queuecommand() 365 snic_stats_update_active_ios(&snic->s_stats); snic_queuecommand() 367 atomic_dec(&snic->ios_inflight); snic_queuecommand() 377 snic_proc_tmreq_pending_state(struct snic *snic, snic_proc_tmreq_pending_state() argument 409 snic_process_io_failed_state(struct snic *snic, snic_process_io_failed_state() argument 418 atomic64_inc(&snic->s_stats.misc.io_tmo); snic_process_io_failed_state() 423 atomic64_inc(&snic->s_stats.misc.io_aborted); snic_process_io_failed_state() 428 atomic64_inc(&snic->s_stats.misc.data_cnt_mismat); snic_process_io_failed_state() 434 atomic64_inc(&snic->s_stats.fw.out_of_res); snic_process_io_failed_state() 439 atomic64_inc(&snic->s_stats.io.io_not_found); snic_process_io_failed_state() 444 atomic64_inc(&snic->s_stats.misc.sgl_inval); snic_process_io_failed_state() 449 atomic64_inc(&snic->s_stats.fw.io_errs); snic_process_io_failed_state() 454 atomic64_inc(&snic->s_stats.fw.scsi_errs); snic_process_io_failed_state() 468 SNIC_SCSI_DBG(snic->shost, snic_process_io_failed_state() 474 SNIC_HOST_ERR(snic->shost, "fw returns failed status %s flags 0x%llx\n", snic_process_io_failed_state() 498 snic_process_icmnd_cmpl_status(struct snic *snic, snic_process_icmnd_cmpl_status() argument 520 atomic64_inc(&snic->s_stats.misc.io_under_run); snic_process_icmnd_cmpl_status() 524 atomic64_inc(&snic->s_stats.misc.qfull); snic_process_icmnd_cmpl_status() 528 snic_process_io_failed_state(snic, icmnd_cmpl, sc, cmpl_stat); snic_process_icmnd_cmpl_status() 529 atomic64_inc(&snic->s_stats.io.fail); snic_process_icmnd_cmpl_status() 530 SNIC_HOST_ERR(snic->shost, snic_process_icmnd_cmpl_status() 545 snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) snic_icmnd_cmpl_handler() argument 562 SNIC_SCSI_DBG(snic->shost, snic_icmnd_cmpl_handler() 566 if (cmnd_id >= snic->max_tag_id) { snic_icmnd_cmpl_handler() 567 SNIC_HOST_ERR(snic->shost, snic_icmnd_cmpl_handler() 573 sc = scsi_host_find_tag(snic->shost, cmnd_id); snic_icmnd_cmpl_handler() 577 atomic64_inc(&snic->s_stats.io.sc_null); snic_icmnd_cmpl_handler() 578 SNIC_HOST_ERR(snic->shost, snic_icmnd_cmpl_handler() 584 SNIC_TRC(snic->shost->host_no, cmnd_id, 0, snic_icmnd_cmpl_handler() 592 io_lock = snic_io_lock_hash(snic, sc); snic_icmnd_cmpl_handler() 596 SNIC_SCSI_DBG(snic->shost, snic_icmnd_cmpl_handler() 604 atomic64_inc(&snic->s_stats.io.req_null); snic_icmnd_cmpl_handler() 608 SNIC_HOST_ERR(snic->shost, snic_icmnd_cmpl_handler() 626 snic_proc_tmreq_pending_state(snic, sc, hdr_stat); snic_icmnd_cmpl_handler() 629 snic_stats_update_io_cmpl(&snic->s_stats); snic_icmnd_cmpl_handler() 635 SNIC_SCSI_DBG(snic->shost, snic_icmnd_cmpl_handler() 642 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, snic_icmnd_cmpl_handler() 649 if (snic_process_icmnd_cmpl_status(snic, icmnd_cmpl, hdr_stat, sc)) { snic_icmnd_cmpl_handler() 651 SNIC_HOST_ERR(snic->shost, snic_icmnd_cmpl_handler() 664 snic_calc_io_process_time(snic, rqi); snic_icmnd_cmpl_handler() 666 snic_release_req_buf(snic, rqi, sc); snic_icmnd_cmpl_handler() 668 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, snic_icmnd_cmpl_handler() 676 snic_stats_update_io_cmpl(&snic->s_stats); snic_icmnd_cmpl_handler() 680 snic_proc_dr_cmpl_locked(struct snic *snic, snic_proc_dr_cmpl_locked() argument 691 SNIC_SCSI_DBG(snic->shost, "itmf_cmpl: Cmd State = %s\n", snic_proc_dr_cmpl_locked() 697 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, snic_proc_dr_cmpl_locked() 701 SNIC_SCSI_DBG(snic->shost, snic_proc_dr_cmpl_locked() 712 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, snic_proc_dr_cmpl_locked() 716 SNIC_SCSI_DBG(snic->shost, snic_proc_dr_cmpl_locked() 728 SNIC_SCSI_DBG(snic->shost, snic_proc_dr_cmpl_locked() 742 snic_update_abort_stats(struct snic *snic, u8 cmpl_stat) snic_update_abort_stats() argument 744 struct snic_abort_stats *abt_stats = &snic->s_stats.abts; snic_update_abort_stats() 746 SNIC_SCSI_DBG(snic->shost, "Updating Abort stats.\n"); snic_update_abort_stats() 767 snic_process_itmf_cmpl(struct snic *snic, snic_process_itmf_cmpl() argument 780 io_lock = snic_io_lock_hash(snic, sc); snic_process_itmf_cmpl() 786 atomic64_inc(&snic->s_stats.io.req_null); snic_process_itmf_cmpl() 789 SNIC_HOST_ERR(snic->shost, snic_process_itmf_cmpl() 806 snic_update_abort_stats(snic, cmpl_stat); snic_process_itmf_cmpl() 819 SNIC_SCSI_DBG(snic->shost, snic_process_itmf_cmpl() 839 SNIC_SCSI_DBG(snic->shost, snic_process_itmf_cmpl() 845 snic_release_req_buf(snic, rqi, sc); snic_process_itmf_cmpl() 848 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, snic_process_itmf_cmpl() 860 snic_proc_dr_cmpl_locked(snic, fwreq, cmpl_stat, cmnd_id, sc); snic_process_itmf_cmpl() 873 SNIC_SCSI_DBG(snic->shost, snic_process_itmf_cmpl() 887 SNIC_HOST_ERR(snic->shost, snic_process_itmf_cmpl() 890 SNIC_HOST_ERR(snic->shost, snic_process_itmf_cmpl() 909 snic_itmf_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) snic_itmf_cmpl_handler() argument 921 SNIC_SCSI_DBG(snic->shost, snic_itmf_cmpl_handler() 926 SNIC_SCSI_DBG(snic->shost, snic_itmf_cmpl_handler() 938 if ((cmnd_id & SNIC_TAG_MASK) >= snic->max_tag_id) { snic_itmf_cmpl_handler() 939 SNIC_HOST_ERR(snic->shost, snic_itmf_cmpl_handler() 947 sc = scsi_host_find_tag(snic->shost, cmnd_id & SNIC_TAG_MASK); snic_itmf_cmpl_handler() 952 atomic64_inc(&snic->s_stats.io.sc_null); snic_itmf_cmpl_handler() 953 SNIC_HOST_ERR(snic->shost, snic_itmf_cmpl_handler() 960 snic_process_itmf_cmpl(snic, fwreq, cmnd_id, hdr_stat, sc); snic_itmf_cmpl_handler() 966 snic_hba_reset_scsi_cleanup(struct snic *snic, struct scsi_cmnd *sc) snic_hba_reset_scsi_cleanup() argument 968 struct snic_stats *st = &snic->s_stats; snic_hba_reset_scsi_cleanup() 971 SNIC_SCSI_DBG(snic->shost, "HBA Reset scsi cleanup.\n"); snic_hba_reset_scsi_cleanup() 972 snic_scsi_cleanup(snic, snic_cmd_tag(sc)); snic_hba_reset_scsi_cleanup() 987 * 1. Cleanup all the scsi cmds, release all snic specific cmds 991 snic_hba_reset_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) snic_hba_reset_cmpl_handler() argument 1004 SNIC_HOST_INFO(snic->shost, snic_hba_reset_cmpl_handler() 1008 SNIC_SCSI_DBG(snic->shost, snic_hba_reset_cmpl_handler() 1020 if (cmnd_id >= snic->max_tag_id) { snic_hba_reset_cmpl_handler() 1021 SNIC_HOST_ERR(snic->shost, snic_hba_reset_cmpl_handler() 1029 sc = scsi_host_find_tag(snic->shost, cmnd_id); snic_hba_reset_cmpl_handler() 1032 atomic64_inc(&snic->s_stats.io.sc_null); snic_hba_reset_cmpl_handler() 1033 SNIC_HOST_ERR(snic->shost, snic_hba_reset_cmpl_handler() 1041 io_lock = snic_io_lock_hash(snic, sc); snic_hba_reset_cmpl_handler() 1044 if (!snic->remove_wait) { snic_hba_reset_cmpl_handler() 1046 SNIC_HOST_ERR(snic->shost, snic_hba_reset_cmpl_handler() 1057 atomic64_inc(&snic->s_stats.io.req_null); snic_hba_reset_cmpl_handler() 1060 SNIC_HOST_ERR(snic->shost, snic_hba_reset_cmpl_handler() 1073 snic_hba_reset_scsi_cleanup(snic, sc); snic_hba_reset_cmpl_handler() 1075 SNIC_BUG_ON(snic_get_state(snic) != SNIC_OFFLINE && snic_hba_reset_cmpl_handler() 1076 snic_get_state(snic) != SNIC_FWRESET); snic_hba_reset_cmpl_handler() 1080 spin_lock_irqsave(&snic->snic_lock, gflags); snic_hba_reset_cmpl_handler() 1081 if (snic_get_state(snic) == SNIC_FWRESET) snic_hba_reset_cmpl_handler() 1082 snic_set_state(snic, SNIC_ONLINE); snic_hba_reset_cmpl_handler() 1083 spin_unlock_irqrestore(&snic->snic_lock, gflags); snic_hba_reset_cmpl_handler() 1085 if (snic->remove_wait) snic_hba_reset_cmpl_handler() 1086 complete(snic->remove_wait); snic_hba_reset_cmpl_handler() 1089 atomic64_inc(&snic->s_stats.reset.hba_reset_cmpl); snic_hba_reset_cmpl_handler() 1093 if (snic->config.xpt_type == SNIC_DAS) snic_hba_reset_cmpl_handler() 1096 SNIC_SCSI_DBG(snic->shost, "reset_cmpl: Queuing discovery work.\n"); snic_hba_reset_cmpl_handler() 1097 queue_work(snic_glob->event_q, &snic->disc_work); snic_hba_reset_cmpl_handler() 1103 snic_msg_ack_handler(struct snic *snic, struct snic_fw_req *fwreq) snic_msg_ack_handler() argument 1105 SNIC_HOST_INFO(snic->shost, "Message Ack Received.\n"); snic_msg_ack_handler() 1111 snic_aen_handler(struct snic *snic, struct snic_fw_req *fwreq) snic_aen_handler() argument 1120 SNIC_SCSI_DBG(snic->shost, snic_aen_handler() 1128 SNIC_HOST_INFO(snic->shost, "aen:TGT_OFFLINE Event Recvd.\n"); snic_aen_handler() 1132 SNIC_HOST_INFO(snic->shost, "aen:TGT_ONLINE Event Recvd.\n"); snic_aen_handler() 1136 SNIC_HOST_INFO(snic->shost, "aen:LUN_OFFLINE Event Recvd.\n"); snic_aen_handler() 1140 SNIC_HOST_INFO(snic->shost, "aen:LUN_ONLINE Event Recvd.\n"); snic_aen_handler() 1144 SNIC_HOST_INFO(snic->shost, "aen:Config Change Event Recvd.\n"); snic_aen_handler() 1148 SNIC_HOST_INFO(snic->shost, "aen:TGT_ADD Event Recvd.\n"); snic_aen_handler() 1152 SNIC_HOST_INFO(snic->shost, "aen:TGT_DEL Event Recvd.\n"); snic_aen_handler() 1156 SNIC_HOST_INFO(snic->shost, "aen:LUN_ADD Event Recvd.\n"); snic_aen_handler() 1160 SNIC_HOST_INFO(snic->shost, "aen:LUN_DEL Event Recvd.\n"); snic_aen_handler() 1164 SNIC_HOST_INFO(snic->shost, "aen:DISC_CMPL Event Recvd.\n"); snic_aen_handler() 1168 SNIC_HOST_INFO(snic->shost, "aen:Unknown Event Recvd.\n"); snic_aen_handler() 1185 struct snic *snic = svnic_dev_priv(vdev); snic_io_cmpl_handler() local 1193 atomic64_dec(&snic->s_stats.fw.actv_reqs); snic_io_cmpl_handler() 1198 /* Check for snic subsys errors */ snic_io_cmpl_handler() 1201 SNIC_HOST_ERR(snic->shost, snic_io_cmpl_handler() 1206 SNIC_HOST_ERR(snic->shost, snic_io_cmpl_handler() 1213 snic_io_exch_ver_cmpl_handler(snic, fwreq); snic_io_cmpl_handler() 1217 snic_report_tgt_cmpl_handler(snic, fwreq); snic_io_cmpl_handler() 1221 snic_icmnd_cmpl_handler(snic, fwreq); snic_io_cmpl_handler() 1225 snic_itmf_cmpl_handler(snic, fwreq); snic_io_cmpl_handler() 1229 snic_hba_reset_cmpl_handler(snic, fwreq); snic_io_cmpl_handler() 1233 snic_msg_ack_handler(snic, fwreq); snic_io_cmpl_handler() 1237 snic_aen_handler(snic, fwreq); snic_io_cmpl_handler() 1242 SNIC_SCSI_DBG(snic->shost, snic_io_cmpl_handler() 1250 if (cmpl_time > atomic64_read(&snic->s_stats.io.max_cmpl_time)) snic_io_cmpl_handler() 1251 atomic64_set(&snic->s_stats.io.max_cmpl_time, cmpl_time); snic_io_cmpl_handler() 1262 snic_fwcq_cmpl_handler(struct snic *snic, int io_cmpl_work) snic_fwcq_cmpl_handler() argument 1267 struct snic_misc_stats *misc_stats = &snic->s_stats.misc; snic_fwcq_cmpl_handler() 1269 for (cq_idx = snic->wq_count; cq_idx < snic->cq_count; cq_idx++) { snic_fwcq_cmpl_handler() 1270 nent_per_cq = vnic_cq_fw_service(&snic->cq[cq_idx], snic_fwcq_cmpl_handler() 1288 snic_queue_itmf_req(struct snic *snic, snic_queue_itmf_req() argument 1308 snic->config.hid, snic_queue_itmf_req() 1323 ret = snic_queue_wq_desc(snic, tmreq, sizeof(*tmreq)); snic_queue_itmf_req() 1325 SNIC_HOST_ERR(snic->shost, snic_queue_itmf_req() 1329 SNIC_SCSI_DBG(snic->shost, snic_queue_itmf_req() 1337 snic_issue_tm_req(struct snic *snic, snic_issue_tm_req() argument 1346 if (snic_get_state(snic) == SNIC_FWRESET) snic_issue_tm_req() 1349 atomic_inc(&snic->ios_inflight); snic_issue_tm_req() 1351 SNIC_SCSI_DBG(snic->shost, snic_issue_tm_req() 1357 tmreq = snic_dr_req_init(snic, rqi); snic_issue_tm_req() 1360 tmreq = snic_abort_req_init(snic, rqi); snic_issue_tm_req() 1370 ret = snic_queue_itmf_req(snic, tmreq, sc, tmf, req_id); snic_issue_tm_req() 1378 SNIC_HOST_ERR(snic->shost, snic_issue_tm_req() 1382 SNIC_SCSI_DBG(snic->shost, snic_issue_tm_req() 1387 atomic_dec(&snic->ios_inflight); snic_issue_tm_req() 1396 snic_queue_abort_req(struct snic *snic, snic_queue_abort_req() argument 1401 SNIC_SCSI_DBG(snic->shost, "q_abtreq: sc %p, rqi %p, tag %x, tmf %d\n", snic_queue_abort_req() 1407 return snic_issue_tm_req(snic, rqi, sc, tmf); snic_queue_abort_req() 1414 snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc) snic_abort_finish() argument 1421 io_lock = snic_io_lock_hash(snic, sc); snic_abort_finish() 1425 atomic64_inc(&snic->s_stats.io.req_null); snic_abort_finish() 1428 SNIC_SCSI_DBG(snic->shost, snic_abort_finish() 1445 atomic64_inc(&snic->s_stats.abts.drv_tmo); snic_abort_finish() 1446 SNIC_SCSI_DBG(snic->shost, snic_abort_finish() 1449 /* do not release snic request in timedout case */ snic_abort_finish() 1466 SNIC_HOST_INFO(snic->shost, snic_abort_finish() 1474 snic_release_req_buf(snic, rqi, sc); snic_abort_finish() 1483 snic_send_abort_and_wait(struct snic *snic, struct scsi_cmnd *sc) snic_send_abort_and_wait() argument 1501 io_lock = snic_io_lock_hash(snic, sc); snic_send_abort_and_wait() 1520 SNIC_HOST_ERR(snic->shost, snic_send_abort_and_wait() 1550 SNIC_SCSI_DBG(snic->shost, "send_abt_cmd: TAG 0x%x\n", tag); snic_send_abort_and_wait() 1555 ret = snic_queue_abort_req(snic, rqi, sc, tmf); snic_send_abort_and_wait() 1557 SNIC_HOST_ERR(snic->shost, snic_send_abort_and_wait() 1576 atomic64_inc(&snic->s_stats.abts.num); snic_send_abort_and_wait() 1583 SNIC_SCSI_DBG(snic->shost, snic_send_abort_and_wait() 1610 struct snic *snic = shost_priv(sc->device->host); snic_abort_cmd() local 1614 SNIC_SCSI_DBG(snic->shost, "abt_cmd:sc %p :0x%x :req = %p :tag = %d\n", snic_abort_cmd() 1617 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { snic_abort_cmd() 1618 SNIC_HOST_ERR(snic->shost, snic_abort_cmd() 1627 ret = snic_send_abort_and_wait(snic, sc); snic_abort_cmd() 1631 ret = snic_abort_finish(snic, sc); snic_abort_cmd() 1634 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, snic_abort_cmd() 1638 SNIC_SCSI_DBG(snic->shost, snic_abort_cmd() 1649 snic_is_abts_pending(struct snic *snic, struct scsi_cmnd *lr_sc) snic_is_abts_pending() argument 1662 for (tag = 0; tag < snic->max_tag_id; tag++) { snic_is_abts_pending() 1663 io_lock = snic_io_lock_tag(snic, tag); snic_is_abts_pending() 1666 sc = scsi_host_find_tag(snic->shost, tag); snic_is_abts_pending() 1685 SNIC_SCSI_DBG(snic->shost, "Found IO in %s on LUN\n", snic_is_abts_pending() 1701 snic_dr_clean_single_req(struct snic *snic, snic_dr_clean_single_req() argument 1714 io_lock = snic_io_lock_tag(snic, tag); snic_dr_clean_single_req() 1716 sc = scsi_host_find_tag(snic->shost, tag); snic_dr_clean_single_req() 1735 SNIC_SCSI_DBG(snic->shost, snic_dr_clean_single_req() 1742 SNIC_SCSI_DBG(snic->shost, snic_dr_clean_single_req() 1763 SNIC_SCSI_DBG(snic->shost, snic_dr_clean_single_req() 1778 ret = snic_queue_abort_req(snic, rqi, sc, tmf); snic_dr_clean_single_req() 1780 SNIC_HOST_ERR(snic->shost, snic_dr_clean_single_req() 1817 SNIC_HOST_ERR(snic->shost, snic_dr_clean_single_req() 1831 snic_release_req_buf(snic, rqi, sc); snic_dr_clean_single_req() 1844 snic_dr_clean_pending_req(struct snic *snic, struct scsi_cmnd *lr_sc) snic_dr_clean_pending_req() argument 1850 for (tag = 0; tag < snic->max_tag_id; tag++) { snic_dr_clean_pending_req() 1854 ret = snic_dr_clean_single_req(snic, tag, lr_sdev); snic_dr_clean_pending_req() 1856 SNIC_HOST_ERR(snic->shost, "clean_err:tag = %d\n", tag); snic_dr_clean_pending_req() 1865 if (snic_is_abts_pending(snic, lr_sc)) { snic_dr_clean_pending_req() 1872 SNIC_SCSI_DBG(snic->shost, "clean_pending_req: Success.\n"); snic_dr_clean_pending_req() 1878 SNIC_HOST_ERR(snic->shost, snic_dr_clean_pending_req() 1890 snic_dr_finish(struct snic *snic, struct scsi_cmnd *sc) snic_dr_finish() argument 1898 io_lock = snic_io_lock_hash(snic, sc); snic_dr_finish() 1903 SNIC_SCSI_DBG(snic->shost, snic_dr_finish() 1918 SNIC_SCSI_DBG(snic->shost, snic_dr_finish() 1928 SNIC_SCSI_DBG(snic->shost, snic_dr_finish() 1935 SNIC_HOST_ERR(snic->shost, snic_dr_finish() 1952 ret = snic_dr_clean_pending_req(snic, sc); snic_dr_finish() 1955 SNIC_SCSI_DBG(snic->shost, snic_dr_finish() 1978 snic_release_req_buf(snic, rqi, sc); snic_dr_finish() 1985 snic_queue_dr_req(struct snic *snic, snic_queue_dr_req() argument 1992 return snic_issue_tm_req(snic, rqi, sc, SNIC_ITMF_LUN_RESET); snic_queue_dr_req() 1996 snic_send_dr_and_wait(struct snic *snic, struct scsi_cmnd *sc) snic_send_dr_and_wait() argument 2005 io_lock = snic_io_lock_hash(snic, sc); snic_send_dr_and_wait() 2010 SNIC_HOST_ERR(snic->shost, snic_send_dr_and_wait() 2025 SNIC_SCSI_DBG(snic->shost, "dr: TAG = %x\n", tag); snic_send_dr_and_wait() 2038 ret = snic_queue_dr_req(snic, rqi, sc); snic_send_dr_and_wait() 2040 SNIC_HOST_ERR(snic->shost, snic_send_dr_and_wait() 2085 snic_unlink_and_release_req(struct snic *snic, struct scsi_cmnd *sc, int flag) snic_unlink_and_release_req() argument 2092 io_lock = snic_io_lock_hash(snic, sc); snic_unlink_and_release_req() 2104 snic_release_req_buf(snic, rqi, sc); snic_unlink_and_release_req() 2106 SNIC_TRC(snic->shost->host_no, snic_cmd_tag(sc), (ulong) sc, snic_unlink_and_release_req() 2120 struct snic *snic = shost_priv(shost); snic_device_reset() local 2134 snic_unlink_and_release_req(snic, sc, SNIC_DEV_RST_NOTSUP); snic_device_reset() 2139 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { snic_device_reset() 2140 snic_unlink_and_release_req(snic, sc, 0); snic_device_reset() 2148 SNIC_HOST_INFO(snic->shost, snic_device_reset() 2151 rqi = snic_req_init(snic, 0); snic_device_reset() 2165 ret = snic_send_dr_and_wait(snic, sc); snic_device_reset() 2167 SNIC_HOST_ERR(snic->shost, snic_device_reset() 2171 snic_unlink_and_release_req(snic, sc, 0); snic_device_reset() 2176 ret = snic_dr_finish(snic, sc); snic_device_reset() 2179 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, snic_device_reset() 2183 SNIC_SCSI_DBG(snic->shost, snic_device_reset() 2201 snic_issue_hba_reset(struct snic *snic, struct scsi_cmnd *sc) snic_issue_hba_reset() argument 2210 rqi = snic_req_init(snic, 0); snic_issue_hba_reset() 2220 SNIC_HOST_INFO(snic->shost, "issu_hr:Host reset thru ioctl.\n"); snic_issue_hba_reset() 2226 io_lock = snic_io_lock_hash(snic, sc); snic_issue_hba_reset() 2232 snic->remove_wait = &wait; snic_issue_hba_reset() 2237 snic->config.hid, 0, (ulong) rqi); snic_issue_hba_reset() 2241 ret = snic_queue_wq_desc(snic, req, sizeof(*req)); snic_issue_hba_reset() 2243 SNIC_HOST_ERR(snic->shost, snic_issue_hba_reset() 2253 atomic64_inc(&snic->s_stats.reset.hba_resets); snic_issue_hba_reset() 2254 SNIC_HOST_INFO(snic->shost, "Queued HBA Reset Successfully.\n"); snic_issue_hba_reset() 2256 wait_for_completion_timeout(snic->remove_wait, snic_issue_hba_reset() 2259 if (snic_get_state(snic) == SNIC_FWRESET) { snic_issue_hba_reset() 2260 SNIC_HOST_ERR(snic->shost, "reset_cmpl: Reset Timedout.\n"); snic_issue_hba_reset() 2267 snic->remove_wait = NULL; snic_issue_hba_reset() 2273 snic_req_free(snic, rqi); snic_issue_hba_reset() 2281 snic->remove_wait = NULL; snic_issue_hba_reset() 2287 snic_req_free(snic, rqi); snic_issue_hba_reset() 2290 SNIC_HOST_ERR(snic->shost, snic_issue_hba_reset() 2300 struct snic *snic = shost_priv(shost); snic_reset() local 2305 /* Set snic state as SNIC_FWRESET*/ snic_reset() 2306 sv_state = snic_get_state(snic); snic_reset() 2308 spin_lock_irqsave(&snic->snic_lock, flags); snic_reset() 2309 if (snic_get_state(snic) == SNIC_FWRESET) { snic_reset() 2310 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_reset() 2319 snic_set_state(snic, SNIC_FWRESET); snic_reset() 2320 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_reset() 2324 while (atomic_read(&snic->ios_inflight)) snic_reset() 2327 ret = snic_issue_hba_reset(snic, sc); snic_reset() 2332 spin_lock_irqsave(&snic->snic_lock, flags); snic_reset() 2333 snic_set_state(snic, sv_state); snic_reset() 2334 spin_unlock_irqrestore(&snic->snic_lock, flags); snic_reset() 2335 atomic64_inc(&snic->s_stats.reset.hba_reset_fail); snic_reset() 2379 snic_cmpl_pending_tmreq(struct snic *snic, struct scsi_cmnd *sc) snic_cmpl_pending_tmreq() argument 2383 SNIC_SCSI_DBG(snic->shost, snic_cmpl_pending_tmreq() 2401 snic_scsi_cleanup(struct snic *snic, int ex_tag) snic_scsi_cleanup() argument 2410 SNIC_SCSI_DBG(snic->shost, "sc_clean: scsi cleanup.\n"); snic_scsi_cleanup() 2412 for (tag = 0; tag < snic->max_tag_id; tag++) { snic_scsi_cleanup() 2417 io_lock = snic_io_lock_tag(snic, tag); snic_scsi_cleanup() 2419 sc = scsi_host_find_tag(snic->shost, tag); snic_scsi_cleanup() 2431 snic_cmpl_pending_tmreq(snic, sc); snic_scsi_cleanup() 2444 SNIC_SCSI_DBG(snic->shost, snic_scsi_cleanup() 2453 SNIC_HOST_INFO(snic->shost, snic_scsi_cleanup() 2457 snic_release_req_buf(snic, rqi, sc); snic_scsi_cleanup() 2461 SNIC_HOST_INFO(snic->shost, snic_scsi_cleanup() 2466 snic_stats_update_io_cmpl(&snic->s_stats); snic_scsi_cleanup() 2469 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, snic_scsi_cleanup() 2480 snic_shutdown_scsi_cleanup(struct snic *snic) snic_shutdown_scsi_cleanup() argument 2482 SNIC_HOST_INFO(snic->shost, "Shutdown time SCSI Cleanup.\n"); snic_shutdown_scsi_cleanup() 2484 snic_scsi_cleanup(snic, SCSI_NO_TAG); snic_shutdown_scsi_cleanup() 2492 snic_internal_abort_io(struct snic *snic, struct scsi_cmnd *sc, int tmf) snic_internal_abort_io() argument 2500 io_lock = snic_io_lock_hash(snic, sc); snic_internal_abort_io() 2512 SNIC_SCSI_DBG(snic->shost, snic_internal_abort_io() 2521 SNIC_SCSI_DBG(snic->shost, snic_internal_abort_io() 2536 SNIC_SCSI_DBG(snic->shost, "internal_abts:dev rst sc %p\n", sc); snic_internal_abort_io() 2539 SNIC_SCSI_DBG(snic->shost, "internal_abts: Issuing abts tag %x\n", snic_internal_abort_io() 2544 ret = snic_queue_abort_req(snic, rqi, sc, tmf); snic_internal_abort_io() 2546 SNIC_HOST_ERR(snic->shost, snic_internal_abort_io() 2579 struct snic *snic = NULL; snic_tgt_scsi_abort_io() local 2589 snic = shost_priv(snic_tgt_to_shost(tgt)); snic_tgt_scsi_abort_io() 2590 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: Cleaning Pending IOs.\n"); snic_tgt_scsi_abort_io() 2597 for (tag = 0; tag < snic->max_tag_id; tag++) { snic_tgt_scsi_abort_io() 2598 io_lock = snic_io_lock_tag(snic, tag); snic_tgt_scsi_abort_io() 2601 sc = scsi_host_find_tag(snic->shost, tag); snic_tgt_scsi_abort_io() 2616 ret = snic_internal_abort_io(snic, sc, tmf); snic_tgt_scsi_abort_io() 2618 SNIC_HOST_ERR(snic->shost, snic_tgt_scsi_abort_io() 2629 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: abt_cnt = %d\n", abt_cnt); snic_tgt_scsi_abort_io()
|
H A D | snic_attrs.c | 21 #include "snic.h" 28 struct snic *snic = shost_priv(class_to_shost(dev)); snic_show_sym_name() local 30 return snprintf(buf, PAGE_SIZE, "%s\n", snic->name); snic_show_sym_name() 38 struct snic *snic = shost_priv(class_to_shost(dev)); snic_show_state() local 41 snic_state_str[snic_get_state(snic)]); snic_show_state() 57 struct snic *snic = shost_priv(class_to_shost(dev)); snic_show_link_state() local 59 if (snic->config.xpt_type == SNIC_DAS) snic_show_link_state() 60 snic->link_status = svnic_dev_link_status(snic->vdev); snic_show_link_state() 63 (snic->link_status) ? "Link Up" : "Link Down"); snic_show_link_state()
|
H A D | snic_debugfs.c | 22 #include "snic.h" 25 * snic_debugfs_init - Initialize debugfs for snic debug logging 40 de = debugfs_create_dir("snic", NULL); snic_debugfs_init() 66 * elements that are specific to snic 111 struct snic *snic = (struct snic *) filp->private_data; snic_reset_stats_read() local 115 len = sprintf(buf, "%u\n", snic->reset_stats); snic_reset_stats_read() 129 * resets cumulative stats of snic. 140 struct snic *snic = (struct snic *) filp->private_data; snic_reset_stats_write() local 141 struct snic_stats *stats = &snic->s_stats; snic_reset_stats_write() 160 snic->reset_stats = val; snic_reset_stats_write() 162 if (snic->reset_stats) { snic_reset_stats_write() 167 atomic64_set(&snic->io_cmpl_skip, snic_reset_stats_write() 182 SNIC_HOST_INFO(snic->shost, "Reset Op: Driver statistics.\n"); snic_reset_stats_write() 201 struct snic *snic = (struct snic *) sfp->private; snic_stats_show() local 202 struct snic_stats *stats = &snic->s_stats; snic_stats_show() 375 * per snic 378 * When debugfs is cofigured this routine sets up the stats file per snic 380 * to log per snic stats 383 snic_stats_debugfs_init(struct snic *snic) snic_stats_debugfs_init() argument 389 snprintf(name, sizeof(name), "host%d", snic->shost->host_no); snic_stats_debugfs_init() 402 snic->stats_host = de; snic_stats_debugfs_init() 406 snic->stats_host, snic_stats_debugfs_init() 407 snic, snic_stats_debugfs_init() 414 snic->stats_file = de; snic_stats_debugfs_init() 418 snic->stats_host, snic_stats_debugfs_init() 419 snic, snic_stats_debugfs_init() 427 snic->reset_stats_file = de; snic_stats_debugfs_init() 438 * elements that are specific to to snic stats 441 snic_stats_debugfs_remove(struct snic *snic) snic_stats_debugfs_remove() argument 443 debugfs_remove(snic->stats_file); snic_stats_debugfs_remove() 444 snic->stats_file = NULL; snic_stats_debugfs_remove() 446 debugfs_remove(snic->reset_stats_file); snic_stats_debugfs_remove() 447 snic->reset_stats_file = NULL; snic_stats_debugfs_remove() 449 debugfs_remove(snic->stats_host); snic_stats_debugfs_remove() 450 snic->stats_host = NULL; snic_stats_debugfs_remove() 515 SNIC_ERR("Debugfs root directory for snic doesn't exist.\n"); snic_trc_debugfs_init()
|
H A D | snic_io.h | 25 /* SG descriptor for snic */ 68 struct snic; 88 struct snic *snic; /* Associated snic */ member in struct:snic_req_info 110 snic_req_init(struct snic *, int sg_cnt); 111 void snic_req_free(struct snic *, struct snic_req_info *); 112 void snic_calc_io_process_time(struct snic *, struct snic_req_info *); 113 void snic_pci_unmap_rsp_buf(struct snic *, struct snic_req_info *); 115 snic_abort_req_init(struct snic *, struct snic_req_info *); 117 snic_dr_req_init(struct snic *, struct snic_req_info *);
|
H A D | snic.h | 42 #define SNIC_DRV_NAME "snic" 123 /* snic module params */ 126 /* snic debugging */ 248 struct completion *wait; /* protected by snic lock*/ 261 * snic structure to represent SCSI vNIC 263 struct snic { struct 264 /* snic specific members */ 306 /* Maintain snic specific commands, cmds with no tag in spl_cmd_list */ 333 struct dentry *stats_host; /* Per snic debugfs root */ 334 struct dentry *stats_file; /* Per snic debugfs file */ 335 struct dentry *reset_stats_file;/* Per snic reset stats file */ 347 }; /* end of snic structure */ 382 void snic_shutdown_scsi_cleanup(struct snic *); 385 int snic_request_intr(struct snic *); 386 void snic_free_intr(struct snic *); 387 int snic_set_intr_mode(struct snic *); 388 void snic_clear_intr_mode(struct snic *); 390 int snic_fwcq_cmpl_handler(struct snic *, int); 391 int snic_wq_cmpl_handler(struct snic *, int); 395 void snic_log_q_error(struct snic *); 396 void snic_handle_link_event(struct snic *); 399 int snic_queue_exch_ver_req(struct snic *); 400 int snic_io_exch_ver_cmpl_handler(struct snic *, struct snic_fw_req *); 402 int snic_queue_wq_desc(struct snic *, void *os_buf, u16 len); 404 void snic_handle_untagged_req(struct snic *, struct snic_req_info *); 405 void snic_release_untagged_req(struct snic *, struct snic_req_info *); 406 void snic_free_all_untagged_reqs(struct snic *); 407 int snic_get_conf(struct snic *); 408 void snic_set_state(struct snic *, enum snic_state); 409 int snic_get_state(struct snic *);
|
H A D | snic_disc.h | 30 struct snic; 41 void (*cb)(struct snic *); 67 /* snic tgt flags */ 87 int snic_disc_start(struct snic *); 88 void snic_disc_term(struct snic *); 89 int snic_report_tgt_cmpl_handler(struct snic *, struct snic_fw_req *); 90 int snic_tgtinfo_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq); 95 void snic_tgt_del_all(struct snic *);
|
H A D | snic_res.h | 89 struct snic; 91 int snic_get_vnic_config(struct snic *); 92 int snic_alloc_vnic_res(struct snic *); 93 void snic_free_vnic_res(struct snic *); 94 void snic_get_res_counts(struct snic *); 95 void snic_log_q_error(struct snic *); 96 int snic_get_vnic_resources_size(struct snic *);
|
H A D | snic_stats.h | 56 atomic64_t snic_resets; /* snic resets */ 57 atomic64_t snic_reset_compl; /* snic reset completions */ 58 atomic64_t snic_reset_fail; /* snic reset failures */ 96 int snic_stats_debugfs_init(struct snic *); 97 void snic_stats_debugfs_remove(struct snic *);
|
H A D | snic_trc.c | 24 #include "snic.h" 119 * snic_trc_init() : Configures Trace Functionality for snic.
|
H A D | snic_fwint.h | 315 __le32 req_id; /* Command id of snic req to be aborted */ 354 * used for requesting firmware to reset snic 422 * Basic structure for all snic requests that are sent from the host to 488 * Auxillary macro to verify specific snic req/cmpl structures
|
/linux-4.4.14/drivers/net/ethernet/cavium/thunder/ |
H A D | nicvf_ethtool.c | 238 struct nicvf *snic; nicvf_get_sset_count() local 240 snic = nic->snicvf[sqs]; nicvf_get_sset_count() 241 if (!snic) nicvf_get_sset_count() 244 (snic->qs->rq_cnt + snic->qs->sq_cnt); nicvf_get_sset_count()
|
/linux-4.4.14/drivers/scsi/ |
H A D | Makefile | 42 obj-$(CONFIG_SCSI_SNIC) += snic/
|