New upstream version 18.02
[deb_dpdk.git] / drivers / net / bnxt / bnxt_txq.c
index 99ddddd..5352434 100644 (file)
@@ -108,8 +108,15 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
        struct bnxt_tx_queue *txq;
        int rc = 0;
 
+       if (queue_idx >= bp->max_tx_rings) {
+               PMD_DRV_LOG(ERR,
+                       "Cannot create Tx ring %d. Only %d rings available\n",
+                       queue_idx, bp->max_tx_rings);
+               return -ENOSPC;
+       }
+
        if (!nb_desc || nb_desc > MAX_TX_DESC_CNT) {
-               RTE_LOG(ERR, PMD, "nb_desc %d is invalid", nb_desc);
+               PMD_DRV_LOG(ERR, "nb_desc %d is invalid", nb_desc);
                rc = -EINVAL;
                goto out;
        }
@@ -124,7 +131,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
        txq = rte_zmalloc_socket("bnxt_tx_queue", sizeof(struct bnxt_tx_queue),
                                 RTE_CACHE_LINE_SIZE, socket_id);
        if (!txq) {
-               RTE_LOG(ERR, PMD, "bnxt_tx_queue allocation failed!");
+               PMD_DRV_LOG(ERR, "bnxt_tx_queue allocation failed!");
                rc = -ENOMEM;
                goto out;
        }
@@ -142,14 +149,14 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
        /* Allocate TX ring hardware descriptors */
        if (bnxt_alloc_rings(bp, queue_idx, txq->tx_ring, NULL, txq->cp_ring,
                        "txr")) {
-               RTE_LOG(ERR, PMD, "ring_dma_zone_reserve for tx_ring failed!");
+               PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!");
                bnxt_tx_queue_release_op(txq);
                rc = -ENOMEM;
                goto out;
        }
 
        if (bnxt_init_one_tx_ring(txq)) {
-               RTE_LOG(ERR, PMD, "bnxt_init_one_tx_ring failed!");
+               PMD_DRV_LOG(ERR, "bnxt_init_one_tx_ring failed!");
                bnxt_tx_queue_release_op(txq);
                rc = -ENOMEM;
                goto out;