From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmZpD-0004b4-BN for qemu-devel@nongnu.org; Tue, 02 Mar 2010 16:40:19 -0500 Received: from [199.232.76.173] (port=37833 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmZpC-0004ah-GZ for qemu-devel@nongnu.org; Tue, 02 Mar 2010 16:40:18 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NmZpA-0004xR-1h for qemu-devel@nongnu.org; Tue, 02 Mar 2010 16:40:18 -0500 Received: from moutng.kundenserver.de ([212.227.17.9]:58034) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NmZp9-0004xN-Ft for qemu-devel@nongnu.org; Tue, 02 Mar 2010 16:40:15 -0500 From: Stefan Weil Date: Tue, 2 Mar 2010 22:37:53 +0100 Message-Id: <1267565880-18382-13-git-send-email-weil@mail.berlios.de> In-Reply-To: <4B7821AC.6080400@mail.berlios.de> References: <4B7821AC.6080400@mail.berlios.de> Subject: [Qemu-devel] [PATCHv3 13/20] eepro100: Support RNR interrupt List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers Cc: mst@redhat.com The RNR interrupt is triggered under these conditions: * the RU is not ready to receive a frame due to missing resources * the RU is ready and a RU abort command was requested Signed-off-by: Stefan Weil --- hw/eepro100.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/eepro100.c b/hw/eepro100.c index 7eaa876..40d8db5 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -120,7 +120,7 @@ #define RU_NOP 0x0000 #define RX_START 0x0001 #define RX_RESUME 0x0002 -#define RX_ABORT 0x0004 +#define RU_ABORT 0x0004 #define RX_ADDR_LOAD 0x0006 #define RX_RESUMENR 0x0007 #define INT_MASK 0x0100 @@ -426,13 +426,11 @@ static void eepro100_fr_interrupt(EEPRO100State * s) eepro100_interrupt(s, 0x40); } -#if 0 static void eepro100_rnr_interrupt(EEPRO100State * s) { /* RU is not ready. */ eepro100_interrupt(s, 0x10); } -#endif static void eepro100_mdi_interrupt(EEPRO100State * s) { @@ -1065,6 +1063,13 @@ static void eepro100_ru_command(EEPRO100State * s, uint8_t val) } set_ru_state(s, ru_ready); break; + case RU_ABORT: + /* RU abort. */ + if (get_ru_state(s) == ru_ready) { + eepro100_rnr_interrupt(s); + } + set_ru_state(s, ru_idle); + break; case RX_ADDR_LOAD: /* Load RU base. */ TRACE(OTHER, logout("val=0x%02x (RU base address)\n", val)); @@ -1747,6 +1752,8 @@ static ssize_t nic_receive(VLANClientState *nc, const uint8_t * buf, size_t size if (get_ru_state(s) != ru_ready) { /* No resources available. */ logout("no resources, state=%u\n", get_ru_state(s)); + /* TODO: RNR interrupt only at first failed frame? */ + eepro100_rnr_interrupt(s); s->statistics.rx_resource_errors++; //~ assert(!"no resources"); return -1; -- 1.7.0