Skip to content

Commit 7542f29

Browse files
committed
Add RX deque prototype
1 parent 278a28f commit 7542f29

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

virtio-snd.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,10 @@ VSND_GEN_TX_QUEUE_HANDLER(flush, 0);
605605
\
606606
IIF(WRITE) \
607607
(/* enqueue frames */ \
608-
void *payload = (void *) (base + addr); if (bad_msg_err == 0) \
609-
__virtio_snd_rx_frame_dequeue(payload, len, stream_id); \
608+
void *payload = (void *) (base + addr); \
609+
if (bad_msg_err != 0) \
610+
goto early_continue; \
611+
__virtio_snd_rx_frame_dequeue(payload, len, stream_id); \
610612
, /* flush queue */ \
611613
(void) stream_id; \
612614
/* Suppress unused variable warning. */) ret_len += len; \
@@ -620,8 +622,8 @@ VSND_GEN_TX_QUEUE_HANDLER(flush, 0);
620622
IIF(WRITE) \
621623
(/* enque frames */ \
622624
virtio_snd_prop_t *props = &vsnd_props[stream_id]; \
623-
/*props->lock.buf_ev_notity++;*/ \
624-
/*pthread_cond_signal(&props->lock.readable);*/, /* flush queue */ \
625+
props->lock.buf_ev_notity++; \
626+
pthread_cond_signal(&props->lock.readable);, /* flush queue */ \
625627
) \
626628
\
627629
/* Tear down the descriptor list and free space. */ \
@@ -1028,15 +1030,14 @@ static void __virtio_snd_rx_frame_dequeue(void *out,
10281030
uint32_t len =
10291031
left < actual ? left : actual; /* Naive min implementation */
10301032

1031-
memcpy(props->intermediate + written_bytes, node->addr + node->pos,
1033+
memcpy(out + written_bytes, node->addr + node->pos,
10321034
len);
10331035

10341036
written_bytes += len;
10351037
node->pos += len;
10361038
if (node->pos >= node->len)
10371039
list_del(&node->q);
10381040
}
1039-
memcpy(out, props->intermediate, written_bytes);
10401041

10411042
props->lock.buf_ev_notity--;
10421043
pthread_cond_signal(&props->lock.writable);

0 commit comments

Comments
 (0)