From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0FPj-0007zr-Q2 for qemu-devel@nongnu.org; Wed, 03 Jun 2015 16:37:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0FPg-0002lB-EO for qemu-devel@nongnu.org; Wed, 03 Jun 2015 16:37:27 -0400 Received: from smtp2-g21.free.fr ([2a01:e0c:1:1599::11]:3643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0FPg-0002kH-8o for qemu-devel@nongnu.org; Wed, 03 Jun 2015 16:37:24 -0400 Message-ID: <556F64AF.5050000@reactos.org> Date: Wed, 03 Jun 2015 22:33:51 +0200 From: =?ISO-8859-15?Q?Herv=E9_Poussineau?= MIME-Version: 1.0 References: <1432729200-5322-1-git-send-email-hpoussin@reactos.org> <1432729200-5322-17-git-send-email-hpoussin@reactos.org> <20150602110533.GP26298@aurel32.net> In-Reply-To: <20150602110533.GP26298@aurel32.net> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 16/17] net/dp8393x: repair can_receive() method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Leon Alrae Le 02/06/2015 13:05, Aurelien Jarno a =E9crit : > On 2015-05-27 14:19, Herv=E9 Poussineau wrote: >> Datasheet clearly says that RXDIS flag prevents reception, but says >> nothing about a required presence of RXEN flag. >> >> While at it, fix the style of the following if statement. >> >> Signed-off-by: Herv=E9 Poussineau >> --- >> hw/net/dp8393x.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c >> index 95a4d3d..b81036a 100644 >> --- a/hw/net/dp8393x.c >> +++ b/hw/net/dp8393x.c >> @@ -622,10 +622,12 @@ static int dp8393x_can_receive(NetClientState *n= c) >> { >> dp8393xState *s =3D qemu_get_nic_opaque(nc); >> >> - if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN)) >> + if (s->regs[SONIC_CR] & SONIC_CR_RXDIS) { >> return 0; >> - if (s->regs[SONIC_ISR] & SONIC_ISR_RBE) >> + } >> + if (s->regs[SONIC_ISR] & SONIC_ISR_RBE) { >> return 0; >> + } >> return 1; >> } > > I don't have the datasheet at hand, but what would be the point of such > a RXEN flag if it is ignored? Are you sure it's not because it's enable= d > by default? > After double checking the datasheet: - RXEN "enables the receive buffer management [...]. Setting this bit res= ets the RXDIS bit" - "Setting [RXDIS] disables the receiver from buffering data to memory or= the Receive FIFO. [...] The RXEN bit is reset when the receiver is disab= led." So RXEN and RXDIS are mutually exclusive, except in transition phases whe= n a packet is currently received and you're setting RXEN/RXDIS. As QEMU doesn't emulate the period of reception of a packet (packet is re= ceived at once), both flag checks are equivalent. So, I'll withdraw this patch in v3. Herv=E9