Commit Graph

119 Commits

Author SHA1 Message Date
Matthew D Fleming
deceab8792 sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.
Commit the cxgb driver piece.
2011-01-12 19:53:44 +00:00
Navdeep Parhar
61cb6c9076 wakeup is required if the adapter lock is released anywhere during
init and not just for the may_sleep case.

Pointed out by:	Isilon
MFC after:	3 days
2010-08-15 20:34:51 +00:00
John Baldwin
b739a509f2 - Change the warning about PCI-e links narrower than x8 to only apply to
10G cards.  1G cards are x4 only.
- Use constants from pcireg.h for reading the current link width.
- Use pci_set_max_read_req() rather than implementing it by hand.

Reviewed by:	np
MFC after:	1 week
2010-07-26 17:31:15 +00:00
Navdeep Parhar
bd1a9fbad6 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
2010-07-09 00:38:00 +00:00
Navdeep Parhar
2c32b50248 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
2010-07-09 00:36:35 +00:00
Navdeep Parhar
29c54b85f9 Fix bufsize calculation so that cxgbtool can display information for the
last I/O queue too.

MFC after:	3 days
2010-07-09 00:35:09 +00:00
Navdeep Parhar
06eace6376 make format string a string literal.
Reported by:	clang
2010-06-12 22:24:39 +00:00
Navdeep Parhar
3a2c6562f3 cxgb(4): add an 'nfilters' tunable that lets the user place an upper
limit on the number of hardware filters (and thus the amount of TCAM
reserved for filtering).
2010-06-07 08:23:16 +00:00
Navdeep Parhar
cb958aba98 Remove invalid assertion.
Holding the adapter lock while changing the LRO settings is sufficient.

PR:		kern/146759
MFC after:	3 days
2010-05-20 18:22:45 +00:00
Navdeep Parhar
b85998cb48 Do not hold the T3 firmware in memory all the time. firmware(9) can
load/unload it as needed.
2010-05-05 22:29:54 +00:00
Navdeep Parhar
d6da836201 Add support for hardware filters to cxgb(4). The T3 chip can inspect
L2/3/4 headers and can drop or steer packets as instructed.  Filtering
based on src ip, dst ip, src port, dst port, 802.1q, udp/tcp, and mac
addr is possible.  Add support in cxgbtool to program these filters.
Some simple examples:

Drop all tcp/80 traffic coming from the subnet specified.
# cxgbtool cxgb2 filter 0 sip 192.168.1.0/24 dport 80 type tcp action drop

Steer all incoming UDP traffic to qset 0.
# cxgbtool cxgb2 filter 1 type udp queue 0 action pass

Steer all tcp traffic from 192.168.1.1 to qset 1.
# cxgbtool cxgb2 filter 2 sip 192.168.1.1 type tcp queue 1 action pass

Drop fragments.
# cxgbtool cxgb2 filter 3 type frag action drop

List all filters.
# cxgbtool cxgb2 filter list
index         SIP                DIP     sport dport VLAN PRI P/MAC type Q
    0     192.168.1.0/24         0.0.0.0     *    80    0 0/1 */*    tcp -
    1         0.0.0.0/0          0.0.0.0     *     *    0 0/1 */*    udp 0
    2     192.168.1.1/32         0.0.0.0     *     *    0 0/1 */*    tcp 1
    3         0.0.0.0/0          0.0.0.0     *     *    0 0/1 */*   frag -
