Commit Graph

25907 Commits

Author SHA1 Message Date
Adrian Chadd
dd6a574e09 Enable the use of TDMA on an 802.11n channel (with aggregation disabled,
of course.)

There's a few things that needed to happen:

* In case someone decides to set the beacon transmission rate to be
  at an MCS rate, use the MCS-aware version of the duration calculation
  to figure out how long the received beacon frame was.

* If TxOP enforcing is available on the hardware and we're doing TDMA,
  enable it after a reset and set the TDMA guard interval to zero.
  This seems to behave fine.

TODO:

* Although I haven't yet seen packet loss, the PHY errors that would be
  triggered (specifically Transmit-Override-Receive) aren't enabled
  by the 11n HAL.  I'll have to do some work to enable these PHY errors
  for debugging.

What broke:

* My recent changes to the TX queue handling has resulted in the driver
  not keeping the hardware queue properly filled when doing non-aggregate
  traffic.  I have a patch to commit soon which fixes this situation
  (albeit by reminding me about how my ath driver locking isn't working
  out, sigh.)

  So if you want to test this without updating to the next set of patches
  that I commit, just bump the sysctl dev.ath.X.hwq_limit from 2 to 32.

Tested:

* AR5416 <-> AR5416, with ampdu disabled, HT40, 5GHz, MCS12+Short-GI.
  I saw 30mbit/sec in both directions using a bidirectional UDP test.
2013-05-21 18:02:54 +00:00
Adrian Chadd
6ea069190d Fix build break - the SetCapability calls return HAL_BOOL,
not HAL_STATUS.
2013-05-21 14:28:05 +00:00
Hans Petter Selasky
6d5ae34a44 Add new USB quirk.
MFC after:	1 week
PR:		usb/178771
2013-05-21 06:13:38 +00:00
Adrian Chadd
38aa9f3688 Extend the TXOP enforce capability to support checking whether it's
supported.
2013-05-21 05:51:49 +00:00
Marcel Moolenaar
cb34ed4434 Add basic support for FDT to i386 & amd64. This change includes:
1.  Common headers for fdt.h and ofw_machdep.h under x86/include
    with indirections under i386/include and amd64/include.
2.  New modinfo for loader provided FDT blob.
3.  Common x86_init_fdt() called from hammer_time() on amd64 and
    init386() on i386.
4.  Split-off FDT specific low-level console functions from FDT
    bus methods for the uart(4) driver. The low-level console
    logic has been moved to uart_cpu_fdt.c and is used for arm,
    mips & powerpc only. The FDT bus methods are shared across
    all architectures.
5.  Add dev/fdt/fdt_x86.c to hold the fdt_fixup_table[] and the
    fdt_pic_table[] arrays. Both are empty right now.

FDT addresses are I/O ports on x86. Since the core FDT code does
not handle different address spaces, adding support for both I/O
ports and memory addresses requires some thought and discussion.
It may be better to use a compile-time option that controls this.

Obtained from:	Juniper Networks, Inc.
2013-05-21 03:05:49 +00:00
Jung-uk Kim
a9d8d09c46 Merge ACPICA 20130517. 2013-05-20 23:52:49 +00:00
Jung-uk Kim
b3f35be0c6 - Prefer ACPI_COMPARE_NAME(a, b) macro over strncmp(a, b, ACPI_NAME_SIZE).
- Make sure the predefined name is a string type.
- Return slightly more useful errors.
2013-05-20 22:18:18 +00:00
Jung-uk Kim
ec23b5bfe7 Fix white spaces. 2013-05-20 22:10:01 +00:00
Adrian Chadd
5b66d8a5ad Make the HT rate duration calculation work for MCS rates > 15. 2013-05-20 07:10:43 +00:00
Sean Bruno
156860b2b3 Update snd quirks for T520, T420, X220.
Group onboard mic and headphone mic jack together.  Creates association that
will switch between microphone inputs depending on the state of the headphone
jack being connected to a live mic.

Fixes onboard mic not working at all on T520.

