Lines Matching refs:num_vfs

350 static int bnxt_set_vf_attr(struct bnxt *bp, int num_vfs)  in bnxt_set_vf_attr()  argument
355 for (i = 0; i < num_vfs; i++) { in bnxt_set_vf_attr()
362 static int bnxt_hwrm_func_vf_resource_free(struct bnxt *bp, int num_vfs) in bnxt_hwrm_func_vf_resource_free() argument
371 for (i = pf->first_vf_id; i < pf->first_vf_id + num_vfs; i++) { in bnxt_hwrm_func_vf_resource_free()
404 static int bnxt_alloc_vf_resources(struct bnxt *bp, int num_vfs) in bnxt_alloc_vf_resources() argument
409 bp->pf.vf = kcalloc(num_vfs, sizeof(struct bnxt_vf_info), GFP_KERNEL); in bnxt_alloc_vf_resources()
413 bnxt_set_vf_attr(bp, num_vfs); in bnxt_alloc_vf_resources()
415 size = num_vfs * BNXT_HWRM_REQ_MAX_SIZE; in bnxt_alloc_vf_resources()
429 for (j = 0; j < BNXT_HWRM_REQS_PER_PAGE && k < num_vfs; j++) { in bnxt_alloc_vf_resources()
502 static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset) in bnxt_hwrm_func_vf_resc_cfg() argument
548 vf_cp_rings /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
549 vf_tx_rings /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
550 vf_rx_rings /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
551 vf_vnics /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
552 vf_stat_ctx /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
553 vf_ring_grps /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
554 vf_rss /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
574 req.max_msix = cpu_to_le16(vf_msix / num_vfs); in bnxt_hwrm_func_vf_resc_cfg()
577 for (i = 0; i < num_vfs; i++) { in bnxt_hwrm_func_vf_resc_cfg()
612 static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) in bnxt_hwrm_func_cfg() argument
625 vf_cp_rings = bnxt_get_avail_cp_rings_for_en(bp) / num_vfs; in bnxt_hwrm_func_cfg()
626 vf_stat_ctx = bnxt_get_avail_stat_ctxs_for_en(bp) / num_vfs; in bnxt_hwrm_func_cfg()
629 num_vfs; in bnxt_hwrm_func_cfg()
632 num_vfs; in bnxt_hwrm_func_cfg()
633 vf_ring_grps = (hw_resc->max_hw_ring_grps - bp->rx_nr_rings) / num_vfs; in bnxt_hwrm_func_cfg()
634 vf_tx_rings = (hw_resc->max_tx_rings - bp->tx_nr_rings) / num_vfs; in bnxt_hwrm_func_cfg()
635 vf_vnics = (hw_resc->max_vnics - bp->nr_vnics) / num_vfs; in bnxt_hwrm_func_cfg()
665 for (i = 0; i < num_vfs; i++) { in bnxt_hwrm_func_cfg()
684 hw_resc->max_rx_rings -= vf_rx_rings * num_vfs; in bnxt_hwrm_func_cfg()
685 hw_resc->max_hw_ring_grps -= vf_ring_grps * num_vfs; in bnxt_hwrm_func_cfg()
686 hw_resc->max_cp_rings -= vf_cp_rings * num_vfs; in bnxt_hwrm_func_cfg()
687 hw_resc->max_rsscos_ctxs -= num_vfs; in bnxt_hwrm_func_cfg()
688 hw_resc->max_stat_ctxs -= vf_stat_ctx * num_vfs; in bnxt_hwrm_func_cfg()
689 hw_resc->max_vnics -= vf_vnics * num_vfs; in bnxt_hwrm_func_cfg()
695 static int bnxt_func_cfg(struct bnxt *bp, int num_vfs, bool reset) in bnxt_func_cfg() argument
698 return bnxt_hwrm_func_vf_resc_cfg(bp, num_vfs, reset); in bnxt_func_cfg()
700 return bnxt_hwrm_func_cfg(bp, num_vfs); in bnxt_func_cfg()
703 int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset) in bnxt_cfg_hw_sriov() argument
713 rc = bnxt_func_cfg(bp, *num_vfs, reset); in bnxt_cfg_hw_sriov()
714 if (rc != *num_vfs) { in bnxt_cfg_hw_sriov()
717 *num_vfs = 0; in bnxt_cfg_hw_sriov()
722 *num_vfs = rc; in bnxt_cfg_hw_sriov()
725 bnxt_ulp_sriov_cfg(bp, *num_vfs); in bnxt_cfg_hw_sriov()
729 static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) in bnxt_sriov_enable() argument
741 vfs_supported = *num_vfs; in bnxt_sriov_enable()
784 if (vfs_supported != *num_vfs) { in bnxt_sriov_enable()
786 *num_vfs, vfs_supported); in bnxt_sriov_enable()
787 *num_vfs = vfs_supported; in bnxt_sriov_enable()
790 rc = bnxt_alloc_vf_resources(bp, *num_vfs); in bnxt_sriov_enable()
794 rc = bnxt_cfg_hw_sriov(bp, num_vfs, false); in bnxt_sriov_enable()
798 rc = pci_enable_sriov(bp->pdev, *num_vfs); in bnxt_sriov_enable()
806 bnxt_hwrm_func_vf_resource_free(bp, *num_vfs); in bnxt_sriov_enable()
816 u16 num_vfs = pci_num_vf(bp->pdev); in bnxt_sriov_disable() local
818 if (!num_vfs) in bnxt_sriov_disable()
829 num_vfs); in bnxt_sriov_disable()
833 bnxt_hwrm_func_vf_resource_free(bp, num_vfs); in bnxt_sriov_disable()
847 int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs) in bnxt_sriov_configure() argument
873 num_vfs = 0; in bnxt_sriov_configure()
878 if (num_vfs && num_vfs == bp->pf.active_vfs) in bnxt_sriov_configure()
883 if (!num_vfs) in bnxt_sriov_configure()
886 bnxt_sriov_enable(bp, &num_vfs); in bnxt_sriov_configure()
892 return num_vfs; in bnxt_sriov_configure()
1179 int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset) in bnxt_cfg_hw_sriov() argument
1181 if (*num_vfs) in bnxt_cfg_hw_sriov()