Skip to content

Commit aa3812f

Browse files
committed
Addressed copilot's review. Improved VDE RX
1 parent 6718f0e commit aa3812f

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define MAX_TCPSOCKETS 4
1212
#define MAX_UDPSOCKETS 2
1313
#define MAX_ICMPSOCKETS 2
14-
#define RXBUF_SIZE (64 * 1024)
14+
#define RXBUF_SIZE (20 * 1024)
1515
#define TXBUF_SIZE (32 * 1024)
1616

1717
#ifndef WOLFIP_POSIX_TCPDUMP

src/port/posix/bsd_socket.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,9 @@ void poller_callback(int fd, uint16_t event, void *arg)
945945
wr = write(entry->pipe_write, &c, 1);
946946
}
947947
if (wr < 0 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) {
948+
/* Best-effort wakeup only: close/teardown races can invalidate the
949+
* pipe while callbacks are still in flight, so hard errors are
950+
* intentionally ignored here. */
948951
}
949952
}
950953

src/port/vde2/vde_device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ static int vde_poll(struct wolfIP_ll_dev *ll, void *buf, uint32_t len)
6262
pfd.fd = vde_datafd(vde_conn);
6363
pfd.events = POLLIN;
6464

65-
/* Poll with short timeout (2ms, same as TAP driver) */
66-
ret = poll(&pfd, 1, 2);
65+
/* Keep ll polling non-blocking to avoid adding per-call sleep latency. */
66+
ret = poll(&pfd, 1, 0);
6767
if (ret < 0) {
6868
perror("vde_poll: poll");
6969
return -1;

src/wolfip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ static int fifo_push(struct fifo *f, void *data, uint32_t len)
274274
memset(&desc, 0, sizeof(struct pkt_desc));
275275
/* Ensure 4-byte alignment in the buffer */
276276
head = fifo_align_head_pos(head, f->size);
277-
if (head == tail && h_wrap == 0)
278-
h_wrap = 0;
279277
{
280278
uint32_t space;
281279
if (head == tail && h_wrap == 0)

0 commit comments

Comments
 (0)