summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio
AgeCommit message (Collapse)AuthorFilesLines
2022-09-16virtio: add support for per queue packet counterMohsin Kazmi5-0/+28
Type: improvement Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I21a701a556b88a9d81f0e074a59fa34b3746b1d9
2022-08-31gso: zero-initialize gho structVladislav Grishenko1-0/+1
It may contain garbage in debug builds resulting in wrong gho detected flags and offsets. Type: fix Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: Ia79633262185016f527e7dc6c67334cda6f055f2
2022-05-20virtio: use the internal hdr offsets of buffer metadata for offloadsMohsin Kazmi2-39/+23
Type: improvement Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: Ie63c360f2e42e9e5799f5c536453823ea95ed3b8
2022-05-19api: refactor api data storageDamjan Marion1-2/+2
single struct to hold all api handler, flags, etc. Provide functions to toggle flags instead of writing directly to internal data. Type: refactor Change-Id: I4730d7290e57489de8eda34a72211527e015b721 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-05-09vhost: memory leak upon deleting vhost-user interfaceSteven Luong1-3/+1
We allocate vring_spinlock for all vrings in the vui, not just the ones being used. So when we free the vui, we have to free vring_spinlock for all vrings, not just the one being used. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I3951fda71ce6e11474b04302116ea9e08b404758
2022-05-04vhost: use_custom_mac set in create_vhost_user_if_v2Fahad Naeem1-0/+1
Type: fix set use_custom_mac for args in create_vhost_user_if_v2 API Add testcase for custom mac-address Signed-off-by: Fahad Naeem <fahadnaeemkhan@gmail.com> Change-Id: Iac64d818e0f1e6d36187fe769ee33d202aaafd05 Signed-off-by: Fahad Naeem <fahadnaeemkhan@gmail.com>
2022-03-01virtio: refactor codeMohsin Kazmi18-349/+345
Type: refactor Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I3788cc857023fafcc8eb6d6ff4524425026a75d8
2022-02-15tcp: Do not include the tcp_packet.h file in the ip4_packet.hNeale Ranns3-0/+3
Type: refactor IP4 does not depend on TCP (it's the other way around). This upside down dependency leads to some nasty circular includes when trying to use ip46_address.h in interface.h Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I4a1bd21543b08b9c1cf1e5563da738414734a878
2022-02-01virtio: coverity woes -- divide by zeroSteven Luong1-0/+7
Coverity complains the expression, j % vif->num_txq, may encounter divide by zero. While there is little chance that vif->num_txq is zero, it is easy to prevent divide by zero if vif->num_txq is ever zero. Type: fix Fixes: I337ec63d0868f665329d68eadf1744e080b73a0d Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I2e91f296737ce266ab70fffc1f442cc600724fa2
2022-01-18virtio: remove admin-up flag during interface creationMohsin Kazmi1-3/+0
Type: fix During the interface creation time, (by default) admin-up flag is locally set for tap and virtio interfaces. While, in VPP the state of these interfaces are still admin-down. User needs to explicitly call 'set interface state <interface-name> up' to admin-up the newly created tap or virtio interface(s) in VPP. So, this behavior is inconsistent. This patch fixes the issue to have consistent behavior for given interface between local and global administration state. Change-Id: Ifd8904a09fbdbe7b386874ac3231dc0527064518 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2022-01-10interface: refactor interface capabilities code, part 2Damjan Marion2-18/+22
Type: improvement Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: Ie595e69af8657b0ee18a84ac71c5d433108d9ef8
2022-01-07ethernet: new interface registration functionDamjan Marion2-22/+11
Prep for supporting multiple callbacks, optional args, etc. Type: improvement Change-Id: I96244c098712e8213374678623f12527b0e7f387 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-01-05interface: refactor interface capabilities codeDamjan Marion3-17/+15
Make it shorter to type, easier to debug, make adding callbacks in future simpler. Type: improvement Change-Id: I6cdd6375e36da23bd452a7c7273ff42789e94433 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-12-14virtio: integrate with new tx infraMohsin Kazmi7-53/+233
Type: improvement Change-Id: I337ec63d0868f665329d68eadf1744e080b73a0d Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-11-12virtio: improve the inline of clib_memcpy_fastMohsin Kazmi1-1/+1
Type: refactor Change-Id: Ia13a9cf6480aac280f3d287c59908e84c29c3443 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-11-05virtio: fix the initializationMohsin Kazmi1-1/+1
Type: fix Fixes: d96b28ac0917 ("virtio: improve input node performance") vlib_buffer_t is defined on stack to be used for input feature arc lookup once per frame call for performance reasons. The definition is missing the initialization to avoid the assignment of garbage value. Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: Ie7930186bbd8240c44d257808ebd31e06e854b29
2021-10-06docs: vnet comment nitfixesNathan Skrzypczak1-31/+37
Type: improvement Change-Id: Iac01d7830b53819ace8f199554be10ab89ecdb97 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-10-04virtio: remove control queue support from virtio_show() for tap/tunMohsin Kazmi1-6/+0
Type: fix Tap/Tun interfaces do not have control queue. This patch removes the support of control queue from virtio_show() which is used by show tap/tun cli. Change-Id: Ib89144ad488ed548fb1ce50ee232a1b8659ccf29 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-10-01devices: add support for pseudo header checksumMohsin Kazmi2-11/+49
Type: improvement Linux uses pseudo header checksum when checksum of l4 is offloaded. This patch adds similar support in virtual interfaces. Change-Id: I6a94d1104e59356f95057e7c122e3be9cd8659a3 Signed-off-by: Aloys Augustin <aloaugus@cisco.com> Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-09-27virtio: Still init unused txqNathan Skrzypczak1-17/+0
Type: fix For some virtio backends, packets don't seem to flow if all the queues that have been requested are not initialized Change-Id: I41765d668497ff954e6d69d36836590947fd93b1 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-09-22virtio: fix the type of argument in virtio_show()Mohsin Kazmi2-7/+8
Type: fix virtio have three different interfaces (tap, tun and native virtio). virtio_show() is used by CLI commands to show information about these interfaces. It uses interface type to print interface specific information. virtio_show() should use proper type for virtio interfaces (TAP, TUN, VIRTIO). Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I2043dc2cfe2e2f6c7c9348b8494aa4a27cab31f3
2021-08-26vhost: migrate to new TX infraSteven Luong3-88/+67
Take advantage of the new TX infra and support manual thread placement Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Id8023846a2eb59125fcf2f80f4f11eb681cf14dc
2021-08-20vlib: add format_vnet_buffer_no_chainBenoît Ganne1-3/+2
- add format_vnet_buffer and format_vnet_buffer_no_chain to mirror format_vlib_buffer and format_vlib_buffer_no_chain - format_vnet_buffer used to be the "no chain" version, replace all of its current use with the corresponding format_vnet_buffer_no_chain - add a function to dump vnet buffer details from gdb Type: improvement Change-Id: I143ce845f80e7ef937ea33a557b6e3b5988c5b8f Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-08-18vhost: interrupt mode support with mqSteven Luong3-138/+209
vhost interrupt mode support with mq does not work when coalesce frame is not configured to 0. When packed-ring is configured, we were also setting the wrong flag for want-interrupt. No need to trigger an interrupt to RX infra if there is at least one queue in the same thread that is doing polling. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I8e64250f2aa6bf611a777a53e4d2c1076d83305f
2021-07-15misc: replace CLIB_PREFETCH with clib_prefetch_{load,store}Damjan Marion2-14/+14
Type: refactor Change-Id: Id10cbf52e8f2dd809080a228d8fa282308be84ac Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-06-23virtio: api cleanupFilip Tehlar2-49/+13
Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I4f9316b16f16a48e2042aa17db596bfd181bd314
2021-06-22virtio: api cleanupFilip Tehlar1-54/+9
Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I047310b8c9fcc51dcfb187710ff59b7895abe217
2021-06-07pg: Reduce the inclusion of pg.hNeale Ranns1-0/+3
Type: style reduce the number of files recompiled after changing pg.h from 1110 to 102. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I50611eba818eeb3a2dffd437a3c72c77766bed80
2021-05-17virtio: add the checks for descriptors chain lenMohsin Kazmi1-0/+23
Type: fix virtio uses indirect descriptors for chain buffers. indirect descriptor chain is mapped on a vlib_buffer_t. Single descriptor is 16 bytes and vlib_buffer_t has 2048 bytes space. So maximum long chain can have 128 (=2048/16) indirect descriptors. This patch adds check to make sure descriptors chain len should not exceed 128. Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I060cfb7709568f42c9b5634527172690ce66a1a3
2021-05-08vhost: low performance in interrupt mode in some casesSteven Luong1-35/+19
When vhost and another interface, say tap, are configured for interrupt mode, performance number may be very low from vhost. Further analysis discovers that when vhost posts an interrupt to the RX infra, there is a 10 msec delay in waking up its input routine. The delay is due to vhost posts the interrupt from the main thread which tries to wake up the worker thread. The fix is for vhost to move the posting interrupt call to the corresponding input worker thread by calling vnet_hw_if_set_rx_queue_file_index() to set it up. While at it, streamline the function vhost_user_kickfd_read_ready() since it will be called from the worker thread. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I9beedcd33e1558c8335da4ee7fadc51c29ee4589
2021-05-06vlib: fix the offload flags sizeMohsin Kazmi4-5/+5
Type: fix Change-Id: I433fe3799975fe3ba00fa30226f6e8dae34e88fc Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-05-05vlib: move offload flags to 1st cacheline in vlib_buffer_tMohsin Kazmi2-3/+3
Type: improvement Some tests i.e. ipsec see performance regression when offload flags are moved to 2nd cacheline. This patch moves them back to 1st cacheline. Change-Id: I6ead45ff6d2c467b0d248f409e27c2ba31758741 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-05-04virtio: add simple drop counter for interfaceMohsin Kazmi1-30/+33
Type: improvement Change-Id: I4ac6b1a6553e26a5c26b6761fa3c4cc5d4925486 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-05-04virtio: fix the interruptMohsin Kazmi3-162/+202
Type: fix virtio/tap interfaces set the empty buffers in the input node for receiving data. Backend uses those buffers, fills them with data and notifies the virtio/tap driver. But virtio/tap driver gets into stall state if interface is created and configured through exec script on VPP startup.conf and put the interface in interrupt mode while VPP is only configured with main thread. This patch fixes the problem by prefilling buffers during the interface creation. Change-Id: Ibc4d0e70e127ccc4b7cf8b2b18406ae4b02c73b4 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-05-01vlib: refactor trajectory trace debug featureBenoît Ganne2-6/+0
trajectory trace has been broken for a while because we used to save the buffer trajectory in a vector pointed to in opaque2. This does not work well when opaque2 is copied (eg. because of a clone) as 2 buffers end up sharing the same vector. This dedicates a full cacheline in the buffer metadata instead when trajectory is compiled in. No dynamic allocation, no sharing, no tears. Type: refactor Change-Id: I6a028ca1b48d38f393a36979e5e452c2dd48ad3f Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-04-05vhost: Crash upon disconnectSteven Luong1-1/+1
Patch 24601 introduced description into template. In vhost_user_process, template is reused inside the while loop to call clib_file_add. But description is allocated outside of the loop only once. As a result, the same storage for description is being referenced by all instances of call to clib_file_add. As long as we don't call clib_file_del, we may be good with multiple fds sharing the same storage for the description. When one of the fds disconnects and frees the description, the other fds is holding onto the free memory pointer. Bad news eventually happens when another fd disconnects and frees the description that was already free previously. The fix is to move the allocation of description inside the loop to avoid sharing. Type: fix Fixes: gerrit.fd.io/r/c/vpp/+/24601 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ie670931acdc2c7b851982d98fd0d837284a19036
2021-03-24virtio: improve compilation timeDamjan Marion1-64/+57
Type: improvement Change-Id: I56dadb852f63da0597ddf4db395a22afdf2d9cc0 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-03-19interface: add capabilities flagsMohsin Kazmi3-16/+21
Type: improvement This patch adds flags to represent the modern NICs capabilities. Change-Id: I96d38d9ab7eac55974d72795cd100d8337168e1e Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-02-26virtio: place the event fds on worker threads for pci deviceMohsin Kazmi1-0/+11
Type: improvement Change-Id: I8322bca1a9aa75c97c0fe2ff24b2f65fc43242ce Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-02-24virtio: enable the interrupt support for uio_pci_genericMohsin Kazmi1-11/+4
Type: improvement Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: Ic25ffe9c8e37826733cfb9e62cefb491bb3322bc
2021-02-15vlib: refactor checksum offload supportMohsin Kazmi4-30/+36
Type: refactor This patch refactors the offload flags in vlib_buffer_t. There are two main reasons behind this refactoring. First, offload flags are insufficient to represent outer and inner headers offloads. Second, room for these flags in first cacheline of vlib_buffer_t is also limited. This patch introduces a generic offload flag in first cacheline. And detailed offload flags in 2nd cacheline of the structure for performance optimization. Change-Id: Icc363a142fb9208ec7113ab5bbfc8230181f6004 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-02-08virtio: use vpp clib_memset instead glibc memsetMohsin Kazmi1-2/+2
Type: improvement Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: Ib3cefe5d27286c4853eb0c0e1803a94787a62c97
2021-02-08virtio: add atomic call for kickingMohsin Kazmi2-20/+6
Type: fix Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I41faa2ca249ff75e564a732af896e6b5d76bf665
2021-02-01tap: fix the interrupt handlingMohsin Kazmi1-3/+4
Type: fix Interrupt are suppressed from kernel on tx path. Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I9f39f343b7e16bad09910766adf0b09654721f67
2021-01-27vhost: vhost interface hardware address not setSteven Luong3-6/+9
The check args->hwaddr is always true and it always copies the mac address from args->hwaddr even though none was set. Check args->use_custom_mac instead. Type: fix Fixes: gerrit 29970 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I0c51bf1ea79b02c4fbdc3c52e694f186bdd96600
2021-01-21interface: rx queue infra rework, part oneDamjan Marion8-163/+128
Type: improvement Change-Id: I4008cadfd5141f921afbdc09a3ebcd1dcf88eb29 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-01-08vhost: Add event index for interrupt notification to driverSteven Luong8-192/+506
VPP only supports a poor man's approach for interrupt notification to the driver. It uses a simple binary flag for "interrupt needed" or "interrupt not needed". Most drivers support more sophisticated event index already. This feature is to add the long due missing feature and make it configurable, off by default. Type: feature Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I68dab7dd07045cafb49af97b7f70db9b8131ae03
2021-01-05tap: fix the buffering index for groMohsin Kazmi1-6/+8
Type: fix Fixes: 587f9130424fd451e4ba823240d02f655fb197d1 Change-Id: Ia1739fad6a36fa658aece157d7adea8bbaa751d2 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2020-12-28vlib: add missing file template descriptionsPaul Vinciguerra1-0/+4
Add descriptions to clib_file_t template structures so that sockets can be identified via the 'show unix file' cli command. Type: fix Change-Id: Ibf82d55aa6c7b1126bd252b76d0dc8b7076f5046 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-25virtio: Extend vhost multi-queues support beyond 8 queue pairsSteven Luong3-60/+122
Current vhost multi-queues support has a hard limit of 8 queue pairs due to static vring array. This limit was raised in qemu. VPP should support more than 8 queue pairs also. Change static vring allocation to dynamic. When the interface is created, we allocate 8 queue pairs to begin with. We also keep track of how many queue pairs that the interface actually uses. We reply VHOST_USER_GET_QUEUE_NUM with 128 as our maximum number of support queue pair. When qemu starts initializing queue pair greater than 8, we expand the vrings as needed on demand. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I4a02d987d52d1bbe601b00e71f650fe6ebfcc0d7