History log of /freebsd-current/sys/dev/cxgb/cxgb_adapter.h
Revision Date Author Comments
# 78d14616 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line bare tag

Remove /^\s*\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 954712e8 30-May-2022 Justin Hibbits <jhibbits@FreeBSD.org>

Mechanically convert cxgb(4) and cxgbe(4) to IfAPI

Reviewed by: np
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38597


# 6792568f 10-Jan-2022 Navdeep Parhar <np@FreeBSD.org>

cxgb(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.

MFC after: 1 week
Sponsored by: Chelsio Communications


# 8bd97b07 21-Oct-2019 Gleb Smirnoff <glebius@FreeBSD.org>

Convert to if_foreach_llmaddr() KPI.


# 7790c8c1 17-Oct-2019 Conrad Meyer <cem@FreeBSD.org>

Split out a more generic debugnet(4) from netdump(4)

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


# 3948ad29 28-Feb-2019 Conrad Meyer <cem@FreeBSD.org>

cxgb(4): Netdump: only reference allocated qsets

SGE_QSETS is an upper bound -- fewer qsets may be allocated depending on
the number of CPUs.

Reviewed by: markj, np, vangyzen
X-MFC-With: r333288
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D17274


# d7c5a620 18-May-2018 Matt Macy <mmacy@FreeBSD.org>

ifnet: Replace if_addr_lock rwlock with epoch + mutex

Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree
4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.32
4.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.32
4.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.32
4.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.32
4.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.32
4.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.32
4.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32

After the patch

InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree
5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.51
5.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.51
5.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.51
5.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.51
5.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.52
5.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by: gallatin
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15366


# eb07d67e 05-May-2018 Mark Johnston <markj@FreeBSD.org>

Add netdump support to cxgb(4).

Tested with a T320 adapter.

Reviewed by: np
MFC after: 1 month
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D15258


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# eb36b1d0 30-Jun-2017 Jason A. Harmening <jah@FreeBSD.org>

Clean up MD pollution of bus_dma.h:

--Remove special-case handling of sparc64 bus_dmamap* functions.
Replace with a more generic mechanism that allows MD busdma
implementations to generate inline mapping functions by
defining WANT_INLINE_DMAMAP in <machine/bus_dma.h>. This
is currently useful for sparc64, x86, and arm64, which all
implement non-load dmamap operations as simple wrappers
around map objects which may be bus- or device-specific.

--Remove NULL-checked bus_dmamap macros. Implement the
equivalent NULL checks in the inlined x86 implementation.
For non-x86 platforms, these checks are a minor pessimization
as those platforms do not currently allow NULL maps. NULL
maps were originally allowed on arm64, which appears to have
been the motivation behind adding arm[64]-specific barriers
to bus_dma.h, but that support was removed in r299463.

--Simplify the internal interface used by the bus_dmamap_load*
variants and move it to bus_dma_internal.h

--Fix some drivers that directly include sys/bus_dma.h
despite the recommendations of bus_dma(9)

Reviewed by: kib (previous revision), marius
Differential Revision: https://reviews.freebsd.org/D10729


# c578b6ac 18-Feb-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Provide a set of inline functions to manage simple mbuf(9) queues, based
on queue(3)'s STAILQ. Utilize them in cxgb(4) and Xen, deleting home
grown implementations.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# e26e6373 27-Sep-2014 Navdeep Parhar <np@FreeBSD.org>

cxgb(4): implement if_get_counter.


# 76039bc8 26-Oct-2013 Gleb Smirnoff <glebius@FreeBSD.org>

The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
to this event, adding if_var.h to files that do need it. Also, include
all includes that now are included due to implicit pollution via if_var.h

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 0a704909 29-Jun-2012 Navdeep Parhar <np@FreeBSD.org>

cxgb(4): IPv6 rx/tx hw checksum, IPv6 TSO and LRO too.

(Some parts already worked, this makes it complete).


# 09fe6320 19-Jun-2012 Navdeep Parhar <np@FreeBSD.org>

- Updated TOE support in the kernel.

- Stateful TCP offload drivers for Terminator 3 and 4 (T3 and T4) ASICs.
These are available as t3_tom and t4_tom modules that augment cxgb(4)
and cxgbe(4) respectively. The cxgb/cxgbe drivers continue to work as
usual with or without these extra features.

- iWARP driver for Terminator 3 ASIC (kernel verbs). T4 iWARP in the
works and will follow soon.

Build-tested with make universe.

30s overview
============
What interfaces support TCP offload? Look for TOE4 and/or TOE6 in the
capabilities of an interface:
# ifconfig -m | grep TOE

Enable/disable TCP offload on an interface (just like any other ifnet
capability):
# ifconfig cxgbe0 toe
# ifconfig cxgbe0 -toe

Which connections are offloaded? Look for toe4 and/or toe6 in the
output of netstat and sockstat:
# netstat -np tcp | grep toe
# sockstat -46c | grep toe

Reviewed by: bz, gnn
Sponsored by: Chelsio communications.
MFC after: ~3 months (after 9.1, and after ensuring MFC is feasible)


# 62b5b6ec 24-May-2012 Bjoern A. Zeeb <bz@FreeBSD.org>

MFp4 bz_ipv6_fast:

Significantly update tcp_lro for mostly two things:
1) introduce basic support for IPv6 without extension headers.
2) try hard to also get the incremental checksum updates right,
especially also in the IPv4 case for the IP and TCP header.

