Lines Matching refs:num_vfs

367 static int bnxt_set_vf_attr(struct bnxt *bp, int num_vfs)  in bnxt_set_vf_attr()  argument
372 for (i = 0; i < num_vfs; i++) { in bnxt_set_vf_attr()
379 static int bnxt_hwrm_func_vf_resource_free(struct bnxt *bp, int num_vfs) in bnxt_hwrm_func_vf_resource_free() argument
390 for (i = pf->first_vf_id; i < pf->first_vf_id + num_vfs; i++) { in bnxt_hwrm_func_vf_resource_free()
422 static int bnxt_alloc_vf_resources(struct bnxt *bp, int num_vfs) in bnxt_alloc_vf_resources() argument
427 bp->pf.vf = kcalloc(num_vfs, sizeof(struct bnxt_vf_info), GFP_KERNEL); in bnxt_alloc_vf_resources()
431 bnxt_set_vf_attr(bp, num_vfs); in bnxt_alloc_vf_resources()
433 size = num_vfs * BNXT_HWRM_REQ_MAX_SIZE; in bnxt_alloc_vf_resources()
447 for (j = 0; j < BNXT_HWRM_REQS_PER_PAGE && k < num_vfs; j++) { in bnxt_alloc_vf_resources()
524 static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset) in bnxt_hwrm_func_vf_resc_cfg() argument
572 vf_cp_rings /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
573 vf_tx_rings /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
574 vf_rx_rings /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
575 vf_vnics /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
576 vf_stat_ctx /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
577 vf_ring_grps /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
578 vf_rss /= num_vfs; in bnxt_hwrm_func_vf_resc_cfg()
598 req->max_msix = cpu_to_le16(vf_msix / num_vfs); in bnxt_hwrm_func_vf_resc_cfg()
601 for (i = 0; i < num_vfs; i++) { in bnxt_hwrm_func_vf_resc_cfg()
637 static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) in bnxt_hwrm_func_cfg() argument
653 vf_cp_rings = bnxt_get_avail_cp_rings_for_en(bp) / num_vfs; in bnxt_hwrm_func_cfg()
654 vf_stat_ctx = bnxt_get_avail_stat_ctxs_for_en(bp) / num_vfs; in bnxt_hwrm_func_cfg()
657 num_vfs; in bnxt_hwrm_func_cfg()
660 num_vfs; in bnxt_hwrm_func_cfg()
661 vf_ring_grps = (hw_resc->max_hw_ring_grps - bp->rx_nr_rings) / num_vfs; in bnxt_hwrm_func_cfg()
662 vf_tx_rings = (hw_resc->max_tx_rings - bp->tx_nr_rings) / num_vfs; in bnxt_hwrm_func_cfg()
663 vf_vnics = (hw_resc->max_vnics - bp->nr_vnics) / num_vfs; in bnxt_hwrm_func_cfg()
693 for (i = 0; i < num_vfs; i++) { in bnxt_hwrm_func_cfg()
711 hw_resc->max_rx_rings -= vf_rx_rings * num_vfs; in bnxt_hwrm_func_cfg()
712 hw_resc->max_hw_ring_grps -= vf_ring_grps * num_vfs; in bnxt_hwrm_func_cfg()
713 hw_resc->max_cp_rings -= vf_cp_rings * num_vfs; in bnxt_hwrm_func_cfg()
714 hw_resc->max_rsscos_ctxs -= num_vfs; in bnxt_hwrm_func_cfg()
715 hw_resc->max_stat_ctxs -= vf_stat_ctx * num_vfs; in bnxt_hwrm_func_cfg()
716 hw_resc->max_vnics -= vf_vnics * num_vfs; in bnxt_hwrm_func_cfg()
722 static int bnxt_func_cfg(struct bnxt *bp, int num_vfs, bool reset) in bnxt_func_cfg() argument
725 return bnxt_hwrm_func_vf_resc_cfg(bp, num_vfs, reset); in bnxt_func_cfg()
727 return bnxt_hwrm_func_cfg(bp, num_vfs); in bnxt_func_cfg()
730 int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset) in bnxt_cfg_hw_sriov() argument
740 rc = bnxt_func_cfg(bp, *num_vfs, reset); in bnxt_cfg_hw_sriov()
741 if (rc != *num_vfs) { in bnxt_cfg_hw_sriov()
744 *num_vfs = 0; in bnxt_cfg_hw_sriov()
749 *num_vfs = rc; in bnxt_cfg_hw_sriov()
755 static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) in bnxt_sriov_enable() argument
767 vfs_supported = *num_vfs; in bnxt_sriov_enable()
810 if (vfs_supported != *num_vfs) { in bnxt_sriov_enable()
812 *num_vfs, vfs_supported); in bnxt_sriov_enable()
813 *num_vfs = vfs_supported; in bnxt_sriov_enable()
816 rc = bnxt_alloc_vf_resources(bp, *num_vfs); in bnxt_sriov_enable()
820 rc = bnxt_cfg_hw_sriov(bp, num_vfs, false); in bnxt_sriov_enable()
824 rc = pci_enable_sriov(bp->pdev, *num_vfs); in bnxt_sriov_enable()
848 bnxt_hwrm_func_vf_resource_free(bp, *num_vfs); in bnxt_sriov_enable()
861 u16 num_vfs = pci_num_vf(bp->pdev); in bnxt_sriov_disable() local
863 if (!num_vfs) in bnxt_sriov_disable()
874 num_vfs); in bnxt_sriov_disable()
878 bnxt_hwrm_func_vf_resource_free(bp, num_vfs); in bnxt_sriov_disable()
890 int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs) in bnxt_sriov_configure() argument
916 num_vfs = 0; in bnxt_sriov_configure()
921 if (num_vfs && num_vfs == bp->pf.active_vfs) in bnxt_sriov_configure()
926 if (!num_vfs) in bnxt_sriov_configure()
929 bnxt_sriov_enable(bp, &num_vfs); in bnxt_sriov_configure()
935 return num_vfs; in bnxt_sriov_configure()
1245 int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset) in bnxt_cfg_hw_sriov() argument
1247 if (*num_vfs) in bnxt_cfg_hw_sriov()