Commit Graph

21608 Commits

Author SHA1 Message Date
Justin T. Gibbs
8577146eac Fix bug in the netfront driver that caused excessive packet drops during
receive processing.

Remove unnecessary restrictions on the mbuf chain length built during an
LRO receive.  This restriction was copied from the Linux netfront driver
where the LRO implementation cannot handle more than 18 discontinuities.
The FreeBSD implementation has no such restriction.

MFC after: 1 week
2011-01-29 02:36:45 +00:00
Andrew Turner
c8045145b7 Use bus space functions rather than inw/outw
to help a future port of the driver to ARM.

Approved by:	imp (mentor)
2011-01-29 00:53:58 +00:00
Marcel Moolenaar
df0437ca6f Don't use the MAC address in the device tree if it's all zeroes
(i.e. 00-00-00-00-00-00). Use the currently programmed address
instead.

While here, simplify the function.
2011-01-28 23:40:13 +00:00
Pyun YongHyeon
f69ddfbb5f Fix logic error. Due to the bug, it incorrectly checked TXQ status
which in turn can leave TXQ active.

Submitted by:	Brad ( brad <> comstyle dot com )
MFC after:	3 days
2011-01-28 21:03:32 +00:00
Adrian Chadd
a6a308a4df (Mostly) teach ath_rate_sample about MCS rates.
This is just the bare minimum needed to teach ath_rate_sample to try
and handle MCS rates. It doesn't at all attempt to find the best
rate by any means - it doesn't know anything about the MCS rate
relations, TX aggregation or any of the much sexier 11n stuff
that's out there.

It's just enough to transmit 11n frames and handle TX completion.

It shouldn't affect legacy (11abg) behaviour.

Obtained from:	rpaulo@
2011-01-28 08:57:58 +00:00
Adrian Chadd
064e40d0ab Make space for the extended 802.11n MCS rate tables. 2011-01-28 08:45:19 +00:00
Adrian Chadd
d054f3a866 Bring in some 802.11n packet duration calculation functions from a mix of Sam/Rui and linux ath9k .
This will eventually be used by rate control modules and by the TX
code for calculating packet duration when handling rts/cts protection.

Obtained from:	sam@, rpaulo@, linux ath9k
2011-01-28 08:35:55 +00:00
Konstantin Belousov
4a13a769dc Add support for BIO_DELETE on swap-backed md(4). In the case of BIO_DELETE
covering the whole page, free the page. Otherwise, clear the region and
mark it clean. Not marking the page dirty could reinstantiate cleared
data, but it is allowed by BIO_DELETE specification and saves unneeded
write to swap.

Reviewed by:	alc
Tested by:	pho
MFC after:	2 weeks
2011-01-27 16:10:25 +00:00
Adrian Chadd
0fafe07ff3 Initialise the chainmask from the EEPROM rather than the hard-coded defaults.
The defaults enabled three chains on the AR5416 even if the card has two
chains. This restores that and ensures that only the correct TX/RX
chainmasks are used.

When HT modes are enabled, all TX chains will be correctly enabled.

This should now enable analog chain swapping with 2-chain cards.
I'm not sure if this is needed for just the AR5416 or whether
it also applies to AR9160, AR9280 and AR9287 (later on); I'll have
to get clarification.
2011-01-27 09:26:37 +00:00
Adrian Chadd
4ceb85596b Add missing getCapability call for AR5416. 2011-01-27 08:42:50 +00:00
Adrian Chadd
51fcc8350c Make a note to re-check whether that particular check is needed. 2011-01-27 07:33:17 +00:00
Adrian Chadd
6ef699a0a6 Writing to the analog registers on the AR9220 (Merlin PCI) seems to require a delay.
This, along with an initval change which will appear in a subsequent commit,
fixes bus panics that I have been seing with the AR9220 on a Routerstation Pro
(AR7161 MIPS board.)

Obtained from: Linux ath9k
PR: kern/154220
2011-01-27 02:56:03 +00:00
Matthew D Fleming
00f0e671ff Explicitly wire the user buffer rather than doing it implicitly in
sbuf_new_for_sysctl(9).  This allows using an sbuf with a SYSCTL_OUT
drain for extremely large amounts of data where the caller knows that
appropriate references are held, and sleeping is not an issue.

