X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_txq.c;h=99dddddfc50ff8be2f15d32f5d9d428cbfa672ee;hb=7236d2bfe0acc48330e3c2a3dfac4ada9a792cd8;hp=460f71aac278aba822bfa503f6c3eb4f99843b8c;hpb=6eb3cc2294fd3b56c6512eb2c335613751f09c4a;p=dpdk.git diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index 460f71aac2..99dddddfc5 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -49,8 +49,6 @@ void bnxt_free_txq_stats(struct bnxt_tx_queue *txq) { struct bnxt_cp_ring_info *cpr = txq->cp_ring; - /* 'Unreserve' rte_memzone */ - if (cpr->hw_stats) cpr->hw_stats = NULL; } @@ -108,10 +106,12 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; struct bnxt_tx_queue *txq; + int rc = 0; if (!nb_desc || nb_desc > MAX_TX_DESC_CNT) { RTE_LOG(ERR, PMD, "nb_desc %d is invalid", nb_desc); - return -EINVAL; + rc = -EINVAL; + goto out; } if (eth_dev->data->tx_queues) { @@ -123,15 +123,18 @@ 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 == NULL) { + if (!txq) { RTE_LOG(ERR, PMD, "bnxt_tx_queue allocation failed!"); - return -ENOMEM; + rc = -ENOMEM; + goto out; } txq->bp = bp; txq->nb_tx_desc = nb_desc; txq->tx_free_thresh = tx_conf->tx_free_thresh; - bnxt_init_tx_ring_struct(txq); + rc = bnxt_init_tx_ring_struct(txq, socket_id); + if (rc) + goto out; txq->queue_id = queue_idx; txq->port_id = eth_dev->data->port_id; @@ -141,15 +144,19 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, "txr")) { RTE_LOG(ERR, PMD, "ring_dma_zone_reserve for tx_ring failed!"); bnxt_tx_queue_release_op(txq); - return -ENOMEM; + rc = -ENOMEM; + goto out; } if (bnxt_init_one_tx_ring(txq)) { RTE_LOG(ERR, PMD, "bnxt_init_one_tx_ring failed!"); bnxt_tx_queue_release_op(txq); - return -ENOMEM; + rc = -ENOMEM; + goto out; } eth_dev->data->tx_queues[queue_idx] = txq; - return 0; + +out: + return rc; }