Commit Graph

24260 Commits

Author SHA1 Message Date
John Baldwin
4bb96a7418 Add locking to the aic(4) driver and mark it MPSAFE.
- Move 'free_scbs' into the softc rather than having it be a global list
  and convert it to an SLIST instead of a hand-rolled linked-list.
- Use device_printf() and device_get_unit() instead of storing the unit
  number in the softc.
- Remove use of explicit bus space handles and tags.
- Don't call device_set_desc() in the pccard attach routine, instead
  set a default description during the pccard probe if the matching
  product doesn't have a name.

Tested by:	no one
2012-10-15 16:09:59 +00:00
John Baldwin
e40cc6afc4 Add locking to the ahb(4) driver and mark it MPSAFE.
- Use device_printf() and device_get_unit() instead of storing the unit
  number in the softc.
- Remove use of explicit bus space handles and tags.
- Compare pointers against NULL.
- Let new-bus allocate a softc rather than doing it by hand.

Tested by:	no one
2012-10-15 16:05:02 +00:00
John Baldwin
0e87317a92 Add locking to the aha(4) driver and mark it MPSAFE.
- Remove use of explicit bus space handles and tags.

Tested by:	no one
2012-10-15 15:59:13 +00:00
John Baldwin
a25d65b064 Add locking to the adw(4) driver and mark it MPSAFE.
- Use device_printf() and device_get_nameunit() instead of adw_name().
- Remove use of explicit bus space handles and tags.
- Use pci_enable_busmaster() rather than frobbing the PCI command register
  directly.
- Use the softc provided by new-bus rather than allocating a new one.

Tested by:	no one
2012-10-15 15:26:00 +00:00
Aleksandr Rybalko
26aff2abad Mask data to only 16 bits to be sure on write into switch reg.
Submitted by:	Luiz Otavio O Souza
Approved by:	adrian (mentor)
2012-10-15 12:28:14 +00:00
Aleksandr Rybalko
454d507ad8 Locking for etherswitch framework:
* add lock/unlock methods;
* add lock/unlock default implementation;
* surround switch IOCTLs with locking;
* add lock/unlock implementation for arswitch;

Submitted by:	Luiz Otavio O Souza
Approved by:	adrian (mentor)
2012-10-15 12:20:40 +00:00
Aleksandr Rybalko
daa4deac71 Defaulting to id "0" if ar7240_probe(dev) success, fix warning when building
with DEBUG.

Submitted by:	Luiz Otavio O Souza
Approved by:	adrian (mentor)
2012-10-15 12:03:11 +00:00
Adrian Chadd
cf0c92d600 Track the total number of software queued frames in an atomic variable
stashed away in ath_node.

As much as I tried to stuff that behind the ATH_NODE lock, unfortunately
the locking is just too plain hairy (for me! And I wrote it!) to do
cleanly. Hence using atomics here instead of a lock. The ATH_NODE lock
just isn't currently used anywhere besides the rate control updates.

If in the future everything gets migrated back to using a single ATH_NODE
lock or a single global ATH_TX lock (ie, a single TX lock for all TX and
TX completion) then fine, I'll remove the atomics.
2012-10-15 00:07:18 +00:00
Adrian Chadd
13aa9ee5c2 Stop abusing the ATH_TID_*() queue macros for filtered frames and give
them their own macro set.
2012-10-14 23:52:30 +00:00
Adrian Chadd
8e7393944d Push the actual TX processing into the ath taskqueue, rather than having
it run out of multiple concurrent contexts.

Right now the ath(4) TX processing is a bit hairy. Specifically:

* It was running out of ath_start(), which could occur from multiple
  concurrent sending processes (as if_start() can be started from multiple
  sending threads nowdays.. sigh)

* during RX if fast frames are enabled (so not really at the moment, not
  until I fix this particular feature again..)

* during ath_reset() - so anything which calls that

* during ath_tx_proc*() in the ath taskqueue - ie, TX is attempted again
  after TX completion, as there's now hopefully some ath_bufs available.

* Then, the ic_raw_xmit() method can queue raw frames for transmission
  at any time, from any net80211 TX context. Ew.

This has caused packet ordering issues in the past - specifically,
there's absolutely no guarantee that preemption won't occuring _during_
ath_start() by the TX completion processing, which will call ath_start()
again. It's a mess - 802.11 really, really wants things to be in
sequence or things go all kinds of loopy.

So:

* create a new task struct for TX'ing;
* make the if_start method simply queue the task on the ath taskqueue;
* make ath_start() just be called by the new TX task;
* make ath_tx_kick() just schedule the ath TX task, rather than directly
  calling ath_start().

