mirror of https://github.com/xemu-project/xemu.git
vhost-user: Refactor vhost acked features saving
Abstract vhost acked features saving into vhost_user_save_acked_features, export it as util function. Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn> Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn> Message-Id: <50dc9b09b0635e3052551efcc1046c2a85332fcb.1671627406.git.huangy81@chinatelecom.cn> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
5795702a85
commit
937b7d96e4
|
@ -14,5 +14,6 @@
|
||||||
struct vhost_net;
|
struct vhost_net;
|
||||||
struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc);
|
struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc);
|
||||||
uint64_t vhost_user_get_acked_features(NetClientState *nc);
|
uint64_t vhost_user_get_acked_features(NetClientState *nc);
|
||||||
|
void vhost_user_save_acked_features(NetClientState *nc);
|
||||||
|
|
||||||
#endif /* VHOST_USER_H */
|
#endif /* VHOST_USER_H */
|
||||||
|
|
|
@ -45,10 +45,23 @@ uint64_t vhost_user_get_acked_features(NetClientState *nc)
|
||||||
return s->acked_features;
|
return s->acked_features;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vhost_user_stop(int queues, NetClientState *ncs[])
|
void vhost_user_save_acked_features(NetClientState *nc)
|
||||||
{
|
{
|
||||||
NetVhostUserState *s;
|
NetVhostUserState *s;
|
||||||
|
|
||||||
|
s = DO_UPCAST(NetVhostUserState, nc, nc);
|
||||||
|
if (s->vhost_net) {
|
||||||
|
uint64_t features = vhost_net_get_acked_features(s->vhost_net);
|
||||||
|
if (features) {
|
||||||
|
s->acked_features = features;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vhost_user_stop(int queues, NetClientState *ncs[])
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
NetVhostUserState *s;
|
||||||
|
|
||||||
for (i = 0; i < queues; i++) {
|
for (i = 0; i < queues; i++) {
|
||||||
assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER);
|
assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER);
|
||||||
|
@ -56,11 +69,7 @@ static void vhost_user_stop(int queues, NetClientState *ncs[])
|
||||||
s = DO_UPCAST(NetVhostUserState, nc, ncs[i]);
|
s = DO_UPCAST(NetVhostUserState, nc, ncs[i]);
|
||||||
|
|
||||||
if (s->vhost_net) {
|
if (s->vhost_net) {
|
||||||
/* save acked features */
|
vhost_user_save_acked_features(ncs[i]);
|
||||||
uint64_t features = vhost_net_get_acked_features(s->vhost_net);
|
|
||||||
if (features) {
|
|
||||||
s->acked_features = features;
|
|
||||||
}
|
|
||||||
vhost_net_cleanup(s->vhost_net);
|
vhost_net_cleanup(s->vhost_net);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue