Lines Matching refs:p_spq

197 				  struct qed_spq *p_spq)  in qed_spq_hw_initialize()  argument
204 cxt_info.iid = p_spq->cid; in qed_spq_hw_initialize()
210 p_spq->cid); in qed_spq_hw_initialize()
228 DMA_LO_LE(p_spq->chain.p_phys_addr); in qed_spq_hw_initialize()
230 DMA_HI_LE(p_spq->chain.p_phys_addr); in qed_spq_hw_initialize()
234 struct qed_spq *p_spq, struct qed_spq_entry *p_ent) in qed_spq_hw_post() argument
236 struct qed_chain *p_chain = &p_hwfn->p_spq->chain; in qed_spq_hw_post()
237 struct core_db_data *p_db_data = &p_spq->db_data; in qed_spq_hw_post()
256 DOORBELL(p_hwfn, p_spq->db_addr_offset, *(u32 *)p_db_data); in qed_spq_hw_post()
263 p_spq->db_addr_offset, in qed_spq_hw_post()
264 p_spq->cid, in qed_spq_hw_post()
280 if (!p_hwfn->p_spq) in qed_async_event_completion()
291 cb = p_hwfn->p_spq->async_comp_cb[p_eqe->protocol_id]; in qed_async_event_completion()
310 if (!p_hwfn->p_spq || (protocol_id >= MAX_PROTOCOL_TYPE)) in qed_spq_register_async_cb()
313 p_hwfn->p_spq->async_comp_cb[protocol_id] = cb; in qed_spq_register_async_cb()
321 if (!p_hwfn->p_spq || (protocol_id >= MAX_PROTOCOL_TYPE)) in qed_spq_unregister_async_cb()
324 p_hwfn->p_spq->async_comp_cb[protocol_id] = NULL; in qed_spq_unregister_async_cb()
390 spin_lock_bh(&p_hwfn->p_spq->lock); in qed_eq_completion()
392 spin_unlock_bh(&p_hwfn->p_spq->lock); in qed_eq_completion()
485 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_setup() local
493 INIT_LIST_HEAD(&p_spq->pending); in qed_spq_setup()
494 INIT_LIST_HEAD(&p_spq->completion_pending); in qed_spq_setup()
495 INIT_LIST_HEAD(&p_spq->free_pool); in qed_spq_setup()
496 INIT_LIST_HEAD(&p_spq->unlimited_pending); in qed_spq_setup()
497 spin_lock_init(&p_spq->lock); in qed_spq_setup()
500 p_phys = p_spq->p_phys + offsetof(struct qed_spq_entry, ramrod); in qed_spq_setup()
501 p_virt = p_spq->p_virt; in qed_spq_setup()
503 capacity = qed_chain_get_capacity(&p_spq->chain); in qed_spq_setup()
507 list_add_tail(&p_virt->list, &p_spq->free_pool); in qed_spq_setup()
514 p_spq->normal_count = 0; in qed_spq_setup()
515 p_spq->comp_count = 0; in qed_spq_setup()
516 p_spq->comp_sent_count = 0; in qed_spq_setup()
517 p_spq->unlimited_pending_count = 0; in qed_spq_setup()
519 bitmap_zero(p_spq->p_comp_bitmap, SPQ_RING_SIZE); in qed_spq_setup()
520 p_spq->comp_bitmap_idx = 0; in qed_spq_setup()
523 qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_CORE, &p_spq->cid); in qed_spq_setup()
524 qed_spq_hw_initialize(p_hwfn, p_spq); in qed_spq_setup()
527 qed_chain_reset(&p_spq->chain); in qed_spq_setup()
530 p_spq->db_addr_offset = qed_db_addr(p_spq->cid, DQ_DEMS_LEGACY); in qed_spq_setup()
531 p_db_data = &p_spq->db_data; in qed_spq_setup()
541 p_spq->db_addr_offset); in qed_spq_setup()
542 rc = qed_db_recovery_add(p_hwfn->cdev, db_addr, &p_spq->db_data, in qed_spq_setup()
559 struct qed_spq *p_spq = NULL; in qed_spq_alloc() local
565 p_spq = kzalloc(sizeof(*p_spq), GFP_KERNEL); in qed_spq_alloc()
566 if (!p_spq) in qed_spq_alloc()
570 ret = qed_chain_alloc(cdev, &p_spq->chain, &params); in qed_spq_alloc()
577 capacity = qed_chain_get_capacity(&p_spq->chain); in qed_spq_alloc()
586 p_spq->p_virt = p_virt; in qed_spq_alloc()
587 p_spq->p_phys = p_phys; in qed_spq_alloc()
588 p_hwfn->p_spq = p_spq; in qed_spq_alloc()
593 qed_chain_free(cdev, &p_spq->chain); in qed_spq_alloc()
595 kfree(p_spq); in qed_spq_alloc()
602 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_free() local
606 if (!p_spq) in qed_spq_free()
611 p_spq->db_addr_offset); in qed_spq_free()
612 qed_db_recovery_del(p_hwfn->cdev, db_addr, &p_spq->db_data); in qed_spq_free()
614 if (p_spq->p_virt) { in qed_spq_free()
615 capacity = qed_chain_get_capacity(&p_spq->chain); in qed_spq_free()
619 p_spq->p_virt, p_spq->p_phys); in qed_spq_free()
622 qed_chain_free(p_hwfn->cdev, &p_spq->chain); in qed_spq_free()
623 kfree(p_spq); in qed_spq_free()
624 p_hwfn->p_spq = NULL; in qed_spq_free()
629 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_get_entry() local
633 spin_lock_bh(&p_spq->lock); in qed_spq_get_entry()
635 if (list_empty(&p_spq->free_pool)) { in qed_spq_get_entry()
643 p_ent->queue = &p_spq->unlimited_pending; in qed_spq_get_entry()
645 p_ent = list_first_entry(&p_spq->free_pool, in qed_spq_get_entry()
648 p_ent->queue = &p_spq->pending; in qed_spq_get_entry()
654 spin_unlock_bh(&p_spq->lock); in qed_spq_get_entry()
662 list_add_tail(&p_ent->list, &p_hwfn->p_spq->free_pool); in __qed_spq_return_entry()
667 spin_lock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
669 spin_unlock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
690 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_add_entry() local
692 if (p_ent->queue == &p_spq->unlimited_pending) { in qed_spq_add_entry()
693 if (list_empty(&p_spq->free_pool)) { in qed_spq_add_entry()
694 list_add_tail(&p_ent->list, &p_spq->unlimited_pending); in qed_spq_add_entry()
695 p_spq->unlimited_pending_count++; in qed_spq_add_entry()
701 p_en2 = list_first_entry(&p_spq->free_pool, in qed_spq_add_entry()
726 list_add_tail(&p_ent->list, &p_spq->pending); in qed_spq_add_entry()
727 p_spq->normal_count++; in qed_spq_add_entry()
730 list_add(&p_ent->list, &p_spq->pending); in qed_spq_add_entry()
731 p_spq->high_count++; in qed_spq_add_entry()
745 if (!p_hwfn->p_spq) in qed_spq_get_cid()
747 return p_hwfn->p_spq->cid; in qed_spq_get_cid()
756 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_post_list() local
759 while (qed_chain_get_elem_left(&p_spq->chain) > keep_reserve && in qed_spq_post_list()
763 list_move_tail(&p_ent->list, &p_spq->completion_pending); in qed_spq_post_list()
764 p_spq->comp_sent_count++; in qed_spq_post_list()
766 rc = qed_spq_hw_post(p_hwfn, p_spq, p_ent); in qed_spq_post_list()
779 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_pend_post() local
782 while (!list_empty(&p_spq->free_pool)) { in qed_spq_pend_post()
783 if (list_empty(&p_spq->unlimited_pending)) in qed_spq_pend_post()
786 p_ent = list_first_entry(&p_spq->unlimited_pending, in qed_spq_pend_post()
796 return qed_spq_post_list(p_hwfn, &p_spq->pending, in qed_spq_pend_post()
818 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_comp_bmap_update() local
820 __set_bit(pos, p_spq->p_comp_bitmap); in qed_spq_comp_bmap_update()
821 while (test_bit(p_spq->comp_bitmap_idx, in qed_spq_comp_bmap_update()
822 p_spq->p_comp_bitmap)) { in qed_spq_comp_bmap_update()
823 __clear_bit(p_spq->comp_bitmap_idx, in qed_spq_comp_bmap_update()
824 p_spq->p_comp_bitmap); in qed_spq_comp_bmap_update()
825 p_spq->comp_bitmap_idx++; in qed_spq_comp_bmap_update()
826 qed_chain_return_produced(&p_spq->chain); in qed_spq_comp_bmap_update()
834 struct qed_spq *p_spq = p_hwfn ? p_hwfn->p_spq : NULL; in qed_spq_post() local
864 spin_lock_bh(&p_spq->lock); in qed_spq_post()
890 spin_unlock_bh(&p_spq->lock); in qed_spq_post()
899 p_ent->queue == &p_spq->unlimited_pending); in qed_spq_post()
901 if (p_ent->queue == &p_spq->unlimited_pending) { in qed_spq_post()
919 spin_lock_bh(&p_spq->lock); in qed_spq_post()
927 spin_unlock_bh(&p_spq->lock); in qed_spq_post()
937 struct qed_spq *p_spq; in qed_spq_completion() local
945 p_spq = p_hwfn->p_spq; in qed_spq_completion()
946 if (!p_spq) in qed_spq_completion()
949 spin_lock_bh(&p_spq->lock); in qed_spq_completion()
950 list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, list) { in qed_spq_completion()
954 p_spq->comp_count++; in qed_spq_completion()
971 spin_unlock_bh(&p_spq->lock); in qed_spq_completion()