Now yes, this means that I've taken a step backwards in terms of
concurrency - TX -and- RX now occur in the same single-task taskqueue.
But there's nothing stopping me from separating out the TX / TX completion
code into a separate taskqueue which runs in parallel with the RX path,
if that ends up being appropriate for some platforms.

This fixes the CCMP/seqno concurrency issues that creep up when you
transmit large amounts of uni-directional UDP traffic (>200MBit) on a
FreeBSD STA -> AP, as now there's only one TX context no matter what's
going on (TX completion->retry/software queue,
userland->net80211->ath_start(), TX completion -> ath_start());
but it won't fix any concurrency issues between raw transmitted frames
and non-raw transmitted frames (eg EAPOL frames on TID 16 and any other
TID 16 multicast traffic that gets put on the CABQ.)  That is going to
require a bunch more re-architecture before it's feasible to fix.

In any case, this is a big step towards making the majority of the TX
path locking irrelevant, as now almost all TX activity occurs in the
taskqueue.

Phew.
2012-10-14 20:44:08 +00:00
Adrian Chadd
516f67965a Break the RX processing up into smaller chunks of 128 frames each.
Right now processing a full 512 frame queue takes quite a while (measured
on the order of milliseconds.) Because of this, the TX processing ends up
sometimes preempting the taskqueue:

* userland sends a frame
* it goes in through net80211 and out to ath_start()
* ath_start() will end up either direct dispatching or software queuing a
  frame.

If TX had to wait for RX to finish, it would add quite a few ms of
additional latency to the packet transmission.  This in the past has
caused issues with TCP throughput.

Now, as part of my attempt to bring sanity to the TX/RX paths, the first
step is to make the RX processing happen in smaller 'parts'. That way
when TX is pushed into the ath taskqueue, there won't be so much latency
in the way of things.

The bigger scale change (which will come much later) is to actually
process the frames in the ath_intr taskqueue but process _frames_ in
the ath driver taskqueue.  That would reduce the latency between
processing and requeuing new descriptors. But that'll come later.

The actual work:

* Add ATH_RX_MAX at 128 (static for now);
* break out of the processing loop if npkts reaches ATH_RX_MAX;
* if we processed ATH_RX_MAX or more frames during the processing loop,
  immediately reschedule another RX taskqueue run.  This will handle
  the further frames in the taskqueue.

This should have very minimal impact on the general throughput case,
unless the scheduler is being very very strange or the ath taskqueue
ends up spending a lot of time on non-RX operations (such as TX
completion.)
2012-10-14 20:31:38 +00:00
Nick Hibma
da016e84de Implement modem control in u3g. Tested on Option GTM382W, Huawei E220,
and Sierra Wireless MC8790V. Also implement the .ucom_poll method.

Note: This makes it possible to use lqr/echo in ppp.conf. And it
resolves ppp hanging during the PPp> phase.

Reviewed by:	hps
MFC after:	1 week
2012-10-14 19:15:54 +00:00
Eitan Adler
d6025c7bb7 Add support for the extrememory Snippy
PR:		usb/159611
Submitted by:	Fabian Keil <fk@fabiankeil.de>
Approved by:	cperciva (implicit)
MFC after:	3 days
2012-10-14 17:26:45 +00:00
Eitan Adler
c0f4985dbd Add support for Feiya Elango USB MicroSD
PR:		usb/153599
Submitted by:	CyberLeo <cyberleo@cyberleo.net>
Approved by:	cperciva (implicit)
MFC after:	3 days
2012-10-14 17:26:40 +00:00
Eitan Adler
35ed5bb738 Add support for the Buffalo RUF2 flash drive.
PR:		usb/166848
Submitted by:	Andrew Gregory <andrew@scss.com.au>
Reviewed by:	hselasky
Approved by:	cperciva (implicit)
MFC after:	3 days
2012-10-14 17:26:32 +00:00
Andriy Gapon
9548b507cb acpi_thermal: when _ACx is tripped, all _ALi i>= x should be on
... and not just _ALx as it is now.

MFC after:	20 days
2012-10-14 09:32:38 +00:00
Andriy Gapon
178f3ce611 acpi_wmi: move wmi_info_list into sc
different instances of acpi_wmi couldn't properly share it and, in fact,
there was no reason to do that

MFC after:	10 days
2012-10-14 09:31:11 +00:00
Adrian Chadd
b1dddc280f Fix the non-TDMA build. 2012-10-13 06:27:34 +00:00
Alexander Motin
64d8b0b472 Fix build with PAE enabled. I doubt any code uses CAM_SCATTER_VALID or
CAM_DATA_PHYS, or they ever correctly worked, but make this build at least.
2012-10-12 22:06:06 +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
John Baldwin
ae09eb7337 Add locking to adv(4) driver and mark it MPSAFE.
- Disable the support for the second channel on twin-channel EISA cards as
  the current incarnation can't possibly work correctly (it hasn't worked
  since switching to new-bus where new-bus allocates the softc).  If anyone
  bothers to test this again it can be fixed properly and brought back.
