qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ne2000: Drop ne2000_can_receive


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] ne2000: Drop ne2000_can_receive
Date: Thu, 2 Jul 2015 14:41:30 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jul 01, 2015 at 01:25:05PM +0800, Fam Zheng wrote:
> ne2000_receive already checks the same conditions and drops the packet
> if it's not ready, removing the .can_receive callback avoids the
> necessity to add explicit flushes when the conditions turn true (which
> is required by the new semantics of .can_receive since 6e99c63
> "net/socket: Drop net_socket_can_send").
> 
> Plus the "return 1" if E8390_STOP is also suspicious.

I think that is actually correct behavior.  It says we want to discard
packets instead of queuing them if the NIC is stopped.

This patch is incomplete.  Previously the NIC never woke up after
ne2000_buffer_full() transitioned false -> true.  Now the NIC never
queues packets anymore.

ne2000_receive() needs to be changed to:

  if (s->cmd & E8390_STOP) {
      return -1;
  }
  if (ne2000_buffer_full(s)) {
      return 0;
  }

This moves the old .can_receive() behavior into .receive().

Flush calls need to be added to each of the locations where
ne2000_buffer_full() transitions from true -> false.

Attachment: pgpYj7Rnd2QR5.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]