net/bnxt: fix crash after removing and adding slaves
authorSantoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Thu, 24 Oct 2019 07:44:27 +0000 (13:14 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 25 Oct 2019 17:23:23 +0000 (19:23 +0200)
commit8937597cfe7caf6a2ca4353b5be6f828e114f600
treee747b3e9f71c592c15ab227ed415cd43eeead25c
parent26f044cebd554555d678f0cb9c26b1c32b14b393
net/bnxt: fix crash after removing and adding slaves

On removing the slave interface, slave_remove in bonding module calls
_rte_eth_dev_reset which in turn frees both Tx and Rx queues.
1. segfault is seen after removing/adding the slave interface and starting
bond interface.
In this below path, when mtu is set for the slave interface, queues are
not created yet and driver reference to queue[0] causes the segfault.
slave_configure:
rte_eth_dev_set_mtu
rte_eth_dev_configure
rte_eth_rx_queue_setup

2. segfault is seen on starting the port after removing from bond device.
This is a testpmd bug where in, on starting the port, testpmd is supposed
to recreate the queues before starting the port.

Fixed these by adding check for queues created before accessing them.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt.h
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/bnxt/bnxt_rxq.c