- Use device_printf() and device_get_nameunit() instead of adv_name().
- Remove use of explicit bus space handles and tags.
- Use PCI bus accessors and helper routines rather than accessing
  config registers directly.
- Handle failures from adv_attach().

Tested by:	no one (hope it works)
2012-10-12 21:31:44 +00:00
Peter Grehan
2f001371c3 Virtio SCSI driver
Submitted by:	Bryan Venteicher  bryanv at daemoninthecloset dot org
Reviewed by:	grehan
2012-10-11 23:41:18 +00:00
Peter Grehan
1dbd8bc927 Patch from Bryan to fix a virtqueue issue:
virtqueue: Fix non-indirect virtqueues

    We really must walk the entire descriptor chain in order
    to append the to be free'd chain to the existing free
    chain.

Submitted by:	Bryan Venteicher (bryanv@daemoninthecloset.org)
Reported by:	cognet
2012-10-11 23:03:42 +00:00
Aleksandr Rybalko
3d09489774 Fix tiypo.
Submitted by:	Luiz Otavio O Souza
Approved by:	adrian (mentor)
2012-10-11 21:19:42 +00:00
Pyun YongHyeon
548c8f1ac2 Add APE firmware support and improve firmware handshake procedure.
This change will enable IPMI access on 5717/5718/5719/5720 and 5761
controllers. Because ASF is not available when APE firmware is
present, bge_allow_asf tunable is ignored when driver detects APE
firmware.  Also bge(4) no longer performs two resets(one blind
reset and the other reset with firmware in mind) in device attach.
Now bge(4) performs a reset with enough information in bge_reset().
The APE firmware also needs special handling to make suspend/resume
work but it was not implemented yet.

With this change, bge(4) should work on any 5717/5718/5719/5720
controllers. Special thanks to Mike Hibler at Emulab who setup
remote debugging on Dell R820. Without his help I couldn't be able
to address several issues happened on Dell Rx20 systems. And many
thanks to Broadcom for continuing to support FreeBSD!

Submitted by:	davidch (initial version)
H/W donated by:	Broadcom
Tested by:	many
Tested on:	Del R820/R720/R620/R420/R320 and HP Proliant DL 360 G8
2012-10-11 06:43:43 +00:00
Pyun YongHyeon
e2245168c5 For 5717C/5719C/5720C and 57765 PHYs, do not perform any special
handling(jumbo, wire speed etc) in brgphy_reset().  Touching
BRGPHY_MII_AUXCTL register seems to confuse APE firmware such that
it couldn't establish a link.
2012-10-11 06:07:48 +00:00
Pyun YongHyeon
cc085b3609 Rework controller reset procedure. Previously driver saved
BGE_PCI_PCISTATE register before issuing global reset. After
issuing reset, it reads BGE_PCI_PCISTATE register again and
compares the saved register value and current value. It was used to
know whether the global reset operation was completed or not.
Unfortunately, this logic caused several issues on recent BCM5717/
5718/5719 and BCM5720 controllers. It seems APE firmware accesses
some registers while global reset is in progress such that reading
BGE_PCI_PCISTATE register after reset does not yield old pre-reset
state value. This resulted in consuming too much time in global
reset and sometimes it couldn't successfully complete reset.

The BGE_MISCCFG_RESET_CORE_CLOCKS of BGE_MISC_CFG register is
self-clearing bit so driver is able to know the reset completion.
But the core-lock reset will disable indirect/flat/standard access
modes such that driver cannot poll BGE_MISCCFG_RESET_CORE_CLOCKS
bit of BGE_MISC_CFG register. So just wait enough time for
core-clock reset to complete.
Data sheet says driver should wait 100us for PCI/PCI-X devices and
100ms for PCIe devices. I chose 1ms for PCI/PCI-X since this value
was used for many years in bge(4). For PCIe devices, use 100ms as
recommended by data sheet.

bge_chipinit() also cleared BGE_MAC_MODE register which shall clear
firmware configured mode information. I think this will result in
losing ASF/IPMI link in device attachment. Let bge_reset() honor
firmware configured BGE_MAC_MODE register and don't announce driver
is UP in bge_reset(). Firmware should have control over driver until
it's fully initialized by driver.

While I'm here, enable workaround for PCI-X BCM5704 A0 in
bge_reset(). This will prevent internal arbitration logic from
switching to the other DMA engine after a retry cycle.
2012-10-11 05:48:04 +00:00
Jim Harris
6568ebfcbb Count number of times each queue pair's interrupt handler is invoked.
Also add sysctls to query and reset each queue pair's stats, including
the new count added here.

