Commit Graph

23817 Commits

Author SHA1 Message Date
Luigi Rizzo
8d1717963b Use legacy interrupts as a default. This gives up to 10% speedup
when used in qemu (and this driver is for non-PCIe cards,
so probably its largest use is in virtualized environments).

Approved by:	Jack Vogel
MFC after:	3 days
2012-07-25 11:28:15 +00:00
Adrian Chadd
59a7572437 Add a new HAL method - the AR93xx and later NICs have a separate
TX descriptor ring for TX status completion. This API call will pass
the allocated buffer details to the HAL.
2012-07-24 01:18:19 +00:00
Adrian Chadd
1006fc0c3b Modify ath_descdma_setup() to take a descriptor size parameter.
The AR9300 and later descriptors are 128 bytes, however I'd like to make
sure that isn't used for earlier chips.

* Populate the TX descriptor length field in the softc with
  sizeof(ath_desc)

* Use this field when allocating the TX descriptors

* Pre-AR93xx TX/RX descriptors will use the ath_desc size; newer ones will
  query the HAL for these sizes.
2012-07-23 23:40:13 +00:00
Ed Maste
b225878c75 Quirk MS keyboard so that function keys work
The function keys on a Microsoft Natural Egronomic Keyboard 4000 have been
repurposed as "Help", "Undo", "Redo" etc., and a special "F Lock" key is
required to return them to their normal purpose.

This change enables the UQ_KBD_BOOTPROTO quirk for the MS Natural 4000
keyboard to get the keys working again.  More extensive changes to the USB
keyboard infrastructure would be needed to fully support the "F Lock" mode
and the extended keys on this keyboard.

PR:		usb/116947
Approved by:	hselasky@
2012-07-23 15:14:28 +00:00
Eygene Ryabinkin
411e2f7fc8 u3g: add support for Huawei E392 LTE modem
I am using it rebranded and it carries the label "Megafon"
(it is Russian mobile operator); works fine with my 3G network.

Approved by: hselasky
2012-07-23 14:22:45 +00:00
Adrian Chadd
59ab77207e Revert this; it wasn't supposed to be part of this commit. 2012-07-23 03:55:19 +00:00
Adrian Chadd
3fdfc33024 Begin separating out the TX DMA setup in preparation for TX EDMA support.
* Introduce TX DMA setup/teardown methods, mirroring what's done in
  the RX path.

  Although the TX DMA descriptor is setup via ath_desc_alloc() /
  ath_desc_free(), there TX status descriptor ring will be allocated
  in this path.

* Remove some of the TX EDMA capability probing from the RX path and
  push it into the new TX EDMA path.
2012-07-23 03:52:18 +00:00
Adrian Chadd
54c9979539 Flesh out a new DMA map for the EDMA TX completion status, as well
as a lock to go with that whole code path.
2012-07-23 02:49:25 +00:00
Adrian Chadd
3d9b15965e Begin modifying the descriptor allocation functions to support a variable
sized TX descriptor.

This is required for the AR93xx EDMA support which requires 128 byte
TX descriptors (which is significantly larger than the earlier
hardware.)
2012-07-23 02:26:33 +00:00
Alexander Motin
b8aff31b25 Use 16bit PIO instead of 32bit in case of misaligned buffer.
It fixes kernel panic during CD write with cdrecord on sparc64.
2012-07-21 14:59:43 +00:00
Gleb Smirnoff
1fc2ea61bf Fix typo in comment, should be MHz here.
Submitted by:	Daan Vreeken <Daan vitsch.nl>
2012-07-21 14:07:43 +00:00
Alexander Motin
d17996abb0 Fix typo in bzero length argument during sense fetching.
For me it at least fixed CD burning in PIO mode.

MFC after:	3 days
2012-07-21 08:19:43 +00:00
Adrian Chadd
be4f96a6b7 Introduce a rate table TLV so rate table statistics consumers
know how to map rix -> rate code.
2012-07-20 02:17:48 +00:00
Adrian Chadd
42420dccd5 Bump this up to match what the HAL is at now. 2012-07-20 01:41:18 +00:00
Adrian Chadd
b8f2a85349 Enable the basic node-based rate control statistics via an ioctl(). 2012-07-20 01:36:46 +00:00
Adrian Chadd
2d20d6559d Add a per-node rate control routine for each rate control module.
For now, the only module implement is 'sample', and that's only partially
implemented.  The main issue here with reusing this structure in userland
is that it uses 'rix' everywhere, which requires the userland code to
have access to the current HAL rate table.

