From: NĂ©lio Laranjeiro Date: Mon, 9 Oct 2017 14:44:43 +0000 (+0200) Subject: net/mlx5: fix crash during RETA update X-Git-Tag: spdx-start~1527 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3f2fe392bd49d3b35e54cb3797d02edc2a82175d;p=dpdk.git net/mlx5: fix crash during RETA update Reta update needs to stop/start the port but stopping the port does not disable the polling functions which may end in a segfault if a core is polling the queue while the control thread is modifying it. This patch changes the sequences to an order where such situation cannot happen. Fixes: aa13338faf5e ("net/mlx5: rebuild flows on updating RETA") Cc: stable@dpdk.org Signed-off-by: Nelio Laranjeiro Acked-by: Yongseok Koh --- diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c index d3d260338f..8942879922 100644 --- a/drivers/net/mlx5/mlx5_rss.c +++ b/drivers/net/mlx5/mlx5_rss.c @@ -351,11 +351,12 @@ mlx5_dev_rss_reta_update(struct rte_eth_dev *dev, struct priv *priv = dev->data->dev_private; assert(!mlx5_is_secondary()); - mlx5_dev_stop(dev); priv_lock(priv); ret = priv_dev_rss_reta_update(priv, reta_conf, reta_size); priv_unlock(priv); - if (ret) - return -ret; - return mlx5_dev_start(dev); + if (dev->data->dev_started) { + mlx5_dev_stop(dev); + mlx5_dev_start(dev); + } + return -ret; } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 212b4df0e1..eeb958546a 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -30,6 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include @@ -118,6 +119,12 @@ mlx5_dev_stop(struct rte_eth_dev *dev) return; priv_lock(priv); + dev->data->dev_started = 0; + /* Prevent crashes when queues are still in use. */ + dev->rx_pkt_burst = removed_rx_burst; + dev->tx_pkt_burst = removed_tx_burst; + rte_wmb(); + usleep(1000 * priv->rxqs_n); DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev); priv_special_flow_disable_all(priv); priv_mac_addrs_disable(priv);