Sponsored by:	Intel
2012-10-10 23:35:16 +00:00
Jim Harris
8bed48f25d Put the nvme_qpair mutex on its own cacheline.
Sponsored by:	Intel
2012-10-10 23:28:58 +00:00
Alexander Motin
72acfaabbf - Remove ancient checks for sim->softc == NULL. It can't be NULL, as it is
set not-NULL during SIM registration and set to UMASS_GONE on destruction.
Debug messages there look broken for at least 9 years, as they dereference
softc value that was just checked to be equal to NULL.
 - Remove magic pointer value UMASS_GONE and use simple NULL instead.

Found by:	Clang Static Analyzer
2012-10-10 22:02:11 +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
Jim Harris
500cbe13db Add support for locate LED.
While here, change ISCI_LED to ISCI_PHY since conceptually the hardware
ties the LEDs to a phy and the LEDs for a given phy cannot be controlled
independently.

Submitted by: Paul Maulberger <Paul.Maulberger at gmx.de> (with modifications)
2012-10-10 18:01:56 +00:00
Alexander Motin
f5d569f322 Add checks for ata_sata_scr_read() return statuses. It is mostly to silence
Clang Static Analyzer warnings as errors there are usually unlikely.
2012-10-10 17:51:23 +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
Pyun YongHyeon
87b8c39061 Remove unnecessary delay. I don't see any comments in data sheet
that requires 10ms delay after device reset.  Because that code was
there from day 1, I guess it was added to give enough settlement
time after updating BGE_MAC_MODE register.
The recommended delay time for BGE_MAC_MODE after updating is 40us
and it was already done in r241219.
2012-10-10 05:43:04 +00:00
Pyun YongHyeon
df4db53856 Fix a long standing VCPU reset sequence bug on BCM5906.
The VCPU(Virtual CPU) of BCM5906 is used to provide a mechanism to
control the bootcode execution and to pick up configuration data
stored inside the EEPROM.
The bootcode of BCM5906 will check the BGE_VCPU_STATUS_DRV_RESET
bit to decide which booting procedure to choose.
Data sheet indicates the VCPU of BCM5906 should set
BGE_VCPU_STATUS_DRV_RESET bit *before* VCPU reset or global reset.
2012-10-10 04:38:29 +00:00
Pyun YongHyeon
ad49eccff0 Do not force PCIe 1.0a mode in device reset on BCM5717 and newer
controllers. BCM5785 does not require PCI 1.0a mode as well during
reset.
2012-10-10 02:35:10 +00:00
Pyun YongHyeon
f846d3a23e Honor PHY type fiber for BCM5717/BCM5718/BCM5719/BCM5720. 2012-10-10 02:21:36 +00:00
Pyun YongHyeon
2246e8c6e8 On PHY write error use hex number to show the value.
Add more comments.
2012-10-10 01:59:53 +00:00
Pyun YongHyeon
48630d79c5 If the maximum payload size is 256 bytes or more, set the DMA write
water mark to 256 bytes.  Otherwise controller will encounter DMA
write under run errors and would result in RX DMA hang. If the
maximum payload size is 128 bytes, the water mark is set to 128
bytes as usual.
While here, set maximum read request size to 2048 for BCM5719/BCM5720.
For other PCIe devices, use 4096. And reprogram the maximum read
request size whenever device reset is performed.
2012-10-10 01:24:02 +00:00
Neel Natu
af0d1ee939 Grab the softc from the ACPI host-pci bridge device instead of from the pci
endpoint device.

Reviewed by:	jhb
2012-10-10 00:06:31 +00:00
Alexander Motin
675dce071a Cast vendor-specific spell on VIA VT1818S codecs alike to VT1708S to
make analog input loopback and dual-stream playback work by enabling
signal mixing by nid 22, as it should be according to info returned by
the CODEC.  Otherwise pin nid 28 receives only signal from DAC nid 16.

PR:		kern/169124
MFC after:	1 week
2012-10-09 17:06:31 +00:00
Kevin Lo
a10cee30c9 Prefer NULL over 0 for pointers 2012-10-09 08:27:40 +00:00
Kevin Lo
10d66948a8 Fix typo: s/unknow/unknown 2012-10-09 06:15:16 +00:00
Pyun YongHyeon
e010b05517 Rework device detach. While here, move driver lock/callout
initialization to the beginning of device attach for readability.
2012-10-08 07:33:43 +00:00
Pyun YongHyeon
f7add34cfc Limit applying TX data corruption and FIFO workaround to BCM5719
A0. It's believed BCM5720 does not have the issue.
2012-10-08 07:13:45 +00:00