For now, this is a very large work in progress.

Specific details:

* The rate control information is per-node at the moment and wrapped
  in a TLV, to ease parsing and backwards compatibility.
* .. but so I can be slack for now, the userland statistics are just
  a copy of the kernel-land sample node state.
* However, for now use a temporary copy and change the rix entries
  to dot11rate entries to make it slightly easier to eyeball.

Problems:

* The actual rate information table is unfortunately indexed by rix
  and it doesn't contain a rate code.  So the userland side of this
  currently has no way to extract out a mapping.

TODO:

* Add a TLV payload to dump out the rate control table mapping so
  'rix' can be turned into a dot11 / MCS rate.
* .. then remove the temporary copy.
2012-07-20 01:36:02 +00:00
Adrian Chadd
9e38f70840 Create an ioctl API for fetching the current rate control information. 2012-07-20 01:27:20 +00:00
Adrian Chadd
dd9f5bba52 Prepare for (re)using this header file in userland.
Remove the inlined code from the header file if it's compiled in userland.
It's not required and it shouldn't be there in the first place.
2012-07-20 00:47:23 +00:00
Marius Strobl
6d36859855 Revert the use of BUS_DMA_ALLOCNOW when creating the DMA tag for user
data introduced in r236061. Using that flag doesn't make that much
sense on this case as the DMA maps using it are also created during
sym_pci_attach(). Moreover, due to the maxsegsz parameter used, doing
so may exhaust the bounce pages pool on architectures requiring
bounce pages. [1]
While at it, use a slightly more appropriate maxsegsz parameter.

PR:		169526
Submitted by:	Mike Watters [1]
MFC after:	3 days
2012-07-19 14:43:46 +00:00
Adrian Chadd
bb06995571 Convert the TX path to use the new HAL methods for accessing the
TX descriptor link pointers.

This is required for the AR93xx and later chipsets.

The RX path is slightly different - the legacy RX path directly
accesses ath_desc->ds_link for now, however this isn't at all done
for EDMA (FIFO) RX.

Now, for those performing a little software archeology here:

This is all a bit sub-optimal. "struct ath_desc" is only really relevant
for the pre-AR93xx NICs - where ds_link and ds_data is always in the
same location.

The AR93xx and later NICs have different descriptor layouts altogether.

Now, for AR93xx and later NICs, you should never directly reference
ds_link and ds_data, as:

* the RX descriptors don't have either - the data is _after_ the RX
  descriptor.  They're just one large buffer.  There's also no need for
  a per-descriptor RX buffer size as they're all fixed sizes.

* the TX descriptors have 4 buffer and 4 length fields _and_ a link
  pointer.  Each frame takes up one TX FIFO pointer, but it can contain
  multiple subframes (either multiple frames in a buffer, and/or
  multiple frames in an aggregate/RIFS burst.)

* .. so, when TX frames are queued to a hardware queue, the link
  pointer is ONLY for buffers in that frame/aggregate.  The next frame
  starts in a new FIFO pointer.

* Finally, descriptor completion status is in a different ring.
  I'll write something up about that when its time to do so.

This was inspired by Linux ath9k and the reference driver but is a
reimplementation.

Obtained from:	Linux ath9k, Qualcomm Atheros
2012-07-19 03:51:16 +00:00
Adrian Chadd
661deb68d5 Use HAL_NUM_RX_QUEUES rather than a magic constant. 2012-07-19 03:18:15 +00:00
Adrian Chadd
ad3e6dcd37 Break out the TX descriptor link field into HAL methods.
The DMA FIFO chips (AR93xx and later) differ slightly to th elegacy
chips:

* The RX DMA descriptors don't have a ds_link field;
* The TX DMA descriptors have a ds_link field however at a different
  offset.

This is a reimplementation based on what the reference driver and ath9k
does.

A subsequent commit will enable it in the TX and beacon paths.

