Message ID | 20230119011653.311675-9-jacob.e.keller@intel.com |
---|---|
State | Accepted |
Delegated to: | Anthony Nguyen |
Headers | show |
Series | ice: various virtualization cleanups | expand |
> -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of > Jacob Keller > Sent: czwartek, 19 stycznia 2023 02:17 > To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org> > Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Harshitha > Ramamurthy <harshitha.ramamurthy@intel.com> > Subject: [Intel-wired-lan] [PATCH net-next v2 08/13] ice: add a function to > initialize vf entry > > Some of the initialization code for Single Root IOV VFs will need to be reused > when we introduce Scalable IOV. Pull this code out into a new > ice_initialize_vf_entry helper function. > > Co-developed-by: Harshitha Ramamurthy > <harshitha.ramamurthy@intel.com> > Signed-off-by: Harshitha Ramamurthy <harshitha.ramamurthy@intel.com> > Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> > --- > Changes since v1: > * Added Harshitha's Co-developed-by and Signed-off-by > > Note that this patch was originally authored by Harshitha internally, but she > no longer works for Intel. I took over authorship with her blessing. > I've added her Co-developed-by to indicate authorship, but her @intel.com > address is no longer valid. > > I did not think it right to have her be the "From:" address since she will not be > responsible for addressing feedback. > > drivers/net/ethernet/intel/ice/ice_sriov.c | 16 ++---------- > drivers/net/ethernet/intel/ice/ice_vf_lib.c | 26 +++++++++++++++++++ > .../ethernet/intel/ice/ice_vf_lib_private.h | 1 + > 3 files changed, 29 insertions(+), 14 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c > b/drivers/net/ethernet/intel/ice/ice_sriov.c > index 6ff29be974c5..6c07f661d44c 100644 > --- a/drivers/net/ethernet/intel/ice/ice_sriov.c > +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c Tested-by: Marek Szlosek <marek.szlosek@intel.com>
diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c index 6ff29be974c5..6c07f661d44c 100644 --- a/drivers/net/ethernet/intel/ice/ice_sriov.c +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c @@ -867,21 +867,9 @@ static int ice_create_vf_entries(struct ice_pf *pf, u16 num_vfs) /* set sriov vf ops for VFs created during SRIOV flow */ vf->vf_ops = &ice_sriov_vf_ops; + ice_initialize_vf_entry(vf); + vf->vf_sw_id = pf->first_sw; - /* assign default capabilities */ - vf->spoofchk = true; - vf->num_vf_qs = pf->vfs.num_qps_per; - ice_vc_set_default_allowlist(vf); - - /* ctrl_vsi_idx will be set to a valid value only when VF - * creates its first fdir rule. - */ - ice_vf_ctrl_invalidate_vsi(vf); - ice_vf_fdir_init(vf); - - ice_virtchnl_set_dflt_ops(vf); - - mutex_init(&vf->cfg_lock); 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 624c7de8b205..b6fd1e852968 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -698,6 +698,32 @@ void ice_set_vf_state_qs_dis(struct ice_vf *vf) /* Private functions only accessed from other virtualization files */ +/** + * ice_initialize_vf_entry - Initialize a VF entry + * @vf: pointer to the VF structure + */ +void ice_initialize_vf_entry(struct ice_vf *vf) +{ + struct ice_pf *pf = vf->pf; + struct ice_vfs *vfs; + + vfs = &pf->vfs; + + /* 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); + + /* ctrl_vsi_idx will be set to a valid value only when iAVF + * creates its first fdir rule. + */ + ice_vf_ctrl_invalidate_vsi(vf); + ice_vf_fdir_init(vf); + + mutex_init(&vf->cfg_lock); +} + /** * ice_dis_vf_qs - Disable the VF queues * @vf: pointer to the VF structure diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib_private.h b/drivers/net/ethernet/intel/ice/ice_vf_lib_private.h index a0f204746f4e..552d1d02982d 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib_private.h +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib_private.h @@ -23,6 +23,7 @@ #warning "Only include ice_vf_lib_private.h in CONFIG_PCI_IOV virtualization files" #endif +void ice_initialize_vf_entry(struct ice_vf *vf); void ice_dis_vf_qs(struct ice_vf *vf); int ice_check_vf_init(struct ice_vf *vf); enum virtchnl_status_code ice_err_to_virt_err(int err);