i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs
Subsystems (2)
PATCH v2 1/1 i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs
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.
--- 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(-)
drivers/net/ethernet/intel/i40e/i40e.h +3 -0
@@ -120,6 +120,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,
@@ -145,6 +146,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 {
drivers/net/ethernet/intel/i40e/i40e_main.c +10 -0
@@ -36,6 +36,8 @@ static int i40e_setup_misc_vector(struct i40e_pf *pf);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);
@@ -8581,6 +8583,14 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired) "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;
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -2
@@ -1776,7 +1776,7 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)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;
@@ -1785,7 +1785,7 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)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 ;
Signature · 7 lines
2.18.4 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN. Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
Jankowski
PATCH v2 1/1 i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs
Quoted 102 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: czwartek, 22 pa?dziernika 2020 12:40
To: intel-wired-lan at lists.osuosl.org
Cc: Palczewski, Mateusz <[email protected]>; Dziedziuch, SylwesterX <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2] i40e: Fix ErrorI40E_AQ_RC_EINVALwhen removing VFsWhen 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 <[email protected]>Reported-by kernel test robot <[email protected]>--- 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(-)drivers/net/ethernet/intel/i40e/i40e.h +3
-0@@ -120,6 +120,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,@@ -145,6 +146,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 {drivers/net/ethernet/intel/i40e/i40e_main.c +0
-0@@ -36,6 +36,8 @@ static int i40e_setup_misc_vector(struct i40e_pf *pf);static void
i40e_determine_queue_usage(struct i40e_pf *pf); static inti40e_setup_pf_filter_control(struct i40e_pf *pf); static voidi40e_prep_for_reset(struct i40e_pf *pf, bool lock_acquired);drivers/net/ethernet/intel/i40e/i40e_main.c +2
-0+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, boollock_acquired); static inti40e_setup_misc_vector_for_recovery_mode(struct i40e_pf *pf); @@ - 8581,6 +8583,14 @@ voidi40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired)drivers/net/ethernet/intel/i40e/i40e_main.c +8
-0"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;drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1
-1@@ -1776,7 +1776,7 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) 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 ); }drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1
-1ret =i40e_pci_sriov_enable (pdev, num_vfs); goto sriov_configure_out;@@ -1785,7 +1785,7 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)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 {
Quoted 4 lines
dev_warn(&pdev->dev, "Unable to free VFs because some
are assigned to VMs.\n");
ret =-EINVAL;
--
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN.
Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.