net/sfc: add dedicated header file with MCDI interface
[dpdk.git] / drivers / net / bnxt / bnxt_rxq.c
index e42308a..793a47d 100644 (file)
@@ -197,7 +197,7 @@ err_out:
 
 void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 {
-       struct bnxt_sw_rx_bd *sw_ring;
+       struct rte_mbuf **sw_ring;
        struct bnxt_tpa_info *tpa_info;
        uint16_t i;
 
@@ -210,9 +210,10 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
        if (sw_ring) {
                for (i = 0;
                     i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
-                       if (sw_ring[i].mbuf) {
-                               rte_pktmbuf_free_seg(sw_ring[i].mbuf);
-                               sw_ring[i].mbuf = NULL;
+                       if (sw_ring[i]) {
+                               if (sw_ring[i] != &rxq->fake_mbuf)
+                                       rte_pktmbuf_free_seg(sw_ring[i]);
+                               sw_ring[i] = NULL;
                        }
                }
        }
@@ -221,9 +222,9 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
        if (sw_ring) {
                for (i = 0;
                     i < rxq->rx_ring->ag_ring_struct->ring_size; i++) {
-                       if (sw_ring[i].mbuf) {
-                               rte_pktmbuf_free_seg(sw_ring[i].mbuf);
-                               sw_ring[i].mbuf = NULL;
+                       if (sw_ring[i]) {
+                               rte_pktmbuf_free_seg(sw_ring[i]);
+                               sw_ring[i] = NULL;
                        }
                }
        }
@@ -305,7 +306,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
                return -EINVAL;
        }
 
-       if (!nb_desc || nb_desc > MAX_RX_DESC_CNT) {
+       if (nb_desc < BNXT_MIN_RING_DESC || nb_desc > MAX_RX_DESC_CNT) {
                PMD_DRV_LOG(ERR, "nb_desc %d is invalid\n", nb_desc);
                rc = -EINVAL;
                goto out;
@@ -326,7 +327,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
        rxq->bp = bp;
        rxq->mb_pool = mp;
        rxq->nb_rx_desc = nb_desc;
-       rxq->rx_free_thresh = rx_conf->rx_free_thresh;
+       rxq->rx_free_thresh =
+               RTE_MIN(rte_align32pow2(nb_desc) / 4, RTE_BNXT_MAX_RX_BURST);
 
        PMD_DRV_LOG(DEBUG, "RX Buf MTU %d\n", eth_dev->data->mtu);