Tested on T520, T420.
Suspect X220 needs this too, untested on.

MFC after:	1 month
2013-05-19 01:45:29 +00:00
Adrian Chadd
6112d22c3f More non-ATH_DEBUG build fixes. 2013-05-19 01:33:17 +00:00
Adrian Chadd
bd0edcac7c Since we're now using the ah pointer, always declare it.
This fixes non-DEBUG builds.
2013-05-19 00:53:06 +00:00
Steven Hartland
6fb5c84ea2 Added output of device QUIRKS for CAM and AHCI devices during boot.
Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks
2013-05-18 23:36:21 +00:00
Adrian Chadd
9be82a4209 Be (very) careful about how to add more TX DMA work.
The list-based DMA engine has the following behaviour:

* When the DMA engine is in the init state, you can write the first
  descriptor address to the QCU TxDP register and it will work.

* Then when it hits the end of the list (ie, it either hits a NULL
  link pointer, OR it hits a descriptor with VEOL set) the QCU
  stops, and the TxDP points to the last descriptor that was transmitted.

* Then when you want to transmit a new frame, you can then either:
  + write the head of the new list into TxDP, or
  + you write the head of the new list into the link pointer of the
    last completed descriptor (ie, where TxDP points), then kick
    TxE to restart transmission on that QCU>

* The hardware then will re-read the descriptor to pick up the link
  pointer and then jump to that.

Now, the quirks:

* If you write a TxDP when there's been no previous TxDP (ie, it's 0),
  it works.

* If you write a TxDP in any other instance, the TxDP write may actually
  fail.  Thus, when you start transmission, it will re-read the last
  transmitted descriptor to get the link pointer, NOT just start a new
  transmission.

So the correct thing to do here is:

