[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.4 08/12] milkymist-minimac2: Flush queued
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH for-2.4 08/12] milkymist-minimac2: Flush queued packets when link comes up |
Date: |
Tue, 14 Jul 2015 19:07:34 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, 07/14 13:02, Michael Walle wrote:
> Am 2015-07-14 09:53, schrieb Fam Zheng:
> >Drop .can_receive and move the semantics into minimac2_rx, by returning
> >0.
> >
> >That is once minimac2_rx returns 0, incoming packets will be queued
> >until the queue is explicitly flushed. We do this when s->regs[R_STATE0]
> >or s->regs[R_STATE1] is changed in minimac2_write.
> >
> >Signed-off-by: Fam Zheng <address@hidden>
> >---
> > hw/net/milkymist-minimac2.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> >diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
> >index f06afaa..cd38a06 100644
> >--- a/hw/net/milkymist-minimac2.c
> >+++ b/hw/net/milkymist-minimac2.c
> >@@ -303,8 +303,7 @@ static ssize_t minimac2_rx(NetClientState *nc,
> >const uint8_t *buf, size_t size)
> > r_state = R_STATE1;
> > rx_buf = s->rx1_buf;
> > } else {
> >- trace_milkymist_minimac2_drop_rx_frame(buf);
> >- return size;
> >+ return 0;
>
> trace removed?
Because the frame is no longer dropped as we return 0 - it is queued and will
be sent again when we do qemu_flush_queued_packets later. Should I rename the
trace point?
Fam
>
> > }
> >
> > /* assemble frame */
> >@@ -354,6 +353,7 @@ minimac2_read(void *opaque, hwaddr addr, unsigned
> >size)
> > return r;
> > }
> >
> >+static int minimac2_can_rx(MilkymistMinimac2State *s);
> > static void
> > minimac2_write(void *opaque, hwaddr addr, uint64_t value,
> > unsigned size)
> >@@ -387,6 +387,9 @@ minimac2_write(void *opaque, hwaddr addr, uint64_t
> >value,
> > case R_STATE1:
> > s->regs[addr] = value;
> > update_rx_interrupt(s);
> >+ if (minimac2_can_rx(s)) {
> >+ qemu_flush_queued_packets(qemu_get_queue(s->nic));
> >+ }
> > break;
> > case R_SETUP:
> > case R_COUNT0:
> >@@ -411,10 +414,8 @@ static const MemoryRegionOps minimac2_ops = {
> > .endianness = DEVICE_NATIVE_ENDIAN,
> > };
> >
> >-static int minimac2_can_rx(NetClientState *nc)
> >+static int minimac2_can_rx(MilkymistMinimac2State *s)
> > {
> >- MilkymistMinimac2State *s = qemu_get_nic_opaque(nc);
> >-
> > if (s->regs[R_STATE0] == STATE_LOADED) {
> > return 1;
> > }
>
> please move this above the minimac2_write call, so the forward declaration
> isn't necessary anymore.
>
>
>
> -michael
>
- Re: [Qemu-devel] [PATCH for-2.4 06/12] etsec: Flush queue when rx buffer is consumed, (continued)
[Qemu-devel] [PATCH for-2.4 07/12] mcf_fec: Drop mcf_fec_can_receive, Fam Zheng, 2015/07/14
[Qemu-devel] [PATCH for-2.4 09/12] mipsnet: Flush queued packets when receiving is enabled, Fam Zheng, 2015/07/14
[Qemu-devel] [PATCH for-2.4 10/12] stellaris_enet: Flush queued packets when read done, Fam Zheng, 2015/07/14
[Qemu-devel] [PATCH for-2.4 11/12] dp8393x: Flush packets when link comes up, Fam Zheng, 2015/07/14
[Qemu-devel] [PATCH for-2.4 12/12] axienet: Flush queued packets when rx is done, Fam Zheng, 2015/07/14
[Qemu-devel] [PATCH for-2.4 08/12] milkymist-minimac2: Flush queued packets when link comes up, Fam Zheng, 2015/07/14
Re: [Qemu-devel] [PATCH for-2.4 00/12] hw/net: Fix .can_receive() for NICs, Wen Congyang, 2015/07/14
Re: [Qemu-devel] [PATCH for-2.4 00/12] hw/net: Fix .can_receive() for NICs, Stefan Hajnoczi, 2015/07/14