diff mbox series

[iwl-next,v2,1/2] ice: set vf->num_msix in ice_initialize_vf_entry()

Message ID 20240322214445.1653263-2-jacob.e.keller@intel.com
State Accepted
Delegated to: Anthony Nguyen
Headers show
Series ice: minor cleanups for VF IRQ logic | expand

Commit Message

Jacob Keller March 22, 2024, 9:44 p.m. UTC
Commit fe1c5ca2fe76 ("ice: implement num_msix field per VF") updated the
driver to allow for per-VF MSI-X configuration. The initial defaults were
set in ice_create_vf_entries(). This logic is better placed in
ice_initialize_vf_entry(). Indeed, that function already sets
vf->num_vf_qs, as well as initializes the allow list via calling
ice_vc_set_default_allowlist().

Move this logic into ice_initialize_vf_entry(). This makes the code clear,
and ensures that these VF fields will be initialized properly for both
SR-IOV VFs and the upcoming Scalable IOV VFs.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>

---
 drivers/net/ethernet/intel/ice/ice_sriov.c  | 5 -----
 drivers/net/ethernet/intel/ice/ice_vf_lib.c | 5 ++++-
 2 files changed, 4 insertions(+), 6 deletions(-)

Comments

Romanowski, Rafal April 10, 2024, 8:14 a.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Jacob Keller
> Sent: Friday, March 22, 2024 10:45 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Cc: Keller, Jacob E <jacob.e.keller@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-next v2 1/2] ice: set vf->num_msix in
> ice_initialize_vf_entry()
> 
> Commit fe1c5ca2fe76 ("ice: implement num_msix field per VF") updated the
> driver to allow for per-VF MSI-X configuration. The initial defaults were set in
> ice_create_vf_entries(). This logic is better placed in ice_initialize_vf_entry().
> Indeed, that function already sets
> vf->num_vf_qs, as well as initializes the allow list via calling
> ice_vc_set_default_allowlist().
> 
> Move this logic into ice_initialize_vf_entry(). This makes the code clear, and
> ensures that these VF fields will be initialized properly for both SR-IOV VFs and
> the upcoming Scalable IOV VFs.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> 
> ---
>  drivers/net/ethernet/intel/ice/ice_sriov.c  | 5 -----
> drivers/net/ethernet/intel/ice/ice_vf_lib.c | 5 ++++-
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c
> b/drivers/net/ethernet/intel/ice/ice_sriov.c
> index 65e1986af777..5e9521876617 100644
> --- a/drivers/net/ethernet/intel/ice/ice_sriov.c
> +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
> @@ -831,11 +831,6 @@ static int ice_create_vf_entries(struct ice_pf *pf, u16
> num_vfs)
> 
>  		pci_dev_get(vfdev);
> 
> -		/* set default number of MSI-X */
> -		vf->num_msix = pf->vfs.num_msix_per;
> -		vf->num_vf_qs = pf->vfs.num_qps_per;
> -		ice_vc_set_default_allowlist(vf);
> -
>  		hash_add_rcu(vfs->table, &vf->entry, vf_id);
>  	}
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
> b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
> index 21d26e19338a..c51e2482cad2 100644
> --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
> @@ -992,10 +992,13 @@ void ice_initialize_vf_entry(struct ice_vf *vf)
> 
>  	/* assign default capabilities */
>  	vf->spoofchk = true;
> -	vf->num_vf_qs = vfs->num_qps_per;
>  	ice_vc_set_default_allowlist(vf);
>  	ice_virtchnl_set_dflt_ops(vf);
> 
> +	/* set default number of MSI-X */
> +	vf->num_msix = vfs->num_msix_per;
> +	vf->num_vf_qs = vfs->num_qps_per;
> +
>  	/* ctrl_vsi_idx will be set to a valid value only when iAVF
>  	 * creates its first fdir rule.
>  	 */
> --
> 2.44.0.53.g0f9d4d28b7e6


Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
index 65e1986af777..5e9521876617 100644
--- a/drivers/net/ethernet/intel/ice/ice_sriov.c
+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
@@ -831,11 +831,6 @@  static int ice_create_vf_entries(struct ice_pf *pf, u16 num_vfs)
 
 		pci_dev_get(vfdev);
 
-		/* set default number of MSI-X */
-		vf->num_msix = pf->vfs.num_msix_per;
-		vf->num_vf_qs = pf->vfs.num_qps_per;
-		ice_vc_set_default_allowlist(vf);
-
 		hash_add_rcu(vfs->table, &vf->entry, vf_id);
 	}
 
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
index 21d26e19338a..c51e2482cad2 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
@@ -992,10 +992,13 @@  void ice_initialize_vf_entry(struct ice_vf *vf)
 
 	/* assign default capabilities */
 	vf->spoofchk = true;
-	vf->num_vf_qs = vfs->num_qps_per;
 	ice_vc_set_default_allowlist(vf);
 	ice_virtchnl_set_dflt_ops(vf);
 
+	/* set default number of MSI-X */
+	vf->num_msix = vfs->num_msix_per;
+	vf->num_vf_qs = vfs->num_qps_per;
+
 	/* ctrl_vsi_idx will be set to a valid value only when iAVF
 	 * creates its first fdir rule.
 	 */