summaryrefslogtreecommitdiff
path: root/drivers/net/bnxt/bnxt_rxr.c
diff options
context:
space:
mode:
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>2019-10-01 18:23:22 -0700
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-08 12:14:30 +0200
commit1bf01f5135f895326430d5670d7ad835e0c55727 (patch)
treed7689527664c7d4bf6dfb55aef55cce1a2099e6a /drivers/net/bnxt/bnxt_rxr.c
parent4172f757fe01010d1df4294a7e51c186a6065772 (diff)
downloaddpdk-next-eventdev-1bf01f5135f895326430d5670d7ad835e0c55727.zip
dpdk-next-eventdev-1bf01f5135f895326430d5670d7ad835e0c55727.tar.gz
dpdk-next-eventdev-1bf01f5135f895326430d5670d7ad835e0c55727.tar.xz
net/bnxt: prevent device access when device is in reset
Refactor init and uninit functions so that the driver can fail the eth_dev_ops callbacks and accessing Tx and Rx queues when device is in reset or in error state. Transmit and receive queues are freed during reset cleanup and reallocated during recovery. So we block all data path handling in this state. The eth_dev dev_started field is updated depending on the status of the device. Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com> Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Diffstat (limited to 'drivers/net/bnxt/bnxt_rxr.c')
-rw-r--r--drivers/net/bnxt/bnxt_rxr.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 185a0e3..12313dd 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -539,6 +539,9 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
int rc = 0;
bool evt = false;
+ if (unlikely(is_bnxt_in_error(rxq->bp)))
+ return 0;
+
/* If Rx Q was stopped return. RxQ0 cannot be stopped. */
if (unlikely(((rxq->rx_deferred_start ||
!rte_spinlock_trylock(&rxq->lock)) &&
@@ -625,6 +628,20 @@ done:
return nb_rx_pkts;
}
+/*
+ * Dummy DPDK callback for RX.
+ *
+ * This function is used to temporarily replace the real callback during
+ * unsafe control operations on the queue, or in case of error.
+ */
+uint16_t
+bnxt_dummy_recv_pkts(void *rx_queue __rte_unused,
+ struct rte_mbuf **rx_pkts __rte_unused,
+ uint16_t nb_pkts __rte_unused)
+{
+ return 0;
+}
+
void bnxt_free_rx_rings(struct bnxt *bp)
{
int i;