aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ntb/if_ntb
Commit message (Collapse)AuthorAgeFilesLines
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* Report NTB link speed to console and interface.Alexander Motin2017-04-231-13/+4
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=317340
* Pretend we support some IOCTLs to not scary upper layers.Alexander Motin2017-01-111-0/+5
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=311935
* Make MAC address generation more random.Alexander Motin2016-07-301-2/+1
| | | | | | | 'ticks' approach does not work at boot time. Notes: svn path=/head/; revision=303553
* Once more refactor KPI between ntb_transport(4) and if_ntb(4)..Alexander Motin2016-07-291-4/+5
| | | | | | | | | New design allows to attach multiple consumers to ntb_transport(4) instance. Previous design obtained from Linux theoretically allowed that, but was not practically usable (Linux also has only one consumer driver now). Notes: svn path=/head/; revision=303494
* Improve checksum "offload" support.Alexander Motin2016-07-091-4/+50
| | | | | | | | | | | | | For compatibility reasons make driver not report any checksum offload by default, since there is indeed none. But if administrator knows that interface is used only for local traffic, he can enable fake checksum offload manually on both sides to save some CPU cycles, since the data are already protected by CRC32 of PCIe link. Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=302499
* Rewrite if_ntb to use modern interface KPIs and features.Alexander Motin2016-07-091-90/+249
| | | | | | | | | It includes: link state, if_transmit, buf_ring, multiple queues, bpf, etc. Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=302496
* Improve memory allocation errors handling on receive.Alexander Motin2016-07-091-1/+6
| | | | Notes: svn path=/head/; revision=302495
* Synchronize MTU code with Linux.Alexander Motin2016-07-091-3/+2
| | | | | | | It is mandatory for transport compatibility. Notes: svn path=/head/; revision=302494
* NewBus'ify NTB subsystem.Alexander Motin2016-07-091-1476/+69
| | | | | | | | | | | | This follows NTB subsystem modularization in Linux, tuning it to FreeBSD native NewBus interfaces. This change allows to support different types of hardware with different drivers, support multiple NTB instances in a system, ntb_transport module use for needs other then if_ntb, etc. Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=302484
* Fix if_ntb interface setup to include IFF_MULTICAST.Eric van Gyzen2016-06-181-1/+1
| | | | | | | | | | | | | | | | This allows IPv6 link local addresses (and other IPv6 functionality) to work. PR: 210355 Submitted by: Steve Wahl and David Bright (both at Dell Inc.) Reviewed by: cem, mav Tested by: mav (on Intel hardware) Approved by: re (kib) MFC after: 5 days Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D6885 Notes: svn path=/head/; revision=302014
* Re-enable write combining, disabled by default at r295486.Alexander Motin2016-05-241-0/+4
| | | | | | | | | | if_ntb(4) strongly benefits from WC, improving throughput from 350Mbit/s to 8-10Gbit/s on my tests. MFC after: 1 week Notes: svn path=/head/; revision=300610
* As <machine/pmap.h> is included from <vm/pmap.h>, there is no need toSvatopluk Kraus2016-02-221-1/+0
| | | | | | | | | | include it explicitly when <vm/pmap.h> is already included. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5373 Notes: svn path=/head/; revision=295880
* if_ntb: Don't roundup MW size to full BAR size unnecessarilyConrad Meyer2015-12-031-1/+1
| | | | | | | | | | | | | | | | | | Note that the MW allocation still must be BAR *aligned*. So, this only loosens the constraints on MW allocation slightly. BAR-aligned does not play well with large (GB+) BAR sizes. Going forward, if anyone cares about if_ntb on very large BARs, I suggest they add functionality to allocate a smaller window than the BAR size, and set the BAR range to cover a window much larger than the allocated window. This will require negotiating a window offset and limit for protocol traffic. None of this is implemented in this revision. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291706
* if_ntb: Log error *before* zeroing relevant variablesConrad Meyer2015-12-031-2/+2
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291705
* if_ntb: Initialize if_mtu to the correct MTUConrad Meyer2015-11-191-1/+6
| | | | | | | | | | Lower the payload data (IP) portion of the MTU from 0x10000 to IP_MAXPACKET (0xFFFF) to avoid panicing the IP stack. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291085
* if_ntb: Add Xeon link watchdog register writesConrad Meyer2015-11-191-0/+31
| | | | | | | | | | | | | | This feature is disabled by default. To enable it, tune hw.if_ntb.enable_xeon_watchdog to non-zero. If enabled, writes an unused NTB register every second to demonstrate to a hardware watchdog that the NTB device is still alive. Most machines with NTB will not need this -- you know who you are. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291084
* if_ntb: Reuse receive buffers correctlyConrad Meyer2015-11-181-10/+22
| | | | | | | | | | | | | | | | Discard the unused rx_free_q. Instead, reuse inputed packets by putting them back on the *pend* queue after reinitialization. If tx or rx handlers are unavailable, free mbufs rather than leaking them. With this change, if_ntb can receive more than 100 (NTB_QP_DEF_NUM_ENTRIES) packets. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291034
* NTB: Expose 32-bit BAR limits to consumersConrad Meyer2015-11-181-2/+4
| | | | | | | | | | | | | 32-bit BARs can only address memory mapped in the low 32 bits of physical RAM. Expose this as a 'plimit' out parameter from ntb_mw_get_range(). Fix if_ntb to allocate memory within this limit. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291033
* if_ntb: Diff reduce with LinuxConrad Meyer2015-11-181-24/+29
| | | | | | | | | | | | Use bus_space_write instead of (non-volatile) C pointer writes via an iowrite32() shim in the same places as the Dual BSD/GPL Linux driver. Update some types to fixed 32-bit sizes. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291028
* if_ntb: Clear the right QP in the free bitmapConrad Meyer2015-11-141-1/+1
| | | | | | | | | Now it can ping back and forth. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290810
* if_ntb: MFV c92ba3c5: invalid buf pointer in multi-MW setupsConrad Meyer2015-11-111-2/+2
| | | | | | | | | | | | | | | | Order of operations issue with the QP Num and MW count, which would result in the receive buffer pointer being invalid if there are more than 1 MW. Corrected with parenthesis to enforce the proper order of operations. Reported by: John I. Kading <John.Kading@gd-ms.com> Reported by: Conrad Meyer <cem@FreeBSD.org> Authored by: Jon Mason <jdmason@kudzu.us> Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290688
* ntb: volatile some members set by interrupt routinesConrad Meyer2015-11-111-2/+2
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290686
* if_ntb: Add module-specific log levelConrad Meyer2015-11-111-29/+39
| | | | | | | | | Rather than relying on the quite accurately named 'bootverbose'. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290684
* if_ntb: Transport link cleanup needs to be on a taskqueueConrad Meyer2015-11-111-2/+11
| | | | | | | | | | | | | | Because it can sleep drainking link work callout(s). Linux (dual BSD/GPL driver) does something very similar. At the same time, switch the NTB CTX lock to a non-spin mutex, because the taskqueue_swi lock can't be taken after a spin mutex. Suggested by: Witness Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290683
* NTB: Diff reduce with LinuxConrad Meyer2015-11-111-3/+7
| | | | | | | | | No functional change. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290682
* ntb: Use caddr_t to simplify pointer arithmeticConrad Meyer2015-11-111-11/+10
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290679
* if_ntb: Use ffsll() now that it is broadly availableConrad Meyer2015-10-221-8/+1
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289775
* NTB: Revert r289645Conrad Meyer2015-10-201-4/+0
| | | | | | | | | | Per Benno, this is a Linuxism we do not need in FreeBSD. Suggested by: benno Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289654
* if_ntb: Diff-reduce with Linux; add queue index typeConrad Meyer2015-10-201-10/+15
| | | | | | | | | | | | Add ntb_q_idx_t so it is more clear which struct members are of the same type (some bogus uint64_ts snuck in that should have been unsigned int). Add tx_err_no_buf and s/ENOMEM/EBUSY/ in tx_enqueue to match Linux. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289653
* NTB: MFV 8c9edf63: Fix zero size or integer overflow in ntb_set_mwConrad Meyer2015-10-201-4/+7
| | | | | | | | | | | | | | | | | | A plain 32 bit integer will overflow for values over 4GiB. Change the plain integer size to the appropriate size type in ntb_set_mw. Change the type of the size parameter and two local variables used for size. Even if there is no overflow, a size of zero is invalid here. Authored by: Allen Hubbe Reported by: Juyoung Jung Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289652
* NTB: MFV da2e5ae5: Fix ntb_transport out-of-order RX updateConrad Meyer2015-10-201-44/+74
| | | | | | | | | | | | | | | | | | | | | | | | It was possible for a synchronous update of the RX index in the error case to get ahead of the asynchronous RX index update in the normal case. Change the RX processing to preserve an RX completion order. There were two error cases. First, if a buffer is not present to receive data, there would be no queue entry to preserve the RX completion order. Instead of dropping the RX frame, leave the RX frame in the ring. Schedule RX processing when RX entries are enqueued, in case there are RX frames waiting in the ring to be received. Second, if a buffer is too small to receive data, drop the frame in the ring, mark the RX entry as done, and indicate the error in the RX entry length. Check for a negative length in the receive callback in ntb_netdev, and count occurrences as rx_length_errors. Authored by: Allen Hubbe Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289651
* if_ntb: Correct over-long lines, use qmin()Conrad Meyer2015-10-201-4/+4
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289650
* if_ntb: Use if_printf instead of device_printfConrad Meyer2015-10-201-8/+7
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289649
* NTB: MFV 7eb38781: Print driver name in module initConrad Meyer2015-10-201-0/+4
| | | | | | | | | | | Prints driver name to indicate what is being loaded. Authored by: Dave Jiang Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289645
* NTB: MFV 9891417d: Increase transport MTU to 64k from 16kConrad Meyer2015-10-201-1/+1
| | | | | | | | | | | | Benchmarking showed a significant performance increase with the MTU size to 64k instead of 16k. Change the driver default to 64k. Authored by: Dave Jiang Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289616
* if_ntb: Fix typo in qp_link_work to match LinuxConrad Meyer2015-10-201-2/+2
| | | | | | | | | | | Throw away the result of the peer SPAD read. The peer will write our local SPAD and we need to keep the locally read SPAD value to check if the remote side is up. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289615
* if_ntb: MFV 2849b5d7: Reset transport QP link stats on downConrad Meyer2015-10-201-9/+22
| | | | | | | | | | | | | | Reset the link stats when the link goes down. In particular, the TX and RX index and count must be reset, or else the TX side will be sending packets to the RX side where the RX side is not expecting them. Reset all the stats, to be consistent. Authored by: Allen Hubbe Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289613
* NTB: Add ntb_db_vector_mask() missed in r289546Conrad Meyer2015-10-191-2/+2
| | | | | | | | | | This is the last one. Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289598
* if_ntb: MFV e26a5843: Move MW/DB management to if_ntbConrad Meyer2015-10-181-230/+346
| | | | | | | | | | | | | | | | | | | | | | | | | | This is the last e26a5843 patch. The general thrust of the rewrite was to move more responsibility for Memory Window and Doorbell interrupt management from the ntb_hw driver to if_ntb. A number of APIs have been added, removed, or replaced. The old DB callback mechanism has been excised. Instead, callers (if_ntb) are responsible for configuring MWs and handling their interrupts more directly. This adds a tunable, hw.ntb.max_mw_size, allowing users to limit the size of memory windows used by if_ntb (identical to the Linux modparam of the same name). Despite attempts to keep mechanical name changes to separate commits, some have snuck in here. At least the driver should be much more similar to the latest Linux one now -- making porting fixes easier. Authored by: Allen Hubbe Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289546
* if_ntb: Rename things to match Linux driverConrad Meyer2015-10-181-115/+117
| | | | | | | | | | No functional change. Part of the huge rewrite (e26a5843). Obtained from: Linux (e26a5843) (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289545
* if_ntb: Replace handmade bitset macros with sys/bitset.hConrad Meyer2015-10-181-13/+22
| | | | | | | | | No functional change. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289544
* NTB: Rename some variables/functions to match LinuxConrad Meyer2015-10-181-5/+5
| | | | | | | | | | | | | | No functional change. Still part of the huge e26a5843 rewrite. I'm trying to make it less of a complete rewrite in the FreeBSD version of the driver. Still, it helps if our names match Linux. Obtained from: Linux (e26a5843) (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289539
* NTB: Add variable number MW, DB CB support codeConrad Meyer2015-10-151-24/+31
| | | | | | | | | | | | | | | | | | | | | | | This is a follow-up to r289208: "Xeon Errata Workaround." Add logic to support a variable number of memory windows and doorbell callbacks. This was added to the Linux driver in the "Xeon Errata Workaround" commit, but I skipped it because it didn't look neccessary at the time. It is needed for future Haswell split-BAR support, so bring it in now. A new tunable was added for if_ntb, 'hw.ntb.max_num_clients'. By default, it is set to zero -- infer the number of clients from the number of memory windows available from the hardware. Any other positive value can specify a different number of clients, limited by the number of doorbell callbacks available (4 under MSI-X, or 15 (Xeon) or 34 (SoC) under legacy INTx). Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289396
* if_ntb: MFV 3cc5ba19: Add alignment check to meet hardware requirementConrad Meyer2015-10-141-2/+15
| | | | | | | | | | | | | | | | | | Original Linux commit log: The NTB translate register must have the value to be BAR size aligned. This alignment check make sure that the DMA memory allocated has the proper alignment. Another requirement for NTB to function properly with memory window BAR size greater or equal to 4M is to use the CMA feature in 3.16 kernel with the appropriate CONFIG_CMA_ALIGNMENT and CONFIG_CMA_SIZE_MBYTES set. Authored by: Dave Jiang Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289346
* NTB: MFV a1413cfb: correct the spread of queues over mw'sConrad Meyer2015-10-141-2/+2
| | | | | | | | | | | | | The detection of an uneven number of queues on the given memory windows was not correct. The mw_num is zero based and the mod should be division to spread them evenly over the mw's. Authored by: Jon Mason Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289345
* if_ntb: Cleanup styleConrad Meyer2015-10-141-9/+9
| | | | Notes: svn path=/head/; revision=289341
* NTB: MFV 403c63cb: client event cleanupConrad Meyer2015-10-141-4/+18
| | | | | | | | | | | Provide a better event interface between the client and transport. Authored by: Jon Mason Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289340
* NTB: MFV e8aeb60c: Disable interrupts and poll under high loadConrad Meyer2015-10-141-14/+9
| | | | | | | | | Authored by: Jon Mason Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289281
* NTB: MFV fca4d518: Fix ntb_transport link down raceConrad Meyer2015-10-131-6/+6
| | | | | | | | | | | | | | | | A WARN_ON is being hit in ntb_qp_link_work due to the NTB transport link being down while the ntb qp link is still active. This is caused by the transport link being brought down prior to the qp link worker thread being terminated. To correct this, shutdown the qp's prior to bringing the transport link down. Also, only call the qp worker thread if it is in interrupt context, otherwise call the function directly. Authored by: Jon Mason Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289273