Commit Graph

514 Commits

Author SHA1 Message Date
Navdeep Parhar
7a5b897dfe cxgbe(4): Remove stray if_up from the code that creates the tracing ifnet. 2014-05-23 01:45:44 +00:00
Maksim Yevmenkin
080a4b9b1c use correct (integer) type for the temperature sysctl
Reviewed by:	np, scottl
Obtained from:	Netflix
MFC after:	3 days
2014-04-17 19:29:15 +00:00
Navdeep Parhar
8b3f42d52d cxgbe(4): Recognize the "spider" configuration where a T5 card's 40G
QSFP port is presented as 4 distinct 10G SFP+ ports to the driver.

MFC after:	2 weeks
2014-03-21 00:56:56 +00:00
Navdeep Parhar
65bd4d1cb4 cxgbe(4): Use ifi_oqdrops in if_data to count drops in the tx path. 2014-03-20 02:28:05 +00:00
Navdeep Parhar
475992bdfb cxgbe(4): if_iqdrops statistic should include tunnel congestion drops.
MFC after:	1 week
2014-03-20 01:58:04 +00:00
Navdeep Parhar
38035ed6dc cxgbe(4): significant rx rework.
- More flexible cluster size selection, including the ability to fall
  back to a safe cluster size (PAGE_SIZE from zone_jumbop by default) in
  case an allocation of a larger size fails.
- A single get_fl_payload() function that assembles the payload into an
  mbuf chain for any kind of freelist.  This replaces two variants: one
  for freelists with buffer packing enabled and another for those without.
- Buffer packing with any sized cluster.  It was limited to 4K clusters
  only before this change.
- Enable buffer packing for TOE rx queues as well.
- Statistics and tunables to go with all these changes.  The driver's
  man page will be updated separately.

MFC after:	5 weeks
2014-03-18 20:14:13 +00:00
Dimitry Andric
e9e21b6e41 In cxgbe, conditionalize the t4_pgprot_wc() function, since it is only
used when DOT5 is defined.

Reviewed by:	np
MFC after:	3 days
2014-02-14 23:38:42 +00:00
Scott Long
f7a74e061b Add a new sysctl, dev.cxgbe.N.rsrv_noflow, and a companion tunable,
hw.cxgbe.rsrv_noflow.  When set, queue 0 of the port is reserved for
TX packets without a flowid.  The hash value of packets with a flowid
is bumped up by 1.  The intent is to provide a private queue for
link-level packets like LACP that is unlikely to overflow or suffer
deep queue latency.

Reviewed by:	np
Obtained from:	Netflix
MFC after:	3 days
2014-02-06 18:40:38 +00:00
Navdeep Parhar
e46dcc5670 cxgbe(4): Use the rx channel map (instead of the tx channel map) as the
congestion channel map.

MFC after:	1 week
2014-02-06 03:30:12 +00:00
Navdeep Parhar
7293a15f54 cxgbe(4): The T5 allows for a different freelist starvation threshold
for queues with buffer packing.  Use the correct value to calculate a
freelist's low water mark.

MFC after:	1 week
2014-02-06 03:21:43 +00:00
Navdeep Parhar
454813ff9c cxgbe(4): Use the port's tx channel to identify it to t4_clr_port_stats.
MFC after:	3 days
2014-02-06 02:34:29 +00:00
Adrian Chadd
3af0f449ae Add an option to enable or disable the small RX packet copying that
is done to improve performance of small frames.

When doing RX packing, the RX copying isn't necessarily required.

Reviewed by:	np
2014-01-02 23:23:33 +00:00
Navdeep Parhar
88bb82e511 Do not create a hardware IPv6 server if the listen address is not
in6addr_any and is not in the CLIP table either.  This fixes a reported
TOE+IPv6 NULL-dereference panic in do_pass_open_rpl().

While here, stop creating hardware servers for any loopback address.
It's just a waste of server tids.

