From patchwork Wed Nov 22 18:56:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander H Duyck X-Patchwork-Id: 840482 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="smwGjWAM"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yhsXd51ypz9s1h for ; Thu, 23 Nov 2017 06:12:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 03D852F7F9; Wed, 22 Nov 2017 19:12:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZirEgKYvudCJ; Wed, 22 Nov 2017 19:12:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 844CC2D00E; Wed, 22 Nov 2017 19:12:30 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 853241C2314 for ; Wed, 22 Nov 2017 18:56:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7CCAD88AA8 for ; Wed, 22 Nov 2017 18:56:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FWUP860-OLWK for ; Wed, 22 Nov 2017 18:56:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by hemlock.osuosl.org (Postfix) with ESMTPS id 79EAB88AA0 for ; Wed, 22 Nov 2017 18:56:24 +0000 (UTC) Received: by mail-pg0-f65.google.com with SMTP id u3so12954718pgn.7 for ; Wed, 22 Nov 2017 10:56:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=69AR0qoIOOeZKEBqFB1X3QH2xwxrDR+qJsBit8ejwT8=; b=smwGjWAM954EJ3mQf4IepDSIJGS1QYbFFowcuk9z5zt7LVGBVwDFFDZE4hTVb9e9Po hhoXXS+PrXqQMOxWFhNI8bDbNW5XW8TXIva8r9kqayxjJU2cmqqKga+QvbaM+gWnyzLR 0jdvcy2UKyjoWPO4+SJnt7OyTvlRFc4d17B2iI0vjRZJ2zsOwZNoCw2H26jdYhuheW8y Of2G3W5KZoGG2ey/Vi95E2ifkpSlVTQGxXYS5gzYKhr0y5pJLWzuf0H6DOkVlLB58J7Y XtaoAml3J/3YJlBmlur5NXV3WW1ofEW8bWOKuOpc6piyT/AdjdIfGN6HNBrzqL/av+RO yuRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=69AR0qoIOOeZKEBqFB1X3QH2xwxrDR+qJsBit8ejwT8=; b=cKL+VryuzcX5H61xd2w4co9dW8jdNUwKtQwZsgOtfGPAlDP9yZoGE3e/Gnb9+/WA5W tpfdZxqdgsSoqJCBi+MD3s71jyCCsgE+FxfLVhD7EYfE6jfnRV7HlruS/gLNxnuWITot KFBty2k1Vx79aItabohIUYnNSCdfTowTLQ3/7D5BQHQUVxt+PnAsQXzRqiKE1Eiaym7t 1wR1hPXRbti7jZo0ibppz6GKBlAWfzTpx+XdfhH4N3ooxxJqwx+GRn3c9zsIIiXWNtXb dik1NiclaWfUKeqypEDHmTtC1QXLZYyIbCQ49wjORmfdFFtd0g5RhhtrVbJQVS5ilmia EsGQ== X-Gm-Message-State: AJaThX4OqfOebeHwnmBD8+fq+rhNPwq9sII1/Tmlaw6OfxnalyadWd/d 0SuzNzj+1dSIjhvoU6UqcsQgIQvd X-Google-Smtp-Source: AGs4zMZQgSFpBLHTUeiuAQKBEpE93ygzAkDCUldnNr1x4SOTzuAkFiV6m36oXq6olfWO/xSVTG+41A== X-Received: by 10.99.43.6 with SMTP id r6mr21502000pgr.353.1511376983744; Wed, 22 Nov 2017 10:56:23 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id a23sm20009605pfa.177.2017.11.22.10.56.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 10:56:23 -0800 (PST) From: Alexander Duyck To: intel-wired-lan@lists.osuosl.org Date: Wed, 22 Nov 2017 10:56:22 -0800 Message-ID: <20171122185622.29785.67698.stgit@localhost.localdomain> In-Reply-To: <20171122185256.29785.93548.stgit@localhost.localdomain> References: <20171122185256.29785.93548.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [jkirsher/next-queue PATCH 02/16] ixgbe: Perform reinit any time number of VFs change X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Alexander Duyck If the number of VFs are changed we need to reinitialize the part since the offset for the device and the number of pools will be incorrect. Without this change we can end up seeing Tx hangs and dropped Rx frames for incoming traffic. In addition we should drop the code that is arbitrarily changing the default pool and queue configuration. Instead we should wait until the port is reset and reconfigured via ixgbe_sriov_reinit. Signed-off-by: Alexander Duyck Tested-by: Andrew Bowers --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 112d24c6c9ce..15d89258fbc3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -227,9 +227,6 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, unsigned int max_vfs) int ixgbe_disable_sriov(struct ixgbe_adapter *adapter) { unsigned int num_vfs = adapter->num_vfs, vf; - struct ixgbe_hw *hw = &adapter->hw; - u32 gpie; - u32 vmdctl; int rss; /* set num VFs to 0 to prevent access to vfinfo */ @@ -271,18 +268,6 @@ int ixgbe_disable_sriov(struct ixgbe_adapter *adapter) pci_disable_sriov(adapter->pdev); #endif - /* turn off device IOV mode */ - IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, 0); - gpie = IXGBE_READ_REG(hw, IXGBE_GPIE); - gpie &= ~IXGBE_GPIE_VTMODE_MASK; - IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie); - - /* set default pool back to 0 */ - vmdctl = IXGBE_READ_REG(hw, IXGBE_VT_CTL); - vmdctl &= ~IXGBE_VT_CTL_POOL_MASK; - IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl); - IXGBE_WRITE_FLUSH(hw); - /* Disable VMDq flag so device will be set in VM mode */ if (adapter->ring_feature[RING_F_VMDQ].limit == 1) { adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED; @@ -378,13 +363,15 @@ static int ixgbe_pci_sriov_disable(struct pci_dev *dev) int err; #ifdef CONFIG_PCI_IOV u32 current_flags = adapter->flags; + int prev_num_vf = pci_num_vf(dev); #endif err = ixgbe_disable_sriov(adapter); /* Only reinit if no error and state changed */ #ifdef CONFIG_PCI_IOV - if (!err && current_flags != adapter->flags) + if (!err && (current_flags != adapter->flags || + prev_num_vf != pci_num_vf(dev))) ixgbe_sriov_reinit(adapter); #endif