From nobody Fri May 10 18:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561916329; cv=none; d=zoho.com; s=zohoarc; b=M1QMBZRcQwMdPeO/2iL2/DgspWeQzNo6rONBrts6Ag7zpHVnwrbUIm5rrPIbsWTgQG93MVE9ms7RR9awVfHivFXYnQBbEYSGEKARtIxNHFzWCG4WaX5+s+QbsWjtiJwXEzHL0XOu0y4ErWgjq5n+x5xHE8Q8na+HlaV/Hbw+kQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561916329; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=qbz7HjpGO5OHQwtVdJAVnfbjEqL2G8F0It+Y5GJ3zQg=; b=R6RArOVhOMPTVpHPQbEWVRxx78GOQKoIr/Y0NaEPgNABrMpfrf7Q45CfiC18TtXZJBWqG71oFWoCr9Fj+2y53g0w9AMtQAVJSU4oqUguCEA5baKZKKCr8x+Cjkc+9g9VAgMxXKoMBDGFq3EYHp3CZPSSFSSfwGsieN39fdjijZ8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156191632909968.73083531869725; Sun, 30 Jun 2019 10:38:49 -0700 (PDT) Received: from localhost ([::1]:45824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdmo-0004QU-1O for importer@patchew.org; Sun, 30 Jun 2019 13:38:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58347) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdjY-0000R7-Cx for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhdjX-0000YT-9b for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:24 -0400 Received: from mail.ilande.co.uk ([46.43.2.167]:40198 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hhdjX-000826-3v for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:23 -0400 Received: from host109-146-132-17.range109-146.btcentralplus.com ([109.146.132.17] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hhdfr-0001xd-5d for qemu-devel@nongnu.org; Sun, 30 Jun 2019 18:31:35 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org Date: Sun, 30 Jun 2019 18:31:59 +0100 Message-Id: <20190630173203.9620-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> References: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.146.132.17 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.43.2.167 Subject: [Qemu-devel] [PATCH 1/5] sunhme: add trace event for logging PCI IRQ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mark Cave-Ayland --- hw/net/sunhme.c | 2 ++ hw/net/trace-events | 1 + 2 files changed, 3 insertions(+) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index 1ebaee3c82..6d660a8238 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -209,6 +209,8 @@ static void sunhme_update_irq(SunHMEState *s) } =20 level =3D (seb ? 1 : 0); + trace_sunhme_update_irq(mifmask, mif, sebmask, seb, level); + pci_set_irq(d, level); } =20 diff --git a/hw/net/trace-events b/hw/net/trace-events index 3cd9e122df..d16273c579 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -359,6 +359,7 @@ sunhme_rx_filter_reject(void) "rejecting incoming frame" sunhme_rx_filter_accept(void) "accepting incoming frame" sunhme_rx_desc(uint32_t addr, int offset, uint32_t status, int len, int cr= , int nr) "addr 0x%"PRIx32"(+0x%x) status 0x%"PRIx32 " len %d (ring %d/%d)" sunhme_rx_xsum_calc(uint16_t xsum) "calculated incoming xsum as 0x%x" +sunhme_update_irq(uint32_t mifmask, uint32_t mif, uint32_t sebmask, uint32= _t seb, int level) "mifmask: 0x%x mif: 0x%x sebmask: 0x%x seb: 0x%x lev= el: %d" =20 # virtio-net.c virtio_net_announce_notify(void) "" --=20 2.11.0 From nobody Fri May 10 18:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561916223; cv=none; d=zoho.com; s=zohoarc; b=C7CB0uG+GP70Em0+R3DAV8Xj5sQImrdlj3WOfG+cpQIVTaD/LcddpQDfmbDKQV0CeCODK+sLqCH4p2bbE11p9JEgkxHt7He5wcqEhhDa0Uv72t9A6YG17Sj4QTsXYMlpxdXsesb/1D5SPUWiYcamhkxy4clodqwX1hxoQ0GNfjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561916223; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=QUKR91xXP63B9XSiDLa9I/XKo7bdA2stZAaaEysVyeE=; b=KbatI8RdFmt3UFDpjcx6BlwU/1ZTqsQQzMRqGlMd2aIfGOQKlUNmr86Dc6C/4knxBNRPofi5OT347mEqYxDvruDxjru3xRWm6IYgyBBA6J50Is6rzqjlZUKsfvqsxsNXSvM1zbdpXcM/Vrhtdnpk4EysO6cJN6I7S0RvTjZXsOg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156191622360288.00609345336932; Sun, 30 Jun 2019 10:37:03 -0700 (PDT) Received: from localhost ([::1]:45802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdl2-0001iS-Iy for importer@patchew.org; Sun, 30 Jun 2019 13:36:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58311) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdjU-0000LM-73 for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhdjT-0000Tx-81 for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:20 -0400 Received: from mail.ilande.co.uk ([46.43.2.167]:40194 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hhdjT-0007yq-1P for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:19 -0400 Received: from host109-146-132-17.range109-146.btcentralplus.com ([109.146.132.17] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hhdfr-0001xd-Gf for qemu-devel@nongnu.org; Sun, 30 Jun 2019 18:31:35 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org Date: Sun, 30 Jun 2019 18:32:00 +0100 Message-Id: <20190630173203.9620-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> References: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.146.132.17 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.43.2.167 Subject: [Qemu-devel] [PATCH 2/5] sunhme: fix incorrect constant in sunhme_can_receive() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Due to a copy/paste error the wrong register was being checked in order to determine if the NIC is able to receive data. Signed-off-by: Mark Cave-Ayland --- hw/net/sunhme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index 6d660a8238..e3a488ee1d 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -649,7 +649,7 @@ static int sunhme_can_receive(NetClientState *nc) { SunHMEState *s =3D qemu_get_nic_opaque(nc); =20 - return s->macregs[HME_MAC_RXCFG_ENABLE >> 2] & HME_MAC_RXCFG_ENABLE; + return s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_ENABLE; } =20 static void sunhme_link_status_changed(NetClientState *nc) --=20 2.11.0 From nobody Fri May 10 18:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561916218; cv=none; d=zoho.com; s=zohoarc; b=VlIzCA3QwJvixtgS6srC1GJcLVGC79Ti2mTMswKf0P24Rh9dm8nXDGh750zumlFOBEvOsWto+n+ZCPILiiedfjBfUP+gCYz7OAmye6le/iM0PdSml6wbTcMRUGw2lTpLsy96VQNiLKDpNWRi7gUhzmFZrnDGThntG6OVaw/6WvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561916218; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mxT5T8nDkv3quBT6DtI84tLVjV9a8jEOKq7QW+rIGkU=; b=bsIl4+yoWFbvuBOgm5FfknGSNt/DYVhrbPNBvZekmFLJZ43UDVKbdsb833NSLeSpf+ztmloYxtSusHyxetxp+hKPbh2hwH3R9BR8IVVbbYc0rS8aF1h82sbDu9wAOCUN0tDum0U0H77sYgbsgu343ksZuOcOgPtfp9dC5u8RtxM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561916217836633.1845904016724; Sun, 30 Jun 2019 10:36:57 -0700 (PDT) Received: from localhost ([::1]:45800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdl2-0001ha-Dl for importer@patchew.org; Sun, 30 Jun 2019 13:36:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58313) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdjU-0000LN-9l for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhdjT-0000UF-Az for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:20 -0400 Received: from mail.ilande.co.uk ([46.43.2.167]:40190 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hhdjT-0007ys-5Q for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:19 -0400 Received: from host109-146-132-17.range109-146.btcentralplus.com ([109.146.132.17] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hhdfr-0001xd-Ps for qemu-devel@nongnu.org; Sun, 30 Jun 2019 18:31:36 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org Date: Sun, 30 Jun 2019 18:32:01 +0100 Message-Id: <20190630173203.9620-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> References: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.146.132.17 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.43.2.167 Subject: [Qemu-devel] [PATCH 3/5] sunhme: flush any queued packets when HME_MAC_RXCFG_ENABLE bit is raised X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Some client drivers use this bit to pause and resume the driver so make sure that queued packets are flushed when the MAC is disabled and then reactivat= ed. Signed-off-by: Mark Cave-Ayland --- hw/net/sunhme.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index e3a488ee1d..14e7effb88 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -373,10 +373,20 @@ static void sunhme_mac_write(void *opaque, hwaddr add= r, uint64_t val, unsigned size) { SunHMEState *s =3D SUNHME(opaque); + uint64_t oldval =3D s->macregs[addr >> 2]; =20 trace_sunhme_mac_write(addr, val); =20 s->macregs[addr >> 2] =3D val; + + switch (addr) { + case HME_MACI_RXCFG: + if (!(oldval & HME_MAC_RXCFG_ENABLE) && + (val & HME_MAC_RXCFG_ENABLE)) { + qemu_flush_queued_packets(qemu_get_queue(s->nic)); + } + break; + } } =20 static uint64_t sunhme_mac_read(void *opaque, hwaddr addr, --=20 2.11.0 From nobody Fri May 10 18:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561916332; cv=none; d=zoho.com; s=zohoarc; b=UgQWfdnxC8WYt8u29Q8vIhwDrWgVBvxw+f55OdW5k3XtuFy9MVZFjtykgusWqal4Y9DXMRTZzSdBdd7iH5jk6ogl1e5QrKMN8XDYxRSKWFIYyH3DzIs1xuCw8b8HtswpG6ATntgQwnceyGxvh7W4fVjQmcoU+tQEpi1+6xUc8NY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561916332; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ngyPZOptiwmpaW83cKMp+kGgsxAH+VXcnlEaerzHbDM=; b=EE3z7B6upxFX1BGVXnv2f3kSuFsBdBrh2Az4LmJiSePfrY2Z9/GQwkHoVmsGC14JH2nTmP32xbxUcpSc0MqPZbtYs0rvAIR/RLYOvn2qz02H/RIvy/xQThDYIrj9Ao0V0KttjiAKu+vaXT/QCX30blxrCfUmz6jqKNYBI/1xdXU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15619163329361.7952518097273469; Sun, 30 Jun 2019 10:38:52 -0700 (PDT) Received: from localhost ([::1]:45822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdmn-0004QP-Uw for importer@patchew.org; Sun, 30 Jun 2019 13:38:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58378) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdja-0000UF-Dk for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhdjZ-0000ar-Do for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:26 -0400 Received: from mail.ilande.co.uk ([46.43.2.167]:40192 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hhdjZ-0007yr-7Q for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:25 -0400 Received: from host109-146-132-17.range109-146.btcentralplus.com ([109.146.132.17] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hhdfs-0001xd-36 for qemu-devel@nongnu.org; Sun, 30 Jun 2019 18:31:36 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org Date: Sun, 30 Jun 2019 18:32:02 +0100 Message-Id: <20190630173203.9620-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> References: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.146.132.17 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.43.2.167 Subject: [Qemu-devel] [PATCH 4/5] sunhme: fix return values from sunhme_receive() during receive packet processing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The current return values in sunhme_receive() when processing incoming pack= ets are inverted from what they should be. Make sure that we return 0 to indica= te the packet was discarded (and polling is to be disabled) and -1 to indicate that the packet was discarded but polling for incoming data is to be contin= ued. Signed-off-by: Mark Cave-Ayland --- hw/net/sunhme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index 14e7effb88..cd076d642b 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -728,7 +728,7 @@ static ssize_t sunhme_receive(NetClientState *nc, const= uint8_t *buf, =20 /* Do nothing if MAC RX disabled */ if (!(s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_ENABLE)) { - return -1; + return 0; } =20 trace_sunhme_rx_filter_destmac(buf[0], buf[1], buf[2], @@ -757,14 +757,14 @@ static ssize_t sunhme_receive(NetClientState *nc, con= st uint8_t *buf, /* Didn't match hash filter */ trace_sunhme_rx_filter_hash_nomatch(); trace_sunhme_rx_filter_reject(); - return 0; + return -1; } else { trace_sunhme_rx_filter_hash_match(); } } else { /* Not for us */ trace_sunhme_rx_filter_reject(); - return 0; + return -1; } } else { trace_sunhme_rx_filter_promisc_match(); --=20 2.11.0 From nobody Fri May 10 18:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561916328; cv=none; d=zoho.com; s=zohoarc; b=glnzR+zeQ2q2usfpbbsRe9YNDWzUsfJOjIp9bbzVL4G8jGLNd1xi8T6qu2IxBAQuxdKEDV4X9wxhWWrBvXOgiwd8b8zPbXeYsPoAW/VSsVRM7PdHqv93iC0PG/OrV0asKdW2hOgovxogTbouLDnhwH+BpPLdCYF/cp7xyIWcD/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561916328; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4fyFDv5VRcPTs6q1urf6RW0+fGjmYK9lGMRH/ZmzdGY=; b=VOiL3tkdZFPM0krfUG/eLvbvnZ9bKb91VX2ui6YGDQXsmzZW1kSFtiaaLex2+qdm4mdXahNM9SKuTT9k8KloGUgI+oAs+pI/j4XVVcESQQIU64lySfMDjFS6WZlM1HdZaeKnhBeBT+UpcGJ+AZB8AHA8nCmVUj52/q5zZcyNRlI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561916328444238.05205719751314; Sun, 30 Jun 2019 10:38:48 -0700 (PDT) Received: from localhost ([::1]:45820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdmn-0004PX-7u for importer@patchew.org; Sun, 30 Jun 2019 13:38:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58363) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhdjZ-0000Sg-Ht for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhdjY-0000ZV-CS for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:25 -0400 Received: from mail.ilande.co.uk ([46.43.2.167]:40196 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hhdjY-00080J-2g for qemu-devel@nongnu.org; Sun, 30 Jun 2019 13:35:24 -0400 Received: from host109-146-132-17.range109-146.btcentralplus.com ([109.146.132.17] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hhdfs-0001xd-D0 for qemu-devel@nongnu.org; Sun, 30 Jun 2019 18:31:36 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org Date: Sun, 30 Jun 2019 18:32:03 +0100 Message-Id: <20190630173203.9620-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> References: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.146.132.17 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.43.2.167 Subject: [Qemu-devel] [PATCH 5/5] sunhme: ensure that RX descriptor ring overflow is indicated to client driver X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On very busy networks connected via a tap interface, it is possible to over= flow the RX descriptor ring in the time between the client driver enabling the RX MAC and finishing writing the final configuration to the NIC registers. Ensure that we detect this condition and update the status register accordi= ngly to indicate an overflow has occurred (and the incoming packet dropped) in o= rder to prevent the client driver becoming confused. Signed-off-by: Mark Cave-Ayland --- hw/net/sunhme.c | 9 +++++++++ hw/net/trace-events | 1 + 2 files changed, 10 insertions(+) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index cd076d642b..8b8603e696 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -44,6 +44,7 @@ #define HME_SEBI_STAT 0x100 #define HME_SEBI_STAT_LINUXBUG 0x108 #define HME_SEB_STAT_RXTOHOST 0x10000 +#define HME_SEB_STAT_NORXD 0x20000 #define HME_SEB_STAT_MIFIRQ 0x800000 #define HME_SEB_STAT_HOSTTOTX 0x1000000 #define HME_SEB_STAT_TXALL 0x2000000 @@ -787,6 +788,14 @@ static ssize_t sunhme_receive(NetClientState *nc, cons= t uint8_t *buf, pci_dma_read(d, rb + cr * HME_DESC_SIZE, &status, 4); pci_dma_read(d, rb + cr * HME_DESC_SIZE + 4, &buffer, 4); =20 + /* If we don't own the current descriptor then indicate overflow error= */ + if (!(status & HME_XD_OWN)) { + s->sebregs[HME_SEBI_STAT >> 2] |=3D HME_SEB_STAT_NORXD; + sunhme_update_irq(s); + trace_sunhme_rx_norxd(); + return -1; + } + rxoffset =3D (s->erxregs[HME_ERXI_CFG >> 2] & HME_ERX_CFG_BYTEOFFSET) = >> HME_ERX_CFG_BYTEOFFSET_SHIFT; =20 diff --git a/hw/net/trace-events b/hw/net/trace-events index d16273c579..58665655cc 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -359,6 +359,7 @@ sunhme_rx_filter_reject(void) "rejecting incoming frame" sunhme_rx_filter_accept(void) "accepting incoming frame" sunhme_rx_desc(uint32_t addr, int offset, uint32_t status, int len, int cr= , int nr) "addr 0x%"PRIx32"(+0x%x) status 0x%"PRIx32 " len %d (ring %d/%d)" sunhme_rx_xsum_calc(uint16_t xsum) "calculated incoming xsum as 0x%x" +sunhme_rx_norxd(void) "no free rx descriptors available" sunhme_update_irq(uint32_t mifmask, uint32_t mif, uint32_t sebmask, uint32= _t seb, int level) "mifmask: 0x%x mif: 0x%x sebmask: 0x%x seb: 0x%x lev= el: %d" =20 # virtio-net.c --=20 2.11.0