Lines Matching refs:p_spq
214 struct qed_spq *p_spq) in qed_spq_hw_initialize() argument
221 cxt_info.iid = p_spq->cid; in qed_spq_hw_initialize()
227 p_spq->cid); in qed_spq_hw_initialize()
245 DMA_LO_LE(p_spq->chain.p_phys_addr); in qed_spq_hw_initialize()
247 DMA_HI_LE(p_spq->chain.p_phys_addr); in qed_spq_hw_initialize()
254 struct qed_spq *p_spq, struct qed_spq_entry *p_ent) in qed_spq_hw_post() argument
256 struct qed_chain *p_chain = &p_hwfn->p_spq->chain; in qed_spq_hw_post()
282 DOORBELL(p_hwfn, qed_db_addr(p_spq->cid, DQ_DEMS_LEGACY), *(u32 *)&db); in qed_spq_hw_post()
289 qed_db_addr(p_spq->cid, DQ_DEMS_LEGACY), in qed_spq_hw_post()
290 p_spq->cid, db.params, db.agg_flags, in qed_spq_hw_post()
305 if (!p_hwfn->p_spq || (p_eqe->protocol_id >= MAX_PROTOCOL_TYPE)) in qed_async_event_completion()
308 cb = p_hwfn->p_spq->async_comp_cb[p_eqe->protocol_id]; in qed_async_event_completion()
325 if (!p_hwfn->p_spq || (protocol_id >= MAX_PROTOCOL_TYPE)) in qed_spq_register_async_cb()
328 p_hwfn->p_spq->async_comp_cb[protocol_id] = cb; in qed_spq_register_async_cb()
336 if (!p_hwfn->p_spq || (protocol_id >= MAX_PROTOCOL_TYPE)) in qed_spq_unregister_async_cb()
339 p_hwfn->p_spq->async_comp_cb[protocol_id] = NULL; in qed_spq_unregister_async_cb()
493 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_setup() local
498 INIT_LIST_HEAD(&p_spq->pending); in qed_spq_setup()
499 INIT_LIST_HEAD(&p_spq->completion_pending); in qed_spq_setup()
500 INIT_LIST_HEAD(&p_spq->free_pool); in qed_spq_setup()
501 INIT_LIST_HEAD(&p_spq->unlimited_pending); in qed_spq_setup()
502 spin_lock_init(&p_spq->lock); in qed_spq_setup()
505 p_phys = p_spq->p_phys + offsetof(struct qed_spq_entry, ramrod); in qed_spq_setup()
506 p_virt = p_spq->p_virt; in qed_spq_setup()
508 capacity = qed_chain_get_capacity(&p_spq->chain); in qed_spq_setup()
512 list_add_tail(&p_virt->list, &p_spq->free_pool); in qed_spq_setup()
519 p_spq->normal_count = 0; in qed_spq_setup()
520 p_spq->comp_count = 0; in qed_spq_setup()
521 p_spq->comp_sent_count = 0; in qed_spq_setup()
522 p_spq->unlimited_pending_count = 0; in qed_spq_setup()
524 bitmap_zero(p_spq->p_comp_bitmap, SPQ_RING_SIZE); in qed_spq_setup()
525 p_spq->comp_bitmap_idx = 0; in qed_spq_setup()
528 qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_CORE, &p_spq->cid); in qed_spq_setup()
529 qed_spq_hw_initialize(p_hwfn, p_spq); in qed_spq_setup()
532 qed_chain_reset(&p_spq->chain); in qed_spq_setup()
538 struct qed_spq *p_spq = NULL; in qed_spq_alloc() local
543 p_spq = kzalloc(sizeof(struct qed_spq), GFP_KERNEL); in qed_spq_alloc()
544 if (!p_spq) in qed_spq_alloc()
554 &p_spq->chain, NULL)) in qed_spq_alloc()
558 capacity = qed_chain_get_capacity(&p_spq->chain); in qed_spq_alloc()
565 p_spq->p_virt = p_virt; in qed_spq_alloc()
566 p_spq->p_phys = p_phys; in qed_spq_alloc()
567 p_hwfn->p_spq = p_spq; in qed_spq_alloc()
572 qed_chain_free(p_hwfn->cdev, &p_spq->chain); in qed_spq_alloc()
573 kfree(p_spq); in qed_spq_alloc()
579 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_free() local
582 if (!p_spq) in qed_spq_free()
585 if (p_spq->p_virt) { in qed_spq_free()
586 capacity = qed_chain_get_capacity(&p_spq->chain); in qed_spq_free()
590 p_spq->p_virt, p_spq->p_phys); in qed_spq_free()
593 qed_chain_free(p_hwfn->cdev, &p_spq->chain); in qed_spq_free()
594 kfree(p_spq); in qed_spq_free()
595 p_hwfn->p_spq = NULL; in qed_spq_free()
600 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_get_entry() local
604 spin_lock_bh(&p_spq->lock); in qed_spq_get_entry()
606 if (list_empty(&p_spq->free_pool)) { in qed_spq_get_entry()
614 p_ent->queue = &p_spq->unlimited_pending; in qed_spq_get_entry()
616 p_ent = list_first_entry(&p_spq->free_pool, in qed_spq_get_entry()
619 p_ent->queue = &p_spq->pending; in qed_spq_get_entry()
625 spin_unlock_bh(&p_spq->lock); in qed_spq_get_entry()
633 list_add_tail(&p_ent->list, &p_hwfn->p_spq->free_pool); in __qed_spq_return_entry()
638 spin_lock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
640 spin_unlock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
661 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_add_entry() local
663 if (p_ent->queue == &p_spq->unlimited_pending) { in qed_spq_add_entry()
665 if (list_empty(&p_spq->free_pool)) { in qed_spq_add_entry()
666 list_add_tail(&p_ent->list, &p_spq->unlimited_pending); in qed_spq_add_entry()
667 p_spq->unlimited_pending_count++; in qed_spq_add_entry()
673 p_en2 = list_first_entry(&p_spq->free_pool, in qed_spq_add_entry()
696 list_add_tail(&p_ent->list, &p_spq->pending); in qed_spq_add_entry()
697 p_spq->normal_count++; in qed_spq_add_entry()
700 list_add(&p_ent->list, &p_spq->pending); in qed_spq_add_entry()
701 p_spq->high_count++; in qed_spq_add_entry()
715 if (!p_hwfn->p_spq) in qed_spq_get_cid()
717 return p_hwfn->p_spq->cid; in qed_spq_get_cid()
726 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_post_list() local
729 while (qed_chain_get_elem_left(&p_spq->chain) > keep_reserve && in qed_spq_post_list()
734 list_add_tail(&p_ent->list, &p_spq->completion_pending); in qed_spq_post_list()
735 p_spq->comp_sent_count++; in qed_spq_post_list()
737 rc = qed_spq_hw_post(p_hwfn, p_spq, p_ent); in qed_spq_post_list()
750 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_pend_post() local
753 while (!list_empty(&p_spq->free_pool)) { in qed_spq_pend_post()
754 if (list_empty(&p_spq->unlimited_pending)) in qed_spq_pend_post()
757 p_ent = list_first_entry(&p_spq->unlimited_pending, in qed_spq_pend_post()
767 return qed_spq_post_list(p_hwfn, &p_spq->pending, in qed_spq_pend_post()
775 struct qed_spq *p_spq = p_hwfn ? p_hwfn->p_spq : NULL; in qed_spq_post() local
790 spin_lock_bh(&p_spq->lock); in qed_spq_post()
816 spin_unlock_bh(&p_spq->lock); in qed_spq_post()
825 p_ent->queue == &p_spq->unlimited_pending); in qed_spq_post()
827 if (p_ent->queue == &p_spq->unlimited_pending) { in qed_spq_post()
844 spin_lock_bh(&p_spq->lock); in qed_spq_post()
846 qed_chain_return_produced(&p_spq->chain); in qed_spq_post()
852 spin_unlock_bh(&p_spq->lock); in qed_spq_post()
862 struct qed_spq *p_spq; in qed_spq_completion() local
871 p_spq = p_hwfn->p_spq; in qed_spq_completion()
872 if (!p_spq) in qed_spq_completion()
875 spin_lock_bh(&p_spq->lock); in qed_spq_completion()
876 list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, list) { in qed_spq_completion()
887 __set_bit(pos, p_spq->p_comp_bitmap); in qed_spq_completion()
889 while (test_bit(p_spq->comp_bitmap_idx, in qed_spq_completion()
890 p_spq->p_comp_bitmap)) { in qed_spq_completion()
891 __clear_bit(p_spq->comp_bitmap_idx, in qed_spq_completion()
892 p_spq->p_comp_bitmap); in qed_spq_completion()
893 p_spq->comp_bitmap_idx++; in qed_spq_completion()
894 qed_chain_return_produced(&p_spq->chain); in qed_spq_completion()
897 p_spq->comp_count++; in qed_spq_completion()
914 spin_unlock_bh(&p_spq->lock); in qed_spq_completion()
936 (found->queue == &p_spq->unlimited_pending)) in qed_spq_completion()
944 spin_lock_bh(&p_spq->lock); in qed_spq_completion()
946 spin_unlock_bh(&p_spq->lock); in qed_spq_completion()