ring_grp usage: * [0] = default completion ring * [1 -> +rx_cp_nr_rings] = rx_cp, rx rings * [1+rx_cp_nr_rings + 1 -> +tx_cp_nr_rings] = tx_cp, tx rings */
| 720 | * [1+rx_cp_nr_rings + 1 -> +tx_cp_nr_rings] = tx_cp, tx rings |
| 721 | */ |
| 722 | int bnxt_alloc_hwrm_rings(struct bnxt *bp) |
| 723 | { |
| 724 | struct bnxt_coal coal; |
| 725 | unsigned int i; |
| 726 | int rc = 0; |
| 727 | |
| 728 | bnxt_init_dflt_coal(&coal); |
| 729 | bnxt_init_all_rings(bp); |
| 730 | |
| 731 | for (i = 0; i < bp->rx_cp_nr_rings; i++) { |
| 732 | unsigned int soc_id = bp->eth_dev->device->numa_node; |
| 733 | struct bnxt_rx_queue *rxq = bp->rx_queues[i]; |
| 734 | struct bnxt_rx_ring_info *rxr = rxq->rx_ring; |
| 735 | struct bnxt_ring *ring; |
| 736 | |
| 737 | if (bnxt_need_agg_ring(bp->eth_dev)) { |
| 738 | ring = rxr->ag_ring_struct; |
| 739 | if (ring == NULL) { |
| 740 | bnxt_free_rxq_mem(rxq); |
| 741 | |
| 742 | rc = bnxt_init_rx_ring_struct(rxq, soc_id); |
| 743 | if (rc) |
| 744 | goto err_out; |
| 745 | |
| 746 | rc = bnxt_alloc_rings(bp, soc_id, |
| 747 | i, NULL, rxq, |
| 748 | rxq->cp_ring, NULL, |
| 749 | "rxr"); |
| 750 | if (rc) |
| 751 | goto err_out; |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | rc = bnxt_alloc_hwrm_rx_ring(bp, i); |
| 756 | if (rc) |
| 757 | goto err_out; |
| 758 | bnxt_hwrm_set_ring_coal(bp, &coal, |
| 759 | rxq->cp_ring->cp_ring_struct->fw_ring_id); |
| 760 | } |
| 761 | |
| 762 | /* If something is wrong with Rx ring alloc, skip Tx ring alloc */ |
| 763 | for (i = 0; i < bp->tx_cp_nr_rings; i++) { |
| 764 | rc = bnxt_alloc_hwrm_tx_ring(bp, i); |
| 765 | if (rc) |
| 766 | goto err_out; |
| 767 | } |
| 768 | |
| 769 | err_out: |
| 770 | return rc; |
| 771 | } |
| 772 | |
| 773 | /* Allocate dedicated async completion ring. */ |
| 774 | int bnxt_alloc_async_cp_ring(struct bnxt *bp) |
no test coverage detected