aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mlx4
Commit message (Collapse)AuthorAgeFilesLines
* mlx(4): Fix a typo in a source code commentGordon Bergling2026-02-081-1/+1
| | | | | | - s/segements/segments/ MFC after: 3 days
* mlx4ib(4): Fix some typos in device messagesGordon Bergling2025-02-051-4/+4
| | | | | | - s/availible/available/ MFC after: 5 days
* mlx4: use is_power_of_2Doug Moore2024-09-281-1/+1
| | | | | | | | It's faster to use is_power_of_2 than it is to compute roundup_power_of_two and then compare. So do that. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46838
* roundup_pow_of_two: don't take the log of itDoug Moore2024-09-282-3/+3
| | | | | | | | | Based on the definitions, ilog2(roundup_pow_of_two(x)) == order_base_2(x). Replace the former with the latter in a few places to save a few calculations. Reviewed by: bz, kib Differential Revision: https://reviews.freebsd.org/D46827
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-281-5/+0
| | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740
* mlx4, mlx5: Eliminate redundent NULL check for packet filterZhenlei Huang2024-05-281-1/+1
| | | | | | | | | | | | | | | | | | mlx4 and mlx5 are Ethernet devices and ether_ifattach() does an unconditional bpfattach(). From commit 16d878cc99ef [1] and on, we should not check ifp->if_bpf to tell us whether or not we have any bpf peers that might be interested in receiving packets. And since commit 2b9600b4497b [2], ifp->if_bpf can not be NULL even after the network interface has been detached. No functional change intended. 1. 16d878cc99ef Fix the following bpf(4) race condition which can result in a panic 2. 2b9600b4497b Add dead_bpf_if structure, that should be used as fake bpf_if during ifnet detach Reviewed by: kp, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45196
* linuxkpi: spinlock: Simplify codeEmmanuel Vadot2024-05-161-4/+4
| | | | | | | | | Just use a typedef for spinlock_t, no need to create a useless structure. Reviewed by: bz, emaste Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D45205
* mlx4(5): fix driver initializationYuji Hagiwara2023-12-231-1/+2
| | | | | | | | After netlinkification, ether_ifattach() requires ifmedia_init() to be done before it. PR: 275897 MFC after: 1 week
* mlx4en(4): add missing newline to debug messagesKevin Lo2023-06-181-2/+2
| | | | | | | | Add newline to debug messages after dumping uar_page_shift and reserved_uars. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D40582
* Revert "mlx4: Move DEFINE_MUTEX() outside function body."Hans Petter Selasky2023-05-221-2/+1
| | | | | | Requested by: jrtc27@ This reverts commit 805d759338a2be939fffc8bf3f25cfaab981a9be.
* mlx4: Move DEFINE_MUTEX() outside function body.Hans Petter Selasky2023-05-211-1/+2
| | | | | | | | Move static mutex declaration outside function body, to avoid global variables being declared on the stack, when using SYSINITs. MFC after: 1 week Sponsored by: NVIDIA Networking
* mlx4: Finish conversion to IfAPIJustin Hibbits2023-02-141-6/+6
| | | | | | Fix a few stragglers found with further IfAPI work. Sponsored by: Juniper Networks, Inc.
* Mechanically convert mlx4(4) to IfAPIJustin Hibbits2023-02-0710-171/+171
| | | | | | Reviewed by: hselasky, zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37823
* mlx4: purge EOL release compatibilityElliott Mitchell2023-02-043-18/+1
| | | | | | | | Remove FreeBSD 10 support code. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/603 Differential Revision: https://reviews.freebsd.org/D35560
* mlx4core: Use-after-free causes a resource leak in flow-steering detachHans Petter Selasky2022-06-071-2/+4
| | | | | | | | | | | | | | | | | | | | | | mlx4_QP_FLOW_STEERING_DETACH_wrapper first removes the steering rule (which results in freeing the rule structure), and then references a field in this struct (the qp number) when releasing the busy-status on the rule's qp. Since this memory was freed, it could reallocated and changed. Therefore, the qp number in the struct may be incorrect, so that we are releasing the incorrect qp. This leaves the rule's qp in the busy state (and could possibly release an incorrect qp as well). Fix this by saving the qp number in a local variable, for use after removing the steering rule. Linux commit: 3b01fe7f91c8e4f9afc4fae3c5af72c14958d2d8 PR: 264469 MFC after: 1 week Sponsored by: NVIDIA Networking
* mlx4core: Fix a memory leak when deleting slave's resourcesHans Petter Selasky2022-05-301-0/+1
| | | | | | | | | | | | | mlx4_delete_all_resources_for_slave() in the resource tracker should free all memory allocated for a slave. While releasing memory of fs_rule, it misses releasing memory of fs_rule->mirr_mbox. Linux commit: 461d5f1b59490ce0096dfda45e10038c122a7892 PR: 264249 MFC after: 1 week Sponsored by: NVIDIA Networking
* mlx4: Fix a memory leak bug.Hans Petter Selasky2022-05-191-1/+1
| | | | | | | | | | | | | | In function mlx4_opreq_action(), pointer "mailbox" is not released, when mlx4_cmd_box() return and error, causing a memory leak bug. Fix this issue by going to "out" label, mlx4_free_cmd_mailbox() can free this pointer. Linux commit: febfd9d3c7f74063e8e630b15413ca91b567f963 PR: 264056 MFC after: 1 week Sponsored by: NVIDIA Networking
* mlx4: Remove unused variables.John Baldwin2022-04-092-6/+0
| | | | | Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34826
* mlx4: Remove a variable only used in commented-out code.John Baldwin2022-04-091-3/+0
| | | | | Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34825
* mlx4en(4): Fix two in source code commentsGordon Bergling2022-04-022-2/+2
| | | | | | | - s/differnt/different/ - s/differntly/differently/ MFC after: 3 days
* mlx5/mlx4: Bump driver version to 3.7.1Hans Petter Selasky2022-03-082-4/+4
| | | | | MFC after: 1 week Sponsored by: NVIDIA Networking
* Fix 'take effect' spelling in menus and comments.betterentley2021-11-191-1/+1
| | | | | Signed-off-by: John Bentley <johnbentley.public@gmail.com> Pull Request: https://github.com/freebsd/freebsd-src/pull/559
* mlx4: rename conflicting netdev_priv() to mlx4_netdev_priv()Bjoern A. Zeeb2021-10-257-37/+44
| | | | | | | | | | | | | | netdev_priv() is a LinuxKPI function which was used with the old ifnet linux/netdevice.h implementation which was not adaptable to modern Linux drviers unless rewriting them for ifnet in first place which defeats the purpose. Rename the netdev_priv() calls in mlx4 to mlx4_netdev_priv() returning the ifnet softc to avoid conflicting symbol names with different implementations in the future. MFC after: 3 days Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D32640
* Fix two typos in source code commentsGordon Bergling2021-10-161-1/+1
| | | | | | | - s/alocated/allocated/ - s/realocated/reallocated/ MFC after: 3 days
* mlx4en(4): Fix wrong mbuf cluster size in mlx4_en_debugnet_init()Hans Petter Selasky2021-10-051-1/+1
| | | | | | | | | | | | | | | | This fixes an "invalid cluster size" panic when debugnet is activated. panic() m_getzone() debugnet_mbuf_reinit() debugnet_any_ifnet_update() ifhwioctl() ifioctl() Submitted by: ae@ PR: 258923 MFC after: 1 week Sponsored by: NVIDIA Networking
* mlx5/mlx4: Bump driver version to 3.7Hans Petter Selasky2021-07-282-4/+4
| | | | | | | | | While at it only output driver version to dmesg(8) when hardware is present. Differential Revision: https://reviews.freebsd.org/D29100 MFC after: 1 week Reviewed by: kib and markj Sponsored by: NVIDIA Networking
* ibcore: Kernel space update based on Linux 5.7-rc1.Hans Petter Selasky2021-07-288-344/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Overview: This is the first stage of a RDMA stack upgrade introducing kernel changes only based on Linux 5.7-rc1. This patch is based on about four main areas of work: - Update of the IB uobjects system: - The memory holding so-called AH, CQ, PD, SRQ and UCONTEXT objects is now managed by ibcore. This also require some changes in the kernel verbs API. The updated verbs changes are typically about initialize and deinitialize objects, and remove allocation and free of memory. - Update of the uverbs IOCTL framework: - The parsing and handling of user-space commands has been completely refactored to integrate with the updated IB uobjects system. - Various changes and updates to the generic uverbs interfaces in device drivers including the new uAPI surface. - The mlx5_ib_devx.c in mlx5ib and related mlx5 core changes. Dependencies: - The mlx4ib driver code has been updated with the minimum changes needed. - The mlx5ib driver code has been updated with the minimum changes needed including DV support. Compatibility: - All user-space facing APIs are backwards compatible after this change. - All kernel-space facing RDMA APIs are backwards compatible after this change, with exception of ib_create_ah() and ib_destroy_ah() which takes a new flag. - The "ib_device_ops" structure exist, but only contains the driver ID and some structure sizes. Differences from Linux: - Infiniband drivers must use the INIT_IB_DEVICE_OPS() macro to set the sizes needed for allocating various IB objects, when adding IB device instances. Security: - PRIV_NET_RAW is needed to use raw ethernet transmit features. - PRIV_DRIVER is needed to use other privileged operations. Based on upstream Linux, Torvalds (5.7-rc1): 8632e9b5645bbc2331d21d892b0d6961c1a08429 MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31149 Sponsored by: NVIDIA Networking
* mlx4: Map core_clock page to user space only when allowedHans Petter Selasky2021-07-125-4/+12
| | | | | | | | | | | | | | | | | | Currently when we map the hca_core_clock page to the user space, there are vulnerable registers, one of which is semaphore, on this page as well. If user read the wrong offset, it can modify the above semaphore and hang the device. Hence, mapping the hca_core_clock page to the user space only when user required it specifically. After this patch, mlx4 core_clock won't be mapped to user space by default. Oppose to current state, where mlx4 core_clock is always mapped to user space. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking
* mlx4ib and mlx5ib: Set slid to zero in Ethernet completion structHans Petter Selasky2021-07-121-1/+3
| | | | | | | | | | | | | | | IB spec says that a lid should be ignored when link layer is Ethernet, for example when building or parsing a CM request message (CA17-34). However, since ib_lid_be16() and ib_lid_cpu16() validates the slid, not only when link layer is IB, we set the slid to zero to prevent false warnings in the kernel log. Linux commit: 65389322b28f81cc137b60a41044c2d958a7b950 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking
* ibcore: Declare ib_post_send() and ib_post_recv() arguments constHans Petter Selasky2021-07-124-25/+26
| | | | | | | | | | | | | | | | | | | Since neither ib_post_send() nor ib_post_recv() modify the data structure their second argument points at, declare that argument const. This change makes it necessary to declare the 'bad_wr' argument const too and also to modify all ULPs that call ib_post_send(), ib_post_recv() or ib_post_srq_recv(). This patch does not change any functionality but makes it possible for the compiler to verify whether the ib_post_(send|recv|srq_recv) really do not modify the posted work request. Linux commit: f696bf6d64b195b83ca1bdb7cd33c999c9dcf514 7bb1fafc2f163ad03a2007295bb2f57cfdbfb630 d34ac5cd3a73aacd11009c4fc3ba15d7ea62c411 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking
* ibcore: Simplify ib_modify_qp_is_ok().Hans Petter Selasky2021-07-121-9/+1
| | | | | | | | | | | | | | | | All callers to ib_modify_qp_is_ok() provides enum ib_qp_state makes the checks of out-of-scope redundant. Let's remove them together with updating function signature to return boolean result. While at it remove unused "ll" parameter from ib_modify_qp_is_ok(). Linux commit: 19b1f54099b6ee334acbfbcfbdffd1d1f057216d d31131bba5a1630304c55ea775c48cc84912ab59 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking
* ibcore: Introduce ib_port_phys_state enum.Hans Petter Selasky2021-07-121-1/+2
| | | | | | | | | | | | In order to improve readability, add ib_port_phys_state enum to replace the use of magic numbers. Linux commit: 72a7720fca37fec0daf295923f17ac5d88a613e1 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking
* mlx4/OFED: replace the struct net_device with struct ifnetBjoern A. Zeeb2021-06-188-61/+61
| | | | | | | | | | | | | | | | | Given all the code does operate on struct ifnet, the last step in this longer series of changes now is to rename struct net_device to struct ifnet (that is what it was defined to in the LinuxKPi code). While mlx4 and OFED are "shared" code the decision was made years ago to not write it based on the netdevice KPI but the native ifnet KPI for most of it. This commit simply spells this out and with that frees "struct netdevice" to be re-done on LinuxKPI to become a more native/mixed implementation over time as needed by, e.g., wireless drivers. Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30515
* mlx4: replace LinuxKPI macros with ifnet functionsBjoern A. Zeeb2021-05-273-14/+15
| | | | | | | | | | | The LinuxKPI net_device actually is an ifnet; in order to further clean that up so we can extend "net_device" replace the few macros inline in mlx4. Sponsored by: The FreeBSD Foundation MFC after: 12 days Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30476
* LinuxKPI/OFED/mlx4: cleanup netdevice.h some moreBjoern A. Zeeb2021-05-261-0/+6
| | | | | | | | | | | | | This removes all unused bits from linux/netdevice.h and migrates two inline functions into the mlx4 and ofed code respectively. This gets the mlx4/ofed (struct ifnet) specific bits down to 7 lines in netdevice.h. Sponsored by: The FreeBSD Foundation MFC after: 13 days Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D30461
* mlx4: remove no longer needed headerBjoern A. Zeeb2021-03-261-1/+0
| | | | | | | | | | | Remove linux/inetdevice.h as neither of the two inline functions there are used here. Sposored-by: The FreeBSD Foundation MFC-after: 2 weeks Reviewed-by: hselasky X-D-R: D29366 (extracted as further cleanup) Differential Revision: https://reviews.freebsd.org/D29428
* mlx4, mthca: Silence warnings about no-op alignment operationsMark Johnston2021-02-112-4/+6
| | | | | | | | | | | | | Since commit 8fa6abb6f4f64f ("Expose clang's alignment builtins and use them for roundup2/rounddown2"), clang emits warnings for several alignment operations in these drivers because the operation is a no-op. The compiler is arguably being too strict here, but in the meantime let's silence the warnings by conditionally compiling the alignment operations. Reviewed by: arichardson, hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28576
* linuxkpi: Add more pci functions needed by DRMEmmanuel Vadot2021-01-121-1/+1
| | | | | | | | | | | | | | | | -pci_get_class : This function search for a matching pci device based on the class/subclass and returns a newly created pci_dev. - pci_{save,restore}_state : This is analogous to ours with the same name - pci_is_root_bus : Return true if this is the root bus - pci_get_domain_bus_and_slot : This function search for a matching pci device based on domain, bus and slot/function concat into a single unsigned int (devfn) and returns a newly created pci_dev - pci_bus_{read,write}_config* : Read/Write to the config space. While here add some helper function to alloc and fill the pci_dev struct. Reviewed by: hselasky, bz (older version) Differential Revision: https://reviews.freebsd.org/D27550
* Bump driver versions for mlx5en(4) and mlx4en(4).Hans Petter Selasky2021-01-082-4/+6
| | | | | MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking
* Include GID type when deleting GIDs from HW table under RoCE in mlx4ib.Hans Petter Selasky2020-11-101-2/+7
| | | | | | | | | | | | | | Refer to the Linux commit mentioned below for a more detailed description. Linux commit: a18177925c252da7801149abe217c05b80884798 Requested by: Isilon MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=367555
* Infiniband clients must be attached and detached in a specific order in ibcore.Hans Petter Selasky2020-07-063-6/+6
| | | | | | | | | | | | | | | | | | | Currently the linking order of the infiniband, IB, modules decide in which order the clients are attached and detached. For example one IB client may use resources from another IB client. This can lead to a potential deadlock at shutdown. For example if the ipoib is unregistered after the ib_multicast client is detached, then if ipoib is using multicast addresses a deadlock may happen, because ib_multicast will wait for all its resources to be freed before returning from the remove method. Fix this by using module_xxx_order() instead of module_xxx(). Differential Revision: https://reviews.freebsd.org/D23973 MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=362953
* Allow multicast packets to be received in promiscious mode, in mlx4en(4).Hans Petter Selasky2020-06-171-3/+5
| | | | | | | | | | | | Make sure we disable the multicast filter in promiscious mode aswell as when the all multicast flag is set. MFC after: 1 week Found by: Tycho Nightingale <tychon@freebsd.org> Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=362271
* Avoid trying to toggle TSO twiceRyan Moeller2020-06-151-0/+2
| | | | | | | | | | | | | | Remove TSO from the toggle mask when automatically disabled by TXCKSUM* in various NIC drivers. Reviewed by: hselasky, np, gallatin, jpaetzel Approved by: mav (mentor) MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D25120 Notes: svn path=/head/; revision=362201
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-262-7/+10
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Widen EPOCH(9) usage in mlx4en(4).Hans Petter Selasky2020-01-311-6/+8
| | | | | | | | | | | | | Make sure all receive completion callbacks are covered by the network EPOCH(9), because this is required when calling if_input() and ether_input() after r357012. Convert some spaces to tabs while at it. Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=357327
* Enter the network epoch in RX processing taskqueue.Gleb Smirnoff2020-01-251-0/+3
| | | | Notes: svn path=/head/; revision=357102
* Split out a more generic debugnet(4) from netdump(4)Conrad Meyer2019-10-172-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Debugnet is a simplistic and specialized panic- or debug-time reliable datagram transport. It can drive a single connection at a time and is currently unidirectional (debug/panic machine transmit to remote server only). It is mostly a verbatim code lift from netdump(4). Netdump(4) remains the only consumer (until the rest of this patch series lands). The INET-specific logic has been extracted somewhat more thoroughly than previously in netdump(4), into debugnet_inet.c. UDP-layer logic and up, as much as possible as is protocol-independent, remains in debugnet.c. The separation is not perfect and future improvement is welcome. Supporting INET6 is a long-term goal. Much of the diff is "gratuitous" renaming from 'netdump_' or 'nd_' to 'debugnet_' or 'dn_' -- sorry. I thought keeping the netdump name on the generic module would be more confusing than the refactoring. The only functional change here is the mbuf allocation / tracking. Instead of initiating solely on netdump-configured interface(s) at dumpon(8) configuration time, we watch for any debugnet-enabled NIC for link activation and query it for mbuf parameters at that time. If they exceed the existing high-water mark allocation, we re-allocate and track the new high-water mark. Otherwise, we leave the pre-panic mbuf allocation alone. In a future patch in this series, this will allow initiating netdump from panic ddb(4) without pre-panic configuration. No other functional change intended. Reviewed by: markj (earlier version) Some discussion with: emaste, jhb Objection from: marius Differential Revision: https://reviews.freebsd.org/D21421 Notes: svn path=/head/; revision=353685
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-141-40/+37
| | | | | | | Reviewed by: hselasky Notes: svn path=/head/; revision=353505
* Include eventhandler.h in more compilation unitsConrad Meyer2019-05-211-0/+1
| | | | | | | | | | | | | | | | This was enumerated with exhaustive search for sys/eventhandler.h includes, cross-referenced against EVENTHANDLER_* usage with the comm(1) utility. Manual checking was performed to avoid redundant includes in some drivers where a common os_bsd.h (for example) included sys/eventhandler.h indirectly, but it is possible some of these are redundant with driver-specific headers in ways I didn't notice. (These CUs did not show up as missing eventhandler.h in tinderbox.) X-MFC-With: r347984 Notes: svn path=/head/; revision=348026
* Bump the Mellanox driver version numbers and the FreeBSD version number.Hans Petter Selasky2019-05-082-4/+4
| | | | | | | | MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=347325