Obtained from:	Linux ath9k, Qualcomm Atheros
2012-07-19 02:25:14 +00:00
Sean Bruno
ce61627a2d On BIO_ERROR, set bio_resid to stop losing data in the error case.
Submitted by:	Mark Johnston <markjdb@gmail.com>
Reviewed by:	scottl@freebsd.org
MFC after:	2 weeks
2012-07-18 18:10:27 +00:00
Christian Brueffer
1d50dd1f08 Fix a small memory leak in mpssas_get_sata_identify(). The change has been
submitted upstream as well.

Reviewed by:	ken, scottl
Obtained from:	DragonFly BSD (change df8658e030226dd015cff9749452666d8fe1e87b)
MFC after:	5 days
2012-07-18 09:06:07 +00:00
Alexander Motin
f4f6d5e0ab For Intel Panther/Lynx Point USB 3.0 xHCI controllers enable SuperSpeed USB
capability and reroute USB 2.0 ports to the xHCI controller.

Reviewed by:	hselasky
2012-07-17 14:03:04 +00:00
Hans Petter Selasky
c6b5a9a02b Add new USB device ID.
PR:		usb/169789
Submitted by:	Ruslan Bukin
MFC after:	1 week
2012-07-16 10:12:07 +00:00
Hans Petter Selasky
6446f79981 Add new USB device ID.
PR:		usb/169789
MFC after:	1 week
2012-07-16 09:35:47 +00:00
Adrian Chadd
c7f5bb7a4f Handle RX Keymiss events.
The AR9003 series NICs implement a separate RX error to signal that a
Keycache miss occured.  The earlier NICs would not set the key index
valid bit.

I'll dig into the difference between "no key index bit set" and "keycache
miss".
2012-07-15 20:51:41 +00:00
Adrian Chadd
29edf89eaa Log the number of handled decsriptors and valid descriptors when
hitting RXEOL.
2012-07-15 20:48:21 +00:00
Hans Petter Selasky
48804d9c0e Add new USB device ID.
PR:		usb/169789
MFC after:	1 week
2012-07-15 18:12:09 +00:00
Christian Brueffer
80ad0053bc Fix typo in a message.
Obtained from:	DragonFly BSD (change 7a817ab191e4898404a9037c55850e47d177308c)
MFC after:	3 days
2012-07-15 14:40:49 +00:00
Rui Paulo
63490e32b2 The JP1082 device doesn't respond to the MII_BMSR command and it turns
out that it has an unusable PHY. It still works, although very slowly,
without a PHY, so I implemented non-PHY support in the udav driver.
2012-07-15 05:49:02 +00:00
Adrian Chadd
7e3fc039f6 Fix build breakage when one isn't building with IEEE80211_SUPPORT_SUPERG.
Noticed by:	mav
2012-07-14 12:15:20 +00:00
Adrian Chadd
2e7620b6d2 Merge in some other features from the legacy RX path:
* wrap the RX proc calls in the RX refcount;
* call the DFS checking, fast frames staging and TX rescheduling if
  required.

TODO:

* figure out if I can just make "do TX rescheduling" mean "schedule
  TX taskqueue" ?
2012-07-14 07:56:47 +00:00
Adrian Chadd
9a5a667da4 Make sure that 'rs' is pointing to the correct RX status. 2012-07-14 05:53:03 +00:00
Adrian Chadd
b5b60f35b7 Ensure that error is set.
Noticed by:	rui
2012-07-14 05:51:54 +00:00
Adrian Chadd
0b59717b4b Change the RX EDMA path to first complete the FIFO, then re-populate it
with fresh descriptors, before handling the frames.

Wrap it all in the RX locks.

Since the FIFO is very shallow (16 for HP, 128 for LP) it needs to be
drained and replenished very quickly.  Ideally, I'll eventually move this
RX FIFO drain/fill into the interrupt handler, only deferring the actual
frame completion.
2012-07-14 02:52:48 +00:00
Adrian Chadd
8d467c41b0 Don't free the descriptor allocation/map if it doesn't exist.
I missed this in my previous commit.
2012-07-14 02:47:16 +00:00
Adrian Chadd
2fe91baa92 Create an RX queue lock.
Ideally these locks would go away and there'd be a single driver lock,
like what iwn(4) does.  I'll worry about that later.
2012-07-14 02:22:17 +00:00
Adrian Chadd
39abbd9bd2 Fix EDMA RX to actually work without panicing the machine.
I was setting up the RX EDMA buffer to be 4096 bytes rather than the
RX data buffer portion.  The hardware was likely getting very confused
and DMAing descriptor portions into places it shouldn't, leading to
memory corruption and occasional panics.

