Commit Graph

23624 Commits

Author SHA1 Message Date
Adrian Chadd
c7c073413b Fix uninitialised reference.
Noticed by:	John Hay <jhay@meraka.org.za>
2012-06-11 12:26:23 +00:00
Adrian Chadd
7561cb5c8b Wrap the whole (software) TX path from ifnet dequeue to software queue
(or direct dispatch) behind the TXQ lock (which, remember, is doubling
as the TID lock too for now.)

This ensures that:

 (a) the sequence number and the CCMP PN allocation is done together;
 (b) overlapping transmit paths don't interleave frames, so we don't
     end up with the original issue that triggered kern/166190.

     Ie, that we don't end up with seqno A, B in thread 1, C, D in
     thread 2, and they being queued to the software queue as "A C D B"
     or similar, leading to the BAW stalls.

This has been tested:

* both STA and AP modes with INVARIANTS and WITNESS;
* TCP and UDP TX;
* both STA->AP and AP->STA.

STA is a Routerstation Pro (single CPU MIPS) and the AP is a dual-core
Centrino.

PR:		kern/166190
2012-06-11 07:44:16 +00:00
Adrian Chadd
4b6db4043f Add another TID lock. 2012-06-11 07:35:24 +00:00
Adrian Chadd
ba0e58f4fa Make sure the frames are queued to the head of the list, not the tail.
See previous commit.

PR:		kern/166190
2012-06-11 07:31:50 +00:00
Adrian Chadd
39f24578fb When scheduling frames in an aggregate session, the frames should be
scheduled from the head of the software queue rather than trying to
queue the newly given frame.

