Lines Matching refs:pfvf
27 static void rvu_set_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf,
29 static void rvu_clear_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf,
341 static void rvu_update_rsrc_map(struct rvu *rvu, struct rvu_pfvf *pfvf, in rvu_update_rsrc_map() argument
369 pfvf->npalf = attach ? true : false; in rvu_update_rsrc_map()
370 num_lfs = pfvf->npalf; in rvu_update_rsrc_map()
374 pfvf->nixlf = attach ? true : false; in rvu_update_rsrc_map()
375 num_lfs = pfvf->nixlf; in rvu_update_rsrc_map()
378 attach ? pfvf->sso++ : pfvf->sso--; in rvu_update_rsrc_map()
379 num_lfs = pfvf->sso; in rvu_update_rsrc_map()
382 attach ? pfvf->ssow++ : pfvf->ssow--; in rvu_update_rsrc_map()
383 num_lfs = pfvf->ssow; in rvu_update_rsrc_map()
386 attach ? pfvf->timlfs++ : pfvf->timlfs--; in rvu_update_rsrc_map()
387 num_lfs = pfvf->timlfs; in rvu_update_rsrc_map()
390 attach ? pfvf->cptlfs++ : pfvf->cptlfs--; in rvu_update_rsrc_map()
391 num_lfs = pfvf->cptlfs; in rvu_update_rsrc_map()
394 attach ? pfvf->cpt1_lfs++ : pfvf->cpt1_lfs--; in rvu_update_rsrc_map()
395 num_lfs = pfvf->cpt1_lfs; in rvu_update_rsrc_map()
555 struct rvu_pfvf *pfvf; in rvu_scan_block() local
569 pfvf = rvu_get_pfvf(rvu, (cfg >> 8) & 0xFFFF); in rvu_scan_block()
570 rvu_update_rsrc_map(rvu, pfvf, block, in rvu_scan_block()
574 rvu_set_msix_offset(rvu, pfvf, block, lf); in rvu_scan_block()
610 struct rvu_pfvf *pfvf; in rvu_setup_msix_resources() local
622 pfvf = &rvu->pf[pf]; in rvu_setup_msix_resources()
625 pfvf->msix.max = ((cfg >> 32) & 0xFFF) + 1; in rvu_setup_msix_resources()
626 rvu_check_min_msix_vec(rvu, pfvf->msix.max, pf, 0); in rvu_setup_msix_resources()
629 err = rvu_alloc_bitmap(&pfvf->msix); in rvu_setup_msix_resources()
634 pfvf->msix_lfmap = devm_kcalloc(rvu->dev, pfvf->msix.max, in rvu_setup_msix_resources()
636 if (!pfvf->msix_lfmap) in rvu_setup_msix_resources()
652 offset = rvu_alloc_rsrc_contig(&pfvf->msix, nvecs); in rvu_setup_msix_resources()
658 pfvf = &rvu->hwvf[hwvf + vf]; in rvu_setup_msix_resources()
662 pfvf->msix.max = (cfg & 0xFFF) + 1; in rvu_setup_msix_resources()
663 rvu_check_min_msix_vec(rvu, pfvf->msix.max, pf, vf + 1); in rvu_setup_msix_resources()
666 err = rvu_alloc_bitmap(&pfvf->msix); in rvu_setup_msix_resources()
670 pfvf->msix_lfmap = in rvu_setup_msix_resources()
671 devm_kcalloc(rvu->dev, pfvf->msix.max, in rvu_setup_msix_resources()
673 if (!pfvf->msix_lfmap) in rvu_setup_msix_resources()
684 offset = rvu_alloc_rsrc_contig(&pfvf->msix, nvecs); in rvu_setup_msix_resources()
727 struct rvu_pfvf *pfvf; in rvu_free_hw_resources() local
743 pfvf = &rvu->pf[id]; in rvu_free_hw_resources()
744 kfree(pfvf->msix.bmap); in rvu_free_hw_resources()
748 pfvf = &rvu->hwvf[id]; in rvu_free_hw_resources()
749 kfree(pfvf->msix.bmap); in rvu_free_hw_resources()
769 struct rvu_pfvf *pfvf; in rvu_setup_pfvf_macaddress() local
780 pfvf = &rvu->pf[pf]; in rvu_setup_pfvf_macaddress()
784 u64_to_ether_addr(*mac, pfvf->mac_addr); in rvu_setup_pfvf_macaddress()
786 eth_random_addr(pfvf->mac_addr); in rvu_setup_pfvf_macaddress()
788 eth_random_addr(pfvf->mac_addr); in rvu_setup_pfvf_macaddress()
790 ether_addr_copy(pfvf->default_mac, pfvf->mac_addr); in rvu_setup_pfvf_macaddress()
796 pfvf = &rvu->hwvf[hwvf]; in rvu_setup_pfvf_macaddress()
800 u64_to_ether_addr(*mac, pfvf->mac_addr); in rvu_setup_pfvf_macaddress()
802 eth_random_addr(pfvf->mac_addr); in rvu_setup_pfvf_macaddress()
804 eth_random_addr(pfvf->mac_addr); in rvu_setup_pfvf_macaddress()
806 ether_addr_copy(pfvf->default_mac, pfvf->mac_addr); in rvu_setup_pfvf_macaddress()
1244 u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blkaddr) in rvu_get_rsrc_mapcount() argument
1248 return pfvf->npalf ? 1 : 0; in rvu_get_rsrc_mapcount()
1251 return pfvf->nixlf ? 1 : 0; in rvu_get_rsrc_mapcount()
1253 return pfvf->sso; in rvu_get_rsrc_mapcount()
1255 return pfvf->ssow; in rvu_get_rsrc_mapcount()
1257 return pfvf->timlfs; in rvu_get_rsrc_mapcount()
1259 return pfvf->cptlfs; in rvu_get_rsrc_mapcount()
1261 return pfvf->cpt1_lfs; in rvu_get_rsrc_mapcount()
1267 static bool is_blktype_attached(struct rvu_pfvf *pfvf, int blktype) in is_blktype_attached() argument
1271 return pfvf->npalf ? 1 : 0; in is_blktype_attached()
1273 return pfvf->nixlf ? 1 : 0; in is_blktype_attached()
1275 return !!pfvf->sso; in is_blktype_attached()
1277 return !!pfvf->ssow; in is_blktype_attached()
1279 return !!pfvf->timlfs; in is_blktype_attached()
1281 return pfvf->cptlfs || pfvf->cpt1_lfs; in is_blktype_attached()
1289 struct rvu_pfvf *pfvf; in is_pffunc_map_valid() local
1294 pfvf = rvu_get_pfvf(rvu, pcifunc); in is_pffunc_map_valid()
1297 if (!is_blktype_attached(pfvf, blktype)) in is_pffunc_map_valid()
1327 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_get_blkaddr_from_slot() local
1334 if (!is_blktype_attached(pfvf, blktype)) in rvu_get_blkaddr_from_slot()
1347 numlfs = rvu_get_rsrc_mapcount(pfvf, blkaddr); in rvu_get_blkaddr_from_slot()
1365 numlfs = rvu_get_rsrc_mapcount(pfvf, num_blkaddr[i]); in rvu_get_blkaddr_from_slot()
1380 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_detach_block() local
1391 rvu_nix_reset_mac(pfvf, pcifunc); in rvu_detach_block()
1395 num_lfs = rvu_get_rsrc_mapcount(pfvf, block->addr); in rvu_detach_block()
1409 rvu_update_rsrc_map(rvu, pfvf, block, in rvu_detach_block()
1416 rvu_clear_msix_offset(rvu, pfvf, block, lf); in rvu_detach_block()
1475 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_get_nix_blkaddr() local
1501 pfvf->nix_blkaddr = BLKADDR_NIX1; in rvu_get_nix_blkaddr()
1502 pfvf->nix_rx_intf = NIX_INTFX_RX(1); in rvu_get_nix_blkaddr()
1503 pfvf->nix_tx_intf = NIX_INTFX_TX(1); in rvu_get_nix_blkaddr()
1507 pfvf->nix_blkaddr = BLKADDR_NIX0; in rvu_get_nix_blkaddr()
1508 pfvf->nix_rx_intf = NIX_INTFX_RX(0); in rvu_get_nix_blkaddr()
1509 pfvf->nix_tx_intf = NIX_INTFX_TX(0); in rvu_get_nix_blkaddr()
1513 return pfvf->nix_blkaddr; in rvu_get_nix_blkaddr()
1546 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_attach_block() local
1573 rvu_update_rsrc_map(rvu, pfvf, block, in rvu_attach_block()
1577 rvu_set_msix_offset(rvu, pfvf, block, lf); in rvu_attach_block()
1584 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_check_rsrc_availability() local
1590 if (req->npalf && !is_blktype_attached(pfvf, BLKTYPE_NPA)) { in rvu_check_rsrc_availability()
1603 if (req->nixlf && !is_blktype_attached(pfvf, BLKTYPE_NIX)) { in rvu_check_rsrc_availability()
1628 mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->addr); in rvu_check_rsrc_availability()
1644 mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->addr); in rvu_check_rsrc_availability()
1659 mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->addr); in rvu_check_rsrc_availability()
1678 mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->addr); in rvu_check_rsrc_availability()
1772 static u16 rvu_get_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf, in rvu_get_msix_offset() argument
1780 for (vec = 0; vec < pfvf->msix.max; vec++) { in rvu_get_msix_offset()
1781 if (pfvf->msix_lfmap[vec] == MSIX_BLKLF(blkaddr, lf)) in rvu_get_msix_offset()
1787 static void rvu_set_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf, in rvu_set_msix_offset() argument
1798 if (!rvu_rsrc_check_contig(&pfvf->msix, nvecs)) in rvu_set_msix_offset()
1801 offset = rvu_alloc_rsrc_contig(&pfvf->msix, nvecs); in rvu_set_msix_offset()
1809 pfvf->msix_lfmap[offset + vec] = MSIX_BLKLF(block->addr, lf); in rvu_set_msix_offset()
1812 static void rvu_clear_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf, in rvu_clear_msix_offset() argument
1826 offset = rvu_get_msix_offset(rvu, pfvf, block->addr, lf); in rvu_clear_msix_offset()
1830 pfvf->msix_lfmap[offset + vec] = 0; in rvu_clear_msix_offset()
1833 rvu_free_rsrc_contig(&pfvf->msix, nvecs, offset); in rvu_clear_msix_offset()
1841 struct rvu_pfvf *pfvf; in rvu_mbox_handler_msix_offset() local
1844 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_msix_offset()
1845 if (!pfvf->msix.bmap) in rvu_mbox_handler_msix_offset()
1850 rsp->npa_msixoff = rvu_get_msix_offset(rvu, pfvf, BLKADDR_NPA, lf); in rvu_mbox_handler_msix_offset()
1858 rsp->nix_msixoff = rvu_get_msix_offset(rvu, pfvf, blkaddr, lf); in rvu_mbox_handler_msix_offset()
1861 rsp->sso = pfvf->sso; in rvu_mbox_handler_msix_offset()
1865 rvu_get_msix_offset(rvu, pfvf, BLKADDR_SSO, lf); in rvu_mbox_handler_msix_offset()
1868 rsp->ssow = pfvf->ssow; in rvu_mbox_handler_msix_offset()
1872 rvu_get_msix_offset(rvu, pfvf, BLKADDR_SSOW, lf); in rvu_mbox_handler_msix_offset()
1875 rsp->timlfs = pfvf->timlfs; in rvu_mbox_handler_msix_offset()
1879 rvu_get_msix_offset(rvu, pfvf, BLKADDR_TIM, lf); in rvu_mbox_handler_msix_offset()
1882 rsp->cptlfs = pfvf->cptlfs; in rvu_mbox_handler_msix_offset()
1886 rvu_get_msix_offset(rvu, pfvf, BLKADDR_CPT0, lf); in rvu_mbox_handler_msix_offset()
1889 rsp->cpt1_lfs = pfvf->cpt1_lfs; in rvu_mbox_handler_msix_offset()
1893 rvu_get_msix_offset(rvu, pfvf, BLKADDR_CPT1, lf); in rvu_mbox_handler_msix_offset()
2029 struct rvu_pfvf *pfvf; in rvu_mbox_handler_set_vf_perm() local
2038 pfvf = rvu_get_pfvf(rvu, target); in rvu_mbox_handler_set_vf_perm()
2041 pfvf->flags &= RVU_CLEAR_VF_PERM; in rvu_mbox_handler_set_vf_perm()
2042 } else if (test_bit(PF_SET_VF_TRUSTED, &pfvf->flags) ^ in rvu_mbox_handler_set_vf_perm()
2044 change_bit(PF_SET_VF_TRUSTED, &pfvf->flags); in rvu_mbox_handler_set_vf_perm()
2046 if (!test_bit(PF_SET_VF_TRUSTED, &pfvf->flags)) { in rvu_mbox_handler_set_vf_perm()
2853 struct rvu_pfvf *pfvf = &rvu->pf[0]; in rvu_afvf_msix_vectors_num_ok() local
2856 pfvf = &rvu->pf[0]; in rvu_afvf_msix_vectors_num_ok()
2863 return (pfvf->msix.max >= RVU_AF_INT_VEC_CNT + RVU_PF_INT_VEC_CNT) && in rvu_afvf_msix_vectors_num_ok()