X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_rxq.c;h=eeda631ff869817ecf2877ba5e60eedee32cf423;hp=19c0e3f6476def739e819521530a86f971f08833;hb=2eb53b134aae;hpb=6eb3cc2294fd3b56c6512eb2c335613751f09c4a diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 19c0e3f647..eeda631ff8 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -41,6 +41,7 @@ #include "bnxt_hwrm.h" #include "bnxt_ring.h" #include "bnxt_rxq.h" +#include "bnxt_rxr.h" #include "bnxt_vnic.h" #include "hsi_struct_def_dpdk.h" @@ -216,7 +217,20 @@ err_out: static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq __rte_unused) { - /* TODO: Requires interaction with TX ring */ + struct bnxt_sw_rx_bd *sw_ring; + uint16_t i; + + if (rxq) { + sw_ring = rxq->rx_ring->rx_buf_ring; + if (sw_ring) { + for (i = 0; i < rxq->nb_rx_desc; i++) { + if (sw_ring[i].mbuf) { + rte_pktmbuf_free_seg(sw_ring[i].mbuf); + sw_ring[i].mbuf = NULL; + } + } + } + } } void bnxt_free_rx_mbufs(struct bnxt *bp) @@ -237,7 +251,13 @@ void bnxt_rx_queue_release_op(void *rx_queue) if (rxq) { bnxt_rx_queue_release_mbufs(rxq); - /* TODO: Free ring and stats here */ + /* Free RX ring hardware descriptors */ + bnxt_free_ring(rxq->rx_ring->rx_ring_struct); + + /* Free RX completion ring hardware descriptors */ + bnxt_free_ring(rxq->cp_ring->cp_ring_struct); + + bnxt_free_rxq_stats(rxq); rte_free(rxq); } @@ -274,7 +294,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, rxq->nb_rx_desc = nb_desc; rxq->rx_free_thresh = rx_conf->rx_free_thresh; - /* TODO: Initialize ring structure */ + bnxt_init_rx_ring_struct(rxq); rxq->queue_id = queue_idx; rxq->port_id = eth_dev->data->port_id; @@ -282,7 +302,13 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, 0 : ETHER_CRC_LEN); eth_dev->data->rx_queues[queue_idx] = rxq; - /* TODO: Allocate RX ring hardware descriptors */ + /* Allocate RX ring hardware descriptors */ + if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq->rx_ring, rxq->cp_ring, + "rxr")) { + RTE_LOG(ERR, PMD, "ring_dma_zone_reserve for rx_ring failed!"); + bnxt_rx_queue_release_op(rxq); + return -ENOMEM; + } return 0; }