On Mon, Dec 2, 2013 at 10:12 PM, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 2 December 2013 07:11, Peter Crosthwaite > <peter.crosthwa...@xilinx.com> wrote: >> There was a replication of the rx descriptor address walking logic. >> Reorder the flow control to remove. This refactoring also obsoletes >> the local variables packet_desc_addr and last_desc_addr. >> >> Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com> >> --- >> >> hw/net/cadence_gem.c | 39 ++++++++++----------------------------- >> 1 file changed, 10 insertions(+), 29 deletions(-) >> >> diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c >> index 3f30caf..73ac0d8 100644 >> --- a/hw/net/cadence_gem.c >> +++ b/hw/net/cadence_gem.c >> @@ -586,7 +586,6 @@ static int gem_mac_address_filter(GemState *s, const >> uint8_t *packet) >> static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t >> size) >> { >> unsigned desc[2]; >> - hwaddr packet_desc_addr, last_desc_addr; >> GemState *s; >> unsigned rxbufsize, bytes_to_copy; >> unsigned rxbuf_offset; >> @@ -667,17 +666,16 @@ static ssize_t gem_receive(NetClientState *nc, const >> uint8_t *buf, size_t size) >> >> DB_PRINT("config bufsize: %d packet size: %ld\n", rxbufsize, size); >> >> - packet_desc_addr = s->rx_desc_addr; >> - while (1) { >> - DB_PRINT("read descriptor 0x%x\n", (unsigned)packet_desc_addr); >> + while (bytes_to_copy) { >> + DB_PRINT("read descriptor 0x%x\n", (unsigned)s->rx_desc_addr); > > Can we get here with bytes_to_copy == 0 ? The logic sets size to a minimum > of 64 bytes but we've already set up bytes_to_copy before that. >
Should we be able to get here? Wouldn't that means you are trying to recieve a length 0 packet? Could just convert to do loop to receive a length 0 packet when gem_recieve is called with size = 0. Regards, Peter > -- PMM >