This leads to some rather unfortunate out of order (but still valid
as it's inside the BAW) frame TX.

This now:

* Always queues the frame at the end of the software queue;
* Tries to direct dispatch the frame at the head of the software queue,
  to try and fill up the hardware queue.

TODO:

* I should likely try to queue as many frames to the hardware as I can
  at this point, rather than doing one at a time;
* ath_tx_xmit_aggr() may fail and this code assumes that it'll schedule
  the TID.  Otherwise TX may stall.

PR:		kern/166190
2012-06-11 07:29:25 +00:00
Adrian Chadd
4547f047ba Retried frames need to be inserted in the head of the list, not the tail.
This is an unfortunate byproduct of how the routine is used - it's called
with the head frame on the queue, but if the frame is failed, it's inserted
into the tail of the queue.

Because of this, the sequence numbers would get all shuffled around and
the BAW would be bumped past this sequence number, that's now at the
end of the software queue.  Then, whenever it's time for that frame
to be transmitted, it'll be immediately outside of the BAW and TX will
stall until the BAW catches up.

It can also result in all kinds of weird duplicate BAW frames, leading
to hilarious panics.

PR:		kern/166190
2012-06-11 07:15:48 +00:00
Adrian Chadd
42f4d0618a Finish undoing the previous commit - this part of the code is no longer
required.

PR:		kern/166190
2012-06-11 07:08:40 +00:00
Adrian Chadd
c2ac9655c3 Introduce a new lock debug which is specifically for making sure the
_TID_ lock is held.

For now the TID lock is also the TXQ lock. This is just to make sure
that the right TXQ lock is held for the given TID.
2012-06-11 07:06:49 +00:00
Adrian Chadd
a108d2d6c6 Revert r233227 and followup commits as it breaks CCMP PN replay detection.
This showed up when doing heavy UDP throughput on SMP machines.

The problem with this is because the 802.11 sequence number is being
allocated separately to the CCMP PN replay number (which is assigned
during ieee80211_crypto_encap()).

Under significant throughput (200+ MBps) the TX path would be stressed
enough that frame TX/retry would force sequence number and PN allocation
to be out of order.  So once the frames were reordered via 802.11 seqnos,
the CCMP PN would be far out of order, causing most frames to be discarded
by the receiver.

I've fixed this in some local work by being forced to:

  (a) deal with the issues that lead to the parallel TX causing out of
      order sequence numbers in the first place;
  (b) fix all the packet queuing issues which lead to strange (but mostly
      valid) TX.

I'll begin fixing these in a subsequent commit or five.

PR:		kern/166190
2012-06-11 06:59:28 +00:00
Alexander Motin
eb586bd9ee Partially revert r236666:
Return PROTO_ATA protocol in response to XPT_PATH_INQ.

smartmontools uses it to identify ATA devices and I don't know any other
place now where it is important. It could probably use XPT_GDEV_TYPE
instead for more accurate protocol information, but let it live for now.

Reported by:	matthew
MFC after:	3 days
2012-06-10 11:17:14 +00:00
Adrian Chadd
94fe37d25c Add a new ioctl for ath(4) which returns the aggregate statistics. 2012-06-10 06:42:18 +00:00
Mitsuru IWASAKI
fb864578af Add x86/acpica/acpi_wakeup.c for amd64 and i386. Difference of
suspend/resume procedures are minimized among them.

common:
- Add global cpuset suspended_cpus to indicate APs are suspended/resumed.
- Remove acpi_waketag and acpi_wakemap from acpivar.h (no longer used).
- Add some variables in acpi_wakecode.S in order to minimize the difference
  among amd64 and i386.
- Disable load_cr3() because now CR3 is restored in resumectx().

amd64:
- Add suspend/resume related members (such as MSR) in PCB.
- Modify savectx() for above new PCB members.
- Merge acpi_switch.S into cpu_switch.S as resumectx().

i386:
- Merge(and remove) suspendctx() into savectx() in order to match with
  amd64 code.

Reviewed by:	attilio@, acpi@
2012-06-09 00:37:26 +00:00
Alexander Motin
c18783f219 Add IDs for Marvell 88SE9220/9230/9235 PCIe 2.0 x2 6Gbps SATA controllers.
Marvell 88SE9230 was confirmed to work, the rest two are just guessed.

MFC after:	1 week
2012-06-08 07:44:42 +00:00
John Hay
7501345eed Add support for the Sunix SER5437A dual serial PCI Express card. 2012-06-08 06:07:23 +00:00
Maksim Yevmenkin
c5d8a885d4 Correct typo(?) and actually set PTHRESH to 32 and not 16 as per Intel
Linux driver 3.8.21.

MFC after:	1 week
2012-06-07 22:57:26 +00:00
Pyun YongHyeon
55b5758c90 Fix typo.
Submitted by:	Alexander Milanov < a <> amilanov dot com >
2012-06-07 03:22:20 +00:00
Kevin Lo
144a072499 Fix a logic error when use PCIY_PMG capability
Reviewed by:	yongari
2012-06-07 02:24:27 +00:00
Sergey Kandaurov
4fb52be9c2 Fix the build. 2012-06-06 09:07:50 +00:00
Alexander Motin
bc1bf6e842 ATA/SATA controllers have no idea about protocol of the connected device
until transport will do some probe actions (at least soft reset).
Make ATA/SATA SIMs to not report bogus and confusing PROTO_ATA protocol.
Make ATA/SATA transport to fill that gap by reporting protocol to SIM with
XPT_SET_TRAN_SETTINGS and patching XPT_GET_TRAN_SETTINGS results if needed.
2012-06-06 06:52:51 +00:00
Kevin Lo
858f9d27f0 Check the return value of pci_find_cap() 2012-06-06 02:42:30 +00:00
Maksim Yevmenkin
cd1fb2e095 Before it gets lost in the noise.
Put a bandaid to prevent ixgbe(4) from completely locking up the system
under high load. Our platform has a few CPU cores and a single active
ixgbe(4) port with 4 queues. Under high enough traffic load, at about
7.5GBs and 700,000 packets/sec (outbound), the entire system would
deadlock. What we found was that each CPU was in an endless loop on a
different ix taskqueue thread. The OACTIVE flag had gotten set on each
queue, and the ixgbe_handle_queue() function was continuously rescheduling
itself via the taskqueue_enqueue. Since all CPUs were busy with their
taskqueue threads, the ixgbe_local_timer() function couldn't run to clear
the OACTIVE flag.

Submitted by:	scottl
MFC after:	1 week
2012-06-05 18:48:02 +00:00
Adrian Chadd
9f95609828 Mostly revert previous commit(s). After doing a bunch of local testing,
it turns out that it negatively affects performance.  I'm stil investigating
exactly why deferring the IO causes such negative TCP performance but
doesn't affect UDP preformance.

Leave the ath_tx_kick() change in there however; it's going to be useful
to have that there for if_transmit() work.

PR:		kern/168649
2012-06-05 06:03:55 +00:00
Adrian Chadd
14d33c7e35 Create a function - ath_tx_kick() - which is called where ath_start() is
called to "kick" along TX.

For now, schedule a taskqueue call.

Later on I may go back to the direct call of ath_rx_tasklet() - but for
now, this will do.

I've tested UDP and TCP TX. UDP TX still achieves 240MBit, but TCP
TX gets stuck at around 100MBit or so, instead of the 150MBit it should
be at.  I'll re-test with no ACPI/power/sleep states enabled at startup
and see what effect it has.

This is in preparation for supporting an if_transmit() path, which will
turn ath_tx_kick() into a NUL operation (as there won't be an ifnet
queue to service.)

Tested:
	* AR9280 STA

TODO:
	* test on AR5416, AR9160, AR928x STA/AP modes

PR:		kern/168649
2012-06-05 03:14:49 +00:00
David E. O'Brien
eb9aea5ac0 Add the 'filemon' device. 'filemon' is a kernel module that provides a device
interface for processes to record system calls of its children.

Submitted by:	Juniper Networks.
2012-06-04 22:54:19 +00:00
Adrian Chadd
470a7f4191 Migrate the TX path to a taskqueue for now, until a better way of
implementing parallel TX and TX/RX completion can be done without
simply abusing long-held locks.

Right now, multiple concurrent ath_start() entries can result in
frames being dequeued out of order.  Well, they're dequeued in order
fine, but if there's any preemption or race between CPUs between:

* removing the frame from the ifnet, and
* calling and runningath_tx_start(), until the frame is placed on a
  software or hardware TXQ

Then although dequeueing the frame is in-order, queueing it to the hardware
may be out of order.

This is solved in a lot of other drivers by just holding a TX lock over
a rather long period of time.  This lets them continue to direct dispatch
without races between dequeue and hardware queue.

Note to observers: if_transmit() doesn't necessarily solve this.
It removes the ifnet from the main path, but the same issue exists if
there's some intermediary queue (eg a bufring, which as an aside also
may pull in ifnet when you're using ALTQ.)

So, until I can sit down and code up a much better way of doing parallel
TX, I'm going to leave the TX path using a deferred taskqueue task.
What I will likely head towards is doing a direct dispatch to hardware
or software via if_transmit(), but it'll require some driver changes to
allow queues to be made without using the really large ath_buf / ath_desc
entries.

TODO:

* Look at how feasible it'll be to just do direct dispatch to
  ath_tx_start() from if_transmit(), avoiding doing _any_ intermediary
  serialisation into a global queue.  This may break ALTQ for example,
  so I have to be delicate.

* It's quite likely that I should break up ath_tx_start() so it
  deposits frames onto the software queues first, and then only fill
  in the 802.11 fields when it's being queued to the hardware.
  That will make the if_transmit() -> software queue path very
  quick and lightweight.

* This has some very bad behaviour when using ACPI and Cx states.
  I'll do some subsequent analysis using KTR and schedgraph and file
  a follow-up PR or two.

PR:		kern/168649
2012-06-04 22:01:12 +00:00
Dimitry Andric
56e4bfe54d Fix build of aicasm when CC=clang. This was due to a side-effect of the
EARLY_BUILD macro: the -Qunused-arguments flag isn't passed anymore when
building this particular program.  However, with clang 3.1 and -Werror,
such unused argument warnings are flagged as errors, causing buildkernel
to fail at this stage, due to the -nostdinc flag passed during linking.
Since the -nostdinc flag isn't actually needed, just remove it.

X-MFC-With:	r236528
2012-06-04 20:36:11 +00:00
Dimitry Andric
cec20e143c Make aicasm compile without warnings if -Wpointer-sign is enabled.
MFC after:	3 days
2012-06-04 17:22:43 +00:00
Marius Strobl
4c87055c0c Disable verification of the flashed content for now; for reasons unknown
it sometimes causes physwr to hang.
2012-06-03 21:03:16 +00:00
Marius Strobl
7f2107d400 - Loop up to 3 seconds when waiting for a device to get ready. [1]
- Make the device description match the driver name.
- Identify the chip variant based on the JEDEC and use that information
  to use the proper values for page count, offset and size instead of
  hardcoding a AT45DB642x with 2^N byte page support disabled.
- Take advantage of bioq_takefirst().
- Given that CONTINUOUS_ARRAY_READ_HF (0x0b) command isn't even mentioned
  in Atmel's DataFlash Application Note, as suggested by the previous
  comment may not work on all all devices and actually doesn't properly
  on at least AT45DB321D (JEDEC 0x1f2701), rewrite at45d_task() to use
  CONTINUOUS_ARRAY_READ (0xe8) for reading instead. This rewrite is laid
  out in a way allowing to easily add support for BIO_DELETE later on.
- Add support for reads and writes not starting on a page boundary.
- Verify the flash content after writing.
- Let at45d_task() gracefully handle errors on SPI transfers and the
  device not becoming ready afterwards again. [1]
- Use DEVMETHOD_END. [1]
- Use NULL instead of 0 for pointers. [1]

Additional testing by:	Ian Lepore

Submitted by:	Ian Lepore [1]
MFC after:	1 week
2012-06-03 01:00:55 +00:00
Marius Strobl
ae5d8757bf Add missing prototypes. While at it, sort them alphabetically.
MFC after:	3 days
2012-06-02 20:47:00 +00:00
Marius Strobl
f3a4392048 Remove nitems() now that it lives in <sys/param.h> since r236486. 2012-06-02 20:00:52 +00:00
Marius Strobl
47f4a4dc9a Take advantage of nitems().
MFC after:	3 days
2012-06-02 19:41:28 +00:00
Hans Petter Selasky
bb57146269 Add appropriate checks for ic_bsschan being set to IEEE80211_CHAN_ANYC in
some of the USB WLAN drivers. This fixes a panic when using monitor mode.

MFC after:	1 week
Submitted by:	PseudoCylon
2012-06-02 09:10:51 +00:00
Matt Jacob
e2873b76a6 Clean up and complete the incomplete deferred enable code.
Make the default role NONE if target mode is selected. This
allows ctl(8) to switch to/from target mode via knob settings.
If we default to role 'none', this causes a reset of the
24XX f/w which then causes initiators to wake up and notice
when we come online.

Reviewed by:    kdm
MFC after:      2 weeks
Sponsored by:   Spectralogic
2012-06-01 23:29:48 +00:00
Jung-uk Kim
9ad569771a Consistently use ACPI_SUCCESS() and ACPI_FAILURE() macros wherever possible. 2012-06-01 21:33:33 +00:00
Jung-uk Kim
4d46ef51dd Execute AcpiLeaveSleepStatePrep() for S1 and reduce code duplication.
MFC after:	3 days
2012-06-01 17:00:33 +00:00
Hans Petter Selasky
d9073c1e6a Improve support for detaching kernel drivers on a per interface basis.
MFC after:	1 week
2012-06-01 16:30:54 +00:00
John Baldwin
03b0ca8b28 Commit a portion of 233708 I missed earlier and don't include the
definition of igb_start() and igb_start_locked() (nor set if_start in
the ifnet) when igb(4) uses if_transmit.
2012-06-01 15:52:41 +00:00
Mitsuru IWASAKI
f0a101b7e2 Call AcpiLeaveSleepStatePrep() in interrupt disabled context
(described in ACPICA source code).

- Move intr_disable() and intr_restore() from acpi_wakeup.c to acpi.c
  and call AcpiLeaveSleepStatePrep() in interrupt disabled context.
- Add acpi_wakeup_machdep() to execute wakeup MD procedures and call
  it twice in interrupt disabled/enabled context (ia64 version is
  just dummy).
- Rename wakeup_cpus variable in acpi_sleep_machdep() to suspcpus in
  order to be shared by acpi_sleep_machdep() and acpi_wakeup_machdep().
- Move identity mapping related code to acpi_install_wakeup_handler()
  (i386 version) for preparation of x86/acpica/acpi_wakeup.c
  (MFC candidate).

Reviewed by:	jkim@
MFC after:	2 days
2012-06-01 15:26:32 +00:00
Adrian Chadd
81c2214dda Add a missing #include, required for IEEE80211_DEBUG. 2012-06-01 06:20:39 +00:00
Eitan Adler
d45ce511db Adding missing dependancies for loading hptiop(4), hptmv(4) and isp(4) as modules.
PR:		kern/166239
Submitted by:	Pavel Timofeev <timp87@gmail.com>
Discussed on:	-stable, -scsi
Reviewed by:	scottl
No objection from: mjacob
Approved by:	cperciva
MFC after:	3 days
2012-06-01 04:34:49 +00:00
Eitan Adler
829ac2c3e0 Fix warning generated by clang;
warning: equality comparison with extraneous parentheses
	[-Wparentheses-equality]

Reported by:	arundel
Reviewed by:	gnn
Approved by:	cperciva
MFC after:	3 days
2012-06-01 04:23:20 +00:00
Pyun YongHyeon
198b3ad636 Remove unnecessary device_printfs.
Pointed out by:	marius
2012-05-31 23:56:10 +00:00
Marius Strobl
749a52693c Try to finally get the point in time at which bge_add_sysctls() is called
right; it needs to be called before bge_can_use_msi() but in turn requires
bge_flags to be properly set.

Submitted by:	yongari
MFC after:	3 days
2012-05-30 20:04:07 +00:00
Sean Bruno
87e7271687 Cosmetic nit. If a configured volume has no label, don't emit an empty
string for the name during probe.  Simply indicate that it has no label.

Submitted by:	bhaga@
MFC after:	3 days
2012-05-30 17:07:50 +00:00
Eitan Adler
d9b73ea9cf Add support for Sun 1040 PCI Quad Serial
PR:		kern/163450
Submitted by:	Anonymous Hardware Hacker <silicium@harmony-p.ath.cx>
Approved by:	cperciva
MFC after:	1 week
2012-05-30 03:47:51 +00:00
Robert Noland
cf864f03b6 Add device ids for the Winbond 83627DHG-P chip and set the registers to
trigger the keyboard reset line on timeout.

Reviewed by:	bz
MFC after:	1 week
2012-05-29 16:39:42 +00:00
Robert Noland
63fb0bb621 Fix a typo in wbwd so that CRF5 is actually written to the data register
rather than the index register.

Reviewed by:	bz
MFC after:	3 days
2012-05-29 16:25:01 +00:00
Hans Petter Selasky
58a9da85fe Add quirk for Marvell based AHCI controller.
MFC after:	3 days
Suggested by:	mav @
2012-05-29 15:56:30 +00:00
Mitsuru IWASAKI
e3b56b6604 Reorder resume procedures.
DEVICE_RESUME() should be done before AcpiLeaveSleepState() because
PCI config space evaluation can be occurred during control method
executions.

This should fix one of the hang up problems on resuming.

MFC after:	3 days
2012-05-29 05:28:34 +00:00