summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNĂ©lio Laranjeiro <nelio.laranjeiro@6wind.com>2017-10-25 16:04:36 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2017-10-26 02:33:01 +0200
commit5f64e6bfa1937828c9813af777a85ea57cc2e4fe (patch)
tree0bb8b1e7df38e741dee93c54ebf4c2bc5e9496f7
parent3ba62841c2ff2739b6cc34d29b6c6583ac872c93 (diff)
downloaddpdk-5f64e6bfa1937828c9813af777a85ea57cc2e4fe.zip
dpdk-5f64e6bfa1937828c9813af777a85ea57cc2e4fe.tar.gz
dpdk-5f64e6bfa1937828c9813af777a85ea57cc2e4fe.tar.xz
net/mlx5: fix device stop with multiple regions
LIST macro are not safe when inside a LIST_FOREACH() a LIST_REMOVE() is called to remove an entry, this behavior is undefined causing some entries to disappear from the list. Fixes: 6e78005a9b30 ("net/mlx5: add reference counter on DPDK Tx queues") Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
-rw-r--r--drivers/net/mlx5/mlx5_trigger.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 982d0a2..5de2d02 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -188,7 +188,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
error:
/* Rollback. */
dev->data->dev_started = 0;
- LIST_FOREACH(mr, &priv->mr, next)
+ for (mr = LIST_FIRST(&priv->mr); mr; mr = LIST_FIRST(&priv->mr))
priv_mr_release(priv, mr);
priv_flow_stop(priv, &priv->flows);
priv_dev_traffic_disable(priv, dev);
@@ -230,9 +230,8 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
priv_dev_interrupt_handler_uninstall(priv, dev);
priv_txq_stop(priv);
priv_rxq_stop(priv);
- LIST_FOREACH(mr, &priv->mr, next) {
+ for (mr = LIST_FIRST(&priv->mr); mr; mr = LIST_FIRST(&priv->mr))
priv_mr_release(priv, mr);
- }
priv_flow_delete_drop_queue(priv);
priv_unlock(priv);
}