aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
AgeCommit message (Collapse)AuthorFilesLines
2020-08-13devices: allow link state down with netlinkMatthew Smith1-1/+1
Type: fix Use the up parameter in vnet_netlink_set_link_state(). It was ignoring the parameter and always setting IFF_UP on an interface. Change-Id: I0d44406d982afbdc43bc6b26d0f22c0bdd47abdc Signed-off-by: Matthew Smith <mgsmith@netgate.com> (cherry picked from commit 81284163a293759bc5c2d6a124639c6796589d15)
2020-08-13virtio: vhost gso checksum error when both indirect and mrg_rxbuf are offSteven Luong1-20/+19
Turn on gso, turn off both indirect and mrg_rxbuf caused traffic received and sent with checksum error. The problem is we are not mapping the hdr correctly in the shared memory address. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I7ef3bc2755544167b0e624365988111b17399e89 (cherry picked from commit b232d192f2f77114e26cf7f99b57bcd6140872d0)
2020-08-12virtio: vhost gso is broken in some topologySteven Luong1-2/+8
Recent modification added a call to vnet_gso_header_offset_parser in the beginning of vhost_user_handle_tx_offload. The former routine may set tcp or udp->checksum to 0. While it is appropriate to set it to 0 for the GSO packet, it is broken and causes checksum error if the aformentiooned routine is called by a non-GSO packet. The fix is to not call vhost_user_handle_tx_offload if the buffer does not indicate checksum offload is needed. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I6e699d7a40b7887ff149cd8f77e8f0fa9374ef19 (cherry picked from commit 564e1672917e205d7ae79525bb937df18f8d764b)
2020-04-05virtio: vhost checksum problem for ipv6Steven Luong1-3/+3
When checksum is enable for IPv6, it erroneously set the flag VNET_BUFFER_F_OFFLOAD_IP_CKSUM. That flag is meant for ip4 packets only. Type: fix Ticket: VPP-1857 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Id03b2937bfa34e2a9b50a36aafe0700bad7fb95e
2020-03-27virtio: fix link up/down flagMohsin Kazmi1-3/+9
Type: fix "set int state <interface> down" puts the virtio device link down. It will not put the link in "UP" state, when "set int state <interface up>" will be used again to change the interface admin up. This patch fixes it. To test: create tap set int state tap0 up set int state tap0 down sh hardware sh int set int state tap0 up sh int sh hardware Change-Id: I3c0e31539f8a2a1e40220e7fb57eedecf408f067 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 529f0e97b6064039c500adce0d54b738954b2ffa)
2020-03-27virtio: fix the out of order descriptors in txMohsin Kazmi4-8/+103
Type: fix Some vhost-backends give used descriptors back in out-of-order. This patch fixes the native virtio to handle out-of-order descriptors. Change-Id: I74ba03a2111dc601be4396c0fa800c33db5554b4 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 7f6d145accc6e63b150ab4efc282f19cbe996b57)
2020-03-04tap: misc fixesMohsin Kazmi2-20/+21
Ticket: VPPSUPP-58 1) Previously, host mtu can't be set if tap interface is in namespace. 2) generate the host mac address, if it is not provided. 3) fix the parameters for tap_create_v2 in vat. 4) fix the pretty print of parameters for tap_create_v2 in custom dump. Type: fix Change-Id: I18898af90dbd37d773a40b6535dd9c03c9984679 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2020-02-06virtio: feature arc have higher priority than redirectDamjan Marion1-3/+4
Type: fix Fixes: 8389fb9 Change-Id: Ie159eb444b28b36a7af86049b80fba4e49be93cb Signed-off-by: Damjan Marion <damarion@cisco.com> (cherry picked from commit 06c194d91b6d2d888ed2b0c5cf0df1cdbc7c53a4)
2020-01-29devices: vhost: fix data offset on inputBenoît Ganne1-11/+1
Regardless of whether the virtio_net_hdr is sent as a separate descriptors or in the same descriptor as the data, we always want to skip the header length - maybe moving to the next descriptor along the way. Type: fix Change-Id: Iaa70aeb310e589639b20f8c7029aaa8d3ce5d307 Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit 5ecc1e4d433a34845c7bfd761dc990413e6c321b)
2019-12-01virtio: fix use-after-freeBenoît Ganne1-1/+1
Type: fix Change-Id: Ic67d9da65d937f56ecf994a5504c6351624b32ff Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit 8f011830b2e01dfdbf8449b3145a4dd806b5515f)
2019-11-18tap: fix cli parserDamjan Marion1-4/+5
Type: fix Change-Id: I38ee9efd23774cce7790565825527cca9ba6f200 Signed-off-by: Damjan Marion <damarion@cisco.com> (cherry picked from commit 0ba86cb1bdcc273ebc3d5a92f765639a64894a7a)
2019-10-29devices: 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-14devices: 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 (cherry picked from commit 61b8ba69f7a9540ed00576504528ce439f0286f5)
2019-10-03fib: fix some typos in fib/mtrieLijian.Zhang1-1/+1
Type: fix Change-Id: I1af0e4a9bc23a3b6b6d3a74df093801ab6cae1f8 Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com> (cherry picked from commit 33af8c1ed89f15cf0601ee891e9603bef16f2c93)
2019-10-03vlib: add flag to explicitelly mark nodes which can init per-node packet traceDamjan Marion4-0/+4
Type: feature Change-Id: I913f08383ee1c24d610c3d2aac07cef402570e2c Signed-off-by: Damjan Marion <damarion@cisco.com> (cherry picked from commit 7ca5aaac10e95306f74ea4afd52110dd46aa0381)
2019-09-28devices: fix issue of per_interface_next_indexMichael Yu1-3/+4
Per interface, next hop graph node can be customized with vnet_hw_interface_rx_redirect_to_node function, but it doesn't work well for af-packet type interface. In current implementation, with function af_packet_set_interface_next_node invoked next hop graph node index can be set to apif->per_interface_next_index, but it's not set to next0 properly for packet processing in af_packet_device_input_fn. Type: fix Signed-off-by: Michael Yu <michael.a.yu@nokia-sbell.com> Change-Id: I8e132ddd1c3c01b6f476de78546d4a9389b3ff87 Signed-off-by: Michael Yu <michael.a.yu@nokia-sbell.com> (cherry picked from commit 90b34ed67a516c4391ad353ba431f8419b582d50)
2019-09-27tap: fix tap interface not working on Arm issueLijian.Zhang1-1/+6
The VPP code tries to set all userspace memory in the table via IOCTL to VHOST_SET_MEM_TABLE. But on aarch64, the userspace address range is larger (48 bits) than that on x86 (47 bits). Below is an segment from /proc/[vpp]/maps. fffb41200000-fffb43a00000 rw-s 00000000 00:0e 532232 /anon_hugepage (deleted) Instead of setting all userspace memory space to vhost-net, will only set the address space reserved by pmalloc module during initialization. Type: fix Change-Id: I91cb35e990869b42094cf2cd0512593733d33677 Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com> Reviewed-by: Steve Capper <Steve.Capper@arm.com> (cherry picked from commit ba0da570f264785f6b50eff7829f6653c0924069)
2019-09-20devices: vhost-user crashes displaying show trace for deleted interfaceSteven Luong1-6/+10
After the trace is collected and if the interface is then deleted, show trace may crash for the debug image. This is due to the additional check in pool_elt_at_index() to make sure that the block is not free. The fix is to do the check in vhost format trace and return "interface deleted" Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I0744f913ba6146609663443f408d784067880f93 (cherry picked from commit 5cd987dda679fe50b9cd7a834bb9162db39ade78)
2019-09-05tap: revert clean-up when linux will delete the tap interfaceMohsin Kazmi2-43/+0
Type: fix Ticket: VPP-1766 revert e4ac48e792f4eebfce296cfde844ee73b1abd62f Change-Id: I03feea4008a47859d570ad8d1d08ff3f30d139ef Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
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-08-20devices: skip checksum calculation if guest supports checksum offloadSteven Luong1-3/+7
Set VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD for the interface to skip checksum calculation if guest supports checksum offload. Type: fix Ticket: VPP-1750 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ie933c3462394f07580ef7f2bec1d2eb3b075bd0c (cherry picked from commit a75ad876401a700127ebf234fc422e76fcd57b4c)
2019-08-19gso: fix l3 and l4 header offset in case of tagged interfaceMohsin Kazmi1-0/+14
previously, PG and virtio interfaces calculate wrong l3 and l4 header offset. This patch fixes this issue. Type: fix Ticket: VPP-1739 Change-Id: I5ba978e464babeb65e0711e1027320d46b3b9932 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 14bea1bb6505c0134dd5d2a18bcc436ce72cd149)
2019-08-17gso: remove the ip checksum flag in case of ipv6Mohsin Kazmi1-1/+0
Type: fix Ticket: VPP-1727 Change-Id: Icfee35c5ab5e1c65079d1ca7bb514162319113e5 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 7dfcf7f1f504f5e8283c54a428805cc3a4aa8da9)
2019-08-02devices: add null check after map_guest_mem callsSteven Luong1-2/+16
map_guest_mem may return null. Coverity complains about calls without checking its return. Simple stuff. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I0626115f4951a88f23d9792f0232fb57c132fbc2
2019-08-02virtio: add the display information in virtio cliChenmin Sun2-2/+2
Type: fix 1. Add option '[gso-enabled]' in cli 'create interface virtio' 2. Add gso information in virtio_show() Change-Id: I4eb58f4421325ef54a6a68c8341b3a6d3d68136a Signed-off-by: Chenmin Sun <chenmin.sun@intel.com>
2019-07-31devices interface tests: vhosst GSO supportSteven Luong7-19/+296
Add gso option in create vhost interface to support gso and checksum offload. Tested with the following startup options in qemu: csum=on,gso=on,guest_csum=on,guest_tso4=on,guest_tso6=on,guest_ufo=on, host_tso4=on,host_tso6=on,host_ufo=on Type: feature Change-Id: I9ba1ee33677a694c4a0dfe66e745b098995902b8 Signed-off-by: Steven Luong <sluong@cisco.com>
2019-07-30tap: fix segv when host-if-name is not givenMohsin Kazmi1-8/+10
Type: fix Fixes: c30d87e6139c64eceade54972715b402c625763d Change-Id: I86b606b18ff6a30709b7aff089fd5dd00103bd7f Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-07-24tap: print the interface name on cli when createdMohsin Kazmi2-0/+6
Type: feature Change-Id: If11f00574322c35c1780c31d5f7b47d30e083e35 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-07-23api: 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>
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>
2019-07-18tap: fix memory errors with create/delete APIBenoît Ganne1-7/+9
CLI allocates vectors consumed by tap_create_if(), whereas API pass null-terminated C-strings allocated on API segment. Do not try to be too clever here, and just allocate our own private copies. Type: fix Fixes: 8d879e1a6bac47240a232893e914815f781fd4bf Ticket: VPP-1724 Change-Id: I3ccdb8e0fcd4cb9be414af9f38cf6c33931a1db7 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-07-18vlib: convert frame_index into real pointersAndreas Schultz1-1/+1
The fast path almost always has to deal with the real pointers. Deriving the frame pointer from a frame_index requires a load of the 32bit frame_index from memory, another 64bit load of the heap base pointer and some calculations. Lets store the full pointer instead and do a single 64bit load only. This helps avoiding problems when the heap is grown and frames are allocated below vm->heap_aligned_base. Type: refactor Change-Id: Ifa6e6e984aafe1e2755bff80f0a4dfcddee3623c Signed-off-by: Andreas Schultz <andreas.schultz@travelping.com> Signed-off-by: Dave Barach <dave@barachs.net>
2019-06-29devices: virtio pci leaking spinlockSteven Luong1-0/+1
Memory is dirt cheap. But there is no need to throw it away. Type: fix Change-Id: I155130ab3c435b1c04d7c0e9f54795b8de9383d9 Signed-off-by: Steven Luong <sluong@cisco.com>
2019-06-28tap: fix memory errors in create/deleteBenoît Ganne1-1/+5
If the host interface name is not specified at creation, host_if_name was wrongly set to a stack-allocated variable. Make sure it always points to a heap allocated vector. At deletion time, we must free all allocated vectors. Type:fix Change-Id: I17751f38e95097998d51225fdccbf3ce3c365593 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-06-20tap: fix the total length of packet for stats byteMohsin Kazmi1-3/+3
Type: fix Fixes: 8389fb9 Change-Id: I31076db78507736631609146d4cca28597aca704 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-06-20tap: add support to configure tap interface host MTU sizeMohsin Kazmi8-2/+78
This patch adds support to configure host mtu size using api, cli or startup.conf. Type: feature Change-Id: I8ab087d82dbe7dedc498825c1a3ea3fcb2cce030 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-05-28tap: crash in multi-thread environmentMohsin Kazmi3-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: I82b15d3e9b0fb6add9b9ac49bf602a538946634a Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit c2c89782d34df0dc7197b18b042b4c2464a101ef)
2019-05-27virtio: Add gso support for native virtio driverMohsin Kazmi5-7/+77
Change-Id: I7b735f5a540e8c278bac88245acb3f8c041c49c0 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-05-24Tap: 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> (cherry picked from commit 55203e745f5e3f1f6c4dbe99d6eab8dee4d13ea6)
2019-05-16init / exit function orderingDave Barach1-6/+6
The vlib init function subsystem now supports a mix of procedural and formally-specified ordering constraints. We should eliminate procedural knowledge wherever possible. The following schemes are *roughly* equivalent: static clib_error_t *init_runs_first (vlib_main_t *vm) { clib_error_t *error; ... do some stuff... if ((error = vlib_call_init_function (init_runs_next))) return error; ... } VLIB_INIT_FUNCTION (init_runs_first); and static clib_error_t *init_runs_first (vlib_main_t *vm) { ... do some stuff... } VLIB_INIT_FUNCTION (init_runs_first) = { .runs_before = VLIB_INITS("init_runs_next"), }; The first form will [most likely] call "init_runs_next" on the spot. The second form means that "init_runs_first" runs before "init_runs_next," possibly much earlier in the sequence. Please DO NOT construct sets of init functions where A before B actually means A *right before* B. It's not necessary - simply combine A and B - and it leads to hugely annoying debugging exercises when trying to switch from ad-hoc procedural ordering constraints to formal ordering constraints. Change-Id: I5e4353503bf43b4acb11a45fb33c79a5ade8426c Signed-off-by: Dave Barach <dave@barachs.net>
2019-05-07Fix af_packet issues:jackiechen19851-31/+57
1. Fix af_packet memory leak; 2. Fix close socket twice; 3. Adjust debug log for syscall; 4. Adjust dhcp client output log; Change-Id: I96bfaef16c4fad80c5da0d9ac602f911fee1670d Signed-off-by: jackiechen1985 <xiaobo.chen@tieto.com>
2019-05-06virtio: refactor ctrl queue supportMohsin Kazmi1-22/+32
Change-Id: Ifb16351f39e5eb2cd154e70a1c96243e4842e80d Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-05-01virtio: Fix virtio buffer allocationMohsin Kazmi1-1/+1
Change-Id: I0ffb468aef56f5fd223218a83425771595863666 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-05-01virtio: remove configurable queue size supportMohsin Kazmi5-41/+27
Native virtio device through legacy driver can't support configurable queue size. Change-Id: I76c446a071bef8a469873010325d830586aa84bd Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-04-25tap: Fix the indirect buffer allocationMohsin Kazmi1-1/+1
Change-Id: I73f76c25754f6fb14a49ae47b6404f3cbabbeeb5 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-04-17tap: clean-up when linux will delete the tap interfaceMohsin Kazmi2-0/+43
When container is deleted which has tap interface attached, Linux also delete the tap interface leaving the VPP side of tap. This patch does a clean up job to remove that VPP side of tap interface. To produce the behavior: In VPP: create tap On linux: sudo ip netns add ns1 sudo ip link set dev tap0 netns ns1 sudo ip netns del ns1 Change-Id: Iaed1700073a9dc64e626c1d0c449f466c143f3ae Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-04-15tap: fix the crashMohsin 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>
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>