Commit Graph

24250 Commits

Author SHA1 Message Date
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
Pyun YongHyeon
9dd3fa374a Fix typo. Check against number of allocated MSI-X vectors.
There is no ale(4) controller that supports MSI-X so this is not
real issue.

PR:	kern/171825
2012-10-08 07:01:07 +00:00
Adrian Chadd
3e6cc97fd6 Migrate the TID TXQ accesses to a new set of macros, rather than reusing
the ATH_TXQ_* macros.

* Introduce the new macros;
* rename the TID queue and TID filtered frame queue so the compiler
  tells me I'm using the wrong macro.

These should correspond 1:1 to the existing code.
2012-10-07 23:45:19 +00:00
Adrian Chadd
943e37a120 Initialise an uninitialised variable. 2012-10-05 16:44:00 +00:00
John Baldwin
f8d6c20a0f Further adjust the workaround in r234501. Rounding all small requests up
to 32k swamped the controller causing firmware hangs.  Instead, round
requests smaller than 64k up to the next power of 2 as a general rule.
To handle the one known special case of a command that accepts a 12k
buffer returning a 24k-ish reply, round requests between 8k and 16k up
to 32k rather than 16k.  The result is that commands less than 8k should
now be rounded up to a smaller size (either 4k or 8k) rather than 32k.

PR:		kern/155658
Tested by:	Andreas Longwitz
MFC after:	1 week
2012-10-05 15:52:31 +00:00
Pyun YongHyeon
a6e66cd28b Follow Broadcom datasheet:
Delay 100 microseconds after enabling transmit MAC.
 Delay 10 microseconds after enabling receive MAC.
2012-10-05 07:13:21 +00:00
Pyun YongHyeon
9b80ffe78f Add 40 microseconds delay after updating EMAC Mode register as
recommended by Broadcom data sheet.
2012-10-05 06:24:22 +00:00
Pyun YongHyeon
a0a03d1e82 APE firmware touches EMAC Mode and TX/RX MAC Mode registers to keep
the MAC connected to the outside world.  So keep the accesses
atomic.
2012-10-05 03:46:25 +00:00
Pyun YongHyeon
e4146b9510 Don't touch EMAC Mode and TX/RX MAC Mode register when driver is
not running.
2012-10-05 03:35:38 +00:00
Adrian Chadd
e9472a9f88 Implement the quarter rate fractional channel programming for the
AR5416 and AR9280, but leave it disabled by default.

TL;DR: don't enable this code at all unless you go through the process
of getting the NIC re-certified.  This is purely to be used as a
reference and NOT a certified solution by any stretch of the imagination.

The background:

The AR5112 RF synth right up to the AR5133 RF synth (used on the AR5416,
derivative is used for the AR9130/AR9160) only implement down to 2.5MHz
channel spacing in 5GHz.  Ie, the RF synth is programmed in steps of 2.5MHz
(or 5, 10, 20MHz.) So they can't represent the quarter rate channels
in the 4.9GHz PSB (which end in xxx2MHz and xxx7MHz).  They support
fractional spacing in 2GHz (1MHz spacing) (or things wouldn't work,
right?)

So instead of doing this, the RF synth programming for the AR5112 and
later code will round to the nearest available frequency.

If all NICs were RF5112 or later, they'll inter-operate fine - they all
program the same. (And for reference, only the latest revision of the
RF5111 NICs do it, but the driver doesn't yet implement the programming.)

However:

* The AR5416 programming didn't at all implement the fractional synth
  work around as above;
* The AR9280 programming actually programmed the accurate centre frequency
  and thus wouldn't inter-operate with the legacy NICs.

So this patch:

* Implements the 4.9GHz PSB fractional synth workaround, exactly as the
  RF5112 and later code does;
* Adds a very dirty workaround from me to calculate the same channel
  centre "fudge" to the AR9280 code when operating on fractional frequencies
  in 5GHz.

HOWEVER however:

It is disabled by default.  Since the HAL didn't implement this feature,
it's highly unlikely that the AR5416 and AR928x has been tested in these
centre frequencies.  There's a lot of regulatory compliance testing required
before a NIC can have this enabled - checking for centre frequency,
for drift, for synth spurs, for distortion and spectral mask compliance.
There's likely a lot of other things that need testing so please don't
treat this as an exhaustive, authoritative list.  There's a perfectly good
process out there to get a NIC certified by your regulatory domain, please
go and engage someone to do that for you and pay the relevant fees.

If a company wishes to grab this work and certify existing 802.11n NICs
for work in these bands then please be my guest.  The AR9280 works fine
on the correct fractional synth channels (49x2 and 49x7Mhz) so you don't
need to get certification for that. But the 500KHz offset hack may have
the above issues (spur, distortion, accuracy, etc) so you will need to
get the NIC recertified.

Please note that it's also CARD dependent.  Just because the RF synth
will behave correctly doesn't at all mean that the card design will also
behave correctly.  So no, I won't enable this by default if someone
verifies a specific AR5416/AR9280 NIC works.  Please don't ask.

Tested:

I used the following NICs to do basic interoperability testing at
half and quarter rates.  However, I only did very minimal spectrum
analyser testing (mostly "am I about to blow things up" testing;
not "certification ready" testing):

* AR5212 + AR5112 synth
* AR5413 + AR5413 synth
* AR5416 + AR5113 synth
* AR9280
2012-10-04 15:42:45 +00:00
Adrian Chadd
0eb8162623 Pause and unpause the software queues for a given node based on the
net80211 node power save state.

* Add an ATH_NODE_UNLOCK_ASSERT() check
* Add a new node field - an_is_powersave
* Pause/unpause the queue based on the node state
* Attempt to handle net80211 concurrency issues so the queue
  doesn't get paused/unpaused more than once at a time from
  the net80211 power save code.

Whilst here (and breaking my usual rule), set CLRDMASK when a queue
is unpaused, regardless of whether the queue has some pending traffic.
This means the first frame from that TID (now or later) will hvae
CLRDMASK set.

Also whilst here, bump the swretrymax counters whenever the
filtered frames code expires a frame.  Again, breaking my rule, but
this is just a statistics thing rather than a functional change.

This doesn't fix ps-poll (but it doesn't break it too much worse
than it is at the present) or correcting the TID updates.
That's next on the list.

Tested:
	* AR9220 AP (Atheros AP96 reference design)
	* Macbook Pro and LG Optimus 1 Android phone, both setting
	  and clearing power save state (but not using PS-POLL.)
2012-10-03 23:23:45 +00:00