Lines Matching refs:head

16 	fifo->head = 0;
28 return fifo->tail - fifo->head;
39 return fifo->size + fifo->head - fifo->tail;
50 return fifo->head == fifo->tail;
54 * fm10k_fifo_head_offset - returns indices of head with given offset
56 * @offset: offset to add to head
58 * This function returns the indices into the FIFO based on head + offset
62 return (fifo->head + offset) & (fifo->size - 1);
85 u32 *head = fifo->buffer + fm10k_fifo_head_offset(fifo, 0);
87 /* verify there is at least 1 DWORD in the fifo so *head is valid */
92 return FM10K_TLV_DWORD_LEN(*head);
105 /* update head so it is at the start of next frame */
106 fifo->head += len;
115 * This function resets the head pointer to drop all messages in the FIFO and
120 fifo->head = fifo->tail;
124 * fm10k_mbx_index_len - Convert a head/tail index into a length value
126 * @head: head index
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)
134 u16 len = tail - head;
176 * fm10k_mbx_head_add - Determine new head value with added offset
178 * @offset: length to add to head offset
180 * This function takes the local head index and recomputes it for
185 u16 head = (mbx->head + offset + 1) & ((mbx->mbmem_len << 1) - 1);
188 return (head > mbx->head) ? --head : ++head;
192 * fm10k_mbx_head_sub - Determine new head value with subtracted offset
194 * @offset: length to add to head offset
196 * This function takes the local head index and recomputes it for
201 u16 head = (mbx->head - offset - 1) & ((mbx->mbmem_len << 1) - 1);
204 return (head < mbx->head) ? ++head : --head;
335 u32 *head = fifo->buffer;
350 head += end;
356 for (end = fifo->size - end; len; head = fifo->buffer) {
366 fm10k_write_reg(hw, mbmem + tail++, *(head++));
372 * fm10k_mbx_pull_head - Pulls data off of head of Tx FIFO
375 * @head: acknowledgement number last received
378 * head index. It will then pull up to mbmem_len DWORDs off of the
379 * head of the FIFO and will place it in the MBMEM registers
383 struct fm10k_mbx_info *mbx, u16 head)
385 u16 mbmem_len, len, ack = fm10k_mbx_index_len(mbx, head, mbx->tail);
421 * head and len determines the length to copy.
429 u16 end, len, head;
431 /* determine data length and mbmem head index */
433 head = fm10k_mbx_head_sub(mbx, len);
434 if (head >= mbx->mbmem_len)
435 head++;
444 /* adjust head to match offset for FIFO */
445 head &= mbx->mbmem_len - 1;
446 if (!head)
447 head++;
452 *(tail++) = fm10k_read_reg(hw, mbmem + head++);
476 u16 len, seq = fm10k_mbx_index_len(mbx, mbx->head, tail);
483 /* update head and record bytes received */
484 mbx->head = fm10k_mbx_head_add(mbx, len);
610 * @head: head index provided by remote mailbox
613 * last head update to the current one. It uses the result of the
617 static void fm10k_mbx_update_local_crc(struct fm10k_mbx_info *mbx, u16 head)
619 u16 len = mbx->tail_len - fm10k_mbx_index_len(mbx, head, mbx->tail);
622 head = fm10k_fifo_head_offset(&mbx->tx, mbx->pulled);
625 mbx->local = fm10k_fifo_crc(&mbx->tx, head, len, mbx->local);
695 * fm10k_mbx_dequeue_rx - Dequeues the message from the head in the Rx FIFO
711 err = fm10k_tlv_msg_parse(hw, fifo->buffer + fifo->head,
722 /* shift head and tail based on the memory we moved */
723 fifo->tail -= fifo->head;
724 fifo->head = 0;
841 FM10K_MSG_HDR_FIELD_SET(mbx->head, HEAD) |
855 FM10K_MSG_HDR_FIELD_SET(mbx->head, HEAD);
881 FM10K_MSG_HDR_FIELD_SET(mbx->head, HEAD);
901 FM10K_MSG_HDR_FIELD_SET(mbx->head, TAIL) |
939 FM10K_MSG_HDR_FIELD_SET(mbx->head, HEAD);
952 u16 type, rsvd0, head, tail, size;
958 head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
967 if (tail != mbx->head)
972 /* validate that head is moving correctly */
973 if (!head || (head == FM10K_MSG_HDR_MASK(HEAD)))
975 if (fm10k_mbx_index_len(mbx, head, mbx->tail) > mbx->tail_len)
981 if (fm10k_mbx_index_len(mbx, mbx->head, tail) < mbx->mbmem_len)
992 if (!head || (head == FM10K_MSG_HDR_MASK(HEAD)))
1007 * fm10k_mbx_create_reply - Generate reply based on state and remote head
1010 * @head: acknowledgement number
1013 * mailbox state and the remote FIFO head. It will return the length
1018 struct fm10k_mbx_info *mbx, u16 head)
1024 fm10k_mbx_update_local_crc(mbx, head);
1027 fm10k_mbx_pull_head(hw, mbx, head);
1060 u16 len, head, ack;
1066 head = FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, HEAD);
1067 ack = fm10k_mbx_index_len(mbx, head, mbx->tail);
1086 mbx->rx.head = 0;
1095 * at the head of the Tx FIFO if they are larger than max_size. It does not
1152 u16 size, head;
1156 head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
1179 /* align our tail index to remote head index */
1180 mbx->tail = head;
1182 return fm10k_mbx_create_reply(hw, mbx, head);
1198 u16 head, tail;
1202 head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
1207 mbx->tail = head;
1224 return fm10k_mbx_create_reply(hw, mbx, head);
1241 u16 head;
1245 head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
1251 /* we have already verified mbx->head == tail so we know this is 0 */
1266 /* verify the head indicates we completed all transmits */
1267 if (head != mbx->tail)
1277 return fm10k_mbx_create_reply(hw, mbx, head);
1293 u16 head;
1296 head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
1309 mbx->tail = head;
1553 * evenly splitting it. In order to allow for easy masking of head/tail
1595 /* initialize tail and head */
1597 mbx->head = 1;
1638 FM10K_MSG_HDR_FIELD_SET(mbx->head, SM_HEAD);
1655 FM10K_MSG_HDR_FIELD_SET(mbx->head, SM_HEAD) |
1674 /* initialize tail and head */
1676 mbx->head = 1;
1775 u16 tail, head, ver;
1779 head = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_HEAD);
1785 if (!head || head > FM10K_SM_MBX_FIFO_LEN)
1789 if (mbx->tail < head)
1790 head += mbx->mbmem_len - 1;
1791 if (tail < mbx->head)
1793 if (fm10k_mbx_index_len(mbx, head, mbx->tail) > mbx->tail_len)
1795 if (fm10k_mbx_index_len(mbx, mbx->head, tail) < mbx->mbmem_len)
1886 /* push tail in front of head */
1887 if (tail < mbx->head)
1898 /* guarantee head aligns with the end of the last message */
1899 mbx->head = fm10k_mbx_head_sub(mbx, mbx->pushed);
1903 if (mbx->head > mbmem_len)
1904 mbx->head -= mbmem_len;
1913 * @head: head index of message
1919 struct fm10k_mbx_info *mbx, u16 head)
1926 /* push head behind tail */
1927 if (mbx->tail < head)
1928 head += mbmem_len;
1930 fm10k_mbx_pull_head(hw, mbx, head);
1953 * fm10k_sm_mbx_create_reply - Generate reply based on state and remote head
1956 * @head: acknowledgement number
1959 * mailbox state and the remote FIFO head. It will return the length
1964 struct fm10k_mbx_info *mbx, u16 head)
1970 fm10k_sm_mbx_transmit(hw, mbx, head);
2043 u16 head, tail;
2048 head = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_HEAD);
2070 fm10k_sm_mbx_create_reply(hw, mbx, head);
2134 * evenly splitting it. In order to allow for easy masking of head/tail