summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
AgeCommit message (Collapse)AuthorFilesLines
2019-10-25devices: vhoost cpu->copy array overflow on tcp jumbo frame (65535 bytes)Steven Luong2-2/+8
We reserve 40 slots in cpu->copy array prior to copy out to avoid overflowing the array. However, 40 is not enough for the jumbo frame because desceiptor buffer len is likely at 1536. Change the reserve to 200 and add ASSERT to avoid encountering the same problem in the future. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ibf0c03c4b4f33e781d5be8679ccd6c3a4b4a646d (cherry picked from commit 7331005c16d0e1499080899b2a0676a0cd945595)
2019-10-07devices: vhost not reading packets from vringSteven Luong2-0/+25
In a rare event, after the vhost protocol message exchange has finished and the interface had been brought up successfully, the driver MAY still change its mind about the memory regions by sending new memory maps via SET_MEM_TABLE. Upon processing SET_MEM_TABLE, VPP invalidates the old memory regions and the descriptor tables. But it does not re-compute the new descriptor tables based on the new memory maps. Since VPP does not have the descriptor tables, it does not read the packets from the vring. In the normal working case, after SET_MEM_TABLE, the driver follows up with SET_VRING_ADDRESS which VPP computes the descriptor tables. The fix is to stash away the descriptor table addresses from SET_VRING_ADDRESS. Re-compute the new descriptor tables when processing SET_MEM_TABLE if descriptor table addresses are known. Type: fix Ticket: VPP-1784 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I3361f14c3a0372b8d07943eb6aa4b3a3f10708f9
2019-09-03tap: interface rx counter not increment correctSteven Luong1-1/+1
vlib_increment_combined_counter takes sw_if_index, not hw_if_index. Using hw_if_index may work as long as there is no subinterface created to cause hw_if_index and sw_if_index to differ. Type: fix Ticket: VPP-1759 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I6db042186eeeacf32250f7ef261af8cd6f5ce56e (cherry picked from commit efa119db3910e77f79eb005c67f8c01b473b40a1)
2019-07-24api: binary api cleanupDave Barach4-10/+18
Multiple API message handlers call vnet_get_sup_hw_interface(...) without checking the inbound sw_if_index. This can cause a pool_elt_at_index ASSERT in a debug image, and major disorder in a production image. Given that a number of places are coded as follows, add an "api_visible_or_null" variant of vnet_get_sup_hw_interface, which returns NULL given an invalid sw_if_index, or a hidden sw interface: - hw = vnet_get_sup_hw_interface (vnm, sw_if_index); + hw = vnet_get_sup_hw_interface_api_visible_or_null (vnm, sw_if_index); if (hw == NULL || memif_device_class.index != hw->dev_class_index) return clib_error_return (0, "not a memif interface"); Rename two existing xxx_safe functions -> xxx_or_null to make it obvious what they return. Type: fix Change-Id: I29996e8d0768fd9e0c5495bd91ff8bedcf2c5697 Signed-off-by: Dave Barach <dave@barachs.net> (cherry picked from commit 3940de36728b768574a3e998389bb90d55f690d1)
2019-07-23devices: vhost handling VHOST_USER_SET_FEATURESSteven Luong1-0/+1
Some combinations of new qemu (2.11) and old dpdk (16.10) may send VHOST_USER_SET_FEATURES at the end of the protocol exchange which the vhost interface is already declared up and ready. Unfortunately, the process of VHOST_USER_SET_FEATURES will cause the interface to go down. Not sure if it is correct or needed. Because there is no additional messages thereafter, the hardware interface stays down. The fix is to check the interface again at the end of processing VHOST_USER_SET_FEATURES. If it is up and ready, we bring back the hardware interface. Type: fix Change-Id: I490cd03820deacbd8b44d8f2cb38c26349dbe3b2 Signed-off-by: Steven Luong <sluong@cisco.com> (cherry picked from commit 545866b5b3115b7de114bdb7883f5ece59b702d4)
2019-05-23tap: crash in multi-thread environmentSteven Luong3-5/+4
In tap tx routine, virtio_interface_tx_inline, there used to be an interface spinlock to ensure packets are processed in an orderly fashion clib_spinlock_lock_if_init (&vif->lockp); When virtio code was introduced in 19.04, that line is changed to clib_spinlock_lock_if_init (&vring->lockp); to accommodate multi-queues. Unfortunately, althrough the spinlock exists in the vring, it was never initialized for tap, only for virtio. As a result, many nasty things can happen when running tap interface in multi-thread environment. Crash is inevitable. The fix is to initialize vring->lockp for tap and remove vif->lockp as it is not used anymore. Change-Id: Ibc8f5c8192af550e3940597c06992dfdaccb4c49 Signed-off-by: Steven Luong <sluong@cisco.com>
2019-05-23Tap: Fix the indirect buffers allocation VPP-1660Mohsin Kazmi4-48/+61
Indirect buffers are used to store indirect descriptors to xmit big packets. This patch moves the indirect buffer allocation from interface creation to device node. Now it allocates or deallocates buffers during tx for chained buffers. Change-Id: I55cec208a2a7432e12fe9254a7f8ef84a9302bd5 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-04-26tap: Fix the indirect buffer allocation VPP-1660Mohsin Kazmi1-1/+1
Change-Id: I73f76c25754f6fb14a49ae47b6404f3cbabbeeb5 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-04-16tap: fix the crash [VPP-1645]Mohsin Kazmi1-0/+3
Crash will happen when someone will try to setup a tap interface in host namespace without providing the host side of tap interface custom name. This patch fixes the problem by using the default name in this case. Change-Id: Ic1eaea5abd01bc6c766d0e0fcacae29ab7a7ec45 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 2a6861ff7bc90c1518b68459210830052774d429)
2019-04-10API: Fix shared memory only action handlers.Ole Troan3-70/+1
Some API action handlers called vl_msg_ai_send_shmem() directly. That breaks Unix domain socket API transport. A couple (bond / vhost) also tried to send a sw_interface_event directly, but did not send the message to all that had registred interest. That scheme never worked correctly. Refactored and improved the interface event code. Change-Id: Idb90edfd8703c6ae593b36b4eeb4d3ed7da5c808 Signed-off-by: Ole Troan <ot@cisco.com>
2019-04-08fixing typosJim Thompson4-4/+4
Change-Id: I215e1e0208a073db80ec6f87695d734cf40fabe3 Signed-off-by: Jim Thompson <jim@netgate.com>
2019-04-08virtio: Fix the coverity warningsMohsin Kazmi1-6/+11
Change-Id: I7c6e4bf2abf08193e54a736510c07eeacd6aebe7 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-04-08minor spelling errors (both in comments)Jim Thompson1-1/+1
Change-Id: I9282a838738d0ba54255bef347abf4735be29820 Signed-off-by: Jim Thompson <jim@netgate.com>
2019-04-06Pipe: fix double count on TX (TX counting is done in interface-output)Neale Ranns1-11/+1
Change-Id: I550313a36ae02eb3faa2f1a5e3614f55275a00cf Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-04-03virtio: Add support for multiqueueMohsin Kazmi7-88/+493
Change-Id: Id71ffa77e977651f219ac09d1feef334851209e1 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-03-28Add RDMA ibverb driver pluginBenoît Ganne1-10/+2
RDMA ibverb is a userspace API to efficiently rx/tx packets. This is an initial, unoptimized driver targeting Mellanox cards. Next steps should include batching, multiqueue and additional cards. Change-Id: I0309c7a543f75f2f9317eaf63ca502ac7a093ef9 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-03-28Typos. A bunch of typos I've been collecting.Paul Vinciguerra1-1/+1
Change-Id: I53ab8d17914e6563110354e4052109ac02bf8f3b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-15Revert "API: Cleanup APIs interface.api"Ole Trøan3-3/+6
This reverts commit e63325e3ca03c847963863446345e6c80a2c0cfd. Allow time for CSIT to accommodate. Change-Id: I59435e4ab5e05e36a2796c3bf44889b5d4823cc2 Signed-off-by: ot@cisco.com
2019-03-15API: Cleanup APIs interface.apiJakub Grajciar3-6/+3
Use of consistent API types for interface.api Change-Id: Ieb54cebb4ac96b432a3f0b41596718aa2f34885b Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-03-13vhost-user: restart vpp may cause vhost to crashSteven Luong1-1/+1
Fix a typo in vhost_user_rx_discard_packet which may cause txvq->last_avail_idx to go wild. Change-Id: Ifaeb58835dff9b7ea82c061442722f1dcaa5d9a4 Signed-off-by: Steven Luong <sluong@cisco.com> (cherry picked from commit 39382976701926c1f34191c1311829c15a53cb01)
2019-03-13deprecate VLIB_DEVICE_TX_FUNCTION_MULTIARCHFilip Tehlar3-21/+15
Change-Id: I8819bcb9e228e7a432f4a7b67b6107f984927cd4 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-03-04devices: migrate old MULTIARCH macros to VLIB_NODE_FNFilip Tehlar3-18/+9
Change-Id: I911fb3f1c6351b37580c5dbde6939a549431a92d Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-02-23vhoat: potential crash in map_guest_mem using debug imageSteven Luong1-1/+14
map_guest_mem may be called from worker-thread/dataplane. It has a call to vlib_log and may crash inside vlib_log's ASSERT statement /* make sure we are running on the main thread to avoid use in dataplane code, for dataplane logging consider use of event-logger */ ASSERT (vlib_get_thread_index () == 0); The fix is to convert the vlib_log call in map_guest_map to event logger Change-Id: Iaaf6d86782aa8a18d25e0209f22dc31f04668d56 Signed-off-by: Steven Luong <sluong@cisco.com>
2019-02-22tapv2: coverity strikes backSteven Luong1-5/+4
while https://gerrit.fd.io/r/#/c/16590/ fixed the leaked fd which coverity reported at that time, new coverity run reports simailar leaked fd in a different goto punt path. It would be nice if coverity reported both of them at the same time. Or perhaps it did and I just missed it. Anyway, the new fix is to put the close (fd) statement prior to the return of tap_create_if routine which should catch all goto's. Change-Id: I0a51ed3710e32d5d74c9cd9b5066a667153e2f9d Signed-off-by: Steven Luong <sluong@cisco.com>
2019-02-22Add no-append flag to vlib_frame_tDamjan Marion1-0/+1
Change-Id: I01c4f5755d579282773ac227b0bc24f8ddbb2bd1 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-02-21vhost: VPP stalls with vhost performing control plane actionsSteven Luong3-214/+259
Symptom ------- With NDR traffic blasting at VPP, bringing up a new VM with vhost connection to VPP causes packet drops. I am able to recreate this problem easily using a simple setup like this. TREX-------------- switch ---- VPP |---------------| |-------| Cause ----- The reason for the packet drops is due to vhost holding onto the worker barrier lock for too long in vhost_user_socket_read(). There are quite a few of system calls inside the routine. At the end of the routine, it unconditionally calls vhost_user_update_iface_state() for all message types. vhost_user_update_iface_state() also unconditionally calls vhost_user_rx_thread_placement() and vhost_user_tx_thread_placement(). vhost_user_rx_thread_placement scraps out all existing cpu/queue mappings for the interface and creates brand new cpu/queue mappings for the interface. This process is very disruptive and very expensive. In my opinion, this area of code needs a makeover. Fixes ----- * vhost_user_socket_read() is rewritten that it should not hold onto the worker barrier lock for system calls, or at least minimize the need for doing it. * Remove the call to vhost_user_update_iface_state as a default route at the end of vhost_user_socket_read(). There is only a couple of message types which really need to call vhost_user_update_iface_state(). We put the call to those message types which need it. * Remove vhost_user_rx_thread_placement() and vhost_user_tx_thread_placement from vhost_user_update_iface_state(). There is no need to repetatively change the cpu/queue mappings. * vhost_user_rx_thread_placement() is actually quite expensive. It should be called only once per queue for the interface. There is no need to scrap the existing cpu/queue mappings and create new cpu/queue mappings when the additional queues becomes active/enable. * Change to create the cpu/queue mappings for the first RX when the interface is created. Dont remove the cpu/queue mapping when the interface is disconnected. Remove the cpu/queue mapping only when the interface is deleted. The create vhost user interface CLI also has some very expensive system calls if the command is entered with the optional keyword "server" As a bonus, This patch makes the create vhost user interface binary-api and CLI thread safe. Do the protection for the small amount of code which is thread unsafe. Change-Id: I4a19cbf7e9cc37ea01286169882e5603e6d7eb77 Signed-off-by: Steven Luong <sluong@cisco.com>
2019-02-19tap gso: experimental supportAndrew Yourtchenko7-8/+248
This commit adds a "gso" parameter to existing "create tap..." CLI, and a "no-gso" parameter for the compatibility with the future, when/if defaults change. It makes use of the lowest bit of the "tap_flags" field in the API call in order to allow creation of GSO interfaces via API as well. It does the necessary syscalls to enable the GSO and checksum offload support on the kernel side and sets two flags on the interface: virtio-specific virtio_if_t.gso_enabled, and vnet_hw_interface_t.flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO. The first one, if enabled, triggers the marking of the GSO-encapsulated packets on ingress with VNET_BUFFER_F_GSO flag, and setting vnet_buffer2(b)->gso_size to the desired L4 payload size. VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO determines the egress packet processing in interface-output for such packets: When the flag is set, they are sent out almost as usual (just taking care to set the vnet header for virtio). When the flag is not enabled (the case for most interfaces), the egress path performs the re-segmentation such that the L4 payload of the transmitted packets equals gso_size. The operations in the datapath are enabled only when there is at least one GSO-compatible interface in the system - this is done by tracking the count in interface_main.gso_interface_count. This way the impact of conditional checks for the setups that do not use GSO is minimized. "show tap" CLI shows the state of the GSO flag on the interface, and the total count of GSO-enabled interfaces (which is used to enable the GSO-related processing in the packet path). This commit lacks IPv6 extension header traversal support of any kind - the L4 payload is assumed to follow the IPv6 header. Also it performs the offloads only for TCP (TSO - TCP segmentation offload). The UDP fragmentation offload (UFO) is not part of it. For debug purposes it also adds the debug CLI: "set tap gso {<interface> | sw_if_index <sw_idx>} <enable|disable>" Change-Id: Ifd562db89adcc2208094b3d1032cee8c307aaef9 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2019-02-14Add -fno-common compile optionBenoît Ganne3-3/+3
-fno-common makes sure we do not have multiple declarations of the same global symbol across compilation units. It helps debug nasty linkage bugs by guaranteeing that all reference to a global symbol use the same underlying object. It also helps avoiding benign mistakes such as declaring enum as global objects instead of types in headers (hence the minor fixes scattered across the source). Change-Id: I55c16406dc54ff8a6860238b90ca990fa6b179f1 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-02-09buffers: fix typoDamjan Marion4-7/+6
Change-Id: I4e836244409c98739a13092ee252542a2c5fe259 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-02-06buffers: make buffer data size configurable from startup configDamjan Marion4-5/+6
Example: buffers { default data-size 1536 } Change-Id: I5b4436850ca18025c9fdcfc7ed648c2c2732d660 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-02-06virtio: enable msix interrupt modeMohsin Kazmi4-44/+114
Change-Id: Idd560f3afde1dd03bc3d6fbb2070096146865f50 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-02-06virtio: Use new buffer optimizationMohsin Kazmi5-2/+24
Change-Id: Ifc98373371b967c49a75989eac415ddda1dcf15f Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-01-30virtio: fix the device order (legacy or modern)Mohsin Kazmi1-3/+3
Change-Id: I60f88d50f062b004e6dea487bd627d303d0a5e75 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-01-29virtio: Support legacy and transitional virtio devicesMohsin Kazmi1-3/+11
Change-Id: Ib1316482dd7b1ae3c27c7eeb55839ed8af9ca162 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-01-24virtio: Minor fixes and header cleanupMohsin Kazmi5-24/+7
Change-Id: I2e5fd45abcd07e9eda6184587889bdcd9613a159 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-01-23virtio: Add support for loggingMohsin Kazmi4-31/+97
Change-Id: Ieadf0a97379ed8b17241e454895c4e5e195dc52f Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-01-21virtio: Native virtio driverMohsin Kazmi11-173/+2069
Change-Id: Id7fccf2f805e578fb05032aeb2b649a74c3c0e56 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-01-08virtio: fix kick race issueDamjan Marion3-10/+29
Change-Id: I25b2a28513821bc5eab9ac6890a3964d412b0399 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-01-07tapv2: add "tap_flags" field to the TAPv2 interface APIAndrew Yourtchenko3-0/+8
Change-Id: I26f99d95f52c9fe107d17dcbbf5c6185523beade Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2019-01-02Fixes for buliding for 32bit targets:David Johnson1-0/+1
* u32/u64/uword mismatches * pointer-to-int fixes * printf formatting issues * issues with incorrect "ULL" and related suffixes * structure alignment and padding issues Change-Id: I70b989007758755fe8211c074f651150680f60b4 Signed-off-by: David Johnson <davijoh3@cisco.com>
2019-01-01buffers: remove unused codeDamjan Marion3-7/+4
Change-Id: If2bbfbc52994f5de0879763e0b7a7864498debb6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-12-22tapv2: coverity woeSteven1-2/+4
coverity complains about fd leaking inside the if statement because there is a goto which bypasses the statement close (fd). The fix is to close (fd) immediately after it is no longer used. Change-Id: Ic5035b07ec1f179ff3db77744843e47aa8067a3c Signed-off-by: Steven <sluong@cisco.com>
2018-11-26Add a feature arc consistency checkDave Barach1-0/+1
Verify that last node in the computed feature order matches reality. This check doesn't make sense in all cases, so we skip it if the newly-added vnet_feature_arc_registration_t ".last_in_arc" datum is a NULL pointer. Change-Id: Ia99c3e2b2da2e4780a7d5bc71670c5742a66fef2 Signed-off-by: Dave Barach <dave@barachs.net>
2018-11-23vhost-user: use memory store barrierDamjan Marion1-3/+3
Should be less expensive... Change-Id: I678a39e42a054bf5f6ef9c59d0fb93ff9719b964 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-11-23vhost-user: add missing inlinesDamjan Marion1-2/+2
Change-Id: I1ed39c4ee084b26faac8286d9729413311ba9508 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-11-23vhost-user: avoid global storage accessDamjan Marion1-26/+34
Change-Id: I9dbeff51d3ede6db3cd5a097623aa580e5e25042 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-11-23vhost-user: simplify input loopDamjan Marion1-181/+174
Change-Id: I6e6963882825e83d8da3a460be35c7349e107777 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-11-22vhost-user: hint ethernet-input about single sw_if_indexDamjan Marion1-1/+16
Change-Id: Ia495f8f50c43baf0d6eeb8e9ba04314ce277286f Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-11-22vhost-user: avoid per-packet feature arc lookupsDamjan Marion1-12/+18
Change-Id: If96f5a7c7e4b511cab3d57e5b57796aa516aff11 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-11-22vhost-user: fix input node runtime statsDamjan Marion1-2/+2
Change-Id: Idda43d1236889ef91d8c37faf98ae23a19de688c Signed-off-by: Damjan Marion <damarion@cisco.com>