Lines Matching refs:snic
25 struct snic *snic = svnic_dev_priv(wq->vdev); in snic_wq_cmpl_frame_send() local
30 SNIC_HOST_INFO(snic->shost, in snic_wq_cmpl_frame_send()
34 SNIC_TRC(snic->shost->host_no, 0, 0, in snic_wq_cmpl_frame_send()
49 struct snic *snic = svnic_dev_priv(vdev); in snic_wq_cmpl_handler_cont() local
54 spin_lock_irqsave(&snic->wq_lock[q_num], flags); in snic_wq_cmpl_handler_cont()
55 svnic_wq_service(&snic->wq[q_num], in snic_wq_cmpl_handler_cont()
60 spin_unlock_irqrestore(&snic->wq_lock[q_num], flags); in snic_wq_cmpl_handler_cont()
66 snic_wq_cmpl_handler(struct snic *snic, int work_to_do) in snic_wq_cmpl_handler() argument
71 snic->s_stats.misc.last_ack_time = jiffies; in snic_wq_cmpl_handler()
72 for (i = 0; i < snic->wq_count; i++) { in snic_wq_cmpl_handler()
73 work_done += svnic_cq_service(&snic->cq[i], in snic_wq_cmpl_handler()
87 struct snic *snic = svnic_dev_priv(wq->vdev); in snic_free_wq_buf() local
91 dma_unmap_single(&snic->pdev->dev, buf->dma_addr, buf->len, in snic_free_wq_buf()
95 spin_lock_irqsave(&snic->spl_cmd_lock, flags); in snic_free_wq_buf()
97 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); in snic_free_wq_buf()
103 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); in snic_free_wq_buf()
106 snic_pci_unmap_rsp_buf(snic, rqi); in snic_free_wq_buf()
110 snic_req_free(snic, rqi); in snic_free_wq_buf()
111 SNIC_HOST_INFO(snic->shost, "snic_free_wq_buf .. freed.\n"); in snic_free_wq_buf()
119 snic_select_wq(struct snic *snic) in snic_select_wq() argument
128 snic_wqdesc_avail(struct snic *snic, int q_num, int req_type) in snic_wqdesc_avail() argument
130 int nr_wqdesc = snic->config.wq_enet_desc_count; in snic_wqdesc_avail()
137 SNIC_HOST_INFO(snic->shost, "desc_avail: Multi Queue case.\n"); in snic_wqdesc_avail()
143 nr_wqdesc -= atomic64_read(&snic->s_stats.fw.actv_reqs); in snic_wqdesc_avail()
149 snic_queue_wq_desc(struct snic *snic, void *os_buf, u16 len) in snic_queue_wq_desc() argument
153 struct snic_fw_stats *fwstats = &snic->s_stats.fw; in snic_queue_wq_desc()
162 pa = dma_map_single(&snic->pdev->dev, os_buf, len, DMA_TO_DEVICE); in snic_queue_wq_desc()
163 if (dma_mapping_error(&snic->pdev->dev, pa)) { in snic_queue_wq_desc()
164 SNIC_HOST_ERR(snic->shost, "qdesc: PCI DMA Mapping Fail.\n"); in snic_queue_wq_desc()
171 q_num = snic_select_wq(snic); in snic_queue_wq_desc()
173 spin_lock_irqsave(&snic->wq_lock[q_num], flags); in snic_queue_wq_desc()
174 desc_avail = snic_wqdesc_avail(snic, q_num, req->hdr.type); in snic_queue_wq_desc()
176 dma_unmap_single(&snic->pdev->dev, pa, len, DMA_TO_DEVICE); in snic_queue_wq_desc()
178 spin_unlock_irqrestore(&snic->wq_lock[q_num], flags); in snic_queue_wq_desc()
179 atomic64_inc(&snic->s_stats.misc.wq_alloc_fail); in snic_queue_wq_desc()
180 SNIC_DBG("host = %d, WQ is Full\n", snic->shost->host_no); in snic_queue_wq_desc()
185 snic_queue_wq_eth_desc(&snic->wq[q_num], os_buf, pa, len, 0, 0, 1); in snic_queue_wq_desc()
191 spin_unlock_irqrestore(&snic->wq_lock[q_num], flags); in snic_queue_wq_desc()
204 snic_handle_untagged_req(struct snic *snic, struct snic_req_info *rqi) in snic_handle_untagged_req() argument
210 spin_lock_irqsave(&snic->spl_cmd_lock, flags); in snic_handle_untagged_req()
211 list_add_tail(&rqi->list, &snic->spl_cmd_list); in snic_handle_untagged_req()
212 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); in snic_handle_untagged_req()
220 snic_req_init(struct snic *snic, int sg_cnt) in snic_req_init() argument
228 rqi = mempool_alloc(snic->req_pool[typ], GFP_ATOMIC); in snic_req_init()
230 atomic64_inc(&snic->s_stats.io.alloc_fail); in snic_req_init()
231 SNIC_HOST_ERR(snic->shost, in snic_req_init()
242 rqi->snic = snic; in snic_req_init()
251 if (sg_cnt > atomic64_read(&snic->s_stats.io.max_sgl)) in snic_req_init()
252 atomic64_set(&snic->s_stats.io.max_sgl, sg_cnt); in snic_req_init()
255 atomic64_inc(&snic->s_stats.io.sgl_cnt[sg_cnt - 1]); in snic_req_init()
263 SNIC_SCSI_DBG(snic->shost, "Req_alloc:rqi = %p allocatd.\n", rqi); in snic_req_init()
272 snic_abort_req_init(struct snic *snic, struct snic_req_info *rqi) in snic_abort_req_init() argument
283 req = mempool_alloc(snic->req_pool[SNIC_REQ_TM_CACHE], GFP_ATOMIC); in snic_abort_req_init()
285 SNIC_HOST_ERR(snic->shost, "abts:Failed to alloc tm req.\n"); in snic_abort_req_init()
303 snic_dr_req_init(struct snic *snic, struct snic_req_info *rqi) in snic_dr_req_init() argument
309 req = mempool_alloc(snic->req_pool[SNIC_REQ_TM_CACHE], GFP_ATOMIC); in snic_dr_req_init()
311 SNIC_HOST_ERR(snic->shost, "dr:Failed to alloc tm req.\n"); in snic_dr_req_init()
328 snic_req_free(struct snic *snic, struct snic_req_info *rqi) in snic_req_free() argument
334 SNIC_SCSI_DBG(snic->shost, in snic_req_free()
340 dma_unmap_single(&snic->pdev->dev, in snic_req_free()
345 mempool_free(rqi->abort_req, snic->req_pool[SNIC_REQ_TM_CACHE]); in snic_req_free()
350 dma_unmap_single(&snic->pdev->dev, in snic_req_free()
355 mempool_free(rqi->dr_req, snic->req_pool[SNIC_REQ_TM_CACHE]); in snic_req_free()
359 dma_unmap_single(&snic->pdev->dev, in snic_req_free()
364 mempool_free(rqi, snic->req_pool[rqi->rq_pool_type]); in snic_req_free()
368 snic_pci_unmap_rsp_buf(struct snic *snic, struct snic_req_info *rqi) in snic_pci_unmap_rsp_buf() argument
374 dma_unmap_single(&snic->pdev->dev, in snic_pci_unmap_rsp_buf()
384 snic_free_all_untagged_reqs(struct snic *snic) in snic_free_all_untagged_reqs() argument
390 spin_lock_irqsave(&snic->spl_cmd_lock, flags); in snic_free_all_untagged_reqs()
391 list_for_each_safe(cur, nxt, &snic->spl_cmd_list) { in snic_free_all_untagged_reqs()
395 snic_pci_unmap_rsp_buf(snic, rqi); in snic_free_all_untagged_reqs()
400 snic_req_free(snic, rqi); in snic_free_all_untagged_reqs()
402 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); in snic_free_all_untagged_reqs()
409 snic_release_untagged_req(struct snic *snic, struct snic_req_info *rqi) in snic_release_untagged_req() argument
413 spin_lock_irqsave(&snic->snic_lock, flags); in snic_release_untagged_req()
414 if (snic->in_remove) { in snic_release_untagged_req()
415 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_release_untagged_req()
418 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_release_untagged_req()
420 spin_lock_irqsave(&snic->spl_cmd_lock, flags); in snic_release_untagged_req()
422 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); in snic_release_untagged_req()
426 spin_unlock_irqrestore(&snic->spl_cmd_lock, flags); in snic_release_untagged_req()
427 snic_req_free(snic, rqi); in snic_release_untagged_req()
547 snic_calc_io_process_time(struct snic *snic, struct snic_req_info *rqi) in snic_calc_io_process_time() argument
553 if (duration > atomic64_read(&snic->s_stats.io.max_time)) in snic_calc_io_process_time()
554 atomic64_set(&snic->s_stats.io.max_time, duration); in snic_calc_io_process_time()