MFC after:	1 week
2013-12-17 21:41:23 +00:00
Navdeep Parhar
93e9cae3fa Read card capabilities after firmware initialization, instead of setting
them up as part of firmware initialization (which the driver gets to do
only if it's the master driver).

Read the range of tids available for the ETHOFLD functionality if it's
enabled.

New is_ftid() and is_etid() functions to test whether a tid falls within
the range of filter tids or ETHOFLD tids respectively.

MFC after:	2 weeks
2013-12-14 03:08:03 +00:00
Adrian Chadd
ac68deae6d Print out the full PCIe link negotiation during dmesg.
I found this useful when checking whether a NIC is in a PCIE 3.0 8x slot
or not.

Reviewed by:	np
Sponsored by:	Netflix, inc.
2013-12-10 00:07:04 +00:00
Navdeep Parhar
d419aaa126 Unstaticize t4_list and t4_uld_list. This works around a clang
annoyance[1] and allows kgdb to find these symbols.

[1] http://lists.freebsd.org/pipermail/freebsd-hackers/2012-November/041166.html

MFC after:	3 days
2013-12-09 23:33:57 +00:00
Navdeep Parhar
273ef9912d cxgbe(4): save a copy of the RSS map for each port for the driver's use. 2013-12-08 17:47:37 +00:00
Navdeep Parhar
05337b80ee cxgbe(4): T4_SET_SCHED_CLASS and T4_SET_SCHED_QUEUE ioctls to program
scheduling classes in the chip and to bind tx queue(s) to a scheduling
class respectively.  These can be used for various kinds of tx traffic
throttling (to force selected tx queues to drain at a fixed Kbps rate,
or a % of the port's total bandwidth, or at a fixed pps rate, etc.).

Obtained from:	Chelsio
2013-12-03 18:34:52 +00:00
Navdeep Parhar
2471928bf8 Disable an assertion that relies on some code[1] that isn't in HEAD yet.
[1] http://lists.freebsd.org/pipermail/freebsd-net/2013-August/036573.html
2013-11-27 19:54:19 +00:00
Navdeep Parhar
245a0bd40a cxgbe(4): update the internal list of device features.
MFC after:	3 days
2013-11-21 20:07:58 +00:00
Navdeep Parhar
1192eeb8a3 cxgbe(4): Tidy up the display for payload memory statistics (pm_stats).
# sysctl -n dev.t4nex.0.misc.pm_stats
# sysctl -n dev.t5nex.0.misc.pm_stats

MFC after:	1 week
2013-11-07 00:25:49 +00:00
Navdeep Parhar
be2c01211c cxgbe(4): Exclude MPS_RPLC_MAP_CTL (0x11114) from the register dump. Turns
out it's a write-only register with strange side effects on read.

Submitted by:	gnn
MFC after:	3 days
2013-11-04 21:06:21 +00:00
Gleb Smirnoff
66e01d73cd - Provide necessary includes.
- Remove unnecessary includes.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-29 11:17:49 +00:00
Gleb Smirnoff
c3322cb91c Include necessary headers that now are available due to pollution
via if_var.h.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-28 07:29:16 +00:00
Gleb Smirnoff
76039bc84f 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.
2013-10-26 17:58:36 +00:00
Navdeep Parhar
87f804e879 Fix typo in previous commit. 2013-10-18 00:00:08 +00:00
Navdeep Parhar
02318fcf86 iw_cxgbe should have a dependency on t4nex.
Reported by:	trasz@
2013-10-17 23:57:17 +00:00
Navdeep Parhar
fb93f5c47f iw_cxgbe: iWARP driver for Chelsio T4/T5 chips. This is a straight port
of the iw_cxgb4 found in OFED distributions.

Obtained from:	Chelsio
2013-10-17 18:37:25 +00:00
Navdeep Parhar
b3eda7872d cxgbe(4): Store the log2 of the # of doorbells per BAR2 page for both
ingress and egress queues, and for both T4 and T5.  These values are
used by the T4/T5 iWARP driver.
2013-10-14 23:32:56 +00:00
Navdeep Parhar
48d05478bf cxgbe(4): Update T4 and T5 firmwares to 1.9.12.0 2013-10-14 21:25:07 +00:00
Gleb Smirnoff
4cdc1f5421 There are some high performance NICs that count statistics in hardware,
and there are ifnets, that do that via counter(9). Provide a flag that
would skip cache line trashing '+=' operation in ether_input().

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
Reviewed by:	melifaro, adrian
Approved by:	re (marius)
2013-10-09 19:04:40 +00:00
Dimitry Andric
64db896617 Fix kernel build on amd64 after r256118, since the machine/md_var.h
header is not implicitly included there.  So include it explicitly.

Approved by:	re (delphij)
Pointy hat to:	dim
MFC after:	3 days
X-MFC-With:	r256118
2013-10-07 22:30:03 +00:00
Dimitry Andric
42355a4ff6 Remove redundant declaration of cpu_clflush_line_size in
sys/dev/cxgbe/t4_sge.c, to silence a gcc warning.

Approved by:	re (gjb)
MFC after:	3 days
2013-10-07 16:56:56 +00:00
Navdeep Parhar
eb22728291 Rework the tx credit mechanism between the cxgbe/tom driver
and the card.  This helps smooth out some burstiness in the
exchange.

Approved by:	re (glebius)
2013-09-09 04:38:57 +00:00
Navdeep Parhar
c81d56a0aa Fix a miscalculation that caused cxgbe/tom to auto-increment
a TOE socket's tx buffer size too aggressively.

Approved by:	re (delphij)
2013-09-09 00:16:59 +00:00
Navdeep Parhar
4f641559c7 For TOE connections, the window scale factor in CPL_PASS_ACCEPT_REQ is
set to 15 to indicate that the peer did not send a window scale option
with its SYN.  Do not send a window scale option in the SYN|ACK reply
in that case.
2013-09-03 23:34:04 +00:00
Navdeep Parhar
32e9219012 Fix the sysctl that displays whether buffer packing is enabled
or not.
2013-08-30 02:13:36 +00:00
Navdeep Parhar
1458bff9a4 Implement support for rx buffer packing. Enable it by default for T5
cards.

This is a T4 and T5 chip feature which lets the chip deliver multiple
Ethernet frames in a single buffer.  This is more efficient within the
chip, in the driver, and reduces wastage of space in rx buffers.

- Always allocate rx buffers from the jumbop zone, no matter what the
  MTU is.  Do not use the normal cluster refcounting mechanism.
- Reserve space for an mbuf and a refcount in the cluster itself and let
  the chip DMA multiple frames in the rest.
- Use the embedded mbuf for the first frame and allocate mbufs on the
  fly for any additional frames delivered in the cluster.  Each of these
  mbufs has a reference on the underlying cluster.
2013-08-30 01:45:36 +00:00
Navdeep Parhar
480e603c79 Merge r254386 from user/np/cxl_tuning. Add an INET|INET6 check missing
in said revision.

r254386:
Flush inactive LRO entries periodically.
2013-08-29 06:26:22 +00:00
Navdeep Parhar
c93d567412 Whitespace nit. 2013-08-28 23:15:05 +00:00
Navdeep Parhar
319a31ea18 Change t4_list_lock and t4_uld_list_lock from mutexes to sx'es.
- tom_uninit had to be reworked not to hold the adapter lock (a mutex)
  around t4_deactivate_uld, which acquires the uld_list_lock.
- the ifc_match for the interface cloner that creates the tracer ifnet
  had to be reworked as the kernel calls ifc_match with the global
  if_cloners_mtx held.
2013-08-28 20:59:22 +00:00
Navdeep Parhar
9800517691 Add hooks in base cxgbe(4) for the iWARP upper-layer driver. Update a
couple of assertions in the TOE driver as well.
2013-08-28 20:45:45 +00:00
Navdeep Parhar
8a59745fca Use correct mailbox and PCIe PF number when querying RDMA parameters. 2013-08-26 19:02:52 +00:00
Navdeep Parhar
aa9a5cc05a There is no need to hold the freelist lock around alloc/free of
software descriptors.  This also silences WITNESS warnings when
the software descriptors are allocated with M_WAITOK.

MFC after:	1 week
2013-08-23 18:03:18 +00:00
Navdeep Parhar
2485eeee37 Display P/N information in the description.
Submitted by:	gnn
MFC after:	3 days
2013-08-20 18:22:04 +00:00
Navdeep Parhar
82342de26d Display temperature sensor data. Shows -1 if sensor not
available on the card.

# sysctl dev.t4nex.0.temperature
# sysctl dev.t5nex.0.temperature
2013-08-02 18:05:42 +00:00
Navdeep Parhar
73cd922046 Fix previous commit (r253873). "cong" has one bit per channel but the
congestion channel map has 1 nibble per channel.  So bits wxyz need to
be blown up into 000w000x000y000z.
2013-08-02 17:44:19 +00:00
Navdeep Parhar
ba41ec4848 Set up congestion manager context properly for T5 based cards.
MFC after:	3 days (will check with re@)
2013-08-01 23:38:30 +00:00
Navdeep Parhar
6e22f9f3da Display SGE tunables in the sysctl tree.
dev.t5nex.0.fl_pktshift: payload DMA offset in rx buffer (bytes)
dev.t5nex.0.fl_pad: payload pad boundary (bytes)
dev.t5nex.0.spg_len: status page size (bytes)
dev.t5nex.0.cong_drop: congestion drop setting

Discussed with:	scottl
2013-07-31 05:12:51 +00:00
Navdeep Parhar
2393220538 Display a string instead of a numeric code in the linkdnrc sysctl.
Submitted by:	gnn@
2013-07-27 07:43:43 +00:00
Navdeep Parhar
716c9e1b58 Expand the list of devices claimed by cxgbe(4). 2013-07-27 00:53:07 +00:00
Navdeep Parhar
caf20efcde Add support for packet-sniffing tracers to cxgbe(4). This works with
all T4 and T5 based cards and is useful for analyzing TSO, LRO, TOE, and
for general purpose monitoring without tapping any cxgbe or cxl ifnet
directly.

Tracers on the T4/T5 chips provide access to Ethernet frames exactly as
they were received from or transmitted on the wire.  On transmit, a
tracer will capture a frame after TSO segmentation, hw VLAN tag
insertion, hw L3 & L4 checksum insertion, etc.  It will also capture
frames generated by the TCP offload engine (TOE traffic is normally
invisible to the kernel).  On receive, a tracer will capture a frame
before hw VLAN extraction, runt filtering, other badness filtering,
before the steering/drop/L2-rewrite filters or the TOE have had a go at
it, and of course before sw LRO in the driver.

There are 4 tracers on a chip.  A tracer can trace only in one direction
(tx or rx).  For now cxgbetool will set up tracers to capture the first
128B of every transmitted or received frame on a given port.  This is a
small subset of what the hardware can do.  A pseudo ifnet with the same
name as the nexus driver (t4nex0 or t5nex0) will be created for tracing.
The data delivered to this ifnet is an additional copy made inside the
chip.  Normal delivery to cxgbe<n> or cxl<n> will be made as usual.

/* watch cxl0, which is the first port hanging off t5nex0. */
# cxgbetool t5nex0 tracer 0 tx0  (watch what cxl0 is transmitting)
# cxgbetool t5nex0 tracer 1 rx0  (watch what cxl0 is receiving)
# cxgbetool t5nex0 tracer list
# tcpdump -i t5nex0   <== all that cxl0 sees and puts on the wire

If you were doing TSO, a tcpdump on cxl0 may have shown you ~64K
"frames" with no L3/L4 checksum but this will show you the frames that
were actually transmitted.

/* all done */
# cxgbetool t5nex0 tracer 0 disable
# cxgbetool t5nex0 tracer 1 disable
# cxgbetool t5nex0 tracer list
# ifconfig t5nex0 destroy
2013-07-26 22:04:11 +00:00
Navdeep Parhar
4ff45b8b45 Reserve room for ioctls that aren't in this copy of the driver yet. 2013-07-26 20:54:33 +00:00
Navdeep Parhar
92ad6ac7d4 Specify a timeout for the PL block.
MFC after:	3 days
2013-07-17 02:37:40 +00:00
Navdeep Parhar
2b66d73259 Attach to the 4x10G T540-CR card. 2013-07-11 19:09:31 +00:00
Navdeep Parhar
3a760ee793 - Show the reason why link is down if this information is available.
- Display the temperature and PHY firmware version of the BT PHY.

MFC after:	1 day
2013-07-05 01:53:51 +00:00
Navdeep Parhar
6eb3180fb2 - Make note of interface MTU change if the rx queues exist, and not just
when the interface is up.
- Add a tunable to control the TOE's rx coalesce feature (enabled by
  default as it always has been).  Consider the interface MTU or the
  coalesce size when deciding which cluster zone to use to fill the
  offload rx queue's free list.  The tunable is:
  dev.{t4nex,t5nex}.<N>.toe.rx_coalesce

MFC after:	1 day
2013-07-04 21:19:01 +00:00
Navdeep Parhar
6300655cc1 On-the-fly changes to the interrupt coalescing timer should apply to the
TOE rx queues too.

MFC after:	1 day
2013-07-04 20:17:39 +00:00
Navdeep Parhar
50ce3d40aa Pay attention to TCP_NODELAY when it's set/unset after the connection
is established.

MFC after:	1 day
2013-07-04 19:44:30 +00:00
Navdeep Parhar
7e2fb22f81 Ring the egress queue's doorbell as soon as there are 8 or more
descriptors ready to be processed.

MFC after:	1 day
2013-07-04 19:15:41 +00:00
Navdeep Parhar
054a2dc11c The T5 allows the driver to specify the ISS. Do so; use the ISS picked
by the kernel.

MFC after:	1 day
2013-07-04 18:41:21 +00:00
Navdeep Parhar
c337fa30af - Read all TP parameters in one place.
- Read the filter mode, calculate various shifts, and use them
  properly during active open (in select_ntuple).

MFC after:	1 day
2013-07-04 17:55:52 +00:00
Navdeep Parhar
f72b68a1bf - Include the T5 firmware with the driver.
- Update the T4 firmware to the latest.
- Minor reorganization and updates to the version macros, etc.

Obtained from:	Chelsio
MFC after:	1 day
2013-07-03 23:52:15 +00:00
Navdeep Parhar
87c7afeb55 Add a sysctl to get the number of filters available.
sysctl dev.t4nex.<N>.nfilters
sysctl dev.t5nex.<N>.nfilters

MFC after:	3 days
2013-07-01 17:31:04 +00:00
Navdeep Parhar
9942898697 Update T5 register ranges. This is so that regdump skips over registers
with read side-effects.

MFC after:	3 days
2013-06-27 18:59:07 +00:00
Navdeep Parhar
f81cb396de cxgbe/tom: Allow caller to select the queue (control or data) used to
send the CPL_SET_TCB_FIELD request in t4_set_tcb_field().

MFC after:	1 week
2013-06-11 21:20:23 +00:00
Navdeep Parhar
e0f8a7f4da cxgbe/tom: Fix bad signed/unsigned mixup in the stid allocator. This
fixes a panic when allocating a mixture of IPv6 and IPv4 stids.

MFC after:	1 week
2013-06-08 07:23:26 +00:00
Navdeep Parhar
ad13c6af54 cxgbe(4): Never install a firmware if hw.cxgbe.fw_install is 0.
MFC after:	1 week
2013-06-05 20:57:52 +00:00
Navdeep Parhar
9050afc0a0 cxgbe(4): Provide accurate hit count for filters on T5 cards. The
location within the TCB and the size have both changed.

MFC after:	1 week
2013-06-04 02:25:25 +00:00
Navdeep Parhar
9e4ffff197 cxgbe(4): Some more debug sysctls. These work on both T4 and T5 based
cards.

dev.t5nex.0.misc.cim_ma_la: CIM MA logic analyzer
dev.t5nex.0.misc.cim_pif_la: CIM PIF logic analyzer
dev.t5nex.0.misc.mps_tcam: MPS TCAM entries
dev.t5nex.0.misc.tp_la: TP logic analyzer
dev.t5nex.0.misc.ulprx_la: ULPRX logic analyzer

Obtained from:	Chelsio
MFC after:	1 week
2013-06-01 02:07:37 +00:00
Konstantin Belousov
5ada86640b Add dependencies on the firmware, which allows the loading of the cxgb
and cxgbe modules.

Reviewed and approved by:	np
MFC after:	1 week
2013-05-16 13:07:02 +00:00
Navdeep Parhar
d607c7477c Deal correctly with 40G ports that don't have any transceiver plugged
in.  Do not claim that they have unknown tranceivers.

MFC after:	3 days
2013-05-13 20:00:03 +00:00
Navdeep Parhar
959cbee5b0 cxgbe: Switch to a better way to install firmware.
MFC after:	1 week
2013-05-03 20:09:17 +00:00
Navdeep Parhar
688dba74a5 cxgbe/tom: Do not use M_PROTO1 to mark rx zero-copy mbufs as special.
All the M_PROTOn flags are clobbered when an mbuf is appended to the
socket buffer.

MFC after:	1 week
2013-05-03 18:37:50 +00:00
Navdeep Parhar
88c4ff7bf1 Fix DDP breakage introduced in r248925. Bitwise OR has higher
precedence than ternary conditional.

MFC after:	1 week
2013-04-30 19:57:21 +00:00
Navdeep Parhar
249b2994d4 Attach to the T580 (2 x 40G) card.
MFC after:	1 week.
2013-04-30 06:30:21 +00:00
Navdeep Parhar
8cf31b85b5 - Provide accurate ifmedia information so that 40G ports/transceivers are
displayed properly in ifconfig, etc.

- Use the same number of tx and rx queues for a 40G port as for a 10G port.

MFC after:	1 week
2013-04-30 05:51:52 +00:00
Navdeep Parhar
3cc9b3e283 cxgbe(4): Some updates to shared code.
Obtained from:	Chelsio
MFC after:	1 week
2013-04-30 05:32:07 +00:00
Navdeep Parhar
3cc7ae06fd cxgbe(4): Refuse to install T5 firmwares on a T4 card (and vice versa).
MFC after:	1 week
2013-04-18 22:54:41 +00:00
Navdeep Parhar
dd181b2652 cxgbe/tom: Update the CLIP table on the chip when there are changes
to the list of IPv6 addresses on the system.  The table is used for
TOE+IPv6 only.
2013-04-18 19:52:11 +00:00
Navdeep Parhar
c0bc8af9b7 Add pciids of the T5 based cards. The ones that I haven't tested with
cxgbe(4) are disabled for now.  This will change.

MFC after:	2 weeks
2013-04-11 23:40:05 +00:00
Navdeep Parhar
77ad3c4146 Cosmetic change (s/wrwc/wcwr/;s/WRWC/WCWR/).
MFC after:	3 days.
2013-04-11 22:49:29 +00:00
Navdeep Parhar
cf738022b0 Auto-reduce the holdoff timers that are greater than the maximum value
allowed by the hardware.

MFC after:	3 days
2013-04-11 22:46:39 +00:00
Navdeep Parhar
b7a7c6d0c3 cxgbe/tom: Slight simplification of code that calculates options2.
MFC after:	3 days
2013-04-11 21:36:01 +00:00
Navdeep Parhar
e7fdf38bbb Get rid of a couple of stray \n's.
MFC after:	3 days.
2013-04-11 21:17:49 +00:00
Navdeep Parhar
53e8e49dcf There is no need for elaborate queries and error checking when trying to
set FW4MSG_ENCAP.

MFC after:	3 days
2013-04-11 21:15:35 +00:00
Navdeep Parhar
408b98ef5a - Explain clearly why a different firmware is being installed (if/when
it is being installed).  Improve other error messages while here.

- Select special FPGA specific configuration profile when appropriate.

MFC after:	3 days
2013-04-11 19:39:40 +00:00
Navdeep Parhar
13bf4b0798 cxgbe(4): Ensure that the MOD_LOAD handler runs before either t4nex or
t5nex attach to their devices.

MFC after:	3 days
2013-04-11 17:50:50 +00:00
Navdeep Parhar
d14b0ac129 cxgbe(4): Add support for Chelsio's Terminator 5 (aka T5) ASIC. This
includes support for the NIC and TOE features of the 40G, 10G, and
1G/100M cards based on the T5.

The ASIC is mostly backward compatible with the Terminator 4 so cxgbe(4)
has been updated instead of writing a brand new driver.  T5 cards will
show up as cxl (short for cxlgb) ports attached to the t5nex bus driver.

Sponsored by:	Chelsio
2013-03-30 02:26:20 +00:00
Navdeep Parhar
cc66a2c789 cxgbe(4): Report unusual out of band errors from the firmware.
Obtained from:	Chelsio
MFC after:	5 days
2013-02-26 21:25:17 +00:00
Navdeep Parhar
d78bd33fac cxgbe(4): Consider all the API versions of the interfaces exported by
the firmware (instead of just the main firmware version) when evaluating
firmware compatibility.  Document the new "hw.cxgbe.fw_install" knob
being introduced here.

This should fix kern/173584 too.  Setting hw.cxgbe.fw_install=2 will
mostly do what was requested in the PR but it's a bit more intelligent
in that it won't reinstall the same firmware repeatedly if the knob is
left set.

PR:		kern/173584
MFC after:	5 days
2013-02-26 20:35:54 +00:00
Navdeep Parhar
0abd31e2f7 cxgbe(4): Ask the card's firmware to pad up tiny CPLs by encapsulating
them in a firmware message if it is able to do so.  This works out
better for one of the FIFOs in the chip.

MFC after:	5 days
2013-02-26 00:27:27 +00:00
Navdeep Parhar
d938ff1d15 cxgbe(4): Update firmware to 1.8.4.0.
MFC after:	5 days
2013-02-26 00:10:28 +00:00
Navdeep Parhar
c1508f2bad cxgbe(4): Add sysctls to extract debug information from the chip:
dev.t4nex.X.misc.cim_la         logic analyzer dump
dev.t4nex.X.misc.cim_qcfg       queue configuration
dev.t4nex.X.misc.cim_ibq_xxx    inbound queues
dev.t4nex.X.misc.cim_obq_xxx    outbound queues

Obtained from:	Chelsio
MFC after:	1 week
2013-02-21 20:13:15 +00:00
Navdeep Parhar
b85313804d cxgbe(4): Assume that CSUM_TSO in the transmit path implies CSUM_IP and
CSUM_TCP too.  They are all set explicitly by the kernel usually.

While here, fix an unrelated bug where hardware L4 checksum calculation
was accidentally disabled for some IPv6 packets.

Reported by:	alfred@
MFC after:	3 days
2013-02-20 23:15:40 +00:00
Navdeep Parhar
bf3db9ebd8 Do not hold locks around hardware context reads.
MFC after:	3 days
2013-02-09 00:35:28 +00:00
Navdeep Parhar
0d8158d796 Busy-wait when cold.
Reported by:	gnn, jhb
MFC after:	3 days
2013-02-06 06:44:42 +00:00
Navdeep Parhar
c25f378771 Provide a statistic to track the number of drops in each of the port's
txq's buf_ring.  The aggregate for all the queues of a port is already
provided in ifnet->if_snd.ifq_drops.

MFC after:	3 days.
2013-01-29 20:59:22 +00:00
Navdeep Parhar
d92ed49c94 Install an extra hold on the newly allocated synq entry so that it
cannot be freed while do_pass_accept_req is running.  This closes a race
where do_pass_establish on another CPU (the driver chose a different
queue for the new tid) expands the synq entry into a full PCB and then
releases the only hold on it, all while do_pass_accept_req is still
running.

MFC after:	3 days
2013-01-26 03:23:28 +00:00
Navdeep Parhar
1cdc889916 Force the 404-BT card (4 x 1G) to use the "uwire" configuration file.
MFC after:	3 days
2013-01-26 03:10:28 +00:00
Navdeep Parhar
dfd1b3a02f Add a couple of missing error codes. Treat CPL_ERR_KEEPALV_NEG_ADVICE as
negative advice and not a fatal error.

MFC after:	3 days
2013-01-26 03:01:51 +00:00
Navdeep Parhar
7ca5c8632d cxgbe/tom: List IFCAP_TOE6 as supported now that all the required pieces
are in place.  You still have to enable it explicitly, after loading the
t4_tom KLD.
2013-01-26 01:06:27 +00:00
Navdeep Parhar
e13fe79820 cxgbe: Make the for_each macros safer to use by turning them
into a single statement each.

Submitted by:	Christoph Mallon <christoph dot mallon at gmx dot de>
MFC after:	1 week
2013-01-17 18:52:49 +00:00
Navdeep Parhar
601fce8879 cxgbe: Do a more thorough job in the CLEAR_STATS ioctl.
MFC after:	3 days
2013-01-16 23:49:55 +00:00
Navdeep Parhar
5bb17208d7 cxgbe: Fix the for_each_foo macros -- the last argument should not share
its name with any member of struct sge.

MFC after:	3 days
2013-01-16 23:48:55 +00:00
Navdeep Parhar
c995301b2d cxgbe/tom: Add support for fully offloaded TCP/IPv6 connections (passive open).
MFC after:	1 week
2013-01-15 18:50:40 +00:00
Navdeep Parhar
8be0815671 cxgbe/tom: Add support for fully offloaded TCP/IPv6 connections (active open).
MFC after:	1 week
2013-01-15 18:38:51 +00:00
Navdeep Parhar
87aa6825ff cxgbe/tom: Basic CLIP table management.
This is the Compressed Local IPv6 table on the chip.  To save space, the
chip uses an index into this table instead of a full IPv6 address in
some of its hardware data structures.

For now the driver fills this table with all the local IPv6 addresses
that it sees at the time the table is initialized.  I'll improve this
later so that the table is updated whenever new IPv6 addresses are
configured or existing ones deleted.

MFC after:	1 week
2013-01-15 07:07:29 +00:00
Navdeep Parhar
7f441ef267 cxgbe/tom: Miscellaneous updates for TOE+IPv6 support (more to follow).
- Teach find_best_mtu_idx() to deal with IPv6 endpoints.

- Install correct protosw in offloaded TCP/IPv6 sockets when DDP is
  enabled.

- Move set_tcp_ddp_ulp_mode to t4_tom.c so that t4_tom.h can be included
  without having to drag in t4_msg.h too.  This was bothering the iWARP
  driver for some reason.

MFC after:	1 week
2013-01-15 00:24:01 +00:00
Navdeep Parhar
0a0a697c73 cxgbe(4): Updates to the hardware L2 table management code.
- Add full support for IPv6 addresses.

- Read the size of the L2 table during attach.  Do not assume that PCIe
  physical function 4 of the card has all of the table to itself.

- Use FNV instead of Jenkins to hash L3 addresses and drop the private
  copy of jhash.h from the driver.

MFC after:	1 week
2013-01-14 20:36:22 +00:00
Navdeep Parhar
c66c36a454 Overhaul the stid allocator so that it can be used for IPv6 servers
too.  The entry for an IPv6 server in the TCAM takes up the equivalent
of two ordinary stids and must be properly aligned too.

MFC after:	1 week
2013-01-11 00:07:01 +00:00
Navdeep Parhar
b174b65819 cxgbe(4): Add functions to help synchronize "slow" operations (those not
on the fast data path) and use them instead of frobbing the adapter lock
and busy flag directly.

Other changes made while reworking all slow operations:
- Wait for the reply to a filter request (add/delete).  This guarantees
  that the operation is complete by the time the ioctl returns.
- Tidy up the tid_info structure.
- Do not allow the tx queue size to be set to something that's not a
  power of 2.

MFC after:	1 week
2013-01-10 23:56:50 +00:00
Navdeep Parhar
c9bfe3d179 cxgbe(4): updates to the configuration file that controls how hardware
resources are partitioned.

- Reduce the number of virtual interfaces reserved for PF4.  This leaves
  spare room in the source MAC table and allows the driver to setup
  filters that rewrite the source MAC address.

- Reduce the number of filters and use the freed up space for the CLIP
  (Compressed Local IPv6 addresses) table.  This is a prerequisite for
  IPv6 TOE support which will follow separately in a series of commits.

MFC after:	1 week
2013-01-09 21:27:14 +00:00
Navdeep Parhar
c6719ccdef cxgbe(4): Add support for the T440-LP-CR card. This is the 4x10G low
profile card with a QSFP+ transceiver.

MFC after:	3 days
2012-12-22 07:47:07 +00:00
Navdeep Parhar
4cead97615 cxgbe(4): must hold a write-lock on the table while allocating an L2
entry for switching.

MFC after:	3 days
2012-12-21 19:28:17 +00:00
Gleb Smirnoff
c6499eccad Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.
2012-12-04 09:32:43 +00:00
Navdeep Parhar
d588c1f9ba cxgbe/tom: Handle the case where the chip falls out of DDP mode by
itself.  The hole in the receive sequence space corresponds to the
number of bytes placed directly up to that point.

MFC after:	1 week
2012-11-29 19:39:27 +00:00
Navdeep Parhar
000da5202e cxgbe/tom: Add a flag to indicate that the L2 table entry for an
embryonic connection has been setup and never attempt to abort a tid
before this is done.  This fixes a bad race where a listening socket is
closed when the driver is in the middle of step (b) here.  The symptom
of this were "ARP miss" errors from the driver followed by tid leaks.

A hardware-offloaded passive open works this way:

a) A SYN "hits" the TCAM entry for a server tid and the chip delivers it
to the queue associated with the server tid (say, queue A).  It waits
for a response from the driver telling it what to do.

