From patchwork Thu Dec 28 21:30:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Belgazal, Netanel" X-Patchwork-Id: 853572 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amazon.com header.i=@amazon.com header.b="JfprApuz"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z72vd6JNrz9sBW for ; Fri, 29 Dec 2017 08:30:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754018AbdL1Vai (ORCPT ); Thu, 28 Dec 2017 16:30:38 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:15942 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754186AbdL1Vag (ORCPT ); Thu, 28 Dec 2017 16:30:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1514496636; x=1546032636; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=XJG4TDWhizvqH7Or49Gv6E4CtLvJ27l1jR8rtRh7QJE=; b=JfprApuz84iJt+xDxl/gZ7h0pVBOrfbAtUbYb0ScUretHHvXNJ1DKHaT Sn8HFMg2RZYibEbzqIJvc6GANV/T30KK3+KusNf/vt+HXvbcnvP2ohsg2 onbTXo+evU0l1Jhh7JO8hknz3zhde6bkq+NtNFnXTlXu8zd8chapLdEug A=; X-IronPort-AV: E=Sophos;i="5.45,472,1508803200"; d="scan'208";a="712277841" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-8549039f.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Dec 2017 21:30:36 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-8549039f.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id vBSLUZGb105368 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Thu, 28 Dec 2017 21:30:36 GMT Received: from EX13D10UWB003.ant.amazon.com (10.43.161.106) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Thu, 28 Dec 2017 21:30:34 +0000 Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13D10UWB003.ant.amazon.com (10.43.161.106) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Thu, 28 Dec 2017 21:30:34 +0000 Received: from dev-dsk-netanel-1a-9f923ce6.eu-west-1.amazon.com (10.15.81.133) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1236.3 via Frontend Transport; Thu, 28 Dec 2017 21:30:31 +0000 From: To: , CC: Netanel Belgazal , , , , , , , , , Subject: [PATCH net 1/3] net: ena: unmask MSI-X only after device initialization is completed Date: Thu, 28 Dec 2017 21:30:18 +0000 Message-ID: <1514496620-69953-2-git-send-email-netanel@amazon.com> X-Mailer: git-send-email 2.7.3.AMZN In-Reply-To: <1514496620-69953-1-git-send-email-netanel@amazon.com> References: <1514496620-69953-1-git-send-email-netanel@amazon.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Netanel Belgazal 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 --- 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/ethernet/amazon/ena/ena_netdev.c index 97c5a89a9cf7..6fb28fd43eb3 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 *adapter) static int ena_up_complete(struct ena_adapter *adapter) { - int rc, i; + int rc; rc = ena_rss_configure(adapter); if (rc) @@ -1584,17 +1584,6 @@ static int ena_up_complete(struct ena_adapter *adapter) ena_napi_enable_all(adapter); - /* Enable completion queues interrupt */ - for (i = 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 = 0; i < adapter->num_queues; i++) - napi_schedule(&adapter->ena_napi[i].napi); - return 0; } @@ -1731,7 +1720,7 @@ static int ena_create_all_io_rx_queues(struct ena_adapter *adapter) static int ena_up(struct ena_adapter *adapter) { - int rc; + int rc, i; netdev_dbg(adapter->netdev, "%s\n", __func__); @@ -1774,6 +1763,17 @@ static int ena_up(struct ena_adapter *adapter) set_bit(ENA_FLAG_DEV_UP, &adapter->flags); + /* Enable completion queues interrupt */ + for (i = 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 = 0; i < adapter->num_queues; i++) + napi_schedule(&adapter->ena_napi[i].napi); + return rc; err_up: