Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2277432pxb; Mon, 11 Jan 2021 05:52:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJytJ8U48+11aC7bovVLguIWpnpXYG40XRcseu+Vd89Vfm0mv6vT8lZv0Z4zUVHWPrjyPPhR X-Received: by 2002:a50:fb97:: with SMTP id e23mr14641367edq.208.1610373177134; Mon, 11 Jan 2021 05:52:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610373177; cv=none; d=google.com; s=arc-20160816; b=jNJQfGtcyms4Mvbm5keEVMljSIkh2YsUxhhG+CzuS3GNY24jIAsEKOPHJ69e8Z3TJy dfqEFkvcB8FDA7wIEOGcFl4Z1f2llLoFrW65Hzt3F/xJyz0OzASQwfQVIGl5vRhq3hUJ hTQNfz6zf028QzrqmvBKdkWRqpsDxIyQm8FD4RKZyZx+SdZUDJ8myURb2V0YUOvJ6R0y U5v2QobnjyOb9KTq+VJcfvIaYbF6yQ3iHv7VbtZMmjnchjnW8ceJonrP/L6fWXBSXbnk gW73QFTgyUAgSs592Zv3cDDWcdeQBEzJ5Q/0YGbD9y1HKYny/29aUW95vUBxXH5pvRbl Ubtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nwyt2Txa7cCkH3zm56n2YyDTCCh1Z5e7fvHKZEdEJck=; b=rsu+WJea3zBKVMJ8ZLdT06W88yfhGIf228mlMdsej6u7E/ApPKZBqjqQd+mFQwb2dS 1lnnNXAeyCe5dmamF3EkMlyCTt4nmlN+OqOy2xm2DDKfQuPgS4FN/pDnRJq3IrULaDWo 8JCGD6vGmiXGW/JmMZId789hkYCDct0QLposU2B9+gAWOJyKDRjcwB3k7lXo1hazo9kK Bdi/G/EnAvgH+bGyEoPtpj+FRaYQRZfnt/m6CgeMPJJgN9yMhHH2MsXYFRBrs0w7Mp7t 60csUUGrvCZ5JcHfwCRydzCUd6uPogymusYGBA547vd0aVbXO5slFPfeetKRe4ruY2Ax 1P1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kKHmbzgc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i8si6879602edr.271.2021.01.11.05.52.32; Mon, 11 Jan 2021 05:52:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kKHmbzgc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387806AbhAKNtX (ORCPT + 99 others); Mon, 11 Jan 2021 08:49:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:57052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731108AbhAKNKC (ORCPT ); Mon, 11 Jan 2021 08:10:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F033921973; Mon, 11 Jan 2021 13:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370586; bh=aVJ8CgOh1pd9gLSjSzrywYM/A/tG0BuZmeOQO3xJTso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kKHmbzgc3Sm8jwMSR4R3qdB+0Bc04hgaTYv9bdpRxmEHFwFfy3lZQWux6QWxuXMI/ Uws/0sPeV9RhOeqX1zrj2XrY91slDWob8D4v9MeD8xOJeOuQhwXKttC0lqWv4l2wPL /b87Hg37ZBV0lGMdxsIdCq0A02YJ9ZWwVPiUzK3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sylwester Dziedziuch , Konrad Jankowski , Tony Nguyen Subject: [PATCH 5.4 10/92] i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs Date: Mon, 11 Jan 2021 14:01:14 +0100 Message-Id: <20210111130039.653194817@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sylwester Dziedziuch [ Upstream commit 3ac874fa84d1baaf0c0175f2a1499f5d88d528b2 ] When removing VFs for PF added to bridge there was an error I40E_AQ_RC_EINVAL. It was caused by not properly resetting and reinitializing PF when adding/removing VFs. Changed how reset is performed when adding/removing VFs to properly reinitialize PFs VSI. Fixes: fc60861e9b00 ("i40e: start up in VEPA mode by default") Signed-off-by: Sylwester Dziedziuch Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/i40e/i40e.h | 3 +++ drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -129,6 +129,7 @@ enum i40e_state_t { __I40E_RESET_INTR_RECEIVED, __I40E_REINIT_REQUESTED, __I40E_PF_RESET_REQUESTED, + __I40E_PF_RESET_AND_REBUILD_REQUESTED, __I40E_CORE_RESET_REQUESTED, __I40E_GLOBAL_RESET_REQUESTED, __I40E_EMP_RESET_INTR_RECEIVED, @@ -156,6 +157,8 @@ enum i40e_state_t { }; #define I40E_PF_RESET_FLAG BIT_ULL(__I40E_PF_RESET_REQUESTED) +#define I40E_PF_RESET_AND_REBUILD_FLAG \ + BIT_ULL(__I40E_PF_RESET_AND_REBUILD_REQUESTED) /* VSI state flags */ enum i40e_vsi_state_t { --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -44,6 +44,8 @@ static int i40e_setup_misc_vector(struct static void i40e_determine_queue_usage(struct i40e_pf *pf); static int i40e_setup_pf_filter_control(struct i40e_pf *pf); static void i40e_prep_for_reset(struct i40e_pf *pf, bool lock_acquired); +static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit, + bool lock_acquired); static int i40e_reset(struct i40e_pf *pf); static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired); static int i40e_setup_misc_vector_for_recovery_mode(struct i40e_pf *pf); @@ -8484,6 +8486,14 @@ void i40e_do_reset(struct i40e_pf *pf, u "FW LLDP is disabled\n" : "FW LLDP is enabled\n"); + } else if (reset_flags & I40E_PF_RESET_AND_REBUILD_FLAG) { + /* Request a PF Reset + * + * Resets PF and reinitializes PFs VSI. + */ + i40e_prep_for_reset(pf, lock_acquired); + i40e_reset_and_rebuild(pf, true, lock_acquired); + } else if (reset_flags & BIT_ULL(__I40E_REINIT_REQUESTED)) { int v; --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -1704,7 +1704,7 @@ int i40e_pci_sriov_configure(struct pci_ if (num_vfs) { if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; - i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG); + i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); } ret = i40e_pci_sriov_enable(pdev, num_vfs); goto sriov_configure_out; @@ -1713,7 +1713,7 @@ int i40e_pci_sriov_configure(struct pci_ if (!pci_vfs_assigned(pf->pdev)) { i40e_free_vfs(pf); pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; - i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG); + i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); } else { dev_warn(&pdev->dev, "Unable to free VFs because some are assigned to VMs.\n"); ret = -EINVAL;