aboutsummaryrefslogtreecommitdiff
path: root/sys/ofed
Commit message (Collapse)AuthorAgeFilesLines
* MFC r359014:Hans Petter Selasky2020-03-191-1/+0
| | | | | | | | | | | Fix for double unlock in ipoib. The ipoib_unicast_send() function is not supposed to unlock the priv lock. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=359124
* MFC r358694:Hans Petter Selasky2020-03-131-3/+3
| | | | | | | | | Fix some whitespace issues in ipoib. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=358934
* MFC r328623:Hans Petter Selasky2018-02-011-1/+1
| | | | | | | | | Properly implement the cond_resched() function macro in the LinuxKPI. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=328657
* MFC r325533:Hans Petter Selasky2017-11-171-1/+1
| | | | | | | | | | | Make the dma_alloc_coherent() function in the LinuxKPI NULL safe with regard to the "dev" argument. Submitted by: Krishnamraju Eraparaju @ Chelsio Sponsored by: Chelsio Communications Notes: svn path=/stable/9/; revision=325938
* MFC r322248:Hans Petter Selasky2017-08-155-15/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix for mlx4en(4) to properly call m_defrag(). The m_defrag() function can only defrag mbuf chains which have a valid mbuf packet header. In r291699 when the mlx4en(4) driver was converted into using BUSDMA(9), the call to m_defrag() was moved after the part of the transmit routine which strips the header from the mbuf chain. This effectivly disabled the mbuf defrag mechanism and such packets simply got dropped. This patch removes the stripping of mbufs from a chain and loads all mbufs using busdma. If busdma finds there are no segments, unload the DMA map and free the mbuf right away, because that means all data in the mbuf has been inlined in the TX ring. Else proceed as usual. Add a per-ring rounter for the number of defrag attempts and make sure the oversized_packets counter gets zeroed while at it. The counters are per-ring to avoid excessive cache misses in the TX path. Submitted by: mjoras@ Differential Revision: https://reviews.freebsd.org/D11683 Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322536
* MFC r322306:Hans Petter Selasky2017-08-141-1/+2
| | | | | | | | | | | Print maximum MTU when trying to set invalid MTU in the mlx4en(4) driver. Useful for debugging. Submitted by: Sepherosa Ziehau <sephe@dragonflybsd.org> Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322506
* MFC r322304:Hans Petter Selasky2017-08-141-15/+70
| | | | | | | | | | | Add support for RX and TX statistics when the mlx4en(4) PCI device is in VF or SRIOV mode typically in a virtual machine environment. Submitted by: Sepherosa Ziehau <sephe@dragonflybsd.org> Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322503
* MFC r289577:Hans Petter Selasky2017-08-142-3/+9
| | | | | | | | | | Merge LinuxKPI changes from DragonflyBSD: - Map more Linux compiler related defines to FreeBSD ones. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322502
* MFC r292537 and r314878:Hans Petter Selasky2017-08-141-0/+17
| | | | | | | | | Implement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE(). Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322501
* MFC r321782:Hans Petter Selasky2017-08-075-67/+0
| | | | | | | | | | | Remove some dead statistics related code and a structure field from the mlx4en driver which is used by its Linux counterpart, but not under FreeBSD. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322166
* MFC r321772:Hans Petter Selasky2017-08-072-4/+4
| | | | | | | | | | | Fix broken usage of the mlx4_read_clock() function: - return value has too small width - cycle_t is unsigned and cannot be less than zero Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322163
* MFC r321780:Hans Petter Selasky2017-08-071-1/+1
| | | | | | | | | Make sure on-stack buffer is properly aligned. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322160
* MFC r321986:Hans Petter Selasky2017-08-071-1/+1
| | | | | | | | | | | | | | | Change reject message type when destroying cm_id in ibore. This patch fixes an interopability issue between FreeBSD and non-FreeBSD systems when the connection establishment is aborted. Refer to the initial commit in Linux, drivers/infiniband/core/cm.c, for a more detailed description. Obtained from: Linux Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322157
* MFC r321985:Hans Petter Selasky2017-08-071-2/+2
| | | | | | | | | Ticks are 32-bit in FreeBSD. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=322154
* MFC r320876:Hans Petter Selasky2017-07-131-1/+7
| | | | | | | | | | | Make sure the mlx4en RX DMA ring gets stamped with software ownership in order to prevent the flow of QP to error in the firmware once UPDATE_QP is called. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=320946
* MFC r319972:Hans Petter Selasky2017-06-181-2/+2
| | | | | | | | | | | | Use static device numbering instead of dynamic one when creating mlx4en network interfaces. This prevents infinite unit number growth typically when the mlx4en driver is used inside virtual machines which support runtime PCI attach and detach. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=320068
* MFC r319413:Hans Petter Selasky2017-06-041-3/+2
| | | | | | | | | | | | Free hardware queue resource after port is stopped in the mlx4en(4) driver. Else if the port is up the resource might still be busy and the MTT free will fail. PR: 216493 Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=319568
* MFC r319414:Hans Petter Selasky2017-06-041-30/+12
| | | | | | | | | | | | | | | Allow communication between functions on the same host when using the mlx4en(4) driver in SRIOV mode. Place a copy of the destination MAC address in the send WQE only under SRIOV/eSwitch configuration or when the device is in selftest. This allows communication between functions on the same host. PR: 216493 Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=319565
* MFC r318531:Hans Petter Selasky2017-05-222-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | mlx4: Use the CQ quota for SRIOV when creating completion EQs When creating EQs to handle CQ completion events for the PF or for VFs, we create enough EQE entries to handle completions for the max number of CQs that can use that EQ. When SRIOV is activated, the max number of CQs a VF (or the PF) can obtain is its CQ quota (determined by the Hypervisor resource tracker). Therefore, when creating an EQ, the number of EQE entries that the VF should request for that EQ is the CQ quota value (and not the total number of CQs available in the firmware). Under SRIOV, the PF, also must use its CQ quota, because the resource tracker also controls how many CQs the PF can obtain. Using the firmware total CQs instead of the CQ quota when creating EQs resulted wasting MTT entries, due to allocating more EQEs than were needed. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=318629
* MFC r317505:Hans Petter Selasky2017-05-192-8/+8
| | | | | | | | | | | Don't free uninitialized sysctl contexts in the mlx4en driver. This can cause NULL pointer panics during failed device attach. Differential Revision: https://reviews.freebsd.org/D8876 Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=318541
* MFC r313555:Hans Petter Selasky2017-05-196-24/+167
| | | | | | | | | | | | | | | | | | | | | | | | | Flexible and asymmetric allocation of EQs and MSI-X vectors for PF/VFs. Previously, the mlx4 driver queried the firmware in order to get the number of supported EQs. Under SRIOV, since this was done before the driver notified the firmware how many VFs it actually needs, the firmware had to take into account a worst case scenario and always allocated four EQs per VF, where one was used for events while the others were used for completions. Now, when the firmware supports the asymmetric allocation scheme, denoted by exposing num_sys_eqs > 0 (--> MLX4_DEV_CAP_FLAG2_SYS_EQS), we use the QUERY_FUNC command to query the firmware before enabling SRIOV. Thus we can get more EQs and MSI-X vectors per function. Moreover, when running in the new firmware/driver mode, the limitation that the number of EQs should be a power of two is lifted. Obtained from: Linux (dual BSD/GPLv2 licensed) Submitted by: Dexuan Cui @ microsoft . com Differential Revision: https://reviews.freebsd.org/D8867 Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=318537
* MFC r313556:Hans Petter Selasky2017-05-196-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change mlx4 QP allocation scheme. When using Blue-Flame, BF, the QPN overrides the VLAN, CV, and SV fields in the WQE. Thus, BF may only be used for QPNs with bits 6,7 unset. The current ethernet driver code reserves a TX QP range with 256b alignment. This is wrong because if there are more than 64 TX QPs in use, QPNs >= base + 65 will have bits 6/7 set. This problem is not specific for the Ethernet driver, any entity that tries to reserve more than 64 BF-enabled QPs should fail. Also, using ranges is not necessary here and is wasteful. The new mechanism introduced here will support reservation for "Eth QPs eligible for BF" for all drivers: bare-metal, multi-PF, and VFs (when hypervisors support WC in VMs). The flow we use is: 1. In mlx4_en, allocate Tx QPs one by one instead of a range allocation, and request "BF enabled QPs" if BF is supported for the function 2. In the ALLOC_RES FW command, change param1 to: a. param1[23:0] - number of QPs b. param1[31-24] - flags controlling QPs reservation Bit 31 refers to Eth blueflame supported QPs. Those QPs must have bits 6 and 7 unset in order to be used in Ethernet. Bits 24-30 of the flags are currently reserved. When a function tries to allocate a QP, it states the required attributes for this QP. Those attributes are considered "best-effort". If an attribute, such as Ethernet BF enabled QP, is a must-have attribute, the function has to check that attribute is supported before trying to do the allocation. In a lower layer of the code, mlx4_qp_reserve_range masks out the bits which are unsupported. If SRIOV is used, the PF validates those attributes and masks out unsupported attributes as well. In order to notify VFs which attributes are supported, the VF uses QUERY_FUNC_CAP command. This command's mailbox is filled by the PF, which notifies which QP allocation attributes it supports. Obtained from: Linux (dual BSD/GPLv2 licensed) Submitted by: Dexuan Cui @ microsoft . com Differential Revision: https://reviews.freebsd.org/D8868 Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=318534
* MFC r313778:Hans Petter Selasky2017-03-141-1/+1
| | | | | | | | | | Improve code readability and fix compilation error when using clang 4.x. Found by: emaste @ Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=315258
* MFC r310058:Hans Petter Selasky2017-01-091-27/+41
| | | | | | | | | | | Fix initialisation of mlx4_pci_table's .driver_data fields. Differential Revision: https://reviews.freebsd.org/D8791 Sponsored by: Mellanox Technologies Submitted by: Dexuan Cui <decui@microsoft.com> Notes: svn path=/stable/9/; revision=311796
* MFC r308031:Hans Petter Selasky2016-11-071-8/+7
| | | | | | | | | | Fix indentation and remove duplicate queue stopped stats increment. Found by: Ryan Stone <rysto32@gmail.com> Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=308400
* MFC r306451:Hans Petter Selasky2016-10-101-9/+20
| | | | | | | | | | | The IORESOURCE_XXX defines should resemble a bitmask while SYS_RES_XXX are not bitmasks. Fix return value of pci_resource_flags() to reflect this change. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=306951
* MFC r304342:Hans Petter Selasky2016-08-261-0/+16
| | | | | | | | | | | | Add support for setting blocking and non-blocking mode on /dev/rdma_cm by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags handling is done by the kern_ioctl() function. Reported by: Alex Bowden <alex.bowden@outlook.com> Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=304847
* MFC r298458:Hans Petter Selasky2016-04-291-2/+7
| | | | | | | | | | | | | Add missing set of the current VNET when inputting IP packets in IPoIB. This fixes a kernel panic when using IPoIB with VIMAGE and infiniband. PR: 208957 Sponsored by: Mellanox Technologies Tested by: Justin Clift <justin@postgresql.org> Notes: svn path=/stable/9/; revision=298780
* MFC r297968:Hans Petter Selasky2016-04-293-13/+0
| | | | | | | | | Remove some unused fields. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=298777
* MFC r297967:Hans Petter Selasky2016-04-292-4/+12
| | | | | | | | | | | | | Ensure the received IP header gets 32-bits aligned. The FreeBSD's TCP/IP stack assumes that the IP-header is 32-bits aligned when decoding it. Else unaligned 32-bit memory access can happen, which not all processor architectures support. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=298776
* MFC r297966:Hans Petter Selasky2016-04-291-2/+17
| | | | | | | | | | | | | Add missing port_up checks. When downing a mlxen network adapter we need to check the port_up variable to ensure we don't continue to transmit data or restart timers which can reside in freed memory. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=298774
* MFC r294520:Hans Petter Selasky2016-04-072-22/+22
| | | | | | | | | | | | | | | LinuxKPI atomic fixes: - Fix implementation of atomic_add_unless(). The atomic_cmpset_int() function returns a boolean and not the previous value of the atomic variable. - The atomic counters should be signed according to Linux. - Some minor cosmetics and styling while at it. Reviewed by: alfred @ Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=297659
* MFC r297444:Hans Petter Selasky2016-04-071-2/+2
| | | | | | | | | Fix bugs in currently unused bit searching loop. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=297657
* MFC r296987:Hans Petter Selasky2016-04-071-2/+3
| | | | | | | | | Add missing curly brackets in for loop. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=297653
* MFC r296910:Hans Petter Selasky2016-04-072-2/+3
| | | | | | | | | | | | | Use hardware computed Toeplitz hash for incoming flowids Use the Toeplitz hash value as source for the flowid. This makes the hash value more suitable for so-called hash bucket algorithms which are used in the FreeBSD's TCP/IP stack when RSS is enabled. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=297650
* MFC r296909:Hans Petter Selasky2016-04-072-0/+7
| | | | | | | | | | | | | | | | Fix witness panic in the ipoib_ioctl() function when unloading the ipoib module. The bpfdetach() function is trying to turn off promiscious mode on the network interface it is attached to while holding a mutex. The fix consists of ignoring any further calls to the ipoib_ioctl() function when the network interface is going to be detached. The ipoib_ioctl() function might sleep. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=297649
* MFC 294366:John Baldwin2016-01-231-1/+1
| | | | | | | | | | | | | | | | | Initialize vm_page_prot to VM_MEMATTR_DEFAULT instead of 0. If a driver's Linux mmap callback passed vm_page_prot through unchanged, then linux_dev_mmap_single() would try to apply whatever VM_MEMATTR_xxx value 0 is to the mapping. On x86, VM_MEMATTR_DEFAULT is the PAT value for write-back (WB) which is 6, while 0 maps to the PAT value for uncacheable (UC). Thus, any mmap request that did not explicitly set page_prot was tried to map memory as UC triggering the warning in sg_pager_getpages(). Sponsored by: Chelsio Communications Notes: svn path=/stable/9/; revision=294636
* MFC r292989:Hans Petter Selasky2016-01-121-2/+6
| | | | | | | | Handle when filedescriptors are closed before initialized. An early fdclose() call can cause fget_unlocked() to fail. Notes: svn path=/stable/9/; revision=293737
* MFC r290003:Hans Petter Selasky2015-12-141-1/+18
| | | | | | | | | | Add support for binding IRQs to CPUs in the LinuxKPI. The new function added is for BSD only and does not exist in Linux. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=292193
* MFstable/10 r292136:Enji Cooper2015-12-131-1/+7
| | | | | | | | | | | | | | | | MFC r291753: Fix scope of bridge_header and bridge_pcix_cap in mthca_reset(..) They're only used in the __linux__ case Differential Revision: https://reviews.freebsd.org/D4332 Reported by: cppcheck Reviewed by: hselasky Sponsored by: EMC / Isilon Storage Division Notes: svn path=/stable/9/; revision=292137
* MFC r283612, r290710, r291694, r291699 and r291793:Hans Petter Selasky2015-12-1116-2533/+1210
| | | | | | | | | | | | | | | | | | | | | | | | | - Add SIOCGI2C ioctl support to the driver. Would work only on ConnectX-3 with fresh firmware. The low level code is based on code provided by Mellanox. - Fix print formatting compile warnings for Sparc64 and PowerPC platforms. - Updated the mlx4 and mlxen drivers to the latest version, v2.1.6: - Added support for dumping the SFP EEPROM content to dmesg. - Fixed handling of network interface capability IOCTLs. - Fixed race when loading and unloading the mlxen driver by applying appropriate locking. - Removed two unused C-files. - Convert the mlxen driver to use the BUSDMA(9) APIs instead of vtophys() when loading mbufs for transmission and reception. While at it all pointer arithmetic and cast qualifier issues were fixed, mostly related to transmission and reception. - Fix i386 build WITH_OFED=YES. Remove some redundant KASSERTs. Sponsored by: Mellanox Technologies Differential Revision: https://reviews.freebsd.org/D4283 Differential Revision: https://reviews.freebsd.org/D4284 Notes: svn path=/stable/9/; revision=292115
* MFC r291693:Hans Petter Selasky2015-12-111-0/+19
| | | | | | | | | | | Add some structures and defines which will be used when decoding small form factor, SFF, standards compliant ethernet EEPROMs. Obtained from: Linux Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=292109
* MFC r291690:Hans Petter Selasky2015-12-111-4/+0
| | | | | | | | | | Remove incorrect defines. The proper version of these macros is defined in linux/etherdevice.h. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=292108
* MFstable/10 r291185:Enji Cooper2015-11-231-0/+1
| | | | | | | | | | | | | | MFC r291047: Don't leak work if __mlx4_register_vlan(..) fails in mlx4_master_immediate_activate_vlan_qos(..) Differential Revision: https://reviews.freebsd.org/D4203 Submitted by: Miles Olrich <miles.olrich@isilon.com> Sponsored by: EMC / Isilon Storage Division Notes: svn path=/stable/9/; revision=291186
* MFC 287440:John Baldwin2015-09-112-25/+22
| | | | | | | | | | | | | | | | | | Currently the Linux character device mmap handling only supports mmap operations that map a single page that has an associated vm_page_t. This does not permit mapping larger regions (such as a PCI memory BAR) and it does not permit mapping addresses beyond the top of RAM (such as a 64-bit BAR located above the top of RAM). Instead of using a single OBJT_DEVICE object and passing the physaddr via the offset as a hack, create a new sglist and OBJT_SG object for each mmap request. The requested memory attribute is applied to the object thus affecting all pages mapped by the request. Sponsored by: Chelsio Notes: svn path=/stable/9/; revision=287637
* MFC r285088:Hans Petter Selasky2015-07-212-16/+19
| | | | | | | | | | | | | Fix broken implementation of "kvasprintf()" function by adding missing kmalloc() call. Make function global instead of static inline to fix compiler warnings about passing variable argument lists to inline functions. Sponsored by: Mellanox Technologies Requested by: markj @ Notes: svn path=/stable/9/; revision=285757
* MFC r282817:Hans Petter Selasky2015-05-211-0/+4
| | | | | | | | | | Apply proper locking when iterating the multicast addresses and add a missing check for NULL from a non-blocking "kzalloc()" function call. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=283179
* MFC r277396, r278681, r278865, r278924, r279205, r280208,Hans Petter Selasky2015-05-0520-176/+347
| | | | | | | | | | | | | | | | | | | | | | | | r280210, r280764 and r280768: Update the Linux compatibility layer: - Add more functions. - Add some missing includes which are needed when the header files are not included in a particular order. - The kasprintf() function cannot be inlined due to using a variable number of arguments. Move it to a C-file. - Fix problems about 32-bit ticks wraparound and unsigned long conversion. Jiffies or ticks in FreeBSD have integer type and are not long. - Add missing "order_base_2()" macro. - Fix BUILD_BUG_ON() macro. - Declare a missing symbol which is needed when compiling without -O2 - Clean up header file inclusions in the linux/completion.h, linux/in.h and linux/fs.h header files. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=282514
* MFC r280211:Hans Petter Selasky2015-03-251-2/+2
| | | | | | | | | Add missing void pointer argument to SYSINIT() functions. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=280543
* MFC r279865:Hans Petter Selasky2015-03-151-5/+8
| | | | | | | | | | Ensure setting promiscious mode when a network interface is up, is always non-blocking by not locking a SX type of mutex. Sponsored by: Mellanox Technologies Notes: svn path=/stable/9/; revision=280019