aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cxgbe/t4_netmap.c
Commit message (Collapse)AuthorAgeFilesLines
* cxgbe: Flush transmitted packets more regularly in netmap modeMark Johnston2024-07-151-13/+12
| | | | | | | | Previously, when transmitting short runs of packets via cxgbe_nm_tx(), we would wait until a large number of packets were buffered before scheduling a task to clean transmit buffers. Obtained from: np
* cxgbe(4): Add support for netmap offsets.Navdeep Parhar2024-01-081-3/+11
| | | | | | PR: 253069 MFC after: 1 week Sponsored by: Chelsio Communications
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Mechanically convert cxgb(4) and cxgbe(4) to IfAPIJustin Hibbits2023-03-071-14/+14
| | | | | | Reviewed by: np Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38597
* cxgbe: Various whitespace fixes.John Baldwin2022-11-151-2/+2
| | | | | | | Mostly trailing whitespace and spaces before tabs. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D37350
* cxgbe(4): Add another setting to the knob that controls congestion.Navdeep Parhar2022-09-121-29/+12
| | | | | | | | hw.cxgbe.cong_drop=2 will generate backpressure *and* drop frames for queues that are congested. MFC after: 2 weeks Sponsored by: Chelsio Communications
* cxgbe(4): Specify the ingress queue's type when creating it.Navdeep Parhar2022-09-121-0/+1
| | | | | | | | The firmware takes the type into account when setting up the PCIe channel for the queue. MFC after: 1 week Sponsored by: Chelsio Communications
* cxgbe(4): Separate the sw- and hw-specific parts of resource allocationsNavdeep Parhar2021-04-261-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver uses both software resources (locks, callouts, memory for descriptors and for bookkeeping, sysctls, etc.) and hardware resources (VIs, DMA queues, TCAM entries, etc.) to operate the NIC. This commit splits the single *_ALLOCATED flag used to track all these resources into separate *_SW_ALLOCATED and *_HW_ALLOCATED flags. This is the simplified pseudocode that now applies to most queues (foo can be ctrlq/txq/rxq/ofld_txq/ofld_rxq): /* Idempotent */ alloc_foo { if (!SW_ALLOCATED) init_iq/init_eq/init_fl no-fail sw init alloc_iq_fl/alloc_eq/alloc_wrq may-fail sw alloc add_foo_sysctls, etc. no-fail post-alloc items if (!HW_ALLOCATED) alloc_iq_fl_hwq/alloc_eq_hwq hw resource allocation } /* Idempotent */ free_foo { if (!HW_ALLOCATED) free_iq_fl_hwq/free_eq_hwq release hw resources if (!SW_ALLOCATED) free_iq_fl/free_eq/free_wrq release sw resources } The routines that take the driver to FULL_INIT_DONE and VI_INIT_DONE and back are now all idempotent. The quiesce routines pay attention to the HW_ALLOCATED flag and will not wait on the hardware for pidx/cidx updates and other completions if this flag is not set. MFC after: 1 month Sponsored by: Chelsio Communications
* cxgbe(4): use standard sysctl routines to deal with 16b values.Navdeep Parhar2021-03-191-18/+12
| | | | | | | | These routines to handle 8b and 16b types were added in r289773 5+ years ago. MFC after: 2 weeks Sponsored by: Chelsio Communications
* cxgbe(4): Stop but don't free netmap queues when netmap is switched off.Navdeep Parhar2020-12-031-25/+195
| | | | | | | | | | | | | | | | It is common for freelists to be starving when a netmap application stops. Mailbox commands to free queues can hang in such a situation. Avoid that by not freeing the queues when netmap is switched off. Instead, use an alternate method to stop the queues without releasing the context ids. If netmap is enabled again later then the same queue is reinitialized for use. Move alloc_nm_rxq and txq to t4_netmap.c while here. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=368296
* cxgbe(4): Revert r367917.Navdeep Parhar2020-12-021-48/+0
| | | | | | | | | | | | r367917 fixed the backpressure on the netmap rxq being stopped but that doesn't help if some other netmap rxq is starved (because it is stopping too although the driver doesn't know this yet) and blocks the pipeline. An alternate fix that works in all cases will be checked in instead. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=368283
* cxgbe(4): Catch up with in-flight netmap rx before destroying queues.Navdeep Parhar2020-11-211-0/+48
| | | | | | | | | | | | | | The netmap application using the driver is responsible for replenishing the receive freelists and they may be totally depleted when the application exits. Packets in flight, if any, might block the pipeline in case there aren't enough buffers left in the freelist. Avoid this by filling up the freelists with a driver allocated buffer. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=367917
* cxgbe(4): fix the size of the iq/eq maps.Navdeep Parhar2020-10-221-6/+6
| | | | | | | | | | | | | | The firmware can allocate ingress and egress context ids anywhere from its configured range. Size the iq/eq maps to match the entire range instead of assuming that the firmware always allocates the first available context id. Reported by: Baptiste Wicht @ Verisign MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=366929
* cxgbe(4): Avoid unnecessary work in the firmware during netmap tx.Navdeep Parhar2020-09-291-0/+16
| | | | | | | | | | | | Bind the netmap tx queues to a special '0xff' scheduling class which makes the firmware skip some processing related to rate limiting on the outgoing traffic. Future firmwares will do this automatically. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=366247
* Remove duplicate line.Navdeep Parhar2020-09-291-3/+0
| | | | Notes: svn path=/head/; revision=366246
* cxgbe(4): adjust the doorbell threshold for netmap freelists to match theNavdeep Parhar2020-09-291-1/+4
| | | | | | | | | | maximum burst size used when fetching descriptors from the list. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=366245
* cxgbe(4): display an error message when netmap cannot be enabled becauseNavdeep Parhar2020-09-291-1/+4
| | | | | | | | | the interface is down. MFC after: 1 week Notes: svn path=/head/; revision=366244
* cxgbe(4): fixes for netmap operation with only some queues active.Navdeep Parhar2020-09-291-77/+201
| | | | | | | | | | | | | | | | | | - Only active netmap receive queues should be in the RSS lookup table. - The RSS table should be restored for NIC operation when the last active netmap queue is switched off, not the first one. - Support repeated netmap ON/OFF on a subset of the queues. This works whether the the queues being enabled and disabled are the only ones active or not. Some kring indexes have to be reset in the driver for the second case. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=366242
* cxgbe(4): Add a pointer to the adapter softc in vi_info.Navdeep Parhar2020-06-251-8/+8
| | | | | | | | | | | | | There were quite a few places where port_info was being accessed only to get to the adapter. Reviewed by: jhb@ MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D25432 Notes: svn path=/head/; revision=362616
* cxgbe(4): Split sge_nm_rxq into three cachelines.Navdeep Parhar2020-03-201-3/+3
| | | | | | | | | | | | | | | This reduces the lines bouncing around between the driver rx ithread and the netmap rxsync thread. There is no net change in the size of the struct (it continues to waste a lot of space). This kind of split was originally proposed in D17869 by Marc De La Gueronniere @ Verisign, Inc. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=359159
* cxgbe(4): Add a knob to allow netmap tx traffic to be checksummed byNavdeep Parhar2020-02-051-7/+12
| | | | | | | | | | | | the hardware. hw.cxgbe.nm_txcsum=1 MFC after: 2 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=357553
* cxgbe(4): Allow nm_black_hole and nm_cong_drop to be set at any time.Navdeep Parhar2020-02-051-2/+2
| | | | | | | | | | | The cong_drop setting will apply to queues created after the setting is changed and not to existing queues. MFC after: 2 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=357552
* cxgbe(4): Report accurate rx_buf_maxsize to netmap.Navdeep Parhar2020-02-041-0/+1
| | | | | | | | MFC after: 2 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=357551
* cxgbe(4): Retire the allow_mbufs_in_cluster optimization.Navdeep Parhar2020-02-041-6/+11
| | | | | | | | | | | This simplifies the driver's rx fast path as well as the bookkeeping code that tracks various rx buffer sizes and layouts. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=357481
* cxgbe(4): Never use hardware checksumming in netmap tx.Navdeep Parhar2019-12-121-10/+5
| | | | | | | | MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=355673
* cxgbe(4): Use TX_PKTS2 work requests in netmap Tx if it's available.Navdeep Parhar2019-12-101-4/+11
| | | | | | | | | | | TX_PKTS2 is more efficient within the firmware and this improves netmap Tx by a few Mpps in some common scenarios. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=355580
* cxgbe(4): Use correct FetchBurstMin values for T6.Navdeep Parhar2019-10-251-4/+6
| | | | | | | | MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=354106
* cxgbe: revert r309725Vincenzo Maffione2018-11-281-1/+1
| | | | | | | | | | | | | After the fix contained in r341144, cxgbe does not need anymore to set the IFCAP_NETMAP flag manually. Reviewed by: np Approved by: gnn (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D17987 Notes: svn path=/head/; revision=341145
* Add read-only sysctls for all tunables in the cxgbe(4) driver.John Baldwin2018-11-271-3/+3
| | | | | | | | | | Reviewed by: np MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D18360 Notes: svn path=/head/; revision=341098
* cxgbe/netmap: Fix cxgbe netmap when interface is DOWNJulien Charbon2018-11-121-0/+3
| | | | | | | | | | | | | | | | A kernel panic can occur if the cxgbe interface is DOWN when activating netmap. This patch prevents the driver from freeing up cxgbe netmap resources when they have not been allocated. Submitted by: Nicolas Witkowski <nwitkowski@verisign.com> Reviewed by: np MFC after: 1 week Sponsored by: Verisign, Inc. Differential Revision: https://reviews.freebsd.org/D17802 Notes: svn path=/head/; revision=340375
* cxgbe(4): Add a knob to split the rx queues for a netmap enabledNavdeep Parhar2018-10-251-8/+66
| | | | | | | | | | | | interface into two groups. Filters can be used to match traffic and distribute it across a group. hw.cxgbe.nm_split_rss Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=339749
* cxgbe(4): Update the VI's default queue when netmap is enabled/disabled.Navdeep Parhar2018-10-251-0/+8
| | | | | | | Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=339705
* cxgbe(4): Be explicit about ignoring the return value of cmpset in someNavdeep Parhar2018-08-211-1/+1
| | | | | | | | | | cases. Reported by: Coverity (CIDs 1009398, 1009400, 1009401, 1357325, 1394783). All false positives. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=338166
* cxgbe(4): Create two variants of service_iq, one for queues withNavdeep Parhar2018-08-111-8/+3
| | | | | | | | | | freelists and one for those without. MFH: 3 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=337609
* cxgbe(4): Add a sysctl to control the tx credit reclaim mechanism forNavdeep Parhar2018-08-091-2/+8
| | | | | | | | | netmap tx queues. There is no change in default behavior. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=337553
* cxgbe(4): Add a hw.cxgbe.starve_fl sysctl that can be used to starve theNavdeep Parhar2018-06-151-4/+23
| | | | | | | | | | freelists of netmap receive queues. This is primarily to test various congestion scenarios in the chip. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=335243
* cxgbe(4): Track the number of received frames separately from the numberNavdeep Parhar2018-06-151-16/+25
| | | | | | | | | | | | | of descriptors processed. Add the ability to gather a certain maximum number of frames in the driver's rx before waking up netmap rx. If there aren't enough frames then netmap rx will be woken up as usual. hw.cxgbe.nm_rx_nframes Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=335241
* netmap: align codebase to the current upstream (commit id 3fb001303718146)Vincenzo Maffione2018-04-121-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changelist: - Turn tx_rings and rx_rings arrays into arrays of pointers to kring structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib, vtnet and ptnet drivers to cope with the change. - Generalize the nm_config() callback to accept a struct containing many parameters. - Introduce NKR_FAKERING to support buffers sharing (used for netmap pipes) - Improved API for external VALE modules. - Various bug fixes and improvements to the netmap memory allocator, including support for externally (userspace) allocated memory. - Refactoring of netmap pipes: now linked rings share the same netmap buffers, with a separate set of kring pointers (rhead, rcur, rtail). Buffer swapping does not need to happen anymore. - Large refactoring of the control API towards an extensible solution; the goal is to allow the addition of more commands and extension of existing ones (with new options) without the need of hacks or the risk of running out of configuration space. A new NIOCCTRL ioctl has been added to handle all the requests of the new control API, which cover all the functionalities so far supported. The netmap API bumps from 11 to 12 with this patch. Full backward compatibility is provided for the old control command (NIOCREGIF), by means of a new netmap_legacy module. Many parts of the old netmap.h header has now been moved to netmap_legacy.h (included by netmap.h). Approved by: hrs (mentor) Notes: svn path=/head/; revision=332423
* Catch up with the removal of nktr_slot_flags from upstream netmap. NoNavdeep Parhar2018-02-201-1/+1
| | | | | | | | | functional impact intended. Submitted by: Vincenzo Maffione <v.maffione@gmail.com> Notes: svn path=/head/; revision=329675
* cxgbe(4): Do not forward interrupts to queues with freelists. ThisNavdeep Parhar2017-12-221-10/+4
| | | | | | | | | | | | | | | leaves the firmware event queue (fwq) as the only queue that can take interrupts for others. This simplifies cfg_itype_and_nqueues and queue allocation in the driver at the cost of a little (never?) used configuration. It also allows service_iq to be split into two specialized variants in the future. MFC after: 2 months Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=327093
* cxgbe(4): Fix per-queue netmap operation.Navdeep Parhar2017-06-151-0/+24
| | | | | | | | | | | | Do not attempt to initialize netmap queues that are already initialized or aren't supposed to be initialized. Similarly, do not free queues that are not initialized or aren't supposed to be freed. PR: 217156 Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=319986
* cxgbe(4): netmap does not set IFCAP_NETMAP in an ifnet's if_capabilitiesNavdeep Parhar2016-12-091-1/+1
| | | | | | | | | any more (since r307394). Do it in the driver instead. MFC after: 1 week Notes: svn path=/head/; revision=309725
* cxgbe(4): Fix netmap with T6, which doesn't encapsulate SGE_EGR_UPDATENavdeep Parhar2016-09-231-10/+18
| | | | | | | | | | message inside a FW_MSG. The base NIC already deals with updates in either form. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=306273
* cxgbe(4): Setup congestion response for T6 rx queues.Navdeep Parhar2016-09-211-1/+1
| | | | Notes: svn path=/head/; revision=306063
* cxgbe(4): Use smaller min/max bursts for fl descriptors with a T6.Navdeep Parhar2016-09-111-2/+4
| | | | | | | Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=305702
* Store the offset of the KDOORBELL and GTS registers in the softc.John Baldwin2016-08-011-9/+9
| | | | | | | | | | | | | VF devices use a different register layout than PF devices. Storing the offset in a value in the softc allows code to be shared between the PF and VF drivers. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7389 Notes: svn path=/head/; revision=303647
* cxgbe(4): Merge netmap support from the ncxgbe/ncxl interfaces to theNavdeep Parhar2016-06-231-315/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vcxgbe/vcxl interfaces and retire the 'n' interfaces. The main cxgbe/cxl interfaces and tunables related to them are not affected by any of this and will continue to operate as usual. The driver used to create an additional 'n' interface for every cxgbe/cxl interface if "device netmap" was in the kernel. The 'n' interface shared the wire with the main interface but was otherwise autonomous (with its own MAC address, etc.). It did not have normal tx/rx but had a specialized netmap-only data path. r291665 added another set of virtual interfaces (the 'v' interfaces) to the driver. These had normal tx/rx but no netmap support. This revision consolidates the features of both the interfaces into the 'v' interface which now has a normal data path, TOE support, and native netmap support. The 'v' interfaces need to be created explicitly with the hw.cxgbe.num_vis tunable. This means "device netmap" will not result in the automatic creation of any virtual interfaces. The following tunables can be used to override the default number of queues allocated for each 'v' interface. nofld* = 0 will disable TOE on the virtual interface and nnm* = 0 to will disable native netmap support. # number of normal NIC queues hw.cxgbe.ntxq_vi hw.cxgbe.nrxq_vi # number of TOE queues hw.cxgbe.nofldtxq_vi hw.cxgbe.nofldrxq_vi # number of netmap queues hw.cxgbe.nnmtxq_vi hw.cxgbe.nnmrxq_vi hw.cxgbe.nnm{t,r}xq{10,1}g tunables have been removed. --- tl;dr version --- The workflow for netmap on cxgbe starting with FreeBSD 11 is: 1) "device netmap" in the kernel config. 2) "hw.cxgbe.num_vis=2" in loader.conf. num_vis > 2 is ok too, you'll end up with multiple autonomous netmap-capable interfaces for every port. 3) "dmesg | grep vcxl | grep netmap" to verify that the interface has netmap queues. 4) Use any of the 'v' interfaces for netmap. pkt-gen -i vcxl<n>... . One major improvement is that the netmap interface has a normal data path as expected. 5) Just ignore the cxl interfaces if you want to use netmap only. No need to bring them up. The vcxl interfaces are completely independent and everything should just work. --------------------- Approved by: re@ (gjb@) Relnotes: Yes Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=302110
* sys: Make use of our rounddown() macro when sys/param.h is available.Pedro F. Giffuni2016-04-301-1/+1
| | | | | | | No functional change. Notes: svn path=/head/; revision=298848
* cxgbe(4): Add a struct sge_params to store per-adapter SGE parameters.Navdeep Parhar2016-03-081-9/+9
| | | | | | | | | | Move the code that reads all the parameters to t4_init_sge_params in the shared code. Use these per-adapter values instead of globals. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=296478
* cxgbe(4): Very basic T6 awareness. This is part of ongoing work toNavdeep Parhar2016-03-041-3/+2
| | | | | | | | | | | | | | | | | | update to the latest internal shared code. - Add a chip_params structure to keep track of hardware constants for all generations of Terminators handled by cxgbe. - Update t4_hw_pci_read_cfg4 to work with T6. - Update the hardware debug sysctls (hidden within dev.<tNnex>.<n>.misc.*) to work with T6. Most of the changes are in the decoders for the CIM logic analyzer and the MPS TCAM. - Acquire the regwin lock around indirect register accesses. Obtained from: Chelsio Communications Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=296383