Inspired by:	rwatson
2011-01-27 00:34:12 +00:00
Pyun YongHyeon
54899a96e1 Add support for RTL8105E PCIe Fast Ethernet controller. It seems
the controller has a kind of embedded controller/memory and vendor
applies a large set of magic code via undocumented PHY registers in
device initialization stage. I guess it's a firmware image for the
embedded controller in RTL8105E since the code is too big compared
to other DSP fixups. However I have no idea what that magic code
does and what's purpose of the embedded controller. Fortunately
driver seems to still work without loading the firmware.

While I'm here change device description of RTL810xE controller.

H/W donated by:	Realtek Semiconductor Corp.
2011-01-26 21:14:20 +00:00
Pyun YongHyeon
ed072c9d1a Add Realtek RTL8201E 10/100 PHY found in RTL8105E controller. The
exact model name is not clear yet. All previous RTL8201 10/100 PHYs
used 0x8201 in MII_PHYIDR2 which in turn makes model number 0x20
but this PHY used new model number 0x08.
2011-01-26 21:07:44 +00:00
Pyun YongHyeon
502be0f749 Do not use interrupt taskqueue on controllers with MSI/MSI-X
capability. One of reason using interrupt taskqueue in re(4) was
to reduce number of TX/RX interrupts under load because re(4)
controllers have no good TX/RX interrupt moderation mechanism.
Basic TX interrupt moderation is done by hardware for most
controllers but RX interrupt moderation through undocumented
register showed poor RX performance so it was disabled in r215025.
Using taskqueue to handle RX interrupt greatly reduced number of
interrupts but re(4) consumed all available CPU cycles to run the
taskqueue under high TX/RX network load.  This can happen even with
RTL810x fast ethernet controller and I believe this is not
acceptable for most systems.

To mitigate the issue, use one-shot timer register to moderate RX
interrupts. The timer register provides programmable one-shot timer
and can be used to suppress interrupt generation. The timer runs at
125MHZ on PCIe controllers so the minimum time allowed for the
timer is 8ns. Data sheet says the register is 32 bits but
experimentation shows only lower 13 bits are valid so maximum time
that can be programmed is 65.528us. This yields theoretical maximum
number of RX interrupts that could be generated per second is about
15260. Combined with TX completion interrupts re(4) shall generate
less than 20k interrupts. This number is still slightly high
compared to other intelligent ethernet controllers but system is
very responsive even under high network load.

Introduce sysctl variable dev.re.%d.int_rx_mod that controls amount
of time to delay RX interrupt processing in units of us. Value 0
completely disables RX interrupt moderation. To provide old
behavior for controllers that have MSI/MSI-X capability, introduce
a new tunable hw.re.intr_filter. If the tunable is set to non-zero
value, driver will use interrupt taskqueue. The default value of
the tunable is 0. This tunable has no effect on controllers that
has no MSI/MSI-X capability or if MSI/MSI-X is explicitly disabled
by administrator.

While I'm here cleanup interrupt setup/teardown since re(4) uses
single MSI/MSI-X message at this moment.
2011-01-26 20:25:40 +00:00
Alexander Motin
7f63cad89e Add missing part of r217877. 2011-01-26 13:10:07 +00:00
Adrian Chadd
f68a9f06e1 Add ar5416RestoreChainMask() which will undo any AR5416 specific chainmask
overriding after calibration.

This will get set for other two chain radios, such as AR9280 and later on,
AR9287. It should however be a nul operation.
2011-01-26 10:48:29 +00:00
Adrian Chadd
b868c6d0b1 Add an AR5416 workaround - force a different bias based on 2.4ghz channel frequency.
Obtained from:	Linux ath9k
2011-01-26 10:36:43 +00:00
Adrian Chadd
60a507a514 Break out the chainmask init code into a new function - ar5416InitChainMasks() .
ath9k does a few different things here during config - if it's an early
AR5416 with two chains, it enables all three chains for calibration and
then restores the chainmask to the original values after initial
calibration has completed.

The reason behind this commit is to begin breaking out the chainmask
configuration for this specific reason; follow-up commits will add
the chainmask restore in the ar5416Reset() routine.
2011-01-26 10:08:37 +00:00
Adrian Chadd
5a2def3a5e * fix HAL_DEBUG_INTERRUPT to be a separate bit, it was overlapping with
something else
* add HAL_DEBUG_GPIO, for some GPIO related debugging I'm tinkering with
  at the moment.
