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: pgpvXYPZRlhCf.pgp
Description: PGP signature

Reply via email to