Move variables around for better locality, factor things out into
functions, allow checksum updates to be compiled out, ...

Leave a few comments on further things to look at in the future,
though that is not the full list.

Update drivers with appropriate #includes as needed for IPv6 data
type in LRO.

Sponsored by: The FreeBSD Foundation
Sponsored by: iXsystems

Reviewed by: gnn (as part of the whole)
MFC After: 3 days


# 65d43cc6 07-Feb-2012 Navdeep Parhar <np@FreeBSD.org>

Remove if_start from cxgb and cxgbe.

Submitted by: jhb
MFC after: 3 days


# 7eeb16ce 23-Mar-2011 Navdeep Parhar <np@FreeBSD.org>

t3_free_sge_resources should be given the number of qsets it needs to free.

MFC after: 1 week


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# bd1a9fba 08-Jul-2010 Navdeep Parhar <np@FreeBSD.org>

Improve cxgb(4)'s behaviour when faced with temporarily "bouncy" links:
- Run the adapter's tick at 1Hz and remove link state checks from it.
Instead, have each port check its link state. Delay the check so that
it takes place slightly after the driver is notified of a change in
link state. This is a cheap way to debounce these notifications if
many are received in rapid succession. POLL_LINK_1ST_TIME flag can
also be eliminated as a side effect of these changes.
- Do not reset the PHY when link goes down.
- Clear port's link_fault flag if the PHY indicates link is down.
- get_link_status_r should leave speed and duplex alone when link is down.

MFC after: 1 month


# 2c32b502 08-Jul-2010 Navdeep Parhar <np@FreeBSD.org>

Eliminate ext_intr_task. The "slow" interrupt handler is already
running on the adapter's task queue. Just do what the task does
instead of enqueueing it.

MFC after: 3 days


# 27d1c65e 12-Jun-2010 Navdeep Parhar <np@FreeBSD.org>

cxgb(4): add knob to get packet timestamps from the hardware.

The T3 ASIC can provide an incoming packet's timestamp instead of its RSS hash.
The timestamp is just a counter running off the card's clock. With a 175MHz
clock an increment represents ~5.7ns and the 32 bit value wraps around in ~25s.

# sysctl -d dev.cxgbc.0.pkt_timestamp
dev.cxgbc.0.pkt_timestamp: provide packet timestamp instead of connection hash

# sysctl -d dev.cxgbc.0.core_clock
dev.cxgbc.0.core_clock: core clock frequency (in KHz)
# sysctl dev.cxgbc.0.core_clock
dev.cxgbc.0.core_clock: 175000


# 63ae3fec 13-May-2010 Navdeep Parhar <np@FreeBSD.org>

MFC r207639, r207643, r207687, r207688

r207639: Add IFCAP_LINKSTATE to cxgb
r207643: T3 hardware filters + cxgbtool interface to this functionality.
r207687: if_cxgb should not depend on the T3 firmware module directly.
r207688: various doorbell adjustments


# 1d4942f4 05-May-2010 Navdeep Parhar <np@FreeBSD.org>

Don't ring the tx doorbell for every frame when we know more frames
will follow. Adjust the freelist and response queue doorbells too.

Discussed with: kmacy


# ece8cb88 05-Apr-2010 Navdeep Parhar <np@FreeBSD.org>

