diff options
| author | Jacob Keller <jacob.e.keller@intel.com> | 2023-02-22 09:09:20 -0800 | 
|---|---|---|
| committer | Tony Nguyen <anthony.l.nguyen@intel.com> | 2023-03-13 11:06:06 -0700 | 
| commit | be96815c616822d3800405b8fbebe3e069d6eed2 (patch) | |
| tree | 9e9e7d1c74966b07d9962b48791ec1cd305d3f2c /drivers/net/ethernet/intel/ice/ice_main.c | |
| parent | c414463ab1bb098e67f4c1a4ef64f3e97780f087 (diff) | |
ice: call ice_is_malicious_vf() from ice_vc_process_vf_msg()
The main loop in __ice_clean_ctrlq first checks if a VF might be malicious
before calling ice_vc_process_vf_msg(). This results in duplicate code in
both functions to obtain a reference to the VF, and exports the
ice_is_malicious_vf() from ice_virtchnl.c unnecessarily.
Refactor ice_is_malicious_vf() to be a static function that takes a pointer
to the VF. Call this in ice_vc_process_vf_msg() just after we obtain a
reference to the VF by calling ice_get_vf_by_id.
Pass the mailbox data from the __ice_clean_ctrlq function into
ice_vc_process_vf_msg() instead of calling ice_is_malicious_vf().
This reduces the number of exported functions and avoids the need to obtain
the VF reference twice for every mailbox message.
Note that the state check for ICE_VF_STATE_DIS is kept in
ice_is_malicious_vf() and we call this before checking that state in
ice_vc_process_vf_msg. This is intentional, as we stop responding to VF
messages from a VF once we detect that it may be overflowing the mailbox.
This ensures that we continue to silently ignore the message as before
without responding via ice_vc_send_msg_to_vf().
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Marek Szlosek <marek.szlosek@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_main.c')
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 3 | 
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index a7e7a186009e..20b3f3e6eda1 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -1517,8 +1517,7 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)  			data.max_num_msgs_mbx = hw->mailboxq.num_rq_entries;  			data.async_watermark_val = ICE_MBX_OVERFLOW_WATERMARK; -			if (!ice_is_malicious_vf(pf, &event, &data)) -				ice_vc_process_vf_msg(pf, &event); +			ice_vc_process_vf_msg(pf, &event, &data);  			break;  		case ice_aqc_opc_fw_logging:  			ice_output_fw_log(hw, &event.desc, event.msg_buf);  | 
