aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cxgbe/adapter.h
Commit message (Collapse)AuthorAgeFilesLines
* cxgbe(4): Stop but don't free netmap queues when netmap is switched off.Navdeep Parhar2020-12-031-0/+11
| | | | | | | | | | | | | | | | 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-3/+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/+3
| | | | | | | | | | | | | | 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-0/+2
| | | | | | | | | | | | | | 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): More fixes for the T6 FCS error counter.Navdeep Parhar2020-10-091-0/+2
| | | | | | | | | | | | | | | | | | | | r365732 was the first attempt to get an accurate count but it was writing to some read-only registers to clear them and that obviously didn't work. Instead, note the counter's value when it is supposed to be cleared and subtract it from future readings. dev.<port>.stats.rx_fcs_error should not be serviced from the MPS register for T6. The stats.* sysctls should all use T5_PORT_REG for T5 and above. This must have been missed in the initial T5 support years ago. Fix it while here. MFC after: 3 days Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=366589
* Store the send tag type in the common send tag header.John Baldwin2020-10-061-1/+0
| | | | | | | | | | | | | | | | | | | | Both cxgbe(4) and mlx5(4) wrapped the existing send tag header with their own identical headers that stored the type that the type-specific tag structures inherited from, so in practice it seems drivers need this in the tag anyway. This permits removing these extra header indirections (struct cxgbe_snd_tag and struct mlx5e_snd_tag). In addition, this permits driver-independent code to query the type of a tag, e.g. to know what type of tag is being queried via if_snd_query. Reviewed by: gallatin, hselasky, np, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D26689 Notes: svn path=/head/; revision=366491
* cxgbe(4): adjust the doorbell threshold for netmap freelists to match theNavdeep Parhar2020-09-291-0/+1
| | | | | | | | | | 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): let the PF driver use VM work requests for transmit.Navdeep Parhar2020-09-221-1/+4
| | | | | | | | | | | | This allows the PF interfaces to communicate with the VF interfaces over the internal switch in the ASIC. Fix the GL limits for VM work requests while here. MFC after: 3 days Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=365993
* cxgbe(4): add support for stateless offloads for VXLAN traffic.Navdeep Parhar2020-09-181-0/+10
| | | | | | | | | | | Hardware assistance includes checksumming (tx and rx), TSO, and RSS on the inner traffic in a VXLAN tunnel. Relnotes: Yes Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=365871
* cxgbe(4): changes in the Tx path to help increase tx coalescing.Navdeep Parhar2020-07-031-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | - Ask the firmware for the number of frames that can be stuffed in one work request. - Modify mp_ring to increase the likelihood of tx coalescing when there are just one or two threads that are doing most of the tx. Add teeth to the abdication mechanism by pushing the consumer lock into mp_ring. This reduces the likelihood that a consumer will get stuck with all the work even though it is above its budget. - Add support for coalesced tx WR to the VF driver. This, with the changes above, results in a 7x improvement in the tx pps of the VF driver for some common cases. The firmware vets the L2 headers submitted by the VF driver and it's a big win if the checks are performed for a batch of packets and not each one individually. Reviewed by: jhb@ MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D25454 Notes: svn path=/head/; revision=362905
* cxgbe(4): Add a pointer to the adapter softc in vi_info.Navdeep Parhar2020-06-251-6/+7
| | | | | | | | | | | | | 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): Add a tx_len16_to_desc helper.Navdeep Parhar2020-06-231-0/+8
| | | | | | | | | | No functional change. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=362532
* cxgbe/iw_cxgbe: Add an async callback to notify iw_cxgbe in case of aNavdeep Parhar2020-05-191-0/+1
| | | | | | | | | | | fatal error. Submitted by: Krishnamraju Eraparaju @ Chelsio MFC after: 2 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=361261
* Use both crypto engines on a T6.John Baldwin2020-04-101-2/+0
| | | | | | | | | | | | | A T6 adapter contains two crypto engines on separate channels. This commit distributes sessions between the two engines. Previously, only the first engine was used. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D24347 Notes: svn path=/head/; revision=359784
* Refactor driver and consumer interfaces for OCF (in-kernel crypto).John Baldwin2020-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The linked list of cryptoini structures used in session initialization is replaced with a new flat structure: struct crypto_session_params. This session includes a new mode to define how the other fields should be interpreted. Available modes include: - COMPRESS (for compression/decompression) - CIPHER (for simply encryption/decryption) - DIGEST (computing and verifying digests) - AEAD (combined auth and encryption such as AES-GCM and AES-CCM) - ETA (combined auth and encryption using encrypt-then-authenticate) Additional modes could be added in the future (e.g. if we wanted to support TLS MtE for AES-CBC in the kernel we could add a new mode for that. TLS modes might also affect how AAD is interpreted, etc.) The flat structure also includes the key lengths and algorithms as before. However, code doesn't have to walk the linked list and switch on the algorithm to determine which key is the auth key vs encryption key. The 'csp_auth_*' fields are always used for auth keys and settings and 'csp_cipher_*' for cipher. (Compression algorithms are stored in csp_cipher_alg.) - Drivers no longer register a list of supported algorithms. This doesn't quite work when you factor in modes (e.g. a driver might support both AES-CBC and SHA2-256-HMAC separately but not combined for ETA). Instead, a new 'crypto_probesession' method has been added to the kobj interface for symmteric crypto drivers. This method returns a negative value on success (similar to how device_probe works) and the crypto framework uses this value to pick the "best" driver. There are three constants for hardware (e.g. ccr), accelerated software (e.g. aesni), and plain software (cryptosoft) that give preference in that order. One effect of this is that if you request only hardware when creating a new session, you will no longer get a session using accelerated software. Another effect is that the default setting to disallow software crypto via /dev/crypto now disables accelerated software. Once a driver is chosen, 'crypto_newsession' is invoked as before. - Crypto operations are now solely described by the flat 'cryptop' structure. The linked list of descriptors has been removed. A separate enum has been added to describe the type of data buffer in use instead of using CRYPTO_F_* flags to make it easier to add more types in the future if needed (e.g. wired userspace buffers for zero-copy). It will also make it easier to re-introduce separate input and output buffers (in-kernel TLS would benefit from this). Try to make the flags related to IV handling less insane: - CRYPTO_F_IV_SEPARATE means that the IV is stored in the 'crp_iv' member of the operation structure. If this flag is not set, the IV is stored in the data buffer at the 'crp_iv_start' offset. - CRYPTO_F_IV_GENERATE means that a random IV should be generated and stored into the data buffer. This cannot be used with CRYPTO_F_IV_SEPARATE. If a consumer wants to deal with explicit vs implicit IVs, etc. it can always generate the IV however it needs and store partial IVs in the buffer and the full IV/nonce in crp_iv and set CRYPTO_F_IV_SEPARATE. The layout of the buffer is now described via fields in cryptop. crp_aad_start and crp_aad_length define the boundaries of any AAD. Previously with GCM and CCM you defined an auth crd with this range, but for ETA your auth crd had to span both the AAD and plaintext (and they had to be adjacent). crp_payload_start and crp_payload_length define the boundaries of the plaintext/ciphertext. Modes that only do a single operation (COMPRESS, CIPHER, DIGEST) should only use this region and leave the AAD region empty. If a digest is present (or should be generated), it's starting location is marked by crp_digest_start. Instead of using the CRD_F_ENCRYPT flag to determine the direction of the operation, cryptop now includes an 'op' field defining the operation to perform. For digests I've added a new VERIFY digest mode which assumes a digest is present in the input and fails the request with EBADMSG if it doesn't match the internally-computed digest. GCM and CCM already assumed this, and the new AEAD mode requires this for decryption. The new ETA mode now also requires this for decryption, so IPsec and GELI no longer do their own authentication verification. Simple DIGEST operations can also do this, though there are no in-tree consumers. To eventually support some refcounting to close races, the session cookie is now passed to crypto_getop() and clients should no longer set crp_sesssion directly. - Assymteric crypto operation structures should be allocated via crypto_getkreq() and freed via crypto_freekreq(). This permits the crypto layer to track open asym requests and close races with a driver trying to unregister while asym requests are in flight. - crypto_copyback, crypto_copydata, crypto_apply, and crypto_contiguous_subsegment now accept the 'crp' object as the first parameter instead of individual members. This makes it easier to deal with different buffer types in the future as well as separate input and output buffers. It's also simpler for driver writers to use. - bus_dmamap_load_crp() loads a DMA mapping for a crypto buffer. This understands the various types of buffers so that drivers that use DMA do not have to be aware of different buffer types. - Helper routines now exist to build an auth context for HMAC IPAD and OPAD. This reduces some duplicated work among drivers. - Key buffers are now treated as const throughout the framework and in device drivers. However, session key buffers provided when a session is created are expected to remain alive for the duration of the session. - GCM and CCM sessions now only specify a cipher algorithm and a cipher key. The redundant auth information is not needed or used. - For cryptosoft, split up the code a bit such that the 'process' callback now invokes a function pointer in the session. This function pointer is set based on the mode (in effect) though it simplifies a few edge cases that would otherwise be in the switch in 'process'. It does split up GCM vs CCM which I think is more readable even if there is some duplication. - I changed /dev/crypto to support GMAC requests using CRYPTO_AES_NIST_GMAC as an auth algorithm and updated cryptocheck to work with it. - Combined cipher and auth sessions via /dev/crypto now always use ETA mode. The COP_F_CIPHER_FIRST flag is now a no-op that is ignored. This was actually documented as being true in crypto(4) before, but the code had not implemented this before I added the CIPHER_FIRST flag. - I have not yet updated /dev/crypto to be aware of explicit modes for sessions. I will probably do that at some point in the future as well as teach it about IV/nonce and tag lengths for AEAD so we can support all of the NIST KAT tests for GCM and CCM. - I've split up the exising crypto.9 manpage into several pages of which many are written from scratch. - I have converted all drivers and consumers in the tree and verified that they compile, but I have not tested all of them. I have tested the following drivers: - cryptosoft - aesni (AES only) - blake2 - ccr and the following consumers: - cryptodev - IPsec - ktls_ocf - GELI (lightly) I have not tested the following: - ccp - aesni with sha - hifn - kgssapi_krb5 - ubsec - padlock - safe - armv8_crypto (aarch64) - glxsb (i386) - sec (ppc) - cesa (armv7) - cryptocteon (mips64) - nlmsec (mips64) Discussed with: cem Relnotes: yes Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D23677 Notes: svn path=/head/; revision=359374
* cxgbe(4): Split sge_nm_rxq into three cachelines.Navdeep Parhar2020-03-201-9/+14
| | | | | | | | | | | | | | | 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
* Rename TOE TLS stats from [rt]x_tls_* to [rt]x_toe_tls_*.John Baldwin2020-02-281-4/+4
| | | | | | | | | | | This more clearly differentiates TLS records encrypted and decrypted in TOE connections from those encrypted via NIC TLS. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=358415
* Remove the per-TXQ tls_wrs stat.John Baldwin2020-02-131-1/+0
| | | | | | | | | | | | It duplicated the kern_tls_records stat and was not conditional on NIC TLS being enabled. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D23670 Notes: svn path=/head/; revision=357890
* cxgbe(4): Add pfil(9) hooks to the driver's rx.Navdeep Parhar2020-02-041-0/+2
| | | | | | | | MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=357483
* cxgbe(4): Retire the allow_mbufs_in_cluster optimization.Navdeep Parhar2020-02-041-29/+14
| | | | | | | | | | | 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): Avoid ext_arg2 in rxb_free.Navdeep Parhar2020-02-031-0/+2
| | | | | | | | | | | | | ext_arg2 is the only item in the third cacheline in an mbuf and could be cold by the time rxb_free runs. Put the information needed by rxb_free in the same line as the refcount, which is very likely to be hot given that rxb_free runs when the refcount is decremented and reaches 0. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=357479
* cxgbe(4): Initialize the rx buffer's metadata on first-use and not onNavdeep Parhar2020-02-031-1/+0
| | | | | | | | | | | | | allocation. refill_fl doesn't touch any part of a freshly allocated cluster after this change. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=357475
* cxgbe(4): Use TX_PKTS2 work requests in netmap Tx if it's available.Navdeep Parhar2019-12-101-0/+1
| | | | | | | | | | | 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): sysctl to reset the temperature/voltage sensor.Navdeep Parhar2019-11-241-0/+1
| | | | | | | | | | | # sysctl dev.<nexus>.<inst>.reset_sensor=1 # sysctl dev.t6nex.0.reset_sensor=1 MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=355059
* NIC KTLS for Chelsio T6 adapters.John Baldwin2019-11-211-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for ifnet (NIC) KTLS using Chelsio T6 adapters. Unlike the TOE-based KTLS in r353328, NIC TLS works with non-TOE connections. NIC KTLS on T6 is not able to use the normal TSO (LSO) path to segment the encrypted TLS frames output by the crypto engine. Instead, the TOE is placed into a special setup to permit "dummy" connections to be associated with regular sockets using KTLS. This permits using the TOE to segment the encrypted TLS records. However, this approach does have some limitations: 1) Regular TOE sockets cannot be used when the TOE is in this special mode. One can use either TOE and TOE-based KTLS or NIC KTLS, but not both at the same time. 2) In NIC KTLS mode, the TOE is only able to accept a per-connection timestamp offset that varies in the upper 4 bits. Put another way, only connections whose timestamp offset has the 28 lower bits cleared can use NIC KTLS and generate correct timestamps. The driver will refuse to enable NIC KTLS on connections with a timestamp offset with any of the lower 28 bits set. To use NIC KTLS, users can either disable TCP timestamps by setting the net.inet.tcp.rfc1323 sysctl to 0, or apply a local patch to the tcp_new_ts_offset() function to clear the lower 28 bits of the generated offset. 3) Because the TCP segmentation relies on fields mirrored in a TCB in the TOE, not all fields in a TCP packet can be sent in the TCP segments generated from a TLS record. Specifically, for packets containing TCP options other than timestamps, the driver will inject an "empty" TCP packet holding the requested options (e.g. a SACK scoreboard) along with the segments from the TLS record. These empty TCP packets are counted by the dev.cc.N.txq.M.kern_tls_options sysctls. Unlike TOE TLS which is able to buffer encrypted TLS records in on-card memory to handle retransmits, NIC KTLS must re-encrypt TLS records for retransmit requests as well as non-retransmit requests that do not include the start of a TLS record but do include the trailer. The T6 NIC KTLS code tries to optimize some of the cases for requests to transmit partial TLS records. In particular it attempts to minimize sending "waste" bytes that have to be given as input to the crypto engine but are not needed on the wire to satisfy mbufs sent from the TCP stack down to the driver. TCP packets for TLS requests are broken down into the following classes (with associated counters): - Mbufs that send an entire TLS record in full do not have any waste bytes (dev.cc.N.txq.M.kern_tls_full). - Mbufs that send a short TLS record that ends before the end of the trailer (dev.cc.N.txq.M.kern_tls_short). For sockets using AES-CBC, the encryption must always start at the beginning, so if the mbuf starts at an offset into the TLS record, the offset bytes will be "waste" bytes. For sockets using AES-GCM, the encryption can start at the 16 byte block before the starting offset capping the waste at 15 bytes. - Mbufs that send a partial TLS record that has a non-zero starting offset but ends at the end of the trailer (dev.cc.N.txq.M.kern_tls_partial). In order to compute the authentication hash stored in the trailer, the entire TLS record must be sent as input to the crypto engine, so the bytes before the offset are always "waste" bytes. In addition, other per-txq sysctls are provided: - dev.cc.N.txq.M.kern_tls_cbc: Count of sockets sent via this txq using AES-CBC. - dev.cc.N.txq.M.kern_tls_gcm: Count of sockets sent via this txq using AES-GCM. - dev.cc.N.txq.M.kern_tls_fin: Count of empty FIN-only packets sent to compensate for the TOE engine not being able to set FIN on the last segment of a TLS record if the TLS record mbuf had FIN set. - dev.cc.N.txq.M.kern_tls_records: Count of TLS records sent via this txq including full, short, and partial records. - dev.cc.N.txq.M.kern_tls_octets: Count of non-waste bytes (TLS header and payload) sent for TLS record requests. - dev.cc.N.txq.M.kern_tls_waste: Count of waste bytes sent for TLS record requests. To enable NIC KTLS with T6, set the following tunables prior to loading the cxgbe(4) driver: hw.cxgbe.config_file=kern_tls hw.cxgbe.kern_tls=1 Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21962 Notes: svn path=/head/; revision=354974
* Create a file to hold shared routines for dealing with T6 key contexts.John Baldwin2019-11-131-1/+9
| | | | | | | | | | | | | | ccr(4) and TLS support in cxgbe(4) construct key contexts used by the crypto engine in the T6. This consolidates some duplicated code for helper functions used to build key contexts. Reviewed by: np MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D22156 Notes: svn path=/head/; revision=354667
* Split Chelsio send tags into a generic base tag and a ratelimit tag.John Baldwin2019-10-221-7/+8
| | | | | | | | | | | | | | NIC KTLS will add a new TLS send tag type in cxgbe(4) that is a distinct tag from a ratelimit tag. To support this, refactor cxgbe_snd_tag to be a simple send tag with a type and convert the existing ratelimit tag to a new cxgbe_rate_tag structure. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D22072 Notes: svn path=/head/; revision=353900
* Always allocate the atid table during attach.John Baldwin2019-10-221-2/+0
| | | | | | | | | | | | Previously the table was allocated on first use by TOE and the ratelimit code. The forthcoming NIC KTLS code also uses this table. Allocate it unconditionally during attach to simplify consumers. Reviewed by: np Differential Revision: https://reviews.freebsd.org/D22028 Notes: svn path=/head/; revision=353899
* This adds the third step in getting BBR into the tree. BBR andRandall Stewart2019-08-011-0/+1
| | | | | | | | | | | an updated rack depend on having access to the new ratelimit api in this commit. Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D20953 Notes: svn path=/head/; revision=350501
* cxgbe(4): Count and clear interrupts generated at the software's request.Navdeep Parhar2019-03-281-0/+2
| | | | | | | | | | An interrupt can be requested by setting the F_SWINT bit in PL_PF_CTL. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=345660
* cxgbe(4): Treat the viid as an opaque identifier.Navdeep Parhar2019-03-201-2/+4
| | | | | | | | | | | Recent firmwares prefer to use a different format for viid internally and this change allows them to do so. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=345334
* cxgbe(4): Auto-dump the CIM block's logic analyzer on a TIMER0 interrupt.Navdeep Parhar2019-02-071-0/+1
| | | | | | | Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=343862
* cxgbe(4): Auto-dump the device log on a mailbox timeout or when theNavdeep Parhar2019-02-071-0/+1
| | | | | | | | | firmware reports an error in pcie_fw. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=343861
* cxgbe(4): Improved error reporting and diagnostics.Navdeep Parhar2019-02-011-19/+34
| | | | | | | | | | | | | | | | | | | | | | | "slow" interrupt handler: - Expand the list of INT_CAUSE registers known to the driver. - Add decode information for many more bits but decouple it from the rest of intr_info so that it is entirely optional. - Call t4_fatal_err exactly once, and from the top level PL intr handler. t4_fatal_err: - Use t4_shutdown_adapter from the common code to stop the adapter. - Stop servicing slow interrupts after the first fatal one. Driver/firmware interaction: - CH_DUMP_MBOX: note whether the mailbox being dumped is a command or a reply or something else. - Log the raw value of pcie_fw for some errors. - Use correct log levels (debug vs. error). Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=343666
* cxgbe(4): Fall back to a basic configuration in case of any error duringNavdeep Parhar2018-12-061-0/+1
| | | | | | | | | | | | | card initialization. This is an expanded version of r333682. Break up prep_firmware into simpler routines while here. Load the firmware/config KLD only if needed. MFC after: 1 month Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=341620
* Move CLIP table handling out of TOM and into the base driver.John Baldwin2018-11-291-0/+6
| | | | | | | | | | | | | | | | | - Store the clip table in 'struct adapter' instead of in the TOM softc. - Init the clip table during attach and teardown during detach. - While here, add a dev.<nexus>.<unit>.misc.clip sysctl to dump the CLIP table. This does mean that we update the clip table even if TOE is not enabled, but non-TOE things need the CLIP table anyway. Reviewed by: np, Krishnamraju Eraparaju @ Chelsio Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D18010 Notes: svn path=/head/; revision=341172
* Add read-only sysctls for all tunables in the cxgbe(4) driver.John Baldwin2018-11-271-0/+2
| | | | | | | | | | Reviewed by: np MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D18360 Notes: svn path=/head/; revision=341098
* Move the TLS key map into the adapter softc so non-TOE code can use it.John Baldwin2018-11-151-0/+2
| | | | | | | Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=340466
* Add a facility for transmitting "raw" work requests on regular NIC queues.John Baldwin2018-11-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | - Use PH_loc.eight[1] as a general 'cflags' (Chelsio flags) field to describe properties of a queued packet. The MC_RAW_WR flag indicates an mbuf holding a raw work request. mbuf_cflags() returns the current flags. - Raw work request mbufs are allocated via alloc_wr_mbuf() which will allocate a single contiguous range to hold the mbuf data. The consumer can use mtod() to obtain the start of the work request and write the required work request in the buffer. The mbuf can then be enqueued directly to the txq via mp_ring_enqueue(). - Since raw work requests might potentially send arbitrary work requests, only set the EQUIQ and EQUEQ bits on work requests that support them such as the normal tunneled Ethernet packet work requests. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D17811 Notes: svn path=/head/; revision=340173
* cxgbe(4): Update the VI's default queue when netmap is enabled/disabled.Navdeep Parhar2018-10-251-0/+1
| | | | | | | Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=339705
* cxgbe(4): improve the accuracy of various TSO limits reported to the kernel.Navdeep Parhar2018-10-221-0/+1
| | | | | | | Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=339628
* cxgbe(4): Link related changes.Navdeep Parhar2018-09-251-47/+0
| | | | | | | | | | | | | | | | | | | | | | | - Switch to using 32b port/link capabilities in the driver. The 32b format is used internally by firmwares > 1.16.45.0 and the driver will now interact with the firmware in its native format, whether it's 16b or 32b. Note that the 16b format doesn't have room for 50G, 200G, or 400G speeds. - Add a bit in the pause_settings knobs to allow negotiated PAUSE settings to override manual settings. - Ensure that manual link settings persist across an administrative down/up as well as transceiver unplug/replug. - Remove unused is_*G_port() functions. Approved by: re@ (gjb@) MFC after: 1 month Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=338924
* cxgbev(4): Updates to the VF driver to cope with recent ifmedia andNavdeep Parhar2018-08-231-0/+2
| | | | | | | | | | ctrlq changes in the base driver. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=338218
* cxgbe(4): Replace T4_PKT_TIMESTAMP with something slightly less hackish.Navdeep Parhar2018-08-181-1/+1
| | | | Notes: svn path=/head/; revision=337996
* cxgbe(4): Use VLAN_TRUNKDEV instead of private cookie to figure out theNavdeep Parhar2018-08-151-2/+0
| | | | | | | | | | parent of a VLAN ifnet. MFC after: 1 week Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=337873
* cxgbe(4): Use two hashes instead of a table to keep track ofNavdeep Parhar2018-08-151-1/+1
| | | | | | | | | | | | | | | | | hashfilters. Two because the driver needs to look up a hashfilter by its 4-tuple or tid. A couple of fixes while here: - Reject attempts to add duplicate hashfilters. - Do not assume that any part of the 4-tuple that isn't specified is 0. This makes it consistent with all other mandatory parameters that already require explicit user input. MFC after: 2 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=337830
* cxgbe(4): Move all control queues to the adapter.Navdeep Parhar2018-08-111-2/+1
| | | | | | | | | | | | | | | | There used to be one control queue per adapter (the mgmtq) that was initialized during adapter init and one per port that was initialized later during port init. This change moves all the control queues (one per port/channel) to the adapter so that they are initialized during adapter init and are available before any port is up. This allows the driver to issue ctrlq work requests over any channel without having to bring up any port. MFH: 2 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=337659
* cxgbe(4): Create two variants of service_iq, one for queues withNavdeep Parhar2018-08-111-2/+6
| | | | | | | | | | freelists and one for those without. MFH: 3 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=337609
* cxgbe(4): Allow the driver to specify a burst size when configuring aNavdeep Parhar2018-08-071-1/+4
| | | | | | | | | | | | | | | traffic class for rate limiting. Add experimental knobs that allow the user to specify a default pktsize and burstsize for traffic classes associated with a port: dev.<ifname>.<instance>.tc.pktsize dev.<ifname>.<instance>.tc.burstsize Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=337439
* cxgbe(4): Allow user-configured and driver-configured traffic classes toNavdeep Parhar2018-08-061-4/+8
| | | | | | | | | | | be used simultaneously. Move sysctl_tc and sysctl_tc_params to t4_sched.c while here. MFC after: 3 weeks Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=337398