Lines Matching defs:ring

222 /* Rx DMA timeout in ms, which is used to calculate Rx ring buffer size */
1033 struct circ_buf *ring = &sport->rx_ring;
1036 if (ring->head < ring->tail) {
1037 count = sport->rx_sgl.length - ring->tail;
1039 ring->buf + ring->tail, count);
1040 ring->tail = 0;
1043 if (ring->head > ring->tail) {
1044 count = ring->head - ring->tail;
1046 ring->buf + ring->tail, count);
1047 ring->tail = ring->head;
1057 struct circ_buf *ring = &sport->rx_ring;
1129 * ring->head points to the end of data already written by the DMA.
1130 * ring->tail points to the beginning of data to be read by the
1135 ring->head = sport->rx_sgl.length - state.residue;
1136 BUG_ON(ring->head > sport->rx_sgl.length);
1147 * At this point ring->head may point to the first byte right after the
1149 * 0 <= ring->head <= sport->rx_sgl.length
1151 * However ring->tail must always points inside the dma buffer:
1152 * 0 <= ring->tail <= sport->rx_sgl.length - 1
1154 * Since we use a ring buffer, we have to handle the case
1158 if (ring->head < ring->tail) {
1159 count = sport->rx_sgl.length - ring->tail;
1161 tty_insert_flip_string(port, ring->buf + ring->tail, count);
1162 ring->tail = 0;
1167 if (ring->tail < ring->head) {
1168 count = ring->head - ring->tail;
1169 tty_insert_flip_string(port, ring->buf + ring->tail, count);
1170 /* Wrap ring->head if needed */
1171 if (ring->head >= sport->rx_sgl.length)
1172 ring->head = 0;
1173 ring->tail = ring->head;
1204 struct circ_buf *ring = &sport->rx_ring;
1227 ring->buf = kzalloc(sport->rx_dma_rng_buf_len, GFP_ATOMIC);
1228 if (!ring->buf)
1231 sg_init_one(&sport->rx_sgl, ring->buf, sport->rx_dma_rng_buf_len);