cxgb(4) MFCs: r204271,r204274,r204348,r204921,r205944,r205945,r205946,r205947,r205948,r205949,r205950,r206109

r204271:
Accessing an mbuf after it has been handed off to the hardware is a bad
race as it could already have been tx'd and freed by that time. Place
the bpf tap just _before_ writing the gen bit.

This fixes a panic when running tcpdump on a cxgb interface.

r204274:
There is no need to test __FreeBSD_version for features that have
been around for a long time now (7.1-ish or even earlier); assume
they are present. These includes MSI, TSO, LRO, VLAN, INTR_FILTERS,
FIRMWARE, etc.

Also, eliminate some dead code and clean up in other places as part
of this quick once-over.

r204348:
Support IFCAP_VLANHWTSO in cxgb(4). It works with or without vlanhwtag.
While here, remove old DPRINTFs and tidy up the capability code a bit.

r204921:
Better TwinAx transceiver detection.

Originally submitted by: <Bruno dot Bittner at isilon dot com>
(This is a rewritten, corrected version of that patch)

r205944:
Refresh the firmware version immediately after it is upgraded (or downgraded).

r205945:
Improved PHY EDC settings.

r205946:
Do not attempt to retrieve interrupt information before it is available.

r205947:
Fix build with "nooptions INET"

r205948:
Fix tx drop statistics.

r205949:
Fix signed/unsigned mix-up that allowed txq->in_use to grow beyond txq->size.

r205950:
Multiple fixes related to queue set sizing and resources:

- Only the tunnelq (TXQ_ETH) requires a buf_ring, an ifq, and the watchdog/timer
callouts. Do not allocate these for the other tx queues.

- Use 16k jumbo clusters only on offload capable cards by default.

- Do not allocate a full tx ring for the offload queue if the card is not
offload capable.

- Slightly better freelist size calculation.

- Fix nmbjumbo4 typo, remove unneeded global variables.

r206109:
Increase response queue size to avoid starvation, add a counter
to track it when it does occur.


# 489ca05b 02-Apr-2010 Navdeep Parhar <np@FreeBSD.org>

Increase response queue size to avoid starvation, add a counter
to track it when it does occur.


# 97ae3bc3 30-Mar-2010 Navdeep Parhar <np@FreeBSD.org>

Multiple fixes related to queue set sizing and resources:

- Only the tunnelq (TXQ_ETH) requires a buf_ring, an ifq, and the watchdog/timer
callouts. Do not allocate these for the other tx queues.

- Use 16k jumbo clusters only on offload capable cards by default.

- Do not allocate a full tx ring for the offload queue if the card is not
offload capable.

- Slightly better freelist size calculation.

- Fix nmbjumbo4 typo, remove unneeded global variables.

MFC after: 3 days


# 92f61ecb 30-Mar-2010 Navdeep Parhar <np@FreeBSD.org>

Fix tx drop statistics.

MFC after: 3 days


# e83ec3e5 24-Feb-2010 Navdeep Parhar <np@FreeBSD.org>

There is no need to test __FreeBSD_version for features that have
been around for a long time now (7.1-ish or even earlier); assume
they are present. These includes MSI, TSO, LRO, VLAN, INTR_FILTERS,
FIRMWARE, etc.

Also, eliminate some dead code and clean up in other places as part
of this quick once-over.

MFC after: 1 week


# e0d8d4df 20-Jan-2010 Navdeep Parhar <np@FreeBSD.org>

MFC r201907,202671,202678

r201907:
Extra parantheses to keep certain compilers happy.

r202671:
Fix for a cxgb(4) panic. cxgb_ioctl can be called by the IP and IPv6
layers with non-sleepable locks held. Don't (potentially) sleep in
those situations.

r202678:
Complain if freelist queue sizes are significantly less than desired.


# b302b77c 19-Jan-2010 Navdeep Parhar <np@FreeBSD.org>

Fix for a cxgb(4) panic. cxgb_ioctl can be called by the IP and IPv6
layers with non-sleepable locks held. Don't (potentially) sleep in
those situations.


# bbec3bb5 11-Nov-2009 Navdeep Parhar <np@FreeBSD.org>

MFC r197791

cxgb(4) updates, including:
- support for the new Gen-2, BT, and LP-CR cards.
- T3 firmware 7.7.0
- shared "common code" updates.


# c01f2b83 05-Oct-2009 Navdeep Parhar <np@FreeBSD.org>