2011-01-26 09:37:43 +00:00
Alexander Motin
a59641a90d Hardware supported by siis(4) allows software control over activity LEDs.
Expose that functionality to led(4) OR-ing it with regular LED activity.
2011-01-26 08:54:10 +00:00
Pyun YongHyeon
d180a66f19 Remove TX taskqueue and directly invoke re_start in interrupt task. 2011-01-25 23:27:28 +00:00
Pyun YongHyeon
4a58fd452a Prefer MSI-X to MSI on controllers that support MSI-X. All
recent PCIe controllers(RTL8102E or later and RTL8168/8111C or
later) supports either 2 or 4 MSI-X messages. Unfortunately vendor
did not publicly release RSS related information yet. However
switching to MSI-X is one-step forward to support RSS.
2011-01-25 22:18:00 +00:00
Pyun YongHyeon
f9ad4da76d Disable TSO for all Realtek controllers. Experimentation showed
RTL8111C generated corrupted frames where TCP option header was
broken. All other sample controllers I have did not show such
problem so it could be RTL8111C specific issue. Because there are
too many variants it's hard to tell how many controllers have such
issue. Just disable TSO by default but have user override it.
2011-01-25 19:05:46 +00:00
Konstantin Belousov
96410b9575 Bio shall not be accessed after g_io_deliver(9).
Reported and tested by:	pho
Reviewed by:	ae, phk
MFC after:	1 week
2011-01-25 14:00:30 +00:00
Adrian Chadd
3545027dc3 * Re-format the v4k header to be consistent
* Re-do the structure size/component math to make sure the struct matches
  the expected size
* Just to be clear that we care about bitmask ordering, revert my previous
  change and instead define that macro if we're on big-endian.
2011-01-25 07:37:12 +00:00
Adrian Chadd
6468b2baa5 Bring over a fix from ath9k - zero some of the TX descriptors for Kite/AR9285.
Kite doesn't have per-chain control (it has one chain) or antenna control; so
don't try to set those descriptor entries.
2011-01-25 05:47:50 +00:00
Adrian Chadd
2b020858f9 Rename this linux-ism __BIG_ENDIAN_BITFIELD macro to something suitable for FreeBSD.
Warner has pointed out that FreeBSD's bit orders follow byte orders.
2011-01-25 05:41:36 +00:00
Adrian Chadd
d55a8a09e8 Commit updated AR9285 (Kite) v2 initvals from ath9k. 2011-01-25 05:36:29 +00:00
Adrian Chadd
fb14f71662 Fix the Atheros V4K EEPROM definitions to match those in ath9k.
It turns out that the V4K eeprom definitions (used by the AR9285 and
its derivatives) is wrong. These values are at least causing issues
on my AR2427.

With this fix (and initvals in a subsequent commit), the AR2427 behaves
a lot better.

Note - there's still significant drift between the ath9k v4k eeprom
init code (again, used by AR9285 and derivatives) and what's in this
tree. That needs to be investigated and resolved.
2011-01-25 05:35:09 +00:00
Marcel Moolenaar
f1fb96475a In uart_tty_outwakeup(), check CTS/RTS flow control settings and
prevent sending data when CTS is de-asserted.
In uart_tty_intr(), call uart_tty_outwakeup() when the CTS signal
changed, knowing that uart_tty_outwakeup() will do the right
thing for flow control. This avoids redundant conditionals.

PR:		kern/148644
Submitted by:	John Wehle <john@feith.com>
MFC after:	3 days
2011-01-24 18:34:16 +00:00
Pyun YongHyeon
4de89d86cd Reinitialize driver when MTU is changed and driver is running.
Reported by:	Huang, Yusheng ( yusheng.huang <> bluecoat com )
2011-01-24 17:53:58 +00:00
Hans Petter Selasky
99f017d21b Add more sanity checks for USB_HOST_ALIGN input values. Re-factor existing
checks for readability.

