numam-dpdk/lib
Yuanhan Liu b0a985d1f3 vhost: add dequeue zero copy
The basic idea of dequeue zero copy is, instead of copying data from
the desc buf, here we let the mbuf reference the desc buf addr directly.

Doing so, however, has one major issue: we can't update the used ring
at the end of rte_vhost_dequeue_burst. Because we don't do the copy
here, an update of the used ring would let the driver to reclaim the
desc buf. As a result, DPDK might reference a stale memory region.

To update the used ring properly, this patch does several tricks:

- when mbuf references a desc buf, refcnt is added by 1.

  This is to pin lock the mbuf, so that a mbuf free from the DPDK
  won't actually free it, instead, refcnt is subtracted by 1.

- We chain all those mbuf together (by tailq)

  And we check it every time on the rte_vhost_dequeue_burst entrance,
  to see if the mbuf is freed (when refcnt equals to 1). If that
  happens, it means we are the last user of this mbuf and we are
  safe to update the used ring.

- "struct zcopy_mbuf" is introduced, to associate an mbuf with the
  right desc idx.

Dequeue zero copy is introduced for performance reason, and some rough
tests show about 50% perfomance boost for packet size 1500B. For small
packets, (e.g. 64B), it actually slows a bit down (well, it could up to
15%). That is expected because this patch introduces some extra works,
and it outweighs the benefit from saving few bytes copy.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Qian Xu <qian.q.xu@intel.com>
2016-10-12 09:45:14 +02:00
..
librte_acl lib: use C99 syntax for zero-size arrays 2016-09-13 15:35:28 +02:00
librte_cfgfile lib: add missing include dependencies 2016-09-13 15:35:28 +02:00
librte_cmdline lib: add missing include dependencies 2016-09-13 15:35:28 +02:00
librte_compat compat: remove unneeded macro 2015-06-29 16:41:23 +02:00
librte_cryptodev cryptodev: fix build on Suse 11 SP2 2016-10-08 17:54:38 +02:00
librte_distributor distributor: remove inclusion of mbuf header 2015-05-11 15:36:37 +02:00
librte_eal app/test: fix vdev names 2016-10-13 15:55:42 +02:00
librte_ether app/test: fix vdev names 2016-10-13 15:55:42 +02:00
librte_hash hash: fix bucket size usage 2016-10-12 18:40:52 +02:00
librte_ip_frag ip_frag: fix missing dependency on hash library 2016-10-05 15:47:23 +02:00
librte_jobstats jobstats: fix typo in a comment 2016-06-30 18:51:20 +02:00
librte_kni kni: remove continuous memory restriction 2016-09-21 19:18:44 +02:00
librte_kvargs remove unneeded tests for NULL when freeing 2016-01-27 15:34:48 +01:00
librte_lpm lib: add missing include dependencies 2016-09-13 15:35:28 +02:00
librte_mbuf mbuf: add functions to dump offload flags 2016-10-12 18:08:40 +02:00
librte_mempool mempool: fix comments for no contiguous flag 2016-10-04 11:16:01 +02:00
librte_meter meter: fix excess token bucket update in srtcm 2016-09-21 22:56:03 +02:00
librte_net net: get packet type for the first layers only 2016-10-11 18:17:13 +02:00
librte_pdump pdump: fix created directory permissions 2016-10-12 18:40:49 +02:00
librte_pipeline lib: work around unnamed structs/unions 2016-09-13 15:35:28 +02:00
librte_port port: support file descriptor 2016-10-13 11:42:37 +02:00
librte_power examples/vm_power_manager: remove dependency on internal header 2016-07-11 17:23:32 +02:00
librte_reorder lib: add missing include dependencies 2016-09-13 15:35:28 +02:00
librte_ring lib: use C99 syntax for zero-size arrays 2016-09-13 15:35:28 +02:00
librte_sched sched: fix releasing enqueued packets 2016-09-23 21:14:54 +02:00
librte_table table: add cuckoo hash 2016-10-12 22:08:36 +02:00
librte_timer timer: fix lag delay 2016-10-05 12:02:53 +02:00
librte_vhost vhost: add dequeue zero copy 2016-10-12 09:45:14 +02:00
Makefile ivshmem: remove library and its EAL integration 2016-08-23 12:23:58 +02:00