cxgb(4) updates, including:
- support for the new Gen-2, BT, and LP-CR cards.
- T3 firmware 7.7.0
- shared "common code" updates.

Approved by: gnn (mentor)
Obtained from: Chelsio
MFC after: 1 month


# 5157862a 26-Jun-2009 Robert Watson <rwatson@FreeBSD.org>

Use if_maddr_rlock() instead of IF_ADDR_LOCK() to protect access to
if_multiaddrs in if_cxgb.

Approved by: re (kib)
MFC after: 6 weeks


# 3f345a5d 19-Jun-2009 Kip Macy <kmacy@FreeBSD.org>

Greatly simplify cxgb by removing almost all of the custom mbuf management logic

- remove mbuf iovec - useful, but adds too much complexity when isolated to
the driver

- remove driver private caching - insufficient benefit over UMA to justify
the added complexity and maintenance overhead

- remove separate logic for managing multiple transmit queues, with the
new drbr routines the control flow can be made to much more closely resemble
legacy drivers

- remove dedicated service threads, with per-cpu callouts one can get the same
benefit much more simply by registering a callout 1 tick in the future if there
are still buffered packets

- remove embedded mbuf usage - Jeffr's changes will (I hope) soon be integrated
greatly reducing the overhead of using kernel APIs for reference counting
clusters

- add hysteresis to descriptor coalescing logic

- add coalesce threshold sysctls to allow users to decide at run-time
between optimizing for forwarding / UDP or optimizing for TCP

- add once per second watchdog to effectively close the very rare races
occurring from coalescing

- incorporate Navdeep's changes to the initialization path required to
convert port and adapter locks back to ordinary mutexes (silencing BPF
LOR complaints)

- enable prefetches in get_packet and tx cleaning

Reviewed by: navdeep@
MFC after: 2 weeks


# 0bbdea77 21-May-2009 George V. Neville-Neil <gnn@FreeBSD.org>

Integrate three changes from Chelsio.

1) Add a sysctl that will say what type of PHYs exist on the card.
2) Fix a bug that occurs when an AEL 2005 PHY resets without a transciever
in the card.
3) Unify the PHY link detection code.

Obtained from: Navdeep Parhar
MFC after: 10 days


# f2d8ff04 10-Mar-2009 George V. Neville-Neil <gnn@FreeBSD.org>

Update the Chelsio driver to the latest bits from Chelsio

Firmware upgraded to 7.1.0 (from 5.0.0).
T3C EEPROM and SRAM added; Code to update eeprom/sram fixed.
fl_empty and rx_fifo_ovfl counters can be observed via sysctl.
Two new cxgbtool commands to get uP logic analyzer info and uP IOQs
Synced up with Chelsio's "common code" (as of 03/03/09)

Submitted by: Navdeep Parhar at Chelsio
Reviewed by: gnn
MFC after: 2 weeks


# a02573bc 22-Nov-2008 Kip Macy <kmacy@FreeBSD.org>

- enable multiple transmit queues
- invert sense of hw.cxgb.singleq tunable to hw.cxgb.multiq
- don't wake up transmitting thread by default
- add per tx queue ifaltq to handle ALTQ
- remove several unused functions in cxgb_multiq.c
- add several sysctls: multiq_tx_enable, coalesce_tx_enable,
and wakeup_tx_thread
- this obsoletes the hw.cxgb.snd_queue_len as ifq is replaced
by a buf_ring


# db7f0b97 21-Nov-2008 Kip Macy <kmacy@FreeBSD.org>

- bump __FreeBSD version to reflect added buf_ring, memory barriers,
and ifnet functions

- add memory barriers to <machine/atomic.h>
- update drivers to only conditionally define their own

- add lockless producer / consumer ring buffer
- remove ring buffer implementation from cxgb and update its callers

- add if_transmit(struct ifnet *ifp, struct mbuf *m) to ifnet to
allow drivers to efficiently manage multiple hardware queues
(i.e. not serialize all packets through one ifq)
- expose if_qflush to allow drivers to flush any driver managed queues

This work was supported by Bitgravity Inc. and Chelsio Inc.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# a7db7fbd 23-Sep-2008 Kip Macy <kmacy@FreeBSD.org>

- Remove default NIC dependency on ulp headers
- make toe module build dependent on kernel support

Submitted by: Chelsio Inc.
MFC after: 1 week


