Lines Matching refs:nq

163 	struct bnxt_qplib_nq *nq = nq_work->nq;  in bnxt_qpn_cqn_sched_task()  local
165 if (cq && nq) { in bnxt_qpn_cqn_sched_task()
167 if (atomic_read(&cq->arm_state) && nq->cqn_handler) { in bnxt_qpn_cqn_sched_task()
168 dev_dbg(&nq->pdev->dev, in bnxt_qpn_cqn_sched_task()
170 __func__, cq, nq); in bnxt_qpn_cqn_sched_task()
171 nq->cqn_handler(nq, cq); in bnxt_qpn_cqn_sched_task()
239 static void clean_nq(struct bnxt_qplib_nq *nq, struct bnxt_qplib_cq *cq) in clean_nq() argument
241 struct bnxt_qplib_hwq *hwq = &nq->hwq; in clean_nq()
243 int budget = nq->budget; in clean_nq()
252 if (!NQE_CMP_VALID(nqe, nq->nq_db.dbinfo.flags)) in clean_nq()
281 1, &nq->nq_db.dbinfo.flags); in clean_nq()
297 clean_nq(cq->nq, cq); in __wait_for_all_nqes()
303 struct bnxt_qplib_nq *nq = from_tasklet(nq, t, nq_tasklet); in bnxt_qplib_service_nq() local
304 struct bnxt_qplib_hwq *hwq = &nq->hwq; in bnxt_qplib_service_nq()
306 int budget = nq->budget; in bnxt_qplib_service_nq()
316 if (!NQE_CMP_VALID(nqe, nq->nq_db.dbinfo.flags)) in bnxt_qplib_service_nq()
349 if (nq->cqn_handler(nq, (cq))) in bnxt_qplib_service_nq()
350 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
375 if (nq->srqn_handler(nq, in bnxt_qplib_service_nq()
378 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
386 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
392 1, &nq->nq_db.dbinfo.flags); in bnxt_qplib_service_nq()
395 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, true); in bnxt_qplib_service_nq()
408 void bnxt_re_synchronize_nq(struct bnxt_qplib_nq *nq) in bnxt_re_synchronize_nq() argument
410 int budget = nq->budget; in bnxt_re_synchronize_nq()
412 nq->budget = nq->hwq.max_elements; in bnxt_re_synchronize_nq()
413 bnxt_qplib_service_nq(&nq->nq_tasklet); in bnxt_re_synchronize_nq()
414 nq->budget = budget; in bnxt_re_synchronize_nq()
419 struct bnxt_qplib_nq *nq = dev_instance; in bnxt_qplib_nq_irq() local
420 struct bnxt_qplib_hwq *hwq = &nq->hwq; in bnxt_qplib_nq_irq()
428 tasklet_schedule(&nq->nq_tasklet); in bnxt_qplib_nq_irq()
433 void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill) in bnxt_qplib_nq_stop_irq() argument
435 if (!nq->requested) in bnxt_qplib_nq_stop_irq()
438 nq->requested = false; in bnxt_qplib_nq_stop_irq()
440 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, false); in bnxt_qplib_nq_stop_irq()
442 synchronize_irq(nq->msix_vec); in bnxt_qplib_nq_stop_irq()
443 irq_set_affinity_hint(nq->msix_vec, NULL); in bnxt_qplib_nq_stop_irq()
444 free_irq(nq->msix_vec, nq); in bnxt_qplib_nq_stop_irq()
445 kfree(nq->name); in bnxt_qplib_nq_stop_irq()
446 nq->name = NULL; in bnxt_qplib_nq_stop_irq()
449 tasklet_kill(&nq->nq_tasklet); in bnxt_qplib_nq_stop_irq()
450 tasklet_disable(&nq->nq_tasklet); in bnxt_qplib_nq_stop_irq()
453 void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq) in bnxt_qplib_disable_nq() argument
455 if (nq->cqn_wq) { in bnxt_qplib_disable_nq()
456 destroy_workqueue(nq->cqn_wq); in bnxt_qplib_disable_nq()
457 nq->cqn_wq = NULL; in bnxt_qplib_disable_nq()
461 bnxt_qplib_nq_stop_irq(nq, true); in bnxt_qplib_disable_nq()
463 if (nq->nq_db.reg.bar_reg) { in bnxt_qplib_disable_nq()
464 iounmap(nq->nq_db.reg.bar_reg); in bnxt_qplib_disable_nq()
465 nq->nq_db.reg.bar_reg = NULL; in bnxt_qplib_disable_nq()
468 nq->cqn_handler = NULL; in bnxt_qplib_disable_nq()
469 nq->srqn_handler = NULL; in bnxt_qplib_disable_nq()
470 nq->msix_vec = 0; in bnxt_qplib_disable_nq()
473 int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx, in bnxt_qplib_nq_start_irq() argument
476 struct bnxt_qplib_res *res = nq->res; in bnxt_qplib_nq_start_irq()
479 if (nq->requested) in bnxt_qplib_nq_start_irq()
482 nq->msix_vec = msix_vector; in bnxt_qplib_nq_start_irq()
484 tasklet_setup(&nq->nq_tasklet, bnxt_qplib_service_nq); in bnxt_qplib_nq_start_irq()
486 tasklet_enable(&nq->nq_tasklet); in bnxt_qplib_nq_start_irq()
488 nq->name = kasprintf(GFP_KERNEL, "bnxt_re-nq-%d@pci:%s", in bnxt_qplib_nq_start_irq()
490 if (!nq->name) in bnxt_qplib_nq_start_irq()
492 rc = request_irq(nq->msix_vec, bnxt_qplib_nq_irq, 0, nq->name, nq); in bnxt_qplib_nq_start_irq()
494 kfree(nq->name); in bnxt_qplib_nq_start_irq()
495 nq->name = NULL; in bnxt_qplib_nq_start_irq()
496 tasklet_disable(&nq->nq_tasklet); in bnxt_qplib_nq_start_irq()
500 cpumask_clear(&nq->mask); in bnxt_qplib_nq_start_irq()
501 cpumask_set_cpu(nq_indx, &nq->mask); in bnxt_qplib_nq_start_irq()
502 rc = irq_set_affinity_hint(nq->msix_vec, &nq->mask); in bnxt_qplib_nq_start_irq()
504 dev_warn(&nq->pdev->dev, in bnxt_qplib_nq_start_irq()
506 nq->msix_vec, nq_indx); in bnxt_qplib_nq_start_irq()
508 nq->requested = true; in bnxt_qplib_nq_start_irq()
509 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, res->cctx, true); in bnxt_qplib_nq_start_irq()
514 static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt) in bnxt_qplib_map_nq_db() argument
520 pdev = nq->pdev; in bnxt_qplib_map_nq_db()
521 nq_db = &nq->nq_db; in bnxt_qplib_map_nq_db()
543 nq_db->dbinfo.hwq = &nq->hwq; in bnxt_qplib_map_nq_db()
544 nq_db->dbinfo.xid = nq->ring_id; in bnxt_qplib_map_nq_db()
549 int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq, in bnxt_qplib_enable_nq() argument
556 nq->pdev = pdev; in bnxt_qplib_enable_nq()
557 nq->cqn_handler = cqn_handler; in bnxt_qplib_enable_nq()
558 nq->srqn_handler = srqn_handler; in bnxt_qplib_enable_nq()
561 nq->cqn_wq = create_singlethread_workqueue("bnxt_qplib_nq"); in bnxt_qplib_enable_nq()
562 if (!nq->cqn_wq) in bnxt_qplib_enable_nq()
565 rc = bnxt_qplib_map_nq_db(nq, bar_reg_offset); in bnxt_qplib_enable_nq()
569 rc = bnxt_qplib_nq_start_irq(nq, nq_idx, msix_vector, true); in bnxt_qplib_enable_nq()
571 dev_err(&nq->pdev->dev, in bnxt_qplib_enable_nq()
578 bnxt_qplib_disable_nq(nq); in bnxt_qplib_enable_nq()
582 void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq) in bnxt_qplib_free_nq() argument
584 if (nq->hwq.max_elements) { in bnxt_qplib_free_nq()
585 bnxt_qplib_free_hwq(nq->res, &nq->hwq); in bnxt_qplib_free_nq()
586 nq->hwq.max_elements = 0; in bnxt_qplib_free_nq()
590 int bnxt_qplib_alloc_nq(struct bnxt_qplib_res *res, struct bnxt_qplib_nq *nq) in bnxt_qplib_alloc_nq() argument
595 nq->pdev = res->pdev; in bnxt_qplib_alloc_nq()
596 nq->res = res; in bnxt_qplib_alloc_nq()
597 if (!nq->hwq.max_elements || in bnxt_qplib_alloc_nq()
598 nq->hwq.max_elements > BNXT_QPLIB_NQE_MAX_CNT) in bnxt_qplib_alloc_nq()
599 nq->hwq.max_elements = BNXT_QPLIB_NQE_MAX_CNT; in bnxt_qplib_alloc_nq()
605 hwq_attr.depth = nq->hwq.max_elements; in bnxt_qplib_alloc_nq()
607 hwq_attr.type = bnxt_qplib_get_hwq_type(nq->res); in bnxt_qplib_alloc_nq()
608 if (bnxt_qplib_alloc_init_hwq(&nq->hwq, &hwq_attr)) { in bnxt_qplib_alloc_nq()
609 dev_err(&nq->pdev->dev, "FP NQ allocation failed"); in bnxt_qplib_alloc_nq()
612 nq->budget = 8; in bnxt_qplib_alloc_nq()
2045 nq_work->nq = qp->scq->nq; in bnxt_qplib_post_send()
2047 queue_work(qp->scq->nq->cqn_wq, &nq_work->work); in bnxt_qplib_post_send()
2132 nq_work->nq = qp->rcq->nq; in bnxt_qplib_post_recv()
2134 queue_work(qp->rcq->nq->cqn_wq, &nq_work->work); in bnxt_qplib_post_recv()
3153 flush_workqueue(qp->scq->nq->cqn_wq); in bnxt_qplib_flush_cqn_wq()
3155 flush_workqueue(qp->rcq->nq->cqn_wq); in bnxt_qplib_flush_cqn_wq()