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()
147 qed_ptt_release(p_hwfn, p_ptt); in qed_spq_block()
155 static int qed_spq_fill_entry(struct qed_hwfn *p_hwfn, in qed_spq_fill_entry() argument
168 DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n", in qed_spq_fill_entry()
173 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_fill_entry()
190 static void qed_spq_hw_initialize(struct qed_hwfn *p_hwfn, in qed_spq_hw_initialize() argument
200 rc = qed_cxt_get_cid_info(p_hwfn, &cxt_info); in qed_spq_hw_initialize()
203 DP_NOTICE(p_hwfn, "Cannot find context info for cid=%d\n", in qed_spq_hw_initialize()
218 physical_q = qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_LB); in qed_spq_hw_initialize()
227 static int qed_spq_hw_post(struct qed_hwfn *p_hwfn, in qed_spq_hw_post() argument
230 struct qed_chain *p_chain = &p_hwfn->p_spq->chain; in qed_spq_hw_post()
238 DP_NOTICE(p_hwfn, "Failed to produce from SPQ chain\n"); in qed_spq_hw_post()
250 DOORBELL(p_hwfn, p_spq->db_addr_offset, *(u32 *)p_db_data); in qed_spq_hw_post()
255 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_hw_post()
269 qed_async_event_completion(struct qed_hwfn *p_hwfn, in qed_async_event_completion() argument
274 if (!p_hwfn->p_spq || (p_eqe->protocol_id >= MAX_PROTOCOL_TYPE)) in qed_async_event_completion()
277 cb = p_hwfn->p_spq->async_comp_cb[p_eqe->protocol_id]; in qed_async_event_completion()
279 return cb(p_hwfn, p_eqe->opcode, p_eqe->echo, in qed_async_event_completion()
282 DP_NOTICE(p_hwfn, in qed_async_event_completion()
290 qed_spq_register_async_cb(struct qed_hwfn *p_hwfn, in qed_spq_register_async_cb() argument
294 if (!p_hwfn->p_spq || (protocol_id >= MAX_PROTOCOL_TYPE)) in qed_spq_register_async_cb()
297 p_hwfn->p_spq->async_comp_cb[protocol_id] = cb; in qed_spq_register_async_cb()
302 qed_spq_unregister_async_cb(struct qed_hwfn *p_hwfn, in qed_spq_unregister_async_cb() argument
305 if (!p_hwfn->p_spq || (protocol_id >= MAX_PROTOCOL_TYPE)) in qed_spq_unregister_async_cb()
308 p_hwfn->p_spq->async_comp_cb[protocol_id] = NULL; in qed_spq_unregister_async_cb()
314 void qed_eq_prod_update(struct qed_hwfn *p_hwfn, u16 prod) in qed_eq_prod_update() argument
317 USTORM_EQE_CONS, p_hwfn->rel_pf_id); in qed_eq_prod_update()
319 REG_WR16(p_hwfn, addr, prod); in qed_eq_prod_update()
322 int qed_eq_completion(struct qed_hwfn *p_hwfn, void *cookie) in qed_eq_completion() argument
331 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, "fw_cons_idx %x\n", fw_cons_idx); in qed_eq_completion()
349 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_eq_completion()
359 if (qed_async_event_completion(p_hwfn, p_eqe)) in qed_eq_completion()
361 } else if (qed_spq_completion(p_hwfn, in qed_eq_completion()
371 qed_eq_prod_update(p_hwfn, qed_chain_get_prod_idx(p_chain)); in qed_eq_completion()
374 spin_lock_bh(&p_hwfn->p_spq->lock); in qed_eq_completion()
375 rc = qed_spq_pend_post(p_hwfn); in qed_eq_completion()
376 spin_unlock_bh(&p_hwfn->p_spq->lock); in qed_eq_completion()
381 int qed_eq_alloc(struct qed_hwfn *p_hwfn, u16 num_elem) in qed_eq_alloc() argument
398 ret = qed_chain_alloc(p_hwfn->cdev, &p_eq->chain, &params); in qed_eq_alloc()
400 DP_NOTICE(p_hwfn, "Failed to allocate EQ chain\n"); in qed_eq_alloc()
405 qed_int_register_cb(p_hwfn, qed_eq_completion, in qed_eq_alloc()
408 p_hwfn->p_eq = p_eq; in qed_eq_alloc()
417 void qed_eq_setup(struct qed_hwfn *p_hwfn) in qed_eq_setup() argument
419 qed_chain_reset(&p_hwfn->p_eq->chain); in qed_eq_setup()
422 void qed_eq_free(struct qed_hwfn *p_hwfn) in qed_eq_free() argument
424 if (!p_hwfn->p_eq) in qed_eq_free()
427 qed_chain_free(p_hwfn->cdev, &p_hwfn->p_eq->chain); in qed_eq_free()
429 kfree(p_hwfn->p_eq); in qed_eq_free()
430 p_hwfn->p_eq = NULL; in qed_eq_free()
436 static int qed_cqe_completion(struct qed_hwfn *p_hwfn, in qed_cqe_completion() argument
440 if (IS_VF(p_hwfn->cdev)) in qed_cqe_completion()
447 return qed_spq_completion(p_hwfn, cqe->echo, 0, NULL); in qed_cqe_completion()
450 int qed_eth_cqe_completion(struct qed_hwfn *p_hwfn, in qed_eth_cqe_completion() argument
455 rc = qed_cqe_completion(p_hwfn, cqe, PROTOCOLID_ETH); in qed_eth_cqe_completion()
457 DP_NOTICE(p_hwfn, in qed_eth_cqe_completion()
467 void qed_spq_setup(struct qed_hwfn *p_hwfn) in qed_spq_setup() argument
469 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_setup()
507 qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_CORE, &p_spq->cid); in qed_spq_setup()
508 qed_spq_hw_initialize(p_hwfn, p_spq); in qed_spq_setup()
524 db_addr = (void __iomem *)((u8 __iomem *)p_hwfn->doorbells + in qed_spq_setup()
526 rc = qed_db_recovery_add(p_hwfn->cdev, db_addr, &p_spq->db_data, in qed_spq_setup()
529 DP_INFO(p_hwfn, in qed_spq_setup()
533 int qed_spq_alloc(struct qed_hwfn *p_hwfn) in qed_spq_alloc() argument
541 struct qed_dev *cdev = p_hwfn->cdev; in qed_spq_alloc()
556 DP_NOTICE(p_hwfn, "Failed to allocate SPQ chain\n"); in qed_spq_alloc()
572 p_hwfn->p_spq = p_spq; in qed_spq_alloc()
584 void qed_spq_free(struct qed_hwfn *p_hwfn) in qed_spq_free() argument
586 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_free()
594 db_addr = (void __iomem *)((u8 __iomem *)p_hwfn->doorbells + in qed_spq_free()
596 qed_db_recovery_del(p_hwfn->cdev, db_addr, &p_spq->db_data); in qed_spq_free()
600 dma_free_coherent(&p_hwfn->cdev->pdev->dev, in qed_spq_free()
606 qed_chain_free(p_hwfn->cdev, &p_spq->chain); in qed_spq_free()
608 p_hwfn->p_spq = NULL; in qed_spq_free()
611 int qed_spq_get_entry(struct qed_hwfn *p_hwfn, struct qed_spq_entry **pp_ent) in qed_spq_get_entry() argument
613 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_get_entry()
622 DP_NOTICE(p_hwfn, in qed_spq_get_entry()
643 static void __qed_spq_return_entry(struct qed_hwfn *p_hwfn, in __qed_spq_return_entry() argument
646 list_add_tail(&p_ent->list, &p_hwfn->p_spq->free_pool); in __qed_spq_return_entry()
649 void qed_spq_return_entry(struct qed_hwfn *p_hwfn, struct qed_spq_entry *p_ent) in qed_spq_return_entry() argument
651 spin_lock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
652 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_return_entry()
653 spin_unlock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
670 static int qed_spq_add_entry(struct qed_hwfn *p_hwfn, in qed_spq_add_entry() argument
674 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_add_entry()
727 u32 qed_spq_get_cid(struct qed_hwfn *p_hwfn) in qed_spq_get_cid() argument
729 if (!p_hwfn->p_spq) in qed_spq_get_cid()
731 return p_hwfn->p_spq->cid; in qed_spq_get_cid()
737 static int qed_spq_post_list(struct qed_hwfn *p_hwfn, in qed_spq_post_list() argument
740 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_post_list()
750 rc = qed_spq_hw_post(p_hwfn, p_spq, p_ent); in qed_spq_post_list()
753 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post_list()
761 int qed_spq_pend_post(struct qed_hwfn *p_hwfn) in qed_spq_pend_post() argument
763 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_pend_post()
777 qed_spq_add_entry(p_hwfn, p_ent, p_ent->priority); in qed_spq_pend_post()
780 return qed_spq_post_list(p_hwfn, &p_spq->pending, in qed_spq_pend_post()
799 static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo) in qed_spq_comp_bmap_update() argument
802 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_comp_bmap_update()
814 int qed_spq_post(struct qed_hwfn *p_hwfn, in qed_spq_post() argument
818 struct qed_spq *p_spq = p_hwfn ? p_hwfn->p_spq : NULL; in qed_spq_post()
822 if (!p_hwfn) in qed_spq_post()
826 DP_NOTICE(p_hwfn, "Got a NULL pointer\n"); in qed_spq_post()
830 if (p_hwfn->cdev->recov_in_prog) { in qed_spq_post()
831 DP_VERBOSE(p_hwfn, in qed_spq_post()
842 rc = qed_spq_fill_entry(p_hwfn, p_ent); in qed_spq_post()
856 rc = qed_spq_add_entry(p_hwfn, p_ent, p_ent->priority); in qed_spq_post()
860 rc = qed_spq_pend_post(p_hwfn); in qed_spq_post()
878 rc = qed_spq_block(p_hwfn, p_ent, fw_return_code, in qed_spq_post()
894 qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post()
901 qed_spq_comp_bmap_update(p_hwfn, p_ent->elem.hdr.echo); in qed_spq_post()
906 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post()
912 int qed_spq_completion(struct qed_hwfn *p_hwfn, in qed_spq_completion() argument
922 if (!p_hwfn) in qed_spq_completion()
925 p_spq = p_hwfn->p_spq; in qed_spq_completion()
933 qed_spq_comp_bmap_update(p_hwfn, echo); in qed_spq_completion()
942 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_completion()
954 DP_NOTICE(p_hwfn, in qed_spq_completion()
960 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_completion()
965 found->comp_cb.function(p_hwfn, found->comp_cb.cookie, p_data, in qed_spq_completion()
968 DP_VERBOSE(p_hwfn, in qed_spq_completion()
976 qed_spq_return_entry(p_hwfn, found); in qed_spq_completion()
983 int qed_consq_alloc(struct qed_hwfn *p_hwfn) in qed_consq_alloc() argument
1001 ret = qed_chain_alloc(p_hwfn->cdev, &p_consq->chain, &params); in qed_consq_alloc()
1003 DP_NOTICE(p_hwfn, "Failed to allocate ConsQ chain"); in qed_consq_alloc()
1007 p_hwfn->p_consq = p_consq; in qed_consq_alloc()
1017 void qed_consq_setup(struct qed_hwfn *p_hwfn) in qed_consq_setup() argument
1019 qed_chain_reset(&p_hwfn->p_consq->chain); in qed_consq_setup()
1022 void qed_consq_free(struct qed_hwfn *p_hwfn) in qed_consq_free() argument
1024 if (!p_hwfn->p_consq) in qed_consq_free()
1027 qed_chain_free(p_hwfn->cdev, &p_hwfn->p_consq->chain); in qed_consq_free()
1029 kfree(p_hwfn->p_consq); in qed_consq_free()
1030 p_hwfn->p_consq = NULL; in qed_consq_free()