Whilst here, don't bother allocating descriptors for the RX EDMA case.
We don't use those descriptors. Instead, just allocate ath_buf entries.
2012-07-14 02:07:51 +00:00
Andriy Gapon
d30b88af05 acpi_cpu: separate a notion of current deepest allowed+available Cx level
... from a user-set persistent limit on the said level.
Allow to set the user-imposed limit below current deepest available level
as the available levels may be dynamically changed by ACPI platform
in both directions.
Allow "Cmax" as an input value for cx_lowest sysctls to mean that there
is not limit and OS can use all available C-states.
Retire global cpu_cx_count as it no longer serves any meaningful
purpose.

Reviewed by:	jhb, gianni, sbruno
Tested by:	sbruno, Vitaly Magerya <vmagerya@gmail.com>
MFC after:	2 weeks
2012-07-13 08:11:55 +00:00
Sean Bruno
cf72e8934e sys/dev/mfivar.h contains references to MFI_DEBUG, but it never gets turned on unless the file also includes opt_mfi.h.
Submitted by:	Andrew Boyer aboyer@averesystems.com
MFC after:	2 weeks
2012-07-11 19:08:23 +00:00
Sean Bruno
dfcbfdbb90 When an MFI command fails, the driver needs to set bio->bio_resid so that
the upper levels notice.  Otherwise we see commands silently failing leading
to data corruption.  This mirrors dadone()

Submitted by:	Andrew Boyer aboyer@averesystems.com
Reviewed by:	scottl@freebsd.org
MFC after:	2 weeks
2012-07-11 18:16:54 +00:00
John Baldwin
f5afad7389 Cast a bus address to a uintmax_t for a debug printf to fix the build on
arm.
2012-07-11 15:04:20 +00:00
John Baldwin
ba59181d1c Map ATH_KTR_* to 0 when ATH_DEBUG is not defined. This effectively NOPs
out their use in that case.
2012-07-11 12:10:13 +00:00
Hiroki Sato
89b4ba9934 Merge from r234532:
- Fix an ifname matching issue which prevented "ifconfig wlan0 create" from
  working.
- Return non-zero status when unit < 0.

Spotted by:	dhw
2012-07-11 02:57:32 +00:00
Peter Grehan
310dacd09b Various VirtIO improvements
PCI:
        - Properly handle interrupt fallback from MSIX to MSI to legacy.
          The host may not have sufficient resources to support MSIX,
          so we must be able to fallback to legacy interrupts.
        - Add interface to get the (sub) vendor and device IDs.
        - Rename flags to VTPCI_FLAG_* like other VirtIO drivers.
      Block:
        - No longer allocate vtblk_requests from separate UMA zone.
          malloc(9) from M_DEVBUF is sufficient. Assert segment counts
          at allocation.
        - More verbose error and debug messages.
      Network:
        - Remove stray write once variable.
      Virtqueue:
        - Shuffle code around in preparation of converting the mb()s to
          the appropriate atomic(9) operations.
        - Only walk the descriptor chain when freeing if INVARIANTS is
          defined since the result is only KASSERT()ed.

Submitted by:	Bryan Venteicher (bryanv@daemoninthecloset.org)
2012-07-11 02:57:19 +00:00
John Baldwin
0f078d635e Fix build when ATH_DEBUG is not defined. 2012-07-10 18:57:05 +00:00
Adrian Chadd
be4a8356bc Commit missing flags for the high/low priority (HP/LP) RX queues.
Noticed by:	everyone
2012-07-10 18:30:20 +00:00
Adrian Chadd
fda21122d0 Add some debugging and comments about what's going on when reinitialising
the FIFO.

I still see some corner cases where no RX occurs when it should be
occuring.  It's quite possible that there's a subtle race condition
somewhere; or maybe I'm not programming the RX queues right.

There's also no locking here yet, so any reset/configuration path
state change (ie, enabling/disabling receive from the ioctl, net80211
taskqueue, etc) could quite possibly confuse things.
2012-07-10 07:45:47 +00:00