| 119 | } |
| 120 | |
| 121 | int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, |
| 122 | uint16_t queue_idx, |
| 123 | uint16_t nb_desc, |
| 124 | unsigned int socket_id, |
| 125 | const struct rte_eth_txconf *tx_conf) |
| 126 | { |
| 127 | struct bnxt *bp = eth_dev->data->dev_private; |
| 128 | struct bnxt_tx_queue *txq; |
| 129 | int rc = 0; |
| 130 | |
| 131 | rc = is_bnxt_in_error(bp); |
| 132 | if (rc) |
| 133 | return rc; |
| 134 | |
| 135 | if (queue_idx >= bnxt_max_rings(bp)) { |
| 136 | PMD_DRV_LOG(ERR, |
| 137 | "Cannot create Tx ring %d. Only %d rings available\n", |
| 138 | queue_idx, bp->max_tx_rings); |
| 139 | return -EINVAL; |
| 140 | } |
| 141 | |
| 142 | if (nb_desc < BNXT_MIN_RING_DESC || nb_desc > MAX_TX_DESC_CNT) { |
| 143 | PMD_DRV_LOG(ERR, "nb_desc %d is invalid", nb_desc); |
| 144 | return -EINVAL; |
| 145 | } |
| 146 | |
| 147 | if (eth_dev->data->tx_queues) { |
| 148 | txq = eth_dev->data->tx_queues[queue_idx]; |
| 149 | if (txq) |
| 150 | bnxt_tx_queue_release_op(eth_dev, queue_idx); |
| 151 | } |
| 152 | txq = rte_zmalloc_socket("bnxt_tx_queue", sizeof(struct bnxt_tx_queue), |
| 153 | RTE_CACHE_LINE_SIZE, socket_id); |
| 154 | if (!txq) { |
| 155 | PMD_DRV_LOG(ERR, "bnxt_tx_queue allocation failed!"); |
| 156 | return -ENOMEM; |
| 157 | } |
| 158 | |
| 159 | txq->bp = bp; |
| 160 | eth_dev->data->tx_queues[queue_idx] = txq; |
| 161 | |
| 162 | txq->free = rte_zmalloc_socket(NULL, |
| 163 | sizeof(struct rte_mbuf *) * nb_desc, |
| 164 | RTE_CACHE_LINE_SIZE, socket_id); |
| 165 | if (!txq->free) { |
| 166 | PMD_DRV_LOG(ERR, "allocation of tx mbuf free array failed!"); |
| 167 | rc = -ENOMEM; |
| 168 | goto err; |
| 169 | } |
| 170 | txq->nb_tx_desc = nb_desc; |
| 171 | txq->tx_free_thresh = |
| 172 | RTE_MIN(rte_align32pow2(nb_desc) / 4, RTE_BNXT_MAX_TX_BURST); |
| 173 | txq->offloads = eth_dev->data->dev_conf.txmode.offloads | |
| 174 | tx_conf->offloads; |
| 175 | |
| 176 | txq->tx_deferred_start = tx_conf->tx_deferred_start; |
| 177 | |
| 178 | rc = bnxt_init_tx_ring_struct(txq, socket_id); |
nothing calls this directly
no test coverage detected