examples/vhost: handle memory hotplug for async vhost
authorCheng Jiang <cheng1.jiang@intel.com>
Fri, 23 Jul 2021 08:09:37 +0000 (08:09 +0000)
committerChenbo Xia <chenbo.xia@intel.com>
Fri, 23 Jul 2021 08:58:53 +0000 (10:58 +0200)
commitb9f23beee0094afb930f3b15c1ac8f2d45b2584f
treed73bdcd70dcc596fd80205bc58ccac815413fab2
parent259caa21d70181d7bc986f9921c813abdac90793
examples/vhost: handle memory hotplug for async vhost

When the guest memory is hotplugged, the vhost application which
enables DMA acceleration must stop DMA transfers before the vhost
re-maps the guest memory.

To accomplish that, we need to do these changes in the vhost sample:
1. add inflight packets count.
2. add vring_state_changed() callback.
3. add inflight packets clear process in destroy_device() and
vring_state_changed().

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
examples/vhost/main.c
examples/vhost/main.h