Lines Matching +full:mailbox +full:-
1 /* SPDX-License-Identifier: BSD-3-Clause */
40 * @v_opcode: opcodes for VF-PF communication
46 * Send message to VF driver (0x0802) using mailbox
60 cmd->id = CPU_TO_LE32(vfid); in ice_aq_send_msg_to_vf()
68 return ice_sq_send_cmd(hw, &hw->mailboxq, &desc, msg, msglen, cd); in ice_aq_send_msg_to_vf()
74 * @v_opcode: opcodes for VF-PF communication
80 * Send message to PF driver using mailbox queue. By default, this
98 return ice_sq_send_cmd(hw, &hw->mailboxq, &desc, msg, msglen, cd); in ice_aq_send_msg_to_pf()
130 u16 index = (u16)(ice_fls(link_speed) - 1); in ice_conv_link_speed_to_virtchnl()
145 /* The mailbox overflow detection algorithm helps to check if there
148 * 1. The mailbox snapshot structure, ice_mbx_snapshot, is initialized during
151 * messages within the mailbox queue while looking for a malicious VF.
153 * 2. When the caller starts processing its mailbox queue in response to an
179 * in ice_mbx_snapshot for every new mailbox interrupt handled.
182 /* Using the highest value for an unsigned 16-bit value 0xFFFF to indicate that
188 * ice_mbx_reset_snapshot - Initialize mailbox snapshot structure
189 * @snap: pointer to the mailbox snapshot
195 /* Clear mbx_buf in the mailbox snaphot structure and setting the in ice_mbx_reset_snapshot()
196 * mailbox snapshot state to a new capture. in ice_mbx_reset_snapshot()
198 ice_memset(&snap->mbx_buf, 0, sizeof(snap->mbx_buf), ICE_NONDMA_MEM); in ice_mbx_reset_snapshot()
199 snap->mbx_buf.state = ICE_MAL_VF_DETECT_STATE_NEW_SNAPSHOT; in ice_mbx_reset_snapshot()
202 LIST_FOR_EACH_ENTRY(vf_info, &snap->mbx_vf, ice_mbx_vf_info, list_entry) in ice_mbx_reset_snapshot()
203 vf_info->msg_count = 0; in ice_mbx_reset_snapshot()
207 * ice_mbx_traverse - Pass through mailbox snapshot
211 * Traversing the mailbox static snapshot without checking
221 snap_buf = &hw->mbx_snapshot.mbx_buf; in ice_mbx_traverse()
223 /* As mailbox buffer is circular, applying a mask in ice_mbx_traverse()
226 num_iterations = ICE_RQ_DATA_MASK(++snap_buf->num_iterations); in ice_mbx_traverse()
229 * Condition-1: If the number of iterations in the mailbox is equal to in ice_mbx_traverse()
230 * the mailbox head which would indicate that we have reached the end in ice_mbx_traverse()
232 * Condition-2: If the maximum messages serviced in the mailbox for a in ice_mbx_traverse()
236 * to the maximum number of mailbox entries serviced in current work item. in ice_mbx_traverse()
238 if (num_iterations == snap_buf->head || in ice_mbx_traverse()
239 (snap_buf->max_num_msgs_mbx < ICE_IGNORE_MAX_MSG_CNT && in ice_mbx_traverse()
240 ++snap_buf->num_msg_proc >= snap_buf->max_num_msgs_mbx)) in ice_mbx_traverse()
245 * ice_mbx_detect_malvf - Detect malicious VF in snapshot
247 * @vf_info: mailbox tracking structure for a VF
261 vf_info->msg_count++; in ice_mbx_detect_malvf()
263 if (vf_info->msg_count >= ICE_ASYNC_VF_MSG_THRESHOLD) in ice_mbx_detect_malvf()
266 /* continue to iterate through the mailbox snapshot */ in ice_mbx_detect_malvf()
273 * ice_e830_mbx_vf_dec_trig - Decrements the VF mailbox queue counter
279 * the buffers at the PF mailbox queue.
284 u16 vfid = LE16_TO_CPU(event->desc.retval); in ice_e830_mbx_vf_dec_trig()
290 * ice_mbx_vf_clear_cnt_e830 - Clear the VF mailbox queue count
305 * ice_mbx_vf_state_handler - Handle states of the overflow algorithm
307 * @mbx_data: pointer to structure containing mailbox data
308 * @vf_info: mailbox tracking structure for the VF in question
315 * snapshot. The data from any previous mailbox snapshot is
316 * cleared and a new capture of the mailbox head and tail is
331 struct ice_mbx_snapshot *snap = &hw->mbx_snapshot; in ice_mbx_vf_state_handler()
333 struct ice_ctl_q_info *cq = &hw->mailboxq; in ice_mbx_vf_state_handler()
343 /* When entering the mailbox state machine assume that the VF in ice_mbx_vf_state_handler()
349 if (mbx_data->max_num_msgs_mbx <= ICE_ASYNC_VF_MSG_THRESHOLD) in ice_mbx_vf_state_handler()
353 * set for the number of asynchronous messages a VF can send to mailbox in ice_mbx_vf_state_handler()
355 * mailbox serviced in current interrupt. in ice_mbx_vf_state_handler()
357 if (mbx_data->async_watermark_val < ICE_ASYNC_VF_MSG_THRESHOLD || in ice_mbx_vf_state_handler()
358 mbx_data->async_watermark_val > mbx_data->max_num_msgs_mbx) in ice_mbx_vf_state_handler()
362 snap_buf = &snap->mbx_buf; in ice_mbx_vf_state_handler()
364 switch (snap_buf->state) { in ice_mbx_vf_state_handler()
366 /* Clear any previously held data in mailbox snapshot structure. */ in ice_mbx_vf_state_handler()
371 * Mailbox for current interrupt. in ice_mbx_vf_state_handler()
373 snap_buf->num_pending_arq = mbx_data->num_pending_arq; in ice_mbx_vf_state_handler()
374 snap_buf->num_msg_proc = mbx_data->num_msg_proc; in ice_mbx_vf_state_handler()
375 snap_buf->max_num_msgs_mbx = mbx_data->max_num_msgs_mbx; in ice_mbx_vf_state_handler()
377 /* Capture a new static snapshot of the mailbox by logging the in ice_mbx_vf_state_handler()
381 snap_buf->head = ICE_RQ_DATA_MASK(cq->rq.next_to_clean + in ice_mbx_vf_state_handler()
382 mbx_data->num_pending_arq); in ice_mbx_vf_state_handler()
383 snap_buf->tail = ICE_RQ_DATA_MASK(cq->rq.next_to_clean - 1); in ice_mbx_vf_state_handler()
384 snap_buf->num_iterations = snap_buf->tail; in ice_mbx_vf_state_handler()
388 * mailbox queue. Comparing this value against the watermark in ice_mbx_vf_state_handler()
391 if (snap_buf->num_pending_arq >= in ice_mbx_vf_state_handler()
392 mbx_data->async_watermark_val) { in ice_mbx_vf_state_handler()
416 snap_buf->state = new_state; in ice_mbx_vf_state_handler()
419 if (is_malvf && !vf_info->malicious) { in ice_mbx_vf_state_handler()
420 vf_info->malicious = 1; in ice_mbx_vf_state_handler()
428 * ice_mbx_clear_malvf - Clear VF mailbox info
429 * @vf_info: the mailbox tracking structure for a VF
432 * current mailbox tracking state.
436 vf_info->malicious = 0; in ice_mbx_clear_malvf()
437 vf_info->msg_count = 0; in ice_mbx_clear_malvf()
441 * ice_mbx_init_vf_info - Initialize a new VF mailbox tracking info
443 * @vf_info: the mailbox tracking info structure for a VF
445 * Initialize a VF mailbox tracking info structure and insert it into the
453 struct ice_mbx_snapshot *snap = &hw->mbx_snapshot; in ice_mbx_init_vf_info()
456 LIST_ADD(&vf_info->list_entry, &snap->mbx_vf); in ice_mbx_init_vf_info()
460 * ice_mbx_init_snapshot - Initialize mailbox snapshot data
463 * Clear the mailbox snapshot structure and initialize the VF mailbox list.
467 struct ice_mbx_snapshot *snap = &hw->mbx_snapshot; in ice_mbx_init_snapshot()
469 INIT_LIST_HEAD(&snap->mbx_vf); in ice_mbx_init_snapshot()