Lines Matching refs:nq

158 	struct bnxt_qplib_nq *nq = nq_work->nq;  in bnxt_qpn_cqn_sched_task()  local
160 if (cq && nq) { in bnxt_qpn_cqn_sched_task()
162 if (atomic_read(&cq->arm_state) && nq->cqn_handler) { in bnxt_qpn_cqn_sched_task()
163 dev_dbg(&nq->pdev->dev, in bnxt_qpn_cqn_sched_task()
165 __func__, cq, nq); in bnxt_qpn_cqn_sched_task()
166 nq->cqn_handler(nq, cq); in bnxt_qpn_cqn_sched_task()
234 static void clean_nq(struct bnxt_qplib_nq *nq, struct bnxt_qplib_cq *cq) in clean_nq() argument
236 struct bnxt_qplib_hwq *hwq = &nq->hwq; in clean_nq()
238 int budget = nq->budget; in clean_nq()
294 clean_nq(cq->nq, cq); in __wait_for_all_nqes()
300 struct bnxt_qplib_nq *nq = from_tasklet(nq, t, nq_tasklet); in bnxt_qplib_service_nq() local
301 struct bnxt_qplib_hwq *hwq = &nq->hwq; in bnxt_qplib_service_nq()
305 int budget = nq->budget; in bnxt_qplib_service_nq()
342 if (!nq->cqn_handler(nq, (cq))) in bnxt_qplib_service_nq()
345 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
363 if (!nq->srqn_handler(nq, in bnxt_qplib_service_nq()
368 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
376 dev_warn(&nq->pdev->dev, in bnxt_qplib_service_nq()
384 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, true); in bnxt_qplib_service_nq()
391 struct bnxt_qplib_nq *nq = dev_instance; in bnxt_qplib_nq_irq() local
392 struct bnxt_qplib_hwq *hwq = &nq->hwq; in bnxt_qplib_nq_irq()
400 tasklet_schedule(&nq->nq_tasklet); in bnxt_qplib_nq_irq()
405 void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill) in bnxt_qplib_nq_stop_irq() argument
407 tasklet_disable(&nq->nq_tasklet); in bnxt_qplib_nq_stop_irq()
409 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, false); in bnxt_qplib_nq_stop_irq()
411 synchronize_irq(nq->msix_vec); in bnxt_qplib_nq_stop_irq()
413 tasklet_kill(&nq->nq_tasklet); in bnxt_qplib_nq_stop_irq()
414 if (nq->requested) { in bnxt_qplib_nq_stop_irq()
415 irq_set_affinity_hint(nq->msix_vec, NULL); in bnxt_qplib_nq_stop_irq()
416 free_irq(nq->msix_vec, nq); in bnxt_qplib_nq_stop_irq()
417 nq->requested = false; in bnxt_qplib_nq_stop_irq()
421 void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq) in bnxt_qplib_disable_nq() argument
423 if (nq->cqn_wq) { in bnxt_qplib_disable_nq()
424 destroy_workqueue(nq->cqn_wq); in bnxt_qplib_disable_nq()
425 nq->cqn_wq = NULL; in bnxt_qplib_disable_nq()
429 bnxt_qplib_nq_stop_irq(nq, true); in bnxt_qplib_disable_nq()
431 if (nq->nq_db.reg.bar_reg) { in bnxt_qplib_disable_nq()
432 iounmap(nq->nq_db.reg.bar_reg); in bnxt_qplib_disable_nq()
433 nq->nq_db.reg.bar_reg = NULL; in bnxt_qplib_disable_nq()
436 nq->cqn_handler = NULL; in bnxt_qplib_disable_nq()
437 nq->srqn_handler = NULL; in bnxt_qplib_disable_nq()
438 nq->msix_vec = 0; in bnxt_qplib_disable_nq()
441 int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx, in bnxt_qplib_nq_start_irq() argument
446 if (nq->requested) in bnxt_qplib_nq_start_irq()
449 nq->msix_vec = msix_vector; in bnxt_qplib_nq_start_irq()
451 tasklet_setup(&nq->nq_tasklet, bnxt_qplib_service_nq); in bnxt_qplib_nq_start_irq()
453 tasklet_enable(&nq->nq_tasklet); in bnxt_qplib_nq_start_irq()
455 snprintf(nq->name, sizeof(nq->name), "bnxt_qplib_nq-%d", nq_indx); in bnxt_qplib_nq_start_irq()
456 rc = request_irq(nq->msix_vec, bnxt_qplib_nq_irq, 0, nq->name, nq); in bnxt_qplib_nq_start_irq()
460 cpumask_clear(&nq->mask); in bnxt_qplib_nq_start_irq()
461 cpumask_set_cpu(nq_indx, &nq->mask); in bnxt_qplib_nq_start_irq()
462 rc = irq_set_affinity_hint(nq->msix_vec, &nq->mask); in bnxt_qplib_nq_start_irq()
464 dev_warn(&nq->pdev->dev, in bnxt_qplib_nq_start_irq()
466 nq->msix_vec, nq_indx); in bnxt_qplib_nq_start_irq()
468 nq->requested = true; in bnxt_qplib_nq_start_irq()
469 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, true); in bnxt_qplib_nq_start_irq()
474 static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt) in bnxt_qplib_map_nq_db() argument
481 pdev = nq->pdev; in bnxt_qplib_map_nq_db()
482 nq_db = &nq->nq_db; in bnxt_qplib_map_nq_db()
505 nq_db->dbinfo.hwq = &nq->hwq; in bnxt_qplib_map_nq_db()
506 nq_db->dbinfo.xid = nq->ring_id; in bnxt_qplib_map_nq_db()
511 int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq, in bnxt_qplib_enable_nq() argument
518 nq->pdev = pdev; in bnxt_qplib_enable_nq()
519 nq->cqn_handler = cqn_handler; in bnxt_qplib_enable_nq()
520 nq->srqn_handler = srqn_handler; in bnxt_qplib_enable_nq()
523 nq->cqn_wq = create_singlethread_workqueue("bnxt_qplib_nq"); in bnxt_qplib_enable_nq()
524 if (!nq->cqn_wq) in bnxt_qplib_enable_nq()
527 rc = bnxt_qplib_map_nq_db(nq, bar_reg_offset); in bnxt_qplib_enable_nq()
531 rc = bnxt_qplib_nq_start_irq(nq, nq_idx, msix_vector, true); in bnxt_qplib_enable_nq()
533 dev_err(&nq->pdev->dev, in bnxt_qplib_enable_nq()
540 bnxt_qplib_disable_nq(nq); in bnxt_qplib_enable_nq()
544 void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq) in bnxt_qplib_free_nq() argument
546 if (nq->hwq.max_elements) { in bnxt_qplib_free_nq()
547 bnxt_qplib_free_hwq(nq->res, &nq->hwq); in bnxt_qplib_free_nq()
548 nq->hwq.max_elements = 0; in bnxt_qplib_free_nq()
552 int bnxt_qplib_alloc_nq(struct bnxt_qplib_res *res, struct bnxt_qplib_nq *nq) in bnxt_qplib_alloc_nq() argument
557 nq->pdev = res->pdev; in bnxt_qplib_alloc_nq()
558 nq->res = res; in bnxt_qplib_alloc_nq()
559 if (!nq->hwq.max_elements || in bnxt_qplib_alloc_nq()
560 nq->hwq.max_elements > BNXT_QPLIB_NQE_MAX_CNT) in bnxt_qplib_alloc_nq()
561 nq->hwq.max_elements = BNXT_QPLIB_NQE_MAX_CNT; in bnxt_qplib_alloc_nq()
567 hwq_attr.depth = nq->hwq.max_elements; in bnxt_qplib_alloc_nq()
569 hwq_attr.type = bnxt_qplib_get_hwq_type(nq->res); in bnxt_qplib_alloc_nq()
570 if (bnxt_qplib_alloc_init_hwq(&nq->hwq, &hwq_attr)) { in bnxt_qplib_alloc_nq()
571 dev_err(&nq->pdev->dev, "FP NQ allocation failed"); in bnxt_qplib_alloc_nq()
574 nq->budget = 8; in bnxt_qplib_alloc_nq()
1935 nq_work->nq = qp->scq->nq; in bnxt_qplib_post_send()
1937 queue_work(qp->scq->nq->cqn_wq, &nq_work->work); in bnxt_qplib_post_send()
2022 nq_work->nq = qp->rcq->nq; in bnxt_qplib_post_recv()
2024 queue_work(qp->rcq->nq->cqn_wq, &nq_work->work); in bnxt_qplib_post_recv()
2949 flush_workqueue(qp->scq->nq->cqn_wq); in bnxt_qplib_flush_cqn_wq()
2951 flush_workqueue(qp->rcq->nq->cqn_wq); in bnxt_qplib_flush_cqn_wq()