From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bl2nam02on0109.outbound.protection.outlook.com ([104.47.38.109]:45293 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752802AbeBCSDi (ORCPT ); Sat, 3 Feb 2018 13:03:38 -0500 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Netanel Belgazal , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 086/110] net: ena: unmask MSI-X only after device initialization is completed Date: Sat, 3 Feb 2018 18:01:24 +0000 Message-ID: <20180203180015.29073-86-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Netanel Belgazal [ Upstream commit 7853b49ce8e0ef6364d24512b287463841d71bd3 ] Under certain conditions MSI-X interrupt might arrive right after it was unmasked in ena_up(). There is a chance it would be processed by the driver before device ENA_FLAG_DEV_UP flag is set. In such a case the interrupt is ignored. ENA device operates in auto-masked mode, therefore ignoring interrupt leaves it masked for good. Moving unmask of interrupt to be the last step in ena_up(). Signed-off-by: Netanel Belgazal Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 26 +++++++++++++-----------= -- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/eth= ernet/amazon/ena/ena_netdev.c index c6bd5e24005d..67df5053dc30 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -1565,7 +1565,7 @@ static int ena_rss_configure(struct ena_adapter *adap= ter) =20 static int ena_up_complete(struct ena_adapter *adapter) { - int rc, i; + int rc; =20 rc =3D ena_rss_configure(adapter); if (rc) @@ -1584,17 +1584,6 @@ static int ena_up_complete(struct ena_adapter *adapt= er) =20 ena_napi_enable_all(adapter); =20 - /* Enable completion queues interrupt */ - for (i =3D 0; i < adapter->num_queues; i++) - ena_unmask_interrupt(&adapter->tx_ring[i], - &adapter->rx_ring[i]); - - /* schedule napi in case we had pending packets - * from the last time we disable napi - */ - for (i =3D 0; i < adapter->num_queues; i++) - napi_schedule(&adapter->ena_napi[i].napi); - return 0; } =20 @@ -1731,7 +1720,7 @@ create_err: =20 static int ena_up(struct ena_adapter *adapter) { - int rc; + int rc, i; =20 netdev_dbg(adapter->netdev, "%s\n", __func__); =20 @@ -1774,6 +1763,17 @@ static int ena_up(struct ena_adapter *adapter) =20 set_bit(ENA_FLAG_DEV_UP, &adapter->flags); =20 + /* Enable completion queues interrupt */ + for (i =3D 0; i < adapter->num_queues; i++) + ena_unmask_interrupt(&adapter->tx_ring[i], + &adapter->rx_ring[i]); + + /* schedule napi in case we had pending packets + * from the last time we disable napi + */ + for (i =3D 0; i < adapter->num_queues; i++) + napi_schedule(&adapter->ena_napi[i].napi); + return rc; =20 err_up: --=20 2.11.0