提交 f3734319 编写于 作者: J Jan Kiszka

slirp: Remove unneeded if_queued

There is now a trivial check on entry of if_start for pending packets,
so we can drop the additional tracking via if_queued.
Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
上级 e3078bf4
...@@ -110,8 +110,6 @@ if_output(struct socket *so, struct mbuf *ifm) ...@@ -110,8 +110,6 @@ if_output(struct socket *so, struct mbuf *ifm)
insque(ifm, ifq); insque(ifm, ifq);
diddit: diddit:
slirp->if_queued++;
if (so) { if (so) {
/* Update *_queued */ /* Update *_queued */
so->so_queued++; so->so_queued++;
...@@ -157,7 +155,6 @@ diddit: ...@@ -157,7 +155,6 @@ diddit:
void if_start(Slirp *slirp) void if_start(Slirp *slirp)
{ {
uint64_t now = qemu_get_clock_ns(rt_clock); uint64_t now = qemu_get_clock_ns(rt_clock);
int requeued = 0;
bool from_batchq, next_from_batchq; bool from_batchq, next_from_batchq;
struct mbuf *ifm, *ifm_next, *ifqt; struct mbuf *ifm, *ifm_next, *ifqt;
...@@ -182,8 +179,7 @@ void if_start(Slirp *slirp) ...@@ -182,8 +179,7 @@ void if_start(Slirp *slirp)
while (ifm_next) { while (ifm_next) {
/* check if we can really output */ /* check if we can really output */
if (!slirp_can_output(slirp->opaque)) { if (!slirp_can_output(slirp->opaque)) {
slirp->if_start_busy = false; break;
return;
} }
ifm = ifm_next; ifm = ifm_next;
...@@ -200,12 +196,9 @@ void if_start(Slirp *slirp) ...@@ -200,12 +196,9 @@ void if_start(Slirp *slirp)
ifm_next = NULL; ifm_next = NULL;
} }
slirp->if_queued--;
/* Try to send packet unless it already expired */ /* Try to send packet unless it already expired */
if (ifm->expiration_date >= now && !if_encap(slirp, ifm)) { if (ifm->expiration_date >= now && !if_encap(slirp, ifm)) {
/* Packet is delayed due to pending ARP resolution */ /* Packet is delayed due to pending ARP resolution */
requeued++;
continue; continue;
} }
...@@ -245,7 +238,5 @@ void if_start(Slirp *slirp) ...@@ -245,7 +238,5 @@ void if_start(Slirp *slirp)
m_free(ifm); m_free(ifm);
} }
slirp->if_queued = requeued;
slirp->if_start_busy = false; slirp->if_start_busy = false;
} }
...@@ -581,13 +581,8 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, ...@@ -581,13 +581,8 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
} }
} }
/*
* See if we can start outputting
*/
if (slirp->if_queued) {
if_start(slirp); if_start(slirp);
} }
}
/* clear global file descriptor sets. /* clear global file descriptor sets.
* these reside on the stack in vl.c * these reside on the stack in vl.c
......
...@@ -235,7 +235,6 @@ struct Slirp { ...@@ -235,7 +235,6 @@ struct Slirp {
int mbuf_alloced; int mbuf_alloced;
/* if states */ /* if states */
int if_queued; /* number of packets queued so far */
struct mbuf if_fastq; /* fast queue (for interactive data) */ struct mbuf if_fastq; /* fast queue (for interactive data) */
struct mbuf if_batchq; /* queue for non-interactive data */ struct mbuf if_batchq; /* queue for non-interactive data */
struct mbuf *next_m; /* pointer to next mbuf to output */ struct mbuf *next_m; /* pointer to next mbuf to output */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册