summaryrefslogtreecommitdiffstats
path: root/src/drivers/infiniband
Commit message (Collapse)AuthorAgeFilesLines
* [uaccess] Remove redundant copy_from_user() and copy_to_user()Michael Brown2025-04-304-0/+4
| | | | | | | Remove the now-redundant copy_from_user() and copy_to_user() wrapper functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Prevent the use of reserved words in C23Miao Wang2025-04-271-2/+2
| | | | | | | | GCC 15 defaults to C23, which reserves bool, true, and false as keywords. Avoid using these as parameter or variable names. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uaccess] Remove trivial uses of userptr_tMichael Brown2025-04-246-15/+13Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uaccess] Remove user_to_phys() and phys_to_user()Michael Brown2025-04-214-8/+8
| | | | | | | | Remove the intermediate concept of a user pointer from physical address conversions, leaving virt_to_phys() and phys_to_virt() as the directly implemented functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uaccess] Add explicit casts to and from userptr_t where neededMichael Brown2025-04-201-1/+1
| | | | | | | Allow for the possibility of userptr_t becoming a pointer type by adding explicit casts where necessary. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Use ETH_HLEN for inline header sizeRabia Manaa2024-03-171-1/+1
| | | | | | | | | | | | The driver does not correctly handle very short transmitted packets such as EAPoL-Start where the entire DMA content lies within the current send work queue entry inline header length of 18 bytes. Fix by reducing the inline header length to the Ethernet frame header length of 14 bytes. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [drivers] Sort PCI_ROM() entries numericallyGeert Stappers2024-02-222-6/+5Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Done with the help of this Perl script: $MARKER = 'PCI_ROM'; # a regex $AB = 1; # At Begin @HEAD = (); @ITEMS = (); @TAIL = (); foreach $fn (@ARGV) { open(IN, $fn) or die "Can't open file '$fn': $!\n"; while (<IN>) { if (/$MARKER/) { push @ITEMS, $_; $AB = 0; # not anymore at begin } else { if ($AB) { push @HEAD, $_; } else { push @TAIL, $_; } } } } continue { close IN; open(OUT, ">$fn") or die "Can't open file '$fn' for output: $!\n"; print OUT @HEAD; print OUT sort @ITEMS; print OUT @TAIL; close OUT; # For a next file $AB = 1; @HEAD = (); @ITEMS = (); @TAIL = (); } Executed that script while src/drivers/ as current working directory, provided '$(grep -rl PCI_ROM)' as argument. Signed-off-by: Geert Stappers <stappers@stappers.it>
* [libc] Replace linker_assert() with build_assert()Michael Brown2024-01-162-4/+4
| | | | | | | | | | | | | | | | | | | | | | | We currently implement build-time assertions via a mechanism that generates a call to an undefined external function that will cause the link to fail unless the compiler can prove that the asserted condition is true (and thereby eliminate the undefined function call). This assertion mechanism can be used for conditions that are not amenable to the use of static_assert(), since static_assert() will not allow for proofs via dead code elimination. Add __attribute__((error(...))) to the undefined external function, so that the error is raised at compile time rather than at link time. This allows us to provide a more meaningful error message (which will include the file name and line number, as with any other compile-time error), and avoids the need for the caller to specify a unique symbol name for the external function. Change the name from linker_assert() to build_assert(), since the assertion now takes place at compile time rather than at link time. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Make static_assert() available via assert.hMichael Brown2024-01-162-4/+4
| | | | | | | Expose static_assert() via assert.h and migrate link-time assertions to build-time assertions where possible. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Add new PCI ID for NVIDIA BlueField-3 network deviceMohammed Taha2023-01-231-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Allow PCI config space backup to be limited by maximum offsetMichael Brown2022-11-133-6/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Add support for ConnectX-3 based cardsChristian Iversen2021-02-021-0/+4
| | | | | | | | | | | | | | | | | | | | | After a ton of tedious work, I am pleased to finally introduce full support for ConnectX-3 cards in iPXE! The work has been done by finding all publicly available versions of the Mellanox Flexboot sources, cleaning them up, synthesizing a git history from them, cleaning out non-significant changes, and correlating with the iPXE upstream git history. After this, a proof-of-concept diff was produced, that allowed iPXE to be compiled with rudimentary ConnectX-3 support. This diff was over 10k lines, and contained many changes that were not part of the core driver. Special thanks to Michael Brown <mcb30@ipxe.org> for answering my barrage of questions, and helping brainstorm the development along the way. Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [hermon] Avoid parsing length field on completion errorsMichael Brown2021-02-021-2/+16
| | | | | | | | | | | The CQE length field will not be valid for a completion in error. Avoid parsing the length field and just call the completion handler directly. In debug builds, also dump the queue pair context to allow for inspection of the error. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Make hermon_dump_xxx() functions no-ops on non-debug buildsMichael Brown2021-02-021-0/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Minimise reset timeMichael Brown2021-02-012-7/+32
| | | | | | | | | Check for reset completion by waiting for the device to respond to PCI configuration cycles, as documented in the Programmer's Reference Manual. On the original ConnectX HCA, this reduces the time spent on reset from 1000ms down to 1ms. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Throttle debug output when sensing port typeChristian Iversen2021-02-011-0/+3
| | | | | | | | When auto-detecting the initial port type, the Hermon driver will spam the debug output without hesitation. Add a short delay in each iteration to fix this. Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [hermon] Add a debug notice when initialization is completeChristian Iversen2021-02-011-0/+1
| | | | | | Signed-off-by: Christian Iversen <ci@iversenit.dk> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Add support for port management eventChristian Iversen2021-02-012-0/+39
| | | | | | | | | | Inspired by Flexboot, the function hermon_event_port_mgmnt_change() is added to handle the HERMON_EV_PORT_MGMNT_CHANGE event type, which updates the Infiniband subsystem. Signed-off-by: Christian Iversen <ci@iversenit.dk> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Adjust Ethernet work queue sizeChristian Iversen2021-02-011-3/+3
| | | | | | | | | | | | | Hermon Ethernet work queues have more RX than TX entries, unlike most other drivers. This is possibly the source of some stochastic deadlocks previously experienced with this driver. Update the sizes to be in line with other drivers, and make them slightly larger for better performance. These new queue sizes have been found to work well with ConnectX-3 hardware. Signed-off-by: Christian Iversen <ci@iversenit.dk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Use reset value suitable for ConnectX-3Michael Brown2021-02-011-1/+1
| | | | | | | | | | | | | | | The programming documentation states that the reset magic value is "0x00000001 (Big Endian)", and the current code matches this by using the value 0x01000000 for the implicitly little-endian writel(). Inspection of the FlexBoot source code reveals an exciting variety of reset values, some suggestive of confusion around endianness. Experimentation suggests that the value 0x01000001 works reliably across a wide range of hardware. Debugged-by: Christian Iversen <ci@iversenit.dk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Clean up whitespace in hermon.cChristian Iversen2021-02-011-1/+1
| | | | Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [hermon] Limit link poll frequency in DOWN stateMichael Brown2021-02-012-1/+17
| | | | | | | | | | | | | | | | | | | Some older versions of the hardware (and/or firmware) do not report an event when an Infiniband link reaches the INIT state. The driver works around this missing event by calling ib_smc_update() on each event queue poll while the link is in the DOWN state. Commit 6cb12ee ("[hermon] Increase polling rate for command completions") addressed this by speeding up the time taken to issue each command invoked by ib_smc_update(). Experimentation shows that the impact is still significant: for example, in a situation where an unplugged port is opened, the throughput on the other port can be reduced by over 99%. Fix by throttling the rate at which link polling is attempted. Debugged-by: Christian Iversen <ci@iversenit.dk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Perform clean MPT unmap on device shutdownChristian Iversen2021-01-292-0/+29
| | | | | | | | | | This change is ported from Flexboot sources. When stopping a Hermon device, perform hermon_unmap_mpt() which runs HERMON_HCR_HW2SW_MPT to bring the Memory Protection Table (MPT) back to software control. Signed-off-by: Christian Iversen <ci@iversenit.dk> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Use Ethernet MAC as eIPoIB local EMACChristian Iversen2021-01-292-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | The eIPoIB local Ethernet MAC is currently constructed from the port GUID. Given a base GUID/MAC value of N, Mellanox seems to populate: Node GUID: N + 0 Port 1 GUID: N + 1 Port 2 GUID: N + 2 and Port 1 MAC: N + 0 Port 2 MAC: N + 1 This causes a duplicate local MAC address when port 1 is configured as Infiniband and port 2 as Ethernet, since both will derive their MAC address as (N + 1). Fix by using the port's Ethernet MAC as the eIPoIB local EMAC. This is a behavioural change that could potentially break configurations that rely on the local EMAC value, such as a DHCP server relying on the chaddr field for DHCP reservations. Signed-off-by: Christian Iversen <ci@iversenit.dk> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Increase polling rate for command completionsChristian Iversen2021-01-291-2/+2
| | | | | | | | | | | | | | | | | | Some older versions of the hardware (and/or firmware) do not report an event when an Infiniband link reaches the INIT state. The driver works around this missing event by calling ib_smc_update() on each event queue poll while the link is in the DOWN state. This results in a very large number of commands being issued while any open Infiniband link is in the DOWN state (e.g. unplugged), to the point that the 1ms delay from waiting for each command to complete will noticeably affect responsiveness. Fix by decreasing the command completion polling delay from 1ms to 10us. Signed-off-by: Christian Iversen <ci@iversenit.dk> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Add event queue debug functionsMichael Brown2021-01-281-2/+76
| | | | | | | | Add hermon_dump_eqctx() for dumping the event queue context and hermon_dump_eqes() for dumping any unconsumed event queue entries. Originally-implemented-by: Christian Iversen <ci@iversenit.dk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Increase command timeout from 2 to 10 secondsChristian Iversen2021-01-281-1/+1
| | | | | | | | Some commands (particularly in relation to device initialization) can occasionally take longer than 2 seconds, and the Mellanox documentation recommends a 10 second timeout. Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [hermon] Add assorted debug error messagesMichael Brown2021-01-281-6/+33
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Show "issuing command" messages only at DBGLVL_EXTRAMichael Brown2021-01-281-7/+5Star
| | | | | Originally-implemented-by: Christian Iversen <ci@iversenit.dk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Reorganize PCI ROM list and document well-known product namesChristian Iversen2021-01-281-2/+9
| | | | Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [golan] Backport typo fix in nodnic_prm.h: s/HERMON/NODNIC/Christian Iversen2021-01-281-2/+2
| | | | Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [arbel] Clean up whitespace in MT25218_PRM.h headerChristian Iversen2021-01-281-88/+88
| | | | Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [hermon] Clean up whitespace in MT25408_PRM.h headerChristian Iversen2021-01-281-132/+132
| | | | Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [infiniband] Require drivers to specify the number of portsChristian Iversen2021-01-276-0/+6
| | | | | | | | | | | | Require drivers to report the total number of Infiniband ports. This is necessary to report the correct number of ports on devices with dynamic port types. For example, dual-port Mellanox cards configured for (eth, ib) would be rejected by the subnet manager, because they report using "port 2, out of 1". Signed-off-by: Christian Iversen <ci@iversenit.dk>
* [golan] Add new PCI IDsMohammed Taha2020-12-281-0/+3
| | | | | Signed-off-by: Mohammed <mohammedt@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Rename malloc_dma() to malloc_phys()Michael Brown2020-11-056-108/+108
| | | | | | | | | | | | The malloc_dma() function allocates memory with specified physical alignment, and is typically (though not exclusively) used to allocate memory for DMA. Rename to malloc_phys() to more closely match the functionality, and to create name space for functions that specifically allocate and map DMA-capable buffers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Update drivers to use pci_ioremap()Michael Brown2020-09-257-19/+28
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Add explicit type casts for nodnic_queue_pair_typeMichael Brown2020-06-271-2/+4
| | | | | | | | | | GCC 10 emits warnings for implicit conversions of enumerated types. The flexboot_nodnic code defines nodnic_queue_pair_type with values identical to those of ib_queue_pair_type, and implicitly casts between them. Add an explicit cast to fix the warning. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Fix address-of-pointer bug for multicast attach/detachMichael Brown2019-08-171-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Add various new PCI device IDsMohammed2019-05-021-0/+3
| | | | | Signed-off-by: Mohammed <mohammedt@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [vlan] Provide vlan_netdev_rx() and vlan_netdev_rx_err()Michael Brown2019-04-271-12/+6Star
| | | | | | | | | The Hermon driver uses vlan_find() to identify the appropriate VLAN device for packets that are received with the VLAN tag already stripped out by the hardware. Generalise this capability and expose it for use by other network card drivers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Set log_max_qp to 1Ameer Mahagneh2018-03-202-4/+3Star
| | | | | | | This is required to work around a bug in some firmware versions. Signed-off-by: Ameer Mahagneh <ameerm@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Do not assume all devices are identicalMichael Brown2018-03-181-5/+2Star
| | | | | | | | Remove the global variable shomron_nodnic_supported, since it may have different values for different PCI devices. Originally-fixed-by: Mohammed Taha <mohammedt@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Avoid implicit-fallthrough warnings on GCC 7Michael Brown2017-03-291-0/+1
| | | | | | Reported-by: Vinson Lee <vlee@freedesktop.org> Reported-by: Liang Yan <lyan@suse.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Bug fixes and improved paging allocation methodRaed Salem2017-03-2317-555/+199Star
| | | | | | | | Updates: - revert Support for clear interrupt via BAR Signed-off-by: Raed Salem <raeds@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Assert that mapping length is non-zeroMichael Brown2017-03-221-0/+1
| | | | | | | An (impossible) mapping length of zero produces a negative bit shift, which is technically undefined. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [arbel] Assert that mapping length is non-zeroMichael Brown2017-03-221-0/+1
| | | | | | | An (impossible) mapping length of zero produces a negative bit shift, which is technically undefined. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [infiniband] Return status code from ib_create_cq() and ib_create_qp()Michael Brown2017-03-222-20/+16Star
| | | | | | | | | | | | Any underlying errors arising during ib_create_cq() or ib_create_qp() are lost since the functions simply return NULL on error. This makes debugging harder, since a debug-enabled build is required to discover the root cause of the error. Fix by returning a status code from these functions, thereby allowing any underlying errors to be propagated. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [qib7322] Use correct length for memset()Michael Brown2017-03-211-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linda] Use correct length for memset()Michael Brown2017-03-211-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>