16367         0.0.0.0/0          0.0.0.0     *     *    0 0/1 */*      * *

MFC after:	2 weeks
2010-05-05 00:41:40 +00:00
Navdeep Parhar
2caefebb07 Add IFCAP_LINKSTATE to cxgb's capabilities.
MFC after:	3 days
2010-05-04 23:55:08 +00:00
Maxim Sobolev
e50d35e6c6 Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after:	1 month
2010-05-03 07:32:50 +00:00
Navdeep Parhar
489ca05be7 Increase response queue size to avoid starvation, add a counter
to track it when it does occur.
2010-04-02 17:50:52 +00:00
Navdeep Parhar
97ae3bc359 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
2010-03-31 00:27:49 +00:00
Navdeep Parhar
92f61ecb4b Fix tx drop statistics.
MFC after:	3 days
2010-03-31 00:26:02 +00:00
Navdeep Parhar
1d609d51f0 Do not attempt to retrieve interrupt information before it is available.
MFC after:	3 days
2010-03-31 00:22:58 +00:00
Navdeep Parhar
a9da6d239c Refresh the firmware version immediately after it is upgraded (or downgraded).
MFC after:	3 days
2010-03-31 00:19:39 +00:00
Navdeep Parhar
cd5c70b2ba Better TwinAx transceiver detection.
Originally submitted by: <Bruno dot Bittner at isilon dot com>
(This is a rewritten, corrected version of that patch)

MFC after:    1 week
2010-03-09 19:57:44 +00:00
Navdeep Parhar
f9c6e16451 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.
2010-02-26 07:08:44 +00:00
Navdeep Parhar
e83ec3e5c3 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
2010-02-24 10:16:18 +00:00
Navdeep Parhar
3c0e59de3e Don't forget to release the adapter lock for a no-op. 2010-01-23 01:44:30 +00:00
Navdeep Parhar
b302b77ca7 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.
2010-01-20 03:40:43 +00:00
Navdeep Parhar
a9c23ef044 Don't disable the XGMAC's tx on ifconfig down. It is unnecessary
and can cause false backpressure in the chip.  Fix a us/ms mixup
while here.
2009-11-13 00:37:29 +00:00
Navdeep Parhar
7ead19d4a8 sc->rev and is_offload(sc) will always be 0 during probe. Wait till
attach to get correct values.
2009-11-13 00:28:16 +00:00
John Baldwin
e1b17582f4 Take a step towards removing if_watchdog/if_timer. Don't explicitly set
if_watchdog/if_timer to NULL/0 when initializing an ifnet.  if_alloc()
sets those members to NULL/0 already.
2009-11-06 14:55:01 +00:00
Navdeep Parhar
c01f2b8301 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
2009-10-05 20:21:41 +00:00
John Baldwin
6b2eaa836f Fill the reverse RSS map with 0xff's so that the subsequent loop to
calculate the values will work properly.

Reviewed by:	np
MFC after:	1 month
2009-09-04 21:00:45 +00:00
Navdeep Parhar
2975f78738 Various ifmedia related fixes in cxgb(4), including:
- build ifmedia list based on phy->caps, not string comparisons.
- rebuild media list when a transceiver change is detected.
- return EOPNOTSUPP instead of ENXIO in cxgb_media_status.

Approved by:	gnn (mentor)
MFC after:	2 weeks.
2009-06-24 21:56:05 +00:00
Navdeep Parhar
16daf36814 Fix cxgb's ifmedia ioctl handling. Also fixed a comment.
Reviewed by:	kmacy
Approved by:	gnn (mentor)
2009-06-22 21:42:57 +00:00
Kip Macy
3f345a5d09 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
2009-06-19 23:34:32 +00:00
George V. Neville-Neil
02c7d9a64f Re-add the send queue tunable for people who do not use buffering.
Reviewed by:	jhb
MFC after:	3 days
2009-06-11 21:32:26 +00:00
George V. Neville-Neil
e3503bc98d Rework interrupt bringup and teardown.
Calculate the exact number of vectors we'll use before calling
pci_alloc_msix.  Don't grab nine all the time.

Call cxgb_setup_interrupts once per T3, not once per port.  Ditto
for cxgb_teardown_interrupts.

Don't leak resources when interrupt setup fails in the middle.

Obtained from:	Navdeep Parhar
MFC after:	10 days
2009-05-27 20:13:36 +00:00
George V. Neville-Neil
7529967798 Partial reversion of previous commit. The CXGB_SHUTDOWN flag does NOT
need to be inverted when doing an ifconfig down of an interface.

Pointed out by:	Navdeep Parhar
MFC after: 1 week
2009-05-22 18:26:47 +00:00
George V. Neville-Neil
c2009a4c90 Fix a possible panic cxgb_controller_attach() routine that would occur
only if prepping the adapter failed.

Slight adjustment to comments.

Fix a bug whereby downing the interface didn't preven it from
processing packets.

Submitted by:	Navdeep Parhar
MFC after:	1 week
2009-05-22 15:06:03 +00:00
George V. Neville-Neil
0bbdea7776 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
2009-05-21 15:08:03 +00:00
George V. Neville-Neil
3cf138bb79 Modified the attach and detach routines to handle bringing ports up
and down more cleanly.  This addresses a problem where if we have the
link flap during boot the driver would lock up the system.

Reviewed by:	jhb
MFC after:	1 week
2009-05-21 14:43:12 +00:00
Warner Losh
00b4e54ae7 We no longer need to use d_thread_t, migrate to struct thread *. 2009-05-20 17:29:21 +00:00
George V. Neville-Neil
0c1ff9c605 Minor updates to the Chelsio driver, including removing an LOR.
Submitted by:	Navdeep Parhar at Chelsio
Reviewed by:	gnn
MFC after: 	3 weeks
2009-03-23 19:58:26 +00:00
George V. Neville-Neil
6b6e256ae1 Fix a bug in the recent update to the Chelsio driver.
The tick routine was not being restarted in the init_locked routine
which could resulted in loss of carrier when updating the MTU.

Submitted by:	Navdeep Parhar at Chelsio
MFC after:	3 weeks
2009-03-21 17:09:00 +00:00
George V. Neville-Neil
f2d8ff04fe 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
2009-03-10 19:22:45 +00:00
George V. Neville-Neil
837f41b067 Check in the actual module recognition code for the Chelsio
driver.

Obtained from:	Chelsio Inc.
2008-12-18 14:21:35 +00:00
George V. Neville-Neil
7f15419bb7 Bug fix to support N310 version of Chelsio cards (board ID 1088).
Obtained from:	Chelsio Inc.
MFC after:	3 days
2008-12-06 02:10:53 +00:00
George V. Neville-Neil
5197f3abd7 Re submit code to print the part and serial number for Chelsio cards.
The original code was accidentally removed in another commit.

MFC after: 1 day
2008-12-05 21:40:11 +00:00
Kip Macy
f35c2d6551 Update internal mac stats every time the tick task is called
if we don't do this "netstat -w 1" will frequently see negative
differences in packets sent
2008-12-01 05:43:30 +00:00
Kip Macy
ceac50eb77 Proper fix for tracking ifnet statistics 2008-12-01 04:41:45 +00:00
Kip Macy
5eba27fe0c Add backward compatibility ifdefs for non-multiq kernels 2008-11-23 07:30:07 +00:00
Kip Macy
098fb9b469 intr_machdep.h breaks build on some arches and is not needed 2008-11-23 00:13:25 +00:00
Kip Macy
a02573bc06 - 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
2008-11-22 08:05:05 +00:00
George V. Neville-Neil
2a1b9f07fc Several small additions to the Chelsio 10G driver.
1) Fix a bug in dealing with the Alerus 1006 PHY which prevented the
device from ever coming back up once it had been set to down.

2) Add a kernel tunable (hw.cxgb.snd_queue_len) which makes it possible
to give the device more than IFQ_MAXLEN entries in its send queue.  The
default remains 50.

3) Add code to place the card'd identification and serial number into
its description (%desc) so that users can tell which card they have
installed.
2008-11-21 19:22:25 +00:00