Approved by:	thompsa (mentor)
2011-01-24 17:38:37 +00:00
Adrian Chadd
514539dcbd Remove an invalid register setup; this is likely a holdover from
the AR5212 code. It doesn't exist in ath9k and I've been told it
doesn't exist in the Atheros internal driver.
2011-01-24 17:03:22 +00:00
Alexander Motin
f1bfc8aba8 ICH7 SATA controller in legacy mode can provide access to SATA registers
via AHCI-like memory resource at BAR(5). Use it if BIOS was so kind to
allocate memory for that BAR. This allows hot-plug support and connection
speed reporting.

MFC after:	2 weeks
2011-01-24 09:24:20 +00:00
Pyun YongHyeon
7be4de2de7 Apply TX interrupt moderation to all RTL810xE PCIe Fast Ethernet
controllers. Experimentation with RTL8102E, RTL8103E and RTL8105E
showed dramatic decrement of TX completion interrupts under high TX
load(e.g.  from 147k interrupts/second to 10k interrupts/second)
With this change, TX interrupt moderation is applied to all
controllers except RTL8139C+.
2011-01-24 00:01:06 +00:00
Adrian Chadd
d8d0c29db8 Enable the 11n PHY by default whether or not 11n is configured.
The linux ath9k driver and (from what I've been told) the atheros reference
driver does this; it then leaves discarding 11n frames to the 802.11 layer.

Whilst I'm here, merge in a fix from ath9k which maintains a turbo register
setting when enabling the 11n register; and remove an un-needed (duplicate)
flag setting.
2011-01-23 14:49:50 +00:00
Adrian Chadd
69d1f737f8 Update the AR9280v2 inivals to match what is in Linux ath9k.
This repairs the behaviour of my AR9280 - both radio chains now seem
to correctly be receiving.
2011-01-23 14:30:35 +00:00
Andrew Thompson
d929b72e23 Revert the ndis part of r212122, windrv_stub.c already adds a MODULE_VERSION
and this breaks loading miniport drivers from loader.conf

Reported by:	Yuri <yuri^rawbw^com>
Submitted by:	Paul B Mahol
MFC after:	3 days
2011-01-22 21:33:18 +00:00
Hans Petter Selasky
d8d1becfdd Allow USB_HOST_ALIGN to be configured at compile time. This patch is
necessary for MIPS based RouterStation Pro board and maybe other MIPS
based boards as well.

Submitted by:	Milan Obuch
Approved by:	thompsa (mentor)
2011-01-22 13:52:23 +00:00
Jack F Vogel
7d5f64a903 Don't bother to run the flowcontrol code if there
is no change. Thanks to Andrew for the tweak.
2011-01-22 00:19:15 +00:00
Jack F Vogel
1d4e0b19e4 Missing case for 82598DA type adapter, thanks Andrew. 2011-01-22 00:08:06 +00:00
Jack F Vogel
c6f98cde15 Leftover bogus TX UNLOCK removed. Thanks to
Andrew Boyer.
2011-01-21 23:55:28 +00:00
Adrian Chadd
409daaf37b Fix some typos. 2011-01-21 07:28:48 +00:00
Adrian Chadd
25580e3f63 Add missing getCapability call for AR5416. 2011-01-21 07:26:53 +00:00
Adrian Chadd
a5314ffdf0 Modify the v14/v4k eeprom diag interface to return the whole eeprom.
The v1 and v3 interfaces returned the whole EEPROM but the v14/v4k
interfaces just returned the base header. There's extra information
outside of that which would also be nice to get access to.
2011-01-21 06:42:25 +00:00
Adrian Chadd
a108ab6394 ANI changes #1 - split out the ANI polling from the RxMonitor hook.
The rxmonitor hook is called on each received packet. This can get very,
very busy as the tx/rx/chanbusy registers are thus read each time a packet
is received.

Instead, shuffle out the true per-packet processing which is needed and move
the rest of the ANI processing into a periodic event which runs every 100ms
by default.
2011-01-21 05:21:00 +00:00
Pyun YongHyeon
c27d7a76fc Correct wrong definition of PM timer mask and adjust L1/PM timer
value. While I'm here enable all clocks before initializing
controller. This change should fix lockup issue seen on AR8152
v1.1 PCIe Fast Ethernet controller.

PR:	kern/154076
MFC after:	3 days
2011-01-20 18:26:33 +00:00
Adrian Chadd
1e659efff7 ar9280SetAntennaSwitch() was using the AR5416 chainmasks (3 chains)
rather than the AR9280 chainmasks (2 chains)
2011-01-20 15:09:11 +00:00