From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 15DEA2C02 for ; Thu, 31 Aug 2017 11:45:11 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id 187so1014372wmn.1 for ; Thu, 31 Aug 2017 02:45:11 -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; bh=CfX1BdzkJKFVTmuLuhJu7HSzNiYN0HxU7H6z3hYVAAo=; b=pi9Ics2uZwBFF5W4JMZewiuwjhYSKo55mTy5lZfyylerP3iqKOJBtzYm2Ij5Nh/s1/ /LtK6+1NS7aZILo8dVI5+n/wki8kWRoKFQroh0thQqhsD7OYF/uIeDbyE2O2M5/gqSbe CaVqH+ucqy3S9YT3gFWHqwJddfwNGFl9dnfeDVNBuzYKRffowGxtFZ6q6Tz2TqBa5nbT izkZ8sMWy2N7KBjGZDZGVQU0hPegrcxc4grkVEWf7AAqHRL1qXpV9kj8kVqPWBmHoD+5 pE7lfJ2KYSQ/NFPOvG1VkX9JbGOlMCKA72cI9I3/hzdpdvJ9Ph9902URWA/+Ix1UT2Sm 9R4Q== 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; bh=CfX1BdzkJKFVTmuLuhJu7HSzNiYN0HxU7H6z3hYVAAo=; b=jVABAbrFZ2/oqf5IYiPJ60DqbPjvIFfqZMeUcUo8hz1p4lJaosbf4TFJvIZDglLJVk f1hphnBsOLRRM+/y8KWfLwuKGVjLENWF2wowN6A7Ki/pDOYNR+tPRJdalcnu8yB5wkiB l1XqbzewPQ5T8bYg+A/VyUnJXABQcZQl1w0dl6D8POeRGSN6z5oQUlFoXuBWWpLsaj/f 1b5zrjySn5RFcGkkxjZFhdBz33wqZUbG8nkMK9l+YhM1FEUZhkFOVEBWRczLzyM5zNWd 7XD4GYfmuFbLgE0lLFJvJ9CVmEv53sRFuzslj+14eVO8LcBK8BZ5V4EerthTtqSKmDu6 XhiA== X-Gm-Message-State: AHPjjUi1ZK8YIq6iw54d2sLqwLYgah4IVTL5fes5ZW0o7VTiW8dwForZ yJe+ZKf1AcUgClNirTg= X-Google-Smtp-Source: ADKCNb7KOpTmJckzPqINrFxjb7lOC5GUjHYec0ivPzvO+HHEus42zD+42omDxSdPlh4IrWaFjFwRvA== X-Received: by 10.28.232.82 with SMTP id f79mr117206wmh.179.1504172711761; Thu, 31 Aug 2017 02:45:11 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id w200sm4692010wmw.20.2017.08.31.02.45.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Aug 2017 02:45:10 -0700 (PDT) From: Adrien Mazarguil To: Yuanhan Liu Cc: stable@dpdk.org Date: Thu, 31 Aug 2017 11:44:54 +0200 Message-Id: <920ba896c2de57ba6e93fa46d3831fba6e9a4cbc.1504172212.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: <20170814121817.GR9612@yliu-home> Subject: [dpdk-stable] [PATCH 2/2] net/mlx4: fix assertion failure on link update X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Aug 2017 09:45:12 -0000 [ backported from upstream commit 2d449f7c52de93a5978b03ea541e454fe87f801b ] The interrupt handler can sometimes be triggered for reasons other than a link status event. An assertion failure happen when such events occur while an asynchronous link status update is already scheduled. Address this issue using the same approach as its mlx5 counterpart, commit a9f2fbc42f0c ("net/mlx5: fix inconsistent link status") Fixes: c4da6caa426d ("mlx4: handle link status interrupts") Cc: stable@dpdk.org Signed-off-by: Adrien Mazarguil Acked-by: Nelio Laranjeiro --- drivers/net/mlx4/mlx4.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 22af742..e17d371 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5386,6 +5386,7 @@ priv_dev_link_status_handler(struct priv *priv, struct rte_eth_dev *dev) { struct ibv_async_event event; int port_change = 0; + struct rte_eth_link *link = &dev->data->dev_link; int ret = 0; /* Read all message and acknowledge them. */ @@ -5401,21 +5402,20 @@ priv_dev_link_status_handler(struct priv *priv, struct rte_eth_dev *dev) event.event_type, event.element.port_num); ibv_ack_async_event(&event); } - - if (port_change ^ priv->pending_alarm) { - struct rte_eth_link *link = &dev->data->dev_link; - - priv->pending_alarm = 0; - mlx4_link_update(dev, 0); - if (((link->link_speed == 0) && link->link_status) || - ((link->link_speed != 0) && !link->link_status)) { + if (!port_change) + return ret; + mlx4_link_update(dev, 0); + if (((link->link_speed == 0) && link->link_status) || + ((link->link_speed != 0) && !link->link_status)) { + if (!priv->pending_alarm) { /* Inconsistent status, check again later. */ priv->pending_alarm = 1; rte_eal_alarm_set(MLX4_ALARM_TIMEOUT_US, mlx4_dev_link_status_handler, dev); - } else - ret = 1; + } + } else { + ret = 1; } return ret; } @@ -5435,6 +5435,7 @@ mlx4_dev_link_status_handler(void *arg) priv_lock(priv); assert(priv->pending_alarm == 1); + priv->pending_alarm = 0; ret = priv_dev_link_status_handler(priv, dev); priv_unlock(priv); if (ret) -- 2.1.4