ice: various virtualization cleanups
Subsystems (5)
v2 cover ice: various virtualization cleanups
This series contains a variety of refactors and cleanups in the VF code for the ice driver. Its primary focus is to cleanup a few areas of the driver before we begin implementing Scalable IOV.
This includes some cleanup and simplification of the VF operations and addition of a few new operations that will be required by Scalable IOV, as well as some other refactors needed for the handling of VF subfunctions.
It also contains a patch for changing the way we handle the mapping of the PCI BAR 0 registers to allow sparse maps. This is done to enable iRDMA to map the RDMA registers with write combining. Today, the iRDMA driver tries this, but since the ice driver already mapped them as uncachable, the write combining does not take effect. This results in additional latency as the write combining can't be used.
This is fixed by modifying the driver to perform its own iomaps to map the region before the RDMA space and the region after the space separately. We can't just reduce the size of the map because Scalable IOV will need the registers in the region beyond the RDMA area.
Changes since v1
* drop "ice: add helper function for checking VSI VF requirements"
* add new patch "ice: refactor VSI setup to use parameter structure"
* Fix iRDMA use of hw_addr
* Fix printk format in WARN_ON
* Add Co-developed-by tag for "ice: add a function to initialize vf entry"
* Cleanup use of ice_set_vf_state_qs_dis
* Fix build failures reported by robot
Jacob Keller (13):
ice: fix function comment referring to ice_vsi_alloc
ice: drop unnecessary VF parameter from several VSI functions
ice: refactor VSI setup to use parameter structure
ice: move vsi_type assignment from ice_vsi_alloc to ice_vsi_cfg
ice: Fix RDMA latency issue by allowing write-combining
ice: move ice_vf_vsi_release into ice_vf_lib.c
ice: Pull common tasks into ice_vf_post_vsi_rebuild
ice: add a function to initialize vf entry
ice: introduce ice_vf_init_host_cfg function
ice: convert vf_ops .vsi_rebuild to .create_vsi
ice: introduce clear_reset_state operation
ice: introduce .irq_close VF operation
ice: remove unnecessary virtchnl_ether_addr struct use
drivers/infiniband/hw/irdma/main.c | 2 +- drivers/net/ethernet/intel/ice/ice.h | 4 +- drivers/net/ethernet/intel/ice/ice_base.c | 5 +- drivers/net/ethernet/intel/ice/ice_eswitch.c | 26 ++- drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +- drivers/net/ethernet/intel/ice/ice_lib.c | 138 ++++++----- drivers/net/ethernet/intel/ice/ice_lib.h | 52 ++++- drivers/net/ethernet/intel/ice/ice_main.c | 219 ++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_osdep.h | 48 +++- drivers/net/ethernet/intel/ice/ice_sriov.c | 133 ++++------- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 181 ++++++++++++++- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 12 +- .../ethernet/intel/ice/ice_vf_lib_private.h | 3 + drivers/net/ethernet/intel/ice/ice_virtchnl.c | 24 +- 16 files changed, 621 insertions(+), 233 deletions(-)
base-commit: dd2bcc3ced4c47bead56ad9b728d7d5c3941cae2
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 1/13 ice: fix function comment referring to ice_vsi_alloc
Since commit 1d2e32275de7 ("ice: split ice_vsi_setup into smaller functions") ice_vsi_alloc has not been responsible for all of the behavior implied by the comment for ice_vsi_setup_vector_base.
Fix the comment to refer to the new function ice_vsi_alloc_def().
---
Changes since v1:
* Add Reviewed-by tag
drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_lib.c +1 -1
@@ -1527,7 +1527,7 @@ static int ice_get_vf_ctrl_res(struct ice_pf *pf, struct ice_vsi *vsi)* ice_vsi_setup_vector_base - Set up the base vector for the given VSI * @vsi: ptr to the VSI * -* This should only be called after ice_vsi_alloc() which allocates the +* This should only be called after ice_vsi_alloc_def() which allocates the * corresponding SW VSI structure and initializes num_queue_pairs for the * newly allocated VSI. *
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 2/13 ice: drop unnecessary VF parameter from several VSI functions
In reply to Jacob KellerThe vsi->vf pointer gets assigned early on during ice_vsi_alloc. Several functions currently take a VF pointer, but they can just use the existing vsi->vf pointer as needed. Modify these functions to drop the unnecessary VF parameter.
Note that ice_vsi_cfg is not changed as a following change will refactor so that the VF pointer is assigned during ice_vsi_cfg rather than ice_vsi_alloc.
---
Changes since v1:
* Add Reviewed-by tag
* Fix kdoc warning about non-existent function argument
drivers/net/ethernet/intel/ice/ice_lib.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +8 -13
@@ -166,14 +166,14 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)/** * ice_vsi_set_num_qs - Set number of queues, descriptors and vectors for a VSI * @vsi: the VSI being configured -* @vf: the VF associated with this VSI, if any * * Return 0 on success and a negative value on error */ -static void ice_vsi_set_num_qs (struct ice_vsi *vsi,struct ice_vf *vf) +static void ice_vsi_set_num_qs (struct ice_vsi *vsi) {enum ice_vsi_type vsi_type = vsi->type;struct ice_pf *pf = vsi->back; +struct ice_vf *vf = vsi->vf;if (WARN_ON (vsi_type ==ICE_VSI_VF && !vf))return ;
@@ -594,15 +594,13 @@ static int ice_vsi_alloc_stat_arrays(struct ice_vsi *vsi)/** * ice_vsi_alloc_def - set default values for already allocated VSI * @vsi: ptr to VSI -* @vf: VF for ICE_VSI_VF and ICE_VSI_CTRL * @ch: ptr to channel */ static int -ice_vsi_alloc_def (struct ice_vsi *vsi,struct ice_vf *vf, -struct ice_channel *ch) +ice_vsi_alloc_def (struct ice_vsi *vsi,struct ice_channel *ch) {if (vsi->type !=ICE_VSI_CHNL ) { -ice_vsi_set_num_qs (vsi, vf); +ice_vsi_set_num_qs (vsi);if (ice_vsi_alloc_arrays (vsi))return -ENOMEM ; }
@@ -2702,14 +2700,11 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)/** * ice_vsi_cfg_def - configure default VSI based on the type * @vsi: pointer to VSI -* @vf: pointer to VF to which this VSI connects. This field is used primarily -* for the ICE_VSI_VF type. Other VSI types should pass NULL. * @ch: ptr to channel * @init_vsi: is this an initialization or a reconfigure of the VSI */ static int -ice_vsi_cfg_def (struct ice_vsi *vsi,struct ice_vf *vf,struct ice_channel *ch, -int init_vsi) +ice_vsi_cfg_def (struct ice_vsi *vsi,struct ice_channel *ch,int init_vsi) {struct device *dev =ice_pf_to_dev (vsi->back);struct ice_pf *pf = vsi->back;
@@ -2717,7 +2712,7 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vf *vf, struct ice_channel *ch, vsi->vsw = pf->first_sw; - ret =ice_vsi_alloc_def (vsi, vf, ch); + ret =ice_vsi_alloc_def (vsi, ch);if (ret)return ret;
@@ -2875,7 +2870,7 @@ int ice_vsi_cfg(struct ice_vsi *vsi, struct ice_vf *vf, struct ice_channel *ch, {int ret; - ret =ice_vsi_cfg_def (vsi, vf, ch, init_vsi); + ret =ice_vsi_cfg_def (vsi, ch, init_vsi);if (ret)return ret;
@@ -3504,7 +3499,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, int init_vsi) prev_rxq = vsi->num_rxq;ice_vsi_decfg (vsi); - ret =ice_vsi_cfg_def (vsi, vsi->vf, vsi->ch, init_vsi); + ret =ice_vsi_cfg_def (vsi, vsi->ch, init_vsi);if (ret) goto err_vsi_cfg;
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 02/13] ice: drop unnecessary VF parameter from several VSI functions
drivers/net/ethernet/intel/ice/ice_lib.c
Quoted 35 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: czwartek, 19 stycznia 2023 02:17
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 02/13] ice: drop unnecessary VF parameter from several VSI functionsThe
vsi->vfpointer gets assigned early on duringice_vsi_alloc. Several functions currently take a VF pointer, but they can just use the existingvsi->vfpointer as needed. Modify these functions to drop thevsi->unnecessary
VF parameter.Note that
ice_vsi_cfgis not changed as a following change will refactor so that the VF pointer is assigned duringice_vsi_cfgrather thanice_vsi_alloc.Signed-off-by Jacob Keller <[email protected]>Reviewed-by Michal Swiatkowski <[email protected]>---
Changes since v1:
* Add Reviewed-by tag
* Fix kdoc warning about non-existent function argumentdrivers/net/ethernet/intel/ice/ice_lib.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)drivers/net/ethernet/intel/ice/ice_lib.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 3/13 ice: refactor VSI setup to use parameter structure
In reply to Jacob KellerThe ice_vsi_setup function, ice_vsi_alloc, and ice_vsi_cfg functions have grown a large number of parameters. These parameters are used to initialize a new VSI, as well as re-configure an existing VSI
Any time we want to add a new parameter to this function chain, even if it will usually be unset, we have to change many call sites due to changing the function signature.
A future change is going to refactor ice_vsi_alloc and ice_vsi_cfg to move the VSI configuration and initialization all into ice_vsi_cfg.
Before this, refactor the VSI setup flow to use a new ice_vsi_cfg_params structure. This will contain the configuration (mainly pointers) used to initialize a VSI.
Pass this from ice_vsi_setup into the related functions such as ice_vsi_alloc, ice_vsi_cfg, and ice_vsi_cfg_def.
Introduce a helper, ice_vsi_to_params to convert an existing VSI to the parameters used to initialize it. This will aid in the flows where we rebuild an existing VSI.
Since we also pass the ICE_VSI_FLAG_INIT to more functions which do not need (or cannot yet have) the VSI parameters, lets make this clear by renaming the function parameter to vsi_flags and using a u32 instead of a signed integer. The name vsi_flags also makes it clear that we may extend the flags in the future.
This change will make it easier to refactor the setup flow in the future, and will reduce the complexity required to add a new parameter for configuration in the future.
---
Changes since v1:
* New patch to introduce ice_vsi_cfg_params structure
drivers/net/ethernet/intel/ice/ice_eswitch.c | 8 +- drivers/net/ethernet/intel/ice/ice_lib.c | 92 ++++++++++---------- drivers/net/ethernet/intel/ice/ice_lib.h | 52 +++++++++-- drivers/net/ethernet/intel/ice/ice_main.c | 40 +++++++-- drivers/net/ethernet/intel/ice/ice_sriov.c | 9 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 9 +- 6 files changed, 147 insertions(+), 63 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +7 -1
@@ -425,7 +425,13 @@ static void ice_eswitch_release_env(struct ice_pf *pf)static struct ice_vsi *ice_eswitch_vsi_setup (struct ice_pf *pf,struct ice_port_info *pi) { -return ice_vsi_setup (pf, pi,ICE_VSI_SWITCHDEV_CTRL ,NULL ,NULL ); +struct ice_vsi_cfg_params params = {}; + + params.type =ICE_VSI_SWITCHDEV_CTRL ; + params.pi = pi; + params.flags =ICE_VSI_FLAG_INIT ; + +return ice_vsi_setup (pf, ¶ms); }/**
drivers/net/ethernet/intel/ice/ice_lib.c +47 -45
235 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_lib.h +44 -8
70 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +35 -5
@@ -3444,14 +3444,27 @@ void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size)static struct ice_vsi *ice_pf_vsi_setup (struct ice_pf *pf,struct ice_port_info *pi) { -return ice_vsi_setup (pf, pi,ICE_VSI_PF ,NULL ,NULL ); +struct ice_vsi_cfg_params params = {}; + + params.type =ICE_VSI_PF ; + params.pi = pi; + params.flags =ICE_VSI_FLAG_INIT ; + +return ice_vsi_setup (pf, ¶ms); }static struct ice_vsi *ice_chnl_vsi_setup (struct ice_pf *pf,struct ice_port_info *pi,struct ice_channel *ch) { -return ice_vsi_setup (pf, pi,ICE_VSI_CHNL ,NULL , ch); +struct ice_vsi_cfg_params params = {}; + + params.type =ICE_VSI_CHNL ; + params.pi = pi; + params.ch = ch; + params.flags =ICE_VSI_FLAG_INIT ; + +return ice_vsi_setup (pf, ¶ms); }/**
@@ -3465,7 +3478,13 @@ ice_chnl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,static struct ice_vsi *ice_ctrl_vsi_setup (struct ice_pf *pf,struct ice_port_info *pi) { -return ice_vsi_setup (pf, pi,ICE_VSI_CTRL ,NULL ,NULL ); +struct ice_vsi_cfg_params params = {}; + + params.type =ICE_VSI_CTRL ; + params.pi = pi; + params.flags =ICE_VSI_FLAG_INIT ; + +return ice_vsi_setup (pf, ¶ms); }/**
@@ -3479,7 +3498,13 @@ ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)struct ice_vsi *ice_lb_vsi_setup (struct ice_pf *pf,struct ice_port_info *pi) { -return ice_vsi_setup (pf, pi,ICE_VSI_LB ,NULL ,NULL ); +struct ice_vsi_cfg_params params = {}; + + params.type =ICE_VSI_LB ; + params.pi = pi; + params.flags =ICE_VSI_FLAG_INIT ; + +return ice_vsi_setup (pf, ¶ms); }/**
@@ -4998,6 +5023,7 @@ static void ice_deinit(struct ice_pf *pf)*/ int ice_load (struct ice_pf *pf) { +struct ice_vsi_cfg_params params = {};struct ice_vsi *vsi;int err;
@@ -5010,7 +5036,11 @@ int ice_load(struct ice_pf *pf)return err; vsi =ice_get_main_vsi (pf); - err =ice_vsi_cfg (vsi,NULL ,NULL ,ICE_VSI_FLAG_INIT ); + + params =ice_vsi_to_params (vsi); + params.flags =ICE_VSI_FLAG_INIT ; + + err =ice_vsi_cfg (vsi, ¶ms);if (err) goto err_vsi_cfg;
drivers/net/ethernet/intel/ice/ice_sriov.c +7 -2
@@ -248,11 +248,16 @@ void ice_free_vfs(struct ice_pf *pf)*/ static struct ice_vsi *ice_vf_vsi_setup (struct ice_vf *vf) { -struct ice_port_info *pi =ice_vf_get_port_info (vf); +struct ice_vsi_cfg_params params = {};struct ice_pf *pf = vf->pf;struct ice_vsi *vsi; - vsi =ice_vsi_setup (pf, pi,ICE_VSI_VF , vf,NULL ); + params.type =ICE_VSI_VF ; + params.pi =ice_vf_get_port_info (vf); + params.vf = vf; + params.flags =ICE_VSI_FLAG_INIT ; + + vsi =ice_vsi_setup (pf, ¶ms);if (!vsi) {dev_err (ice_pf_to_dev (pf),"Failed to create VF VSI\n" );
drivers/net/ethernet/intel/ice/ice_vf_lib.c +7 -2
@@ -1115,11 +1115,16 @@ void ice_vf_ctrl_vsi_release(struct ice_vf *vf)*/ struct ice_vsi *ice_vf_ctrl_vsi_setup (struct ice_vf *vf) { -struct ice_port_info *pi =ice_vf_get_port_info (vf); +struct ice_vsi_cfg_params params = {};struct ice_pf *pf = vf->pf;struct ice_vsi *vsi; - vsi =ice_vsi_setup (pf, pi,ICE_VSI_CTRL , vf,NULL ); + params.type =ICE_VSI_CTRL ; + params.pi =ice_vf_get_port_info (vf); + params.vf = vf; + params.flags =ICE_VSI_FLAG_INIT ; + + vsi =ice_vsi_setup (pf, ¶ms);if (!vsi) {dev_err (ice_pf_to_dev (pf),"Failed to create VF control VSI\n" );ice_vf_ctrl_invalidate_vsi (vf);
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 03/13] ice: refactor VSI setup to use parameter structure
Quoted 48 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Thursday, January 19, 2023 6:47 AM
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 03/13] ice: refactor VSI setup to use parameter structureThe
ice_vsi_setupfunction,ice_vsi_alloc, andice_vsi_cfgfunctions have grown a large number of parameters. These parameters are used to initialize a new VSI, as well as re-configure an existing VSIAny time we want to add a new parameter to this function chain, even if it will usually be unset, we have to change many call sites due to changing the function signature.
A future change is going to refactor
ice_vsi_allocandice_vsi_cfgto move the VSI configuration and initialization all intoice_vsi_cfg.Before this, refactor the VSI setup flow to use a new
ice_vsi_cfg_paramsstructure. This will contain the configuration (mainly pointers) used to initialize a VSI.Pass this from
ice_vsi_setupinto the related functions such asice_vsi_alloc,ice_vsi_cfg, andice_vsi_cfg_def.Introduce a helper,
ice_vsi_to_paramsto convert an existing VSI to the parameters used to initialize it. This will aid in the flows where we rebuild an existing VSI.Since we also pass the
ICE_VSI_FLAG_INITto more functions which do not need (or cannot yet have) the VSI parameters, lets make this clear by renaming the function parameter tovsi_flagsand using a u32 instead of a signed integer. The namevsi_flagsalso makes it clear that we may extend the flags in the future.This change will make it easier to refactor the setup flow in the future, and will reduce the complexity required to add a new parameter for configuration in the future.
Signed-off-by Jacob Keller <[email protected]>---
Changes since v1:
* New patch to introduceice_vsi_cfg_paramsstructure
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c | 8 +- drivers/net/ethernet/intel/ice/ice_lib.c | 92 ++++++++++---------- drivers/net/ethernet/intel/ice/ice_lib.h | 52 +++++++++-- drivers/net/ethernet/intel/ice/ice_main.c | 40 +++++++-- drivers/net/ethernet/intel/ice/ice_sriov.c | 9 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 9 +- 6 files changed, 147 insertions(+), 63 deletions(-)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 4/13 ice: move vsi_type assignment from ice_vsi_alloc to ice_vsi_cfg
In reply to Jacob KellerThe ice_vsi_alloc and ice_vsi_cfg functions are used together to allocate and configure a new VSI, called as part of the ice_vsi_setup function.
In the future with the addition of the subfunction code the ice driver will want to be able to allocate a VSI while delaying the configuration to a later point of the port activation.
Currently this requires that the port code know what type of VSI should be allocated. This is required because ice_vsi_alloc assigns the VSI type.
Refactor the ice_vsi_alloc and ice_vsi_cfg functions so that VSI type assignment isn't done until the configuration stage. This will allow the devlink port addition logic to reserve a VSI as early as possible before the type of the port is known. In this way, the port add can fail in the event that all hardware VSI resources are exhausted.
Since the ice_vsi_cfg function already takes the ice_vsi_cfg_params structure, this is relatively straight forward.
---
Changes since v1:
* Re-order after new patch
* Changed to take into account ice_vsi_cfg_params
drivers/net/ethernet/intel/ice/ice_lib.c | 51 ++++++++++++------------ 1 file changed, 26 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +26 -25
@@ -639,23 +639,18 @@ ice_vsi_alloc_def(struct ice_vsi *vsi, struct ice_channel *ch)/** * ice_vsi_alloc - Allocates the next available struct VSI in the PF * @pf: board private structure -* @params: parameters to use when allocating the new VSI * -* The VF pointer is used for ICE_VSI_VF and ICE_VSI_CTRL. For ICE_VSI_CTRL, -* it may be NULL in the case there is no association with a VF. For -* ICE_VSI_VF the VF pointer *must not* be NULL. +* Reserves a VSI index from the PF and allocates an empty VSI structure +* without a type. The VSI structure must later be initialized by calling +* ice_vsi_cfg(). * * returns a pointer to a VSI on success, NULL on failure. */ -static struct ice_vsi * -ice_vsi_alloc (struct ice_pf *pf,struct ice_vsi_cfg_params *params) +static struct ice_vsi *ice_vsi_alloc (struct ice_pf *pf) {struct device *dev =ice_pf_to_dev (pf);struct ice_vsi *vsi =NULL ; -if (WARN_ON (params->type ==ICE_VSI_VF && !params->vf)) -return NULL ; -/* Need to protect the allocation of the VSIs at the PF level */ mutex_lock (&pf->sw_mutex);
@@ -672,11 +667,7 @@ ice_vsi_alloc(struct ice_pf *pf, struct ice_vsi_cfg_params *params)if (!vsi) goto unlock_pf; - vsi->type = params->type; vsi->back = pf; - vsi->port_info = params->pi; -/* For VSIs which don't have a connected VF, this will be NULL */ - vsi->vf = params->vf;set_bit (ICE_VSI_DOWN , vsi->state);/* fill slot and make note of the index */
@@ -687,16 +678,6 @@ ice_vsi_alloc(struct ice_pf *pf, struct ice_vsi_cfg_params *params) pf->next_vsi =ice_get_free_slot (pf->vsi, pf->num_alloc_vsi, pf->next_vsi); -if (vsi->type ==ICE_VSI_CTRL ) { -if (vsi->vf) { -WARN_ON (vsi->vf->ctrl_vsi_idx !=ICE_NO_VSI ); - vsi->vf->ctrl_vsi_idx = vsi->idx; - }else { -WARN_ON (pf->ctrl_vsi_idx !=ICE_NO_VSI ); - pf->ctrl_vsi_idx = vsi->idx; - } - } - unlock_pf:mutex_unlock (&pf->sw_mutex);return vsi;
@@ -2856,14 +2837,24 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params) }/** -* ice_vsi_cfg - configure VSI and tc on it +* ice_vsi_cfg - configure a previously allocated VSI * @vsi: pointer to VSI * @params: parameters used to configure this VSI */ int ice_vsi_cfg (struct ice_vsi *vsi,struct ice_vsi_cfg_params *params) { +struct ice_pf *pf = vsi->back;int ret; +if (WARN_ON (params->type ==ICE_VSI_VF && !params->vf)) +return -EINVAL ; + + vsi->type = params->type; + vsi->port_info = params->pi; + +/* For VSIs which don't have a connected VF, this will be NULL */ + vsi->vf = params->vf; + ret =ice_vsi_cfg_def (vsi, params);if (ret)return ret;
@@ -2872,6 +2863,16 @@ int ice_vsi_cfg(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params)if (ret)ice_vsi_decfg (vsi); +if (vsi->type ==ICE_VSI_CTRL ) { +if (vsi->vf) { +WARN_ON (vsi->vf->ctrl_vsi_idx !=ICE_NO_VSI ); + vsi->vf->ctrl_vsi_idx = vsi->idx; + }else { +WARN_ON (pf->ctrl_vsi_idx !=ICE_NO_VSI ); + pf->ctrl_vsi_idx = vsi->idx; + } + } +return ret; }
@@ -2956,7 +2957,7 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params) WARN_ON(!params->pi))return NULL ; - vsi =ice_vsi_alloc (pf, params); + vsi =ice_vsi_alloc (pf);if (!vsi) {dev_err (dev,"could not allocate VSI\n" );return NULL ;
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 04/13] ice: move vsi_type assignment from ice_vsi_alloc to ice_vsi_cfg
Quoted 30 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Thursday, January 19, 2023 6:47 AM
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 04/13] ice: movevsi_typeassignment fromice_vsi_alloctoice_vsi_cfgThe
ice_vsi_allocandice_vsi_cfgfunctions are used together to allocate and configure a new VSI, called as part of theice_vsi_setupfunction.In the future with the addition of the subfunction code the ice driver will want to be able to allocate a VSI while delaying the configuration to a later point of the port activation.
Currently this requires that the port code know what type of VSI should be allocated. This is required because
ice_vsi_allocassigns the VSI type.Refactor the
ice_vsi_allocandice_vsi_cfgfunctions so that VSI type assignment isn't done until the configuration stage. This will allow the devlink port addition logic to reserve a VSI as early as possible before the type of the port is known. In this way, the port add can fail in the event that all hardware VSI resources are exhausted.Since the
ice_vsi_cfgfunction already takes theice_vsi_cfg_paramsstructure, this is relatively straight forward.
Quoted 9 lines
Signed-off-by Jacob Keller <[email protected]>---
Changes since v1:
* Re-order after new patch
* Changed to take into accountice_vsi_cfg_paramsdrivers/net/ethernet/intel/ice/ice_lib.c | 51 ++++++++++++------------ 1 file changed, 26 insertions(+), 25 deletions(-)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 5/13 ice: Fix RDMA latency issue by allowing write-combining
In reply to Jacob KellerThe current method of mapping the entire BAR region as a single uncacheable region does not allow RDMA to use write combining (WC). This results in increased latency with RDMA.
To fix this, we initially planned to reduce the size of the map made by the PF driver to include only up to the beginning of the RDMA space. Unfortunately this will not work in the future as there are some hardware features which use registers beyond the RDMA area. This includes Scalable IOV, a virtualization feature being worked on currently.
Instead of simply reducing the size of the map, we need a solution which will allow access to all areas of the address space while leaving the RDMA area open to be mapped with write combining.
To allow for this, and fix the RMDA latency issue without blocking the higher areas of the BAR, we need to create multiple separate memory maps. Doing so will create a sparse mapping rather than a contiguous single area.
Replace the void *hw_addr with a special ice_hw_addr structure which represents the multiple mappings as a flexible array.
Based on the available BAR size, map up to 3 regions:
* The space before the RDMA section
* The RDMA section which wants write combining behavior
* The space after the RDMA section
Add an ice_get_hw_addr function which converts a register offset into the appropriate kernel address based on which chunk it falls into. This does cost us slightly more computation overhead for register access as we now must check the table each access. However, we can pre-compute the addresses where this would most be a problem.
With this change, the RDMA driver is now free to map the RDMA register section as write-combined without impacting access to other device registers used by the main PF driver.
---
Changes since v1:
* Export ice_get_hw_addr
* Use ice_get_hw_addr in iRDMA driver
* Fix the WARN_ON to use %pa instead of %llx for printing a resource_size_t
drivers/infiniband/hw/irdma/main.c | 2 +- drivers/net/ethernet/intel/ice/ice.h | 4 +- drivers/net/ethernet/intel/ice/ice_base.c | 5 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +- drivers/net/ethernet/intel/ice/ice_main.c | 177 +++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_osdep.h | 48 ++++- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 +- 8 files changed, 219 insertions(+), 24 deletions(-)
drivers/infiniband/hw/irdma/main.c +1 -1
@@ -228,7 +228,7 @@ static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf rf->cdev = pf; rf->gen_ops.register_qset = irdma_lan_register_qset; rf->gen_ops.unregister_qset = irdma_lan_unregister_qset; - rf->hw.hw_addr = pf->hw.hw_addr; + rf->hw.hw_addr =ice_get_hw_addr (&pf->hw,0 ); rf->pcidev = pf->pdev; rf->msix_count = pf->num_rdma_msix; rf->pf_id = pf->hw.pf_id;
drivers/net/ethernet/intel/ice/ice.h +3 -1
@@ -75,7 +75,9 @@#include "ice_vsi_vlan_ops.h" #include "ice_gnss.h" -#define ICE_BAR0 0 +#define ICE_BAR0 0 +#define ICE_BAR_RDMA_WC_START 0x0800000 +#define ICE_BAR_RDMA_WC_END 0x1000000#define ICE_REQ_DESC_MULTIPLE 32#define ICE_MIN_NUM_DESC 64#define ICE_MAX_NUM_DESC 8160
drivers/net/ethernet/intel/ice/ice_base.c +2 -3
@@ -480,7 +480,7 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring) ring->rx_offset =ice_rx_offset (ring);/* init queue specific tail register */ - ring->tail = hw->hw_addr +QRX_TAIL (pf_q); + ring->tail =ice_get_hw_addr (hw,QRX_TAIL (pf_q));writel (0 , ring->tail);return 0 ;
@@ -790,8 +790,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,/* init queue specific tail reg. It is referred as * transmit comm scheduler queue doorbell. */ - ring->tail = hw->hw_addr +QTX_COMM_DBELL (pf_q); - + ring->tail =ice_get_hw_addr (hw,QTX_COMM_DBELL (pf_q));if (IS_ENABLED (CONFIG_DCB )) tc = ring->dcb_tc;else
drivers/net/ethernet/intel/ice/ice_ethtool.c +2 -1
@@ -3085,7 +3085,8 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring,/* this is to allow wr32 to have something to write to * during early allocation of Rx buffers */ - rx_rings[i].tail = vsi->back->hw.hw_addr +PRTGEN_STATUS ; + rx_rings[i].tail =ice_get_hw_addr (&vsi->back->hw, +PRTGEN_STATUS ); err =ice_setup_rx_ring (&rx_rings[i]);if (err)
drivers/net/ethernet/intel/ice/ice_main.c +166 -11
210 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_osdep.h +43 -5
60 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_txrx.h +1 -1
@@ -272,7 +272,7 @@ struct ice_rx_ring {struct net_device *netdev;/* netdev ring maps to */ struct ice_vsi *vsi;/* Backreference to associated VSI */ struct ice_q_vector *q_vector;/* Backreference to associated vector */ -u8 __iomem *tail; +void __iomem *tail;union {struct ice_rx_buf *rx_buf;struct xdp_buff **xdp_buf;
drivers/net/ethernet/intel/ice/ice_type.h +1 -1
@@ -821,7 +821,7 @@ struct ice_mbx_data {/* Port hardware description */ struct ice_hw { -u8 __iomem *hw_addr; +void *hw_addr;void *back;struct ice_aqc_layer_props *layer_info;struct ice_port_info *port_info;
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining
Quoted 54 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Thursday, January 19, 2023 2:17 AM
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combiningThe current method of mapping the entire BAR region as a single uncacheable region does not allow RDMA to use write combining (WC). This results in increased latency with RDMA.
To fix this, we initially planned to reduce the size of the map made by the PF driver to include only up to the beginning of the RDMA space. Unfortunately this will not work in the future as there are some hardware features which use registers beyond the RDMA area. This includes Scalable IOV, a virtualization feature being worked on currently.
Instead of simply reducing the size of the map, we need a solution which will allow access to all areas of the address space while leaving the RDMA area open to be mapped with write combining.
To allow for this, and fix the RMDA latency issue without blocking the higher areas of the BAR, we need to create multiple separate memory maps. Doing so will create a sparse mapping rather than a contiguous single area.
Replace the void
*hw_addrwith a specialice_hw_addrstructure which represents the multiple mappings as a flexible array.Based on the available BAR size, map up to 3 regions:
* The space before the RDMA section
* The RDMA section which wants write combining behavior
* The space after the RDMA sectionAdd an
ice_get_hw_addrfunction which converts a register offset into the appropriate kernel address based on which chunk it falls into. This does cost us slightly more computation overhead for register access as we now must check the table each access. However, we can pre-compute the addresses where this would most be a problem.With this change, the RDMA driver is now free to map the RDMA register section as write-combined without impacting access to other device registers used by the main PF driver.
Reported-by Dave Ertman <[email protected]>Signed-off-by Jacob Keller <[email protected]>---
Changes since v1:
* Exportice_get_hw_addr
* Useice_get_hw_addrin iRDMA driver
* Fix theWARN_ONto use %pa instead of %llx for printing aresource_size_t
Quoted 10 lines
drivers/infiniband/hw/irdma/main.c | 2 +- drivers/net/ethernet/intel/ice/ice.h | 4 +- drivers/net/ethernet/intel/ice/ice_base.c | 5 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +- drivers/net/ethernet/intel/ice/ice_main.c | 177 +++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_osdep.h | 48 ++++- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 +- 8 files changed, 219 insertions(+), 24 deletions(-)
Quoted 3 lines
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining
In reply to Jacob KellerFrom: Jacob Keller <[email protected]>
Date: Wed, 18 Jan 2023 17:16:45 -0800
Quoted 18 lines
The current method of mapping the entire BAR region as a single uncacheable region does not allow RDMA to use write combining (WC). This results in increased latency with RDMA.
To fix this, we initially planned to reduce the size of the map made by the PF driver to include only up to the beginning of the RDMA space. Unfortunately this will not work in the future as there are some hardware features which use registers beyond the RDMA area. This includes Scalable IOV, a virtualization feature being worked on currently.
Instead of simply reducing the size of the map, we need a solution which will allow access to all areas of the address space while leaving the RDMA area open to be mapped with write combining.
To allow for this, and fix the RMDA latency issue without blocking the higher areas of the BAR, we need to create multiple separate memory maps. Doing so will create a sparse mapping rather than a contiguous single area.
Quoted 8 lines
Replace the void
*hw_addrwith a specialice_hw_addrstructure which represents the multiple mappings as a flexible array.Based on the available BAR size, map up to 3 regions:
* The space before the RDMA section
* The RDMA section which wants write combining behavior
* The space after the RDMA section
Please don't.
You have[0]:
* io_mapping_init_wc() (+ io_mapping_fini());
* io_mapping_create_wc() (+ io_mapping_free());
^ they do the same (the second just allocates a struct ad-hoc, but it
can be allocated manually or embedded into a driver structure),
* arch_phys_wc_add() (+ arch_phys_wc_del())[1];
^ optional to make MTRR happy
-- precisely for the case when you need to remap *a part* of BAR in a different mode.
Splitting BARs, dropping pcim_iomap_regions() and so on, is very wrong. Not speaking of that it's PCI driver which must own and map all the memory the device advertises in its PCI config space, and in case of ice, PCI driver is combined with Ethernet, so it's ice which must own and map all the memory.
Not speaking of that using a structure with a flex array and creating a static inline to calculate the pointer each time you need to read/write a register, hurts performance and looks properly ugly.
The interfaces above must be used by the RDMA driver, right before mapping its part in WC mode. PCI driver has no idea that someone else wants to remap its memory differently, so the code doesn't belong here. I'd drop the patch and let the RDMA team fix/improve their driver.
Quoted 19 lines
Add an
ice_get_hw_addrfunction which converts a register offset into the appropriate kernel address based on which chunk it falls into. This does cost us slightly more computation overhead for register access as we now must check the table each access. However, we can pre-compute the addresses where this would most be a problem.With this change, the RDMA driver is now free to map the RDMA register section as write-combined without impacting access to other device registers used by the main PF driver.
Reported-by Dave Ertman <[email protected]>Signed-off-by Jacob Keller <[email protected]>---
Changes since v1:
* Exportice_get_hw_addr
* Useice_get_hw_addrin iRDMA driver
* Fix theWARN_ONto use %pa instead of %llx for printing aresource_size_t
Quoted 9 lines
drivers/infiniband/hw/irdma/main.c | 2 +- drivers/net/ethernet/intel/ice/ice.h | 4 +- drivers/net/ethernet/intel/ice/ice_base.c | 5 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +- drivers/net/ethernet/intel/ice/ice_main.c | 177 +++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_osdep.h | 48 ++++- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 +- 8 files changed, 219 insertions(+), 24 deletions(-)
[0]
https://elixir.bootlin.com/linux/v6.2-rc6/source/include/linux/io-mapping.h#L42
[1]
https://elixir.bootlin.com/linux/v6.2-rc6/source/arch/x86/include/asm/io.h#L339
Thanks,
Olek
RE: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining
Quoted 68 lines
-----Original Message-----
From: Lobakin, Alexandr <[email protected]>
Sent: Monday, January 30, 2023 2:03 AM
To: Keller, Jacob E <[email protected]>
Cc: Intel Wired LAN <[email protected]>; Nguyen, Anthony L <[email protected]>; Linga, Pavan Kumar <[email protected]>; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combiningFrom: Jacob Keller <[email protected]>
Date: Wed, 18 Jan 2023 17:16:45 -0800Quoted 18 lines
The current method of mapping the entire BAR region as a single uncacheable region does not allow RDMA to use write combining (WC). This results in increased latency with RDMA.
To fix this, we initially planned to reduce the size of the map made by the PF driver to include only up to the beginning of the RDMA space. Unfortunately this will not work in the future as there are some hardware features which use registers beyond the RDMA area. This includes Scalable IOV, a virtualization feature being worked on currently.
Instead of simply reducing the size of the map, we need a solution which will allow access to all areas of the address space while leaving the RDMA area open to be mapped with write combining.
To allow for this, and fix the RMDA latency issue without blocking the higher areas of the BAR, we need to create multiple separate memory maps. Doing so will create a sparse mapping rather than a contiguous single area.
Quoted 8 lines
Replace the void
*hw_addrwith a specialice_hw_addrstructure which represents the multiple mappings as a flexible array.Based on the available BAR size, map up to 3 regions:
* The space before the RDMA section
* The RDMA section which wants write combining behavior
* The space after the RDMA sectionPlease don't.
You have[0]:
*
io_mapping_init_wc()(+io_mapping_fini());
*io_mapping_create_wc()(+io_mapping_free());^ they do the same (the second just allocates a struct ad-hoc, but it
can be allocated manually or embedded into a driver structure),*
arch_phys_wc_add()(+ arch_phys_wc_del())[1];^ optional to make MTRR happy
-- precisely for the case when you need to remap *a part* of BAR in a different mode.
Splitting BARs, dropping
pcim_iomap_regions()and so on, is very wrong. Not speaking of that it's PCI driver which must own and map all the memory the device advertises in its PCI config space, and in case of ice, PCI driver is combined with Ethernet, so it's ice which must own and map all the memory.
Not speaking of that using a structure with a flex array and creating a static inline to calculate the pointer each time you need to read/write a register, hurts performance and looks properly ugly.
Quoted 5 lines
The interfaces above must be used by the RDMA driver, right before mapping its part in WC mode. PCI driver has no idea that someone else wants to remap its memory differently, so the code doesn't belong here. I'd drop the patch and let the RDMA team fix/improve their driver.
Appreciate the review! I proposed this option after the original change was to simply reduce the initial size of our bar mapping, resulting in losing access to the registers beyond the RDMA section, which was a non-starter for us once we finish implementing Scalable IOV support.
Searching for io_mapping_init_wc and io_mapping_create_wc there are only a handful of users and not much documentation so no wonder I had trouble locating it! Thanks for helping me learn about it.
@[email protected], @Saleem, Shiraz it looks like we need to drop this patch and modify the iRDMA driver's method of requesting write combined regions to use these new interfaces.
@Nguyen, Anthony L Can you drop this patch from the series on IWL or should I send a v3?
Thanks,
Jake
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerRe: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining
Quoted 2 lines · Jacob E
@Nguyen, Anthony L Can you drop this patch from the series on IWL or should I send a v3?
It looks like it cleanly drops out of the series; I can take care of it, no need for v3.
Thanks,
Tony
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining
In reply to Keller, Jacob EQuoted 76 lines · Jacob E
Quoted 68 lines
-----Original Message-----
From: Lobakin, Alexandr <[email protected]>
Sent: Monday, January 30, 2023 2:03 AM
To: Keller, Jacob E <[email protected]>
Cc: Intel Wired LAN <[email protected]>; Nguyen, Anthony L <[email protected]>; Linga, Pavan Kumar <[email protected]>; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combiningFrom: Jacob Keller <[email protected]>
Date: Wed, 18 Jan 2023 17:16:45 -0800Quoted 18 lines
The current method of mapping the entire BAR region as a single uncacheable region does not allow RDMA to use write combining (WC). This results in increased latency with RDMA.
To fix this, we initially planned to reduce the size of the map made by the PF driver to include only up to the beginning of the RDMA space. Unfortunately this will not work in the future as there are some hardware features which use registers beyond the RDMA area. This includes Scalable IOV, a virtualization feature being worked on currently.
Instead of simply reducing the size of the map, we need a solution which will allow access to all areas of the address space while leaving the RDMA area open to be mapped with write combining.
To allow for this, and fix the RMDA latency issue without blocking the higher areas of the BAR, we need to create multiple separate memory maps. Doing so will create a sparse mapping rather than a contiguous single area.
Quoted 8 lines
Replace the void
*hw_addrwith a specialice_hw_addrstructure which represents the multiple mappings as a flexible array.Based on the available BAR size, map up to 3 regions:
* The space before the RDMA section
* The RDMA section which wants write combining behavior
* The space after the RDMA sectionPlease don't.
You have[0]:
*
io_mapping_init_wc()(+io_mapping_fini());
*io_mapping_create_wc()(+io_mapping_free());^ they do the same (the second just allocates a struct ad-hoc, but it
can be allocated manually or embedded into a driver structure),*
arch_phys_wc_add()(+ arch_phys_wc_del())[1];^ optional to make MTRR happy
-- precisely for the case when you need to remap *a part* of BAR in a different mode.
Splitting BARs, dropping
pcim_iomap_regions()and so on, is very wrong. Not speaking of that it's PCI driver which must own and map all the memory the device advertises in its PCI config space, and in case of ice, PCI driver is combined with Ethernet, so it's ice which must own and map all the memory.
Not speaking of that using a structure with a flex array and creating a static inline to calculate the pointer each time you need to read/write a register, hurts performance and looks properly ugly.Quoted 5 lines
The interfaces above must be used by the RDMA driver, right before mapping its part in WC mode. PCI driver has no idea that someone else wants to remap its memory differently, so the code doesn't belong here. I'd drop the patch and let the RDMA team fix/improve their driver.
Appreciate the review! I proposed this option after the original change was to simply reduce the initial size of our bar mapping, resulting in losing access to the registers beyond the RDMA section, which was a non-starter for us once we finish implementing Scalable IOV support.
Quoted 8 lines
Searching for
io_mapping_init_wcandio_mapping_create_wcthere are only a handful of users and not much documentation so no wonder I had trouble locating it! Thanks for helping me learn about it.@[email protected], @Saleem, Shiraz it looks like we need to drop this patch and modify the iRDMA driver's method of requesting write combined regions to use these new interfaces.
@Nguyen, Anthony L Can you drop this patch from the series on IWL or should I send a v3?
Thanks,
Jake
Mustafa,
It looks like Shiraz is on vacation and you're his coverage. Can you help investigate this and the proposed io_mapping solution from Olek?
Dave,
I tried to add you on the original thread above but it got lost due to an incorrect email.
Thanks,
Jake
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 6/13 ice: move ice_vf_vsi_release into ice_vf_lib.c
In reply to Jacob KellerThe ice_vf_vsi_release function will be used in a future change to refactor the .vsi_rebuild function. Move this over to ice_vf_lib.c so that it can be used there.
---
No changes since v1.
drivers/net/ethernet/intel/ice/ice_sriov.c | 15 --------------- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 18 ++++++++++++++++++ .../ethernet/intel/ice/ice_vf_lib_private.h | 1 + 3 files changed, 19 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/ice/ice_sriov.c +0 -15
@@ -40,21 +40,6 @@ static void ice_free_vf_entries(struct ice_pf *pf) } } -/** -* ice_vf_vsi_release - invalidate the VF's VSI after freeing it -* @vf: invalidate this VF's VSI after freeing it -*/ -static void ice_vf_vsi_release (struct ice_vf *vf) -{ -struct ice_vsi *vsi =ice_get_vf_vsi (vf); - -if (WARN_ON (!vsi)) -return ; - -ice_vsi_release (vsi); -ice_vf_invalidate_vsi (vf); -} -/** * ice_free_vf_res - Free a VF's resources * @vf: pointer to the VF info
drivers/net/ethernet/intel/ice/ice_vf_lib.c +18 -0
@@ -1143,6 +1143,24 @@ void ice_vf_invalidate_vsi(struct ice_vf *vf) vf->lan_vsi_num =ICE_NO_VSI ; } +/** +* ice_vf_vsi_release - Release the VF VSI and invalidate indexes +* @vf: pointer to the VF structure +* +* Release the VF associated with this VSI and then invalidate the VSI +* indexes. +*/ +void ice_vf_vsi_release (struct ice_vf *vf) +{ +struct ice_vsi *vsi =ice_get_vf_vsi (vf); + +if (WARN_ON (!vsi)) +return ; + +ice_vsi_release (vsi); +ice_vf_invalidate_vsi (vf); +} +/** * ice_vf_set_initialized - VF is ready for VIRTCHNL communication * @vf: VF to set in initialized state
drivers/net/ethernet/intel/ice/ice_vf_lib_private.h +1 -0
@@ -36,6 +36,7 @@ void ice_vf_ctrl_invalidate_vsi(struct ice_vf *vf);void ice_vf_ctrl_vsi_release (struct ice_vf *vf);struct ice_vsi *ice_vf_ctrl_vsi_setup (struct ice_vf *vf);void ice_vf_invalidate_vsi (struct ice_vf *vf); +void ice_vf_vsi_release (struct ice_vf *vf);void ice_vf_set_initialized (struct ice_vf *vf);#endif /* _ICE_VF_LIB_PRIVATE_H_ */
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 06/13] ice: move ice_vf_vsi_release into ice_vf_lib.c
drivers/net/ethernet/intel/ice/ice_sriov.c
Quoted 29 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: czwartek, 19 stycznia 2023 02:17
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 06/13] ice: moveice_vf_vsi_releaseintoice_vf_lib.cThe
ice_vf_vsi_releasefunction will be used in a future change to refactor the .vsi_rebuild function. Move this over toice_vf_lib.cso that it can be used there.Signed-off-by Jacob Keller <[email protected]>---
No changes since v1.drivers/net/ethernet/intel/ice/ice_sriov.c | 15 --------------- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 18 ++++++++++++++++++ .../ethernet/intel/ice/ice_vf_lib_private.h | 1 + 3 files changed, 19 insertions(+), 15 deletions(-)drivers/net/ethernet/intel/ice/ice_sriov.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 7/13 ice: Pull common tasks into ice_vf_post_vsi_rebuild
In reply to Jacob KellerThe Single Root IOV implementation of .post_vsi_rebuild performs some tasks that will ultimately need to be shared with the Scalable IOV implementation such as rebuilding the host configuration.
Refactor by introducing a new wrapper function, ice_vf_post_vsi_rebuild which performs the tasks that will be shared between SR-IOV and Scalable IOV. Move the ice_vf_rebuild_host_cfg and ice_vf_set_initialized calls into this wrapper. Then call the implementation specific post_vsi_rebuild handler afterwards.
This ensures that we will properly re-initialize filters and expected settings for both SR-IOV and Scalable IOV.
---
No Changes since v1.
drivers/net/ethernet/intel/ice/ice_sriov.c | 2 -- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_sriov.c +0 -2
@@ -816,8 +816,6 @@ static int ice_sriov_vsi_rebuild(struct ice_vf *vf)*/ static void ice_sriov_post_vsi_rebuild (struct ice_vf *vf) { -ice_vf_rebuild_host_cfg (vf); -ice_vf_set_initialized (vf);ice_ena_vf_mappings (vf);wr32 (&vf->pf->hw,VFGEN_RSTAT (vf->vf_id),VIRTCHNL_VFR_VFACTIVE ); }
drivers/net/ethernet/intel/ice/ice_vf_lib.c +17 -2
@@ -270,6 +270,21 @@ static int ice_vf_rebuild_vsi(struct ice_vf *vf)return 0 ; } +/** +* ice_vf_post_vsi_rebuild - Reset tasks that occur after VSI rebuild +* @vf: the VF being reset +* +* Perform reset tasks which must occur after the VSI has been re-created or +* rebuilt during a VF reset. +*/ +static void ice_vf_post_vsi_rebuild (struct ice_vf *vf) +{ +ice_vf_rebuild_host_cfg (vf); +ice_vf_set_initialized (vf); + + vf->vf_ops->post_vsi_rebuild (vf); +} +/** * ice_is_any_vf_in_unicast_promisc - check if any VF(s) * are in unicast promiscuous mode
@@ -495,7 +510,7 @@ void ice_reset_all_vfs(struct ice_pf *pf)ice_vf_pre_vsi_rebuild (vf);ice_vf_rebuild_vsi (vf); - vf->vf_ops->post_vsi_rebuild (vf); +ice_vf_post_vsi_rebuild (vf);mutex_unlock (&vf->cfg_lock); }
@@ -646,7 +661,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) goto out_unlock; } - vf->vf_ops->post_vsi_rebuild (vf); +ice_vf_post_vsi_rebuild (vf); vsi =ice_get_vf_vsi (vf);if (WARN_ON (!vsi)) { err = -EINVAL ;
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 07/13] ice: Pull common tasks into ice_vf_post_vsi_rebuild
drivers/net/ethernet/intel/ice/ice_sriov.c
Quoted 37 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: czwartek, 19 stycznia 2023 02:17
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 07/13] ice: Pull common tasks intoice_vf_post_vsi_rebuildThe Single Root IOV implementation of .post_vsi_rebuild performs some tasks that will ultimately need to be shared with the Scalable IOV implementation such as rebuilding the host configuration.
Refactor by introducing a new wrapper function,
ice_vf_post_vsi_rebuildwhich performs the tasks that will be shared between SR-IOV and Scalable IOV. Move theice_vf_rebuild_host_cfgandice_vf_set_initializedcalls into this wrapper. Then call the implementation specificpost_vsi_rebuildhandler afterwards.This ensures that we will properly re-initialize filters and expected settings for both SR-IOV and Scalable IOV.
Signed-off-by Jacob Keller <[email protected]>---
No Changes since v1.drivers/net/ethernet/intel/ice/ice_sriov.c | 2 -- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/ice/ice_sriov.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 8/13 ice: add a function to initialize vf entry
In reply to Jacob KellerSome 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.
---
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(-)
drivers/net/ethernet/intel/ice/ice_sriov.c +2 -14
@@ -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); }
drivers/net/ethernet/intel/ice/ice_vf_lib.c +26 -0
@@ -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
drivers/net/ethernet/intel/ice/ice_vf_lib_private.h +1 -0
@@ -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);
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 08/13] ice: add a function to initialize vf entry
drivers/net/ethernet/intel/ice/ice_sriov.c
Quoted 42 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: czwartek, 19 stycznia 2023 02:17
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>; Harshitha Ramamurthy <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 08/13] ice: add a function to initialize vf entrySome 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_entryhelper function.Co-developed-by: Harshitha Ramamurthy
<[email protected]>Signed-off-by Harshitha Ramamurthy <[email protected]>Signed-off-by Jacob Keller <[email protected]>---
Changes since v1:
* Added Harshitha's Co-developed-by and Signed-off-byNote 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(-)drivers/net/ethernet/intel/ice/ice_sriov.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 9/13 ice: introduce ice_vf_init_host_cfg function
In reply to Jacob KellerIntroduce a new generic helper ice_vf_init_host_cfg which performs common host configuration initialization tasks that will need to be done for both Single Root IOV and the new Scalable IOV implementation.
---
No changes since v1.
drivers/net/ethernet/intel/ice/ice_sriov.c | 36 +------------ drivers/net/ethernet/intel/ice/ice_vf_lib.c | 54 +++++++++++++++++++ .../ethernet/intel/ice/ice_vf_lib_private.h | 1 + 3 files changed, 57 insertions(+), 34 deletions(-)
drivers/net/ethernet/intel/ice/ice_sriov.c +2 -34
@@ -573,51 +573,19 @@ static int ice_set_per_vf_res(struct ice_pf *pf, u16 num_vfs)*/ static int ice_init_vf_vsi_res (struct ice_vf *vf) { -struct ice_vsi_vlan_ops *vlan_ops;struct ice_pf *pf = vf->pf; -u8 broadcast[ETH_ALEN ];struct ice_vsi *vsi; -struct device *dev;int err; vf->first_vector_idx =ice_calc_vf_first_vector_idx (pf, vf); - dev =ice_pf_to_dev (pf); vsi =ice_vf_vsi_setup (vf);if (!vsi)return -ENOMEM ; - err =ice_vsi_add_vlan_zero (vsi); -if (err) { -dev_warn (dev,"Failed to add VLAN 0 filter for VF %d\n" , - vf->vf_id); + err =ice_vf_init_host_cfg (vf, vsi); +if (err) goto release_vsi; - } - - vlan_ops =ice_get_compat_vsi_vlan_ops (vsi); - err = vlan_ops->ena_rx_filtering (vsi); -if (err) { -dev_warn (dev,"Failed to enable Rx VLAN filtering for VF %d\n" , - vf->vf_id); - goto release_vsi; - } - -eth_broadcast_addr (broadcast); - err =ice_fltr_add_mac (vsi, broadcast,ICE_FWD_TO_VSI ); -if (err) { -dev_err (dev,"Failed to add broadcast MAC filter for VF %d, error %d\n" , - vf->vf_id, err); - goto release_vsi; - } - - err =ice_vsi_apply_spoofchk (vsi, vf->spoofchk); -if (err) { -dev_warn (dev,"Failed to initialize spoofchk setting for VF %d\n" , - vf->vf_id); - goto release_vsi; - } - - vf->num_mac =1 ;return 0 ;
drivers/net/ethernet/intel/ice/ice_vf_lib.c +54 -0
60 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_vf_lib_private.h +1 -0
@@ -36,6 +36,7 @@ void ice_vf_rebuild_host_cfg(struct ice_vf *vf);void ice_vf_ctrl_invalidate_vsi (struct ice_vf *vf);void ice_vf_ctrl_vsi_release (struct ice_vf *vf);struct ice_vsi *ice_vf_ctrl_vsi_setup (struct ice_vf *vf); +int ice_vf_init_host_cfg (struct ice_vf *vf,struct ice_vsi *vsi);void ice_vf_invalidate_vsi (struct ice_vf *vf);void ice_vf_vsi_release (struct ice_vf *vf);void ice_vf_set_initialized (struct ice_vf *vf);
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 09/13] ice: introduce ice_vf_init_host_cfg function
drivers/net/ethernet/intel/ice/ice_sriov.c
Quoted 29 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: czwartek, 19 stycznia 2023 02:17
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 09/13] ice: introduceice_vf_init_host_cfgfunctionIntroduce a new generic helper
ice_vf_init_host_cfgwhich performs common host configuration initialization tasks that will need to be done for both Single Root IOV and the new Scalable IOV implementation.Signed-off-by Jacob Keller <[email protected]>---
No changes since v1.drivers/net/ethernet/intel/ice/ice_sriov.c | 36 +------------ drivers/net/ethernet/intel/ice/ice_vf_lib.c | 54 +++++++++++++++++++ .../ethernet/intel/ice/ice_vf_lib_private.h | 1 + 3 files changed, 57 insertions(+), 34 deletions(-)drivers/net/ethernet/intel/ice/ice_sriov.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 10/13 ice: convert vf_ops .vsi_rebuild to .create_vsi
In reply to Jacob KellerThe .vsi_rebuild function exists for ice_reset_vf. It is used to release and re-create the VSI during a single-VF reset.
This function is only called when we need to re-create the VSI, and not when rebuilding an existing VSI. This makes the single-VF reset process different from the process used to restore functionality after a hardware reset such as the PF reset or EMP reset.
When we add support for Scalable IOV VFs, the implementation will be very similar. The primary difference will be in the fact that each VF type uses a different underlying VSI type in hardware.
Move the common functionality into a new ice_vf_recreate VSI function. This will allow the two IOV paths to share this functionality. Rework the .vsi_rebuild vf_op into .create_vsi, only performing the task of creating a new VSI.
This creates a nice dichotomy between the ice_vf_rebuild_vsi and ice_vf_recreate_vsi, and should make it more clear why the two flows atre distinct.
---
No changes since v1.
drivers/net/ethernet/intel/ice/ice_sriov.c | 22 ++++++--------- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 31 ++++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +- 3 files changed, 40 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/ice/ice_sriov.c +9 -13
@@ -757,23 +757,19 @@ static void ice_sriov_clear_reset_trigger(struct ice_vf *vf) }/** -* ice_sriov_vsi_rebuild - release and rebuild VF's VSI -* @vf: VF to release and setup the VSI for +* ice_sriov_create_vsi - Create a new VSI for a VF +* @vf: VF to create the VSI for * -* This is only called when a single VF is being reset (i.e. VFR, VFLR, host VF -* configuration change, etc.). +* This is called by ice_vf_recreate_vsi to create the new VSI after the old +* VSI has been released. */ -static int ice_sriov_vsi_rebuild (struct ice_vf *vf) +static int ice_sriov_create_vsi (struct ice_vf *vf) { -struct ice_pf *pf = vf->pf; +struct ice_vsi *vsi; -ice_vf_vsi_release (vf); -if (!ice_vf_vsi_setup (vf)) { -dev_err (ice_pf_to_dev (pf), -"Failed to release and setup the VF%u's VSI\n" , - vf->vf_id); + vsi =ice_vf_vsi_setup (vf); +if (!vsi)return -ENOMEM ; - }return 0 ; }
@@ -795,7 +791,7 @@ static const struct ice_vf_ops ice_sriov_vf_ops = { .trigger_reset_register = ice_sriov_trigger_reset_register, .poll_reset_status = ice_sriov_poll_reset_status, .clear_reset_trigger = ice_sriov_clear_reset_trigger, - .vsi_rebuild = ice_sriov_vsi_rebuild, + .create_vsi = ice_sriov_create_vsi, .post_vsi_rebuild = ice_sriov_post_vsi_rebuild, };
drivers/net/ethernet/intel/ice/ice_vf_lib.c +30 -1
@@ -241,12 +241,41 @@ static void ice_vf_pre_vsi_rebuild(struct ice_vf *vf) vf->vf_ops->clear_reset_trigger (vf); } +/** +* ice_vf_recreate_vsi - Release and re-create the VF's VSI +* @vf: VF to recreate the VSI for +* +* This is only called when a single VF is being reset (i.e. VVF, VFLR, host +* VF configuration change, etc) +* +* It releases and then re-creates a new VSI. +*/ +static int ice_vf_recreate_vsi (struct ice_vf *vf) +{ +struct ice_pf *pf = vf->pf; +int err; + +ice_vf_vsi_release (vf); + + err = vf->vf_ops->create_vsi (vf); +if (err) { +dev_err (ice_pf_to_dev (pf), +"Failed to recreate the VF%u's VSI, error %d\n" , + vf->vf_id, err); +return err; + } + +return 0 ; +} +/** * ice_vf_rebuild_vsi - rebuild the VF's VSI * @vf: VF to rebuild the VSI for * * This is only called when all VF(s) are being reset (i.e. PCIe Reset on the * host, PFR, CORER, etc.). +* +* It reprograms the VSI configuration back into hardware. */ static int ice_vf_rebuild_vsi (struct ice_vf *vf) {
@@ -654,7 +683,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)ice_vf_pre_vsi_rebuild (vf); -if (vf->vf_ops->vsi_rebuild (vf)) { +if (ice_vf_recreate_vsi (vf)) {dev_err (dev,"Failed to release and setup the VF%u's VSI\n" , vf->vf_id); err = -EFAULT ;
drivers/net/ethernet/intel/ice/ice_vf_lib.h +1 -1
@@ -60,7 +60,7 @@ struct ice_vf_ops {void (*trigger_reset_register)(struct ice_vf *vf,bool is_vflr);bool (*poll_reset_status)(struct ice_vf *vf);void (*clear_reset_trigger)(struct ice_vf *vf); -int (*vsi_rebuild)(struct ice_vf *vf); +int (*create_vsi)(struct ice_vf *vf);void (*post_vsi_rebuild)(struct ice_vf *vf); };
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 11/13 ice: introduce clear_reset_state operation
In reply to Jacob KellerWhen hardware is reset, the VF relies on the VFGEN_RSTAT register to detect when the VF is finished resetting. This is a tri-state register where 0 indicates a reset is in progress, 1 indicates the hardware is done resetting, and 2 indicates that the software is done resetting.
Currently the PF driver relies on the device hardware resetting VFGEN_RSTAT when a global reset occurs. This works ok, but it does mean that the VF might not immediately notice a reset when the driver first detects that the global reset is occurring.
This is also problematic for Scalable IOV, because there is no read/write equivalent VFGEN_RSTAT register for the Scalable VSI type. Instead, the Scalable IOV VFs will need to emulate this register.
To support this, introduce a new VF operation, clear_reset_state, which is called when the PF driver first detects a global reset. The Single Root IOV implementation can just write to VFGEN_RSTAT to ensure its cleared immediately, without waiting for the actual hardware reset to begin. The Scalable IOV implementation will use this as part of its tracking of the reset status to allow properly reporting the emulated VFGEN_RSTAT to the VF driver.
---
Changes since v1:
* Add no-op version of ice_set_vf_state_dis for when CONFIG_PCI_IOV is disabled.
* Make ice_set_state_qs_dis static since there are no callers outsice ice_vf_lib.c
drivers/net/ethernet/intel/ice/ice_main.c | 2 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 16 ++++++++++++++++ drivers/net/ethernet/intel/ice/ice_vf_lib.c | 12 +++++++++++- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 5 +++-- 4 files changed, 31 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
@@ -537,7 +537,7 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)/* Disable VFs until reset is completed */ mutex_lock (&pf->vfs.table_lock);ice_for_each_vf (pf, bkt, vf) -ice_set_vf_state_qs_dis (vf); +ice_set_vf_state_dis (vf);mutex_unlock (&pf->vfs.table_lock);if (ice_is_eswitch_mode_switchdev (pf)) {
drivers/net/ethernet/intel/ice/ice_sriov.c +16 -0
@@ -654,6 +654,21 @@ static void ice_sriov_free_vf(struct ice_vf *vf)kfree_rcu (vf, rcu); } +/** +* ice_sriov_clear_reset_state - clears VF Reset status register +* @vf: the vf to configure +*/ +static void ice_sriov_clear_reset_state (struct ice_vf *vf) +{ +struct ice_hw *hw = &vf->pf->hw; + +/* Clear the reset status register so that VF immediately sees that +* the device is resetting, even if hardware hasn't yet gotten around +* to clearing VFGEN_RSTAT for us. +*/ +wr32 (hw,VFGEN_RSTAT (vf->vf_id),VIRTCHNL_VFR_INPROGRESS ); +} +/** * ice_sriov_clear_mbx_register - clears SRIOV VF's mailbox registers * @vf: the vf to configure
@@ -787,6 +802,7 @@ static void ice_sriov_post_vsi_rebuild(struct ice_vf *vf)static const struct ice_vf_ops ice_sriov_vf_ops = { .reset_type =ICE_VF_RESET , .free = ice_sriov_free_vf, + .clear_reset_state = ice_sriov_clear_reset_state, .clear_mbx_register = ice_sriov_clear_mbx_register, .trigger_reset_register = ice_sriov_trigger_reset_register, .poll_reset_status = ice_sriov_poll_reset_status,
drivers/net/ethernet/intel/ice/ice_vf_lib.c +11 -1
@@ -717,7 +717,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)* ice_set_vf_state_qs_dis - Set VF queues state to disabled * @vf: pointer to the VF structure */ -void ice_set_vf_state_qs_dis (struct ice_vf *vf) +static void ice_set_vf_state_qs_dis (struct ice_vf *vf) {/* Clear Rx/Tx enabled queues flag */ bitmap_zero (vf->txq_ena,ICE_MAX_RSS_QS_PER_VF );
@@ -725,6 +725,16 @@ void ice_set_vf_state_qs_dis(struct ice_vf *vf)clear_bit (ICE_VF_STATE_QS_ENA , vf->vf_states); } +/** +* ice_set_vf_state_dis - Set VF state to disabled +* @vf: pointer to the VF structure +*/ +void ice_set_vf_state_dis (struct ice_vf *vf) +{ +ice_set_vf_state_qs_dis (vf); + vf->vf_ops->clear_reset_state (vf); +} +/* Private functions only accessed from other virtualization files */ /**
drivers/net/ethernet/intel/ice/ice_vf_lib.h +3 -2
@@ -56,6 +56,7 @@ struct ice_mdd_vf_events {struct ice_vf_ops {enum ice_disq_rst_src reset_type;void (*free)(struct ice_vf *vf); +void (*clear_reset_state)(struct ice_vf *vf);void (*clear_mbx_register)(struct ice_vf *vf);void (*trigger_reset_register)(struct ice_vf *vf,bool is_vflr);bool (*poll_reset_status)(struct ice_vf *vf);
@@ -213,7 +214,7 @@ u16 ice_get_num_vfs(struct ice_pf *pf);struct ice_vsi *ice_get_vf_vsi (struct ice_vf *vf);bool ice_is_vf_disabled (struct ice_vf *vf);int ice_check_vf_ready_for_cfg (struct ice_vf *vf); -void ice_set_vf_state_qs_dis (struct ice_vf *vf); +void ice_set_vf_state_dis (struct ice_vf *vf);bool ice_is_any_vf_in_unicast_promisc (struct ice_pf *pf); void ice_vf_get_promisc_masks(struct ice_vf *vf, struct ice_vsi *vsi,
@@ -259,7 +260,7 @@ static inline int ice_check_vf_ready_for_cfg(struct ice_vf *vf)return -EOPNOTSUPP ; } -static inline void ice_set_vf_state_qs_dis (struct ice_vf *vf) +static inline void ice_set_vf_state_dis (struct ice_vf *vf) { }
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 11/13] ice: introduce clear_reset_state operation
Dear Jacob,
Thank you for your patch.
Am 19.01.23 um 02:16 schrieb Jacob Keller:
Quoted 10 lines
When hardware is reset, the VF relies on the
VFGEN_RSTATregister to detect when the VF is finished resetting. This is a tri-state register where 0 indicates a reset is in progress, 1 indicates the hardware is done resetting, and 2 indicates that the software is done resetting.Currently the PF driver relies on the device hardware resetting
VFGEN_RSTATwhen a global reset occurs. This works ok, but it does mean that the VF might not immediately notice a reset when the driver first detects that the global reset is occurring.
Quoted 7 lines
This is also problematic for Scalable IOV, because there is no read/write equivalent
VFGEN_RSTATregister for the Scalable VSI type. Instead, the Scalable IOV VFs will need to emulate this register.To support this, introduce a new VF operation,
clear_reset_state, which is called when the PF driver first detects a global reset. The Single Root IOV implementation can just write toVFGEN_RSTATto ensure its cleared
it’s
Quoted 4 lines
immediately, without waiting for the actual hardware reset to begin. The Scalable IOV implementation will use this as part of its tracking of the reset status to allow properly reporting the emulated
VFGEN_RSTATto the VF driver.
Can this be tested somehow? If yes, it’d be great if you added the recipe.
Quoted 6 lines
Signed-off-by Jacob Keller <[email protected]>---
Changes since v1:
* Add no-op version ofice_set_vf_state_disfor whenCONFIG_PCI_IOVis disabled.
* Makeice_set_state_qs_disstatic since there are no callers outsice
outside
Quoted 107 lines
ice_vf_lib.cdrivers/net/ethernet/intel/ice/ice_main.c | 2 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 16 ++++++++++++++++ drivers/net/ethernet/intel/ice/ice_vf_lib.c | 12 +++++++++++- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 5 +++-- 4 files changed, 31 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +1
-1@@ -537,7 +537,7 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)/* Disable VFs until reset is completed */ mutex_lock (&pf->vfs.table_lock);ice_for_each_vf (pf, bkt, vf) -ice_set_vf_state_qs_dis (vf); +ice_set_vf_state_dis (vf);mutex_unlock (&pf->vfs.table_lock);if (ice_is_eswitch_mode_switchdev (pf)) {drivers/net/ethernet/intel/ice/ice_sriov.c +16
-0@@ -654,6 +654,21 @@ static void ice_sriov_free_vf(struct ice_vf *vf)kfree_rcu (vf, rcu); } +/** +* ice_sriov_clear_reset_state - clears VF Reset status register +* @vf: the vf to configure +*/ +static void ice_sriov_clear_reset_state (struct ice_vf *vf) +{ +struct ice_hw *hw = &vf->pf->hw; + +/* Clear the reset status register so that VF immediately sees that +* the device is resetting, even if hardware hasn't yet gotten around +* to clearing VFGEN_RSTAT for us. +*/ +wr32 (hw,VFGEN_RSTAT (vf->vf_id),VIRTCHNL_VFR_INPROGRESS ); +} +/** * ice_sriov_clear_mbx_register - clears SRIOV VF's mailbox registers * @vf: the vf to configure @@ -787,6 +802,7 @@ static void ice_sriov_post_vsi_rebuild(struct ice_vf *vf)static const struct ice_vf_ops ice_sriov_vf_ops = { .reset_type =ICE_VF_RESET , .free = ice_sriov_free_vf, + .clear_reset_state = ice_sriov_clear_reset_state, .clear_mbx_register = ice_sriov_clear_mbx_register, .trigger_reset_register = ice_sriov_trigger_reset_register, .poll_reset_status = ice_sriov_poll_reset_status,drivers/net/ethernet/intel/ice/ice_vf_lib.c +11
-1@@ -717,7 +717,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)* ice_set_vf_state_qs_dis - Set VF queues state to disabled * @vf: pointer to the VF structure */ -void ice_set_vf_state_qs_dis (struct ice_vf *vf) +static void ice_set_vf_state_qs_dis (struct ice_vf *vf) {/* Clear Rx/Tx enabled queues flag */ bitmap_zero (vf->txq_ena,ICE_MAX_RSS_QS_PER_VF );@@ -725,6 +725,16 @@ void ice_set_vf_state_qs_dis(struct ice_vf *vf)clear_bit (ICE_VF_STATE_QS_ENA , vf->vf_states); } +/** +* ice_set_vf_state_dis - Set VF state to disabled +* @vf: pointer to the VF structure +*/ +void ice_set_vf_state_dis (struct ice_vf *vf) +{ +ice_set_vf_state_qs_dis (vf); + vf->vf_ops->clear_reset_state (vf); +} +/* Private functions only accessed from other virtualization files */ /** drivers/net/ethernet/intel/ice/ice_vf_lib.h +2
-1@@ -56,6 +56,7 @@ struct ice_mdd_vf_events {struct ice_vf_ops {enum ice_disq_rst_src reset_type;void (*free)(struct ice_vf *vf); +void (*clear_reset_state)(struct ice_vf *vf);void (*clear_mbx_register)(struct ice_vf *vf);void (*trigger_reset_register)(struct ice_vf *vf,bool is_vflr);bool (*poll_reset_status)(struct ice_vf *vf);@@ -213,7 +214,7 @@ u16 ice_get_num_vfs(struct ice_pf *pf);struct ice_vsi *ice_get_vf_vsi (struct ice_vf *vf);bool ice_is_vf_disabled (struct ice_vf *vf);int ice_check_vf_ready_for_cfg (struct ice_vf *vf); -void ice_set_vf_state_qs_dis (struct ice_vf *vf); +void ice_set_vf_state_dis (struct ice_vf *vf);bool ice_is_any_vf_in_unicast_promisc (struct ice_pf *pf); void ice_vf_get_promisc_masks(struct ice_vf *vf, struct ice_vsi *vsi,
drivers/net/ethernet/intel/ice/ice_vf_lib.h static inline int ice_check_vf_ready_for_cfg(struct ice_vf *vf) · line 265
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_vf_lib.h +1
-1@@ -259,7 +260,7 @@ static inline int ice_check_vf_ready_for_cfg(struct ice_vf *vf)return -EOPNOTSUPP ; } -static inline void ice_set_vf_state_qs_dis (struct ice_vf *vf) +static inline void ice_set_vf_state_dis (struct ice_vf *vf) { }
Kind regards,
Paul
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 11/13] ice: introduce clear_reset_state operation
Quoted 24 lines · Paul Menzel
Dear Jacob,
Thank you for your patch.
Am 19.01.23 um 02:16 schrieb Jacob Keller:
Quoted 10 lines
When hardware is reset, the VF relies on the
VFGEN_RSTATregister to detect when the VF is finished resetting. This is a tri-state register where 0 indicates a reset is in progress, 1 indicates the hardware is done resetting, and 2 indicates that the software is done resetting.Currently the PF driver relies on the device hardware resetting
VFGEN_RSTATwhen a global reset occurs. This works ok, but it does mean that the VF might not immediately notice a reset when the driver first detects that the global reset is occurring.Quoted 7 lines
This is also problematic for Scalable IOV, because there is no read/write equivalent
VFGEN_RSTATregister for the Scalable VSI type. Instead, the Scalable IOV VFs will need to emulate this register.To support this, introduce a new VF operation,
clear_reset_state, which is called when the PF driver first detects a global reset. The Single Root IOV implementation can just write toVFGEN_RSTATto ensure its cleared
Quoted 9 lines
it’s
Quoted 4 lines
immediately, without waiting for the actual hardware reset to begin. The Scalable IOV implementation will use this as part of its tracking of the reset status to allow properly reporting the emulated
VFGEN_RSTATto the VF driver.Can this be tested somehow? If yes, it’d be great if you added the recipe.
The operation can be tested by triggering a device reset while having VFs. But note that the ice driver does not yet support Scalable IOV. We are working on this but are not yet ready to submit a series implementing the support. Some of this series are patches intended to aid in implementing Scalable IOV, and I am sending them now in order to reduce the size and scope of the series that will actually finish the implementation.
In general the reset behavior can be tested by adding a Single Root IOV VF (via sriov_numvfs), and then triggering a reset. This can be done in a variety of ways including by configuring some of the netlink VF parameters like the trust setting, or by any operation on the PF that triggers a PF reset. (Unfortunately I do not recall a specific example offhand).
Thanks,
Jake
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 11/13] ice: introduce clear_reset_state operation
In reply to Jacob Kellerdrivers/net/ethernet/intel/ice/ice_sriov.c
Quoted 67 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: czwartek, 19 stycznia 2023 02:17
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 11/13] ice: introduceclear_reset_stateoperationWhen hardware is reset, the VF relies on the
VFGEN_RSTATregister to detect when the VF is finished resetting. This is a tri-state register where 0 indicates a reset is in progress, 1 indicates the hardware is done resetting, and 2 indicates that the software is done resetting.Currently the PF driver relies on the device hardware resetting
VFGEN_RSTATwhen a global reset occurs. This works ok, but it does mean that the VF might not immediately notice a reset when the driver first detects that the global reset is occurring.This is also problematic for Scalable IOV, because there is no read/write equivalent
VFGEN_RSTATregister for the Scalable VSI type. Instead, the Scalable IOV VFs will need to emulate this register.To support this, introduce a new VF operation,
clear_reset_state, which is called when the PF driver first detects a global reset. The Single Root IOV implementation can just write toVFGEN_RSTATto ensure its cleared immediately, without waiting for the actual hardware reset to begin. The Scalable IOV implementation will use this as part of its tracking of the reset status to allow properly reporting the emulatedVFGEN_RSTATto the VF driver.Signed-off-by Jacob Keller <[email protected]>---
Changes since v1:
* Add no-op version ofice_set_vf_state_disfor whenCONFIG_PCI_IOVis disabled.
* Makeice_set_state_qs_disstatic since there are no callers outsiceice_vf_lib.cdrivers/net/ethernet/intel/ice/ice_main.c | 2 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 16 ++++++++++++++++ drivers/net/ethernet/intel/ice/ice_vf_lib.c | 12 +++++++++++- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 5 +++-- 4 files changed, 31 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +1
-1@@ -537,7 +537,7 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type) /* Disable VFs until reset is completed */ mutex_lock(&pf->vfs.table_lock);ice_for_each_vf (pf, bkt, vf) -ice_set_vf_state_qs_dis (vf); +ice_set_vf_state_dis (vf);mutex_unlock (&pf->vfs.table_lock);if (
ice_is_eswitch_mode_switchdev(pf)) { diff --gita/drivers/net/ethernet/intel/ice/ice_sriov.cb/drivers/net/ethernet/intel/ice/ice_sriov.c
index46088c05d485..4d8930b83b35100644drivers/net/ethernet/intel/ice/ice_sriov.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 12/13 ice: introduce .irq_close VF operation
In reply to Jacob KellerThe Scalable IOV implementation will require notifying the VDCM driver when an IRQ must be closed. This allows the VDCM to handle releasing stale IRQ context values and properly reconfigure.
To handle this, introduce a new optional .irq_close callback to the VF operations structure. This will be implemented by Scalable IOV to handle the shutdown of the IRQ context.
Since the SR-IOV implementation does not need this, we must check that its non-NULL before calling it.
---
No changes since v1.
drivers/net/ethernet/intel/ice/ice_sriov.c | 1 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 4 ++++ drivers/net/ethernet/intel/ice/ice_vf_lib.h | 1 + 3 files changed, 6 insertions(+)
drivers/net/ethernet/intel/ice/ice_sriov.c +1 -0
@@ -807,6 +807,7 @@ static const struct ice_vf_ops ice_sriov_vf_ops = { .trigger_reset_register = ice_sriov_trigger_reset_register, .poll_reset_status = ice_sriov_poll_reset_status, .clear_reset_trigger = ice_sriov_clear_reset_trigger, + .irq_close = NULL, .create_vsi = ice_sriov_create_vsi, .post_vsi_rebuild = ice_sriov_post_vsi_rebuild, };
drivers/net/ethernet/intel/ice/ice_vf_lib.c +4 -0
@@ -237,6 +237,10 @@ static void ice_vf_clear_counters(struct ice_vf *vf)*/ static void ice_vf_pre_vsi_rebuild (struct ice_vf *vf) { +/* Close any IRQ mapping now */ +if (vf->vf_ops->irq_close) + vf->vf_ops->irq_close (vf); +ice_vf_clear_counters (vf); vf->vf_ops->clear_reset_trigger (vf); }
drivers/net/ethernet/intel/ice/ice_vf_lib.h +1 -0
@@ -61,6 +61,7 @@ struct ice_vf_ops {void (*trigger_reset_register)(struct ice_vf *vf,bool is_vflr);bool (*poll_reset_status)(struct ice_vf *vf);void (*clear_reset_trigger)(struct ice_vf *vf); +void (*irq_close)(struct ice_vf *vf);int (*create_vsi)(struct ice_vf *vf);void (*post_vsi_rebuild)(struct ice_vf *vf); };
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 12/13] ice: introduce .irq_close VF operation
drivers/net/ethernet/intel/ice/ice_vf_lib.c
Quoted 48 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: czwartek, 19 stycznia 2023 02:17
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 12/13] ice: introduce .irq_close VF operationThe Scalable IOV implementation will require notifying the VDCM driver when an IRQ must be closed. This allows the VDCM to handle releasing stale IRQ context values and properly reconfigure.
To handle this, introduce a new optional .irq_close callback to the VF operations structure. This will be implemented by Scalable IOV to handle the shutdown of the IRQ context.
Since the SR-IOV implementation does not need this, we must check that its non-NULL before calling it.
Signed-off-by Jacob Keller <[email protected]>---
No changes since v1.drivers/net/ethernet/intel/ice/ice_sriov.c | 1 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 4 ++++ drivers/net/ethernet/intel/ice/ice_vf_lib.h | 1 + 3 files changed, 6 insertions(+)drivers/net/ethernet/intel/ice/ice_sriov.c +1
-0@@ -807,6 +807,7 @@ static const struct ice_vf_ops ice_sriov_vf_ops = { .trigger_reset_register = ice_sriov_trigger_reset_register, .poll_reset_status = ice_sriov_poll_reset_status, .clear_reset_trigger = ice_sriov_clear_reset_trigger, + .irq_close = NULL, .create_vsi = ice_sriov_create_vsi, .post_vsi_rebuild = ice_sriov_post_vsi_rebuild, }; diff --git
a/drivers/net/ethernet/intel/ice/ice_vf_lib.cb/drivers/net/ethernet/intel/ice/ice_vf_lib.c
index2ea801ebb2ac..d16c2ea83873100644drivers/net/ethernet/intel/ice/ice_vf_lib.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 13/13 ice: remove unnecessary virtchnl_ether_addr struct use
In reply to Jacob KellerThe dev_lan_addr and hw_lan_addr members of ice_vf are used only to store the MAC address for the VF. They are defined using virtchnl_ether_addr, but only the .addr sub-member is actually used. Drop the use of virtchnl_ether_addr and just use a u8 array of length [ETH_ALEN].
---
No changes since v1.
drivers/net/ethernet/intel/ice/ice_eswitch.c | 18 +++++++------- drivers/net/ethernet/intel/ice/ice_sriov.c | 16 ++++++------- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 8 +++---- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 24 +++++++++---------- 5 files changed, 35 insertions(+), 35 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +9 -9
@@ -71,17 +71,17 @@ void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf)if (!ice_is_switchdev_running (vf->pf))return ; -if (is_valid_ether_addr (vf->hw_lan_addr.addr)) { +if (is_valid_ether_addr (vf->hw_lan_addr)) { err =ice_eswitch_add_vf_mac_rule (vf->pf, vf, - vf->hw_lan_addr.addr); + vf->hw_lan_addr);if (err) {dev_err (ice_pf_to_dev (vf->pf),"Failed to add MAC %pM for VF %d\n, error %d\n" , - vf->hw_lan_addr.addr, vf->vf_id, err); + vf->hw_lan_addr, vf->vf_id, err);return ; } vf->num_mac++; -ether_addr_copy (vf->dev_lan_addr.addr, vf->hw_lan_addr.addr); +ether_addr_copy (vf->dev_lan_addr, vf->hw_lan_addr); } }
@@ -237,7 +237,7 @@ ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi)ice_vsi_update_security (vsi, ice_vsi_ctx_set_antispoof);metadata_dst_free (vf->repr->dst); vf->repr->dst =NULL ; -ice_fltr_add_mac_and_broadcast (vsi, vf->hw_lan_addr.addr, +ice_fltr_add_mac_and_broadcast (vsi, vf->hw_lan_addr,ICE_FWD_TO_VSI );netif_napi_del (&vf->repr->q_vector->napi);
@@ -265,14 +265,14 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf) GFP_KERNEL);if (!vf->repr->dst) {ice_fltr_add_mac_and_broadcast (vsi, - vf->hw_lan_addr.addr, + vf->hw_lan_addr,ICE_FWD_TO_VSI ); goto err; }if (ice_vsi_update_security (vsi, ice_vsi_ctx_clear_antispoof)) {ice_fltr_add_mac_and_broadcast (vsi, - vf->hw_lan_addr.addr, + vf->hw_lan_addr,ICE_FWD_TO_VSI );metadata_dst_free (vf->repr->dst); vf->repr->dst =NULL ;
@@ -281,7 +281,7 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf)if (ice_vsi_add_vlan_zero (vsi)) {ice_fltr_add_mac_and_broadcast (vsi, - vf->hw_lan_addr.addr, + vf->hw_lan_addr,ICE_FWD_TO_VSI );metadata_dst_free (vf->repr->dst); vf->repr->dst =NULL ;
@@ -338,7 +338,7 @@ void ice_eswitch_update_repr(struct ice_vsi *vsi) ret =ice_vsi_update_security (vsi, ice_vsi_ctx_clear_antispoof);if (ret) { -ice_fltr_add_mac_and_broadcast (vsi, vf->hw_lan_addr.addr,ICE_FWD_TO_VSI ); +ice_fltr_add_mac_and_broadcast (vsi, vf->hw_lan_addr,ICE_FWD_TO_VSI );dev_err (ice_pf_to_dev (pf),"Failed to update VF %d port representor" , vsi->vf->vf_id); }
drivers/net/ethernet/intel/ice/ice_sriov.c +8 -8
@@ -1242,7 +1242,7 @@ ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi) goto out_put_vf; ivi->vf = vf_id; -ether_addr_copy (ivi->mac, vf->hw_lan_addr.addr); +ether_addr_copy (ivi->mac, vf->hw_lan_addr);/* VF configuration for VLAN and applicable QoS */ ivi->vlan =ice_vf_get_port_vlan_id (vf);
@@ -1290,8 +1290,8 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)return -EINVAL ;/* nothing left to do, unicast MAC already set */ -if (ether_addr_equal (vf->dev_lan_addr.addr, mac) && -ether_addr_equal (vf->hw_lan_addr.addr, mac)) { +if (ether_addr_equal (vf->dev_lan_addr, mac) && +ether_addr_equal (vf->hw_lan_addr, mac)) { ret =0 ; goto out_put_vf; }
@@ -1305,8 +1305,8 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)/* VF is notified of its new MAC via the PF's response to the * VIRTCHNL_OP_GET_VF_RESOURCES message after the VF has been reset */ -ether_addr_copy (vf->dev_lan_addr.addr, mac); -ether_addr_copy (vf->hw_lan_addr.addr, mac); +ether_addr_copy (vf->dev_lan_addr, mac); +ether_addr_copy (vf->hw_lan_addr, mac);if (is_zero_ether_addr (mac)) {/* VF will send VIRTCHNL_OP_ADD_ETH_ADDR message with its MAC */ vf->pf_set_mac = false;
@@ -1707,7 +1707,7 @@ void ice_print_vf_rx_mdd_event(struct ice_vf *vf)dev_info (dev,"%d Rx Malicious Driver Detection events detected on PF %d VF %d MAC %pM. mdd-auto-reset-vfs=%s\n" , vf->mdd_rx_events.count, pf->hw.pf_id, vf->vf_id, - vf->dev_lan_addr.addr, + vf->dev_lan_addr,test_bit (ICE_FLAG_MDD_AUTO_RESET_VF , pf->flags) ?"on" :"off" ); }
@@ -1751,7 +1751,7 @@ void ice_print_vfs_mdd_events(struct ice_pf *pf)dev_info (dev,"%d Tx Malicious Driver Detection events detected on PF %d VF %d MAC %pM.\n" , vf->mdd_tx_events.count, hw->pf_id, vf->vf_id, - vf->dev_lan_addr.addr); + vf->dev_lan_addr); } }mutex_unlock (&pf->vfs.table_lock);
@@ -1841,7 +1841,7 @@ ice_is_malicious_vf(struct ice_pf *pf, struct ice_rq_event_info *event,if (pf_vsi)dev_warn (dev,"VF MAC %pM on PF MAC %pM is generating asynchronous messages and may be overflowing the PF message queue. Please see the Adapter User Guide for more information\n" , - &vf->dev_lan_addr.addr[0 ], + &vf->dev_lan_addr[0 ], pf_vsi->netdev->dev_addr); } }
drivers/net/ethernet/intel/ice/ice_vf_lib.c +4 -4
@@ -1008,18 +1008,18 @@ static int ice_vf_rebuild_host_mac_cfg(struct ice_vf *vf) vf->num_mac++; -if (is_valid_ether_addr (vf->hw_lan_addr.addr)) { - status =ice_fltr_add_mac (vsi, vf->hw_lan_addr.addr, +if (is_valid_ether_addr (vf->hw_lan_addr)) { + status =ice_fltr_add_mac (vsi, vf->hw_lan_addr,ICE_FWD_TO_VSI );if (status) {dev_err (dev,"failed to add default unicast MAC filter %pM for VF %u, error %d\n" , - &vf->hw_lan_addr.addr[0 ], vf->vf_id, + &vf->hw_lan_addr[0 ], vf->vf_id, status);return status; } vf->num_mac++; -ether_addr_copy (vf->dev_lan_addr.addr, vf->hw_lan_addr.addr); +ether_addr_copy (vf->dev_lan_addr, vf->hw_lan_addr); }return 0 ;
drivers/net/ethernet/intel/ice/ice_vf_lib.h +2 -2
@@ -98,8 +98,8 @@ struct ice_vf {struct ice_sw *vf_sw_id;/* switch ID the VF VSIs connect to */ struct virtchnl_version_info vf_ver;u32 driver_caps;/* reported by VF driver */ -struct virtchnl_ether_addr dev_lan_addr; -struct virtchnl_ether_addr hw_lan_addr; +u8 dev_lan_addr[ETH_ALEN ]; +u8 hw_lan_addr[ETH_ALEN ];struct ice_time_mac legacy_last_added_umac;DECLARE_BITMAP (txq_ena,ICE_MAX_RSS_QS_PER_VF );DECLARE_BITMAP (rxq_ena,ICE_MAX_RSS_QS_PER_VF );
drivers/net/ethernet/intel/ice/ice_virtchnl.c +12 -12
@@ -507,7 +507,7 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg) vfres->vsi_res[0 ].vsi_type =VIRTCHNL_VSI_SRIOV ; vfres->vsi_res[0 ].num_queue_pairs = vsi->num_txq;ether_addr_copy (vfres->vsi_res[0 ].default_mac_addr, - vf->hw_lan_addr.addr); + vf->hw_lan_addr);/* match guest capabilities */ vf->driver_caps = vfres->vf_cap_flags;
@@ -1802,10 +1802,10 @@ ice_vfhw_mac_add(struct ice_vf *vf, struct virtchnl_ether_addr *vc_ether_addr)* was correctly specified over VIRTCHNL */ if ((ice_is_vc_addr_legacy (vc_ether_addr) && -is_zero_ether_addr (vf->hw_lan_addr.addr)) || +is_zero_ether_addr (vf->hw_lan_addr)) ||ice_is_vc_addr_primary (vc_ether_addr)) { -ether_addr_copy (vf->dev_lan_addr.addr, mac_addr); -ether_addr_copy (vf->hw_lan_addr.addr, mac_addr); +ether_addr_copy (vf->dev_lan_addr, mac_addr); +ether_addr_copy (vf->hw_lan_addr, mac_addr); }/* hardware and device MACs are already set, but its possible that the
@@ -1836,7 +1836,7 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,int ret;/* device MAC already added */ -if (ether_addr_equal (mac_addr, vf->dev_lan_addr.addr)) +if (ether_addr_equal (mac_addr, vf->dev_lan_addr))return 0 ;if (is_unicast_ether_addr (mac_addr) && !ice_can_vf_change_mac (vf)) {
@@ -1891,8 +1891,8 @@ ice_update_legacy_cached_mac(struct ice_vf *vf, ice_is_legacy_umac_expired(&vf->legacy_last_added_umac)) return; -ether_addr_copy (vf->dev_lan_addr.addr, vf->legacy_last_added_umac.addr); -ether_addr_copy (vf->hw_lan_addr.addr, vf->legacy_last_added_umac.addr); +ether_addr_copy (vf->dev_lan_addr, vf->legacy_last_added_umac.addr); +ether_addr_copy (vf->hw_lan_addr, vf->legacy_last_added_umac.addr); }/**
@@ -1906,15 +1906,15 @@ ice_vfhw_mac_del(struct ice_vf *vf, struct virtchnl_ether_addr *vc_ether_addr)u8 *mac_addr = vc_ether_addr->addr;if (!is_valid_ether_addr (mac_addr) || - !ether_addr_equal (vf->dev_lan_addr.addr, mac_addr)) + !ether_addr_equal (vf->dev_lan_addr, mac_addr))return ;/* allow the device MAC to be repopulated in the add flow and don't -* clear the hardware MAC (i.e. hw_lan_addr.addr) here as that is meant +* clear the hardware MAC (i.e. hw_lan_addr) here as that is meant * to be persistent on VM reboot and across driver unload/load, which * won't work if we clear the hardware MAC here */ -eth_zero_addr (vf->dev_lan_addr.addr); +eth_zero_addr (vf->dev_lan_addr);ice_update_legacy_cached_mac (vf, vc_ether_addr); }
@@ -1934,7 +1934,7 @@ ice_vc_del_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,int status;if (!ice_can_vf_change_mac (vf) && -ether_addr_equal (vf->dev_lan_addr.addr, mac_addr)) +ether_addr_equal (vf->dev_lan_addr, mac_addr))return 0 ; status =ice_fltr_remove_mac (vsi, mac_addr,ICE_FWD_TO_VSI );
@@ -3733,7 +3733,7 @@ static int ice_vc_repr_add_mac(struct ice_vf *vf, u8 *msg)int result;if (!is_unicast_ether_addr (mac_addr) || -ether_addr_equal (mac_addr, vf->hw_lan_addr.addr)) +ether_addr_equal (mac_addr, vf->hw_lan_addr))continue ;if (vf->pf_set_mac) {
Signature · 6 lines
2.39.1.405.gd4c25cc71f83 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 13/13] ice: remove unnecessary virtchnl_ether_addr struct use
drivers/net/ethernet/intel/ice/ice_eswitch.c
Quoted 32 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: czwartek, 19 stycznia 2023 02:17
To: Intel Wired LAN <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 13/13] ice: remove unnecessaryvirtchnl_ether_addrstruct useThe
dev_lan_addrandhw_lan_addrmembers ofice_vfare used only to store the MAC address for the VF. They are defined usingvirtchnl_ether_addr, but only the .addr sub-member is actually used. Drop the use ofvirtchnl_ether_addrand just use a u8 array of length [ETH_ALEN].Signed-off-by Jacob Keller <[email protected]>---
No changes since v1.drivers/net/ethernet/intel/ice/ice_eswitch.c | 18 +++++++------- drivers/net/ethernet/intel/ice/ice_sriov.c | 16 ++++++------- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 8 +++---- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 24 +++++++++---------- 5 files changed, 35 insertions(+), 35 deletions(-)drivers/net/ethernet/intel/ice/ice_eswitch.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan