Lines Matching refs:hwr
7354 __bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in __bnxt_hwrm_reserve_pf_rings() argument
7363 enables |= hwr->tx ? FUNC_CFG_REQ_ENABLES_NUM_TX_RINGS : 0; in __bnxt_hwrm_reserve_pf_rings()
7364 req->num_tx_rings = cpu_to_le16(hwr->tx); in __bnxt_hwrm_reserve_pf_rings()
7366 enables |= hwr->rx ? FUNC_CFG_REQ_ENABLES_NUM_RX_RINGS : 0; in __bnxt_hwrm_reserve_pf_rings()
7367 enables |= hwr->stat ? FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; in __bnxt_hwrm_reserve_pf_rings()
7369 enables |= hwr->cp ? FUNC_CFG_REQ_ENABLES_NUM_MSIX : 0; in __bnxt_hwrm_reserve_pf_rings()
7370 enables |= hwr->cp_p5 ? in __bnxt_hwrm_reserve_pf_rings()
7373 enables |= hwr->cp ? in __bnxt_hwrm_reserve_pf_rings()
7375 enables |= hwr->grp ? in __bnxt_hwrm_reserve_pf_rings()
7378 enables |= hwr->vnic ? FUNC_CFG_REQ_ENABLES_NUM_VNICS : 0; in __bnxt_hwrm_reserve_pf_rings()
7379 enables |= hwr->rss_ctx ? FUNC_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : in __bnxt_hwrm_reserve_pf_rings()
7381 req->num_rx_rings = cpu_to_le16(hwr->rx); in __bnxt_hwrm_reserve_pf_rings()
7382 req->num_rsscos_ctxs = cpu_to_le16(hwr->rss_ctx); in __bnxt_hwrm_reserve_pf_rings()
7384 req->num_cmpl_rings = cpu_to_le16(hwr->cp_p5); in __bnxt_hwrm_reserve_pf_rings()
7385 req->num_msix = cpu_to_le16(hwr->cp); in __bnxt_hwrm_reserve_pf_rings()
7387 req->num_cmpl_rings = cpu_to_le16(hwr->cp); in __bnxt_hwrm_reserve_pf_rings()
7388 req->num_hw_ring_grps = cpu_to_le16(hwr->grp); in __bnxt_hwrm_reserve_pf_rings()
7390 req->num_stat_ctxs = cpu_to_le16(hwr->stat); in __bnxt_hwrm_reserve_pf_rings()
7391 req->num_vnics = cpu_to_le16(hwr->vnic); in __bnxt_hwrm_reserve_pf_rings()
7398 __bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in __bnxt_hwrm_reserve_vf_rings() argument
7406 enables |= hwr->tx ? FUNC_VF_CFG_REQ_ENABLES_NUM_TX_RINGS : 0; in __bnxt_hwrm_reserve_vf_rings()
7407 enables |= hwr->rx ? FUNC_VF_CFG_REQ_ENABLES_NUM_RX_RINGS | in __bnxt_hwrm_reserve_vf_rings()
7409 enables |= hwr->stat ? FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; in __bnxt_hwrm_reserve_vf_rings()
7410 enables |= hwr->rss_ctx ? FUNC_VF_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; in __bnxt_hwrm_reserve_vf_rings()
7412 enables |= hwr->cp_p5 ? in __bnxt_hwrm_reserve_vf_rings()
7415 enables |= hwr->cp ? FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0; in __bnxt_hwrm_reserve_vf_rings()
7416 enables |= hwr->grp ? in __bnxt_hwrm_reserve_vf_rings()
7419 enables |= hwr->vnic ? FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS : 0; in __bnxt_hwrm_reserve_vf_rings()
7423 req->num_tx_rings = cpu_to_le16(hwr->tx); in __bnxt_hwrm_reserve_vf_rings()
7424 req->num_rx_rings = cpu_to_le16(hwr->rx); in __bnxt_hwrm_reserve_vf_rings()
7425 req->num_rsscos_ctxs = cpu_to_le16(hwr->rss_ctx); in __bnxt_hwrm_reserve_vf_rings()
7427 req->num_cmpl_rings = cpu_to_le16(hwr->cp_p5); in __bnxt_hwrm_reserve_vf_rings()
7429 req->num_cmpl_rings = cpu_to_le16(hwr->cp); in __bnxt_hwrm_reserve_vf_rings()
7430 req->num_hw_ring_grps = cpu_to_le16(hwr->grp); in __bnxt_hwrm_reserve_vf_rings()
7432 req->num_stat_ctxs = cpu_to_le16(hwr->stat); in __bnxt_hwrm_reserve_vf_rings()
7433 req->num_vnics = cpu_to_le16(hwr->vnic); in __bnxt_hwrm_reserve_vf_rings()
7440 bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_hwrm_reserve_pf_rings() argument
7445 req = __bnxt_hwrm_reserve_pf_rings(bp, hwr); in bnxt_hwrm_reserve_pf_rings()
7459 bp->hw_resc.resv_tx_rings = hwr->tx; in bnxt_hwrm_reserve_pf_rings()
7465 bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_hwrm_reserve_vf_rings() argument
7471 bp->hw_resc.resv_tx_rings = hwr->tx; in bnxt_hwrm_reserve_vf_rings()
7475 req = __bnxt_hwrm_reserve_vf_rings(bp, hwr); in bnxt_hwrm_reserve_vf_rings()
7486 static int bnxt_hwrm_reserve_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_hwrm_reserve_rings() argument
7489 return bnxt_hwrm_reserve_pf_rings(bp, hwr); in bnxt_hwrm_reserve_rings()
7491 return bnxt_hwrm_reserve_vf_rings(bp, hwr); in bnxt_hwrm_reserve_rings()
7515 static int bnxt_get_total_rss_ctxs(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_get_total_rss_ctxs() argument
7517 if (!hwr->grp) in bnxt_get_total_rss_ctxs()
7520 int rss_ctx = bnxt_get_nr_rss_ctxs(bp, hwr->grp); in bnxt_get_total_rss_ctxs()
7523 rss_ctx *= hwr->vnic; in bnxt_get_total_rss_ctxs()
7529 return hwr->grp + 1; in bnxt_get_total_rss_ctxs()
7598 static void bnxt_copy_reserved_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_copy_reserved_rings() argument
7602 hwr->tx = hw_resc->resv_tx_rings; in bnxt_copy_reserved_rings()
7604 hwr->rx = hw_resc->resv_rx_rings; in bnxt_copy_reserved_rings()
7605 hwr->cp = hw_resc->resv_irqs; in bnxt_copy_reserved_rings()
7607 hwr->cp_p5 = hw_resc->resv_cp_rings; in bnxt_copy_reserved_rings()
7608 hwr->grp = hw_resc->resv_hw_ring_grps; in bnxt_copy_reserved_rings()
7609 hwr->vnic = hw_resc->resv_vnics; in bnxt_copy_reserved_rings()
7610 hwr->stat = hw_resc->resv_stat_ctxs; in bnxt_copy_reserved_rings()
7611 hwr->rss_ctx = hw_resc->resv_rsscos_ctxs; in bnxt_copy_reserved_rings()
7615 static bool bnxt_rings_ok(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_rings_ok() argument
7617 return hwr->tx && hwr->rx && hwr->cp && hwr->grp && hwr->vnic && in bnxt_rings_ok()
7618 hwr->stat && (hwr->cp_p5 || !(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)); in bnxt_rings_ok()
7625 struct bnxt_hw_rings hwr = {0}; in __bnxt_reserve_rings() local
7642 hwr.cp = cp + ulp_msix; in __bnxt_reserve_rings()
7644 hwr.cp = bnxt_nq_rings_in_use(bp); in __bnxt_reserve_rings()
7647 hwr.tx = bp->tx_nr_rings; in __bnxt_reserve_rings()
7648 hwr.rx = bp->rx_nr_rings; in __bnxt_reserve_rings()
7652 hwr.cp_p5 = hwr.rx + hwr.tx; in __bnxt_reserve_rings()
7654 hwr.vnic = bnxt_get_total_vnics(bp, hwr.rx); in __bnxt_reserve_rings()
7657 hwr.rx <<= 1; in __bnxt_reserve_rings()
7658 hwr.grp = bp->rx_nr_rings; in __bnxt_reserve_rings()
7659 hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr); in __bnxt_reserve_rings()
7660 hwr.stat = bnxt_get_func_stat_ctxs(bp); in __bnxt_reserve_rings()
7663 rc = bnxt_hwrm_reserve_rings(bp, &hwr); in __bnxt_reserve_rings()
7667 bnxt_copy_reserved_rings(bp, &hwr); in __bnxt_reserve_rings()
7669 rx_rings = hwr.rx; in __bnxt_reserve_rings()
7671 if (hwr.rx >= 2) { in __bnxt_reserve_rings()
7672 rx_rings = hwr.rx >> 1; in __bnxt_reserve_rings()
7684 rx_rings = min_t(int, rx_rings, hwr.grp); in __bnxt_reserve_rings()
7685 hwr.cp = min_t(int, hwr.cp, bp->cp_nr_rings); in __bnxt_reserve_rings()
7686 if (hwr.stat > bnxt_get_ulp_stat_ctxs(bp)) in __bnxt_reserve_rings()
7687 hwr.stat -= bnxt_get_ulp_stat_ctxs(bp); in __bnxt_reserve_rings()
7688 hwr.cp = min_t(int, hwr.cp, hwr.stat); in __bnxt_reserve_rings()
7689 rc = bnxt_trim_rings(bp, &rx_rings, &hwr.tx, hwr.cp, sh); in __bnxt_reserve_rings()
7691 hwr.rx = rx_rings << 1; in __bnxt_reserve_rings()
7692 tx_cp = bnxt_num_tx_to_cp(bp, hwr.tx); in __bnxt_reserve_rings()
7693 hwr.cp = sh ? max_t(int, tx_cp, rx_rings) : tx_cp + rx_rings; in __bnxt_reserve_rings()
7694 bp->tx_nr_rings = hwr.tx; in __bnxt_reserve_rings()
7711 bp->cp_nr_rings = hwr.cp; in __bnxt_reserve_rings()
7713 if (!bnxt_rings_ok(bp, &hwr)) in __bnxt_reserve_rings()
7736 static int bnxt_hwrm_check_vf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_hwrm_check_vf_rings() argument
7744 req = __bnxt_hwrm_reserve_vf_rings(bp, hwr); in bnxt_hwrm_check_vf_rings()
7758 static int bnxt_hwrm_check_pf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_hwrm_check_pf_rings() argument
7763 req = __bnxt_hwrm_reserve_pf_rings(bp, hwr); in bnxt_hwrm_check_pf_rings()
7781 static int bnxt_hwrm_check_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) in bnxt_hwrm_check_rings() argument
7787 return bnxt_hwrm_check_pf_rings(bp, hwr); in bnxt_hwrm_check_rings()
7789 return bnxt_hwrm_check_vf_rings(bp, hwr); in bnxt_hwrm_check_rings()
12818 struct bnxt_hw_rings hwr = {0}; in bnxt_rfs_capable() local
12828 hwr.grp = bp->rx_nr_rings; in bnxt_rfs_capable()
12829 hwr.vnic = bnxt_get_total_vnics(bp, bp->rx_nr_rings); in bnxt_rfs_capable()
12831 hwr.vnic++; in bnxt_rfs_capable()
12832 hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr); in bnxt_rfs_capable()
12836 if (hwr.vnic > max_vnics || hwr.rss_ctx > max_rss_ctxs) { in bnxt_rfs_capable()
12851 if (hwr.vnic <= bp->hw_resc.resv_vnics && in bnxt_rfs_capable()
12852 hwr.rss_ctx <= bp->hw_resc.resv_rsscos_ctxs) in bnxt_rfs_capable()
12855 bnxt_hwrm_reserve_rings(bp, &hwr); in bnxt_rfs_capable()
12856 if (hwr.vnic <= bp->hw_resc.resv_vnics && in bnxt_rfs_capable()
12857 hwr.rss_ctx <= bp->hw_resc.resv_rsscos_ctxs) in bnxt_rfs_capable()
12861 hwr.vnic = 1; in bnxt_rfs_capable()
12862 hwr.rss_ctx = 0; in bnxt_rfs_capable()
12863 bnxt_hwrm_reserve_rings(bp, &hwr); in bnxt_rfs_capable()
13810 struct bnxt_hw_rings hwr = {0}; in bnxt_check_rings() local
13825 hwr.rx = rx_rings; in bnxt_check_rings()
13826 hwr.tx = tx * tx_sets + tx_xdp; in bnxt_check_rings()
13827 if (max_tx < hwr.tx) in bnxt_check_rings()
13830 hwr.vnic = bnxt_get_total_vnics(bp, rx); in bnxt_check_rings()
13832 tx_cp = __bnxt_num_tx_to_cp(bp, hwr.tx, tx_sets, tx_xdp); in bnxt_check_rings()
13833 hwr.cp = sh ? max_t(int, tx_cp, rx) : tx_cp + rx; in bnxt_check_rings()
13834 if (max_cp < hwr.cp) in bnxt_check_rings()
13836 hwr.stat = hwr.cp; in bnxt_check_rings()
13838 hwr.cp += bnxt_get_ulp_msix_num_in_use(bp); in bnxt_check_rings()
13839 hwr.stat += bnxt_get_ulp_stat_ctxs_in_use(bp); in bnxt_check_rings()
13840 hwr.grp = rx; in bnxt_check_rings()
13841 hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr); in bnxt_check_rings()
13844 hwr.cp_p5 = hwr.tx + rx; in bnxt_check_rings()
13845 rc = bnxt_hwrm_check_rings(bp, &hwr); in bnxt_check_rings()
13848 hwr.cp += bnxt_get_ulp_msix_num(bp); in bnxt_check_rings()
13849 hwr.cp = min_t(int, hwr.cp, bnxt_get_max_func_irqs(bp)); in bnxt_check_rings()
13851 if (hwr.cp > bp->total_irqs) { in bnxt_check_rings()
13852 int total_msix = bnxt_change_msix(bp, hwr.cp); in bnxt_check_rings()
13854 if (total_msix < hwr.cp) { in bnxt_check_rings()
13856 hwr.cp, total_msix); in bnxt_check_rings()