Lines Matching refs:nq
159 struct bnxt_qplib_nq *nq = nq_work->nq; in bnxt_qpn_cqn_sched_task() local
161 if (cq && nq) { in bnxt_qpn_cqn_sched_task()
163 if (atomic_read(&cq->arm_state) && nq->cqn_handler) { in bnxt_qpn_cqn_sched_task()
164 dev_dbg(&nq->pdev->dev, in bnxt_qpn_cqn_sched_task()
166 __func__, cq, nq); in bnxt_qpn_cqn_sched_task()
167 nq->cqn_handler(nq, cq); in bnxt_qpn_cqn_sched_task()
235 static void clean_nq(struct bnxt_qplib_nq *nq, struct bnxt_qplib_cq *cq) in clean_nq() argument
237 struct bnxt_qplib_hwq *hwq = &nq->hwq; in clean_nq()
239 int budget = nq->budget; in clean_nq()
295 clean_nq(cq->nq, cq); in __wait_for_all_nqes()
301 struct bnxt_qplib_nq *nq = from_tasklet(nq, t, nq_tasklet); in bnxt_qplib_service_nq() local
302 struct bnxt_qplib_hwq *hwq = &nq->hwq; in bnxt_qplib_service_nq()
306 int budget = nq->budget; in bnxt_qplib_service_nq()
343 if (!nq->cqn_handler(nq, (cq))) in bnxt_qplib_service_nq()
346 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
364 if (!nq->srqn_handler(nq, in bnxt_qplib_service_nq()
369 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
377 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
385 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, true); in bnxt_qplib_service_nq()
392 struct bnxt_qplib_nq *nq = dev_instance; in bnxt_qplib_nq_irq() local
393 struct bnxt_qplib_hwq *hwq = &nq->hwq; in bnxt_qplib_nq_irq()
401 tasklet_schedule(&nq->nq_tasklet); in bnxt_qplib_nq_irq()
406 void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill) in bnxt_qplib_nq_stop_irq() argument
408 tasklet_disable(&nq->nq_tasklet); in bnxt_qplib_nq_stop_irq()
410 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, false); in bnxt_qplib_nq_stop_irq()
412 synchronize_irq(nq->msix_vec); in bnxt_qplib_nq_stop_irq()
414 tasklet_kill(&nq->nq_tasklet); in bnxt_qplib_nq_stop_irq()
415 if (nq->requested) { in bnxt_qplib_nq_stop_irq()
416 irq_set_affinity_hint(nq->msix_vec, NULL); in bnxt_qplib_nq_stop_irq()
417 free_irq(nq->msix_vec, nq); in bnxt_qplib_nq_stop_irq()
418 nq->requested = false; in bnxt_qplib_nq_stop_irq()
422 void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq) in bnxt_qplib_disable_nq() argument
424 if (nq->cqn_wq) { in bnxt_qplib_disable_nq()
425 destroy_workqueue(nq->cqn_wq); in bnxt_qplib_disable_nq()
426 nq->cqn_wq = NULL; in bnxt_qplib_disable_nq()
430 bnxt_qplib_nq_stop_irq(nq, true); in bnxt_qplib_disable_nq()
432 if (nq->nq_db.reg.bar_reg) { in bnxt_qplib_disable_nq()
433 iounmap(nq->nq_db.reg.bar_reg); in bnxt_qplib_disable_nq()
434 nq->nq_db.reg.bar_reg = NULL; in bnxt_qplib_disable_nq()
437 nq->cqn_handler = NULL; in bnxt_qplib_disable_nq()
438 nq->srqn_handler = NULL; in bnxt_qplib_disable_nq()
439 nq->msix_vec = 0; in bnxt_qplib_disable_nq()
442 int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx, in bnxt_qplib_nq_start_irq() argument
447 if (nq->requested) in bnxt_qplib_nq_start_irq()
450 nq->msix_vec = msix_vector; in bnxt_qplib_nq_start_irq()
452 tasklet_setup(&nq->nq_tasklet, bnxt_qplib_service_nq); in bnxt_qplib_nq_start_irq()
454 tasklet_enable(&nq->nq_tasklet); in bnxt_qplib_nq_start_irq()
456 snprintf(nq->name, sizeof(nq->name), "bnxt_qplib_nq-%d", nq_indx); in bnxt_qplib_nq_start_irq()
457 rc = request_irq(nq->msix_vec, bnxt_qplib_nq_irq, 0, nq->name, nq); in bnxt_qplib_nq_start_irq()
461 cpumask_clear(&nq->mask); in bnxt_qplib_nq_start_irq()
462 cpumask_set_cpu(nq_indx, &nq->mask); in bnxt_qplib_nq_start_irq()
463 rc = irq_set_affinity_hint(nq->msix_vec, &nq->mask); in bnxt_qplib_nq_start_irq()
465 dev_warn(&nq->pdev->dev, in bnxt_qplib_nq_start_irq()
467 nq->msix_vec, nq_indx); in bnxt_qplib_nq_start_irq()
469 nq->requested = true; in bnxt_qplib_nq_start_irq()
470 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, true); in bnxt_qplib_nq_start_irq()
475 static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt) in bnxt_qplib_map_nq_db() argument
482 pdev = nq->pdev; in bnxt_qplib_map_nq_db()
483 nq_db = &nq->nq_db; in bnxt_qplib_map_nq_db()
506 nq_db->dbinfo.hwq = &nq->hwq; in bnxt_qplib_map_nq_db()
507 nq_db->dbinfo.xid = nq->ring_id; in bnxt_qplib_map_nq_db()
512 int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq, in bnxt_qplib_enable_nq() argument
519 nq->pdev = pdev; in bnxt_qplib_enable_nq()
520 nq->cqn_handler = cqn_handler; in bnxt_qplib_enable_nq()
521 nq->srqn_handler = srqn_handler; in bnxt_qplib_enable_nq()
524 nq->cqn_wq = create_singlethread_workqueue("bnxt_qplib_nq"); in bnxt_qplib_enable_nq()
525 if (!nq->cqn_wq) in bnxt_qplib_enable_nq()
528 rc = bnxt_qplib_map_nq_db(nq, bar_reg_offset); in bnxt_qplib_enable_nq()
532 rc = bnxt_qplib_nq_start_irq(nq, nq_idx, msix_vector, true); in bnxt_qplib_enable_nq()
534 dev_err(&nq->pdev->dev, in bnxt_qplib_enable_nq()
541 bnxt_qplib_disable_nq(nq); in bnxt_qplib_enable_nq()
545 void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq) in bnxt_qplib_free_nq() argument
547 if (nq->hwq.max_elements) { in bnxt_qplib_free_nq()
548 bnxt_qplib_free_hwq(nq->res, &nq->hwq); in bnxt_qplib_free_nq()
549 nq->hwq.max_elements = 0; in bnxt_qplib_free_nq()
553 int bnxt_qplib_alloc_nq(struct bnxt_qplib_res *res, struct bnxt_qplib_nq *nq) in bnxt_qplib_alloc_nq() argument
558 nq->pdev = res->pdev; in bnxt_qplib_alloc_nq()
559 nq->res = res; in bnxt_qplib_alloc_nq()
560 if (!nq->hwq.max_elements || in bnxt_qplib_alloc_nq()
561 nq->hwq.max_elements > BNXT_QPLIB_NQE_MAX_CNT) in bnxt_qplib_alloc_nq()
562 nq->hwq.max_elements = BNXT_QPLIB_NQE_MAX_CNT; in bnxt_qplib_alloc_nq()
568 hwq_attr.depth = nq->hwq.max_elements; in bnxt_qplib_alloc_nq()
570 hwq_attr.type = bnxt_qplib_get_hwq_type(nq->res); in bnxt_qplib_alloc_nq()
571 if (bnxt_qplib_alloc_init_hwq(&nq->hwq, &hwq_attr)) { in bnxt_qplib_alloc_nq()
572 dev_err(&nq->pdev->dev, "FP NQ allocation failed"); in bnxt_qplib_alloc_nq()
575 nq->budget = 8; in bnxt_qplib_alloc_nq()
1934 nq_work->nq = qp->scq->nq; in bnxt_qplib_post_send()
1936 queue_work(qp->scq->nq->cqn_wq, &nq_work->work); in bnxt_qplib_post_send()
2021 nq_work->nq = qp->rcq->nq; in bnxt_qplib_post_recv()
2023 queue_work(qp->rcq->nq->cqn_wq, &nq_work->work); in bnxt_qplib_post_recv()
2948 flush_workqueue(qp->scq->nq->cqn_wq); in bnxt_qplib_flush_cqn_wq()
2950 flush_workqueue(qp->rcq->nq->cqn_wq); in bnxt_qplib_flush_cqn_wq()