b) The driver decides it is ok to proceed.  It adds the new tid to the
list of embryonic connections associated with the server tid and then
hands off the SYN to the kernel's syncache to make sure that the kernel
okays it too.  If it does then the driver provides an L2 table entry,
queue id (say, queue B), etc. and instructs the chip to send the SYN/ACK
response.

c) The chip delivers a status to queue B depending on how the third step
of the 3-way handshake goes.  The driver removes the tid from its list
of embryonic connections and either expands the syncache entry or
destroys the tid.  In any case all subsequent messages for the new tid
will be delivered to queue B, not queue A.  Anything running in queue B
knows that the L2 entry has long been setup and the new flag is of no
interest from here on.  If the listener is closed it will deal with
so_comp as normal.

MFC after:	1 week
2012-11-29 19:10:04 +00:00
Navdeep Parhar
e1e0aa8d3e cxgbe/tom: Plug mbuf leak.
MFC after:	3 days
2012-11-16 00:21:54 +00:00
Navdeep Parhar
274b95d3ac Make sure the inp hasn't been dropped before trying to access its socket
and tcpcb.

MFC after:	3 days
2012-11-06 20:22:39 +00:00
Navdeep Parhar
c5dddc6694 Remove the tid from the software table (and bump down the in-use
counter) when the syncache doesn't want the driver to reply to an
incoming SYN.  This fixes a harmless bug where tids_in_use would
go out of sync with the hardware counter.