# 79775f8f 22-Sep-2008 Kip Macy <kmacy@FreeBSD.org>

Update cxgb include paths to not require prefixing with dev/cxgb

Submitted by: Chelsio Inc.


# e97121da 22-Sep-2008 Kip Macy <kmacy@FreeBSD.org>

Allow cxgb to be unified across versions by making newer features conditional

Submitted by: Chelsio Inc
MFC after: 3 days


# aa819acf 15-Sep-2008 Kip Macy <kmacy@FreeBSD.org>

White space cleanups to bring closer to RELENG_7


# af9b081c 15-Sep-2008 Kip Macy <kmacy@FreeBSD.org>

Remove some dead code along with gratuitous differences between HEAD and 7


# d5e2c3dd 08-Sep-2008 Kip Macy <kmacy@FreeBSD.org>

Fix issue with recovering from transient jumbo mbuf shortage.

Submitted by: Chelsio Inc.
MFC after: 3 days


# 706cb31f 12-Aug-2008 Kip Macy <kmacy@FreeBSD.org>

Add LRO and MAC statistics to exported sysctls.

Obtained from: Chelsio Inc.
MFC after: 1 week


# 25292deb 11-Aug-2008 Kip Macy <kmacy@FreeBSD.org>

Remove cxgb private lro implementation and switch to using system implementation.

Obtained from: Chelsio Inc.
MFC after: 1 week


# 9b4de886 11-Aug-2008 Kip Macy <kmacy@FreeBSD.org>

Vendor fix for PHY problem.

Obtained from: Chelsio Inc.
MFC after: 3 days


# 4af83c8c 18-Jul-2008 Kip Macy <kmacy@FreeBSD.org>

import vendor fixes to cxgb


# ef9e6d4c 31-Mar-2008 Kip Macy <kmacy@FreeBSD.org>

reduce the size of the jumbo ring on i386 and disable pcpu cluster caching


# 8e10660f 22-Feb-2008 Kip Macy <kmacy@FreeBSD.org>

- update firmware to 5.0
- add support for T3C
- add DDP support (zero-copy receive)
- fix TOE transmit of large requests
- fix shutdown so that sockets don't remain in CLOSING state indefinitely
- register listeners when an interface is brought up after tom is loaded
- fix setting of multicast filter
- enable link at device attach
- exit tick handler if shutdown is in progress
- add helper for logging TCB
- add sysctls for dumping transmit queues

- note that TOE wxill not be MFC'd until after 7.0 has been finalized

MFC after: 3 days


# 2fd79ec2 15-Jan-2008 Kip Macy <kmacy@FreeBSD.org>

put tx queue size back to 1024


# 139edb19 15-Jan-2008 Kip Macy <kmacy@FreeBSD.org>

- Simplify mb_free_ext_fast
- increase asserts for mbuf accounting
- track outstanding mbufs (maps very closely to leaked)
- actually only create one thread per port if !multiq
Oddly enough this fixes the use after free

- move txq_segs to stack in t3_encap
- add checks that pidx doesn't move pass cidx
- simplify mbuf free logic in collapse mbufs routine


# 60f1e276 14-Jan-2008 Kip Macy <kmacy@FreeBSD.org>

- move WR_LEN in to cxgb_adapter.h add PIO_LEN to make intent clearer
- move cxgb_tx_common in to cxgb_multiq.c and rename to cxgb_tx
- move cxgb_tx_common dependencies
- further simplify cxgb_dequeue_packet for the non-multiqueue case
- only launch one service thread per port in the non-multiq case
- remove dead cleaning code from cxgb_sge.c
- simplify PIO case substantially in by returning directly from mbuf collapse
and just using m_copydata
- remove gratuitous m_gethdr in the rx path
- clarify freeing of mbufs in collapse


# 5ef02c02 13-Jan-2008 Kip Macy <kmacy@FreeBSD.org>

Convert over to using the multiqueue infrastructure although all calls going
through cxgb_start still end up using queue 0


# 9330dbc3 10-Jan-2008 Kip Macy <kmacy@FreeBSD.org>

Be more aggressive about tx cleaning - when multiples streams were running the tx
queue could fill up and stop getting cleaned.


# 10b16b26 09-Jan-2008 Kip Macy <kmacy@FreeBSD.org>

Add support for selectively dumping the state of the hardware response queue.
Change ordering of a couple of types.


