From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 309B41B1C7 for ; Mon, 9 Oct 2017 16:45:32 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id m72so23254839wmc.1 for ; Mon, 09 Oct 2017 07:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=zhhHjjqyjjy8ZOi5oMieb2MwFcvMDkws6lfQfPCIZ2o=; b=gwdynmbGr2AZoAlktS6aUcx5TdM7cHwDzuczgNBNJa0uXMLVOUEYnNePska7sHjwh2 /4cB+7cg12UG2DIaOi1GiStOQ/kY7aixhTMGauUEqljuQGwk3Tq74t3QOwGFSu3TffxH KQZCBbRMDOhgXHjpaHcWcfzycwBK26szhCtrceC0SQpFtndHdpsOvyJ/wRL4w+RDy8Az 13b8bg+gVXBQXGWDCCAt6Qs1GNe6w5ydGFW4TY+g8BbYXYU6M7Apvvphv1vpcOiEc3Vk kYdhN/PWs4AAez67X97WQ+JhQ7dK6rpQ1bEMHeSddLsShQhIsAl8+NVYqFzYdMbWXJ/8 is2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=zhhHjjqyjjy8ZOi5oMieb2MwFcvMDkws6lfQfPCIZ2o=; b=sovgI/cUnyp1Pg6VhHGKPoEUZiwTQKmvkfKuuUlWfqKg5jH1X68VSB1HcQP8F2Xs+w D4GJKVkp29dotU0YpgG37NsTM0aax7LErmUmNmoS0xPZXQNKuGNGAtsjK14mlrWKXbvd TUsTcywu0kDmlK44jXmHVIFdAcdYUPTXM/rKhWq4zdRS4UoDs0o/6njAvOQsxXFq+NZ4 mz1tvODA1QWTS9bDlDH7pMwLdF6tYk1QzqyqUXvabVf0XBycCNp36roZ3R++kvx8K0R5 +/66n6p2GQu3Rblu4hEfouUTR2wGnZ2/Jv6kFYWOehL9KQrwkAB0bLjFnISdDxbkctjN B3vg== X-Gm-Message-State: AMCzsaVRpPlYb3wzKUyX/UtymBjXrtMnFpvfwaRPAKJYSb7TKtbUgjqw nu4qnZqiZyNKpZuj32XKmxVTgcL/0Q== X-Google-Smtp-Source: AOwi7QDV6N6LcpwV2Qd2JP3c1strzrjps+7N//uw0PsXIWYw6oV9ZkoJby9TRvhNftnm0NDb5HWk2Q== X-Received: by 10.28.45.5 with SMTP id t5mr8129553wmt.108.1507560331750; Mon, 09 Oct 2017 07:45:31 -0700 (PDT) Received: from ping.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id x15sm6791495wma.32.2017.10.09.07.45.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 07:45:31 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: adrien.mazarguil@6wind.com, yskoh@mellanox.com, ferruh.yigit@intel.com, stable@dpdk.org Date: Mon, 9 Oct 2017 16:44:43 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 07/30] net/mlx5: fix reta update can segfault X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Oct 2017 14:45:32 -0000 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: yskoh@mellanox.com Cc: stable@dpdk.org Signed-off-by: Nelio Laranjeiro Acked-by: Yongseok Koh --- drivers/net/mlx5/mlx5_rss.c | 9 +++++---- drivers/net/mlx5/mlx5_trigger.c | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c index d3d2603..8942879 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 212b4df..eeb9585 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); -- 2.1.4