All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net v2] i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs
@ 2020-10-22 10:39 Mateusz Palczewski
  2020-12-15 13:10 ` Jankowski, Konrad0
  0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Palczewski @ 2020-10-22 10:39 UTC (permalink / raw)
  To: intel-wired-lan

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 <sylwesterx.dziedziuch@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
---
 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(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index c517c47..f1f0fe2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -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 {
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 672dc2c..5fef34f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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;
 
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 8951740..8987295 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -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;
-- 
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.
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Intel-wired-lan] [PATCH net v2] i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs
  2020-10-22 10:39 [Intel-wired-lan] [PATCH net v2] i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs Mateusz Palczewski
@ 2020-12-15 13:10 ` Jankowski, Konrad0
  0 siblings, 0 replies; 2+ messages in thread
From: Jankowski, Konrad0 @ 2020-12-15 13:10 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Mateusz Palczewski
> Sent: czwartek, 22 pa?dziernika 2020 12:40
> To: intel-wired-lan at lists.osuosl.org
> Cc: Palczewski, Mateusz <mateusz.palczewski@intel.com>; Dziedziuch,
> SylwesterX <sylwesterx.dziedziuch@intel.com>
> Subject: [Intel-wired-lan] [PATCH net v2] 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.
> 
> Fixes: fc60861e9b00 ("i40e: start up in VEPA mode by default")
> Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
> Reported-by: kernel test robot <lkp@intel.com>
> ---
>  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(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e.h
> b/drivers/net/ethernet/intel/i40e/i40e.h
> index c517c47..f1f0fe2 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e.h
> @@ -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 {
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c
> b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 672dc2c..5fef34f 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -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;
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> index 8951740..8987295 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> @@ -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;
> --
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
---------------------------------------------------------------------
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.
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-15 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22 10:39 [Intel-wired-lan] [PATCH net v2] i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs Mateusz Palczewski
2020-12-15 13:10 ` Jankowski, Konrad0

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.