• Home
  • Raw
  • Download

Lines Matching refs:vf

35 static void otx2vf_process_vfaf_mbox_msg(struct otx2_nic *vf,  in otx2vf_process_vfaf_mbox_msg()  argument
39 dev_err(vf->dev, in otx2vf_process_vfaf_mbox_msg()
45 dev_err(vf->dev, in otx2vf_process_vfaf_mbox_msg()
52 dev_err(vf->dev, in otx2vf_process_vfaf_mbox_msg()
60 vf->pcifunc = msg->pcifunc; in otx2vf_process_vfaf_mbox_msg()
63 mbox_handler_msix_offset(vf, (struct msix_offset_rsp *)msg); in otx2vf_process_vfaf_mbox_msg()
66 mbox_handler_npa_lf_alloc(vf, (struct npa_lf_alloc_rsp *)msg); in otx2vf_process_vfaf_mbox_msg()
69 mbox_handler_nix_lf_alloc(vf, (struct nix_lf_alloc_rsp *)msg); in otx2vf_process_vfaf_mbox_msg()
72 mbox_handler_nix_txsch_alloc(vf, in otx2vf_process_vfaf_mbox_msg()
76 mbox_handler_nix_bp_enable(vf, (struct nix_bp_cfg_rsp *)msg); in otx2vf_process_vfaf_mbox_msg()
80 dev_err(vf->dev, in otx2vf_process_vfaf_mbox_msg()
113 static int otx2vf_process_mbox_msg_up(struct otx2_nic *vf, in otx2vf_process_mbox_msg_up() argument
121 otx2_reply_invalid_msg(&vf->mbox.mbox_up, 0, 0, req->id); in otx2vf_process_mbox_msg_up()
128 &vf->mbox.mbox_up, 0, in otx2vf_process_mbox_msg_up()
138 vf, (struct cgx_link_info_msg *)req, rsp); in otx2vf_process_mbox_msg_up()
141 otx2_reply_invalid_msg(&vf->mbox.mbox_up, 0, 0, req->id); in otx2vf_process_mbox_msg_up()
154 struct otx2_nic *vf; in otx2vf_vfaf_mbox_up_handler() local
158 vf = vf_mbox->pfvf; in otx2vf_vfaf_mbox_up_handler()
170 otx2vf_process_mbox_msg_up(vf, msg); in otx2vf_vfaf_mbox_up_handler()
179 struct otx2_nic *vf = (struct otx2_nic *)vf_irq; in otx2vf_vfaf_mbox_intr_handler() local
185 otx2_write64(vf, RVU_VF_INT, BIT_ULL(0)); in otx2vf_vfaf_mbox_intr_handler()
191 mbox = &vf->mbox.mbox; in otx2vf_vfaf_mbox_intr_handler()
199 vf->mbox.num_msgs = hdr->num_msgs; in otx2vf_vfaf_mbox_intr_handler()
203 queue_work(vf->mbox_wq, &vf->mbox.mbox_wrk); in otx2vf_vfaf_mbox_intr_handler()
206 mbox = &vf->mbox.mbox_up; in otx2vf_vfaf_mbox_intr_handler()
212 vf->mbox.up_num_msgs = hdr->num_msgs; in otx2vf_vfaf_mbox_intr_handler()
216 queue_work(vf->mbox_wq, &vf->mbox.mbox_up_wrk); in otx2vf_vfaf_mbox_intr_handler()
222 static void otx2vf_disable_mbox_intr(struct otx2_nic *vf) in otx2vf_disable_mbox_intr() argument
224 int vector = pci_irq_vector(vf->pdev, RVU_VF_INT_VEC_MBOX); in otx2vf_disable_mbox_intr()
227 otx2_write64(vf, RVU_VF_INT_ENA_W1C, BIT_ULL(0)); in otx2vf_disable_mbox_intr()
228 free_irq(vector, vf); in otx2vf_disable_mbox_intr()
231 static int otx2vf_register_mbox_intr(struct otx2_nic *vf, bool probe_pf) in otx2vf_register_mbox_intr() argument
233 struct otx2_hw *hw = &vf->hw; in otx2vf_register_mbox_intr()
241 err = request_irq(pci_irq_vector(vf->pdev, RVU_VF_INT_VEC_MBOX), in otx2vf_register_mbox_intr()
242 otx2vf_vfaf_mbox_intr_handler, 0, irq_name, vf); in otx2vf_register_mbox_intr()
244 dev_err(vf->dev, in otx2vf_register_mbox_intr()
252 otx2_write64(vf, RVU_VF_INT, BIT_ULL(0)); in otx2vf_register_mbox_intr()
253 otx2_write64(vf, RVU_VF_INT_ENA_W1S, BIT_ULL(0)); in otx2vf_register_mbox_intr()
259 req = otx2_mbox_alloc_msg_ready(&vf->mbox); in otx2vf_register_mbox_intr()
261 otx2vf_disable_mbox_intr(vf); in otx2vf_register_mbox_intr()
265 err = otx2_sync_mbox_msg(&vf->mbox); in otx2vf_register_mbox_intr()
267 dev_warn(vf->dev, in otx2vf_register_mbox_intr()
269 otx2vf_disable_mbox_intr(vf); in otx2vf_register_mbox_intr()
275 static void otx2vf_vfaf_mbox_destroy(struct otx2_nic *vf) in otx2vf_vfaf_mbox_destroy() argument
277 struct mbox *mbox = &vf->mbox; in otx2vf_vfaf_mbox_destroy()
279 if (vf->mbox_wq) { in otx2vf_vfaf_mbox_destroy()
280 flush_workqueue(vf->mbox_wq); in otx2vf_vfaf_mbox_destroy()
281 destroy_workqueue(vf->mbox_wq); in otx2vf_vfaf_mbox_destroy()
282 vf->mbox_wq = NULL; in otx2vf_vfaf_mbox_destroy()
285 if (mbox->mbox.hwbase && !test_bit(CN10K_MBOX, &vf->hw.cap_flag)) in otx2vf_vfaf_mbox_destroy()
292 static int otx2vf_vfaf_mbox_init(struct otx2_nic *vf) in otx2vf_vfaf_mbox_init() argument
294 struct mbox *mbox = &vf->mbox; in otx2vf_vfaf_mbox_init()
298 mbox->pfvf = vf; in otx2vf_vfaf_mbox_init()
299 vf->mbox_wq = alloc_workqueue("otx2_vfaf_mailbox", in otx2vf_vfaf_mbox_init()
302 if (!vf->mbox_wq) in otx2vf_vfaf_mbox_init()
305 if (test_bit(CN10K_MBOX, &vf->hw.cap_flag)) { in otx2vf_vfaf_mbox_init()
309 hwbase = vf->reg_base + RVU_VF_MBOX_REGION; in otx2vf_vfaf_mbox_init()
315 hwbase = ioremap_wc(pci_resource_start(vf->pdev, in otx2vf_vfaf_mbox_init()
317 pci_resource_len(vf->pdev, in otx2vf_vfaf_mbox_init()
320 dev_err(vf->dev, "Unable to map VFAF mailbox region\n"); in otx2vf_vfaf_mbox_init()
326 err = otx2_mbox_init(&mbox->mbox, hwbase, vf->pdev, vf->reg_base, in otx2vf_vfaf_mbox_init()
331 err = otx2_mbox_init(&mbox->mbox_up, hwbase, vf->pdev, vf->reg_base, in otx2vf_vfaf_mbox_init()
336 err = otx2_mbox_bbuf_init(mbox, vf->pdev); in otx2vf_vfaf_mbox_init()
346 if (hwbase && !test_bit(CN10K_MBOX, &vf->hw.cap_flag)) in otx2vf_vfaf_mbox_init()
348 destroy_workqueue(vf->mbox_wq); in otx2vf_vfaf_mbox_init()
354 struct otx2_nic *vf; in otx2vf_open() local
362 vf = netdev_priv(netdev); in otx2vf_open()
363 if (is_otx2_lbkvf(vf->pdev)) { in otx2vf_open()
379 struct otx2_nic *vf = netdev_priv(netdev); in otx2vf_xmit() local
384 sq = &vf->qset.sq[qidx]; in otx2vf_xmit()
404 struct otx2_nic *vf = netdev_priv(netdev); in otx2vf_set_rx_mode() local
406 queue_work(vf->otx2_wq, &vf->rx_mode_work); in otx2vf_set_rx_mode()
411 struct otx2_nic *vf = container_of(work, struct otx2_nic, rx_mode_work); in otx2vf_do_set_rx_mode() local
412 struct net_device *netdev = vf->netdev; in otx2vf_do_set_rx_mode()
416 mutex_lock(&vf->mbox.lock); in otx2vf_do_set_rx_mode()
418 req = otx2_mbox_alloc_msg_nix_set_rx_mode(&vf->mbox); in otx2vf_do_set_rx_mode()
420 mutex_unlock(&vf->mbox.lock); in otx2vf_do_set_rx_mode()
433 otx2_sync_mbox_msg(&vf->mbox); in otx2vf_do_set_rx_mode()
435 mutex_unlock(&vf->mbox.lock); in otx2vf_do_set_rx_mode()
458 struct otx2_nic *vf = container_of(work, struct otx2_nic, reset_task); in otx2vf_reset_task() local
462 if (netif_running(vf->netdev)) { in otx2vf_reset_task()
463 otx2vf_stop(vf->netdev); in otx2vf_reset_task()
464 vf->reset_count++; in otx2vf_reset_task()
465 otx2vf_open(vf->netdev); in otx2vf_reset_task()
476 struct otx2_nic *vf = netdev_priv(netdev); in otx2vf_set_features() local
480 otx2_mcam_flow_del(vf); in otx2vf_set_features()
484 if (!otx2_get_maxflows(vf->flow_cfg)) { in otx2vf_set_features()
505 static int otx2_wq_init(struct otx2_nic *vf) in otx2_wq_init() argument
507 vf->otx2_wq = create_singlethread_workqueue("otx2vf_wq"); in otx2_wq_init()
508 if (!vf->otx2_wq) in otx2_wq_init()
511 INIT_WORK(&vf->rx_mode_work, otx2vf_do_set_rx_mode); in otx2_wq_init()
512 INIT_WORK(&vf->reset_task, otx2vf_reset_task); in otx2_wq_init()
516 static int otx2vf_realloc_msix_vectors(struct otx2_nic *vf) in otx2vf_realloc_msix_vectors() argument
518 struct otx2_hw *hw = &vf->hw; in otx2vf_realloc_msix_vectors()
524 otx2vf_disable_mbox_intr(vf); in otx2vf_realloc_msix_vectors()
528 dev_err(vf->dev, "%s: Failed to realloc %d IRQ vectors\n", in otx2vf_realloc_msix_vectors()
533 return otx2vf_register_mbox_intr(vf, false); in otx2vf_realloc_msix_vectors()
541 struct otx2_nic *vf; in otx2vf_probe() local
566 netdev = alloc_etherdev_mqs(sizeof(*vf), qcount, qcount); in otx2vf_probe()
574 vf = netdev_priv(netdev); in otx2vf_probe()
575 vf->netdev = netdev; in otx2vf_probe()
576 vf->pdev = pdev; in otx2vf_probe()
577 vf->dev = dev; in otx2vf_probe()
578 vf->iommu_domain = iommu_get_domain_for_dev(dev); in otx2vf_probe()
580 vf->flags |= OTX2_FLAG_INTF_DOWN; in otx2vf_probe()
581 hw = &vf->hw; in otx2vf_probe()
582 hw->pdev = vf->pdev; in otx2vf_probe()
608 vf->reg_base = pcim_iomap(pdev, PCI_CFG_REG_BAR_NUM, 0); in otx2vf_probe()
609 if (!vf->reg_base) { in otx2vf_probe()
615 otx2_setup_dev_hw_settings(vf); in otx2vf_probe()
617 err = otx2vf_vfaf_mbox_init(vf); in otx2vf_probe()
622 err = otx2vf_register_mbox_intr(vf, true); in otx2vf_probe()
627 err = otx2_attach_npa_nix(vf); in otx2vf_probe()
631 err = otx2vf_realloc_msix_vectors(vf); in otx2vf_probe()
639 err = cn10k_lmtst_init(vf); in otx2vf_probe()
666 netdev->max_mtu = otx2_get_max_mtu(vf); in otx2vf_probe()
669 if (is_otx2_lbkvf(vf->pdev)) { in otx2vf_probe()
672 n = (vf->pcifunc >> RVU_PFVF_FUNC_SHIFT) & RVU_PFVF_FUNC_MASK; in otx2vf_probe()
684 err = otx2_wq_init(vf); in otx2vf_probe()
690 err = otx2vf_mcam_flow_init(vf); in otx2vf_probe()
694 err = otx2_register_dl(vf); in otx2vf_probe()
703 free_percpu(vf->hw.lmt_info); in otx2vf_probe()
704 if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) in otx2vf_probe()
705 qmem_free(vf->dev, vf->dync_lmt); in otx2vf_probe()
706 otx2_detach_resources(&vf->mbox); in otx2vf_probe()
708 otx2vf_disable_mbox_intr(vf); in otx2vf_probe()
710 otx2vf_vfaf_mbox_destroy(vf); in otx2vf_probe()
724 struct otx2_nic *vf; in otx2vf_remove() local
729 vf = netdev_priv(netdev); in otx2vf_remove()
732 if (vf->flags & OTX2_FLAG_RX_PAUSE_ENABLED || in otx2vf_remove()
733 (vf->flags & OTX2_FLAG_TX_PAUSE_ENABLED)) { in otx2vf_remove()
734 vf->flags &= ~OTX2_FLAG_RX_PAUSE_ENABLED; in otx2vf_remove()
735 vf->flags &= ~OTX2_FLAG_TX_PAUSE_ENABLED; in otx2vf_remove()
736 otx2_config_pause_frm(vf); in otx2vf_remove()
739 cancel_work_sync(&vf->reset_task); in otx2vf_remove()
740 otx2_unregister_dl(vf); in otx2vf_remove()
742 if (vf->otx2_wq) in otx2vf_remove()
743 destroy_workqueue(vf->otx2_wq); in otx2vf_remove()
744 otx2vf_disable_mbox_intr(vf); in otx2vf_remove()
745 otx2_detach_resources(&vf->mbox); in otx2vf_remove()
746 free_percpu(vf->hw.lmt_info); in otx2vf_remove()
747 if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) in otx2vf_remove()
748 qmem_free(vf->dev, vf->dync_lmt); in otx2vf_remove()
749 otx2vf_vfaf_mbox_destroy(vf); in otx2vf_remove()
750 pci_free_irq_vectors(vf->pdev); in otx2vf_remove()