Lines Matching refs:tail

34 	fifo->tail = 0;
45 return fifo->tail - fifo->head;
56 return fifo->size + fifo->head - fifo->tail;
67 return fifo->head == fifo->tail;
83 * fm10k_fifo_tail_offset - returns indices of tail with given offset
85 * @offset: offset to add to tail
87 * This function returns the indicies into the fifo based on tail + offset
91 return (fifo->tail + offset) & (fifo->size - 1);
129 * fm10k_mbx_index_len - Convert a head/tail index into a length value
132 * @tail: head index
134 * This function takes the head and tail index and determines the length
137 static u16 fm10k_mbx_index_len(struct fm10k_mbx_info *mbx, u16 head, u16 tail)
139 u16 len = tail - head;
142 if (len > tail)
149 * fm10k_mbx_tail_add - Determine new tail value with added offset
153 * This function takes the local tail index and recomputes it for
158 u16 tail = (mbx->tail + offset + 1) & ((mbx->mbmem_len << 1) - 1);
161 return (tail > mbx->tail) ? --tail : ++tail;
165 * fm10k_mbx_tail_sub - Determine new tail value with subtracted offset
169 * This function takes the local tail index and recomputes it for
174 u16 tail = (mbx->tail - offset - 1) & ((mbx->mbmem_len << 1) - 1);
177 return (tail < mbx->tail) ? ++tail : --tail;
217 * pushed onto the tail of the Rx queue.
221 u32 *tail = mbx->rx.buffer + fm10k_fifo_tail_offset(&mbx->rx, 0);
223 /* pushed tail is only valid if pushed is set */
227 return FM10K_TLV_DWORD_LEN(*tail);
234 * @tail_offset: additional offset to add to tail pointer
239 * the tail you can use tail_offset to adjust the pointer.
245 u32 *tail = fifo->buffer + end;
257 memcpy(tail, msg, end << 2);
261 * fm10k_fifo_enqueue - Enqueues the message to the tail of the FIFO
266 * contained in the first DWORD of the message and will place at the tail
284 /* memory barrier to guarantee FIFO is written before tail update */
287 /* Update Tx FIFO tail */
288 fifo->tail += len;
330 mbx->tail--;
332 * tail and len determines the length to copy.
340 u16 end, len, tail, mask;
345 /* determine data length and mbmem tail index */
348 tail = fm10k_mbx_tail_sub(mbx, len);
349 if (tail > mask)
350 tail++;
362 /* adjust tail to match offset for FIFO */
363 tail &= mask;
364 if (!tail)
365 tail++;
368 fm10k_write_reg(hw, mbmem + tail++, *(head++));
379 * This function will push the tail index forward based on the remote
387 u16 mbmem_len, len, ack = fm10k_mbx_index_len(mbx, head, mbx->tail);
399 /* update tail and record number of bytes in transit */
400 mbx->tail = fm10k_mbx_tail_add(mbx, len - ack);
430 u32 *tail = fifo->buffer;
441 tail += end;
444 for (end = fifo->size - end; len; tail = fifo->buffer) {
452 *(tail++) = fm10k_read_reg(hw, mbmem + head++);
456 /* memory barrier to guarantee FIFO is written before tail update */
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)
476 u16 len, seq = fm10k_mbx_index_len(mbx, mbx->head, tail);
505 fifo->tail += len;
619 u16 len = mbx->tail_len - fm10k_mbx_index_len(mbx, head, mbx->tail);
720 memmove(fifo->buffer, fifo->buffer + fifo->tail, mbx->pushed << 2);
722 /* shift head and tail based on the memory we moved */
723 fifo->tail -= fifo->head;
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) |
880 FM10K_MSG_HDR_FIELD_SET(mbx->tail, TAIL) |
932 u16 type, rsvd0, head, tail, size;
937 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, TAIL);
947 if (tail != mbx->head)
955 if (fm10k_mbx_index_len(mbx, head, mbx->tail) > mbx->tail_len)
958 /* validate that tail is moving correctly */
959 if (!tail || (tail == FM10K_MSG_HDR_MASK(TAIL)))
961 if (fm10k_mbx_index_len(mbx, mbx->head, tail) < mbx->mbmem_len)
974 /* neither create nor error include a tail offset */
975 if (tail)
1046 mbx->rx.tail = 0;
1137 /* align our tail index to remote head index */
1138 mbx->tail = head;
1155 u16 head, tail;
1160 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, TAIL);
1164 mbx->tail = head;
1169 err = fm10k_mbx_push_tail(hw, mbx, tail);
1197 u16 head, tail;
1202 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, TAIL);
1208 /* we have already verified mbx->head == tail so we know this is 0 */
1224 if (head != mbx->tail)
1269 /* reset tail index and size to prepare for reconnect */
1270 mbx->tail = head;
1285 return fm10k_mbx_create_reply(hw, mbx, mbx->tail);
1510 * evenly splitting it. In order to allow for easy masking of head/tail
1552 /* initalize tail and head */
1553 mbx->tail = 1;
1593 mbx->mbx_hdr = FM10K_MSG_HDR_FIELD_SET(mbx->tail, SM_TAIL) |
1610 mbx->mbx_hdr = FM10K_MSG_HDR_FIELD_SET(mbx->tail, SM_TAIL) |
1631 /* initalize tail and head */
1632 mbx->tail = 1;
1734 u16 tail, head, ver;
1736 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_TAIL);
1746 if (!tail || tail > FM10K_SM_MBX_FIFO_LEN)
1748 if (mbx->tail < head)
1750 if (tail < mbx->head)
1751 tail += mbx->mbmem_len - 1;
1752 if (fm10k_mbx_index_len(mbx, head, mbx->tail) > mbx->tail_len)
1754 if (fm10k_mbx_index_len(mbx, mbx->head, tail) < mbx->mbmem_len)
1838 u16 tail)
1844 /* push tail in front of head */
1845 if (tail < mbx->head)
1846 tail += mbmem_len;
1849 err = fm10k_mbx_push_tail(hw, mbx, tail);
1884 /* push head behind tail */
1885 if (mbx->tail < head)
1899 mbx->tail = fm10k_mbx_tail_sub(mbx, mbx->tail_len - tail_len);
1904 if (mbx->tail > mbmem_len)
1905 mbx->tail -= mbmem_len;
1978 fm10k_sm_mbx_create_reply(hw, mbx, mbx->tail);
1993 u16 head, tail;
1997 tail = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_TAIL);
2012 len = fm10k_sm_mbx_receive(hw, mbx, tail);