Lines Matching +full:current +full:- +full:speed

1 // SPDX-License-Identifier: GPL-2.0
11 * @v_opcode: opcodes for VF-PF communication
31 cmd->id = cpu_to_le32(vfid); in ice_aq_send_msg_to_vf()
39 return ice_sq_send_cmd(hw, &hw->mailboxq, &desc, msg, msglen, cd); in ice_aq_send_msg_to_vf()
44 * @adv_link_support: determines the format of the returned link speed
47 * Convert link speed supported by HW to link speed supported by virtchnl.
48 * If adv_link_support is true, then return link speed in Mbps. Else return
49 * link speed as a VIRTCHNL_LINK_SPEED_* casted to a u32. Note that the caller
52 * expect the speed in Mbps.
56 u32 speed; in ice_conv_link_speed_to_virtchnl() local
61 speed = ICE_LINK_SPEED_10MBPS; in ice_conv_link_speed_to_virtchnl()
64 speed = ICE_LINK_SPEED_100MBPS; in ice_conv_link_speed_to_virtchnl()
67 speed = ICE_LINK_SPEED_1000MBPS; in ice_conv_link_speed_to_virtchnl()
70 speed = ICE_LINK_SPEED_2500MBPS; in ice_conv_link_speed_to_virtchnl()
73 speed = ICE_LINK_SPEED_5000MBPS; in ice_conv_link_speed_to_virtchnl()
76 speed = ICE_LINK_SPEED_10000MBPS; in ice_conv_link_speed_to_virtchnl()
79 speed = ICE_LINK_SPEED_20000MBPS; in ice_conv_link_speed_to_virtchnl()
82 speed = ICE_LINK_SPEED_25000MBPS; in ice_conv_link_speed_to_virtchnl()
85 speed = ICE_LINK_SPEED_40000MBPS; in ice_conv_link_speed_to_virtchnl()
88 speed = ICE_LINK_SPEED_50000MBPS; in ice_conv_link_speed_to_virtchnl()
91 speed = ICE_LINK_SPEED_100000MBPS; in ice_conv_link_speed_to_virtchnl()
94 speed = ICE_LINK_SPEED_UNKNOWN; in ice_conv_link_speed_to_virtchnl()
98 /* Virtchnl speeds are not defined for every speed supported in in ice_conv_link_speed_to_virtchnl()
100 * drivers, while reporting the speed the new speed values are in ice_conv_link_speed_to_virtchnl()
106 speed = (u32)VIRTCHNL_LINK_SPEED_100MB; in ice_conv_link_speed_to_virtchnl()
111 speed = (u32)VIRTCHNL_LINK_SPEED_1GB; in ice_conv_link_speed_to_virtchnl()
114 speed = (u32)VIRTCHNL_LINK_SPEED_10GB; in ice_conv_link_speed_to_virtchnl()
117 speed = (u32)VIRTCHNL_LINK_SPEED_20GB; in ice_conv_link_speed_to_virtchnl()
120 speed = (u32)VIRTCHNL_LINK_SPEED_25GB; in ice_conv_link_speed_to_virtchnl()
125 speed = (u32)VIRTCHNL_LINK_SPEED_40GB; in ice_conv_link_speed_to_virtchnl()
128 speed = (u32)VIRTCHNL_LINK_SPEED_UNKNOWN; in ice_conv_link_speed_to_virtchnl()
132 return speed; in ice_conv_link_speed_to_virtchnl()
173 * 8. The memory allocated for variables in ice_mbx_snapshot is de-allocated
177 /* Using the highest value for an unsigned 16-bit value 0xFFFF to indicate that
183 * ice_mbx_traverse - Pass through mailbox snapshot
197 snap_buf = &hw->mbx_snapshot.mbx_buf; in ice_mbx_traverse()
202 num_iterations = ICE_RQ_DATA_MASK(++snap_buf->num_iterations); in ice_mbx_traverse()
205 * Condition-1: If the number of iterations in the mailbox is equal to in ice_mbx_traverse()
208 * Condition-2: If the maximum messages serviced in the mailbox for a in ice_mbx_traverse()
212 * to the maximum number of mailbox entries serviced in current work item. in ice_mbx_traverse()
214 if (num_iterations == snap_buf->head || in ice_mbx_traverse()
215 (snap_buf->max_num_msgs_mbx < ICE_IGNORE_MAX_MSG_CNT && in ice_mbx_traverse()
216 ++snap_buf->num_msg_proc >= snap_buf->max_num_msgs_mbx)) in ice_mbx_traverse()
221 * ice_mbx_detect_malvf - Detect malicious VF in snapshot
236 struct ice_mbx_snapshot *snap = &hw->mbx_snapshot; in ice_mbx_detect_malvf()
238 if (vf_id >= snap->mbx_vf.vfcntr_len) in ice_mbx_detect_malvf()
242 snap->mbx_vf.vf_cntr[vf_id]++; in ice_mbx_detect_malvf()
244 if (snap->mbx_vf.vf_cntr[vf_id] >= ICE_ASYNC_VF_MSG_THRESHOLD) in ice_mbx_detect_malvf()
254 * ice_mbx_reset_snapshot - Reset mailbox snapshot structure
263 if (!snap || !snap->mbx_vf.vf_cntr) in ice_mbx_reset_snapshot()
267 vfcntr_len = snap->mbx_vf.vfcntr_len; in ice_mbx_reset_snapshot()
269 memset(snap->mbx_vf.vf_cntr, 0, in ice_mbx_reset_snapshot()
270 (vfcntr_len * sizeof(*snap->mbx_vf.vf_cntr))); in ice_mbx_reset_snapshot()
273 memset(&snap->mbx_buf, 0, sizeof(snap->mbx_buf)); in ice_mbx_reset_snapshot()
274 snap->mbx_buf.state = ICE_MAL_VF_DETECT_STATE_NEW_SNAPSHOT; in ice_mbx_reset_snapshot()
278 * ice_mbx_vf_state_handler - Handle states of the overflow algorithm
305 struct ice_mbx_snapshot *snap = &hw->mbx_snapshot; in ice_mbx_vf_state_handler()
307 struct ice_ctl_q_info *cq = &hw->mailboxq; in ice_mbx_vf_state_handler()
319 /* Checking if max messages allowed to be processed while servicing current in ice_mbx_vf_state_handler()
322 if (mbx_data->max_num_msgs_mbx <= ICE_ASYNC_VF_MSG_THRESHOLD) in ice_mbx_vf_state_handler()
328 * mailbox serviced in current interrupt. in ice_mbx_vf_state_handler()
330 if (mbx_data->async_watermark_val < ICE_ASYNC_VF_MSG_THRESHOLD || in ice_mbx_vf_state_handler()
331 mbx_data->async_watermark_val > mbx_data->max_num_msgs_mbx) in ice_mbx_vf_state_handler()
335 snap_buf = &snap->mbx_buf; in ice_mbx_vf_state_handler()
337 switch (snap_buf->state) { in ice_mbx_vf_state_handler()
344 * Mailbox for current interrupt. in ice_mbx_vf_state_handler()
346 snap_buf->num_pending_arq = mbx_data->num_pending_arq; in ice_mbx_vf_state_handler()
347 snap_buf->num_msg_proc = mbx_data->num_msg_proc; in ice_mbx_vf_state_handler()
348 snap_buf->max_num_msgs_mbx = mbx_data->max_num_msgs_mbx; in ice_mbx_vf_state_handler()
354 snap_buf->head = ICE_RQ_DATA_MASK(cq->rq.next_to_clean + in ice_mbx_vf_state_handler()
355 mbx_data->num_pending_arq); in ice_mbx_vf_state_handler()
356 snap_buf->tail = ICE_RQ_DATA_MASK(cq->rq.next_to_clean - 1); in ice_mbx_vf_state_handler()
357 snap_buf->num_iterations = snap_buf->tail; in ice_mbx_vf_state_handler()
364 if (snap_buf->num_pending_arq >= in ice_mbx_vf_state_handler()
365 mbx_data->async_watermark_val) { in ice_mbx_vf_state_handler()
389 snap_buf->state = new_state; in ice_mbx_vf_state_handler()
395 * ice_mbx_report_malvf - Track and note malicious VF
417 if (bitmap_len < hw->mbx_snapshot.mbx_vf.vfcntr_len) in ice_mbx_report_malvf()
431 * ice_mbx_clear_malvf - Clear VF bitmap and counter for VF ID
451 if (bitmap_len < snap->mbx_vf.vfcntr_len) in ice_mbx_clear_malvf()
455 if (vf_id >= bitmap_len || vf_id >= snap->mbx_vf.vfcntr_len) in ice_mbx_clear_malvf()
467 snap->mbx_vf.vf_cntr[vf_id] = 0; in ice_mbx_clear_malvf()
473 * ice_mbx_init_snapshot - Initialize mailbox snapshot structure
487 struct ice_mbx_snapshot *snap = &hw->mbx_snapshot; in ice_mbx_init_snapshot()
489 /* Ensure that the number of VFs allocated is non-zero and in ice_mbx_init_snapshot()
493 if (!vf_count || vf_count > hw->func_caps.num_allocd_vfs) in ice_mbx_init_snapshot()
496 snap->mbx_vf.vf_cntr = devm_kcalloc(ice_hw_to_dev(hw), vf_count, in ice_mbx_init_snapshot()
497 sizeof(*snap->mbx_vf.vf_cntr), in ice_mbx_init_snapshot()
499 if (!snap->mbx_vf.vf_cntr) in ice_mbx_init_snapshot()
505 snap->mbx_vf.vfcntr_len = vf_count; in ice_mbx_init_snapshot()
510 memset(&snap->mbx_buf, 0, sizeof(snap->mbx_buf)); in ice_mbx_init_snapshot()
511 snap->mbx_buf.state = ICE_MAL_VF_DETECT_STATE_NEW_SNAPSHOT; in ice_mbx_init_snapshot()
517 * ice_mbx_deinit_snapshot - Free mailbox snapshot structure
524 struct ice_mbx_snapshot *snap = &hw->mbx_snapshot; in ice_mbx_deinit_snapshot()
527 devm_kfree(ice_hw_to_dev(hw), snap->mbx_vf.vf_cntr); in ice_mbx_deinit_snapshot()
528 snap->mbx_vf.vfcntr_len = 0; in ice_mbx_deinit_snapshot()
531 memset(&snap->mbx_buf, 0, sizeof(snap->mbx_buf)); in ice_mbx_deinit_snapshot()