Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2281198pxb; Mon, 11 Jan 2021 05:59:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsrd0ujyLi820rHsY625i7I8oCFik87P0xKeIPBP9D51Hu+hGn2jxem7ohgv0Mf5/mg6S+ X-Received: by 2002:a17:906:31d2:: with SMTP id f18mr10763530ejf.407.1610373590754; Mon, 11 Jan 2021 05:59:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610373590; cv=none; d=google.com; s=arc-20160816; b=DFrXPFBaXaBahJZw6e99KFKS/zCewImAT7orZND9OZbgm/UzPacVZfHQnTJnb4knsE pKHbhgPNo2j4szuPrNEe4XIGOUUCe+9vLq8TeS73hvYcqtgTgUjRRq+U13jx8p/fwbtr UUKI+iGrJg7rQIxj4tWTOoGOVmpcIWa6W37m+bgstOF/suSIL6tKQsE9Vnh2hAqaHCag Wq2BOwLQ4FXXm3USW5YNxlTdImeI+32tlutQHbYvK7fWQ7AMShfyF3B/ovpK3flIxChz ucMovrNMpV51ZrulOyRdK8/0WYMzhST1lNXeFceYb+Cp/zVuUiYrMBLGTw9VGKV3KH53 U84A== 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=Dr+UcREtS4DvhyboI4GmCBchGKh8T/r9zYbzaQ56Efc=; b=xGpjhjExQ9B1QTvHJLdxcllBEWuk4ZrtvjSlXbBrBuzK4kmZtC0aTICGoDrZF0yFIZ 6Atapx7pqzkzT53PZuQ5JzuHy+qNUQLfOm92QGs40HJJEyqFnu06BaMXf5kHrKHnG3rp /LvfDfpA1VQ+rvf14I6Q1j+AmmvXGcKlJjr5AqJH+sP+GkQQ70PJGH8IEmNHQFrmhYk5 pH6t+wCb20jXoik+gu8QxXKIkHDhil3rV32G97mQbageqhmcRH+PEnRA0lCY/rwhBHfm Skm1UWrEV0sB2Ub8tBj/+dmh6ytJob5Rvy4TPYYbv0IPpi/SU9WMaHdqjEqxepTKGto8 4Ebw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T6Co2lz0; 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 l6si6574030ejp.140.2021.01.11.05.59.26; Mon, 11 Jan 2021 05:59:50 -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=T6Co2lz0; 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 S1731105AbhAKNz1 (ORCPT + 99 others); Mon, 11 Jan 2021 08:55:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:54992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729064AbhAKNHe (ORCPT ); Mon, 11 Jan 2021 08:07:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5612B225AC; Mon, 11 Jan 2021 13:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370412; bh=b+v5EaPP8K0y5jyLa9VHS08HE509XfySbVbYhSUS1FQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T6Co2lz0V0cB1InQw6ocg8A3nQil0VfIsVvk4BkLSSBOOk3GzD1nmWtU58WvEYyd5 B4LxyccpRTXsx6LHY1+Vk56TCdqFbeSKaOwWORx63By2m9UfbdOLb0F8TKglhGqj2A ghZ4ka4F2PBRc+xfbSMg8cBMo51RoUerFbvCB1Iw= 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 4.19 11/77] i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs Date: Mon, 11 Jan 2021 14:01:20 +0100 Message-Id: <20210111130036.954328390@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130036.414620026@linuxfoundation.org> References: <20210111130036.414620026@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 @@ -127,6 +127,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_REQUESTED, @@ -153,6 +154,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 @@ -42,6 +42,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 void i40e_fdir_sb_setup(struct i40e_pf *pf); @@ -7929,6 +7931,14 @@ void i40e_do_reset(struct i40e_pf *pf, u dev_dbg(&pf->pdev->dev, "PFR requested\n"); i40e_handle_reset_warning(pf, lock_acquired); + } 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 @@ -1567,7 +1567,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); } return i40e_pci_sriov_enable(pdev, num_vfs); } @@ -1575,7 +1575,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"); return -EINVAL;