* ALWAYS use the holding descriptor (ie, the last transmitted descriptor
  that we've kept safe) and use the link pointer in _THAT_ to transmit
  the next frame.

* NEVER write to the TxDP after you've done the initial write.

* .. also, don't do this whilst you're also resetting the NIC.

With this in mind, the following patch does basically the above.

* Since this encapsulates Sam's issues with the QCU behaviour w/ TDMA,
  kill the TDMA special case and replace it with the above.

* Add a new TXQ flag - PUTRUNNING - which indicates that we've started
  DMA.

* Clear that flag when DMA has been shutdown.

* Ensure that we're not restarting DMA with PUTRUNNING enabled.

* Fix the link pointer logic during TXQ drain - we should always ensure
  the link pointer does point to something if there's a list of frames.
  Having it be NULL as an indication that DMA has finished or during
  a reset causes trouble.

Now, given all of this, i want to nuke axq_link from orbit.  There's now HAL
methods to get and set the link pointer of a descriptor, so what we
should do instead is to update the right link pointer.

* If there's a holding descriptor and an empty TXQ list, set the
  link pointer of said holding descriptor to the new frame.

* If there's a non-empty TXQ list, set the link pointer of the
  last descriptor in the list to the new frame.

* Nuke axq_link from orbit.

Note:

* The AR9380 doesn't need this.  FIFO TX writes are atomic.  As long as
  we don't append to a list of frames that we've already passed to the
  hardware, all of the above doesn't apply.  The holding descriptor stuff
  is still needed to ensure the hardware can re-read a completed
  descriptor to move onto the next one, but we restart DMA by pushing in
  a new FIFO entry into the TX QCU.  That doesn't require any real
  gymnastics.

Tested:

* AR5210, AR5211, AR5212, AR5416, AR9380 - STA mode.
2013-05-18 18:27:53 +00:00
Adrian Chadd
f2f6761490 Re-add some code to exclude transmitting if we're in reset.
This fixes some "transmitting during reset" bugs that crept in after
I messed around with this part of the transmit path.
2013-05-18 13:58:07 +00:00
Hans Petter Selasky
e5359a3bba Don't clear stall at first time use of USB MIDI endpoints.
Most likely some non-USB compliant devices will choke on it
sooner or later. Clear stall is strictly speaking not needed.
If the first MIDI command sent or transmitted is lost, this
is not a big problem for us.

MFC after:	1 week
2013-05-18 07:16:20 +00:00
Hans Petter Selasky
33da3daa40 Fix issue with "Logitech Webcam C525":
Set a valid alternate interface setting
when enumerating USB audio devices else
the device mentioned will not work like
expected.

PR:		usb/178722
MFC after:	1 week
2013-05-18 07:03:06 +00:00
Warner Losh
8b18cb1c23 For ARM, MIPS, and PowerPC, default to 32-byte alignment, but allow it
to be as small as 8.
2013-05-17 20:53:15 +00:00
Gavin Atkinson
1c6951aeb6 o Retrive the part number (CP2103 etc) from the hardware on attach.
o  The CP2101 and CP2102 do not support GPIO pin use at all, enforce this.
o  Support reading the GPIO status on the second port of the CP2105.  More
   work is needed before the CP2105 GPIO pins can be used as outputs.

Hardware donated by:	Silicon Labs
MFC after:		3 weeks
2013-05-17 19:13:31 +00:00
Konstantin Belousov
f05f3c1764 Add new capability types encodings from HyperTransport I/O Link
Specification revisions 3.00 and 3.10.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2013-05-17 14:04:31 +00:00
Adrian Chadd
97c9a8e806 Add some more debugging printf()s to complain if the ath_buf tx queue
doesn't match the actual hardware queue this frame is queued to.

I'm trying to ensure that the holding buffers are actually being queued
to the same TX queue as the holding buffer that they end up on.
I'm pretty sure this is all correct so if this complains, it'll be due
to some kind of subtle broken-ness that needs fixing.

This is only done for legacy hardware, not EDMA hardware.

Tested:

* AR5416 STA mode, very lightly
2013-05-17 05:16:30 +00:00
Warner Losh
c96e8c3222 When reporting the user readable size, round up. Several SD cards not
only use SI units, but also are a couple of percent short. If you need
to know the exact size, diskinfo will return exact results.
2013-05-16 19:44:51 +00:00
Adrian Chadd
6d07d3e014 Tidy up the debugging - don't bother printing out TID pointers; now
that we are printing out the MAC address in these fields, just printing
out the TID is enough.
2013-05-16 17:53:12 +00:00
Adrian Chadd
b45a991e92 Limit the number of software queued frames when doing non-aggregation.
This should prevent the TX queue being filled with non-aggregate frames,
causing starvation and non-fair queue behaviour.
2013-05-16 17:46:32 +00:00
Adrian Chadd
dfaf8de927 Dump out the holding buffer descriptor contents and addresses stopping DMA. 2013-05-16 17:45:01 +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
Adrian Chadd
22a3aee637 Implement my first cut at "correct" node power-save and
PS-POLL support.

This implements PS-POLL awareness i nthe

* Implement frame "leaking", which allows for a software queue
  to be scheduled even though it's asleep
* Track whether a frame has been leaked or not
* Leak out a single non-AMPDU frame when transmitting aggregates
* Queue BAR frames if the node is asleep
* Direct-dispatch the rest of control and management frames.
  This allows for things like re-association to occur (which involves
  sending probe req/resp as well as assoc request/response) when
  the node is asleep and then tries reassociating.
* Limit how many frames can set in the software node queue whilst
  the node is asleep.  net80211 is already buffering frames for us
  so this is mostly just paranoia.
* Add a PS-POLL method which leaks out a frame if there's something
  in the software queue, else it calls net80211's ps-poll routine.
  Since the ath PS-POLL routine marks the node as having a single frame
  to leak, either a software queued frame would leak, OR the next queued
  frame would leak. The next queued frame could be something from the
  net80211 power save queue, OR it could be a NULL frame from net80211.

TODO:

* Don't transmit further BAR frames (eg via a timeout) if the node is
  currently asleep.  Otherwise we may end up exhausting management frames
  due to the lots of queued BAR frames.

  I may just undo this bit later on and direct-dispatch BAR frames
  even if the node is asleep.

* It would be nice to burst out a single A-MPDU frame if both ends
  support this.  I may end adding a FreeBSD IE soon to negotiate
  this power save behaviour.

* I should make STAs timeout of power save mode if they've been in power
  save for more than a handful of seconds.  This way cards that get
  "stuck" in power save mode don't stay there for the "inactivity" timeout
  in net80211.

* Move the queue depth check into the driver layer (ath_start / ath_transmit)
  rather than doing it in the TX path.

* There could be some naughty corner cases with ps-poll leaking.
  Specifically, if net80211 generates a NULL data frame whilst another
  transmitter sends a normal data frame out net80211 output / transmit,
  we need to ensure that the NULL data frame goes out first.
  This is one of those things that should occur inside the VAP/ic TX lock.
  Grr, more investigations to do..

Tested:

* STA: AR5416, AR9280
* AP: AR5416, AR9280, AR9160
2013-05-15 18:33:05 +00:00
David C Somayajulu
f10a77bb82 Add Qlogic 10Gigabit Ethernet & CNA Adapter Driver Version 3.10.10 for
QLogic 8300 Series Adapters

Submitted by: David C Somayajulu (davidcs@freebsd.org) QLogic Corporation
Approved by: George Neville-Neil (gnn@freebsd.org)
2013-05-15 17:03:09 +00:00
Adrian Chadd
370f81fab6 Add ALQ beacon debugging. 2013-05-13 21:18:00 +00:00
Adrian Chadd
5086df9f1f Support sending ATH_ALQ messages with no payload. 2013-05-13 21:17:27 +00:00
Jung-uk Kim
634cf355b0 Remove a bogus re-assignment.
MFC after:	3 days
2013-05-13 20:03:59 +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
Adrian Chadd
9b48fb4b32 Improve the debugging output - use the MAC address rather than various
pointer values everywhere.
2013-05-13 19:52:35 +00:00
Adrian Chadd
ba83edd45c Since the node state is 100% back under the TX lock, just kill the use
of atomics.

I'll re-think this nonsense later.
2013-05-13 19:03:12 +00:00
Adrian Chadd
22780332ae Oops, commit the other half of r250606. 2013-05-13 19:02:22 +00:00
Adrian Chadd
01a2ad5a4c This lock only protects the rate control state for now, mention this. 2013-05-13 18:57:18 +00:00
Adrian Chadd
4bed2b67ca Begin tidying up the reassociation and node sleep/wakeup paths.
* Move the node sleep/wake state under the TX lock rather than the
  node lock.  Let's leave the node lock protecting rate control only
  for now.

* When reassociating, various state needs to be cleared.  For example,
  the aggregate session needs to be torn down, including any pending
  aggregation negotiation and BAR TX waiting.

* .. and we need to do a "cleanup" pass since frames in the hardware
  TX queue need to be transmitted.

Modify ath_tx_tid_cleanup() to be called with the TX lock held and push
frames into a completion list.  This allows for the cleanup to be
done atomically for all TIDs in a node rather than grabbing and
releasing the TX lock each time.
2013-05-13 18:56:04 +00:00
Eitan Adler
a164074fc4 Fix several typos
PR:		kern/176054
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
MFC after:	3 days
2013-05-12 16:43:26 +00:00
Eitan Adler
7a2b450ff8 Fxi a bunch of typos.
PR:	misc/174625
Submitted by:	Jeremy Chadwick <jdc@koitsu.org>
2013-05-10 16:41:26 +00:00
Adrian Chadd
8328d6e4d4 Make sure the holding descriptor and link pointer are both freed during
a non-loss reset.

When the drain functions are called, the holding descriptor and link pointers
are NULLed out.

But when the processq function is called during a non-loss reset, this
doesn't occur.  So the next time a DMA occurs, it's chained to a descriptor
that no longer exists and the hardware gets angry.

Tested:

* AR5416, STA mode; use sysctl dev.ath.X.forcebstuck=1 to force a non-loss
  reset.

TODO:

* Further AR9380 testing just to check that the behaviour for the EDMA
  chips is sane.

PR:		kern/178477
2013-05-10 10:06:45 +00:00
Luigi Rizzo
ede69cff5b another minor bugfix in the memory allocator, this time in the free routine. 2013-05-10 08:46:10 +00:00
John Baldwin
5569a8b8df Revision 233677 broke certain machines. Specifically, if the firmware/BIOS
assigned conflicting ranges to BARs then leaving the BARs alone could
result in one device stealing mmio accesses intended to go to a second
device.  Prior to 233677 the PCI bus driver attempted to handle this case
by clearing the BAR to 0 depending on BARs based at 0 not decoding (which
is not guaranteed to be true).  Now when a conflicting BAR is detected the
following steps are taken:

 1) If hw.pci.realloc_bars (a new tunable) is enabled (default is enabled),
    then ignore the current BAR setting from the firmware and attempt to
    allocate a fresh resource range for the BAR.

 2) If 1) failed (or was disabled), disable decoding for the relevant
    BAR type (e.g. disable mem decoding for a memory BAR) and emit a
    warning if booting verbose.

