vhost: merge sync and async mbuf to descriptor filling
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 26 Oct 2021 16:29:03 +0000 (18:29 +0200)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Fri, 29 Oct 2021 10:32:30 +0000 (12:32 +0200)
commit816a565bf3df3a7f1939bbc161d100c76fad70e4
tree8666f050d166843d94230df5b1ae2da0a828f7b7
parentb84e85e3b1b97c01891a334d25639439de87f015
vhost: merge sync and async mbuf to descriptor filling

This patches merges copy_mbuf_to_desc() used by the sync
path with async_mbuf_to_desc() used by the async path.

Most of these complex functions are identical, so merging
them will make the maintenance easier.

In order not to degrade performance, the patch introduces
a boolean function parameter to specify whether it is called
in async context. This boolean is statically passed to this
always-inlined function, so the compiler will optimize this
out.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
lib/vhost/virtio_net.c