On 2/5/2023 2:00 AM, Michael S. Tsirkin wrote:
On Sat, Feb 04, 2023 at 03:04:02AM -0800, Si-Wei Liu wrote:
For network hardware device, I thought suspend
just needs to wait until the completion of ongoing Tx/Rx DMA transaction
already in the flight, rather than to drain all the upcoming packets until
avail_idx.
It depends I guess but if device expects to recover all state from just
ring state in memory then at least it has to drain until some index
value.
Yes, that's the general requirement for other devices than networking
device. For e.g., if a storage device had posted request before
suspending and there's no way to replay those requests from destination,
it needs to drain until all posted requests are completed. For network
device, this requirement can be lifted up somehow, as network (Ethernet)
usually is tolerant to packet drops. Jason and I once had a long
discussion about the expectation for {get,set}_vq_state() driver API and
we came to conclusion that this is something networking device can stand
up to:
https://lore.kernel.org/lkml/b2d18964-8cd6-6bb1-1995-5b9662070...@redhat.com/
-Siwei