Tested by:	Alex Keda <admin@lissyara.su>
MFC after:	1 week
2013-05-09 19:24:50 +00:00
Luigi Rizzo
4dc07530d7 if_lem.c: make sure that lem_rxeof() can drain the entire rx queue
irrespective of the setting of lem_rx_process_limit, while
	giving a chance to the taskqueue scheduler to act after
	each chunk.
	This makes lem_rxeof similar to the one in if_em.c and if_igb.c .

if_lem.c and if_em.c: add a sysctl to manually configure the
	'itr' moderation register.

Approved by:	Jack Vogel
2013-05-09 17:07:30 +00:00
Luigi Rizzo
1405478115 simplify the code to initialize the RDT while in netmap mode. 2013-05-09 16:57:02 +00:00
Adrian Chadd
caedab2c56 Update the holding buffer locking for EDMA. 2013-05-09 15:57:55 +00:00
Adrian Chadd
5e0185081d Fix the holding descriptor logic to actually be "right" (for values
of "right".)

Flip back on the "always continue TX DMA using the holding descriptor"
code - by always setting ATH_BUF_BUSY and never setting axq_link to NULL.

Since the holding descriptor is accessed via txq->axq_link and _that_
is done behind the TXQ lock rather than the TX path lock, the holding
descriptor stuff itself needs to be behind the TXQ lock.

