From nobody Wed Dec 17 21:59:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492706739842162.31243619188842; Thu, 20 Apr 2017 09:45:39 -0700 (PDT) Received: from localhost ([::1]:55067 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1FD8-0003az-9u for importer@patchew.org; Thu, 20 Apr 2017 12:45:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1F92-0008PT-I0 for qemu-devel@nongnu.org; Thu, 20 Apr 2017 12:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1F90-00087n-WE for qemu-devel@nongnu.org; Thu, 20 Apr 2017 12:41:24 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:36886) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d1F90-00084S-OF for qemu-devel@nongnu.org; Thu, 20 Apr 2017 12:41:22 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1d1F8v-0006wP-6V for qemu-devel@nongnu.org; Thu, 20 Apr 2017 17:41:17 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 20 Apr 2017 17:40:58 +0100 Message-Id: <1492706470-10921-13-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492706470-10921-1-git-send-email-peter.maydell@linaro.org> References: <1492706470-10921-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 12/24] cadence_gem: Correct the multi-queue can rx logic X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Correct the buffer descriptor busy logic to work correctly when using multiple queues. Signed-off-by: Alistair Francis Message-id: 8a7e8059984e27d46a276a66299d035a0afd280f.1491947224.git.alistai= r.francis@xilinx.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- hw/net/cadence_gem.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index 17c229d..a66a9cc 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -481,14 +481,17 @@ static int gem_can_receive(NetClientState *nc) } =20 for (i =3D 0; i < s->num_priority_queues; i++) { - if (rx_desc_get_ownership(s->rx_desc[i]) =3D=3D 1) { - if (s->can_rx_state !=3D 2) { - s->can_rx_state =3D 2; - DB_PRINT("can't receive - busy buffer descriptor (q%d) 0x%= x\n", - i, s->rx_desc_addr[i]); - } - return 0; + if (rx_desc_get_ownership(s->rx_desc[i]) !=3D 1) { + break; + } + }; + + if (i =3D=3D s->num_priority_queues) { + if (s->can_rx_state !=3D 2) { + s->can_rx_state =3D 2; + DB_PRINT("can't receive - all the buffer descriptors are busy\= n"); } + return 0; } =20 if (s->can_rx_state !=3D 0) { --=20 2.7.4