| 866 | } |
| 867 | |
| 868 | int bnxt_alloc_hwrm_tx_ring(struct bnxt *bp, int queue_index) |
| 869 | { |
| 870 | struct bnxt_tx_queue *txq = bp->tx_queues[queue_index]; |
| 871 | struct bnxt_cp_ring_info *cpr = txq->cp_ring; |
| 872 | struct bnxt_ring *cp_ring = cpr->cp_ring_struct; |
| 873 | struct bnxt_tx_ring_info *txr = txq->tx_ring; |
| 874 | struct bnxt_ring *ring = txr->tx_ring_struct; |
| 875 | unsigned int idx = queue_index + bp->rx_cp_nr_rings; |
| 876 | uint16_t tx_cosq_id = 0; |
| 877 | struct bnxt_coal coal; |
| 878 | int rc = 0; |
| 879 | |
| 880 | rc = bnxt_alloc_cmpl_ring(bp, idx, cpr); |
| 881 | if (rc) |
| 882 | goto err_out; |
| 883 | |
| 884 | bnxt_init_dflt_coal(&coal); |
| 885 | bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id); |
| 886 | |
| 887 | rc = bnxt_hwrm_stat_ctx_alloc(bp, cpr); |
| 888 | if (rc) |
| 889 | goto err_out; |
| 890 | |
| 891 | if (bp->vnic_cap_flags & BNXT_VNIC_CAP_COS_CLASSIFY) |
| 892 | tx_cosq_id = bp->tx_cosq_id[queue_index < bp->max_lltc ? queue_index : 0]; |
| 893 | else |
| 894 | tx_cosq_id = bp->tx_cosq_id[0]; |
| 895 | |
| 896 | rc = bnxt_hwrm_ring_alloc(bp, ring, |
| 897 | HWRM_RING_ALLOC_INPUT_RING_TYPE_TX, |
| 898 | queue_index, cpr->hw_stats_ctx_id, |
| 899 | cp_ring->fw_ring_id, |
| 900 | tx_cosq_id); |
| 901 | if (rc) |
| 902 | goto err_out; |
| 903 | |
| 904 | bnxt_set_db(bp, &txr->tx_db, HWRM_RING_ALLOC_INPUT_RING_TYPE_TX, |
| 905 | queue_index, ring->fw_ring_id, |
| 906 | ring->ring_mask); |
| 907 | txq->index = idx; |
| 908 | |
| 909 | return rc; |
| 910 | err_out: |
| 911 | bnxt_free_hwrm_tx_ring(bp, queue_index); |
| 912 | return rc; |
| 913 | } |
no test coverage detected