Received: from eggs.gnu.org ([2001:4830:134:3::10]:34819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHXmz-0002w0-II for qemu-devel@nongnu.org; Mon, 27 Jun 2016 10:45:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHXmx-0008Ae-Aj for qemu-devel@nongnu.org; Mon, 27 Jun 2016 10:45:28 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHXmx-000844-2H for qemu-devel@nongnu.org; Mon, 27 Jun 2016 10:45:27 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1bHXmj-0005Rz-Re for qemu-devel@nongnu.org; Mon, 27 Jun 2016 15:45:13 +0100 From: Peter Maydell Date: Mon, 27 Jun 2016 15:44:56 +0100 Message-Id: <1467038710-24307-5-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1467038710-24307-1-git-send-email-peter.maydell@linaro.org> References: <1467038710-24307-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 04/18] cadence_gem: Set the last bit when wrap is set List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Alistair Francis The Cadence GEM data sheet says: "Wrap - marks last descriptor in transmit buffer descriptor list. This can be set for any buffer within the frame." which seems to imply that when the wrap bit is set so is the last bit. Previously if the wrap bit is set, but the last is not then QEMU will enter an infinite loop. Signed-off-by: Alistair Francis Reported-by: Li Qiang Reported-by: P J P Message-id: eb23f15c67989ea6a53609dc66568399dadf52a7.1466539342.git.alistair.francis@xilinx.com Signed-off-by: Peter Maydell --- hw/net/cadence_gem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index e5f3c98..8a4be1e 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -274,6 +274,11 @@ static inline unsigned tx_desc_get_last(unsigned *desc) return (desc[1] & DESC_1_TX_LAST) ? 1 : 0; } +static inline void tx_desc_set_last(unsigned *desc) +{ + desc[1] |= DESC_1_TX_LAST; +} + static inline unsigned tx_desc_get_length(unsigned *desc) { return desc[1] & DESC_1_LENGTH; @@ -939,6 +944,7 @@ static void gem_transmit(CadenceGEMState *s) /* read next descriptor */ if (tx_desc_get_wrap(desc)) { + tx_desc_set_last(desc); packet_desc_addr = s->regs[GEM_TXQBASE]; } else { packet_desc_addr += 8; -- 1.9.1