MFC after:	3 days
2012-11-06 18:58:57 +00:00
Ed Schouten
6b946662d9 Prefer __containerof() over __member2struct().
The former works better with qualifiers, but also properly type checks
the input pointer.
2012-10-19 13:26:40 +00:00
Navdeep Parhar
fb51680534 Always provide sndbuf and MSS values in a flowc command, even when the
driver is going to abort the connection right after the flowc.

MFC after:	3 days
2012-10-17 16:37:16 +00:00
Navdeep Parhar
726793aa8d Whitespace cleanup.
MFC after:	3 days
2012-10-17 05:08:35 +00:00
Navdeep Parhar
8039b7e51b Temporary fix for kern/172364.
PR:		kern/172364
MFC after:	3 days
2012-10-12 21:58:21 +00:00
Navdeep Parhar
86e02bf207 Use global knob in the TP_PARA_REG3 register to disable congestion
drops if the user has chosen this behaviour.

MFC after:	3 days
2012-10-12 21:48:21 +00:00
Navdeep Parhar
c2e35e3f37 Add a driver ioctl to clear a port's MAC statistics.
Submitted by:	gnn@
MFC after:	3 days
2012-10-10 19:27:40 +00:00
Navdeep Parhar
8d92e1db93 Add a driver ioctl to read a byte from any device on a port's i2c bus.
This lets userspace read arbitrary information from the SFP+ modules
etc. on this bus.

