Lines Matching refs:p_hwfn

48 static void qed_spq_blocking_cb(struct qed_hwfn *p_hwfn,  in qed_spq_blocking_cb()  argument
62 static int __qed_spq_block(struct qed_hwfn *p_hwfn, in __qed_spq_block() argument
90 static int qed_spq_block(struct qed_hwfn *p_hwfn, in qed_spq_block() argument
102 rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, false); in qed_spq_block()
108 rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true); in qed_spq_block()
112 p_ptt = qed_ptt_acquire(p_hwfn); in qed_spq_block()
114 DP_NOTICE(p_hwfn, "ptt, failed to acquire\n"); in qed_spq_block()
118 DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n"); in qed_spq_block()
119 rc = qed_mcp_drain(p_hwfn, p_ptt); in qed_spq_block()
120 qed_ptt_release(p_hwfn, p_ptt); in qed_spq_block()
122 DP_NOTICE(p_hwfn, "MCP drain failed\n"); in qed_spq_block()
127 rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true); in qed_spq_block()
138 p_ptt = qed_ptt_acquire(p_hwfn); in qed_spq_block()
141 qed_hw_err_notify(p_hwfn, p_ptt, QED_HW_ERR_RAMROD_FAIL, in qed_spq_block()
150 qed_ptt_release(p_hwfn, p_ptt); in qed_spq_block()
158 static int qed_spq_fill_entry(struct qed_hwfn *p_hwfn, in qed_spq_fill_entry() argument
171 DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n", in qed_spq_fill_entry()
176 DP_VERBOSE(p_hwfn, in qed_spq_fill_entry()
196 static void qed_spq_hw_initialize(struct qed_hwfn *p_hwfn, in qed_spq_hw_initialize() argument
206 rc = qed_cxt_get_cid_info(p_hwfn, &cxt_info); in qed_spq_hw_initialize()
209 DP_NOTICE(p_hwfn, "Cannot find context info for cid=%d\n", in qed_spq_hw_initialize()
224 physical_q = qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_LB); in qed_spq_hw_initialize()
233 static int qed_spq_hw_post(struct qed_hwfn *p_hwfn, in qed_spq_hw_post() argument
236 struct qed_chain *p_chain = &p_hwfn->p_spq->chain; in qed_spq_hw_post()
244 DP_NOTICE(p_hwfn, "Failed to produce from SPQ chain\n"); in qed_spq_hw_post()
256 DOORBELL(p_hwfn, p_spq->db_addr_offset, *(u32 *)p_db_data); in qed_spq_hw_post()
261 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_hw_post()
275 qed_async_event_completion(struct qed_hwfn *p_hwfn, in qed_async_event_completion() argument
280 if (!p_hwfn->p_spq) in qed_async_event_completion()
284 DP_ERR(p_hwfn, "Wrong protocol: %s:%d\n", in qed_async_event_completion()
291 cb = p_hwfn->p_spq->async_comp_cb[p_eqe->protocol_id]; in qed_async_event_completion()
293 return cb(p_hwfn, p_eqe->opcode, p_eqe->echo, in qed_async_event_completion()
296 DP_NOTICE(p_hwfn, in qed_async_event_completion()
306 qed_spq_register_async_cb(struct qed_hwfn *p_hwfn, in qed_spq_register_async_cb() argument
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()
318 qed_spq_unregister_async_cb(struct qed_hwfn *p_hwfn, in qed_spq_unregister_async_cb() argument
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()
330 void qed_eq_prod_update(struct qed_hwfn *p_hwfn, u16 prod) in qed_eq_prod_update() argument
333 USTORM_EQE_CONS, p_hwfn->rel_pf_id); in qed_eq_prod_update()
335 REG_WR16(p_hwfn, addr, prod); in qed_eq_prod_update()
338 int qed_eq_completion(struct qed_hwfn *p_hwfn, void *cookie) in qed_eq_completion() argument
347 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, "fw_cons_idx %x\n", fw_cons_idx); in qed_eq_completion()
365 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_eq_completion()
375 if (qed_async_event_completion(p_hwfn, p_eqe)) in qed_eq_completion()
377 } else if (qed_spq_completion(p_hwfn, in qed_eq_completion()
387 qed_eq_prod_update(p_hwfn, qed_chain_get_prod_idx(p_chain)); in qed_eq_completion()
390 spin_lock_bh(&p_hwfn->p_spq->lock); in qed_eq_completion()
391 rc = qed_spq_pend_post(p_hwfn); in qed_eq_completion()
392 spin_unlock_bh(&p_hwfn->p_spq->lock); in qed_eq_completion()
397 int qed_eq_alloc(struct qed_hwfn *p_hwfn, u16 num_elem) in qed_eq_alloc() argument
414 ret = qed_chain_alloc(p_hwfn->cdev, &p_eq->chain, &params); in qed_eq_alloc()
416 DP_NOTICE(p_hwfn, "Failed to allocate EQ chain\n"); in qed_eq_alloc()
421 qed_int_register_cb(p_hwfn, qed_eq_completion, in qed_eq_alloc()
424 p_hwfn->p_eq = p_eq; in qed_eq_alloc()
433 void qed_eq_setup(struct qed_hwfn *p_hwfn) in qed_eq_setup() argument
435 qed_chain_reset(&p_hwfn->p_eq->chain); in qed_eq_setup()
438 void qed_eq_free(struct qed_hwfn *p_hwfn) in qed_eq_free() argument
440 if (!p_hwfn->p_eq) in qed_eq_free()
443 qed_chain_free(p_hwfn->cdev, &p_hwfn->p_eq->chain); in qed_eq_free()
445 kfree(p_hwfn->p_eq); in qed_eq_free()
446 p_hwfn->p_eq = NULL; in qed_eq_free()
452 static int qed_cqe_completion(struct qed_hwfn *p_hwfn, in qed_cqe_completion() argument
456 if (IS_VF(p_hwfn->cdev)) in qed_cqe_completion()
463 return qed_spq_completion(p_hwfn, cqe->echo, 0, NULL); in qed_cqe_completion()
466 int qed_eth_cqe_completion(struct qed_hwfn *p_hwfn, in qed_eth_cqe_completion() argument
471 rc = qed_cqe_completion(p_hwfn, cqe, PROTOCOLID_ETH); in qed_eth_cqe_completion()
473 DP_NOTICE(p_hwfn, in qed_eth_cqe_completion()
483 void qed_spq_setup(struct qed_hwfn *p_hwfn) in qed_spq_setup() argument
485 struct qed_spq *p_spq = p_hwfn->p_spq; 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()
540 db_addr = (void __iomem *)((u8 __iomem *)p_hwfn->doorbells + in qed_spq_setup()
542 rc = qed_db_recovery_add(p_hwfn->cdev, db_addr, &p_spq->db_data, in qed_spq_setup()
545 DP_INFO(p_hwfn, in qed_spq_setup()
549 int qed_spq_alloc(struct qed_hwfn *p_hwfn) in qed_spq_alloc() argument
557 struct qed_dev *cdev = p_hwfn->cdev; in qed_spq_alloc()
572 DP_NOTICE(p_hwfn, "Failed to allocate SPQ chain\n"); in qed_spq_alloc()
588 p_hwfn->p_spq = p_spq; in qed_spq_alloc()
600 void qed_spq_free(struct qed_hwfn *p_hwfn) in qed_spq_free() argument
602 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_free()
610 db_addr = (void __iomem *)((u8 __iomem *)p_hwfn->doorbells + in qed_spq_free()
612 qed_db_recovery_del(p_hwfn->cdev, db_addr, &p_spq->db_data); in qed_spq_free()
616 dma_free_coherent(&p_hwfn->cdev->pdev->dev, in qed_spq_free()
622 qed_chain_free(p_hwfn->cdev, &p_spq->chain); in qed_spq_free()
624 p_hwfn->p_spq = NULL; in qed_spq_free()
627 int qed_spq_get_entry(struct qed_hwfn *p_hwfn, struct qed_spq_entry **pp_ent) in qed_spq_get_entry() argument
629 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_get_entry()
638 DP_NOTICE(p_hwfn, in qed_spq_get_entry()
659 static void __qed_spq_return_entry(struct qed_hwfn *p_hwfn, in __qed_spq_return_entry() argument
662 list_add_tail(&p_ent->list, &p_hwfn->p_spq->free_pool); in __qed_spq_return_entry()
665 void qed_spq_return_entry(struct qed_hwfn *p_hwfn, struct qed_spq_entry *p_ent) in qed_spq_return_entry() argument
667 spin_lock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
668 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_return_entry()
669 spin_unlock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
686 static int qed_spq_add_entry(struct qed_hwfn *p_hwfn, in qed_spq_add_entry() argument
690 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_add_entry()
743 u32 qed_spq_get_cid(struct qed_hwfn *p_hwfn) in qed_spq_get_cid() argument
745 if (!p_hwfn->p_spq) in qed_spq_get_cid()
747 return p_hwfn->p_spq->cid; in qed_spq_get_cid()
753 static int qed_spq_post_list(struct qed_hwfn *p_hwfn, in qed_spq_post_list() argument
756 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_post_list()
766 rc = qed_spq_hw_post(p_hwfn, p_spq, p_ent); in qed_spq_post_list()
769 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post_list()
777 int qed_spq_pend_post(struct qed_hwfn *p_hwfn) in qed_spq_pend_post() argument
779 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_pend_post()
793 qed_spq_add_entry(p_hwfn, p_ent, p_ent->priority); in qed_spq_pend_post()
796 return qed_spq_post_list(p_hwfn, &p_spq->pending, in qed_spq_pend_post()
815 static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo) in qed_spq_comp_bmap_update() argument
818 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_comp_bmap_update()
830 int qed_spq_post(struct qed_hwfn *p_hwfn, in qed_spq_post() argument
834 struct qed_spq *p_spq = p_hwfn ? p_hwfn->p_spq : NULL; in qed_spq_post()
838 if (!p_hwfn) in qed_spq_post()
842 DP_NOTICE(p_hwfn, "Got a NULL pointer\n"); in qed_spq_post()
846 if (p_hwfn->cdev->recov_in_prog) { in qed_spq_post()
847 DP_VERBOSE(p_hwfn, in qed_spq_post()
862 rc = qed_spq_fill_entry(p_hwfn, p_ent); in qed_spq_post()
876 rc = qed_spq_add_entry(p_hwfn, p_ent, p_ent->priority); in qed_spq_post()
880 rc = qed_spq_pend_post(p_hwfn); in qed_spq_post()
898 rc = qed_spq_block(p_hwfn, p_ent, fw_return_code, in qed_spq_post()
914 qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post()
921 qed_spq_comp_bmap_update(p_hwfn, p_ent->elem.hdr.echo); in qed_spq_post()
926 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post()
932 int qed_spq_completion(struct qed_hwfn *p_hwfn, in qed_spq_completion() argument
942 if (!p_hwfn) in qed_spq_completion()
945 p_spq = p_hwfn->p_spq; in qed_spq_completion()
953 qed_spq_comp_bmap_update(p_hwfn, echo); in qed_spq_completion()
962 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_completion()
974 DP_NOTICE(p_hwfn, in qed_spq_completion()
980 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_completion()
985 found->comp_cb.function(p_hwfn, found->comp_cb.cookie, p_data, in qed_spq_completion()
988 DP_VERBOSE(p_hwfn, in qed_spq_completion()
996 qed_spq_return_entry(p_hwfn, found); in qed_spq_completion()
1003 int qed_consq_alloc(struct qed_hwfn *p_hwfn) in qed_consq_alloc() argument
1021 ret = qed_chain_alloc(p_hwfn->cdev, &p_consq->chain, &params); in qed_consq_alloc()
1023 DP_NOTICE(p_hwfn, "Failed to allocate ConsQ chain"); in qed_consq_alloc()
1027 p_hwfn->p_consq = p_consq; in qed_consq_alloc()
1037 void qed_consq_setup(struct qed_hwfn *p_hwfn) in qed_consq_setup() argument
1039 qed_chain_reset(&p_hwfn->p_consq->chain); in qed_consq_setup()
1042 void qed_consq_free(struct qed_hwfn *p_hwfn) in qed_consq_free() argument
1044 if (!p_hwfn->p_consq) in qed_consq_free()
1047 qed_chain_free(p_hwfn->cdev, &p_hwfn->p_consq->chain); in qed_consq_free()
1049 kfree(p_hwfn->p_consq); in qed_consq_free()
1050 p_hwfn->p_consq = NULL; in qed_consq_free()