# 8d5754af 09-Jan-2008 Kip Macy <kmacy@FreeBSD.org>

make nqsets a uint32_t so that sysctl will work
add 2 fields for allowing queue dumping


# 8090c9f5 17-Dec-2007 Kip Macy <kmacy@FreeBSD.org>

Make TCP offload work on HEAD (modulo negative interaction between sbcompress
and t3_push_frames).
- Import latest changes to cxgb_main.c and cxgb_sge.c from toestack p4 branch
- make driver local copy of tcp_subr.c and tcp_usrreq.c and override tcp_usrreqs so
TOE can also functions on versions with unmodified TCP

- add cxgb back to the build


# 3e96c7e7 15-Dec-2007 Kip Macy <kmacy@FreeBSD.org>

Import updated support code for the TOM (tcp offload module).


# 2de1fa86 09-Sep-2007 Kip Macy <kmacy@FreeBSD.org>

pull in changes made to RELENG_6 version in the process of doing the MFC

Supported by: Chelsio
Approved by: re (blanket)


# 8adc65ad 08-Sep-2007 Kip Macy <kmacy@FreeBSD.org>

Add back in support for normal mbuf chaining on RX under DISABLE_MBUF_IOVEC

Approved by: re(blanket)
Supported by: Chelsio


# 5c5df3da 08-Sep-2007 Kip Macy <kmacy@FreeBSD.org>

- fix qset to port binding as a proper fix for the problems encountered on the 4-port
- fix the use after free seen when sending packets small enough to fit as an immediate
and bpf peers are present
- update to firmware rev 4.7 along with various small vendor fixes

Supported by: Chelsio
Approved by: re (blanket)
MFC after: 3 days


# 7ac2e6c3 25-Aug-2007 Kip Macy <kmacy@FreeBSD.org>

Fixes for 4 port and small packet optimization

- remove cpl->iff panic - we can't know the port number from the rspq on the 4-port
- pick the ifnet based on the interface in the CPL header
- switch to using qset 0 for egress on the 4-port for now - may change
when we start using RSS
- move ether_ifdetach to before the port lock gets deinitialized to avoid
hang in the case where there are BPF peers (cxgb_ioctl is called indirectly
when BPF peers are present)
- don't call t3_mac_reset if multiport is set, this was causing tx errors
by misconfiguring the MAC on the 4-port
- change V_TXPKT_INTF to use txpkt_intf as the interfaces are not contiguous
- free the mbuf immediately in the case where the payload is small enough to be copied
into the rspq
- only update the coalesce timer if for a queue if packets were taken off of it
- add in missed 20ms DELAY in initializaton vsc8211

- prompt MFC as this only applies to the 4-port which is currently completely
broken - OK'd by kensmith

Supported by: Chelsio
Approved by: re (blanket)
MFC after: 0 days


# 7aff6d8e 16-Aug-2007 Kip Macy <kmacy@FreeBSD.org>

forward port signedness fixes from RELENG_6
fix compile error for case where MSI_SUPPORTED not defined

Approved by: re (blanket)


# 6b68e276 10-Aug-2007 Kip Macy <kmacy@FreeBSD.org>

- In all structures other than port info port is a pointer to a port info,
make the code less confusing by renaming the port number to port_id

Approved by: re (blanket)


# ac3a6d9c 17-Jul-2007 Kip Macy <kmacy@FreeBSD.org>

- integrate most recent changes from vendor branch and upgrade to firmware revision 4.5.5
- add filter support
- further improvements for T304
- recover gracefully from spurious immediate packets

Approved by: re(blanket)
Supported by: Chelsio
MFC after: 3 days


# b8fe6051 10-Jul-2007 Kip Macy <kmacy@FreeBSD.org>

MFp4 122896
- reduce cpu usage by as much as 25% (40% -> 30) by doing txq reclaim more efficiently
- use mtx_trylock when trying to grab the lock to avoid spinning during long encap loop
- add per-txq reclaim task
- if mbufs were successfully re-claimed try another pass
- track txq overruns with sysctl

Approved by: re (blanket)


# bb38cd2f 16-Jun-2007 Kip Macy <kmacy@FreeBSD.org>

- switch adapter and port lock over to using sx so that resources
can be allocated atomically
- add debug macros for printing lock initialization / teardown
- add buffers to port_info and adapter to allow each lock to have a
unique name
- destroy mutexes initialized by cxgb_offload_init
- remove recursive calls to ADAPTER_LOCK
- move callout_drain calls so that they don't occur with the lock held
- ensure that only as many qsets as are needed are initialized and
destroyed