Reading multiple bytes in the same transaction isn't possible right now.
I'll update the driver once the chip's firmware supports this.

MFC after:	3 days
2012-10-10 17:13:46 +00:00
Navdeep Parhar
aa95b6533b There is no need to report the same error twice.
MFC after:	3 days
2012-10-10 16:54:14 +00:00
Navdeep Parhar
5323ca8f4b Remove unused item. cxgbe's rx queue's lock was removed a long time ago.
MFC after:	3 days
2012-10-10 16:52:39 +00:00
Kevin Lo
9823d52705 Revert previous commit...
Pointyhat to:	kevlo (myself)
2012-10-10 08:36:38 +00:00
Kevin Lo
a10cee30c9 Prefer NULL over 0 for pointers 2012-10-09 08:27:40 +00:00
Gavin Atkinson
e935190a33 Switch some PCI register reads from using magic numbers to using the names
defined in pcireg.h

MFC after:	1 week
2012-09-19 12:27:23 +00:00
Gavin Atkinson
389c8bd51e Align the PCI Express #defines with the style used for the PCI-X
#defines.  This also has the advantage that it makes the names more
compact, iand also allows us to correct the non-uniform naming of
the PCIM_LINK_* defines, making them all consistent amongst themselves.

This is a mostly mechanical rename:
  s/PCIR_EXPRESS_/PCIER_/g
  s/PCIM_EXP_/PCIEM_/g
  s/PCIM_LINK_/PCIEM_LINK_/g

