Lines Matching full:hba

22 static u32 bnx2fc_alloc_conn_id(struct bnx2fc_hba *hba,
24 static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
26 static void bnx2fc_free_session_resc(struct bnx2fc_hba *hba,
28 static void bnx2fc_free_conn_id(struct bnx2fc_hba *hba, u32 conn_id);
86 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_offload_session() local
100 rval = bnx2fc_alloc_session_resc(hba, tgt); in bnx2fc_offload_session()
157 bnx2fc_free_session_resc(hba, tgt); in bnx2fc_offload_session()
160 bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id); in bnx2fc_offload_session()
293 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_upload_session() local
299 * Called with hba->hba_mutex held. in bnx2fc_upload_session()
324 bnx2fc_send_session_destroy_req(hba, tgt); in bnx2fc_upload_session()
344 bnx2fc_free_session_resc(hba, tgt); in bnx2fc_upload_session()
345 bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id); in bnx2fc_upload_session()
355 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_init_tgt() local
363 if (hba->num_ofld_sess >= BNX2FC_NUM_MAX_SESS) { in bnx2fc_init_tgt()
369 tgt->fcoe_conn_id = bnx2fc_alloc_conn_id(hba, tgt); in bnx2fc_init_tgt()
443 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_rport_event_handler() local
483 * Offload process is protected with hba mutex. in bnx2fc_rport_event_handler()
486 mutex_lock(&hba->hba_mutex); in bnx2fc_rport_event_handler()
492 mutex_unlock(&hba->hba_mutex); in bnx2fc_rport_event_handler()
503 hba->num_ofld_sess); in bnx2fc_rport_event_handler()
508 /* This counter is protected with hba mutex */ in bnx2fc_rport_event_handler()
509 hba->num_ofld_sess++; in bnx2fc_rport_event_handler()
521 mutex_unlock(&hba->hba_mutex); in bnx2fc_rport_event_handler()
536 mutex_lock(&hba->hba_mutex); in bnx2fc_rport_event_handler()
544 mutex_unlock(&hba->hba_mutex); in bnx2fc_rport_event_handler()
550 hba->num_ofld_sess--; in bnx2fc_rport_event_handler()
552 hba->num_ofld_sess); in bnx2fc_rport_event_handler()
557 if ((hba->wait_for_link_down) && in bnx2fc_rport_event_handler()
558 (hba->num_ofld_sess == 0)) { in bnx2fc_rport_event_handler()
559 wake_up_interruptible(&hba->shutdown_wait); in bnx2fc_rport_event_handler()
561 mutex_unlock(&hba->hba_mutex); in bnx2fc_rport_event_handler()
580 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_tgt_lookup() local
586 tgt = hba->tgt_ofld_list[i]; in bnx2fc_tgt_lookup()
610 * @hba: pointer to adapter structure
613 static u32 bnx2fc_alloc_conn_id(struct bnx2fc_hba *hba, in bnx2fc_alloc_conn_id() argument
618 /* called with hba mutex held */ in bnx2fc_alloc_conn_id()
622 * both hba mutex and hba lock. Atleast hba mutex or in bnx2fc_alloc_conn_id()
623 * hba lock needs to be held for read access. in bnx2fc_alloc_conn_id()
626 spin_lock_bh(&hba->hba_lock); in bnx2fc_alloc_conn_id()
627 next = hba->next_conn_id; in bnx2fc_alloc_conn_id()
628 conn_id = hba->next_conn_id++; in bnx2fc_alloc_conn_id()
629 if (hba->next_conn_id == BNX2FC_NUM_MAX_SESS) in bnx2fc_alloc_conn_id()
630 hba->next_conn_id = 0; in bnx2fc_alloc_conn_id()
632 while (hba->tgt_ofld_list[conn_id] != NULL) { in bnx2fc_alloc_conn_id()
639 spin_unlock_bh(&hba->hba_lock); in bnx2fc_alloc_conn_id()
643 hba->tgt_ofld_list[conn_id] = tgt; in bnx2fc_alloc_conn_id()
645 spin_unlock_bh(&hba->hba_lock); in bnx2fc_alloc_conn_id()
649 static void bnx2fc_free_conn_id(struct bnx2fc_hba *hba, u32 conn_id) in bnx2fc_free_conn_id() argument
651 /* called with hba mutex held */ in bnx2fc_free_conn_id()
652 spin_lock_bh(&hba->hba_lock); in bnx2fc_free_conn_id()
653 hba->tgt_ofld_list[conn_id] = NULL; in bnx2fc_free_conn_id()
654 spin_unlock_bh(&hba->hba_lock); in bnx2fc_free_conn_id()
660 static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, in bnx2fc_alloc_session_resc() argument
672 tgt->sq = dma_alloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size, in bnx2fc_alloc_session_resc()
685 tgt->cq = dma_alloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size, in bnx2fc_alloc_session_resc()
698 tgt->rq = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size, in bnx2fc_alloc_session_resc()
710 tgt->rq_pbl = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size, in bnx2fc_alloc_session_resc()
735 tgt->xferq = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_alloc_session_resc()
749 tgt->confq = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_alloc_session_resc()
763 tgt->confq_pbl = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_alloc_session_resc()
787 tgt->conn_db = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_alloc_session_resc()
802 tgt->lcq = dma_alloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size, in bnx2fc_alloc_session_resc()
822 * @hba: adapter structure pointer
827 static void bnx2fc_free_session_resc(struct bnx2fc_hba *hba, in bnx2fc_free_session_resc() argument
839 dma_free_coherent(&hba->pcidev->dev, tgt->lcq_mem_size, in bnx2fc_free_session_resc()
845 dma_free_coherent(&hba->pcidev->dev, tgt->conn_db_mem_size, in bnx2fc_free_session_resc()
851 dma_free_coherent(&hba->pcidev->dev, tgt->confq_pbl_size, in bnx2fc_free_session_resc()
856 dma_free_coherent(&hba->pcidev->dev, tgt->confq_mem_size, in bnx2fc_free_session_resc()
862 dma_free_coherent(&hba->pcidev->dev, tgt->xferq_mem_size, in bnx2fc_free_session_resc()
868 dma_free_coherent(&hba->pcidev->dev, tgt->rq_pbl_size, in bnx2fc_free_session_resc()
873 dma_free_coherent(&hba->pcidev->dev, tgt->rq_mem_size, in bnx2fc_free_session_resc()
879 dma_free_coherent(&hba->pcidev->dev, tgt->cq_mem_size, in bnx2fc_free_session_resc()
885 dma_free_coherent(&hba->pcidev->dev, tgt->sq_mem_size, in bnx2fc_free_session_resc()