MFC after: 3 days
Sponsored by: Chelsio Inc.


# ef72318f 12-Jun-2007 Kip Macy <kmacy@FreeBSD.org>

- import new common code for the T304
- update to firmware version 4.1.0

- switch over to standard method for initializing cdevs (contributed by scottl@)
- break out timer_reclaim_task to be per-port
- move msix teardown into separate function
- fix bus_setup_intr for msi-x for the multi-port case so that msi-x resources
are not corrupted on unload
- handle 10/100/1000 base-T media and auto negotiation
- bind qset to cpu even for singleq case
- white space cleanups
- remove recursive PORT_LOCK
- move mtu setting to separate function
- stop and re-init port when changing mtu
- replace all direct references to m_data with calls to mtod
- handle attach failure better by not trying to de-initialize
taskqueues when they have not been allocated
- no longer default to jumbo frames

Sponsored by: Chelsio
MFC after: 3 days


# 10faa568 28-May-2007 Kip Macy <kmacy@FreeBSD.org>

When building cxgb as a module make include paths relative to the driver's root.
This will make it possible to build the module out of tree against an older src tree.

MFC after: 3 days


# d722cab4 25-May-2007 Kip Macy <kmacy@FreeBSD.org>

(MFp4)
- upgrade to reflect state of 1.0.0.86
- move from firmware rev 3.2 to 4.0.0
- import driver bits for offload functionality
- remove binary distribution clause from top level files as it
runs counter to the intent of purely supporting the hardware

MFC after: 3 days


# c0a24dd4 08-Apr-2007 Kip Macy <kmacy@FreeBSD.org>

Convert driver RX path over to using mbuf iovec


# fa0521c0 03-Apr-2007 Kip Macy <kmacy@FreeBSD.org>

Make DMA tags per-queue to facilate parallel mappings
Defer mbuf allocation and initialization until after data has already been
received in a cluster

This reduces cpu utilization somewhat, but it only improves the rx path.
Recent changes to TCP appear to make us rate limited by the TX path.

This is the first step in reducing mbuf management overhead for manipulating
clusters.

MFC after: 3 days


# ac6b4cf1 23-Mar-2007 Kip Macy <kmacy@FreeBSD.org>

bus_size_t is a bad cross-architectural type with respect to printf, use uint32_t instead


# f309e60d 23-Mar-2007 Kip Macy <kmacy@FreeBSD.org>

commit missed change


# 693d746c 21-Mar-2007 Kip Macy <kmacy@FreeBSD.org>

make MSI-X the default and allocate up to mp_ncpus queues per port

MFC after: 3 days


# 577e9bbe 20-Mar-2007 Kip Macy <kmacy@FreeBSD.org>

Synchronize with version 1.0.071 of Chelsio's common code
(with the notable exception of improvements for using multiple TX queues)

This adds support for the T3B2 ASIC rev

Obtained from: Chelsio
MFC after: 3 days


# b9d6bc3b 14-Mar-2007 Kip Macy <kmacy@FreeBSD.org>

make desc_reclaimable macro safe to arbitrary arguments


# b6d90eb7 13-Mar-2007 Kip Macy <kmacy@FreeBSD.org>

First of several commits for driver support for the Chelsio T3B 10 Gigabit
Ethernet adapter.

Reviewed by: scottl, sam

For those interested in the preliminary performance work see below.

Plots of mxge vs. cxgb running netpipe:

blocksize vs. bandwidth:
http://www.fsmware.com/chelsio.random/bsvsbw.gif

blocksize vs. RTT:
First of several commits for driver support for the Chelsio T3B 10 Gigabit
Ethernet adapter.

Reviewed by: scottl, sam

For those interested in the preliminary performance work see below.

Plots of mxge vs. cxgb running netpipe:

blocksize vs. bandwidth:
http://www.fsmware.com/chelsio.random/bsvsbw.gif

blocksize vs. RTT:
http://www.fsmware.com/chelsio.random/bsvstime.gif

blocksize vs. RTT for block sizes <= 10kb:
http://www.fsmware.com/chelsio.random/bsvstime_10kb.gif
http://www.fsmware.com/chelsio.random/bsvstime_10kb3.gif