When this is MFC'd, #defines will be added for the old names to assist
out-of-tree drivers.

Discussed with:	jhb
MFC after:	1 week
2012-09-18 22:04:59 +00:00
Navdeep Parhar
8a599c0859 Install interrupt handlers early, during attach, for the reason
explained in r239913 by jhb.

MFC after:	1 week
2012-09-13 09:18:13 +00:00
Navdeep Parhar
57c60f98b8 Use native FreeBSD facilities everywhere except the shared code in common/
MFC after:	1 week
2012-09-13 09:10:10 +00:00
Navdeep Parhar
8a7ba352b0 Update interface to firmware 1.6.2 and include the firmware in the driver.
Obtained from:	Chelsio
MFC after:	1 week
2012-09-13 06:32:52 +00:00
Navdeep Parhar
87a74dd6e3 Deal with the case where a syncache entry added by the TOE driver is
evicted from the syncache but a later syncache_expand succeeds because
of syncookies.  The TOE driver has to resort to more direct means to
install its hooks in the socket in this case.
2012-08-21 22:23:17 +00:00
Navdeep Parhar
f9796f4373 Avoid a NULL pointer dereference. 2012-08-21 19:45:19 +00:00
Navdeep Parhar
36fd646e38 Cannot hold a mutex around vm_fault_quick_hold_pages, so don't. Tweak
some comments while here.
2012-08-21 19:39:09 +00:00
Navdeep Parhar
c91bcaaab5 Minor cleanup: use bitwise ops instead of pointless wrappers around
setbit/clrbit.
2012-08-21 18:30:16 +00:00
Navdeep Parhar
06fd9875aa Correctly handle the case where an inp has already been dropped by the time
the TOE driver reports that an active open failed.  toe_connect_failed is
supposed to handle this but it should be provided the inpcb instead of the
tcpcb which may no longer be around.
2012-08-21 18:09:33 +00:00
Navdeep Parhar
e682d02e12 Support for TCP DDP (Direct Data Placement) in the T4 TOE module.
Basically, this is automatic rx zero copy when feasible.  TCP payload is
DMA'd directly into the userspace buffer described by the uio submitted
in soreceive by an application.

- Works with sockets that are being handled by the TCP offload engine
  of a T4 chip (you need t4_tom.ko module loaded after cxgbe, and an
  "ifconfig +toe" on the cxgbe interface).
- Does not require any modification to the application.
- Not enabled by default.  Use hw.t4nex.<X>.toe.ddp="1" to enable it.
2012-08-17 00:49:29 +00:00
Navdeep Parhar
5f7a640879 Initialize various DDP parameters in the main cxgbe(4) driver:
- Setup multiple DDP page sizes.  When the driver attempts DDP it will
  try to combine physically contiguous pages into regions of these sizes.

- Set the indicate size such that the payload carried in the indicate can
  be copied in the header mbuf (and the 16K rx buffer can be recycled).

- Set DDP threshold to the max payload that the chip will coalesce and
  deliver to the driver (this is ~16K by default, which is also why the
  offload rx queue is backed by 16K buffers).  If the chip is able to
  coalesce up to the max it's allowed to, it's a good sign that the peer
  is transmitting in bulk without any TCP PSH.

MFC after:	2 weeks
2012-08-16 22:33:56 +00:00
Navdeep Parhar
efc9fddc3d Make room for DDP page pods in the default configuration profile. While
here, bump up the L2 table's size to 4K entries.

MFC after:	2 weeks
2012-08-16 20:30:14 +00:00
Navdeep Parhar
1f1b5a0f6f Add a routine (t4_set_tcb_field) to update arbitrary parts of a hardware
TCB.  Filters are programmed by modifying the TCB too (via a different
routine) and the reply to any TCB update is delivered via a
CPL_SET_TCB_RPL.  Figure out whether the reply is for a filter-write or
something else and route it appropriately.

MFC after:	2 weeks
2012-08-16 20:15:29 +00:00
Navdeep Parhar
1b4cc91fcc Allow for a different handler for each type of firmware message.
MFC after:	2 weeks
2012-08-16 18:31:50 +00:00
Navdeep Parhar
8340ece577 The size of the buffers in an Ethernet freelist has to be higher than the
interface's MTU.  Initialize such freelists with correct values.

This wasn't a problem for common MTUs (1500 and 9000) as the buffers (2048
and 9216 in size) happened to have enough spare room.  I ran into it when
playing around with unusual MTUs.

MFC after:	2 weeks
2012-08-15 01:03:13 +00:00
Navdeep Parhar
2951cbabf0 if_iqdrops should include frames truncated within the chip.
MFC after:	2 weeks
2012-08-14 22:15:12 +00:00
Navdeep Parhar
9fb8886b29 Convert some fixed parameters to tunables (with reasonable default
values).

- cong_drop specifies what to do on congestion: nothing, backpressure,
  or drop.
- fl_pktshift specifies the padding before Ethernet payload.
- fl_pad specifies the boundary upto which to pad Ethernet payload.
- spg_len controls the length of the status page.

MFC after:	2 weeks
2012-08-14 21:47:41 +00:00
Dimitry Andric
daccbb811d In sys/dev/cxgbe/firmware/t4fw_interface.h, change the enum
'fw_hdr_intfver' into an anonymous enum, which avoids a clang 3.2
warning about all the enum values being the same value.

Reviewed by:	np
MFC after:	1 week
2012-08-06 18:54:17 +00:00
Navdeep Parhar
c8d954ab75 Fix a bug in code that calculates the number of the first interrupt
vector for a port.  This affected the gigabit ports of T422 cards (the
ones with 2x10G ports and 2x1G ports).

