Lines Matching full:tail

17 	fifo->tail = 0;  in fm10k_fifo_init()
28 return fifo->tail - fifo->head; in fm10k_fifo_used()
39 return fifo->size + fifo->head - fifo->tail; in fm10k_fifo_unused()
50 return fifo->head == fifo->tail; in fm10k_fifo_empty()
66 * fm10k_fifo_tail_offset - returns indices of tail with given offset
68 * @offset: offset to add to tail
70 * This function returns the indices into the FIFO based on tail + offset
74 return (fifo->tail + offset) & (fifo->size - 1); in fm10k_fifo_tail_offset()
120 fifo->head = fifo->tail; in fm10k_fifo_drop_all()
124 * fm10k_mbx_index_len - Convert a head/tail index into a length value
127 * @tail: head index
129 * This function takes the head and tail index and determines the length
132 static u16 fm10k_mbx_index_len(struct fm10k_mbx_info *mbx, u16 head, u16 tail) in fm10k_mbx_index_len() argument
134 u16 len = tail - head; in fm10k_mbx_index_len()
137 if (len > tail) in fm10k_mbx_index_len()
144 * fm10k_mbx_tail_add - Determine new tail value with added offset
146 * @offset: length to add to tail offset
148 * This function takes the local tail index and recomputes it for
153 u16 tail = (mbx->tail + offset + 1) & ((mbx->mbmem_len << 1) - 1); in fm10k_mbx_tail_add() local
156 return (tail > mbx->tail) ? --tail : ++tail; in fm10k_mbx_tail_add()
160 * fm10k_mbx_tail_sub - Determine new tail value with subtracted offset
162 * @offset: length to add to tail offset
164 * This function takes the local tail index and recomputes it for
169 u16 tail = (mbx->tail - offset - 1) & ((mbx->mbmem_len << 1) - 1); in fm10k_mbx_tail_sub() local
172 return (tail < mbx->tail) ? ++tail : --tail; in fm10k_mbx_tail_sub()
212 * pushed onto the tail of the Rx queue.
216 u32 *tail = mbx->rx.buffer + fm10k_fifo_tail_offset(&mbx->rx, 0); in fm10k_mbx_pushed_tail_len() local
218 /* pushed tail is only valid if pushed is set */ in fm10k_mbx_pushed_tail_len()
222 return FM10K_TLV_DWORD_LEN(*tail); in fm10k_mbx_pushed_tail_len()
229 * @tail_offset: additional offset to add to tail pointer
234 * the tail you can use tail_offset to adjust the pointer.
240 u32 *tail = fifo->buffer + end; in fm10k_fifo_write_copy() local
252 memcpy(tail, msg, end << 2); in fm10k_fifo_write_copy()
256 * fm10k_fifo_enqueue - Enqueues the message to the tail of the FIFO
261 * contained in the first DWORD of the message and will place at the tail
279 /* memory barrier to guarantee FIFO is written before tail update */ in fm10k_fifo_enqueue()
282 /* Update Tx FIFO tail */ in fm10k_fifo_enqueue()
283 fifo->tail += len; in fm10k_fifo_enqueue()
328 * tail and len determines the length to copy.
336 u16 end, len, tail, mask; in fm10k_mbx_write_copy() local
341 /* determine data length and mbmem tail index */ in fm10k_mbx_write_copy()
344 tail = fm10k_mbx_tail_sub(mbx, len); in fm10k_mbx_write_copy()
345 if (tail > mask) in fm10k_mbx_write_copy()
346 tail++; in fm10k_mbx_write_copy()
358 /* adjust tail to match offset for FIFO */ in fm10k_mbx_write_copy()
359 tail &= mask; in fm10k_mbx_write_copy()
360 if (!tail) in fm10k_mbx_write_copy()
361 tail++; in fm10k_mbx_write_copy()
366 fm10k_write_reg(hw, mbmem + tail++, *(head++)); in fm10k_mbx_write_copy()
377 * This function will push the tail index forward based on the remote
385 u16 mbmem_len, len, ack = fm10k_mbx_index_len(mbx, head, mbx->tail); in fm10k_mbx_pull_head()
397 /* update tail and record number of bytes in transit */ in fm10k_mbx_pull_head()
398 mbx->tail = fm10k_mbx_tail_add(mbx, len - ack); in fm10k_mbx_pull_head()
428 u32 *tail = fifo->buffer; in fm10k_mbx_read_copy() local
439 tail += end; in fm10k_mbx_read_copy()
442 for (end = fifo->size - end; len; tail = fifo->buffer) { in fm10k_mbx_read_copy()
452 *(tail++) = fm10k_read_reg(hw, mbmem + head++); in fm10k_mbx_read_copy()
456 /* memory barrier to guarantee FIFO is written before tail update */ in fm10k_mbx_read_copy()
461 * fm10k_mbx_push_tail - Pushes up to 15 DWORDs on to tail of FIFO
464 * @tail: tail index of message
466 * This function will first validate the tail index and size for the
473 u16 tail) in fm10k_mbx_push_tail() argument
476 u16 len, seq = fm10k_mbx_index_len(mbx, mbx->head, tail); in fm10k_mbx_push_tail()
505 fifo->tail += len; in fm10k_mbx_push_tail()
619 u16 len = mbx->tail_len - fm10k_mbx_index_len(mbx, head, mbx->tail); in fm10k_mbx_update_local_crc()
720 memmove(fifo->buffer, fifo->buffer + fifo->tail, mbx->pushed << 2); in fm10k_mbx_dequeue_rx()
722 /* shift head and tail based on the memory we moved */ in fm10k_mbx_dequeue_rx()
723 fifo->tail -= fifo->head; in fm10k_mbx_dequeue_rx()
730 * fm10k_mbx_enqueue_tx - Enqueues the message to the tail of the Tx FIFO
736 * contained in the first DWORD of the message and will place at the tail
854 FM10K_MSG_HDR_FIELD_SET(mbx->tail, TAIL) | in fm10k_mbx_create_data_hdr()
880 FM10K_MSG_HDR_FIELD_SET(mbx->tail, TAIL) | in fm10k_mbx_create_disconnect_hdr()
901 FM10K_MSG_HDR_FIELD_SET(mbx->head, TAIL) | in fm10k_mbx_create_fake_disconnect_hdr()
902 FM10K_MSG_HDR_FIELD_SET(mbx->tail, HEAD); in fm10k_mbx_create_fake_disconnect_hdr()
952 u16 type, rsvd0, head, tail, size; in fm10k_mbx_validate_msg_hdr() local
957 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, TAIL); in fm10k_mbx_validate_msg_hdr()
967 if (tail != mbx->head) in fm10k_mbx_validate_msg_hdr()
975 if (fm10k_mbx_index_len(mbx, head, mbx->tail) > mbx->tail_len) in fm10k_mbx_validate_msg_hdr()
978 /* validate that tail is moving correctly */ in fm10k_mbx_validate_msg_hdr()
979 if (!tail || (tail == FM10K_MSG_HDR_MASK(TAIL))) in fm10k_mbx_validate_msg_hdr()
981 if (fm10k_mbx_index_len(mbx, mbx->head, tail) < mbx->mbmem_len) in fm10k_mbx_validate_msg_hdr()
994 /* neither create nor error include a tail offset */ in fm10k_mbx_validate_msg_hdr()
995 if (tail) in fm10k_mbx_validate_msg_hdr()
1067 ack = fm10k_mbx_index_len(mbx, head, mbx->tail); in fm10k_mbx_reset_work()
1085 mbx->rx.tail = 0; in fm10k_mbx_reset_work()
1179 /* align our tail index to remote head index */ in fm10k_mbx_process_connect()
1180 mbx->tail = head; in fm10k_mbx_process_connect()
1198 u16 head, tail; in fm10k_mbx_process_data() local
1203 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, TAIL); in fm10k_mbx_process_data()
1207 mbx->tail = head; in fm10k_mbx_process_data()
1212 err = fm10k_mbx_push_tail(hw, mbx, tail); in fm10k_mbx_process_data()
1251 /* we have already verified mbx->head == tail so we know this is 0 */ in fm10k_mbx_process_disconnect()
1267 if (head != mbx->tail) in fm10k_mbx_process_disconnect()
1308 /* reset tail index and size to prepare for reconnect */ in fm10k_mbx_process_error()
1309 mbx->tail = head; in fm10k_mbx_process_error()
1324 return fm10k_mbx_create_reply(hw, mbx, mbx->tail); in fm10k_mbx_process_error()
1553 * evenly splitting it. In order to allow for easy masking of head/tail
1595 /* initialize tail and head */ in fm10k_pfvf_mbx_init()
1596 mbx->tail = 1; in fm10k_pfvf_mbx_init()
1636 mbx->mbx_hdr = FM10K_MSG_HDR_FIELD_SET(mbx->tail, SM_TAIL) | in fm10k_sm_mbx_create_data_hdr()
1653 mbx->mbx_hdr = FM10K_MSG_HDR_FIELD_SET(mbx->tail, SM_TAIL) | in fm10k_sm_mbx_create_connect_hdr()
1674 /* initialize tail and head */ in fm10k_sm_mbx_connect_reset()
1675 mbx->tail = 1; in fm10k_sm_mbx_connect_reset()
1775 u16 tail, head, ver; in fm10k_sm_mbx_validate_fifo_hdr() local
1777 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_TAIL); in fm10k_sm_mbx_validate_fifo_hdr()
1787 if (!tail || tail > FM10K_SM_MBX_FIFO_LEN) in fm10k_sm_mbx_validate_fifo_hdr()
1789 if (mbx->tail < head) in fm10k_sm_mbx_validate_fifo_hdr()
1791 if (tail < mbx->head) in fm10k_sm_mbx_validate_fifo_hdr()
1792 tail += mbx->mbmem_len - 1; in fm10k_sm_mbx_validate_fifo_hdr()
1793 if (fm10k_mbx_index_len(mbx, head, mbx->tail) > mbx->tail_len) in fm10k_sm_mbx_validate_fifo_hdr()
1795 if (fm10k_mbx_index_len(mbx, mbx->head, tail) < mbx->mbmem_len) in fm10k_sm_mbx_validate_fifo_hdr()
1873 * @tail: tail index of message
1880 u16 tail) in fm10k_sm_mbx_receive() argument
1886 /* push tail in front of head */ in fm10k_sm_mbx_receive()
1887 if (tail < mbx->head) in fm10k_sm_mbx_receive()
1888 tail += mbmem_len; in fm10k_sm_mbx_receive()
1891 err = fm10k_mbx_push_tail(hw, mbx, tail); in fm10k_sm_mbx_receive()
1926 /* push head behind tail */ in fm10k_sm_mbx_transmit()
1927 if (mbx->tail < head) in fm10k_sm_mbx_transmit()
1943 mbx->tail = fm10k_mbx_tail_sub(mbx, mbx->tail_len - tail_len); in fm10k_sm_mbx_transmit()
1948 if (mbx->tail > mbmem_len) in fm10k_sm_mbx_transmit()
1949 mbx->tail -= mbmem_len; in fm10k_sm_mbx_transmit()
2026 fm10k_sm_mbx_create_reply(hw, mbx, mbx->tail); in fm10k_sm_mbx_process_reset()
2043 u16 head, tail; in fm10k_sm_mbx_process_version_1() local
2047 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_TAIL); in fm10k_sm_mbx_process_version_1()
2062 len = fm10k_sm_mbx_receive(hw, mbx, tail); in fm10k_sm_mbx_process_version_1()
2134 * evenly splitting it. In order to allow for easy masking of head/tail