diff options
| author | Paul Greenwalt <paul.greenwalt@intel.com> | 2024-08-21 00:26:16 +0300 | 
|---|---|---|
| committer | Tony Nguyen <anthony.l.nguyen@intel.com> | 2024-10-09 00:37:15 +0300 | 
| commit | 59f4d59b25aec39a015c0949f4ec235c7a839c44 (patch) | |
| tree | 2509bbbb752050eec414927bdde81b8c51c75e17 /drivers/net/ethernet/intel/ice/ice_vf_lib.c | |
| parent | b699c81af0683ad5b7a7e2b3ef4ae3ff8ee41153 (diff) | |
| download | linux-59f4d59b25aec39a015c0949f4ec235c7a839c44.tar.xz | |
ice: add E830 HW VF mailbox message limit support
E830 adds hardware support to prevent the VF from overflowing the PF
mailbox with VIRTCHNL messages. E830 will use the hardware feature
(ICE_F_MBX_LIMIT) instead of the software solution ice_is_malicious_vf().
To prevent a VF from overflowing the PF, the PF sets the number of
messages per VF that can be in the PF's mailbox queue
(ICE_MBX_OVERFLOW_WATERMARK). When the PF processes a message from a VF,
the PF decrements the per VF message count using the E830_MBX_VF_DEC_TRIG
register.
Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_vf_lib.c')
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_vf_lib.c | 26 | 
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c index a69e91f88d81..d618292dfe27 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -710,6 +710,23 @@ ice_vf_clear_vsi_promisc(struct ice_vf *vf, struct ice_vsi *vsi, u8 promisc_m)  }  /** + * ice_reset_vf_mbx_cnt - reset VF mailbox message count + * @vf: pointer to the VF structure + * + * This function clears the VF mailbox message count, and should be called on + * VF reset. + */ +static void ice_reset_vf_mbx_cnt(struct ice_vf *vf) +{ +	struct ice_pf *pf = vf->pf; + +	if (ice_is_feature_supported(pf, ICE_F_MBX_LIMIT)) +		ice_mbx_vf_clear_cnt_e830(&pf->hw, vf->vf_id); +	else +		ice_mbx_clear_malvf(&vf->mbx_info); +} + +/**   * ice_reset_all_vfs - reset all allocated VFs in one go   * @pf: pointer to the PF structure   * @@ -735,7 +752,7 @@ void ice_reset_all_vfs(struct ice_pf *pf)  	/* clear all malicious info if the VFs are getting reset */  	ice_for_each_vf(pf, bkt, vf) -		ice_mbx_clear_malvf(&vf->mbx_info); +		ice_reset_vf_mbx_cnt(vf);  	/* If VFs have been disabled, there is no need to reset */  	if (test_and_set_bit(ICE_VF_DIS, pf->state)) { @@ -951,7 +968,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)  	ice_eswitch_update_repr(&vf->repr_id, vsi);  	/* if the VF has been reset allow it to come up again */ -	ice_mbx_clear_malvf(&vf->mbx_info); +	ice_reset_vf_mbx_cnt(vf);  out_unlock:  	if (lag && lag->bonded && lag->primary && @@ -1004,7 +1021,10 @@ void ice_initialize_vf_entry(struct ice_vf *vf)  	ice_vf_fdir_init(vf);  	/* Initialize mailbox info for this VF */ -	ice_mbx_init_vf_info(&pf->hw, &vf->mbx_info); +	if (ice_is_feature_supported(pf, ICE_F_MBX_LIMIT)) +		ice_mbx_vf_clear_cnt_e830(&pf->hw, vf->vf_id); +	else +		ice_mbx_init_vf_info(&pf->hw, &vf->mbx_info);  	mutex_init(&vf->cfg_lock);  }  | 
