net/bnxt: prevent device access when device is in reset
[dpdk.git] / drivers / net / bnxt / bnxt_rxq.c
index 1d95f11..d5fc526 100644 (file)
@@ -263,6 +263,9 @@ void bnxt_rx_queue_release_op(void *rx_queue)
        struct bnxt_rx_queue *rxq = (struct bnxt_rx_queue *)rx_queue;
 
        if (rxq) {
+               if (is_bnxt_in_error(rxq->bp))
+                       return;
+
                bnxt_rx_queue_release_mbufs(rxq);
 
                /* Free RX ring hardware descriptors */
@@ -294,6 +297,10 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
        int rc = 0;
        uint8_t queue_state;
 
+       rc = is_bnxt_in_error(bp);
+       if (rc)
+               return rc;
+
        if (queue_idx >= bp->max_rx_rings) {
                PMD_DRV_LOG(ERR,
                        "Cannot create Rx ring %d. Only %d rings available\n",
@@ -363,10 +370,15 @@ out:
 int
 bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev, uint16_t queue_id)
 {
+       struct bnxt *bp = eth_dev->data->dev_private;
        struct bnxt_rx_queue *rxq;
        struct bnxt_cp_ring_info *cpr;
        int rc = 0;
 
+       rc = is_bnxt_in_error(bp);
+       if (rc)
+               return rc;
+
        if (eth_dev->data->rx_queues) {
                rxq = eth_dev->data->rx_queues[queue_id];
                if (!rxq) {
@@ -382,10 +394,15 @@ bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev, uint16_t queue_id)
 int
 bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev, uint16_t queue_id)
 {
+       struct bnxt *bp = eth_dev->data->dev_private;
        struct bnxt_rx_queue *rxq;
        struct bnxt_cp_ring_info *cpr;
        int rc = 0;
 
+       rc = is_bnxt_in_error(bp);
+       if (rc)
+               return rc;
+
        if (eth_dev->data->rx_queues) {
                rxq = eth_dev->data->rx_queues[queue_id];
                if (!rxq) {
@@ -406,6 +423,10 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
        struct bnxt_vnic_info *vnic = NULL;
        int rc = 0;
 
+       rc = is_bnxt_in_error(bp);
+       if (rc)
+               return rc;
+
        if (rxq == NULL) {
                PMD_DRV_LOG(ERR, "Invalid Rx queue %d\n", rx_queue_id);
                return -EINVAL;
@@ -458,6 +479,10 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
        struct bnxt_rx_queue *rxq = NULL;
        int rc = 0;
 
+       rc = is_bnxt_in_error(bp);
+       if (rc)
+               return rc;
+
        /* For the stingray platform and other platforms needing tighter
         * control of resource utilization, Rx CQ 0 also works as
         * Default CQ for async notifications