#
4ecf22e3 |
| 13-Jun-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
vhost: export device id as the interface to applications
With all the previous prepare works, we are just one step away from the final ABI refactoring. That is, to change current API to let them sti
vhost: export device id as the interface to applications
With all the previous prepare works, we are just one step away from the final ABI refactoring. That is, to change current API to let them stick to vid instead of the old virtio_net dev.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Tested-by: Rich Lane <rich.lane@bigswitch.com> Acked-by: Rich Lane <rich.lane@bigswitch.com>
show more ...
|
#
16ae8abe |
| 10-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
vhost: remove dependency on device private field
This change could let us avoid the dependency of "virtio_net" struct, to prepare for the ABI refactoring.
Signed-off-by: Yuanhan Liu <yuanhan.liu@li
vhost: remove dependency on device private field
This change could let us avoid the dependency of "virtio_net" struct, to prepare for the ABI refactoring.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Tested-by: Rich Lane <rich.lane@bigswitch.com> Acked-by: Rich Lane <rich.lane@bigswitch.com>
show more ...
|
#
a67f286a |
| 10-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
vhost: export queue free entries
The new API rte_vhost_avail_entries() is actually a rename of rte_vring_available_entries(), with the "vring" to "vhost" name change to keep the consistency of other
vhost: export queue free entries
The new API rte_vhost_avail_entries() is actually a rename of rte_vring_available_entries(), with the "vring" to "vhost" name change to keep the consistency of other vhost exported APIs.
This change could let us avoid the dependency of "virtio_net" struct, to prepare for the ABI refactoring.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Tested-by: Rich Lane <rich.lane@bigswitch.com> Acked-by: Rich Lane <rich.lane@bigswitch.com>
show more ...
|
#
e2a1dd12 |
| 23-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
vhost: rename device id variable
I failed to figure out what does "fh" mean here for a long while. The only guess I could have had is "file handle". So, you get the point that it's not well named.
vhost: rename device id variable
I failed to figure out what does "fh" mean here for a long while. The only guess I could have had is "file handle". So, you get the point that it's not well named.
I then figured it out that "fh" is derived from the fuse lib, and my above guess is right. However, device_fh represents a virtio net device ID. Therefore, here I rename it to vid (Virtio-net device ID, or Vhost device ID; choose one you prefer) to make it easier for understanding.
This name (vid) then will be considered to the only interface to applications. That's another reason to do the rename: it's our interface, make it more understandable.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Tested-by: Rich Lane <rich.lane@bigswitch.com> Acked-by: Rich Lane <rich.lane@bigswitch.com>
show more ...
|
#
7f262239 |
| 23-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: make a copy of virtio device id
Make a copy of virtio device id (device_fh) from the virtio_net struct, so that we could have less dependency on the virtio_net struct.
Signed-off-by
examples/vhost: make a copy of virtio device id
Make a copy of virtio device id (device_fh) from the virtio_net struct, so that we could have less dependency on the virtio_net struct.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Tested-by: Rich Lane <rich.lane@bigswitch.com> Acked-by: Rich Lane <rich.lane@bigswitch.com>
show more ...
|
#
c08a3490 |
| 29-Apr-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
vhost: declare device id as int
device_fh repsents the device id for a specific virtio net device. Firstly, "int" would be big enough: we don't need 64 bit. Secondly, this could let us avoid the ugl
vhost: declare device id as int
device_fh repsents the device id for a specific virtio net device. Firstly, "int" would be big enough: we don't need 64 bit. Secondly, this could let us avoid the ugly "%" PRIu64 ".." stuff.
And since ctx.fh is derived from device_fh, declare it as int, too.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Tested-by: Rich Lane <rich.lane@bigswitch.com> Acked-by: Rich Lane <rich.lane@bigswitch.com>
show more ...
|
#
550c9d27 |
| 29-Apr-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
vhost: set/reset device flags internally
It does not make sense to ask the application to set/unset the flag VIRTIO_DEV_RUNNING (that used internal only) at new_device()/ destroy_device() callback.
vhost: set/reset device flags internally
It does not make sense to ask the application to set/unset the flag VIRTIO_DEV_RUNNING (that used internal only) at new_device()/ destroy_device() callback.
Instead, it should be set after new_device() succeeds and reset before destroy_device() is invoked inside vhost lib. This patch fixes it.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Tested-by: Rich Lane <rich.lane@bigswitch.com> Acked-by: Rich Lane <rich.lane@bigswitch.com>
show more ...
|
#
97daf19e |
| 07-Jun-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: fix corrupted vdev tailq list
There are two tailq lists, one for logging all vhost devices, another one for logging vhost devices distributed on a specific core. However, there is ju
examples/vhost: fix corrupted vdev tailq list
There are two tailq lists, one for logging all vhost devices, another one for logging vhost devices distributed on a specific core. However, there is just one tailq entry, named "next", to chain the two list, which is wrong and could result to a corrupted tailq list, that the tailq list might always be non-empty: the entry is still there even after you have invoked TAILQ_REMOVE several times.
Fix it by introducing two tailq entries, one for each list.
Fixes: 45657a5c6861 ("examples/vhost: use tailq to link vhost devices")
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
3901ed99 |
| 17-Jun-2016 |
Thomas Monjalon <thomas.monjalon@6wind.com> |
eal: fix thread naming on FreeBSD
rte_thread_setname was a macro defined only for Linux. The function rte_thread_setname() can now be used on FreeBSD as well on Linux. It is required to build librte
eal: fix thread naming on FreeBSD
rte_thread_setname was a macro defined only for Linux. The function rte_thread_setname() can now be used on FreeBSD as well on Linux. It is required to build librte_pdump.
The macro was 0 for old glibc. The function is now returning -1. The related logs are decreased from error to debug level because it is not an important failure, just a debug inconvenience.
Fixes: 278f945402c5 ("pdump: add new library for packet capture")
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: David Marchand <david.marchand@6wind.com>
show more ...
|
#
b4e0f64f |
| 03-May-2016 |
Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it> |
examples: remove useless check of port count
The rte_eth_dev_count() function will never return a value greater than RTE_MAX_ETHPORTS, so that checking is useless.
Signed-off-by: Mauricio Vasquez B
examples: remove useless check of port count
The rte_eth_dev_count() function will never return a value greater than RTE_MAX_ETHPORTS, so that checking is useless.
Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
show more ...
|
#
56fe86f8 |
| 02-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: embed statistics into device structure
Embed dev_statistics into vhost_dev struct, which could clean the code a bit.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
|
#
273ecdbc |
| 02-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: clean switch worker
switch_worker() is the last piece of code that is messy yet it touches virtio/vhost device.
Here do a cleanup, so that we will be less painful for later vhost AB
examples/vhost: clean switch worker
switch_worker() is the last piece of code that is messy yet it touches virtio/vhost device.
Here do a cleanup, so that we will be less painful for later vhost ABI refactoring.
The cleanup is straight forward: break long lines, move some code into functions. The last, comment a bit on switch_worker().
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
bdb19b77 |
| 02-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: fix mbuf allocation failure
It has always been a mystery (at least to me before) that how many mbuf is enough while creating an mbuf pool. While current macro NUM_MBUFS_PER_PORT give
examples/vhost: fix mbuf allocation failure
It has always been a mystery (at least to me before) that how many mbuf is enough while creating an mbuf pool. While current macro NUM_MBUFS_PER_PORT gives your some insights, it's not that accurate: it doesn't consider the case we may receive a big packet, say 64K when TSO is enabled.
We actually have tried to fix it once before, with commit 5499c1fc9baa ("examples/vhost: fix mbuf allocation"), but it just workarounded it by enlarging it a bit so that the case described in the commit log by passes. So, while trying to fix it ultimately, I'm thinking how big is big enough, and what are the factors need consider to figure out a proper value.
Therefore, here you are. I introduced a helper function to create the mbuf pool, and do the "how many mbufs are needed" calculation there. Also, I put detailed comments how that comes, to serve as the guidelines.
Fixes: 9fd72e3cbd29 ("examples/vhost: add virtio offload") Fixes: 5499c1fc9baa ("examples/vhost: fix mbuf allocation")
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
9c5ef512 |
| 02-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: handle broadcast packet
Every time I do a VM2VM iperf test with vhost example, I have to set the arp table manually, as vhost-switch just ignores the broadcast packet, leaving the AR
examples/vhost: handle broadcast packet
Every time I do a VM2VM iperf test with vhost example, I have to set the arp table manually, as vhost-switch just ignores the broadcast packet, leaving the ARP request not served.
Here we do a transmit a broadcast packet (such as ARP request) to every vhost device, as well as the physical port, to fix above arp table issue.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
da9e1583 |
| 02-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: use MAC compare helper
rte_ether.h already provides a helper function to do mac address compare. No need to define our own, use it directly.
Signed-off-by: Yuanhan Liu <yuanhan.liu@
examples/vhost: use MAC compare helper
rte_ether.h already provides a helper function to do mac address compare. No need to define our own, use it directly.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
45657a5c |
| 02-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: use tailq to link vhost devices
To simplify code and logic.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
|
#
7b63233b |
| 02-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: remove unused macro and struct
Interestingly, DESC_PER_CACHELINE has never been used since the introduction of vhost example. Remove it.
vlan_ethhdr struct and VLAN_ETH_HLEN macro r
examples/vhost: remove unused macro and struct
Interestingly, DESC_PER_CACHELINE has never been used since the introduction of vhost example. Remove it.
vlan_ethhdr struct and VLAN_ETH_HLEN macro reference had been removed by commit 4d50b6acbd95 ("examples/vhost: adapt Tx routing to lib"), but had forgot to remove the definition.
Fixes: 4d50b6acbd95 ("examples/vhost: adapt Tx routing to lib")
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
68363d85 |
| 02-May-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: remove the non-working zero copy code
It's reported that it's has not been working for a long while. And due to it's complex, it's better to redesign it than to fix it to make it wor
examples/vhost: remove the non-working zero copy code
It's reported that it's has not been working for a long while. And due to it's complex, it's better to redesign it than to fix it to make it work again.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
1f49ec15 |
| 22-Apr-2016 |
Thomas Monjalon <thomas.monjalon@6wind.com> |
examples: remove useless debug flags
The debug logs must be enabled at compile-time and run-time. There are also some internal flags in some examples to enable the debug logs of the applications. Th
examples: remove useless debug flags
The debug logs must be enabled at compile-time and run-time. There are also some internal flags in some examples to enable the debug logs of the applications. They are now enabled in debug configs and can be disabled thanks to the more generic logtype mechanism: rte_set_log_type(RTE_LOGTYPE_USER1, 0);
Removing these #ifdef allows to test these code branches more easily and avoid dead code pitfalls.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
1a95fe0b |
| 25-Mar-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: fix VLAN tag
While the last arg of virtio_tx_route() asks a vlan tag, we currently feed it with device_fh, which is wrong. Fix it.
Fixes: 4796ad63ba1f ("examples/vhost: import users
examples/vhost: fix VLAN tag
While the last arg of virtio_tx_route() asks a vlan tag, we currently feed it with device_fh, which is wrong. Fix it.
Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application")
Reported-by: Qian Xu <qian.q.xu@intel.com> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
df40169a |
| 25-Mar-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: fix offload settings
Comments for PKT_TX_TCP_SEG at rte_mbuf says that we should only set PKT_TX_IP_CKSUM and reset ip hdr checksum for IPv4:
- if it's IPv4, set the PKT_TX_IP_CKS
examples/vhost: fix offload settings
Comments for PKT_TX_TCP_SEG at rte_mbuf says that we should only set PKT_TX_IP_CKSUM and reset ip hdr checksum for IPv4:
- if it's IPv4, set the PKT_TX_IP_CKSUM flag and write the IP checksum to 0 in the packet
Fixes: 9fd72e3cbd29 ("examples/vhost: add virtio offload")
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
5674dad2 |
| 25-Mar-2016 |
Yuanhan Liu <yuanhan.liu@linux.intel.com> |
examples/vhost: remove unnecessary pseudo checksum calculation
For checksum offloading only case, the TCP/IP stack would have calculated the pseudo checksum. Therefore, we don't need to re-calculate
examples/vhost: remove unnecessary pseudo checksum calculation
For checksum offloading only case, the TCP/IP stack would have calculated the pseudo checksum. Therefore, we don't need to re-calculate it again here; remove it.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
e1c64805 |
| 19-Jan-2016 |
Jianfeng Tan <jianfeng.tan@intel.com> |
examples/vhost: fix out of sequence packets
Issue description: when packets go through vhost example to virtio device and come back to another virtio device or physical NIC, the sequence of packets
examples/vhost: fix out of sequence packets
Issue description: when packets go through vhost example to virtio device and come back to another virtio device or physical NIC, the sequence of packets will be changed.
Reported-by: Thomas Long <thomas.long@intel.com> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|
#
5499c1fc |
| 18-Feb-2016 |
Jianfeng Tan <jianfeng.tan@intel.com> |
examples/vhost: fix mbuf allocation
How to reproduce:
1. Start vhost-switch ./examples/vhost/build/vhost-switch -c 0x3 -n 4 -- -p 1 --stat 0 2. Start VM with a virtio port $ $QEMU -smp cores=2,sock
examples/vhost: fix mbuf allocation
How to reproduce:
1. Start vhost-switch ./examples/vhost/build/vhost-switch -c 0x3 -n 4 -- -p 1 --stat 0 2. Start VM with a virtio port $ $QEMU -smp cores=2,sockets=1 -m 4G -cpu host -enable-kvm \ -chardev socket,id=char1,path=<path to vhost-user socket> \ -device virtio-net-pci,netdev=vhostuser1 \ -netdev vhost-user,id=vhostuser1,chardev=char1 -object memory-backend-file,id=mem,size=4G,mem-path=<hugetlbfs path>,share=on \ -numa node,memdev=mem -mem-prealloc \ -hda <path to VM img> 3. Start l2fwd in VM $ ./examples/l2fwd/build/l2fwd -c 0x1 -n 4 -m 1024 -- -p 0x1 4. Use ixia to inject packets in a small data bit rate.
Error:
vhost-switch keeps printing error message: failed to allocate memory for mbuf.
Root cause:
How many mbufs allocated for a port is calculated by below formula. NUM_MBUFS_PER_PORT = ((MAX_QUEUES*RTE_TEST_RX_DESC_DEFAULT) + \ (num_switching_cores*MAX_PKT_BURST) + \ (num_switching_cores*RTE_TEST_TX_DESC_DEFAULT) +\ (num_switching_cores*MBUF_CACHE_SIZE)) We suppose num_switching_cores is 1 and MBUF_CACHE_SIZE is 128. And when initializing port, master core fills mbuf mempool cache, so there would be some left in that cache, for example 121. So total mbufs which can be used is: (MAX_PKT_BURST + MBUF_CACHE_SIZE - 121) = (32 + 128 - 121) = 39. What makes it worse is that there is a buffer to store mbufs (which will be tx_burst to physical port), if it occupies some mbufs, there will be possible < 32 mbufs left, so vhost dequeue prints out this msg.
In all, it fails to include master core's mbuf mempool cache.
Reported-by: Qian Xu <qian.q.xu@intel.com> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
show more ...
|
#
9fd72e3c |
| 05-Feb-2016 |
Jijiang Liu <jijiang.liu@intel.com> |
examples/vhost: add virtio offload
Change the codes in vhost sample to test virtio offload feature.
These changes include,
1. add two test options: tx-csum and tso.
2. add virtio_tx_offload() fun
examples/vhost: add virtio offload
Change the codes in vhost sample to test virtio offload feature.
These changes include,
1. add two test options: tx-csum and tso.
2. add virtio_tx_offload() function to test vhost TX offload feature for VM to NIC case;
however, for VM to VM case, it doesn't need to call this function, the reason is explained in patch 2.
Signed-off-by: Jijiang Liu <jijiang.liu@intel.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
show more ...
|