MFC after:	will check with re@
2012-07-09 21:53:50 +00:00
Navdeep Parhar
9a0b948f98 Fix inverted test that resulted in incorrect multicast hw programming. 2012-07-03 06:56:11 +00:00
Navdeep Parhar
9f1dae79da Instruct the firmware not to provision resources for TCP offload if the
kernel is being built without TCP_OFFLOAD.  But never override
toecaps_allowed if it has been set manually.
2012-07-02 20:42:43 +00:00
Navdeep Parhar
932b1a5f1d - Assign (don't OR) the CSUM_XXX bits to csum_flags in the rx checksum code.
- Fix TSO/TSO4 mixup.
- Add IFCAP_LINKSTATE to the available/enabled capabilities.
2012-06-30 02:05:09 +00:00
Navdeep Parhar
a1ea9a8276 cxgbe(4): support for IPv6 TSO and LRO.
Submitted by:	bz (this is a modified version of that patch)
2012-06-29 19:51:06 +00:00
Navdeep Parhar
9600bf00bb cxgbe(4): support for IPv6 hardware checksumming (rx and tx). 2012-06-29 16:50:52 +00:00
Navdeep Parhar
2cd9f0711d Allow cxgbe(4) running within a VM to attach to its devices that have been
exported via PCI passthrough.

- Do not check for a specific physical function (PF) before claiming a device.
  Different PFs have different device-ids so this check is redundant anyway.

- Obtain the PF# from the WHOAMI register instead of pci_get_function().

- Setup the memory windows using the real BAR0 address, not what the VM says it
  is.

Obtained from:	Chelsio Communications
2012-06-26 00:34:34 +00:00
Navdeep Parhar
4defc81b0e Better way to determine the status page length and rx pad boundary. 2012-06-23 22:12:27 +00:00
Navdeep Parhar
3c51d1544a Do not allocate extra vectors when adapter is not TOE
capable (or toecaps have been disallowed by the user).

+ one very minor unrelated cleanup in t4_sge.c
2012-06-22 22:59:42 +00:00
Navdeep Parhar
afce448c1a Do not read registers with read side effects while performing a register
dump for cxgbetool.
2012-06-22 08:37:33 +00:00
Navdeep Parhar
2a5f6b0e65 cxgbe(4): update to firmware interface 1.5.2.0; updates to shared code. 2012-06-22 07:51:15 +00:00
Navdeep Parhar
09fe63205c - 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)
2012-06-19 07:34:13 +00:00
Bjoern A. Zeeb
62b5b6ecd0 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
2012-05-24 23:03:23 +00:00
Navdeep Parhar
7a32954c40 Change the default to not use packet counters to generate rx interrupts.
Rely solely on the timer based mechanism.

Update man page to reflect this change.

MFC after:	1 week
2012-04-30 09:46:05 +00:00
Navdeep Parhar
e07f03e8fc Make sure that the firmware version is available in
dev.t4nex.X.firmware_version even if the driver fails to attach
properly.  At least it'll be easy to tell what we're dealing with.

MFC after:	1 week
2012-04-30 08:44:10 +00:00
Navdeep Parhar
d513f5b690 Use the non-sleeping variang of t4_wr_mbox in code that can be called
with locks held.

MFC after:	1 day
2012-02-13 18:41:32 +00:00
Navdeep Parhar
62795b70eb Program the MAC exact match table in batches of 7 addresses at
a time when possible.  This is more efficient than one at a time.

Submitted by:	gnn
MFC after:	3 days
2012-02-08 00:36:36 +00:00
Navdeep Parhar
17c60e7b50 Acquire the adapter lock before updating fields of the filter structure.
Submitted by:	gnn (different version)
MFC after:	3 days
2012-02-07 09:39:46 +00:00
Navdeep Parhar
65d43cc6e7 Remove if_start from cxgb and cxgbe.
Submitted by:	jhb
MFC after:	3 days
2012-02-07 07:32:39 +00:00
Navdeep Parhar
bfb08b6b6b cxgbe: reduce diffs with other branches.
Will help future MFCs from HEAD.

MFC after:	3 days
2012-02-07 06:21:59 +00:00
Navdeep Parhar
733b92779e Many updates to cxgbe(4)
- Device configuration via plain text config file.  Also able to operate
  when not attached to the chip as the master driver.

- Generic "work request" queue that serves as the base for both ctrl and
  ofld tx queues.

- Generic interrupt handler routine that can process any event on any
  kind of ingress queue (via a dispatch table).

- A couple of new driver ioctls.  cxgbetool can now install a firmware
  to the card ("loadfw" command) and can read the card's memory
  ("memdump" and "tcb" commands).

- Lots of assorted information within dev.t4nex.X.misc.*  This is
  primarily for debugging and won't show up in sysctl -a.

- Code to manage the L2 tables on the chip.

- Updates to cxgbe(4) man page to go with the tunables that have changed.

- Updates to the shared code in common/

- Updates to the driver-firmware interface (now at fw 1.4.16.0)

MFC after:	1 month
2011-12-16 02:09:51 +00:00
Navdeep Parhar
214c358257 Do not clobber the ingress queue's congestion setting.
MFC after:	1 month
2011-12-14 05:34:23 +00:00
Matthew D Fleming
103af58f59 Do not define bool/true/false if the symbols already exist.
MFC after:	2 weeks
Sponsored by:	Isilon Systems, LLC
2011-12-12 18:43:24 +00:00
Marius Strobl
4b7ec27007 - There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
  (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
  since r52045) but even recently added device drivers do this unnecessarily.
  Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
  Discussed with: jhb
- Also while at it, use __FBSDID.
2011-11-22 21:28:20 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Navdeep Parhar
59bc8ce035 - driver ioctl to get SGE context for any given queue.
- sysctls to display the context id, cidx, and pidx of all kinds of queues.

MFC after:	3 days
2011-06-11 04:50:54 +00:00
Navdeep Parhar
9104663338 Cause backpressure (instead of dropping frames) on congestion.
MFC after:	3 days
2011-06-04 23:36:19 +00:00
Navdeep Parhar
9b4d7b4e67 Allow lazy fill up of freelists.
MFC after:	3 days
2011-06-04 23:31:33 +00:00
Navdeep Parhar
272cba15b8 Provide hit-count with rest of the information about a filter.
MFC after:	1 week
2011-06-01 01:32:58 +00:00
Navdeep Parhar
136e410ceb Firmware device log.
# sysctl dev.t4nex.0.devlog

MFC after:	mdf's sysctl+sbuf changes are MFC'd
2011-05-31 23:49:13 +00:00
Navdeep Parhar
b400f1ea97 Update to firmware interface 1.3.10
MFC after:	1 week
2011-05-30 21:56:37 +00:00
Navdeep Parhar
56599263c5 - Specialized ingress queues that take interrupts for other ingress
queues.  Try to have a set of these per port when possible, fall back
  to sharing a common pool between all ports otherwise.

- One control queue per port (used to be one per hardware channel).

- t4_eth_rx now handles Ethernet rx only.

- sysctls to display pidx/cidx for some queues.

MFC after:	1 week
2011-05-30 21:34:44 +00:00
Navdeep Parhar
4dba21f17e L2 table code. This is enough to get the T4's switch + L2 rewrite
filters working.  (All other filters - switch without L2 info rewrite,
steer, and drop - were already fully-functional).

Some contrived examples of "switch" filters with L2 rewriting:

# cxgbetool t4nex0  iport 0  dport 80  action switch  vlan +9  eport 3
Intercept all packets received on physical port 0 with TCP port 80 as
destination, insert a vlan tag with VID 9, and send them out of port 3.

# cxgbetool t4nex0  sip 192.168.1.1/32  ivlan 5  action switch \
	vlan =9  smac aa:bb:cc:dd:ee:ff  eport 0
Intercept all packets (received on any port) with source IP address
192.168.1.1 and VLAN id 5, rewrite the VLAN id to 9, rewrite source mac
to aa:bb:cc:dd:ee:ff, and send it out of port 0.

