vhost: read last used index once
authorBalazs Nemeth <bnemeth@redhat.com>
Wed, 28 Apr 2021 02:17:31 +0000 (10:17 +0800)
committerChenbo Xia <chenbo.xia@intel.com>
Wed, 28 Apr 2021 02:21:37 +0000 (04:21 +0200)
commitd18db8049c7c52fe91058c125c7a59c8c2f9cb42
tree1d3b0a64769ccc31af8233b04d529e8fc3df1605
parent895f409c4aa872abefc73a5d280af3b2262207bb
vhost: read last used index once

Instead of calculating the address of a packed descriptor based on the
vq->desc_packed and vq->last_used_idx every time, store that base
address in desc_base. On arm, this saves 176 bytes in code size of
function in which vhost_flush_enqueue_batch_packed gets inlined.

Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/vhost/virtio_net.c