net: prevent sending packets while guest is stopped

Do not modify guest memory or devices when the guest is stopped.
Currently the netdevs still send packets while the guest is stopped if
their file descriptor was being monitored for write (e.g. the socket
write buffer filled before the guest was stopped).

Netdevs call qemu_flush_queued_packets() when the file descriptor
becomes writable again.  Don't resume packet processing when this
happens.

Instead we flush queues when the guest resumes.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
virtio-net: don't run bh on vm stopped

commit 783e7706937fe15523b609b545587a028a2bdd03
    virtio-net: stop/start bh when appropriate

is incomplete: BH might execute within the same main loop iteration but
after vmstop, so in theory, we might trigger an assertion.
I was unable to reproduce this in practice,
but it seems clear enough that the potential is there, so worth fixing.

Cc: qemu-stable@nongnu.org
Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>