MFC after:	1 week
2011-05-30 21:07:26 +00:00
Navdeep Parhar
b0775aef77 Simplify t4_os_find_pci_capability.
MFC after:	3 days
2011-05-19 19:37:41 +00:00
Navdeep Parhar
bc14b14d62 - Enable per-channel congestion notification.
- Enable PCIe relaxed ordering for all egress queues and rx data buffers.

MFC after:	3 days
2011-05-18 22:09:04 +00:00
Navdeep Parhar
c43431465e Add missing header. The test for VLAN_CAPABILITIES later in the file
doesn't make sense without it.

MFC after:	3 days
2011-05-17 00:40:11 +00:00
Navdeep Parhar
af49c94220 sysctl that displays the absolute queue id of an rxq. 2011-05-14 19:27:15 +00:00
Navdeep Parhar
3792a4d286 Bump up the number of egress queues that the driver is allowed to use.
MFC after:	3 days
2011-05-05 23:09:17 +00:00
Navdeep Parhar
489eeba940 T4 packet timestamps.
Reference code that shows how to get a packet's timestamp out of
cxgbe(4).  Disabled by default because we don't have a standard way
today to pass this information up the stack.

The timestamp is 60 bits wide and each increment represents 1 tick of
the T4's core clock.  As an example, the timestamp granularity is ~4.4ns
for this card:

# sysctl dev.t4nex.0.core_clock
dev.t4nex.0.core_clock: 228125

MFC after:	1 week
2011-05-05 02:38:08 +00:00
Navdeep Parhar
8820ce5fe7 T4 packet filtering/steering.
- Enable 5-tuple and every-packet lookup.

- Setup the default filter mode to allow filtering/steering based on IP
  protocol, ingress port, inner VLAN ID, IP frag, FCoE, and MPS match
  type; all combined together.  You can also filter based on MAC index,
  Ethernet type, IP TOS/IPv6 Traffic Class, and outer VLAN ID but you'll
  have to modify the default filter mode and exclude some of the
  match-fields in it.

  IPv4 and IPv6 SIP/DIP/SPORT/DPORT are always available in all filter
  rules.

- Add driver ioctls to get/set the global filter mode.

- Add driver ioctls to program and delete hardware filters.  A couple of
  the "switch" actions that rewrite Ethernet and VLAN information and
  switch the packet out of another port may not work as the L2 code is not
  yet in place.  Everything else, including all "drop" and "pass" rules
  with RSS or absolute qid, should work.

Obtained from:	 Chelsio Communications
2011-05-05 02:04:56 +00:00
Navdeep Parhar
b815af1b74 Always re-arm an iq's interrupt before leaving the handler.
MFC after:	1 week
2011-05-04 23:07:30 +00:00
Navdeep Parhar
fb12416c9f Ring the freelist doorbell from within refill_fl. While here, fix a bug
that could have allowed the hardware pidx to reach the cidx even though
the freelist isn't empty.  (Haven't actually seen this but it was there
waiting to happen..)

MFC after:	1 week
2011-04-20 23:20:00 +00:00
Navdeep Parhar
b5a6d97e1e Use the correct free routine when destroying a control queue.
X-MFC after:	r220873
2011-04-20 18:04:34 +00:00
Navdeep Parhar
657d9381b1 Use Toeplitz hash for RSS.
MFC after:	3 days
2011-04-19 22:14:18 +00:00
Navdeep Parhar
f7dfe243b4 - Move all Ethernet specific items from sge_eq to sge_txq. sge_eq is
now a suitable base for all kinds of egress queues.

- Add control queues (sge_ctrlq) and allocate one of these per hardware
  channel.  They can be used to program filters and steer traffic (and
  more).

MFC after:	1 week
2011-04-19 22:08:28 +00:00
Navdeep Parhar
2be67d2948 Fix a couple of bad races that can occur when a cxgbe interface is taken
down.  The ingress queue lock was unused and has been removed as part of
these changes.

- An in-flight egress update from the SGE must be handled before the
  queue that requested it is destroyed.  Wait for the update to arrive.

- Interrupt handlers must stop processing rx events for a queue before
  the queue is destroyed.  Events that have not yet been processed
  should be ignored once the queue disappears.

MFC after:	1 week
2011-04-15 03:09:27 +00:00
Navdeep Parhar
6b49a4ece8 There is no need to request a tx credit flush if such a request is already
pending.

MFC after:	3 days
2011-04-14 20:06:23 +00:00
Navdeep Parhar
bd0d62016a Modify read/write ioctls to work with 64 bit registers too.
MFC after:	3 days
2011-04-07 07:10:42 +00:00
Navdeep Parhar
37ba135472 Update header and related code for firmware 1.3.8
MFC after:	3 days
2011-04-01 00:40:24 +00:00
Navdeep Parhar
a91fea93ad Do not over-allocate MSI interrupts for the case where each ingress
queue has its own interrupt.  If the exact number that we need is not a
power of 2 and we're using MSI, then switch to interrupt multiplexing.

While here, replace the magic numbers with something more readable.

MFC after:	3 days
2011-03-24 01:03:01 +00:00
Navdeep Parhar
9f1f7ec9a8 Fix an error while constructing the table that maps context id -> egress
queue.

MFC after:	1 day
2011-03-22 21:05:56 +00:00
Navdeep Parhar
d986a01abf Display holdoff timers and packet counts as a list of numbers.
MFC after:	1 week
2011-03-09 21:07:09 +00:00
Navdeep Parhar
9458619309 cxgbe shouldn't directly know of the UMA zones where network buffers
come from.

MFC after:	1 week
2011-03-08 03:04:07 +00:00
Navdeep Parhar
99bb3c5399 Be sure to stay within the bounds of the mod_str array when displaying
the transceiver type.
2011-03-05 04:19:38 +00:00
Navdeep Parhar
83d58badea There is no need to hold an ingress queue's lock while processing its
descriptors.

MFC after:	1 week
2011-03-05 04:04:23 +00:00
Navdeep Parhar
e874ff7a8b Calculate how many descriptors can be reclaimed before calling
reclaim_tx_descs
2011-03-05 03:54:37 +00:00
Navdeep Parhar
7d29df5931 Tweaks for rx:
- everything related to LRO should be in #ifdef INET blocks
- reorder sge_iq's fields so that the most frequently used are all together
- pull all rx code into t4_intr_data directly
- let go of the ingress queue lock when passing up data
- refill the freelist only if it is short of at least 32 buffers
2011-03-05 03:42:03 +00:00
Navdeep Parhar
29ca78e104 Store the ifnet rather than the port_info in each txq and rxq struct.
MFC after:	1 week
2011-03-05 03:27:14 +00:00
Navdeep Parhar
aa2457e17c A txpkts work request should have a valid FID.
MFC after:	1 week
2011-03-05 03:18:56 +00:00
Navdeep Parhar
56c2cdaf9b Upgrade the firmware on the card automatically if a better version is
available.  Downgrade only for a major version mismatch.

MFC after:	1 week
2011-03-05 03:12:50 +00:00
Navdeep Parhar
ecb79ca4f6 Resume tx immediately in response to an SGE egress update from the hardware.
MFC after:	1 week
2011-03-05 03:06:38 +00:00
Navdeep Parhar
4a1bd0e4e8 Fix incorrect assertion.
MFC after:	3 days
2011-03-05 03:01:14 +00:00
Navdeep Parhar
54e4ee7163 cxgbe(4) - NIC driver for Chelsio T4 (Terminator 4) based 10Gb/1Gb adapters.
MFC after:	3 weeks
2011-02-18 08:00:26 +00:00