So, do the mental gymnastics needed to do this.

I've not seen any of the hardware failures that I was seeing when
I last tried to do this.

Tested:

* AR5416, STA mode
2013-05-08 21:23:51 +00:00
Adrian Chadd
248dd6039d Bring in a basic ethernet switch driver for the IP17x series of
switches.

These are notably found on some AR71xx based Mikrotik boards.

Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>
Reviewed by:	ray
2013-05-08 20:58:41 +00:00
Adrian Chadd
1ead288f8d Fix the ukswitch code to work with the new vlan changes:
* Fix API changes;
* remove unused code;
* Allow some switches to be used that don't expose a set of PHY
  registers for the CPU facing port (eg the ADM6996 for the Ubiquiti
  Routerstation.)

Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>
Reviewed by:	ray
2013-05-08 20:56:43 +00:00
Adrian Chadd
f47857dc3d Correctly mark the CPU port.
Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>
Reviewed by:	ray
2013-05-08 20:54:59 +00:00
Adrian Chadd
a48a9355ef Add the ability to change the vlan operation mode.
This adds a vlan capability field to etherswitch_info structure and some
definitions of ports flags.

It adds the support to global config parameters which right now is used
only to switch between the vlan modes, but it is intended to be extended
to support the setup of others parameters (STP, mirror, etc.).

Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>
Reviewed by:	ray
2013-05-08 20:46:54 +00:00